Feeds:
Posts
Comments

Archive for the ‘Java’ Category

Its a common knowledge that Thinkpads have HDAPS feature (IBM Active Protection System). Its primary purpose, in Windows at least, is to detect falling motion (laptop about to crash into the ground) so that it can immediately park the hard disk heads to prevent data loss. How cool is that?
In Linux, are are available drivers that you can install in order for you to make use or access the built-in accelerometer. Users on YouTube have already posted demos of fun things you can do with it, from useful features such as tapping your laptop to switch workspaces, or changing the display orientation to silly ones like playing games by tilting the laptop itself and making it hum like Jedi swords. So what do you need to get started hacking? First, you’ll need the TP_SMAPI. Second? Imagination. Here’s a java port to get you started:

int threshold = 2;
long numMillisecondsToSleep = 1000; // 1 second
int oldx=0, oldy=0, x, y;
boolean doupdate;

try {
    do {
        FileReader fr = new FileReader("/sys/devices/platform/hdaps/position");
        BufferedReader br = new BufferedReader(fr);
        String s = br.readLine();

        StringTokenizer st = new StringTokenizer(s, "(,)");
        x = Integer.parseInt(st.nextToken());
        y = Integer.parseInt(st.nextToken());

        doupdate = false;

        if ((oldx != x) || (oldy != y)) {

            if (Math.abs(oldx - x) > threshold) {
                oldx = (oldx != x) ? x : oldx;
                doupdate = true;
            }

            if (Math.abs(oldy - y) > threshold) {
                oldy = (oldy != y) ? y : oldy;
                doupdate = true;
            }

            if (doupdate) {
                System.out.println("x = " + oldx + " | " + "y = " + oldy);
            }

        }

        try {
            Thread.sleep(numMillisecondsToSleep);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    } while(true);

} catch (IOException e) {
    e.printStackTrace();
}

Ported from the original C code written by Jeff Molofee.

Advertisements

Read Full Post »

Flex 2 Books

Very Exciting weekend :). Why? its because the Flex 2 books and Training Videos I ordered last week just arrived yesterday!. I wont be mentioning all the titles yet but so far from what I’ve seen and read, the Lynda.com : Flex 2 Advanced: Using Data Services Training Video is excellent stuff! I went thru chapter 3 to 9 (Im semi-advanced student ;P) and all I can say is, the money spent was all worth it. I’m now consuming the Adobe Flex & Java book from the guys at Farata Systems. Im deep-diving on the data-integration stuff since its going to be the most crucial part of our enterprise application development. Will update on the book reviews as soon as I’ve covered some chapters. Right now I’m looking at how to replace or redesign our existing ACEGI-based security module.

Update: June 28, 2007

Disclaimer: I haven’t read the whole book yet but here’s my first impressions from the few chapters Ive read and jumping from one chapter to another. The Adobe Flex & Java book: RIA Book was good but was kinda outdated. It featured a lot of working real-world examples which is good stuff. The books weren’t cheap so I was a little disappointed because I was expecting more of advanced Flex-Java stuff that takes on advanced custom component tricks/hacks, a bit of Cairngorm or other MVC frameworks, Modules, Security / ACLs, Migrating from web frameworks to pure Flex front-end. I was also looking for a bit about Spring integration or anything about a guide for former AJAX developers (for some who have been doing web apps all their lives, switching to event-based app is a paradigm shift). The ebook that came with the book is useless. Table of contents is unclickable and unsearchable. I am yet to check out the bundled Training Video.

I also have the Actionscript 3 Cookboook from Oreilly. This book is excellent! I’ve read 3 whole chapters so far: XML, Arrays and Menus and I’m already smiling from ear to ear from what I’ve absorbed so quickly. I just realized how powerful E4X support is!!! and how AS3 easily handles XML data like a fish to a water. Highly recommended even for someone like me who never programmed in Actionscript before.

I also have Adobe Flex: Straight from the source and Oreilly Flex 2 Programming. Just browsed thru the pages and jumping from diff chapters . They are almost the same. Just a little better than the official Flex2 documentation which is available for free in PDF form. In fairness, the two books covered more examples than the official doc.

I also have Flex 2 Total Training training video. It covers how to use Flex builder and working with Flex 2 UI components. No advanced stuff. haven’t watched them all yet so I cant comment much.

Too much many books, too little time.

Read Full Post »

Just finished cleaning up some slides I used for my Team’s training. Here it is:

Quick guide on Integrating Flex 2, LiveCycle Data Services and Spring – For Java developers who wants to integrate Flex with new or existing J2EE applications.
Cairngorm Microarchitecture
– Advanced topic not meant for Flex/Actionscript beginners. Read this before taking on Cairngorm.
Flex Modules – Created by Alex Harui. Very useful for building big Flex 2 apps. Modules are used to break applications up into smaller pieces.

Read Full Post »