Sunday, December 5, 2010

Show images on Blogger with jQuery plugin: LightBox

LightBox is a powerful library for viewing images on the web written in JavaScript. You can easily integrate LightBox into Blogger as following steps:

1, Download the Javascript and CSS files as aforementioned link.
2, Upload those code to somewhere website supported link (Google pages is a good choice because you suppose to write blog with Blogger)
3, Go to "Edit HTML Template" in your Blogger then add the following code in head
<link href="https://sites.google.com/site/xuvifblog/jquery.lightbox-0.5.css" media="screen" rel="stylesheet" type="text/css"></link>
<link href="https://sites.google.com/site/xuvifblog/SyntaxHighlighter.css" media="screen" rel="stylesheet" type="text/css"></link>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script src="https://sites.google.com/site/xuvifblog/jquery.lightbox-0.5.min.js">
4, Save as Template
5, Write your blog as this example
<div id="gallery">
<a href="http://leandrovieira.com/projects/jquery/lightbox/photos/image1.jpg">
<img height="50px" src="http://leandrovieira.com/projects/jquery/lightbox/photos/image1.jpg" width="50px" /></a> <a href="http://leandrovieira.com/projects/jquery/lightbox/photos/image2.jpg">
<img height="50px" src="http://leandrovieira.com/projects/jquery/lightbox/photos/image2.jpg" width="50px" /></a>
</div>
<script type="text/javascript">
    $(function() {
       $('#gallery a').lightBox({fixedNavigation:true});
    });
</script>

Enjoy!


Tuesday, March 31, 2009

Building webservice with spring and xfire

Download: sping-xfire.war


In previous post, I wrote a simple webservice by using apache axis. And today, I will show you how to make a webservice by using spring and xfire.
I assume that you have been similar with IDE and will detail in how to configure the application.
Library:
+ spring.jar
+ xfire.jar
+ log4j.jar
+ commons-logggin.jar
+ jdom.jar
Now, let look at application structure:


+EchoService.java is an interface in which there're one function:
public String printback(String text);
+EchoServiceImpl.java: implemented class of the above interface.




Here is web.xml:



then application.xml:



then xfire-servlet.xml:

Friday, March 27, 2009

A simple webservice with Apache Axis

Download:ws-simple.war
Hi readers,
    There're many ways to depvelop a webservice. In this post, I want to introduce a way to build webservice with apache axis (http://ws.apache.org/axis/). I'm going to implement a very simple function: when receiving a request from client, server will reponse a string to client.
What should we need?
    IDE: Eclipse 3.4.
    Library: apache axis.
      +axis.jar
      +commons-discovery-0.2.jar
      +commons-logging.jar
      +jaxrpc.jar
      +saaj.jar
      +wsdl4j.jar
Steps:
1, Create a dynamic web project inside eclipse.
2, Add the librarise (as listed above) into the project, also add these to build path.
3, Write your codes.
4, Export war file (using eclipse or ant task).
5, Put war file into apache tomcat server (webapps directory)
6, Open browser and test (eg: http://localhost:8080/ws-simple/services/EchoService?wsdl)

The picture below is the structure of application.


Let look inside the application:
+User.java is a complex parameter of webservice.
+IEchoService.java is an interface in which there're three functions:
        public String echo(String message);
        public String addUser(User user) throws Exception;
        public String printback(String text);
+EchoServiceImpl.java: implemented class of the above interface.
+Declare Axis servlet in web.xml file.
+Expose the webservice by using server-config.wsdd file.
    -To create server-config.wsdd file we can use Java2WSDL tool inside apache axis library.