Ashik’s IT Thoughts

April 7, 2009

Bowling with Friends

Filed under: Community, Java — ashikuzzaman @ 2:05 am

Last week I went to bowling with my friends in Fremont and we enjoyed it a lot. I paid on behalf of them for the game so that everyone else pay me back later. Despite their repeated query to know how much they should pay me, I was too busy the whole last week to calculate that. Right now, having a little relax time, so I downloaded JDK 6 in my new laptop from office and wrote the small java program to calculate it. Compile and run the program to know how much I owe to each of them.

/**
* To compile: javac -d . BowlingCost.java
* To run: java BowlingCost
*/

import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
public class BowlingCost {
public static final double shoeRent = 4.0;
public static final double perGame = 4.25;
private static int male = 5;
private static int female = 4;
private static Map payersMaritalStatus = new HashMap();
public BowlingCost() {
payersMaritalStatus.put("Shahriar", Boolean.TRUE);
payersMaritalStatus.put("Ezaz", Boolean.TRUE);
payersMaritalStatus.put("Hasinur", Boolean.TRUE);
payersMaritalStatus.put("Nitol", Boolean.FALSE);
payersMaritalStatus.put("Ashik", Boolean.TRUE);
}
public static void main(String []args) {
BowlingCost cost = new BowlingCost();
System.out.println("Total Cost of Bowling = " + calculateTotal() + " dollars.\n");
displayPaymentAmounts();
System.out.println("\nThank you! It was a pleasure playing bowling with you guys!!");
}
private static double calculateTotal() {
return perGame * (male * 3 + female * 1) + shoeRent * (male + female);
}
private static void displayPaymentAmounts() {
Iterator it = payersMaritalStatus.keySet().iterator();
String payerName = null;
boolean isMarried = false;
while(it.hasNext()) {
payerName = (String) it.next();
isMarried = ((Boolean) payersMaritalStatus.get(payerName)).booleanValue();
if(isMarried) {
System.out.println(payerName + " should pay " + (perGame * (3 + 1) + shoeRent * (1 + 1)) + " dollars.");
} else {
System.out.println(payerName + " should pay " + (perGame * 3 + shoeRent * 1) + " dollars.");
}
}
}
}

If you don’t want to run the program in command line or opening your favorite IDE, then you can use the following online java compiler to copy paste the code there (select Java SE 1.4 class from the drop down box at the bottom).

http://www.zamples.com/JspExplorer/index.jsp?format=jdk16cl

Here is the output if you run the program:

Total Cost of Bowling = 116.75 dollars.

Ezaz should pay 25.0 dollars.
Ashik should pay 25.0 dollars.
Hasinur should pay 25.0 dollars.
Shahriar should pay 25.0 dollars.
Nitol should pay 16.75 dollars.

Thank you! It was a pleasure playing bowling with you guys!!

August 29, 2007

Intel Chairman’s Visit in Bangladesh

Filed under: Community — ashikuzzaman @ 12:36 am

Intel Corporation is the world’s largest semiconductor company and the inventor of the x86 series of microprocessors, the processors found in many personal computers. Dr. Craig R. Barrett, the chairman of this giant chip maker company, will visit Bangladesh soon. The purpose of his visit is predicted to find out facts for investment opportunity in Bangladesh. This came in newspapers a few days ago like:

“Intel Corporation’s chairman Craig Barrett will visit Bangladesh during first week of September 2007. This could be viewed as an opportunity to develop partnership that brings a win-win platform. Craig made similar visit to Vietnam in 2002 which triggered the staggering investment afterward.”

Bangladesh needs foreign direct investment (FDI) from companies like Intel, but the political and infrastructure constraints are not quite attractive for such investment from big companies. However, we have a huge labor force at a comparatively cheap wage which makes us attractive to them. All we need now is a chance to prove ourselves to the big corporates. If Intel comes and operates a hardware assembly and test facility in Bangladesh successfully, it will be a matter of time for other major global players to have the faith on the business environment and opportunites in Bangladesh.

Our current investment scenario is no less than pathetic due to poor conversion of investment proposals into actual implementation. Intel chairman is visiting us in a time when we are just coming out of a major flood, facing a critical political age. But we hope that none of these will stop us from showing our real potential to this big corporate player. Intel’s investment in Vietnam turned this country from a state where we are today to a state where we want to go.

