The following example is an implementation of the Producer-Consumer problem. A class which provides the methods for generating and consuming an integer value is separated from the Producer and the Consumer thread classes. class SharedData { int data; synchronized void set(int value) { System.out.println("Generate " + value); data = value; } synchronized int get() { System.out.println("Get " + data); return data; } } class Producer implements Runnable { SharedData sd; Producer(SharedData sd... Read Full Story
Design Patterns in PHP : Singleton Design Pattern
By Rakhitha Ratnayake, 14 December 2009.
Singleton design pattern is the most simple design pattern which has only one class. Singleton design pattern allows only one object to be created from a singleton class. If many other classes need to use a object from a singleton class, they have to use the same instance. These types of classes are required for logging, registry, database connections, memory manager, window manager…etc. This... Read Full Story
A thread refers to a single sequential flow of control within a program. For simplicity, think of threads as processes being executed within the context of a certain program. Consider modern operating systems that allow you to run multiple programs at once. While typing a document on your computer using a text editor, you can listen to music at the same time and surf through the net on your PC. The operating system installed in your computer allows multitasking. Likewise, a program... Read Full Story
The top-level containers like JFrame and JApplet in Swing are slightly incompatible with those in AWT. This is in terms of adding components to the container. Instead of directly adding a component to the container as in AWT containers, you have to first get the content pane of the container. To do this, you'll have to use the getContentPane method of the container. Java Programming Tutorial Sample Source Code: Setting Up Top-Level Containers: A JFrame Example: import javax.swing.*; import... Read Full Story
Java Programming Thread Constructor The thread has eight constructors. Let us have a quick look at some of these constructors. Thread Constructors Thread() Creates a new Thread object. Thread(String name) Creates a new Thread object with the specified name. Thread(Runnable target) Creates a new Thread object based on a Runnable object. target refers to the object whose run method is called. Thread(Runnable target, String name) Creates a new Thread object with the specified name and based on... Read Full Story
I got interested in this book after discovering Gary Rosenzweig’s AS3 tutorials on his Flash Game University Website. I was impressed by his ability to explain things clearly and simply. As other reviews have already stated “AS3 Game Programming University” is an excellent and highly readable book for learning AS3. In practice I find it much more helpful than Colin Moock’s book “Essential ActionScript 3.0″, which is a little too academic for me (although I’m glad I have it!). I’m also... Read Full Story
Book Details Author:David Ascher, Alex Martelli, Anna Ravenscroft No of Pages: 844 pages Press: O'Reilly Media, Inc.; 2 edition Dated:March 18, 2005 Language: English ISBN-10: 0596007973 ISBN-13: 978-0596007973 Book Description Portable, powerful, and a breeze to use, Python is the popular open source object-oriented programming language used for both standalone programs and scripting applications. It is now being used by an increasing number of major organizations, including NASA and Google... Read Full Story
From Drools version 4 to version 5, the framework has undergone quite a few improvements. These include support for three additional business modeling techniques. So today, Drools is not only a rule engine, but much more than that.
One of these techniques is event processing. The module that added event processing capabilities to the framework is called Drools Fusion . It supports Complex Event Processing (CEP) and Event Stream Processing (ESP).
"...Complex Event Processing, or CEP... Read Full Story
Book Details Author:John Carnell, Rob Harrop, and Kunal Mittal (Ed) No of Pages: 528 pages Press: Apress Dated:October 17, 2006 Language: English ISBN-10: 1590597389 ISBN-13: 978-1590597385 Book Description Pro Apache Struts with Ajax maps out how to use the Apache Struts MVC web framework, so you can solve everyday web application development challenges. This book takes an application-centric approach: the development of an application drives Struts along with Ajax coveragenot the other way... Read Full Story
Book Details Author:Hans Petter Langtangen No of Pages: 693 pages Press: Springer; Edition:1 edition Dated:September 10, 2009 Language: English ISBN-10: 3642024742 ISBN-13: 978-3642024740 Book Description The book serves as a first introduction to computer programming of scientific applications, using the high-level Python language. The exposition is example- and problem-oriented, where the applications are taken from mathematics, numerical calculus, statistics, physics, biology, and finance... Read Full Story