I love walking. It's good for my health both in physical and mental. I found my peace during the walking. During my sabbatical, I walked at least an hour every day. After I returned to work, I walked at least 30 minutes after my lunch. Sometimes, I found a solution for my problem during my walk.
“I am going the way of all the earth. Be strong and be a man! Keep the mandate of the Lord, your God, walking in his ways and keeping his statutes, commands, ordinances, and decrees as they are written in the law of Moses, that you may succeed in whatever you do, and wherever you turn.” (1 Kings 2:2-3)
Sunday, March 23, 2014
Sunday, February 2, 2014
Tết - Happy Year of the Horse
Đầu năm khai bút. Cầu xin Thiên Chúa ban cho mọi người tràn đầy sức khỏe và niềm vui. Đơn giản. Có sức khỏe, có niềm vui, chúng ta mới thành công trong công việc. Thành công dẫn đến sự thịnh vượng. Sự thịnh vượng sẽ đem lại nhiều sức khoẻ và làm cuộc sống chúng ta thêm hạnh phúc.
First writting for a new year, Year of the Horse 2014. May God bless everyone a full health and happiness. Simply, health and happiness are the basic elements of success. Sucess leads to the prosperous. The prosperous enrichs our life.
First writting for a new year, Year of the Horse 2014. May God bless everyone a full health and happiness. Simply, health and happiness are the basic elements of success. Sucess leads to the prosperous. The prosperous enrichs our life.
Wednesday, January 1, 2014
Slow Down
Looked into the past, I thought I would more success and quickly reached my goals if I slowed down. So, my resolution for this new year is slow down.
I will reading slowly so I can enjoy the writing.
I will drive slowly so I can arrive the destination safely and on time.
“To build may have to be the slow and laborious task of years. To destroy can be the thoughtless act of a single day.”
— Winston Churchill
“For fast-acting relief, try slowing down.”
— Lily Tomlin
“The trees that are slow to grow bear the best fruit.”
— Moliere
“Always remember to slow down in life; live, breathe, and learn; take a look around you whenever you have time and never forget everything and every person that has the least place within your heart.”
— Anonymous
“Slow down and enjoy life. It's not only the scenery you miss by going to fast-you also miss the sense of where you are going and why.”
— Eddie Cantor
“Slow down and everything you are chasing will come around and catch you.”
— John De Paola
“Slow down you're doing fine
You can't be everything you want to be
Before your time.”
— Billy Joel
I will reading slowly so I can enjoy the writing.
I will drive slowly so I can arrive the destination safely and on time.
“To build may have to be the slow and laborious task of years. To destroy can be the thoughtless act of a single day.”
— Winston Churchill
“For fast-acting relief, try slowing down.”
— Lily Tomlin
“The trees that are slow to grow bear the best fruit.”
— Moliere
“Always remember to slow down in life; live, breathe, and learn; take a look around you whenever you have time and never forget everything and every person that has the least place within your heart.”
— Anonymous
“Slow down and enjoy life. It's not only the scenery you miss by going to fast-you also miss the sense of where you are going and why.”
— Eddie Cantor
“Slow down and everything you are chasing will come around and catch you.”
— John De Paola
“Slow down you're doing fine
You can't be everything you want to be
Before your time.”
— Billy Joel
Sunday, December 22, 2013
Install Eclipse on Mac OS/X
After I upgraded my MacBook Pro from OS/X 10.7 "Lion" to OS/X 10.9 "Mavericks", many my applications did not work correctly so I uninstalled them. Install Eclipse IDE on Mac OS/X is simple, just extract the zip file and you are all set.
How do I put Eclipse icon on launchpad?
Move whole Eclipse folder to your Applications folder
How do I put Eclipse icon on launchpad?
Move whole Eclipse folder to your Applications folder
Sunday, November 17, 2013
Check for existing record before insert
To avoid duplicate record in database, it is better to check for duplicate certain column data before insert. Primary key is a good mechanic to prevent duplicate row but don't count on it. Take a look the following SQL statements.
-- Creating temporary table (Notice the primary key is set to identity)
CREATE TABLE #tblTemp
( ID int identity primary key,
ColA nvarchar(30),
ColB nvarchar(50)
);
GO
-- Inserting new record into the temporary table tblTemp
-- If execute this insert statement twice, you will have two row have same data in ColA and ColB
-- with difference ID
INSERT INTO #tblTemp VALUES ('Test A1', 'Test B1');
-- This is better
IF NOT EXISTS (SELECT 1 FROM #tblTemp WHERE #tblTemp.ColA='Test A1')
INSERT INTO #tblTemp VALUES ('Test A1', 'Test B1')
SELECT * FROM #tblTemp
Another example using sample database AdventureWorks2012.
USE AdventureWorks2012;
GO
SELECT * FROM AdventureWorks2012.Person.Address WHERE AddressLine1='1970 Napa Ct.';
GO
-- We don't want a duplicate record for AddressLine1 '1970 Napa Ct.' and PostalCode 1597
IF NOT EXISTS (SELECT 1 FROM AdventureWorks2012.Person.Address WHERE AddressLine1='1970 Napa Ct.' AND PostalCode=1597)
INSERT INTO AdventureWorks2012.Person.Address (AddressLine1, City, StateProvinceID, PostalCode)
VALUES ('1970 Napa Ct.', 'Lane Cove', 50, 1597);
SELECT * FROM AdventureWorks2012.Person.Address WHERE AddressLine1='1970 Napa Ct.';
GO
-- Creating temporary table (Notice the primary key is set to identity)
CREATE TABLE #tblTemp
( ID int identity primary key,
ColA nvarchar(30),
ColB nvarchar(50)
);
GO
-- Inserting new record into the temporary table tblTemp
-- If execute this insert statement twice, you will have two row have same data in ColA and ColB
-- with difference ID
INSERT INTO #tblTemp VALUES ('Test A1', 'Test B1');
-- This is better
IF NOT EXISTS (SELECT 1 FROM #tblTemp WHERE #tblTemp.ColA='Test A1')
INSERT INTO #tblTemp VALUES ('Test A1', 'Test B1')
SELECT * FROM #tblTemp
Another example using sample database AdventureWorks2012.
USE AdventureWorks2012;
GO
SELECT * FROM AdventureWorks2012.Person.Address WHERE AddressLine1='1970 Napa Ct.';
GO
-- We don't want a duplicate record for AddressLine1 '1970 Napa Ct.' and PostalCode 1597
IF NOT EXISTS (SELECT 1 FROM AdventureWorks2012.Person.Address WHERE AddressLine1='1970 Napa Ct.' AND PostalCode=1597)
INSERT INTO AdventureWorks2012.Person.Address (AddressLine1, City, StateProvinceID, PostalCode)
VALUES ('1970 Napa Ct.', 'Lane Cove', 50, 1597);
SELECT * FROM AdventureWorks2012.Person.Address WHERE AddressLine1='1970 Napa Ct.';
GO
Tuesday, October 8, 2013
Error 5120 When Attached Database
I got error 5120 when attempted to attach sample database AdventureWorks2012 to Microsoft SQL Server 2012 ran on Microsoft Windows 8.1 Preview.
Solution to this problem is simple: Close the current Microsoft SQL Server Management Studio and run it as administrator to attach database. Also, do not use 'sa'. Use Windows Authentication instead.
Now, test it as normal user by update a record in the AdventureWorks2012 database.
Solution to this problem is simple: Close the current Microsoft SQL Server Management Studio and run it as administrator to attach database. Also, do not use 'sa'. Use Windows Authentication instead.
Now, test it as normal user by update a record in the AdventureWorks2012 database.
Tuesday, September 17, 2013
Microsoft SQL vs MySQL
I'm working with both databases and love them. Here are my notes their SQL syntax difference.
Select first 10 records from table:
In Microsoft SQL:
Select first 10 records from table:
In Microsoft SQL:
SELECT TOP 10 SchoolID, SchoolName
FROM schools
ORDER BY SchoolID;
In MySQL:
SELECT SchoolID, SchoolName
Create new table and insert data from existing tables
Microsoft SQL:
SELECT * INTO Schools_Bak20130916 FROM Schools;
MySQL:
CREATE TABLE Schools_Bak20130916 SELECT * FROM Schools;
FROM schools
ORDER BY SchoolID;
In MySQL:
SELECT SchoolID, SchoolName
ORDER BY SchoolID
LIMIT 10
Microsoft SQL:
SELECT * INTO Schools_Bak20130916 FROM Schools;
MySQL:
CREATE TABLE Schools_Bak20130916 SELECT * FROM Schools;
Subscribe to:
Posts (Atom)


