January 2008 - Posts
One of the reasons I work is to help my parent. I love to show them how I love them and appreciate them in every little way I can. For 2 years that I've been working in this industry, I've been trying to help my father upgrade his PC everytime. He uses his PC to run his photo and video coverage/editing business while on the side, he's working as an entertainer(folk singer). It's quite amazing how my father still has the energy to work even now that he's at age 50. I'd like to make him happy by making an HTML website for him(this one will utilize dojo, rocks!) to advertise his business(which has been our bread and butter for several years) and supporting him with his music compositions.
I'd like invite you then to please listen to him sing his song on Philippine Radio at 102.7 Star FM from 12:15AM to 1PM, everyday from January 21 to Feb 22. The title of his song is txtm8.
Update (07/19/2010): After 2 years, I decided to create a Filipino Blog for my father. Please check it out! It's seldom updated by I try to add new contents whenever I can. You can also watch his YouTube videos there!
Note: In reading this post, please disregard for a moment the difference between an exception and an error. I mainly used the word error for convenience. Thank you.
Yesterday, I was given a tip by my team lead which I found nice and quite elegant to do so. Before, when I'm trying to catch an error I'm always tempted to do the following
[code Language="Java"]
if (true){
//doSomething
}
else{
//printErrorMessages
}
[/code]
But now, I try to make a subclass of java.lang.Throwable to catch Runtime Exceptions (like to check if a reference in my session or one of HttpSession object's attribute is null). I do it like this
[code language="Java"]
try{
//doSomething
if (someValue==null){
throw new ACustomException();
}
}
catch(ACustomException acex){
//printErrorMessage
}
[/code]
I personally find it neater than the previous method. How about you?
I was whining why RAD's automatic code(and browsing) completion for HTML and XML tag sucks. I approached my team lead and told him about it. I told him that Netbean's and Eclipse's WTP plugin did it way better. He smiled and told me to press CTRL + Enter and I got shocked in amazement. :)
While reading Bruce Eckel's article, Java: Evolutionary Dead End, he mentioned of another programming language which is somehow based on Java(and runs on the same VM) but has the feel and construct of a Scripting language(e.g. Ruby). I got interested and quickly searched for any related article and I found the following:
While it's still arguable if new things should continously be added to the Java language, I partially agree with Bruce Eckel. I think that the Java language should stop evolving in adding new features/keywords except for new API's. New language constructs should be left to a new programming language, and in Bruce Eckel's opinion, Scala. This is a better idea IMHO because we've already seen this done in other technologies like for example:
* C/C++ - Lua Scripting Languag(For game development)
* HTML - Javascript(thus DHTML)
* SQL - Procedeural Language
One reason I liked Java before was that it hardly ever changed during the past years(until Java 5). The same goes for C/C++(atleast for the last 7 years). Generics is a good addition to the Java language but other than that, I already feel like I have everything I need to do my job. I'm actually quite happy when JSP 2.0 introduced the "Expression Language". Rather than trying to make JSP solve the problem on its own, they introduced another language which is in the form ${myObject.member}.
Finally, since I'm no language expert. I am merely a user. Still I think bloating the language with unecessary features really makes me sick.
I've been fiddling with Oracle SQLDeveloper lately. What I liked about it is that it's free and second, it's an alternantive to M$ SQLServer. I think you could even use it for other RDBMS other than Oracle like MySQL and SQLServer. It's made in Java(rocks!), and there's an online tutorial on how to use it.
I didn't like PHPMyAdmin that much so if it's indeed possible to use this with other Database systems then I would defintely choose this app. One of the few notable features is its ability to export your data to several file formats like CSV, HTML, XML, etc. although I don't know if you could also do that with SQLServer Management Studio or PHPMyAdmin.
There's also a query builder(like in SQLServer) which allows you to drag tables and dynamically build a query based on the fields you choose and relationships you form.
I'm doing this in-sync with learning PL/SQL so this is just another great addition in my toolset.
While studying about Struts Tiles, I encountered the topic about definitions and inheriting from other definitions. For those who are not yet familiar with Tiles, a definition defines a tile or template. This reminded me of ASP.Net Master Pages which I learned during my stay with my previous employer. From
http://www.oreilly.com/catalog/jakarta/chapter/ch14.html, One who has used master pages and used tiles would quickly recognize the similarities in features.
[code Language="XML"]
<tiles-definitions>
<definition name="storefront.default" path="/layouts/storefrontDefaultLayout.jsp">
<put name="header" value="/common/header.jsp" />
<put name="menubar" value="/common/menubar.jsp" />
<put name="copyright" value="/common/copyright.jsp" />
</definition>
</tiles-definitions>
[/code]
When Inheriting from above code
[code Language="XML"]
<tiles-definitions>
<definition name="storefront.custom" extends="storefront.default">
<put name="copyright" value="/common/new-copyright.jsp" />
</definition>
</tiles-definitions>
[/code]
But ofcourse, this feature existed in Tiles and other JSP Templating Framework before it did in ASP.Net(as my ego tells me). With the advent of Portlets though(see WebParts for ASP.Net), I'm wondering how the acceptance of templating frameworks such as tiles would still be accepted and/or adapted by the younger generation of developers. Or perhaps, maybe, we could just use both at the same time. For now, I have to deal with this technology until our team decides that we use Portlets again in our development.
It's my first time to use SVN. It's funny how I first got acquainted with Visual Sourcesafe than this opensource tool. I think Most Java developers would typically get involved in SVN than VSS. But now though, I'm quite happy learning about SVN. It wasn't very hard to set it up with my IDE(RAD7/Eclipse), online instruction here. It was a little confusing at first(coming from the VSS background; where is the Set Working Folder menu? hehehe). I'll try setting up a local server for it at home so I could also use it on my personal projects.
One thing I noticed about it though... We currently have a local drive and a network drive. We were instructed to put our files on the network drive because it has a backup. However, when I tried Checking out on the network drive, the icons(status) didn't show up. When I tried checking out again on my local drive, the icons showed up. So I decided to use the local drive anyway since the source is technically, also backed up on the repository.
Note: I've done the following using Rad7 but should also be applicable to Eclipse(since RAD7 is basically made on top of Eclipse).
When you have total control of you web container/app server, deploying jar files is as easy as dropping the folder in your common lib folder. If you don't package your web apps as a war file then it's even easier because you only have to drop the jars in the WEB-INF/lib folder of your webapp. But if you don't have total control of your web server or application server, your only choice is to package the jars you've used with your war file.
While developing a web project using my recently developed utility(a jar file), I encountered a NoClassDefFound error. Of course, it's pretty obvious that the jar file I've made and using on my web project could not be found(not visible in the CLASSPATH). Adding the jar to the build path only eliminated the compilation problem. Dragging the jar file into the lib folder of my Eclipse workspace isn't a very good idea. It took me a couple of hours before I figured out the solution:
- Right Click on your web project
- Click Properties
- Select J2EE Module Dependencies
- Click the Web Libraries Tab
- Add external jars(if the jar is outside of your project). An entry will be added under Jar/Module, make sure you click on the checkbox(checked).
And everything should be fine. I tried exporting to a war file and then checked the content and my jar files are indeed deployed with the war.