Google App Engine – running on a remote linux box (VPS)

So, you’ve been working on a Google App Engine project on your VPS and for some reason, when you type the following command:

dev_appserver.py <projectfolder>

it works, but when you try to access it in your browser from the client machine (your personal PC or laptop from where you’ve ssh’d into), it doesn’t work or gives you a “Connection Timed Out” error.

There are 2 things you need to check when this happens:

  1. IPTables – check whether you’ve opened up the port on which the local app server is working on
  2. App Server host name and port settings

For IPTables, you just need to make sure the correct rules are set. Since my app server will be running on port 8080, I had to check to see if that port was open or not. The ports can be checked with the following command:

 sudo iptables -nvL –line-numbers

If you don’t see port 8080 opened on the INPUT list, you’ll need to open it.

IPTables works from top to bottom. So, usually, the last entry is to reject everything that doesn’t fit. So, you might need to add the rule in between and for this we use the -I argument. For example, if I want to make this rule the 4th entry in my INPUT list (I have 5 rules), this can be done with the following command:

sudo iptables -I INPUT 4 -p tcp –dport 8080 -j ACCEPT

This should fix the iptables part of things.

Next, we need to fix the app server host and port values. By default app engine server runs on localhost and port 8080. Let’s change that to work with the external IP address of the Linux box and fix it to port 8080:

dev_appserver.py <projectfolder> –host myserver.com –port 8080

And now, if you visit myserver.com, it should work!

How to kill a vbscript running the sendkeys command

It is nearly impossible to stop a wild VBScript running amuck with the sendkeys command on windows. To be sure you can always attempt to open windows taskbar and try to kill the process, if you know its name and if the script gives you enough time to open the taskbar and kill it. But in my experience its impossible to do that without creating a whole mess with sendkeys and sometimes, the only way out is to quickly open or switch to a text editor and wait patiently until it ends.

Scripts that I run frequently, I usually put them in my Quick launch bar so I can kick them off without having to switch windows. The AppActivate() command activates the right window for the script to work on. AppActivate unfortunately doesn’t restore windows if they are minimized. You might have realised this the hard way, as did I, when minimizing all windows and trying to trigger the script from the desktop.

Since VBScript doesn’t provide it’s own way to kill runaway sendkeys commands, it’s up to us to stop it. Every script that I write looks for a file called ‘stopscript.txt’ on the desktop, once every few times the sendkeys is called. If the file exists, it stops and no more sendkeying after that. To create that file, I’ve written another script whose only job is to create an empty file called ‘stopscript.txt’ on the desktop if it doesn’t exist. This script is also placed in my quick launch so it can be started quite easily. So whenever a sendkeys script starts behaving weird, I just start this script and the other one terminates instantly. I’ve found this technique to be a lifesaver in many situations. However, it does require that you be careful and call the file checking function at the right places when developing your script.

Also, always have an empty notepad window open when working with sendkeys. If it goes amuck, you can capture most of the bad commands by bringing the notepad window into focus. This is just another precaution :). Also, you can have your main script delete the stopscript.txt file at the very beginning so that you don’t have to manually switch to the desktop and delete it yourself. To stop it again, click on the stopping script.

VBScript is by no means a great solution for sendkeys automation. There are several professional tools available which can achieve the same. But VBScript comes for free on a windows machine. And when working with clients, sometimes you’re not allowed to install anything on the system and that’s when VBScript comes in handy as the poor man’s automation tool!

Links:

Checking if a file exists and creating it in VBScript

Problem: Virtualbox on Acer 4530 freezes constantly

AMD has a hardware virtualization component called AMD-V which apparently improves the virtualbox experience. However, with the latest virtualbox on Acer 4530, it hangs up the entire laptop. Here’s a lengthy discussion with a solution at the end:

http://www.virtualbox.org/ticket/4179

Kudos to the people who worked on this ticket for persisting until the solution was found.

Problem: Windows 7 doesn’t remember view settings for individual folders

If you’re using Windows 7, you must have noticed that very often your folder view preferences get messed up. The thumbnail view for your gallery changes to List and the detail listing for your documents changes to thumbnails. This is extremely frustrating and after searching around a bit, I finally came across this thread that seems to explain the problem. A user by name of ‘Graham Laws’ has finally answered the problem:

=====================

Hi Guys.

There is two scenarios with remembering views (Windows 7):
1. Libraries – Don’t Remember
2. Folders / Favourites – DO Remember (Easy Fix : Add My Docs to Favourites – see below)
Library Behaviour
Lets say you click Documents, then choose ‘medium icons’, wherever you navigate within Documents from then on stays in ‘med icon’ view.
NB Choosing Organize>Fold & Search Options>View>’Apply to Folders’ and ‘Reset Folders’ are not available in Libraries.
Folders / Favourites
Folders do remember views by default. So if you navigate to C:\users\xxx\Documents etc each individual folder in the tree will remember whatever you set it to.
Likewise if you add ‘My Documents’ to Favourites and navigate from there. To add ‘My Docs’ to Favourites you need to navigate to your User Folder e.g:
i)Start Menu> User Folder> My Docs
ii) Rt-click ‘Favourites’ > ‘Add current location to favourites’
DO NOT add ‘My Docs’ to Favourites from within Libraries. As it is ‘Libraries’ that ignore last view setting.
NB Choosing Organize>Fold & Search Options>View>’Apply to Folders’ and ‘Reset Folders’ are available in Folders. So you can make all folders copy your current view (Apply to folders).


