Adding extension type to Xcode 3 syntax coloring
It has been a long vacation from this blog, but I am brining it back with a fix that has been troubling me for sooooo long. I do a lot of my research in cython, which has source file extensions “.pyx”, instead of the usual python extension “.py”. I finally discovered how to do this, after much effort.
The hint came from: http://wotnau.blogspot.com/2009/03/xcode-erb-file-highlighting.html
Basically I just opened the file /Developer/Library/PrivateFrameworks/DevToolsCore.framework/Versions/Current/Resources/Standard file types.pbfilespec in an editor, and on the line that read:
- Extensions = (py);
I changed to:
- Extensions = (py,pyx);
Thats it! Now my .pyx files open in Xcode with the syntax coloring of a .py file. If this has been troubling you too, I think this will likely work!
Vectordesigner can’t import pylab/matplotlib eps/pdf files
A research colleague of mine suggested to me that Vectordesigner, a powerful yet lightweight vector drawing application might prove to be a good tool for gathering research plots into figures for publication. I started using it about 6 months ago, and was largely impressed, however I noticed that it was having trouble importing the plots that I was making with pylab.
Specifically, the imported pdf and eps files were losing their formatting, getting their size changed, fonts changed, and sometimes even lines would lose their formatting. After trying everything I could think of, I was about to break down and throw VD in the trash can, and get used to the confusion of Illustrator. (I tried to email the makers VD three times, and never got one reply. Great customer service guys, considering I actually spent $70 instead of just stealing it like everyone else…)
Finally I figured out how to solve the problem. All I had to do was uncheck the little box “Parse file contents” on the import sub-menu. I can’t “ungroup” what results, and transparency for eps files is still messed up but at least now my plots look right. Hope this helps someone else; I feel bad trashing Tweakersoft, but man, all it would have taken was a 2.5 second email saying “Were looking into it” on ONE of my three emails. Customer service just isn’t what it used to be…
Un-breaking the MySQLdb module after my Snow-Leopard upgrade
After a few days of trying, giving up for a few months, and a few hours of trying again, I have finally managed to regain the use of the MySQLdb python package, that was broken after y upgrade to Snow-Leopard several months ago. It all seems so easy after you figure out what to do, but I wanted to document my journey and possibly save others the grief I went through.
- Install XAMPP: Super simple really; just go to http://www.apachefriends.org/en/xampp-macosx.html and follow their instructions.
- Add the XAMPP binary directory to your path: Add a line like this to your .*rc file:
- export PATH=$PATH:/Applications/XAMPP/xamppfiles/bin
- Download the source for MySQLdb: I like to download/extract all of these sorts of things into ~/local/src
- Following the instructions from Eric Simmerman to the letter, we build and install MySQLdb
- If you are using the default Snow-Leopard python (mine is 2.6.1), you will need to turn off 64-bit functionality in order to import the module. You can do this by add this line to your .*rc file as well (I think this is equivalent to Eric’s #3):
- export VERSIONER_PYTHON_PREFER_32_BIT=yes
That did the trick for me. On to brighter days, we def. could use more sun in Seattle this time of year. Leave a comment if this was helpful for you too!
-n
The Five A’s
I listened to an old interview of George Carlin this morning by a very young looking John Stewart, about a range of topics relating to George’s success as an artist. While listening, I was really taken aback by one of his observations. As a child, George attended an experimental catholic school near his home, without the usual grading and disciplinary systems. He says that because of this, the only A’s he got from his teachers were their:
-
Attention
- Approval
- Admiration
- Approbation
- Applause
In graduate school, having completed all of my required classes and now done with pretty much everything that I can actually be graded on, I have sometimes felt slightly rudderless when it comes to evaluating my own performance. Papers are ultimately the notches in the professional belt of an academic, but so much work and time must go into each one that it sometimes feels like I am not moving forward at all. It makes sense to me, then, to start evaluating myself by what ultimately might be a MORE stringent set of criterion, based on George’s five A’s. If I can manage to get the attention, approval, admiration, approbation, and applause of my supervisors, mentors, family, and friends, I can at least rest assured that I did something right along the way in the great paper chase!
-n
One last thing:cdto
I came across cdto today, and already incorporated it into my regular workflow. Basically, cdto just adds a small button to your finder that will open terminal into the directory that the finder is currently selected on. Between that and CopyPath (Same deal, except copies the path of a file to the clipboard…) I now have a pretty sweet finder window setup. But who uses the finder when there is always the command line…
-n
laprint and auto-pst-pdf: A winning combination!
WOW. I just finished installing/figuring out how to use the laprint function for matlab, to simply export research-quality figures into my latex documents. I won’t spend a whole lot of time rehashing the directions, because installation and usage were pretty straightforward:
- Put laprint in the matlab path.
- Use it to generate a picture, with some text strings that will eventually be parsed by TeX. I had to include the command: set(0,’defaulttextinterpreter’,'none’) in order to prevent matlab from messing everything up.
- Install psfrag and auto-pst-pdf into your TeX distribution path (I use MacTeX and TeXShop with a default install, so this is just /usr/texbin for the .sty files and /usr/local/bin for the .pro file from psfrag).
- Copy the .tex and .eps files that laprint generates into the working directory of your tex file.
- Typeset a-la the example given in the directions.
So simple, even a child with sudo privileges could do it. Granting a child sudo is generally a questionable thing to do, however…
-n
matplotlib can’t find dvipng version!
I spend this morning frustrated out of my skull, trying to get my research plots working in ipython after upgrading from OS 10.5 –> OS 10.6. The main difficulty stemmed from the following error message:
File “/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib-0.98.6svn-py2.5-macosx-10.3-fat.egg/matplotlib/texmanager.py”, line 68, in dvipng_hack_alpharaise RuntimeError(‘Could not obtain dvipng version’)
export PATH=”$PATH:/usr/texbin”
Cool illusion:
The winner of the “Best Illusion of the Year Contest” is definitely worth checking out. I like this illusion because it is subtly different than many visual illusions that I have seen. What comes to mind are those static perception illusions, such as MC Escher paintings, that your eyes travel over but who fundamentally stay fixed. In this illusion, the paradox unfolds in real time. The clash comes from the part of our brain that has encoded the experience of watching objects fall since birth providing a framework, arguing with the visual areas that are trying to interpret motion stimulus within that framework, and finding it impossible. My brain keeps trying to understand how the sequence of events I am observing could not have come from the world that I am used to, and yet at the end this irreconcilable streams are instantly brought into focus, by slightly changing the camera angle.
In this way, I see a metaphore for many of the mathematical problems that I suffered through as an undergraduate. As the constructor of the proof, at times you have an overwhelming intuition that the final result you are chasing is attainable. Yet for some reason, you cannot reconcile this intuition with the techniques you are bringing to bear on the problem. And then, almost in a flash, the angle of you approach shifts just slightly, and your intuition and reason click into alignment. See for yourself…
-n
More zsh
I just added the following key bindings to my .zshrc file:
Now my terminal behaves like all of my other applications, as far as skipping forward and backward.
UPDATE:
I also added:
export WORDCHARS=”${WORDCHARS:s#/#}”
So that the back-deleting works properly with directories. Now if only I could do the same with ipython… Anybody who does, please throw me a line! -n
Abraham Lincoln: The dogmas of the quiet past…
I heard the following quote on a recent TED talk by Sir Ken Robinson. As soon as I heard it, I knew that it was going to be one that I would want to remember, so I am writing this post to both reflect on it, and have a place to remember it:
The dogmas of the quiet past are inadequate to the stormy present. The occasion is piled high with difficulty, and we must rise with the occasion. As our case is new, so we must think anew and act anew.
When Sir Robinson repeated this quote, he prefaced his statement by claiming that we need a revolution in education, and not just the evolution of education. I agree with him, that is to say if we want ourselves to be at the bleeding edge of scientific, intellectual, and cultural advancement, we must revolutionize our approach. However this observation presupposes that these human endeavors are evolving; I would say that evolution will happen regardless, and revolution is our ticket for the train. It is the revolution that provides the engine for the wheels of the cultural evolution; we must hope that it is not too late to rise with that occasion. Americans assume that because thinking (and acting) anew are our legacy, we have some how cornered the market. One could say that the future is the process of re-invention, and being satisfied … is being left in the past …
Im just sayin’…
-n