Search Results

Religion

You might have noticed that I have an item named religion in my tag cloud. Does that mean I have suddenly become religious? Hello no. Exorcise that thought. Religion is the opium of the poor (well I am not exactly rich but I am not poor and don't do opium). Heaven and hell exists only in the minds of preachers. Lots of other geeks are religious though. They would swear by Java, PHP or some poor souls who need to be rescued even swear by primitive things like C# or .NET (windows really does sucks (No that has nothing to do with religion , it's a scientific fact)). So this tag, religion is about such arguments like 'PHP is better than Java' and 'perl is better than python' (anyone want to compare Fortran and Python?). Well what's really better, is it PHP or Java? well it's a matter of horses for courses (but PHP has recently lost the plot a bit with an API that is way too big, but then Java is showing it's age too). While still on the subject of religion and religious wars you might ask, Is Fedora better than Debian?  Yes Fedora is miles ahead of Debian (but even so, Debian is much better than Windows)

AITCOM(SUCKS).net

You might have already seen my comments about aitcom.net - accessing s site hosted there is like playing the lottery - you never know when your lucky number comes up and the browser finally opens up the page for you. Like the stupid idiot I am, I didn't type in 'aitcom.net' into google before signing up for their dedicated server package. If I had done so I wouldn't have touched them with a barge pole. (Note to self: when doing business with an unfamiliar company always google on the company name). these are some of the things that I came up with in my search. AITsucks.com being the most prominent. Here is what they say: 1) AITCOM.net's service - or why I'm missing almost $200 - Ricardo

PHP HTTP Clients and on the fly gzip compression.

You can speed up your website, by making your web server perform on the fly gzip compression. Any old web server including the lame IIS can do that. Similarly any old web browser including the badly designed, badly written Internet Explorer can transparently decompress this gzipped content. Unfortunately the same cannot be said about some HTTP client libraries. But it isn't as bad is it sounds. These client libraries simply avoid sending the 'Accept-Encoding: gzip,deflate' header and the server will respond by not deflating the content. So the only thing you lose is a bit of speed. Well you might lose a bit of money also if you pay by the gigabyte for your bandwidth. If you are building a web services client with PHP, you can try to combine the PHP HTTP wrapper the zlib extension to read and deflate gzip compressed data. One php.net contributed note on php.net suggests to 'daisy chain' the zlib:// and http:// wrappers (). Another approach is to rely on gzopen. They will both echo out the HTML of the web page at http://raditha.com/ - but appearances can be deceptive. If you analyze the traffic with wireshark (or any old packet sniffer), you will find that the 'Accept-Encoding: gzip,deflate' header is not being sent and it's counterpart 'Content-Encoding: gzip' is not included in the response. The above code appears to work because the PHP Zlib extension will open uncompressed files without complaining. In other words, when it encounters uncompressed data, gzopen behaves exactly like fopen and gzread behaves like fread. So if you want to benefit from the deflate module on your webserver, you will need to use your own client library. How to create a client library is beyond the scope of this post, but I will explain how you can set and get the headers and decode the data. In order to make sure that the server compresses the content you need to do: fwrite($this->socket, "Accept-Encoding: gzip,deflatern"); Usually images and other binary files will not be gzipped, so you need to make sure that the server sends back the 'Content-Encoding: gzip' header before you actually try to decompress the message body. $this->headerArray = split("rn", $this->headers); foreach($this->headerArray as $head) { $parts = split(": ",$head); if(strtolower($parts[0]) == 'content-encoding: gzip') { $gzip=true; } } It's not a requirement to convert the headers to lower case before comparision; we are just playing safe because sometime you find weird servers not capitalizing the second word in the header. Once you have identified that the content is gzipped, you might be tempted to just use the gzinflate() method to inflate what you read in from the socket. gzinflate(stream_get_contents($this->socket, $length-10)); you will only run into an error PHP Warning:  gzinflate(): data error in /var/www/clients/twitter/RadHTTPClient.php on line 261 PHP Stack trace: PHP   1. {main}() /var/www/raditha/http-deflate.php:0 PHP   2. RadHTTPClient->getMessageBody() /var/www/raditha/http-deflate.php::20 PHP   3. gzinflate() /var/www/raditha/RadHTTPClient.php:261 It happens because the gzinflate() function doesn't expect to deal with the gzip header. The header contains the gzip magic number as well as other flags such as file modification time etc. This header has to be stripped out before you pass it into the gzinflate function. if($useGzip) { $b = fread($this->socket,2); if(ord($b[0]) == 0x1f && ord($b[1]) == 0x8b) { $gzHead = fread($this->socket,8); $s = gzinflate(stream_get_contents($this->socket, $length-10)); } } if the magic number 0x1f8b is not found you can treat the data as already uncompressed data (of course you will need to add the 'else' to go with it). One last thing; if you want to enable one the fly gzip compression with Apache all you need to do is to add the following directives to the httpd.conf file LoadModule deflate_module modules/mod_deflate.so AddOutputFilterByType DEFLATE text/html text/plain text/xml

