Wednesday, November 21, 2007

AccessDataSource & SqlDataSource

I used AccessDataSource tag in ASP.NET to connect a Microsoft Access Database, accidentally found this weird problem. The code is like this:

This code having no problem on localhost IIS server, but when I move it to my web hosting, it return "Access Deny to Database" kind of message.

So, I was thinking what wrong with this code? Then I find Mr. Google and saw this:
"The AccessDataSource will not connect to an Access database that is password-protected; to retrieve data from a password-protected Access database, use the SqlDataSource control."

Ei, but how come localhost manage to run it? Not understand. But, I guess I just need to use SqlDataSource in stead, problem solved, question remain unknown.

Monday, November 19, 2007

Microsoft ASP.NET 2.0 Vs Java Apache Struts

Hehe, another Microsoft & Java comparison.

Overall, both of them having a quite complete framework which let developers easy to develop web application.

ASP.NET 2.0 & Apache Struts framework comparison:

1) .NET Master Page = Struts Tiles Definition (Something like layout)
2) .NET Theme & Skin, Struts don't have this feature. (Store all the images, css in one place, make it easy to change from one set to another set)
3) Struts URL remap from .jsp to .do, .NET don't have this feature. (The jsp file for http://www.abc.com/index.do can be store at //server-root-path/somename/main.jsp, outsider won't know where is the exact location of the jsp file)
4) Struts Business Logic & Presentation Layer Separate, .NET don't have this feature. (Business logic centralize at Struts Action, separate from presentation layer which is the jsp, jsp only use to display selected data, all the logic on select what data out program at Struts Action)
5) Both have Resources for localization.
6) Both have Pre-compilation, create a cache copy on the server, let user open a website faster.

Secondly is the software use for web development:

1) Microsoft ASP.NET 2.0 - Microsoft Visual Studio 2005 (NOT FREE) or Microsoft Visual Web Developer (FREE) + Microsoft .NET Framework 2.0

2) Java Apache Struts - Netbeans (FREE) or Eclipse (FREE) + Struts plug in

Thirdly is how easy to pick up these new framework:

1) Microsoft ASP.NET 2.0 - I find it quite easy to learn. There are a lot of online resources available to view or download. I like W3Schools the most, all the basic information can get from there, easy to understand also.

2) Java Apache Struts - I find it hard to learn. There are too many things to handle for create a single page, struts-config, tiles-definition, application-resources, Action, Form & jsp 6 things. I took quite some time to pick up this framework.

But the way, I still haven't fully discover all the .NET features, I might miss out some important features on .NET. Overall, I like .NET, it is easy to learn.

Thursday, November 15, 2007

Java Class Cache Problem

I found this cache problem during my development. Example of how this problem can be happen:

If these two java files compiled into class files previously, then we might need to be careful when changing the "planId" constants value. The problem happen when we change the "planId" value to some other value & only compile the Constants.java file. In this case, Main.class file still refer to previous "planId" value which is "999".

So, the best solution is to remove all the classes & compile all java files again which we called it as Clean Build.

Thursday, November 8, 2007

"div" Tag

I facing a lot of problems with "div" tag in IE browser, I just wondering is it IE not understand this tag or they don't want to understand this tag.

Just fix a small bug on IE browser which they don't understand "whitespace: pre" CSS under "div" tag, I use "pre" tag then the problem solve.

pngfix.js

Recently facing some problems on PNG transparent images in IE6 browser. The solution is include this javascript:

It seem like this javascript is quite common in used when I try make a Google search. This script change all the images object in a web page to span object and calling a Microsoft library to make PNG images transparent.

Only need to do this on IE5.5 & IE6.