iPhone更新至OS 4.0

152 views 六月 23, 10 by Timothy

昨天iPhone OS 4.0的发布,成为这两天最热闹的一件事了。估计全世界的果粉都等着这一天的到来。昨晚网上等到12点多,都没见OS 4.0公布出来,白天又要上班,所以只有等今晚了。晚饭过后,就开着iTunes,接上iPhone,准备更新固件。
iPhone1

接上iPhone后,iTunes能检测到最新版的4.0固件,于是俺迫不及待的点击了更新。可是好事多磨啊,估计全世界众多的果粉,都在连接和下载,下载速度变得很慢。不幸的是,我的更新看来下载快完成一半了,结果突然显示连接错误,下载停止了。更无语的是,竟然不支持断点续传,又要重新下载。这样的悲剧重复了两三次,实在是没信心了。后来在网上找到公布出来的官方OS的HTTP下载地址,索性开了个QQ旋风来下载,国产软件果然不负众望,以飞快的速度把固件给拖了下来……(看来关键时刻,还是国货当自强啊,嘿嘿)
接下来就是刷机,国产很简单,几分钟后,iPhone就伴随着新的OS 4.0启动了。启动后,在iTunes里能看到更新后的固件版本:
iPhone2
最后,来一张更新固件后的iPhone截图: 
iPhone3
OS 4.0的一些新特性,只有慢慢体会了。今晚总算顺利完成了固件升级,打完收工……

Blog插件更新

66 views 六月 12, 10 by Timothy

很久没整理下Blog了,这次对Blog的一些插件做了一些调整和更新。
为了优化一下Blog访问速度和用户体验,正式启用了WP Super Cache插件。Nginx下需要单独在配置文件中设置一下,生效后,随便访问几个页面,看到Blog的wp-content/cache目录下生成文件了,表示成功启用了。设置的方式,可以参考久酷同学的一篇文章
另外,貌似WP Super Cache插件和WP-PostViews插件有一些冲突,启用了WP Super Cache后,发现文章计数停住不动了,估计是因为生成了静态页面的关系。想了一下,俺的文章其实访问量并不是很大,显示一下文章访问量意义也不太明显,所以为了性能的缘故,暂时停用了WP-PostViews插件。网上貌似有关于这两个插件冲突的解决方法,不过今天暂时没时间细细研究了,空了再试试。
最后,替换掉一个评论者信息的插件Comment Info Detector,感觉WP-UserAgent能检测的浏览器和操作系统的版本更多一些,所以用了它。
其实俺比较喜欢的是WP Super Cache这个插件,希望它对Blog的访问速度有一定的提升。嗯,观察几天Blog访问情况就知道结果了。

Ubuntu 10.04 更新源收集

836 views 五月 10, 10 by Timothy

网上收集来的Ubuntu 10.04更新源,感觉网易的速度还不错,其他几个都是国内的,大家可以试试。

使用方法:
1.sudo gedit   /etc/apt/sources.list
编辑你的源列表,将原来的内容全部删除,添加下面列表中最适合你的源 (注意不要全部添加),选择一个最合适你的即可,复制到你的列表中,然后保存列表。
2.sudo apt-get update   更新源列表信息
可以在运行“sudo   apt-get update ”时查看一下错误信息,把不能连接的源删除再重新运行“sudo apt-get update ”。
3.sudo apt-get upgrade  升  级
或者用ubuntu自带的更新管理器升级 也可
Ubuntu 10.04源列表:

台湾
deb http://tw.archive.ubuntu.com/ubuntu/ lucid main universe restricted multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu/ lucid main universe restricted multiverse
deb http://tw.archive.ubuntu.com/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://tw.archive.ubuntu.com/ubuntu/ lucid-security universe main multiverse restricted
deb http://tw.archive.ubuntu.com/ubuntu/ lucid-updates universe main multiverse restricted
deb-src http://tw.archive.ubuntu.com/ubuntu/ lucid-updates universe main multiverse restricted

SRT Sources
deb http://ubuntu.srt.cn/ubuntu/ lucid main restricted universe multiverse
deb http://ubuntu.srt.cn/ubuntu/ lucid-security main restricted universe multiverse
deb http://ubuntu.srt.cn/ubuntu/ lucid-updates main restricted universe multiverse
deb http://ubuntu.srt.cn/ubuntu/ lucid-proposed main restricted universe multiverse
deb http://ubuntu.srt.cn/ubuntu/ lucid-backports main restricted universe multiverse
deb-src http://ubuntu.srt.cn/ubuntu/ lucid main restricted universe multiverse
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-security main restricted universe multiverse
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-updates main restricted universe multiverse
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-proposed main restricted universe multiverse
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-backports main restricted universe multiverse

