Showing posts with label web. Show all posts
Showing posts with label web. Show all posts

Monday, August 2, 2010

web is a mess…where is the hope?

Recently I am helping designing and coding a web site, which I thought would be a small project… I did know about the difference between old IE and other “standard” browsers and some hacks and work-arounds, but I failed to realize it would be so painful to do all things “right”.

In stead of insisting everything should look exactly the same in all browsers, I think it is natual that some design details could degrade in older browsers, like round corners and text shadow. The real troublemaker turns form elements, each browser (depending on the operating system and even system theme) displays them differently – an awful nightmare :( There aren’t any standard to style them, the only solution is to employ JavaScript to hide the original form and render a fake one with div and spans. Thus select element becomes an unsorted list with a CSS’s and scripts, which seems very bizarre…

Maybe it is time to re-invent the web. People have been talking about this for decades, but I see little progress. I don’t believen HTML5 is a solution, though it’s really hot. Semantics is important, but I don’t believe it the key issue. Web pages are no longer simply documents, but applications, and we are distributing service instead of content. JavaScript has many bad parts but is blessed as well, devil or angel, it should be the core of web. HTML should be fundamentally changed to be a better present layer of JavaScript. A lot of functions carried out by browser natively should be given to JavaScript or other future client-side code. With more power and freedom of client code, coding for web could certainly bring more good things to users.

Monday, May 31, 2010

Serving static file in nginx with a some check

Recently I developed  a small web site for my lab, and we are hosting it on Google App Engine (GAE), as Google provides quite enough resources for a site of several pages ;)

However we also need to provide download of huge files, which can not be store in GAE, thus we had to host it in one of our severs. Initially we do not want our content directly accessible, so we want to use dynamic URL but we don’t want to loose the performance of nginx.

My final solution is use rsa module by Sybren A. Stuvel (which is pure python) to encrypt the real url (with fixed private key) in GAE, and give the encrypted url to user. In the file host, I use nginx’s X-Accel-Redirect feature and a tiny cherrypy server to decrypt the url (with corresponding pub key), and simply set the X-Accel-Redirect header to the real internal path of nginx.

This solution works well in my case :)

Thursday, March 18, 2010

GAE Hello world error

Google App Engine supports SSL now, however Python 2.5 does not come with SSL socket in stock :(

gae$ /usr/local/bin/dev_appserver.py \
~/projects/hello/
Traceback (most recent call last):
File "/usr/local/bin/dev_appserver.py", line 50, in <module>
execfile(script_path, globals())
File "/usr/local/google_appengine/google/appengine/tools/dev_appserver_main.py", line 338, in <module>
sys.exit(main(sys.argv))
File "/usr/local/google_appengine/google/appengine/tools/dev_appserver_main.py", line 297, in main
server = MakeRpcServer(option_dict)
File "/usr/local/google_appengine/google/appengine/tools/dev_appserver_main.py", line 259, in MakeRpcServer
host_override=option_dict[ARG_ADMIN_CONSOLE_HOST])
File "/usr/local/google_appengine/google/appengine/tools/appcfg.py", line 114, in __init__
self.opener = self._GetOpener()
File "/usr/local/google_appengine/google/appengine/tools/appcfg.py", line 317, in _GetOpener
opener.add_handler(urllib2.HTTPSHandler())
AttributeError: 'module' object has no attribute 'HTTPSHandler'

To resovle the problem you got to recomile Python with SSL support as instructed by Patrick Altman and then follow a regular  configure – make – make install routine.

Then you need to Edit the Modules/Setup.dist to uncomment a couple of lines:

# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
SSL=/usr/local/ssl
_ssl _ssl.c 
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl 
-L$(SSL)/lib -lssl -lcrypto

Monday, December 14, 2009

Idea for a simple bib tool

I was using Zotero for my research readings, however, it is a bit too heavy for me, and I want a tool that can be portable across machines. So I am planning to write a bib tool for myself when I am a bit free sometime next spring.

