Wednesday, June 10, 2009

Setting EclipseLink 1.1 and Spring 2.5.6 in Eclipse 3.4

This article provides an example of using Spring framework 2.5.6 JPA and Test framework to create a record in the MySQL database. Here we are using EclipseLink 1.1 for the JPA implementation.

I will try to provide all jars and config files necessary to get EclipseLink 1.1 going and also include a simple test case. You will need to have basic knowledge of JPA and have experience using Eclipse IDE.

First you need the following spring 2.5.6 jars. Using Eclipse you can edit your build path and add these libraries.

spring-framework\dist\modules\spring-orm.jar
spring-framework\dist\modules\spring-test.jar
spring-framework\dist\modules\spring-beans.jar
spring-framework\dist\modules\spring-context.jar
spring-framework\dist\modules\spring-context-support.jar
spring-framework\dist\modules\spring-core.jar
spring-framework\lib\junit\junit-4.4.jar
spring-framework\dist\modules\spring-jdbc.jar
spring-framework\dist\weaving\spring-agent.jar
eclipselink\jlib\eclipselink.jar
eclipselink\jlib\jpa\javax.persistence_1.99.0.jar

In your Java project, you will need to configure the persistence.xml in the META-INF folder.

persistence.xml


Next you will need to create a Spring configuration file as follows.

databaseContext.xml



Create a bean called Product in the my package.

eg

@Entity
public class Product {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Long id;

String name;
....

}
Create a DAO class called ProductDao

ProductDao

@Repository
public class ProductDao {

@PersistenceContext
EntityManager em;

public void create(Product product) {
em.persist(product);
}
}


Next create the testcase to test the persistence...

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"/databaseContext.xml"})
public class TestDatabaseConnectionCreation {

//Need to test auto creation of tables...
@Autowired
ProductDao dao;

@Test
public void testCreate() {
Product p = new Product();
p.setName("It works");
dao.create(p);
}
}


Note I had to put the runtime weaver in the Run configuration Arguments tab VM arguments as such...

-javaagent:D:\devtools\spring-framework-2.5.6.SEC01\dist\weaving\spring-agent.jar

You will also need to include the MySQL JDBC driver...

You can now right click on the testCreate() and select run as Junit Test. Magic should happen as follows

  • Spring framework should load,
  • Connects to the MySQL database
  • Creates the product table
  • Inserts a product record to the table
  • Rollback the transaction (note the table remains in the database)

Monday, March 2, 2009

Gears of War Recall

There are reported problems with the PC version of Gears of War.

This issue apparently affects all Gears of War for Windows releases and prevents the game from properly launching after January 1st, 2009. While an update has been issued, the distributor has acted to have the product removed from it’s inventory and off the shelves of retailers to mitigate any additional exposure for the retailers and end user customers.

Retailers have been requested to immediately stop selling the game (in store and online) and return all inventory to their authorized Microsoft distributor.

Customers owning an affected copy of the game are directed to :

Wednesday, February 25, 2009

Don't get Wiii'd on by Nintendo

A warning to anyone who has a Nintendo Wii or intends to get one. Here is a real encounter from someone who had problems with WII during the warranty period.

A few weeks ago my son's Wii started making a horrible noise after inserting a disk and it stopped reading disks - fortunately it still had a month to go on the warranty.

I had to post it registered post to Victoria to get it fixed. Then after a couple of weeks Nintendo gave me a call and said there was actually nothing wrong with it and because there was nothing wrong it would cost $35 for the assessment. They said I could send it back to them if it still had problems and they would fix it and this time they would refund the postage.

I paid the $35 assessment fee and they sent it back to me. When I got it back I placed a Wii game disk in it and it made an even more horrible noise and the disk would not even come out. So I sent it back to Nintendo with a message to fix it properly or I will contact Consumer Affairs. After a few days they responded saying that there was in fact something wrong with the disk drive and it is not covered by the warranty. They said that the disk drive was not working because there is a foreign object in the Wii and it will cost us $120 to fix on top of the new assessment fee of $35. I asked them why they had not discovered the foreign object in their first assessment and they said it is not up to them to speculate how or when the foreign object got into the Wii.

I've come to the conclusion that it's not worth the time, money and effort just to have a good Wii.

Friday, February 13, 2009

Cold encounter with Dmoz.org

