Home

Mon, Jun. 23rd, 2008, 04:47 pm
Tumblr

Dear only reader, :-)

Since I never have the time/patience to blog, I'm starting a "tumblelog" at Tumblr.com:

http://dserodio.tumblr.com/

Let's see how that works out.

Thu, Jan. 4th, 2007, 12:05 pm
Java 6 gotchas - #1

I'll post some Java 6 gotchas here as I run into them, because I'm getting worse at remembering these kind of details.

Gotcha #1:
Apparently, javax.xml.parsers.DocumentBuilder#parse(String uri) from Java 5 accepts a filepath like "C:\temp\foo.xml" (which is not a valid URI) while in Java 6 it doesn't.

This problem manifested itself when I tried to run DbWrench in Java 6.

Thu, Aug. 24th, 2006, 09:20 pm
How to branch with Subclipse

Nice advice on the subclipse-users mailing list by Mark Phippard
Easy way:
  1. Team -> Create Branch/Tag Specify URL to store it, and be sure to select option to create from working copy. Since your project is still on trunk after this completes, you have to do a Revert to get the project back to a pristine condition.
  2. Use Team -> Switch when you want to go back to the branch code.

Better way:
  1. Do Team -> Update on your project so that your entire working copy is updated to a single, known revision.
  2. Do Team -> Create Branch/Tag and create a branch directly in the repository using that known revision.
  3. Do Team -> Switch to swap your working copy to the branch. Since it was already based on that revision, this will be quick and simple.
  4. Do Team -> Commit to commit your changes to the branch.
  5. Do Team -> Switch to swap back to trunk.

Why is this "better" when it is so many steps? It separates the creation of the branch from the commit of your changes. This makes it easier to create a patch with your changes, or to later merge them back to trunk. The "easy" method is fast and simple way to stash your changes but it will be harder to later reintegrate those changes to the trunk.

Tue, Aug. 15th, 2006, 05:55 pm
file:// URLs and Winblows

Just came across this "snippet of wisdom" in the Maven users list:
file:// defines the file protocol
file://localhost/ is the root adress on your local system
file:/// is the short form of file://localhost/
file://///server/share/ addresses the "share" of "server" in a Windows network, which is a convenient form of file://localhost/\\server\share\, since the path from your local system to the server's share is \\server\share

Got it? Any other mixture is a concession to user's habbits and may or maynot be supported by the URL parser of your product/app/browser.

Fri, Jun. 30th, 2006, 02:04 pm
No Callisto today

Damn! No Callisto today!
Callisto will be delayed for a bit. Unforeseen circumstances.Uncontrollable events. We don't have an ETA yet, but stay tuned forinformation. We do expect it to be released today.

Thu, Jun. 29th, 2006, 02:25 pm
Definition of scripting

What's scripting? How is it different from programming? The best definition I found is Ward Cunningham's: I'm interested in scripting as a style of programming instead of a style of languages. You're writing the program to serve YOUR needs, not somebody else's needs so there's a different set of trade offs. We get caught up in serving the needs of our customers that we forget to meet our own needs. (emphasis mine).

BTW, if you don't know Ward, he's the "Wiki father", and one of the greatest authorities on Design Patterns.

Fri, Jun. 2nd, 2006, 12:33 pm
Spring 2.0

I'd read about Spring 2.0 before, but I didn't like what I read. It seems to be moving away from XML-based dependency injection, towards annotation-based. Using Spring annotations in my classes would tie them to Spring, which I don't want, so I was pleasantly surprised when reading the (still-in-progress) What's new in Spring 2.0?:

  • Easier XML configuration

  • Extensible XML support

  • and
  • New bean scopes

.
It seems like they haven't got as annotation-crazy as I'd thought.

Mon, Apr. 17th, 2006, 03:13 pm
XML x Wiki x M$ Word x ???

Our projects' glossary is currently written in M$ Word. I really, really dislike M$ Word, for a bunch of reasons, mainly:

  1. It's expensive
  2. It's proprietary
  3. It's resource-intensive (aka uses a great amount of RAM)
  4. Binary document format
  5. Mixed content and presentation

