Microphone of Travelmate 8371 in Ubuntu... Pain...
I was trying to setup my laptop with Ubuntu 10.10. Well, so far, most of applications and devices are working as expected. However, the microphone with Gmail Chat is pretty much a pain. First of all, I found this link and installed the pavucontrol and changed the settings to Microphone 2. Well, it works with Skype but not with Gmail Chat. The Gmail Chat driver auto adjusts volume so it all went back to the default settings again... WTF... Anyway... keep fighting on it at the moment... Has anyone had this problem and resolved it? [...]
by Elvis Hsu No comments Read More
Sync device Date/Time with http web server
Well, this is long way back when I was a rookie to develop Windows Mobile applications with C#. I believe there are some people want to sync the device date/time with their web server as the device date/time somehow doesn't tick correctly after certain days. So first of all, you should have a look the SetSystemTime function as you need a SYSTEMTIME structure to pass the value to SetSystemTime function. We start to P/Invoke the SetSystemTime method. [DllImport("coredll.dll", SetLastError = true)] private static extern bool SetSystemTime(ref SYSTEMTIME time); Create the SYSTEMTIME [...]
by Elvis Hsu No comments Read More
Check the application has installed on Windows Mobile Device
When I deploy the application to customers, I like to wrap all cabs in one as it would be much easier. For example, .NETCF and SQLCE. If the device is new, the .NETCF or SQLCE needs to be installed prior running my application. Thanks for CeSetupDriver and here. They helped me a lot to deploy the application with the way I want. However, I don't want to prompt user every time that the .NETCF or SQLCE has already installed. So I come up with a checking method to validate that the application has already installed and skip to next cab installation. All you need to do is passing [...]
by Elvis Hsu No comments Read More
Darken or lighten the colour with C#
It was a while ago to play the colours in .NETCF. The case was drawing darker or lighter colour when user clicks my custom design buttons. Well, I believe it would be much easier to change the colour by its original colour. So I came up with two methods to extend the existing System.Drawing.Color object. These two methods can be found similar over the Internet. So, I have to thank all the developers in the Internet... public static Color GetColorDarker(this Color color, double factor) { // The factor value value cannot be greater than 1 or smaller than 0. // Otherwise [...]
by Elvis Hsu No comments Read More
JDK not found on Installing Android SDK
Today, I was trying to install the Android SDK to my laptop and got "JDK not found on Installing Android SDK"... Well, I was a bit confused as I have installed the latest JDK. So, I decided to google it. Most of results are for 64bit OS but I use 32bit Windows 7. Well, then I pressed "Back" button and then pressed "Next" again in the initialization page. Ha... It allows me to install it then... I believe the installer caches the previous data if you haven't installed the JDK. Well, good to know that is easy to fix this installation issue... [...]
by Elvis Hsu No comments Read More
Validate input URL string
I just tried to write a function to validate URL address. Well, as usual, I've done some researches on Google and not many efficient and satisfy solutions. However, I've got a solution which is using Regex in C# to validate a URL and it seems a acceptable method to test the URL input. public static bool IsValidUrl(this string url) { string strRegex = "^(https?://)" + "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" // user@ + @"(([0-9]{1,3}\.){3}[0-9]{1,3}" // IP- 10.0.0.1 + "|" // allows either IP or domain + @"([0-9a-z_!~*'()-]+\.)*" [...]
by Elvis Hsu No comments Read More
Wrap long string in C#
Today I was think how to optimize the drawing string method on my library... so far I worked out this... However I still couldn't workout how to really wrap long string within the sentence... Any help? public static string[] WrapString(this Graphics gx, Font font, string text, float maxWidth, bool wrap) { // find if actual max text width is smaller than max width or maxWidth is smaller than zero or wrap is set to false if (gx.MeasureString(text, font).Width < maxWidth || maxWidth <= 0 || !wrap) { return text.Split(new char[] { '\n' }); } int [...]
by Elvis Hsu No comments Read More

CryptoDonatex