La Vita è Bella

Thursday, March 31, 2005

The correct way to use "alt" in images

Wanna post your e-mail address at your homepage, but be worried about the spam spiders? You can use a picture, just like what E-Mail Icon Generator do; Or you can use "_AT_" instead of "@", just like "foo_AT_bar_DOT_com". But neither is friendly, easy to use. You must type the email address yourself, you can't just copy & paste it.

So here's a solution for it.

Preparing 2 pictures, one for "@" & one for ".", just like the followings: the picture of "@" the picture of "."

Now, put them into your e-mail address, replace the real "@" and ".".

I guess you'll say, that don't work. Yep, it don't work, it isn't finished. Remember the title? Our focus is the "alt" attribute. Now, add the "alt" attribute into "img", which content is the one you've replaced: "@" or ".", see the following html code:

foo<img src="http://wang.yuxuan.org/pix/at.png" alt="@" />bar<img src="http://wang.yuxuan.org/pix/dot.png" alt="." />com

Here's the effect:

foo@bar.com

Copy it, and paste it to the "To" field in your mail client. If you're using Firefox, you'll get the perfect e-mail address. If you're using ie, unfortunately, you'll only get this: "foobarcom". Stupid ie can only show the stupid tooltip(maybe you should add a title="" to stop ie from showing the stupid tooltip), but not process "alt" correctly. So, you should throw your ie into trash now.

That's not the end. If you're lazy, don't wanna prepare the 2 pictures, just omit the picture thing, like this:

foo<img src="http://where/is/my/picture/at.png" alt="@" />bar<img src="http://where/is/my/picture/dot.png" alt="." />com

See what?

foo@bar.com

Stupid ie will give you a stupid cross, but in Firefox, it's correct and copyable.

Yeah, trash your ie today. Now.



tags: , , , ,

18:33:00 by fishy - w3c - Permanent Link

no comments yet - no trackbacks yet - karma: 6 [+/-]

Tuesday, March 15, 2005

Perfect latex-beamer Chinese support

Just resolved the last problem in latex-beamer's Chinese support: Chinese PDF bookmark.

Howto? Just use the following command to compile it:

pdflatex beamer_slide.tex
pdflatex beamer_slide.tex
gbk2uni beamer_slide.out
pdflatex beamer_slide.tex


tags: , , ,

18:33:00 by fishy - i18n.zh - Permanent Link

no comments yet - no trackbacks yet - karma: 17 [+/-]

Thursday, March 03, 2005

OpenVPN

Finally, configured OpenVPN well now.

My situation is: 2 computers A & B, A is at the lab and in a subnet, B is at the dormitory. I just want A to use B's connection.

Following OpenVPN's Static Key Mini-HOWTO, I used the following configurations:

Server:

remote server.ip dev tun0
ifconfig 10.8.0.1 10.8.0.2
secret /etc/openvpn/static.key
comp-lzo
keepalive 10 60
ping-timer-rem
persist-tun
persist-key

Client:

remote server.ip
dev tun0
ifconfig 10.8.0.2 10.8.0.1
secret /etc/openvpn/static.key
comp-lzo
keepalive 10 60
ping-timer-rem
persist-tun
persist-key

And then is the routing settings. At server, I must enable ip forwarding as the following script:

#!/bin/sh
modprobe iptable_nat
iptables -t nat -A POSTROUTING -s 10.8.0.0/16 -d ! 10.8.0.0/16 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward

At client, Add the original route to the server network, and add 10.8.0.1 as the gateway to all other networks:

#!/bin/sh
route add -net server.ip netmask 255.255.255.0 gw 192.168.0.251
route del default route add default gw 10.8.0.1

And then I can use OpenVPN!



tags: ,

14:41:00 by fishy - opensource - Permanent Link

no comments yet - no trackbacks yet - karma: 17 [+/-]

May the Force be with you. RAmen