This could be relevant that Intel has an involvement with Bangladesh already. There are a few hundreds of BUET students working in Intel’s Design/Fabrication labs in CA,WA, VA,OR states in USA. A few years back, they formed a body named ‘IBA’ (Intel Bangladesh Association), which was approved by Intel authorities. And as an acknowledgment of contribution from this university, Intel funded for a simulation lab named ‘Robert Noyce Simulation Lab’ (named after one of the two founders of Intel) in Electrical & Electronic Dept of BUET. You can find details on IBA here: http://www.buet.ac.bd/eee/iba

In our next AABEA event of 4th September with Dr. Ishfaqur Reza in Santa Clara, I would like to know whether IBA is behind this visit of Craig Barrett to Bangladesh. NRBs have been trying to portray Bangladesh in a positive manner throughout the world and I believe this is one of those efforts.

If Intel thinks that the one engineer’s wage in USA can accomodate 10 engineers in Bangladesh, it may be good enough to outweigh the current infrastructure lackings we have. Imagine Intel investing $200 million or $500 million in Bangladesh and the economic picture of the country will change radically as other foreign investors will feel safe to invest here as well.

The caretaker govt should have done their homework to take proper advantage of Dr. Barrett’s visit to Bangladesh and show him our strength and potential. We are looking forward to this visit with lot of hopes, with great expectations. We can do it, we will do it.

Source: Taken from my post at AABEA Blog

August 22, 2007

Geni: Family Tree Application

Filed under: Community, Private, Web — ashikuzzaman @ 4:11 pm

I came to know about Geni from FreeBase a while ago. As soon as I saw it, I was amazed. allow people to graphically view and edit family trees. I was looking for such an application for a long time and now I have started my family tree. It will be not only useful and fun but will be a great way to socialize with the relatives.

Geni is a tool for understanding and staying in touch with your family. Geni lets you create a family tree through our fun simple interface. You can expand your tree by adding relatives’ email addresses. They will be invited to join your tree and can add other relatives. Your tree will continue to grow as relatives invite other relatives. From a technical point of view, the web site is so great in delivering exactly what a person would like to see in a family tree gradually that I am speechless! I don’t remember any other application stuck me with so surprise probably other than Facebook.

What are you waiting for now? Start your family tree in http://www.geni.com or join if one of your relative has already started the tree.

April 19, 2007

Crisis in software development

Filed under: Community — ashikuzzaman @ 3:38 pm

I saw a discussion on this topic in bangla ict and wanted to share with my blog readers. The original article is from The Daily Star newspaper.

Crisis in software development

Md Anwarul Kabir

The overall growth of software development in Bangladesh has not been as good as we expected earlier. The government in 1997 identified the software sector as a thrust sector for the overall economic growth of the country. Accordingly, a commission was formed under the ministry of commerce (later called JRC commission) to formulate some recommendations for the rapid growth of the software industry in Bangladesh.

The commission identified four problematic functional areas namely: fiscal, human resource, infrastructure, and marketing, and provided some recommendations to overcome the barriers in software development in our country.

By accepting these recommendations (however, some of these recommendations are yet to be implemented), the government had set a target to export yearly software worth two billion dollar (Tk 14,000 crore) by the year 2006. However the statistics (BCIT) reveal that the total earning from software sector during 2004-2005 was approximately Tk 88.34 crore. No doubt, this achievement lies far behind as it has been envisaged. This article tries to investigate the real causes that hinder the overall growth in this sector.

It has been argued that the quality of any product largely depends on its demand. Alternatively, demand of a product vastly depends on the quality of a product. This hypothesis is very much true for any software product. The very causes of failure in software development industries in Bangladesh can be identified as twofold: 1) Poor marketing efforts, and 2) Lack of quality products.

At this point of time, as Bangladesh software industries are not capable of producing quality software products, they are not succeeding in entering the ever-demanding global software market. Alternatively, as the software industries are not able to enter the global software market, the quality software development in our software industries seems to be impossible. In fact, software industries in Bangladesh are suffering from this dilemma. For the overall growth of software development in Bangladesh it is now very essential to find a way out from this Carch-22.

Poor marketing efforts
Precondition for accessing the global software market is the creation of internal software market. In fact, experience in software development for internal market can help much in developing software for the global market. Unlike other engineering products software products are dynamic ones. In fact, software development is a continuous and dynamic process. So, experience is a vital issue for producing a quality software product. And for acquiring this experience a sound internal market is a must.

