20 December 2010


The error message ORA-12162 "TNS:net service name is incorrectly specified" is not exactly what it meant.

It suggests that there is a problem with the tnsnames.ora file contents, but in reality the message ORA-12162 "TNS:net service name is incorrectly specified" results from improperly setting your ORACLE_SID value.

To fix this error in Windows, set your $ORACLE_HOME:
c:> set ORACLE_SID=fred

In Linux, these commands sets ORACLE_HOME and $ORACLE_SID as follows:
ORACLE_HOME=/u01/oracle; export ORACLE_HOME

update: instead of asdb you need to specify the DB name you wanna use.

Putty Colors

These are the meanings of different putty terminal colors.
* Normal file : Normal
* Directory: Blue
* Symbolic link : Cyan
* Pipe: Yellow
* Socket: Magenta
* Block device driver: Bold yellow foreground, with black background
* Character device driver: Bold yellow foreground, with black background
* Orphaned syminks : Blinking Bold white with red background
* Missing links ( and the files they point to) : Blinking Bold white
with red background
* Archives or compressed : Red (.tar, .gz, .zip, .rpm)
* Image files : Magenta (.jpg, gif, bmp, png, tif)

16 December 2010

Database TSN in Oracle

If you are working with Oracle and is a beginner with Oracle, you will find lots of new protocols defined by Oracle to be used. One of them is TSN. TSN is short for Transparent Network Substrate. As Wikipedia says it is:
The Transparent Network Substrate (TNS) allows peer-to-peer connectivity where no machine-level connectivity can occur. It provides a user-transparent layer that enables a heterogeneous network consisting of different protocols to function as a homogeneous network. TNS forms a transparent layer to which different network protocols can connect. It provides a network of applications above the existing networks of computers.
Oracle Corporation typically relies on TNS to provide generic network connectivity to and between Oracle databases, regardless of underlying protocols.

14 December 2010

Remote Desktop Shortcuts

  • CTRL+ALT+END: Open the Microsoft Windows NT Security dialog box (CTRL+ALT+DEL)
  • ALT+PAGE UP: Switch between programs from left to right (CTRL+PAGE UP)
  • ALT+PAGE DOWN: Switch between programs from right to left (CTRL+PAGE DOWN)
  • ALT+INSERT: Cycle through the programs in most recently used order (ALT+TAB)
  • ALT+HOME: Display the Start menu (CTRL+ESC)
  • CTRL+ALT+BREAK: Switch the client computer between a window and a full screen
  • ALT+DELETE: Display the Windows menu
  • CTRL+ALT+Minus sign (-): Place a snapshot of the entire client window area on the Terminal server clipboard and provide the same functionality as pressing ALT+PRINT SCREEN on a local computer (ALT+PRT SC)
  • CTRL+ALT+Plus sign (+): Place a snapshot of the active window in the client on the Terminal server clipboard and provide the same functionality as pressing PRINT SCREEN on a local computer (PRT SC)

JPA - Java Persistence API

JPA seems to be another generation of Hibernate. It seems that even SUN has problem defining the difference between them.
Sun Says:
Sun Microsystems has stated that ideas came from several frameworks, including Hibernate and JDO.
But what is JPA ? it seems it is a persistence entity is a lightweight Java class whose state is typically persisted to a table in a relational database.
So what it does, it does what Hibernate was doing plus some more extra features. What are those features ? I am not sure yet, whenever I have hands on experience I will write here.
How to use it ?
Thanks to developers of EclipseLink, you can easily use that tool utilizing JPA within Eclipse for your project. For more information about EclipseLink, please visit their website.

7 December 2010

Google Chrome OS

Do you prefer to be fast or your data to be secure ? That’s the question you want to ask. Google chrome OS is so fast. It is not even comparable with the previous used to Operating Systems. But remember, everything is on the cloud. You are not loosing any data at the price of having someone else taking care of your data. This one is Google. Your choice, how much you want Google to know about you ? That’s the question you need to answer before switching to it.
I myself can see myself using Chrome OS in its guest user mode. Which don’t store anything and you can go online and do your things.
This is a video about Google Chrome OS and how to use it.

22 November 2010

Regex in Java

If you want to use regex in Java, keep in mind one note. The backslash is a skip character in regex. In Java you need to have two backslashes to define one. For example \” in regex means a “ character. While, in java you should be using \\”. Two backslashes will translate into one in Java and then translate as a skip character for regex. It gets even trickier when you want to use a backslash in your regex. You need to have four backslashes such as \\\\. They are going to be translated into \\ for the regex and then the regex will distinguish a backslash if it exists within the string you are parsing (since \\ is the backslash annotation for regex.)

