2010-10-31

Nov 1st: Conan O’Brien's “Show Zero”

Conan O’Brien will broadcast his warm-up show on the internet:
  • PDT (Los Angeles): Nov 1st, 20:00
  • CET (Berlin, Paris): Nov 2nd, 4:00
Links:

Mac OS X Lion: the 1990s version of Launchpad, the Linux version of the App Store

AtEase was a simplified version of the Finder developed by Apple in the early 90s. Its purpose was equivalent to Launchpad of Mac OS X Lion: Make it easy for beginners to start applications without causing any damage.
But Mac OS X offers beginners help with one more potential source of trouble: it makes it simpler to install and update applications via its app store. The Linux analog of the app store is called package management: It tightly manages installation and also handles updates and removals. I’ve always considered it one of Linux’s killer features. Package management has been around for a long time and it is time that this kind of innovation spreads to other desktop operating systems. While experts could not care less about Launchpad for their own use, it will make their lives easier, because beginners will understand their systems better and cause less damage. On the other hand, the app store will be directly useful to them. I love that Apple keeps track of what you own and lets you install it in one go on new computers.

2010-10-30

Apple, Intel, and Light Peak: news and predictions

Recap: USB2 is becoming too slow. Most hard drives are approximately twice as fast as its maximum speed in practice, while flash sticks can be 5 times faster and more:
  • HSPA (3G): 14 Mbit/s (down), 5.8 Mbit/s (up)
  • LTE (4G): 100 Mbit/s (down), 50 Mbit/s (up)
  • Wi-Fi 802.11n: 130 MBit/s
  • Gigabit Ethernet: 300MBit/s (under real-world conditions)
  • USB2: 480 Mbit/s (real world: ca. 200 Mbit/s)
  • Fast hard drive: 80 MB/s (640 Mbit/s). RAIDs are obviously faster.
  • Firewire 800: 786.432 Mbit/s
  • Fast flash memory: read 200 MB/s (1.6 Gbit/s), write 100 MB/s (800 Mbit/s)
  • Firewire 3200: 3.2 Gbit/s
  • USB3: 4.8 Gbit/s
  • Light Peak: 10 Gbit/s
Thus, people are looking for a successor to USB2. USB3 has already been on the market for a while, but Intel and Apple are pushing a completely new optical standard called Light Peak. I suspect that this is the reason why it takes both companies so long to support USB3 (if they ever do it). The vision for a fast connector is enticing: You can support power, video, audio, and data via a single plug. It might also give us a power socket that is internationally available. If many locations have such sockets in the future, we don’t need to carry a power supply unit with us, any more. It’s obvious that the socket-hating Apple shares this vision. The main advantage of USB3 is that it is completely compatible with USB2: USB3 devices work with USB2 computers and USB3 computers work with USB2 devices. But USB3 has a few disadvantages:
  • thick, relatively short cables
  • no master-to-master communication, e.g. to network two computers
  • unwieldy and fragile connectors (e.g. plugging in USB blindly is risky)
In contrast, Light Peak has thin cables that are up to 100m long and is fully symmetrical. There are several options for its plugs [1], some of them better than USB [2].

I predict that Apple will do the following with Light Peak:
  1. Macs and MacBooks: Light Peak will replace as many connectors as possible. Apple’s displays already function as docking stations. If a Light Peak connector can be used to power the MacBook (as opposed to the MacBook powering a connected device) then only a single cable is needed for the display to provide video, sound, additional ports, and power. Currently, 3 cables are used (power, DisplayPort, USB). Light Peak can also transport foreign protocols over its wire which means that USB could be at a docking station, but not at the portable device (which is admittedly too radical as long as USB sticks are popular).
  2. iPad, iPhone, iPod: Light Peak will (eventually) replace the current dock connector. This would be a huge gamble, but enable many new applications, including connecting an iOS device to a full-blown docking station.
Updates

2010-10-28

Soon all your applications will always be open