But unfortunately the scenario of internal market for software products developed in Bangladesh is not favourable. Though the use of software in our industries, service providing organizations, and other commercial establishments is increasing significantly, the demand of locally developed software products is not accelerating at the same rate.

One of the major reasons of this is lack of any established national policy that can accelerate the creation of internal market for locally developed software products. Relatively low price of foreign (especially from the neighbouring country) software attracts the consumers in procuring foreign products rather than buying local one.

For instance, if an organization decides to buy a multi-user accountancy software from a local software firm, the minimum price it has to pay is approximately Tk 100,000, whereas in the market an efficient and proven multi-user Indian accountancy software like Accord or Tally is available from Tk 30,000 to 50,000. Moreover, locally developed accountancy software has no high profile as Indian products do.

So, why will the client opt for a local software? In this context, the question arises why the foreign software products are cheaper than the locally developed software products? The answer to this question lies in the very nature of the development process of software products. The cost of initial development of any software product is significantly much higher than its subsequent versions. Because the latter can be produced by merely copying the initial one.

Most of the foreign software products available in our market are their subsequent versions. So, the consumers in our country do not have to bear the initial cost of the development. Moreover, these software are more reliable as they already have established high profile. Many international commercial companies use these products efficiently.

On the contrary, most of the Bangladeshi software firms need to charge the initial cost for development for their clients although the reliability of their “to be developed” products is quite uncertain. So, naturally, the local clients are not interested in procuring local software products. To change this scenario, the government must take steps by imposing high tax on foreign software products and by implementing strict copyright act for the use of software products.

International market
Apart from developing internal software market, we also need to target the international market. At present, as our software firms have no high profile in developing software products, we could not succeed in competing with other countries. Especially our neighbouring country India has already created high profile in the field of software development as it has been in the global software market for at least two decades. This long-time experience as well as availability of many high level IT experts at relatively low cost compared with the developed countries has made India capable of taking advantages of procuring software projects from the global market quite easily. Besides these, as India has professional immigrant communities in the US and in other developed countries who have succeeded in influencing the global market to procure software projects for India.

This is true, it would be very unrealistic on our part to compete with India at this moment to procure software projects from the global market. However, at least we should have a policy to gear up our marketing strategy to procure global software projects. Bangladesh government through its embassies/high commissions may open up a special software marketing cell in different developed countries. Besides our professional expatriates living in the USA and other developed countries may play an important role in this context. They may instantiate software firms to procure software projects to be developed in Bangladesh at low cost.

In the area of software development, timing is a crucial factor. If the end products can not be delivered in time, the clients will be lost. Our observation has revealed that some software firms failed to meet up the deadline decided with clients for delivering end products and subsequently clients cancelled the work order. Failure to meet up deadline for any software project may cause negative attitude towards our software marketing efforts among the prospective clients. So, estimating deadline for any software project must be realistic and software firms must pay especial attention to this.

For marketing, pricing of the product is an important issue. For developers one of the critical questions is: “How much should we charge for our software?” Asking too little price will be jeopardized because in that case developers even can not reach the break event point. Again, charging too much for the product will be a barrier to our marketing efforts. Though the software pricing is a complex phenomenon still there are some scientific economic theories in this regard.

These theories must be applied when the software companies fix the prices of their product. In this context, it must be mentioned that we being at the entry point of global software market, our profit margin should me minimal one so that we can easily compete with other software exporting countries. In fact, at this moment our objective should be to create our profile in the international market by producing quality software at relatively low price.

Lack of quality products
From the client’s point of view the quality assurance is of prime concern as the most of the systems are to be used in real time environment. Yet now, our software companies in general have not gained confidence in developing quality software. Right now we have over 200 software developing firms and among them only 20 companies have earned ISO 9001 certification but not a single one has achieved CMM/CMM1 level 3 certification. In this context it should be stated in terms of achieving ISO 9001 certification is not that important issue to justify the quality of software products. ISO only focuses the general aspects of development to certify the quality.

But achieving CMM/CMM1 (minimum at level 3 out of five levels) is the prime factor for defining quality software. One statistics has revealed that some of the software companies in our country could only pass the first level of CMM/CMM1. In this respect it must be stated that if a software product could pass at least level three of CMM/CMM1 then we can classify this as quality product. The barriers to achieving quality software on part of our software industries are discussed below:

