Tuesday, November 6, 2012

Synergy problems

If you are using Synergy server on Windows 7, and the clients connect to the server properly, but the mouse refuses to move to the client window without any apparent reasons, the Scroll Lock key might be ON.

Turn it off and synergy will start working again.


Monday, October 8, 2012

Ubuntu: Sony laptops reboot on suspend

Does your Sony laptop reboot when you try to wake it from suspend sleep mode?
Are you running Ubuntu 12.04? Then this probably solves your issue... the catch is that it will cost you one more reboot.

Here goes
1. Edit the /etc/default/grub file.
sudo gedit /etc/default/grub
   
2. Find the line which says
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

and change it to

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_sleep=nonvs"

and save and close.

3. Update grub
sudo update-grub

This will take effect on next reboot. Enjoy.

Saturday, September 22, 2012

Network painfully slow on Ubuntu

If you are suddenly seeing a painfully slow network connection on Ubuntu, with lots of dropped packets, chances are that you recently upgraded the kernel and restarted the computer to use that kernel.

In my case, the problem was a bad ethernet Realtek driver, which was included with  (or chosen by) the new kernel(r8169). The solution is to patch the kernel to use the correct driver (r8168), which is free from this issue.

The steps to fix this issue are simple... ( source - this page )
  1. Download the Linux driver from here.
  2. Extract it somewhere.
  3. Run "sudo ./autorun.sh"
Enjoy the fast speed...

Monday, September 17, 2012

Playing with Phong shading

While going through an example in the OpenGL SuperBible 5, I came across the Phong lighting model. Its  one of the tricks which helps create those amazing 3D pictures.

Looking closer at the equations, I found that a bug in the specular lighting calculations, which is reported here... https://code.google.com/p/oglsuperbible5/issues/detail?id=47

Here is what a phong shaded sphere looks like...


Now, its time to play with the fragment shader a bit... added some trigonometric beauty (  cos(600*x)*exp(-pow(20*x, 2.0)) ) to the reflection point...

Math is fun.

Tuesday, September 11, 2012

Eclipse theme on Ubuntu

Changing the look and feel of Eclipse on Ubuntu 10.04...

Problems:
1. Eclipse defaults to a white background. We need themes.
2. It has unbelievably large tabs on the top... are they taking some tips from the IE behemoth? No... its just does not play well with Linux.

Solutions:
1. Open Help -> Eclipse Marketplace. Search for "theme" and install Eclipse Color Theme. Once installed and restarted, go to Window -> Preferences -> Appearance -> Color theme.... pick a color theme you like and rejoice.

2. On the terminal, say "gedit ~/.gtkrc-2.0" and in the resulting window, type....


style "compact-toolbar"
{
GtkToolbar::internal-padding = 0
xthickness = 1
ythickness = 1
}

style "compact-button"
{
xthickness = 0
ythickness = 0
}

class "GtkToolbar"   style "compact-toolbar"
widget_class "*<GtkToolbar>*<GtkButton>" style "compact-button"

Save and restart Eclipse. The tabs should now be smaller. You are welcome.

Thursday, September 6, 2012

MP3 tag editor


If you are like me and listen to audio books, chances are that the random ordering of the chapters / sections must have driven you mad at some point of time.

The audio books I have usually have their order specified clearly in their filenames. Of course, this ordering info has been irritatingly left out of the id3 tag.

Because of this, iTunes does a lousy job or ordering the items when they are added to the library. And it lacks a good way to edit the tags. I wished Steve Jobs had listened to audio books and faced this problem. He would have got it fixed.

However, I found this extremely useful id3 tag editor which allows me to edit the tags of many files at once. It allows me to derive the id3 track name from the file name in an intuitive and user friendly GUI. And its free... http://www.mp3tag.de/en/

You can also change the file names from the tag, or even from the filename itself. It doesn't get better than this.

Ubuntu 10.04 VirtualBox USB woes

I was setting up a Windows 7 64bit guest OS on a Ubuntu 10.04 host, just for running iTunes. I needed to get some audio books into the ipod. Of course, no USB devices showed up when Windows finally booted, displaying the message "no usb devices connected". I dont understand how it can say that so confidently, specially since I am sitting right here and looking at the ipod connected to the computer. Even Ubuntu sees that its connected. I suggest that the message be changed to "no usb devices identified"... or something similar... something which is not a blatant lie.

