Tuesday, February 26, 2008

Implementing the Singleton Pattern in C#

Implementing the Singleton Pattern in C#

Implementing the Singleton Pattern in C#

The singleton pattern is one of the best-known patterns in software engineering. Essentially, a singleton is a class which only allows a single instance of itself to be created, and usually gives simple access to that instance. Most commonly, singletons don't allow any parameters to be specified when creating the instance - as otherwise a second request for an instance but with a different parameter could be problematic! (If the same instance should be accessed for all requests with the same parameter, the factory pattern is more appropriate.) This article deals only with the situation where no parameters are required. Typically a requirement of singletons is that they are created lazily - i.e. that the instance isn't created until it is first needed.

There are various different ways of implementing the singleton pattern in C#. I shall present them here in reverse order of elegance, starting with the most commonly seen, which is not thread-safe, and working up to a fully lazily-loaded, thread-safe, simple and highly performant version. Note that in the code here, I omit the private modifier, as it is the default for class members. In many other languages such as Java, there is a different default, and private should be used.

All these implementations share four common characteristics, however:

  • A single constructor, which is private and parameterless. This prevents other classes from instantiating it (which would be a violation of the pattern). Note that it also prevents subclassing - if a singleton can be subclassed once, it can be subclassed twice, and if each of those subclasses can create an instance, the pattern is violated. The factory pattern can be used if you need a single instance of a base type, but the exact type isn't known until runtime.
  • The class is sealed. This is unnecessary, strictly speaking, due to the above point, but may help the JIT to optimise things more.
  • A static variable which holds a reference to the single created instance, if any.
  • A public static means of getting the reference to the single created instance, creating one if necessary.

Note that all of these implementations also use a public static property Instance as the means of accessing the instance. In all cases, the property could easily be converted to a method, with no impact on thread-safety or performance.

First version - not thread-safe

// Bad code! Do not use!
public sealed class Singleton
{
static Singleton instance=null;

Singleton()
{
}

public static Singleton Instance
{
get
{
if (instance==null)
{
instance = new Singleton();
}
return instance;
}
}
}

As hinted at before, the above is not thread-safe. Two different threads could both have evaluated the test if (instance==null) and found it to be true, then both create instances, which violates the singleton pattern. Note that in fact the instance may already have been created before the expression is evaluated, but the memory model doesn't guarantee that the new value of instance will be seen by other threads unless suitable memory barriers have been passed.

Second version - simple thread-safety

public sealed class Singleton
{
static Singleton instance=null;
static readonly object padlock = new object();

Singleton()
{
}

public static Singleton Instance
{
get
{
lock (padlock)
{
if (instance==null)
{
instance = new Singleton();
}
return instance;
}
}
}
}

This implementation is thread-safe. The thread takes out a lock on a shared object, and then checks whether or not the instance has been created before creating the instance. This takes care of the memory barrier issue (as locking makes sure that all reads occur logically after the lock acquire, and unlocking makes sure that all writes occur logically before the lock release) and ensures that only one thread will create an instance (as only one thread can be in that part of the code at a time - by the time the second thread enters it,the first thread will have created the instance, so the expression will evaluate to false). Unfortunately, performance suffers as a lock is acquired every time the instance is requested.

Note that instead of locking on typeof(Singleton) as some versions of this implementation do, I lock on the value of a static variable which is private to the class. Locking on objects which other classes can access and lock on (such as the type) risks performance issues and even deadlocks. This is a general style preference of mine - wherever possible, only lock on objects specifically created for the purpose of locking, or which document that they are to be locked on for specific purposes (e.g. for waiting/pulsing a queue). Usually such objects should be private to the class they are used in. This helps to make writing thread-safe applications significantly easier.

Third version - attempted thread-safety using double-check locking

// Bad code! Do not use!
public sealed class Singleton
{
static Singleton instance=null;
static readonly object padlock = new object();

Singleton()
{
}

public static Singleton Instance
{
get
{
if (instance==null)
{
lock (padlock)
{
if (instance==null)
{
instance = new Singleton();
}
}
}
return instance;
}
}
}

