Archive: ‘Tips’ Category

HSQLDB CASE-Insensitive ‘LIKE’ QUERY – THREE Implementation Methods

No comments October 1st, 2007

 

Method 1: We can use the following command to change the case sensitivity of the text-comparison of any table which we are going to create.
SET IGNORECASE
SET IGNORECASE { TRUE | FALSE };

· Disables (ignorecase = true) or enables (ignorecase = false) the case sensitivity of text comparison and indexing for new tables.· By default, character columns in new databases are case sensitive. The sensitivity must be switched before creating tables.· Existing tables and their data are not affected.· When switched on, the data type VARCHAR is set to VARCHAR_IGNORECASE in new tables.· Alternatively, we can specify the VARCHAR_IGNORECASE type for the definition of individual columns. So it is possible to have some columns case sensitive and some not, even in the same table.· Only an administrator may do this.Link: http://hsqldb.org/web/hsqlDocsFrame.html

Method 2: We can extend HSQLDB with JAVA functions.

Java function to do the case-insensitive searchpublic static boolean containsMatch(String target, String search) {return target.toLowerCase().contains(search.toLowerCase());}

  • This function must be a public static function.
  • Same as the Stored Procedures in HSQLDB

Query used to get the dataselect distinct “COLUMN NAME” from Sheet where "com.companyname.xxx.Util.containsMatch"("COLUMN NAME", ‘String to search’)Link: http://blog.taragana.com/index.php/archive/tip-how-to-extend-hsqldb-rdbms-with-java/

Method 3: We can use the methods like LCASE or UCASE to the column name. It’s giving inside the SQL QUERY itself. This will first convert that column values into a SPECIFIC CASE before comparison.

SQL QuerySelect FIELD_NAME from TABLE_NAME WHERE “+ “LCASE (FIELD_NAME) LIKE ‘%” + search_String + “%’We can also use UCASESelect FIELD_NAME from TABLE_NAME WHERE “+ “UCASE (FIELD_NAME) LIKE ‘%” + search_String + “%’Here search_String is the string which we want to search inside that database.Link: http://www.devdaily.com/java/jwarehouse/hsqldb/src/org/hsqldb/sample/FindFile.java.shtml,,

Book Mark it-> del.icio.us | Reddit | Slashdot | Digg | Facebook | Technorati | Google | StumbleUpon | Window Live | Tailrank | Furl | Netscape | Yahoo | BlinkList

Popularity: 1% [?]

Bookmark this on BuzzURLBookmark this on BuzzURL Post to TwitterTweets for this web page Bookmark this on FC2 Bookmark newsing it! Choix it! Add to Google Bookmark Bookmark this on Delicious Digg This

Different types of US Visas

No comments September 24th, 2007

 

Ever wondered what type of Visa you need if you want to enter USA. Here are the different types of Visa for USA. [Its taken from Bhuvan’s Blog].

