Computing

You are currently browsing the archive for the Computing category.

Dojo Version: 0.4.1

In the previous few months, I was using Dojo to develop one application. The reason that I chose at that time is due to the beautiful widgets provided by its framework. In fact, I don’t know dojo also provide many utilities which facilitates the development on the web interface. In my application, I made use of several widgets, like ComboBox, FilteringTable, TabContainer, ContentPane, LinkPane, Button, FloatingPane and Tooltip, etc. Besides the widgets, I also make use of its dojo.io.bind and dojo.event.connect service.

Widgets - Ease of Use

TabContainer

Dojo provides a lot of widgets. At least it satisfies what I want. The first widget that I want is the TabContainer. It provides nice layout in navigating between pages. However, this widget got a very important problem, it limits the height of the block. For webpages, we always set the height in percentage so that we expect the page can heighten when it is long. Nevertheless, by setting height: 100% to the style, it renders to be the height of the current browser view, the block does not heighten automatically.

TabContainer

ComboBox

Another widget that I always use is ComboBox. It enables end users to type part of the text and the web will provide a list of matching entries. Here are the problems I face. The first one is about support on IE. This widget is not in a good condition when using in IE. It easily lose focus when pressing backspace or after switching window. My user always complain why the whole page loses when pressing backspace. Then I will tell them the reason is the backspace triggers the “Back” function of the browser.

Besides, a suggestion on ComboBox should be eliminating the limitation on prefix search. I did see some ComboBox like implementation in a commercial framework like can do that. It should not be a big performance issue to Javascript either.

ComboBox

Performance

Besides the availability of widgets, performance is also a major issue for AJAX frameworks. In fact, I did not perform any specific testing using any tool on Dojo. So, my saying here may be somehow subjective. However, what I say is based on its framework design.

In Dojo, if you want to use Dojo widget, the browser will load a lot of js, css files. If your web application is not designed well, it will load the same set of files again and again, which consumes time and network bandwidth. In my application, the performance is still good for local network. Nevertheless, it is quite slow when connecting from home through the Internet. Sometimes, the browser is even hanged.

Also, the size of these files are quite large compared with other frameworks. I know Dojo community is always doing the compression to make file size smaller, but it is not enough yet. Hope this becomes better in the coming releases.

Other Problems

There is one problem on the support of different browsers. I focus on supporting Firefox and IE. For Firefox, all things are good because we have Firebug to help, and Dojo it tightly integrated with the debugging function of Firebug. However, IE support is really not enough. There are many strange debug messages when using IE. I can’t find where they come from.

Also, the most serious problem is that my IE will crash if I use my system for some time. This doesn’t happen in Firefox. Google Search gives me some hints about the issue, which says that if we open a lot of widgets in IE, the memory control will get into problem and the browser will crash. Really serious…

Summary

Even I have faced so many problems in my development, I still think Dojo is worth to use in development. The main reason is that Dojo is only in a beta version now. The more stable release 0.9 M1 is released when I am writinig and 1.0 will be released soon. The architecture is totally re-factored, I believe the Dojo community will work out a much better solution to the problems I faced.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

Mashup, a term suggested to be part of Web 2.0, means integrating services and contents from different web sites to provide your own website. A common example we can always see nowadays, is website makes use of Google Map to show where their users and businesses are located.

The web is now blooming in a very fast speed. With the introduction of Web 2.0, includes the use of AJAX, many people around the World are developing applications much easier. Quite a lot fantastic ideas in the old days become real and appear on the Web. Despite this, ONLY one group of developers still cannot do much, so people starts to collaborate.

By using Web Services and related technology, they start to exchange information in a raw XML format. Mashup then comes out. Mashup mainly are websites that retrieves the information above. Transferring XML format is brilliant since the service provider only aims to provide content. The service receiver can then fit the data to their own design. From this approach, even the end-users are viewing the same news feed, they can choose different layout from various websites according to their own preference.

An article by Sun is talking about Mashup
http://java.sun.com/developer/technicalArticles/J2EE/mashup_1/

ProgrammableWeb collects many Mashup website

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

Since learning about AJAX from Shan Shin’s JavaPassion course last year, I have tried several AJAX Frameworks in testing environment and have already made use part of them in production application. These frameworks always lead me to dead end. Most of them are not mature enough, and each of them do have something better and worser.