This implementation attempts to be thread-safe without the necessity of taking out a lock every time. Unfortunately, there are four downsides to the pattern:

  • It doesn't work in Java. This may seem an odd thing to comment on, but it's worth knowing if you ever need the singleton pattern in Java, and C# programmers may well also be Java programmers. The Java memory model doesn't ensure that the constructor completes before the reference to the new object is assigned to instance. The Java memory model underwent a reworking for version 1.5, but double-check locking is still broken after this without a volatile variable (as in C#).
  • Without any memory barriers, it's broken in the ECMA CLI specification too. It's possible that under the .NET 2.0 memory model (which is stronger than the ECMA spec) it's safe, but I'd rather not rely on those stronger semantics, especially if there's any doubt as to the safety. Making the instance variable volatile can make it work, as would explicit memory barrier calls, although in the latter case even experts can't agree exactly which barriers are required. I tend to try to avoid situations where experts don't agree what's right and what's wrong!
  • It's easy to get wrong. The pattern needs to be pretty much exactly as above - any significant changes are likely to impact either performance or correctness.
  • It still doesn't perform as well as the later implementations.

Fourth version - not quite as lazy, but thread-safe without using locks

public sealed class Singleton
{
static readonly Singleton instance=new Singleton();

// Explicit static constructor to tell C# compiler
// not to mark type as beforefieldinit
static Singleton()
{
}

Singleton()
{
}

public static Singleton Instance
{
get
{
return instance;
}
}
}

As you can see, this is really is extremely simple - but why is it thread-safe and how lazy is it? Well, static constructors in C# are specified to execute only when an instance of the class is created or a static member is referenced, and to execute only once per AppDomain. Given that this check for the type being newly constructed needs to be executed whatever else happens, it will be faster than adding extra checking as in the previous examples. There are a couple of wrinkles, however:

  • It's not as lazy as the other implementations. In particular, if you have static members other than Instance, the first reference to those members will involve creating the instance. This is corrected in the next implementation.
  • There are complications if one static constructor invokes another which invokes the first again. Look in the .NET specifications (currently section 9.5.3 of partition II) for more details about the exact nature of type initializers - they're unlikely to bite you, but it's worth being aware of the consequences of static constructors which refer to each other in a cycle.
  • The laziness of type initializers is only guaranteed by .NET when the type isn't marked with a special flag called beforefieldinit. Unfortunately, the C# compiler (as provided in the .NET 1.1 runtime, at least) marks all types which don't have a static constructor (i.e. a block which looks like a constructor but is marked static) as beforefieldinit. I now have a discussion page with more details about this issue. Also note that it affects performance, as discussed near the bottom of this article.

One shortcut you can take with this implementation (and only this one) is to just make instance a public static readonly variable, and get rid of the property entirely. This makes the basic skeleton code absolutely tiny! Many people, however, prefer to have a property in case further action is needed in future, and JIT inlining is likely to make the performance identical. (Note that the static constructor itself is still required if you require laziness.)

Fifth version - fully lazy instantiation

public sealed class Singleton
{
Singleton()
{
}

public static Singleton Instance
{
get
{
return Nested.instance;
}
}

class Nested
{
// Explicit static constructor to tell C# compiler
// not to mark type as beforefieldinit
static Nested()
{
}

internal static readonly Singleton instance = new Singleton();
}
}

Here, instantiation is triggered by the first reference to the static member of the nested class, which only occurs in Instance. This means the implementation is fully lazy, but has all the performance benefits of the previous ones. Note that although nested classes have access to the enclosing class's private members, the reverse is not true, hence the need for instance to be internal here. That doesn't raise any other problems, though, as the class itself is private. The code is a bit more complicated in order to make the instantiation lazy, however.

Performance vs laziness

