Tuesday, July 31, 2012

Python and a GIL

I run recently into a very nice article that describes in an excellent way of what a GIL is and what it is not. So if you, as me run in to many GIL battles in your life, it is a good read. One thing to add, traditionally threads were introduced to do a parallel IO not a parallel computation, keep that in mind.

Friday, July 27, 2012

UTF8 support under Windows in SublimeText2

SublimeText2 has a great problem with guessing encoding under Windows system. It tries to use CP1252 instead of CP1250 (for my locals:)) by default. I strongly suggest installing a package manager for SublimeText2. And then installing a encoding helper plugin. I also recommend (If you are a Central-European nation) changing a fallback_encoding property in: Preferences->Settings- Default to a Central European (Windows 1250).
A list of possible values:
st_encodings_list = [
   "UTF-8",
   "UTF-8 with BOM",
   "UTF-16 LE",
   "UTF-16 LE with BOM",
   "UTF-16 BE",
   "UTF-16 BE with BOM",
   "Western (Windows 1252)",
   "Western (ISO 8859-1)",
   "Western (ISO 8859-3)",
   "Western (ISO 8859-15)",
   "Western (Mac Roman)",
   "DOS (CP 437)",
   "Arabic (Windows 1256)",
   "Arabic (ISO 8859-6)",
   "Baltic (Windows 1257)",
   "Baltic (ISO 8859-4)",
   "Celtic (ISO 8859-14)",
   "Central European (Windows 1250)",
   "Central European (ISO 8859-2)",
   "Cyrillic (Windows 1251)",
   "Cyrillic (Windows 866)",
   "Cyrillic (ISO 8859-5)",
   "Cyrillic (KOI8-R)",
   "Cyrillic (KOI8-U)",
   "Estonian (ISO 8859-13)",
   "Greek (Windows 1253)",
   "Greek (ISO 8859-7)",
   "Hebrew (Windows 1255)",
   "Hebrew (ISO 8859-8)",
   "Nordic (ISO 8859-10)",
   "Romanian (ISO 8859-16)",
   "Turkish (Windows 1254)",
   "Turkish (ISO 8859-9)",
   "Vietnamese (Windows 1258)",
   "Hexadecimal"
]

Wednesday, July 25, 2012

A good approximation of pi

Ah, yes, a really nice article about a Pi approximation.

Monday, July 16, 2012

PowerShell sending requests

From time to time, I have to generate a request to some web service for each element from a database. From a db I tend to generate a PowerShell commands to send a request:
$page = (New-Object System.Net.WebClient).DownloadString("http://localhost/")
And if one needs to know what was returned
Write-Host "$page"

Friday, July 13, 2012

Using PowerShell

I still keep using Unix tools underneath my GNU Emacs on windows, tools, like grep, sort, find. But, they need a configuration, and on Windows, they face specific problems :) On SO, there is a nice list of PoSh cmdlets that are an excellent replacement for my typical tasks.

Tuesday, July 10, 2012

The next JavaScript issue

This site becomes my diary of JavaScript problems that I fall into, or am aware of. The newest one is the infinity. In other words what is a result of:
parseInt(1 / 0, 19)
And why it is 18.

Monday, July 2, 2012

What tool use to write T4 templates

Each time, I work for a different company, I use a different tool, so far I believe the best is tangible t4, without modeling tools.