Sunday, September 3, 2017

What can be learn from Nature?

I love clicking birds and so I have been observing trees quite keenly. I am fascinated with this particular species as they can change their color completely .
Gulmohar trees spread a beautiful carpet around them every summer. Each tree starts bearing red flowers at a particular time independent of its neighbouring Gulmohar. It sheds them at its own pace and dons the new green leaves as well.
Gulmohar Tree (24 Jun, 2017)
We can learn these things from them -
1. Be patient for good times - Your time to bear fruit will come at a time which is most suitable to you. There is a dawn after every dusk.
2. Stop comparing - Your friends, neighbours, relatives have different set of problems. Your time and length of good phase does not have to be synchronised with theirs.
3. Bad times teach us - If you are going through a low phase; remember that it will teach you to flower-up during your summers.
4. Be unattached - There is no need to be disheartened every time when things go wrong. You may have to shed your flowers because otherwise you may not gain new leaves.
5. Its a circle - All phases are effervescent. Life keeps oscillating between seasons of happiness and sadness.
Flower (3rd Sept, 2017)

Friday, October 21, 2016

Convert XML to Objects / XML to Java Classes

Problem : To integrate an external service with your product if all you have is request or response XML. That is in case you dont have WSDL.

How come this problem?
Such a scenario can occur if you want to integrate a service but dont have licence or provide a possible service hook so it can be used during implementation.


Steps 


1. Convert XML to XSD