Lack of expertise in producing flawless user requirements: To ensure the quality of software products, the developing firms must go through some defined software development steps as suggested in software engineering discipline. The very first step is to analyze the users’ requirement. Defining users’ requirement precisely is a crucial part as designing of the system vastly depends on this.

Ideally system analysts should do all sorts of analysis to produce user requirement analysis documents. Unfortunately, in Bangladesh, a few firms pay much effort to produce flawless user requirement documents. This is, in fact, due to lack of theoretical knowledge in system analysis and design. Production of high quality requirement analysis documents needs in-depth theoretical knowledge in system analysis and design. But many of local software development firms lack the expertise in this field. To combat this limitations software firms should consult academics in this field with a view to producing relatively flawless user requirement analysis documents.

Lack of expertise in designing the system: Apart from user requirement analysis, the designing part of the software product is the most vital part in the development process. The efficiency of any implemented software system entirely depends on its design. Again, availability of expert software designers is a real challenge to our software industries. In fact, as we have entered the software development area quite recently compared with other countries, a few software engineers could acquire required expertise in software designing. In this context, it may be pointed out that we have many entry level programmers or coders but the number of experienced and expert software engineers is till a handful.

In fact, our software industries are suffering from the lack of availability of resourceful persons who can guide large and complex software projects properly to produce quality end products. It may be mentioned here that sound academic knowledge in software engineering is a must for developing a quality software system. A bridge between industries and academic institutions can improve this scenario. The theoretical sound knowledge of academics may be exploited in industrial software projects. Besides depending on the complexity of the project, software firms may hire foreign experts for specific period to accomplish the project properly.

Lack of knowledge in developing model: Software development process must follow some specific model, depending on characteristics of system to be developed, available resourceful persons and other technical factors. Our empirical studies have shown that many of our software development firms do not follow any particular model in developing their software products. Without adopting any suitable model for development the end product can not be a quality one. So, prior to starting a software project, the developer must select model for the development.

Absence of proper software testing procedure: Quality software demands exhaustive test to check its performance. Some theoretical testing methodologies are available to check the performance and integrity of the software. Many developing firms, here in Bangladesh, hastily try to deliver the end products to their clients without performing exhaustive test which in turn keep many bugs in end products. In this context, it should be pointed out that fixing the errors after delivering the product (especially if it is on operation) is costlier than during the developing time. So, software developers must perform the test phase of the development before delivering the end product to the clients.

Inconsistent documentation: For software development documentation is a very important part. Though some of the software firms in our country put documentation for their products but very frequently the documentation is either incomplete or inconsistent. As the software is ever-growing product, documentation in coding must be kept for the future possible enhancement of the software. Besides, clarity of user manual is desirable for any good software products. Our software firms should pay especial attention to this.

So far this article has tried to find out the reasons behind our failure to enter the global software market. To combat the problem, it is high time, on our part to formulate some policies with a view to improving both our marketing efforts and developing quality software. To develop internal market for our own software products, the government must stop the easy availability of foreign products. Imposition of high tax on foreign products will significantly change the scenario. Side by side, to improve the quality of our own products both the industries and academic institutions should work hand in hand.

The involvement of academics in software projects run by the industry will contribute much to improve the quality of the end products. Besides, like many other developed countries students from different universities in this discipline can work for industries as internees. This will no doubt provide our young students an exposure to real time developing environment.

The author is Assistant Professor and Research Coordinator of Department of Computer Science of American International University-Bangladesh (AIUB)

© thedailystar.net, 2007. All Rights Reserved

source: http://www.thedailystar.net/

March 27, 2007

SourceForge.Net Addition: Buying/Selling Services for Open Source Software

Filed under: Community — ashikuzzaman @ 11:02 am

I got the following email a little earlier. SoiurceForge.Net is going to add an exciting feature soo: Buying/Selling Services for Open Source Software.
Dear SourceForge.net community member,

As an active participant in the Open Source community, you may be excited
to learn about a new feature that we will add to SourceForge.net in late
spring/early summer. This feature will allow you to buy or sell services
for Open Source software on SourceForge.net.

Interested? Follow the link below and we’ll keep you updated as we move
towards the official launch of this feature:

https://ostg.wufoo.com/forms/marketplace-interest-list/

Thank you for your continued support,
The SourceForge.net Team

SourceForge.net will never ask you for sensitive personal information via an email.

To update your communication preferences, please go to:
http://sourceforge.net/account/