Our organization has tons of M$ Office licenses, so points 1) and 2) are not so important. Our developer's machines are not exactly high-end, so point 3) is important. But the main problem is that the binary format is not RCS-friendly. The RCS can't diff two different revisions, ergo, can't automatically merge concurrent modifications.

The net effect is that M$ Word documents are often forgotten, because it's such a pain to modify them (in a collaborative environment, of course) that you often procrastinate. Our glossary is completely out-of-date, because no one bothers to update it.

This holds true for all kinds of M$ Word documents, but I decided to begin thru the glossary because it's the most dynamic (text) document we have.

These are the requirements:

  • Text-based (of course)
  • Open standard
  • Easy editing
  • Extensible

Last week, I investigated 4 alternatives:

AlternativeProsCons
Wiki Simple. Easy editing. Easy cross-referencing (hyperlinking). Only works online. Not really RCS-friendly (Trac has own RCS). "Loose" structure.
ReSTructed Text Simple. Very readableSyntax is not as easy as it seems. "Loose" structure.
XOXO Simple. Readable.Designed for ordered or unordered lists, not "definition lists" (a glossary is a special case of definition list).
XMLGlossSpecific for glossaries Specific for glossaries (won't work for other types of documents). License too restrictive
Today, I remembered about DocBook.
DocBook provides a system for writing structured documents using SGML or XML. It is particularly well-suited to books and papers about computer hardware and software, though it is by no means limited to them.

In theory, it seems like a perfect match. It has a whole lot of glossary-related elements. It's XML-based, so you can leverage your knowledge about XML. So now, I'm looking for DocBook tutorials, tools, anectodes, and glossary examples.

Tue, Apr. 11th, 2006, 09:50 am
Red Hat buys JBoss

So now the speculation is over. Red Hat bought JBoss. I don't know what Red Hat has been up to lately, so I don't understand what the implications are. After reading half a dozen "JBoss is evil!" rants, I ran across an interesting article by Timothy M. O'Brien. I'd never seen GPL as "bad", but this article makes a pretty good point about GPL x Apache license.

Mon, Apr. 10th, 2006, 07:15 pm
Servlet Security

Currently, we have a single Java web app running. This app's architecture is a mess, because the developer who implemented "the web part" had never done Java webapps before, so he used the only "model" he was used to: PHP.
As a result, there's a lot of business logic in the JSPs, which makes it pretty hard to test, and it completely ignores that its running inside a container.
The app's security uses a programmatic model, and is pretty badly implemented. The login page creates an "operator" bean and puts it in the HttpSession. Then, each JSP has a <jsp:useBean/> tag, which looks for this "operator" bean. If the session has expired, the result is a "InstantiationException: bean operator not found within scope" error.
The error page tries to differentiate between a "regular" error and a "bean operator not found within scope" error using javax.servlet.error.message, which is pretty fragile. The net result is that when the session expires, the user gets a cryptic error page and the app logs an ERROR which is not an error.
I have configured log4j to e-mail me all uncaught errors, which means I'm getting lots of e-mails reporting expired sessions.

I knew this implementation was bad, but the flood of e-mail has made me fix it now. In a (near) future, we're going to need a SSO solution, but for now, I'm using plain Servlet CMS; I hope it won't be too difficult to replace it when the time comes.

Wed, Jan. 18th, 2006, 10:47 am
Now we're talking!

Google has just announced they're going to federate Google Talk.


Currently, the IM world is like the e-mail world was some 15 years ago. If you had a Fidonet account, you couldn't email someone with a Compuserve account (and vice-versa). SMTP changed that, by routing the e-mail thru as many servers and networks as necessary to reach its intended recipient.


You see, Google Talk uses the XMPP protocol. XMPP was created by the Jabber open-source community, and it can be seen as the SMTP for Instant Messaging, since it implements the concept of federation, or federated identity as Wikipedia calls it. What this means is that you can use your @gmail.com account to IM someone with a @bigcorp.com account. The XMPP protocol is also a lot more network-efficient, because when you IM the guy across the office the message won't be routed all the way to (another country, in my case) the IM provider server.


Jabber users of the world, unite!

Tue, Nov. 29th, 2005, 05:57 pm
Mini-pattern

Just found this post about the "File/Stream Mini-Pattern":

Name: The File/Stream Duality

Context: Your API retrieves data from, or writes data to a file

Forces:

  • The naive approach is to have the API take in a filename, or a File object to work on.
  • Far too many developers believe this is sufficient
  • Unless the file is random-access, then in order to read or write to that file, you’re going to have to turn it into a byte stream.
  • One day, somebody is going to have a stream of bytes that is not a file, but that they want to pass through your API.
  • When that happens, this person will curse you, your parents, and the town you grew up in.

Therefore:

If you are writing an API that takes a filename, instead provide an API that does precisely the same thing to an arbitrary stream of bytes, and then add “convenience” methods that apply those stream-based methods to files.

I've came across this situation when trying to use my co-workers' Pulga (sorry, no link) Avalon container from inside a "One Jar", and Pulga couldn't open its XML config File. If it expected a Stream instead of a File, it'd probably worked straight off.

Tue, Nov. 29th, 2005, 01:39 pm
Spring and JSP

Our team is currently developing a Java Web application. I've just introduced them to Spring and Hibernate, so learning them both plus a web framework would be too much, so they're using JSP for the presentation layer, since it's closer to what they know (PHP, ASP, etc).

Today, they've asked me how can I access a Spring Bean from inside a JSP page?. Since I've never worked directly with JSP, I had to research a little. I found a good idiom for it in a post by mfisher in the Spring Framework Support Forums, which I reproduce here:

In general, you should minimize application code's awareness of the beanFactory. Dependencies should be injected in the service layer so that Controllers (Servlets) may use (or delegate to) objects loaded by the beanFactory. Objects may be returned to the view layer, but the views (JSPs) should not access the beanFactory directly to retrieve objects.

All that said, there are ways to access the ApplicationContext via the ServletContext. For using Spring in a web application, there is a ContextLoaderListener which is specified in web.xml as:

<listener>
 <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

That will look in the default location of: WEB-INF/applicationContext.xml.
For a different name or location, you need to add:

<context-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>WEB-INF/someOtherFilename.xml</param-value>
</context-param>

The ApplicationContext can then be retrieved via the static method:

WebApplicationContextUtils.getWebApplicationContext(servletContext)

The accessibility of ApplicationContext via ServletContext is primarily for the purpose of the framework itself, and as mentioned above following "best practice" design will reduce or eliminate the need to acces the beanFactory from within application code.

Fri, Nov. 18th, 2005, 10:42 am
Two cool Windows utilities

I've been using SciTE as my default text editor for a while. It's fast, small, doesn't need instalation (runs from a Pen Drive), and has configurable syntax highlighting and code "folding".
Last week I came across Notepad++, which uses SciTE (Scintilla, actualy) as the editor widget, and adds lots of features on top of it. It has a GUI for setting up new languages, which is very useful at this moment since I'm working with (ugh!) Clipper (xBase) files, which of course no "recent" editor supports out-of-the-box. It doesn't need to be installed either, and manages split windows, which SciTE doesn't. I've already made Notepad++ my default text editor for Windows.

The other utility I discovered is Console, which

is a Win console window enhancement. It was inspired by eConsole. Console features include configurable font, color, size, background image and transparency (on Win2000 and later)

It makes working with the Windows Command Prompt a little less annoying.

Tue, Nov. 8th, 2005, 10:47 am
Eclipse + Java quickstart

This page has a nice quickstart for Eclipse (or Java) newbies, including setting up Ant and Subversion.

Tue, Nov. 8th, 2005, 10:41 am
Eclipse 3.2M3 is out

Yeah, Eclipse 3.2M3 is out. Check the New and Noteworthy: the Hierarchical Problems View and the Filtering in Show View dialog are the coolest features IMHO.

After a long period of using Milestone builds, I think I'll stick with 3.1.1 thou, I'm tired of struggling with WTP and JBossIDE, and nowadays I use the XSD editor more often than the Java editor.

Fri, Nov. 4th, 2005, 11:07 am
Slacking again

Yeah, I've been slacking again. When I think about posting, I remind how long it's been since my last post, and the thought of updating it discourages me.
My friend Bruno has been keeping his blog enviously (yeah, I had to look this up on the dictionary) updated.
So I'll try a new approach: instead of trying to keep this blog up-to-date in some way, I'll just post "tidbits of wisdom" :-).
Let's see if it works this way.