网易(速度很快)
deb http://mirrors.163.com/ubuntu/ lucid main universe restricted multiverse
deb-src http://mirrors.163.com/ubuntu/ lucid main universe restricted multiverse
deb http://mirrors.163.com/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ lucid-security universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ lucid-updates universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ lucid-proposed universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ lucid-proposed universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ lucid-updates universe main multiverse restricted

ubuntu官方上海源,提供 Kernel,Hiweed,ubuntu
deb http://mirror.rootguide.org/ubuntu/ lucid main universe restricted multiverse
deb-src http://mirror.rootguide.org/ubuntu/ lucid main universe restricted multiverse
deb http://mirror.rootguide.org/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://mirror.rootguide.org/ubuntu/ lucid-security universe main multiverse restricted
deb http://mirror.rootguide.org/ubuntu/ lucid-updates universe main multiverse restricted
deb http://mirror.rootguide.org/ubuntu/ lucid-proposed universe main multiverse restricted
deb-src http://mirror.rootguide.org/ubuntu/ lucid-proposed universe main multiverse restricted
deb http://mirror.rootguide.org/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirror.rootguide.org/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirror.rootguide.org/ubuntu/ lucid-updates universe main multiverse restricted

搜狐源:
deb http://mirrors.shlug.org/ubuntu/ lucid main universe restricted multiverse
deb-src http://mirrors.shlug.org/ubuntu/ lucid main universe restricted multiverse
deb http://mirrors.shlug.org/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://mirrors.shlug.org/ubuntu/ lucid-security universe main multiverse restricted
deb http://mirrors.shlug.org/ubuntu/ lucid-updates universe main multiverse restricted
deb http://mirrors.shlug.org/ubuntu/ lucid-proposed universe main multiverse restricted
deb-src http://mirrors.shlug.org/ubuntu/ lucid-proposed universe main multiverse restricted
deb http://mirrors.shlug.org/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirrors.shlug.org/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirrors.shlug.org/ubuntu/ lucid-updates universe main multiverse restricted

骨头源,骨头源是 bones7456架设的一个Ubuntu源 ,提供ubuntu,deepin
deb http://ubuntu.srt.cn/ubuntu/ lucid main universe restricted multiverse
deb-src http://ubuntu.srt.cn/ubuntu/ lucid main universe restricted multiverse
deb http://ubuntu.srt.cn/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-security universe main multiverse restricted
deb http://ubuntu.srt.cn/ubuntu/ lucid-updates universe main multiverse restricted
deb http://ubuntu.srt.cn/ubuntu/ lucid-proposed universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-proposed universe main multiverse restricted
deb http://ubuntu.srt.cn/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-updates universe main multiverse restricted

lupaworld源:
deb http://mirror.lupaworld.com/ubuntu/ lucid main universe restricted multiverse
deb-src http://mirror.lupaworld.com/ubuntu/ lucid main universe restricted multiverse

deb http://mirror.lupaworld.com/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://mirror.lupaworld.com/ubuntu/ lucid-security universe main multiverse restricted
deb http://mirror.lupaworld.com/ubuntu/ lucid-updates universe main multiverse restricted
deb http://mirror.lupaworld.com/ubuntu/ lucid-proposed universe main multiverse restricted
deb-src http://mirror.lupaworld.com/ubuntu/ lucid-proposed universe main multiverse restricted
deb http://mirror.lupaworld.com/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirror.lupaworld.com/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirror.lupaworld.com/ubuntu/ lucid-updates universe main multiverse restricted

rootguide 源,ubuntu官方上海源,提供 Kernel,Hiweed,ubuntu
deb http://mirror.rootguide.org/ubuntu/ lucid main universe restricted multiverse
deb-src http://mirror.rootguide.org/ubuntu/ lucid main universe restricted multiverse
deb http://mirror.rootguide.org/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://mirror.rootguide.org/ubuntu/ lucid-security universe main multiverse restricted
deb http://mirror.rootguide.org/ubuntu/ lucid-updates universe main multiverse restricted
deb http://mirror.rootguide.org/ubuntu/ lucid-proposed universe main multiverse restricted
deb-src http://mirror.rootguide.org/ubuntu/ lucid-proposed universe main multiverse restricted
deb http://mirror.rootguide.org/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirror.rootguide.org/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirror.rootguide.org/ubuntu/ lucid-updates universe main multiverse restricted

手机ROM更新至WM6.5-28011

540 views 十二月 30, 09 by Timothy

