Thursday, December 31, 2009

New year 2010 Resolutions

Nothing beats today to write about a beginning chapter of year.

My new year resolutions of 2010

1. Earn more money. Money money. To support family and life.

2. Of course a good career is neccessary.

3. Without the most important aspect of life -- health, point 1 and 2 is useless.

4. Above all, spiritually blessed by God. Amen.

5. Lead a simple life. Be contended.

6. More time with family spending quality time with parents, wife and brining up children.

7. More time with good friends and relatives. Socialize.

8. Have extra spare cash. Be charitable.

9. Have a passive income to be financially independent

10. Be a charisma person.

Wednesday, December 30, 2009

Food

As the kids are not around, might be a good time to catch up with
Lawrence and his family.

Sent from my iPhone

Monday, December 28, 2009

20litre tank thing

Foreign registered vehicles is allowed to pump up to max 20 litres of petrol within 50km radius from Malaysia checkpoint.

Yesterday was a long weekend (After X'mas) holidays back to Singapore. The North South highway is choked with cars, especially after three lanes merge into two. Whenever there is heavy vehicle with some driving slow especially at night, soon you can imagine car started to crawl at 70-90km/h. The traffic was bad in the petrol station somewhere in Pagoh where everyone rush to pump in some petrol. Hurray to the petrol kiosk there. Car drivers however have to endure the long queue in the resting area leading to the Petronas.

What I did was detour to Macap toll --> Immediately after the toll, turn left and head towards the JB trunk road. After travelling another 10km+, there are ample of petrol kiosks for refilling. Petronas on the left, Shell and caltax 250m on the right. And another 500m, one should see Mobile on the left. Thereafter, travel few more km and join back the highway.

Still the highway traffic is terrible. Caught in causeway jam for an hour and half before arriving home past midnight.

A busy school holidays

This year school holidays was spent mostly in Malaysia. With the kids back to my hometown in Seremban, we went to Sunway Lagoon as well. MyKad holders entitled to 20% discount, Jusco card 25% off the entrance ticket.

2 Parks - Water Park & Amusement Park
Adult Ticket RM 48.00 (Normal RM 60.00)
Child Ticket RM 36.00 (Normal RM 45.00)
** Maximum 6 tickets per transaction **
** Click here for park details **

http://www.sunwaylagoon.com/whtnew/whtnew.asp

Saturday, December 19, 2009

Sent from my iPhone

Concert

3 good men concert

Hi we are experiencing 1st concert experience at maxpavillion spore
for 3 good men show.


Sent from my iPhone

My lucky draw

After 2 years of unlucky charm, at last the spell has been broken. Thank you Lord.

Manage to get a lucky gift from my company dinner and dance!
Posted by Picasa

Wednesday, December 9, 2009

Fairy Contest experience

Was early arriving 30mins before the scheduled stated time of registering at 8:30am in the shopping mall. The person in charge did not come until 9am+ where registeration begun.

Some experience to share:

Yes, my daughter did not make it into the finals but it was a nice and worth experience participating. Thanks for the organizer giving a chance.

The performance was the core scoring irregardless of the theme. Almost...if u can score high in the talented section. Also when it mentioned as 2 mins means 2mins.

Nice learn.

Thursday, December 3, 2009

tiger woods

"I have let my family down and I regret those transgressions with all of my heart. I have not been true to my values and the behavior my family deserves. I am not without faults and I am far short of perfect. I am dealing with my behavior and personal failings behind closed doors with my family. Those feelings should be shared by us alone."- tiger woods

http://shine.yahoo.com/channel/sex/whats-next-for-elin-nordegren-and-tiger-woods-549896/

Tuesday, December 1, 2009

A visit to the Singapore Zoo

It's been quite a while since my last visit. It was like 2 years ago or more perhaps.

The entrance fee is a first shocking. It has increased with inflation of course but not my pay :(

Adult: $25
Child: $12.5

A family of four of us, we paid $75.

inclusive of admissions, tram ride (unlimited) and one way boat ride.

Hmm.. probably will enroll into the Singapore Zoo Friends membership which costs $180 for a year unlimited visits to the Zoo next time.

Mei Mei contest

Brought my daughter to a fairy contest. She managed to get into the qualifying round.

Thursday, November 19, 2009

Post to Wordpress using email

http://codex.wordpress.org/Post_to_your_blog_using_email

HP p6290d PC




Got my new PC last Sunday. It is a Quad core HP PC.

Love it. Ergonomics. My first branded PC. I used to assemble previously with bits and pieces and ended up with a mix of rainbow colour of periherals.

With a branded PC it just makes me proud to be a owner of a PC. Powerful. Upgraded from previous AMD Athon 1.8 with motherboard supporting only 1.0, IDE disk.

Now much faster DDR3 ram, 6MB internal cache, SATA disks. Cool.

Will consider for a new HP again.

Only draw back it's a windows 7 32 bit OS. :(

Thanks for the feedback from the comments by user.

I am attaching my Windows 7 Experience Index here.
Apologize, I am unable to enlarge the attach at the moment till I figure it out later. The base score is 5.9.
Processor: 7.2
Mem: 7.2
Graphics: 6.5
Gaming graphics: 6.5
Primary hdd: 5.9

Recently, I tried to run Age of Empire II and believe me or not that I was unable to run with such a sophisticated machine. I got some driver issues. This machine comes with DirectX 11. I suppose the net has some resource that said some dll are omitted from DirectX 9.0c to directX 11. Hence can't play AOEII.


Friday, November 13, 2009

Financial Spread

I have been touching on spread lately. In a contango market ie.
Bullish view on the commodity market eg oil or gas. One thinks that
the prices will eventually be up in the future eg 3 months later. The
opposite is known as backwardation market. This is ignoring the
current oil price market ie. Flat price

To trade profitability in a contango market , one will sell M1 and buy
M2. And to close the position will simply reverse it with buying M1
and sell M2.

This is known as a time spread.


Sent from my iPhone

Thursday, October 29, 2009

3rd Jab of Hep A & Hep B

Did my 3rd final job of Hep A & Hep B today at clinic. Was told by the nurse that the jab can last a 'lifetime' but of course subject to individual. So sometime down the road, need to perform a bloodtest to check the immunity whether a booster is required.

Thursday, October 15, 2009

Meet up with Grace Cheng

Last Sunday, there was a short an hour workshop on Forex trading by Grace Cheng in Suntec. Somehow I did turn up for the event and manage to get in touch with what Grace was explaining how she travelled around the world across 5 continents and not missed a day of trading work.

Tuesday, October 6, 2009

First forex trade placed

I performed my first forex live trade.

The journey of thousands miles begin with a single step...

Monday, October 5, 2009

A day trip to Teluk Sengat - Crocodile Farm


Hello...please see a scenic view from Teluk Sengat where the crocodile farm lies...behold...danger beneath...

Friday, September 18, 2009

Oracle OEM 10g agent installation into Cluster nodes

There is not much resource available on the net that mentioned about the installation of Oracle 10g agent for grid control into a Cold Failover cluster.
CFC is generally a OS control cluster.

I would discuss about the setup that I have done.

Basically, this was an installation into a Solaris Sparc OS 9 two node using VCS cluster. Oracle Grid control version 10.2.0.5. Oracle Database Enterprise 10.2.0.3.

I installed through GUI using runInstaller.

I have tried about almost 10 times all in all until the last one manage to get it up monitored by OMS.

The trick is...

1. export ORACLE_HOSTNAME=logical-hostname

2. cd /source
where source is the installation files for oracle 10g agent 10.2.0.5

3.
Instead of just ./runInstaller

use this

./runInstaller -invPtrLoc /var/opt/oracle/oraInst.loc ORACLE_HOME=/u01/app/oracle/product/agent10g/ ORACLE_HOSTNAME=

This will enable the installation of 10g agent to be cluster-aware.

After installation, modify $ORACLE_HOME/sysman/config/emd.properties file
Set
AgentListenOnAllNICs=TRUE
to
AgentListenOnAllNICs=FALSE

Thursday, September 10, 2009

Remove files that is older thatn 7 days in Unix

find . -name "fullfiles*" -type f -mtime +7 -exec rm -f {} \;

where fullfiles is the name of the files (prefix) that you wish to remove

Wednesday, September 9, 2009

Oracle Grid Control 10g

I have setup the Oracle Grid Control 10.2.0.5 "successfully".

Thought everything was working until the notification email alerts is not responding to the metrics. Test email was able to sent out and received. Metrics will triggered and appearing in the "Alerts" of the grid control web page. However no email.

Finding resource in web found in metalink.
356774.1

SOLUTION
1. Log on to sqlplus as the SYSMAN user on the repository database and run the following commands:

SQL> exec emd_maintenance.remove_em_dbms_jobs -- to tidy up any broken jobs
SQL> exec emd_maintenance.submit_em_dbms_jobs

Presto!

Prior this I did downloaded the EMDiagkit (356774.1)
./repvfy verify notifications -level 9

OR

./repvfy verify -level 9

for all modules verification.


Cool!

Monday, September 7, 2009

Henderson waves

From hort park, we took a bridge walk upwards...Still another 2km (approx 30mins) for us to get to Henderson waves.

We parked our car at Kent Ridge Park B, started our journey there. Walked past a bridge downslope to Hort Park.

More info at http://www.visitsingapore.com/publish/stbportal/en/home/what_to_see/parks___nature_reserves/Southern_Ridges.html

There walked another 20mins to arrive the Alexandra Arch. (see pic).

From here upward moves, another 30mins or so before arriving Henderson waves...

X Windows

To enable X windows in my Windows XP connecting to a unix server, I did the following:-

1. Download Cygwin. It's a small setup.exe file. From there you configure the component that you required. In this case, the X windows and ssh.

2. After the installation has completed, click on Cygwin.exe

3. type > startx

4. In the terminal windows, ksh> xhost +

5. In your windows XP services, stop the firewall, else windows won't pop up.
Windows Firewall/Internet Connection Sharing (ICS)

6. export DISPLAY=IPaddress:0.0

IPaddress: is your local ip

eg: export DISPLAY=10.1.1.1:0.0

7. ssh to the remote box and launch the GUI.

Presto!

Saturday, September 5, 2009

Toyota Borneo motors leng kee service

Booked for my vios 10K km service in leng kee today for the 11am slot.  Arrived there at 1045. Was told by the service lady that mine is not an express service as I did not  choose for the express service online. 

I can't recall whether if I have chose express or not but isn't the normal usual 10000km service shd be an express one?  Then to further delay, she said between 12 till 1pm no service as it is lunch hour.  Which means the service only starts aft 1pm.  And I might only able to collect my car then. 

Had I known this I would have booked an earlier slot or won't take up the 11 slot.    

Sent from my iPhone


Friday, September 4, 2009

Oracle 10g 10.2.0.5 Grid Control

To install Oracle 10g Grid Control 10.2.0.5, the latest at this point of writing, one has to install the base version 10.2.0.1 and upgrade to 10.2.0.5 later.

I have tried using GUI tool ./runInstaller

The sequence is to install base, this will create a OMS, repository, and agent

Next, upgrade to 10.2.0.5 for the base (this take abt 2 hours). Then upgrade agent.

A tip is to turn off archive logs while performing installation.

Friday, August 28, 2009

Penang trip

I am going to Penang this morning midnight. It's a day trip. Let's see
how things turn out.

God bless.

Sent from my iPhone

Sunday, August 23, 2009

Gu wen cha

Have lunch in Gu Wen Cha. Stop by johor in taman Gaya. Chicken rice.
Large portion. Taste can be better. Smoother.

Tuesday, August 18, 2009

Trip to Pengerang

Planning to make a trip to Pengerang this week. It's a little town
situated an hour drive away from Desaru, Malaysia.
Age is catching up with me. Commitment as well.

Sent from my iPhone

Thursday, August 6, 2009

IPhone unix path

For those who has jailbreak it and with firmware 3.0, I am listing down someuseful path that I come across. Please bear with me I am still learning. Only 4 days into my discoveries....

/private/var/mobile/Library/Downloads - If you want to install ipa files. Copy them into this folder.

/System/Library/Audio/UISounds - SMS. This is the folder where all the sms ringtones are placed. Rename extension to .caf. Apparently you need to rename the default file name eg: Rename new sms.caf to sms-received1.caf(backup original copies first)

/Library/Ringtones - This is the folder you place your .m4r (ringtones)

/private/var/mobile/Library - Probably my main menu..where can browse in to view other paths.

You may download WINSCP for scp copying...

My First iPhone

I got my first iphone last week. It was a old phone 2G though but I am already very excited with the features and the usability and the mass amount of things can be done with it.

A journey of thousands miles begin with a single step.

Friday, July 31, 2009

Hospital sultan aminah

What a nice outlook appearance. Reminds me of touring uk or europe university. The hyatt hotel nearby apparently has been taken over and renamed as thistle. Last sunday went to dangga mall, not much crowd. But i was enjoying e nice penang food in the basement restaurant.
Will be making a trip this evening to visit my father in law whom is hospitalised. Some relatives will be following my car. Thank god, i got my first car early this year. Toyota boleh!
Hope to get my car wash and remember to fill up petrol prior coming back!
Past few days hot news in singapore, ppl are queing to buy properties that are ranging $600psf at least to $1000psf. Kind of out reach for me. Can an average executive afford this? Probably set a target to get a small old condo instead.

Mayhem@K810i

Wednesday, July 29, 2009

My 100th blog posts

This is my 100th posts. Hurray, something to celebrate.


To set IE as default browser

click Start, Run and type control appwiz.cpl,,3

Click custom--> then you specify the browser which you want to set as default

Tuesday, July 28, 2009

Malaysia hospital

My father in law was transfered to malaysia hospital last sunday. It was just 5 mins drive from e checkpoint. But e heavy traffic really sucks and make ppl fed up. Drove in yesterday night after work ard 8pm, traffic was mild. Kind of tired. Time to take some break.

Mayhem@K810i

Wednesday, July 22, 2009

Mei Mei eye checkup

Drove to office today. My wife brought my daughter to hospital for an eye inspection yesterday. She has Anisometropia. Its a condition whereby she has two different reflactor power in both eyes. And one of her eye has Amblyopia or commonly known as lazy eye. As we didnt manage to discover early,our only hope is to help her by all our means. Pray to lord. May god heal her and bless her.

Mayhem@K810i

My father-in-law is hospitalised

He was admitted to hospital yesterday. After awaiting 4 hours in a local hospital, he finally got a admitted to a room. Of course after my brother in law argue with e hospital. A poor old man was lying on a wheel chair feeling cold, past 1030pm, unable to have a place to sleep.
Last week, he was still okay when i fetched him out from his hometown. There after three visits to e GP, finally e blood test has a tell tale sign that he needs to be admitted to hospital.
Last updated was he is under going a CT scan. God blessed him. My wife has been very sad and helpless on this. We all still have hope on god.


Mayhem@K810i

Monday, July 20, 2009

Feeling blessed and contended

If we have faith, God will open a door for us.

Not perhaps one that we ourselves would ever have thought of, but one that will ultimately prove good for us.

A. J Cronin

Change default ost path in Outlook

Many of you knows how to change the path for pst file which is pretty straightforward.

To change the ost file in Outlook need a little tweak in the registry.

Open registry,
HKEY_ CURRENT_USER\Software\ Microsoft\Office\11.0\Outlook key, create a new expandable string value named ForcePSTPath, and specify the path that you wish to store .ost

You need to disable exchange cache and then change the path to the new path and enabled back the exchange cache.

I am refering to Outlook 2000.

Friday, July 10, 2009

H1N1

I can still recall the night that i spent 7 hours in the hospital awaiting the test results of h1N1.
We were just back from our holidays trip in bangkok. Because it is listed as a h1N1 known exported cases country, and i got some symtom of cough, i went to e hospital for a diagnosis check of this virus. Little i know that this takes 7 good sleep hours of mine. I was there from 11pm till 6am before i left the premises. I have not brought nothing there, and e whole waiting process was boring and sleepy of course it was cold too. Thank thank my wife got me a jacket. Yet i still feel cold and sleepy. It seems that e purpose was to quarantine there for several hours.
It was just wrong timing. Because of a cheap airfare promo, we thought of bringing e kids there to experience a premium airline service. No doubt e food, e in flight entertainment was excellent. Having said that, e trouble of getting into hospital for 7 hours, sending worries to colleagues and bosses,my whole family was kind of stay home, with my cousins as well as we were in contacts. Just too much of hassle.
All i have to say is to thank god for making sure you tide through this mini crisis.

Mayhem@K810i

Mobile blogging

I should have discovered this or rather shd say do this much earlier when my brother told me e other day of mobile blogging.
I am kind of excited of this and hope to update my Blog more often now. I am currently busy reading some trading books. Hope to learn more in trading .
Its friday. Mrt is crowed as usual. On my way home. Hungry at e moment.

Mayhem@K810i

First mobile blog

Got my laser mouse for 45. I love this mouse

Thursday, July 9, 2009

My Albums

Long Beach Seafood Kallang

Last night we have a very enjoyable company team dinner with our guest from London and States.

Long Beach Seafood

Shark's Fin


Very sumptuous meal! Best shark's fin that I ever had.

RPO vs RTO

Recovery Point Objective
The Recovery Point Objective (RPO) is the point in time to which you must recover data as defined by your organization. This is generally a definition of what an organization determines is an "acceptable loss" in a disaster situation.

The Recovery Time Objective (RTO) is the duration of time and a service level within which a business process must be restored after a disaster (or disruption) in order to avoid unacceptable consequences associated with a break in business continuity.

Refer:
http://en.wikipedia.org/wiki/Recovery_point_objective

Monday, July 6, 2009

Dental visit

Visited dentist today in Amara.

Got a sensitive tooth. It was discovered as a gum problem.

Tuesday, May 26, 2009

Fire extinguisher

Yesterday has a chance to visit the civil defense centre. And manage to learn several safety moments and life savings skills such as CPR, and manage to experience to use fire extinguisher.

Thursday, May 21, 2009

Bought a Sony Ericsson W705

I got this phone for my wife W705. A very nice featured phone.

She has already changed twice. I am still on my old K810i. When is my iphone coming?

Wednesday, May 20, 2009

God healing

My son was very ill week before last ie. during the 1st week of May. We visited GP twice and got his blood sample test check. GP said he should recover within a next few days and could be due to virus. He already finished one bottle of antibiotics and GP prescribed another bottle (same antibiotics).

However the next week days his condition worsen, he lung is full of phlegm. He vomited all the phlegm while coughing. We wanted to send him to specialist for further diagnosis but was told appointment full and the next day was labour day (1 May). Kinda of worried and I started to pray to Lord, God for his healing. "In the name of Jesus, please heal my son so he can recover"

My son has been weak since young. He had been admitted to hospital on similar occasions, already several times. Once he ever infected with Pneumonia as well. Thank god that he make through and our family are thankful. I prayed that he will grow up healthy and become stronger.

I would like to share with you specifically with this incidents that god really listen to us and answer to our prayer. Amen. Praise lord. And I really pray hard for this.

May God, in the name of Jesus guide us through, our family in our future ahead.

Thursday, May 7, 2009

SQL IO stats

Run the following to trace on SQL IO statistics

select @@servername as servername,
avg(cast(io_stall_read_ms/(1.0+num_of_reads) as numeric(10,1))) as avg_read_stall_ms,
avg(cast(io_stall_write_ms/(1.0+num_of_writes) as numeric(10,1)))as avg_write_stall_ms,
avg(cast((io_stall_read_ms+io_stall_write_ms)/(1.0+num_of_reads + num_of_writes) as numeric(10,1)))as avg_io_stall_ms
from sys.dm_io_virtual_file_stats(null,null)

Friday, April 24, 2009

Birthday Treats

Today two colleagues and one ex-colleague treated me a birthday lunch though my birthday was yesterday...A nice ones especially in working world where seldom ppl trust each other and can make friends...

Thursday, April 23, 2009

Google Chrome

By default google chrome uses IE setting for proxy.

To workaround or disable/enable the proxy, in your Google Chrome shortcut, specify the parameter "--proxy-server="

"C:\Documents and Settings\chewch\Local Settings\Application Data\Google\Chrome\Application\chrome.exe" --proxy-server=

Happy Birthday

Happy birthday to myself. Aged 33. Hope I can become mature, gain faith to god, with his words and wisdom I will grow.

Monday, April 20, 2009

First step to be a Christian...

Today, we have invited Pastor Amos to give some sermon for our monthly fellowship meeting.

Pastor Amos has shared his view on tithing and reminded that we should 'give' more not necessary in the form of tith as in thew new testament. Giving can be many forms many contribution. May it be to an orphan or some poor people. It's always between you and god.

I am glad to know him and hope this marks the single step to know God.

Bless god, Amen

Tuesday, April 14, 2009

A bible for my wife

A good ex-colleague and good friend of mine, Alvin has bought a Bible as a gift to my wife. It's a nice gesture of him. God bless.

Wednesday, April 8, 2009

Dow Jones Corrections

DJIA 7789.56
-2.34% -186.29
NASDAQ 1561.61
-2.81% -45.10
NYSE 5120.67
-2.45% -128.81
S&P 500 815.55
-2.39% -19.93

Friday, March 6, 2009

Dow at its 12 year lowest

Check out from marketwatch.com

Wall Street's dollar menu
GE 3/5/08: $33.55 Today: $6.66
BAC 3/5/08: $37.55 Today: $3.17
GM 3/5/08: $22.97 Today: $1.86
C 3/5/08: $22.15 Today: $1.02
AIG 3/5/08: $44.61 Today: $0.35

Dow 6,594.44 -281.40 -4.09%
Nasdaq 1,299.59 -54.15 -4.00%
S&P 500 682.55 -30.32 -4.25%

What can one do looking at all these numbers daily? It's in a down trend.

Wednesday, March 4, 2009

Stocks at 12 years low

US markets is at their 12 year low (http://money.cnn.com/2009/03/03/markets/markets_newyork/index.htm)

Dow Jones 6,726.02
Nasdaq 1,321.01
S&P 500 696.33

There might be possibly more downward pressure. But looking at 3 to 5 years horizon, it might be good entry point.

Wednesday, February 25, 2009

Daily Quotes- Mahatma Gandhi.

"Whatever you do will be insignificant, but it is very important that you do it".-Mahatma Gandhi.

Tuesday, February 24, 2009

Monday, February 23, 2009

My new car

Sunday was a remarkable day for my new car. After about 2 weeks since I got it, there were two major news about my car. First, a relative called asking if we have bought our car registration plate for 4D number. It come out to be a consolidation prize. I bought a an exact four digit number but it come out to be in different permutation.

Then, I parked my car in the Giant supermart and it appears someone scratched one of the door. Karma. console oneself

Saturday, February 14, 2009

Books I am reading...

7 Winning Strategies of Trading Forex - Grace Cheng

Strategy 1 - Market Sentiment
2- Trend Riding
3- Breakout Fading
4- Breakout Trading
5- Decreased Volatility Breakout
6- Carry Trade
7- News Straddling

Vios Arrived!

I am collecting my first car, Toyota Vios today. What a remarkable day to remember on 14th Feb 2009.

Wednesday, February 4, 2009

Rapid Search Engine

http://www.kucau.net/wp/2007/10/18/ultimate-list-of-37-search-engines-to-hunt-files-on-rapidshare-and-other-filesharing-sites/

Tuesday, February 3, 2009

Transfering logins from mssql 2005 to mssql 2005

Using sp_help_revlogin

master...sysxlogins not available in mssql 2005.

New script below-->

USE master
GO

IF OBJECT_ID ('sp_hexadecimal') IS NOT NULL

DROP PROCEDURE sp_hexadecimal

GO

CREATE PROCEDURE sp_hexadecimal

@binvalue varbinary(256),

@hexvalue varchar (514) OUTPUT

AS

DECLARE @charvalue varchar (514)

DECLARE @i int

DECLARE @length int

DECLARE @hexstring char(16)

SELECT @charvalue = '0x'

SELECT @i = 1

SELECT @length = DATALENGTH (@binvalue)

SELECT @hexstring = '0123456789ABCDEF'

WHILE (@i <= @length)

BEGIN

DECLARE @tempint int

DECLARE @firstint int

DECLARE @secondint int

SELECT @tempint = CONVERT(int, SUBSTRING(@binvalue,@i,1))

SELECT @firstint = FLOOR(@tempint/16)

SELECT @secondint = @tempint - (@firstint*16)

SELECT @charvalue = @charvalue +

SUBSTRING(@hexstring, @firstint+1, 1) +

SUBSTRING(@hexstring, @secondint+1, 1)

SELECT @i = @i + 1

END

SELECT @hexvalue = @charvalue

GO



IF OBJECT_ID ('sp_help_revlogin') IS NOT NULL

DROP PROCEDURE sp_help_revlogin

GO

CREATE PROCEDURE sp_help_revlogin @login_name sysname = NULL AS

DECLARE @name sysname

DECLARE @type varchar (1)

DECLARE @hasaccess int

DECLARE @denylogin int

DECLARE @is_disabled int

DECLARE @PWD_varbinary varbinary (256)

DECLARE @PWD_string varchar (514)

DECLARE @SID_varbinary varbinary (85)

DECLARE @SID_string varchar (514)

DECLARE @tmpstr varchar (1024)

DECLARE @is_policy_checked varchar (3)

DECLARE @is_expiration_checked varchar (3)



IF (@login_name IS NULL)

DECLARE login_curs CURSOR FOR

SELECT p.sid, p.name, p.type, p.is_disabled, l.hasaccess, l.denylogin

FROM sys.server_principals p LEFT JOIN sys.syslogins l ON ( l.name = p.name )

WHERE p.type IN ( 'S', 'G', 'U' ) AND p.name <> 'sa'

ELSE

DECLARE login_curs CURSOR FOR

SELECT p.sid, p.name, p.type, p.is_disabled, l.hasaccess, l.denylogin

FROM sys.server_principals p LEFT JOIN sys.syslogins l ON ( l.name = p.name )

WHERE p.type IN ( 'S', 'G', 'U' ) AND p.name = @login_name

OPEN login_curs

FETCH NEXT FROM login_curs INTO @SID_varbinary, @name, @type, @is_disabled, @hasaccess, @denylogin

IF (@@fetch_status = -1)

BEGIN

PRINT 'No login(s) found.'

CLOSE login_curs

DEALLOCATE login_curs

RETURN -1

END

SET @tmpstr = '/* sp_help_revlogin script '

PRINT @tmpstr

SET @tmpstr = '** Generated ' + CONVERT (varchar, GETDATE()) + ' on ' + @@SERVERNAME + ' */'

PRINT @tmpstr

PRINT ''

WHILE (@@fetch_status <> -1)

BEGIN

IF (@@fetch_status <> -2)

BEGIN

PRINT ''

SET @tmpstr = '-- Login: ' + @name

PRINT @tmpstr



IF (@type IN ( 'G', 'U'))

BEGIN -- NT authenticated account/group

SET @tmpstr = 'CREATE LOGIN ' + QUOTENAME( @name ) + ' FROM WINDOWS'

END

ELSE BEGIN -- SQL Server authentication

-- obtain password and sid

SET @PWD_varbinary = CAST( LOGINPROPERTY( @name, 'PasswordHash' ) AS varbinary (256) )

EXEC sp_hexadecimal @PWD_varbinary, @PWD_string OUT

EXEC sp_hexadecimal @SID_varbinary, @SID_string OUT



-- obtain password policy state

SELECT @is_policy_checked =

CASE is_policy_checked WHEN 1 THEN 'ON' WHEN 0 THEN 'OFF' ELSE NULL END

FROM sys.sql_logins WHERE name = @name

SELECT @is_expiration_checked =

CASE is_expiration_checked WHEN 1 THEN 'ON' WHEN 0 THEN 'OFF' ELSE NULL END

FROM sys.sql_logins WHERE name = @name



SET @tmpstr = 'CREATE LOGIN ' + QUOTENAME( @name )

+ ' WITH PASSWORD = ' + @PWD_string

+ ' HASHED, SID = ' + @SID_string



IF ( @is_policy_checked IS NOT NULL )

BEGIN

SET @tmpstr = @tmpstr + ', CHECK_POLICY = ' + @is_policy_checked

END

IF ( @is_expiration_checked IS NOT NULL )

BEGIN

SET @tmpstr = @tmpstr + ', CHECK_EXPIRATION = ' + @is_expiration_checked

END

END



IF (@denylogin = 1)

BEGIN -- login is denied access

SET @tmpstr = @tmpstr + '; DENY CONNECT SQL TO ' + QUOTENAME( @name )

END

ELSE IF (@hasaccess = 0)

BEGIN -- login has exists but does not have access

SET @tmpstr = @tmpstr + '; REVOKE CONNECT SQL TO ' + QUOTENAME( @name )

END



IF (@is_disabled = 1)

BEGIN -- login is disabled

SET @tmpstr = @tmpstr + '; ALTER LOGIN ' + QUOTENAME( @name ) + ' DISABLE'

END



PRINT @tmpstr

END

FETCH NEXT FROM login_curs INTO @SID_varbinary, @name, @type, @is_disabled, @hasaccess, @denylogin

END

CLOSE login_curs

DEALLOCATE login_curs



RETURN 0

GO

-----
http://blogs.msdn.com/lcris/archive/2006/04/03/567680.aspx

Object Search in SQL 2005

Example here to select for object "dba_spaceused"

Object Search is not available in SQL 2005. Hopefully 2008 has one.

SELECT name,
CASE xtype
WHEN 'C' THEN 'CHECK constraint'
WHEN 'D' THEN 'Default or DEFAULT constraint'
WHEN 'F' THEN 'FOREIGN KEY constraint'
WHEN 'L' THEN 'Log'
WHEN 'FN' THEN 'Scalar function'
WHEN 'IF' THEN 'Inlined table-function'
WHEN 'P' THEN 'Stored procedure'
WHEN 'PK' THEN 'PRIMARY KEY constraint (type is K)'
WHEN 'RF' THEN 'Replication filter stored procedure'
WHEN 'S' THEN 'System table'
WHEN 'TF' THEN 'Table function'
WHEN 'TR' THEN 'Trigger'
WHEN 'U' THEN 'User table'
WHEN 'UQ' THEN 'UNIQUE constraint (type is K)'
WHEN 'V' THEN 'View'
WHEN 'X' THEN 'Extended stored procedure'
END as type
FROM sysobjects WHERE name LIKE '%dba_SpaceUsed%'
UNION ALL
SELECT name, 'column' FROM syscolumns WHERE name LIKE '%dba_SpaceUsed%'

(Reference: http://www.symantec.com/community/download/2568/object-seacrh-sql-2005)

Sunday, January 18, 2009

Remove the firefox browsing history

1. In the Location bar, enter about:config
2. Search for the preference browser.urlbar.maxRichResults.
3. Double-click the browser.urlbar.maxRichResults preference and enter a value of -1.
4. Close Firefox.
5. Start Firefox again.

Now when you type in the Location bar, no list of results will be shown.

Source: http://www.raymond.cc/blog/archives/2006/11/14/how-to-delete-individual-urls-from-firefox-address-bar-history/

Thursday, January 15, 2009

SQLPLUS prompt

I got my PC refreshed the other day. Lost most of my settings and didn't have a good backup though have been backup up files here and there, throwing here..form disk A to disk B...at the end when disaster strike...can't really manage to handle.

Anyway, visit http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2006-06-22.9332221251

It has a good write up on SQLPLus prompt customization.

My sample and favorite as below

COLUMN file_name FORMAT a44
COLUMN tablespace_name FORMAT a20
COLUMN owner FORMAT a15
COLUMN segment_name FORMAT a20
set lines 132
set pages 100
set termout off
col dbname new_value prompt_dbname
col uname new_value prompt_username

select instance_name dbname from v$instance;
select user uname from dual;
set sqlprompt "&&prompt_username'@'&&prompt_dbname> "
set termout on
set time off

Thursday, January 8, 2009