10 reasons Why Cloud Computing is the Wave of the Future - LaptopLogic.com: "10 reasons Why Cloud Computing is the Wave of the Future
April 29, 2009 at 10:04:35 AM, by Gilberto J. Perera Rating: 0 out of 5
What is all this Cloud computing mumbo jumbo about and why should I care? Our editor Gilberto J. Perera puts it to us straight.
Before we delve into the reasons why cloud computing is the wave of the future we must first understand what cloud computing is. According to Berkeley scientists, 'Cloud computing refers to both the applications delivered as services over the Internet and the hardware and systems software in the datacenters that provide those services. The services themselves have long been referred to as Software as a Service (SaaS), so we use that term. The datacenter hardware and software is what we will call a Cloud.'
So what does this mean? Simply put, companies (Google, Microsoft, Amazon) will provide users with software that resides on their servers in the 'cloud' or the 'grid' so that users can access that software and information from anywhere and on any computer attached to the internet. In other words software would cease to be just a tangible product that you buy and install on your computer. Software is evolving into a service that you access from your computer over the internet. Examples of cloud computing can be seen with services like Gmail, Google Docs, Office Live, SOHO, and other online platforms.
In the past couple of years software providers have been moving more and more applications to the 'cloud', this article discusses some of the reasons why cloud computing is the wave of the future in terms of delivering software as a service.
1. Software as a Subscription
In a cloud, software resides on a service providers servers external to a user’s computer. In a sense users would not have to buy software for their computers because the software is loaded per use while the user is online (via a browser or some kind of connector application). The only models that would support this type of software use would be a subscription based or pay as you go model. Instead of shelling $149 for Office Home & Student, a user may pay a set fee/month; say $5.95/month and the user can tailor their subscription to meet their needs. This will keep users from buying software that is bundled with applications the user may not care for. A perfect example of this is the Office Suite.
2. Reduced Software Maintenance
By keeping the software in the 'clouds' users can reduce the amount of maintenance on their computers. Nowadays essentially every program installed on a computer has an update function that searches for the latest software changes in order to patch security flaws, correct software issues, and/or introduce new functionality. When upgrades are made to software on the cloud it does not affect the user's computer, it would not require for the user to restart their computers, it would simply mean that unless the change affects functionality or visual elements, the user will be oblivious to those updates and their computers will never be affected by those updates. A reasonable reduction in systems maintenance would be expected as a result of this.
3. Increased Reliability
Increased reliability stems from the fact that the cloud runs on systems that are extremely reliable and provide some form of redundancy. Unless a user takes the time to setup a backup system for their files or sets up some kind of redundancy with offsite backups, etc. Users run the risk of losing valuable and sometime unrecoverable data on their computers. In the case of grid computing if a storage server on the cloud fails due to hardware or software issues, the service provider needs only to shift the load over to other servers or bring up a backup server in its place. If it occurred at a users premises with installed software a simple issue can turn to hours of technical support over the phone, costly downtime, and unhappy users and customers.
4. Increased Scalability
Running out of hard drive space at home? Looks like an additional hard drive along with a visit to a computer technician for installation will solve the problem. However in a cloud computing environment, storage is not an issue, as long as you can pay for it. Service providers need only to add servers or shift load from one server to another to accommodate for the additional use of space. The same goes for application use, instead of a small business adding additional servers to handle business transactions all they have to do is contact the service provider to let them know that they will need additional resources.
5. Cost Reduction
Costs are reduced in a number of ways. Capital expenditures are reduced because a lot of the load and storage will be shifted over to the service provider who can provide that service at a lower cost. Aside from decreased capital expenditures associated with hardware purchases, users would see the cost of software decrease due to the reduced cost of subscription software. IT staff at businesses would be reduced because the majority of the maintenance is performed at the service provider.
6. Environmentally Friendly
One of the greatest advantages of cloud computing is the increased longevity and use of older hardware used by datacenters. This in turn lessens the amount of electronic waste dumped because equipment is older and increased use of those resources. When businesses use current assets instead of purchasing additional hardware they reduce the size of their carbon footprint because it is one less server that is put into service, it is one less server that is consuming electricity .
7. Matches Current Computing Trends
The introduction of the netbooks has moved a lot of sales from computers and laptops with more powerful processors and extended capabilities to less powerful and more efficient platforms . This signals that users are looking for computers that meet their needs and are affordable. The advent of cloud computing will be able to match this trend because a lot of the processing overhead is performed at the servers and not the computer, so the need for an extremely powerful computer is muted. As cloud computing matures and more and more processing is shifted to the cloud, computers will require less processing power and will have basic functionality.
8. Portability/Accessibility
One the greatest advantages to grid computing is the availability of files and software anywhere that there is an active internet connection. This brings forth added accessibility and productivity for those that are on the road and require access to files and software. With a large number of companies looking for alternatives to employees working at the office and the increasing number of employees making up a mobile workforce. The reduction in application costs and technical support would easily continue to support this trend towards a mobile workforce that would utilize the computer grid.
9. Efficient Use of Computer Resources
The advent of virtualization has provided companies with ways to efficiently used their computer resources. Users no longer require separate servers for different applications. With virtualization multiple server technologies can run from a single server. This shift to virtualization supports the growth of cloud computing due to the increased capabilities of servers. Cloud computing would also simplify IT's role in computer management because computers would be software agnostic.
10. Versionless Software
Versionless software refers to the elimination of software upgrade projects. Changes and updates to software would be constant and version numbers would be transparent to the user, all the user would see is added functionality. It would also give users '...access to new technology early and often rather than forcing them to wait for a final, packaged product to be shipped. ' This concept will enable the enterprise to remain in the cutting edge of technology and would reduce training costs associated with new software releases.
As one can see the case for cloud computing is quite appealing. The shift towards cloud computing would enable businesses to save money while minimizing their impact on the environments. Users would have the flexibility of accessing information from anywhere on the planet where an internet connection exists. Everyone will benefit from the increased availability and affordability of applications that were beyond their reach due to cost and complexity with maintenance and installation. Lastly the need for additional training associated with new product releases would be eliminated to due to the nature of the applications constant changing state."
Friday, May 1, 2009
Tuesday, April 21, 2009
LCD TV - PC World