I used this (http://xmlgrid.net/xml2xsd.html). There was one from freeformatter.com  but it is not able to generate XSD's properly. 

Remember to choose the XML which is most data rich. Of course avoid any error response XMLs.




2. Preprocess XSD

Now, there are problems with the conversion.

a. Remove namespaces in XSD - if you ignore this step, then JAXB will throw error while converting it in next step.

b. Add any datatypes not present in XSD. Every data must have data type associated with it. 

c. Correct the incorrect datatypes as seen in cases of int - They are double. Sometimes DateTime is interpreted as String. 

d. Remove the last character. It cant be recognised -  will show error in Eclipse.



3. Use Eclipse or xfc provided in JDK.

a. Right click the your XSD in eclipse and choose new -> Generate JAXB Classes from Schema.
There are many tutorials (http://www.javawebtutor.com/articles/jaxb/jaxb_java_class_from_xsd.php)

Provide package for the new classes etc. and you are done.

b. Alternatively
you can use xjc utlity . This file comes along with JDK.


xjc  Request.xsd

Generation of separate classes
JAXB will generate a single class with all other classes as nested static classes.

In case you want separate classes for each complex type in XSD then bindings.xsb will come to your rescue. This file tells JAXB to generate separate classes.

Bindings.xjb
<jaxb:bindings
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
    version="1.0">
    <jaxb:globalBindings localScoping="toplevel"/>
</jaxb:bindings>

Bindings is an optional file.
xjc -b bindings.xjb  Request.xsd

Another problem I faced was conflicts with naming.

[ERROR] (Relevant to above error) another "MyType" is generated from here.
  line 93 of file:/C:/temp2/Request.xsd
  
  
There were several classes being generated with the same name.
-XautoNameResolution  - will resolve the issue.


xjc -XautoNameResolution -b bindings.xjb  Request.xsd

Wednesday, October 19, 2016

Rename or Remove Namespace in XML file

Recently while working with web services, I stumbled on a problem where in I had to read the the XMLs and convert them into object.

Now this can be done easily, if you have WSDL but I dont usually encounter easy problems.

All I had was an XML and I have manually create an object for it. However, JAXB unmarshaller wont convert it because of namespaces. Hence, I wrote this program to remove namespaces which can be used to rename namespaces as well.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
  * Recursively renames the namespace of a node.
  * 
  * @param node
  *            the starting node.
  * @param namespace
  *            the new namespace. Supplying <tt>null</tt> removes the namespace.
  */
 public static void renameNamespace(Node node, String namespace) {

  Document document = node.getOwnerDocument();
  if (node.getNodeType() == Node.ELEMENT_NODE) {
   String nodename = node.getNodeName();
   Element e = (Element) node;
   NamedNodeMap attrs = node.getAttributes();
   String attributeName = null;
   //rename the namespace in the tag
   if (nodename.lastIndexOf(":") > 0) {
    nodename = (String) nodename.subSequence(nodename.lastIndexOf(":") + 1, nodename.length());
    nodename = namespace + ":" + nodename;
   }
   document.renameNode(node, namespace, nodename);
  }
  NodeList list = node.getChildNodes();
  //call recursively
  for (int i = 0; i < list.getLength(); ++i) {
   renameNamespace(list.item(i), namespace);
  }
 }

Rename Namespaces



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 /**
  * Recursively removes the namespace of a node.
  * 
  * @param node
  *            the starting node.
  * @param namespace
  *            the new namespace. Supplying <tt>null</tt> removes the namespace.
  */
 public static void removeNamespace(Node node) {

  Document document = node.getOwnerDocument();
  if (node.getNodeType() == Node.ELEMENT_NODE) {
   String nodename = node.getNodeName();
   Element e = (Element) node;
   NamedNodeMap attrs = node.getAttributes();
   String attributeName = null;
   //remove the tag which defines namespace
   for (int i = 0; i < attrs.getLength(); i++) {
    if (attrs.item(i) != null) {
     attributeName = attrs.item(i).getNodeName();
     if (attributeName.startsWith("xmlns")) {
      e.removeAttribute(attrs.item(i).getNodeName());
      i--;
     }
    }
   }
   //remove the namespace in the tag
   if (nodename.lastIndexOf(":") > 0) {
    nodename = (String) nodename.subSequence(nodename.lastIndexOf(":") + 1, nodename.length());
   }
   document.renameNode(node, null, nodename);
  }
  NodeList list = node.getChildNodes();
  //call recursively
  for (int i = 0; i < list.getLength(); ++i) {
   removeNamespace(list.item(i), namespace);
  }
 }

Remove Namespaces




 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 private static void print(PrintStream out, Document doc) throws IOException {

  OutputFormat fmt = new OutputFormat();
  fmt.setIndenting(true);
  XMLSerializer ser = new XMLSerializer(out, fmt);
  ser.serialize(doc);
 }

 public static void main(String[] args) {

  try {
   File fXmlFile = new File("src\\test\\xyz.xml");
   DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
   DocumentBuilder dBuilder;
   dBuilder = dbFactory.newDocumentBuilder();
   Document doc = dBuilder.parse(fXmlFile);
   renameNamespace(doc.getDocumentElement().getParentNode(), "renamed");
   //removeNamespace(doc.getDocumentElement().getParentNode());
   print(System.out, doc);
  } catch (ParserConfigurationException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } catch (SAXException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } catch (IOException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }
 }

Test Code



After removing the namespaces the unmarshaller worked like charm.  

Tuesday, October 29, 2013

Defeat Browser Caching

Caching is used at various levels. When you visit a website, your browser fetches the data from the web server and a part of it is stored on local storage temporarily. These can contain source code, image etc. So the next time you open the same website, your request doesn't have to traverse long hierarchy from DNS all the way to country specific web server. This saves time and bandwidth.

Browser Caching may be good for most websites or most parts of it however, it’s not advantageous in number of situations.

  • A secure banking site may not like any of its part to be cached as the customers system can be compromised and cached information can be used to gain insight into customers account. (Yes it uses SSL but the intruder can still know the time of access etc)
  • Parts which need are updated very frequently. For example, the ad block may still show the old “advertisement.gif” and user may click thinking the he’s lucky to always be the millionth visitor!
I have seen these two scenario’s in past one year.

Old Ads

Scenario 1 - In a large organization, it often happens the Development team fixes an issue raised by the Testing team and closes the bug but testers can still find the flaw!
Or
Scenario 2 - There might be various development teams in a web product which is already deployed at the client site. The UI team makes changes but these changes are not visible to end user. The angry client admonishes UI team manager and the blame is passed to business logic team who had no role in it!
The reason for all these is neither Testing team nor Business logic team but Browser Caching!!!

Fighting it out

You must remember that you cannot delete the user’s cache programmatically. Hence, all the methods revolve around prevention.

Method 1 – Tell the browser not to cache.

HTML
<meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate" /> 
<meta http-equiv="expires" content="-1" /> 
<meta http-equiv="pragma" content="no-cache" />

Servlet


response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); 
response.setHeader("Pragma", "no-cache");
response.setDateHeader("Expires", 0);

And one can make it for PHP with header(), ASP with Response.AppendHeader() etc.

This approach is useful if your application was not already cached. If it was, then browser may fetch the cached version only. Also doesn’t work on version of IE (http://support.microsoft.com/kb/321722). The above method is necessary but not sufficient. (Please read edit for the method below)

Method 2(a) – Random number next to link (un-escaped characters)
Change
<link REL="STYLESHEET" TYPE="text/css" HREF/css/default.css"/>
To
 <script >document.write('<link REL="STYLESHEET" TYPE="text/css" HREF="/css/default.css?' + new Date().getTime() + '"></link>');</script>
Each time a random number is generated, it changes the URL and browser believes that it doesn’t have a cached copy.


Method 2(b) – Random number next to link (escaped characters)
Change
<script language="JavaScript" src="/jsdir/My.js"/>
To
<script >    document.write(unescape("%3Cscript src='/jsdir/My.js?" +  new Date().getTime() + "' type='text/javascript'%3E%3C/script%3E"));</script>

The method 2(a) worked for both Google Chrome and Mozilla.

But for IE you need to follow two approaches.
1. If you have CSS then use 2(a), and for
2. JavaScripts use 2(b).


EDIT: Full proof method - Change in Method 1

    This method works on all browsers and you won't need to restart the webserver! Simply include the <head> tag with meta tags two times, one after the <body> tag (needed only for IE).

<html>
<head>
<title>title</title> 
 <meta http-equiv="expires" content="-1" /> 
 <meta http-equiv="pragma" content="no-cache" />
</head>
<body>
  Body goes here
</body>
 <head> 
 <meta http-equiv="expires" content="-1" /> 
 <meta http-equiv="pragma" content="no-cache" />
 </head>
</html>

Monday, July 29, 2013

QTP 11.5 Batch Test Problems

I wanted to test a GUI application and came across this great software - QTP which automates test cases easily. However, I faced issues with the trial version for Batch Testing. Without the batch test runner, one has to keep repeating "Open-Run-Log Results" cycle for EVERY test case. All of it requires user intervention and it felt that manual testing would be much better.I installed updates but it didn't solve the issue.

Googling facilitated me to find an alternative way to batch test. Some users used their VB Scripting knowledge. One can create a .vbs file with following code:-
 ' on error resume next  
 Dim qtApp 'As QuickTest.Application ' Declare the Application object variable  
 Dim qtTest 'As QuickTest.Test ' Declare a Test object variable  
 Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object  
 qtApp.Launch ' Start QuickTest  
 qtApp.Visible = True ' Make the QuickTest application visible  
   
 ' Set QuickTest run options  
 Set file_Sys=CreateObject("Scripting.filesystemObject")  
 Set Dir=file_Sys.GetFolder("C:\YOUR PATH FOR TESTCase Folder")  
 set test_collection=Dir.SubFolders  
 Set qtresultsObj=CreateObject("Quicktest.RunResultsOptions")  
   
 For each t_folder in test_collection  
      qtApp.Open t_folder.Path,True,False  
      qtresultsObj.resultsLocation=t_folder.path&"\Res1"  
      qtApp.Test.Run qtresultsObj,true  
      qtApp.test.Close  
 Next  
 
 qtApp.Options.Run.RunMode = "Fast"  
 qtApp.Options.Run.ViewResults = False  
   
 Set qtTest = Nothing ' Release the Test object  
 Set qtApp = Nothing ' Release the Application object  
   


This script helps to get away with the QTP's erratic batch test runner. But it has its own pitfalls. Whenever you use this, there are error messages displayed after each execution. 

Batch Test Error

 To overcome, I wrote an application in JAVA which will scan after every interval for such messages and do away with them. 




STEPS for Batch Testing
  1. Make a .vbs file
  2. Copy paste the code as shown above and change the file path to the folder where all your test cases are stored, save it
  3. Download the QTP Batch Runner Helper
  4. Run the Helper and enter the scan interval. (Dont click on "Start" )
  5. Double click on ".vbs" file
  6. While the QTP is loading the test case, go back to "Batch Runner Helper" and click on "Start"

Friday, July 19, 2013

Jana Gana Mana Controversy - Clearing Facts

Someone created a post on Facebook about Indian National Anthem being a homage to King George V and as the bad news travels faster, people have started believing it. The post
Stanza 1: The (Indian) people wake up remembering your good name and ask for your blessings and they sing your glories 
(Tava shubha name jaage; tava shubha aashish maage, gaaye tava jaya gaatha)
Stanza 2: Around your throne, people of all religions come and give their love and anxiously wait to hear your kind words.
Stanza 3: Praise to the King for being the charioteer, for leading the ancient travellers beyond misery.
Stanza 4: Drowned in deep ignorance and suffering, this poverty stricken,unconscious country? Waiting for the wink of your eye and our mother's (the Queen's) true protection.
Stanza 5: In your compassionate plans, the sleeping Bharat (India) will wake up. We bow down to your feet, O Queen, and glory to Rajeshwara(the King).
This whole poem does not indicate any love for the Motherland, but depicts a bleak picture of it. When you sing Jana Gana Mana, whom are you glorifying?
Certainly not the Motherland. Is it God? The poem does not indicate that. 
1. "The poem does not indicate that" Surely, such an article was written by someone who lacked intellectual acuity. A poem isn't always direct! Its the meaning behind those words that you have to understand. I'm sure that if this author had read "The Road not Taken by Robert Frost", he would infer that its actually about making a choice of road when one is stuck in a forest!

"Whom are you glorifying? Is it God?" Yes!  The meaning can be easily interpreted by reading the translation itself -> "Praise to the King for being the charioteer, for leading the ancient travellers beyond misery". Tagore could be thinking about Lord Krishna, as to how being a Charioteer, he ensured the victory of the Truth.

And now, if you re-read the entire translation it seems as an ode to God.

2. But, the post also has this ->
only those provinces that were under British rule, i.e., Punjab, Sindh, Gujarat, Maratha, were mentioned. None of the princely states, which are integral parts of India now, such as Kashmir, Rajasthan, Andhra, Mysore and Kerala, were recognized.
"Dravida-Utkala-Bangal" - Dravida includes southern states - Kerala, Mysore too. Even if he hadn't included I still wouldn't believe this allegation for a simple reason - its a "poem" and not encyclopedia page to include all names.

This is what I believe. But I could be wrong. So you should hear straight from the horses mouth:-
1. From his letter in 1939(1) - "I should only insult myself if I cared to answer those who consider me capable of such unbounded stupidity"
2.  Extract from another letter written(2) -  “A certain high official in His Majesty’s service, who was also my friend, had requested that I write a song of felicitation towards the Emperor. The request simply amazed me. It caused a great stir in my heart. In response to that great mental turmoil, I pronounced the victory in Jana Gana Mana of that Bhagya Vidhata of India who has from age after age held steadfast the reins of India’s chariot through rise and fall, through the straight path and the curved. That Lord of Destiny, that Reader of the Collective Mind of India, that Perennial Guide, could never be George V, George VI, or any other George. Even my official friend understood this about the song. After all, even if his admiration for the crown was excessive, he was not lacking in simple common sense.”

References:-

Saturday, June 8, 2013

Thank You Dear Stranger


I had to board my flight at 5:45 pm from Delhi Airport. To be on a safer side I decided to reach Mathura at 11:30 am to take any train to Delhi which all reach there before 2:30 pm.

The suitable trains

The plan was simple, clear and effective.
It usually takes about 30-35 mins to reach Mathura from Vrindavan so I was very relaxed as I started around 11 am. To accompany me, on this lonely journey were a plethora of doleful songs for the heartbroken sung by Altaf Raja et al who have unanimously been the favourite of all Taxi's drivers since time immemorial. Though I requested him three times to decrease the volume but maybe he couldn't hear me as he was already lost thinking why his girl was "Bewafa" (carried away by the song). We stopped for refuelling, a brief transition from cacophony to the highway silence. On arriving at Railway Station's Outer gate, he asked me to take the Pedal rickshaw as he didn't want to bribe the Policemen, I agreed.  The skinny rikshawala took 10 mins to steer the riksha through the crowd and stopped halfway to the reservation centre. 


With only a small trunk besides my laptop bag, I rushed inside the station to see the 100's of men lined up in many queues for getting ticket. With some experience, you can know that enqueing the shortest line doesn't always decrease your waiting time. The dynamics of queuing theory work in ideal conditions and Indian Railway Queues are surely ideal...... for abnormality! As I was halfway in the queue chosen by me, a catfight commenced in the adjacent queue. Since the railway guards failed to break it off, they asked the guy inside the window to stop issuing the tickets. Apparently, the guard must have been inspired from the famous quote - To stop the train, pull the chain!

When I reached near the ticket window, a lady requested me to buy a ticket for her as was in hurry and couldn't afford to join the queue. With people trying to push me aside, I quickly took the money from her and requested for two tickets to Delhi. In no time, the lady inside the window gave me a single ticket for two people!

I quickly apologized for being unable to get a single ticket for her. She understood that it all happened unintentionally and agreed to go in the same train. Though, this didn't appeal me, as the only way to get a train now was to run (it was 12:30 pm). I was frantic to reach Delhi before 3 pm. A guy who accompanied her asked us to cross 2 platforms quickly to catch a train that was to depart. It was a race in which I had to run slower so as not to leave my co-passenger because I had the tickets. Just as we reached the platform-3, panting heavily - found out that, the train had already departed. Cursing myself for helping a stranger and wasting the last opportunity to make it to my flight, I could only get angrier when she said that there are no other trains till 3 pm.

The thought of missing the flight sent shivers, and decided if there are no trains, then I'm taking a bus right away. I traversed back to platform 1, to ask for trains to Delhi at help desk. They were out to lunch. My mind had started playing games, and it kept saying as if the "Game's over”, "You have lost it". It even started questioning my faith. But still something inside me kept saying that "He" can't do that. In few minutes, the same girl with the guy stood before me. I gave them a displeasing look to let them know what they had done to me. She said they are out for lunch, now we need to wait.

We both had smartphones and could access internet. But sometimes, even Google fails to answer what a Coolie can! I fetched the latest information from a Coolie, and started running to platform 3 where the Kongu Express was arriving an hour late from its schedule time. The lady asked me to get into sleeper compartment, even though we didn't have a ticket. As it was my mistake to get a clubbed ticket, I had to accede to it but requested her to handle the ticket Examiner (TTE). Fortunately, we got a compartment where only one person was sleeping. She managed to bribe the TTE. It was a relief as I'm not a veteran player in that field.

After realising that train was going to Hazrat Nizzamuddin instead of New Delhi, I re-calculated the time. It turned out that then I would reach airport only if there isn't a single traffic jam. I couldn't risk it.

The lady started talking, I kept answering straight to end the conversation soon. I thought - Why prolong a futile talk when we were to part anyway? It was sultry and I was perspiring, she offered water. The affable savour-faire seemed suspicious. With a smile, I answered a no to it. As it was only a 2 hour journey, I thought I would survive but the fast moving train made me feel sleepy. With half closed eyes, I laid on my head the bag. Looking at my uneasy posture, she suggested that I must keep my luggage below the seat and sleep peacefully. After a long comfortable sleep, I asked her how I can reach New Delhi at the earliest. She initially said bus to which I objected (didn't want to be a hostage to traffic). The next suggestion was Metro, which involved changing two trains. Favorably, she was also going to a place which had the same route.

After arriving at Delhi, we quickly took a taxi to get to the nearest Metro station. On the train, she told me that the bus from Mathura would not take less than 4 hours and if chose it, I was sure to miss the flight. On the way, I kept thinking, why was she amiable to me? Why didn't she take the auto fare even though I requested her several times? When the New Delhi Metro Station came, I could only re-pay for her kindness with a Munch. From there I got a direct train to Airport.

I now ponder over this incident and ask myself - what if she hadn't asked me to buy a ticket for her? Would I be able to get the much needed peaceful sleep in a sleeper coach? 

Most importantly, Would I still make it to the airport? Maybe not because the train which departed couldn't be caught even If I ran the fastest I could. I reached Airport 50 mins before boarding time, if I was alone in the metro; I would surely get late while learning the process. It made me realize that there are people who are good and without a cause. They are like jewels found below the sea, so rare that its hard to believe they are real. 

--Thank you Dear Stranger    

Monday, February 18, 2013

Those "ASL" Days


Today when my cellphone beeped, it was my friend from college asking if there was anyone in the group of 10 people who could field the question. Suddenly, I reminisced the sounds of "Knock" and "Shutting of door". These two things had been like the beeps of the cell phone then.

In early 2000's, Internet was acknowledged for chatting and Yahoo, ICQ, MSN messengers were the Facebook, Twitter and G+. Yahoo! and Hotmail were competing head to head for users and Yahoo was giving 25 MB of free storage compared to a meager 5 MB from Hotmail. I recollect these from the past:-

1. "ASL?" - (Age, Sex, Location) was how conversations started 90% of the times. People were averse talking to same gender.

2. Usernames were very catchy - Sexyboy2000, smarty86, cuteprincess_18. A friend had made - "MC_BC_UC_IC@....com".

3. In the chatrooms, there would be one user who would force everyone to hear the song that he/she was listening to on his machine.

4. Most users usually had fix timings of staying logged in. You could find them during that interval in the same chatroom.

5. Every messenger had some irritating "Buzz!" which was to grab the attention of the participants. Most of us would use it several times one after the other.

I guess I was in 4th or 5th class when I joined a chatroom. There were some who were discussing about games and other topics in the main window. I didn't understand many of the shortforms they used and so I would ask the same. So then, this person PMed(private message) me. As I was new to chatting, I would immediately add anyone who sent a message. She was 60/f/US.

Slowly we started talking regularly and more so because this user was online most of the time. She would help me with all Internet related stuff (voice chat, ICQ etc).  Since its very usual for us to refer to any elder women as "aunty", she found it very cute. I was too young to understand what was cute there.  We became great friends. I often taught her hindi words, she would help me understanding american phrases. Im sure I voice chatted too but dont remember anything specific. Yes, once I asked her the meaning of F word and she said I need to stop talking to such people :). Everytime after the school, I would log in and we would have something talk about. It would usually begin with what I did at school.

A few months later, I tried to login but was unsuccessful. In those days, the server wouldn't always connect you. After several attempts, I was sure it wasn't that. The dialog box said that Yahoo! won’t allow anyone below 13 years! I couldn’t even log in from the web interface. They had deleted my account.

Later, I created another account but didn’t remember her username completely. I tried looking in various chatrooms but no "cookenciel....." was found. Even  couldn’t help me.  And this is how I lost my first online friend.

Wednesday, October 10, 2012

Fake "Privacy Notice" On Facebook


The problem with the Internet users today is that they think its gonna take only a second to re-post, but they forget its gonna take less than a minute to find out the Truth.

Do you think re-posting this on wall would help?  Hell no!

This post has been going viral for a month now.  
Facebook is now a publicly traded entity. It is recommended that all members post a notice similar to this, or if you prefer you can copy and paste this release. If you do not publish such a statement at least once, then you are indirectly allowing public use of such items as your photos and information contained in their status updates. PRIVACY NOTICE: Warning - any person and / or institution and / or Agent and / or Agency of any governmental structure including but not limited to the United States Federal Government also using or monitoring this website or any of its associated sites DO NOT have my permission to use any of my profile information nor any of the content contained herein including, but not limited to my photos, and / or the comments made about my photos or any other "picture" of art posted on my profile. You are hereby notified that it is strictly prohibited to disclose, copy, distribute, disclose or take any other action against me with regard to this profile and the contents herein. The previous prohibitions also apply to your employee, agent, student, or any personnel under your direction or control. The contents of this profile are private and confidential information and sensitive. The violation of my personal privacy is punishable by law. UCC 1 -103 1 -308.

Firstly, before joining Facebook you agreed to their privacy policy. Whatever you agreed cannot be altered even if you put a threatening notice!

Secondly, Facebook hasn't changed its privacy policy after it went public on May 18, 2012. And in case, they decide to do that in future then EACH user has to accept or deny it. Obviously, users who agree would be allowed to use service. Remember - Google making you agree to fresh policy changes recently?

Most importantly, UCC 1 - 308 isn't related to privacy or social networking!!


Moreover, there is a post on FB Newsroom which says that the Facebook Governance Page  would allow users to actively participate in the acceptance/rejection of changes in privacy policy.

Friday, September 14, 2012

What is the best/worst comment in source code you have ever encountered?



1.
 options.BatchSize = 300; //Madness? THIS IS SPARTAAAAAA!



2.
// I am not responsible of this code.
// They made me write it, against my will.



3.
// I am not sure if we need this, but too scared to delete.



4.
//Dear future me. Please forgive me.
//I can't even begin to express how sorry I am.



5.
/*
 * You may think you know what the following code does.
 * But you don’t. Trust me.
 * Fiddle with it, and you’ll spend many a sleepless
 * Night cursing the moment you thought you’d be clever
 * Enough to "optimize" the code below.
 * Now close this file and go play with something else.
 */



6.
#Christmas tree initializer 
    toConnect = [  ] 
    toRead =   [        ] 
    toWrite = [           ]  
    primes = [               ] 
    responses =  {} 
    remaining =   {}



7.
double penetration; // ouch



8.
// I dedicate all this code, all my work, to my wife, Darlene, who will
// have to support me and our three children and the dog once it gets
// released into the public.



9.
# To understand recursion, see the bottom of this file

At the bottom of the file:
# To understand recursion, see the top of this file



10.
//When I wrote this, only God and I understood what I was doing
//Now, God only knows



11.
//
// Dear maintainer:
//
// Once you are done trying to 'optimize' this routine,
// and have realized what a terrible mistake that was,
// please increment the following counter as a warning
// to the next guy:
//
// total_hours_wasted_here = 42
//
.


12.
/**
* For the brave souls who get this far: You are the chosen ones,
* the valiant knights of programming who toil away, without rest,
* fixing our most awful code. To you, true saviours, kings of men,
* I say this: never gonna give you up, never gonna let you down,
* never gonna run around and desert you. Never gonna make you cry,
* never gonna say goodbye. Never gonna tell a lie and hurt you.
*/




Thursday, January 12, 2012

Sunday, January 8, 2012

Nathuram Realized the Gandhian Dream!


Gandhi, a votary of non-violence and truth, credited for shaping India’s democratic and secular ideals. He was a one man army; people followed his words and trusted his actions. Such was his impact, that people could lay life for him. He is crowned “Man of the Year” in 1930 by the Time magazine. Today, Martin Luther King, Dalai Lama, Nelson Mandela are known as “Children of Gandhi”. Movies made on his life and beliefs have won various International awards. His birthday is “International Day of Non-Violence”.

Those and plethora of other praises for the dhoti clad revolutionist. How could Gandhi’s killer being an Indian killed the man who was fighting for the same cause? Nathuram Godse, often criticized for killing the peaceful man, played a pivotal role in the securing the Indian borders.

In 1906, the Muslim league was formed to support the needs of Muslims. By then Mohd Jinnah was an ambassador of Hindu-Muslim unity. However, after Congress won the 1937 election by extreme majority, and rejected coalition with Muslim league (who won 4.5% votes) demanding a big proportion of Muslims in coalition government. Furious with Congress and to fulfil his political ambitions turned to British rule. Jinnah promised to support British rule at centre if they supported Muslim interests in Congress provinces. ”It is not because we are in love with Imperialism, Jinnah explained to the annual League session in December 1938, “but in Politics one has to play one's game as on a chessboard.

 In 1940, Mohd Jinnah made a statement that demanded a separate nation for Muslims. Gandhi opposed the idea of partition saying "My whole soul rebels against the idea that Hinduism and Islam represent two antagonistic cultures and doctrines. To assent to such a doctrine is for me a denial of God."  Many other Muslim parties opposed such a division but they were subdued. There were several Hindu-Muslim riots in East Bengal which was a Muslim Majority region. A venomous document called Lal Ishtahar , or Red Pamphlet incited the Muslims to kill Hindus.

This extract is from R.C Majumdar’s book “Struggle For Freedom” -> Red Pamphlet
“Ye Musalmans arise awake! Do not buy anything from a Hindu shop. Do not give any employment to a Hindu. Do not accept any degrading office under a Hindu. You are ignorant, but if you acquire knowledge you can at once send all Hindus to jahannum(hell) ………..” 


Millions of Hindus were slaughtered. Being aware of all this, Gandhi was still adamant on his non-violent policy and advised Hindus to stick to ahimsa. Such a staunch approach towards non-violence proved fatal for Hindus. Many more such incidences caused a total divide of India.In the end, it was the Indians who suffered and paid the price of Jinnah and Nehru’s ego with the partition.

Gandhi was responsible for killing of the innocent Hindus. He also didn’t support revolutionists like Bhagat Singh. Even after partition, he fasted so that India released a substantial amount of money for Pakistan. He fasted so that Hindus behave normally with Muslims in India whereas in Pakistan, Muslims kept supressing Hindus but that didn’t affect him. He was violently non-violent. So, he was killed!

Soon after Independence, there were several wars with Pakistan and when they can’t win a war they depend on terrorism. None can deny he wanted peace but expecting a Lion to eat grass is asking too much. If Gandhi was alive, he may have handed Kashmir to Pakistan and that still wouldn’t have quenched their thirst. They would ask for more states and Gandhi who loathed bloodshed would have surely made India bend. His way could arouse national integrity but couldn’t crucify the greed for power and fame. So, his killing was vital for India’s security. Therefore, Nathuram realized the Gandhian dream more than Gandhi could do if he was alive.  

However, killing of a great man like him also had the other side. It paved the way for the rise of dirty politics in the country. The loss of such a leader who was devoted to the nation proved disastrous.  Indian borders were far stretched and freedom gained was soon lost due to ineffective government policies and lack of strong leader.

This is in response, to the various videos and comments of people who are taking sides of (Gandhi) or (Nathuram and Bhagat Singh). Had we got freedom Bhagat Singh’s way then a wrong message would be sent. A loss is better than false victory, and so independence through violent measures is more of a false victory. It may have freed the country but all those violent leaders would have their say and would have divided India into more parts as per their domination. An organised and united approach was needed which cemented all and Gandhi’s approach was equitable.

Thus, taking sides of either would not give us what we have now. Each freedom fighter was instrumental for the turnout.

Presently, corruption and dynastic ruling have crippled the Gandhian ideals. Somehow, he is revered by history books, celebrities, and movies but no more resides in people’s heart. He is everyone’s need but only on currency notes. The nation has suffered due to over ambitious leaders of past and is turning a blind eye to the lessons it learnt. The leaders shouldn’t forget that they are a part of nation and nation isn’t a part of them. Therefore, their good lies in the good of the nation