Wednesday, September 29, 2010

Write a custom task, easily extend Ant


Ant comes with a large number of tasks (Task), the Internet is also a large number of tasks available, but if you are facing the problems others will not mind, how should we do? In fact, if you can spend a little effort to write out their tasks. I started also did not expect such a simple (do nested tasks encountered a little problem), we can see that Ant's structural design is quite good.

Suppose we need to show that the implementation of the task and how much time to write a TimerTask

Start: the execute method of covering org.apache.tools.ant.Task
import org.apache.tools.ant.Task;

import org.apache.tools.ant.BuildException;

public class TimerTask extends Task (

public void execute () throws BuildException (

System.out.println ("I am a timer");

)

)

Note that when compiling Classpath on ant.jar must.

Simplicity, assume that java source files, class files in the same directory, in this directory to write a build.xml file:















Open Dos window to this directory, run ant

Simple enough right! If the class path is more complex or in the jar file, set the classpath attribute on the line.

Continue to: set properties

Suppose we want to add an action attribute, in the Java file:

private String action;

....

public void execute () throws BuildException (

if (action.equals ("init")) (

...
)

...

)

public String getAction () (

return action;

)

public void setAction (String string) (

action = string;

)

In the xml file:



Save the intermediate results using the Project

For this task, it must value the time saved, more appropriate is org.apache.tools.ant.Project a, Project object life cycle is the Build, and can be setProperty, getProperty methods such as save / get value.

public void execute () throws BuildException (

if (getOwningTarget () == null)




[Next]



return;

Project proj = getOwningTarget (). GetProject ();

...



/ / Can do smt with proj now

)

Promotion: Nested Task

If we want to re-nested in the Timer the following sub-tasks (if not necessary :-):







That we first of all just write a simple FooTask, and then add in the build.xml definition:





Then add a method to TimerTask:

public void addFoo (FooTask foo) (

)

Note: addXXX of XXX in the name decided by the , Ant will use Java Reflection to find; type must be concrete type FooTask, can not be Task.






Recommended links:



Top File Compression



Associate



Registry Tools Storage



Zack Rusin interviewed the beauty and magic OF KDE



AMD Intel on EU antitrust penalties comment



DV To AVI



Watch cool mechanical PICTURE production process



Window frames with good HTML tag



Photoshop font effects - Ice Text



Liang No. 400 400 640 074 008 Take your Pick



VOB To FLV



Wizard Games And ENTERTAINMENT



brief E-Mail Tools



Thought to help in the day to enjoy from under The rising voices



DAT To MPEG



Tuesday, September 14, 2010

Photoshop art of sun and moon shuttle - on the evening landscape change


1. Open the image to be edited.



2. Copy the layer 2.



3. Select the middle layer application "photo filter" (menu "Image> adjust> Photo Filter.") Use "warming filter (85)", the concentration of 100%. Click the "good" button.





4. In the current layer, use the "Brightness / Contrast" tool (menu "Image> adjust> brightness / contrast"), apply the following settings:





Brightness: -25
Contrast: 50

Click the "good" button.

5. Click the layer icon in front of the eyes, hidden at the top of the two layers.






[Next]



6. Select the background of the bottom layer, use the "match color" tool (menu "Image> adjust> Match Color"), applied the following attributes.



Brightness: 100
Color strength: 100
Fade: the brightness adjustment of the value to just to show image detail.
And in: not checked
Source: file name
Layer: Layer 1

Click the "good" button.

7. Select the middle layer and add a layer mask (menu "Layer> Add Layer Mask> Show All").



8. In the layer mask is selected circumstances, the use of gradient fill constituency. Select "Symmetric Gradient", click on the horizon, and hold the "Shift" key and drag the gradient tool to the bottom of the image. Set the current layer of the hybrid model as "color filter (screen)."



9. Click the top layer of the eye icon to make it visible. Reduce its opacity reduced their impact.



10. Once again use the "Brightness / Contrast" tool (menu "Image> adjustments> brightness / contrast") to adjust the image. [The following is a comparison of before and after image processing]










Recommended links:



Iphone Video Format



Eclipse + JBoss + EJB3 Entity Bean's Connection Strategy



Dell go from here



qt blackberry



Do Not heat to high speed fully Raiders Summer Thunder



3G birth enormous opportunities



Operators burn punched 11 million users four drama success



Convert M4v To Mpeg



Mpeg 4 mp4



Wizard Icons



Screen Savers Report



Kodak V705 Dual Lens Camera Stabilization cheap listing weekend



Mold industry began to show radiation effects



Adventure And ROLEPLAY reviews



Compare Personal Interest