Here, I would like to make a comparison between several frameworks that I’m really interested in, and probably make use of them in the coming projects. (You know? There are probably more than 100 frameworks available, both commercial and open-source. I guess no one will have time to investigate one by one) Let me first list them out.

Dojo
This is the first framework that I learnt and made use of. It is developed by a group of web application developer, and most of them are well equipped with web technology skills like Javascript, DOM, etc.

YUI (Yahoo! User Interface)
Shan Shin’s course didn’t mention about this framework at the time being. The reason that I know about this comes from Dojo. Many people complains Dojo is slow in terms of performance, and I know some of them switched to YUI due to this reason.

GWT (Google Web Toolkit)
Yet another framework that is developed by big IT company, but this one is not an open-source framework. It provides API and guidelines to help you developing applications.

ZK
Sourceforge.net #1 AJAX Project. I have noticed this framework long time ago, saying that creating AJAX applications without Javascript. This will also be covered in Sang Shing’s course in the coming few months.

In the next part, I will be continuing on the topic by providing table of information.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

Just found a book introduction from TheServerSide.com

This book explains the concept of JPA, with some useful knowledge on the persistence standard, JPA Annotations, Entity Manager and JPA Query Language (also known as EJB-QL), etc. There are examples, and a simple Maven 2 application with MySQL Database, and Hibernate as the persistence provider will be build after reading through the book. I hope this will be useful for my development using JPA.

Post on TheServerSide
JPA101 Chapter
Author: Chris Maki’s Blog
http://jroller.com/page/cmaki

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

I want to import data in an Excel file into MySQL table. MySQL tools like MySQL Query Browser does not provide such function. There are sharewares on the web which provide this function. Instead, you can use function that already provided by MySQL, easy and quick solution.

First, you need to export the data to csv file. Remove any csv headers from the file. After that, run the following script in MySQL Console:

load data local infile 'uniq.csv' into table tblUniq

fields terminated by ','

enclosed by '"'

lines terminated by '\r\n'

(uniqName, uniqCity, uniqComments)

This script loads the file uniq.csv from the local file directory, and imports to table tblUniq. It tokenized the field by terminator, and enclosed all fields with specified character.

In using this script, you need to take care of the special characters in the fields. When exporting csv, if one of the fields got a comma, this field will be enclosed by ” as well. It will cause conflict with the above script. So, to solve this, put your csv file into a Text editor and do some customization before using the script. For example, use “|” instead of “,” for the terminator, etc.

Reference here

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

These days I have a very good experience on installing a CA-signed certificate to our Faculty server. I found that it is much more complicated than a self-signed certificate that I used before. There are lots of formats, types and others things that arouse my concerns during the installation. Let’s walk through some of these.

Before my work, the Faculty of mine bought a certificate from a CA named GeoTrust (which also refers to Equifax). The certificate from this CA has already been installed in more than 90% browsers nowadays, so it is quite a common one compared with those like Verisign and Thawte. That certificate bought is used on one Apache HTTP Server, and my work is to install it to Apache Tomcat on the same machine.

For the usage in Apache HTTP Server, there are two files, which are named like mycert.crt and mykey.key. These two files are the public key and private key respectively. I don’t know what format they are, but I can’t use either of them as the keystore provided to tomcat. Tomcat will throw javax.net.ssl.SSLException and saying that: No available certificate or key crresponds to the SSL cipher suites which are enabled.

After that, I sent an email to the support and asked for help. The guy there provide me a way to go, which is to convert the certificate to the format that Tomcat can use. The procedure is like this:

1. Run the following command to create a keystore named “mycert.p12″ with an alias “tomcat” inside (The alias must be “tomcat”, as it is recognized by Apache Tomcat)

openssl pkcs12 -export -in mycert.crt -inkey mykey.key -out mycert.p12 -name tomcat -CAfile GeoTrustRootCA.cer -caname root -chain

Where GeoTrustRootCA.cer’ is the GeoTrust Root CA available for download here: http://www.geocerts.com/support/roots.php , ‘mycert.crt’ is your current ssl certificate, ‘mykey.key’ is your current private key.

For the GeoTrust Root CA, either Base-64 and DER format can be used. There is no difference after all the works.

2. After running the command, it will ask you for the password, typed in “changeit”. Oh, why “changeit”? Actually, the password is up to you, but it is used by Tomcat to access this keystore. If you used other password, you have to explicitly provided in the Tomcat configuration, which we will talk in Step 4.

