Nov
28
2009
0

Change the format of a Subversion working copy

When you copy a subversion working copy from someone else and perform a `svn up` command, you may meet error like this:

svn: This client is too old to work with working copy ‘./’; please get a newer Subversion client.

You can choose to update your svnclient version, or simply use this python script to change format of this subversion working copy:

./change-svn-wc-format.py . 1.4

Written by mic in: Geek |
Nov
23
2009
0

automake,autoconf使用详解

from: http://www.linuxcomputer.cn/jishuwendang/xinshourumen/200902/03-3029.html

作为Linux下的程序开发人员,大家一定都遇到过Makefile,用make命令来编译自己写的程序确实是很方便.一般情况下,大家都是手工写一个简单Makefile,如果要想写出一个符合自由软件惯例的Makefile就不那么容易了.

在本文中,将给大家介绍如何使用autoconf和automake两个工具来帮助我们自动地生成符合自由软件惯例的 Makefile,这样就可以象常见的 GNU程序一样,只要使用”./configure”,”make”,”make instal”就可以把程序安装到Linux系统中去了.

这将特别适合想做开放源代码软件的程序开发人员,又或如果你只是自己写些小的Toy程序,那么这个文章对你也会有很大的帮助.

一.Makefile介绍

Makefile是用于自动编译和链接的 ,一个工程有很多文件组成,每一个文件的改变都会导致工程的重新链接,但是不是 所有的文件都需要重新编译,Makefile中纪录有文件的信息,在 make时会决定在链接的时候需要重新编译哪些文件.

Makefile的宗旨就是 :让编译器知道要编译一个文件需要依赖其他的 哪些文件.当那些依赖文件有了改变,编译器会自动的发现最终的生成文件已经过时,而重新编译相应的 模块.

Makefile的 基本结构不是 很复杂,但当一个程序开发人员开始写Makefile时,经常会怀疑自己写的 是 否符合惯例,而且自己写的 Makefile经常和自己的 开发环境相关联,当系统环境变量或路径发生了变化后,Makefile可能还要跟着修改.这样就造成了手工书写Makefile的 诸多问题,automake恰好能很好地帮助我们解决这些问题.

使用automake,程序开发人员只需要写一些简单的 含有预定义宏的 文件,由autoconf根据一个宏文件生成configure,由automake根据另一个宏文件生成Makefile.in,再使用configure依据Makefile.in来生成一个符合惯例的 Makefile.下面我们将详细介绍Makefile的 automake生成方法.

(阅读全文……)

Written by mic in: TechNote | 标签:
Nov
22
2009
0

“千万别做腾讯盯上的领域”

“独乐乐与人乐乐,孰乐?”国内互联网企业的回答定然是“独乐”。
短短半年间,互联网行业发生的诉讼接连不断,从视频行业的版权纷争到客户端软件的知识产权纠纷,侵权、维权的激烈戏码让人目不暇接。衣着光鲜的IT大佬们竞相奔走于各式论坛、展会、甚至法庭;今日还是战略联盟,明天转身可能就会兵刃相见;你斥责我“无耻”,我回敬你“贼喊捉贼”……法院终也演变成这些企业做秀的舞台。

毋庸置疑,在现代商业社会中,诉讼正在变成一种互联网行业进行商业谈判的一种方式,有时候占优的一方会借此建立更加规范的行业规则,有时候则是为了敲山震虎。

中国最为投资界关注的互联网公司腾讯正是典型代表,奉行“桉树下不长草”的市场运作技法,让业界既“痛恨”又羡慕。腾讯以即时通讯起家,产品遍及游戏、门户、搜索、电子商务、博客、邮箱、空间、娱乐等,腾讯的每一步腾挪无一不伴随着“与行业龙头的PK”:QQ游戏VS联众,QQ旋风VS迅雷,QQ堂VS泡泡堂,QQ影音VS暴风影音,财付通VS支付宝……

先由其他公司(一般为中小企业)培养市场,待市场相对成熟后,利用自己庞大的用户量基础,进入该领域,并形成自身优势,夺取阵地——这几乎是腾讯的典型作风。无怪乎腾讯联合创始人、前COO曾李青近日在某活动上直接语重心长地告诫互联网创业者,“千万别做腾讯盯上的领域”。