Virtualization is a key technique in informatics: If you access a large and slow medium such as a hard drive or the internet, you are given the impression that you can access everything directly and many complicated intermediate steps are hidden from you. These steps often include the use of caches where data that you are likely to need again is stored on a local medium that is quicker, but also smaller. Caches are based on the observation, that one often only accesses a small amount of data at a time and that data frequently. Thus, if you haven’t used data for a while, you are less likely to need it again, and newer data can replace older data. For hard drives, RAM is used for caching, while web browsers cache internet data on the hard drive.
When using computers, there is one large virtualization hole: applications. You have to manage manually what to keep and RAM and what not. This is why Apple’s plans for Mac OS X Lion are interesting: applications are supposed to automatically save and restore their current state (open windows, etc.), like iOS applications. As a consequence, the dock won’t indicate any more what applications are currently open and applications will be opened and closed automatically. In a way that only finishes what is already partially happening: If many applications are open, there is not enough RAM and some older applications are pushed to the hard drive. That is, virtual memory gives you the impression that you have as much RAM as the hard drive (another example of virtualization). Older RAM content is written to disk if there is not enough room, any more.
It remains to be seen how fast restoring the app and its state is. At least on the iPhone it seems to work well. Then one issue remains: For some things, you need true multi-tasking which means that part of your application keeps running. This should not be hidden from the user and some kind of interface to manage these activities becomes necessary. Examples of such activities are playing music and copying files. It will also be interesting to see how/if Apple allows background apps to hook into the function keys for next song, pause, etc. App switching (as in command/control-tab) will probably show a few least recently used apps. This is an improvement from showing all open apps, which is sometimes not enough, sometimes too much. Finally, there is also the potential that this new management saves power, because less things run simultaneously.

Using HTTP to stream video

Showing complete videos on the web more or less works if you use HTML5 and the H264 format. For browsers that cannot handle this combination, you should offer a fall back to Flash. Theora is also worth looking at, because many (non-Apple) browsers support it. The streaming story is more complicated. The current solution is to use the Real Time Streaming Protocol (RTSP). But it has two disadvantages:
  • Special server and infrastructure are needed
  • Difficulty with firewalls
Apple has proposed a standard to solve these issues:
  • Split a video into a set of small clips (of, say, 10 seconds), link them via an index file. The index file can be appended to if the stream grows, as is the case for live streams.
  • The stream can be adapted to the needs of the client. For example, a cell phone might migrate from Wi-Fi to a cell phone network. Then the stream should have a lower resolution. This is enabled by storing the clips in different versions.
  • Encryption is supported and content providers can prohibit local caching at the client.
Pros and cons:
  • Pro: Any HTTP server can be used for streaming, no special server software needed. Just preprocess your video with Apple’s tool to produce the required files. If you want a live stream, things obviously become more complicated.
  • Pro: HTTP is proven technology that works with any firewall.
  • Con: Client-side support is currently limited to QuickTime on Mac OS X Leopard and iOS. No Windows or Linux! The last two of Apple’s keynotes were transmitted via HTTP streaming and the quality was superb. This explains the requirements for watching them.
[Source: Ars Technica]

2010-10-27

Notes on the MacBook Air late 2010

I picked up my 13" MacBook Air last Saturday and I’m really happy with it. Notes:
  • SSD is fast, often offsetting the slower processor (compared to my desktop mac). The Air boots in 15 seconds!
  • The higher screen resolution of 1440 x 900 is perfect: I wouldn’t want less and don’t need more. The previous resolution of 1280 x 800 of Apple’s 13" notebooks was not enough.
  • Instant on: wake-up is no virtually immediate, previous MacBooks were already sufficiently fast for me, the new Air is even faster. Apparently, Apple now postpones writing the complete system state to the drive (enabling one to resume one’s work even if the battery is completely empty). Previously, this meant that Macs took quite some time until they were finally asleep. This was not a usability problem, but puts a traditional disk in danger, if you move the notebook too soon. Now, this process happens after one hour of sleep which means that it is avoided if the notebook frequently sleeps and wakes up.
  • Trackpad: I now prefer trackpads to mice. Gestures are just great. Use two fingers for scrolling, no more navigating to the scroll bar. Swipe with three fingers to go backward and forward (e.g. in a web browser). Etc. As the trackpad is just one big multi-touch button, right-clicking can be configured; you either click with two fingers or in one of the bottom corners.
  • Speakers: are surprisingly powerful, similar to the iPad’s impressive speakers.
  • Keyboard: The power button is now part of the keyboard. The Air still has an eject key, to be used when you attach the external DVD drive. The function keys are very useful (volume, brightness, next song, pause, etc.). Curious that the notoriously button-phobe Apple does this.
  • Headset: iPod and iPhone headsets work well with the Air, which is nice for Skype and Face Time. Even the remote control for pause and next/previous song works. Alas, you cannot play music if the Air is closed. There are apps that keep the computer from falling asleep, which is something that I’ll be checking out.
  • USB2 has become a serious bottleneck for the Air. I previously compared the different interface technologies (USB, Firewire, Wi-Fi, etc.) and nothing much has changed. Why doesn’t Apple put in USB3? Maybe they are just biding their time until Light Peak is ready. Transferring your previous data to the new computer is just painful. Most people will probably use USB2 sticks or hard drives. In contrast to Firewire, you cannot directly connect two computers via USB (without an adapter) which does not help here, either.
  • Another sad omission is (an option of) HSPA (=3G). My iPad has 3G and I love that you can go online almost wherever you want.
  • Apparently, Apple went with the slightly older processor (Core 2 Duo), because they wanted to use Nvidia graphics chips (which don’t work with newer Intel chips – it’s all part of an Nvidia-Intel feud). Update 2010-12-15: Details on the decision.
  • 13" versus 11": The 13 is not much larger and heavier than the 11. I thought the 11" would feel smaller, but it is mainly a less deeper version of the 13". Also, the battery of the 11" has less capacity (an average 5 hours as opposed to 7 hours).
  • From what I’ve been told, the 11" sells better than the 13" and the Air does not cannibalize iPad sales. I guess, tech people see the similarities, but for non-tech people, notebooks and iPads are completely different devices.
