Marketplace for Content, Tests and Assessment
 
 

Archive

Archive for the ‘Programming / tutorials’ Category

JNDI lookup on JBoss

March 11th, 2010 sadhna No comments

There is no standard way as per Java EE specs for  JNDI naming conventions, hence most of the application servers have their own way of JNDI naming.

On specifying a Datasource’s JNDI name as ‘myDatasource’, JBoss binds as ‘java:myDatasource’. So if one want to deploy the application on Jboss application servers then can use the simplest way is here. The steps for adding and using jndi Datasource to JBOSS 4.x is as under-

  • Copy the jdbc driver to JBOSS_HOME/server/default/lib.
  • Create the jndi xml file for datasource – example ds.xml Read more…

Categories: Programming / tutorials Tags: , ,

Debug Maven tests running inside eclipse

March 1st, 2010 Vinay 1 comment

For those of us who have been running JUnit tests inside eclipse , one of the biggest feature available to us was the debug ability of the JUnit tests.
When we started working on Maven tests , the first questions which came to mind was , How am I going to debug it ?
I started with running the tests class by selecting the class in eclipse and right –> Run as Junit Test.

But this does not work. There are some variables which are being injected through pom.xml and tons of other dependency bugs which would be thrown.

So here is how to run your units tests in debug mode while running through mvn command.  There are two steps to this. You will have to first set up a remote launcher, similar to the way you might have done for remote server.

Then you will run the tests from command prompt or

Create Remote Java Application Debug Configurations Read more…

Categories: Programming / tutorials Tags: ,

Fatal error: wp-includes/vars.php on line 16

February 27th, 2010 Vinay No comments

If you are upgrading to wordpress 2.9, you might get this error Fatal error: wp-includes/vars.php .

Some people get this error when they do an automatic upgrade. I got this error when doing upgrade manually.

Reason : Some of the files were not copied correctly. You would keep your wp-config.php  and contents folder. Rest all the files and folders need to be replaced.

One-to-One mapping in Hibernate using Foreign Key Association

February 16th, 2010 smitha No comments

One-to-One mapping can be done in 2 ways:

  1. Primary key association:
  2. Foreign key association.

My previous post described about the Primary key one-to-one mapping in Hibernate. This post gives an example of Foreign key one-to-one association in Hibernate. Read more…

Mapping Composite Keys in Hibernate

February 10th, 2010 smitha 3 comments

In Real world applications it is natural to have tables with composite keys. The row will be identified with combination of key  column values of a row.

Consider Following scenario:

A test selling website defines tests and customers.

Read more…

One-to-One mapping in Hibernate

February 8th, 2010 smitha No comments

In Hibernate One-to-One mapping can be done in 2 ways: 

  1. Primary key association:
  2. Foreign key association. 

This article describes how a Primary key One-to-one association can be done. 

Consider a Customer and address entities. Each customer will have one address. And an address is associated with one customer.  To make this relationship work in database customer and address will have same Id(primary key). Mapping this kind of relationship in Hibernate is called primary key One-to-One association. Doing so will help you saving, updating, deleting related entities easy.

Read more…

The Object Oriented Game Approach Part 2: Getting started with iPhone Game development

February 6th, 2010 jvmovi No comments

In the past articles, I’ve discussed OOP(Object Oriented Programming) and Game Programming.Be sure to at have a grasp of the basics before diving to this next article.

The basic prerequisites to develop your first iPhone GameApp are:
1)Objective C
2)the iPhone SDK
3)MAC:XCode

So to develop a game in the iPhone , these prerequisites will force you to work in a MAC, and learn Objective C on top of learning the iPhone SDK. Do not be alarmed. Take one step at a time.If you know OOP already, then you just have to familiarize.

Read more…

Categories: Programming / tutorials Tags:

Getting started with Spring TC server

January 28th, 2010 Vinay 2 comments

As promised in last post Good bye MyEclipse. Welcome STS -Spring source Tool Suite, I would be going into the details of Spring TC server development edition and its integration with Spring Source tool suite (STS).

Spring launched the Spring source tc server which is a layer of functional ties and capabilities over the famous Apache Tomcat server. From Spring source site

