Hashemian Blog
Web Tools, Financial Markets, Technology
Sunday, June 29, 2008
RSS/ATOM SyndicationFeed in .NET 3.5 Framework
Among some of the new classes introduced in Version 3.5 of the .NET Framework Class Library (FCL) were the syndication-related classes. While other technologies such as LINQ, extension methods and lambda expressions have been grabbing most of the attention the new syndication classes also deserve a nod. Part of the System.ServiceModel.Syndication namespace the classes offer a variety of methods to easily generate or consume syndication feeds in RSS 2.0 or ATOM 1.0 formats.
It's not that reading or writing feeds were exceedingly difficult before. FCL comes with a number of XML classes that facilitate working with XML data which all syndication feeds emanate from. No doubt there are plenty of sample code out there that made the task as easy as copy, paste and tweak. But now FCL comes with its own native classes to handle feeds, with advanced settings, intellisense, and potential of extension.
To demonstrate ease of use, here's a sample code that pulls in a sample feed from Google, and scrapes and saves the content of each link to a file:var wc = new WebClient(); using (var rss = XmlReader.Create( "http://finance.google.com/finance?morenews=10&q=NASDAQ:INTC&output=rss")) { var feed = SyndicationFeed.Load(rss); foreach (var x in feed.Items) { var uri = x.Links.Last().Uri; wc.DownloadFile(uri, @"c:\rss\" + Regex.Replace(uri.LocalPath, @"^.*/", "")); } } That was easy, eh? Just remember to add System.ServiceModel.Web.dll as a reference to your project. Happy syndicating.
rss,atom,microsoft,net,asp.net,xmlLabels: programming < RSS/ATOM SyndicationFeed in .NET 3.5 Framework>
// posted by rh
Wednesday, June 18, 2008
DNS Mystery, NameServers, IP addresses
Today I was trying to reach 1&1's home page, but the browser kept failing to pull up the site. Mysteriously I was able to reach 1&1's home page when I changed my DNS servers to those of OpenDNS.org. Feeling curious I decided to investigate the matter in depth. My default DNS server was reporting the IP address of www.1and1.com to be 217.160.232.1. While that address belongs to 1&1, it's really one of their routers or gateways and not a Web server. No wonder I was unable to access the site. the working IP address reported by OpenDNS.org and a number of other DNS servers was 217.160.226.203. That is indeed the correct IP address for www.1and1.com. So why was I seeing different results from different DNS servers?
As you may know the job of translating a host name to an IP address falls on a program known as the resolver which queries its designated DNS server for the answer. If the DNS server can not produce the translation (from its cache or authority zone), it issues what it's know as a recursive query to the DNS network on the Internet. The host name is broken to its fragments and each fragment from right to left is queried successively. The results generally consists of hosts known as NameServers, which get the query one step closer to the final result. The final NameServers produce the IP address translation. However, if any of the NameServers along the way can produce the translation, the query stops and the IP address is sent back to the resolver.
Using the Unix/Linux dig command I followed the name resolution for www.1and1.com one step at a time. Results are shown here and shortened for brevity.
This command displays the root servers:# dig ;; ANSWER SECTION: . 451081 IN NS M.ROOT-SERVERS.NET. . 451081 IN NS A.ROOT-SERVERS.NET. . 451081 IN NS B.ROOT-SERVERS.NET. . 451081 IN NS C.ROOT-SERVERS.NET. This command queries one of the root servers and produces NameServers for "com." TLD (Top Level Domain):# dig +norec @A.ROOT-SERVERS.NET www.1and1.com ;; AUTHORITY SECTION: com. 172800 IN NS K.GTLD-SERVERS.NET. com. 172800 IN NS L.GTLD-SERVERS.NET. com. 172800 IN NS M.GTLD-SERVERS.NET. com. 172800 IN NS A.GTLD-SERVERS.NET. This command queries one of the "com." NameServers:# dig +norec @A.GTLD-SERVERS.NET www.1and1.com ;; ANSWER SECTION: www.1and1.com. 172800 IN A 217.160.232.1 ;; AUTHORITY SECTION: 1and1.com. 172800 IN NS ns27.1and1.com. 1and1.com. 172800 IN NS ns28.1and1.com. Generally the previous command shouldn't produce and IP address, instead the authority section would prompt a final query to one of the 1and1.com NameServers (which by the way have the correct IP translation.) Instead somehow an IP address is produced at this level and the query ends with this inaccurate IP translation. I've tried the same query with the homepage URL's of Microsoft, Google, Yahoo and a few other sites and none return an IP address at this level.
It remains to be seen if this erroneous translation would eventually spread around, causing 1&1's homepage to become widely inaccessible. Anyone knows how that IP translation ended up in of the "com." NameServers? Am I making wrong assumptions here? Feel free to let me know.
dns,nameservers,domain names,ip addresses,internetLabels: internet, networks, web < DNS Mystery, NameServers, IP addresses>
// posted by rh
Monday, June 02, 2008
The Inverted CD Yields
I was checking ING DIRECT's CD (Certificates of Deposit) rates today and wondered how long will they continue to be inverted. A 6-month CD currently has an APY of 3.3%, while that of a 4-year CD stands at 2.5%.
What I would really like to see is a normal curve, where the longer the CD term, the higher its yield. Bank yields generally follow the economy and when you see this type of anomaly, one interpretation is that there's more uncertainty with the short-term economic outlook than that of the long-term. Another way to put it, there is more perceived risk in the short-term and hence the investment rewards are higher.
So what is the person with a long-term goal to do? My approach is not lock in my money for such a long time when shorter rates pay nearly a full percentage more. That can amount to quite a bit of interest. Sure, there's always the risk of buyer's remorse if the rates headed lower, but to me eschewing the long-term, low-yield CD is a calculated risk.
I would opt for a short-term, higher-yielding CD and keep rolling it over until the longer-term CD rates become more favorable. In fact, it may make sense to completely bypass CD's for a savings account with a decent rate. ING DIRECT's savings account currently has a 3% APY, and the funds remain completely liquid with no early withdrawal penalties. If and when CD rates become more enticing, one can quickly kick some money from the savings account into a CD.
savings accounts,banks,cd,apy,apr,yields,interest ratesLabels: financial, money < The Inverted CD Yields>
// posted by rh

