Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Monday, December 26, 2011

pentahexed: the tale of a misleading manifest

If you have worked with Oracle's JDBC drivers before, you are no doubt familiar with ojdbc5.jar and ojdbc6.jar.

Oracle tells you that ojdbc5.jar contains Classes for use with JDK 1.5. It contains the JDBC driver classes, except classes for NLS support in Oracle Object and Collection types and that ojdbc6.jar contains Classes for use with JDK 1.6. It contains the JDBC driver classes except classes for NLS support in Oracle Object and Collection types.

Take a class oracle/core/lmx/CoreException.class from each JAR, send it to file and you are not surprised with what you see:

(for oracle/core/lmx/CoreException.class from ojdbc5.jar): compiled Java class data, version 49.0 (Java 1.5)
(for oracle/core/lmx/CoreException.class from ojdbc6.jar): compiled Java class data, version 50.0 (Java 1.6)

Open the manifest of each JAR, however, and you see something interesting. The value of Created-By is the same in both JARs: 1.5.0_30-b03 (Sun Microsystems Inc.). How can a JDK 1.5 compiler know about JDK 1.6? Surely, this has to be something lurking in the scripts that needs to be fixed. It also wouldn't hurt to use a newer version of Ant (the value of Ant-Version) is Apache Ant 1.6.5 (the latest version is 1.8.2).

Sunday, May 01, 2011

the joy of comments

(in code, I mean). Truth is funnier than fiction. Comments in source code, to be precise. Consider, for example, the following worthy addition to the list of classic lines for fortune cookies:
// later is to be
or a declaration of principles:
// THIS method is not calling anywhere
or a declaration of the laws of the jungle:
// All transactional processing classes are responsible
// for calling this method and for providing what action is provided
or perhaps an example of stating the obvious:
// This abstract class houses default and common
// implementation for some interfaces

// This class is the message-driven bean implementation class
// which acts as the listener to queues which hold the messages that affect other 
// business objects
it is unclear why the following comment should even appear in code (perhaps the reader is not expected to be a developer):
// It is restricted to change this API without testing all the references
how does one say a lot without making much sense? how about (some of the funny names in camel case are euphemisms to protect the innocently dangerous; any others are changes just to keep the legal eagles awbay):
/*
 * DefectNumberInOneTrackingSystem Fix : Added this flag becoz
 * misspelledMethodName() in Abstract Object Check Against Null String of
 * FieldThatCannotBeDisclosed String While in This Defect Although it was Not
 * ______ Update But then also FieldThatCannotBeDisclosed string was
 * Not Null Becoz the default value stored in database is
 * 0.0 So it is Not Null and MisspelledFieldName Become true and
 * Then it dont set the AnotherFieldThatCannotBeDisclosed if it is True...See
 * DefectNumberInAnotherTrackingSystem
 */
{includes material that previously appeared hereabouts}

Saturday, May 08, 2010

the things people do and still get paid

The programmers who are paid well and get promoted while being completely ignorant of the implications of a package name for a Java source file. While it seems stentorian to expect everyone to read the Java Language Specification (Chapter 7, in this case, and section 7.2.1 to be precise), it surely isn't too much to ask that people heed the complaints of javac when it fails to successfully compile files whose package names have nothing to do with where the file is located on the disk.

The programmers who flaunt experience with the newer versions of the JDK (5.0 and 6.0) on their résumé but ignore javac's warnings about all the raw types abundant in their freshly written code, simply because they do not understand why the compiler has a problem with code that works.

The programmers who just don't understand why XSLT (from the wikipedia page: XSLT (XSL Transformations) is a declarative, XML-based language used for the transformation of XML documents...) does not work on a document that is not XML.

Tuesday, January 26, 2010

what if someone pretending to be confucius used Eclipse

depecrated (deserves to be execrated); chinese internationalisation (whatever); this abstract class houses default and common implementation for some interfaces (very observant); all tranctional processing classes are responsible for calling this method and for providing what action is provided (schizoid indecision); used to identify newly instantiated instances (काला टीका?); later is to be (absolutely). This is a heck (what the hack!).

