4/12/12

Adding more fields to the Joomla

1.5 Registration page

Warning: Joomla Hack! The following code involves modifying the core Joomla code. This has intrinisc drawbacks, i.e. any time you upgrade you'll have to redo the code, or lose this functionality
Make sure you take backups before you do this change!
The Joomla Registration page usually contains enough information for most website. Users who want enhanced user information, typically go for Community Builder which allows extensive user registration fields. However, it is entirely possible to create additional registration fields without installing any components, by modifying a few lines in the Joomla core code. Here's how to do it. In this example, we will be adding Business and Phone to the user registration field, however you can modify the example to add any fields you want to.

Step 1 - Add fields to the Users table

The first thing you need to do is to add the new fields into the Users table into the database. Using phpmyadmin or otherwise add the fields to the users tabl. The following SQL command adds the fields, however you can add these in any way you want:

ALTER TABLE jos_users ADD business VARCHAR (100) NO NULL AFTER name;
and
ALTER TABLE jos_users ADD phone VARCHAR (100) NO NULL AFTER business;

Once you have created the columns, verify that they have been created correctly and move on to the next step.

Step 2 - Modify the code

You'll need to modify a total of 4 files:
1. Modify the user class to include the new files in libraries/joomla/database/table/user.php
    var $name = null;
    /**
    * The login name
    *
    * @var string
    */
    var $username = null;
var $business = null;
var $phone = null;
2. Modify the code which displays the registration page components/com_user/views/register/tmpl/default.php 




    *





*





*
     

3. Modify the view of the users list: components/com_user/views/user/tmpl/form.php













:









:





 
4. Edit the page which displays the users in the backend: administrator\components\com_users\views\user\tmpl\form.php

                   
                       
                   
                   
                       
                   
               

                   
                       
                   
                   
                       
                   
               
               
                   
                       
                   
                   
                       
                   
               
 
That's it! You now have a couple of additional fields in the users table, and more information available to use. Thanks goes to jtullous from the Joomla Forums who supplied the code.
Make sure you take backups before you do this change!

4/9/12

JAVA DESIGN PATTERNS


Link

ABOUT THE AUTHOR:
Prashant Satarkar
He has a good experience into Java and J2EE designing and development. He has worked for many national and international clients as developer and designer on J2EE technologies.

Requirement Analysis and Designing has been his core competency. He has also studied Rational Unified Processes. The design patterns can come in handy designing phase of the project.
Here is a write-up by Mr. Prashant Satarkar on the subject of design patterns.

Who should read this?
I want to write this article on patterns because I have found in many books that reading about a pattern also, does not at times gives us complete feel of how and where to use it. I want that I should be able to write something which presents the patterns in as simple a way as possible. If the reader understands about the patterns after reading this, I will consider myself successful.

Abstract: “Pattern” as the name suggests, means series of events occurring in a definite order. The patterns can be found in Java and J2ee technologies also. Many a times, we find that there is a particular way of tackling a problem. This way is easy and has been used many times successfully by a number of people earlier also. This method becomes a pattern.

Learning the design patterns is a multiple step process:
1. Acceptance
2. Recognition
3. Internalization

Patterns Defined: The patterns can be defined in many ways. You can find the definitions of patterns in many good books.
“Design patterns are recurring solutions to design problems.”
Patterns: According to commonly known practices, there are 23 design patterns in Java. These patterns are grouped under three heads:
1. Creational Patterns
2. Structural Patterns
3. Behavioral Patterns

Design Pattern detection using Similarity Scoring

Related Papers

Installation

  • Install Java™ 2 Runtime Environment, Standard Edition 1.5.0
    You can download it from http://java.com/en/index.jsp
  • Download the Design Pattern detection Tool (version 4.5 - build 28/05/2010)
    In order to avoid Heap size OutOfMemoryError, execute in console java -Xms32m -Xmx512m -jar pattern4.jar

Usage

  • You must first select the root of the project package. Only class files (bytecode files) are necessary for the project analysis.
  • Then select the pattern(s) to be detected from the pattern list.
  • You can use some of the Huston design pattern Java demos for testing the tool.

Proxy Variation

The design pattern reported by the tool as Proxy2 is actually a variation of Proxy pattern.

However, this Proxy variation is structurally more similar to Decorator pattern than Proxy pattern, since Proxy role has an association to Subject role (named subject) and method Request() declared in Proxy invokes an abstract method having the same signature through subject association (as exactly happens between Decorator and Component roles in Decorator pattern).
The differences between Decorator pattern and this Proxy variation are: a) Decorator role is abstract while Proxy role is concrete, b) Proxy role initializes its association to Subject role with a reference to an object of RealSubject role which is instantiated inside the constructor of Proxy role.

This kind of Proxy variation has been reported by Günter Kniesel and Alex Binun from University of Bonn.

Proxy Variation

ChangeLog

  • Fixed a bug related with the handling of composite generic types (bug reported by Lin-Chieh Wen from the Dept. of Information Engineering & Computer Science, Feng Chia University, Tai-Chung, Taiwan, R.O.C.) (version 4.5)tick
  • Report of additional pattern roles corresponding to methods and fields (version 4.4)tick
  • The Subject role in Observer pattern should also contain a detach method used for unregistering Observers (version 4.3)tick
  • In Visitor pattern visitConcreteElement methods may also have Element type as parameter instead of ConcreteElement types (version 4.2)tick
  • Array types are included in the analysis for the identification of Composite and Observer pattern instances (version 4.1)tick
  • Fixed the problem concerning the distinction of Observer from Composite pattern (version 4)tick
  • Add support for Proxy design pattern (version 4)tick
  • Export detected design pattern instances to XML format (version 2)tick
  • Detection of all design patterns with a single click (version 2)tick
  • Console version (version 2)tick
    Execution: java -Xms32m -Xmx512m -jar pattern4.jar -target "C:\foo\myclasses" -output "C:\foo\output.xml"

Detected Design Patterns in JHotDraw 5.1

Design Pattern Name Roles and Corresponding Classes

