Archives for April 2009

Java concurrency with thread gates

On: Thursday, 16 April 2009

The thread gate pattern is an effective tool for controlling thread concurrency, but many developers are unfamiliar with it. Just as a traffic light can regulate the behavior of automobiles at an intersection, thread gates can block or allow thread progress based on given factors. Obi Ezechukwu introduces the concept of thread gates, then shows you how to implement them in a multithreaded prime-number generator. Level: Intermediate


Multithreading and code concurrency were once the preserve of elite programmers, but the combination of multicore processing power, complex requirements, and the readily available javax.util.concurrent package has changed that. Today, enterprise application developers are expected to be knowledgeable about the various synchronization mechanisms and constructs available in the Java language. The level of expectation is even higher where the problems being solved require non-textbook and highly innovative concurrency constructs. It isn't enough in those situations to understand the Java language's concurrency mechanisms and those included in the standard SDK; you also must be able to use these tools as building blocks for custom-made concurrency controls. 

In this article, we'll explore a concurrency pattern that isn't widely discussed, generally called thread gates. Like its real-world counterpart, a gate instance opens or closes, thus allowing or preventing thread progress. It does so based on the truth value of some predicate. 

I'll start with an overview of thread gates based on the traffic-flow model, then explain how to set up your development environment for the example application, a multithreaded prime-number generator. The remainder of the article will be hands-on, as you learn about the thread gate pattern by implementing it. 
Thread gates: An overview

A good metaphor for thread gates is the traffic light system that operates on many public roads. When the signal is red, cars have to wait at the stop line until the signal changes. On the other hand, cars are free to run past the signal when it is green. There is no limit to the number of times that the signal can go from green to red, given a statistically significant observation timeframe. Traffic lights are designed to enable crossflow of traffic, and are redundant where crossflow does not exist. In a programmer's terms, you can imagine the light as a control that lets bidirectional traffic share a small section of road that might otherwise cause the paths of traffic to intersect in an unsafe manner. 

In the same way, thread gates are generally best used for scenarios where one set of threads has to be prevented from proceeding beyond a determined point, whilst another set of threads is active. To put it another way, the competing sets of threads are dependent on the value of some truth predicate, where each distinct value of the predicate strictly triggers one (and only one) set of threads, forcing the others to remain suspended. Note that the emphasis here is on sets or groups of threads rather than individual threads. In essence, the focus is on scenarios where multiple threads share access to an underlying resource, and the threads can be partitioned into sets depending on the actions that they perform in relation to that resource.


Google App Engine now supports Java

On: Wednesday, 15 April 2009

Google on Tuesday evening announced a new version of its Google App Engine application-hosting service that adds multiple capabilities, including new support for the Java programming language. 
ـــــــــــــــــــــــــــــــــــــــــــــــــ
Improvements are intended to make the Google App Engine infrastructure available to all developers, ranging from those at startups to IT administrators inside the enterprise, Google said. In addition to Java support, other features in the updated version of Google App Engine include database import and export, access to firewalled data, and cron support, which enables configuration of regularly scheduled tasks to operate at defined times. 
ـــــــــــــــــــــــــــــــــــــــــــــــــ
Google has been running internal and external applications on its Google App Engine and it has not been without difficulty, said Kevin Gibbs, tech lead for Google App Engine, in a blog post on Tuesday evening. 
ـــــــــــــــــــــــــــــــــــــــــــــــــ
"Tonight at Campfire One, we released a new set of features -- based on community and internal feedback -- that helps App Engine interface more easily with businesses' existing technologies,"Gibbs wrote. Campfire One features a gathering of developers at company facilities. 
ــــــــــــــــــــــــــــــــــــــــــــــــــ
Early support for Java includes a Java runtime, integration with the Google Web Toolkit 1.6, and a Google Plugin for Eclipse. Developers can program against Java Data Objects or Java Persistence API. Until now, Google App Engine has only leveraged Python. Also highlighted in the Google App Engine upgrade were Google Secure Data Connector, for centrally managed access to on-premise data, and a data import tool to move gigabytes of data into App Engine. Cron support, according to a link to the blog, is geared to the Python language.
ـــــــــــــــــــــــــــــــــــــــــــــــــ 
"By reducing the administrative headaches that come with scaling and distributing an application, we hope that App Engine will continue to let developers do what they do best: launch services that delight users," Gibbs said. 
ــــــــــــــــــــــــــــــــــــــــــــــــــ
In the past six months, Google has launched nearly 50 projects and small products on Google App Engine, including Google Moderator, for distributed communities to vote on subjects, Gibbs said. 
ـــــــــــــــــــــــــــــــــــــــــــــــــ
"In all cases we found it quicker, easier, and more cost-effective to leave the infrastructure to App Engine and the actual product-building to our engineering teams," said Gibbs. 
For more enterprise computing news, visit InfoWorld. Story copyright InfoWorld Media Group, Inc.