Someone would get paid for writing code that invoked the toString() method on an instance of java.lang.String. Meanwhile, in the woods, someone talks about methods consuming a lot of memory consumption (Borges would be proud, no doubt).

Wednesday, May 06, 2009

multiplexing choice

I wonder how many users of either ... or realise that the expression can accommodate exactly two choices. Think of an exclusive or in logic, if you wanted some way to remember this. Abuse of the expression to stuff more choices is rife in usage, especially in conversations. A little popup in Eclipse today offered evidence that the Javadoc in Sun's JDK was not immune; Here's the extract from the documentation for the getTimeZone(String) method in the java.util.TimeZone class in J2SE 5.0 (I have underlined the guilty snippet):



getTimeZone
public static TimeZone getTimeZone(String ID)


Gets the TimeZone for the given ID.


Parameters:
ID - the ID for a TimeZone, either an abbreviation such as "PST", a full name such as "America/Los_Angeles", or a custom ID such as "GMT-8:00". Note that the support of abbreviations is for JDK 1.1.x compatibility only and full names should be used.
Returns:
the specified TimeZone, or the GMT zone if the given ID cannot be understood.

Wednesday, February 18, 2009

transformations galore: OSS humour

It was a dark and stormless night as I stared at a stack trace from the hearts of the JAXP subsystem of JDK 5.0, specifically the Xalan 2.6.0 snapshot shipped by Sun Microsystems under a modified package:



at com.sun.org.apache.xml.internal.serializer.ToHTMLSAXHandler.comment(ToHTMLSAXHandler.java:360)
at GregorSamsa.template$dot$0()
at GregorSamsa.applyTemplates()
at GregorSamsa.transform()
at com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet.transform(AbstractTranslet.java:594)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:663)

GregorSamsa?? Was I seeing visions? An examination of the JDK 5.0 source code (1.5.0_12, to be precise) and the Xalan-J SVN repository told me that I wasn't. All of Kafka's obsession with an individual trapped in a cruel cold bureaucratic labyrinth aside, this is kinda cool in a geeky way. The pun should be obvious if you knew that Xalan's used for effecting XSL transformations. XSLTC (Xalan-J's compiling XML processor) compiles XSL stylesheets into Java classes. A set of such classes is referred to as a translet. A set of steps is followed to determine the name of the main translet class; the final option, should all preceding ones fail, is the built-in default class name, GregorSamsa. Here's the extract from the source code (the comments serve as software development's answer to exposition):



/**
* As Gregor Samsa awoke one morning from uneasy dreams he found himself
* transformed in his bed into a gigantic insect. He was lying on his hard,
* as it were armour plated, back, and if he lifted his head a little he
* could see his big, brown belly divided into stiff, arched segments, on
* top of which the bed quilt could hardly keep in position and was about
* to slide off completely. His numerous legs, which were pitifully thin
* compared to the rest of his bulk, waved helplessly before his eyes.
* "What has happened to me?", he thought. It was no dream....
*/
protected static String DEFAULT_TRANSLET_NAME = "GregorSamsa";

Saturday, January 10, 2009

hop and skip

It all started with a Velocity template error on a page in my bookmarks that I decided to visit again. The Wayback Machine couldn't help out of respect for and adherence to the robots exclusion protocol. Googling got me to DZone and thence to an old InfoQ article about changes in the Java Collections API made in Mustang. Two things caught my eye: "skip lists" and "William Pugh"; The former was a data structure that a colleague in one of my previous jobs had introduced me to (not that I learnt more about this data structure later, but I was quite fascinated with what I had heard). The latter is the father of one of my favourite software code quality tools, FindBugs. As it turned out, William Pugh invented skip lists. You would think that I would've got wind of this at some point given that Pugh was not an unknown name thanks to the tool. Yet, today was when the dots presented themselves to me, connected in glee. The final surprise lay in store for me over at the inevitable Wikipedia page for skip lists. The second reference listed on the page is a paper, whose co-author is a good friend.

