Thursday, February 28, 2008

Shortcuts makes your life easier

Do you find yourself always typing long paths over and over again? Maybe because that is your project path? In vim the first command you do is :lcd and you have to type it in all the time? Here's a small idea that might make your life a little easier. Softlinks...

Make a directory on your home folder to keep all your softlinks. Make the directory name short. Maybe just one letter. I made mine s.

~$ mkdir s


Then make the link in there.

~$ ln -s /long/path/to/project/folder s/project


So now whenever you need to go there just key in:

cd ~/s/project


And tab autocomplete helps a lot here. Maybe you just need to type 4 keys (including tab) if you haven't got much links yet. And in vim? :lcd s/project and BAM you're working you're way to oblivion. Nice eh...

Monday, February 25, 2008

Search for packages and install them in mandrake

Just a little note in case I forget, under Mandrake to look for packages the command is urpmq and to install is urpmi. Simple stuff.

Saturday, February 23, 2008

Running Plone behind an apache server

Alhamdullillah.. After a whole night of googling and hacking configurations I was finally able to configure Plone to run behind an apache server. I began my quest by googling and finding this page: http://plone.org/documentation/how-to/apache-ssl . I don't need the ssl mentioned there but I did want to run Plone behind apache. But following the instructions didn't get me any result. So I tried to find out what on earth does the RewriteRule is actually about. After much googling again I found this: http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html which also led me to an interesting albeit not really what I'm looking for now at http://httpd.apache.org/docs/1.3/misc/rewriteguide.html. Sooooo... the [P] actually stands for proxy.

Ok.. so now I'm getting somewhere. After much trial and error I finally figured out that I need to run:
sudo a2enmod proxy
sudo a2enmod proxy_http

To enable the proxy function in my apache server. Once that is done, it seems the rules given at the first website is not really correct. So in the end my .htaccess contains the following:
<IfModule mod_proxy.c>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^(.*)$ http://localhost:8080/$1 [P]
</IfModule>
</IfModule>

But even though that is all fine and dandy, it didn't allow me to surf to more than the front page. All the subsequent links in the page was broken. And I experimented some more until finally I've got it at:

RewriteRule ^(.*) http://localhost:8080/VirtualHostBase/http/abdullahsolutions.com:80/VirtualHostRoot/_vh_plone/$1 [P]


Read the first article and it will mention about enabling Virtual Host Monster in the zope management page. But it did not mention about if you we're actually serving from a directory under your web root. Well, good thing the about page on the zope management page explained it all. So for the example above, my server was serving plone from the directory plone. The _vh_ tells the virtual host monster to append plone/ to every link it generates. Cool stuff..

So then I finally got it working. Alhamdullillah... Took a whole night. But seems to be very worth it.

Update (16 March 2008): Finally I've even got the layout working. After referring to http://matthewwhitworth.com/2008/02/06/escape-from-mod_rewrite/ and the Velo site it point to and also http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#mapfunc which explains what RewriteMap actually does. The RewriteMap part has to be part of the http.conf or if you are using Ubuntu in the sites configuration file. Then escape the request just like it says in the matthewwhitworth site and it all should work. Finally.

Wednesday, February 20, 2008

Recovering a file using subversion

Today I've just realized I actually deleted a file which is used in on of my projects. After googling for a while I found this http://svnbook.red-bean.com/en/1.2/svn.branchmerge.commonuses.html#svn.branchmerge.commonuses.resurrect which basically tells how to recover a lost file.

To sum it up, you have to first find out which version the file still exists in (that would be the version just BEFORE the file was deleted). To do that use svn log to look for it. I searched for it with something like this:

svn log --verbose | grep -B 10 name_of_file


The -B option is how many lines before the found line should be displayed. Quite important as the version number is actually on top of the log and not on each file line.

Once you know which version you have to recover from, it is a small matter of copying that file from the repository with a svn copy command:

svn copy --revision num_of_revision http://path/to/file/in/repository ./name_of_file


The file would be recovered and you'd have to commit it again to the repository so that it'd be available for everyone.

Sunday, February 10, 2008

Enable .htaccess rewrite in Ubuntu Server

Fuh.. Finally after so long abdullahsolutions.com is up again. It seems that actually it wasn't my hardware that was broken but just the filesystem of my old hard disk. Now I've put in a new hard disk and installed Ubuntu Server 7.10 on it. And just for the site itself I've decided to try out drupal.

Downloaded it and installed it. All seems to be going fine right now. No problems yet. Except for the pretty urls. I needed to enabled mod_rewrite and had no idea how to do that in Ubuntu Server. So after googling it a bit I found just the thing. Type:
a2enmod rewrite

That is short for apache2 enable module. That would create the necessary link in mods-enabled but I still couldn't use the pretty urls in drupal. Well, it turns out that the settings in sites-available/default would not allow override. So had to change AllowOverride None to AllowOverride All. It's good now.

Saturday, February 9, 2008

Welcome to the Rojak

Hi there. Some of you might not know what rojak is, so let me just introduce that first. It is a type of food found here in Malaysia which consist of many types of food. Some of them fruits, some of them nuts, some of them fried things. Point is that all of them are just mixed up in a big bowl and added some sauce and that is it. Mixed up of many kinds of food. Here I will write a mix up of high-tech stuff ranging from things like Linux and Ubuntu to Smartphone and PDA's. Whatever that might come to mind.

Is Blogging No Longer a Thing?

As I embark on my new journey to learn the Rust programming language, I find myself pondering—where have all the blogs gone? In search of pr...