Summary: The Air has become a serious contender as a primary computer, with its increased speed and screen resolution, even more so if one uses an LCD Cinema Display as a docking station. Apple is now aiming for the masses. To save money, it does not sacrifice build quality, but sometimes stays a bit behind on features (e.g., no faster interface than USB, no 3G, no more keyboard backlighting). Apple uses the experience gained from its mobile devices to make its notebooks compact and it uses its clout as a massive buyer of components to keep prices comparatively low. The most recent example of this is that Samsung cannot make its Galaxy Tab cheaper than the iPad.
Related reading:

Use Bash as a stop watch

If you need to time something and don’t want to use any fancy GUI apps, you can use the following command in the Bash shell (Mac OS X or Linux terminal):
date ; read -n 1 -s ; date
Explanation: Print out time and date, wait for a single key to be pressed (-s prevents that key from being shown), and print out time and date again.

Update 2010-12-12: Great suggestion from the comments. The following is an even simpler solution (hit return at the end of the line to start the stop watch, hit return again to stop it).
time read

Small-scale production via the internet

The Economist has an article on how the internet revolutionizes production, taking as an example the tripod mount and stand for the iPhone called “Glif”:
  • Two men from New York had an idea for an iPhone stand.
  • The internet funding platform Kickstarter was used to finance the development.
  • They sent their 3D models via email to a Dutch company which sent them back “printed”, three-dimensional prototypes.
  • A short-run injection-moulding production firm will make the final product:
    Injection moulds commonly produce millions of like results; Protomold specializes in smaller runs, and can make dozens to thousands of castings at a reasonable per-unit price.

2010-10-25

Can the present affect the past?

It looks like it:
In a test that we wouldn't have believed had it not been documented, 100 Cornell students were shown 48 common nouns and given three seconds to observe and visualize each word. Then they were asked to type out as many words as they could remember. After that, a computer re-displayed half of those [original 48] words, which the students then retyped.
You don't have to be psychic to know where we're going with this: It turns out that the students more likely recalled the words that they were later asked to retype.
In his original paper, Dr. Bem wrote, “The results show that practicing a set of words after the recall test does, in fact, reach back in time to facilitate the recall of those words.”
This is similar to some of the things Dean Radin talks about in “Science and the taboo of psi”. He mentions an experiment where people react to unpleasant pictures before they are shown.

Java on Mac OS X Lion: the redux

Update 2011-02-26: OpenJDK: Mac OS X Port Project

Update 2010-11-12:Oracle and Apple Announce OpenJDK Project for Mac OS X”. This is how it should have been done all along, before announcing the deprecation. Then either Apple didn’t think this through or it used it as a negotiation tactic.