Then again, not all coincidences are meaningful.

Tuesday, September 20, 2005

an IDE wanes?

Is Eclipse (Greek verb: ecleipo = 'cease to exist') {source: Wikipedia} all set to go the bloated way of the Mozilla/XPCOM/you_name_it nightmare that rose from the initial offering of Netscape's source code? Version 3.1 has been an improvement in some respects over the horrendously under-performing 3.0 series (which I experienced vicariously thanks to reports from friends and colleagues while enjoying the simple pleasures of 2.1.7)...

Begin Flashback

When I first encountered and used Eclipse I was impressed and pleased. And I wasn't clamouring for IDE snap-ins and wizards for J2EE and UI development (frankly, I'd like to use such one-click tools only after learning what happens under the covers). And Eclipse offered great support for coding with the Java API and conventions. Especially if you were using good old vim for electronic archaeology -- didn't quite scale well given impossible deadlines when you were talking about several source branches inundated with millions of variously commented often intuitively named source files of various genera.

End Flashback

My sweet moments of development quickly went to KDE-on-a-386 hell shortly after I installed release 0.7.0 of the Eclipse Web Tools Platform. This represented an initial offering from the IDE's fold to all those developers who had been consumed by the dark side of commercial IDEs thanks to the allure of wizards, tools and mouse-friendly snap-ins that eased J2EE development (of course, if you didn't have too much of an idea about what went on in this distributed environment, you were competing with the average Visual Basic programmer for mental regression). While the tools contained in the WTP held promise (it was nice to see a lot of the Eclipse features like code assist extended to ugly pasta like JSPs). Soon, though, the White-Screen-Of-Death syndrome (see also: the White Toolbar of Death) became a regular phenomenon. You see, this thing didn't quite scale well when you had a classpath that had as many entries as people in the Indian subcontinent (allow me the hyperbole please). The "cool" feature of automatically recompiling projects soon became an annoyance that took your workstation down every time you changed a couple of characters in the scriplet space. Soon I found myself poring posts on fora and blogs for options to control and optimise Eclipse's memory consumption and garbage collection. ProcessExplorer from SysInternals now became a messenger of bad news as I watched the javaw process iterate through each JAR file in the project classpath. There was nothing I could do. To make matters worse, the WTP subsystem did not have its own vista for configuration. So if I had to turn off the "as-you-type" assistance, I'd have to turn it off for the whole IDE. Nice! For a while, I was stuck with hitting the period ('.') and becoming a man who paused (weak pun there, tinged with some "inquizitive" nostalgia).

This was getting to me. A deadline starting slipping away faster than the eye could see (aah the original figures of speech!). I began monitoring the ".log" file. Entries like the following were rather common:


!ENTRY org.eclipse.wst.sse.ui 4 4 2005-09-20 10:24:13.68
!MESSAGE problem with as-you-type validation
!STACK 0
org.eclipse.core.runtime.OperationCanceledException
at org.eclipse.wst.sse.ui.internal.reconcile.DirtyRegionProcessor.run(DirtyRegionProcessor.java:411)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)



!ENTRY org.eclipse.jst.jsp.core 4 4 2005-09-20 15:50:46.402
!MESSAGE JavaPosition was null!10780


A bug report had been filed about JSP validation and the OperationCanceledException. And another one that seemed to be related to the linear issues with the WTP. What was I to do? Wait? Hell, no!

I reevaluated my situation. Clearly, with the way development worked, all I really really (truly madly deeply) needed was some syntax highlighting for these long tedious convoluted servings of spaghetti and tremulous tofu. So, I didn't really need the WTP. I could wait till they got their act together. All I wanted was good old simple fast Eclipse.