In many cases, you won't actually require full laziness - unless your class initialization does something particularly time-consuming, or has some side-effect elsewhere, it's probably fine to leave out the explicit static constructor shown above. This can increase performance as it allows the JIT compiler to make a single check (for instance at the start of a method) to ensure that the type has been initialized, and then assume it from then on. If your singleton instance is referenced within a relatively tight loop, this can make a (relatively) significant performance difference. You should decide whether or not fully lazy instantiation is required, and document this decision appropriately within the class. (See below for more on performance, however.)

Exceptions

Sometimes, you need to do work in a singleton constructor which may throw an exception, but might not be fatal to the whole application. Potentially, your application may be able to fix the problem and want to try again. Using type initializers to construct the singleton becomes problematic at this stage. Different runtimes handle this case differently, but I don't know of any which do the desired thing (running the type initializer again), and even if one did, your code would be broken on other runtimes. To avoid these problems, I'd suggest using the second pattern listed on the page - just use a simple lock, and go through the check each time, building the instance in the method/property if it hasn't already been successfully built.

Thanks to Andriy Tereshchenko for raising this issue.

A word on performance

A lot of the reason for this page stemmed from people trying to be clever, and thus coming up with the double-checked locking algorithm. There is an attitude of locking being expensive which is common and misguided. I've written a very quick benchmark which just acquires singleton instances in a loop a billion ways, trying different variants. It's not terribly scientific, because in real life you may want to know how fast it is if each iteration actually involved a call into a method fetching the singleton, etc. However, it does show an important point. On my laptop, the slowest solution (by a factor of about 5) is the locking one (solution 2). Is that important? Probably not, when you bear in mind that it still managed to acquire the singleton a billion times in under 40 seconds. That means that if you're "only" acquiring the singleton four hundred thousand times per second, the cost of the acquisition is going to be 1% of the performance - so improving it isn't going to do a lot. Now, if you are acquiring the singleton that often - isn't it likely you're using it within a loop? If you care that much about improving the performance a little bit, why not declare a local variable outside the loop, acquire the singleton once and then loop. Bingo, even the slowest implementation becomes easily adequate.

I would be very interested to see a real world application where the difference between using simple locking and using one of the faster solutions actually made a significant performance difference.

Conclusion (modified slightly on January 7th 2006)

There are various different ways of implementing the singleton pattern in C#. A reader has written to me detailing a way he has encapsulated the synchronization aspect, which while I acknowledge may be useful in a few very particular situations (specifically where you want very high performance, and the ability to determine whether or not the singleton has been created, and full laziness regardless of other static members being called). I don't personally see that situation coming up often enough to merit going further with on this page, but please mail me if you're in that situation.

My personal preference is for solution 4: the only time I would normally go away from it is if I needed to be able to call other static methods without triggering initialization, or if I needed to know whether or not the singleton has already been instantiated. I don't remember the last time I was in that situation, assuming I even have. In that case, I'd probably go for solution 2, which is still nice and easy to get right.

Solution 5 is elegant, but trickier than 2 or 4, and as I said above, the benefits it provides seem to only be rarely useful.

