Skip to main content

Posts

Showing posts from May, 2013

How to disable the 'comments' box on a Wordpress static page

Problem: I want to disable the comments box on a static page I have put up on my Wordpress website, but I can't find any option to do this Solution: (From the thread here ) The option is a little hidden. 'Edit' your page, go to the top right hand corner where it says 'Screen options' and click to open the drag down menu. Check the 'discussion' section. This will make a new options box visible (found below your page text edit area). Uncheck 'Allow comments'.

A little funkyness with Pandas index

Problem: I made a Pandas DataFrame df with a float index. Everything worked fine, including df.plot() But when I tried to do pylab.exp(df.index.values) I got the mysterious error AttributeError: exp Explanation: It turns out that Pandas' index is restricted to int64 and 'object' and so df.index.values returns an 'object' type array with exp can't interpret. We need to explicitly cast it as 'float' to get things to work : pylab.exp(df.index.values.astype('float'))

Blogger and Google sites vs wordpress

I've had this blog now for some years. I also recently put up my professional site on google sites. Very recently I've started to set up a blog/site on Wordpress.com One thing I've noticed for both blogger and sites is that the pages are just not that pretty. I dislike fancy gadgets and tend towards minimal themes. Compared to blogger/sites Wordpress somehow gets the typography and layout just right. Wordpress sites are prettier, for reasons I can not explain. This is a bit of a pity. Blogger lets you customize EVERYTHING. This is awesome. But no matter how I (an complete amateur in design) tweak, I can not get a pretty enough blog. Sites is horrendous. Everything looks very dull and drab. Wordpress charges for some themes, and will charge you a bunch to have access to customizing the CSS and layout. It's not as great as free, but in a way I think the fact that Wordpress charges is a good sign. It means that this is a source of income for them. Which, in turn, mea...

The anti-Google crowd has a point

I'm looking at this backlash against Google and other SV tech co.s and surprisingly find myself on the side of the 'backlasher's. The news articles emphasize the SF hippies, but I think the deep root of it all is the basic social contract these companies are breaking. There is an idea, and it works well. You start a business on the street. You probably hire people who are local, you serve people who are local. You pay taxes to the local government. The government fixes the roads and sets up bus service and educates your kids. Your customers increase in number and their ability to pay. Your business lasts longer. Google and co seem to believe they can get away with creating their own parallel universe of buses and other infrastructure. But they would do much better to pay more taxes, especially local taxes, so that EVERYONE had a better bus service. Yes, their customers are more from outside SV than not, but their workers live here. If SF becomes a shitty place to live they...

Ubuntu apt-get can not remove package due to configuration script

I once installed a package (pypy) through apt-get but then recklessly decided to delete the pypy directory (/usr/lib/pypy). When I tried to next do the right thing (sudo apt-get remove pypy) I kept getting funny errors from dpkg. It turned out that there was a script (/var/lib/dpkg/info/pypy.prerm) that dpky was using that was confusing it. Removing this script enabled me to clean out the package and then reinstall it properly.

Setting up Python/Pylab environment on machine with no root access

No pip? Bootstrapping ourselves cd /tmp (We have write access here) curl -O https://pypi.python.org/packages/source/p/pip/pip-1.3.tar.gz tar -xzf pip-1.3.tar.gz cd pip-1.3/ python setup.py install --user Python informs us pip is now installed under ~/.local/ cd back to our directory. Add this path to .bash_profile PATH=$PATH:$HOME/.local/bin Let's try this out: pip install matplotlib --user pip install ipython --user pip install --upgrade nose --user (The server had an older version of nose)

Git push to production machine

Application: I have code on my development machine that is under git. I would like to be able to send this code to my production machine when I'm ready. One way is to have a repository, say on github or bitbucket, and push from my devel machine and then pull from my prod machine. But sometimes the code is very specific and I'm not sharing it publicly. And, this is a kind of cumbersome two step process. Can we automate this process? Solution (From discussions here and here ):  The basic idea is to set up a git repository in the production machine (wm.git) and indicate that as a remote. When you push, wm.git gets updated with the code that you push. The magic happens in the hook/post-receive script which gets executed on the production machine after a push, so you do not have to manually checkout the latest push.

Exploring Digital Filter Design with Python

If you analyze data chances are you need to use digital filters. The theory and practice of filter design and filter characteristics is well developed and requires some math background. If you do not have the patience to go through all the math the second best thing is to look at filter designs to get an intuition of how filter type and order translate into filter characteristics. I've written a simple Python script using the Pylab and Scipy packages that allows you to interactively 'draw' a filter characteristic and see the filter design results from various algorithms. The amplitude and phase characteristics, and the filter order are plotted and the coefficients are shown in the command window. To play with this educational tool go to the neurapy repository on git hub and grab this script . Run in from ipython and explore the world of digital filter design.