Category Archives: web development

Let dig out a Localtunnel!!!

So as I creating a very early version of the webapp, I want to get opinion from friends. A few thing happen, I’m not quite ready to commit to a full blown installation. And I am too lazy to setup a ssh tunnel, and I didn’t attempt it before.

Of course, there is option number 3. Localtunnel, basically localtunnel is a ruby script that make tunneling very easy, without you having a ssh box remotely. They provide a linux box remotely, which have no shell and only authorized_keys file in home. So you don’t need a dedicated ssh box somewhere.

On linux, make sure you have ruby install, and rubygems installed. On ubuntu, on fedora just replace with yum. The rest of the instruction is on the link below.

sudo apt-get install ruby1.8 rubygems

http://progrium.com/localtunnel/

App Engine Adventure, Redux: lesson learned

After a whole full week, working, erm not quite working, coding, and hacking, my code is a bit hackish anyway. I finished my app engine application, and uploaded it.
It is in
http://sweemengsandbox.appspot.com/main

Here is what I learn, here is a list of stuff, that is not app engine specific:
1) Writing software is hard, ok I knew that, I finally learned it first hand
It took me 3 days, to comes out with the engine, and the next 4 days, tweaking and adding, and finishing the interface at the same time.

2) Python can be easy, if you know enough
Python make things very easy, because it provides a lot of functions and class, that make life easy, provided, you know it. Which is where 3) comes in

3) Python documentation is a nice thing to keep
At one point, I have problem to automate the task of identifying, the image format. It turn out that, there is a imghdr, module, I found that out in the python module.

4) appengine documentation is useful
I have to rely on the documentation a lot to comes out with something.

5) Interface is hard to do
Fine I was using emacs to create the HTML, most of the 7 days were spent of determining the right interface, and try to get it right. But in the end, I still didn’t get it right. Maybe I lacked the artistic side.

6) But dojo really helps in designing interface
Instead of having to craft my own css, I just use dojo own bordercontainer, Which make it easy to design the layout. As a bonus, I am able to decorate the form a little, with somewhat nice looking interface.

7) On the other hand
dojo can be overwhelming, because I have to learn while I do. Dojo can be slow, on a slow network connection, the dojo widget don’t really work well. and Dojo cannot do everything

8) Knowing the fundamental is useful
Today, I realize that there is something dojo cannot do, so I have to roll my own javascript, and css.

9) Having friends, to help out is useful
My friend Omprakash, help me found out that, I need to resize the pictures, and Ben gibe me some insight on the software.

10) Writing program can be satisfactory
Sometime writing program is just fun, for some reason, I kinda addicted to it.

And it ends up as a top 10. Imagine that.
Coding an App Engine(or any python application) is fun. Here is the last one.

11) But what really sucks is,
there is some restriction on the api, one, a few python api don’t work, such as PIL(it make image resizing easy), because it cannot be python c extension. There is limit on how many file one can upload to app engine. Because I cannot upload dojo to it, on the other hand, cdn helps a lot.

Fun with python: web development with Django: part 2, a little overview

Like many framework like, ruby on rails. Django have a set of utilities.

First thing first,
– django-admin.py. This is the main admin utilities, it have everything from start a project synchronize database, generate sql, shell, run the server.

usage:
just call it in shell
django-admin.py
this will show, the set of options and parameter

django-admin.py startproject name
this will start a project. Which will generate a directory, with the settings file, urls.py which map url to your application, __init__.py and manage.py

– manage.py. This is another admin utility, I didn’t see much difference detween this and manage.py. but in most django tutorial, we manage our project, with manage.py.
usage:
in the project directory, in shell
python manage.py
it will show a set of option, similar to django-admin.py

to create new application
python manage.py startapp application-name
this will create your application, the stub of models in model.py, views in view.py

the userdir apache module

By default, the apache webroot, in ubuntu, or most distro. Is in /var/www. Which is not really a big deal, except, it’s a pain to finish writing a php script, then as root, or sudo to cp to /var/www.
If it’s just a server, it’s perfectly fine, for a development machine, it’s a pain.