|
Links
Technorati Profile
TMCnet.com
ARCHIVES
09/01/2003 - 10/01/200303/01/2004 - 04/01/200404/01/2004 - 05/01/200405/01/2004 - 06/01/200406/01/2004 - 07/01/200407/01/2004 - 08/01/200408/01/2004 - 09/01/200409/01/2004 - 10/01/200410/01/2004 - 11/01/200411/01/2004 - 12/01/200412/01/2004 - 01/01/200501/01/2005 - 02/01/200502/01/2005 - 03/01/200503/01/2005 - 04/01/200504/01/2005 - 05/01/200505/01/2005 - 06/01/200506/01/2005 - 07/01/200507/01/2005 - 08/01/200508/01/2005 - 09/01/200509/01/2005 - 10/01/200510/01/2005 - 11/01/200511/01/2005 - 12/01/200512/01/2005 - 01/01/200601/01/2006 - 02/01/200602/01/2006 - 03/01/200603/01/2006 - 04/01/200604/01/2006 - 05/01/200605/01/2006 - 06/01/200606/01/2006 - 07/01/200607/01/2006 - 08/01/200608/01/2006 - 09/01/200609/01/2006 - 10/01/200610/01/2006 - 11/01/200611/01/2006 - 12/01/200612/01/2006 - 01/01/200701/01/2007 - 02/01/200702/01/2007 - 03/01/200703/01/2007 - 04/01/200704/01/2007 - 05/01/200705/01/2007 - 06/01/200706/01/2007 - 07/01/200707/01/2007 - 08/01/200708/01/2007 - 09/01/200709/01/2007 - 10/01/200710/01/2007 - 11/01/200711/01/2007 - 12/01/200712/01/2007 - 01/01/200801/01/2008 - 02/01/200802/01/2008 - 03/01/200803/01/2008 - 04/01/200804/01/2008 - 05/01/200805/01/2008 - 06/01/200806/01/2008 - 07/01/200807/01/2008 - 08/01/200808/01/2008 - 09/01/2008
|