March 28, 2011

GeoTools DbaseFileReader Sample Code

           
           

I observed that, the code given in geotools documentation  is wrong. The statement missing semi colon and major mistake is DbaseFileReader constructor is passing single argument. Actually there is no such constructor.
This sample code read the DBF file and display the row on console.

I am using NetBeans 6.9.1 , JDK 6 and GeoTools 7.2.1

I used following classes

import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.channels.FileChannel.*;
import org.geotools.data.shapefile.dbf.DbaseFileReader;        


Following code read the DBF file from c: drive with the name jal.dbf. You can change the file name with your file location. You can paste this code to your command button event listener method.

Code:-
File selectedFile = jFileChooser1.getSelectedFile();
FileChannel in = null;
        try {
           in = new FileInputStream(selectedFile).getChannel();        //read the DBF file //Dynamic path
           //in = new FileInputStream("c://jal.dbf").getChannel();       //Static path   
        } catch (FileNotFoundException ex) {
            Logger.getLogger(SearchengineView.class.getName()).log(Level.SEVERE, null, ex);
        }
    DbaseFileReader r = null;
    try {
    r = new DbaseFileReader (in, false,Charset.forName("ISO-8859-1"));  //line was wrong in original code
    } catch (IOException ex1) { }

    Object[] fields = new Object[r.getHeader().getNumFields()];
    while(r.hasNext())
    {
            try {
                r.readEntry(fields);
                System.out.println(r.readRow());   //display the row on console
              } catch (IOException ex) {
                Logger.getLogger(SearchengineView.class.getName()).log(Level.SEVERE, null, ex);
            }
    }
        try {
            r.close();
        } catch (IOException ex) {
            Logger.getLogger(SearchengineView.class.getName()).log(Level.SEVERE, null, ex);
        }

           
           
         

February 3, 2011

DVD-RAM ???

If you look over the items of “My Computer” in Windows XP, you may see DVD-RAM drive. In early days it, was CD-ROM or CD-RW, so what does DVD-RAM drive means?

DVD-RAM disk
Basically, DVD-RAM (Random Access Memory) disk is the same as DVD-ROM or DVD, but which is having read/write facility. In simple word, DVD-RAM is like a re-writable DVD but not exactly the same. DVD-RAM is excellent in damage protection and they have long life than other DVD formats.

 In the normal DVD, you can only read the data from disk but cannot write. In DVD-RAM, you can re-write data many times as per requirement. DVD-RAM is used in camcorders, set top boxes, and etc.

Your DVD-RAM drive is able to write the DVD-RAM disk and DVD.

January 18, 2011

First moon mission – Who was the third person?

All know the fact that, NASA’s Apollo 11 spacecraft landed on moon on 20th July 1969 and the commander Neil Armstrong became first human to walk on the moon. You might also know about the Lunar Module Pilot Adwin Aldrin Jr. who became second moonwalker. But some of you might not know that, in this mission three people went to moon, out of which 2 walked on the moon surface and third person Command Module Pilot Michael Collins orbited above the moon surface in command ship named as Columbia. So the bottom line is 3 people went to moon but 2 walked on moon surface and one was in the ship.

January 17, 2011

Really, The Great Wall of China is the only manmade object visible by unaided (naked) eyes from the moon or space?


