Facebook Chat. Now its there….!

Facebook Chat
This is about the long-awaited Facebook Chat, and I’m bit late with this post. Nothing more than that is in the Gmail Chat, but may be this is handy with the friends on FB only.

Posted in Tech News | Tagged , | Comments Off

Renaming a MySQL database

MySQL does not support renaming a database (and prefers not to be done in the supported versions) as mentioned here.

However, use of this statement could result in loss of database contents, which is why it was removed. Do not use RENAME DATABASE in earlier versions in which it is present.

  • But there might be times when you want to do this, and the simple workaround I use is this.
  • Just export the current database. You can use mysqldump or any other GUI tool like HeidiSQL or phpMyAdmin.
  • The dump typically contains SQL statements to create the table, populate it, or both.
  • Then create a database with the name you want, the new database.
  • Then just mysqlimport the exported SQL file to the new database you just created.
  • Final step would be to drop the old database.

Also note,

If you are doing a backup on the server and your tables all are MyISAM tables, consider using the mysqlhotcopy instead because it can accomplish faster backups and faster restores.

 

This is not big deal and just a matter of simple workaround, thats all. So I'm sure there is no way one could get doubts on this. Still if you get any I might be able to give a hand. Feedback and questions are welcome via comment or you can email me at talkout AT SPAMFREE gmail DOT com

 

Posted in Tech Notes | Tagged , | Comments Off

Business Process Outsourcing – ‘Other side of the white-collar’

THIS ARTICLE HAS BEEN REMOVED BY THE BLOG OWNER DUE TO THE WRONG VIEWS IT HAD CREATED. ALSO THE BLOG OWNER WISHES TO APOLOGIZE FOR POSTING THIS ARTICLE WITH OUT VERIFYING THE REAL SOURCE.

BUT THE BLOG OWNER IS STILL WORRIED ABOUT THE LONG WORKING HOURS AND THE STRESS FACED BY ‘SOME’ SOFTWARE ENGINEERS ALL AROUND THE WORLD.

Posted in Random Thoughts | 2 Comments

Warren Buffet – Worlds Richest Person

This is from a mail I got form someone, felt like sharing it here. Some interesting facts about Warren Buffet who feels buying stocks at age 11 was late for him. Warren Buffet is the Legendary Investor who has donated $31 billion to charity. Here are some very interesting aspects of his life:

  • He bought his first share at age 11 and he now regrets that he started too late!
  • He bought a small farm at age 14 with savings from delivering newspapers.
  • He still lives in the same small 3-bedroom house in mid-town Omaha , that he bought after he got married 50 years ago. He says that he has everything he needs in that house. His house does not have a wall or a fence.
  • He drives his own car everywhere and does not have a driver or security people around him.
  • He never travels by private jet, although he owns the world's largest private jet company.
  • His company, Berkshire Hathaway, owns 63 companies. He writes only one letter each year to the CEOs of these companies, giving them goals  for the year. He never holds meetings or calls them on a regular basis.  He has given his CEO's only two rules. Rule number 1: do not lose any of your share holder's money. Rule number 2: Do not forget rule number 1.
  • He does not socialize with the high society crowd. His past time after he gets home is to make himself some pop corn and watch Television.
  • Bill Gates, the world's richest man met him for the first time only 5 years ago. Bill Gates did not think he had anything in common with Warren Buffet. So he had scheduled his meeting only for half hour. But when Gates met him, the meeting lasted for ten hours and Bill Gates became a devotee of Warren Buffet.
  • Warren Buffet does not carry a cell phone, nor has a computer on  his desk.

His advice to young people :

"Stay away from credit cards and invest in yourself and Remember:
A. Money doesn't create man but it is the man who created money.
B. Live your life as simple as you are.
C. Don't do what others say, just listen them, but do what you feel  good.
D. Don't go on brand name; just wear those things in which u feel comfortable.
E. Don't waste your money on unnecessary things; just spend on them  who really in need rather.
F. After all it's your life then why give chance to others to rule our life."