So I began uninstalling the packages. The new "Product Configuration" management console in Eclipse was neat. You could manage plugin and feature installations and updates from here. No more shutdown-delete_files-restart. Think RPM with a nice GUI. The only downside was that some folders and JARs got left behind. Did I say "only"?? Still, it was better than going in blindly all guns blazing. Goodbye WST. Goodbye JST. Goodbye EMF. Goodbye GEF. About 218 folders (and contained files) and JARs later (and after a "-clean" run), I snagged Colorer Take-5, set up some "File Associations", and was merrily editing JSPs at regular speed. Sure, there was no code completion, opening brace/closing brace matching, no way of knowing if the code was fine until deployment. Potentially more round trips. But at least I would be doing something instead of staring at purple morphing into white bands and looking about with embarassment making sure no one was walking about -- can't have people stop and laugh at you for your conviction in a tool that clearly didn't seem to be doing the job right.

Tuesday, March 01, 2005

a bilefull of laughs ... with a strong ring of truth

For any developer (being in the Java/J2EE space will guarantee better results) in the know about TheServerSide, Hani Suleiman's BileBlog should offer excellent reading, in general. Hani transcends new heights today with a worst-of-TSS-posts entry. And while you're rolling down the aisle hurting your rollicking gluteus, take a look an older post that hurls boulders at developers who seem to represent the worst of the lot that has lost all respect for their primary language of communication. I stand by him on this one: I've seen way too many examples of people suffering from unableToTranslateThoughtsToCoherentSentences-itis.

Thursday, February 03, 2005

names! names! names!

The college formerly known as COEP and briefly notorious as PIET has now reverted to its original name. No such luck with Prince Roger Nelson/Christopher/whatever.

Java Development with Ant uses an illustration of an inhabitant of Goa (which is a region on the western coast of India, south of Bombay.). The errata [PDF link] includes a note for "about the cover illustration": The city of Bombay is now officially called Mumbai.

Thursday, June 03, 2004

corporate bloatware, nominal equivalents

