Android bug #01
Calendar events entered via the phone won't show up on Google calendar.
Advice from Google doesn't help.
Update: Found the cause. By default, events created on phone are default to a local calendar "My Calendar" that can't be sync with any calendar in Google Calendar. And you can't change the calendar once the event is saved. A "workaround" is to select the Google Calendar for all events created on phone.
Advice from Google doesn't help.
Update: Found the cause. By default, events created on phone are default to a local calendar "My Calendar" that can't be sync with any calendar in Google Calendar. And you can't change the calendar once the event is saved. A "workaround" is to select the Google Calendar for all events created on phone.
Signing symbian S60 applications
Note: This is NOT the official way to sign an application. This is just a quick hack to help my friend getting an application running on his phone. Go to Symbian Signed for more details on signing an application properly.
- First, go to OPDA.net here to get your certificate and key. If you are not a registered member, you will be forwarded to a registration page. Just create a dummy account. (Yes, the site is in simplified Chinese!)
- Once you are at the page for requesting the certificate, enter the data correctly. The "串号" is your IMEI number of your phone. If you don't know what it is, enter *#06# on your phone. The "手机号码" is your phone number. Just enter anything that starts with 13, 15, or 18. The length of the phone number MUST BE 11 digits long. e.g. 15000000000
- Once you submitted your request, go to "我的证书" and wait for your certificate and key files. It could take several hours or even a day for the files to be ready. Once it said "已完成", click on "普通下载" to download both the .cer and .key files. Keep them in a safe place. You will need them to sign your applications.
- Next, get hold of a Windows application called EasySignPlus. Please don't ask me where to get it. You can easily search for it on the Internet.
- In EasySignPlus, select the certificate and key file you got from opda.net. The password for the key file is four zeros (i.e. 0000). Then drag your unsigned .sis file to the program window. By default, it will sign the application and generate the .sisx file under the same folder as your .sis file
- Install the .sisx file in your phone as usual and have fun~!
Arduino test: voltmeter
First experiment with Arduino. Trying to implement a voltmeter.
Each analog input of Arduino has 1024 steps. From 0 to 5 volt. This experiment used a simple voltage divider to measure roughly 0 to 12 volt (using 50k as R1 and 4k3 as R2).
By varying the values of R1 and R2, the precision and range of the measurement can be changed.
Here is the Arduino code:
Each analog input of Arduino has 1024 steps. From 0 to 5 volt. This experiment used a simple voltage divider to measure roughly 0 to 12 volt (using 50k as R1 and 4k3 as R2).
By varying the values of R1 and R2, the precision and range of the measurement can be changed.
Here is the Arduino code:
// variables for input pin and control LED
int analogInput = 1;
int LEDpin = 13;
int prev = LOW;
int refresh = 1000;
float vout = 0.0;
float vin = 0.0;
float R1 = 50000.0; // !! resistance of R1 !!
float R2 = 4300.0; // !! resistance of R2 !!
// variable to store the value
int value = 0;
void setup(){
// declaration of pin modes
pinMode(analogInput, INPUT);
pinMode(LEDpin, OUTPUT);
// begin sending over serial port
Serial.begin(9600);
}
void loop(){
// read the value on analog input
value = analogRead(analogInput);
//Serial.print("value=");
//Serial.println(value);
if (value >= 1023) {
Serial.println("MAX!!");
delay(refresh);
return;
}
else if (value <= 0) {
Serial.println("MIN!!");
delay(refresh);
return;
}
// blink the LED
if (prev == LOW) {
prev = HIGH;
} else {
prev = LOW;
}
digitalWrite(LEDpin, prev);
// print result over the serial port
vout = (value * 5.0) / 1024.0;
vin = vout / (R2/(R1+R2));
//Serial.print("vout=");
//Serial.println(vout);
Serial.print(vin);
Serial.println(" volt");
// sleep...
delay(refresh);
}
Windows Server 2008
Trying out Windows Server 2008. Tested it in VMWare 5.x (!) on Windows 2000 (OK, so I am still using Windows 2000 on my main machine). Hardware is AMD 4200+ with 2G RAM. And here are some tips on "converting" a Windows Server 2008 to a workstation.
BTW, if you are/were a high school or university student,go to DreamSpark to download Windows Server and Visual Studio etc for free.
BTW, if you are/were a high school or university student,go to DreamSpark to download Windows Server and Visual Studio etc for free.
Converting MKV files for PSP
Here is the command I used to convert MKV files for PSP:
mencoder 5centimeter.mkv -font c:\winnt\fonts\mingliu.ttc -subfont-text-scale 3 -vf pullup,softskip,dsize=480:272,scale=0:0,harddup,unsharp=l3x3:0.5 -sid 1 -slang chi -ofps 24000/1001 -oac faac -faacopts br=128:mpeg=4:object=2:raw -channels 2 -srate 48000 -ovc x264 -x264encopts bitrate=500:global_header:partitions=all:trellis=1:level_idc=30:threads=2 -of lavf -lavfopts format=psp -o 5cm_psp.mp4
mencoder 5centimeter.mkv -font c:\winnt\fonts\mingliu.ttc -subfont-text-scale 3 -vf pullup,softskip,dsize=480:272,scale=0:0,harddup,unsharp=l3x3:0.5 -sid 1 -slang chi -ofps 24000/1001 -oac faac -faacopts br=128:mpeg=4:object=2:raw -channels 2 -srate 48000 -ovc x264 -x264encopts bitrate=500:global_header:partitions=all:trellis=1:level_idc=30:threads=2 -of lavf -lavfopts format=psp -o 5cm_psp.mp4
- mencoder: the encoder that i used
- 5centimeter.mkv: the source file. In this particular case, the MKV container has 1 video steam, 1 audio stream and 2 subtitles (Japanese and Chinese)
- -font c:\winnt\fonts\mingliu.ttc: as I want to embed the Chinese subtitle into the output, I specified the MingLiu font here
- -subfont-text-scale 3: scale down the font for PSP's relatively small screen
- -vf pullup,softskip,dsize=480:272,scale=0:0,harddup,unsharp=l3x3:0.5: video filters. Pullup and softskip are not that useful here as the original source has frame rate of 23.976 already. Dsize and scale are to resize the video. Hardup ensure all frames are processed and finally apply an unsharpen mask.
- -sid 1 -slang chi: embed the Chinese subtitle
- -ofps 24000/1001: output fps is 23.976
- -oac faac -faacopts br=128:mpeg=4:object=2:raw -channels 2 -srate 48000: audio part. Uses the AAC codec, 128kbps, mpeg 4 compatible, 2 channels, and sampling rate is 48kHz.
- -ovc x264 -x264encopts bitrate=500:global_header:partitions=all:trellis=1:level_idc=30:threads=2 -of lavf -lavfopts format=psp video part. Uses X.264 codec. Trelllis, and level_idc are for fine tuning the quality. Threads=2 is used because my PC has 2 cores.
My first Facebook application...
... is a PHP program linked back to this blog... =.=...
Patching Qmail for remote smtp authentication
My ISP (Netvigator) goes to great lengths to block spam mails sending out from its users. All its users cannot connect to SMTP severs outside. This creates a problem for me as I host my own mail server at home.
Normally, when a mail server tries to deliver an email, it will connect to the destination mail server directly. e.g.
But as mentioned above, my ISP blocks all the access (port 25) to the outside world. So there is no way for my mail server to connect to other mail servers and deliver the emails.
Luckily, by the SMTP standard, I could force the mails route through my ISP's mail server:
So far so good. The remaining problem is: the Netvigator's SMTP server requires authentication which my mail server (Qmail) doesn't support! Thanks to open source, it is easy to patch the code though.
Normally, when a mail server tries to deliver an email, it will connect to the destination mail server directly. e.g.
Draft an email to abc@yahoo.com on my PC --->
my mail server --->
yahoo's mail server But as mentioned above, my ISP blocks all the access (port 25) to the outside world. So there is no way for my mail server to connect to other mail servers and deliver the emails.
Luckily, by the SMTP standard, I could force the mails route through my ISP's mail server:
Draft an email to abc@yahoo.com on my PC --->
my mail server --->
Netvigator's mail server --->
yahoo's mail server So far so good. The remaining problem is: the Netvigator's SMTP server requires authentication which my mail server (Qmail) doesn't support! Thanks to open source, it is easy to patch the code though.
- First, go get the patch
- Apply the patch to qmail-remote.c
In my case (on FreeBSD), one of the chunks can't be patched. But don't worry, just open the source to patch it manually!!
patch < qmail-remote-auth.patch - The patched source needs a base64 function (the authentication for SMTP is in base64 format). Go get it here. Unpack the file and copy base64.c and base64.h to the qmail source folder. Compile it.
gcc -c base64.c - Build the new binary
Replace the existing qmail-remote (usually under /var/qmail/bin) with the patched version
make qmail-remote - Now, the Qmail SMTP routing file (/var/qmail/control/smtproutes) supports username and password. e.g. To route everything from my mail server to Netvigator's SMTP server:
:smtp.netvigator.com username password