If you need a really complete and useful source for regular expression, you can always trust oreilly publishing.


12 November 2010

OData and Range Values

OData is an open source protocol designed and developed by Microsoft to enhance the data access over Internet. It can somehow be compared with Gdata (+). The one thing that is missing in OData is the ability to process Range values. For examples, you want to ask for a range of Data beginning with AAC letters to AAZ letters. You need to create a batch job and send that batch job to the sever. The batch job could be something like AAC, AAD, AAE, AAF, … AAZ. This means that you need to have a separate part of your software interpreting the Range requests and transforming them into the Batch requests.
Some notes from their website:
The body of a Batch Request is made up of an ordered series of retrieve operations (as described in[OData:Operations]) and/or ChangeSets.


8 November 2010

Pair Programming in an Agile environment

Pair programming is an agile software development technique in which two programmers work together at one work station. One types in code while the other reviews each line of code as it is typed in. The person typing is called the driver. The person reviewing the code is called the observer (or navigator). The two programmers switch roles frequently.

This is the definition of Pair programming which I for a long time called it Peer programming. To me Peer programming make more sense. I think the pair programming is mainly beneficial in specific situations such as bug fixing and new hire orientations. They learn a lot while watching someone else working and the bug fixes can go smoother while people from the same background works on a bug.
Nice, there are even remote pair programming. Imagine you can program with someone else on a different location, how does that sound ? Don’t you like that ? how about distributed pair programming ?
Jeff Atwood, at coding horror, agrees that pair programming is one of the best ways to catch bugs vs. code reviews. In code reviews people usually don’t spend much time to get to know the code but only to accomplish a task assigned to them which is code reviewing. The code might never has to do anything with them, so why they should spend time reading it ?

Agile Unified Process

Agile Unified Process (AUP) is a simplified version of the IBM Rational Unified Process (RUP). It describes a simple, easy to understand approach to developing business application software using agile techniques and concepts yet still remaining true to the RUP. The AUP applies agile techniques including test driven development (TDD), Agile Modeling, agile change management, and database refactoring to improve productivity.

Enterprise Unified Process

The Enterprise Unified Process (EUP) is an extended variant of the Rational Unified Process and was developed by Scott W. Ambler and Larry Constantine in 2000, eventually reworked in 2005 by Ambler, John Nalbone and Michael Vizdos.
EUP was introduced to overcome some shortages of RUP, namely the lack of system support and eventual retirement of a software system. So two phases and several new disciplines were added to the RUP.


5 November 2010

Google App Engine–My first hands on code experience

Google has released a new app for developer this time, which is called google app engine. This app engine allows developers to develop apps on different languages and the deploy them on the Google app engine where everyone on internet can use them.

It gets even better when you realize that it is not only an app engine but you get a full dashboard that shows you how many IOs your app has been requesting, how much memory and how much CPU time it has been requesting. These are all then illustrated in a nice (flash yet) dashboard for you to have an idea about your application performance.

This is a 10 min video describing how to use the Google App Engine, only if you are using Python as your programming language. Couldn’t yet find a video tutorial for Java yet. It shouldn’t be that hard though.


The Chicken and The Pig in Software companies

There are several variants as to how the Chicken and the Pig meet and the level of the relationship between the two.
However, in every variant, the Chicken suggests that the two involve themselves in a scheme involving ham (or bacon) and eggs (some suggest a breakfast, others suggest a restaurant). In reply, the Pig always notes that, for the Chicken, only a contribution is required (as a chicken can simply lay an egg and then resume normal activities), while for the Pig a "total commitment" (or total sacrifice) is needed (as in order to make ham or bacon, the pig must be slaughtered).


What are you ? A Pig in your company ? Or a Chick ?

A Chicken and a Pig lived on a farm. The farmer was very good to them and they both wanted to do something good for him.
One day the chicken approached the pig and said, "I have a great idea for something we can do for the farmer! Would you like to help?"
The pig, quite intrigued by this, said, "of course! What is it that you propose?"
The chicken knew how much the farmer enjoyed a good healthy breakfast. He also knew how little time the farmer had to make a good breakfast. "I think the farmer would be very happy if we made him breakfast."
The pig thought about this. While not as close to the farmer, he too knew of the farmer's love for a good breakfast. "I'd be happy to help you make breakfast for the farmer! What do you suggest we make?"
The chicken, understanding that he had little else to offer suggested, "I could provide some eggs."
The pig knew the farmer might want more, "That's a fine start. What else should we make?"
The chicken looked around...scratched his head...then said, "ham? The farmer loves ham and eggs!"
The pig, very mindful of what this implied, said, "that's fine, but while you're making a contribution I'm making a real commitment!"