I am about to throw in the towel on IBM/Rational XDE once again. I like software engineering and acknowledge the importance of UML in OOD, and all the power that XDE can offer a developer (two-way synchronization between model and generated code is a big plus). But, the experience of using XDE has been unpleasant for the most part. The first time I tried to use it it would die randomly, and leave zombies running (complete with truncated 6~1.3 filenames in the process list). That Eclipse sits at the core is some encouragement, but the tool suffers from every flaw that identifies corporate bloatware. It's huge and complex, and is not quite intuitive straight out of the box. There's a complete lack of useful and current documentation (tutorials, even if they are discovered deep down in the cavernous set of hyperlinked files, are out of date). Dialog boxes fail to pop up, and some features no longer exist (that you cannot apply the Core J2EE Patterns anymore is a huge minus). First your company (there's no way a sane individual would shell out so many $$$ for this, is there?) drops a Godzilla poopload of money to purchase this chaotic piece of inflateware. Then you have to pay for documentation. And training. And even then there always the sense of missing out on something. I might lean more towards building up a development infrastructure from smaller components. Gives you a sense of plug n' play, and does not leave you locked into the tool. Oh, and did I mention that the codebase reveals a hotchy potchy marriage of Java and COM Automation. Talk about completely tying you down. I hope they use "Iron Maiden" as the codename for the next release.

My Japanese name is Gennosuke Chikamatsu.
Take The Kawaii Japanese Name Generator today!
Created with Rum and Monkey's Name Generator Generator.

Friday, January 02, 2004

search clustering

back in school, I had worked on a project exploring different approaches to clustering search engine results. nothing revolutionary happened (no startup, no IPO, etc etc). Now, there's a new clustering interface out there. It's called Mooter. and my favourite little test search (python) yields results that strike a heavy riff of déjà vu. {courtesy: researchbuzz}

Thursday, October 16, 2003

the standards of commercial documentation

I've been playing around with version 9.0.3 of TopLink, a commercial O/R mapping persistence tool sold by Oracle (a licensing cost of about $7,000 per processor). Oracle bought TopLink from WebGain
(see also: origins of WebGain). Oracle currently (release 2 aka 9.0.2 or 9.0.3 -- the confusion somehow translates into more sales!) ships TopLink as a separate CD in the Oracle9iAS pack (the new 10g promises integration of TopLink into both Oracle9iAS and JDeveloper). I've been having a mixed experience with the Oracle Suite of Acquired Products (Oracle9iAS, JDeveloper, TopLink), and although my little test application using the developer preview of JDeveloper 10g (aka 9.0.5.1375 formerly ka 9.0.4), the first to provide some level of integration with the TopLink Mapping Workbench was a minor success (the strange documentation notwithstanding), I hit a small roadblock and went after the Javadocs for TopLink. Lo and behold! Bad javadocs. The page in question describes the XMLProjectReader class. Note how the parameters described do not match the method signatures. Given that there are so many fairly mature tools to automate most of the process of creating and compiling javadocs, I don't really understand how this can happen. Did this ship straight from WebGain and get shipped out again without as much as a cursory glance? I'm itching for the day when I can test the persistence frameworks in the public domain like Hibernate and implementations of JDO. Any $$$ saved in the process can compensate for any "extra" hours of learning with the lack of documentation (which is the same as learning with the overabundance of useless documentation). And any $$$ saved after all that can be safely donated to these worthy causes. No valid arguments for commercial bloatware come to mind. In the meantime, suffer in silence while the higher-ups dish out the dead presidents. Sigh!

Wednesday, October 15, 2003

misclynx (of a technical nature and then some)

python is a time bomb (in a good sense): "You didn't really mean to write it in Python, you say, it just happened." | open-source projects have a better sense of humour than corporate bloatware sites. case in point, nude pictures on the MiddleGen site | jon udell discusses software reuse, patterns and antipatterns (Dilbertian design patterns ... In the old days, we used to just call these 'bad ideas') ... and also revisits Nigerian spam with birthday greetings | time to link to ray ozzie's much-cited recent blog post on saving the browser (ref: the Eolas lawsuit against MSFT) | and another lesson in commenting code | using an agile software process with offshore development

{from The Guardian}:
The Catholic Church is telling people in countries stricken by Aids not to use condoms because they have tiny holes in them through which HIV can pass - potentially exposing thousands of people to risk.

The church is making the claims across four continents despite a widespread scientific consensus that condoms are impermeable to HIV.
... The WHO has condemned the Vatican's views, saying: "These incorrect statements about condoms and HIV are dangerous when we are facing a global pandemic which has already killed more than 20 million people, and currently affects at least 42 million.".

Friday, September 26, 2003

upside peter, imaginary book list and more

Apparently many of us are incapable of figuring just how incompetent we actually are ...

Jarno Virtanen has a wishlist of imaginary Python books (call it a wish-wishlist if you will).

Friday, August 01, 2003

ODD

Attended my first ever Oracle Developer Days session yesterday at the Grand Hyatt in Buckhead. The session and the nourishments were free, which meant a whole day of fun and good free food (personal note: three Häagen Dasz chocolate bars are bad bad bad!). There were five presentations followed by a series of matching labs, with timely snack, lunch and bathroom breaks. Very useful and a lot of fun.

The highlight of the day was being able to preview the upcoming release of JDeveloper (9.0.5). This new release is worth most of the wait. The current release (9.0.3.1) was a good step forward but has a lot of annoying features (bugs) and sorely lacks several useful developer-friendly features that made me miss Eclipse. Here's a list of what I could uncover:

* Auto-popups to add imports (one of the cool features in Eclipse)

* A set of options to configure Javadoc comments, code structure and error markup (did they integrate Jalopy or try to supersede it?)

* Improved diagramming options with support for UML activity, sequence and use case diagrams

* Thumbnail view for UML modelling

* Wizards for profiling software metrics

* Templates to customize the IDE on an application-to-application basis

* Support for deployment to Tomcat and JBoss

Wednesday, July 23, 2003

to be honest

Windows XP and its associated runnables are flooded with "user-friendly" information, which, most of the time, ends up as an annoyance. Just noted one little tooltip that could prove to be a good exception: I was naming a new folder, when I accidentally hit shift and the '8' key on the keyboard. This would have given me a '*' in the filename, an invalid character. The system did not process my input and a friendly little sober-coloured tooltip (with an enhanced raster shadow) popped up informing me that a filename could not contain the following characters: \/:*?"<>|. Quite useful -- unless you hadn't realized that you had hit the wrong key!

The Oracle Containers for J2EE (OC4J) has been a faithful pain in the rear end. It is another example of Oracle acquiring technology that they can't maintain [There's a related discussion thread on TheServerSide]. The documentation is shoddy, packed with errors, and inconsistent. The rate at which Oracle fixes problems that have already been resolved in existing application servers is appalling. And the product does not match up to all the hype. I have been scouring all the public forums (newsgroups, OTN) in the last several weeks on numerous occasions to find people similarly afflicted. A very popular strain of posts seems to be "why can't I do [something supported by the standard, or other existing application servers, or both]?".

