Skip to main content

Posts

Showing posts from March, 2008

PyScripter

Oooo, shiny. PyScripter is awesome. From my spoilt python brat wishlist we have: Tabbed interface like Notepad++ and SciTE [CHECK] Remember session like Notepad++ [CHECK] Code context like IDLE editor [And More CHECK] Line numbers like SciTE [duh, CHECK] Adjustable tabbing and smart indent like SciTE (And not like IDLE; shudder) [OK, can't figure this out, but at least it does not mess up my existing indenting] Autocompletion like IDLE [And More CHECK] Debugger would be nice, but IPython happens to be all I need right now for that [CHECK] Folding [Ok, this seems to be missing ] In addition the little things I noticed were: Picture of bug before file name in tab, when file has a parsing error. Sweet touch

Word 2007...

... They only inserted bugs in Word 2003 so that people would be so relieved when 2007 came along. Any how, exporting to pdf via Word 2007 was glitch free (for a 186 page thesis, with several figures). Thanks to Ben for the pointer to word 2007.

Diassembling a HDD

Old plastic is brittle You need to take off all the screws, some of which are hidden under the stickers [ here ] The lid of the HDD comes off very easily The HDD platter is SHINY . The magnets that are part of the head assembly are strong! Fun!

IDE for Python (II)

Following up on a previous post about IDEs for Python , my current wishlist would be: Tabbed interface like Notepad++ and SciTE Remember session like Notepad++ Code context like IDLE editor Line numbers like SciTE Adjustable tabbing and smart indent like SciTE (And not like IDLE; shudder) Autocompletion like IDLE Debugger would be nice, but IPython happens to be all I need right now for that I'm gonna try out pyscripter ...

Inkscape + matplotlib's svg = one strange love child

Heh, heh. Just when my analysis was coming along at a nice clip... Here is part of figure1 (png shot of) Here is part of fig2 And here is what happens when I copy fig2 and paste it into fig1 Note that the above figure should look exactly like fig2... I LOVE Inkscape, I LOVE matplotlib, and I'm attached to my toolchain , I hope this can be fixed. UPDATE: See this thread Mike has fixed the problem is SVN - you should replace the backend_svg.py with the one linked in Mike's post.

matplotlib : subplot with polar

Polar plots in matplotlib are generated using the polar(theta, R) command. The source for this command is simply (from the amazing '??' feature of IPython): In [37]: m.polar?? Type: function Base Class: String Form: Namespace: Interactive File: c:\python25\lib\site-packages\matplotlib-0.91.2-py2.5-win32.egg\ matplotlib\pyplot.py Definition: m.polar(*args, **kwargs) Source: def polar(*args, **kwargs): """ POLAR(theta, r) Make a polar plot. Multiple theta, r arguments are supported, with format strings, as in plot. """ ax = gca(polar=True) ret = ax.plot(*args, **kwargs) draw_if_interactive() return ret In order to make a subplot polar we simply add the polar=True argument thus: m.subplot(nrows, ncols, nsubfig, polar=True ) Otherwise, it is treated as a cartesian plot even if you do m.polar(..) afterwards.

Set figure size

In matplotlib you set figure size as follows [ from here ]: import pylab as m f = m.figure() f.set_size_inches((2,6)) which will make the figure 2in wide and 6in tall which works at least for SVG export

Should I move RRiki from Ruby(Rails) to Python?

It boils down to Rails automagically uses the database contents to create an interface, in the other frameworks you have to explcitly create a database in the code. I use Python for computing, why not use it for note taking too. Comparison of Rails and Django. [ bright-green ] Possible Python frameworks: web2py . - no configuration/install to use, can be used from a USB drive. After a laptop crash that option looks tempting..., has migrations which Django doesn't. UPDATE: I'm not moving for now due to time constraints. I will at most look into using SQlite, instead of MySQL

Firefox and thunderbird profiles

The great thing about firefox and thunderbird is that they store their whole state (histories, bookmarks etc.) in folders and you can choose where the folder is located. I just put this with the rest of my junk that gets backed up regularly, so if I need to reinstall windows, I just point thunderbird and firefox to my profiles folder and I get everything back, including extensions, just like nothing happened. Firefox and Thunderbird need their profiles.ini file modified [firefox help here and here , thunderbird help here ]

Vista, HP DV2210us freezes at start of waking from sleep/hibernation

[also see this ] This is a HP dv2210us which has a Go 6150 graphics card. From this microsoft knowledge base entry , assuming that this card has a PCI-E bus (NVIDIA tech specs ), I need this hotfix . The hot fix doesn't work for me. The computer is now such that it will not boot up easily - it gets stuck at a blank screen whenever I switch it on. I have to coax it to get past what ever is stopping it by hitting f8 and catching it at the right boot phase. I'm gonna wipe the hibernation file and see if that works. No I do get an error - \boot\memtest.exe 0xc0000221 file possibly corrupt, header checksum does not match the computed checksum. I think I will restore the computer to the factory default (yes, I do not have vista disks, thank you HP and Microsoft). 2008.03.18: I think the computer has a problem shutting down when it is asked to restart. 2008.03.22: Apparently the HP service techs know about this problem and will fix it since it is under warranty. They promise delivery ...

Apartment complexes in the Boston suburbs

Went apartment hunting in expensive Boston. Windsor Village at Waltham [ web ]. 10min drive from Alewife station on the red line. They have awesome two storied units, like little town houses with patios, on a hilly country side. Very pretty in the snow. About $1900/month without utilities. They have a week day shuttle from the complex to Alewife. Commuting to Boston is a hassle because of the two step process. Avalon at Lexington Hills [ web ]. 15 min drive from Alewife station on the red line. They have very nice huge (1300 sq ft) two bedrooms costing about $2200/month without utilities. They have a week day shuttle from the complex to Alewife. Commuting to Boston is a hassle because of the two step process. They need you to have a cheap renters insurance, they have covered parking. Overlook ridge, revere [ web ]. Reasonable units, some with a view of the old quarry. We saw a sunny 2 bedrrom. They have a pool room and a yoga room. They have a shuttle to Malden ctr T, and a shuttle t...

USB drive won't remove : Optimizing TSVN cache

External USB drive, won't eject (remove safely), says its busy. Running fsutil does not help. Running process explorer (as admin) shows that TSVNcache.exe is holding onto folders I've recently accessed, even though I have closed the folder. What's up? From here we see that this is from the Totoise SVN client and it is the process that puts those nice SVN icons on the folders. This webpage also tells us how to prevent TSVN from running on all folders and only on those we store our code in: Go to SVN settings/Look and feel/Icons and set the exclude paths (or include paths). Kill TSVNcache.exe and voila, your hard drive will be let go. I wonder if this has something to do with explorer nuking itself randomly? Sometimes even this doesn't work, and its a small bug in Vista and XP [ from here ]. I just set the policies for 'quick removal' (no caching) and don't worry about safe removal anymore.

Vista, HP DV2210us suddenly stops booting

When trying to come out of sleep. Blank screen, no HDD activity, no key response. Restarting the computer did not help. Taking battery out and then plugging it back in did not help. Panic! Hardware problem? Turns out no. I'm guessing the hibernation file got corrupted. Hit f8 on switch on to get to a menu screen that will let you continue with boot. Also see this entry .

Dynamical systems simulation in python

Trying out PyDSTools [ webpage , download ] These guys look professional - they have a test suite that you can run to check everything out. Issues: You need to put a file called PyDSTool.pth [ read this ] Play close attention to the trick about subdirectories - you have to repeat it for each level, not just the root level. I have my install in c:\programs\PyDSTool and my file has C:\\ C:\\Programs\\ C:\\Programs\\PyDSTool\\ I have scipy version 0.6.0 but PyDSTool doesn't detect that properly. I commented out the relevant lines in PyDSTool's root __init__.py #if vernums[1] != 5: # raise RuntimeError("SciPy v0.5.1 or above is required") and it continued with the tests. Things seem to work OK, only one thing was declared broken: PyCont: appears to be broken on your system But, there were periodic errors of the nature: ***** Testing script impfn_test.py **************************** Gnuplot not available ------- Examples of implicit function as variable 1D example: a h...

IDE solutions for Python (Windows, Vista)

It turns out that for me the best combination (ease of installation + features) is the following odd couple: Ipython + IDLE (I was using Ipython + SciTe) IDLEs shell sucks compared to Ipython, but IDLE's code editor is awesome, especially considering that its comes standard with the python install. Scite Does: syntax highlighting code folding can call python Multiple tabs Does not: integrate with debugger, parse modules and methods code completion IDLE Does: Syntax highlighting parse module and methods code completion code context integrate debugger Does not: Fold code Have multiple tabs (annoying)

Installing python and friends on Windows (vista)

One way to go is to get the installer from Enthought [ here ]. This is the academic version, but their license agreement is not clear to me: it is not clear that even as a researcher working on public money in a university doing research I publish in publicly accessible journals and make available on my website, I can use this distribution. What you pay for is the convenience of having a lot of open source python related software bundled together. You also get a lot of packages you may not be using. For me, the old fashioned hunter gatherer lifestyle leads me to the following course of action: Download and install python using the installer [ python.org ] Download and install setup tools [ python.org , scroll to the bottom] Run command prompt as admin to use easy_install [ guide here ] Install ipython easy_install http://ipython.scipy.org/dist/ ipython-0.8.2-py2.5.egg easy_install http://ipython.scipy.org/dist/pyreadline-1.5.dev_r2876-py2.5.egg [or whatever versions you want from that...

Configuring Ipython

You can change the directory where Ipython stores its configuration files by [ from here ] changing the IPYTHONDIR environment variable. The default is ~/.ipython for linux and /_ipython for windows. Put your personal Ipython fetishes (like yellow screen with red text - I don't want to know details) in the ipy_user_conf.py file found in the configuration directory. In order to see the options available to you, in a python shell do the following import IPython.ipapi ip = IPython.ipapi.get() o = ip.options o Changing colors [ here ]

Trivia sections in wikipedia articles

Trivia sections are discouraged in wikipedia articles [ policy ]. Somebody decided that if we call them 'notable media references' instead [ policy ], people might think this is a serious encyclopedia. Wikipedia will not be rembered for its content. It will be known for itself - a giant sociological experiment that reminds us what we are like. PS. Most articles I look up in wikipedia, I go straight to the trivia, er, notable media references, section. Without the trivia, why I would look up a 'real' encyclopedia instead.

Calculus made easy

There is a calculus book in pdf form online at djm.cc . I found this in my search for a reference to Netwton's difference quotient method [ wikipedia ], which I use in a paper and which Jeff wanted me to put in a reference for. Looking for a reference to Netwton's difference quotient method was instructive because it led me to a problem I had not had to deal with yet: if you have a numerical method for computing a function f(x) then the simple newton's difference quotient method d f(x) f(x+h) - f(x) ------ = -------------- dx h is problematic because for small values of h (as required by the method) f(x+h) is almost the same as f(x) and the difference and the division may lead you into rounding errors. This paper addresses that issue.

Bats face preys that employ

I have the misfortune to be currently writing a paper with word. Its not that bad, and sometimes quite funny. I started to type "Insectivorous echolocating bats face prey that employ a variety of" and I got a jaggy underline at "prey that employ". Apparently I should either use Insectivorous echolocating bats face prey that employs a variety of OR Insectivorous echolocating bats face preys that employ a variety of My meaning is the latter, but I suspect the plural of the word 'prey' is one of these nasty illogical things in English.

Where does the time go? In "link_to"

For a table with 9400 records: The following code, all Ruby On Rails-ed up, takes 8.15s table > tr > % for column in Journalabbr.content_columns % > th align = "left" > % = column.human_name % > / th > % end % > / tr > % for journalabbr in @journalabbrs % > tr > % for column in Journalabbr.content_columns % > td > % = h journalabbr.send(column. name ) % > / td > % end % > td > % = link_to 'Show' , : action = > 'show' , :id = > journalabbr % > / td > td > % = link_to 'Edit' , : action = > 'edit' , :id = > journalabbr % > / td > td > % = link_to 'Destroy' , { : action = > 'destroy' , :id = > journalabbr } , : confirm = > 'Are you sure?' % > / td > / tr > % end % > / table > By removing content_columns and send_columns and explicitly stating what columns to print, and keeping the same output, the cod...

Passing on the MacBook Air

Looked into Apple Macintosh Laptop computers, as the new lab is a mac lab and decided to pass on the MacBook Air. In comparison to the MacBook I found Pros: Light - 3 pounds (vs 5 pounds for Macbook and my current HP DV2210us) Illuminated keyboard Cons: Max memory is 2Gb (vs 4Gb) Max CPU brawn 1.8GHz Core 2 Duo (vs 2.4 GHz Core 2 Duo) 80GB 4200-rpm 1.8in HDD (vs 250 GB 5400-rpm 2.5in HDD) No optical drive (vs 8x DVD burner) 1 USB 2.0 and NO firewire (vs 2 USB 2.0 and 1 firewire) No ethernet port The power connector and the USB slots open out awkwardly from the case base [ engadget ] Mostly, this machine will be plugged into a keyboard, a large monitor and will sit on a desk doing number crunching and paper writing (Macs do all the work for you, right, not like PCs where you actually have to write the paper yourself). I imagined the awkwardness with which the MacBook Air would sit, with no ethernet cable, always relying on a wireless network, even for DVD burning/loading, with that s...

Setting css class/style for link_to_remote

Add the relevant code to :html as shown below :update => 'divid', :url => {:controller => 'taxes', :action => 'show', :params => {:id => '2'}}, :html => {:style => 'text-decoration: none'} %> You can also do :html => {:class => 'mycssclass'} Note that this is different from link_to 'taxes', :action => "show", :id => '2' }, :style => 'text-decoration: none' %> which is annoying until you find out.