Skip to main content

Posts

Showing posts from July, 2011

small issue with hist

The left is the matplotlib plot - notice the slight rightward shift of the drawn histogram with respect to the solid black line. The right is the pdf produced from the same plot, which is exactly where it should be. Same deal, but with 'Agg' backend and printed to png

LyX + Mac + Math heavy document = keystone cops

LyX has a really nice online math type setting system. I have a math heavy document that I wanted to type up using LyX. Pretty soon I had the classic problem of any feedback system with feedback delay - oscillations. I would type something, it would take about a quarter of a second to update, I would move my mouse to click on a formula, it would take a quarter of a second to change state and by that time I would have clicked twice, the document would have scrolled, and the formula would change state again, because I had clicked somewhere else. Welp. Its back to good old latex and text editors for me. I don't mind the write-compile cycle. LyX is good for text documents, but for math, at least on mac, it is so sluggish, it is more annoying than anything. UPDATE: I have found texmaker to be a very nice IDE on mac.

Tracking down backup space hogs

Problem: Even though I haven't done many file changes the Time machine incremental backup is about 350 MB per flush (resulting in many GB per day for hourly backups). I don't generate THAT much work each day. Using Time Machine and Time Tracker to track down the culprits. Thunderbird: global-messages-db.sqlite (170.5 MiB) Firefox: urlclassifier3.sqlite (50.6 MiB) Cache 78.2 (MiB)

ipython + matplotlib crashing

I've been having this problem ever since I changed to 1.0.1. It's not clear if it is ipython's fault or matplotlib's fault. Today I got the first error message before segfault: objc[56139]: FREED(id): message removeFromSuperviewWithoutNeedingDisplay sent to freed object=0x19b37470 And Mac OS X error report: Date/Time: 2011-07-15 21:47:54.500 -0400 OS Version: Mac OS X 10.5.8 (9L30) Report Version: 6 Anonymous UUID: 655916BF-D521-48C5-B8A3-FBC5E5FA6683 Exception Type: EXC_BAD_INSTRUCTION (SIGILL) Exception Codes: 0x0000000000000001, 0x0000000000000000 Crashed Thread: 0 Application Specific Information: objc[56139]: FREED(id): message removeFromSuperviewWithoutNeedingDisplay sent to freed object=0x19b37470 Thread 0 Crashed: 0 libobjc.A.dylib 0x90595bfa _objc_error + 116 1 libobjc.A.dylib 0x90595c30 __objc_error + 52 2 libobjc.A.dylib 0x90594637 _freedHandler + 58 3 com.apple.CoreFoundation ...

Bug in STIX fonts

Grumble, grumble. MathML on Firefox on mac was going great guns, until I find that \mathcal{N} gives me garbage (but \mathcal{M} looks fine). I see from this bugreport , that this is an issue with the STIX fonts.

Making up a GET request in bottle

Problem: I'm using bottle for a desktop browser based app. I needed to call a page view from an action. The page view normally gets some parameters encoded in a GET request. Solution: The GET request can be faked by doing: request.GET.append(key, value) Since request.GET is just a dictionary.

subclipse, branching, merging etc.

Sometimes merge/branch will refuse to work, saying your resource is out of synch. Do an 'update' and then a 'commit'. After a rename or move + commit, subclipse will say resource is out of synch with the filesystem, just refresh,commit and continue pydev explorer does not show the .* project files. These need to be added to svnignore (or committed if you wish). Use the eclipse navigator to see these file switching a branch to be the trunk is annoying in svn: basically you have to move the folder over - so the current trunk has to be moved (possibly under branches with a new name) and the branch you want has to be moved over and renamed as trunk

Mac OS X MS Word and Equations

I like to compose my equations in LaTeX. I find it a lot faster than the click interface of MS Word's own equation editor. I type up my notes in a LaTeX format so I already have the equations and its a terrible inefficient duplication of work to hunt-n-click them into ms word. One solution is to print a pdf of all the equations, and then use the select tool in preview to copy the equation and then paste it into the word document. The advantage in mac os x is that the copy is in vector format, which means that the inserted equation does not behave as an image - becoming pixellated at the worst moments, but rather scales gracefully. That's gonna save me some time.

Pickling python classes

Ok, this is the first thing in Python I have found to be annoying and nonintuitive. When you pickle a class object you need to make sure that the module for the class is explicitly in scope and imported. I kept banging my head against this problem and only understood it after looking at this guy's blog . When you pickle a class object included in the pickle file is a coded import statement telling the interpreter which module to import to look for the definition of the class. This leads to the following gotcha: The following code will define a class, instantiate it and pickle it without problems #File class_a.py import cPickle class A: def __init__(self): self.x = 22 if __name__ == "__main__": a = A() cPickle.dump(a, open('obja.pkl','wb'), protocol=-1) print cPickle.dumps(a, protocol=0) Notice the stringification of the class : it begins with i__main__ Now, we run the following code to load the object from the pickle: import cPickl...

Hide the dock icon of a program when it is running

Go to the application's bundle (e.g. X11.app) and open the bundle contents. Navigate to Info.plist, open it with a text editor or plist editor. Add or change an item with the key "NSUIElement" and set its value to "1" (type = string). On relaunch of the application, its icon will not appear in the dock. This is usefull for apps like X11 which are servers and should be running in the background.