* Last updated on April 1st 2009
Object Adapter-
Command
Adapter/ConcreteCommand Adaptee/Receiver
CH.ifa.draw.standard.AbstractFigure
adaptee: FigureChangeListener fListener
Request(): release, invalidate, changed
Target role is played by class CH.ifa.draw.framework.Figure
CH.ifa.draw.framework.FigureChangeListener
SpecificRequest(): figureRemoved, figureInvalidated, figureChanged
CH.ifa.draw.figures.RadiusHandle
adaptee: RoundRectangleFigure fOwner
Request(): locate
Target role is played by class CH.ifa.draw.standard.AbstractHandle
CH.ifa.draw.figures.RoundRectangleFigure
SpecificRequest(): getArc, displayBox
CH.ifa.draw.figures.GroupCommand
receiver: DrawingView fView
Execute(): execute
Command role is played by class CH.ifa.draw.util.Command
CH.ifa.draw.framework.DrawingView
Action(): selectionZOrdered, drawing, clearSelection, addToSelection(Figure), checkDamage
CH.ifa.draw.figures.InsertImageCommand
receiver: DrawingView fView
Execute(): execute
Command role is played by class CH.ifa.draw.util.Command
CH.ifa.draw.framework.DrawingView
Action(): lastClick, add(Figure), clearSelection, addToSelection(Figure), checkDamage
CH.ifa.draw.figures.UngroupCommand
receiver: DrawingView fView
Execute(): execute
Command role is played by class CH.ifa.draw.util.Command
CH.ifa.draw.framework.DrawingView
Action(): selectionElements, clearSelection, drawing, addToSelection(Figure), checkDamage
CH.ifa.draw.standard.AlignCommand
receiver: DrawingView fView
Execute(): execute
Command role is played by class CH.ifa.draw.util.Command
CH.ifa.draw.framework.DrawingView
Action(): selectionElements, checkDamage
CH.ifa.draw.standard.BringToFrontCommand
receiver: DrawingView fView
Execute(): execute
Command role is played by class CH.ifa.draw.util.Command
CH.ifa.draw.framework.DrawingView
Action(): selectionZOrdered, drawing, checkDamage
CH.ifa.draw.standard.ChangeAttributeCommand
receiver: DrawingView fView
Execute(): execute
Command role is played by class CH.ifa.draw.util.Command
CH.ifa.draw.framework.DrawingView
Action(): selectionElements, checkDamage
CH.ifa.draw.standard.SendToBackCommand
receiver: DrawingView fView
Execute(): execute
Command role is played by class CH.ifa.draw.util.Command
CH.ifa.draw.framework.DrawingView
Action(): selectionZOrdered, drawing, checkDamage
CH.ifa.draw.standard.ToggleGridCommand
receiver: DrawingView fView
Execute(): execute
Command role is played by class CH.ifa.draw.util.Command
CH.ifa.draw.framework.DrawingView
Action(): getConstrainer, setConstrainer(PointConstrainer)
CH.ifa.draw.figures.TextFigure
adaptee: OffsetLocator fLocator
Request(): moveBy
Target role is played by class CH.ifa.draw.standard.AbstractFigure
CH.ifa.draw.standard.OffsetLocator
SpecificRequest(): moveBy
CH.ifa.draw.standard.AbstractTool
adaptee: DrawingView fView
Request(): activate, deactivate
Target role is played by class CH.ifa.draw.framework.Tool
CH.ifa.draw.framework.DrawingView
SpecificRequest(): clearSelection, setCursor(Cursor)
CH.ifa.draw.figures.LineConnection
adaptee: Connector fStart, Connector fEnd
Request(): updateConnection
Target role is played by class CH.ifa.draw.framework.ConnectionFigure
CH.ifa.draw.framework.Connector
SpecificRequest(): findStart(ConnectionFigure), findEnd(ConnectionFigure)
CH.ifa.draw.standard.AbstractConnector
adaptee: Figure fOwner
Request(): displayBox, containsPoint
Target role is played by class CH.ifa.draw.framework.Connector
CH.ifa.draw.framework.Figure
SpecificRequest(): displayBox, containsPoint
CH.ifa.draw.applet.DrawApplet
adaptee: ToolButton fDefaultToolButton
Request(): toolDone
Target role is played by class CH.ifa.draw.framework.DrawingEditor
adaptee: ToolButton fSelectedToolButton
Request(): paletteUserOver
Target role is played by class CH.ifa.draw.util.PaletteListener
CH.ifa.draw.standard.ToolButton
SpecificRequest(): name, tool
CH.ifa.draw.application.DrawApplication
adaptee: ToolButton fDefaultToolButton
Request(): toolDone
Target role is played by class CH.ifa.draw.framework.DrawingEditor
adaptee: ToolButton fSelectedToolButton
Request(): paletteUserOver
Target role is played by class CH.ifa.draw.util.PaletteListener
CH.ifa.draw.standard.ToolButton
SpecificRequest(): name, tool
CH.ifa.draw.standard.StandardDrawingView
adaptee: Drawing fDrawing
Request(): drawDrawing, setDrawing
Target role is played by class CH.ifa.draw.framework.DrawingView
adaptee: Drawing drawing()
Request(): add(Figure), remove(Figure), freezeView, unfreezeView, selectionZOrdered
CH.ifa.draw.framework.Drawing
SpecificRequest(): draw, removeDrawingChangeListener, addDrawingChangeListener
SpecificRequest(): add(Figure), remove(Figure), lock, unlock, figures
CH.ifa.draw.standard.StandardDrawingView
adaptee: DrawingEditor fEditor
Request(): tool
Target role is played by class CH.ifa.draw.framework.DrawingView
CH.ifa.draw.framework.DrawingEditor
SpecificRequest(): tool
CH.ifa.draw.contrib.PolygonHandle
adaptee: Locator fLocator
Request(): locate
Target role is played by class CH.ifa.draw.standard.AbstractHandle
CH.ifa.draw.framework.Locator
SpecificRequest(): locate(Figure)
CH.ifa.draw.standard.LocatorHandle
adaptee: Locator fLocator
Request(): locate
Target role is played by class CH.ifa.draw.standard.AbstractHandle
CH.ifa.draw.framework.Locator
SpecificRequest(): locate(Figure)
CH.ifa.draw.standard.ToolButton
adaptee: PaletteIcon fIcon
Request(): paintNormal, paintPressed, paintSelected
Target role is played by class CH.ifa.draw.util.PaletteButton
CH.ifa.draw.util.PaletteIcon
SpecificRequest(): normal, pressed, selected
CH.ifa.draw.standard.StandardDrawingView
adaptee: Painter fUpdateStrategy
Request(): paint(Graphics)
Target role is played by class CH.ifa.draw.framework.DrawingView
CH.ifa.draw.framework.Painter
SpecificRequest(): draw(Graphics, DrawingView)
CH.ifa.draw.standard.ReverseFigureEnumerator
adaptee: ReverseVectorEnumerator fEnumeration
Request(): hasMoreElements, nextElement, nextFigure
Target role is played by class CH.ifa.draw.framework.FigureEnumeration
CH.ifa.draw.util.ReverseVectorEnumerator
SpecificRequest(): hasMoreElements, nextElement
Composite Component Composite
CH.ifa.draw.framework.Figure CH.ifa.draw.standard.CompositeFigure
children: Vector fFigures
Add(Component): add(Figure)
Remove(Component): remove(Figure)
Operation(): draw
Decorator Component Decorator
CH.ifa.draw.framework.Locator CH.ifa.draw.standard.OffsetLocator
component: Locator fBase
Operation(): locate(Figure)
CH.ifa.draw.framework.Figure CH.ifa.draw.standard.DecoratorFigure
component: Figure fComponent
Operation(): displayBox, basicDisplayBox, draw, handles
CH.ifa.draw.framework.Tool CH.ifa.draw.standard.SelectionTool
component: Tool fChild
Operation(): mouseDown, mouseDrag, mouseUp
Factory Method Creator
CH.ifa.draw.framework.DrawingView
FactoryMethod(): selectionElements, getFigureSelection
ConcreteCreator role is played by class CH.ifa.draw.standard.StandardDrawingView
CH.ifa.draw.framework.Figure
FactoryMethod(): figures, decompose, connectorAt
ConcreteCreator role is played by class CH.ifa.draw.standard.AbstractFigure
Observer Subject Observer
CH.ifa.draw.standard.StandardDrawing
observers: Vector fListeners
Attach(Observer): addDrawingChangeListener
Detach(Observer): removeDrawingChangeListener
Notify(): figureInvalidated, figureRequestUpdate
CH.ifa.draw.framework.DrawingChangeListener
Update(): drawingInvalidated, drawingRequestUpdate
CH.ifa.draw.standard.StandardDrawingView
observers: Vector fBackgrounds, Vector fForegrounds
Attach(Observer): addBackground, addForeground
Detach(Observer): removeBackground, removeForeground
Notify(): drawAll -> drawPainters
CH.ifa.draw.framework.Painter
Update(): draw
CH.ifa.draw.standard.StandardDrawingView
observers: Vector fSelection
Attach(Observer): addToSelection
Detach(Observer): removeFromSelection
Notify(): keyPressed -> handleCursorKey -> moveSelection
CH.ifa.draw.framework.Figure
Update(): moveBy
Prototype Client Prototype
CH.ifa.draw.standard.ConnectionHandle
prototype: ConnectionFigure fPrototype
Operation(): createConnection
CH.ifa.draw.framework.Figure
CH.ifa.draw.standard.ConnectionTool
prototype: ConnectionFigure fPrototype
Operation(): createConnection
CH.ifa.draw.framework.Figure
CH.ifa.draw.standard.CreationTool
prototype: Figure fPrototype
Operation(): createFigure
CH.ifa.draw.framework.Figure
Singleton Singleton
CH.ifa.draw.util.Clipboard
uniqueInstance: static Clipboard fgClipboard
CH.ifa.draw.util.Iconkit
uniqueInstance: static Iconkit fgIconkit
Instance(): instance
State-Strategy Context State/Strategy
CH.ifa.draw.standard.AbstractFigure CH.ifa.draw.framework.FigureChangeListener
CH.ifa.draw.standard.ChangeConnectionHandle
CH.ifa.draw.standard.ConnectionHandle
CH.ifa.draw.framework.Figure
CH.ifa.draw.figures.GroupCommand
CH.ifa.draw.figures.InsertImageCommand
CH.ifa.draw.figures.UngroupCommand
CH.ifa.draw.standard.AlignCommand
CH.ifa.draw.standard.BringToFrontCommand
CH.ifa.draw.standard.ChangeAttributeCommand
CH.ifa.draw.standard.FigureTransferCommand
CH.ifa.draw.standard.SendToBackCommand
CH.ifa.draw.standard.ToggleGridCommand
CH.ifa.draw.framework.DrawingView
CH.ifa.draw.applet.DrawApplet
CH.ifa.draw.application.DrawApplication
CH.ifa.draw.framework.Tool
CH.ifa.draw.standard.AbstractTool CH.ifa.draw.framework.DrawingView
CH.ifa.draw.standard.ChangeConnectionHandle
CH.ifa.draw.standard.ConnectionHandle
CH.ifa.draw.framework.ConnectionFigure
CH.ifa.draw.samples.javadraw.URLTool
CH.ifa.draw.standard.ConnectionTool
CH.ifa.draw.standard.CreationTool
CH.ifa.draw.standard.DragTracker
CH.ifa.draw.framework.Figure
CH.ifa.draw.standard.AbstractConnector CH.ifa.draw.framework.Figure
CH.ifa.draw.figures.LineConnection CH.ifa.draw.framework.Connector
CH.ifa.draw.util.CommandButton CH.ifa.draw.util.Command
CH.ifa.draw.standard.SelectionTool CH.ifa.draw.framework.Tool
CH.ifa.draw.util.PaletteButton CH.ifa.draw.util.PaletteListener
CH.ifa.draw.standard.StandardDrawingView CH.ifa.draw.framework.Drawing
CH.ifa.draw.figures.LineConnection CH.ifa.draw.framework.Connector
CH.ifa.draw.standard.StandardDrawingView CH.ifa.draw.framework.Drawing
CH.ifa.draw.standard.StandardDrawingView CH.ifa.draw.framework.DrawingEditor
CH.ifa.draw.contrib.PolygonHandle
CH.ifa.draw.standard.LocatorHandle
CH.ifa.draw.framework.Locator
CH.ifa.draw.standard.ConnectionTool CH.ifa.draw.framework.ConnectionFigure
CH.ifa.draw.samples.javadraw.Animator CH.ifa.draw.framework.DrawingView
CH.ifa.draw.applet.DrawApplet
CH.ifa.draw.application.DrawApplication
CH.ifa.draw.framework.Drawing
CH.ifa.draw.figures.TextTool CH.ifa.draw.standard.TextHolder
CH.ifa.draw.standard.StandardDrawingView CH.ifa.draw.framework.Painter
CH.ifa.draw.figures.PolyLineFigure CH.ifa.draw.figures.LineDecoration
CH.ifa.draw.standard.ChangeConnectionHandle CH.ifa.draw.framework.Connector
CH.ifa.draw.standard.StandardDrawingView CH.ifa.draw.framework.PointConstrainer
CH.ifa.draw.standard.HandleTracker CH.ifa.draw.framework.Handle
CH.ifa.draw.standard.ConnectionTool CH.ifa.draw.framework.Connector
CH.ifa.draw.standard.LocatorConnector CH.ifa.draw.framework.Locator
CH.ifa.draw.samples.javadraw.Animator CH.ifa.draw.util.Animatable
Template Method AbstractClass
CH.ifa.draw.standard.AbstractFigure
TemplateMethod(): moveBy, displayBox(Point, Point), size, containsPoint, invalidate, center
PrimitiveOperation(): basicMoveBy, basicDisplayBox, displayBox()
moveBy -> {basicMoveBy }
displayBox(Point origin, Point corner) -> {basicDisplayBox }
size, containsPoint, invalidate, center -> {displayBox() }
CH.ifa.draw.standard.AbstractHandle
TemplateMethod(): displayBox
PrimitiveOperation(): locate
CH.ifa.draw.standard.ActionTool
TemplateMethod(): mouseDown
PrimitiveOperation(): action
CH.ifa.draw.standard.ChangeConnectionHandle
TemplateMethod(): source, invokeStart, invokeStep, invokeEnd
PrimitiveOperation(): target, disconnect, connect, setPoint
source -> {target }
invokeStart -> {target, disconnect }
invokeStep -> {setPoint }
invokeEnd -> {setPoint, connect }
CH.ifa.draw.util.PaletteButton
TemplateMethod(): paint
PrimitiveOperation(): paintBackground, paintPressed, paintSelected, paintNormal