On the other hand. There is a userdir, module in apache. What it does basically, is it enable you to put your file in your home directory, then apache will serve the file there. By default, apache will search in /home/youraccount/public_html, or /home/useraccount/www or /usr/www. To access the file, you just need to call by http://yourserveraddress/~youraccount, with a browser.

To make it easy for me to write stuff into, i just use the form in my home directory. The implication is that, you can redirect your ide to use the directory as your work space.

To do it on ubuntu, inside, /etc/apache2 have a mods-available directory, another is mods-enabled directory. The former is the modules available, the latter is just a symbolic links, to the modules in mods-available.

To enable userdir, in /etc/apache2
run the following in a shell

sudo ln -s mods-available/userdir.load mods-enabled/
sudo ln -s mods-available/userdir.conf mods-enabled/

and don’t forget to create, public_html in your home directory.
to test it just call your browser direct to http://localhost/~yourusername

Or do it properly, we can start a small web hosting business
, or have friends to share a web space, on your server. etc.

Fun with python: web development with Django: part 1 setup

After setup my database, install the ide(the openkomodo post). Now, the next step is to start a project. And I decide to play with python, and django is in my list, because 1) it’s python, 2) it’s works on gutsy, where as turbogears don’t. 3) I kinda like the django’s own ORM.

First thing first, installation is dead simple,
1) get django
http://www.djangoproject.com/download/

get tar file, It just happens I use that.
2) untar it somewhere,

3) run the command in the directory you untar’ed

python setup.py install

So nothing special.

One note here is, you will need a extra web server. It turn out that, django assumes that, there is a separate server, other than it’s own server, serving media like image and file. And it is a pain that to create a links etc. It’s actually easier to just enable userDir in apache. and put in the picture in public_html directory, in your home.

I need userdir because, it need a directory that can be written into. And since a ubuntu user account cannot directly access the apache root, which is in /var/root.

Now you have a web framework, that have a few interesting feature, and a internal server for development purposes

ruby on rails on netbeans 6

One reason why I get the latest netbeans is ruby support. Netbeans it self have a ruby version, jruby, but it support the native ruby installed.

The difference between the both is, if you download the full version of netbeans, you will get jruby, without needing to install ruby on your system. Which features gems, too. On the other hand, native ruby is supported as well, it just that, netbeans do not have the necessary permissions, to access gems. But syntax, highlighting, works quite well.

So using it is a matter of selecting ruby on rails project under ruby, when you start a new project

And also a generator, to generate stuff, like model, scaffold, controller, and other thing that you done, on the rails generate script

But really, it is not much, it is just a gui for process that is usually done, on shell, nothing ground breaking here, just that having a ide that do syntax highlighting on ruby is quite cool.

p.s able to run ruby on netbeans without ruby, rocks too

been playing around with free web hosting

Not too long ago i play around with google page creator, after finding it a bit limiting. So I try another free web hosting. First thing first, last time i created a webpage is in my 1st year in the university. 3 years back, so it is really sometime.

First thing i noticed, it turns out that, now web based, wysiwyg tools, is quite common. And 2 packages i tried, now comes with, add-ons. But unlike google’s own gadget seems a bit limited. Also they have a html edit, which is interesting, and flexible too.

Let’s start with geocities, I tried with the free package, since, i don’t really have cash with me. Now , first impression. The page editor don’t work, because there is no 64 bit version of java plug-in. And it need java to run. On the other hand, it have a web uploader, so i can create on desktop then upload it. It also integrates with yahoo 360. Which I stop using for sometime, other seems cool. But it got only 20 meg or disk space to use.

Then move on to tripod, pretty much the same with geocities, except it doesn’t have yahoo 360 integration, not that i need it anyway. On the other hand, the page creator works quite well.

Now to take time to play around.

playing with yahoo pipes.

Yahoo pipes is one a service by yahoo, to create mash ups. Or rather mash together data source, to be used for your program.

Basically what it does is, first you need to get the data source, which could be a json, atom, or rss. then, filter it based on the criteria you provide, using the modules provided.

Here is an example, using feeds from, forum.lowyat.net

http://pipes.yahoo.com/sweemengs/lowyatforumjobsearch