google中的加号这个运算符一直以来都是一个很实用的Google搜索技巧。比如当你搜索“ai”的时候,Google会将”artificial intelligence”, “Amnesty International”, “Art Institutes”, “Appraisal Institute”, “Adobe Illustrator”等词汇也作为关键字给出搜索结果,但这些并非是你想要的。所以为了只看到包含“ai”的搜索结果,你可以搜索“+ai”。可惜的是现在这个技巧不再管用了,要想搜索“ai”,你可以将“ai”两边加上引号来搜索,严格限制只看到“ai”的搜索结果,但打两个引号要比打一个加号麻烦多了,而且它跟逻辑有关──当你在搜索关键字里用减号的时候,表示不包含某个单词。

至于Google为何去掉加号这个搜索运算符,估计是想将加号用于Google+的搜索,就像你现在在Google+里写加号,即可直接引用某个Google+用户那样:


阅读全文

如何在android模拟器中发短信,模拟GPS、打电话、挂电话,发短信等。

首先,启动模拟器,

然后,在电脑的开始菜单中找到运行,输入CMD,回车,进入CMD;使用以下命令连接模拟器

C:Documents and SettingsAdministrator>telnet localhost 5554

出现

Android Console: type 'help' for a list of commands
OK

其中5554为模拟器在本机的端口,可以使用adb devices查看:

C:android-sdk-windowstools>adb devices

List of devices attached emulator-5554 device

或者最简单的方法是查看模拟器的左上角的4位数字。

adb-在Android模拟器中模拟GPS、打电话、挂电话,发短信

adb-在Android模拟器中模拟GPS、打电话、挂电话,发短信


阅读全文

注:本文转载自图灵社区-Diana

某天看到一篇博文,《一百年后,人类怎样编程?》,只是这个题目,就勾起心中无限感慨。文章没细看,内容大致是分析各种语言,以及其中各种语言现象,今后的发展趋势。我对于语言的进步一直不感冒,对5年前就有很多人推崇的Ruby,至今也懒得抬眼皮看看,8年前被迫用过几天Perl,我就断定这是最糟糕的编程语言之一,因为它标榜自由,却又没法真正自由。时至今日,我仍然只用 C++,C#,Java这三种语言,如果SQL也算的话就是四种。对于达到一定程度的程序员而言,语言已经不重要了,不管做什么功能或者什么平台,只要不是初次上手,都应该有50%以上的代码可以自动生成出来,另外利用开源代码和商业化构件完成30%以上的工作,真正需要自己手工编写的部分绝对不应超过 20%。不论是自动生成的代码,还是开源代码或构件,最大程度的可理解性和通用性是首要追求的目标,因此最通用的,和使用人数最多的语言才是最好的语言。语言的进步对于提高编程效率确有一定帮助,我自己也深有体会,六年前我做C#项目的时候不得不自己写了对IList进行查询的功能,两年之后,LINQ成了语言自带的标准功能,后来的程序员显然可以节省开发这个功能的时间。但是,语言带来的效率提升,远远不如思考方式变化引起的编程效率飞跃来得大。

从第一天编程开始,我就不喜欢这个工作,看到同事飞快地打键盘,屏幕不停地吐出一行行程序,觉得这件事实在傻透了,她编的是FOXPRO,又是一种我很看不起的语言。她编的功能,无非就是横竖画上几根表格线,然后把一些数字和文字填到正确的格子里去,这就是公司里的编程高手所做的事情。我曾经惊讶于这么傻的事情竟然真的需要人来做,可是如果不用人做,又能怎样呢?那时幸亏我利用一点小聪明,在还没有开始从事这种傻工作的时候,就改去研究解密算法了,后来又混上了设计师,小经理,总算没有傻掉,那时心里不免暗自得意和庆幸。


阅读全文

execCommand方法是执行一个对当前文档,当前选择或者给出范围的命令。处理Html数据时常用

如下格式:document.execCommand(sCommand[,交互方式, 动态参数]) ,其中:sCommand为指令参数(如下例中的”2D-Position”),交互方式参数如果是true的话将显示对话框,如果为false的话,则不显示对话框(下例中的”false”即表示不显示对话框),动态参数一般为一可用值或属性值(如下例中的”true”)。


阅读全文

APR_DECLARE_NONSTD(unsigned int) apr_hashfunc_default(const char *char_key,
                                                      apr_ssize_t *klen)
{
    unsigned int hash = 0;
    const unsigned char *key = (const unsigned char *)char_key;
    const unsigned char *p;
    apr_ssize_t i;

    /*
     * This is the popular `times 33' hash algorithm which is used by
     * perl and also appears in Berkeley DB. This is one of the best
     * known hash functions for strings because it is both computed
     * very fast and distributes very well.
     *
     * The originator may be Dan Bernstein but the code in Berkeley DB
     * cites Chris Torek as the source. The best citation I have found
     * is "Chris Torek, Hash function for text in C, Usenet message
     * <27038@mimsy.umd.edu> in comp.lang.c , October, 1990." in Rich
     * Salz's USENIX 1992 paper about INN which can be found at
     * .
     *
     * The magic of number 33, i.e. why it works better than many other
     * constants, prime or not, has never been adequately explained by
     * anyone. So I try an explanation: if one experimentally tests all
     * multipliers between 1 and 256 (as I did while writing a low-level
     * data structure library some time ago) one detects that even
     * numbers are not useable at all. The remaining 128 odd numbers
     * (except for the number 1) work more or less all equally well.
     * They all distribute in an acceptable way and this way fill a hash
     * table with an average percent of approx. 86%.
     *
     * If one compares the chi^2 values of the variants (see
     * Bob Jenkins ``Hashing Frequently Asked Questions'' at
     * http://burtleburtle.net/bob/hash/hashfaq.html for a description
     * of chi^2), the number 33 not even has the best value. But the
     * number 33 and a few other equally good numbers like 17, 31, 63,
     * 127 and 129 have nevertheless a great advantage to the remaining
     * numbers in the large set of possible multipliers: their multiply
     * operation can be replaced by a faster operation based on just one
     * shift plus either a single addition or subtraction operation. And
     * because a hash function has to both distribute good _and_ has to
     * be very fast to compute, those few numbers should be preferred.
     *
     *                  -- Ralf S. Engelschall 
     */

    if (*klen == APR_HASH_KEY_STRING) {
        for (p = key; *p; p++) {
            hash = hash * 33 + *p;
        }
        *klen = p - key;
    }
    else {
        for (p = key, i = *klen; i; i--, p++) {
            hash = hash * 33 + *p;
        }
    }
    return hash;
}

阅读全文

作者的图片

DigDeeply

Technology Stack: PHP/Openresty/GoLang, and so on…

Web Development Engineer

Beijing China