Thursday, July 29, 2010
Tuesday, June 1, 2010
ExWi Unite! ;)
The cafeteria bosses want to kick out Margrite (?, the red haired friendly older one) 6 months before her pension due to 'economic constraints' even so they wrote elsewhere, that they made good earnings in the last year!! WTF? Obviously a case of 'kick u out, get somebody cheaper=younger'. I wondered, if anybody would join a signature list to the cafeteria bosses, to stop this bullshit! Also, we could use this opportunity to complain about some 'worseprovements' they introduced after the change of ownership, like canceling the speaker phone etc.
Who is with me and would sign something like that?
Sunday, January 17, 2010
Intuitive division in Python
When one is hot-coding some idea, it is all about writing down an idea fast, not pretty (even so it's quite hard to write ugly code in Python due to its indental paradigm), not clean or precise, just trying out an idea.
It is then that it could happen to overlook that a division of 2 integer numbers is forcing an integer solution of this calculation (the underlying C-paradigm for divisions in Python is enforcing this), so 3/4 is 0, not 0.75, because one forgot to write something like 3/4.0 to enforce the floating point division.
Many errors in un-counted Python (and C) classes were caused by this intricacy, maybe even some good ideas have been discredited because the code produced weird results. And because of the caused frustrations, the Python inventors have decided to get rid of this, beginning with the 3.x versions of Python, so 3/4 is actually 0.75.
And because this was such a great idea, it was decided to make it available as an option in Python 2.x (before you judge this as a minor change, admit to yourself how often you have been caught by this bug!?).
So, to enable this 'safe' division in Python 2.x code, you have to write the following line before all other imports:
from __future__ import division
(thats 2 underscores in front AND behind the future)
Enjoy your hot-coding now! ;)
Thursday, December 31, 2009
Macbook Memory and Swap files tip
If you are like me, meaning (in this special case):
- don't like to reboot your Macbook and have it running for weeks,
- from time to time have some heavy computing sessions with dozens of progs running,
- realising, that OS X Snow Leopard still does not manage its memory efficiently, by for example releasing the many and huge swap files created for these heavy computing sessions after these programs have been closed, even so your memory monitor shows you, that you have plenty of free RAM left
- and you still don't want to reboot to remedy this problem (= OSX still using the swap files, even so it has free RAM).
- sudo purge
- sudo killall -HUP dynamic_pager
From the manpage of purge:
Purge can be used to approximate initial boot conditions with a cold disk buffer
cache for performance analysis. It does not affect anonymous memory that has been
allocated through malloc, vm_allocate, etc.
dynamic_pager is the prog responsible for the swap files on the Mac. This command is what you could call a 'friendly' kill, because it asks to 'HangUP' on the program, not just to terminate it.
I have tried it and so far it looks very efficient, and saved me already 1 or 2 reboots after only 1 day (of heavy computing.. ;)
Enjoy and Happy New Year to all my 2.3 readers.. ;)
Wednesday, December 9, 2009
Mac data analysis tip of the day
So, you have a lot of plots/images in a folder, but you now only want to look at some of them.
Fortunately, in a Terminal, you could easily 'grab' the right ones by shell globbing (=a form of pattern matching for you non-geeks out there), meaning:
Let's say you have plots/images ending in *.profile.png and *.histo.png, so you easily 'grab' only the profiles by ls *.profile.png, nothing easier than that, but how do you get Mac's Preview now to show this choice to you?
Well, as so often, Mac OS just does the right thing:
You type: 'open *.profile.png' and you get all plots/images nicely put into one Preview window.
A slight setback, but logical:
So far they are treated as single documents, so if you just hit Cmd-P to get a print of all your analyis work, you only get offered to print the currently-selected one.
Even a Cmd-A to select all does NOT change this completely, but is on the right track: After selecting all images you can use the File->Print Selected Images menu entry (Or Alt-Cmd-P) to do just that.
And of course with that you can now print again into a new PDF file to have your plots nicely saved all together.
So, I would call this 'efficiency-with-a-hickup', but nevertheless a much more workable and faster solution to produce a pdf out of a shell-globbed (you don't wanna mouse select every 2nd or 3rd image in your folder now, would you?) selection than possible under pure *nix or *doze..
(I timed it, took me rougly 20 seconds to get the pdf, and only because I couldn't decide nor type the resulting filename ;)
PS.: The way to combine/edit PDFs has slightly changed in SL, get the details here.
Wednesday, November 4, 2009
Using the space station: where does the US go from here?
With the International Space Station nearly completely assembled, attention now turns to how to best utilize it. Taylor Dinerman explains how that will depend on how much access scientists will have to it once the shuttle is retired.
.
.
.
.
A lot!
Monday, October 19, 2009
Subscribe to:
Posts (Atom)