Hoe To Get Ubuntu??

On: Friday, 10 April 2009

It's an easy way to get ubuntu


1_) Download it from ubuntu site..

2_) Request for ubuntu cd just register & write your information and it will come to you between 4-6 monthes

From Here

Why Use Linux?


install”


This could not be further from the truth. Many Linux distributions are as easy, if not easier. to install as Windows. Ubuntu, Linux Mint and PCLinuxOS are but three of the most popular. The install is nothing more than a few mouse clicks and basic options like timezone, language and name. All these are explained well and you need to provide the same information when installing ANY operating system.
Myth 2: “Linux does not recognize my hardware”

Like all Operating Systems, Linux requires “drivers” in order to use a piece of hardware like a sound card or modem, etc. Also like other OSs, if your system is cutting edge with the latest and greatest, there may be challenges at first. This doesn’t happen with Microsoft Windows? A year after it’s release, Windows VISTA is still suffering from poor driver support! The fact is, if your system is 6 months old, hardware support is usually a non-issue.
Myth 3: “Linux is too complicated to use”

In what way? It has a graphical interface with a mouse and windows. It has an auto-updater to keep things current. It has software add/remove capabilities that allow you to install programs with a couple mouse clicks. It even has many apps found in Windows and Mac OS X like Firefox, Thunderbird, Pidgin, Audacity, etc. It’s as easy as Windows…just different. Let’s put it this way, if all you ever knew was Linux and you decided to try Windows for the first time, I’m sure you would find Windows complicated and hard to use too.
Myth 4: “There are no applications available”

One of the points thrown at me during my discussion went something like, “Walk into a computer store and try to find a single Linux app on the shelf…you won’t find any”. Until now I’m not sure what that had to do with anything. There are many thousands of applications available, for free, and are readily available for download. Many Linux distros even come with a point and click interface to download and install these apps without effort. To say there are no applications available is not only a myth but a flat out lie.
Some reasons to use Linux

There are many more “myths” hanging over Linux, but those were some of the more common ones. Let’s now look at a few reasons why one should consider Linux.
Reason 1: Security

Viruses are less of a threat on Linux. The very way a Linux system is designed makes it very difficult for a virus to function as it does in Windows. This also applies to spyware, malware, etc. The fact that almost no viruses are written for Linux also adds a nicer sense of warmth. Wouldn’t be nice to read the almost endless stream of security holes in Windows and know it does not apply to you?
Reason 2: Updatability

Linux is in a constant state of development and improvement by professional and semi-professional developers who donate their time and skills to the various projects. In addition, the majority of the system and available applications are Open source, so if you wish and you had the ability, you could add any feature you needed. Linux also has the ability to expand the life of many systems as it’s reduced overhead and need for system resources means that it will run great on older machines.
Reason 3: Support

Yes, support. As hard as it is to accept, you can easily get support when you do run into difficulties. In addition to the plethora of online forms, both independant and those provided by the distro supplier, there are also more and more 3rd party service providers that offer service contracts for Linux systems. Good to have in a corporate/business environment. There is also support offered by more and more traditional Technology names such as Dell, IBM, Novell, Sun and others. And finally, for support a little closer to home, most major cities have Linux User Groups that can and do offer help and advice. Help and Support IS available and does not usually mean spending hours on hold to speak to someone in a call center on the other side of the planet.
Reason 4: Self-improvement

