Monday, August 19, 2019

How to delete pages from a PDF


  1. Open the PDF in Acrobat PDF
  2. Click File -> Print
  3. Select Microsoft Print to PDF as the Printer
  4. Select the page range and click Print
  5. Enter the name of the file in the prompt. Your new file with selected page is saved

Tuesday, July 02, 2013

Dan Brown's Inferno

Had been thinking of reading it for sometime now. Ordered it from Flipkart.com and true to word they delivered on time :-).

Typical Dan Brown book with symbolism's and puzzles. The topic which he has taken does look ominous and very real. "Over population" is a real threat to human survival. Countries have taken steps to counter that by asking people to limit their off-spring count like China. Recently read a report that by 2028 India will overtake China as the most populous nation. Author argues that there is a limit to the population which can be handled by our earth given its resources. The moment we go over that, the human race will perish. It is a strong argument. Epidemics had been nature's way of controlling the numbers. Given the advancements in medical field we are now not seeing the kind of epidemics which were common around 20-30 years back. So how do we control the human population? Should we invent an epidemic which cannot be controlled? Or is there a better way?

The story revolves around this premise.

There are all the twists and turns and the puzzles and excitement we have come to expect from Dan Brown's Robert Langdon.

I loved reading it :-)

Tuesday, August 18, 2009

What to do if you got swine flu

First of all it is pretty dangerous, so be very very careful.

1) Catch it by one of its legs and sneeze on it..huh..
2) Carefully place it on a hard surface and beat it with a huge book, books on operating systems or databases or Complete References are recommended.

Thursday, January 29, 2009

Learning JAXP

When i referred to this link http://www.ibm.com/developerworks/java/library/x-jaxp it pointed out that it is good to have knowledge on SAX(Simple API for XML) and DOM.

So started with SAX. It is an open source project with no license whatsoever. I started with the "Quickstart" page(http://www.saxproject.org/quickstart.html).

It details a simple example of how to use a SAX parser and what you can do with it.
SAX is an event based XML parser. We would extend the org.xml.sax.helpers.DefaultHandler. Then we would have to create a SAX Driver and attach this handler to it.This provides callback to the events like startDocument(when the SAX Driver finds the beginning of a document) or startElement(when SAX driver starts to parse an element).

I just expanded the example given in the site to check if the XML supplied has all the tags and that they are properly ended or not.
For this i used the startTag() and endTag() callback method.

import java.io.FileReader;
import java.io.IOException;

import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
import org.xml.sax.helpers.XMLReaderFactory;
import java.util.ArrayList;

public class SaxApp extends DefaultHandler{
public SaxApp(){
super();
}
ArrayList arrList = new ArrayList();
boolean error = false;
public void endDocument() throws SAXException {
// TODO Auto-generated method stub
super.endDocument();
System.out.println("End Document");
if(error)
System.out.println("There is error in the document..");
else
System.out.println("There is no error in the document..");
}

public void startDocument() throws SAXException {
// TODO Auto-generated method stub
super.startDocument();
System.out.println("Start Document");
}

public void startElement (String uri, String name,
String qName, Attributes atts)
{
if ("".equals (uri)){
System.out.println("Start element: " + qName);
arrList.add(qName);
}
else
System.out.println("Start element: {" + uri + "}" + name);
}

public void endElement (String uri, String name, String qName)
{
if ("".equals (uri)){
System.out.println("End element: " + qName);
String last =(String)arrList.get(arrList.size()-1);
System.out.println("Last element is :"+last);
if(last.equals(qName)){
arrList.remove(arrList.size()-1);
}else
error = true;
}
else
System.out.println("End element: {" + uri + "}" + name);
}


public static void main(String args[]){
try {
SaxApp app = new SaxApp();
XMLReader myReader = XMLReaderFactory.createXMLReader();
FileReader freader = new FileReader("C:\\error-log-0.xml");

myReader.setContentHandler(app);
myReader.setErrorHandler(app);

myReader.parse(new InputSource(freader));
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}
}

Monday, December 15, 2008

Amazing win for India

First of all, Well Done Sehwag, Sachin and Yuvraj... Amazing game..after what seemed like a easy win for England for 3 and 3/4 days Sehwag comes in and in his inimitable style takes the game away...Just love to watch him when he gets going... Its like every ball something would happen..

Test match cricket at its best..No one would have given India any chance to chase down 387 on the last day and batting was not getting easy(till Sehwag showed it is :-)).

Dhoni 4 out of 4.Great going. India started to take control when England made just 50 odd runs in the 24 overs on Day 4. And kudos to Dhoni to let Yuvraj come in before him. I would have thought after his first innings failure he would not come in at No.5.And Yuvraj did not let him down. It was nice to see the good banter that was going on between Yuvraj and Flintoff. Flintoff trying to provoke Yuvraj and he turning away each time Flintoff came in.

But thanks to England to brave all odds and come in with a full strength team. As Ravi Shastri said we are all very grateful to England team and Barmy Army.If you want to follow Barmy Army i just found out that they have a blog on cricinfo.

Saturday, March 24, 2007

Why blame team india..blame ours genes instead :P

Like millions of Indian Fans i too watched the pathetic display by the Indian Cricket Team..Now we have to rely on Bermuda to beat Bangladesh if we have to go through to next stage.I pray feverishly that it does not happen.Bangladesh deserves to be in Super 8 than India.

This all raises just one question..There is money,there is name ...but where the hell is the commitment? The one thing which was pretty clear from both the matches we lost was that the other team had more intent to win than us..

In the match against Bangladesh it looked like indians did not believe that Bangladesh could beat them even if they scored just 10 runs.The attitude cost them dearly.They were not ready to make something happen rather were content to let Bangladesh press the self destroy button,which did not happen.

In the match against Srilankans it was easy to see that they had come to the game with the purpose of gaining 2 points while going to next round shall india make through.Even when this was a do or die match for india we just failed to realize the enormity of the match.When Srilankans were tottering we just let them off the hook and they took it with both hands.

While Indian cricketers would be the ones making all the money they never look like they deserve all these.One has to just see the performance by India outside Indian subcontinent.So is it time for us to do a reality check? Should we just boycott all the stuff promoted by them?

What this would achieve is that sponsors will move away from cricket and cricketers will get more time to play cricket and train rather than doing endorsements.

Or is this the problem with the genes?Are we not aggressive enough or are we not physically fit enough genetically to play and physically intensive sport.Agreed cricket needs fitness but if you compare with other sports like Athletics or Tennis or Football..the fitness levels required are far less.Maybe that explains why India is not a big force in any of the above sports.
Why blame team india..blame ours genes instead :P