If you have problem to update Windows, e.g. it gives you 80072EFE error, it may be worthwhile to clear the Update Installers in your system and restart again. The instructions can be found at:
http://support.microsoft.com/kb/822798
Especially method 10 which tell you how to empty the software distribution folder.
After you clear the "cached" installers, you may want to restart you system before re-try the update services.
Monday, March 29, 2010
Thursday, March 25, 2010
VirtualBox USB and Ubuntu
I finally manage to get the USB working inside VirtualBox. I followed the instructions from this site https://help.ubuntu.com/community/VirtualBox/USB, restarted my machine, and like magics, my USB works inside my guest system now!
Saturday, March 6, 2010
Ubuntu and NTFS
It seems that by default Ubuntu does not allow you to format drives with NTFS system. If you want to have more advanced options, you need to install the package ntfsprogs, i.e.
After the installation, you can format disks with NTFS system and check their "health"
sudo aptitude install ntfsprogs
After the installation, you can format disks with NTFS system and check their "health"
Monday, February 1, 2010
Additional Symbols for Dia
You can find additional Dia symbols at http://dia-installer.de/shapes.html
Sunday, January 31, 2010
PHP Helps
One of my PHP page was giving me hassles, and in order to make my life easy, I use a PHP formatter such as PHP Formatter to format my code for me, and insert comments at the end of each block to help me to see if there are any miss match braces. It works pretty well.
Other toolds I found which can help web coding easier are:
More can be found at http://www.smashingmagazine.com/2007/07/12/time-savers-code-beautifier-and-formatter/
Other toolds I found which can help web coding easier are:
More can be found at http://www.smashingmagazine.com/2007/07/12/time-savers-code-beautifier-and-formatter/
Sunday, January 17, 2010
Aiptek Tablet and Chinese handwriting recognition
There are many way to type Chinese, however, arguably, the most natural way is handwriting. Windows has handwriting recognition software bundled for a long time now ... and today, I finally find a way to get something similar setup on Ubunut 9.10
Below are the items you need to make it happen.
- a tablet.
- a Java runtime
- HanziInput
The tablet I am using is a cheap rebranded tablet that using Aiptek Tablet. By default, Ubuntu can't really make full use of it. To make it useful, you need to
1) install aiptek driver by
sudo aptitude install xserver-xorg-input-aiptek2) create a 10-linuxaiptek.fdi with the contents as below
<?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
<device>
<match key="info.product" contains="Aiptek">
<merge key="input.x11_driver" type="string">aiptek</merge>
<merge key="input.x11_options.SendCoreEvents" type="string">true</merge>
<merge key="input.x11_options.USB" type="string">On</merge>
<merge key="input.x11_options.Type" type="string">stylus</merge>
<merge key="input.x11_options.Mode" type="string">absolute</merge>
<merge key="input.x11_options.zMin" type="string">0</merge>
<merge key="input.x11_options.zMax" type="string">511</merge>
<merge key="input.x11_options.KeepShape" type="string">On</merge>
</match>
</device>
(ref: https://help.ubuntu.com/community/AiptekTablet)3) place the 10-linuxaiptek.fdi into the directory /usr/share/hal/fdi/policy/20thirdparty/
4) restart the system, and plug in the tablet.
Once you have things setup, you should be able to run the HanziInput.jar, and use the tablet for writing as below.
Labels:
Aiptek Tablet,
Chinese,
Handwriting Recognition,
Hanzi Input,
Input,
Writing
Add custom checks to Spry
I was working on a web application, and it used Spry for performing client side checking. One of the problem I had was to made the rule for checking one of the textfield input changing dynamically depending on a radio buttons selected by a user previously. Though spry is reasonable good for most part, it seems to be very static.
To get around this problem, here were the steps I used:
1) Change the submit button to plain button, and assign your own form validation function to the onclick event, i.e.
The above would make the form validation process to include your own steps. Now, let's explain how spry shows its errors. Below is a sniplet of html code used by Spry. Spry enable and disable showing off an error message by the adding and removing the class "<error type>Stated" from an element, i.e. <span id="sprytextfield1" class="textfieldRequiredState"> to enable the error message; <span id="sprytextfield1" class=""> to disable the error message
Remember earlier, I mentioned that Spry enables and disables the error message by adding and removing the class name from a specific span. We need to do the same in our custom validation function .
To get around this problem, here were the steps I used:
1) Change the submit button to plain button, and assign your own form validation function to the onclick event, i.e.
<input type="button" value="submit" onclick="checkform()">2) Within the checkform() function, do something like the below:
function customValidationFunction(){
// put your own validation functions here.
return true;
}
function checkform(){
var f = document.getElementById("yourformname");
if(
customValidationFunction() && Spry.Widget.Form.validate(f){
f.submit();
}
}
The above would make the form validation process to include your own steps. Now, let's explain how spry shows its errors. Below is a sniplet of html code used by Spry. Spry enable and disable showing off an error message by the adding and removing the class "<error type>
Therefore, if you want to include your own error message, you can do something similar. Let us be a bit lazy, and use one of the unused predefined state for our custom purpose. Let's say, we, want to ensure the first letter of the input is a capital letter. To do so, I decided to use the textfieldMaxCharsState for displaying our error message.
/*Text Field styling classes*/
.textfieldRequiredMsg,
.textfieldInvalidFormatMsg,
.textfieldMinValueMsg,
.textfieldMaxValueMsg,
.textfieldMinCharsMsg,
.textfieldMaxCharsMsg,
.textfieldValidMsg {
display: none;
}
.textfieldRequiredState .textfieldRequiredMsg,
.textfieldInvalidFormatState .textfieldInvalidFormatMsg,
.textfieldMinValueState .textfieldMinValueMsg,
.textfieldMaxValueState .textfieldMaxValueMsg,
.textfieldMinCharsState .textfieldMinCharsMsg,
.textfieldMaxCharsState .textfieldMaxCharsMsg {
display: inline;
color: #CC3333;
border: 1px solid #CC3333;
}
.textfieldValidState input, input.textfieldValidState {
background-color: #B8F5B1;
}
input.textfieldRequiredState, .textfieldRequiredState input,
input.textfieldInvalidFormatState, .textfieldInvalidFormatState input,
input.textfieldMinValueState, .textfieldMinValueState input,
input.textfieldMaxValueState, .textfieldMaxValueState input,
input.textfieldMinCharsState, .textfieldMinCharsState input,
input.textfieldMaxCharsState, .textfieldMaxCharsState input {
background-color: #FF9F9F;
}
.textfieldFocusState input, input.textfieldFocusState {
background-color: #FFFFCC;
}
.textfieldFlashText input, input.textfieldFlashText {
color: red !important;
}
.textfieldHintState input, input.textfieldHintState {
}
<span id="sprytextfield1">
<input type="text" name="mytextfield" id="mytextfield" />
<!--Display an error message>.
<span class="textfieldRequiredMsg">Please enter a description</span>
</span>
<span id="sprytextfield1">
<input type="text" name="mytextfield" id="mytextfield" />
<!--Display an error message>.
<span class="textfieldRequiredMsg">Please enter a description</span>
<span class="textfieldMaxCharsMsg">Your custom error message here.</span>
</span>
Remember earlier, I mentioned that Spry enables and disables the error message by adding and removing the class name from a specific span. We need to do the same in our custom validation function .
function customValidationFunction(){var elmt = document.getElementById("sprytextfield1");if(validation is true){// This would triggers the . textfieldMaxCharsMsg CSS directive alone, and// hence hides the error messageelmt.removeAttribute("class");return true;}else{// This would triggers the . textfieldMaxCharsState . textfieldMaxCharsMsg CSS directive, and // hence shows the error messageelmt.setAttribute("class", "textfieldMaxCharsState";return false;}}
I hope this tutorial make sense to you. If you found any errors both syntactic or grammatical error, please leave me a comment, so I can correct them.
Subscribe to:
Posts (Atom)