Hope this helps.
Gray
  • Proposed As Answer byGraham Laws Wednesday, December 16, 2009 12:20 PM

================================

Problem: Blender always renders only frame 1

Had this problem today with Blender rendering only Frame 1 in spite of repeatedly baking the animation and setting the view to another frame. I had a cloth piece which was to fall freely under gravity by around frame 100 after which I wanted to render the image. But after setting it up, when I rendered it, I kept getting only the first frame.

After searching for quite some time on the net, I came across this post which suggested that the subsurf modifier should be below the cloth modifier. And it worked! Now it renders the exact frame that I select in blender.

Here’s a screenie:

Formatting SD Card on Ubuntu

This is a post just to remind me about the steps needed to format an SD Card on Ubuntu 9.10. I just got a class 4 8GB Kingston SD Card to replace the 1GB Stock SD Card on my G1. Since I’m using a rooted ROM (this one to be precise), I need an ext+fat+swap partition setup on my SD Card. I needed to format the new card identical to the old one and copy the old data onto the new card.

First of all, Ubuntu has a very weird delayed write mechanism that writes data to plugged in devices only when you eject or unmount them. So, if you write something to the card and pull it out, there’s a very good chance that it doesn’t show up. I haven’t seen this anywhere before, especially when using gentoo earlier.

GParted doesn’t display my card which is /dev/sdb. (Update in comments below) So, I decide to use the command line for this. There are three command line utilities for formatting, i.e. fdisk, cfdisk, sfdisk.

cfdisk gives you a UI so that you can select everything using arrow keys. But for some reason, when creating the partitions, it kept creating them as /dev/sdb1p1, /dev/sdb1p2 and /dev/sdb1p3 instead of /dev/sdb1, /dev/sdb2, /dev/sdb3. This kept the disk from showing up when listing the partition table with sudo fdisk -l. Didn’t really investigate why it was doing that. Checked out sfdisk, but the commands are different and looked like I’d need to learn a bit more before I could use it.

So, finally came down to fdisk which is quite handy once you get used to it. Important commands are ‘m’ which displays all the commands and ‘p’ which prints the partition table. So, first created the partitions using ‘n’ and setting them up as 7.4GB win95 fat32 (code ‘b’), 500MB ext3 (code ’83’), remaining 30+MB swap (code ’82’). The file system type can be set using ‘t’ and the codes obtained using ‘L’. The partition table is written using ‘w’.

Now, we need to format the different partitions with the corresponding file systems. This is done as follows:

  • Fat32: sudo mkfs.vfat /dev/sdb1
  • Ext3: sudo mke2fs -j /dev/sdb2 (the -j is required for ext3. Omit it for ext2)
  • Swap: sudo mkswap /dev/sdb3

Once this is done, you should immediately be able to see the different partitions in Nautilus.

Personal Diary options for Ubuntu

Looking for some software for a personal diary, I came across the following two utilities for Ubuntu:

ThotKeeper

It’s a pretty good diary option, but has a very major drawback – the diary entries are stored in plain xml on your hard disk and it doesn’t need a password to login. In fact, it doesn’t have a password option. If you want a diary just to take notes of your daily tasks or an alternative to an online blog (why?), you can go ahead with this.

MyDiary

This is exactly what I was looking for. It has password protection, keyboard shortcuts and easy to use interface. It even has a shortcut to insert the time in your diary post! It’s as if the developer was reading my mind. I would highly recommend this for anyone looking for a personal diary. Just remember that it needs gtkspell installed for python otherwise it won’t even start. If you’re using ubuntu, just search for it in synaptic and install the python libraries for gtkspell.

Update:

Alamanah (updated link)

Almanah looks good, but again the main negative for this one, just like thotkeeper,  is that it isn’t password protected. But apart from that it has a nice calendar and the ability to store the diary entries in encrypted format. One unique feature about Almanah is the ability to add a definition to some text. This definition can be used to link your text to a file, note or a URL. Pretty neat. Plus it’s available in synaptic, so you can give it a shot.

Update (23rd Sep, 2011):

Lifeograph

Another personal diary option brought to my notice by Amit in the comments below. Unfortunately, I couldn’t get it to run on my Debian setup (yes, I’ve moved to a virtualbox Debian installation from a full blown Ubuntu install) and many of the dependencies seem to be in the unstable repo. But the screenshots look good and the features look great. It has been sometime since it was last updated (~10 months), but hopefully it will make it to stable some day.