Sajal Kayan http://www.sajalkayan.com No Windows, No Gates, It is OPEN; No Bill, It is FREE Fri, 15 Aug 2008 09:35:08 +0000 http://wordpress.org/?v=2.5.1 en Facebook.com banned in Thailand? http://www.sajalkayan.com/facebook-banned-thailand.html http://www.sajalkayan.com/facebook-banned-thailand.html#comments Fri, 15 Aug 2008 09:24:18 +0000 Sajal Kayan http://www.sajalkayan.com/?p=97 Since the past few hours, it appears to me that True ISP of Thailand is trying to block one of the most popular socual networking site Facebook. The situation is not as serious as the title makes it sound…. but what the he_l it would be reality when someone at the ministry logs into it for the first time….

On attempting to open any page within facebook we get the friendly message which looks very much like it is generated from True’s stupid transparent proxy.

Just now my staff called True and guess what? The true helpdesk simply asked us to use their proxy in the settings.
Proxy server : proxy.asianet.co.th
Port : 8080

So does changing from transparent to an explicit proxy mean we are going from the frying pan into the fire?

Long live ’ssh -D’

Now, didn’t some lawmaker dude say that its illegal to connect via proxies or sumthin?

]]>
http://www.sajalkayan.com/facebook-banned-thailand.html/feed
Twitter is down again, Mein Führer http://www.sajalkayan.com/twitter-is-down-again-mein-fuhrer.html http://www.sajalkayan.com/twitter-is-down-again-mein-fuhrer.html#comments Fri, 08 Aug 2008 19:08:52 +0000 Sajal Kayan http://www.sajalkayan.com/?p=96 via @luke_bkk

Sorry if it offends anyone… Couldn’t just stop laughing really awesome!!!


Video by CrunchGear

]]>
http://www.sajalkayan.com/twitter-is-down-again-mein-fuhrer.html/feed
Leading Thai Undergarment company threatnes the press http://www.sajalkayan.com/leading-thai-undergarment-company-threatnes-the-press.html http://www.sajalkayan.com/leading-thai-undergarment-company-threatnes-the-press.html#comments Wed, 06 Aug 2008 03:22:42 +0000 Sajal Kayan http://www.sajalkayan.com/?p=95 I run a news.google.com published website. Recently we ran a story titled “5000 undergarment workers storm Government House“. The source of this story is National News Bureau, Public Relations Department of Thailand (Who has now pulled off the story).

The story on my site was published at August 5th, 2008 - 2:59 pm (Thai Time). At about 8:30 pm (too late to expect anyone working), I get a call on my landline *allegedly* from the PR company who takes care of the PR for “Triumph International (Thailand)”, the company the news story is about. I am really a dumb ass for not making a note of her name or the name of the company she works for.

She demanded I pull off the story as it is incorrect. They have made my source (and even their source) do the same. She said that the figures and facts were incorrect. I politely asked for the correct information, but she insisted I remove the story. I tried explaining to her that simply deleting pages which exist in many places in my link structure is harmful for my site. I told her ill comply to her request by morning as all my staff have left work. At this point I thought all was well, when all of a sudden she brought out a point that this is story is wrong and that there can be legal action taken against us.

WTF!!! I said ill comply why you wanna talk about legal action?

At this point the story is still active on the site for the following reasons.

  1. For all we know the the call was not from someone authentic. Someone was fooling with me.
  2. I haven’t received any request or threat in writing.
  3. The request came in too late, beyond our office timing (9am to 5pm)
  4. We have not received any press release or press statement from the company.  Even their pressroom doesn’t have Thailand in the list.

Friendly tip : If you want to damage reputation of your competitor, call up all media outlets you can think of, pretend to be the competitor, and give them legal threats. Make sure to leave no paper trail.

Would love to see your opinions via the comments. I believe this is not an issue to be taken lightly. Should i suck up to the TPTB?

Edit1 : The original story is also published here.
Edit2: Very interesting discussions at the Bangkok Bugle

]]>
http://www.sajalkayan.com/leading-thai-undergarment-company-threatnes-the-press.html/feed
Ruby class to fetch suggested keywords http://www.sajalkayan.com/ruby-class-fetch-suggested-keywords.html http://www.sajalkayan.com/ruby-class-fetch-suggested-keywords.html#comments Sun, 03 Aug 2008 22:53:12 +0000 Sajal Kayan http://www.sajalkayan.com/?p=93 I have recently ditched Perl and fell for Ruby.

