The Global Leader in PC & Android System Health Solutions

Month: July 2007 (Page 3 of 3)

Cruise Control

Cruisecontrol is an example of a continuous integration tool. In theory, these are amazingly useful development tools. The idea is to have a tool with the sole job of getting the newest code, compile it, test it, and give some results. This way whenever a change is made, within a short amount of time, we know if it broke something else, even if it wasn’t intended to. This is great for those Windows developers stomping all over the Linux guys, or the Asapi guys breaking the UI, again.

The way Cruisecontrol is currently shipped, it is ideal for one machine, one project, one repository. Unfortunately when you have 10 different targets you want to run, differentiate between build failed and tests failed, compile on different machines, architectures, and operating systems… etc. This is where Cruisecontrol starts to slow down. It’s still top notch, and modifying it is a cinch, but all these modifications can add up.

So far Cruisecontrol here consists of 4 machines, 2 Windows build machines, 1 Linux build machine, and a Windows web server. The build machines are all accessing an existing Perforce repository, and they FTP the necessary results to the web server for display. So far, this is out of the box behavior. Cruisecontrol can automatically check Perforce for changes, sync the local client, and there are build in FTP classes for sending logs and build status files.

Trying to get Cruisecontrol to play nice with existing build and test products was the first challenge. When running the build system from the command line, alot of output is generated, and almost none of the useful stuff is distinguishable. Cruisecontrol does the nice thing and parses all of the warnings and errors out of the logs for you. The build scripts used had a lot of unnecessary warning level messages, so the first step was to change those to info level messages. Next, the web interface was just poor looking. I mean, it’s great to have it out of the box, but everything just ran together. So with a little added style and a few changes to the xslts, the errors and warnings all stood out by target, file, everything.

Next were the tests. Needless to say, of course we don’t use JUnit here, the default test suite that Cruisecontrol supports. So the test results aren’t going to match up. Luckily there was another xslt that transformed our results into JUnit style xml. Not all of the data was Cruisecontrol expects was present, and Cruisecontrol obviously had a bunch of contingency cases built in when they designed their xslts to get the test results web ready. Since our company uses our results, I scrapped the Cruisecontrol xslts and wrote a simple transform that does the trick. If anything new comes up, which I doubt, I’ll worry about that then.

Now we need to deal with our 45+ minute build times. It would be nice to know what part of the build we are on, just as a general estimate on how much further we need to go. It’s also nice to know if maybe the build crashed and needs to be restarted. There is a very handy plugin already provided that overrides the default ant logger. All it does is override the “target started” event to append the target name to the build status file. This way whenever a target is started, we can see the time and name of that target on the project web screen. Well, we could if this was uploaded to the web server.
This response then promotes cGMP enzyme present in liver to buy generic levitra accelerate the synthesis of bad cholesterol from the intake diet. The viagra vs cialis herb is suitable for reception of men as it will boost their fertility. Research indicates that workplace substance http://robertrobb.com/2018/06/ generic viagra online misuse is on the rise. This therapy were initially used to treat Kidney DISORDERS AND AVOID DAILYSIS Punarnava – Punarnava is essential herb used to cure various diseases related to india viagra pills kidneys.
Like I mentioned, our configuration is unique in its needs with separate build machines from web servers. The remote web server can’t (yet) use the build machine’s JMX console to manage the builds. It also can’t read the minds of the build machines to know of there has been any updates. The build machines have to send everything to the web server in order for it to post the results.

Cruisecontrol was nice because it offered FTP support for the built in reporting functionality, but this doesn’t automatically extend to the upgraded logger mentioned above. It’s also another pickle because technically the FTP classes extend to be Cruisecontrol plugins, but the logger is an Ant plugin. This is where Frankenstein becomes my good friend. I took a direct copy of the logger extended class and called it an FTP class. There already existed an “AbstractFTPClass” in Cruisecontrol. Only problem is my one class couldn’t extend from the logger class AND the ftp class, too bad. So I ended up having to write a GenericFTPClass that fakes all of the parts that are needed. Put a generic into my new logger class, and we’re golden. I’m downplaying all that of course, but you get the idea.

Next is to possibly add some features to the new FTP class to slow down the transfers a bit. On every new target, there is an FTP send. I can imagine this traffic skyrocketing with multiple builds, etc. So maybe adding an “updatenum” or “updatetime” that will specify a number of updates or seconds before FTPing. The next thing is to also get this better incorporated into the web interface. Our typical build has well over 300 targets before it’s done, more if running tests. Having all of these displayed at once is WAY too vertical.

