Programming

Java Threading

November 21, 2009

TimerTextField.java import java.util.Date; import javax.swing.JTextField; public class TimerTextField extends JTextField implements Runnable { private boolean gogo = true; @Override public void run() { // TODO Auto-generated method stub Date d; while(gogo) { d = new Date(); this.setText(d.toString()); this.repaint(); try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } [...]

Read the full article →

Java Navigation

November 14, 2009

Main.java public class Main { public static void main(String[] args) { new Apps(); } } Apps.java import java.awt.Component; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.ListIterator; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField; public class Apps extends JFrame{ private JButton jbsave; private [...]

Read the full article →

Java Hashmap

November 13, 2009

Pet.java public class Pet { private String name; private int age; public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } } Apps.java import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedReader; import java.io.FileReader; [...]

Read the full article →

Java Array

November 13, 2009

import java.util.Arrays; public class MainProg { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub int num1[] = {1,2,3,4}; int num2[] = new int[4]; int num3[] = new int[4]; // to populate for (int i=0 ; i < 4 ; i++) { num2[i] = i; } Arrays.fill(num3,0); // [...]

Read the full article →

Reading CSV File Using C Program

June 2, 2008

Since I’m on an integration project, I’m mostly dealing with transferring of data from two or more systems whether it’s from the legacy system or newly implemented system. Most of the type of data movement is sending CSV files to and from the different system. Here is a simple tutorial on how to read CSV. [...]

Read the full article →

How to display newline in Excel?

January 12, 2008

The commonly used to display newline in Visual Basic is using VbCrLF. But the problem is you will see a small rectangle at the end of the line. PLAIN TEXT Visual Basic: Dim strFirstLine As String Dim strSecondLine As String   strFirstLine = "This is the first line" strSecondLine = "This is second line"   [...]

Read the full article →

Pro *C Programming Do’s and Don’t

November 18, 2007

Use one array per action such as inserting, updated and deleting records. Always increment the array counter every time you add new records. Always resize array every time you add new records. Always reset the array counter after the bulk update, insert and delete. Inserting or updating records should comes last if the value of [...]

Read the full article →

Software Best Practices Conference

September 23, 2007

I want to share ideas from Youdon. His presentation for Software Best Practices Conference is about Ten Most Important Ideas in Software Engineering.  Here is what he talks about: You can't control what you can't measure Peopleware Incrementalism Iteration Repair costs increase Tradeoffs are non-linear Reuse is important Risk management provides insights Consistency trumps brillance [...]

Read the full article →