《中国经营报》

Written by mic in: Uncategorized |
Nov
15
2009
0

MemcacheQ – Simple Queue Service over Memcache

MemcacheQ是一个基于memcache的轻量级MQ(消息队列)服务,实现简单,使用Berkeley DB来做数据持久化。最重要的,它兼容现有的各个语言下的memcache api,比如php:

<?php
/* connect to memcached server */
$memcache_obj = memcache_connect('memcacheq_host', 21201);

/* append a message to queue */
memcache_set($memcache_obj, 'demoqueue1', 'message body here', 0, 0);

/* consume a message from 'demoqueue1' */
memcache_get($memcache_obj, 'demoqueue1');

memcache_close($memcache_obj);
?>

相比起RabbitMQKestrelActiveMQZeroMQ等重量级的MQ,这个小玩意实在太轻巧了,由于代码少,出问题也可以自己解决。下一个项目可以考虑使用它。

Written by mic in: TechNote |
Nov
14
2009
2

How-To Extract the Boot Camp Drivers from the Mac OS X v10.6 Snow Leopard DMG

Introduction

So, you’ve waited for hours and hours for your Leopard DMG to finish torre-I mean, download from the ADC website. You don’t have an extra DL-DVD laying around or you just don’t want to use one – that’s fine, but when you use boot camp, you’ll find it asks for the Leopard DVD anyways!

You don’t have to download the drivers from anywhere, you can extract them and copy/paste them from OS X! Here’s a step-by-step guide on making it easy.

Part 1

Do not mount the Leopard DMG. If it is mounted, unmount it and then restart (you must restart or it will not work, there’s no way to get around it, sorry guys.)

Part 2

Open a new Terminal window. If you don’t know where to find terminal it’s in Applications/Utilities.

Type in:

Code:
sudo hdid -nomount

[Add a space to the end] and drag the Leopard DMG file from your hard drive to the terminal window. The path will appear, and you can hit enter on the command. This forces the HFS+ partition of the Leopard DMG to not load, allowing the ISO part of the DMG to be booted, which is what we need.

If you’re not using sudo already, it’ll ask you for your password, type it in, hit enter, and you’ll be rewarded with the following:

Code:
/dev/disk?              Apple_partition_scheme
/dev/disk?s1            Apple_partition_map
/dev/disk?s2            Apple_Driver_ATAPI
/dev/disk?s3            Apple_HFS

Take note of the “?” because you’ll need to remember it in a little bit.

Part 3

We need to make a way for the volume to mount on your Mac, so type in:

Code:
mkdir /Volumes/drivers

You’ll recieve no response but this is normal.

Part 4

You’re almost there! We now need to force the DMG to load with the ISO volume instead of the HFS+ volume. To do so, simply type:

Code:
sudo mount -t cd9660 -o nodev,nosuid /dev/disk? /Volumes/drivers

Where ? is the number we mentioned earlier. Remeber not to include the ’s1,’ ’s2,’ or ’s3′ parts in this command.

Now you simply have to restart Finder, which is easy to do from terminal:

Code:
killall Finder

Now you just have to copy the drivers onto a USB drive [or burn them to a disc], boot into Windows and install.

Written by mic in: Geek |
Nov
06
2009
0

Closure Tools – Google Code

Google开源了其内部使用的JavaScript开发工具,希望帮助外部程序员开发出速度更快的Web应用程序。Google认为通过允许开发者使用Google自己所用的工具,他们不仅可以创造出更快的富Web应用程序,而且能真正让Web插上翅膀。Closure JavaScript编译器和库曾被Google用于开发Gmail、Google Docs、Google Maps以及其它应用程序。Closure工具包括了JavaScript优化器,移除不需要的代码,压缩其余的代码以实现速度最大化;
与Firebug协同工作的Firefox扩展Closure Inspector,目的是简化调试;


