Thursday, July 28, 2016

Augmented reality silly gaming

Yes, you have all heard of Pokemon Go... that take the world by STORM. So many people have downloaded and played this game (I haven't). Ooh it makes use of map and give you little monster to catch as in "Gotta Catch 'Em All"? Great fresh idea.

Of course you won't see me play this 'cause its very idea is stupid to me.

Now you see people in virtual reality helmet/goggles as they play with virtual or augmented world... Covering your own world and present another world right in front of your eyes is denying reality... I won't go that far in gaming.

But if this is taken the world by storm... it is something worth thinking about. Can I make something that take the world by storm?

And people (especially kids) go crazy with their world of whatever-craft... constantly building things... for what purpose? Too many kids are too much into these things.

And while peaking at some kid's phone. Saw some Batman themed fighting game that is more elaborate than the latest Street Fighter. So graphically intense... and without a joystick/joypad... I don't think I can even control those things.

Yes, small amount of gaming is good. It help you relax and sharpen your eye-hand-coordination and even a great social tool to play with your friends. But too much of it is insane.

Such games nowadays are such triumph of programming ability. Your highest paid friend with software-director-awesome-title probably cannot even make a space invader game.

Thursday, July 21, 2016

Java convert time zones

Yes, Java time (before Java 8) is a pain. Java 8 totally redo this but I am still at Java 7... and of course no time to learn it. People have been struggling for years for its foolishness with the Calendar object and stuff.

And if you deal with international things... timezone difference is going to be a headache. The world does not do day light savings time on the same day also.

Here is a great little util to convert between time zones... from String to String.


import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

public class Testing {
    private static String convertTimeZone(String datetime, String fmt, 
String timeZoneFrom, String timezoneTo) throws Exception {
     TimeZone defaultTimeZone = TimeZone.getDefault(); // save your default time zone
     TimeZone.setDefault(TimeZone.getTimeZone(timeZoneFrom));
                   
        SimpleDateFormat sdf = new SimpleDateFormat(fmt);
        Date d = sdf.parse(datetime);

        sdf.setTimeZone(TimeZone.getTimeZone(timezoneTo));

        String result= sdf.format(d);
     TimeZone.setDefault(defaultTimeZone); // reset default time zone back
        return result;
       
    }

   public static void main(String arg[]) {
     try {
      System.out.println(convertTimeZone("2016-08-21 18:50:00",
"yyyy-MM-dd HH:mm:ss","UTC","Asia/Hong_Kong"));
      System.out.println(convertTimeZone("2016-08-21 06:50:00",
"yyyy-MM-dd HH:mm:ss","Europe/London","UTC"));
     } catch (Exception e) {
      e.printStackTrace();
     }
    }
Check out time zone strings around the world. https://www.mkyong.com/java/java-display-list-of-timezone-with-gmt/.

Tuesday, July 5, 2016

Happy Independence Day

Such excellent stuff. https://mathwithbaddrawings.com/2016/07/04/we-hold-these-mathematical-truths-to-be-self-evident/#more-4802 I especially like:


Seen that in probability... That means A and B are independent events.
I am glad this year no one blow their arms off. But I think fireworks should be banned. Go watch professionals handle it in Navy Pier, ok? Do not need to risk blow yourself up.