The most important concept in this tool:

  • Keep it Simple: there will NOT be fancy setup interface, but a config XML; there will not be many export styles for that is latex’s business.
  • Depend less: there is already many advanced tools for bib organization, but they depend on this and that. I plan to implement all this tool with Python and sqlite3, so it can be put into U-key/Dropbox, and used anywhere.

The basci senarios is:

  1. User start the tool, which set up a local web sever at a high port (eg: 8080), and open any browser to land on the interface.
  2. To add a new paper, user have to
    1. upload a pdf file
    2. add bibtex info by
      1. upload a crospending a bibtex file
      2. fill a form to generate bibtex info
    3. add optional tags
    4. add optional note
  3. To view paper:
    1. start a search (empty field means any)
    2. a list of reference is returned
    3. (optional) open pdf file
  4. To export
    1. start a search
    2. select paper and add to “basket”
    3. go to export folder and get a sorted bib for all and BIB’s for each files and copies of PDF’s

Suggestions are always welcomed :)

Sunday, September 27, 2009

looking for a web software for knowlege sharing

I am currently looking for a web-based software for knowledge sharing in our lab, I've investigated some blog, cms and also wiki softwares, but none seems to fit :(

We just want something which is easy to setup and maintain, and can organize different kind of materials. CMS's are powerful, but relatively hard to used...Wiki seems to lack some kind of structure. Blogs are easy to use, but does not organize resources well.

So what do you use in your lab, my dear readers?

Wednesday, September 16, 2009

QEMU "host only network"

Abstract: Setup an LAN network of only the host and guest.

Recently I'm trying something on qemu and want to access the guest from the host more freely than user mod port redirect, but I do not want to expose my guest to the host network. All I did is to wrap everything into a script:

#!/bin/sh

HOSTIP="192.168.1.250"
GUESTIP="192.168.2.10"
NETMASK="255.255.255.0"
USERID=`whoami`
IFNAME=`sudo tunctl -b -u $USERID`

sudo ifconfig $IFNAME $HOSTIP netmask $NETMASK up

echo ":: Host IP is $HOSTIP"
echo ":: Run the follwing command in guest to set IP and gateway:"
echo " # ifconfig eth0 $GUESTIP"
echo " # route add default gw $HOSTIP"
echo ":: Starting QEMU with TUN/TAP network..."

qemu -hda webdev.qcow \
-boot c -m 256 \
-k en-us -localtime\
-net nic,vlan=0,model=rtl8139 \
-net tap,vlan=0,ifname=$IFNAME,script=no,downscript=no

sudo tunctl -d $IFNAME
HOSTIP="19

Btw, I find sticky note gadget on iGoogle a great tool to share a couple of lines between machines - I'm writing on my Windows laptop and the script is in my Linix desktop, just a few paste and copy brings the script here :)

Wednesday, June 24, 2009

Google Service Blocked by Chinese Gov

It seems the Chinese government is now crazy about blocking foreign websites, now www.google.com, and all services of Google except www.google.cn are now blocked by the Great FireWall.