SpringSource tc Server™ is an enterprise version of Apache Tomcat that provides developers with the lightweight server they want paired with the operational management, advanced diagnostics, and mission-critical support capabilities businesses need.

More details on Spring TC server can be found  SpringSource tc Server — The Tomcat You Know

I decide to give the Spring TC server a shot. I downloaded tc Server Developer Edition(Free) edition (you will have to fill in details and then you get a link in email)

Read more…

Spring adds JSON support

January 27th, 2010 Vinay No comments

We had posted a tutorial example on JSON  Java script sometimes back. It became a pretty popular post and people gave good feedback about it.  Some how the post got deleted and with it all the user’s comment. We apologize to our users. Here is the post JSON JavaScript Tutorial.   JSON is really cool and gives a lot of power in hands of developer.

Spring 3.0 which has come up with a lot of simplification like asynchronous method invocation , have also simplified AJAX calls.  You can now now invoke server side code with JSON and Spring 3 provide support for that. Details on it can be read from Spring Source blog AJAX Simplification in Spring 3

PS: Last time I checked out the spring blog,  the above url was pointing to wrong post. They might have fixed it by now

The Object Oriented Game Approach Part 1: Objects

January 27th, 2010 jvmovi No comments

(For the next series of articles, I would assume that programming would be a fundamental part of one’s body, if not, then go practice! Also ,you need to brush up on some Object Oriented concept. Happy Reading)

Today, we would be tackling about Object Oriented Paradigm, in relation with Game Programming. For now, think inside the box.

First picture a room, say for example picture a computer room.

What should be inside this kind of room? More or less we can see a number of  CPU’s, keyboards,mouses,monitors,cables and maybe one or two printers.Is the room airconditioned? Then you can probably feel a little cold inside this room. Hear some music or probably some noise? Is a sound system probably present too?Also, you should not forget about the tables and the seats where the computers are, or the AVR’s where the computers are hooked too! Have you gotten a feel of the room yet?

Planning is almost always done first instead of just rushing in and just coding whatever pops out of the mind. Coding without planning is only done for those things that need to be crammed. Game programming shouldn’t be one of them.

Now proceed to the next step. Ask yourself these questions:
a)Where are you again?
b)How many objects are in the room?
c)Why are these objects here in the first place?
d)What is the purpose of a specific object?
e)How does an object work?
f)What are the functions of these objects? Read more…

Jquery Tutorial With Javascript

January 27th, 2010 Vinay No comments

Introduction

Today JQuery is a buzz in every tinsel town. From the day web sites began coming into the world wide web space, developers are trying hard to please their users. Javascript arrived and it added spices in it. Developers began playing with javascript and created tens of thousand useful things for the users and made things interactive. But this comes with a price. Creating and maintaining javascript application requires a lot of patience and a lot of trial and error. On the top of this if we wanted to  write  a piece of javascript that creates effects and animation, we had make sure every thing is working and sometimes struggling with table, div, span bla  bla bla. JQuery came into the picture like life savior and it made our life very much comfortable. Just have a look at the piece of code written below :-

<html>
<head>
<script src=”jquery-1.3.2.js”></script>
<script>
$(document).ready(function(){
$(”p”).click(function(){
$(this).hide()
})
})
</script>
</head>
<body>
<p>You click on me, I will come after “Introduction”</p>
</body>
</html>

You can download code examples used in this tutorial here jquery code examples

This is just beginning and it can bring a lot of fun on your website. Imagination is the only limit.

Objective

(1)   What is JQuery

(2)   Why use JQuery

(3)   How JQuery works

(4)   Creating effects with JQuery

(5)   JQuery with server side technologies (ASP.net)

(6)   Future of JQuery Read more…

JSON Javascript Tutorial

January 27th, 2010 Vinay No comments

Introduction : Before we begin our journey of JSON, let’s write down a small piece of code .

<html>
<head>
<script language=”javascript”>
var objTest = {
“TestName” : “SCJP 5 Mock Test”,
“Description” : “This has questions for SCJP 5 mock test”,
“Rating” : 4
};
</script>
</head>
</html>

Our first reaction would be “Hey, wait. This is java script code. What is new in this?”. Welcome to the world of JSON. Read more…

Get Adobe Flash playerPlugin by wpburn.com wordpress themes