Chickens and Pigs

On Agile projects the term Pig has come to describe all the developers, designers and testers who commit to the actual work. The term Chicken is applied to everyone else who make intellectual contributions but do not commit to any work.

3 November 2010

JAXB annotations and how to use them as you wish

I need to use JAXB to create an XML output for a class. This output is generated when JAXB is being called through JETTY framework (i.e. the most probably Jersey is calling JAXB within the Jetty framework).
I have found that JAXB by itself is not creating the XML schemas. However, they are needed to be consumed by JAXB. XML schemas are essential for JAXB to function (i.e. I haven’t seen a tutorial that is based only on a Java Class; every tutorial is discussing how an XML schema is being created, after parsing a specific Class.)
I also have found that within JAXB, there is a part (package or class) called schemagen that is responsible for creating the XML schemas. I think this class should be used to generate the default XML schema and then use JAXB.
Note 1: It sounds like I need to create the Schema and then use the marshalling on the Class. The only thing remaining is the values of the elements in XML; I don’t want to marshal the class but the object of it.
Note 2 : The class is needed to be mapped to the XML schema so that the object can be marshallized.
Schemagen can be located at C:\Program Files\Java\jdk1.6.0_21\bin. It is an .exe file. Thus, it would not be easy to be used within a java program.
In here it has been said that:
The jaxb-xjc.jar file contains the SchemaGenTask.class file, which allows the schema generator to be invoked from the Ant build tool.
It seems that you need to have your packages annotated in order for JAXB to be able to create schema on that. This is writing from Alex Miler that describes this annotation. This and this is the annotation specification for packages in Java Documents. In these definitions you can not find various package annotation elements to be used, it simply defines what a package annotation is.
Annotations may be used on package declarations, with the restriction that at most one annotated package declaration is permitted for a given package.
One other possible way to use the JAXB is to have a file called jaxb.index in your class path. Not sure yet what that file is and how is working.
Problem solution found:
You need to have a class passed to the newInstance(), you can simply get the class you need to marshalize using the .getClass function.
JAXBContext jContext = JAXBContext.newInstance (this.getClass ());
  1. http://download.oracle.com/docs/cd/E17802_01/webservices/webservices/docs/2.0/jaxb/samples.html
  2. http://download.oracle.com/javase/6/docs/api/javax/xml/bind/JAXBContext.html
  3. http://download.oracle.com/javase/6/docs/api/javax/xml/bind/JAXBContext.html#newInstance(java.lang.Class...)
  4. http://java.sun.com/docs/books/jls/third_edition/html/packages.html#
  5. http://tech.puredanger.com/2007/02/28/package-annotations/
  6. http://blogs.sun.com/darcy/entry/javadoc_tip_prefer_package_info
  7. http://download.oracle.com/javase/6/docs/technotes/tools/solaris/javadoc.html#sourcefiles
  8. http://cmaki.blogspot.com/2007/09/annotated-jaxb-classes.html
  9. http://www.oracle.com/technetwork/articles/javase/index-140168.html#binsch
  10. http://download.oracle.com/javaee/5/tutorial/doc/bnazf.html
  11. http://download.oracle.com/javase/6/docs/technotes/tools/share/schemagen.html
  12. https://jaxb.dev.java.net/guide/
  13. https://jaxb.dev.java.net/tutorial/
  14. http://fisheye5.cenqua.com/browse/jaxb/dist/samples/samples-src/j2s-create-marshal
  15. http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.wsfep.multiplatform.doc/info/ae/ae/twbs_jaxbjava2schema.html

28 October 2010

Jersey – Some issues with XMLElement / XMLWrapperElement in JAVA

using JAXB, Jetty and Jersey.
Any XMLElement that has a get function could not use the XMLElement or XMLElementWrapper. They can only use the get method if the variable name is not the string following the get in get method exactly. Or the variable should be set to public so that there is no get and set method is needed for it.
If you have private variable, do not use set and get methods and only use @XMLElement, it will be outputted. If you define it as public variable, then no need to use @XMLElement either.


old note: Static Method (Function)
If a method’s outcome is not really related to the object and is more of a general issue in the class or in your project, it might be a wise idea to define that as a Static method. Not defining it, do not create any harms but it is better to create as a Static method so that when you take a glance at your class, easily distinguish which methods are really related to an object.

27 October 2010

Google Data – GData

JAXB–Default Constructor