(I wouldn't use solution 1 because it's broken, and I wouldn't use solution 3 because it has no benefits over 5.)

Friday, February 15, 2008

SQLite on .NET in 3 minutes. Download to querying in no time flat.

SQLite on .NET in 3 minutes. Download to querying in no time flat

SQLite on .NET - Get up and running in 3 minutes.

You found it! The quick and dirty guide to setting up SQLite with .Net in 3 minutes. Small, fast, and ass-kicking like a transactional Jackie Chan. At least that’s what this campy image created just for this post says. (Shout out to righteous graphics dude Brian Cook for the sweet photoshoppery)

SQLite on .Net, small, fast, ass-kicking.

SQLite: The compelling introduction
You’re writing some smallish app. You know the type. Those little one-offs where you clean up some data, scrape your competitor’s web site, change traffic light colors, blah blah blah. It’s cool enough to warrant it’s own solution, but not so big that you are going to tie into your company’s SQL Server instances. Let’s face it, you don’t really need the hassle of dealing power tripping DBA / IT guys for this project, especially now that their delusions of grandeur have been magnified by the return of American Gladiators to prime time.

Enter SQLite: the quick skinny / speed-date overview:
SQLite, if you weren’t already aware, is an open source, tiny (600K!), *zero install*, transactional database. But theres more! SQLite is as fast or faster than some of the big guys you use every day, largely because there is no server process, no listeners, no FD&C Yellow #5, none of that crapola. The database is just a single file and you communicate with it through a linked in library. Think of the old access days, but not really.

SQLite implements most of the SQL-92 standard. All of the query related stuff you actually care about is there, triggers, views, etc. The only thing missing is stored procedures but that’s probably not a requirement for your project, if at all. And no, I don’t want to get in to the old sps vs. not-sps tangent, man thats so aggressively nerdy in a Kirk vs Picard way.

… But I digest….

As the the SQLite home page will happily tell you, “SQLite is the most widely deployed SQL database engine in the world.” It’s used by little guys you may have heard of like, oh, I don’t know, Adobe, Apple, FireFox, GE, Google, Skype, Sun, and several shadow governments best left un-named. The crazy part is that you rarely hear about SQLite as a real .Net Dude / Dudette developer. I think this is because it’s often bundled inside of things you didn’t really think were using a database like FireFox or Google Gears, but the research bears out that this bad boy is more than capable for real-life tasks like being the back-end db for dynamic web sites with some pretty serious traffic.

SQLite is great for that small-mediumish application we already spec-ed out so lets get into the quick and dirty setup to get this hog rockin’ on .NET.

SQLite : The Quick and Dirty Setup for .NET.

1) Download SQLite
While you can get the generic windows binary on the SQLite download page, I’m going to recommend you instead grab the ADO.NET 2.0 Provider for SQLite from sourceforge. I’m not saying this is the most performant version (it does have an ADO wrapper with its attendant malarkey), but it really is a super-easy starting implementation that’s probably good enough for the long haul.

2) Copy the resultant DLL (System.Data.SQLite.DLL) to your project and add a reference.

3) Download and install one of the billions of SQLite GUI clients. I’ve been using the aptly named “SQLite Administrator” (FREE) which has a sweet, Query Analyzer-alike interface. You can find a big list of SLQLite gui clients here http://www.sqlite.org/cvstrac/wiki?p=ManagementTools if you are so inclined.SQLite administrator tool, free and badassed.

4) Through the GUI, create a database and make a test table of whatever floats your boat. The result will be a single file with a .s3db extension.

5) There is no step 5! DONE! You can now query, insert, update, delete, create, truncate, etc, to your heart’s content using the System.Data.SQLite ADO wrapper. Here is a little helper db util type class to show you the basic schleck:

public static DataTable GetDataTable (string sql)

{

DataTable dt = new DataTable();

try

{

SQLiteConnection cnn = new SQLiteConnection(“DataSource=C:CheckoutWorldDominator.s3db”);

cnn.Open();

SQLiteCommand mycommand = new SQLiteCommand(cnn);

mycommand.CommandText = sql;

SQLiteDataReader reader = mycommand.ExecuteReader();

dt.Load(reader);

reader.Close();

cnn.Close();

} catch {

// Catching exceptions is for communists

}

return dt;

}public static int ExecuteNonQuery(string sql)

{

SQLiteConnection cnn = new SQLiteConnection(“Data Source=C:CheckoutWorldDominator.s3db”);

cnn.Open();

SQLiteCommand mycommand = new SQLiteCommand(cnn);

mycommand.CommandText = sql;

int rowsUpdated = mycommand.ExecuteNonQuery();

cnn.Close();

return rowsUpdated;

}

public static string ExecuteScalar(string sql)

{

SQLiteConnection cnn = new SQLiteConnection(“DataSource=C:CheckoutWorldDominator.s3db”);

cnn.Open();

SQLiteCommand mycommand = new SQLiteCommand(cnn);

mycommand.CommandText = sql;

object value = mycommand.ExecuteScalar();

cnn.Close();

if (value != null)

{

return value.ToString();

}

return “”;

}