On google searching, I found that I needed to add my username to the vboxusers group. Can someone make that a default option when VirtualBox installs? I restarted VBox and Ubuntu. USB still does not work.

After another google search, I found that I needed to add my username to the lp group as well. Additionally, make sure you have the VBox downloaded from Oracle and not the one that comes with Ubuntu. The Ubuntu bundled VBox apparently does not have USB support. Mine was already downloaded from Oracle.

After this, USB works.... yayy.

Steps to get USB to work in VirtualBox...
1. Make sure you have installed VBox downloaded from Oracle.
2. Also install guest additions and extension pack. The extension pack is separately downloaded from the VirtualBox website.
3. Now, add your username to the groups vboxusers and lp. This is done in Top menu -> System -> Administration -> Users and groups -> Manage Groups -> Properties (for vboxusers and lp).
4. Restart computer. You might get away by restarting only VBox...

Enjoy

Tuesday, September 4, 2012

Building Panda3D on Ubuntu 10.04 with Python 2.7

First, install Python 2.7 from sources ( follow the instructions here, or do the following... )

sudo apt-get -y install build-essential
sudo apt-get -y install libreadline5-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
cd ~/Downloads/

wget http://python.org/ftp/python/2.7.2/Python-2.7.2.tgz
tar -xvf Python-2.7.2.tgz
cd Python-2.7.2/
./configure
make
sudo make altinstall

Now, install flex (I was missing this... you might be missing more stuff).
Let me know in the comments what else you needed and I will try to update this page.

sudo apt-get -y install flex


Get the sources for Panda3D from here... ( direct link to Panda3D SDK 1.7.2 source tar.gz)

cd ~/Downloads/
wget http://www.panda3d.org/download/panda3d-1.7.2/panda3d-1.7.2.tar.gz
tar -xvf panda3d-1.7.2.tar.gz
cd panda3d-1.7.2
python makepanda/makepanda.py --everything
sudo python makepanda/installpanda.py --prefix /usr/local
sudo ldconfig








Install Python 2.7 on Ubuntu 10.04

Had to build Python2.7 from source today to get Panda3D to build on my system (yeah... its a convoluted story why I need to do that and cant live with the Python 2.6 which came with Ubuntu)... here are the instructions in brief.

# install the prerequisities
sudo apt-get -y install build-essential
sudo apt-get -y install libreadline5-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

# download the python sources

cd ~/Downloads/
wget http://python.org/ftp/python/2.7.2/Python-2.7.2.tgz

# untar and build

tar -xvf Python-2.7.2.tgz
cd Python-2.7.2/
./configure
make

# alt install so as not to screw up the regular python
sudo make altinstall

# original instructions from
http://askubuntu.com/questions/101591/how-do-i-install-python-2-7-2-on-10-04







Thursday, August 30, 2012

Fullscreen YouTube in Chrome on Ubuntu

I have a dual monitor setup (Twinview) on Ubuntu 10.04 on Nvidia 550Ti. A few weeks ago, my YouTube video fullscreen mode started giving trouble. The full screen mode now tries to go to really full, trying to take up both the screen but only succeeding partially.

The full screen ends up taking one screen, and only shows half of the video and cuts out the other half. I was hoping that a driver update would fix it any day soon, but it never did.

Finally I had had enough and googled for a solution... and as expected, found that many others face the same challenge every day. Surprisingly, there is no good fix for this issue.

However, there is a semi-workaround. This chrome plugin (Multiple Monitor Full Screen) plays youtube video in full screen inside the browser. You can then maximize the browser to get to almost fullscreen... almost there.

Friday, August 10, 2012

Quest for a better programming font

This must be a recurring issue for Programmers...

Every time I find myself resetting / recreating a programming environment, I always have to change to a dark theme and struggle to find a good monospaced, antialiased font ( I am not sure if fonts themselves are antialiased as stored on disk, or are they massaged somewhere between the point they are on disk and before we see them on screen).

In my search, I even came across monospaced fonts which were not really monospace... Inconsolata is one of those (sample code snippet below where I have obscured non essential info)



