Tuesday, June 30, 2009

C# - version of Java currentTimeMillis

Java System.currentTimeMillis() is a very good utility to measure time in Java. However, in C#, it uses Ticks. There is 2 simple way to have a similar version of it

1. Use System.Environment.TickCount, it will return the number of millis elapsed since system started.

2. Use DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond, this will convert current time in Ticks to millisecond.

Monday, June 29, 2009

IMAPIv2 27354130-7F64-5B0F-8F00-5D77AFBE261E Error Fix

If you use WinXP for IMAPIv2, you may encounter the following error

Retrieving the COM class factory for component with CLSID {2735412E-7F64-5B0F-8F00-5D77AFBE261E} failed due to the following error: 80040154.

This error is due to IMAPIv2 is not found on the system. http://support.microsoft.com/kb/932716

To fix this, you have to install the following Microsoft Patch.

Vista is preinstalled with IMAPIv2

Thursday, June 25, 2009

C++ Getting Device IO

Today, I am exploring on how to communicate with window system device with VS C++
In concept, it is rather simple

1. Get the device name

2. Open the device with CreateFile().

3. Perform IO action such as DeviceIoControl()
4. Close the device after use with CloseHandle()

You need to include windows.h, winioctl.h, stdio.h

Below is the sample code from MSDN on reading first primary drive geometry information.

Tuesday, June 9, 2009

Site Value

Before today, I do not know that my blog worth a bit of $$$... USD$146. Not a lot, but, I am amused. Not sure how they could have calculated it. Mostly, must be base on traffic.

Try it out



Web 2.0 Security

Just read about this article about Web 2.0 security and find it interesting.

Web 2.0 Security: Four Things to Know about the Social Web

Below are the 4 main points:

1) Most Web Posts on Blogs and Forums are Actually Unwanted Content (Spam and Malware)

Especially, this is really true. "a site is reputable, doesn't mean its safe. Blogs and message boards belonging to Sony Pictures, Digg, Google, YouTube and Washington State University have all hosted malicious comment spam recently, and My.BarackObama.com was infected with malicious comment spam." Also, twitter will also be the upcoming social website that may help adversary to spread malicious contents. Read this http://www.pcmag.com/article2/0,2817,2348052,00.asp?kc=PCRSS03129TX1K0000625

2) The Top Search Results from Google are Safe, Right?

Search Engine poison is really a concern. Many people thinks that result from reputable search engine such as Google and Yahoo are free from malicious contents. Although these search engine does filter suspicious website, it is still the user responsibility to ensure what site they are visiting to. See this http://www.cio.com/article/208152/Major_Web_Sites_Hit_with_Growing_Web_Attack

3) You're Really NOT Infected; Be Careful Before You Download That

For this, some simple advices - Download only you are sure what you are downloading. Don't panic when you are shown with "warning" message. Scan your system with antivirus program if you suspect that you are infected.

4) Sadly, You Really Can't Trust Your Friends or Your Social Network

The main catch is do not automatically trust suspicious messages from friends. You will never be sure if your friends infected with malicious content.

Do not accept suspicious attachment even it is from your real friends. Infected system can send malicous content to all contacts without the user knowledge.

iPhone for USD$99

This sound like a good deal for the new iPhone. It promises double the speed of its previous model.

The iPhone will come in three sizes and prices. The new phone will have a 16-gigabyte model for USD$199 and a 32-gigibyte version for USD$299. Apple will continue to sell a second-generation iPhone 3G with 8 gigabytes of memory for USD$99.

The new iPhone OS 3.0, which was first unveiled in March, will have cut, copy and paste capabilities for all applications. The operating system will also feature an undo gesture, which will undo the last action by shaking the phone.

Fully integrated search, multimedia text messages and auto-fill for passwords have also been added to the iPhone, though the multimedia text messaging will not be available on AT&T until later in the summer.

The new OS will allow users to rent and purchase movies right from their phones using iTunes, and it will have parental control functionality.

LDAP - Deleting an LDAP entry

To delete an ldif entry, one way is to put an changetype attribute and a value 'delete' in the ldif file For example dn: cn=so...