Detected Design Patterns in JRefactory 2.6.24

Design Pattern Name Roles and Corresponding Classes

* Last updated on April 1st 2009
Object Adapter-
Command
Adapter/ConcreteCommand Adaptee/Receiver
org.acm.seguin.refactor.type.ExtractInterfaceRefactoring org.acm.seguin.refactor.ComplexTransform
org.acm.seguin.refactor.EliminatePackageImportVisitor org.acm.seguin.summary.PackageSummary
org.acm.seguin.refactor.type.RemoveEmptyClassRefactoring org.acm.seguin.summary.TypeSummary
org.acm.seguin.refactor.method.RenameParameterRefactoring org.acm.seguin.summary.MethodSummary
org.acm.seguin.refactor.AddImportTransform org.acm.seguin.parser.ast.ASTName
org.acm.seguin.refactor.type.ChangePackageTransform org.acm.seguin.parser.ast.ASTName
org.acm.seguin.pretty.PrettyPrintVisitor org.acm.seguin.pretty.FieldSizeLookAhead
org.acm.seguin.pretty.PrettyPrintVisitor org.acm.seguin.pretty.LocalVariableLookAhead
org.acm.seguin.metrics.TextReport org.acm.seguin.util.TextFormatter
org.acm.seguin.uml.refactor.ExtractMethodDialog org.acm.seguin.refactor.method.ExtractMethodRefactoring
org.acm.seguin.uml.refactor.ExtractMethodDialog org.acm.seguin.awt.OrderableList
org.acm.seguin.uml.refactor.MoveMethodDialog org.acm.seguin.uml.refactor.ParameterPanel
org.acm.seguin.tools.stub.StubGenTraversal org.acm.seguin.tools.stub.StubFile
org.acm.seguin.print.text.TextPagePrinter org.acm.seguin.print.text.LineSet
org.acm.seguin.uml.refactor.RenameParameterDialog org.acm.seguin.summary.MethodSummary
org.acm.seguin.uml.refactor.RenameClassDialog org.acm.seguin.summary.TypeSummary
org.acm.seguin.uml.UMLPackage org.acm.seguin.uml.line.SegmentedLine
org.acm.seguin.uml.print.UMLPagePrinter org.acm.seguin.uml.UMLPackage
org.acm.seguin.summary.SummaryTraversal org.acm.seguin.summary.load.LoadStatus
org.acm.seguin.metrics.GatherData org.acm.seguin.metrics.MetricsReport
org.acm.seguin.print.text.TextPagePrinter org.acm.seguin.print.text.LinePrinter
org.acm.seguin.summary.load.SwingLoadStatus org.acm.seguin.tools.install.RefactoryStorage
org.acm.seguin.metrics.MethodMetricsFrame org.acm.seguin.summary.MethodSummary
org.acm.seguin.metrics.PackageMetricsFrame org.acm.seguin.summary.PackageSummary
org.acm.seguin.metrics.TypeMetricsFrame org.acm.seguin.summary.TypeSummary
org.acm.seguin.uml.UMLPackage org.acm.seguin.summary.PackageSummary
Factory Method Creator
org.acm.seguin.refactor.type.TypeChangeVisitor
FactoryMethod(): getFileSpecificTransform, getNewImports, getRemoveImportTransform
ConcreteCreator role is played by classes EliminatePackageImportVisitor, MoveClassVisitor, RenameClassVisitor
Observer Subject Observer
org.acm.seguin.refactor.ComplexTransform
observers: ArrayList transforms
Attach(Observer): add(TransformAST)
Detach(): clear
Notify(): apply
org.acm.seguin.refactor.TransformAST
Update(): update
Singleton Singleton
org.acm.seguin.ide.command.PackageSelectorPanel
uniqueInstance: static PackageSelectorPanel mainPanel
Instance(): getMainPanel
org.acm.seguin.ide.common.action.CurrentSummary
uniqueInstance: static CurrentSummary singleton
Instance(): get
org.acm.seguin.ide.common.EditorOperations
uniqueInstance: static EditorOperations singleton
Instance(): get
org.acm.seguin.ide.common.PackageListFilter
uniqueInstance: static PackageListFilter singleton
Instance(): get
org.acm.seguin.ide.common.SourceBrowser
uniqueInstance: static SourceBrowser singleton
Instance(): get
org.acm.seguin.ide.jbuilder.RefactoryNodeViewerFactory
uniqueInstance: static RefactoryNodeViewerFactory factory
Instance(): getFactory
org.acm.seguin.ide.jbuilder.UMLNodeViewerFactory
uniqueInstance: static UMLNodeViewerFactory factory
Instance(): getFactory
org.acm.seguin.pretty.ai.RequiredTags
uniqueInstance: static RequiredTags tags
Instance(): getTagger
org.acm.seguin.refactor.RefactoringFactory
uniqueInstance: static RefactoringFactory singleton
Instance(): get
org.acm.seguin.refactor.undo.UndoStack
uniqueInstance: static UndoStack singleton
Instance(): get
org.acm.seguin.uml.line.LabelSizeComputation
uniqueInstance: static LabelSizeComputation singleton
Instance(): get
org.acm.seguin.version.VersionControlCache
uniqueInstance: static VersionControlCache ssc
Instance(): getCache
State-
Strategy
Context State/Strategy
org.acm.seguin.parser.ast.SimpleNode
org.acm.seguin.pretty.PrettyPrintVisitor
org.acm.seguin.refactor.method.EMParameterFinder
org.acm.seguin.parser.Node
org.acm.seguin.parser.ast.SimpleNode org.acm.seguin.parser.JavaParserVisitor
org.acm.seguin.refactor.field.RenameFieldData org.acm.seguin.summary.Summary
org.acm.seguin.summary.ImportSummary
org.acm.seguin.summary.MethodSummary
org.acm.seguin.summary.TypeSummary
org.acm.seguin.summary.VariableSummary
org.acm.seguin.summary.SummaryVisitor
org.acm.seguin.refactor.method.MoveMethodRefactoring org.acm.seguin.summary.Summary
org.acm.seguin.refactor.AddImportTransform org.acm.seguin.parser.Node
org.acm.seguin.parser.ast.ASTClassDeclaration
org.acm.seguin.parser.ast.ASTConstructorDeclaration
org.acm.seguin.parser.ast.ASTFieldDeclaration
org.acm.seguin.parser.ast.ASTInterfaceDeclaration
org.acm.seguin.parser.ast.ASTMethodDeclaration
org.acm.seguin.parser.ast.ASTNestedClassDeclaration
org.acm.seguin.parser.ast.ASTNestedInterfaceDeclaration
org.acm.seguin.parser.ast.ASTPackageDeclaration
org.acm.seguin.parser.JavaParserVisitor
org.acm.seguin.refactor.method.MoveMethodVisitor org.acm.seguin.summary.Summary
org.acm.seguin.uml.line.DragPanelAdapter org.acm.seguin.uml.line.EndPointPanel
org.acm.seguin.uml.SaveMenuSelection org.acm.seguin.io.Saveable
org.acm.seguin.uml.line.DragPanelAdapter org.acm.seguin.uml.line.LinedPanel
org.acm.seguin.uml.line.LineMouseAdapter org.acm.seguin.uml.line.LinedPanel
org.acm.seguin.ide.common.SourceBrowserAdapter org.acm.seguin.uml.ISourceful
org.acm.seguin.uml.loader.ReloaderSingleton org.acm.seguin.uml.loader.Reloader
org.acm.seguin.refactor.method.ExtractMethodRefactoring org.acm.seguin.parser.Node
org.acm.seguin.refactor.ComplexTransform org.acm.seguin.refactor.TransformAST
org.acm.seguin.ide.common.action.RefactoringAction org.acm.seguin.ide.common.action.SelectedFileSet
org.acm.seguin.uml.UMLLine org.acm.seguin.uml.UMLIcon
org.acm.seguin.ide.elixir.version.ElixirContainsThread
org.acm.seguin.ide.elixir.version.ElixirVersionControlThread
org.acm.seguin.version.VersionControl
org.acm.seguin.uml.line.SegmentedLine org.acm.seguin.uml.line.EndPointPanel
org.acm.seguin.summary.SummaryTraversal
org.acm.seguin.summary.FrameworkFileSummaryLoader
org.acm.seguin.summary.load.LoadStatus
org.acm.seguin.summary.SummaryTraversal org.acm.seguin.summary.FrameworkLoader
org.acm.seguin.pretty.sort.MultipleOrdering org.acm.seguin.pretty.sort.Ordering
org.acm.seguin.pretty.sort.MultipleOrdering org.acm.seguin.util.Settings
Template Method AbstractClass
org.acm.seguin.ide.common.action.CurrentSummary
TemplateMethod(): updateMetaData, find
PrimitiveOperation(): getMetadataReloader, registerWithCurrentDocument
updateMetaData -> {getMetadataReloader }
find -> {registerWithCurrentDocument }
org.acm.seguin.ide.common.action.RefactoringAction
TemplateMethod(): actionPerformed
PrimitiveOperation(): activateListener
org.acm.seguin.io.DirectoryTreeTraversal
TemplateMethod(): traverse
PrimitiveOperation(): isTarget, visit
org.acm.seguin.metrics.MetricsFrame
TemplateMethod(): createFrame
PrimitiveOperation(): getTitle
org.acm.seguin.metrics.MetricsReport
TemplateMethod(): finalReport, typeReport, methodReport
PrimitiveOperation(): reportAverageStatements, reportAveragePublicMethods, reportAverageOtherMethods, reportAverageClassMethods, reportAverageInstanceVariables, reportAverageClassVariables, reportAbstractClasses, reportInterfaces, reportAverageParameters, reportPublicMethods, reportOtherMethods, reportClassMethods, reportInstanceVariables, reportClassVariables, reportStatement, reportParameters, reportLinesOfCode, reportBlockDepth
finalReport -> {reportAverageStatements, reportAveragePublicMethods, reportAverageOtherMethods, reportAverageClassMethods, reportAverageInstanceVariables, reportAverageClassVariables, reportAbstractClasses, reportInterfaces, reportAverageParameters }
typeReport -> {reportPublicMethods, reportOtherMethods, reportClassMethods, reportInstanceVariables, reportClassVariables }
methodReport -> {reportStatement, reportParameters, reportLinesOfCode, reportBlockDepth }
org.acm.seguin.parser.factory.ParserFactory
TemplateMethod(): getParser, getAbstractSyntaxTree
PrimitiveOperation(): getInputStream, getKey
getParser -> {getInputStream }
getAbstractSyntaxTree -> {getKey }
org.acm.seguin.pretty.PrettyPrintFromIDE
TemplateMethod(): prettyPrintCurrentWindow, getPrintData
PrimitiveOperation(): getStringFromIDE, setStringInIDE, setLineNumber, getLineNumber
prettyPrintCurrentWindow -> {getStringFromIDE, setStringInIDE, setLineNumber }
getPrintData -> {getLineNumber }
org.acm.seguin.pretty.sort.Ordering
TemplateMethod(): compare
PrimitiveOperation(): getIndex
org.acm.seguin.print.xml.State
TemplateMethod(): processLine(String), print(StringBuffer)
PrimitiveOperation(): processLine(String, int, StringBuffer), getFont
processLine(String) -> {processLine(String, int, StringBuffer) }
print(StringBuffer) -> {getFont }
org.acm.seguin.refactor.Refactoring
TemplateMethod(): run, recordUsage
PrimitiveOperation(): preconditions, transform, getID
run -> {preconditions, transform }
recordUsage -> {getID }
org.acm.seguin.refactor.type.AddClassRefactoring
TemplateMethod(): transform
PrimitiveOperation(): transformOriginal, createClass
org.acm.seguin.refactor.type.TypeChangeVisitor
TemplateMethod(): visit(FileSummary, Object), visit(ImportSummary, Object), isSamePackage, isMatchingPackage
PrimitiveOperation(): getAppropriateClasses, getFileSpecificTransform, getNewImports, getNewFile, addRenamingTransforms, getRemoveImportTransform, getCurrentPackage
visit(FileSummary, Object) -> {getAppropriateClasses, getFileSpecificTransform, getNewImports, getNewFile, addRenamingTransforms }
visit(ImportSummary, Object) -> {getRemoveImportTransform, getCurrentPackage }
isSamePackage, isMatchingPackage -> {getCurrentPackage }
org.acm.seguin.summary.query.TypeList
TemplateMethod(): query(PackageSummary), add(FileSummary, LinkedList)
PrimitiveOperation(): isIncluded(FileSummary), isIncluded(TypeSummary)
query(PackageSummary) -> {isIncluded(FileSummary) }
add(FileSummary, LinkedList) -> {isIncluded(TypeSummary) }
org.acm.seguin.uml.refactor.DialogViewListener
TemplateMethod(): actionPerformed
PrimitiveOperation(): createDialog
org.acm.seguin.uml.refactor.ExtractMethodDialog
TemplateMethod(): followup, init
PrimitiveOperation(): setStringInIDE, getStringFromIDE, getSelectionFromIDE
followup -> {setStringInIDE }
init -> {getStringFromIDE, getSelectionFromIDE }
org.acm.seguin.uml.refactor.NoInputRefactoringListener
TemplateMethod(): runRefactoring
PrimitiveOperation(): createRefactoring
org.acm.seguin.uml.refactor.RefactoringDialog
TemplateMethod(): runRefactoring
PrimitiveOperation(): createRefactoring
Visitor Visitor ConcreteElement
org.acm.seguin.parser.JavaParserVisitor 86 subclasses of org.acm.seguin.parser.ast.SimpleNode
org.acm.seguin.summary.SummaryVisitor 13 subclasses of org.acm.seguin.summary.Summary