There are numerous articles on the web about why you should list with Dmoz.org. A listing is a guaranteed way for instant search engine relevance and the gaining of the all important pagerank. While it is highly recommended, like many of the SEO requirements it can be an incredibly frustrating experience to go through and there are a lot of disappointed people who have wanted to add their sites to their directory and failed.

The frustration stems from not only from the incredibly long delays you can wait to get listed, but more likely you’re not going to get listed at all.

Frankly the directory is rubbish, it just doesn’t make much sense. It is the most eclectic bunch of random websites that are chosen due to their editor determined ‘uniqueness’ rather than a collection of relevant websites in any category, for any country, that would benefit a directory user. I’ve yet to understand why getting listed in this directory carries so much weight (but it does).

As a web developer I have become keenly aware of a huge flaw in how websites are evaluated and how this impacts on listing requests in such directories and serp results. Dmoz seems to be no different as can be seen from correspondence to one of Dmoz moderators it was confirmed:

“Sites don't get listed because they're submitted well.
Sites don't get listed because they're submitted often.
Sites don't get listed because they're submitted in the right place.
Sites don't get listed because of ANYTHING about the submittal.
Sites get listed because of what's on the site in the form of unique content.”

There’s that phrase that I read so often “unique content”. So like the mighty Google, Dmoz determines the relevance of a page judged largely on ‘unique content’. If the content can be found elsewhere than your site may be deemed repetitive and excluded. If your site looks like any others it’s not going to get listed. The fact that you may offer an alternative venue for something that already exists is deemed irrelevant.

For a directory this is a bizarre requirement, as many websites are completely relevant and yet contain largely similar content. None more so than shopping sites! For customers who want to find particular items in any particular category it is nice to have a choice of where it can be purchased from. Not only is it important to find what you are looking for, but the price, availability and service are just as important if not more so than the mere description of the item, or the fact some other store also sells it.

As it stands now people looking to actually purchase an item are not going to find the most relevant sites available, or even be given much of a choice given this extremely myopic criteria. They will find a single example, or a handful of sites that are deemed interesting and yet different enough to warrant a listing. Dmoz is a museum of website types, it is NOT a directory.

As a case study of this process we tried to get one of our developed sites listed : Gamesportal, a website that sells console and PC games and accessories.

In our particular area for example, that of video console games: of Shopping – Toys and Games - Games – Video Games – Console – New there are apparently a whole 5 companies on the whole planet that sells console video games… see for your self:

http://www.dmoz.org/Shopping/Toys_and_Games/Games/Video_Games/Console/New/

Despite this dearth of websites in this particular category, and the fact it hasn’t been updated since October 2007, we found it impossible to be added. In ten years of the directories existence, 5 whole websites…. Mind blowing!

In other relevant categories such as
http://www.dmoz.org/Shopping/Toys_and_Games/Games/Video_Games

There is a single Australian website that sells games to Australia, apparently each country only requires one store. For a directory website this seems rather peculiar especially since it is in the ‘shopping’ section. Another entry in this listing ceased trading in 2006!

So how can Dmoz be relevant? Why does it have the status it has? I sure can’t figure it out. If it wasn’t a recommended requirement for serp status I wouldn’t even be bothering, I doubt anyone even uses it as it sure doesn’t seem very useful.

Our website was submitted to Dmoz.org for listing approval six months ago. We have waiting ever since and yet still have no news of where we stand. Even direct enquiry on their forums gives no clear indication as apparently years of waiting seems perfectly acceptable.
A perusal of these same forums indicates we are not alone, many people have submitted their listing and waited for years in limbo.

Apparently Dmoz in all their wisdom did provide status feedback to submitted sites but discontinued the service in 2005. So just like the mysterious Google you are in a situation where by you live with perpetual uncertainty about the hows and whys of your listing. And remain at the whim of the volunteers that will determine your fate.

So from our experience we can share some observations for those who are considering applying for a Dmoz listing. After you submit your well designed website, remember this:

  1. If you submit your site on multiple categories you will get penalized, the editors view this as extra work and will probably just delete your request without looking at your site;
  2. Don’t expect be told or warned if you submit to the wrong category you’ll probably just be deleted;
  3. How long before your site get listed – probably never, but the more ‘unique’ your site the better the odds. Remember that Dmoz is a museum, not a functional directory;
  4. How long before you can resubmit – no idea, it’s probably been rejected but hey, live in hope.
  5. Your site may have been rejected but more than likely no editor is even looking at it, just move on, you have better things to do.