NOTE: Above code is quicky crap. It’s just to show you the gist.

Some uses for SQLite to consider:

Configs / Settings: SQLite is a good alternative to xml config files or registry settings for things like user account info and application preferences. It supports encryption, so feel free to keep your brilliant patent ideas in there.

Persistent Caching: You can use SQLite as a DB for cache data that needs to persist through reboots / application recycles. Maybe you have some expensive one-time-on-loadup queries from your enterprise db that you cache up and use in your website or app. By timestamping the data into a local SQLite db, you can live through application restarts and only refresh your cache at the threshold you want to.

Slicing and Dicing data: Load in some data and query to your heart’s content. Great for analyzing data at your leisure, worming through subsets of data, etc. Since its just a little db on your on box, no one is going to hassle you. Managers who were once developers will appreciate being to query through data with SQLite vs. using excel as they usually are too crusty to still have permissions on the real db.

Full DB for One-off apps: Sometimes you write a quickie app that just harvests something in a funky way and collects data. You can output the data as you are grabbing it in all kinds of ways, but throwing into a db is ideal.

Linkage to some more in-depth stuff ……….

- SQLite is pretty hip with with the alt.net scene, you can follow on from here to check out a SQLite NHibernate provider, or here for a SQLite Subsonic provider.

- If you are rockin’ the 3.0 framework there is even a SQLite Linq provider.

- For a comprehensive SQLite how-to (emphasizing command line, non-MS specific) : SQLite Tutorial

- And in case you missed it up top, the main SQLite project page is here.

But football in the groin had a football in the groin!Have a good idea for ways to use SQLite in .Net projects? Been hit in the groin with a football for even suggesting using something like this at your company? Have some award-winning successes or outlandish failures already with SQLite? Leave a funky-fresh comment!

Thursday, February 7, 2008

10个最好用搜索网站出炉 试问Google缘何落榜?

10个最好用搜索网站出炉 试问Google缘何落榜?
互联网时代带来不仅仅是技术上的革命,给我们的日常生活也带来实实在在的改变。理论上,来自全世界的消息,新闻以及评论我们都可以通过点击鼠标轻松 浏览。但是如果要准确的找到所要的东西并非易事。用好英国《每日电讯报》介绍的10个独特的搜索网站,也许你才可以在英文资源占主导的互联网上变成一个真 正的 “冲浪者”。

在全世界数以十亿计的网页面前,不少人会感到迷 茫。根据AOL(美国在线服务公司,是美国最大因特网服务提供商之一)的最新研究表明,有一半以上的英国互联网用户承认他们在海量的网络信息中“迷失”。 对于许多人来说,他们的网络历程仅仅从“google”开始,也从“google”结束。

每年“损失”15天

调查显示,有将近三分之一的被调查者把这归罪于网络可得到的信息太多,更多的三分之二的人则表示网上的信息缺乏准确性和可靠性的管理。据统计,想要在网上找信息,却不知如何下手而漫无目的的“闲逛”,这样的时间每年将浪费15天之多。

其中,的确有一些人的上网习惯一开始就没有改变过来。的确,“google”搜索引擎毫无疑问是一个寻找网络资源的必到之地,但是在某些方面,它却做得不是最快和最好的。因为它只是一个被动的搜索,它并没有在所搜索的前后连贯性以及可靠性上给你帮助。

在这里,英国媒体选出的10个最好的搜索网站,每个人都应该把他们放在自己的网页收藏夹里。因为它会帮助你更容易的找到你所想要的信息。这样你就不会在虚拟的网络世界里“迷失”自己。

知识类

世界知识

网站地址:tinyurl.com/2b2kg9

这个网站由CIA(美国中央情报局)提供信息和庞大的统计数据,在这里你可以找到世界上所有国家的情报,包括国旗,地图,历史等等。