Here is a Ruby class which gets suggested keywords from yahoo API and presents it in a comma separated list. This might be useful for people who use Ruby to upload/edit multiple posts and need to tag them automagically.

This might be awfully simple for the hardcore guys, but for a noob like me, had I come across this example earlier it would have saved me an hour or so. Here it goes…

The Class :-

  1. # A ruby class to fetch suggested keywords using Yahoo’s term Extraction API
  2.  require ‘rubygems’
  3. require ‘xmlsimple’
  4. require ‘net/http’
  5.  
  6. class Tagger
  7.   def content
  8.     @content
  9.   end
  10.   def content=(content)
  11.     @content = content
  12.   end
  13.     def appid
  14.     @appid
  15.   end
  16.   def appid=(appid)
  17.     @appid = appid
  18.   end
  19.   def initialize
  20.  
  21.   end
  22.   def fetch
  23.           url = URI.parse(‘http://search.yahooapis.com/ContentAnalysisService/V1/termExtraction’)
  24.       post_args = {
  25.             ‘appid’ => appid,
  26.             ‘context’ => content,
  27.             ‘output’ => "xml"
  28.       }
  29.       resp1, xml_data = Net::HTTP.post_form(url, post_args)
  30.       keywords = ""
  31.       data = XmlSimple.xml_in(xml_data)
  32.       data[‘Result’].each do |item|
  33.       keywords = keywords + item + ", "
  34.       end
  35.       return keywords
  36.   end
  37. end

Download the class here
Sample usage :

  1. require ‘tagger’
  2. tagg = Tagger.new
  3. tagg.appid =     ‘GO_GET_YOUR_OWN!’
  4. tagg.content = "The content of the post….."
  5. puts tagg.fetch

The appid is available from the Yahoo Developer Network
Limitations : Maximum 5000 queries per day per IP.

]]>
http://www.sajalkayan.com/ruby-class-fetch-suggested-keywords.html/feed
I am 99% male http://www.sajalkayan.com/i-am-99-male.html http://www.sajalkayan.com/i-am-99-male.html#comments Fri, 01 Aug 2008 15:39:57 +0000 Sajal Kayan http://www.sajalkayan.com/?p=92 Last month had been awfully busy for me, in fact i had almost forgotten that i sometimes blog also. Ive started playing with Ruby and am quite satisfied, will post some interesting scripts and hacks… In the meantime i stumbled across this interesting javascript which analyzes your manliness (or womanliness) based on your browsing history. Don’t know how it works but I’m kinda happy with the results… so ill post here.

Likelihood of you being FEMALE is 1%
Likelihood of you being MALE is 99%

Site Male-Female Ratio
google.com 0.98
yahoo.com 0.9
msn.com 0.92
myspace.com 0.74
youtube.com 1
ebay.com 1.11
facebook.com 0.83
paypal.com 1.04
imdb.com 1.06
wordpress.com 0.98
comcast.net 0.89
flickr.com 1.15
nytimes.com 1.13
dell.com 1.04
digg.com 1.56
foxnews.com 1.41
howstuffworks.com 1.27
snopes.com 0.74
ichotelsgroup.com 0.89
reuters.com 1.99
kayak.com 0.82
cafepress.com 0.8
deviantart.com 1.02
mozilla.com 1.13
perezhilton.com 0.75
amtrak.com 0.75
constantcontact.com 0.68
hotmail.com 0.83
sourceforge.net 1.74
thepiratebay.org 2.13
passport.com 0.89
archive.org 1.11
feedburner.com 1.11
skype.com 1.27
ebaumsworld.com 1
godaddy.com 1.17
instructables.com 1.44
alexa.com 1.33
watch-movies.net 0.75
hillaryclinton.com 0.65
ibm.com 1.5
engadget.com 1.7
fark.com 1.82
gmail.com 0.9
rediff.com 1.74
gm.com 1.3
pubmatic.com 0.77
networksolutions.com 1.11
chryslerfinancial.com 0.71
tinyurl.com 0.83
cj.com 0.92
contactmusic.com 0.98
okcupid.com 1.06
nokia.com 1.13
ralphlauren.com 0.8
time.gov 2.08
orkut.com 1.08
lenovo.com 1.67
pair.com 1.08
gettyimages.com 0.71
knfilters.com 1.94
ubuntuforums.org 2.03
wireimage.com 0.59
bluehost.com 1.17
hobbytron.com 1.47
missingmoney.com 0.64
tatuagemdaboa.com.br 1.27