Tidbit of the day:

XML Friends Network is a simple way to represent human relationships using hyperlinks. In recent years, blogs and blogrolls have become the fastest growing area of the Web. XFN enables web authors to indicate their relationship(s) to the people in their blogrolls simply by adding a 'rel' attribute to their <a href> tags, e.g.:



<a href="http://jeff.example.org" rel="friend met">...



I've used it to mark the link to Bruno's blog above.

Fri, Aug. 26th, 2005, 02:54 pm
Learning about RDBMSs

Besides GTD, I'm reading Practical issues in Database Management: A Reference for the Thinking Practicioner, by Fabian Pascal. It's a terrific book, and I'm getting more and more interested in Relational theory. His site has lots of great articles (free) and papers (paid).
After reading so much about "SQL confuses the logical model with the physical model", and that SQL RDBMS's poor performance have nothing to do with relational theory and that TRDBMSs were nirvana, I wanted to run some tests on HypersonicSQL.
I played with EXPLAIN QUERY FOR SELECT ... and the like. When I first learned about JOINs in my Database Systems classes, I learned to do natural joins using WHERE clauses, and NATURAL JOIN clauses, and I thought the difference between both were simply clarity and terseness. Since I was typing the queries by hand, I wanted to be as terse as possible.
Turns out, it doesn't support NATURAL JOIN syntax. Googl'ing, I found that it's a SQL92 feature. So I thought: since HSQLDB already supports JOIN syntax, it shouldn't be too hard to make it understand NATURAL JOINs! I added it to the top of my OSS patches To-Do list, let's see if I can give it a go. At the very least, I'll understand a lot more about RDMBSs.

