Tuesday, January 19, 2010

245345 Type rest of the post here

Read More......

Tuesday, November 07, 2006

Why shouldn't Flash be used on web pages?

  At the beginning of the article I should tell you I hate Flash. Any time I (mistakenly) visit any website which uses Flash it makes me go WTF, why couldn't this moron do this thing in a better way. I know there are a lot of people who love to see Flash and go oooh this is so pretty, but I would ask them do you think Flash is all that good? I'll tell you why I think using Flash is a 'bad' thing to do.
  First a little bit about the history of the WWW. WWW came into being in the early 1990s and the reason of its existence was the fact that we had collected a lot of information but now in the 'information age' there was increasing need to share the information regardless of physical difficulties of transfer.The internet was the solution to this. Hypertext was chosen as the language to transmit the information over this medium 'internet'. Although other protocols were in existence before hypertext none of them was really effective in 'easy' sharing of the information. Hypertext led to creation of easily accessible webpages thus marking the birth of 'WWW'. Right from its start WWW showed tremendous growth and today it is the most popular aspect of the internet(Many people can't differentiate between internet and WWW). Here are some of the things that helped making the WWW so successful:

  • As soon as the basic outline of the WWW was complete, CERN made the source code for its software publicly available.
  • The system requirements for running a WWW server are minimal, so even administrators with limited funds had a chance to become information providers.
  • Because of the intuitive nature of hypertext, many inexperienced computer users were able to connect to the network.
  • The simplicity of the HyperText Markup Language, used for creating interactive documents, allowed inexperienced users to contribute to the expanding database of documents on the Web.
  • The open standard allowed users of different operating systems to access WWW in a similar way using a variety of media to present it
  In short we can say that the web grew at such a pace because it was easy to provide content and it was easy to get content. A large part of it is because it was based on an open standard. But soon the browsers started implementing their own 'enhancements' to HTML(HyperText Markup Language). This led to more difficult web programming. The content was no longer separate from presentation which was perhaps the basis of The Web. New standards had to be created to accomodate the new browser functionality. The breakthrough in this was CSS(Cascading Style Sheets), if properly used this effectively separates the content from presentation i.e now the content is html and presentation is the css which can be in a separate file or within <style> tags. But complete support for standards remains a dream for the web programmers. The browsers(especially the most popular browser in the world) are not fully standards compliant. This makes the job of the web programmer really tough and often you find out that different browsers render web pages differently.   You might be thinking where does Flash fit into this. You are correct, it doesn't. Flash is a proprietary format which means that Adobe is free to change it at its will. I do not support proprietary formats in the least because they aren't standards. You need permission from the provider of the format to use it. What if Adobe fell off the face of earth tomorrow? All the work done in Flash is a waste because no one knows what lies beneath the hood. I am at the mercy of Adobe for
  • Creating content
  • Viewing content
  Suppose I create an operating system 'Perfect OS' which is the best OS ever created and has the best performance among all OSs but the users of Perfect OS would not be able to able to view the content in Flash unless the Adobe people got down and wrote a plugin for the browser which the Perfect OS uses.You might argue that it is very unlikey that would happen because Adobe *will* get down to provide support for your OS. Do you know that there isn't a Flash plugin for x86_64 architecture for any browser on Linux. Of course Flash does not work on non graphical environments(lynx,links,elinks,w3m etc.).
  A primary feature of The Web is that it is accessible to everyone. With Flash the webpage becomes inaccessible for anyone using CLI or people who use screen readers due to vision problems.A lawsuit is going on in the US about such an accessibility issue which was filed by National Federation of the Blind against Target(an online store). I do not know a single web developer who does not want to have the widest user base. So why use Flash?
   Flash is not accessible to everybody. Flash plugin might be free but it is not free as in both meanings of the world. 'Free as in free speech' and 'Free as in free beer'. Flash plugin is free in the sense of the latter. There are a lot of people like me who choose not to install Flash because I do not want to corrupt my 100% open source installation.
  Another reason for popularity of The Web is the ease by which you can provide content to the whole world. When you use Flash you have to spend a lot of money to get the development tools which might get outdated any time Adobe desires. This is contrary to rapid development as it gets dependent on a particular entity for development.
  Think if Flash got really really popular and most popular websites start using it.This would mean every web browser has to have a Flash plugin. Now suppose A produces browser X which is better than browser Y produced by B(like more standards compliant,has better UI,is faster etc). Now lets say that A is a competitor to Adobe in some other field. Adobe wants to kill A, what it does is it does not support browser X(I am not implying Adobe would do that, its just something that might happen with a monopoly. We all know monopoply cannot be broken even with lawsuites). This automatically makes browser Y the better choice. Don't you think that's anti competitive?
  One other thing I got against Flash is that its damn annoying. Waiting five minutes until it can do its loading and then play some animations which you cannot skip and then come to content minutes later and by that time you have lost interest in the whole thing. I haven't used slow internet connections for a long time, I can't even imagine the plight of people waiting for Flash sites to load on dial-up.
  Ok I get the point that it is very easy to create interactive sites in Flash but at what cost? I understand you can murder all standards and usability features for your Flash animation but please try to follow these guidelines so that your website may be bearable for 'anti-Flash' people.
  • Do not design the main page of your site in Flash.
  • Do not make Flash a part of the UI of the site, so if a user doesn't have Flash support (s)he still can access the website.
  • For pages relying heavily on Flash please add something like (requires Flash) on the page they are linked from.
  • Try to make the Flash animations machine readable, so that something like a screen reader can use it.
  Proprietary formats are much more sinister than proprietary applications. They inhibit growth and promote monopoly. It is high time all of us (not only the open-source zealots) realized this and made a positive contribution towards development especially realting to computer technology.

Read More......

Monday, October 23, 2006

Conversing intelligetly online

The internet today isn't an alternate source of communication anymore, infact it is THE communication medium for communication whether its chatting on yahoo to your friend about the movie on sunday or making a Million Dollar deal with an industry hotshot. Although no one would have thought it 10 years back but internet is an integral part of life. Conversations over the internet whether real time or not have one major difference from communication in real life, the only thing that gets over to the other side are words(Video and voice over internet may change this but its a long way off).But sadly most of the people I've met do not seem to realize the fact that the way you use your words make a deep impression on the person you are conversing to. Just as your expressions and posture are important when you converse in real life, the way you write something in an online conversation may make you gain or loose the respect of the other person. You have got to to get your listner to take you seriously and respect you to have a meaningful conversation. Unfortunately online conversations have become quite a nightmare for me where new 'slang' is invented everyday to just look 'cool' or save a few microseconds of time. To be respected you need to follow some basic stuff which can be though of good manners on the internet. Here are some things you should definately follow in conversations over the internet. Do not use all CAPS it is the web equivalent of shouting and should only be used when you really want to emphasize something. Even in that case do not capitalize more than one or two words in the sentance. Use proper capitalization. It just takes very little effort to press the shift key for a tiny fraction of time while you type the first word of your sentence."How are you?" looks much better than "how are you" in my opinion. Use proper punctuation. Always end your sentences with a period '.' or '?' if you are asking a question. Using commas in appropriate places can be a real relief for the reader. Compare "Thank you for the dinner last night, it was great." to "thank you for dinner last night it was great" and you would know what I mean. Do not repeat alphabets to represent your excitement. I see a lot of people using "hiiiiiiiiiiiiiiiiiiiiiiiiiii how are you" to represent their excitement on meeting a friend. I would ask wouldn't "Hi! how are you?" suffice? Use simple smilies and don't overuse them. "Hi :)" this shows all your emotions, you definately don't need to resort to something like "hiiiii :)))))))))" which is plain stupid. Don't overuse abbreviations. Using abbreviations like RTFM or IMHO is ok if you don't overuse them but using "u r" for "you are" or "c" for "see" is an overkill and sometimes the reader might have trouble understanding you. Don't use numbers in place of alphabets like '3' for 'E' or '1' for 'I'. IMO this is the single most irritating thing on the internet and has even earned itself a name, '1337' speak or 'leet' speak for those unaware. But the most common misuse of freedom of online conversations is cutting short words. I do not understand what purpose it serves. How much time would it take to type "Regards" instead of "regds" or does saving the time required to hit one key to make "gud", "good" give you any major benefit? Practicing what I mentioned does not take a lot of effort and no skill whatsoever, but the advantages you gain are huge in the form of respect from the people who read you.

Read More......

Wednesday, October 11, 2006

Python script for fetching your orkut scraps

Google's social networking site orkut has become really popular especially in India and its popularity isn't showing any sign of stopping. I will tell you that I hate orkut and the only reason Im using it is because a lot of friends use it. Its just like the time I'd downloaded 3 different IMs until I found gaim. The reasons I hate orkut are:

  1. The interface is really buggy and inconsistent
  2. Most people on orkut are really lame
  3. It does not have any public API
  4. No RSS
  5. It does not support elinks
Enough of my rant, I basically use orkut to read scraps and I don't like to login and navigate to scraps and then read it. So I wrote this script which fetches my last ten scraps.

This script does no error checking and is at best just a hack. But it can be really useful(especially in office).

Here's the script : http://www.osix.net:80/modules/folder/index.php?tid=12868&action=vf
Enjoy! . Do tell me if it doesn't seem to work or you like it.I might work on it sometime when Im free.

Update: I've added proxy support for the script, if you need proxy support here's the script: http://www.osix.net:80/modules/folder/index.php?tid=12903&action=vf

Read More......

Monday, October 02, 2006

Defining Nothingness

Im usually not very philosophical but there are some things which although scientific in nature cannot be described without being philosophical. One such thing is the inability of the human mind to grasp the simplest thing in the universe. Something that simply has nothing to be understood about. Something that has no property. Im talking about nothing. Its rather strange that we have to associate nothing with something in order to understand it. Some people associate nothing with the dark, some associate with a closed room with 'nothing' inside it. But what we don't realize or ignore is that nothing is not something. We cannot see nothing we cannot smell nothing. Nothing is at the end of the universe which again brings in a lot of imaginative stuff. What comes at the end of the universe? Almost everyone agrees universe is finite but what is beyond that ? If we travelled to the end of the universe what would we see? Even if we don't see anything it doesn't mean its nothing because we are aware of its existence and that's a fact about nothing that it doesn't exist or its existence can't be proved. So that brings me to what I would call the ultimate question, does 'nothing' exist? Maybe its things like that which make us human, the fact that we simply cannot grasp something that isn't around us. We are not machines that would assign nothing=NULL, which although is value zero in its registers but for all purposes serves as nothing. Maybe I should leave it that, the more I think about nothingness the more nothingness I destroy.

Read More......

Sunday, October 01, 2006

Microsoft and piracy

This post is about my thoughts on Microsoft's policy 'against' piracy especially in Third world countries. I can bet M$ wouldn't want you to believe a word of it. Everyday we hear/see plenty of slogans here and there about putting an end to digital piracy but then I would like to ask(this question applies to people in third world countries) how many original CDs of M$ Windows have you seen and how many people you know who have got into trouble for using pirated software . The answer to both questions would be quite low, much lesser than what 'anti piracy' dictates.

  First a word about M$'s policy in developed countries. In those countries mostly people do not assemble thier computers and they don't mind paying extra if all software comes pre-installed on it. This is where M$ cashes in. It has contracts with all the major hardware producers to bundle windows with thier hardware. Believe me its very difficult to get a computer without windows installed on it in the US or UK or any other developed nation. When a user has already paid a lot of money for a software that came with thier computer why would he/she remove it? Secondly the piracy in these nations is not very rampant and M$ keeps strong tabs on it too.
 But the situation is vastly diffrent in the Third World countries like India. If a person was asked to pay a huge amount of money to have S/W pre installed on his/her computer they would plainly refuse. If no other option is available they might not even buy a computer. But their are two solutions available Pirated software or Linux. If piracy wasn't an option it would lead to a huge number of people using free software which doesn't help M$ in any way.
  Not only do M$ lose money but they lose user base which might lead to free software coming to the attention of H/W and S/W makers and more importantly the industries. But what the biggest loss to M$ would be is loss of manpower. Microsoft employes a huge amount of Indians if the number of people using M$ platfom dwindled it would really hit M$'s work force. What this would also do is that since the quality of M$ trained manpower would drop, the big corporations might decide to move to a solution which is more popular with the work force.
 So would it really benefit M$ if it tried to curb piracy. I don't think so. What do you think?

Disclaimer: Everything above is my personnel opinion and is in no way an attempt to defame M$. Its almost 5 am and Im sleepy so pardon me for any mistakes/typos in the post.

Read More......

Wednesday, September 27, 2006

For the first time Im 'against' open source

Its morning, I crawl into my office and open my email. There's an email with 'urgent' in the subject line and its from my boss.Hmm what could this possibly be. I read the mail what it basically said was to uninstall MS Office, Visual Studio,Adobe Photoshop, Macromedia Flash, Winzip etc from all systems and install oo.org . Im a little puzzled and also quite pissed off because it has to be done by tomorrow. Type rest of the post here Although one might say we are only promoting open source by this method but I tend to disagree.We are basically forcing everyone to switch over to oo without any formal training. What this would result in is unhappiness of the users and them getting a wrong idea of open source as inferior software. Later in the day I was about to learn what had caused this. It was a letter from the BSA to our MD 'an educational letter'. This meant our office could be raided anytime and since no licensing fees had been paid for a lot of software we were in quite a lot of danger. Im thinking to myself how often do I wish that this company had a planned IT developement but then again its only three more months. But for the fact Ive to oversee that this 'change' goes on smoothly Im not the least bothered. Some part of me even hopes that they are charged with piracy but then again who cares.

Read More......

Friday, September 22, 2006

Major Network outage

Its a bad bad start to the day. I go into the office, connect to all the
servers I need and check my mail everything seems normal until I try to
connect to orkut. No connection, Im a little pissed. I open the relevent
server tab on mrxvt and ping google.com, no response. I ping the default
gateway for the machine no response still. I rush into the server room and
immediately check the router all the lights are blinking as they are
supposed to Link, DSL and ethernet. I check the ethernet cable on the
server, seems allright. As a last try I restart the router. No nothing
works. Why did the fastest connection in the office had to go down. As I
am thinking I would have to settle for a 256kbps connection I get another
shock. The connection on the proxy server isn't working. Now what? Last
option the unused 128kbps failover connection . I get it connected and
change the settings as soon as I ping my heart sinks its not working as
well the only connection alive in the office is the Tata connection to the
mail server. Then it dawns upon me that there's a problem with the Airtel
connections and since the problem is with Airtel's connection to internet
and not my connection to Airtel the router do not show any sign of a
problem.
I call up Airtel their response: "Sir the Airtel network is down and its
not a problem with your connection.". I ask how long it will take to be
up? "Sir it might take 30 minutes or maybe an hour" I hear that as Our
network has got badly fucked up and it might take half a day to be
repaired. Everything I have learned and experienced about redundancy and
failover connections has come to a nought. I'd love to know what caused
this outage. But perhaps sadly I never will.

Read More......

Thursday, September 21, 2006

Setup shorewall with two interfaces

One of the most basic things whenever you setup a network is allow access from an externel network and then secure it. Both these tasks are easily achieved by using a firewall. A popular choice of firewall is shorewall, in this article I will show you how to configure a simple network two interface network. You allow all traffic from the internal network to the external network but block all traffic except ICMP and http from the external network. So without further delay lets get started.

First you have to install shorewall to this:
yum install shorewall (Fedora/Redhat)
apt-get install shorewall (Ubuntu/Debian)

Now you should have a /etc/shorewall directory and in it there is shorewall.conf file. This is the first file you edit. Im only going to list the lines you'll have to change in the shorewall.conf file:

#Change this from No to Yes
STARTUP_ENABLED=Yes

#Name of firewall zone, if you don't set it you'll have to configure it in zones file
#Set this to fw
FW=fw

#Enable IP Forwarding
#Set this to On
IP_FORWARDING=On



That is all you have to change in the shorewall.conf, You don't need to change other default values.

Now edit/create /etc/shorewall/zones file
You specify one zone net which is the external zone and one zone loc which is for your local network

net ipv4
loc ipv4



Now that you have specified the zones its time to bind them to their interfaces. Lets suppose eth1 is connected to the external network and eth0 is connected to the local network.Time to edit/create /etc/shorewall/interfaces

loc eth0 detect tcpflags
net eth1 detect routefilter,tcpflags,nosmurfs



What you have done in this is bind eth0 to zone loc and told the firewall to detect the broadcast address and check for bad tcp flags. The other thing you have done is bind eth1 to zone net, autodetect broadcast address and check for bad tcp flags+ disable source routing+ check for broadcast source packets.

Upto now you have done these things :
Setup three zones fw(the firewall zone i.e the machine firewall is running on),loc(the local network) and net(the external zone). You have also bound these zones to specific interfaces and enabled IP forwarding.

For sharing an internet connection between multiple computers using a single external IP linux does something called IP masquerading. What it basically means is when you send your packets to the external network the firewall changes the source IP to your external IP and keeps track of who sent the packet to whom. When the host you have sent the packet to replies the firewall recieves the packet and changes the destination address to your IP and sends the packet to you. Sounds tough? To setup IP masquerading for your loc zone(eth0) to access the net zone(eth1) create/edit /etc/shorewall/masq like this:

eth1 eth0



Maybe it isn't so complicated afterall. Now you almost have a fully functional but for one thing You don't have any policy/rule for packet filtering! What are you waiting for create a default policy now. Just create/edit /etc/shorewall/policy .This file is the basic firewall policy. What it means that when a packet does not meet any firewall rule(which we setup later) then it is routed according to the policy.

#SOURCE DEST ACTION LOGGING
$FW net ACCEPT
$FW loc ACCEPT
net all DROP info
# The FOLLOWING POLICY MUST BE LAST
all all REJECT info



The file is read from top to bottom as soon as a packet matches a given rule it is routed accordingly. In this file what we have done is :
  • Allow all traffic from the firewall to external network.
  • Allow all traffic from the firewall to local network.
  • Drop all traffic from external network to anywhere and log it as info message in syslog.
  • Reject all traffic that doesn't meet any rule.
Don't worry if you don't see this working completely, we have to configure the rules which is followed before the default policy. Create/edit /etc/rules like this :

#ACTION SOURCE DEST PROTO PORT
ACCEPT net $FW tcp 80
ACCEPT loc all all
ACCEPT net $FW icmp



Our basic rules are very simple:
  • Allow only tcp traffic from the external network at port 80(http) to the firewall.
  • Allow all traffic from the local network to anywhere
  • Allow ICMP traffic from the external network to the firewall


Now our configuration is complete but for a small step. Edit the file /etc/default/shorewall and change this line

#Change this from 0 to 1
startup=1



Now our configuration of shorewall is complete. Its time to start it:

/etc/init.d/shorewall start



If all goes well then our firewall should be up and running. What we have configured is a very basic setup. For more features and logging facilities I suggest you look into /usr/share/doc/shorewall. The documentation is excellent and the examples are very descriptive. Now go and have fun with your secure network.

Read More......

Wednesday, September 20, 2006

Backups made easy!

Has it ever happened to you that you were working on some file after hours of work you save your file and go to sleep. A week later you need the file and you get some error while opening it or the file simply isn't there. Now you wish you had backed it up but alas! its gone for good. This is where backups come in. Regular backups can be a real life saver no matter whether your data is worth 1 Re. or 100000000 Rs. If you are on linux you have many ways of backup and millions of tools for backup. Backup Stratergy When the first time you backup its a full backup then subsequent backups can be incremental i.e you only change files that have changed since the last backup. The tool I have chosen is rsync because its fast, reliable and available on most linux distros.The backup method can be any of these:

  • SSH (Backup using rsync over SSH)
  • SAMBA (Backup to a windows machine)
  • NFS (Backup to an NFS export)
  • LOCAL (Backup to a local mounted volume)
The script I've created requires a small configuration step after which you can put it in crontab and relieve yourself of backup troubles. Here's the script:

#!/bin/bash

#Configuration part

#The backup method SSH,NFS,SAMBA or LOCAL
#In case of SSH you would have to set up the authentication keys
#to automate the process
METHOD=

#Path of the directory to be saved
DIRTOSAVE=

#Include hidden files i.e files/dirs beginning with '.' Give option Y/N
HIDDEN=

#Remote machine, needs to be given for SAMBA,NFS or SSH
REMOTE=

#Share path, the share name or the path on the remote machine
#Has to start with a / its not needed for SSH or LOCAL
SHARE=

#The backup dir, has to start with /, for NFS or SAMBA it is
#relative to SHARE, for LOCAL or NFS the path is absoloute
BACKUPDIR=

#Username and Password, has to be given for SAMBA, only username is required for
#SSH, the password you'll have to enter manually or setup ssh keys

USR=
PWD=

#End Configuration

#DO not edit below this


if [ $HIDDEN = 'N' ] ; then
EXCLUDE="--exclude=\".\""
else
EXCLUDE=""
fi

if [ $METHOD = 'LOCAL' ]; then
rsync -ru $EXCLUDE $DIRTOSAVE $BACKUPDIR

elif [ $METHOD = 'SSH' ]; then
rsync -ru $EXCLUDE $DIRTOSAVE $USR@$REMOTE:$BACKUPDIR

elif [ $METHOD = 'SAMBA' ]; then
mount -t smbfs //$REMOTE$SHARE /mnt -o username=$USR,password=$PWD
if [ "$?" -ne "0" ]; then
echo "Could not mount remote share"
exit 1
fi
rsync -ru $EXCLUDE $DIRTOSAVE /mnt$BACKUPDIR
umount /mnt

elif [ $METHOD = 'NFS' ]; then
mount $REMOTE:$SHARE /mnt
if [ "$?" -ne "0" ]; then
echo "Could not mount remote share"
exit 1
fi
rsync -ru $EXCLUDE $DIRTOSAVE /mnt$BACKUPDIR
umount /mnt
fi



The crontab entry for this should look something like this if it is supposed to run every sunday night at 1 AM and the file is located at /root/backup.sh
0 0 * * 0 /root/backup.sh

Read More......
feed