Sunday, April 13, 2008

RIGHT MOUSE CLICK ON APPLE MOUSE ?



Few days ago, the keyboard and mouse i usually used my at office computer have spoilt cause by the frequently elecrticity break out at here. I was force to use alernate keyboard and mouse where there are no more spare keyboard and mouse left at the office. SWEAT -.-'''

At the end, i found the write off apple computer's keyboard and mouse. Well, honestly, i really happy to get these devices, it looks cool. hehe... ^.^ The keyboard is very nice, where it is nearly silent when i'm typing on the keyboard. This make my boss cant catch me on doing other thing else... hehe... nice le ? haha...

But the problem arise, when i use the mouse. I have just found out, that, apple mouse has only 1 click button!! Where the hell is my right click button?? -.-'''

I have been shaking head for fews days, trying to get myself to get use to 1 mouse buton. But, i failed to getting familiar with it. So, i have came out a solution to solve the right click issues on my apple mouse. By coding a program to call WinAPI to convert the left click to right click while pressing left shift button. Bellow are my codings on calling WinAPI and swapping the mouse button and get keyboard entery status.

Coding

Declare Function SwapMouseButton Lib "user32.dll" _
Alias "SwapMouseButton" (ByVal bSwap As Integer) As Integer
Private Declare Function GetKeyState Lib "user32.dll" _
(ByVal nVirtKey As Long) As Integer

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

If GetKeyState(160) > -10 Then

SwapMouseButton(0)

Else

SwapMouseButton(1)

End If
End Sub

Friday, April 11, 2008

Restoring Microsoft SQL database file


There is a time i faced Microsoft SQL Server database log file corruption problem on the POS machine i worked on. I googled many sites for different sources on restoring the corrupted log file for few days. At the end, all the sources i found is not applicable to the problem i faced. Sweat -.-'''

Well, some how, i was able to find a site for restoring the log fle. This solution help me restore the MSSQL server log file and the database is working fine after restoring the log file.

Bellow are the steps on restoring the log file :-

RESTORING MS SQL SERVER LOG FILE
1. Create a new database with the same name and same MDF and LDF files

2. Stop sql server and rename the existing MDF to a new one and copy the original MDF to this location and delete the LDF files.

3. Start SQL Server

4. Now your database will be marked suspect

5. Update the sysdatabases to update to Emergency mode. This will not use LOG files in start up

Sp_configure "allow updates", 1
go
Reconfigure with override
GO
Update sysdatabases set status = 32768 where name = "BadDbName"
go
Sp_configure "allow updates", 0
go
Reconfigure with override
GO
6. Restart sql server. now the database will be in emergency mode

7. Now execute the undocumented DBCC to create a log file
DBCC REBUILD_LOG(dbname,'c:\dbname.ldf') -- Undocumented step to create a new log file. (replace the dbname and log file name based on ur requirement)

8. Execute sp_resetstatus

9. Restart SQL server and see the database is online.
Hope these steps helps you to restoring the corrupted log file.

Tuesday, April 1, 2008

Hi Hi!!

Hi Hi!! Everyone... it's been a long time din log in and update my blog dy... hoho... more than 3 months dy lo... haha... sorry for dissapear for quite awhile ^.^

Last 2 month i have start working at a company as a analyst programmer dy lo... hoho...

when 1st day working, they assign me a project on rounding mechanism for their POS system. This is a standard set by government, where every transaction end if 1,2,8 and 9 cent, will be round down to nearst 10 cent, while 3,4,6 and 7 cent will be round to 5 cents.

Well, this is not the big challenge, the biggest challenge for this project is to create a security shrinkage to the POS system. Too much security loop holes found out hoho... ^.^ easy to illegal income oh... haha... Anyway my project is done dy and is currently been used by all branch company... i think most of the cashier who always try to do illegal action on the system really don like me, cuz i'm the one who suggest and implement the security shrinkage... muhaha... don care la... as long as i did my job... haha...