Apple is currently warning developers that Java might not be bundled with Mac OS X Lion. Jobs later clarified:
Sun (now Oracle) supplies Java for all other platforms. They have their own release schedules, which are almost always different than ours, so the Java we ship is always a version behind. This may not be the best way to do it.
Observations:
  • Apple obviously and understandably does not want to handle Java, any more. In the past, it has been slow to support the newest version, so this change could be for the better.
  • Having Java on the Mac is important, because many developers need it. Those developers mainly work on server-side applications, so their work is not directly relevant for Apple. But they are still an influential group whose support Apple won’t want to lose. Java is also crucial for education. I don’t know of any software-related degree where Java or the JVM is not needed at some point.
  • Oracle is very profit-driven and server-oriented, so I’m not sure if they see a business case for Java on Mac OS X.
  • There is an open source Java for the Mac, but it runs under X-Windows, thus Swing is not well integrated (but: Eclipse and SWT run on it, too). There is a petition for Apple to hand over its custom code to the open source community. I think, we’d only need a part of it. While the Swing Aqua look and feel was nice, Nimbus (which appeared in Java SE 6u10) is good enough for me. Mimicking Apple’s GUI will always be a moving target, anyway. Maybe Apple thought about the difficulties of implementing the new look of Mac OS X Lion in Swing and considered it too expensive.
  • The main problem is that neither Apple nor Oracle have really communicated what all of this means. They should have consulted before Apple dropped this kind of a bomb. Now people are free to speculate and some blame Apple, others blame Oracle.
Links:

2010-10-23

Mel Gibson’s fall from grace

This shows how unpopular Gibson currently is in Hollywood: He was to star in a cameo in “The Hangover 2”, but cast and crew complained and he was replaced with Liam Neeson.

2010-10-21

A few thoughts on the October 2010 Apple event

Software

Mac OS X Lion and more:
  • FaceTime is available on the Mac: About time. One has to wonder why FaceTime is a separate app and hasn’t been integrated into iChat. Maybe iChat will go away, long-term and/or iChat features will be added to FaceTime (mainly instant messaging).
  • Mac App Store and Launchpad: Great for beginners who tend to have a hard time to install (as in: apps appear everywhere on their hard drive) and to start/find applications. Also useful for computers that don’t have a DVD drive (such as the MacBook Air). Automatic update of applications is very welcome and a long-rumored Mac OS X feature that never quite made it to the real world. I would like to know how they deinstall applications: Do they remove all the files (preferences, caches, support files) that an app leaves behind?
    Additional reading: Daring Fireball has a nice article on some of the problems with the current ways of app distribution.
  • Full screen apps: This is Apple (partially) taking a page out of the Windows playbook. It makes sense, but I would prefer them to also copy how Windows 7 allows you to quickly split the screen between two applications. I would guess that full-screen operation is enough 80% of the time and vastly simpler than managing lots of small windows. User interfaces have been moving away from multi-windows and towards tabs and views for a while now.
  • Don’t touch the screen: Interesting that Apple explicitly mentions why they are not doing direct touch on Mac OS, but rather use a trackpad with multi-touch gestures.
    Related reading: “What does a multi-touch desktop GUI look like?” seconds Apple’s opinion.
  • Mission control: unifies Spaces, Expose, Dashbord, and Launchpad. This kind of unification is badly needed. Currently, applications and spaces are somewhat at odds with each other and don’t feel completely cohesive. It seems like Dashboard, Launchpad, and full-screen apps become spaces.
Update 2011-02-24: Apple’s MacBook introductions: what’s actually new? [summarizes what is known about Lion, so far]

Software

  • MacBook Air: Brilliant, how it really is an iPad with a keyboard. Because Apple directly uses Flash RAM chips and does not put them into a hard drive enclosure, there is much more space for batteries. One more way that iOS devices and Macs cross-pollinate.
  • Honest battery tests: Finally. This is how you should interact with your customers (god knows Apple not always does it); they are going to see through your shenanigans, anyway.
  • A USB stick to restore your software: MacBook Airs (or is that MacBooks Air?) come with an 8GB stick that allows you to reinstall the operating system and iLife.
  • Instant on – huh? Engadget dropped a hint about what might be new about “instant on” (current MacBooks already wake up from sleep fairly quickly). Apparently, MacBook Airs go into a light sleep when closing them and then into a deeper sleep after an hour (where the contents of the RAM are saved to the hard drive). This feature is less risky with a solid state drive, because turning a hard drive with movable parts on willy-nilly might damage it.

