微软Visual Studio 2010感人广告

其实这是一个关于序员的广告

Share
Posted in programmer at April 24th, 2010. No Comments.

Javascript的二分查找(预排序数组的查找)

《JavaScript高级程序设计》的作者Nicholas C. Zakas使用JavaScript实现的一些基本算法,链接地址如下http://www.nczonline.net/blog/tag/computer-science/。 其中,对本文提到的二分查找算法的实现如下:

  1. //Copyright 2009 Nicholas C. Zakas. All rights reserved.
  2. //MIT-Licensed, see source file
  3. function binarySearch(items, value){
  4.  
  5.     var startIndex  = 0,
  6.         stopIndex   = items.length – 1,
  7.         middle      = Math.floor((stopIndex + startIndex)/2);
  8.  
  9.     while(items[middle] != value && startIndex < stopIndex){
  10.  
  11.         //adjust search area(调整查找范围)
  12.         if (value < items[middle]){
  13.             stopIndex = middle – 1;
  14.         } else if (value > items[middle]){
  15.             startIndex = middle + 1;
  16.         }
  17.  
  18.         //recalculate middle(重新计算中项索引)
  19.         middle = Math.floor((stopIndex + startIndex)/2);
  20.     }
  21.  
  22.     //make sure it's the right value(确保返回正确的值)
  23.     return (items[middle] != value) ? -1 : middle;
  24. }
Share
Posted in javascript at April 24th, 2010. 1 Comment.

其实objectvie-c还算优美

  3.3.1 — Applications may only use Documented APIs in the manner prescribed by Apple and must not use or call any private APIs. Applications must be originally written in Objective-C, C, C++, or JavaScript as executed by the iPhone OS WebKit engine , and only code written in C, C++, and Objective-C may compile and directly link against the Documented APIs (eg, Applications that link to Documented APIs through an intermediary translation or compatibility layer or tool are prohibited).

这段3.3.1的苹果开发者规定,让我高兴了一天,只需要掌握两种语言就可以开发了,不需要其他的狗屁flash,java。

Share
Posted in iphone at April 24th, 2010. No Comments.

iphone 2g 悲剧,android运行可能

David Wong 使用了openiboot成功引导Android系统。在早期就,dev team中的planetbeing就成功将Linux2.6内核引进到苹果平台中的第一二代的iphone和第一代的ipod touch中的,但是还是缺乏一些硬件驱动。

现在david开发了一些驱动程序,使适应iphone缺少部分物理键盘的情况。

此次的对于苹果来说应该说是一场灾难。估计乔布斯见到视频后会抓狂。

Share
Posted in Uncategorized at April 23rd, 2010. No Comments.