However, I think I have found a font that works well...
The Bitstream Vera Sans Mono
http://www.dafont.com/bitstream-vera-mono.font

IDE designers... please include a default black background color theme.
I cant believe you all are using white background for your development (And if not, shame on you for giving us something you yourself don't use).

Monday, August 6, 2012

Audio Captchas

After a long histus, I went to LinkedIn, and was presented with the login page, which in addition to my credentials, also required me to fill in a Captcha.

I have seen many captchas, but this one has gone ridiculous. The text on at least one of the 2 words was completely unreadable, and despite refreshing 3-4 times, I could not feel confident I could pass the captcha test. Then came the moment of increased ridiculousness... I decided to try the audio captcha.

As the noise of the captcha started coming out from my speakers, I thought there was something wrong with my speakers - maybe a loose contact. I continued to believe this for the next 20 seconds or so... I hope this conveys what kind of audio noise the captcha made.

I found some measure of solace in the thought that my speakers are bad, rather than the other thought that they really expect me to find find English language words / alphabets in this soup and I am failing miserably. I am not sure if I will be able to detect a dog barking in that din. What if the captcha was "woof woof"?

The sound track can be described to be equivalent to being in a disco playing 4 loud tracks, all at the same time. Playing tracks you have never heard and now you are asked to decipher the lyrics of one of the songs. And you have to get it right the first time, because the thought of hearing it a second time is starting to give you a headache.

I am not trying to exaggerate... I could not confidently decipher a single word / alphabet of the audio captcha. I don't even know if it had words or alphabets. This is becoming ridiculous and needs a better solution.

Of course, I do understand why they want to make captchas difficult to solve by computers. But there has got to be a better way.


Thursday, August 2, 2012

Setting up a webserver with python server side

Time to install the lamp stack and mod_python on my Ubuntu 10.04 box...
Great news... its really easy. Just run...

sudo apt-get install tasksel
sudo tasksel install lamp-server


This installs apache2, mysql and php. It will ask you for the mysql root/admin password during the installation. So give it a password of your choice... this need not be your login password, but it can be same. Make it different to increase security.

Detailed instructions for setting up Apache, PHP and MySQL individually are given here... https://help.ubuntu.com/community/ApacheMySQLPHP


Once that is done, we now install mod_python into the apache2 web server and restart the server...

sudo apt-get install libapache2-mod-python
sudo service apache2 restart


Now, to create our own site by replacing the default site, we need to edit the apache2 configuration. (instructions from the above linked site)

To create a new site:
  1. Copy the default website as a starting point.
    • sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite 
  2. Edit the new configuration file in a text editor "sudo nano" on the command line or "gksudo gedit", for example: 
    • sudo gedit /etc/apache2/sites-available/mysite
  3. Change the DocumentRoot to point to the new location. For example, /home/user/public_html/
  4. Change the Directory directive, replace <Directory /var/www/> to <Directory /home/user/public_html/>
  5. Add python scripting support...
    •     <Directory /home/user/public_html/>
              Options Indexes FollowSymLinks MultiViews
              AllowOverride None
              Order allow,deny
              allow from all
              AddHandler mod_python .py
              PythonHandler mod_python.publisher
              PythonDebug On
          </Directory>
  6. You can also set separate logs for each site. To do this, change the ErrorLog and CustomLog directives. This is optional, but handy if you have many sites
  7. Save the file
  8. Restart apache
    • sudo service apache2 restart 
  9. Add a test python script into your new website
    • gedit /home/user/public_html/test.py



Wednesday, August 1, 2012

Building wxPython on Ubuntu pains

Tried installing wxPython from source... had a terrible time with the OpenGL libraries. Ofcourse, I cant do without OpenGL if we are to do any nice looking CS Experiments.

Ran into this error and banged my head against it many many times, until it took pity and gave way...


checking for -lGL... no
checking for -lMesaGL... no
configure: error: OpenGL libraries not available


The problem was that despite installing all kinds of OpenGL libraries, this error refused to go away.
After some more head banging, I found, that the /usr/lib/libGL.so was a sym link to nothing.

Deleteded the symlink and created a new one that pointed to an existing file.

sudo rm /usr/lib/libGL.so
sudo ln /usr/lib/libGL.so.295.59 /usr/lib/libGL.so

Problem solved for now...