Welcome to Gary Han's den on the web.
This portal records Gary's everyday thoughts and notes on programming and life.
Please enjoy...

Tuesday, April 23, 2013 - 11:21am

  • Tuesday, April 23, 2013 - 11:21am

    When working with special characters we sometimes run into the issue where the string is not recognizing these characters.
    Especially when trying to parse files from one platform from another.

    I had the following line in a txt file on windows: (saved as ANSI)

    éèêë

    I had the following code that parses and replaces these characters:
    (Java file is saved as UTF-8)
    -------------------
    File file = new File("/windowsPathMappedOnLinux");
    FileInputStream fis = null;
    BufferedInputStream bis = null;
    DataInputStream dis = null;
    String fileContent = "";

    0 comments

Tuesday, August 9, 2011 - 5:56pm

  • Tuesday, August 9, 2011 - 5:56pm

    When you get a database dump from a server and try to import it to one another, often u will face errors like:

     DEFAULT '1753-01-01 00:00:00', "end_date" DATE DEFAULT '1753-01-01
    ORA-39083: Object type TABLE failed to create with error:
    ORA-01861: literal does not match format string

     

    This indicates that the database dump might be using a string format which is different from your server.

    To prove this, login to sqlplus, and do:

    select sysdate from dual;

    if the result is not of:

    0 comments

Thursday, March 3, 2011 - 11:00am

  • Thursday, March 3, 2011 - 11:00am

    Many of us might have came to the probelm where in IE or Chrome, when visiting the secure pages an alert message pops up saying that some of the content of the page is not encrypted.
    This is usually due to non-relative links on our page.
     
    i.e.:
    in: https://www.garyhan.com/secure but some how all your images and css are showing up as http.
    This is because usually when setting up a load balancer, the encryption is handled on the balancer(LB) level, then the LB transfers requests to each of your servers on http port.

    0 comments

Wednesday, November 3, 2010 - 4:49pm

  • Wednesday, November 3, 2010 - 4:49pm

    Just a reminder,
     
    when you have connection failures trying to connect to localhost, while everything else seems fine.
     
    First thing is try 127.0.0.1
    because sometimes the application does not know how to resolve localhost.
     
     

    0 comments

Thursday, October 28, 2010 - 12:41pm

  • Thursday, October 28, 2010 - 12:41pm

    This is just a reminder that when you go to a Oracle database and when u do:
    select * from table_name;
    it returns view or table not exist
     
    yet the table does exist.
     
    Please try:
     
    select * from "table_name";
     
    In Oracle, if you create a table with case sensitive (the " " around your table name) you must also reference it by " " when u run queries.
     
    if you create table table_name (without the " ")
    then you may do:

    0 comments

Tuesday, August 31, 2010 - 9:01pm

  • Tuesday, August 31, 2010 - 9:01pm

        Being a working zombie for a few weeks, I decided to read all my old posts on garyhan.com.
        I can't believe some of these stuff are from so long ago... The posted date are the dates I got hold of this domain, but many of the posts were written years back...

    0 comments

Sunday, August 15, 2010 - 10:20pm

  • Sunday, August 15, 2010 - 10:20pm

        After many months of working on multiple projects, I really need some times off.
        But just as I was going to take a few weeks off, my grand-mother died...
        So I had to rush to China to give her a last farewell.
        No...I was not able to see her before her last breath... She passed away 10 hours before my flight...
     

    1 comments

Tuesday, July 20, 2010 - 10:12pm

  • Tuesday, July 20, 2010 - 10:12pm

    Just a simple note about bugs caused by null pointer exceptions when evaluating 2 values.
    lets look at the following:
     
    if (car.equals("Ford")) {
         return true;
    }
     
    if car is null, we will have a null pointer exception right here...
    so if we do:
    if ("Ford".equals(car)){
         return true;
    }
     
    then we wont have to check if car is null before comparing.
     

    0 comments

Saturday, July 10, 2010 - 12:56am

Wednesday, April 14, 2010 - 11:05pm

  • Wednesday, April 14, 2010 - 11:05pm

        Recently, I started taking on multiple projects, both from management perspective and programming perspective.

        First time ever, I felt overwhelmed with all the work and actually want to jump on my bed and sleep. (Especially on a Friday night, I can sleep for over 16 hours)

        I am here to state what I learned for the last couple months from all this work and perhaps help myself or fellow programmers out there who takes on multiple projects at the same time.

    0 comments