问题问答

网站地址:www.answers.com

在这个网站你可以问任何问题,网站不仅会搜索出问题的答案,甚至还会列出相关的问题以供参考。其中你可以点击“超链接”来查看答案的原始来源。

图书索引

网站地址:www.lii.org

有时候网上搜索到的消息并不能让你相信,但是在这里你可以打消这个顾虑。这个由美国的图书管理员运营的网站的正确性和可靠性,连“维基百科”也要参考其答案。它对于健康,生命或者客观物质等等知识的搜索有着更好的结果。

音乐类

音频资料

网站地址:www.skreemr.com

想要在网上找到歌曲的片断,或者一次著名演讲的音频资料吗?skreemr网站能够做到这一切,它的搜索范围包括互联网上能够找到的所有音乐文件的索引。此外,它还可以告诉你在那里可以买到合法的音乐制品。

歌词总汇

网站地址:www.lyricsfreak.com/

和音乐产业中的规范化相比,这个网站给了众多的不入流艺术家更大的舞台。这个网站的歌词数据库,包含了几千支乐队以及独立艺术家创作的歌词。

服务类

软件下载

网站地址:www.download.com

如果想要在网上下载软件,这个网站也许是你的最好选择。在这里,你可以找到几千个软件,其中大部分是免费的,还有一些只是象征性的收费。虽然软件的更新速度很快,但是这里却保留着许多软件的老版本。

搜索一把抓

网站地址:www.turboscout.com

网上的搜索引擎服务不少,却不知道哪一个最好用。turboscout网站集成了70多个搜索引擎的搜索服务,无论是网页,图片,还是博客,音频/视频都可以一网打尽!

休闲类

旅游顾问

网站地址:www.tripadvisor.com

毫无疑问,tripadvisor网站是旅游方面信息做得最好的网站。甚至有人说,在你来过网站之前千万不要提前预定房间。来访者在这里留下最真诚,客观的评价,给你外出旅游提供最好的忠告。

杂志浏览

网站地址:www.fabsearch.com

没有时间去翻阅众多的杂志?也许这个网站可以帮到你,它把《Elle》,《闲谈者》,《名利场》,《vogue》等杂志上最好的话题都拿到了网上,并且按照城市来区分相关问题方便人们的浏览。

经典怀旧

网站地址:www.summize.com

这个网站也许是怀旧人士的最爱,它并不提供最新的信息,但是在这里你可以找到年代久远的游戏,电影,书籍甚至还有电视节目。

15个世界最顶级的技术类博客网站 - 文学城

15个世界最顶级的技术类博客网站
在互联网世界当中,博客网站的种类是多种多样的。它们中的一些旨在教导、帮助人们交流协作、激发灵感,并拓展我们的思维空间。而另一些博客则侧重于激 发我们的情感,让我们感到愤怒,或是让我们开怀大笑。《电脑世界(Computerworld)》网站的编辑们这些优秀博客网站搜集整理在了一起,为我们 提供了一份最受他们所钟爱的博客网站的列表。最后,我们根据这些博客自身的信息广度、新闻价值、网站设计、更新频率以及娱乐价值,将这份50多位候选人的 大名单做了进一步的缩减,最终得到了这份15个世界最顶级的技术类博客网站排行榜。

  不错,这份排名的确包含了很大的主观成分,但是我们认为它是有史以来发表过的此类博客网站的最棒的排行榜之一。这份名单所涵盖的范围非常广泛:从严肃 的技术性新闻,到对电脑游戏测评和评论,再到新潮消费者电子产品介绍。我们同时也在本份名单的最后增加了一些“荣誉提名”,因为这次排名的竞争是如此的激 烈,让我们感到很难取舍。

  当然了,肯定不会是每一个人都赞同我们的观点。如果你认为有某个博客网站非常的优秀,而又没有出现在我们的“前15名排行榜“中的话,请在本文后面的评论当中留言与我们分享。

1) 生活骇客(Lifehacker)

