More than 500,000 IT Professionals are now Sun Certified. Are You Next?
With the purchase of any certification exam voucher through June 30, 2008, you will receive a second chance certification voucher to retake the exam, if you need it.
Here's how to take advantage of this offer:
1. Select the package or certification exam that you are interested in. 2. Use Priority Code WW48CX1 when you place your order. 3. Schedule Your Exam. 4. And if you don't pass the first time, schedule your retake exam for FREE.
Hurry! Offer Ends June 30, 2008.
More details along with recommended books can be found here.
If you've received the "No Factories configured for this Application" error with MyFaces 1.2, then you're not alone.
Detailed message goes like this:
java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions!
If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
The weirdest thing is that I have the context listener declared in my web.xml!
To those of you who are wondering whether next Monday will be declared a non-working day because of the Holiday Economics Act and the upcoming Labor Day, the answer can be found here.
Labor Day will STILL be celebrated on May 1 (Thursday) and will not be moved to the nearest Monday.
They should probably update the ra9492.pdf file because it does not match the other announcement they have in their website.
Our authors often have great insights. So when one recently told us that .NET technology--in particular C# combined with LINQ--has "leapfrogged Java," we took note. His evidence?
The new .NET library, LINQ*, provides a direct link between C# code and any data source, without the need for a persistence layer like Hibernate.
C# introduced generics, custom attributes, delegates, standardized foreach iterators, property syntax, and extensible value types before Java.
The .NET platform now includes Python, Ruby, and new languages like F#, and frameworks like WPF, WCF, and ASP.NET have become industrial-strength.
On the flipside, another of our authors tells us, a language lives in a developer community and Java's is more vibrant. Java-to-.NET ports like NAnt, NHibernate and NUnit abound, but there's been little movement in the other direction. And .NET still implies Windows.
I'm trying to look for sponsors for an upcoming event this Saturday to help raise funds for our Church auditorium.
You can "pledge" at least 200 pesos for every lap (50 meters) that I will complete.
So for example, Person A pledges 2 laps @ 200 pesos each and Person B pledges 1 lap @ 500.
In order to receive all the pledges above, I need to complete all 3 laps. If I get to complete only 2 laps then I will only get 400 pesos (2 x 200) and the pledge from Person B gets forfeited.
But if I complete all 3 laps, then I should be able to get 900 pesos ((2 x 200 from Person A) + (1 x 500 from Person B)).
You can add a comment below the post to signify your interest. You can also indicate there the amount (per lap) and number of laps you want to pledge. The sequence of the pledges in the comments section will determine the order in which the pledges will be applied/claimed.
Don't worry, I'm not a professional swimmer. I can't even remember the last time I was able to swim in an Olympic-size pool!
No that's not me in the picture. I just got it by doing a web search. But that should at least give you an idea of what the event would be like.
A database which supports JDBC (totally up to you)
The assumption here is that you are already comfortable with Java and databases, and you just want to know how to make your Flex application communicate to your Java backend.
We now proceed to creating our form Using Flex Builder.
guestbook.mxml
[sourcecode language="xml"]
layout="absolute" xmlns:local="*">
[/sourcecode]
Switching to "Design" view should show us the form that we just created.
Look how nice and easy it was to create the form.
But wait, this application doesn't do anything yet, so let's move on to adding some logic.
Let's try to modify the submit button to call our remote object:
Adding this line alone will cause a compile error because we haven't told Flex what the guestBookService and guestBookEntry objects are all about.
First we need to create an ActionScript class named GuestBookEntry.as which will correspond to our remote JPA entity named GuestBookEntry.java (located under the guestbook package).
[sourcecode language="javascript"] package { [Bindable] [RemoteClass(alias="guestbook.GuestBookEntry")] public class GuestBookEntry { public function GuestBookEntry() { }
private var _guestName:String; private var _guestMessage:String;
public function get guestName():String { return _guestName; }
public function set guestName(guestName:String):void { _guestName=guestName; }
public function get guestMessage():String { return _guestMessage; }
public function set guestMessage(guestMessage:String):void { _guestMessage=guestMessage; } } } [/sourcecode]
Notice how the constructor, setters and getters are different from how you would normally do it in Java.
We now update guestbook.mxml to include a reference to our guestBookEntry object (also called a custom component). This should be added as a child of the Application element.
The curly braces mean that any changes to the text values of the form elements in guestbook.mxml would be directly applied to the guestBookEntry instance.
That should leave us with one more compile error to deal with, which is that of the missing reference to guestBookService.
Just add the fragment below as a child to Application and we're all done! At least with the Flex part.
I'm sorry if I cannot explain the ChannelSet details as of now, because I'm as clueless as you are. We just need to make sure that they match the values in our BlazeDs backend and we're good to go.
From your turnkey download, locate a file named blazeds.war, if you've done some Struts programming before, this is the same as the struts-blank.war which can serve as a template for new projects.
Import this war as a project in Eclipse WTP, and name this project guestbook (remember that our backend needs to match the entries we added for the RemoteObject and ChannelSet).
When you're done setting up the project in Eclipse, navigate to "WEB-INF\flex\". At this point we are only interested in "remoting-config.xml" where we should be defining a reference to our remote object.
Add these lines in between the adapters and default-channels:
The guestbook.war can be downloaded from this location. The file uses an odt extension because of hosting limitations. Please rename to .war accordingly.
Also, JAR files from BlazeDS, TopLink and MySQL driver were not included in the distribution.
Let me know if you encounter any problems while running the application.
We (Manning) will hold a random drawing every day from April 17 to April 30. Two winners will be chosen each day. Winners can choose from any ebook available on Manning.com. We will contact you by email if you are one of the lucky winners. No purchase is necessary and you only need to enter once (duplicate entries will be deleted). If your name isn't pulled as a winner one day, it is still eligible to be drawn on subsequent days. A random number generator will be used to choose each day's winners. After April 30 we will send all participants the list of the winners and their ebook choices.
Download link (make sure to rename the downloaded file to .zip instead of .odt)
Database Design:
[sourcecode language="sql"]
CREATE TABLE seats ( rowId varchar(1) not null, columnId int not null, status int, updatedby varchar(10), PRIMARY KEY (rowId,columnId) );
CREATE TABLE userauth ( rowID TINYINT UNSIGNED NOT NULL AUTO_INCREMENT, commonname VARCHAR(35) NOT NULL, username VARCHAR(8) NOT NULL, pswd VARCHAR(32) NOT NULL, PRIMARY KEY(rowID) );
[/sourcecode]
I tried to make the tables as simple as possible.
For the seats table, I used the rowId and columnId columns as the PK. The status column represent the state of a particular seat (0-available, 1-reserved, 2-confirmed). The updatedby column is for storing the name of the user who last updated the record (importance of this column will be discussed later).
I also needed some form of authentication which is contained in the userauth table. I think the columns for this table are self-explanatory, so there's really no need to go into more detail about that.
I created a login.php page for authentication. I had to embed this page to all the other pages which I wanted to protect from unauthorized access.
Note that unless output buffering is enabled, these commands must be executed before any output is returned. Neglecting this rule will result in a server error, because of the violation of the HTTP specification.
You can retrieve the values entered into this form through the following scripts:
[sourcecode language="php"]
$_SERVER[PHP_AUTH_USER] // for retrieving username $_SERVER[PHP_AUTH_PW] // for retrieving password
[/sourcecode]
The values retrieved from the form are then compared to the entries in the userauth table. And if no match is found, the login form is re-displayed to the user.
[sourcecode language="php"]
// Connect to the MySQL database mysql_pconnect("localhost", "tickets", "tickets") or die("Can't connect to database server!"); mysql_select_db("tickets") or die("Can't select database!");
// Check for matching users $query = "SELECT username, pswd FROM userauth" . " WHERE username='$_SERVER[PHP_AUTH_USER]'" . " AND pswd='$_SERVER[PHP_AUTH_PW]'"; $result = mysql_query($query);
// Re-display login form if (mysql_num_rows($result) == 0) { authenticate_user(); } [/sourcecode]
I do hope all these snippets still make sense to you because we are just about to proceed to the more complicated stuff.
Given the seat layout of the concert hall, I decided to represent the rows using letters and the columns as numbers. The tricky part was how to dynamically generate the seat layout based on the rows retrieved from the seats DB table.
The next fragments were taken from seats.php
[sourcecode language="php"]
// Select all the seats in the venue // The seat numbers in the concert hall were read from right to left // (which is why columnId is sorted as desc) $query = "SELECT * from seats order by rowId, columnId desc"; $result = mysql_query($query);
// Iterate through results, assign values to rowId, columnId, // status and updatedBy variables while (list($rowId, $columnId, $status, $updatedby) = mysql_fetch_row($result)) [/sourcecode]
We now begin with the fun part, for every seat, which is still available, create a checkbox. For every seat which is reserved, also create a checkbox only if the user currently logged in is also the same user who reserved the seat. You may be wondering, why do I need to create a checkbox for a seat that's already reserved? This is because, in this application, the reserved state is not the final state for a seat. A reserved seat can still be canceled or confirmed. But once a reserved seat is confirmed, no further modifications can be made to that seat.
From PHP, we step back a bit and discuss the JavaScript part of the code which is as important as the PHP scripts.
[sourcecode language="javascript"] function reserveSeats() {
var selectedList = getSelectedList('Reserve Seats');
if (selectedList) { if (confirm('Do you want to reserve selected seat/s ' + selectedList + '?')) { document.forms[0].oldStatusCode.value=0; document.forms[0].newStatusCode.value=1; document.forms[0].action='bookseats.php'; document.forms[0].submit(); } else { clearSelection(); } } }
function cancelSeats() {
var selectedList = getSelectedList('Cancel Reservation');
if (selectedList) { if (confirm('Do you want to cancel reserved seat/s ' + selectedList + '?')) { document.forms[0].oldStatusCode.value=1; document.forms[0].newStatusCode.value=0; document.forms[0].action='bookseats.php'; document.forms[0].submit(); } else { clearSelection(); } } }
function confirmSeats() {
var selectedList = getSelectedList('Confirm Reservation');
if (selectedList) { if (confirm('Do you want to confirm reserved seat/s ' + selectedList + '?')) { document.forms[0].oldStatusCode.value=1; document.forms[0].newStatusCode.value=2; document.forms[0].action='bookseats.php'; document.forms[0].submit(); } else { clearSelection(); } } } [/sourcecode]
You will notice that there are three main functions (reserveSeats(), cancelSeats() and confirmSeats()) for modifying a seat's status.
These scripts submit the values of the HTML FORM in seats.php to another PHP page named bookseats.php. This bookseats page is particularly interested in three FORM parameters from the seats page namely, oldStatusCode, newStatusCode and the seats array generated by the checkboxes.
An example of the request would be:
oldStatusCode=0 newStatusCode=1 seats[A1,A2,B3]
Which means Reserve the currently Available A1, A2 and B3 seats.
It is important to note the behavior of checkboxes in HTML. Only the values of "selected" checkboxes get submitted when you make a POST request. You can retrieve request parameters in PHP using $_GET for GET requests and$_POST for POST requests.
The bookseats page is divided into two parts. The first part checks whether the seats are still in the same state (no changes were done to the seats by another user while we were busy doing something else) prior to making any updates.
This application represents my first attempt into the PHP world and I must say that there are still a lot of improvements that can be added to this quick and dirty solution.
For one, the user can create his own login form instead of relying in the browser's basic login form (shown earlier).
A logout option would be a very worthy addition and can be achieved by simply adding a link which calls the session_destroy() directive.
Styles and scripts can also be moved to external CSS and external JavaScript files.
Anyway, I still hope I was able to provide you enough details about PHP to serve as starting point.
Feel free to download (and rename to .zip) the application and modify to your own liking.
I'm having a hard time keeping up with reading my NEW books. So instead of just letting them gather dust in my shelf, I'm thinking of selling some of them (those which I do not need for my current projects).
The tag prices attached are based on Amazon's base price (converted to pesos). I already paid for shipping (to Phils.) and customs taxes so in effect you are really getting a HUGE discount.
You can drop me a line here or email me at dayg77 AT gmail DOT com if you're interested.
Thanks.
Update 4/22: Proceeds will go to the same fund raising event as described here.
A few months ago, I was reading the blog of Cay Horstmann (author of Core Java, Core JSF and many others) and came across his The OLPC and Java post.
I got an OLPC for the holiday season. No, it wasn't for the Horstmann twins—after all, it is one laptop per child, so the child must be myself. I got it through the “give one, get one program”. For $400, I got mine and a much more deserving kid somewhere out there got one as well. (Hurry if you want to get yours—the program ends today.)
It was nice to see the BIG guys participate in such a worthy cause. And if they can do it, why can't we?
In line with this, I would like to invite YOU (Yes you! The person reading this post) guys to participate in a similar project from World Vision. But instead of giving away laptops, you help underprivileged children get the education they have been dreaming for.
But what do you get in return? You hopefully get a BIG smile on your face whenever these little kids try to send you back a letter saying even the simplest "THANK YOU".
Order your own Hero Hack Pack and get started with Open Source and Microsoft technology.
Each Hero Hack Pack contains free evaluation editions of Windows Server 2008 and Visual Studio 2008, plus resources for getting started with Open Source development.
Looking for more? We’ve randomly hidden vouchers for free passes to the 2008 Open Source Convention (OSCON) this summer, held in Portland, OR. Each Pack gives you a chance to win a free pass to one of the world’s largest gatherings of the Open Source community.
Great news for Globe subscribers! Globe has announced a new time-based pricing model (5 pesos for every 15 minutes) for mobile browsing.
This looks better than Smart's (10 pesos for every 30 minutes) current offering if you're the type of person who just use this facility to download your emails (and read them offline) which would normally just take you less than 5 minutes.
Check out this page to see how to setup your phone for mobile browsing.
As promised, here's the long overdue Mind Map for SCEA 5 Part I. This file builds on top of the OLD SCEA Part I Study Guide Mind Map. This file contain the references I used for SCEA 5 BETA Part I preparation last year which is just an addition to the resources already mentioned in the OLD SCEA mind map.
You will notice that this mind map is not as elaborate as the first one as we only had a few weeks of preparation for the BETA exam. I still hope you find it useful for your own preparations.
Reminder: Please rename the file to a .mm (Freemind) extension after downloading. Do not use Open Office to view this file.
Did you know that there's such a thing as "CSS Naked Day"? Yes there is!
It's celebrated on the 9th of April each year.
The idea behind this event is to promote Web Standards. Plain and simple. This includes proper use of (x)html, semantic markup, a good hierarchy structure, and of course, a good 'ol play on words. It's time to show off your <body>.
You should probably check out this site I visited earlier to see how a NAKED website looks like.
PS: If you want to know more about HTML and CSS (the FUN way) I suggest you GRAB a copy of Head First HTML with CSS and XHTML, it is HIGHLY recommended.
UPDATE 4/11: Their CSS is back on, you will need to wait for April 9 next year to see the site NAKED again.
How time flies! Just when most people have started using Java 5, you get this announcement from SUN.
Java SE 5.0 is in its Java Technology End of Life (EOL) transition period. The EOL transition period began April 8th, 2007 and will complete October 8th, 2009, when Java SE 5.0 will have reached its End of Service Life (EOSL). Customers interested in learning more about Sun's Java Technology Support and EOL policy »Read More
Customers interested in continuing to receive critical fixes, are encouraged to consider the following options:
Makes me excited to see Java 6 go mainstream. But I guess the people from Apple has a little catching up to do, because up to until now, Java SE 6 for Mac OS X 10.5 is still in Developer Preview.
I've had the privilege to work on some proof of concept pages using Flex since last week. Yes, I've heard the buzz around RIA and Flex before but I didn't have the time to play around with the application until now.
I originally thought that it was somehow expensive to develop applications using Flex, but looking at the new pricing models, it seems that the entry barrier to Flex has been lowered down. You can even develop Flex applications for FREE using just the open source SDK and your old IDE but you lose all the design time capabilities the Flex Builder IDE has to offer.
I downloaded the 60 day trial and since the Flex Builder IDE was built on top of Eclipse (which I have been using for Java for a couple of years already), I immediately became very comfortable with the controls.
Coming from a Java background, I wanted to know how developing in Flex was different from what I would normally do in Java, create some JSPs and corresponding JSF Managed Beans for the UI and probably add some pretty cool JavaScript libraries like JQuery or Scriptaculous for some really nice effects.
I did some web search on Flex and found some interesting articles/links which caught my attention:
I wanted to try out writing some Flex applications but our intermittent internet connection last week prevented me from running the online tutorials.
So I just opted with buying the Early Access e-book copy of Flex 3 In Action from Manning.
After reading chapter 1 which can be downloaded freely from the site, I said to myself, "now why didn't I try Flex earlier?" The argument there about the lack of user interactivity from pure HTML pages made a lot of sense.
I'm still in the early part of exploring Flex, but I must say that I'm really enjoying it and excited about all the new possibilities with regards to what the UI can offer.
Now all I need to do is to connect this to my Java backend and I'm ready to go.
A few weeks ago I was able to attend again our church's midweek service. In spite of being very late for it, I learned a valuable lesson from our pastor about "Trusting God".
He said that "as Christians we only have two choices: either we trust God with our all or not trust him at all."
He also gave an interesting analogy about a tightrope walker who did his stunts blindfolded while carrying a wheelbarrow. The tightrope walker had a critic who said that the trick was only made possible because of familiarization with the environment and cannot be pulled off elsewhere.
So the tightrope walker accepted the challenge and decided to perform the trick across the Niagara falls which he was able to complete successfully. The critic was humbled by this turnout of events and said to the tightrope walker that he now believes that the tightrope walker can pull it off wherever he wishes.
The tightrope walker said, "Do you really believe that I can do it?". The critic responded, "Yes, I really believe!" The tight walker replied, "No you don't understand what you're saying, "Do you really believe?" to which the critic answered, "Yes 100%!".
Then with a big smile, the tightrope walker said to the critic, "Then climb up the wheelbarrow, and let's do the trick again."
While trying to create a simple prototype for an application which uses JSF, EJB 3 and JPA, I decided to implement the suggestions from the article: Using an EJB Session Bean as a Model Facade.
I was particularly interested in injecting my EJBs to my JSF Managed Beans (the article mentioned that it should be possible to do this kind of injection with JSF Managed Beans and Servlets).
[sourcecode language="java"] public class CatalogServlet extends HttpServlet {
@EJB private CatalogFacade cf;
// some variables and methods }[/sourcecode]
I tried using JBoss 4 since it already had lots of available documentation regarding EJB 3 only to find out that this feature is not yet supported.
I tried switching to JBoss 5 Beta 4 but the error was the same.
16:16:31,765 ERROR [JBossInjectionProvider] Injection failed on managed bean. javax.naming.NameNotFoundException: "Name of your Managed Bean goes here" not bound
Hmm, I should probably try this with GlassFish one of these days.
I was watching a local TV program last weekend and they talked about being "earth friendly".
I wanted to do my part in promoting environment awareness so I'm blogging about a website which I was able to note down, that of Luntian Bags.
Luntian Bags are reusable bags made of canvas that come in different designs and sizes. The purpose of the bags is to help reduce plastic bag pollution by using reusable bags instead of wasting plastic ones. These bags are stylish, earth-friendly and carry a message. So for your next trip to the grocery or mall, BYOB.
I first heard about the concept of bringing your own reusable bags from a local supermarket (Rustan's). I'm just not sure if the bags they have there are from the same source.