Links

2010-10-18

Designing APIs with the Java 5 language features

The following is an almost verbatim copy of my post in a thread. I’m replicating it here in order to not lose this content.

While implementing a mid-sized framework, I've discovered that the following Java 5 language features can help improve the usability of APIs.
  • Generics can help avoid casts in more ways than one, especially if instances of Class are used (see my blog post on this subject).
  • Generics and constructors: Generic constructors always need a type argument, while static methods (such as factory methods) can infer type arguments from their actual (method) parameters, leading to shorter code. This is an example:
    public class Foo<X> {
        public static <X> Foo<X> create(Class<X> elementClass) {
            return new Foo<X>(elementClass);
        }
        public Foo(Class<X> elementClass) { }
        public X getElement() { return null; }
        public static void main(String[] args) {
            // Wrong type at right-hand side:
            Foo<String> foo1 = new Foo(String.class);
            // Proper way of doing it:
            Foo<String> foo2 = new Foo<String>(String.class);
            // Correctly infers the type:
            Foo<String> foo3 = Foo.create(String.class);
        }
    }
    
  • Interface Iterable enables the simplified for-each loops. This suggests that whenever you return an interface Iterator, you should also consider returning an interface Iterable. It is unfortunate that Java does not allow for-each to be applied to iterators. One can also use the following adapter:
    public class IterableWrapper<Elem> implements Iterable<Elem> {
        private Iterator<Elem> _iter;
        public IterableWrapper(Iterator<Elem> iter) {
            _iter = iter;
        }
        public Iterator<Elem> iterator() {
            return _iter;
        }
    }
    
  • Varargs are good whenever the API asks for 0 or more "things". In the past, there were often two variants of a method, one with the optional argument (be it a list or an array), the other one without it. With varargs, you can unify both ways of invocation under one signature. Additionally, many data structures can be cleanly created with varargs, for example:
    public static final <T> Set<T> makeSet(T... elements) {
        return new HashSet<T>(Arrays.asList(elements));
    }
    
  • Enums: Make it easy to discover the possible options for an argument. Compare this to the class SWT inside the Eclipse framework of the same name. Practically every GUI widget depends on the constants defined in this class, which makes looking up what constants apply in one particular case more difficult than it should be. Other advantages of Enums: Each enum constant is a full-blown object and one can perform all kinds of book keeping along with defining them; enums can be examined with a switch statement; the classes EnumSet and EnumMap provide memory-saving means for storing enums.
  • Interface Appendable: Unifies all objects “to which char sequences and values can be appended”. The list of implementing classes is long and includes StringWriter and StringBuffer. Consequence: Whenever you have an argument to which you want to "append" strings in a stream-like fashion, consider using this interface.

2010-10-17

Ensuring the long-term survival of our civilization

The most profound goal of science has always been to guarantee our survival and to protect us from the unpredictability of nature. Back in the middle ages, if a farmer had one bad harvest, it often meant his death. The goal of feeding and protecting us has more or less been achieved. The problem is that we now need to change our focus, because the current focus is becoming outdated and even threatens our survival. We need to switch from a focus on consumption, production and work to a focus on moderation, recycling and meaningful lives. A different kind of innovation becomes important that is often only partially technological. The following are a few of the most pressing topics. A frequent theme is robustness in crisis.

2010-10-13

Weird names: Jaime Sin

Wikipedia records that Jaime Sin was aware of the irony: If you are a Cardinal in the Roman Catholic Church and your last name is Sin then that makes you Cardinal Sin.

BiJava: Backwards-incompatible Java