Personally, this is one of the most important reasons why I switched. Linux gave me the chance to learn new skills, gain deeper insights into how computers work and provided an excellent platform to develop on. Some people may be satisfied with going through life with blinders on and living the “status-quo”. For those that enjoy the how/what/why of life, Linux is an excellent choice.
Reason 5: Cost

Most people would put this at the top of the list. For me, cost is one of the least important reasons to switch to Linux. However, the cost advantage of Linux is huge. In a nutshell, you get the complete OS, thousands upon thousands of applications AND support for the grand total price of….$0! We’re not talking a watered down, feature deprived OS either…we’re talking a full-blown, complete, enterprise ready OS…for free. “But my time is worth something and the extra effort needed with Linux cost me money.”, alright…and how much does it cost you when Windows bluescreens in the middle of editing a large report that hasn’t been saved? Or how about when a virus or spyware prevents you from even using your system…probably costs you a lot.

So you see, you are going to hear a lot about why you should not use Linux, and they are going to give you many reasons why you shouldn’t…just very few good reasons.

If you are interested in trying Linux, I would recommend Ubuntu, Linux Mint or PCLinuxOS. Download their LiveCDs. Booting to a LiveCD allows you to try and use a complete Linux environment without making any changes to your hard drive. Once down, just reboot and go back into windows as normal.

To Learn NetBeans IDE on line & mobile app.

On: Sunday, 5 April 2009

At This Link You Can Know More About NetBeans IDE & Java ME (Mobile App.)

http://www.netbeans.tv/

Java NetBeans IDE



NetBeans - Development SimplifiedA free, open-source Integrated Development Environment for software developers. You get all the tools you need to create professional desktop, enterprise, web, and mobile applications with the Java language, C/C++, and even dynamic languages such as PHP, JavaScript, Groovy, and Ruby. NetBeans IDE is easy to install and use straight out of the box and runs on many platforms including Windows, Linux, Mac OS X and Solaris.



The NetBeans IDE 6.5 provides several new features and enhancements, such as rich PHP, JavaScript and Ajax editing features, improved support for using the Hibernate web framework and the Java Persistence API, and tighter GlassFish v3 and MySQL integration.

What do developers say about the NetBeans IDE? Read their testimonials and switch stories.

Highlights
Java Desktop Applications

Create professional desktop applications using the NetBeans Java GUI Builder with Swing Application Framework and Beans Binding support.
PHP Development

A fast and light-weight PHP IDE with code completion and quick fixes, integrated FTP and Xdebug, and support for popular Web Services.

Java EE and Web Applications

Build web applications using Ajax, JavaScript, and CSS. Support for frameworks incl. JSF, Struts, Spring and Hibernate. Full set of tools for EJB development.
Ruby and Ruby on Rails Development

Powerful Ruby editor with code completion and debugger, and full support for Ruby on Rails. Includes the JRuby runtime.

Visual Mobile Development

Create, test and debug GUI applications that run on mobile phones, set-top boxes, and PDAs.
C and C++ Development

Full-featured C/C++ editor, debugger, project templates, support for multiple project configurations, remote development, and packaging of completed projects.


See a quick overview of features on the NetBeans IDE 6.5 Release Page.

Develop Expressive Content with the JavaFX Platformv
JavaFX is an expressive rich client platform for creating and delivering rich Internet experiences across all the screens of your life. 

The JavaFX platform gives you unparalleled freedom and flexibility to create expressive content across multiple screens, including mobile devices, desktops, televisions, and other consumer devices. It combines the best capabilities of the Java platform with comprehensive, immersive media functionality into an intuitive and comprehensive one-stop development environment.

The JavaFX platform empowers content developers by enabling them to focus on creativity instead of coding. It enables developers to create game-changing applications and engaging content with maximum market penetration opportunities. 
Why the JavaFX Platform?