Copyright 2007. SourceForge.net, 46939 Bayside Parkway Fremont, CA 94538

February 26, 2007

Web 2.0 & Open Source

Filed under: Community, Web — ashikuzzaman @ 10:30 pm

Article on Web 2.0 & Open Source

read more | digg story

And a few more references:

http://taint.org/2006/05/29/194404a.html

http://business.newsforge.com/business/05/10/06/0132209.shtml?tid=18&tid=33&tid=13

http://radar.oreilly.com/archives/2006/11/open_source_web.html

http://www.flatworldcmpcollabnet.com/

February 21, 2007

Developing Web Site by Integrating Joomla, SMF and Community Builder

Filed under: Community, Web — ashikuzzaman @ 4:34 pm

Here I provide you the step by step instructions that I carried last night to develop a web site for an IT professionals’ association in California, USA. They need a good news/content management system, a very good forum software and some sort of community/networking features other than regular static/dynamic functionalities that might be developed later phase by phase. I know Joomla (emerged from Mambo) PHP framework or CMS has many great extensions that I can use in developing web 2.0 sites. Although it has been long since I last used PHP, joomla made my work easy by mostly limiting me in configuration and installation efforts to develop a site. So I thaught to share it with you here. I wish there would be something similar in Java with all the extensions and easy to install features!

Pre-Requisite

A domain hosting space where you want to host your site. I chose hostmonster as they have support for PHP, MySQL, Fantastico, Joomla, SMF and many more.