Detected Design Patterns in JUnit 3.7

Design Pattern Name Roles and Corresponding Classes

* Last updated on April 1st 2009
Object Adapter-Command Adapter/ConcreteCommand Adaptee/Receiver
junit.swingui.TestSuitePanel
adaptee: TestTreeModel fModel
Request(): addError, addFailure, endTest
Target role is played by class junit.framework.TestListener
junit.swingui.TestTreeModel
SpecificRequest(): addError(Test), addFailure(Test), addRunTest(Test)
junit.awtui.TestRunner
adaptee: TestResult fTestResult
Request(): addError, addFailure, endTest
Target role is played by class junit.framework.TestListener
junit.framework.TestResult
SpecificRequest(): errorCount, failureCount, runCount, wasSuccessful
junit.awtui.TestRunner
adaptee: ProgressBar fProgressIndicator
Request(): endTest
Target role is played by class junit.framework.TestListener
junit.awtui.ProgressBar
SpecificRequest(): step
junit.swingui.TestHierarchyRunView
adaptee: TestSuitePanel fTreeBrowser
Request(): getSelectedTest, revealFailure, aboutToStart
Target role is played by class junit.swingui.TestRunView
junit.swingui.TestSuitePanel
SpecificRequest(): getSelectedTest, getTree, showTestTree
junit.extensions.TestSetup$1
Request(): protect
Target role is played by class junit.framework.Protectable
junit.extensions.TestSetup
SpecificRequest(): setUp, basicRun, tearDown
junit.framework.TestResult$1
Request(): protect
Target role is played by class junit.framework.Protectable
junit.framework.TestCase
SpecificRequest(): runBare
Composite Component Composite
junit.framework.Test junit.framework.TestSuite
children: Vector fTests
Add(Component): addTest(Test)
Operation(): countTestCases, run -> runTest
Decorator Component Decorator
junit.framework.Test junit.extensions.TestDecorator
component: Test fTest
Operation(): countTestCases, run -> basicRun
Observer Subject Observer
junit.framework.TestResult
observers: Vector fListeners
Attach(Observer): addListener
Detach(Observer): removeListener
Notify(): addError, addFailure, endTest, startTest
junit.framework.TestListener
Update(): addError, addFailure, endTest, startTest
State-Strategy Context State/Strategy
junit.extensions.ActiveTestSuite$1 junit.framework.Test
junit.swingui.FailureRunView
junit.swingui.TestHierarchyRunView
junit.swingui.TestRunContext
junit.swingui.TestRunner junit.runner.FailureDetailView
Template Method AbstractClass
junit.runner.BaseTestRunner
TemplateMethod(): getTest
PrimitiveOperation(): runFailed