http://www.lifehacker.com

  生活骇客(Lifehacker)的座右铭表达了它的全部理念:“不要为技术而生活,要为生活而关注技术!”这个博客提供了有关于各方各面的“时间节省”小贴士,从Firefox网络浏览器的快捷操作,到来自“时间管理教”忠实信徒的谆谆教诲。

2) IT工具箱博客(IT Toolbox Blogs)

http://blogs.ittoolbox.com

IT工具箱博客(IT Toolbox Blogs)有着一大群“战斗在第一线”的IT专家们讨论有关于技术和IT管理的话题。它拥有一系列专业性的博客在处理跟IT安全、数据库、项目管理和其它等等相关的问题。这是一个包罗万象的网站。

3) 硅谷闲话(Valleywag)

http://valleywag.com

“众口铄金,积毁销骨”。硅谷闲话(Valleywag)是专门为那些相信“在技术行业中的生死在很大程度上都取决于硅谷周围所传播的闲话”的人准备的。对于那些热衷于制造、听闻和传播硅谷谣言的那些人来说,这个网站凭借着其卓越的“专业素养”而让人大为惊叹。

4) Kotaku

http://kotaku.com

Kotaku是电脑游戏爱好者的“加油站”。它拥有跟电脑游戏有关的一切,从对游戏的测评,到相关的讨论和扯淡,再到作弊技巧。这里有你所需要的一切,比如某款游戏到哪里去购买,以及怎样进行玩耍。

5) 威胁空间(DangerRoom)

http://blog.wired.com/defense

  《连线(Wired)》杂志所推出的军事和防卫博客网站,它向读者介绍了这个世界上最新、最酷、最令人震撼的军事技术——更不用提那些丑闻、争论和其它类型的军事新闻。网站中还提供了许多视频和图片。

6) 小发明(Gizmodo)

http://gizmodo.com

  小发明(Gizmodo)网站专门为读者挖掘全世界最新、最酷、或是最稀奇古怪的技术发明——从高清晰电视、到咖啡机、到弹力腰带,再到USB驱动器。是的,他们同样也发布那些严肃的技术性新闻。

7) O’Reilly 雷达(O’Reilly Radar)

http://radar.oreilly.com

这是你能够阅读到TimO’Reilly(著名的O’Reilly出版公司的创始人)和其它人讨论有关于网络、编程、开放源代码运动、知识产权、政策、Web2.0和其它前沿科技的地方。

8) 技术丑闻(Techdirt)

http://www.techdirt.com

  技术丑闻(Techdirt)是一个话题中心,以在当前的互联网和电脑领域的热门事件上引发激烈争论而闻名。流言蜚语是它的所爱!简洁是它的特点!

9) Groklaw

http://www.groklaw.net

Groklaw网站的原本存在目的是支持SCO公司对IBM和Novell公司所发起的漫长的专利侵权诉讼,但是不知道什么时候,这里的讨论转向了其它方面,话题包括了技术、知识产权以及政府法规。

10) 改造一整天(Hack a Day)

http://www.hackaday.com

  想要学习怎样为一个廉价的Linux路由器添加一个USB设备吗?想要制作一个蛇形机器人吗?或是将自己的XBox360游戏机改造成一台笔记本?“改造一整天(Hack a Day)”上提供了这些地下室项目,以及其它更多有趣的项目。这个网站是为那些真正有一定技术素养,喜欢自己动手改造技术产品的玩家所准备的。但与此同时,你也可以在这里发现很多乐趣,说不定还会从中开发出一项新的爱好。

11)小玩意儿(Engadget)

http://www.engadget.com

  就像可口可乐和百事可乐的关系一样,小玩意儿(Engadget)和小发明(Gizmodo)就像是一对孪生兄弟。它也是专注于技术产品相关的介绍、 评论,有时候也会有充满激情的演讲和辩论。小玩意儿(Engadget)上充满了摄制精美的产品图片,而它网站的编辑们还有着广泛的内部渠道,可以在新潮 的技术产品还处于先期或早期发布阶段,就可以一睹它们的芳容。同样的,小玩意儿(Engadget)上面也会刊登一些真正非常有趣的手工制作的玩意儿。但 是,我们更喜欢小发明(Gizmodo)一点。