Closure编译器,能以命令行、Web应用或Firefox扩展形式运行;
Closure Library,Google的标准JavaScript类库;
Closure Templates提供了一组预编译的JavaScript接口组件。

Written by mic in: Uncategorized |
Apr
22
2009
0

hack: Leopard为不同的应用程序保留输入法状态

Mac 10.5(Leopard)去掉了为单独窗口设置单独输入法的选项,取而代之的是全局输入法,非常不方便

用日本人写的inputswitcher 可以替换的实现这个功能。
http://limechat.net/inputswitcher/

步骤为:
下载并安装 SIMBL
下载 inputswitcher , 并解压
InputSwitcher.app → /Applications
InputSwitcherClient.bundle → /Library/Application Support/SIMBL/Plugins
启动InputSwitcher.app,并重启其它应用程序,就可以为不同的应用程序窗口保留输入法状态了。

因为基于SIMBL的程序只支持cocoa框架,所以下面的程序还是记录不了输入法状态

  • Finder
  • Thunderbird
  • iTunes

请向apple提出这个bug,越多人提出,apple就越关注,下一版修复的可能就越大
https://bugreport.apple.com/

Written by mic in: Uncategorized | 标签:
Apr
22
2009
0

javascript及css文件的压缩

下载: yuicompressor

java -jar yuicompressor-2.3.6.jar all.js  > all_mini.js

online minify service:

CSS 在线压缩:
cleancss.com 功能最强大,设置项最多
CSS Drive:CSS Compressor 直观易用

Javascript 在线压缩:
javascriptcompressor.com 压缩比最大,可设置Base62 encode以及Shrink variables
jsmin 直观易用,但不能压缩变量名

Written by mic in: Uncategorized | 标签:,
Mar
01
2009
1

web game的过载保护

Qzone的抢车位、好友买卖,都应该算是web game,随着开通人数日益增加,服务器压力日增,也出现了qzone以前经常出现的“网络问题”。

在网络游戏中有登入排队机制,首创于“魔兽世界”中,服务器只接纳在设计容量之内的访客。尽管排队的人数很长,可能要排很久,但是登入后,就能享受到流畅的游戏体验。

基于qq的5千万同时在线用户的附加应用,服务器总是不够的,所以必需有过载保护。qzone的应用有过载保护,但还不足够保证用户的体验是流畅的,回想一下你曾遇到过的场景:

在浏览上一篇日志的时候能够正确显示,接着点击下一篇日志,却告知你出现了“网络问题”。

这个“网络问题”并不是你的网络出现问题,大部分是因为qzone的瞬间访问量超出了服务器的设计值。这就是qzone的过载保护。

在“读操作”占大多数点击量的web应用中,这种过载保护或许已经足够了,而且用户经过很多年的“教育”已经习惯了“有上顿可能无下顿”的浏览体验,呵呵。

但是对于游戏,这样的体验是不足够的,服务器应该预留足够的并发处理能力给每一个能够进入游戏的玩家(会话)。过载保护应该是基于会话的,而不是简单的基于点击。

web game应该启用基于session的过载机制,保证进入游戏的玩家能够流畅的进行游戏,而不用担心下一次点击触发“网络错误”。

如何判定玩家是否在线呢?很简单,如果玩家超过规定时间无动作,则给予logout,并提示用户“你发呆太久”。下次再点击则启用一个新的session,并进入队列,判定它是否可以进入游戏。

Written by mic in: TechNote | 标签:,
Feb
25
2009
--

Safari 4 public beta

据说Safari4的javascript性能有4.2倍提升(基于Nitro引擎,号称快过IE7 30倍),应该是世界上最快的浏览器了吧?不过我没感觉,因为safari3.1已经很快了。

Tab样式很像Chrome,放在标题栏可以省去以前占用的Tab栏,可视空间一下变大啦:)

下图是启动页: Top Sites效果,很炫。

值得高兴的是Safari adblock还能兼容Safari4,呵呵

200902250015.jpg

搜索建议功能也很实用

200902250032.jpg

Written by mic in: Geek | 标签:,

Powered by WordPress. Theme: TheBuckmaker. Kreditvergleich, Streaming Audio

MC Inside