Acknowledgments

  • I would like to thank Alex Binun from University of Bonn, Germany for reporting a missing instance of Decorator design pattern in java.io package and helping me to improve the tool. Version 4 resulted based on his valuable feedback!
  • I would like to thank Lei Hu from the Dept. of Computing & Software, McMaster University, Canada for reporting some missing design pattern instances in JHotDraw 5.1

External documentation sources

Giảng viên vs Sinh viên.

Sinh viên tb + khá =  chưa đọc sách trước khi lên giảng đường.
Sinh viên giỏi = đọc sách trước khi lên giảng đường.
Giảng viên = Sinh viên giỏi + kinh nghiệm.

Full collections from O'Reilly - Head First :)


After a couple of hours search with Google, now I have full ebook collection from O'Reilly - Head First! It is amazing for me. I love these books because it is so simple for understand. In addition,  the guide help us up-to-date basic notions to working with new technologies just in a several days. 
Waiting for newest book in 2012. There are 38 newest Head First books up to 2011 such as:
- Mobile Web published in Dec-2011
- HTML5 Programming published in Oct-2011
- jQuery published in Sep-2011

4/8/12

Hướng dẫn tích hợp NganLuong.Vn vào VirtueMark Joomla!

Sau đây chúng tôi hướng dẫn chi tiết và đơn giản nhất để các bạn có thể tích hợp đơn giản vào website có sử dụng nguồn mở Joomla kèm VirtueMark.
Bước 1: Quý vị và các bạn download file đính kèm trong bài viết này và giải nén: tich_hop_ngan_luong_joomla_virtuemark_pitvietnam.rar (Passrar: www.pitvietnam.com)
Bước 2: Trong thư mục tich_hop_ngan_luong_joomla_virtuemark_pitvietnam đã giải nén ta thực hiện các bước sau:
-    Replace file checkout.index.php trong thư mục đã giải nén vào thư mục administrator/components/com_virtuemart/html/ của Joomla
-    Copy file checkout.nganluong.php trong thư mục đã giải nén vào thư mục administrator/components/com_virtuemart/html/ của Joomla
Bước 3: Vào phần quản trị của Joomla, chọn menu Components->Virtuemart. Trong trang quản trị này, chọn vào mục danh sách các phương thức thanh toán (List Payment Methods) bên menu trái. Trong danh sách các phương thức thanh toán, thêm một phương thức đặt tên là: Nganluong.vn, mã phương thức: NL, và sang phần Configuration của phương thức này thêm nội dung sau vào:
require_once( PAGEPATH . 'checkout.nganluong.php');
?>
Bước 5: Trong file administrator/components/com_virtuemart/html/checkout.nganluong.php cần nhập lại các thông tin sau:
-    Địa chỉ email tài khoản người bán
-    Mã đơn hàng, giỏ hàng
Đến đây bạn đã hoàn tất việc tích hợp tùy biến cho site có sử dung nguồn mở Joomla.
Phòng IT - PITvietnam
(Cảm ơn sự hỗ trợ của NgânLượng.vn)