Web censorship ans secrete police are now bringing the country back to the bad old days :(

Tuesday, June 9, 2009

Sigh...blocked again :(

As everybody knows, there is a Great Firewall(usually called GFW for short) between we Chinese internet users and the 'out side world'. Unluckily for some unknown reason, blogger and blogspot is blocked by GFW recently which does cause me a lot of trouble to keep blogging here... Anyway, I will try hard to keep this site updated.

Sunday, May 3, 2009

Migrate to a blog is just like move to a new house...

It's tiring, but offers a great opportunity to review my stuffs - what I have been writing about, what kind of blog I hope to have, whether my posts are well tagged...

And when I was trying to make a list of all programing/makeup languages I've used, I found some of them get so rusty that I cannot even remember how to define a function in it...Hmm it doesn't sound good :(

Fresh New Blog for Tech blogging =)

Hi all,

Finally I've decided to write a new blog for my technological posts, and all posts related to technology (software, Linux system, web technology...) will be migrate here in a short period of time =)

Monday, April 27, 2009

Wednesday, April 15, 2009

面对网页的遐思

本来我认为技术应该是越来越方便的,可是忽然想到网页制作,发现不是那么回事。

当年dreamweaver横空出世,与frontpage争锋“用table布局的最强大工具”;而今虽然土坯还在孜孜不倦的出dw cs2, dw cs3, dw cs4 实际上严肃的实用网页基本上都变成用文本编辑器(比如记事本)写代码的了(不知道T大的计算机文化基础课程还要不要大家做网页了,当年会有dreamweaver可是个“先进”工具的说……如果还在教dreamweaver我就不的不鄙视一下母校何其土鳖……当然作为一个第三世界国家我没指望大学教学能引领研究和产业发展,至少也得跟上时代步伐)

的确上来就教如何手写代码看起来很是不人性化,大有要非ECS系童鞋小命的感觉,不过从只有head, title, body, p标签开始学习做其实还挺有趣的,比一个一对按钮面板不知道怎么用的dw强多了;当今网页创作工具再次倒退回到了文本编辑器时代。

想想技术变化真是无情,当年一统江湖的大杀气如今成了土老冒的象征……如今漫天的div盒子在html5的语义标签下是不是也很快就要黯然落幕了呢?这个产业真的够残忍,几年时间就把认识颠覆一遍,知识淘汰一遍,一不小心没跟上趋势就被拍死在沙滩上了……

退化进化终究都是变化啊

btw,忽然回想起大四上的一门完全没花心思的课——貌似叫做网络信息论——想起樊平毅老师,当时很不愿意去翻找论文和经典教材,现在才恍然发现追本溯源,看清时下纷繁技术的前世今生,判断它未来,是如此的重要。

Saturday, August 16, 2008

blogger后台改版还是不错的

新的后台页面看起来还是很清爽了,最常用的new post十分的醒目,这点还是不错的。和Google的结合也更加的紧密了,嵌入广告或者其他小玩意儿都容易了许多,也算是一个进步吧:)
基本上对于blogger没有什么不满意的地方了,不过还是贪心的想如果google弄个类似live writer一样的东西就更好了,或者给blogger的wysiwyg编辑器增强一下,连上面的new post的背景指定都需要手写代码有点不够人性化……

fs2U不灵了

金色盾牌血汗铸就~

然而还是有好多好东东是需要下载的,活人不能被D憋死,据说这个是通过dns搞得,于是自然就用本地dns的办法解决它。网上有个脚本效果还行,自己处理其实也就是那个法子(传说中的本地域名解析——hosts文件)。

又可以用了,速度还不错的说;)

btw,另外在卓越亚马逊看到有买开幕式DVD的,没看到而且对那个特别有爱的可以考虑一下哈。bt上据说有个NBC版本高清的流传,不过我这旧电脑和窄带宽就不尝试了……

Thursday, July 17, 2008

SF居然还没有解封!

今天需要下载MinGW才发现这个郁闷的问题,十分的想骂人了……

Saturday, April 12, 2008

更新后的Live Writer能支持自定义模板的Blogger预览了

这个实在是个不错的进步,现在能够更加轻松的用Windows Live Writer写blog了,完全不必登录网页后台来编辑啦^_^

其实我自定义的模板是非常非常简单的,只是定义了title背景色和鼠标悬浮变化而已,没有图片(我觉得简单就是美观,嗯)当然你要是说我在给自己的懒惰寻找理由我也不是很反对;)

其实不少朋友都是有Blog的,不论是Sina还是Blogger的博客,模板差不多的(sohu的特别一点,也更不标准一些,用w3标准卡的话惨不忍睹……)都是CSS的变形而已。于是就有了讨论如何美化博客的共同基础啦,欢迎对此有爱的人和我讨论~

btw, 有本叫做《css之禅》(The Zen of CSS Design)的书,相当的不错,去年秋天出了中文版,我只看过英文的电子书,很不满足,谁有借我看几天吧……这本书的好处是插图相当的多,很多成功页面布局的例子,代码相当的简洁易懂,所以适合各种水平的读者啦^_~。