3. The keystore named “mycert.p12″ is created, it is a X.509 certificate with PKCS#12 format. The format is different from the self-signed certificate created by “keytool”, which is JKS (Java KeyStore)

4. Configure the Tomcat server to switch on secure connection as usual with some additional settings as below:

You then have to specify Tomcat that the keystore is in pkcs12 format by inserting keystoreType=”pkcs12″ in the ssl configuration, also the keystore location pointing to where mycert.p12 is located.

After configuring this, the SSL should be ready using this CA-signed certificate.

Remarks:

There are still some questions that I didn’t solve, which are all related to the command used in Step 1. Some of the options like “-caname” and “-chain” are still unknown to me. Perhaps, someone can give me an answer.

Reference:

http://tomcat.apache.org/tomcat-5.5-doc/ssl-howto.html
http://www.geocerts.com/support/install/install_tomcat.php

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

One of the major change for this 2.4 version of web.xml is the ordering of tags. As the use of XML Schema provides the flexibility on the ordering of tags, you can put the tag in any ordering as you like.

Besides this, one another change is the use of tag library. Starting from 2.4, we have to surround all <taglib> with a new tag <jsp-config>, as required by the mechanism of XML Schema, like the following:

<web-app xmlns=”http://java.sun.com/xml/ns/j2ee”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=”http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd”
version=”2.4″>

<description>StrutsTest</description>

<jsp-config>

<taglib>
<taglib-uri>http://jakarta.apache.org/tomcat/debug-taglib</taglib-uri>
<taglib-location>/WEB-INF/jsp/debug-taglib.tld</taglib-location>
</taglib>

</jsp-config>

</web-app>

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

Learning EJB-QL

Seems that there is still not much resource on Java Persistence, which is included in EJB3. If I want to learn more about EJB-QL, the only way is to look at the resources of EJB2.1. The articles may not be updated, but most of the contents still apply.

However, I found one EJB-QL that is in the spec. seems not supported by most of the vendors, which is OFFSET and LIMIT. I found some articles on people asking Sun about the issue, but no one answers. Then I do a search on Google, and only found Resin which supports it.

These keywords are used together to limit the number of entity instances returned in a list, especially useful for entity storing up to ten thousand records. Your memory size must be a main issue by then. Actually, it is just similar to the ROWNUM functions provided by Oracle, but don’t know why so few vendors implement such a useful function.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

When I am thinking using autoReconnect will resolve the disconnection problem, a new error comes to me.

java.net.SocketException
MESSAGE: Software caused connection abort: recv failed

This error appears in occasional case, but also after a long hours of idle. I used Java Persistence to connect mysql. Today morning, when I was back to office. My application seems fine when doing the querying functionalities. However, when I used persist() and merge() operations which updated the DB, this error occurred.

Someone said this also the same problem as previous, which MySQL disconnects the connections after idle for 8 hours, but I am amazing that the error only throw for updating operations. Is it mechanism for Java Persistence, since it can store part of DB details in memory, so it didn’t actually query the database?

Reference:
http://forums.mysql.com/read.php?39,55337,95721#msg-95721

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

These days, this exception always occur in my new developing application using persistence, especially on the morning when I came back to office. At the beginning, I think it may be due to the use of Java Persistence. However, when I do a search on Google, at the top of the list, I got this post:

http://www.yannicafe.info/wp/2006/11/25/53.html

This post describes the case in detail. It is due to the mechanism of MySQL, where this DB will disconnect all the active connections after 8 hours if there is no activity. After that, if your application try to work on some activities, the above exception is caused.

Normally, the exception should be caught in the application, and direct to a reconnect logic. However, the persistence provider (Oracle TopLink) that I am using does not provide auto reconnect function. So, I need to change the connection URL to the following:

jdbc:mysql://localhost:3306/test?autoReconnect=true

This allow the application to auto reconnect in case MySQL disconnects all the connections. Nevertheless, the bad thing is that  this is not recommended by MySQL community and this parameter may even be removed from future versions of MySQL.

Reference:
http://forums.java.net/jive/thread.jspa?messageID=189962

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

« Older entries § Newer entries »

 

January 2009
S M T W T F S
« May    
 123
45678910
11121314151617
18192021222324
25262728293031

Categories