4/7/12

Prolog :- tutorial

Introduction

Prolog is a logical and a declarative programming language. The name itself, Prolog, is short for PROgramming in LOGic. Prolog's heritage includes the research on theorem provers and other automated deduction systems developed in the 1960s and 1970s. The inference mechanism of Prolog is based upon Robinson's resolution principle (1965) together with mechanisms for extracting answers proposed by Green (1968). These ideas came together forcefully with the advent of linear resolution procedures. Explicit goal-directed linear resolution procedures, such as those of Kowalski and Kuehner (1971) and Kowalski (1974), gave impetus to the development of a general purpose logic programming system. The "first" Prolog was "Marseille Prolog" based on work by Colmerauer (1970). The first detailed description of the Prolog language was the manual for the Marseille Prolog interpreter (Roussel, 1975). The other major influence on the nature of this first Prolog was that it was designed to facilitate natural language processing.
Prolog is the major example of a fourth generation programming language supporting the declarative programming paradigm. The Japanese Fifth-Generation Computer Project, announced in 1981, adopted Prolog as a development language, and thereby focused considerable attention on the language and its capabilities. The programs in this tutorial are written in "standard" (University of) Edinburgh Prolog, as specified in the classic Prolog textbook by authors Clocksin and Mellish (1981,1992). The other major kind of Prolog is the PrologII family of Prologs which are the descendants of Marseille Prolog. The reference to Giannesini, et.al. (1986) uses a version of PrologII. There are differences between these two varieties of Prolog; part of the difference is syntax, and part is semantics. However, students who learn either kind of Prolog can easily adapt to the other kind.
This tutorial is intended to be used to help learn the essential, basic concepts of Prolog. The sample programs have been especially chosen to help promote the use of Prolog programming in an artificial intelligence course. Lisp and Prolog are the most frequently used symbolic programming languages for artificial intelligence. They are widely regarded as excellent languages for "exploratory" and "prototype programming".
Chapter 1 explains the Prolog programming environment for the beginner.
Chapter 2 explains Prolog syntax and many essentials of Prolog programming through the use of carefully chosen sample programs. The sample programs are arranged to guide the student through the development of Prolog programs that are constructed in a top-down, declarative fashion. Care has been taken to cover Prolog programming techniques that are very useful in an artificial intelligence course. In fact, this primer can serve as a convenient, small, concise Prolog introduction for such a course. Semantic issues have been addressed by introducing early the concept of a program clause tree that is used to define in an abstract way what are supposed to be the consequences of a Prolog program specification. The author believes this to be a viable way to promote the basic semantic issues of software verification for Prolog programming. The last section of this chapter introduces an example that shows that Prolog can be effectively used to give careful, precise specifications of systems, contrary to its usual reputation as being hard to document because it is easy to use as an exploratory programming tool.
Chapter 3 explains the operation of the underlying inference engine of Prolog. Chapter 3 should be first read after the student has studied two or three of the sample programs in Chapter 2. The last section in this chapter introduces Prolog meta-interpreters.
Chapter 4 gives an outlined view of the major built-in predicates of Prolog, many of which are exemplified in Chapter 2.
Chapter 5 gives an outline for developing A* search programs in prolog.  Section 5.3 has an αβ search program for the game of tic tac toe.
Chapter 6 presents a unique and extensive presentation of a logic meta-interpreter for normal logical rulebases. {Note 9/4/2006: I have edited this chapter heavily, and the section links are all new.}
Chapter 7 gives an introduction to Prolog's built-in grammar parser generator, and a brief overview of how Prolog can be used to parse English (natural language) sentences. Also, there is a section covering the construction of simple idiomatic natural language interfaces to programs.
Chapter 8 shows how to implement varios prolog prototypes. A new section (§8.4) develops an interactive connection between prolog (inference engine) and Java (GUI) to play tic tac toe. The simple connection model is quite widely adaptable and applicable.
Earlier versions of portions of this tutorial date back to 1988. The introductory material was originally used to help explain a Prolog interpreter developed by the author (no longer available) for use in his courses. The author believes that the introductory material, gathered together in the form given here might be very useful for the student who wants a quick, but well-tailored, introduction to Prolog.
For fuller treatments of Prolog the student is advised to see the textbooks by Clocksin and Mellish (1981,1992), by O'Keefe (1990), by Clocksin (1997, 2003), or by Sterling and Shapiro (1986).
For excellent historical notes regarding Prolog and natural language processing using Prolog the text by Pereira and Shieber (1987) is recommended.
Pomona, California
1988-2011

