Categories
Software development

JSF Richfaces best practice: drop down and data scroller

Reading Time: < 1 minute

drop down box
Clear a list for selectionOneMenu every time, got burned by this in a “page number” drop down for Richfaces data scroller. And some other places.

Use validator
keep in mind it will overwrite the required = “true”, if the user does not select a valid value from drop down, it will give error message during Save method.

Assign 0 to “–select–” ?
Yes or no. Add 0 means 0 is a selectable option, so if one wants to enforce user to select something using required=”true”, it will pass this check. Thus comes in the validator, in which one can say “0” is not valid.

Page number for data scroller
1) t:saveState if we can not have session scope for dataBean;
2) the drop down tip above;
3) When “adding or deleting rows” and it cause the total number of pages changes, make sure set the correct page number in the “action” (save) methods.

Categories
Software development

Oracle, Java etc.

Reading Time: 2 minutes

The following was written more than a year ago…

======
Got opportunity to work on those two technologies recently due to job change. Had some gotchas as I transform from C++, CAD programming to this new program paradigm.

Data problem vs. coding error
In CAD world, sometimes there is problem with the data (CAD file) itself. But most of the time I focus my effort debugging the coding error in my own code, not trying to debugging the data itself. In Oracle/Database world, I found it more often that the data itself could complicate problem. Because the relational database has relationship between table, sometimes we can not add/delete/update table at will due to dependencies (data integrity). This also bring about the second topic I want to discuss.

C++ vs. Java
Java is not as flexible as C++. For instance, how to pass data back from a function, so far I found one way: using the return data. In C++, I used the pointer and reference quite a bit. The wiring of inheritance and interface (implementation) could also got a bit complicated: basically one needs to draw the relationships on a paper to better understand all those.

Eclipse vs. Visual Studio
Eclipse (the free Java IDE) is quite powerful, actually. It’s also highly configurable, with so many plug-ins, e.g., this subclipse integrates Eclipse with Subversion. I remember I could not do such things inside Visual Studio (for Perforce).

Categories
Software development

Dirty flag java script, dynamic drop down

Reading Time: < 1 minute

Dirty flag on a HTML form is much trickier than I thought, that is, it is tricker when I started to programming for dirty flag.

Saw this javascript snippet. It works great except in my case, I was generating dynamic drop down (selection menu), and in a lot of cases it behaves as opposite to expected (i.e., it shows the form is dirty when it is not, and vice versa). Found out there are couple things came into play.

1) The default selection (type “0”), or select “nothing”, I forgot to set the value “0” (string type).

2) Second, I forgot to clear some of the derivative selections when I make selection the primary selection menu (basically it will dynamically generate other drop downs based on the primary selection).

3) Third, allow type “0” has other effect, I had to remove required=”true” validation from the selection menu, and validate it manually. Also, after I made this optional (removed required=”true”), the actionListener will get triggered when I make selection type “0”, previously it was not entering it, and caused other rendering issues.

4) Last but not least, I added a “validator” to the primary selection menu (basically it will give error if I select “0” type), and it will not trigger the actionListener again. Madness. So basically I have to do the validation somewhere else.

Categories
iPhone app Software development Web

Software updates

Reading Time: 2 minutes

WordPress 3.1.1
Finally I got hands around my blog (this one stlplace) and did the WordPress upgrade. I put off the upgrade in the past primarily due to my laziness: there is no automatic update due to I was running on WP 2.0.2. The upgrade itself is not too bad, I followed those two articles on Backup database and Run manual update. I used phpMyAdmin for the WP database backup. For the WP upgrade the only tricky part for me is:

“…Upload the individual files from the new wp-content folder to your existing wp-content folder, overwriting existing files. Do NOT delete your existing wp-content folder. Do NOT delete any files or folders in your existing wp-content directory (except for the one being overwritten by new files)…”

I know “directory overwriting” generally works on Windows system, but we are talking about UNIX (Linux to be precise). The command I used goes like this (in the blog root directory):

cp -r -u new_wp-content_dir .
(here -r means recursive for directories; -u means update)
I believe it did the trick, as I can run upgrade database afterwards. After that I enabled the necessary plugins. The only plugin stopped working is the ultimate warrior tags. The rest are fine.

Btw, I also added WPtouch plugin so that this blog works better on iPhone.

Xcode 3.2.6
I found my old Xcode 3.2.2 can not handle block as it’s necessary to run Ray’s RSS reader example. Download the software from Apple, install, and found this “Base SDK missing” in the new Xcode. Did some google, the trick is to “use latest SDK” in the “project => build” setting. I noticed we can also build “older” targets by changing the target in “deployment target”. Obviously there is a limit as to how far we can go back (I have not checked that yet).

Btw, I found the iPhone 4 simulator looks cooler than iPhone 3 simulator 🙂

Categories
iPhone app Software development

iPhone iOS dev blogs

Reading Time: 2 minutes

The following are iPhone development blogs I often read. Note I used Google reader to get them. I also listed some of the blogs under “dev” category in the side bar (small).

Technical
iPhone development by Jeff Lamarche. Jeff is the author of the best beginners book for iPhone dev “Beginning iPhone development”. Recently I found his profile at LinkedIn, and found he was a law school graduate, which is total surprise to me. He is definitely not a lawyer type in terms of writing (blog) and talking style (from his tweets).