Oh, by the way the dude who made it probably just got shit loads of backlinks… including one from me in the beginning of this post..
via @sugree

]]>
http://www.sajalkayan.com/i-am-99-male.html/feed
Make your own cheap charlie CDN http://www.sajalkayan.com/make-your-own-cheap-charlie-cdn.html http://www.sajalkayan.com/make-your-own-cheap-charlie-cdn.html#comments Sat, 28 Jun 2008 05:26:21 +0000 Sajal Kayan http://www.sajalkayan.com/?p=91 CDN stands for Content Delivery(or Distribution) Network. It is a network of servers usually located in various geographic locations to improve the availability and access speed of a website (or webapp or other media). The main use of CDNs were during the nineteens when inter-continental access was slow, scarce and expensive. Origin server could be in the silicon valley, users from UK would access the node located in UK, so in theory only once the page would be downloaded from the US server to the UK server. Thus allowing the UK visitors to access the page locally resulting in a huge saving in inter-continental bandwidth costs and improved access times for the end users.

CDNs are traditionally a very expensive solution to implement if using any of the established providers. The solution in itself is not very complex. I am in the process of implementing my very own CDN. The benefits are simple.

  • It would reduce load on the origin server
  • Faster access if user downloads pages from a server closer to them
  • Since load on origin server is low, faster access even if cache needs to be refreshed

Some major portions of the CDN I am looking to implement

  1. Origin Server(s)
  2. Geo targeting DNS servers
  3. Squid Cache - Set as Reverse Proxy or web accelerator

Origin Server : This at the moment is a single server, which may be increased to run mysql and apache on separate boxes to increase productivity. This is up and running and in production.

Geo targeting DNS servers : A perl script making use of Geo::IP and Net::DNS::Nameserver modules to resolve the query based on the origin country of the requester. The DNS script is in very early development. At the moment it is basically the example usage of Net::DNS::Nameserver with the Geo::IP loosely implemented. Need to implement some way of using config files which flush every 10 minutes, so I can use a series of servers runing this script and changes in config can be done on one server and rsynced across all nameservers running this script. The perl script is attached in the end. It would resolve foo.example.com differently if the request came from Malaysia.

Squid Cache
: Squid cache is an Free proxy server which can be setup as a Reverse proxy. Users would query this proxy for pages and the proxy would deliver content, flushing the cache based on the rules defined in the squid.conf file and/or the expires headers tag set by the origin server. It can be setup such that different filetypes are cached in a different manner. Different url patterns need to be cached differently. Queries to some URL patterns by logged-in(based on cookies) users should be direct from origin server. These configurations are a little complicated. My plan for this configuration is attached in the end.

The Geo Dns and Squid would be installed on cheap VPS in a few countries. Will start with one to see how well it scales.

EDIT 1 : Playing with Varnish at the moment, considering it over squid.

The Geo Dns perl script :

  1. #!/usr/bin/perl
  2.  
  3. use Geo::IP;
  4. use Net::DNS::Nameserver;
  5. use strict;
  6. use warnings;
  7.  
  8. sub reply_handler {
  9. my ($qname, $qclass, $qtype, $peerhost,$query) = @_;
  10. my ($rcode, @ans, @auth, @add);
  11.  
  12. my $gi = Geo::IP->new(GEOIP_STANDARD);
  13. print "Received query from $peerhost\n";
  14. my $ipsubstr $peerhost, 7;
  15. my $country = $gi->country_code_by_addr($ip);
  16. print "–$ip–$country \n\n";
  17. $query->print;
  18.  
  19. if ($qtype eq "A" && $qname eq "foo.example.com" ) {
  20. my ($ttl, $rdata) = (3600, "10.1.2.3");
  21. if ($country eq "MY" ) {
  22. $rdata = "10.1.2.4";
  23. }
  24. push @ans, Net::DNS::RR->new("$qname $ttl $qclass $qtype $rdata");
  25. $rcode = "NOERROR";
  26. }elsif( $qname eq "foo.example.com" ) {
  27. $rcode = "NOERROR";
  28.  
  29. }else{
  30. $rcode = "NXDOMAIN";
  31. }
  32.  
  33. # mark the answer as authoritive (by setting the ‘aa’ flag
  34. return ($rcode, \@ans, \@auth, \@add, { aa => 1 });
  35. }
  36.  
  37. my $ns = Net::DNS::Nameserver->new(
  38. LocalPort    => 53,
  39. ReplyHandler => \&reply_handler,
  40.  
  41. Verbose      => 1,
  42. ) || die "couldn’t create nameserver object\n";
  43.  
  44. $ns->main_loop;