Fact: Using JOIN instead of WHERE clauses for joining is faster on (the current version of) HypersonicSQL.

Thu, Aug. 25th, 2005, 03:02 pm
Change of course

So, last week I left my previous job. The reasons are not worth mentioning, suffice to say that I got tired of working my ass off to that lazy, amateur company, which shall remain anonymous.
Next week I'll start at PUC, which is the University I attended. Seems like really interesting work: they (we) plan to replace most of the current PUC's systems, because they're a 10-year-old-plus Clipper + Cobol + VB + ??? mess. Also, the department (APT) is being re-structured; they don't follow a development process, use source control or anything like that.
It'll be a great challenge, working with Clipper-minded dinassaurs, but it'll also be great fun, and I'll be working with some of the best professors I had, and a good friend (Diogo) with whom I've worked before at InterBusiness.


So, this blog is going to change a bit. I won't be struggling with Hibernate, but with some higher-level problems, abstractions and the like.
I'll try to keep this a little more up-to-date.


Ah, forgot to mention, I'm reading Getting Things Done, by David Allen, and I'm currently looking to buy the "file folders" he mentions so much, but I can only find the suspended-type folders. If I can't find them within a week, I'm gonna surrender to suspended folders.

Thu, Jul. 21st, 2005, 11:58 am
Folding in Eclipse WTP XML editor

Found this on the WTP newsgroups (sorry, can't find the URL):

to enable add -Dorg.eclipse.wst.sse.ui.foldingenabled in VM args. this adds an "enable folding" preference to the Structured Text Editors preference page which users can then enable/disable.

Note this is all still experimental, unstable.

20 most recent