Stephen Colebourne has a great idea: How about creating a version of Java that is not backwards-compatible? That would mean that it could lose some of its weird and/or hard-to-learn features, while still being recognizably Java and without suffering from the feature overload of some of its competitors. Colebourne also lists three features that BiJava (backwards-incompatible Java) should have: no primitives, nullable types, equals operator. Observations:
  • Avoid feature overload: Larry Wall’s oft-cited saying “there is more than one way of doing things” to me is the very definition of bad language design. Scala and Clojure might suffer from this problem (disclaimer: I still don’t know these languages well enough for an informed opinion).
  • Typing method parameters is great: It allows one to do static checking and documents what’s going on. Languages with algebraic types (ML, Haskell) tend to have even more custom types; they even wrap the type where in Java, one would probably use naked strings. A great practice.
  • I would also argue that (a simple version of) closures should completely replace inner classes. They are immensely confusing to newcomers and not needed if you have closures. Smalltalk and (the partially Smalltalk-inspired) Ruby show that closures and object-orientation are not antithetical.
  • Groovy++ looks interesting, sometimes it seems to stray too far from Java (why in hell are semicolons optional?). [As an aside: Groovy++, please get a proper home page, for those of us who are banned from Google Groups.]
  • ABCL (Armed Bear Common Lisp) is also worth checking out. I love their tongue-in-cheek slogan “The right of the people to keep and arm bears shall not be infringed!”. Like Clojure, ABCL is Lisp, but closely emulates Common Lisp which means it is a simpler language.