A – Official Visa

  • A-1: For Ambassadors, public ministers & consular officers
  • A-2: For immediate family members of A-1
  • A-3: Attendants & servants of A-1 and A-2 holders

    B – Business/Visitor Visa

  • B-1: Temporary visitor for business
  • B-2: Temporary visitor for leisure

    C & D Visa (For Aliens in transit)

  • C-1,2: Alien in transit directly through US
  • C-3: Family of C-1,C-2 in transit
  • C-4: Transit without Visa(TWOV)
  • D-1: Sailors departing on vessel of arrival
  • D-2: Sailors departing by other means

    E – Visa (For Traders/Investors)

  • E-1: Treaty Trader, spouse and children
  • E-2: Treaty Investor, spouse and children

    F Visa (Students)

    Want to study or research at a U.S. college? Then F is the visa for you -

  • F-1: Academic Student
  • F-2: Spouse or child of F-1

    H (Temporary Worker) Visa

  • H-1B: Persons in a specialty occupation
  • H-2B: Seasonal nonagricultural workers
  • H-3: Trainees other than medical/academic; also training of handicaps
  • H-4: Dependants of H visa holders

    I Visa (Media persons)

    Are you a reporter, film person, Editor? Then you require an I-visa -Essential documents: Your press ID, a letter from the editor.

    J & Q Exchange Visitor Visa

  • J-1: Visas for exchange visitors. exchange visitors may be academics, scientists, businesspeople or students.
  • J-2: Spouse or ‘child’ of J-1 under 21

    K Fiance(e) of US Citizen

  • K-1: Fiance(e)
  • K-2: Minor child of K-1
  • K-3: Spouse of a U.S. Citizen (LIFE Act)
  • K-4: Child of K-3 (LIFE Act)Essential documents: Marriage certificate & Photos, Intent of marrying within 90 days in US(for K1).

    L Visa (Intra company Transferees)

  • L-1A: Executive, managerial
  • L-1B: Specialized knowledge
  • L-2: Spouse or child of L-1

    M Visa – Vocational and Language Students

  • M-1: Vocational student or other non-academic student
  • M-2: Spouse or child of M-1

    O Visa – For Prodigies

  • O-1: For a Genius in Sciences, Arts, Education, Business, or Athletics.
  • O-2: Alien’s (support) accompanying O-1
  • O-3: Spouse or child of O-1 or O-2

    P Visa – Athletes and Entertainers

  • P-1: Athletes & Entertainment groups
  • P-2: Entertainers in exchange programs
  • P-3: Entertainers in cultural programs
  • P-4: Spouse or child of P-1, 2, or 3

    R Visa – Religious Workers

  • R-1: Religious workers
  • R-2: Spouse or child of R-1
  • Technorati Tags: ,

    Book Mark it-> del.icio.us | Reddit | Slashdot | Digg | Facebook | Technorati | Google | StumbleUpon | Window Live | Tailrank | Furl | Netscape | Yahoo | BlinkList

    Popularity: 1% [?]

    Bookmark this on BuzzURLBookmark this on BuzzURL Post to TwitterTweets for this web page Bookmark this on FC2 Bookmark newsing it! Choix it! Add to Google Bookmark Bookmark this on Delicious Digg This

    Reading Properties File from outside of a JAR File

    8 comments September 14th, 2007

    Today in my project I had a requirement to fetch the properties file from out side of my JAR file. Its easy to pick it from the CLASSPATH of that JAR file but not that much easy to pick from a “Special location” like TOMCAT home, outside the JAR file. At first I tried to read it as a ResourceBundle. But with our so much difference I done it as follows…

    String path = System.getProperty("catalina.base")

                      + System.getProperty("file.seperator")
                      + "YOUR_FILE.properties";
    FileInputStream fis = new FileInputStream(path);
    Properties props = new Properties();
    props.load(fis);
    fis.close();

    I am putting some more code examples here which I came across my search. Hope this helps anyone.

    1. If the resource file is located in your CLASSPATH, then

       objRes = ResourceBundle.getBundle("/ResFile.Application");

    These two are also helpful

    2. Reading from another JAR (Source : here)
    If your program is in an executable jar file then add the following in the manifest file inside your JAR
    class-path: jarname.jar
    jarname.jar has “some/path/myconfig.properties” file
    To access the properties in junk from your executable jar file in your class, do the following

    Locale eng = Locale.ENGLISH;
    String myvalue  = java.util.ResourceBundle
        .getBundle("some/path/myconfig",eng).getString("greeting");

    3. Verifying the Location (Source: here )  In your code, make sure that you are correctly requesting the resource. If you are requesting a resource from the directory where you are running your jar file from (i.e. the working directory), simply use ResourceBundle.getBundle(“Resource”); or equivalent method.

    If you bundle is within a directory, you must specify the directory when getting the Bundle as a dot separated string, i.e.
    ResourceBundle.getBundle(“etc.i18n.Resource”); would look for the file <working-directory)/etc/i18n/Resource.properties.

    I am also putting some links I came across here : 1, 2, 3

    Book Mark it-> del.icio.us | Reddit | Slashdot | Digg | Facebook | Technorati | Google | StumbleUpon | Window Live | Tailrank | Furl | Netscape | Yahoo | BlinkList

    Popularity: 52% [?]

    Bookmark this on BuzzURLBookmark this on BuzzURL Post to TwitterTweets for this web page Bookmark this on FC2 Bookmark newsing it! Choix it! Add to Google Bookmark Bookmark this on Delicious Digg This

    Exploring Google's Hidden Features

    No comments January 17th, 2007

    Google is a great search engine, but it’s also more than that. Google has tons of hidden features, some of which are quite fun and most of which are extremely useful— if you know about them. These points are excerpted from Mr.Michael Miller’s article published here.

    Google Is a Calculator
    When you can’t be troubled to reach over and pick up the handheld calculator sitting on your desk, you can use Google as a high-tech web-based calculator. All you have to do is enter your equation or formula into the standard Google search box, and then click the Google Search button. The result of the calculation is displayed on the search results page; it’s that simple.

    Google Knows Mathematical Constants In addition to performing calculations, Google also knows a variety of mathematical and scientific constants, such as pi, Avogadro’s Number, and Planck’s Constant. It also knows the radius of the Earth, the mass of the sun, the speed of light, the gravitational constant, and a lot more.

    Google Converts Units of Measure Another surprise is that Google’s calculator also handles conversions. It knows miles and meters, furlongs and light years, seconds and fortnights, and even angstroms and Smoots—and can convert from one unit of measurement to another.

    Google Is a Dictionary Want to look up the definition of a particular word, but don’t want to bother pulling out the old hardcover dictionary? Not sure of a specific spelling? Then use Google as an online dictionary to look up any word you can think of. It’s easy—and there are two ways to do it.

    Google Is a Glossary Even more definitions are available when you use the Google Glossary feature. Google Glossary is what Google calls it, anyway; really, it’s just another advanced search operator that produces some very specific results.

    Google Lists All the Facts When you’re looking for hard facts, Google might be able to help. Yes, Google always returns a list of sites that match your specific query, but if you phrase your query correctly—and are searching for a fact that Google has pre-identified—you can get the precise information you need at the top of the search results page.

    Google Displays Weather Reports Did you know that Google can be used to find and display current weather conditions and forecasts? It’s a pretty easy search; all you have to do is enter the keyword weather, followed by the location. You can enter the location as a city name, city plus state, or Zip code. For example, to view the weather forecast for Minneapolis, enter weather minneapolis.

    Google Knows Current Airport Conditions Weather information is important to travelers, as is information about flight and airport delays. Fortunately, you can use the main Google search page to search for this information, just as you did with weather forecasts.

    Google Tracks Packages Airline flights aren’t the only things you can track with Google. Google also lets you track the status of package deliveries, from the U.S. Postal Service, FedEx, and UPS. All you have to do is enter the package’s tracking number into the Google search box, and Google will display a link to the service’s tracking page for that package.

    Google Is a Giant Phone Directory As part of its massive database of information, Google now includes listings for millions of U.S. households in what it calls the Google PhoneBook. You search the PhoneBook listings from the main Google search box, using specific query parameters.

    Google Knows Area Codes It goes without saying that if Google knows phone numbers, it also knows area codes. If you have an area code and want to know which city it serves, just enter the area code; Google will return the city in which that area code resides.

    Google Has Movie Information Numbers aren’t the only types of information available via a Google lookup. You can also use the standard Google search box to look up movie reviews and showtimes. All you have to do is enter the word movies followed by the name of the movie. For example, to find out when Casino Royale is showing in your neighborhood, enter movies casino royale.

    Google Loves Music Google not only lets you search for movie information, it also is a great search engine for music. Google knows the names of tens of thousands of popular performers; all you have to do is enter the performer’s name in the search box, and Google returns specific information about that performer.

    Google Knows the Answer to the Ultimate Question Let’s return to Google’s calculator for one final hidden feature. As you recall, the Google calculator has been hardwired to include the answers to some fairly complex—and fairly fanciful—calculations. For a bit of fun, try entering the query what is the answer to life the universe and everything. Google’s answer should delight long-time fans of Douglas Adams’ The Hitchhiker’s Guide to the Galaxy. (It’s “42″, in case you were wondering.)

    Technorati tags: Google

    Book Mark it-> del.icio.us | Reddit | Slashdot | Digg | Facebook | Technorati | Google | StumbleUpon | Window Live | Tailrank | Furl | Netscape | Yahoo | BlinkList

    Popularity: 1% [?]

    Bookmark this on BuzzURLBookmark this on BuzzURL Post to TwitterTweets for this web page Bookmark this on FC2 Bookmark newsing it! Choix it! Add to Google Bookmark Bookmark this on Delicious Digg This

    Foxit Reader 2.0

    No comments November 14th, 2006

    icon_getreader.gif

    I happened to know about “Foxit Reader 2.0“; an incredibly small sized PDF reader from Mr.Vadivel’s blog. In his post he had explained about the reason of migration through some of the disadvantages of the commonly used Adobe PDF reader. And I decided just to test this new one. But WOW! For my surprise it took no time for the installation!!! One sec?? Naa.. :)
    Its has some good features too. Lets check some of them taken from their official site.

    • The download size of Foxit Reader is only 1.5 M which is a fraction of Acrobat Reader 20 M size
    • When you run Foxit Reader, it launches instantly without any delay. You are not forced to view an annoying splash window displaying company logo, author names, etc.
    • Have you ever wished to annotate (or comment on) a PDF document when you are reading it? Foxit Reader 2.0 allows you to draw graphics, highlight text, type text and make notes on a PDF document and then print out or save the annotated document.
    • You may convert the whole PDF document into a simple text file.
    • Foxit Reader highly respects the security and privacy of users and will never connect to Internet without users’ permission. While other PDF Reader often silently connects to the Internet in the background. Foxit PDF Reader does not contain any spyware or adware.

    Technorati tags: Foxit Reader, PDF reader

    Book Mark it-> del.icio.us | Reddit | Slashdot | Digg | Facebook | Technorati | Google | StumbleUpon | Window Live | Tailrank | Furl | Netscape | Yahoo | BlinkList

    Popularity: 1% [?]

    Bookmark this on BuzzURLBookmark this on BuzzURL Post to TwitterTweets for this web page Bookmark this on FC2 Bookmark newsing it! Choix it! Add to Google Bookmark Bookmark this on Delicious Digg This