My idea for squid.conf :

  1. 1) Forward proxy :-
  2.  
  3. Allow following IPs to browse any website without any caching… allow https also…
  4.  
  5. a.b.c.d
  6. w.x.y.z
  7. 127.0.0.1 (ill do a ssh tunnel)
  8.  
  9. 2) Reverse proxy :-
  10.  
  11. Rules (to be followed serially, if rule 3 and 5 both match, rule 3 should be used):-
  12.  
  13. 1) All urls ending in the following must be cached for minimum 5 days or expires headder. dont even check to see if file has updated.
  14.  
  15. .jpg, .gif, .css, .js, .swf, .png  (not case sensitive )
  16.  
  17. 2) POST should never be cached
  18.  
  19. 3) Few URLs should be cached for 30 mins (minimum/maximum) no matter what the expires headder says.
  20.  
  21. http://www.mysite.com/urla/
  22. http://www.mysite.com/urlc.html
  23. etc…
  24.  
  25. 4) Requests to http://www.mysite.com/sectiona/* :-
  26.  
  27. * If user has following cookies pass them direct hint : "acl cookie_test req_header Cookie ^.*(comment_author_|wordpress|wp-postpass_).*$"
  28. * http://www.mysite.com/sectiona/sub-section1/* : 30 mins cache no matter what!
  29. * If requester is Googlebot : serve from cache only if it the copy in cache is 5 mins old. else update the cache.
  30. * for other users cache urls ending in .html for 60 mins , rest for 20 mins
  31.  
  32. 5) Requests to http://www.mysite.com/sectionb/*
  33.  
  34. * no cache unless images.
  35. * Allow access only if user has a particular cookie e.g. secret_word=another_word
  36.  
  37. 6) urls which are NOT in point 4 or 5 :-
  38.  
  39. * If users have cookie eg. no_cache then pass direct
  40. * 5 min cache for http://www.mysite.com/sectionc/*
  41. * Cache the shit out of everything else for 30 mins
  42.  
  43. Special Instructions : If origin server is unreachable then show cached result, no matter what. The first cache server is a VPS running ubuntu server with 128 megs of dedicated non-burstable ram and has 4.3 GB diskspace left. resources can be upgraded on request. Where I have mentioned "no matter what" i dont want the proxy server bothering the origin server at all. The origin and proxies will be located far geographically so connection between them may not be optimal.
  44.  
  45. In case squid allows for URL rewriting, i would like to also map for example :-
  46. us.mysite.com -> www.mysite.com
  47.  
  48. so if user can access the same stuff by going to www.mysite.com or even us.mysite.com
  49.  
  50. Also if URL rewriting is possible in Squid, in the future id like to be able to map … http://www.mysite.com/subfolder as http://somesite.com/subfolder and http://www.mysite.com/anotherfolder as http://anothersite.com/anotherfolder
  51.  
  52. Also.. if squid supports ssl, would it be possible to use https (and also install some certificate on the squid) then users connection to and from the proxy is encrypted if needed, but the connection between squid and origin server is plaintext ?
]]>
http://www.sajalkayan.com/make-your-own-cheap-charlie-cdn.html/feed
Twitter logo redesign http://www.sajalkayan.com/twitter-logo-redesign.html http://www.sajalkayan.com/twitter-logo-redesign.html#comments Fri, 27 Jun 2008 06:07:40 +0000 Sajal Kayan http://www.sajalkayan.com/?p=89 New Twitter Logo

I dont think any explaination is needed!

]]>
http://www.sajalkayan.com/twitter-logo-redesign.html/feed
Goodbye Alexa : Google Trends for websites is here! http://www.sajalkayan.com/goodbye-alexa-google-trends-for-websites-is-here.html http://www.sajalkayan.com/goodbye-alexa-google-trends-for-websites-is-here.html#comments Sat, 21 Jun 2008 10:07:23 +0000 Sajal Kayan http://www.sajalkayan.com/goodbye-alexa-google-trends-for-websites-is-here.html Earlier, every now and then I would go to Alexa to see my ranking to massage my ego. Now, Google has come up with a reality check - Google Trends for websites.

Google announced a new layer to Google Trends in an official blogpost. Matt Cutts and Barry Schwartz also blogged about it.

So… How is this different? For starters it gives way more info than other existing tools.

  • Regions the traffic came from (OK, analytics and Alexa shows it but this is much better presentation and also you can check it for any website)
  • Also Visited : Shows which other websites most users of one website visit. This might be useless to some, but IMHO its the most useful feature.
  • Also Searched for :  Very usefull for studying your users. and choosing what words to use.