And I love this quote from him.
"I don't have a problem with guilt about money. The way I see it is that my money represents an enormous number of claim checks on society. It's like I have these little pieces of paper that I can turn into consumption. If I wanted to, I could hire 10,000 people to do nothing but paint my picture every day for the rest of my life. And the GNP would go up. But the utility of the product would be zilch, and I would be keeping those 10,000 people from doing AIDS research, or teaching, or nursing. I don't do that though. I don't use very many of those claim checks. There's nothing material I want very much. And I'm going to give virtually all of those claim checks to charity when my wife and I die."
– (Lowe 1997:165–166)

Ref: http://en.wikipedia.org/wiki/Warren_Buffett

Posted in Random Thoughts | 1 Comment

Ant: Simple JUnit Test

This is the final part of the so called Ant series I have been writing in this blog, about Apache Ant. This is an extremely brief tutorial on JUnit. The goal is to test Ant and JUnit framework integration .

The previous posts on Ant can be found here:

  1. Apache Ant
  2. Ant: Installation
  3. Ant: Hello World in Ant
  4. Ant: Java Hello World in Ant
  5. Ant: Java Swing Hello World in Ant

Prerequisites

In order to do this we will need to have a Java compiler, Ant, and JUnit installed.

Java Classes

First, we need a Java class to test. I had to make this example too simple according to my Java knowledge. This lacks any Java Docs or comments, but it's a pretty simple bit of code. :)

public class Math {	static public int add(int a, int b) {		return a + b;	}

	static public int multiply ( int a, int b) {		return a * b;	}}

Then to test this code, we need a second Java class that will

  1. import junit.framework.*
  2. extend TestCase

There are two important points to note in the sample. First, the routine is named testAdd. This convention tells that the routine is supposed to be a test and that it's targeting the add functionality. Here's the matching example.

import junit.framework.*;

public class TestMath extends TestCase { 

  protected void setUp() {   	// put common setup code in here  }

  protected void tearDown() {  	// put common cleanup code in here

  }

  public void testAdd() {  	int num1 = 3;  	int num2 = 2;  	int total = 5;  	int sum = 0;  	sum = Math.add(num1, num2);  	assertEquals(sum, total);  }

  public void testMulitply() {

  	int num1 = 3;   	int num2 = 7;   	int total = 21;  	int sum = 0;  	sum = Math.multiply(num1, num2);  	assertEquals("Problem with multiply", sum, total);

  	num1 = 5;   	num2 = 4;

  	total = 20;  	sum = Math.multiply(num1, num2);  	assertEquals("Problem with multiply", sum, total);  }}

And both these files could be kept in a sub-folder named src

Ant Script

The last step is how to run your JUnit tests using Ant. Create a file called build.xml and place it in the main folder. The core of this scripts is the following, which does the JUnit tests.

<junit printsummary="yes" haltonfailure="yes" showoutput="yes" >	<classpath>		<pathelement path="${build}"/>		<fileset dir="lib">

			<include name="**/*.jar"/>		</fileset>	</classpath> 	<batchtest fork="yes" todir="${reports}/raw/">		<formatter type="xml"/> 		<fileset dir="${src}">

			<include name="**/*Test*.java"/>		</fileset>	</batchtest></junit>

The file I used is this one. (The inner details of this scripts are Ant Scripting and XML, which is not explained in this document, but really straightforward to understand)

Output

Run ant test in command line:

[root@nimal junit-sample]# ant testBuildfile: build.xml

init:

compile:    [javac] Compiling 2 source files to /opt/junit-sample/bin

run-tests:    [junit] Running TestMath

    [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0.321 sec

test:[junitreport] Processing /opt/junit-sample/reports/TESTS-TestSuites.xml to /tmp/null1227203872[junitreport] Loading stylesheet jar:file:/usr/local/ant/lib/ant-junit.jar!/org/apache/tools/ant

 /taskdefs/optional/junit/xsl/junit-frames.xsl[junitreport] Transform time: 1714ms[junitreport] Deleting: /tmp/null1227203872

BUILD SUCCESSFULTotal time: 6 seconds

Ant will also do nice things like create nice HTML reports! I've linked to a simple Ant script that will compile all the code in your "src" folder, run all the tests named "test*" and then create an HTML report in your "reports\html" folder.

I've linked to a zip file (ant-junit-sample.zip) that contains the build.xml file, the source code and the test class. (If you try to run it and get errors about JUnit not being found, remember to add that junit.jar to your Ant lib folder.)

Attachments


Posted in Tech Notes | Tagged , | Comments Off