FDI publication’s “Around D Word” book states that, there are only 2 artificial objects which can be seen from space, one is Kansai Airport which is located at Japan and other is The Great Wall of China. Then I started quizzing myself about this. I am putting some finding of my investigation.
Little background about this rumor/misconception/myth,
Þ In 1754, English antiquary William Stukeley wrote in letter, “This mighty wall of four score miles in length (Hadrian's Wall) is only exceeded by the Chinese Wall, which makes a considerable figure upon the terrestrial globe, and may be discerned at the moon”
Þ Similar kind of reference found in American-published magazine The Century in 1893
Þ In 1895, Henry Norman states "besides its age it enjoys the reputation of being the only work of human hands on the globe visible from the moon."
Þ In 1932, it was appeared publicly in “Ripley’s Believe It Or Not” cartoon
Þ In 1938, Richard Halliburton's book “Second Book of Marvels” assured readers that The Great Wall could be seen from space and claimed that it was the only man-made structure visible from the moon
This claim was made long before the first man-made satellite, Sputnik, was sent into orbit, and 31 years before humankind had set foot on the moon.
The answer of the above myth:
In case of moon the answer is NO.
The wall is a maximum 9.1 m (30 ft) wide, and is about the same color as the soil surrounding it. Based on the optics of resolving power (distance versus the width of the iris: a few millimeters for the human eye, meters for large telescopes) only an object of reasonable contrast to its surroundings which is 70 mi (110 km) or more in diameter (1 arc-minute) would be visible to the unaided eye from the moon, whose average distance from Earth is 384,393 km (238,851 mi). The apparent width of the Great Wall from the moon is the same as that of a human hair viewed from 2 miles away. To see the wall from the moon would require spatial resolution 17,000 times better than normal (20/20) vision.
In 2001, Neil Armstrong stated about the view from Apollo 11: "I do not believe that, at least with my eyes, there would be any man-made object that I could see. I have not yet found somebody who has told me they've seen the Wall of China from Earth orbit. ...I've asked various people, particularly Shuttle guys, that have been many orbits around China in the daytime, and the ones I've talked to didn't see it."
Apollo 12’s astronaut Alan Bean: "The only thing you can see from the moon is a beautiful sphere, mostly white (clouds), some blue (ocean), patches of yellow (deserts), and every once in a while some green vegetation. No man-made object is visible on this scale. In fact, when first leaving earth's orbit and only a few thousand miles away, no man-made object is visible at that point either."
In case of space the answer is hazy.
Actually, answer of this question is depends on, what do we mean by SPACE? If we take "space" to mean a low Earth orbit (160 km), even though its visibility from that distance is questionable.
Some claims that, we can see it from this distance with naked eyes. U.S. Senator Jake Garn claimed that he was able to see the Great Wall with the naked eye from a space shuttle orbit in the early 1980s, but his claim has been disputed by several U.S. astronauts. Veteran U.S. astronaut Gene Cernan has stated: "At Earth orbit of 100 miles (160 km) to 200 miles (320 km) high, the Great Wall of China is, indeed, visible to the naked eye." Ed Lu, Expedition 7 Science Officer aboard the International Space Station, adds that, "it's less visible than a lot of other objects. And you have to know where to look."
But other authors have argued that, due to limitations of the optics of the eye and the spacing of photoreceptors on the retina, it is impossible to see the wall with the naked eye, even from low orbit, and would require visual acuity of 20/3 (7.7 times better than normal).
Kamlesh P. Lulla, NASA's chief scientist for Earth observation at Johnson Space Center in Houston, directs observation science activities from the Space Shuttle and the International Space Station. He says that generally the Great Wall is hard to see and hard to photograph, because the material from which it is made is about the same color and texture as the area surrounding it. It's questionable whether you can see it with the unaided eye from space. "The shape, the age of the structure, the resolution of the camera, the condition of the atmosphere -- all these factors affect the ability to detect an object from space." But, he added, "you can see the wall in radar images taken from space."
On the whole issue NASA says “The Great Wall of China, frequently billed as the only man-made object visible from space, generally isn't, at least to the unaided eye in low Earth orbit. It certainly isn't visible from the Moon.

To conclude, The Great Wall of China is not visible from either moon or space.
The Beijing Times added, "Having this falsehood printed in our elementary school textbooks is probably the main cause of the misconception being so widely spread."
According to the BBC, "For decades, elementary schoolbooks have maintained that the Great Wall of China could be seen from space - but now the books are being rewritten."
But in India, such wrong information spreading is still going on…
(This article is written on 12-01-2011)

November 29, 2010

Curriculum Vitae V/S Resume


Curriculum Vitae V/S Résumé is one of the hot topic of confusion. When I was working at Penn State, I discussed this topic with one of the English faculty and I am going to add some points from our discussion.

The terms résumé and curriculum vitae are used in different ways all over the world. In United States and in the English-speaking areas of Canada, the word résumé is used principally. In England, Scotland, Ireland, New Zealand, the word curriculum vitae is used principally. In India and Australia the terms are using interchangeably. This doesn’t mean that curriculum vitae term is not used in United States, people are using alternate word but mainly they are using the particular word, same with other countries also.

Résumé should be shorter (approximately 1 or 2 pages most). Résumé is used for applying in the private sector. Résumé should be more specific skills and achievements.

Curriculum Vitae is also called Vita, but not Curriculum Vita (this is wrong word to replace Curriculum Vitae) and it is acronym as CV. It gives detailed information about you. It includes information about educational and academic background, teaching and research experience, publication, awards, honors and etc. CV is used to apply for internship, fellowship, teaching and etc.

So which is the perfect word for you CV or Résumé???


Dehradun City – A Review

In Nov 2009, I got a chance to visit Dehradun for official work. Here, I am sharing my experience and views about Dehradun city. First thing I want to tell you that, Delhi-Dehradun is a very time consuming journey and I suggest don’t take any private bus to travel. I have a very bad experience of private bus that I don’t want to share. I spend Rs. 852 to travel from Delhi to Dehradun through private and so called luxury bus. Delhi to Dehradun journey by ISBT (state government bus) is cheap but very time consuming. It takes 7 hours to travel only 245 km. I recommend to take rail if feasible, which cost more but takes only 3-4 hours (Shatabdi Express).

I don’t understand why people are so fascinated about the city? Some people may like it because of pleasant weather and some (boys) may like because of cute girls, but are these the criteria to like any city?

Dehradun is not a fast city like Mumbai and Delhi, here life runs very smoothly. Like any, Dehradun has some positive as well as negative points. Rickshaw, breakfast rates are very costly. Worst thing is that, you have to eat Parathas (aalu or muli), Chhole-bhatore, Maggie or Pav bhaji in your breakfast. In an average looking restaurant, I shocked by looking at the rate board; wada sambar – Rs. 30, dosa – Rs. 40, tea – Rs. 6, I exited from that place without eating anything. Rickshaws are terribly expensive. I paid Rs. 140 from IIRS to WII, but I was shocked when I have to pay Rs. 30 for just 1.65 km.

If you want to roam in and around Dehradun, there is not a single pleasing place (except some local attractions). Only options are Mussoorie and Rajaji National Park. I heard that Massoorie is nice hill station. I had a chance to visit Massoorie but I avoided it because of company. It feels very boring to roam alone. I was eager to visit Rajaji National Park but you need own vehicle to get in. So I decided to roam in the marketplace that is near to Ghanta ghar. The market was not so impressive. I think that market is only for women and girls. I found fewer shops, where I can buy for myself. You shall find almost all shops in the market have fixed rates. The interesting fact about market is that, it is closed up to 9 pm.

I heard that, Chat is very good in North India. But in case of Dehradun, I found Band Tikki, Pani Puri and one more item (that I don’t remember). In Maharashtra, you can find a lot chat items. 

In a week, I ate Patta kobi 6 times, but I don’t blame the city because it’s my bad luck that, Patta kobi followed me even at Dehradun, after Jalgaon, Hyderabad and Penn State (USA).

Vikram (tam-tam) is a nice and cheaper option to roam in the city than Rickshaw. I don’t know about city bus but I think their frequency is very low, so people prefer Vikram. You will find a good number of banks (specially nationalized) and ATMs in the city.

Overall, in my view, Dehradun is an average city.

August 25, 2010

Hard Disk Drive V/S Hard Disk

What is the difference between Hard Disk Drive and Hard Disk?
Most of the people use these words interchangeably, without knowing the meaning of both. Technically, Hard Disk contains the data and Hard Disk Drive which controls the motion of the hard disks. This confusion arises because Hard Disk Drive and Hard Disk are placed at same case, but in case of Floppy Disk Drive and Floppy Disk, they are separate.

July 26, 2010

Server and Client are really a Hardware???


Technically Not!!!

Server is a software program which gives service to other software programs (clients). Client is also a software program which sends the requirement request to the server.
People are talking about server and client as a hardware, actually they are talking about the server computer and client computer not about server and client. Server computer is the high configured computer which uses the server program to give service to client computer request which sent by client program.

Popular Posts