function inspect(obj, maxLevels, level)
var str = '', type, msg;
// Start Input Validations
// Don't touch, we start iterating at level zero
if(level == null) level = 0;
// At least you want to show the first level
if(maxLevels == null) maxLevels = 1;
if(maxLevels < 1)
return '<font color="red">Error: Levels number must be > 0</font>';
// We start with a non null object
if(obj == null)
return '<font color="red">Error: Object <b>NULL</b></font>';
// End Input Validations
// Each Iteration must be indented
str += '<ul>';
// Start iterations for all objects in obj
for(property in obj)
// Show "property" and "type property"
type = typeof(obj[property]);
str += '<li>(' + type + ') ' + property +
( (obj[property]==null)?(': <b>null</b>'):('')) + '</li>';
// We keep iterating if this property is an Object, non null
// and we are inside the required number of levels
if((type == 'object') && (obj[property] != null) && (level+1 < maxLevels))
str += inspect(obj[property], maxLevels, level+1);
// Is there some properties in obj we can't access? Print it red.
if(typeof(err) == 'string') msg = err;
else if(err.message) msg = err.message;
else if(err.description) msg = err.description;
else msg = 'Unknown';
str += '<li><font color="red">(Error) ' + property + ': ' + msg +'</font></li>';
// Close indent
str += '</ul>';
Tuesday, April 29, 2008
What can I say? Ubuntu is pretty bleeding edge. :P It comes with firefox 3 beta 5 which is pretty slick. But there are still a lot of add-ons which do not work with firefox 3 beta. Earlier on I've blogged about using the 1.1 beta of firebug with firefox 3 beta. It works pretty well on my home box which runs arch linux. But on my computer at the office running on Ubuntu, firebug doesn't even come out. So I had to find a way around.
Luckily Firdaus of OSCC showed me that you actually can install Firefox 2 on Ubuntu. It's still in the repo and you just have to select it with synaptic or apt-get 'Firefox-2'. But the default installation will share the same default profile of Firefox 3 and so will break firebug when you launch Firefox 3. So what can you do? KageSenshi showed me how creating profiles for firefox will solve the problem. Well, first you have to create a different profile just for Firefox 2 by running 'firefox-2 -profilemanager'. There you can create your profile. Make sure you never use this new profile with Firefox 3 so what we do is that we change the command of the icon to start firefox 3 to 'firefox -P "Default"' and the icon to start firefox 2 to 'firefox-2 -P "firefox2"' (Use the name of the profile you created before). I don't think you can run both versions at the same time but I don't have time to experiment right now. These settings work and I have to get back to work.
Saturday, April 19, 2008
I was having lotsa trouble understanding why wasn't my rules applying to the vhost I was setting up. But after reading that I know you weren't suppose to create multiple NameVirtualHost entry. Just one. The ServerName inside the VirtualHost block will determine whether that block applies to the query or not.
Friday, April 18, 2008
ssh-keygen -t dsa
And that will create an id_dsa.pub file in your ~/.ssh folder (By default, you can set it in other places if you want). Anyway, copy the content of that file (it should be just one line) into the ~/.ssh/authorized_keys file on the server you want to login. Now whenever you ssh username@server you'll access it straight away without any password. And scp also works without password so you can write those scripts.
Update: dsa doesn't seem to work anymore. Try using rsa.
http://www.faqs.org/docs/Linux-HOWTO/Bash-Prog-Intro-HOWTO.html. That should be able to bring you up to speed till you start writing whole apps in bash.. ;)
Thursday, April 17, 2008
Starting to look good.. :)
Wednesday, April 16, 2008
Tuesday, April 15, 2008
Username: Your full email address (i.e. email@example.com)
Outgoing Mail Server: smtpout.secureserver.net
Outgoing Mail Server Port: 25, 80, or 3535.
And so first I tested the ports. After telneting the host and ports I finally decided that most probably would work best because the server response has the word 'auth' in it (I have no idea whether it's even relevant or not). Anyhow changed it my /etc/postfix/main.cf to use the 3535 port:
relayhost = smtpout.secureserver.net:3535
And the most important part is the username. It is firstname.lastname@example.org. It is the email@example.com you registered your free mailbox with. Not your login name to godaddy. Use the email address. And then run postmap, restart postfix, and viola, it is sending mail and those mails don't just get dumped into trash. Fuh...
Thursday, April 10, 2008
First step, enable webdav in plone. Go to the zinstance/etc/zope.conf file and unremark the webdav part.
# # valid keys are "address" and "force-connection-close"
And restart your zope. That ought to make it listen to port 1980 on localhost for webdav connection.
Then go to your apache web root folder and add a folder with the same name of your plone instance. Inside there put a .htaccess file like this:
RewriteRule ^($|.*) http://localhost:1980/dev/$1 [L,P]
And that will redirect any access to your folder to the proper port (Note: because you can't use VirtualHostMonster for webdav, it has to be in the same folder as your plone instance. You can put the redirect to your plone instance in a different folder and redirect it from there with VirtualHostMonster).
Okay.. Once that is done you should be able to access it using a webdav client. It has to be a webdav client, not your browser because your browser will not know how to handle webdav. Ok.. so for the webdav client? For ubuntu you can try here:
http://sysblogd.wordpress.com/2007/09/09/ubuntu-mounting-remote-filesystem-using-davfs2-fuse/ . Then you can use it just like a normal folder. Cool.
Oh.. for more reference go to:
Tuesday, April 8, 2008
Monday, April 7, 2008
rsync -av -e ssh username@host:/source/directory/ destination/directory
Or if you need to ssh over a different port you would do something like this:
rsync -av -e "ssh -p 443" username@host:/source/directory destination/directory
-a for archive. -v for verbose. -e to specify to use ssh.
Thursday, April 3, 2008
- Install awstats package
- Edit a file called /etc/awstats/awstats.hostname.conf where hostname is the hostname. Put something like this in it:
- Make a directory called /var/cache and chmod it 777 so it can be used from the web server
- Copy icons to web directory:
cp -r /usr/share/awstats/icon /var/www/icon
- Run this to update databases:
/usr/lib/cgi-bin/awstats.pl -config=hostname -update
- In your web browser, go to the url:
- Study the stats in quiet awe
- Edit crontab to update stats automatically every night:
0 1 * * * /usr/lib/cgi-bin/awstats.pl -config=hostname -update
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...
My blogs' name is High-Tech Rojak but I don't recall ever talking about food. So here's a first. Just recently I got some free t...
I've been thinking quite a bit about documentation and the 'cost' it involves. And when I say documentation, I mean documentatio...
Documentation.... Documentation never change.... (end fallout war never change reference) I don't particularly like documentation. Sor...