My own wish lists for Java:
Update 2010-10-13: Bracha’s blog post “Original Sin” sketches what a Java without primitive types could look like.

    Eric Stoltz as Marty McFly in “Back to the Future”

    In one Fringe episode that takes place in the alternate universe, Eric Stoltz is Marty McFly in “Back to the Future”. This made me curious and I checked out Wikipedia: In our universe, they actually shot five weeks with him in that role before replacing him with Michael J. Fox. It feels like the right decision and I don’t think it is Michael J Fox’s acting, but rather his personality that make him such a great fit. Now you can actually see a little bit of footage [source: Gruber] from those first five weeks.

    2010-10-11

    The first Windows Phone 7 commercial

    The first commercial for Windows Phone 7 is weird. It makes the correct observation that we use our cell phones too much. This part is really well done and I’m sure that many people agree, especially parents of teenagers. The commercial then goes on to propose Windows Phones as saving us from our phones, because they are “designed to get you in and out and back to life.” But don’t we use our phones in the manner shown when we want to escape life as it currently is (boring situations, separated from loved ones, etc.)? Wouldn’t it be better to show us how to live more efficiently with a Windows Phone, instead of ridiculing current phones (or rather, their users)? Not a very inspiring message (i.e., a negative one).
    [Source: Daring Fireball]


    Update 2010-10-13:
    • Idea: Wouldn’t the commercial work better if it dropped the slogan of saving us from our phones and instead revealed that the phones that the people are glued to are Windows Phones?
    • Business Insider additionally shows a second ad and almost paraphrases what I have written above.
    • Related reading: a comment on Microsoft’s previous ads that similarly miss their target.

    2010-10-10

    Lessons to learn from the Frost/Nixon interviews

    I just finished watching the movie “Frost/Nixon” [uk]. Given the subject matter, it is surprisingly thrilling and emotional. While it clearly indicts Nixon, it also paints a multi-faceted picture of him, it takes him seriously as a human being. It also contains two interesting lessons.
    [Minor spoilers ahead]

    Don’t like wireless input devices? Let Apple know!

    This is a follow-up to my previous post “Apple, please give us a wired trackpad!” where I explain why wires are currently better than batteries, how Apple has largely solved the wire problem, and how trackpads will probably replace mice long-term.

    Two new ideas:
    • Give Apple feedback if you agree with me. Every now and then they seem to react to it, so here is hoping. Also let them know that it’s stupid that you can only buy a trackpad in addition to a mouse (and not instead of it) with a new Mac.
    • MacInTouch has a great review of the Wacom Bamboo which is a wired mini-tablet that can be used by touch and by stylus and partially competes with the Magic Trackpad.

    2010-10-09

    Does Java make you less productive than dynamic languages?

    I still hear from many people that dynamic languages make them more productive, but my experience is exactly the opposite: I used to prefer Python to Java. But then along came Eclipse with its refactoring and code browsing and afterwards, I could not go back to simpler editors. Many of the advanced Eclipse features are possible precisely because Java is not dynamic. But in many ways, Python feels more polished than Java. The irony is that this has nothing to do with Python being dynamic. All of the following things could be easily added to Java.

    Standard library. The good news is that Java has libraries for almost anything you can imagine. The bad news is that dynamic languages tend to come with much more useful stuff built in:
    • URL-decoding
    • JSON encoding/decoding
    • UU-encoding
    • Joining strings
    • Command line argument parsing
    • CSV file parsing
    • Complete HTTP client implementation (multipart POST, cookies, ...)
    • Iterators: for loops over iterators, combinations (filter, append, etc.), conversion to collections
    Literals:
    • Collection literals: Java 8 will have collection literals, so we will have to wait a while. In the meantime, Arrays.asList() is good enough for lists and a chainable put() (return type = Map) would be good enough for maps.
    • Triple-quoted strings: If a string is triple-quoted in Python, it can contain multiple lines of text and single quotes.
    • Raw strings: In Python, prefixing a string quote with an 'r' means it is raw and slashes are interpreted as is, and not used for escaping. This is very useful for text that contains backslashes (regular expressions, LaTeX).
    Slicing and dicing complex data structures:
    • List comprehension: great in Python, easily added to Java, once it has closures.
    • Accessing the n-th last element (arrays, strings, lists, ...): In Python, the index -n can be used for this purpose. In Java, you have to resort to mylist.get(mylist.size()-n).
    Miscellaneous:
    • str() and ref(): Python has two kinds of toString() methods. str() returns a human readable representation, while ref() returns something that can be parsed (i.e. this method serializes to Python source code).
    • Keyword arguments, optional arguments: useful, but might be too cumbersome to add to Java.
    Exploring code: Having an interactive command line in Python helps. Eclipse has sheets, but I’ve always found them a bit awkward to use. I am thinking more along the lines of BeanShell, but it does not seem to be updated, any more. I would also love Eclipse to become even better at code browsing (ideas, more ideas).

    Most of the other Java warts, I can live with. That Java will have closures sometimes in the future is great, because currently it is difficult to encapsulate a way of iteration, where the operation that is applied to each element can be configured.

    Related posts:
    Flattr

    Movie: Grand Canyon (1991)

    Grand Canyon” [uk] is a great movie from 1991 with Danny Glover (after the 2nd “Lethal Weapon” movie) and Kevin Kline. I originally saw it when it came out and re-watched it today. It is a bit more somber in the middle than I remembered, but ends fairly upbeat. Lawrence Kasdan wrote and directed it. As an aside, he is responsible for the 2nd and 3rd original Star Wars movies having good scripts. For the new ones, George Lucas decided that he could write the scripts himself. And we all know how that turned out.

    Bill Murray gives a rare interview

    In August 2010, GQ published an interview with Bill Murray. It is one in only five he has done during the last 10 years. Reading it, one learns a lot of curious facts. For example, to do business with him, you have to call an 800 number and then he gets back to you – or doesn’t.

    2010-10-03

    Sub-100ml products

    If a container holds at most 100ml of liquid, you can take it with you in your hand luggage on an airplane. I don’t know if they were there before this regulation, but I’ve recently noticed whole shelves in shops (e.g. Rossmann in Germany) dedicated to sub-100ml products: toothpastes, deodorants, shampoos, etc. Cute and useful.

    Update 2010-10-05: Looks like the 100ml limit will be lifted by 2013, thanks to new detectors that will be deployed by then. I wonder what this will do to the burgeoning sales of bottled beverages at airports.  [Source: Focus via Marianne Busch]

    Flattr

    Killer new GoodReader feature: PDF annotation

    GoodReader is an iOS application for transfering and reading files, especially PDFs. The lastest version supports PDF annotation which is great when you have to give feedback on someone else’s work.

    2010-10-02

    Finally! JavaFX script is dead

    I never fully understood JavaFX script. It seemed like a nice enough language, but it neither completely replaced Java nor integrated well with it. Furthermore, some of the features of its library were sorely missing from Java, but not accessible from it. This is why it is refreshing to see the new JavaFX Roadmap. Its main tenet is that JavaFX script is being discontinued and that JavaFX becomes a framework for Java with many exciting features:
    • Binding API: Well, OK, yet another one. Here is hoping that it will not be too cumbersome and find broad acceptance. The API will include observable collections (which are handy for GUI lists and tables).
    • Media framework: for audio and video. About time.
    • HTML5 support: parsing and display. Also desperately needed in Swing (SWT already has reasonable HTML display support).
    • New table control: Apart from better looks, combining it with observable collections should get one the comfort offered by Glazed Lists.
    • New rich text control.
    Finally Java gets back the human resources that had been moved to JavaFX script by Sun. The new JavaFX features will make it much more appealing for developing desktop applications.

    Update 2010-12-15: Why the new JavaFX makes sense