Maharshtratimes.com (or maharashtratimes.indiatimes.com) is a marathi news website using unicode fonts. But it does not display correctly on firefox browser. The problem is because of a single HTML div which uses justified font style. It displays correctly on IE (which is why it is not getting fixed) - this could be because of firefox's buggy implementation of "align: justify" or that IE simply ignores that style (likely).
Here are some recipes for interpreting stream of bytes as different C types. I will keep adding more to this as I go...
Convert a byte stream (embedded in a string) into 1 byte signed integers:
=> [-4, -3, -2, -1]
Convert a byte stream (embedded in a string) into 1 byte unsigned integers:
=> [252, 253, 254, 255]
This post describes the steps that I took to restore an old server which had died some months back.
I had a linux server running debian pretty reliably. It had failed because of a hardware problems (broken power supply). I replaced the power supply and proceeded to make it current with security fixes. But as it happens when you update after a long time, (or it could also be due to my own itch to remove old kernels), I hosed the system. By that I mean that the system was running but somehow all the kernels had been removed (including the current one that I was running!). Anyway, in summary, the system would not boot because there was no kernel to do so.
Step 1: Okay, I thought I will just reinstall it with Ubuntu (which BTW is my new favorite distribution). But the problem was that the machine was using LVM and Ubuntu installer did not recognize the LVM volumes (even though it is documented to do so).
Step 2: So next stop was latest and greatest Knoppix which recognizes LVM. When I booted knoppix, I was able to see all the old partitions and data (70 gigs of legal *cough* songs, audio books and movies). Success!
Step 3: Next step was to chroot into the old root partition and use apt-get to get the kernel package installed back again. I confirmed that there was no kernel-image-* package installed! apt-get update would fail, because procfs was not mounted, so from out of the chroot, mounted the procfs. After that I was able to update the packages, but the install scripts failed because of errors. The specific error was /dev/null: Permission Denied. I was stumped. The device looked okay and the permissions also were okay (the script runs as root afterall). Upon some search I found out that it is because the default mounts in knoppix do not mount devices (nodev option). Once I fixed that, all things fell right in place.
I created a small form using which you can search the web for unicode devanagari words. It is very cumbersome to actually enter unicode devanagari characters using qwert keyboards, so I have adopted the phonetic transliteration scheme from Manogat website. Do give it a try:
http://amit.chakradeo.net/search/ (Link now removed, please see update below)
Start typing devanagari words phonetically and you will see unicode characters in the input area. When you hit enter, the phrase will be submitted to google.
I keep getting a lot of hits on some of the old posts (Ram Raksha Stotra and Hanuman Chalisa) with visitors asking for audio versions of the stotra. Here is a page where I will keep collecting the audio versions of various stotras.
Song from animation film Hanuman Mahabali maharudra beautifully sung by Vijay Prakash, Sonu Nigam, Shaan, Palash Sen, Kailash Kher, Madhushree, Sneha Pant, music by Tapas Relia and lyrics by Satish Mutatkar.
Lyrics in itrans ascii:
(jaya hanumaan gyaan guNa saagar
jaya kapiis tihu lok ujaagar
raamadoot atulit bal dhaamaa
a.njanee putra pavanasoot naamaa)
paraakram se gu.nje tribhuvan
dharatii paataal,duShTa bhanjan
jal saagar kare paraajay kra.ndan
trikaal nira.ntar lok va.ndan
If this does not work try turning debug to true above if you want to see the encoding.
Update: This still uses the GET method for checking the URL. Phishtank recommends using the POST interface (which will remove limitations on URL length: base64 inflates the length by 33%). Implementing that would need some kind of xmlhttprequest hackery. Stay tuned...
Update3: Thanks to "till" who commented below, here is the bookmarklet using the POST method so now the solution will also work for really long URLs. Till's solution is good, but it makes users trust his site (in addition to phishtank). So basically user has to trust that he is not trying to filter the results being presented..
I have also merged the two earlier bookmarklets so that the current site location will be autopopulated in the prompt, so that user can easily change it if he wants to check a URL different from the one he currently is on.
Against All Enemies: Inside America's War on Terror is a fascinating account of events that happened inside the White House before and after 9/11 and how the focus shifted from fighting the terrorists to war with Iraq. I got to know about this book after watching Clinton's interview with Fox News. where he repeatedly asks the interviewer to read this book. The book starts off describing events in situation room and then goes back in history and explains the background of how Al-Qaeda started appearing on CIA's radar. There is an interesting account of different presidents and their view of terrorism and the changes in the mindset from Cold-War era to terrorism.
I wanted to use the ruby geocoder library on the windows machine, but the installation of the gem failed due to some weird error. I checked the rubyforge project page to see if someone else had a similar problems and someone actually had, but the bug was open for a long time. I decided to fix this issue and found that the problem was due to the fact that windows platform does not allow characters '?' and '&' in the filename with any escaping, period. The said files were used (in a very innovative way I must say!) to test the library by modifying http.rb to return the test datafile contents instead of fetching the URL from the net. (yay open classes in ruby!). The way I fixed the problem was to change the filenames to use '_' instead of '?' and '__' instead of '&'.
I wrote to the developer, but there was no response. Anyway I managed to create a new GEM with the changed files so that this should be installable on windows now. Here are the files if you want to try installing the gem. (Also including the tgz because... it got generated anyway!) geocoder-0.1.1.gem geocoder-0.1.1.tgz
http://www.phishtank.com is a new service which aims to help weed out phishing URLs and email addresses using wisdom of the crowds. Users can submit emails/URLs which they suspect of fraud and others can vote if they really are fraudulent or not. I think it is a great concept. There is a REST API using which applications can embed this webservice within them. So for example, there could be a outlook plugin which will display "phishy" email addresses in a special way in order to alert the user immediately. Same for web browsers which can render phishing websites in a special stylesheet. The applications can also add interface for the user to submit suspect pages and email easily without using web browsers.
I checked out the API and it does not feel like it is fully baked! There are interfaces for authorization and checking email/url status and submitting new emails/urls. Some things that stand out immediately are:
Exclusive use of SSL for the API access.
Parameter authentication (i.e. including cryptographic digest of all the parameters to ensure that parameters are not changed using man-in-the-middle attack)
User registers on the web for API access and gets api key and shared secret
Using the API, application gets a frob (what is behind the name ?) and authorization url using auth.frob.request
User has to authorize the frob using the authorization url specified in the response. (optionally you can specify callback url which the server will call for authorization, I will need to check this from home when I have access to a server -- the docs are very thin about the mechanism)
Once authorized, app uses the frob and gets a token for short time API access (30 minutes in my tests) (auth.token.request)
App can check token status which tells remaining time on token.(auth.token.status)
App can revoke the token when it is done using it. (auth.token.revoke)
The APIs for check.url, check.email, submit.url, submit.email then use the token.
I did not understand why there is a need for FROB in this, why can't you just get the token from api key and shared secret ? What problem are they solving by this indirection ?
Anyway, here is the ruby script that I used for testing this... I am planning to turn this into a module, but providing it here for early access... phishtank.rb config.yml
P.S. the check_url interface is not working, I am getting invalid token error. and the same token can be revoked successfully.
P.P.S. The API uses SSL (no cleartext api available) and ruby's open-uri library insists on checking the server SSL certificate which always fails (probably because signer needs to be trusted by openssl), I had to change it locally to ignore ssl verification in order to proceed.
Update (Oct/12/06): the check.url interface is finally working. For this API, the signature needs to be calculated before escaping the url. I refactored the ruby script a bit to remove redundant code and moved the configuration to a seperate file. I still need to work with the response parser and make it general for all types of responses. XML parsing gets so ugly so fast, it's amazing!
Haven't been updating the blog recently... Here are some books I read in the last few weeks...
A View from the TOP (Audio Book) by Zig Ziglar. A very good audio programme about achieving significance in all aspects of life - Health, Finance, Relationships, Spirituality. This may be the first time I encountered someone being so open about his religious beliefs in a self-help program.
Think and Grow Rich by Napoleon Hill - about creating a burning desire to achieve success and generating ideas.
Digital Fortress by Dan Brown - I was fascinated by earlier two books by Dan Brown - Angels and Demons and The DaVinci Code and this one deals with topics that are dearer to me - Security, Encryption, NSA. But I did not find it as gripping as the first two. I was particularly turned off by the concepts (e.g. mutation strings) that the author tries to create for the story to advance, such things just turn the brain off. (That makes me think that maybe I enjoyed the first two books because I do not have any knowledge about the topics of Pope, Illuminati, Christian history)
Deception Point - by Dan Brown. This was even more boring about a new discovery by NASA, the politics, cover-ups, yawn...
The Da Vinci Code. I really liked the way the story is told. I wonder why any author cannot create such novels based on Indian Mythologies, Ramayan, Mahabharat ? Telling the story of someone trying to find out the Ashwatthama's gem by getting clues from Bhagwadgeeta ?