如果一个人做的网页可以反映他的性格的话,从我的blogspot看我应该是“率真而灵动”的,自我陶醉ing~~

Tuesday, March 11, 2008

体验了一把MSN-Gtalk互通,很刺激

今天上网的时候偶然看到已经可以通过“某些手段”实现MSN-Gtalk的互联互通了,遂体验了一把:

为了使用这个互联互通的功能,我们需要利用Jabber Transport来作为桥接,可以理解成把你的帐号交给一个bot去登录msn,然后把消息转发给使用jabber协议的Gtalk。具体方法为了方便使用了一种常见的Jabber协议的IM软件(但是不是Gtalk,sigh…)Psi。

安装psi 0.11 windows版后直接就可以使用Google的账户登录,登录后点坐下的那个按钮,选择service discovery,然后在上面一个框中填入:
jabbernet.dk
当然,如果你使用其他的jabber im transport server也没问题,然后browse

这时候会列出可用的服务,选择msn,填入账户密码,ok了~

从此Psi就没用了,不用再理他了,嘿嘿。登录Gtalk,看到MSN的联系人了吧?(应该会看到不少邀请,嗯)

=======================================

当然貌似是Jabber Transport Server的设计问题,所以有时候联系人的在线状态会显示成离线……

=======================================

再后来就该说怎么停止Jabber Transport Server上的MSN服务了……(不然一登录Gmail MSN就掉了太傻了>_<)

在主界面你的Jabber帐号上(也就是xxx[at]gmail.com)上点击右键,然后选择XML console,输入以下内容:

<iq type='set' to='msn.jabbernet.dk'>
<query xmlns='jabber:iq:register'>
<remove/>
</query>
</iq>

原理上其实就是一次空注册操作,嗯

Friday, January 4, 2008

Windows Live Writer 2008真的已经很实用了

和早年需要自己指定ftp发布照片相比,现在发布格式内容竟然是这样的简单。支持向多数的weblog程序提交照片,比如我用的blogspot和live space都是被支持的^^

以前在日志里面贴个照片多么的艰难啊,现在终于不用登陆网页去贴照片啦,真让人高兴。另外现在对于blog的标签的支持也让这个程序实用性极大的增强了,可以说是目前所有的通用独立blog发布程序里最好的了。

对于我这样的同样的内容两次发布来说,生活真是从此轻松愉快~~

Saturday, December 29, 2007

发现还是常看校内的,于是

于是我在我的两个主浏览器里都把广告干掉了,wahaha

对于firefox,用的当然是轻松方便的adblock插件,规则如下:

http://gg.xiaonei.com/*
xiaonei.com#*(id*=banner)
xiaonei.com#div(class*=announcement)
xiaonei.com#*(id*=p44)

这四条把校内的广告干干净净的干掉了,嘿嘿嘿

至于opera稍微有点技巧(虽然很通俗,很平凡,很多人都知道)就是自定义user css我专门用记事本写了个xiaonei.css放在opera 的profile\styles\user\目录下,内容这样写

/* Xiao Nei AD-remove*/
#dashGift, #dashIm, #p44
{ display: none !important }
[id="banner"]
{ display: none !important }
[class="block announcement link"]
{ display: none !important }

然后访问校内,右键选择站点属性,显示选项卡的自定义层叠样式表选择上述的xiaonei.css,重启opera,打开校内……Bingo!广告每咯=)

iGoogle的Holiday Village主题真pp

感觉iGoogle的品位最近好得多了,不知道是不是请了更强大的设计师(或者是换了恰好符合我口味的设计师,嘿嘿)

没pp没真相,呵呵,上图一个:

(以下图片转自google)

宁静的小村庄,温暖的灯光,纷纷扬扬的雪花,清凉的月光~

这个图片是个非常有意思的结构,中间的小村庄是永远居中的,两遍的树林是可以tile的,也就是说这景致横向多长看起来都是很连贯的,相当的不错。

(用firefox找出网页中图果然比较方便,用opera就差得多了,sigh,期待fx3中)