BEGINNING >>>

4/2/12

A simple guide to creating your first Vista Gadget

Gadgets are simply HTML and JavaScript. The SideBar exposes a bunch of API's which are accessible from JavaScript and extends the HTML schema. In this short guide we will greate a simple "Hello World" gadget.

The four steps

  • Create a directory to contain the gadget files.
  • Create an HTML page for our "Hello World".
  • Create the XML file for the gadget manifest.
  • Test the created gadget with Vista Sidebar.

Step 1 - Create a directory to contain the gadget files

Locate and open your gadgets folder. Click the Start button, and then click Run. In the Open text box, type:
%userprofile%\AppData\Local\Microsoft\Windows Sidebar\Gadgets
This will open an explorer window containing your Gadgets folder.
Create a new folder named HelloWorld.gadget

Step 2 - Create an HTML page for our "Hello World".

Create a file named HelloWorld.html and update it's contents with the following HTML:
(NOTE: The source is available for download at the bottom of this article)
<html>
<head>
    <title>Hello, World!title>
    <style>
        body
        {
            margin: 0;
            width: 130px;
            height: 65px;
        }
        #gadgetContent
        {
            width: 130px;
            top: 24px;
            text-align: center;
            position: absolute;
            font-family: Verdana;
            font-size: 10pt;
        }
    style>
