doT.sYs

February 14, 2011

Creating Bottom-up Web Service (WSDL)

Filed under: Server Artifacts

This post will primarily show you how to create a simple Web Service application through Apache Axis in Eclipse, and will not dwell on explaining the background or functionality of a Web Service.

Yet, it’s a de facto to at least give a little definition.

WSDL or the Web Services Definition Language is just another specification to describe network XML-based services.
It supports message-oriented and procedural approach XML technologies. (for further reading click here)

1. Preparing the web application
a. Create a new web application and name it as “SimpleWebService”.

New Dynamic Project

b. Download and add “axis.jar” (download here) to the application libraries.
c. Edit and add this following configurations to the web.xml file.

< servlet >
	< servlet-name >AxisServlet< / servlet-name >
	< servlet-class >org.apache.axis.transport.http.AxisServlet
   < / servlet-class >
< / servlet >
< servlet >
	< servlet-name >AdminServlet< / servlet-name >
	< servlet-class >org.apache.axis.transport.http.AdminServlet
        < / servlet-class >
        < load-on-startup >100< / load-on-startup >
< / servlet >
< servlet-mapping >
	< servlet-name >AxisServlet< / servlet-name >
	/servlet/AxisServlet< / url-pattern >
< / servlet-mapping >
< servlet-mapping >
	< servlet-name >AxisServlet< / servlet-name >
	< url-pattern >*.jws< / url-pattern >
< / servlet-mapping >
< servlet-mapping >
	< servlet-name >AxisServlet< / servlet-name >
	< url-pattern >/services/*< / url-pattern >
< / servlet-mapping >

*Note: spaces were created for display purposes only, adjust accordingly.

c. Create a public class and add any transactional method. In this sample i created “SimpleMessageTransport” method that accepts a string parameter and returns it to the server.

2. Creating Web Service

After successfully creating the artifacts of the Web application, it’s now time to create the Web Service.

a. From the file menu choose “New->Web Service”.
b. Configure exactly as shown in the picture below.

wsdl-conf

c. Then click Finish, it will then open a Web Service Client where you can verify and test.

wsdl-generated

Your project structure should look like this

project-struc

Voila! you can now access your Web Service through the net!.

local-access

January 1, 2011

Happy New Year! 2011

Filed under: Uncategorized
                        C h e e r s!
                       Happy New Year!

March 15, 2010

Reviewing the BASICS

Right knowledge in OOP makes your code and implementation more reliable. This can be achieved by correct coding practice and methodology. However, there will come a time that you’ll be affront with confusion of concepts and implementation of what OOP objects to use in right and efficient way. You’ll be stuck if you’re not well equipped. In this article, I’m hoping to aid newbies in this context, familiarize you with the basics of OOP that i think you need to know to get all throughout a smooth coding spree.

Here are some common discussions found in development forums that you might find useful resource.

Static vs Non-Static

Static members : Act like global variables. There is only one instance of it in the entire program execution. They can be used with the class name directly and shared by all objects of a class.

Example on referring a static method or data member.

	
class A {
	
    static int firstInt;
    static int secondInt;
	
    static void initialize(int fnum, int snum) {
      firstInt = fnum;
      secondInt = snum;
    }
	
    static void ThisIsStaticMethod() {
                     /* first sample access */
              System.out.println(\"First Num Prints .... \" + A.fnum);
                    /* second sample access, where we omitted the class name */
              System.out.println(\"Second Num Prints .... \" + snum);    
	
    }
	
    public static void main(String argv[]) {
        /*  \"A.\" is omitted with the same result */
          initialize(55, 23);   
	
        /* \"A.\" could alse be omitted in this context */
           A.ThisIsStaticMethod();   
	
     }
	
  }
	

Non-Static members : Are defined for each object. There is a copy of each of these members for each object instantiated.

	
class A {
	
    static int firstInt;
    static int secondInt;
	
    /* Class constructor */
	
   A(int fnum, int snum) {
      firstInt = fnum;
      secondInt = snum;
    }
	
