|
|
|||||||||||||
Evan Summers's BlogFebruary 2007 ArchivesDumbed Down WWWPosted by evanx on February 24, 2007 at 11:26 PM | Permalink | Comments (4)The "Google Operating System" blog entry "Google Docs & Spreadsheets vs Microsoft Office" quotes a Writely post as follows. "One of the reasons the web is so nice is that the page UI is simple... a few things at a time, a very easy metaphor, etc. It passes the 'mom' test - I can usually just tell my mom to go to a site, and she usually can figure it out. I can't remember the last time I could do that with a desktop app. So, even though the windows desktop is 'richer', it's not necessarily better."
My mom is 60 year old granny who has been working on a Linux desktop, using OpenOffice, Thunderbird and Firefox every day for years. Prior to that she used a Win95 computer for email and browsing BBC's Food website, when she was housekeeper and cook in the UK, for Richard Branson's parents, actually :) OK, she didn't setup her Linux desktop herself - my brother did it for her. Well, I don't service my car myself, does that mean i shouldn't be driving a car?! Well in that case, if i was limited to riding a donkey, I'd name it Ajax ;) So that blog tries to imply that the browser is the web, as in collaboration, contextual search and what-not. Shame, maybe they haven't heard of Webservices, which can be consumed by Java RIAs, which can be launched from the browser using WebStart? It's time to start thinking beyond the "browser is the web" paradigm, because the web can be so much more than the browser! In future, our favourite opensource desktop apps like OpenOffice, Firefox and Thunderbird, might get web-enabled and transformed into caching, stateless web clients, eg. using Amazon S3 for storage, and mashing up a bunch of other webservices. But some people believe the web should be so much less than the desktop, dumbed down to the lowest common denominator. When their vested interest is around web ads, can we expect otherwise?
By the time they figure out that ultimately people want more than that, and are better at using computers than they than give them credit for, maybe they'll be classic victims of the Innovator's Dilemma.
Password HashPosted by evanx on February 21, 2007 at 11:40 PM | Permalink | Comments (0)Passwords should never be seen in clear text eg. in transfer objects, or in database columns. So we hash them up. Nothing to it.
public class PasswordHasher { String algorithm = "SHA-256"; public String hashPassword(byte[] passwordBytes) throws NoSuchAlgorithmException { MessageDigest digest = MessageDigest.getInstance(algorithm); byte[] hashBytes = digest.digest(passwordBytes); String hashString = Base64.encode(hashBytes); return hashString; } public boolean verifyPassword(byte[] passwordBytes, String hashString) throws NoSuchAlgorithmException { return hashPassword(passwordBytes).equals(hashString); } }
Gooey Event HubPosted by evanx on February 16, 2007 at 08:36 AM | Permalink | Comments (6)
We implement a event listener list singleton supporting weak references. Then we can add listeners to an object we wish to observe, and fire events to its observers, without implementing any such support in the observed objects eg. addListener(), removeListener(), fireEvent(). We can choose to fire an event in a background SwingWorker thread, or in the EDT eg. using invokeLater() or invokeAndWait(). So we might use this event hub as a basic event/message bus.
We create BackgroundEvent and UpdateGuiEvent classes to enable some EDT switching as follows.
public EventHubDemo() { ... public void actionPerformed(ActionEvent event) { if (checkForNewMessagesAction.equalsActionCommand(event)) { checkForNewMessagesAction.setEnabled(false); eventHub.fireEventInBackground(new BackgroundEvent(this, event)); } ... } protected void doInBackground(ActionEvent event, JProgressBar progressBar) { if (checkForNewMessagesAction.equalsActionCommand(event)) { try { ... eventHub.fireEventAndWait(new UpdateGuiEvent(this, event)); } catch (Exception e) { eventHub.fireEventAndWait(new ExceptionEvent(this, event, e)); } } ... } where we wish to handle checkForNewMessagesAction in a background SwingWorker thread, and once completed, switch back into the EDT to update the GUI.
Bound Gooey BeansPosted by evanx on February 05, 2007 at 03:07 AM | Permalink | Comments (0)
In the Gooey Beans Info prequel, we explicitly declare properties. Now we allow a bean info instance to be bound to a specific bean, in order to support bound properties ie. firing PropertyChangeEvent's.
In our bean, we instantiate a bound bean info class with PropertyChangeSupport as follows.
public class BakedBean { public final BakedBeanInfo info = new BakedBeanInfo(this); private BigInteger barcode; private String label; private Integer bakingTemparature; private BigDecimal medianLength; ... public BakedBean() { } ... public void setBarcode(BigInteger barcode) { this.barcode = barcode; info.barcode.firePropertyChanged(barcode); } } where we use property "literals" from our bean info to firePropertyChanged(). We can add PropertyChangeListener's as follows.
public class BakedBeanDemo implements PropertyChangeListener, Runnable { BakedBean bean = new BakedBean(); ... public BakedBeanDemo() { ... bean.info.getPropertyChangeSupport().addPropertyChangeListener(this); } ... }
Unhybridising RIA development with SwingPosted by evanx on February 02, 2007 at 11:28 AM | Permalink | Comments (26)Our editor highlights Bruce Eckel's Hydridizing Java.
The timing for Java (applets) for internet clients for Web 1.0 was too early. The bandwidth, RAM and CPU of the common users and their PCs were insufficient for anything other than a browser rending HTML. Naturally this led to the current popular technologies eg. PHP, AJAX, server-side Java, which leverage HTML/browsers. Of course the efforts of Sun et al followed the money to the server-side. However, with megabits of broadband, gigs of RAM, and multicore multigigahertz processing becoming the norm, I contend that events are shaping up for Swing to live up to its potential as a serious candidate for Web 3.0, with Netbeans as one of its many allies. 50megs in the scheme of 2gigs is not relevant, and multi-megabyte WebStart downloads via multi-megabit broadband is worth a few second's wait for a killer application you use regularly.
Java/Swing/Netbeans potentially allows developers to deliver RIA and desktop functionality with rapid ease.
There are engineering problems to be solved (and killer applications to be developed). But fortunately there are lots of engineers,
not least ourselves. And it's opensource, so... Let's do this! :)
| |||||||||||||
|
|