head>
<body>
    <span id="gadgetContent">
        Hello, World!
    span>
body>
html>

Step 3 - Create the XML file for the gadget manifest

Now you need to create a Gadget manifest. This is an XML file that specifies the core HTML file and defines the gadget's properties, such as name, icon, and description. Every gadget manifest is named gadget.xml.
To create the gadget manifest, copy and paste the following text into a new file. Save your file with the file name gadget.xml. For localization support, make sure that you save your gadget.xml file with UTF-8 encoding.
xml version="1.0" encoding="utf-8" ?>
<gadget>
    <name>Hello, World!name>
    <namespace>Example.Younamespace>
    <version>1.0.0.0version>
    <author name="Your Name">
        <info url="www.example.com" />
    author>
    <copyright>© 2007copyright>
    <description>My first gadgetdescription>
    <hosts>
        <host name="sidebar">
            <base type="HTML" apiVersion="1.0.0" src="HelloWorld.html" />
            <platform minPlatformVersion="1.0" />
            <permissions>Fullpermissions>
        host>
    hosts>
gadget>

Step 4 - Test the created gadget with Vista Sidebar

  • Right click on the Sidebar. Choose Add Gadgets...
  • Double click the Hello World Gadget
The gadget should now appear on your sidebar. If you want to make updates to the Gadget HTML then view the changes you need to remove it from the sidebar and add it again for the changes to become visible.

Next Steps....

Why not try adding a background to the Gadget (see GadgetBackground), changing the height or editing the CSS to make it appear differently.