Developers are seeking the most efficient way of creating expressive content in applications that appear on desktops, on the Internet, and on mobile devices. They need to build high-fidelity GUI's that operate seamlessly on multiple Web browsers, operating systems and devices, without having to port or rewrite their applications for each screen. To meet this goal, developers need to work efficiently with team members such as graphics designers and media authors to exchange audio, video, and other rich media assets.

The JavaFX platform contains an essential set of tools and technologies that enable developers and designers to collaborate, create, and deploy applications with expressive content to browsers and desktops. Mobile application developers can use the JavaFX 1.1 Mobile Emulator to preview applications for mobile devices using the JavaFX platform.

Key features of the JavaFX 1.1 platform include:
One-stop-shop expressive content design and development platform for all screens: Build engaging visual experiences across desktop, browser and mobile with a unified development and deployment model. The most powerful and pervasive platform in the industry is now the most expressive!

Broadest market reach: Devices can open up to the broadest portfolio of content and services in the industry. Applications can be distributed across billions of devices with the power of Java. Mobile developers can efficiently target their content to as many mobile devices as possible.

Broadest access to mobile device capabilities: JavaFX is the best way to bring expressive, feature-rich content to mobile devices. JavaFX Mobile brings expressiveness to Java ME, to combine the richest mobile experience with the most access to the underlying system and across the broadest number of devices.

Lower implementation cost: Builds on your pre-existing investment in Java. Developers can use any Java library within a JavaFX application to build expressive interfaces.In mobile devices, JavaFX builds on top of the existing Java ME and Mobile Service Architecture (MSA) platforms to reduce implementation costs for device manufacturers.

Designer-developer workflow: Dramatically shorten your production cycle for design and development.

Powerful runtime: Leverage the extreme ubiquity, power, performance and security of the Java runtime.

Break free from the browser: Drag-and drop a JavaFX application from the browser to deploy applications to the desktop.
What Can I Build with JavaFX?

Here are some examples from the extensive JavaFX samples library to give you a taste of the JavaFX technology. Click each thumbnail to run the sample application and see a description that explains how it was built.

 Simple Video Player

This sample uses the JavaFX Media Component, a prefabricated video player that provides all of the standard video player controls you might need. Incorporating video in your application is as simple as creating an instance of this component, setting a few variables and including a link to your video source. For mobile deployment, run the Simple Video Player Mobile sample. 

 Interesting Photos

This sample uses Web Services (Flickr's REST API) to retrieve photos from Flickr into a JavaFX application. Works for desktop and mobile deployment.

 Path Animation

This sample shows how to animate a shape along an arbitrary vector path. It has two scenarios: a car running on a racetrack and a boat sailing on waves. You only have to create an animated node for a visual asset and a path for the track along which it moves. Works for desktop and mobile deployment.

 Flying Saucer

This sample shows you how to create a flying saucer that will escape from the browser, fly around outside the browser a bit, and then land back in the browser. The new out-of-process Java applet plugin in Java SE 6 update 10 or higher and enables you to make applets which can run outside of the browser. Works for desktop deployment only.
JavaFX Platform Components

The JavaFX platform architecture is shown in the following figure. Mouse over any box in the diagram for a description.

 

The JavaFX platform combines a straightforward declarative language called JavaFX Script, a set of development tools, graphics, media and audio support libraries, and runtime environments. This ensures that applications can provide a consistent look and feel across devices with diverse form factors and capabilities. 
What Tools Are Available for the JavaFX Platform?

The available downloads are organized by the functionality you need to start developing with JavaFX. The diagram shows the download bundles, and the following sections contain a detailed description of what each download bundle includes.
The developer bundle contains the following tools.
NetBeans IDE 6.5 for JavaFX 1.1

The JavaFX technology is integrated with the NetBeans IDE, a mature and powerful development environment that makes it easy to build, preview, and debug JavaFX applications.

The NetBeans IDE for JavaFX is easy to learn, and it comes bundled with the JavaFX SDK and lots of sample applications.

The NetBeans editor features a drag and drop palette to quickly add JavaFX statements, including transformations, effects and animation.

JavaFX 1.1 Plugin for NetBeans

If you are already using the NetBeans IDE 6.5, you can add the JavaFX 1.1 plugin to include support for developing JavaFX applications.