Cocoanetics (aka Dr. Touch): Oliver Drobnik, the former Windows Admin turned full time iPhone iOS developer lives in Austria (Europe). Note he recently changed the name from Dr. Touch to Cocoanetics. Regardless the name change, I found he has a very good sense of both technology and business: I think his article on Notifications and “Part Store” (he sold his components software like parts) are very interesting.

iPhone developer:tips written primarily by John Muchow, who is the author of Core J2ME (which is the primary mobile development language pre iPhone, it is still used on Blackberry platform, and note Android used a different Java virtual machine developed by Google). I think some article such as “rename Xcode project”, “Prevent application being placed in background” etc. to be interesting.

iPhone development blog: written by Nick Dalton who got into iPhone dev early. A lot of goodies include this iPhone iOS app store reject reasons. I believe he is a co-founder and CTO of a mobile development firm in SF (can not recall the company name on top of my head, you may google).

Ray Wenderlich: the blog bears the author’s name. It has a lot of meaningful tutorials (not those “Hello world” stuff). Besides that, I found this How to host beta test for iOS app” to be interesting.

Other Resources, news, gossips etc
iPhone developer news (Apple): get it from Apple iOS developer center. The official place for all the announcement etc.

Mobile Orchard: used to be good technical stuff, stopped update this April, just resumed blogging.

43 iPhone app development resources: the list is a bit dated, but still useful.

I will add more as time goes.

Categories
Software development

Some corrections to Hibernate tutorial

Reading Time: 2 minutes

Hibernate logo
I was referring to the First application at Hibernate (Jboss) offical documentation. I found some problems when doing the exercise: just want to share some of my findings so others may benefit.

1) dependency version missing: there are already some some discussions on the Hibernate discussion forum, such as this one and that one. I followed the first one: added the version numbers as suggested and the problem went away.

2) jdbc driver can not be found, the fix is to

mvn install:install-file -DgroupId=hsqldb -DartifactId=hsqldb -Dversion=1.8.1.2 -Dpackaging=jar -Dfile=/path/to/your/hsqldb.jar

in my case (mac) this is /Users/major_xu/Downloads/hsqldb/lib/hsqldb.jar

I saw discussion on this one, too, the suggestion is to “add classpath for hsqldb.jar”. But I don’t know how to do it in maven command line.

3) misc: there are a lot other corrections:

Categories
Career Software development

How to find a job in this difficult market?

Reading Time: 2 minutes

Particularly in the IT (software development) field. Obviously the No. 1 thing is “never give up”. I started looking about 9 months ago when I felt “the need to look”: both for defense (fear of lay off) and offense (opportunities better matching my interest and skill). I had to admit finding a job is not an easy thing in this environment. Why look for another job while one still has a job (besides the main reason behind the change)? The simple answer is, only when a person still has a job or other sources of income, he/she will have the space to look for something better.

job search logo
(Source: Brandies U.)

Strategy and Job search sites I used

Categories
iPhone app Software development

Objective-C: first impression

Reading Time: < 1 minute

I like Apple products: I had iPod Nano (2nd gen) since 2007, and I owned MacBook (white plastic), and bought iPhone for my wife this Jan. All bring us very good user experience. That is not to say, Apple products are flawless. IPod and iPhone will die once a while, but nothing catastrophic as it does not erase music etc. MacBook has minor problems too such as “could not come back to life after hibernate”, and the heat generated by battery. But I like both my old iPod nano and my fairly new MacBook (the user interface is just beautiful 😀

Ok, now back to the hard part. One reason I bought MacBook is I want to learn Objective C (the programming language on Mac OS X) and Cocoa (UI framework). My first impression (after almost a year, on and off) on Objective C and Cocoa (using XCode) is: very unforgiving, like Steve Jobs 🙁

Two little stories from my own study, both on Chapter 9 NSUndoManager

Categories
Software development

The eBay Skype deal

Reading Time: < 1 minute

eBay agreed to sell a majority stake of Skype to a consortium of private investors lead by Silver Lake Partners. (WSJ: EBay CEO: Skype Investors “Confident” of Work-Around Software, get it from Google if necessary).

Silver lake is not new to me. Because they bought Seagate, and my former employer (hint: a major CAD/PLM software company) and made money from both (WSJ: Silver Lake’s Skype Deal Resembles Its Seagate Investment). See more of their investments here.

Categories
Software development

This Green dam thing

Reading Time: 2 minutes

(Update June 11) Here is a review of the software, by experts at Univ. of Michigan.

(Original) Yesterday I read from WSJ that Chinese government is asking the PC makers to install anti-porn software “Green dam” from July 1. I can understand western media’s interest here: the intension of government is more than protecting the Chinese kids, it’s more about controlling access to the world wide web, blah blah blah. I think this kind of analysis overly simplied (and obscured) many things happening in China. The real situation in China is more complicated. Since I grow up in China and read Chinese, I visit Chinese web sites from time to time. One thing I found over the years, is there are much more sex related content in Chinese web sites, even for sites like Sina, Netease (163.com) or Sohu.

green dam anti-porn software
(User Interface of Green Dam software, source: WSJ)