MIDlet development on the 6600 - Code Samples

You can download sample code related to the discussion, you need to have a J2ME development enviorenment to compile them (eg. Sun Wireless Took Kit 2.0 or higher). Even though the midlets can be executed on the Nokia 6600, Some of these samples may not work on KToolbar 6600.zip The source code in this zip archives contains: BaseMidlet.java The base class for all of the midlets used in this demo. It defines two utility methods for displaying application and error (exception) messages. HTTP.java Retrieving a web page using the GET and POST methods. MickeyMouse.java A class that captures audio input - which sounds like 'Mickey Mouse' when played back. Audio data is saved in the RMS. MickeyMouse.java A class that captures audion input - which sounds like 'Mickey Mouse' when played back. Audio data is saved in the RMS. Record.java Capture an audio clip in three different formats to determine what works best (turns out to be AMR). Play.java Plays back audio data from the record store. This class is the counter part for the MickeyMouse.java and Record.java classes. VideoRecord.java Will attempt to capture video data from the phones camera (and will fail in the attempt because RecordControl is not support for capture://video) File.java Will try and (fail) to access the filesytem using the File Connection Optional Package of the GCF. The zip file also contains the compiled binary (unsigned) jarfile and it's descriptor. You can deploy the demo directly on your mobile phone by pointing it at http://www.raditha.com/6600.jad If you are interested in configuring your webserver to deploy midlets this way, add the following lines to your apache configuration: addtype application/java-archive jar addtype text/vnd.sun.j2me.app-descriptor jad These directives can either be placed in the .htaccess file or the httpd.conf file, if you place then httpd.conf, apache has to be restarted.   The 6600   |   The MMAPI   |   The Connectors   |   The Verdict   |   Download

The Java Help System

You came here probably because you are a software engineer or web developer, you would know how to use an FTP software. Both SFTP Applet and FTP applet seem to attract a large percentage of users unfamiliar with the File Transfer Protocol. Or how to use a File Transfer Program. Why is that? because we get a lot of sales from companies involved in the imaging/printing/music industries. So a help system has been a long felt need for these products. Today I downloaded javahelp as a first step in the process of identifying a suitable software for making the help system for these and other products that we put out. Let's see how it goes I will share my findings online. The first impression is that the docs aren't as good as it should be.   update 2011-11-28 : The javahelp system discussed here has been long discontinued

300 days, 300,000 pages, 30,000 downloads

Yops, that just about somes up the statistics for my Mega Upload project. Of course the top ten projects at sourceforge get ten times as many downloads each day as does megaupload. But then these projects are usually hundred times bigger in size. The other day I wrote about a new release for the java edition, unfortunatley I couldn't quite get around to making up the tarball and adding it to the projects downloads. Of course it's a trivial task but it is alwasy such trivial tasks that fall pray to procrasitination but finally I managed to get around to it. While still on the subject, it's about time that I upgraded the online demo as well. The new 1.4x branch is much more scalable than the 1.3x branch and the demo is being accessed more often than it used to be.

p7131 Radio

Yipeee. After a quite a struggle, the analog TV tuner on the P7131 is working fine with mythtv and tvtime. However I cannot say the same about it's radio. The radio doesn't work at all. The only thing I can get out of it is an entry in /var/log/messages that says "tuner' 1-004b: tuner has no way to set radio frequency". A google search for the error does not brings up anything usefull. But there was one post in a mailing list that included a patch for the saa7134 drivers. In fact during my countless searches over the past few weeks I have seen innumerable patches for the saa7134 and other drivers. Many of the posters claimed that they were required to make even the TV tuner work. The truth is that none of them were needed. My kernel is supposed to have support for this card already. This particular patch though, appeared different and I got the feeling it might address the issue. It's been a long time since I last compiled a kernel. I am very reluctant to go through all that again so decided to apply the patch and compile just the relevent modules.

J2SE 5.0 or J2SE 1.5

Yesterdy I visited java.sun.com after a weeks gap to find a strange new creature on the products page. It was called Java Standard Edition 5.0, this new creature is something I have never heard of before. There weren't any definitive article (one that could be easily found anyway) that described what exactly that they have done, So I am happily jumping into my own conclusion and here it is. It appears that because of the new language features that are supposed to be integrated into the new version of the J2SDK, they may have decided to number the java langauge specification as version 5.0. This is somewhat similar to the confusion we had over java 2 and J2SE 1.2 - people are still confused by it. Going by the same rules the new language standard would then be called java 5.0 (a huge leap from java 2.0, but 2.0 was released during the last century) and the new J2SDK is called J2SDK 1.5. A pattern somewhat similar to the tactic they adapted with Solaris long time ago and also similar to the redhat versioning scheme where version 8.0 and 9.0 are very similar despite the change in major version numbers. I have just downloaded the SDK (beta 2), let's see if the released notes can shed more light. Follow Up: The plot thickens

The less well known log analysers

Yesterday, I took a look at three big names in web log analysis; analog, awstats and webalizer. Today is the turn of some less well known products that are listed on freshmeat. There are hundreds, so only the products that do not have the appearence of abandonware were anlysed. That is only products that have released a new build during the past few months were looked at. The first such was Visitors, a nice little 70kb download. Installation was a piece of cake (just type make). Running it though is not quite the same because Visitors does not seem to have a configuration file. All the settings have to be passed in as command line parameters. Secondly it does not allow you to change the logfile format, but since it recognized my own files I shouldn't be complaining. Visitors has two features to help you figure out what 'trails' a visitor took through your site. As the author of analog takes great pains to explain such reports are unreliable and downright misleading. The second feature (related to the first), is the ability to produce a graph of the visitor's path. It requires the graphviz package to be installed. Next I tried something called logmine. Words fail me. Then I tried a program called Nettracker, it claims to be an award winner. Who ever gave them the award didn't try their installer. The next victim was Web Druid a webalizer fork, and that sounds promising. Webdruid can also interact with graphviz to show you which paths the user took through your site. I didn't bother to find out if this feature was infact available in webalizer. Looks like another study, this time a comparision of webalizer and webdruid is in order, but first they need to be persuaded to accept my log files.

Gnome Upgrade

Yesterday's story was about a Jmeter installation that dragged over many moons. Here is another. I began an installation of gnome 2.6.1 from source a quite some time ago. Don't for a moment think I spent six weeks doing nothing but compile gnome, instead I would multitask running the configure, make , make install in the background while doing other work in a foreground process. Naturally thread priority was for the foreground task, some days the background task never had even as much as a clock tick Anyway in the end finally reached the stage where gnome would (reluctantly) start up but as the screen shots will reveal it's a very reluctant installation indeed.

Copyright or Copyleft?

Yesterday's Lakbima newspaper carries an article saying copyleft is a figment of daya dissanayake's imagination. You can bet your hard disk that this guy laboriously wrote that article with pen and paper and then went with it to the post office to send it off to the editor. Because if he had access to a computer or phone connected to the internet, he would have first typed in 'copyleft' into the Google search box and clicked through to the first result - the Wikipedia page on copyleft and discovered that it's not a figment of anyone's imagination, least of all my father daya dissanayake's. Incidentally Wikipedia itself happens to be a copyleft work. Recently a bunch of guys launched what they call the first Sri Lankan e-book library. All the best to them, but I have no connection with it what so ever. Neither does daya dissanayake, but he did make the keynote speech at their launch and he spoke on the subject of copyright or rather how the current copyright laws only seem to benefit publishers at the expense of authors and readers. This speech was picked up by several newspapers, and carried last week. Now one Bobby Boteju, who calls himself a writer but just happens to be a translator has chosen to shoot that down and to protect the publishers' interests. Sadly for him, he forgot to spend 30 seconds on research and made a fool of himself. Hang on a second, this guy is (or was) a Director of the Sri Lanka Performing Rights Society. Worse still, he has even written a book on copyrights! well no wonder copyright, and copyright protection is in such a sad state in this country. Kind of proves the point daya dissanayake was trying to make. Maybe I am being unfair, maybe Boteju can't afford a computer because he's spent all his money paying royalties and license fees to the publishers of the works that he translated. Being a staunch supporter of the copyright regime, that's what he would do even though it's said that many translators do not. His decision not to use a pirate copy of MS Office running on a pirate copy of MS Windows should be applauded. That's what many people in this country actually do. In fact Sri Lanka ranks at number 6 when it comes to software piracy. Yep, a healthy respect for copyright indeed. I am sure Boteju would not have used an Indian film star on the cover of any of his books like most writers seems to. Sometimes book covers are scenes straight out of Bollywood movies, they don't even bother to Photoshop (wonder how many legal copies of Photoshop exists in this country, there are millions of pirate copies). Makes you wonder if the book is based on the Bollywood movie too. Don't be surprised if it is.

Finishing up Jekyll migration - this time for real

Yesterday's goal was to finish off the migration from Wordpress to Jekyll (a destination that was arrived at after a long journey), however there still was a couple of sticking points including paginated categories and tags. Thankfully I found a really well documented plugin which someone with only very elementary Ruby knowledge such as myself could understand at realjenius.com The Realjuenius plugin is a Swiss army knife. It does categories, tags , RSS and includes pagination to boot. By the way do people still use RSS and atom? I see precious few requests for the feed in my log files but the saying is that you shouldn't look a gift horse in the mouth. The rss feed comes at no extra cost, so keep it. Only a few teeny weeny mods were needed to make this plugin behave the way I wanted it to. One is that category names need to be downcaseD and special characters in category and tag names need to be escaped, but these are things that can be managed with my elementary ruby knowledge. Now comes the most boring bit, working with the design. I am not too keen on preserving the existing design and I am not bothered about changing it either. So I am going to put myself firmly on the fence; adapt Twitter Bootstrap with a UI that looks pretty much like the existing design (which is based on the now unmaintained Wordpress Magallen theme)

Android 4 on VirtualBox

Yesterday's attempt to install Ice Cream Sandwich as a guest OS on VirtualBox didn't quite work out. I kept digging and came across a a post on that's geeky where the blogger had attempted to build a VM starting with the Android sources. Well apparently that blogger's day job doesn't involve computers at all, no wonder he can afford to do that sort of thing. Fortunatley this guy had placed his VM online to spare the rest of of merely mortal geeks the hassle of going through all that. The only catch is that his VM didn't work for me either. [ 6.008455] init: Timed out waiting for /dev/.coldboot_done [ 6.017664] Kernel panic - not syncing: Attempted to kill init! There were many suggestions on the web but one that seemed plausible was to chmod and chown the init.rc file But instead of doing that I looked for other images and found one at buildroid. Guess what? same error.

Red Hat 9 -> Fedora Core Part II

Yesterday when I finally managed to boot up after migrating from Redhat 9.0 to Fedora Core 3, it was with a minimalistic installation. An installation without gnome, KDE or any of the office or developer tools. Adding these packages turned out to be a wrist spraining affair. The package manager at first refused to recognize CD changes, this was tracked down to the fact that the cd was mounted at /media/cdrecorder and not /mnt/cdrom creating a new folder in /mnt seemed to take care of that but I had to change CDs at least 30-40 times to get all the packages in. Firefox and thunderbird when they were installed did not detect the old settings properly so I decided to browse with konqueror and download the latest versions of these software. The download manager for kde, Kget seemed to work fine for a while but then it just disappeared and nothing would coerce it to show up on the desktop again so I had to go back to the versions found on the CD. (yikes it does not recognize the java console extension) Thunderbird no longer appeared to choke with the Segmentation fault I reported earlier but it had the same problem all previous versions of mozilla mail had; it chokes when copying a message to the outbox Having lost a full day thanks to the installation/upgrade process, I was desperately keen to get back to work and decided to take a risk and install apache and PHP from RPMs, I should have known better. It was a big mistake. The news installation refused to execute cgi scripts outside the cgi-bin folder. The log file says Permission denied: /home/raditha/websites/raditha/mt/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable There was a lot of bull in various mailing lists about this having to do with file system permissions. That's most unlikely, after working with apache for around 8 years i am sure i would know how to set the correct permissions. Rather than wasting time trying to figure this out (you are not supposed to use RPM installations of apache anyway). So apache was compiled from source along with a minimalistic php engine. Hopefully I will be able to get back to work quickly and have something good to say about fedora tomorrow.

FTP Applet

Yesterday we released the latest version of the FTP Applet. This new release makes has some significant improvements over the previous versions. The most important change is the fact that you can now switch on and off between displaying hidden files. Hidden files as we all know are not too well hidden, in unix like operating systems all you need to do is pass an additional parameter to `ls` to display them. The behaviour of FTP servers isn't very different. The settings dialog can now be used to put on or take off the invisible cloak. We have had quite a few requests for the ability to delete non empty directories. We did not implement this feature upto now thinking that it would be too dangerous. Finally we decided that if that's what the clients want it's upto us to give it. So recursive directory deletion - or the ability to delete a folder that contains other files or subfolders is included in the 1.15 version of the FTP applet and deskto client. (Recursive folder upload and download has been supported for a long time) Both these features will soon find their way into our SFTP Applet as well.

The list idiot

Yesterday someone in the evolt list asked about using Weblogic to deliver servlets. Curiosly this guy doesn't even have a web application, he is just building a dynamic coporate website. What matters though is that he was willing to learn. So I commented about the waste of using battle tank to hunt deer and some other knowledgable posters said pretty much the same thing. The thread starter also wanted to know wether it's worth while to use jsp or servlets (or even struts (my god)) to build these pages. He went on to say that the each user of the site pretty much sees the same content. I suggested getting a simple PHP CMS and make it produce static html It was then that a know it all (you find them in every list) jumped in and replied my message sayin JSPs are compiled to Servlets and it happens only once (as If i didn't know). So that it can be considered that the html is produced only once. Obviously this idiot doesn't even know the difference between static and dynamic content. He also assumed that I was recommending PHP because I was ignorant of JSP!. I read in James Gosling's blog that someone in a recent discussion tried to teach him C. Why do people who only have limited knowledge of one technology assume that other people also know only one technology?

2 years for Rad Inks

Yesterday marked the second birthday of Rad Inks. It's not been an easy two years but it was thoroughly enjoyable, a time of ups and downs, thankfully it was mostly ups. When you start a software company without any external funding it's never easy but that's how Rad Inks began. In order to keep the fires burning we did small outsourced software projects at the start. Being located in south asia where the cost of operatings (and cost of living) is much less than it is in europe or the US made it easier than it would otherwise have been. I wrote last year that I was beginning to feel a slight breeze in my hair, it hasn't developed yet into a gale force wind but the breeze is getting stronger. Slow but steady growth is all that I need. I have worked for a company that grew too big too fast and came crashing down to the earth before. Don't want to see a repeat of that performance. By this time we have completely moved out of outsourced projects. We still continue to customize our own products and continue to take on projects that are built around our own software. It was in August of 2003 that we released our first download, the Rad SFTP applet. It was even featured on the official java website. Since then we have released a few more products the most popular being Rad Upload. The other products have not had the same welcome as Rad Upload, even Rad SFTP despite it's good start is lagging behind Rad Upload but that has not discouraged us.

Virus flood

Yesterday I recieved nearly 300 viruses in a 30 minute window. This mailer apparently send the virus to [email protected], where randomname was a name or sequence of letters chosen at random. Out of laziness I had configured my qmail installation to forward [email protected] to my own address. I need no further proof that this is a bad idea. I immidately reconfigured my server to bounce all unwanted messages and created forwards for all the addresses that I do want to recieve mail on. The number of virus mails dropped drastically. Another point worth mentioning is that the from and sender email addresses in these messages are forged. It's a quite common tactic with spammers. Many mail servers and desktop mail clients have blacklists that reject mail from supposed spammers. Unfortunately some of these systems black list the email address and not the originating mail server. As a result thousands of perfectly innocent people get into these black lists and find that they cannot send legitimate mails to some addresses.

Red Hat 9 -> Fedora Core

Yesterday having successfully managed to install Fedora Core 3, I decided to take the plunge and upgrade my heavily patched Red Hat 9.0 installation. It ended up being a disaster. Things got off to a bad start when the installer kept insisting that my /usr partition was too small. That is a lie, there was more than 1.1 GB free on it, but the installer wanted 430MB more. I cleaned out some unused files and moves some others to a different partition and managed to free up around 500 Mb. Then the installer wanted 19MB more!!. What's really annoying is that you get this message after traversing quite a distance down the installation route. You then have to reboot your existing installation, free up space and then boot up again with the installation CD. After quite a few attempts the installer managed to get over this disk space stumbling block but to my dismay I found that it will take around 150 minutes for the upgrade. The fresh installation took only about 40 minutes. After about 125 minutes the installer freaked out claiming one of the packages were corrupted. The end result was that my existing installation was messed up beyond repair and I didn't have anew installation to show for my efforts either. Booted up again with the installer and this time took to the hard disk partitions with a butcher's knife. I cleaned out the /usr and/usr/local partitions and made them into a stripe set. Then started afresh installation, which did complete in about 40 minutes. That's not the end of the story. When I finally managed to boot up again, it was only to find that the old root and the /home partitions were totallycorrupted this definitely is time to take a break.

First reboot.

Yesterday for the first time in a very long long time, I have had to restart my desktop because of a software failure. This machine does get rebooted once in a while. Most often it's because of a power cut. Sometimes I even switch it off alltogether but that doesn't happen too often. I have had many restarts over the last few years because of hardware failures. But i really cannot remember the lastime I had to reboot because the OS itself crashed. Even today the OS didn't crash - the keyboard did. That is all active software refused to recieve keyboard input. The keyboard was promptly unplugged and plugged back in but that didn't solve the problem - when not fully. If you put your weight on certain keys and kept it there for a second or two a character might show up on screen but that's about it. the Usual way to close X - (ctrl backspace) didn't work either. So in the end, I did the unthinkable - did a reboot.