Tuesday February 27, 2007 More Than a Glimpse of the New Book
As Geertjan already announced, the new NetBeans Platform and Plugin Development book is coming soon. You can already get a Rough Cut preview, and read sample chapters and the table of contents. Many of you have been asking for a platform dev book, so what you think about the contents? Does it cover what you expect from such a book? Do you like the style of the sample chapter?
Cool how many books are being written about NetBeans this year. For instance, have a look at ProNetBeans (available in March), it even comes with a discussion forum (fellows, go post a few questions there, it so new and empty). Then there are two Chinese books, but I can't really tell you much more about them other than what I wrote on the books page. But, they sure look good! ;-) If you the Chinese books, why not write a review for your fellow community members. :-)
PS: You can still nominate community members for the netbeans governance board until next week.
Posted by seapegasus ( Feb 27 2007, 05:56:38 PM CET ) Permalink Comments [2]It's Like Selling 3D Games to the Blind
... or isn't it? Who says the blind never play 3D games? Listen to the alien shooter soundbite on Surreal Horizon's homepage to get a feeling for what 3D audio games are like. You really learn something new each day! (For instance, what a theremin is. Or that it's Sun Microsystem's birthday!)
Posted by seapegasus ( Feb 24 2007, 06:33:32 PM CET ) PermalinkOnce a fellow student introduced me to the big secret how sysadmins really work so efficiently: If a user asks you a question, start typing frantically on your linux box. Do a quick telnet bofh.engr.wisc.edu 666, then you go "Aah!" and read out loud what the detected cause of their problem was. (And then you go back to playing CounterStrike.) I got curious and connected to the telnet port, and the BOFH oracle told me:
The cause of the problem is: Electromagnetic disturbances caused by sun spot activity.
We laughed and for a while it was a running gag to reply "Sun spots" to every why-question. ("Dude why d'you frag me??" - "Uuuh. Sun spots?")
But it's a fact. Now that Martin Grebac showed us a real Sun SPOT, I completely understand how activities involving them causes disturbances in your work. :-o
As you all know, Sun SPOTs are black. Also, they are cuboid, and about as big as a computer mouse, but about twice as heavy I'd say. What distinguishes them from sun spots (black, big, round, wavy) is that SPOTs have built-in WIFI, a row of LEDs, and of course sensors. With its sensors a SPOT can detect temperature, light and 3D acceleration (i.e. which way it is moving in 3D space). Throw a couple in your room, and bang, wireless sensor network. More advanced users throw them into a twister and shoot a movie about it.
The interesting thing of course is, that SPOTs are programmable in Java. Instead of TinyOS, SPOTs come with a JVM which runs code written for Java ME CLDC, and you write and deploy your app the same way that you do for a mobile phone (e.g. using NetBeans). You extend the main class from MIDlet and use a board object that has accessors like getTemperature() etc, and setters and getters like getLEDs() and led[1].setRGB(...), to give you an idea.
Marting showed us some examples that will be included in the box when it is available in stores: For instance, when you switch a SPOT on for the first time, there may be a demo program running that lights a light in the row of LEDs depending on which way you shake the SPOT -- a nice effect to demonstrate the 3D accelerometer. :-) If you switch on the second SPOT of a set, it recogizes the first one, and Martin showed how you can sync them so the wandering LED light seems to ping pong from one SPOT over to the other. :-D Hours of fun! Perfect gift for a geek! If only they were already for sale... :-/
Well, gives us more time to refresh our memory on threading and to come up with something wicked to use these cuties for.... Hmmmm-- Huh, what? Why am I plotting plans and not working, you ask? As I said: Sun Spots!
Posted by seapegasus ( Feb 22 2007, 07:02:21 PM CET ) PermalinkJava Thread Dumps and Other MacOS Hacks
Since recently, my copy of NetBeans ponders the developments of world history after each launch, before it deigns to become responsive after 3-4 minutes. So Petr N. suggested to have a look at the Java thread dump. But how?
First I looked in the wrong place: I noticed the IDE was wasting cycles because I saw it in the Activity Monitor utility that I had put into the dock. You can set this utility to show the CPU state (or network load or RAM usage) in the dock's icon. So, first I clicked the Activity Monitor's Analysis button to get a thread dump; but then I noticed this only shows system threads, and not java threads...
So Petr pointed out to me the generating thread dumps section on the NetBeans QA homepage. The tips there do half the trick. It tells you to start the application from the Terminal, and then hit ctrl-\ to generate the thread dump. Usually, it is output to a file.
But how do I start a MacOS .app file in the Terminal? You can't just type in /Applications/NetBeans.app into the Terminal utility and hit return.
open /Applications/NetBeans.app
only works to execute the app in the Finder, but that's not what we want. What we need is the app's package content. Inside the package you will find the UNIX-style executable.
In the Terminal, the right path to NetBeans' package content looks like this:
/Applications/NetBeans.app/Contents/Resources/NetBeans/bin/netbeans
If you get an error message, go to the Finder and right-click onto the NetBeans.app symbol, then select "show package content" to identify the correct path by looking at the directory structure in the Finder. You can drag and drop the last ...bin/netbeans file icon from the Finder into the Terminal window to make sure to get the path right!
Press enter to start the application in the Terminal. To trigger the thread dump of the running application, hold down the controlkey and hit backslash (ctrl-\). On Mac OS, the output goes straight to the Terminal, not into a file. Copy and paste it into a text editor if you want to keep it. Notice that the terminal is irresponsive after you started NetBeans from it that way -- this is normal, the freshly started foreground process blocks further input to the terminal until you switch the process to the background. If you don't need the Terminal anymore, leave it open.
If you need to use the terminal (and don't want to open another window), do the following:
bg into the Terminal to make the last stopped process run in the background. Note how NetBeans becomes responsive again, and the terminal accepts input too.
fg. This would make the last stopped process run in the foreground again -- and like before, it would be blocking the terminal.
The latter option is not very useful for applications like NetBeans, but for Terminal applications that actually run in the Terminal window (such as top). If you want to stop such a process for a second to quickly check another command, go back to the Terminal by pressing ctrl-Z, and resume the process by typing fg.
Watch out, if you close the Terminal now, it will take the child process with it -- and thusly force-quit NetBeans! When you click the close button or quit the Terminal utility, you will get a warning. Note how it says "[...] will quit the processes bash [...] and java" -- the java process is of course NetBeans. But you only need to run the IDE this way to get a thread dump once, you would not do that each day.
I detected some other useful MacOS shortcuts this week (you might know them already, but in case not): Most people know they can switch applications by pressing Apple-tab and Apple-shift-tab. Similarly you can switch windows within one application by pressing Apple-`on a US keyboard or respectively Apple-< on a German one. Part of the reason why I never used some of those was my confusion about the various keyboard layouts. I switch so often between different keyboards (Apple, PC, Sun; laptop and desktop), different languages (German, US, British, Czech), and different operating systems (Mac, Linux, Windows) that my brain gave up keeping track with all the shortcuts. E.g. on a standard Mac or PC desktop keyboard, the ctrl key is in a different place as on a Sun keyboard, and it's different again on a MacBook... Aaaargh... But this window-switcher shortcut is always at the bottom left of the keyboard, so I trust my brain will be able to handle it. ;)
Another useful keyboard shortcut from a similar context is the one that switches keyboard layouts. I need it quit often (reason: see above). It used to be Apple-space, but I think this is Spotlight now. This is why I always go to the System Preferences for Keyboard & Mouse first to fix the keyboard shortcuts: The yellow warning sign next to a shortcut means it's double-booked. In this case double-click the entry to change it by typing in the new shortcut. I chose ctrl-space to switch the keyboard layout because that's similar to Apple-space. Now you can quickly switch between international layouts, which is useful for people who are able to touch-type in another language, e.g. if you quickly need a Czech Haček or a Germän Umlaut.
Have a look at the other shortcuts too, while you are there. Did you know that Apple-Shift-D looks up a word in the dictionary? I couldn't get it working with a German locale to look up English words, but it works well in an anglophone locale. (But don't even think of using it while writing a message in Apple Mail, where this shortcut will send your email half-finished!) And if you don't know the screenshot schortcuts yet, they are worth knowing by heart. Tip: If you press Apple-shift-4 and then immediatly the spacebar, you can select a window to take a screenshot of.
PS: Woah, when I wrote that about the dictionary pop-up, I just recalled a dream I had last night. I don't remember anymore who the dream character was, I only remember that I called Apple-shift-D on him while he was walking around... So the window popped up... and he fell over it... *giggle* Children, don't try that at home!
Posted by seapegasus ( Feb 16 2007, 05:21:50 PM CET ) PermalinkSearch Engineering - the End of N-Grams? (or Not)
My, I completely missed that: Heise now writes My Search Engine understands me (in German), and also A Chance to Rival Google tells you more (in English):
A start-up company called Powerset has set out for the holy grail -- a natural language search engine! One that does not (like the other one that starts with Goo and ends in gle) "simply" strip off stop words from the search string, and then makes parallel searches of lexemes and synonyms in a database of cleverly sorted n-grams?
Powerset say they will use technology from Xerox PARC. Okay, those Xerox guys are good, but having licenced their stuff doesn't solve the task alone. How and what exactly will they do? Dang, the web page doesn't tell... :-[ Hmmm... "Power set"...? Is that a hint of some sort? ;-)
Google is good because it already lets you search for natural input like "Who is that German who believes that 300 years of the history of the early middle ages are made up??" more or less successfully. Just hit "I feel lucky" and find a page where somebody blogged about this original conspiracy theory. But I had to try five times with different sentences to find this perfect hit. -- Well, still better than getting laughed at by your friends for asking them about phantom time, right? In real natural language search you would not have to try paraphrases yourself.
But don't expect Powerset will implement natural language search requests like "How many non-American and non-Russian Astronauts were deployed to the ISS?" that would get you the list of names and a number. This would require that the search engine not only understands the question perfectly, but also a) has access to a list of ISS astronauts, b) has access to a list of their respective nationalities, c) knows that "non" means I want it to filter all persons of American and Russian nationality from the list (and not people whose names happen to look like a nationality), and then d) interprets "how many" as a request to count the remaining entries, and finally prints the answer. That would "merely" require a mapping from each ever-so crazy text-book question type the user comes up with, to a step-by-step search solution, and the tables to look up data from...Then after 12 years of research a user types in "So how many legs do a farmer, a dog and 17 chicken have together?" and your engines gripes "Gimme a break" and dies of karoshi. *Sigh*
Answering math questions is not what Powerset attempts to achieve. (If they do, then they really found the holy grail!) Basically search engines are 'only' a more user-friendly interface for common "a and b and (c or d or e)"-style search requests, they are not supposed to do math homework for you. Unless somebody wrote a web page about the exact same question using similar words, these questions won't work. You will have to search for "list of ISS astronauts and their nationalities" or something and count them yourself -- sorry.
But there is still enough work to be done to make normal fact searching more intuitve, and that is more likely what Powerset are up to. They may try to use implicit context, so you could type in "Kubiak eat now" then the search would fill in your city (i.e. the city via which your provider connects you) as default location and list fast-food chains. Also search results could be clustered and labeled better -- are they news articles (presumably more reliable) or blog entries or reviews (if you are searching for opinions), are they privately hosted or on company domains or on university sites, what media are they, and how old? If the user's browser is set to German but she searches for an English word, would she be interested in German results about the same topic too? Etc. I hope they hired a lot of user interface designers.
Ooh, Powerset even have job openings for computational linguists, man, I haven't seen that for a while. Well, currently I already have a job, thank you, ;-) so I will have to wait until the end of the year to see the first prototype. *Sigh* Come on, Powerset, give us a Beta! Some Google apps have been in beta for how long? Since, like, the last millenium? See!
Uh-oh. Speaking of Google. I feel a disturbance in the force... Google just published their corpus of n-grams? Free. Gzipped. On 6 DVDs. Woah. *Waves at Thorsten Brants from Saarbrücken!*
Of course this does not mean that google is releasing their n-grams in response to Powerset's announcement, because, dunno, Powerset's new method will be the end of n-gram usage now or something. Obviously, Google did not publish the database column that says on which web page this n-gram was found (data which has to be refreshed regularly anyway)... :-P
If you don't know what an n-gram is: It's just sequences of words like they typically appear in text, sorted by frequency. This involves tokenizing loads and loads of text. Amounts of text which can be found for free on the internet.
For instance, a 3-gram (trigram) is a typical sequence of three words torn out of context ("I am a, I am just, I am here, I am the, I am not" etc). So, if you have collected lots and lots of different trigrams ("not completed but, not count on, not belong to", or "to do it, to go away, to continue his" etc), and have sorted them by frequency, then! *drumroll* You can calculate the statistically most probable English sentence! Which would look like (I am making an example up here) "I am not belong to continue his words are the one of the president of stupid like a big piece of all the things are no doubt that he is another step to..." Wahahahaha! :-D ... :-| Okay, maybe applied linguistics jokes are only funny for computational linguists.
Anyway, the real use case is, having alphabetically sorted n-grams annotated with the web page they came from, speeds up the search process significantly for a search engine provider (because jumping to a position in the alphabet can be done faster than doing full-text search over and over again).
Another example of useful things you can do with Google's n-grams even without the page URL they came from, is training speech recognition systems: If the system didn't get whether you said "Oh painter knew him tivo'ed phile ending sword mine amen sedate" or "Open a new empty word file and insert my name and the date", a quick n-gram frequency comparison tells it: The second interpretation is a bit more likely to occur in the English language. Now, aren't you glad n-grams were invented and you can get them for free? :-)
Posted by seapegasus ( Feb 11 2007, 05:04:30 PM CET ) PermalinkSpeaking of "me". Today, after over 20 years of learning English, I learned that "me" is not the same as "I". You know, sentences like "Only me and X are here", or "X and me, we have the same result in the Myers-Biggs test", sentences like that, they are all wrong. It should be "X and myself" etc... Great. Thanks for telling me now. ;o) I'm just glad we don't use the first person in tutorials, that would have been so embarrassing.
Well, less embarrassing than, say, accidentally saying pršim ("I am raining") in Czech conversation class. Or saying "vypalit nekomu prehradu" instead of "rybnik": You don't expect us stupid foreigners to know that it's "to steal somebody's show" and not "to steal somebody's whole theatre", do you? In the interest of international relationships it is also not recommened to mix "vychodni Nemecko" and "zapadni Nemecko" (East and West Germany) to say "zachodni Nemecko"... ... I swear, one day we'll be the death of our Czech teacher. I think Joe and me -- and I? Joe and I myself have a new goal: To make the teacher desperately call out "Jezis...!" at least once per lesson. That's our new goal. It comes right after learning numerals.
Did I tell you the story about the Czech numerals? No?
So that means.... "with 273 (dve ste sedmdesat tri) Czech (cesky) beers (pivo)" = "s dvema sty sedmdesati tremi ceskymi pivy" or what?? What if the last digit happens to be 3, is it treated like a one-digit 3, or as a number bigger as 5? Oh boy. Of course each student of Czech comes up with the standard workaround sooner or later. Me: "I'd like to order some beers!" -- Them: "Well how many?" -- Me: (Holds up 273 fingers)!
Even if it may appear otherwise, you get pretty far with Czech after a year, especially in (vocabulary-wise) closed domains like restaurants. For example, have you ever been to a Chinese restaurant and thought, what am I supposed to do to communicate anything that is more sophisticated than ordering something from the menu? Speak Chinese? No! Speak Czech!
For instance today: I suddenly was missing a mitten. So I retraced my steps and also went into our Chinese lunch restaurant. It was evening. What is this lunch-customer doing here? The Chinese stare at me. I point at my hand and babble something about cervena rukavice? -- The Chinese girl suddenly smiles, nods, disappears through a side door and returns with my mitten. :-) See? Learning Czinese, uh, Czech rules!
This means I still keep my record: I don't recall having lost anything during the last 10 years! (Note my choice of words. The emphasis is on "recall".)
Well, except for the Babylon 5 CDs.
Oh and the Sparks CDs.
And where is this green shawl with the pattern? :(
Posted by seapegasus ( Feb 09 2007, 01:22:48 AM CET ) Permalink Comments [1]What if my Only Cam is Inside my Mobile?
How can you shoot a movie of your mobile with your mobile? Mirrors? And then win whatever it is they are giving away in this contest. Ah. PlayStation. Hmmm. Any good playstation games out there that are worth resuming my half finished mobile game and shooting a movie of it? Splinter Cell sounds good. (BTW does anybody have a copy of thief the dark project he want to sell for a buck? Write me. I need it for... research purposes.) But probably you can only win prizes for video taping something useful anyway. Bah. Useful applications are way overrated.
In the good old days, at the MacHack (oh sorry, I mean "ADHOC"), I remember, useful was the worst rating you could get at the contest. People submitted entries to the hack contest such as a plugin that uses the web cam to look at colored plates you hold up, and if the plate's green, it scrolls your text editor page up, and if the plate is red, it scrolls down or so. My favorite hack was this JPG network sniffer game (I forgot the name), did I mention it before? It goes like that: A group of persons hangs out in the same LAN in talking distance. Then the one whose turn it is googles for a search term in the image search. While his machine is downloading the images, the other participants use the tool to scan the network traffic for images and look at them: They get a more or less random assortment of image search results (possibly from other LAN users too) -- and to win they must guess what the search term was, based on what they see! Hilarious. :)
OK, that exactly is probably not a suitable game for the contest, I'm just saying, if it's fun for the users, do it, even if it's objectively useless. (I'm an employee and not allowed to take part. Bah.) :-(
Posted by seapegasus ( Feb 08 2007, 06:30:10 PM CET ) Permalink Comments [1]Do You Want Fries With Your IDE?
Have you seen the NBI project, also known as the NetBeans Installer?
Here is an example how NetBeans Installer will look. What do you see? Because it's platform dependent what you see: It detected my MacOS and preselected the OS, and offers me NetBeans IDE 6.0 M6, + GlassFish, + Tomcat. The list of components however also mentions mobility pack, which I don't see -- I assume because mobile companies still don't provide emulators for MacOS. *pout*
So it's correct that the Mobility pack is not listed, but what do you think? I would have prefered to show me a line that says "Mobility pack (not available for MacOS)" or something, so I know I am in the right spot and don't have to look any further. Just something that confirms, "Yup pal, this would have been the right place to download it, and, no pal, it doesn't exist".
But you know what's cool? I though, hah, if I secretly select Windows now, it will still be missing Mobility pack and that would so be a bug! So I select Windows and what happens? The Mobility Pack line appears and whistles innocently as f it was never gone! Which devilish powers have--!! Oh wait never mind, it's just JavaScript.
Posted by seapegasus ( Feb 06 2007, 10:51:00 AM CET ) Permalink Comments [1]Getting Started with Java 3D Games
As I already mentioned last week, my current weekend project involves Java 3D and the jMonkey 3D engine. Since 3D engines are not trivial, a frequently asked question would probably be "How do I get started at all?" I added an FAQ to their wiki and also supplied an answer that worked for me.
jmephysics/tutorial/ of your installation to be introduced to the basics.
jme/src/jmetest/ directory and have a look at the source code to learn how it's done.

This is the current state, after I added physics (collision detection and gravity), keyboard and mouse input handlers, a terrain with hight-sensitive textures, a walking box, and fog (the background can be either fog, or a static skybox with a picture of the horizon).
Next steps? First I'll improve the third-person camera so it follows the player around. Then there is this nice idea how to create a continuous world: You put 9 terrains in a 3x3 grid, and every time the player leaves the middle tile, you move three tiles from behind him in front of him; of course the terrains' borders gotta match for that. Next I need initializer methods that use those features to load game levels with parameters I define, such as day/night or hilly/even or what textures to use for the level (ocean, rock, grass, snow, desert, ...). And yes at some point I will need to add player and non-player characters, buildings and trees. :)
PS: If that is too much computer game for you and you long for a good old real table-top RPG -- then don't click this link!
Posted by seapegasus ( Feb 03 2007, 03:39:57 PM CET ) Permalink