Hari's Corner

Humour, comics, tech, law, software, reviews, essays, articles and HOWTOs intermingled with random philosophy now and then

Moved to a new server

Filed under: Site management by Hari
Posted on Sat, May 2, 2009 at 22:18 IST (last updated: Sat, May 2, 2009 @ 22:18 IST)

If you're able to read this message, congratulations. Your ISP has updated their DNS records and you can now enjoy my blog once again in its full flavour.

Drew has been an excellent host for the last couple of years for my two domains and provided great support, never declining any request for the guests on his server. And all that at zero cost too. In fact, most professional web hosts could learn something from him. I felt extremely safe hosting my websites on Drew's server because of his immense knowledge of *nix, networking, acute security consciousness and helpful nature. Seriously I doubt whether any professional web hosting provider can give me that feeling, because it's a matter of trust and personal relationship which no amount of 5-star reviews, assurances or marketing jargon can provide.

Recently Drew felt that it was time to move on as the cost of maintaining his own dedicated server was not justifying itself and I agreed entirely with him. There's no point in paying for a dedicated server if you cannot use it to its full capacity. Also being a server-admin full time must be quite a chore in additional to a regular job.

Now that I am back on shared hosting I will miss his personal touch while dealing with any issues that might arise. To be fair to my new host, the migration went off pretty smoothly even though my hosting account activation was initially delayed for verification purposes.

If you want to know the name of my new host, let me know and I'll send you an e-mail.
Comments (2)  

Common wrong assumptions by amateur internet "lawyers"

Filed under: People and society by Hari
Posted on Fri, May 1, 2009 at 09:23 IST (last updated: Sat, Jun 6, 2009 @ 10:33 IST)

Well, you get a lot of legal opinions on the internet, but most of them are wild assumptions and inaccurate guesses by lay-people who have only the vaguest ideas of what the Law entails and how the Law is actually interpreted and enforced in different parts of the world.

Here are a few common assumptions made by internet "lawyers" who usually use these as forceful points to advance their arguments.
The internet is governed by its own Laws
Wrong - the jurisdiction of the internet is still a contentious issue with every country using its own law to govern online activities which fall under their jurisdiction. Online issues can be very tough to resolve if your country doesn't have clear-cut cyber-laws governing online activities or if such laws contradict the laws of another country whose citizen is a party to the dispute.
All content on the internet is protected by "free speech" laws
Wrong again. There are numerous "regulatory" authorities, both governmental and non-governmental which try to impose their own set of norms on online content, but their effectiveness is at best weak, because of the international audience of web content and the inability to force web publishers to stick to hosting their content in their own countries.
Copyright is absolute and totally enforceable
Many countries have very lax copyright laws, while some others have no copyright laws worth speaking of and thus provide safe havens for websites promoting content theft and piracy. Of course, international pressure has been mounting to prevent this kind of thing, but there will always be a web host in a "friendly" country to host questionable content.
US laws are applicable and might be enforceable in all parts of the world
Another assumption made by American citizens while discussing legal implications online. Nothing could be further from the truth. Of course, in countries friendly to the US and its policies in international trade and business, this is more true than in other countries; but there are anomalies in legal systems even among such nations.
EULAs are the final word and are always legally enforceable
An EULA is a document of contract and nothing more. Any EULA is subject to the contractual laws of the country in which it is to be enforced. Any contract which violates the legal rights of any of the parties (the end user in this case) in any part of the world might be declared null and void by the law of the land. Thus a software license doesn't always have the full weight of the law behind it, especially in an international context. The fact is, large corporates use EULAs as a way to ensure that customers don't 'complain' too much when their rights are taken away by unfair clauses.
Legal systems are infallible and are mostly fair
Wrong. Judges are human beings with their own subjective leanings and legal systems are often ambiguous and given to liberal interpretation. Also, not every "Law" is spelt out in clear terms; many laws are actually case-laws with a long history of judgements to support a particular point of view. There might be other judgements which contradict these "Laws" in many cases which might lead to long, arduous court battles which don't benefit anybody except the lawyers engaged in the case.
Legal systems are static and absolute
Again, this is a surprising assumption by many online advocates who use several decades old examples to prove a point. In the meantime, legal systems and laws are constantly evolving and adapting to changing times, especially in the context of online laws which are still in their infancy.
Legal issues are only for lawyers
Ignorantia juris non excusat - Ignorance of law is (almost in every country) no excuse. Lay-people need to know the Law of their land, even if only the basics. Obviously it's impossible even for lawyers to know each and every law in operation out there, but for everyday activity and business, some legal knowledge is necessary for everybody.

That's all I can think of right now. If you know of any more common but mistaken assumptions made in online arguments regarding the law, leave a comment here. :biggrin:
Comments (9)  

Time to wind down?

Filed under: Life and Leisure by Hari
Posted on Thu, Apr 23, 2009 at 22:34 IST (last updated: Thu, Apr 23, 2009 @ 22:40 IST)