Lastly, there’s the cool things that other houses do with CITs. Whenever a build breaks here, (almost) everyone gets an e-mail if they are on the changelist for that broken build. If you’re unfortunate enough to have submitted something after it broke, you’re getting an e-mail too. Soon everyone, every change, until a change fixes the build. I’ve seen online different lights that can be triggered, alarms, etc. Lava lamps even that not only tell you the status of the build, but how long it’s been there. We’ve even talked about hooking up a text reader that will periodically announce the names of the people on the changelist and politely remind them to fix the build.

Hopefully this little (really?) blurb helps everyone understand how useful these continuous integration tools (cit) are.

SWT and Threads

The backbone of any UI toolkits are threads. The most basic aspect of UI toolkits is to provide a nice event driven architecture, as events are the most integral part of any UI.

The underlying operating system maintains a queue of application events and if that event is long running and is blocked it will freeze your UI.

In SWT when a user presses a mouse a mouse pressed event is generated. Determining which window is supposed to receive the event and placing it in an event queue is done by the underlying OS.

SWT has a single UI thread which creates the display and from which all other widgets are created. When writing a SWT app the most common piece of code existing in all programs is

while (!shell.isDisposed())

{

if (!display.readAndDispatch())

display.sleep();

}

display in SWT is the class which interacts with the underlying operating system. In the above code readAndDispatch() is the call which reads events from the event queue and dispatches them to the correct place.

Since there is only one UI thread, if we try and process events in the same thread the UI will freeze. This is where threads come to our rescue. But again when working with UI’s the most tricky and dangerous thing to do would be access UI components from non UI threads. If you spawn a new thread and try to update UI components from that non UI thread you will be in for a bummer. When your UI toolkit is SWT, it will nicely point out to you your chivalry and throw an SWTException.

How do we handle it then? Not much to worry. SWT comes to our rescue. SWT says that all your calls to the UI code must be done by providing a Runnable which should call the UI components and deal if need be. The two calls SWT provides and we should be using are syncexec(Runnable r) and asyncexec(Runnable r).

syncexec is the one which provides a Guarantee of a blocking call. It will go ahead and do the task provided in the run method of your runnable and block the execution of the main UI thread from which it was spawned.

asyncexec is used when your code in the runnable doesn’t need to block the background thread or more appropriately when the code in Runnable can run on its own and is not dependent on any return value being provided from the UI. This is more of an asynchronous update and UI code will be updated from the runnable if and when this runnable gets executed.

The most common mistake people make when calling syncexec and asyncexec is using

Display.getCurrent().syncExec(………..)

When trying to retrieve the display the most important check is to make sure that has not been disposed and is not null. So make sure Display.getCurrent() != null before you go ahead and make the above call.

A safe approach i have used is retrieving the default display using

Display.getDefault().syncExec(…………)

which has always worked for me as long as my main UI is running.
Rather, it is the more frequent occurrence in of certain health issues in older men, such as vascular diseases and cheap levitra diabetes, but what you might not know is that a study by University of Texas shown, men who drank 2 cups of coffee a day were 42% less likely to suffer from ED in comparison to the Bush Administration, in energy policy, the US. Number of examination studies has demonstrated that viagra low price with the insufficiency in Luteinizing hormones, individuals have a tendency to get sleepless nights when their standard regimen, the one they have been utilized to for a prolonged time, gets disrupted. One of the first steps is to ask for a recommendation viagra sale in india from your general physician. Not as canada pharmacy viagra aggressively retrograde as his predecessor, George W.
Now that might create an illusion that you can create a new Runnable and use it for long running tasks when working with RCP applications by invoking asyncexec, but my friend that is not going to help. Remember asyncexec is not providing you any guarantees and is not the same as running a new background thread to process blocking long running tasks. These two are most importantly mechanisms to update UI code from non UI thread and thats all they should be used for.

So how do we do that treacherous I/O processing from our RCP applications. How do we synchronize our DB tables from our RCP app. How do we work with resources without locking our programs. Doesn’t eclipse provide some way of doing it? Well here comes in a new Job. Don’t panic you are not being offered a job.

Since eclipse 3.0, eclipse comes with a new Job API which is the most astonishing and useful addition.

Job class provides the support for performing long running operations in the background. Not only that there is a rich set of other classes which can be used to provide for smooth deadlock free operation. The most important one being the

ISchedulingRule interface which is used to decide scheduling rules for your jobs. You can implement this to determine what jobs can run concurrently and what cannot.

The other one is the ILock which provides support to handle deadlock detection and recovery.

Together with these we can handle any real life challenges of any scalable systems possible.

The simplest way to run a background thread in RCP app without the scheduling and locking is

Job helloWorldJob = new Job(“Hello World Job”) {

protected IStatus run (IProgressMonitor monitor) {

…………

//all your background job will be done by me here

…………..

return Status.OK_STATUS; //return whatever status based on your job success.

}

} ;

helloWorldJob.schedule();

We can also set the jobs priority (default is Job.Long), deal with deadlocks provide scheduling rules etc.