自从上次手机刷机到WM6.5-23052后,哥折腾手机的脚步就从来没闲过,呵呵。正所谓生命无止境,折腾不停息,这次哥又手痒了,自从在cnbeta看到MS又放出新版ROM的新闻后,就又重操旧业,开始了折腾的脚步,把俺可怜的Touch Pro又给洗脑了一次。下载ROM,连上电脑,不到10分钟,一个新ROM就顺利的运行在小T上了。这次的ROM是用了一个国外的比较有名小组TAEL定制的英文版ROM,界面清新,重要的是,总体感觉比上次的ROM流畅了很多,集成新版的HTC Sense界面,相当漂亮!刷机后,发现中文不能正常显示,全是框框一样的乱码,装了个中文字体的安装包就解决了。一直以来,Windows Mobile的运行速度都不尽人意,尤其是性能方面,不过微软视乎注意到了这一点,随着ROM版本号的不断升高,能感觉到微软在Windows Phone性能方面的改进,嗯嗯,如果再不重视性能和运行速度,或许Windows Phone会流失大量的Fans和用户,转而投向Android和iPhone。虽然Windows Phone 7.0的正式发布还遥遥无期,不过偶还是非常期盼的。总体评价,这次的ROM让哥很满意,上两张图炫耀下:

VidyaScreen005VidyaScreen007  

VidyaScreen011 VidyaScreen004

手机版博客更新了插件

213 views 十二月 25, 09 by Timothy

一直以来,我的blog用的wp-t-wap插件实现博客的手机浏览,感觉还不错,插件启用时,会自动生成手机浏览所需的页面文件。无意中发现博客好友久酷同学在使用MobilePress,自己去down了一个,试用了一下,果然不错,比起wp-t-wap更轻量级,插件支持多种主题以及自定义主题。而且插件启用后,能够自动识别访问的客户端,如果发现是手机等移动设备,就自动启用MobilePress的主题,相当方便。推荐还没有安装的同学使用。插件的安装和设置也很简单,就不在此累述了……

MobilePress 插件
下载地址: http://wordpress.org/extend/plugins/mobilepress/

Microsoft MyPhone更新了

202 views 十月 08, 09 by Timothy

微软推出的MyPhone是个非常不错的东东,自从MyPhone的beta版本以来,我都一直用它来向网络同步和备份我的手机联系人信息。如今微软推出了新版本的客户端,版本升级至01.05.2128.0401.其中添加了一些新的特性:

查找丢失的手机
“我的手机空间”服务可以在地图上显示上次所知的手机位置(基于上次使用“我的手机空间”同步或共享照片的位置)。此服务需由用户激活。

锁定丢失的手机
如果手机丢失或被盗,“我的手机空间”可以通过远程锁定您的手机或清除其内容,帮助保护您的信息。此功能仅面向部分市场提供,并可能产生一定的费用。

在主流社交网站上共享照片
现在您可以通过“我的手机空间”Web 帐户或手机轻松便捷地将照片发布到 Facebook、Flickr、MySpace 和 Windows Live。

节省手机空间
当您从手机中删除内容后,仍然可以通过您的 Web 帐户访问这些内容(直到从存档文件夹中删除)。

 

得知此版本的更新,我也迫不及待的把我手机上的版本进行了升级,总的说来,比先前的版本更好用了,其实我用得最多的,还是同步联系人信息的功能。推荐有Windows Mobile手机的同学都来体验一下,手机下载地址:http://myphone.microsoft.com/install

Blog updated

115 views 七月 31, 08 by Timothy

今天上网才发现,原来PJBlog有更新了。去作者主页看了看,才知道原来发布了一个V2.8的里程碑版本,后续还有一系列更新。于是我立马去把我的blog升级成PJBlog3了,呵呵。总体看来作者这次改动很大,尤其是blog后台界面,美化了不少的地方,还增加全静态化功能 ,提高了访问的性能。  文章表情也更新了很多。看来作者是下了大功夫的,不更新太对不起作者的劳动成果了    希望这个版本不会有太多的bug。
打完收工…… 
 

Linq to SQL 的更新冲突与管理

258 views 七月 03, 08 by Timothy

前段时间工作中的一个新需求,有机会用到了Linq to SQL。使用后的第一感觉,就是方便很多,也为整个项目节约了一大把的开发时间,甚至代码量也少了很多。不过在程序的实际运行中,始终会遇到一些莫名其妙的异常,最令人不解的,就是“System.Data.Linq.ChangeConflictException: Row not found or changed.” 。当初凭自己和同事的判断,可能是数据库的数据异常所导致,后来发觉这个异常出现得越来越频繁,于是上MSDN查了查,原来是Linq中一个常见的问题:更新冲突。
这个词说起来比较玄乎,其实再平常不过了。下面可以通过一个简单的例子,来重现这个异常。
建立一个普通的测试表:LinqTest(如图)