Oracle also seems to revel in dishing out tools that compete with each other for destruction. OC4J requires its own deployment descriptor (which is a souped-up version of the Orion deployment descriptor) and JDeveloper insists on creating one for you -- except it messes it up most of the time, especially when you move beyond simple kiddie code.

The IDE also provides Class Wizards that allow you to do crazy things like add the same field to a class twice (errors appear only when you attempt to compile). The IDE provides a "Sample Client Wizard" that will generate a sample client for a business bean. The downside is: you cannot name the file at creation time. So if you create more than one sample client for a business bean called BooBean you end up with files like BooBeanClient.java, BooBeanClient1.java, BooBeanClient2.java. Anyone with a modicum of understanding of good software engineering will tell you that these are bad filenames. How ironical it is to hear Oracle scream to the rooftops about employing best practices in their J2EE tools and products.

The IDE has an EJB wizard which allows you dialog-based access to the properties of beans described in the standard ejb-jar.xml. If you use a SCM tool that leaves your local source file copies in read-only mode unless you explicitly check them out (a strict boo-boo, but the sad truth is they're out there!), then you will have two kinds of issues with this wizard: (1) If any action you take modifies files that are read-only, the Wizard will not complain about not being able to write to them. This is very very dangerous, especially if you forget to check out any files that could potentially be modified (NOTE: Anyone working in the J2EE space will know that this is not a trivial thing to do!). (2) As you move through the items in the dialog, the Wizard will pop up warning message boxes (badly designed) telling you that a certain file is not writeable (Talk about bad timing!). And this is even if you haven't modified anything!!! And if you think you can click 'Ok' and proceed, let me tell you that you are sadly mistaken. The only way out is to restart the wizard.

{For more background information and prior rants see helpful error messages, the bear called documentation, on the masochistic tendencies of bloated corporate software, the oracle of patience}

Wednesday, June 25, 2003

i18n java

If the hindi/urdu literary world were to focus its attentions on java and all things thereof, would jar files be referred to as martabaans and enterprise archive files as kaans?

Friday, May 23, 2003

the duke turns 8

Not the swaggering taciturn sardonic John Wayne, but Duke, a software agent that soon became the mascot for the hottest language around, Java. Technically, Java turns eight today. Didn't find any link on the Sun pages though.
friday feeds {Aside: How I wish this could be automated!!}

Served up piping hot: a selection of articles from all the feeds I read (when I get some time off work, of course)

Write and Get Fired (being a link to an account of one librarian fired from being a Google Researcher) | Prime Numbers in Python | Tim Bray on the Death of Scholarship (...when students are asked to look up something relevant to their academic work, 45% of them go to Google, 10% of them go to the local library catalog, and the rest scatter among other search engines...) | Whitespace is a language that works on the following principle: Any non whitespace characters are ignored; only spaces, tabs and newlines are considered syntax (PS: note the date of the posting)
 
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.