LCD TV - PC World: "LCD TV
Expert advice on buying an LCD TV.
PC World Staff (Good Gear Guide) 26/02/2009 15:50:00
Page:
*
1
* 2
* 3
* 4
* 5
* 6
* next >
* How does LCD Work?
* Does size matter?
* Is the native resolution really High Definition?
* What differentiates one LCD TV from another?
* What do you need to connect?
* Watching TV
* Don't wait forever!
We use LCD technology every day, from a simple alarm clock to the screen on your mobile phone. LCD television is the pinnacle of that technology; the end product of continual rigorous development and ingenious design. As each new generation rolls out of the world's LCD plants, the innovations are numerous and accompanied by a leap in quality and capability. This poses a unique problem for consumers that they have never really had to face before when buying a television. The market is flooded with choice, and with the high price of flat panel televisions it is hard to make the right decision with confidence. The purpose of this Buying Guide is to show you what to look out for so that you will take home the panel that best suits your needs, your budget and your lounge room.
How does LCD Work?"
Server Operating Systems - PC World
Server Operating Systems - PC World: "Server Operating Systems
PC World Staff (PC World) 18/10/2002 11:50:05
So you're looking at moving to a client-server model. You want to take the documents that are randomly scattered on the hard disks of the office PCs and manage them in a single directory, accessible at any time from any PC in the office. Maybe you want to get your own Internet domain name and have a Web site that you host locally, or build an Intranet for staff information and communication. Perhaps you just want to take your single DSL link and provide secure Net access for everybody in the office.
If you're running a small business and have more than two or three PCs in the office, it's time to start looking at setting up a server. One of your first considerations will be which server operating system (OS) to use.
What is a server operating system? (Back to contents)
Server OSes are designed from the ground up to provide platforms for multi-user, frequently business-critical, networked applications. As such, the focus of such operating systems tends to be security, stability and collaboration, rather than user interface.
Server OSes provide a platform for multi-user applications, and most come bundled with a batch of common server applications, such as Web servers, e-mail agents and terminal services.
Back"
PC World Staff (PC World) 18/10/2002 11:50:05
So you're looking at moving to a client-server model. You want to take the documents that are randomly scattered on the hard disks of the office PCs and manage them in a single directory, accessible at any time from any PC in the office. Maybe you want to get your own Internet domain name and have a Web site that you host locally, or build an Intranet for staff information and communication. Perhaps you just want to take your single DSL link and provide secure Net access for everybody in the office.
If you're running a small business and have more than two or three PCs in the office, it's time to start looking at setting up a server. One of your first considerations will be which server operating system (OS) to use.
What is a server operating system? (Back to contents)
Server OSes are designed from the ground up to provide platforms for multi-user, frequently business-critical, networked applications. As such, the focus of such operating systems tends to be security, stability and collaboration, rather than user interface.
Server OSes provide a platform for multi-user applications, and most come bundled with a batch of common server applications, such as Web servers, e-mail agents and terminal services.
Back"
Drag & Drop <DIV> in HTML Using Java script
<head>
<title>Drag 'N' Drop</title>
<script>
function $(v) { return(document.getElementById(v)); }
function agent(v) { return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0)); }
function xy(e,v) { return(v?(agent('msie')?event.clientY+document.body.scrollTop:e.pageY):(agent('msie')?event.clientX+document.body.scrollTop:e.pageX)); }
function dragOBJ(d,e) {
function drag(e) { if(!stop) { d.style.top=(tX=xy(e,1)+oY-eY+'px'); d.style.left=(tY=xy(e)+oX-eX+'px'); } }
var oX=parseInt(d.style.left),oY=parseInt(d.style.top),eX=xy(e),eY=xy(e,1),tX,tY,stop;
document.onmousemove=drag; document.onmouseup=function(){ stop=1; document.onmousemove=''; document.onmouseup=''; };
}
</script>
</head>
<body>
<div style="cursor: pointer; position: relative; top: 0; left: 0; background-color: #009ACF; height: 20px; width:120;" onmousedown="dragOBJ(this,event); return false;"> Drag 'N' Drop this </div>
</body>
<title>Drag 'N' Drop</title>
<script>
function $(v) { return(document.getElementById(v)); }
function agent(v) { return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0)); }
function xy(e,v) { return(v?(agent('msie')?event.clientY+document.body.scrollTop:e.pageY):(agent('msie')?event.clientX+document.body.scrollTop:e.pageX)); }
function dragOBJ(d,e) {
function drag(e) { if(!stop) { d.style.top=(tX=xy(e,1)+oY-eY+'px'); d.style.left=(tY=xy(e)+oX-eX+'px'); } }
var oX=parseInt(d.style.left),oY=parseInt(d.style.top),eX=xy(e),eY=xy(e,1),tX,tY,stop;
document.onmousemove=drag; document.onmouseup=function(){ stop=1; document.onmousemove=''; document.onmouseup=''; };
}
</script>
</head>
<body>
<div style="cursor: pointer; position: relative; top: 0; left: 0; background-color: #009ACF; height: 20px; width:120;" onmousedown="dragOBJ(this,event); return false;"> Drag 'N' Drop this </div>
</body>
Sunday, April 12, 2009
How to change Eclipse SVN Plugin Password?
How to change Eclipse SVN Plugin Password: "Subclipse does not collect or store username and password credentials when defining a repository. This is because the JavaHL and SVNKit client adapters are intelligent enough to prompt you for this information when they need to — including when your password has changed.
You can also allow the adapter to cache this information and a common question is how do you delete this cached information so that you can be prompted again? We have an open request to have an API added to JavaHL so that we could provide a UI to do this. Currently, you have to manually delete the cache. The location of the cache varies based on the client adapter used.
JavaHL caches the information in the same location as the command line client — in the Subversion runtime configuration area. On Windows this is located in %APPDATA%\Subversion\auth. On Linux and OSX it is located in ~/.subversion/auth. Just find and delete the file with the cached information.
SVNKit caches information in the Eclipse keyring. By default this is a file named .keyring that is stored in the root of the Eclipse configuration folder. Both of these values can be overriden with command line options. To clear the cache, you have to delete the file. Eclipse will create a new empty keyring when you restart."
You can also allow the adapter to cache this information and a common question is how do you delete this cached information so that you can be prompted again? We have an open request to have an API added to JavaHL so that we could provide a UI to do this. Currently, you have to manually delete the cache. The location of the cache varies based on the client adapter used.
JavaHL caches the information in the same location as the command line client — in the Subversion runtime configuration area. On Windows this is located in %APPDATA%\Subversion\auth. On Linux and OSX it is located in ~/.subversion/auth. Just find and delete the file with the cached information.
SVNKit caches information in the Eclipse keyring. By default this is a file named .keyring that is stored in the root of the Eclipse configuration folder. Both of these values can be overriden with command line options. To clear the cache, you have to delete the file. Eclipse will create a new empty keyring when you restart."
Wednesday, April 8, 2009
Tutorial: Hello World with Ant
Tutorial: Hello World with Ant: "Tutorial: Hello World with Ant
This document provides a step by step tutorial for starting java programming with Ant. It does not contain deeper knowledge about Java or Ant. This tutorial has the goal to let you see, how to do the easiest steps in Ant.
Content
* Preparing the project
* Enhance the build file
* Enhance the build file
* Using external libraries
* Resources
Preparing the project
We want to separate the source from the generated files, so our java source files will be in src folder. All generated files should be under build, and there splitted into several subdirectories for the individual steps: classes for our compiled files and jar for our own JAR-file.
We have to create only the src directory. (Because I am working on Windows, here is the win-syntax - translate to your shell):
md src
The following simple Java class just prints a fixed message out to STDOUT, so just write this code into src\oata\HelloWorld.java.
package oata;
public class HelloWorld {
public static void main(String[] args) {
System.out.println('Hello World');
}
}
Now just try to compile and run that:
md build\classes
javac -sourcepath src -d build\classes src\oata\HelloWorld.java
java -cp build\classes oata.HelloWorld
which will result in
Hello World
Creating a jar-file is not very difficult. But creating a startable jar-file needs more steps: create a manifest-file containing the start class, creating the target directory and archiving the files.
echo Main-Class: oata.HelloWorld>myManifest
md build\jar
jar cfm build\jar\HelloWorld.jar myManifest -C build\classes .
java -jar build\jar\HelloWorld.jar
Note: Do not have blanks around the >-sign in the echo Main-Class instruction because it would falsify it!
Four steps to a running application
After finishing the java-only step we have to think about our build process. We have to compile our code, otherwise we couldn't start the program. Oh - 'start' - yes, we could provide a target for that. We should package our application. Now it's only one class - but if you want to provide a download, no one would download several hundreds files ... (think about a complex Swing GUI - so let us create a jar file. A startable jar file would be nice ... And it's a good practise to have a 'clean' target, which deletes all the generated stuff. Many failures could be solved just by a 'clean build'.
By default Ant uses build.xml as the name for a buildfile, so our .\build.xml would be:
<project>
<target name='clean'>
<delete dir='build'/>
</target>
<target name='compile'>
<mkdir dir='build/classes'/>
<javac srcdir='src' destdir='build/classes'/>
</target>
<target name='jar'>
<mkdir dir='build/jar'/>
<jar destfile='build/jar/HelloWorld.jar' basedir='build/classes'>
<manifest>
<attribute name='Main-Class' value='oata.HelloWorld'/>
</manifest>
</jar>
</target>
<target name='run'>
<java jar='build/jar/HelloWorld.jar' fork='true'/>
</target>
</project>
Now you can compile, package and run the application via
ant compile
ant jar
ant run
Or shorter with
ant compile jar run"
This document provides a step by step tutorial for starting java programming with Ant. It does not contain deeper knowledge about Java or Ant. This tutorial has the goal to let you see, how to do the easiest steps in Ant.
Content
* Preparing the project
* Enhance the build file
* Enhance the build file
* Using external libraries
* Resources
Preparing the project
We want to separate the source from the generated files, so our java source files will be in src folder. All generated files should be under build, and there splitted into several subdirectories for the individual steps: classes for our compiled files and jar for our own JAR-file.
We have to create only the src directory. (Because I am working on Windows, here is the win-syntax - translate to your shell):
md src
The following simple Java class just prints a fixed message out to STDOUT, so just write this code into src\oata\HelloWorld.java.
package oata;
public class HelloWorld {
public static void main(String[] args) {
System.out.println('Hello World');
}
}
Now just try to compile and run that:
md build\classes
javac -sourcepath src -d build\classes src\oata\HelloWorld.java
java -cp build\classes oata.HelloWorld
which will result in
Hello World
Creating a jar-file is not very difficult. But creating a startable jar-file needs more steps: create a manifest-file containing the start class, creating the target directory and archiving the files.
echo Main-Class: oata.HelloWorld>myManifest
md build\jar
jar cfm build\jar\HelloWorld.jar myManifest -C build\classes .
java -jar build\jar\HelloWorld.jar
Note: Do not have blanks around the >-sign in the echo Main-Class instruction because it would falsify it!
Four steps to a running application
After finishing the java-only step we have to think about our build process. We have to compile our code, otherwise we couldn't start the program. Oh - 'start' - yes, we could provide a target for that. We should package our application. Now it's only one class - but if you want to provide a download, no one would download several hundreds files ... (think about a complex Swing GUI - so let us create a jar file. A startable jar file would be nice ... And it's a good practise to have a 'clean' target, which deletes all the generated stuff. Many failures could be solved just by a 'clean build'.
By default Ant uses build.xml as the name for a buildfile, so our .\build.xml would be:
<project>
<target name='clean'>
<delete dir='build'/>
</target>
<target name='compile'>
<mkdir dir='build/classes'/>
<javac srcdir='src' destdir='build/classes'/>
</target>
<target name='jar'>
<mkdir dir='build/jar'/>
<jar destfile='build/jar/HelloWorld.jar' basedir='build/classes'>
<manifest>
<attribute name='Main-Class' value='oata.HelloWorld'/>
</manifest>
</jar>
</target>
<target name='run'>
<java jar='build/jar/HelloWorld.jar' fork='true'/>
</target>
</project>
Now you can compile, package and run the application via
ant compile
ant jar
ant run
Or shorter with
ant compile jar run"
Technology... Innovation... Automation
Technology... Innovation... Automation: "ANT as a automation tool
When it come to build automations, ANT is one of the most powerful tool that can be used. There might be other tools too, but ANT is most widely available and usable. If you are new to ANT then visit http://ant.apache.org. If you want to explore the power of ANT then visit http://ant.apache.org/manual/index.html.
To write or use ANT first you will have to install it. To find out from where to download and how to isntall ANT please visit http://ant.apache.org/manual/install.html.
Here I will take an process as an example and we'll see how we can automate the process using ANT and make our life easier.
Consider the following process:
You have some bunch of programmers working on a project and you are using a central repository; CVS or VSS. At the end of the day when all the programmers are done with their devlopment/bug fixing task for the day a monotonous process is required to be followed. All the source code from the repository needs to be taken and sent to your team at other end (Onsite) through ftp. This process can be broken down in to following steps:
1. Get the latest source code from the repository.
2. Label the source code appropriately to indicate today's work.
3. Filter the files that need to be send.
4. Archive your source code to zip or gzip.
5. Upload the zip file to ftp.
6. And finally send a mail to all the stakeholders stating the upload path and a release note.
Now if we perform this process manually, it will take considerable time and might also cause problems due to human errors.
But if we automate this process, believe me it will not take more than 30 secs to release a project with around 500 source files. What we need to do is identify the atomic tasks to be performed and automate them.
As you can see, the steps mentioned above are atomic tasks that needs to be performed. ANT provides a huge set of core as well as optional tasks [].
I hope that you have basic knowledge about targets, tasks, taskdef etc.
We will define each step or set of steps as a target. Though the complete script can be writting in one target, I prefer it former way for obvious reasons.
The paramters specified in the code snippets are explained in the end.
Considering the above process;
1. Get the latest source code from the repository.
If you are using CVS, ANT provides core task to perform CVS operations.
This can be written in ANT as:
<cvspass cvsRoot='${cvs.root}' password='${cvs.pass}' passfile='.cvs-pass'/>
<cvs command='login' cvsRoot='${cvs.root}' passfile='.cvs-pass'/>
<cvs dest='${base.dir}' cvsRoot='${cvs.root}' command='update -A -dPC' passfile='.cvspass'/>
If you are using VSS, ANT provides optional task for the same.
<vssget serverpath='${vss.server}' vsspath='${vss.path}/${app.name}' ssdir='${vss.ssdir}' localpath='${base.dir}' login='${vss.username},${vss.pass}' recursive='true' />
The piece of code above will get the latest version of code from repository into the specified destination folder.
2. Label the source code appropriately to indicate released work.
<echo message='Tag ${vss.path}/${app.name} with ${app.name}-${timestamp}'/>
<cvs cvsRoot='${cvs.root}' command='tag ${app.name}-${timestamp}' package='${app.name}' passfile='.cvspass'/>
If you are using VSS, ANT provides optional task for the same.
<echo message='Label ${vss.path}/${app.name} with ${app.name}-${timestamp}'/>
<vsslabel serverpath='${vss.server}' vsspath='${vss.path}/${app.name}' ssdir='${vss.ssdir}' login='${vss.username},${vss.pass}' label='${app.name}-${timestamp}' />
The above two tasks can be specified in one target for modularity and hence the reaulting target will be:
<!-- CVS task Starts-->
<target name='cvs' description='get the latest source code from CVS' >
<cvspass cvsRoot='${cvs.root}' password='${cvs.pass}' passfile='.cvs-pass'/>
<cvs command='login' cvsRoot='${cvs.root}' passfile='.cvs-pass'/>
<cvs dest='${base.dir}' cvsRoot='${cvs.root}' command='update -A -dPC' passfile='.cvspass'/>
<cvs cvsRoot='${cvs.root}' command='tag ${app.name}-${timestamp}' package='${app.name}' passfile='.cvspass'/>
</target>
<!-- CVS task ends -->
<!-- VSS task starts -->
<target name='vss' description='get the latest source code from VSS' >
<vssget serverpath='${vss.server}' vsspath='${vss.path}/${app.name}' ssdir='${vss.ssdir}' localpath='${base.dir}' login='${vss.username},${vss.pass}' recursive='true' />
<echo message='Label ${vss.path}/${app.name} with ${app.name}-${timestamp}'/>
<vsslabel serverpath='${vss.server}' vsspath='${vss.path}/${app.name}' ssdir='${vss.ssdir}' login='${vss.username},${vss.pass}' label='${app.name}-${timestamp}' />
</target>
<!-- VSS task ends -->
Now moving to next steps:
3. Filter the files that need to be send.
4. Archive your source code to zip or gzip.
These two steps include filtering out those files which need to be sent and bundle those files.
The target to accomplish this task would look something like this:
<target name='package' description='Package the source code and Contextroot' >
<property name='target.filename' value='${app.name}-${timestamp}.zip'/>
<zip zipfile='${zip.dir}/${app.name}/${target.filename}' >
<fileset dir='${base.dir}'>
<include name='src/**'/>
<include name='ContextRoot/jsp/**'/>
<include name='ContextRoot/WEB-INF/**'/>
<include name='src/META_INF/ejb-jar.xml'/>
<exclude name='ContextRoot/WEB-INF/classes/**'/>
<exclude name='ContextRoot/WEB-INF/lib/**'/>
<exclude name='ContextRoot/jsp/**/*.gif'/>
<exclude name='ContextRoot/jsp/image/**'/>
<exclude name='src/META_INF/**'/>
</fileset>
</zip>
</target>
We have used here ANT task to zip a set of files. The set of files can be specified
Here you need to specify the parameters like the target path and name of the zip file, the source files to be zipped, etc.
5. Upload the zip file to ftp server.
ANT provides a task that allows you to upload files to ftp server. The ANT target for the same is:
<target name='upload' description='uploads to FTP'>
<echo message='Uploading file to ftp : ${target.filename}'/>
<ftp server='${ftp.url}' userid='${ftp.username}' password='${ftp.password}' binary='yes' remotedir='${ftp.remotedir}'>
<fileset dir='${zip.dir}/${app.name}'>
<include name='${target.filename}'/>
</fileset>
</ftp>
<echo message='Release uploaded successfully '/>
</target>
As you can see, the parameters that needs to be provided are connection details for ftp server, transfer mode, files upload path and source file.
The next and final step:
6. And finally send a mail to all the stakeholders stating the upload path and a release note.
ANT provides a optional task for sending MIME mail. But this task highly depends on what contents you require in your mail.
For this task, I have written a class that generates a release note for me which I attach to my mail. Though this highly depends on your requirement but here I have used a very important feature of ANT that is developing custom tasks.
To know how to develop a custoom task, please visit ant.apache.org/manual/develop.html
Here taskdef is used to declare a new Task to ANT and which class should be loaded to implement this task.
The below code declares a new task which is named as releasenote and then this task is to create the release note.
<taskdef name='releasenote' classname='com.note.ReleaseNoteCreator'/>
<releasenote appName='${app.name}' noteName='${note.name}' releasedFile='ftp://ftp.zensar.com/${ftp.remotedir}/${target.filename}'/>
Once the release note is created, the following task will release a mail for you according to the paramters provided.
<mail from='${mail.from}' tolist='${mail.to}' cclist='${mail.cc}' files='${note.name}' user='${mail.user}' password='${mail.pass}' ssl='no' replyto='${mail.reply}' subject='${mail.subject}' mailhost='${mail.host}' mailport='${mail.port}' messagefile='${mail.message}'/> <!--message='${mail.message}'/-->
The complete target will look something like this:
<target name='mail' description='Send release mail' depends='init'>
<echo message='Generating Release Note'/>
<property name='note.name' value='${zip.dir}/${app.name}/ReleaseNote-${timestamp}.txt'/>
<mail from='${mail.from}' tolist='${mail.to}' cclist='${mail.cc}' files='${note.name}' user='${mail.user}' password='${mail.pass}' ssl='no' replyto='${mail.reply}' subject='${mail.subject}' mailhost='${mail.host}' mailport='${mail.port}' messagefile='${mail.message}'/> <!--message='${mail.message}'/-->
</target>
As you can see each target depends on a 'init' target. This 'init' target is used to perform some chores before starting the reelase process. Here it defines a timestamp variable which is used to generate distinct filesnames. The init target will look something like this
Here the record task is used for ANT logging.
<target name='init' description='Create password file and try Login'>
<tstamp/>
<property name='timestamp' value='${DSTAMP}-${TSTAMP}'/>
<record name='${log.file}-${timestamp}.log' action='start' append='yes' loglevel='debug'/>
<echo message='Update, Tag, Package, Upload, and release latest source code from ${rep.type} for ${app.name}'/>
</target>
And finally you can either define a target which will call other targets or set the target execution sequence while executing ANT build file.
My final ANT build file for this process comes out to be:
<?xml version='1.0' encoding='ISO-8859-1'?>
<project name='RELEASE_BUILD' default='getsource' basedir='.'>
<property file='${arg-app}-build.properties'/>
<property name='rep.type' value='${arg-rep}'/>
<property name='base.dir' value='${ws.dir}/${app.name}'/>
<taskdef name='releasenote' classname='com.note.CreateReleaseNote'/>
<target name='init' description='Create password file and try Login'>
<tstamp/>
<property name='timestamp' value='${DSTAMP}-${TSTAMP}'/>
<record name='${log.file}-${timestamp}.log' action='start' append='yes' loglevel='debug'/>
<echo message='Update, Tag, Package, Upload, and release latest source code from ${rep.type} for ${app.name}'/>
</target>
<!-- CVS Starts-->
<target name='cvs' description='get the latest source code from CVS' >
<cvspass cvsRoot='${cvs.root}' password='${cvs.pass}' passfile='.cvs-pass'/>
<cvs command='login' cvsRoot='${cvs.root}' passfile='.cvs-pass'/>
<cvs dest='${base.dir}' cvsRoot='${cvs.root}' command='update -A -dPC' passfile='.cvspass'/>
<cvs cvsRoot='${cvs.root}' command='tag ${app.name}-${timestamp}' package='${app.name}' passfile='.cvspass'/>
</target>
<!-- CVS ends -->
<!-- VSS starts -->
<target name='vss' description='get the latest source code from VSS' >
<vssget serverpath='${vss.server}' vsspath='${vss.path}/${app.name}' ssdir='${vss.ssdir}' localpath='${base.dir}' login='${vss.username},${vss.pass}' recursive='true' />
<echo message='Label ${vss.path}/${app.name} with ${app.name}-${timestamp}'/>
<vsslabel serverpath='${vss.server}' vsspath='${vss.path}/${app.name}' ssdir='${vss.ssdir}' login='${vss.username},${vss.pass}' label='${app.name}-${timestamp}' />
</target>
<!-- VSS ends -->
<!-- Common Packaging, uploading and mail starts -->
<taskdef name='releasenote' classname='com.note.CreateReleaseNote'/>
<target name='package' description='Package the source code and Contextroot' >
<property name='target.filename' value='${app.name}-${timestamp}.zip'/>
<zip zipfile='${zip.dir}/${app.name}/${target.filename}' >
<fileset dir='${base.dir}'>
<include name='src/**'/>
<include name='ContextRoot/jsp/**'/>
<include name='ContextRoot/WEB-INF/**'/>
<include name='src/META_INF/ejb-jar.xml'/>
<exclude name='ContextRoot/WEB-INF/classes/**'/>
<exclude name='ContextRoot/WEB-INF/lib/**'/>
<exclude name='ContextRoot/jsp/**/*.gif'/>
<exclude name='ContextRoot/jsp/image/**'/>
<exclude name='src/META_INF/**'/>
</fileset>
</zip>
</target>
<target name='upload' description='uploads to FTP'>
<echo message='Uploading file to ftp : ${target.filename}'/>
<ftp server='${ftp.url}' userid='${ftp.username}' password='${ftp.password}' binary='yes' remotedir='${ftp.remotedir}'>
<fileset dir='${zip.dir}/${app.name}'>
<include name='${target.filename}'/>
</fileset>
</ftp>
<echo message=' Release uploaded successfully '/>
</target>
<target name='mail' description='Send release mail' depends='init'>
<echo message='Generating Release Note'/>
<property name='note.name' value='${zip.dir}/${app.name}/ReleaseNote-${timestamp}.txt'/>
<releasenote appName='${app.name}' noteName='${note.name}' releasedFile='ftp://ftp.zensar.com/${ftp.remotedir}/${target.filename}'/>
<mail from='${mail.from}' tolist='${mail.to}' cclist='${mail.cc}' files='${note.name}' user='${mail.user}' password='${mail.pass}' ssl='no' replyto='${mail.reply}' subject='${mail.subject}' mailhost='${mail.host}' mailport='${mail.port}' messagefile='${mail.message}'/> <!--message='${mail.message}'/-->
</target>
<!-- Common Packaging, uploading and mail ends -->
<target name='getsource' description='Update, Tag, Package, Upload, and release latest source code from repository' depends='init'>
<antcall target='${rep.type}' />
<echo message='Update Latest Source code completed'/>
<antcall target='release' />
</target>
<target name='release' description='Package, Upload, and release Mail' depends='package,upload,mail'>
<echo message='**Release of ${app.name} latest source code completed successfully**'/>
</target>
</project>
And the properties file that specifies all the paramters required is...
# Application Name as used in APWORKS.
app=MyProject
app.name=MyProject
###### CVS Path (Optional) ########
cvs.root=:pserver:husain@192.168.1.155:/app/cvs/cvsroot
#CVS Password
cvs.pass=
# The cvs module path of the application required for checkout operation.
cvs.module=DEVELOPMENT/MyProject
######## VSS Details #########
# As specified in VSS server path
vss.server=\\\\servername\\repository\\
vss.path=$/VSS/DEVELOPMENT
vss.ssdir=D:/VSS Client
vss.username=vssuser
vss.pass=vssuserpass
####### Workspace Details ##########
#Workspace location. The code from CVS is updated at ws.dir/app.name
ws.dir=D:/ide/workspace
#Target local as well as backup Directory to store zip files to be uploaded to ftp server. Used as parent dir to app.name dir.
zip.dir=D:/BackUp
######## ftp Details ########
ftp.url=ftp.ind.zensar.com
#Target ftp directory
ftp.remotedir=SOURCE/MyProject
ftp.username=user
#ftp password.
ftp.password=password
##############Mail Settings. Used to mail the release note.
mail.message=mailBody.txt
mail.host=mail.mailserver.com
mail.port=25
# list of mail ids
mail.to=target1@domain.com,cm@domain.com
mail.cc=target3@domain.com,cm2@domain.com
#Senders mail-id
mail.user=myself@domain.com
mail.from=myreplymail@domain.com
#Reply mail-id
mail.reply=myreplymail@domain.com
#Senders mail-id password.
mail.pass=mypassword
mail.subject=Source Code Release [Auto-Generated]
#Logger
log.file=D:/BackUp/buildlog
Resources:
Ant Home Page: http://ant.apache.org
Ant installation Manual: http://ant.apache.org/manual/install.html
Ant Manual: http://ant.apache.org/manual/index.html
A good article on ANT Automation: http://www.onjava.com/pub/a/onjava/2002/07/24/antauto.html"
When it come to build automations, ANT is one of the most powerful tool that can be used. There might be other tools too, but ANT is most widely available and usable. If you are new to ANT then visit http://ant.apache.org. If you want to explore the power of ANT then visit http://ant.apache.org/manual/index.html.
To write or use ANT first you will have to install it. To find out from where to download and how to isntall ANT please visit http://ant.apache.org/manual/install.html.
Here I will take an process as an example and we'll see how we can automate the process using ANT and make our life easier.
Consider the following process:
You have some bunch of programmers working on a project and you are using a central repository; CVS or VSS. At the end of the day when all the programmers are done with their devlopment/bug fixing task for the day a monotonous process is required to be followed. All the source code from the repository needs to be taken and sent to your team at other end (Onsite) through ftp. This process can be broken down in to following steps:
1. Get the latest source code from the repository.
2. Label the source code appropriately to indicate today's work.
3. Filter the files that need to be send.
4. Archive your source code to zip or gzip.
5. Upload the zip file to ftp.
6. And finally send a mail to all the stakeholders stating the upload path and a release note.
Now if we perform this process manually, it will take considerable time and might also cause problems due to human errors.
But if we automate this process, believe me it will not take more than 30 secs to release a project with around 500 source files. What we need to do is identify the atomic tasks to be performed and automate them.
As you can see, the steps mentioned above are atomic tasks that needs to be performed. ANT provides a huge set of core as well as optional tasks [].
I hope that you have basic knowledge about targets, tasks, taskdef etc.
We will define each step or set of steps as a target. Though the complete script can be writting in one target, I prefer it former way for obvious reasons.
The paramters specified in the code snippets are explained in the end.
Considering the above process;
1. Get the latest source code from the repository.
If you are using CVS, ANT provides core task to perform CVS operations.
This can be written in ANT as:
<cvspass cvsRoot='${cvs.root}' password='${cvs.pass}' passfile='.cvs-pass'/>
<cvs command='login' cvsRoot='${cvs.root}' passfile='.cvs-pass'/>
<cvs dest='${base.dir}' cvsRoot='${cvs.root}' command='update -A -dPC' passfile='.cvspass'/>
If you are using VSS, ANT provides optional task for the same.
<vssget serverpath='${vss.server}' vsspath='${vss.path}/${app.name}' ssdir='${vss.ssdir}' localpath='${base.dir}' login='${vss.username},${vss.pass}' recursive='true' />
The piece of code above will get the latest version of code from repository into the specified destination folder.
2. Label the source code appropriately to indicate released work.
<echo message='Tag ${vss.path}/${app.name} with ${app.name}-${timestamp}'/>
<cvs cvsRoot='${cvs.root}' command='tag ${app.name}-${timestamp}' package='${app.name}' passfile='.cvspass'/>
If you are using VSS, ANT provides optional task for the same.
<echo message='Label ${vss.path}/${app.name} with ${app.name}-${timestamp}'/>
<vsslabel serverpath='${vss.server}' vsspath='${vss.path}/${app.name}' ssdir='${vss.ssdir}' login='${vss.username},${vss.pass}' label='${app.name}-${timestamp}' />
The above two tasks can be specified in one target for modularity and hence the reaulting target will be:
<!-- CVS task Starts-->
<target name='cvs' description='get the latest source code from CVS' >
<cvspass cvsRoot='${cvs.root}' password='${cvs.pass}' passfile='.cvs-pass'/>
<cvs command='login' cvsRoot='${cvs.root}' passfile='.cvs-pass'/>
<cvs dest='${base.dir}' cvsRoot='${cvs.root}' command='update -A -dPC' passfile='.cvspass'/>
<cvs cvsRoot='${cvs.root}' command='tag ${app.name}-${timestamp}' package='${app.name}' passfile='.cvspass'/>
</target>
<!-- CVS task ends -->
<!-- VSS task starts -->
<target name='vss' description='get the latest source code from VSS' >
<vssget serverpath='${vss.server}' vsspath='${vss.path}/${app.name}' ssdir='${vss.ssdir}' localpath='${base.dir}' login='${vss.username},${vss.pass}' recursive='true' />
<echo message='Label ${vss.path}/${app.name} with ${app.name}-${timestamp}'/>
<vsslabel serverpath='${vss.server}' vsspath='${vss.path}/${app.name}' ssdir='${vss.ssdir}' login='${vss.username},${vss.pass}' label='${app.name}-${timestamp}' />
</target>
<!-- VSS task ends -->
Now moving to next steps:
3. Filter the files that need to be send.
4. Archive your source code to zip or gzip.
These two steps include filtering out those files which need to be sent and bundle those files.
The target to accomplish this task would look something like this:
<target name='package' description='Package the source code and Contextroot' >
<property name='target.filename' value='${app.name}-${timestamp}.zip'/>
<zip zipfile='${zip.dir}/${app.name}/${target.filename}' >
<fileset dir='${base.dir}'>
<include name='src/**'/>
<include name='ContextRoot/jsp/**'/>
<include name='ContextRoot/WEB-INF/**'/>
<include name='src/META_INF/ejb-jar.xml'/>
<exclude name='ContextRoot/WEB-INF/classes/**'/>
<exclude name='ContextRoot/WEB-INF/lib/**'/>
<exclude name='ContextRoot/jsp/**/*.gif'/>
<exclude name='ContextRoot/jsp/image/**'/>
<exclude name='src/META_INF/**'/>
</fileset>
</zip>
</target>
We have used here ANT task to zip a set of files. The set of files can be specified
Here you need to specify the parameters like the target path and name of the zip file, the source files to be zipped, etc.
5. Upload the zip file to ftp server.
ANT provides a task that allows you to upload files to ftp server. The ANT target for the same is:
<target name='upload' description='uploads to FTP'>
<echo message='Uploading file to ftp : ${target.filename}'/>
<ftp server='${ftp.url}' userid='${ftp.username}' password='${ftp.password}' binary='yes' remotedir='${ftp.remotedir}'>
<fileset dir='${zip.dir}/${app.name}'>
<include name='${target.filename}'/>
</fileset>
</ftp>
<echo message='Release uploaded successfully '/>
</target>
As you can see, the parameters that needs to be provided are connection details for ftp server, transfer mode, files upload path and source file.
The next and final step:
6. And finally send a mail to all the stakeholders stating the upload path and a release note.
ANT provides a optional task for sending MIME mail. But this task highly depends on what contents you require in your mail.
For this task, I have written a class that generates a release note for me which I attach to my mail. Though this highly depends on your requirement but here I have used a very important feature of ANT that is developing custom tasks.
To know how to develop a custoom task, please visit ant.apache.org/manual/develop.html
Here taskdef is used to declare a new Task to ANT and which class should be loaded to implement this task.
The below code declares a new task which is named as releasenote and then this task is to create the release note.
<taskdef name='releasenote' classname='com.note.ReleaseNoteCreator'/>
<releasenote appName='${app.name}' noteName='${note.name}' releasedFile='ftp://ftp.zensar.com/${ftp.remotedir}/${target.filename}'/>
Once the release note is created, the following task will release a mail for you according to the paramters provided.
<mail from='${mail.from}' tolist='${mail.to}' cclist='${mail.cc}' files='${note.name}' user='${mail.user}' password='${mail.pass}' ssl='no' replyto='${mail.reply}' subject='${mail.subject}' mailhost='${mail.host}' mailport='${mail.port}' messagefile='${mail.message}'/> <!--message='${mail.message}'/-->
The complete target will look something like this:
<target name='mail' description='Send release mail' depends='init'>
<echo message='Generating Release Note'/>
<property name='note.name' value='${zip.dir}/${app.name}/ReleaseNote-${timestamp}.txt'/>
<mail from='${mail.from}' tolist='${mail.to}' cclist='${mail.cc}' files='${note.name}' user='${mail.user}' password='${mail.pass}' ssl='no' replyto='${mail.reply}' subject='${mail.subject}' mailhost='${mail.host}' mailport='${mail.port}' messagefile='${mail.message}'/> <!--message='${mail.message}'/-->
</target>
As you can see each target depends on a 'init' target. This 'init' target is used to perform some chores before starting the reelase process. Here it defines a timestamp variable which is used to generate distinct filesnames. The init target will look something like this
Here the record task is used for ANT logging.
<target name='init' description='Create password file and try Login'>
<tstamp/>
<property name='timestamp' value='${DSTAMP}-${TSTAMP}'/>
<record name='${log.file}-${timestamp}.log' action='start' append='yes' loglevel='debug'/>
<echo message='Update, Tag, Package, Upload, and release latest source code from ${rep.type} for ${app.name}'/>
</target>
And finally you can either define a target which will call other targets or set the target execution sequence while executing ANT build file.
My final ANT build file for this process comes out to be:
<?xml version='1.0' encoding='ISO-8859-1'?>
<project name='RELEASE_BUILD' default='getsource' basedir='.'>
<property file='${arg-app}-build.properties'/>
<property name='rep.type' value='${arg-rep}'/>
<property name='base.dir' value='${ws.dir}/${app.name}'/>
<taskdef name='releasenote' classname='com.note.CreateReleaseNote'/>
<target name='init' description='Create password file and try Login'>
<tstamp/>
<property name='timestamp' value='${DSTAMP}-${TSTAMP}'/>
<record name='${log.file}-${timestamp}.log' action='start' append='yes' loglevel='debug'/>
<echo message='Update, Tag, Package, Upload, and release latest source code from ${rep.type} for ${app.name}'/>
</target>
<!-- CVS Starts-->
<target name='cvs' description='get the latest source code from CVS' >
<cvspass cvsRoot='${cvs.root}' password='${cvs.pass}' passfile='.cvs-pass'/>
<cvs command='login' cvsRoot='${cvs.root}' passfile='.cvs-pass'/>
<cvs dest='${base.dir}' cvsRoot='${cvs.root}' command='update -A -dPC' passfile='.cvspass'/>
<cvs cvsRoot='${cvs.root}' command='tag ${app.name}-${timestamp}' package='${app.name}' passfile='.cvspass'/>
</target>
<!-- CVS ends -->
<!-- VSS starts -->
<target name='vss' description='get the latest source code from VSS' >
<vssget serverpath='${vss.server}' vsspath='${vss.path}/${app.name}' ssdir='${vss.ssdir}' localpath='${base.dir}' login='${vss.username},${vss.pass}' recursive='true' />
<echo message='Label ${vss.path}/${app.name} with ${app.name}-${timestamp}'/>
<vsslabel serverpath='${vss.server}' vsspath='${vss.path}/${app.name}' ssdir='${vss.ssdir}' login='${vss.username},${vss.pass}' label='${app.name}-${timestamp}' />
</target>
<!-- VSS ends -->
<!-- Common Packaging, uploading and mail starts -->
<taskdef name='releasenote' classname='com.note.CreateReleaseNote'/>
<target name='package' description='Package the source code and Contextroot' >
<property name='target.filename' value='${app.name}-${timestamp}.zip'/>
<zip zipfile='${zip.dir}/${app.name}/${target.filename}' >
<fileset dir='${base.dir}'>
<include name='src/**'/>
<include name='ContextRoot/jsp/**'/>
<include name='ContextRoot/WEB-INF/**'/>
<include name='src/META_INF/ejb-jar.xml'/>
<exclude name='ContextRoot/WEB-INF/classes/**'/>
<exclude name='ContextRoot/WEB-INF/lib/**'/>
<exclude name='ContextRoot/jsp/**/*.gif'/>
<exclude name='ContextRoot/jsp/image/**'/>
<exclude name='src/META_INF/**'/>
</fileset>
</zip>
</target>
<target name='upload' description='uploads to FTP'>
<echo message='Uploading file to ftp : ${target.filename}'/>
<ftp server='${ftp.url}' userid='${ftp.username}' password='${ftp.password}' binary='yes' remotedir='${ftp.remotedir}'>
<fileset dir='${zip.dir}/${app.name}'>
<include name='${target.filename}'/>
</fileset>
</ftp>
<echo message=' Release uploaded successfully '/>
</target>
<target name='mail' description='Send release mail' depends='init'>
<echo message='Generating Release Note'/>
<property name='note.name' value='${zip.dir}/${app.name}/ReleaseNote-${timestamp}.txt'/>
<releasenote appName='${app.name}' noteName='${note.name}' releasedFile='ftp://ftp.zensar.com/${ftp.remotedir}/${target.filename}'/>
<mail from='${mail.from}' tolist='${mail.to}' cclist='${mail.cc}' files='${note.name}' user='${mail.user}' password='${mail.pass}' ssl='no' replyto='${mail.reply}' subject='${mail.subject}' mailhost='${mail.host}' mailport='${mail.port}' messagefile='${mail.message}'/> <!--message='${mail.message}'/-->
</target>
<!-- Common Packaging, uploading and mail ends -->
<target name='getsource' description='Update, Tag, Package, Upload, and release latest source code from repository' depends='init'>
<antcall target='${rep.type}' />
<echo message='Update Latest Source code completed'/>
<antcall target='release' />
</target>
<target name='release' description='Package, Upload, and release Mail' depends='package,upload,mail'>
<echo message='**Release of ${app.name} latest source code completed successfully**'/>
</target>
</project>
And the properties file that specifies all the paramters required is...
# Application Name as used in APWORKS.
app=MyProject
app.name=MyProject
###### CVS Path (Optional) ########
cvs.root=:pserver:husain@192.168.1.155:/app/cvs/cvsroot
#CVS Password
cvs.pass=
# The cvs module path of the application required for checkout operation.
cvs.module=DEVELOPMENT/MyProject
######## VSS Details #########
# As specified in VSS server path
vss.server=\\\\servername\\repository\\
vss.path=$/VSS/DEVELOPMENT
vss.ssdir=D:/VSS Client
vss.username=vssuser
vss.pass=vssuserpass
####### Workspace Details ##########
#Workspace location. The code from CVS is updated at ws.dir/app.name
ws.dir=D:/ide/workspace
#Target local as well as backup Directory to store zip files to be uploaded to ftp server. Used as parent dir to app.name dir.
zip.dir=D:/BackUp
######## ftp Details ########
ftp.url=ftp.ind.zensar.com
#Target ftp directory
ftp.remotedir=SOURCE/MyProject
ftp.username=user
#ftp password.
ftp.password=password
##############Mail Settings. Used to mail the release note.
mail.message=mailBody.txt
mail.host=mail.mailserver.com
mail.port=25
# list of mail ids
mail.to=target1@domain.com,cm@domain.com
mail.cc=target3@domain.com,cm2@domain.com
#Senders mail-id
mail.user=myself@domain.com
mail.from=myreplymail@domain.com
#Reply mail-id
mail.reply=myreplymail@domain.com
#Senders mail-id password.
mail.pass=mypassword
mail.subject=Source Code Release [Auto-Generated]
#Logger
log.file=D:/BackUp/buildlog
Resources:
Ant Home Page: http://ant.apache.org
Ant installation Manual: http://ant.apache.org/manual/install.html
Ant Manual: http://ant.apache.org/manual/index.html
A good article on ANT Automation: http://www.onjava.com/pub/a/onjava/2002/07/24/antauto.html"
Subscribe to:
Posts (Atom)