A Monday morning puzzle
It's not Texas hold'em, but how many "perfect" shuffles with a uniform cut does it take to restore a custom deck?
It is easy to lose a bunch of time thinking about the problem that William Grosso blogs about A Fun Programming Challenge. In Also in Java Today we link to the description: given a deck of size n, take the top i cards off of the deck and perform a perfect shuffle as described. The problem is to figure out how many of these identical shuffles it will take to restore the deck to its original position. Oh - and your solution must run quickly.
It might seem obvious to start out by shuffling the deck and then checking to see which cards are where they belong. If you clock the time it takes to do this, you'll see that you are using way too blunt an instrument. Do you really have to shuffle all of the cards?
" Cyclomatic complexity can be explained in layman's terms as follows: every decision point in a method (i.e., an if, for, while, or case statement) is counted; additionally, one is added for the method's entry point, resulting in an integer-based measurement denoting a method's complexity." In Code Improvement Through Cyclomatic Complexity, Andrew Glover talks about measuring this complexity and then understanding and using these measurements to improve your code. Cyclomatic is not the only measure of complexity and the talkback mentions other useful measures.
Joshua Marinacci is inviting you to join his efforts on "Flying Saucer, an all Java XHTML and CSS renderer". After evaluating HTML renderers for Swing he decide to try his hand at rolling his own and decribes his efforts in a blog entry.
Weblogs, he reports that he has "written a renderer that takes a org.w3c.dom.Document object with inline styles and renders it into a scrollable JPanel. Most of plain HTML is supported, as are the full box model, tables, and images. Parts of relative, absolute, and fixed positioning work. The main issue is the bugs in float/clear, and the lack of forms support. Oh yeah, and it's really, really, really slow."
The Heroes of Code, in Simon Phipps' opinion are the " small teams in 36 projects are diligently creating the local language versions of OpenOffice.org that will bring it to millions around the world in their own language." Simon adds that "This, by the way, is why we need format standards - not for the people who have the wealth to create a custom schema but to include into the community those with economies too small to be worth exploitation."
Malcolm Davis looks ahead to this year's JavaOne conference in I'm ready. Malcolm is one of our bloggers who will be covering the show - as for parties, everyone is invited to the Tuesday night Communities in Action party. There will be presentations from Jini, JXTA, and java.net will be presenting awards recognizing contributions from our community.
Projects and Communities, the Education and Learning community's JAI Stuff project offers a "collection of code, tips and datasets" to help the beginning JAI programmer wade through the complexity.
Using patterns can be made easier with the Pattern Enforcing Compiler (PEC), a Java Patterns Community project. It allows you to mark a class as conforming to a given pattern and then verifies that the class does so.
The Stripping down J2SE discussion continues
in today's Forums.
Javakiddy writes that "If there really is a Java3 at any point, what would developers think if the whole API was ditched and a new j3se.* API created from scratch. All the functionality added over the years re-evaluated and consolidated into brand new packages to make them more coherent."
You have four years to fix your problems says jwenting in crying wolf. "JVMs have roughly a 2 year release cycle.
That makes for a 4 year timespan in which to remove dependencies on that old JVM.
In 4 years all applications are bound to be either maintained or replaced by something else that IS up to date.
And of course noone forces you to run one JVM only. As noted it is quite possible to run several JVMs in parallel, and they need not be the same version."
Princec makes a suggestion that is in violation of the Java license. "Clearly we couldn't ship... 9MB's worth of entertainment in a bloated 23MB distribution, and hardly anyone would download it. ... We left in a few crucial bits [of the JRE] that our game actually uses ...and ended up with something taking 2,620KB. Distribution is easy, and 2.6MB for an entire VM with RMI just... rocks. ... Unfortunately it's technically a breach of the license terms, but, ah... we have a bug in our installer and some of the files in the JRE have gotten corrupted, ahem, and don't install correctly"
In today's java.net News Headlines
- Drone IRC Bot v1.0 Released
- Magnolia: >From the inside
- Quartz Reaches v. 1.4.0
- RIFE v0.7.2 Released
- JXMLPad 2.4 RC1
- JSR 223 Reaches Draft Review Stage
Registered users can submit news items for the
href="http://today.java.net/today/news/">java.net News Page using
our news submission
form. All submissions go through an editorial review before being posted to the site. You can also subscribe to
News RSS feed.
Current and upcoming
- June 21 6th Workshop on Learning Software Organizations
- June 23 NYJavaSIG: 1.5 Concurrency Utilities in Practice
- June 24 Accelerate Productivity with Sun Java Web Application Framework Mod Chat
- June 25-27 Western Canada Java Software Symposium
- June 27 Javapedia Workshop and Community Meeting
- June 28 - July 1 JavaOne 2004
- June 28 - July 2 WWDC 2004
- June 29 Java Communities in Action
- June 29 NetBeans Software Day at JavaOne
Registered users can submit event listings for the
href="http://www.java.net/events">java.net Events Page using our
href="http://today.java.net/cs/user/create/e"> events submission
form. All submissions go through an editorial review before being
posted to the site.
Archives and Subscriptions: This blog is delivered weekdays as the
Today RSS feed. All java.net members can subscribe to the email
updates for the site at the href="https://java-net.dev.java.net/servlets/ProjectMailingListList">
java-net Mailing Lists page. You must be logged in to subscribe
to the javanet_Daily and javanet_Weekly lists. Also, once this page
is no longer featured as the front page of
java.net it will be archived along with other past issues in the href="http://today.java.net/today/archive/">java.net Archive.