Steps

  1. Install Joomla! I logged into my hostmonster control panel, used Fantastico to install Joomla 1.0.12 in /cms directory. Keep the MySQL database, username and password handy with you as these will be needed in later steps.
  2. Download SMF and Unzip it in your local workspace naming it forum. I downloaded SMF 1.1.2 from http://www.simplemachines.org/download
  3. Upload the unzipped forum direcotry with all its contents to your web server’s /public_html directory.
  4. Install SMF through the following URL – http://www.yourdomainname.com/forum/install.php and follow the wizard from there onwards.
  5. Dont use the GZip compression output, uncheck that option in the wizard page.
  6. Give the same MySQL database name, user name and password that you used for joomla installation. You can find these information in configuration.php file under your domain’s /cms directory. The 3 variables to check for the values are – $mosConfig_user, $mosConfig_password, $mosConfig_db .
  7. Once you finish installation, you should get a success message and install.php file should be deleted for security reason.
  8. Download community builder distribution. I downloaded CBuilder1_0_2_unzip1st.zip from – http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,210/Itemid,35/
  9. Unzip the community builder zip file in your local hard drive. You will need cblogin.zip, comprofiler.zip, mod_comprofilermoderator.zip and mod_comprofileronline.zip files from this location in later steps.
  10. Install comprofiler component. To do so, login to Joomla administrator (http://www.yourdomainname.com/cms/administrator) and select the Installers->Components menu item. Browse for the comprofiler.zip file inside your unizipped community builder directory and press upload file & install button.
  11. Install cb login module. To do so, select the Installers->Modules menu item. Browse for the cblogin.zip file inside your unizipped community builder directory and press upload file & install button.
  12. Install cb moderation module. To do so, select the Installers->Modules menu item. Browse for the mod_comprofilermoderator.zip file inside your unizipped community builder directory and press upload file & install button.
  13. Install cb online module. To do so, select the Installers->Modules menu item. Browse for the mod_comprofileronline.zip file inside your unizipped community builder directory and press upload file & install button.
  14. Add a new user menu item named Members List as a URL pointing to: index.php?option=com_comprofiler&task=usersList
  15. Add new menu item CB Details by clicking on Menu->usermenu->New button.
  16. In New Menu Item page, select Component and press Next button.
  17. Select Community Builder from the Component List.
  18. Populate the Name field as CB Details.
  19. Select Parent Item: Top, Access Level: Registered and Published: Yes.
  20. Click on Save button to add this new menu item under user menu.
  21. Activate the CB Login module. To activate select Modules->Site Modules, check from the list that CB Login module is set for Public Access viewing and then publish this module.
  22. Deactivate mod_login module so that you can use only cb login form instead of joomla login form in your site. To deactivate, find out Modules->Site Modules->Login Form and unpublish it.
  23. Use up arrow to bring the CB Login module up in the left navigation bar. You may also re-position all the modules as you need by setting module order and position.
  24. Activate CB Workflows module. To activate, find out Modules->Site Modules->CB Workflows, check if its set to Registered access level and then publish it.
  25. Now download Joomla SMF Bridge (JSMF) from http://www.joomlahacks.com/joomla/components/Joomla-SMF_Forum
  26. Install JSMF component in Joomla. To install it, go to http://www.yourdomainname.com/cms/administrator and select the Installers->Components menu item. Browse for the com_smf_2_0_2.zip file inside your unizipped community builder directory and press upload file & install button.
  27. After installation success message for JSMF, continue for JSMF Installation Page.
  28. Provide the abosulte path for SMF directory which you can find after logging into SMF forum administration panel. An example value for this may be /home/aabeatco/public_html/forum
  29. Provide SMF tables prefix as smf_
  30. Click the Save button at the top right.
  31. Click to patch Jomla Source Files.
  32. Click to patch SMF Source Files.
  33. Click verify link to synchronize users between Joomla and SMF.
  34. Login to Joomla administrator.
  35. Select Components->Community Builder->Plugin Management.
  36. In Install New Plugin section, upload & install cb_plug_smf_2_0_3.zip file.

If you have followed the steps properly, you have enabled your site for visitors to register/login using CB Login form, roam around and give entries for the various news/polls/blogs entries, submit weblinks, do social networking with like minded community members etc. Your users should be able to roam around the joomla cms pages through the link – http://www.yourdomainname.com/cms and the forum either through http://www.yourdomainname.com/forum or from CMS home page’s Forum link.

February 15, 2007

Developing Simple Chess Board With SWT

Filed under: Chess, Community, Java — ashikuzzaman @ 1:38 pm

I have worked with AWT, Swing and SWT in different projects. I was involved last 2 years mostly on web applications and hence after joining Philips, I got a chance to work with thick clients again. Here I developed a simple prototype for SWT beginners with step by step instructions to develop a chess board using SWT and 3 different ways to setup environment, compile and run it. Hope you will enjoy!

  1. Make sure you have Java installed. I installed Java SE 5 in C:\programs\java\jdk_1.5.0.7
  2. Install Ant 1.6.5 altough you may use command prompt if you dont want to use Ant or even better if you use Eclipse which already has Ant functionalities to work with Ant. I installed Ant at C:\programs\java\apache-ant-1.6.5
  3. Create project directory at c:\workspace\SWTBoard either manually or using Eclipse New Java Project.
  4. Download SWT jar file from Eclipse web site – http://www.eclipse.org/swt . If you already have Eclipse installed in your machine then, you will find the JAR file inside $Eclipse_Install_dir$\plugins directory. I am using SWT 3.2.1 for Windows.
  5. Copy the jar file to a suitable directory for easy reference. I copied the org.eclipse.swt.win32.win32.x86_3.2.1.v3235.jar file (or swt.jar if you have downloaded from Eclipse web site) in C:\workspace\swtlibs directory.
  6. Extract swt-win32-3235.dll file inside the SWT jar file and copy it into the same directory.
  7. Create SWTBoard class under package name com.chess4you.board. Here is the source code for this class.
    /** SWTBoard.java **/
    package com.chess4you.board;
    import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell;
    import org.eclipse.swt.widgets.Label; import org.eclipse.swt.graphics.Color;
    import org.eclipse.swt.graphics.Image;
    import org.eclipse.swt.graphics.ImageData;
    import org.eclipse.swt.graphics.Rectangle;
    import org.eclipse.swt.layout.GridData;
    import org.eclipse.swt.layout.GridLayout;
    import org.eclipse.swt.SWT;/**
    * A simple chess board developed using SWT
    *
    * @author Ashik Uzzaman
    * @link https://ashikuzzaman.wordpress.com
    */
    public class SWTBoard { public static final int NUMBER_OF_ROWS = 8;
    public static final int NUMBER_OF_FILES = 8;
    public static Display display = new Display();
    public static Shell shell = new Shell(display, SWT.SHELL_TRIM);
    public static GridLayout layout = new GridLayout();
    public static GridData data;
    public static Label square;

    private static void createSquares() {
    for(int i=NUMBER_OF_ROWS; i>0; i–) {
    for(int j=1; j<=NUMBER_OF_FILES; j++) {
    data = new GridData(GridData.FILL_BOTH);
    square = new Label(shell, SWT.CENTER);
    square.setBounds(shell.getClientArea());
    square.setBackground(getColor(i, j));
    square.setText(“r” + i + “:c” + j);
    square.setForeground(new Color(display, 0, 0, 250));
    square.setToolTipText(“Row ” + i + ” and Column ” + j);
    square.setLayoutData(data);
    }
    }
    } private static Color getColor(int x, int y)
    {
    if((x+y) % 2 == 0)
    return new Color(display, 255, 255, 255);
    else
    return new Color(display, 0, 0, 0);
    }

    /**
    * @param args
    */
    public static void main(String[] args) {
    layout.numColumns = NUMBER_OF_FILES;
    layout.makeColumnsEqualWidth = true;
    int squareSize = 0;
    int width = display.getBounds().width;
    int height = display.getBounds().height;
    if(width >= height) {
    squareSize = height / 2;
    } else {
    squareSize = width / 2;
    }
    shell.setSize(squareSize, squareSize);
    shell.setBounds(new Rectangle(squareSize / 4, squareSize / 4, squareSize, squareSize));
    shell.setLayout(layout);
    ImageData imgData = new ImageData(“board.jpg”);
    Image img = new Image(display, imgData, imgData);
    shell.setImage(img);

    createSquares();

    // shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
    if (!display.readAndDispatch()) {
    display.sleep();
    }
    }
    display.dispose();
    }
    }

  8. Create javase5.bat file inside your project directory. The content of this file actually sets path and classpath required for java and SWT.
    ## Simple batch file for Java classpath settings
    SET JAVA_HOME=C:\programs\java\jdk_1.5.0.7
    SET ANT_HOME=C:\programs\java\apache-ant-1.6.5
    SET PATH=%PATH%;%JAVA_HOME%\bin;%ANT_HOME%\bin
    SET PROJECT_HOME=C:\workspace\SWTBoard
    SET CLASSPATH=%CLASSPATH%;.;%JAVA_HOME%\lib\tools.jar;C:\workspace\swtlibs\org.eclipse.swt.win32.win32.x86_3.2.1.v3235.jar Title “JDK 5”
    cd %PROJECT_HOME%
    cmd
  9. If you use Ant or Eclipse, create build.xml file in your project directory with following contents.
    <?xml version=”1.0″ encoding=”ISO-8859-1″?>
    <project name=”GenericSwtApplication” default=”run” basedir=”.”>
    <description> SWT Application build and execution file </description> <property name=”main.class” value=”com.chess4you.board.SWTBoard”/>
    <property name=”src” location=”.”/>
    <property name=”build” location=”.”/>
    <property name=”swt.libs” value=”C:\workspace\swtlibs”/>

    <property name=”swt.jar.lib” location=”${swt.libs}”/>
    <property name=”swt.jni.lib” location=”${swt.libs}”/>

    <path id=”project.class.path”>
    <pathelement path=”${build}”/>
    <fileset dir=”${swt.jar.lib}”>
    <include name=”**/*.jar”/>
    </fileset>
    </path> <target name=”compile”>
    <javac srcdir=”${src}” destdir=”${build}”>
    <classpath refid=”project.class.path”/>
    </javac>
    </target> <target name=”run” depends=”compile”>
    <java classname=”${main.class}” fork=”true” failonerror=”true”>
    <jvmarg value=”-Djava.library.path=${swt.jni.lib}”/>
    <classpath refid=”project.class.path”/>
    </java>
    </target>
    </project>
  10. Copy a small icon for a chess board in your project directory and name it board.jpg that is used in our code. You may download the icon that I used from http://farm1.static.flickr.com/160/391341494_669254c2c6_s.jpg
  11. To compile from command prompt, double click javase5.bat file and issue the following command: javac com/chess4you/board/SWTBoard.java
  12. To run from command prompt, issue the following command: java -Djava.library.path=C:\workspace\swtlibs com.chess4you.board.SWTBoard
  13. To compile using Ant, issue the following command: ant compile
  14. To run using Ant, issue the following command: ant run
  15. To compile/build the project using Eclipse, you have to first add the SWT jar file in your project classpath. To do so, right-click on your project in package explorer and select Properties->Java Build Path->Libraries->Add External Jars… and add C:\workspace\swtlibs\org.eclipse.swt.win32.win32.x86_3.2.1.v3235.jar . Now you should be able to build the project selecting Project->Build Project .
  16. To run the project using Eclipse, select Run->Run… ->Arguments and in VM Arguments text area add the following entry: -Djava.library.path=C:/workspace/swtlibs
  17. You may also use the Ant build file (build.xml) from Eclipse by double-clicking on it and running the specific targets (compile or run) by right-click on the target and selecting Run As->Ant Build.

February 9, 2007

Khandakar Asif Hasan on “Meet the Mentors” by SQABD

Filed under: Community — ashikuzzaman @ 5:16 pm

SQA Bangladesh took an excellent initiative to interview the mentors of software industry in Bangladesh and podcast those through Meet the Mentors program. Listen to their first podcast(MP3) session at:

http://sqabdmentors.blogspot.com/2007/02/khandakar-asif-hasan-on-meet-mentors-by.html

This session is with Khandakar Asif Hasan, Director at Spectrum Engineering Consortium Ltd who shared his valuable insights on the strategies for development of software industry infrastructure. In this interview he touched the areas of software development life cycle process, proper training of human resources to build up core professionals in this field, the issue of internship, current Bangladesh Government policies in IT sector, modifications that need to apply to grab local software markets, essense of sustainable software development community, major problems of our software industry by comparing with the neighboring country India. He emphasized on collaboration between software companies and sharing knowledge, tools between each other to guide our software development community with a successful new dimension. Overall this podcast session tries to visualize the milestones and problems of software industry through the analytical portray of Khandakar Asif Hasan with his mission, vision and experiences of journey in the software industry during more than a decade.

I was lucky enough to get Asif Vai as mentor in my software engineering career when I joined Spectrum Engineering Consortium Ltd at 2001. Those who have worked with him, have the appreciation for both his architectural vision as well as engineering approach to solving any (non technical) problems. Layered architecture, design patterns, process centric software development approach, importance of good document writing, team work, knowledge sharing are only a few of what he instilled in our team. He understands the industry trends and from a bird’s eye view can tell which one is appropriate to adapt with and which one should be only studied and left in the buzz. We need more mentors like him in our software industry. I invite you to go through the whole session and share your feedbacks with me.

Directly download from:

http://www.sqabd.com/files/Mentors/Episode1-Mentors_SQABD.mp3

http://feeds.feedburner.com/~r/mentors/~5/87717612/Episode1-Mentors_SQABD.mp3

January 30, 2007

Web 2.0 and Beyond

Filed under: Community, Web — ashikuzzaman @ 4:52 pm

I have been following the trends of Web 2.0 for a while and experiencing the changes in the way we use internet. I gave special attention to Web 2.0 when I found one of the main features declaration for newly released Java SE 6 is the support for Web 2.0. Earlier internet was a platform for 2 parties to push/pull information and do transaction. The 2 parties were more or less divisible by their functionalities like information/product supplier and user/consumer. Now its not only or no more that, its about participation of all the parties involved. Anyone can be in the recieving end and anyone can be in the supplying end as well. The more participation is there, the more valuable the service is. Its no more focused on attracting the giant companies or investors, the focus is now distributed to the individual netizens (citizens of the internet). The best article describing Web 2.0 is written by Tim O’Reilly. Google is in the lead of Web 2.0 initiatives instead of Microsoft, and you are not surprised!? Not co-incidentally, Google has been recently voted in a massive survey by Fortune as the best company to work for in USA.

Here is a screenshot of my Google IG that comes up everytime I open my Web 2.0 aware browser Flock. IG is a good example of a Web 2.0 application although its not the best. My homeland Bangladesh’s PageFlakes (with joint venture from Germany) has been awarded by seomoz.org as the best Personalized start pages of Web 2.0 applications in March 2006 followed by Google IG and Windows Live.

I feel the ground work was done long time back when people started appreciating open source models, projects. The dot.com bubble of late 90s couldn’t reduce the importance of internet in cybercitizen’s life. The web matured from a container of products to a provider of scalable services. Web 2.0 hints at an improved form of the World Wide Web, with technologies such as weblogs, social bookmarking, wikis, podcasts, RSS feeds and other forms of many-to-many publishing; social software, Web APIs, Web standards and online Web services representing a significant change in web’s use and behavior. As a Web 2.0 world’s cybercitizen, I use the following web services every now-and-then.

While I am yet trying to grasp the effect and scale of Web 2.0, talk on Web 3.0 ius going on where its predicted that Wikepedia will be the ultimate leader! Good luck to readers on that.

Older Posts »

Blog at WordPress.com.