I've been wondering - and it's been on my mind more often of late - is it time to close my blog and take out my content? There was a time when I felt that at least a few regular readers were responding and there was some motivation to write and express creativity.

In recent times, however, I've not exactly had a lot of encouragement to continue blogging. This encouragement hasn't died down all of a sudden. In the last 6 months, there has been a definite and marked decline in readership which has reflected in the number of articles I've written during that period (or vice versa - it's had a spiral effect). Even without user stats availability, I can gauge that interest in blogging in general is at an all time low since (say) 2005.

I am guessing that only one or two regular readers definitely read this blog now. Or if more people read, I've not had any indication of it. It's been like communicating in a vacuum of late; at least going by responses to my articles in the last few months.

I do not like writing in vacuum. I have no interest in 'personal blogging'. I've had enough trying to get people to respond. I'm weary of the Internet's 'social' ways which has proved only to be a marketing terminology for the big corporates and nothing to do with real human contact.

That's one reason I hate social networking sites. They've killed spontaneity in communication and the human touch by generating tons and tons of spam for a grain of genuine content. E-mail is no longer a one-on-one communication channel but the playground of spammers and a tool for notifications. Bloggers no longer seem to comment out of interest, but more as a way to get a back link.

The time has long gone since I had the enthusiasm to draw in new readers. I no longer have that enthusiasm, particularly when even bloggers I know and communicate with on their blogs do not respond in like manner. It's boring to write a thoughtful comment and get no responses. It's like people have lost all their courtesy and respect for fellow bloggers who actually take time out to read their content. Leave that aside, it should at least be common courtesy to acknowledge the presence of a human being, even if it's only an online presence.

In short, I'm feeling slightly embittered.

Is this the last blog entry then? Most likely not. But I'm sensing that it's very near the end. I've about had it with writing when nobody (or very few people) responds.

To be quite frank, I don't even know how many people will read this and how many will care. However I do thank my regular readers though for the support given to me all these years.
Comments (13)  

Sophisticated online frauds

Filed under: Internet and Blogging by Hari
Posted on Fri, Apr 17, 2009 at 12:00 IST (last updated: Fri, Apr 17, 2009 @ 12:06 IST)

Apart from the old, infamous Nigerian e-mail scam, there are plenty of sophisticated online scams which really seem genuine and fairly respectable companies until you take a closer look and the time to investigate.

Recently, I had been interested in the 1960s version of Batman (the Adam West TV series). I got to plenty of sites and found reviews and other information; but from what I could gather it appeared that the series has not yet been officially released on DVD due to legal issues between Time Warner and Fox.

Interested in knowing whether the issue has been resolved recently, I did a google search for "Batman 1960s DVD" and came across a number of similar looking sites selling DVDs of old, but popular TV shows at quite low prices.

The sites (which I won't link here) look reasonably decent, professional and have all the necessary "product information", FAQs and other relevant info to lull suspicion. However, the first thing I noticed was that there was no legitimate business contact address or e-mail (there was a web form, but no address provided).

The second thing was that they claimed to be selling ALL seasons including every single episode of most of theses shows and further, quite a number of these shows have never been legally released on DVD at any time (like the Batman show I mentioned).

On a related note, on some of these sites, the "ORDER" button was dysfunctional and the user was pointed to a Google AdSense link, which immediately triggered my suspicions in the first place.

Then I searched for "xxx website scam" (where xxx is the domain name of these websites) and found a number of complaints about several of these sites, which all seem to originate from one company and found that most people who had got cheated of several hundreds of dollars were looking for their favourite old TV shows (which are not legally available or very rarely available on DVD today). Complaints range from:

I write this because I am quite shocked that google and yahoo have not de-spammed their search index and allows these scam sites to continue and in some cases, are even listed as "Sponsored links".

I hope people will keep an eye out for these websites and be very careful before doing any business with them. A lot of them look really genuine and professional and only a close check will reveal some suspicious details like I mentioned above.

I know how popular some old TV shows are and I wish that the companies holding legal ownership over them bring out official DVDs instead of driving people into even falling for shady deals from companies of dubious origin.
Comments (5)  

Back from Germany

Filed under: Life and Leisure by Hari
Posted on Sun, Apr 12, 2009 at 21:59 IST (last updated: Sun, Apr 12, 2009 @ 22:02 IST)

Now that I'm back from my 10 day visit to Germany (was back very early this morning), I'll probably write a trip report with a few mandatory photos. :-)

Germany is a fairly large country (relatively speaking) and in 10 days, you can only cover so much ground. However, because our agenda on this trip wasn't purely tourism, we hadn't even the full 10 days to roam around. However, the trip fulfilled my expectations and more and I look forward to writing about it before it recedes too much from my memory.

I'm a bit tired at the moment, but I should get back to my routine tomorrow.
Comments (2)  

flex - learning a little bit of pattern matching

Filed under: Tutorials and HOWTOs by Hari
Posted on Thu, Mar 26, 2009 at 13:27 IST (last updated: Thu, Mar 26, 2009 @ 14:17 IST)