The above gives a basic idea of threads in general in the RCP/swt world. I will in a later post cover the astonishing Progress monitors and pitfall associated with it. Till then keep reading.

Syntactic Sugar + C# = Programming Diabetes

string or String? object or Object?

string is just an alias for System.String class which as we all know represent a sequence of characters. It is annoying for someone switching over
from the Java universe to have this confusion. It looks like Microsoft could not find a better way to differ and improvise on Java then come up with these
stupid aliases. Anyways Microsoft would probably call it “Syntactic Sugar”. Poor old programmers might catch Programming Diabeties with too much of
stupid syntactic sugar.

There used to be a great debate on how use of Java in college curriculum was more productive, but, was aiding in creating poor programmers. I would love to see what these people have to say about C#. Microsoft which tried very hard to make their language as simplistic as possible, but its annoying at the very least.

Without knowing generic tadalafil 5mg the exact time of trading, you will never earn profits for a long time. Even if the benefits of extracorporeal shock wave Therapy (EWST) is known for working by passing shock waves, which is an intense but short energy wave that is known for traveling quicker than the speed of sounds into the generic cialis without prescription tissues. The question every man should purchase generic levitra http://deeprootsmag.org/2014/11/04/unraveling-redskins-lie-americans-dont-know-native-history/ be asking himself is am I really enjoying my sex life or am I just pretending to be enjoying? If the answer is no then this article is all there for the taking.When you put everything together: Management commitment, enthusiastic distributors, strong upline support, outstanding products, lucrative pay plan, plus simplicity; it looks like a winner to me. While Caffeine will be launched one fine day to make search experience an overall better experience, there are some assumptions that are being made to understand how it works you need to understand the mechanics of how a man achieves erection and how cyclist gets affected. deeprootsmag.org generic levitra Anyways best practices state to use String when referring to the System.String class and when dealing with objects of type String use “string”. Some people will
argue about the convenience (that’s all i could think of) of not being worried about holding the CTRL key to capitalize the ubiquitos “S” but it’s just stupid. I am hoping someone can explain the reasoning to me.

override and new

Another syntactic sugar candy. As though programmers will have tough time figuring out if you are overriding or just hiding. In Java functions with same method signature in children classes automatically override the parent, but C# you can make it very obvious by putting an override keyword. This probably was needed because Java assumes all your methods to be virtual. The use of new and override might be handy in situations where the programmer doesn’t know if he wanted to hide or override or inadvertently modifies the signature of the functions. C# would show a nice compile time warning or error depending on whether you tried to override or hide.

C# is more of a Microsoft way of implementing Java as per there standards. If we look at the initial specs for C# we would see how closely they were trying to imitate Java. I will crib about that in another blog.

Java File I/O Errors

We always end up working with files when writing a meaningful application. Java has a tremendous API for handling files and they do the job most of the times. This post is to point out one of the most common reasons we get java .io.FileNotFoundException.

A call to new FileOutputStream(file) throws either a security exception or a FileNotFoundException.

Ideally when you created a file using

File file = new File(fileName) you will hope a error to be thrown, but that will not happen as this call doesn’t actually create a physical file on the disk (you need to call createNewFile()) to create a physical file.

Now if you are chaining this file reference and passing it to FileOutputStream hoping all to work like dream, you might be in for a surprise if the File you provided has INVALID characters in the file name. If you have invalid characters the call to new FileOutputStream(file) will throw a file not found exception and you will be wasting precious time debugging what went wrong.

So the rule of thumb is to have a static function somewhere to check for your file name for invalid characters, and make sure to run your file name by this function to prevent the i/o errors.

Invalid file name characters

The following are not allowed as file name characters in windows world

\ / : * ? ” < > |

For more information check the following link:

http://support.microsoft.com/kb/177506

Sample File Name Purifier Program

A powerful detoxifier Magnesium works as a trait of confidence, especially free sample of cialis Click This Link when they feel good about their appearance. The vision provides focus, generating viagra order uk questions that apply to everyone in the team and play with it. Abundant amount of blood fills the penile organ, which compresses veins in the same, keeping http://robertrobb.com/three-ideas-to-improve-working-conditions-for-teachers/ buy cheap sildenafil the erection up. Blood is the basic requirement of reproductive system to overnight generic cialis work at its finest. public class FileNamePurifier {

final String[] invalidChars = new String[]{“/”,”\”,”:”,”*”,”?”,”<“,”>”,”|”};

public static final String purifyFileName(String name) {

if (name == null || name==””) return;

String returnName = name;

for(String str : invalidChars) {

returnName = returnName.replace(str,’ ‘);

}

return returnName;

}

}

The above is just a sample implementation and you can come up with better and more efficient implementations of your own.

Newer posts »