So it starts my month of travel. I'm sitting at the Budapest Airport as I write this (kudos to Pannon for providing free wireless in the airport), passing time until boarding for the London flight. Then flying back home on friday, then a vacation with family from wednesday to sunday next week - lots of driving in Slovenia, but should really be fun. Then flying to Vegas the tuesday after that, then over to New York on saturday when Vegas is over, and finally coming home and putting the suitcase away for hopefully few months on friday, March 29.
They're calling for boarding.
Monday, March 05, 2007
Month of travel
Wednesday, February 28, 2007
New Horizons probe Jupiter flyby
The NASA's New Horizons's probe made its closest approach to Jupiter today morning (well, morning in my time zone, that is) on its way to its ultimate destination (Pluto, to be reached in 2015). It sent back some of the best to-date pictures of Jupiter and some of its moons.
The probe also carries a compact disc that stores a file listing the names of some 430000 people who chose to send their name in the space. Were you nerd enough to sign up? Or even to sign up your kids? (By the time the news of probe reaching Pluto hits the media in 2015, my kids will be 16 and 14 years old respectively, and I hope they'll grow to be geeks as their dad is, thus appreciate this).
Snowflake magnified 36000 times
Yes, I'm sort-of obsessed with snowflakes - this is not the first time I blogged about them. Here's a fascinating series of images of a single snowflake, imaged with an electron microscope, ranging in magnification factors from 93x to 36000x.
I often try to explain to my son just how small scale is the molecular structure of the material world that surrounds us, but it's hard to word it so that a 8-year old understands it. As they say, a picture is worth a thousand words, and these breathtaking pictures certainly prove the point.
Friday, February 23, 2007
You still can't write a good novel
My brother-in-law was given the task of writing some integrated-circuitry emulator in C# on his internship job. He's a soon-to-graduate electrical engineer and rather an alien to software development. He was given a book, "Visual C# Step by Step" to supposedly help him along and complained to me how it doesn't really help him in figuring out how to actually write a good program, it just teaches him a programming language.
I told him that if he attended a course in French language, he still wouldn't learn how to write a good novel in French.
He understood the analogy. The problem is - at least if I remember my university years - an awful lot of educators around here don't get it.
Speaking in Vegas
I'll be attending the TheServerSide Java Symposium (TSSJS) in Las Vegas between March 21 and 23. On friday, I'll be speaking about the Java 6 Scripting API. I'll be delivering the same talk on the European TSSJS event organized at the end of the June in Barcelona as well.
Monday, February 05, 2007
"Iterators are not intended to be serializable." Huh?
In a recent attempt to reduce my "Unread" mailbox, I went back in it marking as "Read" everything that has been, well, read. So it happened that I stumbled across a bug report I filed with Sun around 7 months ago (yes, that mailbox was deep), and went to see what became of it. You can see it here.
The problem I reported is that various iterator objects shipped with Sun's JRE aren't serializable. Looking at the bug's page, I noticed that the "Evaluation" field has been filled out with:
Iterators are not intended to be serializable. Probably.... Not a Defect.Wow. Whoever evaluated this wasn't particularly, to put it mildly, in short supply of short-sightedness. In accordance to this, the bug was marked as "Request for Enhancement".
Now please tell me if I see it wrong, and if there never-ever can arise a valid class design where a stateful object maintains certain aspect of its state by keeping an iterator into a collection, and said object should be serializable. At least for lists, the concept can even be emulated by holding a reference to the list object and an index variable, so it definitely doesn't sound like a very unsane idea.
I will admit though that I didn't come across an explicit case of it myself. How did I stumble upon this bug then? Continuations. I had a JavaScript program that had a loop going through a collection with an iterator, and captured a continuation within the loop and subsequently attempted to serialize the continuation. Naturally, the continuation being within a loop, the serialization graph of objects reachable through it contained the iterator. Blam.
Now, this admittedly might sound as a more esoteric case of serializing state that contains an iterator, but really, were I to use a "for" loop with explicit indexing instead of an iterator, it wouldn't have been a problem. Therefore, I can't see serializing an iterator to be such an off-the-wall idea to justify the anonymous Sun mouthpiece saying "Iterators are not intended to be serializable"?
Tuesday, January 30, 2007
Jobs: "Nobody uses Java anymore"
I've been going through few weeks worth of the Apple's java-dev mailing list posts, and noticed one that referenced a David Pogue column in NYT from two and a half weeks ago that itself quotes an interview with Steve Jobs centered on iPhone. When Jobs is asked about Java support on iPhone, he says:
"Java’s not worth building in. Nobody uses Java anymore. It’s this big heavyweight ball and chain."This is worrisome. Jobs didn't explicitly reduce the scope of his statement to iPhone and/or mobile phones in general, although since the interview itself was about iPhone, one can give him the benefit of the doubt and assume the "Nobody uses Java anymore" doesn't apply to the computing world outside the mobile devices and won't affect availability of JDK on Mac OS X in the future. (Which, by the way I do find a bit lacking - JDK/JRE on Mac OS X is still stuck at 1.4.2_09 and 1.5.0_06, while the Linux/Solaris/Windows crowd has long since moved on to much higher service releases.)
Actually, as far as mobile devices are considered, I can agree with Jobs that on them Java is indeed "heavyweight ball and chain". John Carmack writes on his blog about difficulties writing DoomRPG and Orcs&Elves for mobile devices using Java here and here, preferring to use BREW as its alternate development platform, with most memorable sentence being:
... it isn't that BREW is inherently brilliant, it just avoids the deep sucking nature of java for resource constrained platforms...and:
The biggest problem is that Java is really slow. On a pure cpu / memory / display / communications level, most modern cell phones should be considerably better gaming platforms than a Game Boy Advanced. With Java, on most phones you are left with about the CPU power of an original 4.77 mhz IBM PC, and lousy control over everything.
So yes, Java on mobile devices is a frustration. I still wished Jobs didn't make an overly generic statement...
Saturday, January 27, 2007
Intel announces 45nm transistor technology
The New York Times reports that Intel has announced new technology for building microprocessors that replaces the "silicon gate electrode on a silicon dioxide insulator" design. The new technology uses a metal gate electrode on a hafnium insulator, eliminating much of the current leak that was the major obstacle in going below the 65nm technology. The new technology promises faster, more energy efficient processors, keeping up the Moore's Law. Intel plans to begin making microprocessors with the new technology as soon as the second half of this year.
To quote the NYT article:
Company researchers said the advance represented the most significant change in the materials used to manufacture silicon chips since Intel pioneered the modern integrated-circuit transistor more than four decades ago.Also:
“This is evolutionary as opposed to revolutionary, but it will generate a big sigh of relief,” said Vivek Subramanian, associate professor of electrical engineering and computer sciences at the University of California, Berkeley.
I wonder whether this'll break the industrial trend of introducing ever more cores in a single CPU chip. My bet is that it won't, but it might allow software developers to get away with writing concurrency-unaware applications for a bit longer (not that I welcome that) if Intel can now indeed again make advances in CPU speeds.
Friday, January 26, 2007
"Clean coal" technologies being researched, says EU Energy Commisioner
Andris Piebalgs, EU's Energy Commisioner said in a speech at the eBio General Assembly yesterday:
From the point of view of security of supply, coal is a wonderful source of energy. Europe has plenty of coal; outside Europe, reserves are spread widely. But the greenhouse gas performance of coal is worse than that of any other fuel.
"Clean coal" technologies are being developed to solve this problem. We will accelerate research into these technologies, and take other steps to create a market for them. But there is no chance of their making a significant contribution by 2020.
That's interesting. EU is under a rather heavy pressure to lessen its energy dependency on oil and gas from Russia, and living in a country that got some collateral damage from the last muscle flexing of russian energy monopoly I can completely understand that. But going back to coal burning, hoping that its ecologically disastrous side effects can be eliminated by some not-yet-existing, but presumably researched "clean coal" technologies is a bit worrisome. I mean, as far as I know, you just can't burn coil without getting CO2, since "burning" by definition is "oxydating". At best, those "clean coal" technologies might try to somehow further process that CO2, instead of emitting it into the environment. I'm admittedly a bit skeptical about it, but I definitely welcome any sufficiently rigorous scientific research into the issue.
Java puzzler: field hide-and-seek
Someone recently asked me to explain the rules for field access in Java, and it sparked the little test program you see below. Can you guess the number sequence it prints?
class Class1 {
String data;
Class1(String data) {
this.data = data;
}
String getData() {
return this.data;
}
}
class Class2 extends Class1 {
String data;
Class2(String data, String superData) {
super(superData);
this.data = data;
}
}
public class Test {
public static void main(String[] args) {
Class1 obj1 = new Class1("1");
Class2 obj2 = new Class2("2", "3");
System.out.println(obj1.data);
System.out.println(obj2.data);
System.out.println((false ? obj1 : obj2).data);
System.out.println(obj1.getData());
System.out.println(obj2.getData());
System.out.println((false ? obj1 : obj2).getData());
}
}It goes to show three interesting things (which are perfectly logical, we just don't think about them often):
- compile-time type of the ?: expression is the most specific common supertype of the compile-time types of its two target subexpressions,
- selection of target type for field access happens at compile time (no "virtual fields" in Java),
- compile-time type of "this" expression is the class that declares the method,
Remember folks, avoid both field hiding and direct access to fields in the first place, so your code doesn't become a puzzler :-)
What did D'Anna see?
(Listening to the BSG Season 2 soundtrack CD as I write this, of course. Package from Amazon arrived yesterday, woot).
Might as well dedicate another post to BSG... I'll admit it feels a bit strange to discuss a plot of a television series here (actually, it feels strange for me to be this enthusiastic about any TV show) but the thing is that this particular damn show actually provokes thoughts, touching with very good sense upon questions ranging from politics to religion to ability of nonhuman beings (I'm avoiding the term "artificial intelligence") to have what unsettingly resembles human minds - sentient, free willed, emotional, even religious.
Anyway, if you didn't see the last BSG episode, "Rapture", you might as well stop reading now, because it won't make any sense to you then.
In the last episode, D'Anna supposedly saw the faces of the last five cylon models in the temple of the Jupiter during the supernova breakout before she died her current body terminally malfunctioned. But did she really see them?
I have a suspicion that as much as it seems so on the surface of it, she actually didn't. If you remember, the Leoben instance that Adama encountered at the weapon storage station in the series pilot mentioned that his nervous system is negatively affected by the electromagnetic activity in the cloud that surrounds the station. I can only imagine how can an ongoing supernova breakout affect the nervous system of a humanoid cylon exposed to it standing on the surface of a nearby planet. So, yes, it might as well be that D'Anna hallucinated as a mental malfunction (and later physical too) caused by the supernova burst and just saw what her subconscious (assuming they have an analogous layer in their psyche) wanted her to see.
Further supporting this claim is that the other cylons don't think much about D'Anna's messiastic fixation and pragmatically only see it as a danger to their common goals. Also, thinking outside of the story, I see that the series writers don't stack unsolved mystery upon unsolved mystery as a means of driving the plot forward (fortunately, unlike Lost's writers, who pretty much seem to be lost in the plot, and definitely lost me as a viewer - pun fully intended), and in accordance to this, nothing else even hints that her mystical beliefs could be true. Well, except that the location where she saw the last five in her vision was the same location Baltar saw in his vision on Kobol at the end of season one. This could be explained if the location is something buried in minds of all cylons, and either Baltar is a cylon himself or the Six in his head is more than just a hallucination that suppresses his sense of guilt. Neither of these assumptions are provable based on currently available information though, but I believe latter is vastly much more probable than the former.
Oh, and there's some wonderful yin-yang contrast in how it's Cavil, the only atheist model among cylons who informs the religious, messisatically predisposed D'Anna that the rest of the community has sentenced her to being boxed in cold storage. I also don't have a moment's doubt that in the future of the series, Baltar will somehow get in a situation where he can restore her from cold storage into a body, and won't hesitate for a moment, as he believes she has the answer to his burning identity-crisis question.
Tuesday, January 23, 2007
Microsoft to the rescue of the mankind
(click on the link to see the original flash animated ad). It's not a fake - this ad was indeed published by Microsoft and for a while appeared on Battlestar Galactica's official homepage on Sci-Fi channel.
Related fun fact: Did you know no TV channel carries Battlestar Galactica in Hungary? One of the commercial chanells bought the rights for the first season few years ago, but they stopped broadcasting it after only (I think) six episodes, citing poor viewer ratings. Morons. (Someone was a moron. Either the TV channel producers, or the company measuring the viewership ratings, or, err..., the local TV audience.) If it weren't for BitTorrent, I wouldn't be able to watch it at all. (And I also wouldn't have any motivation to buy the mini series + the first two seasons on DVD + all the soundtrack CDs from Amazon either, which I did recently. So much for studios' fairytale of "lost revenue due to copyright infringement by file-sharing".)
Saturday, January 06, 2007
Graz for geeks
Wife and me spent the few days around New Year in Graz, Austria. I've taken 245 pictures in total, and now published 13 of them on my Flickr page. I published only those though that have some geek appeal. Among the stuff is Graz's new palace of arts, a building resembling an alien spaceship complete with a "Resistance is futile" neon sign and pulsating lights, a snowman sculpture similar to Calvin's snowman art, half a millenium old clockwork, sculpture carrying the first Austrian cosmonaut's message encoded in waltz steps (no kidding) and more.
Java garbage collection analyzer
IBM Pattern Modeling and Analysis Tool for Java Garbage Collector is "a tool that parses verbose GC trace, analyzes Java heap usage, and recommends key configurations based on pattern modeling of Java heap usage".
I remember I heard about a similar tool for HP JVM on HP-UX (I think Kirk Pepperdine told me about it on the train from Aarhus to Copenhagen this October when we were travelling home from JAOO) - it'd collect GC statistics and then provide you with a GUI where you could play with sliders for various memory settings, and it'd calculate how would have the GC behaved if the program was run with those settings.
On a somewhat related note, as someone who had to do some ammount of GC tuning in the past, I'll be curious about experiences people have with Java 6's GC that is said to behave optimally in most situations without any manual tuning... It sounds enthusiastic, but I'm too often reminded that in reality there is no silver bullet in automatic memory management.
Thursday, December 28, 2006
No H.264 playback on Sony Ericsson W850?
My new gadget, the Sony Ericsson W850, is able to play back video (in addition to being able to record video, take photos, play music, and only incidentally, to make phone calls). It has a 320x240 screen (same as gen-5 iPod), and according to its freely available tech specs, supports "MPEG-4 Simple Visual Profile Level 0, H.263, H.264 Baseline Profile Level 1". My experience though is that it can't play back H.264, at least it didn't play back anything I could produce. I tried both encoding a few minutes clip from a DVD using Handbrake, as well as converting another few minutes DivX clip using iSquint, and the results are the same with both: I tried every combination of settings in both programs, and the combinations where vanilla MPEG-4 is used result in a video file that plays okay on the phone, and the combinations where H.264 is used result in a video file that results in a black screen on the phone (although the audio plays okay).
I have to stress that I'm not saying the device doesn't play H.264. I'm just saying that several video files converted by the above two programs with H.264 option selected didn't play. I could've run into some profile capability violation or something similar - I'm not that much knowledgeable in video encoding. Some people say I should try experimenting with command line ffmpeg. Honestly, I won't. It's not that important, really. While I can find time to listen to music on the go, I really can't imagine I'll want to watch any video content squinting at the 2" screen. The ammount of time I decided to invest in this went only so far as to try comfortable GUI options, with motivation being "because it was there." If anyone has more success than me though, please let me know.
Wednesday, December 27, 2006
Another kludge in Java - varargs
Varargs in Java. Seriously, who needed this?
You're probably aware of my position on Java Generics, how I view their implementation to be a horrific kludge, a compromise made in name of backward compatibility where the backward compatibility issues are in fact nonexistent.
Now, here's a new discovery - vararg methods. Someone asked on the Rhino list whether we can support them, and I answered that as long as he passes the vararg argument explicitly as an array, then yes. I decided to investigate the problem further within a codebase I'm truly familiar with - FreeMarker's BeansWrapper. I quite quickly came up with a scheme for supporting non-overloaded vararg methods. However, for overloaded ones, the exercise becomes, shall we say, a bit more involved. As I had to discover, the overloaded method resolution algorithm from Java Language Specification (JLS) 2nd edition was seriously overwritten into a three-stage algorithm in JLS 3rd edition, of which the "old" (mathematically quite elegant) algorithm from JLS 2 became the second stage. I probably need some additional time to grasp it, but it looks quite horrible now. If you wish, compare:
"Method Invocation Expressions" section in JLS 2
with
"Method Invocation Expressions" section in JLS 3.
Of course, the chapters regarding type conversions (required, as overloaded method resolution relies on the definition of "method invocation conversions", a subset of conversions that is allowed between actual and declared parameter types when invoking a method) are also substantially rewritten to cope with boxing, unboxing, and generic types.
And the worst part? Varargs are yet another Java the Language feature implemented without a Java the Virtual Machine support. They're purely syntactic sugar, with vararg argument being an array on bytecode level. Several annoying things:
- reflection is unaware of it. You can't just pass more arguments to the method, you have to pass the vararags arguments in an explicitly allocated array.
- No automatic object-to-primitive conversion when using reflection. If the vararg method's type is "int...", you must pass int[], not an Integer[]. Compare this with automatic
conversion for regular argument types. - Unintuitive behaviour. Quick, should the following example print 1 or 0:
static void x(Object... i) {
System.out.println(i.length);
}
public static void main(String[] args) {
x(new Object[0]);
}
}
Transparent Desktop Trick
Take a photo of what's behind your computer screen, and set it as your desktop wallpaper. With little care, the results are amazing. See it here.
Labels
So, Blogger got out of beta, and finally it added a labelling feature, which is something I wished for for quite a long time. I decided to label my post to sort them into categories. The categories are (in decreasing order of number of posts at the moment):
software for anything related to software development in general. Java, Open Source, concurrency, programming languages theory. Stuff you'd want to read if you're a fellow software developer.
side interests for serious stuff that I'm interested in as an amateur. Quantum mechanics, astronomy, math, society, politics etc.
mac is for stuff you don't care to read if you aren't interested in Apple computers.
personal is for writings of personal nature.
fun is for art/entertainment/humour things I came across and want to share them with you.
blog a very low volume, blog-related announcements (like this post).
I tried to keep the number of categories to a reasonable minimum, trying to partition the content into as few of them as possible, taking into account possible reasons people read the blog (i.e. it's different for those who track what I do in the software industry, and again different for friends and family).
The links above have associated RSS feeds, so you can choose to syndicate in your reader only those categories you care about. This will probably cause less frustration for me in the future as well, as sometimes I was reluctant to post a more personal writing because I didn't want to decrease the signal-to-noise ratio for (I presume) majority of people who only care for my software-related posts. Heck, I might even post some personal writings in Hungarian now :-)
Friday, December 15, 2006
MacHeist
Via Lifehacker:
MacHeist Bundle is a bundle of 10* highly popular Mac shareware applications. This week only (which means for the next 2 days and 18 hours now), you can purchase them in a bundle for $49 instead of their combined list price of 308$.
Additionaly, 25% of your purchase goes to charity.
What are you waiting for?
*To be completely honest, it's 9 apps at the moment. 10th app is TextMate, and it'll get unlocked (meaning a license code will be sent to everyone who purchased the bundle) if the total raised for charity reaches $100k. It's currently at $67k, so there's realistic chance to get TextMate too as part of the bundle.
Tuesday, December 12, 2006
AAC is better than MP3, Walkman instead of iPod, and what Think Different means to me
Fun fact I learned today: AAC encoding sounds better than MP3 at the same bitrate. Seen here. Re-ripping my CDs right now.
I also bought myself a new cellphone, a Sony Ericsson W850i, and despite some concerns I had initially, the gadget is just brilliant. It has a very decent digital music player built-in (Sony markets them under its Walkman brand) and comes with a 1GB memory stick (I can plug in a bigger one, up to 4GB, and am actively considering buying one), and I can just throw music files from my iTunes library to it using Mac OS X built-in Bluetooth File Exchange app, and it'll nicely index them and add them to its own library. Plays both MP3 and AAC, and recognizes Apple's proprietary iTunes metadata. Just sweet. Guess I'll defer buying myself an iPod for now. Kriszti and me are going on a longish trip to Graz for New Year, so we'll see how it holds up against prolonged use, battery life and overall experience-wise. The phone's contact list and calendar are also syncable with Mac's Address Book and iCal using iSync (after buying a plugin online for 1.43 GBP), a critical feature for me.
As a matter of fact, I initially bought a Samsung Z560, since it's the only phone on the continent at the moment offering HSDPA (think GPRS, only at 1.5MB/s!), but had to return it to T-Mobile after an hour of use and a short frantic search on discussions.apple.com after I realized that it can't sync with Mac, and is not likely it ever will. (Why? Because apparently Samsung has several divisions producing cellphones,
and each of them uses a different sync protocol, and all of them are proprietary...)
And this brings me to the point of that I'm slowly learning what the Apple slogan "Think Different" might mean to me. It means "shake off your Windows-user assumption that any periferial device will work with your computer". I bought a laser printer earlier this year that only works with Mac after installing some cross-compiled Linux drivers. I bought a cellphone that doesn't sync with Mac (fortunately could exchange it for another). I've learned the lesson. I'm shopping for a joystick now, but am not even looking at anything that doesn't feature "Mac compatible" on the box. There's simply no such thing as "maybe it'll work". It's either "it is supported and then Just Works(tm)", or it is "don't even try". In very rare circumstances you can find stuff that is not supported, but works with more or less effort, but it is really a question of dumb luck. Like Sony Ericsson W850i (with a 3rd party plugin - although to be perfectly honest, Apple supports all Sony Ericsson phones, W850i is just too new, and next release of iSync will probably support it out of box), or my Xerox laser printer (works if you dare install a cross-compiled inux CUPS driver). Think Different = Don't Assume It'll Work. Get Used To Doing More Research Than When You Used Windows.