If you want to master a bison first you should learn to flex your muscles well.

Oh, all right. That was an extreme bad pun. But in any case, I'm starting to learn and understand how a lexical analyzer works and how to create a full-fledged lexer-scanner and parser for a fairly simple application.

For those who are not aware, a lexer is a program that reads a stream of characters and tries to match patterns in text. For example, a pattern can be any word, any number, a telephone number, etc. In fact, anything you can write as a regular expression is a pattern readable by a computer.

flex is the modern (and Free Software) implementation (not wholly compatible with the old Lex) of a scanner-generator software. Using flex you can generate a C/C++ program that scans input text, looks for patterns in them and generates "TOKENS" (which are nothing but the matched text tagged as an identifier) which can be used for further processing especially by a parser generator like bison or yacc. The parser grammar defines how to read the tokens, which types of tokens are valid and how to arrange tokens to ensure correct grammar.

As you might have guessed by now, using Flex, especially with a parser generator like bison is not at all easy for those not experienced with at least the basics of regexps. And writing the grammar for a parser generator is even more involved. There are precious few tutorials on the web out there which tell you how to write a decent parser and even then many of those grammars you find in tutorials are rather arcane and not wholly compatible with bison.

Yet it beats using only a regular expression engine which can lead to some extremely unreadable code. Yesterday as an exercise I wrote a simple HTML tag removal script entirely in Flex (without using bison).

It reads everything from <body> to </body> and ignores tags. The flex source code below (well commented) defines the pattern matching necessary to do this and also the actions performed on encountering the patterns (either ignore or output the text based on the conditions).

	/* is_started - generic flag to detect start of any opening 
	or closing tag 
	is_body - flag to detect the start of the body opening tag */	
	int is_started = 0, is_body = 0;
			
/* body matches either <body> or <body attribte="value"...> etc.
   we avoid complex regexps here as the purpose is merely to ignore 
   everything inside < and > */
BODY		"<BODY"
/* once the end of the <body> is matched, we again keep ignoring the
   rest of the text */
ENDBODY	"</BODY>"
/* define the start and end of any tag or tag like element - here again 
   we keep it simple. We are not writing a validating program but merely 
   detecting the beginning and end of tags */
STARTTAG	"<"
ENDTAG	">"
/* convert tabs */
TAB		\t
/* match spaces, two or more */
WHITESPACE	[ ]{2,}
/* match newlines */
NEWLINE	[\r\n]
NEWLINES	{NEWLINE}{2,}
%%
		
{BODY}	{ is_body = 1; /* body start tag started but not 
				  necessarily closed as it might 
				  contain attributes */
		 is_started = 0; /* don't output anything till 
			  	    the end of the body start tag is
				    reached */
		}							
{STARTTAG}	{ is_started = 0; /* Flag the begin of any tag */ }
{ENDTAG}	{ is_started = 1; /* Flag the end of any tag */ }
{ENDBODY}	{ is_body = 0; /* Flag the end body tag */ }
{TAB}		{ 
			if (is_started == 1 && is_body == 1)
				printf ("  "); /* replace single tabs with 2 spaces */
		}
{WHITESPACE}	{
			if (is_started == 1 && is_body == 1)
				printf ("  ");	/* if you encounter two or more 
						whitespaces, replace with exactly
						two spaces */
		}
{NEWLINE} 	{
			if (is_started == 1 && is_body == 1)
				printf ("\n");
		}
{NEWLINES}	{
			if (is_started == 1 && is_body == 1)
				printf ("\n\n");  /* if you encounter two or more
						  newlines replace with exactly 
						  two newlines */
		}
.		{
			if (is_started == 1 && is_body == 1)
			printf (yytext);
		}
%%

To generate the C source from the above, you need flex installed (it should be available with most GNU/Linux distributions). Save the above source code in a file called htmlstrip.l.

From a terminal/console, run the command
flex -s -i -o htmlstrip.c htmlstrip.l

The -s flag states that Flex should be in "silent" mode, that is not echo the unmatched patterns directly to output. The -i flag asks flex to run in case-insensitive mode, so any matches for alphabetic characters are done in a case-insensitive way. The resulting output is saved in a file called htmlstrip.c

To compile the C source code, run the command
gcc htmlstrip.c -lfl -o  htmlstrip

The -lfl flag asks the compiler to link against the flex shared library. Now you can test your script by using an HTML file like this:
htmlstrip < file.html > file.txt

The above commands reads from a source file file.html and outputs the result to a file called file.txt. You can also run it interactively by not using the < file.html to read from a source file and to echo the output to stdout you can avoid using the >file.txt.

As you can imagine, it's pretty obviously very powerful and with a bit of practice easy to use. Combine it with a full fledged parser and you can do a lot more with it.

While this kind of thing is mostly taught in Computer Science courses in universities and for those writing programming language interpreters/compilers, text pattern matching and parsing is useful in the arsenal for any programmer looking for advanced text-manipulation tools.
Comments (2)