Older blog entries for asmodai (starting at number 48)

PyCharm 1.1.1 released

PyCharm 1.1.1 was released yesterday. It consists mostly of bugfixes, find the full release notes on their site.

Syndicated 2011-01-20 12:31:33 from In Nomine - The Lotus Land

Mercurial 1.7, cacerts, and FreeBSD

So with recent Mercurial 1.7 releases HTTPS support was tightened, so you are bound to encounter a warning in the form of: warning: bitbucket.org certificate not verified (check web.cacerts config setting).

Now, on http://mercurial.selenic.com/wiki/CACertificates there are details on what to configure for certain operating systems. Given I use FreeBSD, I altered my $HOME/.hgrc as follows:

[web]
cacerts = /etc/ssl/cert.pem

For OpenBSD this should be in the same place since release 3.8. But apparently NetBSD does not have such a file in base.

Syndicated 2011-01-07 14:05:19 from In Nomine - The Lotus Land

PyCharm and external lint tools

PyCharm already has a number of features present in various tools to lint/check your source code with, but offers a way to hook up external tools. Under File > Settings is a section called IDE Settings. One of the headings here is called External Tools. Select this heading and then press the Add... button on the right hand pane to configure a new external tool.

In the Edit Tool window that now appeared fill in a name, e.g. PEP8 and a group name Lint and add a description. Next point the Program to the location of the pep8.exe executable, e.g. C:\Python27\Scripts\pep8.exe. For Parameters you need to use $FilePath and Working directory should be filled in by default. Once done, you can close it by pressing the OK button.

Now, pyflakes has no .exe or .bat file to accompany it. You will need to add a pyflakes.bat in your Scripts directory inside Python with the following contents:

@echo off
rem Use python to execute the python script having the same name as this batch
rem file, but without any extension, located in the same directory as this
rem batch file
python "%~dpn0" %*

Within PyCharm you follow largely the same settings as for pep8, however make sure to point to the batch file of pyflakes under Program. Close the external tools configuration windows by clicking OK twice. Under the menu heading Tools you should see an submenu heading Lint which, in turn, should contain two menu items: PEP8 and Pyflakes.

Now open a Python file, go to Tools > Lint > PEP8 and you should get output like the following in your Run (4) window:

D:\Python26\Scripts\pep8.exe D:\pprojects\babel\babel\tests\__init__.py
D:\pprojects\babel\babel\tests\__init__.py:16:1: E302 expected 2 blank lines, found 1

Process finished with exit code 1

Syndicated 2010-12-14 12:49:33 from In Nomine - The Lotus Land

svn switch in Mercurial (hg)

For my own sanity:

In order to change the parent repository URL of a Mercurial clone (as svn switch does) one simply edits .hg/hgrc and adjusts the default under [paths].

Syndicated 2010-11-29 12:36:42 from In Nomine - The Lotus Land

PyCharm 1.0

So I was so impressed by PyCharm that I purchased a license. I haven’t noticed much of any delays or slowdowns that other people have complained about.

Syndicated 2010-10-25 10:04:11 from In Nomine - The Lotus Land

On the topic of sensible date and temperature defaults in applications and websites

Something that can always get me a bit frustrated is the choice of defaults used in applications.

Dates: Aside from Belize, Canada, the Federated States of Micronesia, Palau, the Philippines, and the United States are the only countries using a date format where the month is the first entry, followed by day, and lastly year (mm/dd/yyyy). To put to numbers that’s about 436 million people who use this versus 6.35 billion that don’t (ratio of about 14:1). Of that 6.35 billion about 3.8 billion use a date format where day is first, followed by month, and lastly year (dd/mm/yyyy — ratio of about 9:1 to the month first users). About 1.81 billion use a form where the year is first, followed by month, and lastly day (yyyy/mm/dd, roughly equivalent to ISO 8601 — ratio of about 4:1 to the month first users). (Note: these 1.81 billion have a slight overlap with the 3.8 billion due to some countries having two date formatting forms in use or due to two or more distinct scripts with different date formatting styles.) So using a format where the month is first is only confusing for the majority of the world’s population. If you need a default date, use the ISO 8601 format — not only is it less ambiguous, it also allows for much better chronological sorting.

Temperature: Aside from Belize and the United States (I so far managed to find), the worldwide standard for temperature is Celcius, not Fahrenheit. If you are using Fahrenheit you are putting 6.48 billion people at a disadvantage solely against something like 313 million people. That’s a ratio of about 22:1, meaning you put 22 people at a disadvantage for every one person you are trying to please.

Disclaimer: do note that this of course only makes sense if you are appealing to an international audience. If you are just targetting a specific country you will of course default to what they use. On the other hand, properly fixing your code to be i18n-ready is the way to go anyway.

Syndicated 2010-06-19 17:59:01 from In Nomine - The Lotus Land

Predefined macros

So with the GNU compiler you can use the preprocessor to get a list of the predefined macros:

$ cpp -dM /dev/null

or if you prefer to invoke the preprocessor via gcc itself:

$ gcc -dM -E – < /dev/null

This should give you a list similar like:

#define __DBL_MIN_EXP__ (-1021)
#define __FLT_MIN__ 1.17549435e-38F
#define __DEC64_DEN__ 0.000000000000001E-383DD
#define __CHAR_BIT__ 8
#define __WCHAR_MAX__ 2147483647

For Microsoft’s Visual C++ compiler I have only found pages like:

For Intel’s C++ compiler I found the following page with predefined macros.

And I find this interesting page with a lot of different compilers and their predefined macros to identify them and their versions, if any.

Syndicated 2010-04-11 16:05:51 from In Nomine - The Lotus Land

CLDR 1.8 released

On the 17th the Common Language Data Runtime project at Unicode released version 1.8 of the CLDR.

CLDR 1.8 contains data for 186 languages and 159 territories: 501 locales in all. Version 1.8 of the repository contains over 22% more locale data than the previous release, with over 42,000 new or modified data items from over 300 different contributors.

Syndicated 2010-03-18 08:50:35 from In Nomine - The Lotus Land

Firefox 3.6 and the million proxy password popups

I needed to authenticate with a proxy today and with Firefox 3.6 I constantly got user/password dialog boxes. Of course, this is annoying. Some searching lead me to an article on the Mozilla support site which mentions a setting (which you can reach via about:config) named network.auth.force-generic-ntlm which, when set from false to true, fixes a lot of these popups.

Syndicated 2010-03-18 08:40:04 from In Nomine - The Lotus Land

39 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!