Working with JAXB, you need to have an empty constructor within your class. Any class that you are referring to from within your class is better to have this empty constructor class. I am using JAXB as part of Jetty Framework.
One other note: if you want to return result as a group (something that indent a little bit), then you need to return it as a separate class, which is a List (or ArrayList) of some other class (preferably String class).
If you want something to be shown this way:

you shouldn’t specify an XMLElement at the level of definition of the attribute in your class. If you do that, all the XML elements’ names will be the same. This way the first element will be different than the child nodes, which is really desirable.
Note: Apparently this only works in one level, you can not have multiple levels. I have tried creating different levels of classes, subclasses, inner classes, child classes but no one works. The best way to do is to use the following code
@XmlElementWrapper(name = "initialValues")
public List initialValueEntries;
and then Wrap things up in an XMLElementWrapper.
You can learn more about the default constructor of classes using the JAXB framework here.

26 October 2010

String presentation of a Double

I am trying to create an XML document. I like all elements to be String elements in the Java file. Don’t want to mess things up having different kind of elements there.
So the question is how to transfer a double into String without loosing the formatting ? something like 1.323434E7 is not what I want to be presented in the XML format. There should be a way to create a complete String presentation of a Double.
I will update this post as I figure it out. I have remembered the vice versa operation, from String to Double but not this one. It is one of those obvious things that you can not remember when it is almost HOME time!

22 October 2010

Atom Publishing Protocol

If you are new to AtomPub, like me, you might want to check this video from Google that describes AtomPub video.

The person talking in the video is Joe Gregorio.

  • To add an entry to a feed you need to POST an entry to your feed.
  • To delete and entry you need to send a DELETE entry to the server.
  • To update an entry, you need to GET the feed, update it and then PUT it back (send it back to server)

REST Architecture

These are some good videos and tutorials about RESTful Architecture.

  • It is architecture.
  • you can use it using HTTP protocol
HTTP requests
  • GET
  • PUT
  • HEAD
  • POST
Cacheable: the response can be cashed along the way
Idempotent: The request can be done multiple times
Safe: There are no side effects using that.
  • Get: Safe, Idempotent, Cacheable
  • PUT: Idempotent
  • DELETE: Idempotent
  • HEAD: Safe, Idempotent
  • POST
Code on demand: Load code on the fly (and to the browser and load them and use them)
Cache-Control: How long a response can be cached
Difference between Proxy and Gateway: Proxies are selected by user (user agent) while Gateways are selected by servers.
You can use XML-RPC and AtomPub
XML-RPC uses POST. It is not idempotent, cacheable and safe.
ATOMPUB (Zippable too, unlike XML-RPC)
  • GET – retrieve the info
  • POST- Create Resource
  • PUT- Update the resource
  • DELETE – Delete the resource

15 October 2010

Deprecated removal–First bug with high Severity

Can’t believe it, my first bug assigned is to remove a deprecated tag for a function and make it undeprecated. The severity of the problem is SERIOUS. Probably the severity is so high because of customers using the API. The easiest bug I ever fixed in my whole life.
For more information about Deprecation please refer to the wiki page.
This is a short paragraph from there:
In computer software or authoring programs standards and documentation, the term deprecation is applied to software features that are superseded and should be avoided. Although deprecated features remain in the current version, their use may raise warning messages recommending alternative practices, and deprecation may indicate that the feature will be removed in the future. Features are deprecated—rather than being removed—in order to provide backward compatibility and give programmers who have used the feature time to bring their code into compliance with the new standard.

14 October 2010

Windows 7 VMWare Issue

Today I have encountered with a VMWare problem. Not sure why it happens, but it doesn’t let me to join the network via the bridge connection. I am trying to sort it out. Using VMWare on a Windows 7 and hosting a Win 2008 server hosted on that. When Using NAT, everything works fine. However, the bridge connection does not work at all. It seems that the McAfee antivirus is sitting on top of my network card and doesn’t allow access to it via the VMWare.


Found this article about how to set up the bridge conenction in windows 7. However, the title suggests it should be fixed by now as the article discusses version 6.5 of VMWare while I am using version 7 of the VMWare.
Apparently updating to the latest version of WMWare (version 7.1.2) solved the problem that VMWare couldn’t diagnose the network adapter and just was loading the McAfee network adapter.
TIP: The source was because of an authentication failure. You might want to trick windows 7 and disable the Wired Auto Config service in Local Services (in Manage panel in Windows Control Panel). You also can disable the service from auto-start to disable so you won’t find any problem.

9 October 2010

Web Service Scenario

Looking for a way to present the way web services may call each other, come to the definition (which I was known it from before but in a different way) to workflow. Regarding this article a workflow can be used to describe how a scenario of web services can be accomplished.