A blog about computer science and programming, and anything else that might be related.
Wednesday, September 7, 2011
Setting the terminal default editing mode
I had the unexpected surprise after I installed 64-bit Ubuntu, to discover that the terminal wasn't set to Emacs editing mode by default. It's not that I'm a big lover of Emacs (I use Vim), but I've gotten used to the Emacs key bindings in the terminal. After some searching in ~/.bashrc and /etc/bash.bashrc, I found that the "problem" came from ~/.inputrc. The first line of that file was 'set editing-mode vi', so I commented it and all was well again.
Saturday, August 6, 2011
How to setup wireless for Inspiron N3010 in Ubuntu 11.04
It took me a day and the help of allandee from #ubuntu to be able to setup wireless on my laptop, so I decided to write down the steps and put them here in case I or someone else needs them.
First, the laptop comes with Broadcom Corporation BCM4313 802.11b/g/n Wireless LAN Controller (rev 01), so the instructions are for it.
Here are the steps:
First, the laptop comes with Broadcom Corporation BCM4313 802.11b/g/n Wireless LAN Controller (rev 01), so the instructions are for it.
Here are the steps:
1. sudo apt-get install git (in case it's not installed) 2. git clone git://git.bu3sch.de/b43-tools.git 3. cd b43-tools 4. make #build the b43-fwcutter binary 5. cd 6. mkdir tmp #create a temporary dir for the driver 7. cd tmp 8. wget http://mirror2.openwrt.org/sources/broadcom-wl-5.10.56.27.3_mipsel.tar.bz2 9. tar -xjf broadcom-wl-5.10.56.27.3_mipsel.tar.bz2 #extract the archive 10. sudo ~/b43-tools/b43-fwcutter -w /libs/firmware/ ~/tmp/broadcom-wl-5.10.56.27.3_mipsel/driver/wl_apsta/wl_prebuilt.o #extract the firmware #the line above is wrapped to properly show up on screen 11. modprob b43 a restart might be needed afterwards.This is it.
Labels:
broadcom bcm4313,
inspiron n3010,
ubuntu 11.04,
wireless
Tuesday, March 1, 2011
Geospatial Applications
I've started learning about the topic, so I'm getting familiar with PostGIS, OpenLayers, Mapnik, and GIS in general. I want to make some blog posts detailing the steps I've gone through when rendering my own tiles for example.
Anyway, I find the topic fascinating because it allows you to visually link statistics with locations on the globe, which I think is very cool. To be continued...
Anyway, I find the topic fascinating because it allows you to visually link statistics with locations on the globe, which I think is very cool. To be continued...
Friday, January 7, 2011
How to upgrade the SQLite that comes with Python
If you're using Python with SQLite and you want to be able to read and write to the database concurrently, you need to enable WAL. The problem is that only SQLite versions 3.7.x support this new functionality, and Python comes with older versions (at least Python 2.6.x does).
So, you need to upgrade SQLite, but fortunately this is surprisingly easy. If you're on Windows, like I am, you should go to the SQLite download page and download the sqlite.dll. Then, you simply take that dll, and put it in Your_Python_Installation\DLLs, where Your_Python_Installation is the folder where Python is installed, in my case Python26.
After you've done that, you can simply do
So, you need to upgrade SQLite, but fortunately this is surprisingly easy. If you're on Windows, like I am, you should go to the SQLite download page and download the sqlite.dll. Then, you simply take that dll, and put it in Your_Python_Installation\DLLs, where Your_Python_Installation is the folder where Python is installed, in my case Python26.
After you've done that, you can simply do
PRAGMA journal_mode=waland that should activate WAL. To be sure, check the return of value of curs.fetchone() which should be (u'wal',).
Friday, December 17, 2010
Installing oursql on Windows
I had some difficulties installing oursql on Windows, so I thought I'd write down the steps, in case I need to do it again in the future or anyone else has the problems.
First, I tried installing with pip, but that gave me some problems (something about a missing file) even after I installed Cython.
On second try, I noticed that there are already some binaries available, so I tried with those. The archive which can be downloaded from here http://www.habnabit.org/software/oursql/ contains an installer which in turn contains an egg and a .pyd file. Those go in the site-packages directory. I'm saying this in case anyone wants to install oursql in a virtualenv, which is what I wanted to do and I couldn't because the installer only detected my main site-packages and wouldn't let me choose.
I put those in their place, but when trying to import oursql, I got a "ImportError: DLL load failed...". Apparently, I needed the MySQL C Connector. I installed that, but I still got the error, which I solved by copying libmySQL.dll from my WAMP package into site-packages(supposedly, this isn't necessary when MySQL has been installed directly).
Ok, to recap. The steps were:
1) Download an archive with the binaries from here http://www.habnabit.org/software/oursql/
2) Extract the archive and also the installer.
3) Put the egg and the .pyd in the site-packages.
4) Install MySQL C Connector
5) Copy libmySQL.dll into site-packages.
6) Done.
First, I tried installing with pip, but that gave me some problems (something about a missing file) even after I installed Cython.
On second try, I noticed that there are already some binaries available, so I tried with those. The archive which can be downloaded from here http://www.habnabit.org/software/oursql/ contains an installer which in turn contains an egg and a .pyd file. Those go in the site-packages directory. I'm saying this in case anyone wants to install oursql in a virtualenv, which is what I wanted to do and I couldn't because the installer only detected my main site-packages and wouldn't let me choose.
I put those in their place, but when trying to import oursql, I got a "ImportError: DLL load failed...". Apparently, I needed the MySQL C Connector. I installed that, but I still got the error, which I solved by copying libmySQL.dll from my WAMP package into site-packages(supposedly, this isn't necessary when MySQL has been installed directly).
Ok, to recap. The steps were:
1) Download an archive with the binaries from here http://www.habnabit.org/software/oursql/
2) Extract the archive and also the installer.
3) Put the egg and the .pyd in the site-packages.
4) Install MySQL C Connector
5) Copy libmySQL.dll into site-packages.
6) Done.
Monday, November 15, 2010
Update
I thought I'd come back and write something here because I haven't done so in a month, I think. One of the things I did in the mean time was starting to learn assembly. My main goal is to cover my bases, so to speak, and learn the fundamentals of computers and computer science, and I thought that learning assembly would provide that. I haven't started writing code because the book that I'm learning from (Assembly Language Step-by-Step: Programming with Linux
) is big, but I'm close to that point and I'm looking forward to it.
So far I like the book. It starts really slow, which is a bit annoying but to be expected considering it's for people with assembly as their first programming language (I wonder how many people start with assembly), but then goes into a lot of detail and careful explanation in order to make you understand what's going on. It has analogies and a lot of drawings which are so useful for visual learners. That's all I can say for now. I'll add to this once I finish the book.
Oh, and here's something inspiring. A guy who wrote his own compiler, editor, OS and a few others.
So far I like the book. It starts really slow, which is a bit annoying but to be expected considering it's for people with assembly as their first programming language (I wonder how many people start with assembly), but then goes into a lot of detail and careful explanation in order to make you understand what's going on. It has analogies and a lot of drawings which are so useful for visual learners. That's all I can say for now. I'll add to this once I finish the book.
Oh, and here's something inspiring. A guy who wrote his own compiler, editor, OS and a few others.
Monday, October 11, 2010
How to properly install Node.js and npm
I'm documenting here the proper way to install node.js in case I might need to do it again. I'm using the word "proper" because the first time I installed node.js, I did it system wide and that
made it very difficult for me to install npm, the node.js package manager. So, without further ado:
Installing Node.js
Installing npm
Simply do:
made it very difficult for me to install npm, the node.js package manager. So, without further ado:
Installing Node.js
git clone git://github.com/ry/node.git cd node ./configure --prefix=$HOME/my_node make installOpen $HOME/.profile and add:
export PATH=$PATH:$HOME/my_node/binThen run:
source $HOME/.profile
Installing npm
Simply do:
curl http://npmjs.org/install.sh | sh
Subscribe to:
Posts (Atom)