Popular Posts

Thursday, March 29, 2012

Alfresco Search Portlet for Liferay

Most developers who have worked with Alfresco and Liferay have had the problem of having to integrate both applications.

 This integration has become progressively more complex, especially since both platforms are competing for some products increasingly similar, which means that they no longer be supported. Fortunately we have the APIs to program our own applications.

Alfresco Search Portlet uses the Alfresco web services api to do searches on the repository. Similarly, we may develop several portlets for exploiting other features of Alfresco api.

Below are two scren shots of the portlet in view and edit modes:



 The portlet uses a username and password to connect to alfresco and perform a search based on permissions for that user.

Finally, note that the portlet has been tested in the following environment:


Community Liferay 5.2.3 & 6.0, Alfresco 3.2 & 3.3, JDK 1.5 +.

Download Alfresco Search Portlet

Five In One Free Magento Extension

The home page holds the worth of any website. Whether you are running a personal portfolio website or an Online business like E-commerce store and other service & solution providing websites. The important aspect to hold the attention of the user is to provide the maximum exposure of the content that your site has. As the users will not stake longer than a few seconds if they do not find for what they have referred from external resources.
In this particular topic, you will get a free of cost Magento extension or I should rephrase it with five extensions bundle packed in one extension that allow you to present the backend stuff like, New products, Top Selling, Top Rated, Most Viewed etc etc on the front page. It allows the Magento store owner to configure the front end maintenance of from the admin panel.

Draw stars using Java

Here is a tutorial to make your way into drawing graphics with Java. This program creates a semi-circle line of stars. The stars are randomly colored. I made the program using Netbeans 5.5, and I tested the code also with Sun Java Studio Enterprise 8.1. Both of them are free. The output is what you see above (star color may differ as they are randomly colored).
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.awt.geom.*;

class psy2k extends JFrame {
public psy2k()
{
super( "Psy2k star draw" );

setBackground( Color.white );
setSize( 400, 400 );
show();
}
public void paint( Graphics g )
{
int xPoints[] = { 55, 67, 109, 73, 83, 55, 27, 37, 1, 43 };
int yPoints[] = { 0, 36, 36, 54, 96, 72, 96, 54, 36, 36 };

Graphics2D g2d = ( Graphics2D ) g;

GeneralPath star = new GeneralPath();
star.moveTo( xPoints[ 0 ], yPoints[ 0 ] );

for ( int k = 1; k < xPoints.length; k++ ) star.lineTo( xPoints[ k ], yPoints[ k ] ); star.closePath();
g2d.translate( 200, 200 );
for ( int j = 1; j <= 20; j++ ) {
g2d.rotate( Math.PI / 20.0 );
g2d.setColor( new Color( ( int ) ( Math.random() * 256 ),
( int ) ( Math.random() * 256 ),
( int ) ( Math.random() * 256 ) ) );
g2d.fill( star );
}
}
public static void main( String args[] )
{
psy2k app = new psy2k();
app.addWindowListener( new WindowAdapter()
{
public void windowClosing( WindowEvent e )
{
System.exit( 0 );
}
}
);
}
}

Create a drop-down menu for image selection using java

The following code uses JCombo class for creating a drop down menu that provides the user the ability to choose and see the selected image. Note that the images you want to inlcude in your app should be saved in the main directory of your program (if you use netbeans for example open the project folder and save the images there).
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

class ComboBoxTest extends JFrame {
private JComboBox images;
private JLabel label;
private String names[] =
{ "cutlass_32.png", "pet-monkey_32.png",
"pirate-captain_32.png", "first-mate_32.png" };
private Icon icons[] =
{ new ImageIcon( names[ 0 ] ),
new ImageIcon( names[ 1 ] ),
new ImageIcon( names[ 2 ] ),
new ImageIcon( names[ 3 ] ) };

public ComboBoxTest()
{
super( "Psy2k-Photo Selection" );

Container c = getContentPane();
c.setLayout( new FlowLayout() );

images = new JComboBox( names );
images.setMaximumRowCount( 3 );

images.addItemListener(
new ItemListener() {
public void itemStateChanged( ItemEvent e )
{
label.setIcon(
icons[ images.getSelectedIndex() ] );
}
}
);

c.add( images );

label = new JLabel( icons[ 0 ] );
c.add( label );

setSize( 350, 100 );
show();
}

public static void main( String args[] )
{
ComboBoxTest app = new ComboBoxTest();

app.addWindowListener(
new WindowAdapter() {
public void windowClosing( WindowEvent e )
{
System.exit( 0 );
}
}
);
}
}
The icons I used in this app are from Iconbuffet's Amsterdam High Seas collection (pirate icon yeah). Iconbuffet is a free social community for trading small icons with others. If you would like to join the madness feel free. It is very addicting!

The bad co-worker: recognise him!

Everybody of us has experienced the phenomenon "bad co-worker", but let me explain what I learned from my experience (web-developing, coding, graphics):
  1. He (the bad co-worker) designs a layout and then he sends it to me for slicing. BUT when I open the layout in Photoshop, I realise that it consists of 200 layers, ungrouped and named with names "layer 1, layer 2, layer 3, ......., layer 200". Believe me pal it is much easier for me to deal with grouped layers in categories like Header, Footer etc and names like Title, sidebar background etc than guessing or right clicking its layout's component to find the appropriate layer.
  2. If I am out of luck at all the layout file is merged down and in .jpg format with the sample text (which should be deleted) on it.
  3. When he writed code, he does not use "ENTER" button for changing line. The code is a mess, without comments and looks like simple text.
  4. When his pc has a problem, he asks the others first and then tries to fix it on his own.
  5. He prefer asking the others for finding information (like a website's URL) than using Google.
  6. His computer is a mess. The desktop is full of icons and files are totally unorganised so he (and everybody else) cannot find them when it is needed.
  7. When a serious problem occurs in his pc, it means data-loss as he does not know the very simple word "BACKUP".
  8. He leaves on time even if he is a click away from completing a serious task.

Kompozer, The Adobe Dreamweaver Alternative

ompoZer is a complete web authoring system that combines web file management and “what you see is what you get” (WYSIWYG) web page editing. It’s designed to be extremely easy to use, making it ideal for non-technical computer users who want to create an attractive, professional- looking web site without needing to know HTML or web coding.

Of course it’s also possible to write your own code: for that purpose KompoZer features an intelligent Dreamweaver-like code interface.

KompoZer is based on Gecko, the layout engine inside Mozilla; it's a super-fast, very reliable, standards conformant engine maintained on a daily basis by a wide community of developers. Its remarkable support of XML, CSS and JavaScript offers the best authoring platform on the market. Its architecture based on XUL makes it the most extensible editing tool ever.

VDrift, The Great Opensource Racing Game

Powered by Vamos engine (see here for details), VDrift is a cross-platform, open-source driving simulation made with drift racing in mind, and it’s currently available for Linux, FreeBSD, Mac OS X and Windows (Cygwin). Although the game is in an early development stage, it is supposed to be very playable and quite featurepacked, with 19 tracks (including the Nordschleife track), 28 cars, AI players, “very realistic physics” and a (simple) multiplayer network mode.

Initial screenshots look a little rudimentary at times, but seriously sweet at others. I look forward to playing this one and hope to have an in-depth view of both Vamos and VDrift over the coming months.

You can view more screenshots and get VDrift for free at Here.