Author Archive

A JScript / VBScript Regex Ugly Bug

 

Here’s one of the oddest and most significant regex bugs in Internet Explorer. It can appear when using optional elision within lookahead (e.g., via ?, *, {0,n}, or (.|), but not +, interval quantifiers starting from one or higher, or alternation without a zero-length option). An example in JavaScript:

/(?=a?b)ab/.test(”ab”);
// Should return true, but IE 5.5 – 8b1 return false

/(?=a?b)ab/.test(”abc”);
// Correctly returns true (even in IE), although the
// added “c” does not take part in the match

Read the rest of this entry »

Development diary #1

I thought that I’d be sharing some of my experiences developing my Java based blog now that I have progressed slightly.

First I have to tell you about Hibernate it is just so wonderful tool. In short it is a framework for persisting data to database. In long, it really shaves off some of the less delightful aspects of database coding. Depending on your database structure you don’t have to write single statement or either have to but much lesseraspect than in purely JDBC-way. I had some initial trouble to get it up and running but that was my own hindsight in creating proper database structure. That was not too big surprise taking in to mind that I were really green on Java and sql when I initially conceived this blog project. Experience comes with time so to say..
After producing consistent database structure with foreign keys and indexes and what-not. I got my Hibernate mapping working and it was time to code some DAO layer to project. Now I have proper DB layer and DAO schema implemented, this means that I can now easily query stuff from database from business logic layer by only calling DAO’s with something like:

Session session = null;
Transaction tx = null;
PostsDAO postDAO = null;
try{
postDAO = new PostsDAO();
session = postDAO.getSession();
tx = session.beginTransaction();
Post post = postDAO.findWithID(postID); // get post with postID
//or something like
List posts = postDAO.findWithinMonth(date) // where date on java.util.Date, gets posts that were published on same month
//or like
List posts = postDAO.findWithDate(date) //get posts that were published on exact date

Then I can just for example add the post or list to Frontpage class that contains values like

- Sidebar, contains sidebar menu items
- Posts, contains posts
- Footer, contains dynamic footer objects
- Header, contains dynamic header objects

Then I’ll just set frontpage as request parameter and get the stuff on on the .jsp using jstl.
Nice, clean and structured. Also when inserting rows to database Hibernate comes very handy, for example if you have some tables like:

-Post
-Category2Post <- this being relational table to map many-to-many relationships
-Category

And on code side you have couple hibernate pojos portraying those db tables, namely, posts, category2post and category. Hibernate can automagically insert stuff to middle table if you do something like this:
When inserting new post you have fetched post related stuff from form or struts action form or etc..
So you have Post post = new Post();
post.setTitle(title_of_the_post); or smtn..
.
.
.
Then you usually have some Map categories2post map on your post bean, as in this case our post supports multiple categories.
So then you just create new Category2post
Fetch category by categoryID from db and category2post.setCategory(Category)
category2post.setPost(post);
and post.addCategories(category2post);
after this you can save this bean using postDAO
postDAO.saveOrUpdate(post);

Read the rest of this entry »

Jaxcent,”AJAX in Java” for the Internet Released

A Java API for accessing and modifying the DOM

 

Desiderata Software has released Jaxcent 2, a freely available Java API for accessing and modifying Document Object Model (DOM) of browsers.

Version 2 is an unrestricted Java API for doing full-fledged AJAX operations. It can be run on the open Internet instead of being restricted to intranets. The Java of Jaxcent now runs on the server side, and still gives Java programmers full control over the client’s DOM hierarchy. On the client side, all that is required is to add a single JavaScript include statement to existing HTML content, then the resulting page can communicate with Jaxcent on the server.

On the server side, Jaxcent works with standard Java servlet containers and provides classes that correspond to elements of the Document Object Model (DOM), and that can be instantiated to match HTML elements existing (or dynamically created) on the page. These classes provide methods for interacting with the HTML elements, and for receiving events originating from the HTML elements, all in Java. In addition to dynamic interactions with the HTML elements, Jaxcent also provides access to the session and application context, as well as entirely automatic session data management.

You don’t need to rewrite existing applications to take advantage of Jaxcent. Using Jaxcent, as needed, one or more AJAX features can be added piecemeal to one or more pages without any need to modify the structure or specifics of the overall application.

Jaxcent works with AJAX capable browsers, such as Internet Explorer 6, Internet Explorer 7, and Firefox. Jaxcent is written entirely in Java and JavaScript, and therefore is operating system independent. Jaxcent programmers do not need to work in JavaScript. Jaxcent will work with any existing JavaScript code, and it provides features to take advantage of JavaScript if desired, but primarily Jaxcent programming is all-Java and no-JavaScript programming.

Read the rest of this entry »

Free Java Games

 

Mobile Fighter v.1.1.0

Version: 1.1.0
Type: Freeware
Added: 2005 Sep 7
Updated: 2007 Aug 13

Download to PC:
JAD file (MobileFighter.jad)
JAR file (MobileFighter.jar)

DangerousSpeed v.1.4.0
Platforms: Java (J2ME)
GetJar Rank: 18 [view graph]
Version: 1.4.0
Type: Adware
Added: 2008 Feb 7
Updated: 2008 Feb 7
User rating: 9.00

Read the rest of this entry »