12) Feedster

www.feedster.com/feedpapers/Technology

  一切都是那么的水到渠成。这个网站汇集了各种各样的博客站点,包括技术类、体育类、名人八卦、美食、个人体验等等等等——只要你能想到的,它都拥有。 同时,它还提高了卓越的站内搜索功能,以及一个非常酷的RSS新闻阅读软件。它在技术新闻里面加入了非常出色的幽默感。这真是一个各方面都很优秀的网站。

13) 永远的骇客(ForeverGeek)

http://forevergeek.com

  永远的骇客(ForeverGeek)是一个非常棒的网站,它有无数的博客文章,覆盖了多种多样的话题,从技术,到大众新闻,到好莱坞电影,再到电脑游戏测评。这绝对是一个骇客的天堂。假如你想要了解即将上映的好莱坞巨片《变形金刚》的最新消息,或是阅读一篇有关于PhotoshopCS3软件的测评,这就是你应该去的地方。

14)粗鲁的文字(RoughType)

www.roughtype.com

Nick Carr(笔名“Does IT Matter?”)撰写的一个思想锐利的博客,专门讨论与技术相关的各种各样的话题和趋势。他的文章文笔优美,让人阅读起来津津有味,但是同时也会常常激烈那些被批评的公司、人物、技术和政策。

15) 自助餐(Smorgasbord)

www.smorgasbord.net

  作为一个为那些喜爱数码产品和电脑游戏的骇客们所专门打造的站点,这个网站同样也提供最新的有关于政治和名人的新闻。这种娱乐价值和技术新闻的战略组合,让自助餐(Smorgasbord)跻身于最优秀者的行列。

荣誉提名:

1) 苹果(Apple)非官方博客 (TUAW)

www.tuaw.com

TUAW集结了许多独立的博客——这些独立的博客虽然和苹果公司官方没有正式的关系,但是这并不意味着他们的信息不充分、意见没有影响力。这是一个了解苹果公司相关新闻的最好来源。它没有跻身前15名的唯一原因是它太过于专注于一个单一话题。

2) Elliot Back 的博客(Elliot Back’s blog)

http://elliottback.com/wp

  作为自封的“计算机科学家”,Elliot对于每一件自己所关注的事情大放厥词,从为什么XML标准很糟,到泰坦尼克号的旅客名单,再到对好莱坞巨片 《斯巴达300勇士》的影评。这个网站的内容多种多样,但是安排巧妙。此外,他还会提供一些非常棒的小贴士,比如如何增进系统的性能,以及屏蔽垃圾邮件。

3) Ed Foster 的牢骚录(EdFoster’s Gripelog)

www.gripe2ed.com/scoop

时下有一类新的博客网站涌现了出来,它们专门抨击和曝光那些侵害消费者权益的公司和产品,诸如数码产品恶劣的售后服务、粗糙的产品外观或是其他诸如此类的一些问题,但是EdFoster可谓是这一行的开山鼻祖。看看他最新所关注的一些话题:有缺陷的DRM系统、plasma品牌电视机的质保陷阱,以及糟糕的移动电话服务质量。

4) Gadgetell

www.gadgetell.com

  假如你想要了解最新的数码产品、电玩游戏新闻,以及其他相关的一些消息,这是一个很棒的网站。

5) 4sysops

http://4sysops.com

  它为Windows系统的管理员们提供了非常优秀的小提示和操作教程。

如何发掘出更多退休的钱?

如何发掘出更多退休的钱? http://bbs.wenxuecity.com/bbs/tzlc/1328415.html 按照常规的说法,退休的收入必须得有退休前的80%,或者是4% withdrawal rule,而且每年还得要加2-3%对付通胀,这是一个很大...