在测试表中,插入一条测试数据(如图)

测试代码如下:

[code]
namespace LinqTest
{
class Program
{
static void Main(string[] args)
{

TestDataContext db = new TestDataContext();

db.Log = Console.Out;
var result = from p in db.LinqTests
where p.ID == 1
select p;

var info = result.FirstOrDefault();

if(info != null) //插入断点
{
info.Age = 25;
db.SubmitChanges();
}

Console.ReadLine();

}

}

}
[/code]

在测试代码中,将DataContext的日志定向到Console的输出部分,这样方便我们观察Linq实际执行的SQL语句是什么。重现的时候,我们需要在注释的地方,插入断点进行测试。对于示例中的代码,在正常情况下,是不会有错误的。执行过后,我们可以在Console的输出中,看到实际执行的SQL语句(如图)

再进行第二次调试,首先,恢复Age的数据到以前的样子。下面我们运行到断点处,然后偷偷去SQL Server Management Studio中,手动修改数据,将原始数据中的Age,由24,改为22。然后回到VS2008的IDE,按F5继续运行程序,这个时候,你会发现异常出现了(如图)

再回到Console的输出,查看,执行的SQL语句和刚才的一样。这就是问题的所在,在正常运行状态下,Linq在运行时,会把数据库的数据缓存到实体对象中,这是一种理想化的情况,并且在更新时,Linq会默认把除更新字段外的所有字段,作为Update语句中的Where条件。但是,如果此时有另外的程序,在访问数据库,并修改数据库数据的时候,比如刚才把Age改为22。此时Linq缓存起来的数据和实际数据库中的数据产生了不一致的情况。Linq此时仍然把被修改过的字段,作为Update的Where条件,但是数据库中Age早就被我们改过了,不再是25,Where条件始终匹配不到原有的数据。这时,就会抛出所谓的:“System.Data.Linq.ChangeConflictException: Row not found or changed.”异常。

产生此异常,主要是Linq缓存数据和实际数据库数据不一致的情况造成。解决次问题的情况,主要有几种:

1.比较简单的方法,不使用Linq提供的SubmitChanges()方式提交更改,而直接执行SQL语句,例如:
db.ExecuteCommand(“Update [dbo].[LinqTest] SET Age=25 Where ID = @p0″, 1);
这样虽然比较方便,但是感觉又回到了直接写SQL的时代,毕竟Linq to SQL的目的,就是为了让我们看不见SQL,避免写复杂的SQL语句,而直接操作实体对象,这样也可以避免程序可读性差、不便于维护。所以除非万不得已,还是不太推荐使用此方法。

2.参考MSDN的资料,采用Linq提供的解决更新冲突的方法,在异常中捕获冲突,然后手动解决冲突:
[code]
try
{
db.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict);
}
catch (System.Data.Linq.ChangeConflictException ex)
{
foreach (System.Data.Linq.ObjectChangeConflict occ in db.ChangeConflicts)
{
//以下是解决冲突的三种方法,选一种即可

// 使用当前数据库中的值,覆盖Linq缓存中实体对象的值
occ.Resolve(System.Data.Linq.RefreshMode.OverwriteCurrentValues);

// 使用Linq缓存中实体对象的值,覆盖当前数据库中的值
occ.Resolve(System.Data.Linq.RefreshMode.KeepCurrentValues);

// 只更新实体对象中改变的字段的值,其他的保留不变
occ.Resolve(System.Data.Linq.RefreshMode.KeepChanges);
}

// 这个地方要注意,Catch方法中,我们前面只是指明了怎样来解决冲突,这个地方还需要再次提交更新,这样的话,值 //才会提交到数据库。
db.SubmitChanges();
}

[/code]

3. 这个方法也比较简单,也即MSDN中所说的Pessimistic Concurrency Control 。 我们可以来设定哪些字段需要放入Where条件,哪些字段不需要,这样就可以控制更新时候的条件匹配尺度。具体做法,就是在Linq to SQL Designer中,把一些字段的UpdateCheck属性设置为Never,这样,这些字段在更新的时候,就不会再出现在Where条件中了。其实比较推荐的做法,就是在表中设立主键,因为更新的时候,只要把主键作为Where条件,就可以单独的确立一行数据了。把除主键外的字段属性中UpdateCheck设置为Never即可。

关于Linq to SQL中如何管理更改冲突的更多资料,可以在MSDN找到

http://msdn.microsoft.com/zh-cn/library/bb399389.aspx