    void ThisIsAMethod() {
	
               /* first sample access */
               System.out.println(\"First Num Prints .... \" + this.fnum);
               /* second sample access, where we omitted the prefix \"this\" */
              System.out.println(\"Second Num Prints .... \" + snum);    
	
    }
	
    public static void main(String argv[]) {
	
            /* creating new instance of class A */
           A newA = new A(55, 23);  
	
           /* invoking a method through the instance of  newA */
           newA.ThisIsAMethod();    
	
     }
	
  }
	

Overloading vs Overriding

Overloading : Defining same method name with different arguments may or may not have same return type written in the same class itself.

	
      void myTestMethod(int number){
                 System.out.println(number);
      }
	
      int myTestMethodReturn(int number, int snumber){
	
             return number * snumber;
      }
	

Overriding : The methods with the same name and same number of arguments and return type, implemented differently. One is in parent class and the other is in subclass.

	
  class A {
       public  void myTestMethod(int number){
           System.out.println(\"Simply prints : \" + number);
       }
   }
	
   class B extends A {
          void myTestMethod(int number){
              super.myTestMethod(14);
              System.out.println(\"This Prints : \" + number * 14);
         }
    }

Abstract class vs Interface

Interface : Contains abstract methods and properties yet without implementation . It usually defines the characteristic of class but not its identity or how it is being implemented merely stating the “can-do” of a class.

- A class may implement several interfaces.
- When defining an interface, putting abstract and public keyword is not necessary as all the methods and properties defined in interface are by default public and abstract.

Abstract class : Provides more structure. It usually defines some default implementations and has other member like a normal class has.

- A class can extend only one abstract class.

When to use

  • Use Interface when objects share common method signatures yet must be implemented differently.
  • Use Abstract when objects implementation are all of a kind and share a common status and behavior.

Access Modifiers

  • private Makes a method or a variable accessible only from within its own class.
  • protected Makes a method or a variable accessible only to classes in the same package or subclasses of the class.
  • public Makes a class, method, or variable accessible from any other clas.

Class, Method, and Variable Modifiers

  • abstract Used to declare a class that cannot be instantiated, or a method that must be implemented by a nonabstract subclass.
  • class Keyword used to specify a class.
  • extends Used to indicate the superclass that a subclass is extending.
  • final Makes it impossible to extend a class, override a method, or reinitialize a variable.
  • implements Used to indicate the interfaces that a class will implement.
  • interface Keyword used to specify an interface.
  • native Indicates a method is written in a platform-dependent language, such as C.
  • new Used to instantiate an object by invoking the constructor.
  • static Makes a method or a variable belong to a class as opposed to an instance.
  • strictfp Used in front of a method or class to indicate that floating-point numbers will follow FP-strict rules in all expressions.
  • synchronized Indicates that a method can be accessed by only one thread at a time.
  • transient Prevents fields from ever being serialized. Transient fields are always skipped when objects are serialized.
  • volatile Indicates a variable may change out of sync because it is used in threads.

February 22, 2010

How to get rid of VB Script Just-In-Time Debugger Error

Filed under: Uncategorized

Lately i have been pestered with a lame error every time my Windows starts up. The “VB Script Just-In-Time Debugger Error” shows up and it would terminate the explorer.exe process upon clicking OK. Somehow something went wrong in the system but the error does not specifically says what it is. I don’t have a clue how to resolve it.

We all know explorer.exe is critical for all windows to work, thus leaving me no choice but to run it manually. For normal users who do not know how to run the explorer.exe manually, they will be paralyzed. They won’t find their way to work it except to ask for help, which sometimes can be so annoying specially when you’re up to finish a deadline.

Luckily, i was so persistent enough to search for a solution. Though no one gave the exact process of eliminating this error, I come up to finally solve it through my compilation of readings and i’ll share it with you.

Here's how to get rid of this error:
	
1. Open Regedit (Under Run, type regedit)
2. Delete the key \"Debugger\" under
     HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug\
3. Delete the key \"DbgManagedDebugger\" under
     HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\

That’s it! You’ll be free of this annoying error. :)

December 31, 2009

Feliz Año Nuevo

Filed under: Uncategorized

Welcome 2010!
Cheers!
Keep blogging!

December 7, 2009

Search Engine Optimization (SEO)

Filed under: Server Artifacts

Often we focus our site development mainly on its GUI (Graphical User Interface) and content, although this is very critical and needed, yet we tend to neglect adding some essentials that also need to be considered and included in order to optimize the site search ability. We want surfers to find and read our sites especially if we want to market something, thus it is important to make sure that our site link will be included in the list of search results on any search engines.

The question is how will you do it? How will Google, Yahoo, msn etc, will find your site be indexed and included in their search results?

There are a lot of things to learn and take into consideration if you want to optimize your site. Before proceeding, I’ll provide primary reference for you to get started before jumping into SEO. Read through this and decide if you need to reconstruct your site or not.

Google Webmaster Site – This will acquaint you to search engines basic concepts.
Webmaster Guidelines - This will help you effectively design your site.

You could start doing little SEO for your sites through these few tips:

1. Search engines search in a diagonal pattern, from most top-left to bottom-right portion of your page. To illustrate this see figure.

crawler

The page title is always the first one searched, so never leave the tag <title> unspecified. Moreover, it is wise to specify the page title that accurately defines your content.

2. Always use metadata in your site.

* Keywords - this is used to define other related words that might describe your page content. This is usually the search keys that are entered in searching.

     You could use help and look into some useful keywords for your site through this link https://adwords.google.com/select/KeywordToolExternal

     e.g. : <meta name=”keywords” content=”search engine optimization”>

    note: always use lower case for keywords.

* Description - Meta description usually tells the page structure.

    e.g. : <meta name=”description” content=” SEO ★ Search Engine Optimization ★ Tips on how to include SEO techniques.”>

    Special tip: include star ★ “&#9733;” in your meta description, this will help rank your page.

3. H1 tag – The first two are included in the first quadrant of the SEO structure. The next important to take note is your content heading or the use of the H1 tag <h1>. If nothing matched from the first quadrant, the engine will look into the content heading before proceeding into its content.

However, if H1 is not matched, it is unlikely to land in the list of its search results.

4. Footer and links – The last part that the engine will look into is the page footer and links. Defining your link precisely will give the page impression a little high.

There, I hope this will help you somehow on planning and creating your web sites.

November 16, 2009

DOJO Key Links

Filed under: Scripting Language, AJAX

A lot of sites, blogs and forums have emerged nowadays, you might find yourself cluttered with information that doesn’t really solved your DOJO needs. It is always a good practice to keep one solid reference that you can come back every time you stumble into your codes.

Here are useful links that might help you begin and work around with DOJO.

DOJO API

DOJO FORUM

October 5, 2009

7 Ways to gain healthy workforce

Filed under: All Around Work

I am reposting an article ( 7 Habits To Win In Office Politics ) that was originally from lifehack.org authored by Lawrence Cheok, but with my own interpretations.

I found this post helpful and factual and thought that it might also get you to work around on hard times in your own office or workforce. Everything that is posted in here is purely objective, thus you may agree or not agree on points that i might find essential. However, there is always a room for discussions and exchange of views, you may post comments or share more ways that you think should be included in this list.

Way # 1. Be aware you have a CHOICE

In all circumstances, disputes and disagreements arise without caution that can break or make your career. You just have two options when this comes your way, be sober and drool over the situation or get over it and move forward. It is up to you to choose the right feelings for the situation, staying long in aggression is not a good idea neither being numb about it. Be wise enough to control your feelings since this is the hardest to control, it might get out of way.

Way # 2. Know what you are trying to ACHIEVE

When you know what is you goal, even conflicts may arise as long as everyone has its fixed mind to reached a same goal, you will find that at the end of the day everybody has a POINT and had CONTRIBUTED on their own way to accomplished what all of you wanted to achieve .

Way # 3. Focus on your CIRCLE OF INFLUENCE

You might often complain on such given constraints, yet you must cling on more possitive sides when working. Keep thinking of good things why you are still working and never be a victim of helplessness.

“What tangible results do bitching really accomplish? In most instances, none.” Lawrence Cheok

Way # 4. Don’t take SIDES

Know your principles and trust your own assessments, in case you need to decide on things that has colliding point of views from your different bosses, tap your shoulder and be confident to stand on all of them try to convey your own ideas without taking sides yet still maintaining a good channel of communication.

Way # 5. Don’t get PERSONAL

Never go personal. Reserve yourself and save further damage in your relationship. Insults on personal things can cause grave offense and a real blacklist in his list of good employees and possible promotions.

Way # 6. Seek to UNDERSTAND, before being UNDERSTOOD

“The reason people feel unjustified is because they felt misunderstood.” Lawrence Cheok
Don’t be so consumed with your own personal gratification that everyone must understand you, why not try to get out of that shell and start understanding them instead. It is always a two way channel, if they feel that you understood them, everntually they will try to understand you too.

Way # 7. Think WIN-WIN

Get rid of the idea that when someone wins somebody else loses. When you try hard to think of ways that everyone can win, you’ll find things are a lot easer. All six ways boils down to this application it will be a WIN-WIN situation if you learn to practice all those above mentioned.

September 14, 2009

Web Publisher *grrr

I’ve done minimal programming stuffs for two months now. It is a sign that things are not going too well, I miss squeezing juice of logic from my brain from time to time (*sad). I miss using programming IDEs and having headaches due to overtime work. Weird huh? Yes, I guess I am.

Maybe you’re wondering what I have been up to, here is a gist of what my work is like for the past two months.

I’ve been maintaining the company corporate web site, cool isn’t? big time! Sounds fun and interesting and seems to have tons of programming stuffs to be done right? But you’re wrong. In the beginning of the project we all thought that we’ll be doing a lot of programming jobs and expecting to encounter complicated codes especially dojo scripts (my knowledge in dojo is the reason why I was chosen to be part of the project). But to my dismay, the company uses a web publisher that allows any key employee to update the content anytime as they desire but not the layout and other technical details of the site, because that task belongs to us, the maintenance team.

We change layouts, files, flash even pictures and sometimes fix *text bugs. Read it right, yes we often edit text contents, which I previously mentioned can be done by any marketing stuff. It has never been my pleasure to design, it’s not my inclination I guess, yet I’ve been doing design edits for pete sake! I’ve been changing menu and page layouts, resizing pictures, doing a new flash file, and the like and all to be uploaded in that web publisher. Where the hell is PROGRAMMING in that?

My usual know-how about websites are done coding all throughout the site, yet by using this *certain web publisher, less codes are needed, you only deal with xml files (you don’t need much logic in it). To non-IT, the tool is a great help, even fantastic, the tool was created in Java, reliability and functionality is not a question. But to programmers like me it is a pain in the ass. I’ve noticed numerous things that can be easily done when you code it. Plus the publisher took a lot of time for development, aside from its slowness, you need to checkout the files if is already existing and checkin an edited one or the latest file or simply import a new file, but that does not end there, you still need to promote it from three stages (WIP, Staging, Active) and finally publish it. See what I mean? Four key steps that you need to do. *haist it just simply bores me.

Ahhh d***! I need to stop complaining *sigh. I guess I just miss my programming days.

*Cheers to all programmers!

July 29, 2009

Apache Solr and Nutch

I have not post for quite a long time since my last post. I’ve been busy doing the new project I am now into. As a sweet fruit of labor, I would like to share some knowledge I have gained in this new venture.

I was assigned to the global IT projects together with two more colleagues. A lot of new technologies that we need to cope up with, especially dealing with the critical and gem departments of the company - marketing and sales, every detail is scrutinized and case studied thoroughly. Quality and reliability of the system is the top most importance of the development. A portion of everything done is the server configuration and optimization; this is to aid the system for the search management and site hits. The standard tools used by the company are Solr and Nutch working together pretty well, thus we end up studying these technologies.

A brief description:

Apache Solr - is an open source enterprise search server based on the Lucene Java search library, with XML/HTTP and JSON APIs, hit highlighting, faceted search, caching, replication, and a web administration interface. It runs in a Java servlet container such as Apache Tomcat. [Wikipedia.org]

NUTCH - is open source web-search software. It was built on Lucene Java, adding web-specifics, such as a crawler, a link-graph database, and parsers for HTML and other document formats. [Lucene.apache.org]

It is coded completely in the Java programming language, but data is written in language-independent formats.
Nutch has a highly modular architecture allowing developers to create plugins for the following activities: media-type parsing, data retrieval, querying and clustering.
The fetcher (”robot” or “web crawler”) has been written from scratch solely for this project. [Wikipedia.org]

In general, Solr and Nutch harmoniously work together as it is both in-house software of Lucene project. Solr generally is responsible for the search and return capability of the system. If the user first searched an item, Solr technology is the one responsible for caching the search and the returned results. It has great API for JSON, XML as the format of the returned results. Other than caching, Solr have also these following features :

• Uses the Lucene library for full-text search
• Faceted navigation
• JSON, XML, PHP, Ruby, Python and custom Java binary output formats over HTTP
• HTML administration interface
• Replication to other Solr servers
• Extensible through plugins
• Distributed Search
• Caching

On the other hand, Nutch acts as the crawler, a mimic of the “goolge crawler” and other search engine crawler (im totaly a big fun of google. *grin). After hitting the search button, nutch would look for the search item into the entire web application and indexed its location and return its details to Solr if it is found.

To incorporate these in your web application, download the latest release of Solr and Nutch, and install it to your server and follow the configuration guidelines for each. Viola! Your system would have its own search engine with no sweat! *wink



Blog Redesigned by Karen Eve R. Eso