Thursday, May 24, 2012
apple in my eye
I should have started this list ages ago.
Yes, you are so sleek, ouch you cost so much money, wow Facetime, but really, you can't copy an audio CD, or even a data CD for that matter, without jumping through hoops? Oh don't worry, apple's infinitely better by 50MMM in profits lossless format, which is only 50MB per song, so much smaller than the raw format, is what I should rip all of my music to so I can have like 6 songs on my, oh only works on Ipod or Ipad, Ihole. Point is, I have to go through 3 ridiculous steps to do something that should only take one step.
Number #1: Can't duplicate an audio CD.
P.S. It goes without saying that of course Ubuntu flavored Linux does this piece of cake - all I had to do was put it in my machine and Ubuntu asks, "Want to copy CD? Play it? Want a martini?" Why yes and all of the above, and yet you do this with zero profit? How so? I will love Linux til the day I die.
Brasero is the Linux app that does this, thanks to the thankless folks at GNOME.
P.P.S. Download Burn. It works. Now I'm lovin it.
Sunday, May 20, 2012
Precise pangolin updates
Something wicked was screwing up Ubuntu updates recently. Almost made me go back to apt. Just make sure you update your catalogue bwfore downloading and installing new udates. I know with apt this is a no-brainer, but I always assumed that update manager handled that automatically. First one update crashed on restart, the threw a bunch of errors. Then, updates would say there was a bad connection. Finally I had the sense to click check, and found more updates. That did the trick.
Saturday, May 19, 2012
spyderlib 2.1.9 on Python 2.7.3
Change isdir = os.path.isdir to a function, so it can be called with zero args.
def isdir
return is.path.isdir(self)
msysgit bash for XP64
Ironically SysWoW64 is for x86 applications while system32 us for x64. You need to change the registry keys to use wscript from the windows/syswow64 folder.
Monday, May 7, 2012
virtualenvwrapper msys home
An indispensable piece of good Samaritan code is virtualenvwrapper by Doug Hellmann. It has some basic support for windows users using MSYS. In order to make it work though, you need to add an environmental variable to your ~/.bachrc file telling it where your MSYS files are located. If you're using msysgit, it's /c/Program\ Files/Git and user_scripts will append the "bin". And yes you will need mktemp, which you can acquire from MinGW* but you will need xz to unzip it and a compiler to build it. It is almost easier to download and install the mingw-get installer and then just add it to your mingw/msys folder by running the MinGW-MSYS bash and typing mingw-get install mktemp. Then I made a symbolic link, which in Windows looks like a copy, but is actually the same file, in my /home/bin folder which is always first in the bash $PATH.
*Since most MS Windows users have migrated to Win7 x64, I recommend using MSYS compiled by MinGW-w64 from their External binary packages (Win64 hosted) folder on SourceForge. You can simply unzip this either straight into your C:\ folder if you have admin rights, or the new and improved local virtual store which is at C:\Users\<username>\AppData\Local\VirtualStore\Program Files (x86) since MSYS is a 32-bit application. This will give you the POSIX environment and some of the MSYS GNU tools like mktemp, make and fmt, but you may need to copy over a few dll's too. The MSYS-dll is the same as msysgit's so, that's no issue. In particular make requires iconv and intl libraries.
Also you need a few other binaries to run the latest version of virtualenvwrapper. Namely make and fmt, make and the intl and iconv libraries as I said above.
Sunday, May 6, 2012
Python flavored regex
Don't expect all flavors of regular expressions to be the same. For example, one difference between Java and Python, Java allows "unions" of character class by nesting.
[0-4[6-8]]
is the same as
[0-46-8]
but Python's re module will only interpret the latter.
There is an alternative module on pypi called regex that may replace re, which handles nested sets.
Thursday, May 3, 2012
IPythonQt on Windows
IPython is a very commonly used shell instead of the default Python interpreter. One of its advantages is its Qt console which can show plots like MATLAB. Building this for Windows is pretty painless, since windows installers are provided for each dependency, however their installation documentation for Windows is not crystal clear.
- download and install the latest version of Python-2.7 - obviously you must have Python, make sure the executable matches your system, e.g. win32 for 32-bit Windows versions
- See the great documentation on getting pip and setuptools.
- download
ez-setup
from the setuptools documentation and run it using python from a command line (you must have python on your path).
python ez_setup.py
- If you are using Git Bash you can also use curl and pipe it to Python like this.
curl -k https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py | python
python get-pip.py
- If you are using Git Bash you can also use curl and pipe it to Python like this.
curl -k https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python
Wednesday, May 2, 2012
Dueling desktops
I've been playing around with virtual machines and different Linux distros and desktops. Pretty fun stuff. I know there are many websites out there that already cover this extensively. For example here's a discourse on the pros and cons of LXDE and Xfce, two popular "lightweight" desktops that are supported by almost every distro, and even BSD. My Geek Opinions - A Geek's Guide to Technology: LXDE vs Xfce. And here's a comparison of the two most popular heavyweights, GNOME (Ubuntu-Unity flavored) and KDE.
But this blog is realy just for me, and when I was deciding what distro to download and what desktop to use, I don't think the differences between distros and more so between desktops, were all that clear to me. So now that I understand it a little better, I don't want to forget it.
First of all I think it's super important to understand the difference between desktops and distros. I laugh a little about it now, but I actually thought Lubuntu, Kubuntu and Xubuntu were different distros. I didn't know that Linux and BSD could swap desktops. I'd only used machines with a terminal and a single desktop. I suppose in undergrad (1990's) I had the opportunity to use X Windows but that was just to display graphics like plots from MATLAB, and was not remotely like Windows 3.1 or the Macintosh OS the most popular graphic desktops at the time.
Suffice it to say that Linux and BSD unlike Windows and Mac, offer a choice of desktops. By far the most popular desktop is by GNOME, and by default the major Linux distribution all default to GNOME. However alternate desktops, such as KDE, LXDE and Xfce, will run on almost any Linux or BSD distribution. In fact, if you're so inclined, you could just use the command line and X Windows to run graphics programs like an internet browser. Wikipedia has a comparison of desktop environments. Wow, that's a pretty cool list - must check out Qt-Razor; there's a Fedora Spin in the works.
So I installed what I think are the most popular Linux distros as VMs: Fedora16, OpenSUSE12 and Ubuntu 12.04LTS (aka Precise Pangolin). I also installed FreeBSD a direct descendant of Unix. Of course there are other Unix-like systems, but I have a a 2-year old and a full time job so there are limits to how much time I can waste. On each system I chose a different desktop - Fedora got LXDE, OpenSUSE got GNOME, Ubuntu got Xfce and FreeBSD got KDE.
Installation
All four systems are a snap to install. All downloads are about 600MB. Fedora and OpenSUSE come as live ISO's that you start, and then have a app to install to the hard drive. Both also have a downloadable DVD image (about 3GB to 5GB) that can be used to install the system directly. Ubuntu on the other hand has a CD ISO that gives you the choice to install Ubuntu or run live. FreeBSD only has ISO for hard disk installation. I did not love having to run the live versions of Fedora and OpenSUSE to start the installation process, since I already knew I would install, so that was annoying. Also, since they run as live CDs, they require at least 512MB of RAM, which was an issue since I was installing them as VMs on pretty old machines, so RAM for me was scarce. VirtualBox couldn't handle it, but an older version of VMware Player was up to the challenge. Fedora and Ubuntu installations were a breeze, but there were some glitches in the graphics for Open SUSE, which may have been hardware related. I have a separate post on FreeBSD, but essentially it uses terminal style graphics, and installs as root, instead of an administrator, who can obtain root privileges.
Software Repository Packages
I installed some of my favorite tools: Numpy/SciPy, pip, virtualenv, virtualenvwrapper, Requests, Meld and Geany. Almost all were supported on every platform directly from the package repository, but at different releases. You can search Fedora, OpenSUSE and Ubuntu repositories online.
Screenshots
You can download and install Xubuntu, which is Ubuntu with the Xfce desktop.
Fedora has a spin for LXDE that you can download and install.
Open SUSE 12 only comes with GNOME or KDE, but there are older version that have LXDE and Xfce.
Tuesday, May 1, 2012
bugs-everywhere with msysgit
Bugs-everywhere (BE) is kind of neat idea - keep the bugs in your repo.
On MS Windows to get the editor to work for BE comments you need to add a Windows path to an editor since it calls Python's os.system, and not a shell command. If you are using msysgit this can conflict with git since it will read $EDITOR and execute it as a shell command.
To circumvent this, add $GIT_EDITOR which is read by git before $EDITOR. See git-var.
This is easily done if you've set up BE in a virtualenv and especially easy if you have virtualenvwrapper. Either way add to the script file.
postactivate/activate for virtualenvwrapper/virtualenv
# reset git var to vi, GIT_EDITOR is read before EDITORpredeactivate/deactivate for virtualenvwrapper/virtualenv
export GIT_EDITOR=vi
# set bugs-everywhere EDITOR to vim
# must use windows path since it calls os.system
export EDITOR=\"\"%PROGRAMFILES%\\Git\\share\\vim\\vim73\\vim.exe\"\"
# remove bugs-everywhere EDITOR
unset EDITOR
# remove git var GIT_EDITOR
unset GIT_EDITOR