Upon login, you can see an estimate of the unique visitors. in my case the estimate looked way lower than the actual. Here is how they estimate.

Trends for Websites combines information from a variety of sources, such as aggregated Google search data, aggregated opt-in anonymous Google Analytics data, opt-in consumer panel data, and other third-party market research. The data is aggregated over millions of users, powered by computer algorithms, and doesn’t contain personally identifiable information. Additionally, Google Trends for Websites only shows results for sites that receive a significant amount of traffic, and enforces minimum thresholds for inclusion in the tool.

In my case, Alexa puts me way ahead of websites I track. I know for fact that I should be lower than these. (click images to enlarge)

Alexa Graph

Google Trends does a reality check : Now, these results are more believable.

Google Trends for Websites

]]>
http://www.sajalkayan.com/goodbye-alexa-google-trends-for-websites-is-here.html/feed
Open letter to Thailand’s Software Bullies http://www.sajalkayan.com/open-letter-to-thailands-software-bullies.html http://www.sajalkayan.com/open-letter-to-thailands-software-bullies.html#comments Sat, 21 Jun 2008 04:04:26 +0000 Sajal Kayan http://www.sajalkayan.com/open-letter-to-thailands-software-bullies.html Kind attn : Microsoft Thailand (Sorry I cant read your Thai only website)
Kind attn : Lenovo Thailand (Sorry cant find name of contact on your site)
Kind attn : Prasert Charoonpaisal - General Manager - Personal Systems Group (PSG) - HP Thailand
Kind attn : Corporate Communications Dept. - Sony Thai Co., Ltd.
Kind attn : Asus Thailand (Sorry I cant read your Thai only website)
Kind attn : Acer Head Office - Acer Computer Co., Ltd.
Kind attn : Benq Thailand (Sorry I cant read your Thai only website)

Dear Sirs or Madams,

This is to bring to your notice that almost all notebooks available in Thailand come bundled with windows preloaded.

I had purchased a Sony VAIO 3 or 4 years ago which came bundled with Windows XP. Due to quality problems in the software provided, I had to switch over to a different Operating System. I have no claims on the licensing fee of the inferior software provided to me as during the time of purchase I had intended to use it, and I did for quite a while.

Now, the time has come for me to purchase a new notebook. A self conducted study at fortune town on June 20th 2008 reviled that almost all notebooks came with Windows pre-installed and the license bundled. On asking any of the vendors that I don’t want to pay for the license, I was informed it is impossible. The very limited selection of notebooks which do come without Windows pre-installed are bottom of the line models which are usually outdated or very heavy.

My questions to all of the addresses :-

  1. Do you assume a non-windows user to not be able to afford your mid-segment notebooks?
  2. Is your intention to force Linux users into buying a Windows license?
  3. Is this an effort to form a cartel against Linux?

Question to all the notebook vendors :-

  1. Do you refund any difference amount in case the buyer does not use the license?

Question to Lenovo :-

  1. Lenovo USA does offer an interesting range of notebooks without Windows. Does Lenovo Thailand do the same?

Question to Microsoft :-

  1. Do you refund any unused windows License?
  2. I am aware of the software piracy issues in Thailand, but have you ever conducted a study as to how many non-windows users own a windows license? Do you reduce this number when publishing piracy rates?

Please respond, via comment form below in English only. The replies would help me decide weather or not to get a new notebook here in Thailand or order it in the States or Singapore, potentially making the Thai Government suffer a loss of tax revenue.

PS : Apologies to other companies who fit my criteria and I missed them out! They are also free to respond.

Regards,
Sajal Kayan

Update 1 : Thanks to @bact for translating to Thai and publishing on blognone.

Update 2 : Online discussions at blognone and ubuntuclub.

]]>
http://www.sajalkayan.com/open-letter-to-thailands-software-bullies.html/feed
My nerdiness! http://www.sajalkayan.com/my-nerdiness.html http://www.sajalkayan.com/my-nerdiness.html#comments Fri, 20 Jun 2008 04:06:02 +0000 Sajal Kayan http://www.sajalkayan.com/my-nerdiness.html Seems today I have nothing better to do… or maybe too lazy to do actual work !

via Sugree

Nerd Test 1 :-


I am nerdier than 88% of all people. Are you a nerd? Click here to find out!

Nerd Test 2 :-


NerdTests.com says I'm a Dorky Technology Geek.  What are you?  Click here!

]]>
http://www.sajalkayan.com/my-nerdiness.html/feed