Yet another SilverLight 2 preview from Scott Guthrie. More like a teaser, as we don't have the CTP bits ready for download. No doubt about it, Scott's strategy to preview technology prior to it's release is becoming a perfect recipe for success. This "educate first, release latter" is a great way to market technology, as long as it continues getting presented by engineers - yes, could you imagine if this kind of teasers were presented by the marketing people?
Friday, February 29, 2008
First Look at Using Expression Blend with Silverlight 2
Posted by Mário Romano at Friday, February 29, 2008 0 comments
Labels: Development, Technology
Thursday, February 28, 2008
Web Client Software Factory 2.0 shipped
Posted by Mário Romano at Thursday, February 28, 2008 0 comments
Labels: Development, Practices
Install multiple versions of IE on your PC
I love Windows, it's a great family of OSs, but it has it's awkwardnesses. The one that bugs me the most is the installation subsystem.
Not everything on the installation subsystem is wrong. It's ok to have setups and settings in the right place. Uninstall is another story, but it could be worse. To be honest, the problem I have probably has more to do with application co-existence than with the installation sub-system...
Isn't it strange when can't have more then a version of an application installed on the some system? I've installed Mozilla Firefox 3 beta 3, and their they are, Firefox 2 and 3 working on my desktop. Why can't I do it with Internet Explorer?
<update>
Firefox 2 and 3 can in fact co-exist on the same machine, with a limitation: they cannot run simultaneously.
</update>
Well now we can. IE 3, 4, 5, 5.5, 6 and 7. Well, actually we could until last December:
A recent windows update broke the Multiple IE installation and unfortunately this means you'll have to reinstall Multiple IE to get it to work again. I haven't yet identified which update broke the installation.
It should be easier to isolate versions and environments. Will SoftGrid address this kind of isolation? Or should Windows get an intermediate virtualization tier?
Thank António Costa for the tip.
Posted by Mário Romano at Thursday, February 28, 2008 0 comments
Labels: Operating Systems, Technology
USB support on Virtual Machines
Virtual Server has an enormous limitation: it doesn't support USB (other than standard USB input hardware such as keyboard and pointing devices). But now there is a way to use USB on Virtual Server, through the network. And here's another one.
I was hoping this would be a transition solution, as Hyper-V is about to hit the market, but I was wrong: it seems like we'll have to wait for an Hyper-V R2.
Posted by Mário Romano at Thursday, February 28, 2008 0 comments
Labels: Technology
Wednesday, February 27, 2008
Windows Server 2008, Microsoft SQL Server 2008 and Microsoft Visual Studio 2008 Launched
The largest enterprise launch in Microsoft history includes Windows Server 2008, Microsoft SQL Server 2008 and Microsoft Visual Studio 2008; focuses on security, Web, virtualization and better business intelligence.
Not really news, but definitely a milestone for our business.
Here's bink.nu's announcement.
Posted by Mário Romano at Wednesday, February 27, 2008 0 comments
Labels: Technology
EU fines Microsoft record 899 million euros
Reuters announces:
BRUSSELS, Feb 27 (Reuters) - The European Commission fined Microsoft (MSFT.O: Quote, Profile, Research) a record 899 million euros ($1.35 billion) on Wednesday for defying sanctions imposed on the software giant for antitrust violations, far exceeding the original penalty.
The Commission, executive arm of the European Union, has now fined Microsoft 1.68 billion euros for its original violation and for failing to comply with sanctions, more than any other firm. It said no other company had ever ignored sanctions.
"Microsoft was the first company in 50 years of EU competition policy that the Commission has had to fine for failure to comply with an antitrust decision," Competition Commissioner Neelie Kroes said in a statement.
The Commission said in a landmark 2004 ruling -- upheld by an EU court last year -- that Microsoft had failed to provide needed interoperability information to rival makers of "work group server" software.
That software operates printers and sign-ons in small office groups, but to work must connect with desktop Windows machines.
Microsoft was ordered to provide interoperability information. Microsoft said it would, but only for large royalties. The Commission said that was unreasonable.
"I hope that today's decision closes a dark chapter in Microsoft's record of non-compliance with the Commission's March 2004 decision," Kroes said.
After fining Microsoft 407 million euros in 2004, the Commission fined it another 280.5 million euros in July 2006 for failing to comply with the sanctions through June 21, 2006. (Reporting by David Lawsky; Editing by Dale Hudson)
Oops...
Posted by Mário Romano at Wednesday, February 27, 2008 0 comments
Labels: Social
Silverlight served through WSUS
Let's start with the basics: as we all know, and for competition sake, browser enhancements must be served through plug-ins, and plug-ins cannot be installed out-of-the-box with browsers / OSs. So every time we install a browser and hit a page using Flash we have to download the plug-in.
Silverlight is no exception. As much as Microsoft would love to deploy Silverlight as a critical update, they just can't. What Microsoft can, and actually did back on January, is to release Silverlight as an optional update. This is particularly important for the IT guys, that can now easily deploy Silverlight through their infra-structures.
Does this favor Microsoft over Flash? Well yes, but not significantly, not enough to pose a juridical problem over their desktop monopoly. One thing is for sure: if Microsoft want's to beat the crap out of Flash, Silverlight will have to deserve the win, not only over IE and Windows, but over uncharted territories: Firefox, Safari, MacOS, Linux...
This is a David versus Goliath war where Microsoft plays the unfamiliar position of David. Adobe starts with all of the market, Microsoft starts with a superior technological product and plenty on resources to push it. Let the best won! For developers not hostile to Microsoft, clearly Silverlight, but let's not forget this is a war that must be settled by the customers.
Posted by Mário Romano at Wednesday, February 27, 2008 0 comments
Labels: Technology
Tuesday, February 26, 2008
Cool ways to write XML
Here are too cool ways to write XML. The first one depends on .NET 3.5:
XDocument xd = new XDocument(
new XDeclaration("1.0", "UTF-8", "yes"),
new XElement("root",
new XElement("user",
new XElement("username", "orca"),
new XElement("realname", "Mark S. Rasmussen"),
new XElement("description", "I'll handle any escaping (like < & > for example) needs automagically."),
new XElement("articles",
new XElement("article", new XAttribute("id", "25"), "Handling DBNulls"),
new XElement("article", new XAttribute("id", "26"), "Accessing my privates")),
new XElement("hobbies",
new XElement("hobby", "Fishing"),
new XElement("hobby", "Photography"),
new XElement("hobby", "Work")
)
)
)
);
And here is a cool ways using the fluent interface pattern:
XmlOutput xo = new XmlOutput()
.XmlDeclaration()
.Node("root").Within()
.Node("user").Within()
.Node("username").InnerText("orca")
.Node("realname").InnerText("Mark S. Rasmussen")
.Node("description").InnerText("I'll handle any escaping (like < & > for example) needs automagically.")
.Node("articles").Within()
.Node("article").Attribute("id", "25").InnerText("Handling DBNulls")
.Node("article").Attribute("id", "26").InnerText("Accessing my privates")
.EndWithin()
.Node("hobbies").Within()
.Node("hobby").InnerText("Fishing")
.Node("hobby").InnerText("Photography")
.Node("hobby").InnerText("Work");
This last doesn't depend on .NET 3.5, just a this cool library from Mark S. Rasmussen.
Posted by Mário Romano at Tuesday, February 26, 2008 0 comments
Labels: Development
CodeProject gets Silverlight Support
Here is the category: http://www.codeproject.com/kb/Silverlight/
Heard about it at Brad Abrams's blog.
Posted by Mário Romano at Tuesday, February 26, 2008 0 comments
Labels: Development
Sunday, February 24, 2008
Why I don't use Google Reader
As I've mentioned earlier, I read a lot of blogs daily (I pay special attention to about 150 feeds from a total of 450).
Here's my reading practice:
- I have a first go from my favorite ones from within my favorite list while... having breakfast!
- When I get to the office, I use FeedDemon's "Most Popular Posts" report to dig into what people are talking about;
- I bookmark articles I'm interested in for reading when I get back home;
- Back home I review interesting articles, finish reading my favorite list and post on devCatharsis;
As a blogger I have another problem: Google Reader proxies the reader's requests, so I loose the capability to characterize the requests (where they came from, which OS and browser). And yes, all this information is kept in Google...
Posted by Mário Romano at Sunday, February 24, 2008 0 comments
Labels: Tools
Saturday, February 23, 2008
You can look but you better not touch [Silverlight 2]
Scott Guthrie as announced they are going to release the first public beta of Silverlight 2 shortly. No fun, Scott, posting about something we cannot get our hands on... No fun...
Anyway, here's the link, and the new features:
- WPF UI Framework: Silverlight 2 includes a rich WPF-based UI framework that makes building rich Web applications much easier. In includes a powerful graphics and animation engine, as well as rich support for higher-level UI capabilities like controls, layout management, data-binding, styles, and template skinning. The WPF UI Framework in Silverlight is a compatible subset of the WPF UI Framework features in the full .NET Framework, and enables developers to re-use skills, controls, code and content to build both rich cross browser web applications, as well as rich desktop Windows applications.
- Rich Controls: Silverlight 2 includes a rich set of built-in controls that developers and designers can use to quickly build applications. This upcoming Beta1 release includes core form controls (TextBox, CheckBox, RadioButton, etc), built-in layout management panels (StackPanel, Grid, Panel, etc), common functionality controls (Slider, ScrollViewer, Calendar, DatePicker, etc), and data manipulation controls (DataGrid, ListBox, etc). The built-in controls support a rich control templating model, which enables developers and designers to collaborate together to build highly polished solutions.
Rich Networking Support: Silverlight 2 includes rich networking support. It includes out of the box support for calling REST, WS*/SOAP, POX, RSS, and standard HTTP services. It supports cross domain network access (enabling Silverlight clients to directly access resources and data from resources on the web). Beta1 also includes built-in sockets networking support.
- Rich Base Class Library: Silverlight 2 includes a rich .NET base class library of functionality (collections, IO, generics, threading, globalization, XML, local storage, etc). It includes rich APIs that enable HTML DOM/JavaScript integration with .NET code. It also includes LINQ and LINQ to XML library support (enabling easy transformation and querying of data), as well as local data caching and storage support. The .NET APIs in Silverlight are a compatible subset of the full .NET Framework.
Here are the tutorials Scott wrote:
Part 1: Creating "Hello World" with Silverlight 2 and VS 2008
Part 2: Using Layout Management
Part 3: Using Networking to Retrieve Data and Populate a DataGrid
Part 4: Using Style Elements to Better Encapsulate Look and Feel
Part 5: Using the ListBox and DataBinding to Display List Data
Part 6: Using User Controls to Implement Master/Details Scenarios
Part 7: Using Templates to Customize Control Look and Feel
Part 8: Creating a Digg Desktop Version of our Application using WPF
We are getting better UI control support. Hope we can get our hands on this soon.
[update]
Silverlight 2 applications can make cross-domain network calls. Cool!
Posted by Mário Romano at Saturday, February 23, 2008 0 comments
Labels: Development, Technology
Windows Server 2008 SP1
Windows Server 2008 is about to be released, with a twist: it already carries the first service pack!
Why are people making such a fuss about it? First, let take a look at SP definition according to Wikipedia:
A service pack (in short SP) is a collection of updates, fixes and/or enhancements to a software program delivered in the form of a single installable package
So the question is: can Windows Server get updates, fixes or enhancements prior to it's launch? Well it can, through Vista, sharing the codebase over the kernel.
How is this visible? Launch winver.exe both over Vista SP1 and Windows 2008 Server SP1, and you'll get the same version: "Version 6.0 (Build 6001: Service Pack 1)".
We expect new OS versions to introduce new problems and SP to solve them. So can we expect Windows Server 2008 to be more reliable because it comes installed with a paradoxical service pack? I believe so, sharing the kernel codebase is a guarantee of stability. The Vista SP1 vows for Windows 2008 Server. Linux does the some over their kernel, different distributions share a kernel on which people trust.
So what do we expect from Windows 2008 SP2? Probably it will be coincident with Vista SP2, and this will go on until a new server generation arises, or until Microsoft branches their OS versions from client and server.
[update]
Here's a cool post about it.
Posted by Mário Romano at Saturday, February 23, 2008 0 comments
Labels: Operating Systems
Bye bye VB6
Microsoft is finally ending its support for the Visual Basic 6 development tools on 8 April 2008. Microsoft will still support the VB6 runtime for the full lifetime of Vista (2017) and will continue to support Windows 2000, Windows XP and Windows 2003 for the support lifetime of these operating systems.
Though not a great fun of VB6 I've got to admit it left its mark on the turn of the century. And when we hear about companies that still depend upon VB6 10 years later, we just have to applaud this great tool for its lifetime, and to ask these guys: "are you disconnected from this planet? wake up!"
Posted by Mário Romano at Saturday, February 23, 2008 0 comments
Labels: Development, Tools
Wednesday, February 20, 2008
Microsoft to Authorize Proxy Fight at Yahoo
According to New York Times:
Unless Yahoo quickly reverses course and enters into talks, Microsoft would then seek to nominate a slate of directors to Yahoo’s board by March 13, the final deadline for nominations, and pursue a lengthy campaign to oust the board.
The move, expected to cost about $20 million to $30 million, was Microsoft’s alternative to raising its $44.6 billion bid and is seen as a less expensive way to put pressure on Yahoo’s board. Yahoo rejected Microsoft’s original offer as undervalued.
What started as a great idea to fight Google's monopoly is getting uglier. Naturally Microsoft would prefer a friendly deal, especially given the possibility of Yahoo employees leaving en masse if a bitter takeover fight erupts.
This is getting less and less a technological issue, and more of a financial one. Mental note to self: stop blogging about it...
Posted by Mário Romano at Wednesday, February 20, 2008 0 comments
Labels: Social
Windows XP SP3 RC2
Windows XP SP3 RC2 is now available via Windows Update. Just download and run this script on an SP2 XP and Windows Update will recognize your machine as a valid target for Windows XP Service Pack 3 RC2. Enjoy.
Posted by Mário Romano at Wednesday, February 20, 2008 0 comments
Labels: Operating Systems
Microsoft DreamSpark
Finally Microsoft has understood the obvious: providing professional developer and designer for students tools at no charge is the best way to evangelize young people.
Posted by Mário Romano at Wednesday, February 20, 2008 1 comments
Labels: Education
Monday, February 18, 2008
Finally got my hand on an eBook reader!
It's about time! My good friend Manuel Fonseca bought an Hanlin eReader, so I could finally get my hands on one of this gadgets. Thank god for China prices!
Here are my first impressions:
- my real first experience was: it seemed like a conventional device with one of those phony covers showing off features :)
- great reading experience!
- the size is bigger than I though; I can comfortably read eBooks;
- strange as it may seem, though lacking contrast (the background is kind of gray) it is still comfortable to read;
- the page swapping is just too ugly to be true - this devices usually flash the screen;
- half of battery disappeared over the weekend - Manuel did his best to hurry the first battery cycle; the operating time of the rechargeable battery is supposed to be about a month without recharging, based on an average use of 300 pages reading a day;
- the OS interface is not the most beautiful UI I came across;
- still buggy - Manuel complained about 2 restarts (over the first weekend) - too much for a non Windows CE device;
For me it is a great value for 300$. But then again, I have no other to compare with.
And here come the specs - from Hanlin site:
- Hanlin eReader V3 with VizplexTM
- Screen:600*800 6-inch e-Ink display (EPD), 4 levels of greyscale
- SDRAM : 32M Byte, Internal 2M NOR FLASH, SD card slot on the top of the device, memory extension up to 4GB
- CPU:Samsung Arm9 200Mhz
- OS: Linux OS
- Format Support: PDF,DOC,WOLF,MP3,HTML,TXT,CHM,FB2,
Djvu,PNG,TIFF,GIF,BMP,JPG. - Language Support: English, Chinese,
Russian, Ukraine, Turkish, French, Spanish, German, Dutch, Japanese, Korean, Bulgarian, Estonian, Polish and more is adding... - Accessories: 1 charger, 1 USB cable, 1 earphone, 1 battery and 1 hand band.
- Certificates: CE RoHS is applying
Retail Price:$299
Posted by Mário Romano at Monday, February 18, 2008 1 comments
Labels: Technology
I was this close to loose my faith on Vista
This morning it happened: for the first time my Vista workstation seemed blocked on a black screen. I rushed to another machine and accessed it remotely: every thing was working just fine. Strange...
I restarted remotely my Vista box and... still nothing on the screen. Getting stranger...
Then I hit my LCD power button and... nothing happened! My LCD was blocked! My LCD! Isn't this too silly to be true?!?! Totally unresponsive to any input!
I plugged out the power cord, waited for over 10 seconds until the LCD light shut off and connected it back: my Vista was back on action!
The moral of the story - and no, this isn't statistically relevant: my Vista box is more stable than my LCD monitor!
PS: if it wasn't for the recent SP1 update restart I would be terribly pissed off now - my Vista box is always on with decent uptimes. And yes, this is ecologically wrong, but I need to access it from home, and I do shutdown the LCD over lunch and overnight. And don't forget: your computer still drains power when shutdown simply by being plugged into the power socket, they are just sucking up less power.
PS: my monitor is a 17' Dell, an entry level cheap LCD monitor - I'm writing this post from home so I can't post the model - maybe tomorrow.
[update]
My monitor is a Dell E178FP
Posted by Mário Romano at Monday, February 18, 2008 0 comments
Labels: Operating Systems
Sunday, February 17, 2008
Artificial Intelligence
Some members of the US National Academy of Engineering have predicted that Artificial Intelligence will reach the level of humans in around 20 years. So on 2028 computers can reach our level of development - a level incapable of understanding the horrors that we are doing to our planet? If we see it like this, it probably doesn't seam much. Hopefully computers will take over and save us - probably the film movie AI deserved another end...
Posted by Mário Romano at Sunday, February 17, 2008 0 comments
Labels: Ecology
GAT/GAX for VS2K5/VS2K8
Here it is. When Orcas came into town GAT/GAX had their walk on the desert - a version that works for a Beta2 and not for the RTM is just silly. But finally it's over, life can go on.
This is not a GAT/GAX related problem, this is something we have to deal whenever we change a developing cycle. And now that we have the CTP model in action, in the agile sprint way of life, this problem is getting worse.
This is a problem we have to start addressing soon. In the old days, a big change would be 16 versus 32 bits, and that was pretty much it. Now we live on a broader ecosystem. We have to match the right version of a large set of components coming from several providers that can't sync up their agendas.
Another thing we have to learn is to better decouple this environments - I know it is hard, but it seems clear that each and every Visual Studio cycle just breaks up more than it should.
Posted by Mário Romano at Sunday, February 17, 2008 0 comments
Labels: Practices
Friday, February 15, 2008
System.InvalidOperationException: Collection was modified
Unhandled Exception: System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
This is documented as:
InvalidOperationException is used in cases when the failure to invoke a method is caused by reasons other than invalid arguments. For example, InvalidOperationException is thrown by:
MoveNext if objects of a collection are modified after the enumerator is created.
Argh, sometimes enumerators are just too conservative. This seems to be the case:
Hashtable hashTable = new Hashtable();
hashTable.Add(1, 1.ToString());
hashTable.Add(2, 2.ToString());
hashTable.Add(3, 3.ToString());
foreach (object key in hashTable.Keys)
{
hashTable[key] = "something else";
}
To solve this, all we have to do is to get another collection to iterate:
foreach (object key in new ArrayList(hashTable.Keys))
Though understanding this behavior, the responsibility of this sanity check could probably be delegated optionally to the programmer. In my sample I am not changing the enumeration, just the value. Lets not forget that the new ArrayList solution depends upon memory usage.
Posted by Mário Romano at Friday, February 15, 2008 0 comments
Labels: Development
How to Serve HTML as an Excel File from a Web Application
There are a bunch of ways to generate and throw an excel to a browser, each of them with advantages and disadvantages. Some need Excel Services, some need Excel 2007, some need Excel installed on the server, some are just hard to use...The simplest and least dependent upon is throwing HTML to be read from Excel. Here's a great article about it.
Posted by Mário Romano at Friday, February 15, 2008 0 comments
Labels: Development
Thursday, February 14, 2008
DinnerNow 2.5 - .NET 3.5 enabled
DinnerNow is a Microsoft .NET technologies showroom designed over a sample restaurant marketplace application - often seen on hands-on labs and demos. It has been refreshed to .NET 3.5 as DinnerNow 2.5 release. In addition to the new platforms, there are several new features being demonstrated as well:
- Integration between WCF and WF in Orcas
- WCF Orcas Syndication API
- Hosting WCF services in IIS7
- WCF on the .NET Compact Framework 3.5
- LINQ to SQL
Posted by Mário Romano at Thursday, February 14, 2008 0 comments
Labels: Education
Products & Extensions for Visual Studio
visualstudiogallery.com is a directory of products & extensions for Visual Studio. Unfortunately most of them are payed. Nevertheless, a great directory.
Thank Bruno Valente for the hint.
Posted by Mário Romano at Thursday, February 14, 2008 0 comments
Labels: Development, Tools
Wednesday, February 13, 2008
Open Source Ajax Web Portal
Omar AL Zabir, co-founder & CTO Pageflakes has created an AJAX based Web portal http://dropthings.com, and he has posted the source in as open source.
PS: Omar, your portal is this only site on the net supporting both Google and Live-Search. Another great innovation :)
Posted by Mário Romano at Wednesday, February 13, 2008 0 comments
Labels: Technology
Windows Mobile 5 false alarms
My friend Pita as just posted about the solution for the unwanted sound alarms and reminders that flooded the bootstrapper of some Windows Mobiles. I was also one of the unlucky users that had this annoying bug, and Pita had already suggested using MemMaid to solve the problem -which I never did.
Some time ago I was synchronizing my PDA time from the GPS clock when I found a bug on my sync routine: it didn't warn me if the GPS date being too far from the mobile date. And it was, my buggy routine set the date to 2006! Instantly all the sound alarms that appeared on the bootstrap just started popping as regular alarm notifications, allowing me to dismiss them. And that was the last I saw about this alarm bug.
The moral of could very well be: not all bugs are unwanted :)
Posted by Mário Romano at Wednesday, February 13, 2008 0 comments
Labels: Fun
Is NHibernate getting some traction from Microsoft?
When Brad Adams wrote ASP.NET MVC Example Application over Northwind with the Entity Framework, in respect to data, he stated:
Next, we need to create a LINQ model on top of northwind to make it easier to work with... You can do this with NHibernate, LinqToSql, Entity Framework , or any other .NET OR-Mapping technology. As long as it results in .NET Object, the ASP.NET MVC framework can work with it. In this case I am going to use the Entity Framework.
Interesting choice, NHibernate. This seems to be an endorsement, what do you think? More, SubSonic is not on the list, oops...
And then again it probably doesn't mean anything else but the openness of mind Microsoft is breathing right now.
Posted by Mário Romano at Wednesday, February 13, 2008 0 comments
Tuesday, February 12, 2008
ASP.NET MVC Framework Road-Map Update
Scott Guthrie updated the ASP.NET MVC roadmap:
- The ASP.NET MVC Framework can be deployed in the \bin directory of an app and work in partial trust
- Significantly enhanced routing features and infrastructure
- Improved VS 2008 Tool Support
- [ControllerAction] Attribute No Longer Required on Controller Action Methods
- New Filter Attribute Support for Controllers and Action Methods
- HTML Helpers Built-in
- Lots of Refactoring and Design Improvements
- Downloadable ASP.NET MVC Framework Source that can be Built and Patched
Still limited information about scaffolding...
Posted by Mário Romano at Tuesday, February 12, 2008 0 comments
Labels: Development
Famous Software Disasters
DevTopics has posted this series of famous software disasters:
http://www.devtopics.com/20-famous-software-disasters/
http://www.devtopics.com/20-famous-software-disasters-part-2/
http://www.devtopics.com/20-famous-software-disasters-part-3/
http://www.devtopics.com/20-famous-software-disasters-part-4/
Here's my favorite one:
10. Ariane Rocket Goes Boom (1996)
Cost: $500 million
Disaster: Ariane 5, Europe's newest unmanned rocket, was intentionally destroyed seconds after launch on its maiden flight. Also destroyed was its cargo of four scientific satellites to study how the Earth's magnetic field interacts with solar winds.
Cause: Shutdown occurred when the guidance computer tried to convert the sideways rocket velocity from 64-bits to a 16-bit format. The number was too big, and an overflow error resulted. When the guidance system shut down, control passed to an identical redundant unit, which also failed because it was running the same algorithm.
Mental note: when designing redundant systems for space rockets remember to disable overflow checking - if we can't guarantee the correct destination, let's guarantee that if flies for as much as it can (it cost $500 million, so let's at least lower the cost per flown mile ratio)
:)
Posted by Mário Romano at Tuesday, February 12, 2008 0 comments
Labels: Development, Fun
It's not over until the fat lady sings
Here's the Microsoft Responds to Yahoo! Announcement.
Posted by Mário Romano at Tuesday, February 12, 2008 0 comments
Labels: Social
How to extend the Windows Server 2008 evaluation period
Here's how - from Microsoft's support, not a hack!
Posted by Mário Romano at Tuesday, February 12, 2008 0 comments
Labels: Operating Systems
Codegenerator for Sharepoint
Ted Pattison has posted a new SharePoint utility named STSDEV on CodePlex. STSDEV.EXE is a proof-of-concept application that demonstrates a simple code generator for creating SharePoint 2007 development projects targeting Visual Studio. Though not the greatest fan of Sharepoint, I'm a fan of codegenerators as an enforcement vehicle for proven practices. Enjoy.
Posted by Mário Romano at Tuesday, February 12, 2008 0 comments
Labels: Development, Tools
Monday, February 11, 2008
xperf - from Windows Performance Tools (WPT) Kit
The Windows Performance Tools (WPT) Kit contains performance analysis tools that are new to the Windows SDK for Windows Server 2008 and .NET Framework 3.5. [...] The tools include an xperf trace capture tool, an xperfview visualization tool (also known as Performance Analyzer), and an xbootmgr boot trace capture tool. The tools are built on top of the Event Tracing for Windows (ETW) infrastructure. [...] ETW enables Windows and applications to efficiently generate events. Events can be enabled and disabled at any time without requiring system or process restarts. ETW collects requested kernel events and saves them to one or more files that are referred to as "trace files" or "traces."
Here's a simple Visual Studio session on my Vista:
xperf -on DiagEasy
xperf –d \trace.etl
xperf \trace.etl
And here is the result:
The graphics are not too sexy, but they work. And we have a great zoom option.
Posted by Mário Romano at Monday, February 11, 2008 0 comments
Labels: Tools
Supporting Logitech QuickCam Messenger on Vista
Currently Logitech doesn't support my old QuickCam Messenger webcam on Vista. Their advice: get a new one.
MyDigitalLife posted a great hack describing how to install it on Vista (32 bit). I've just tried it and it works. Thank!
My message to Logitech: from now on, I won't need the support that you offer for old products, as I don't intent buying anything else from you guys.
Posted by Mário Romano at Monday, February 11, 2008 0 comments
Labels: Operating Systems
Sunday, February 10, 2008
ASP.NET MVC Example
Brad Adams has published a great example of how developers can leverage the MVC Framework using Entity Framework over the good old Northwind database.
Here's are the links as go through the process step-by-step or just the working example from Brad's blog.
Hear about it at infoq
Posted by Mário Romano at Sunday, February 10, 2008 0 comments
Labels: Development, Education
wiki.asp.net
Here's another source for how to's: ASP.NET Wiki.
As Hanselman says:
There's piles of fantastic community-created and MSFT-created content out there, but if it's not found by a search engine and the right combination of keywords, it's often lost
Too bad he had to retouch his post:
The idea is that folks spend a lot of time trolling the blogs,
googlinglive-searching for answers to common "How To" questions
This is just silly. The verb google has conquered its place in our culture.
Posted by Mário Romano at Sunday, February 10, 2008 0 comments
Labels: Development, Education
Yahoo rejects Microsoft's offer
According to Reuters, Yahoo is set to reject Microsoft unsolicited bid, now worth $42 billion, as too low. Apparently Yahoo could also been considering as option striking a deal with Google to take over its search operations to keep Yahoo independent. Strange as it may seem to many, other bids didn't appear.
Sandeep Aggarwal, an analyst with Oppenheimer & Co, to the San Francisco Chronicle:
To me, it seems like a rejection of the Microsoft offer at its current price, not a rejection of Microsoft.
However, Daniel Taylor, an analyst with Yankee Group, is skeptical about it:
Yahoo's board members have determined that the two companies are incompatible and that Yahoo would be better off merging, if at all, with a more traditional media company.
Yahoo's board is thinking a couple moves ahead, and they're saying 'I don't think that Microsoft is going to pull this off.
Now we the geek bloggers get to talk about finance. Cool!
Posted by Mário Romano at Sunday, February 10, 2008 0 comments
Labels: Social
Perfect alarm clock
Waking up is a challenge for me - I usually stay up late, so the alarm clock keeps calling me with no luck. I had to wake up early in the morning through the last week, and I couldn't risk falling a sleep, so here is the alarm clock system I set up:
+
My personal and configurable sun rise. Not fancy, not geek, but it worked! Too bad it doesn't start as smoothly as the real sun...
Posted by Mário Romano at Sunday, February 10, 2008 0 comments
Labels: Fun
Cayra
I'm addicted to mind-mapping applications. Since I found FreeMind I've developed an obsession for capturing software concepts over software, not whiteboards.
Here's a cool WPF application that maps minds: Cayra. Great layout and graphics capabilities. Incredible user experience.
[update]
Don't forget to keep saving your work, I've been experiencing some crashes. But it payees off, the usage is just incredible. What I really miss is importing FreeMind documents.
Posted by Mário Romano at Sunday, February 10, 2008 2 comments
Labels: Tools
Saturday, February 09, 2008
ooVoo
ooVoo is a multi-person video chat application. Hanselman states he can conference up to 4 people with great experience.
I haven't tried it yet, just installed it. For now I'm just impressed with this great teaser:
[update]
The video seems to be censored now. Here's YouTube's uncensored version.
Posted by Mário Romano at Saturday, February 09, 2008 1 comments
Labels: Tools
Yahoo Board To Determine Fate Of Company Today
Here's TechCrunch opinion about the deal:
It’s fairly certain that Yahoo will continue to use the threat of a deal with Google to try to increase Microsoft’s offer a few dollars per share. But the threat isn’t (or at least, shouldn’t be) real, and both sides know it.
It will be fun to revisit this post some years from after knowing how if this deal went through :)
Posted by Mário Romano at Saturday, February 09, 2008 0 comments
Labels: Social, Technology
VS 2008 Web Development Hot-Fix Roll-Up Available
Scott Guthrie has announced the first Visual Studio 2008 hot-fix: VS 2008 Web Development Hot-Fix Roll-Up, with ID KB946581. You can download it here (2.6MB). Here's the fix list:
HTML Source view performance
- Source editor freezes for a few seconds when typing in a page with a custom control that has more than two levels of sub-properties.
- “View Code” right-click context menu command takes a long time to appear with web application projects.
- Visual Studio has very slow behavior when opening large HTML documents.
- Visual Studio has responsiveness issues when working with big HTML files with certain markup.
- The Tab/Shift-Tab (Indent/Un-indent) operation is slow with large HTML selections.
Design view performance
- Slow typing in design view with certain page markup configurations.
HTML editing
- Quotes are not inserted after Class or CssClass attribute even when the option is enabled.
- Visual Studio crashes when ServiceReference element points back to the current web page.
JavaScript editing
- When opening a JavaScript file, colorization of the client script is sometimes delayed several seconds.
- JavaScript IntelliSense does not work if an empty string property is encountered before the current line of editing.
- JavaScript IntelliSense does not work when jQuery is used.
Web Site build performance
- Build is very slow when Bin folder contains large number of assemblies and .refresh files with web-site projects.
Scott also announced that he plans to more frequently release public patches that roll-up bug-fixes of commonly reported problems. Great news!
Posted by Mário Romano at Saturday, February 09, 2008 0 comments
Labels: Development, Tools
Friday, February 08, 2008
GhostDoc for Visual Studio 2008
GhostDoc is a free add-in for Visual Studio that automatically generates XML documentation comments from an customizable rule engine. This is a great tool to help developers keep their code properly commented so that it can be projected into good old NDoc or the SandCastle.
GhostDoc is not a new tool, but I've stop using it since I'm using Visual Studio 2008. Thank Hugo Ribeiro's post for announcing the 2008 version.
Posted by Mário Romano at Friday, February 08, 2008 0 comments
Labels: Development, Tools
Vista SP1
bink.nu has just posted:
For those hunting for the Windows Vista SP1 rtm, if you got your hands on Microsoft Windows Vista Service Pack 1 Release Candidate Refresh 2, you have the RTM bits!!!
Microsoft released this refresh build end of January though Windows Update only to selected testers, but clever people can get the downloaded SP package from the Windows Update download cache and they have the stand alone package of SP1 RTM
@echo off
reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\VistaSp1 /f > NUL 2>&1
reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\WindowsUpdate\VistaSP1 /f > NUL 2>&1
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\VistaSp1 /v Beta1 /t REG_SZ /d dcf99ef8-d784-414e-b411-81a910d2761d /f
IF NOT %errorlevel% == 0 ( goto ERROR)
:SUCCESS
@echo.
echo ===========================================================
echo Windows Vista SP1 registry key has been set successfully.
echo Please check for updates in Windows Update.
echo ===========================================================
@echo.
goto END
:ERROR
@echo.
echo ===========================================================
echo FAILED to set Windows Vista SP1 registry keys.
echo Please run this script by right clicking and selecting
echo "Run as Administrator".
echo ===========================================================
@echo.
goto END
:END
pause
Just as for the SP1 beta that is running right now, I'm doing the same to get the final SP1 bits. Just like before, some updated reveal others. Tomorrow I'll let you how this worked - from this Vista, I hope
[update]
Oops, didn't work, no SP1 update revealed - still on build 6001, Service Pack 1, v.275. Or did it failed because of the SP1 beta?!?.... I'm afraid this is not the best of time to loose my workstation, so I'll try to uninstall it later.
[update II]
After uninstalling build 6001 (SP1 beta), and after 2 restarts, I'm back in action:
(apparently this is an RC1 - Build 6001.18000)
Posted by Mário Romano at Friday, February 08, 2008 0 comments
Labels: Operating Systems
And now for the OS
After choosing the hardware (for our developer laptops), we have to choose the OS. Here are some of the most obvious choices:
- XP 32 bits - uhmm, fast and boring, wider compatibility range. Still a chance.
- XP 64 bits - getting better...
- Vista 32 bits - nice and cosy, just didn't like the video experience on D830 with nVidia Quadro 140; some compatibility problems that will have to be solved with VMs, but I love VMs :)
- Vista 64 bits - more compatibility problems, haven't tried it yet on the D830
- Windows Server 2008 - great on server tests compatibility, usability, performance, application support and minimalist experience, low on eye candy...
- Hyper-V with a combination of several of the later - this is the one I love the most - downside: 180d after RTM to ship...
- Ubuntu - ok, funny, now really?...
Posted by Mário Romano at Friday, February 08, 2008 0 comments
Labels: Operating Systems
Thursday, February 07, 2008
Microsoft is Googling up
It seems like the cloud infrastructure is really becoming key to how Microsoft goes forward with Software+Services (S+S). As bink.nu mentions:
There are lots of components beyond just the racks of Windows Server boxes that are keeping Microsoft’s online properties up and running. Some of the other pieces that have come across my radar screen (thanks to tips from various sources who requested anonymity):
- AutoPilot: The management system for Microsoft’s Windows Live Messenger and Live Search services. Word is Microsoft is extending AutoPilot to handle every Windows Live service, as well as some other members of its Live and Online families. AutoPilot performs tasks like network monitoring, power monitoring, performance monitoring, analysis, etc. It also will enable Microsoft to use commodity hardware in deploying its datacenter infrastructure.
- Bedrock: The core shared publishing platform for Live
- Shuttle: The feed-management system for Live. I’m not sure how this fits (or doesn’t) with Microsoft’s FeedSync, which is one of Chief Software Architect Ray Ozzie’s pet projects.
- Fuse: A SQL Server diagnostics/monitoring system
- Cloud DB: The project via which Microsoft is scaling out its back-end structured data store. Cloud DB will be the storage platform for many of the Windows Live services and applications. The team is working to make SQL Server more fault tolerant, scalable and highly available.
Oops, seems like Microsoft is learning some lessons from Google. Not there yet, but definitely not sleeping.
Posted by Mário Romano at Thursday, February 07, 2008 0 comments
Labels: Technology
Wednesday, February 06, 2008
.NET Debugging Demos Lab 1: Hang
Every now and then I'm called to help debug applications - I even have a fireman helmet to carry on, even if I feel more like a plumber. Here's a guy gal that is not ashamed to reveal his debug sessions, he even seems to be proud about it, go figure! Now seriously, he posted the first of a series of his great debugging experience.
The last session I had that needed to get into windbg took me 2 days on the client - we couldn't recreate the exact level of stress users did. We could clearly surpass the load with app stress tool, but surpassing it is wasn't enough! On login peak times, this project just started queuing requests like there's no tomorrow! WinDbg pinpointed the locked call - it was AD related and infra-structure dependent, so we solved it by changing the way this application logged-in.
Who knows, I may post the details of my next cool debugging experience back on devCatharsis...
Posted by Mário Romano at Wednesday, February 06, 2008 1 comments
Labels: Development
A "transactional" generic DbHelper for LINQ to SQL
Here's a nice little helper for those who intend to use LINQ to SQL. It will allow us to write something like:
DbHelper.Insert<Student>(
new Student()
{
FirstName = "Tanzim",
LastName = "Saqib",
Email = "me@TanzimSaqib.com",
Website = "http://www.TanzimSaqib.com"}, true); // Use Transaction?
Concise and elegant, isn't it? And what if we turn this around into an extension method, wouldn't it be yet another cool usage? Something like:
new Student()
{
FirstName = "Tanzim",
LastName = "Saqib",
Email = "me@TanzimSaqib.com",
Website = "http://www.TanzimSaqib.com"}, true
).Insert(true /* Use Transaction */);
Oh, how I love C#3 and LINQ....
Posted by Mário Romano at Wednesday, February 06, 2008 0 comments
Labels: Language Trends
Tuesday, February 05, 2008
Get control over your database
Or "Get Your Database Under Version Control", as compiled by Jeff Atwood:
K. Scott Allen just wrote a brilliant five part series on the philosophy and practice of database version control:
Managing your database versions is just darn hard. In my opinion, the schema itself is the easy part, data is often the problem - at least on unstable staging scenarios that derive from production data.
Posted by Mário Romano at Tuesday, February 05, 2008 0 comments
Preventing Denial of Service (DOS) Attacks
Omar Al Zabir as posted this great article '10 ASP.NET Performance and Scalability Secrets'. The last of the tips caught my attention: Prevent Denial of Service (DOS) Attacks.
Omar offers us a simple and effective way to deny DOSs. My question is: shouldn't we tackle this problem on an HttpModule level - better yet, shouldn't IIS take care of these problems for us?
Posted by Mário Romano at Tuesday, February 05, 2008 0 comments
Labels: Security
ADO.NET performance improvements with the .NET Framework 2.0 SP1
I just love when performance service packs! Here they are:
- [they] worked with the CLR team to get improvements like the thread pool improved scalability, and that was important for making sure our SqlReader performance is better in multithreaded scenarios (like your ASP.NET applications under load);
- particularly improved were scenarios like Data set insertion, and multi-threaded scenarios (such as ASP.NET applications) using SqlDataReader (25% better or more, depending on hardware and OS architecture);
Here's a summary:
Scenario | .NET 2 | .NET 2 SP1 | Improvement |
SqlReader | 14855 | 18100 | 27.3% |
DataSet insert | 9637 | 12890 | 40.8% |
Pet Shop 4.0(Browse) | 22.44 | 24.40 | 8.72% |
Pet Shop 4.0 (Buy) | 21.54 | 23.04 | 6.99% |
I love when improvements just fall from the sky with no integration cost. So hurry up and patch your servers!
Posted by Mário Romano at Tuesday, February 05, 2008 0 comments
Labels: Development
2007 Turing Award Winners Announced
in: Dr. Dobb's
Edmund M. Clarke, E. Allen Emerson, and Joseph Sifakis are the recipients of the 2007 A.M. Turing Award for their work on an automated method for finding design errors in computer hardware and software.
The method, called Model Checking, is the most widely used technique for detecting and diagnosing errors in complex hardware and software design. It has helped to improve the reliability of complex computer chips, systems and networks.
...
Model Checking is a type of "formal verification" that analyzes the logic underlying a design, much as a mathematician uses a proof to determine that a theorem is correct. Far from hit or miss, Model Checking considers every possible state of a hardware or software design and determines if it is consistent with the designer's specifications. Clarke and Emerson originated the idea of Model Checking at Harvard in 1981. They developed a theoretical technique for determining whether an abstract model of a hardware or software design satisfies a formal specification, given as a formula in Temporal Logic, a notation for describing possible sequences of events. Moreover, when the system fails the specification, it could identify a counterexample to show the source of the problem. Numerous model checking systems have been implemented, such as Spin at Bell Labs.
Posted by Mário Romano at Tuesday, February 05, 2008 0 comments
Labels: Technology
About Microsoft bid over Yahoo
Let's be clear about it: Google is not a social institution for the defense of civil rights - it is just another corporation, not unlike Microsoft and others.
These corporations usually buy other corporations - for instance, Google bought Picasa, DoubleClick, SketchUp, Blogger, YouTube, FeedBurner and Android - among many others. Yahoo bought Four11, ClassicGames, GeoCities, eGroups and Paul Graham's ViaWeb. Microsoft's list is even larger.
For some strange reason, Google likes to be treated as the virgin Mary of corporations, pure and untouched on the evil of the enterprises. As if we wanted corporations to be pure and naive... All we want from them is to allow the market to play as fair as possible. On an ideal world, maybe corporations shouldn't be allowed to buy each others, only to grow from inside, but that is a fact that we can't prevent, as a basis of out capitalism system.
I've found a great article with which I can relate on this regard: Hello, Google, can you spell hypocrisy?.
On this article, Jack Schofield unmounts Chief Legal Officer's hilarious post, stating:
If Google really thinks Microsoft is evil, it can stop marketing the Google Toolbar and Firefox for Windows, and drop even the mediocre support for Office in Google docs. But it seems it would rather take the money and/or market share, and be hypocritical about it.
Eh, eh, eh, I complaint on a regular basis about this, don't I?
How far Google is open is another matter. It certainly exploits free open source software, but its "secret sauce" isn't available. Its search algorithms and operations are entirely secret, and Google can delete your site from its index without consulting you or anybody else, and you have no real recourse.
Right again, Jack!
My advice to Google: stop winning for all of the cake. For the rest of us, let's keep alert about monopolies. And for now, and over internet search and advertisement, I'd start worrying about Google, for much wrong Microsoft has done on the past.
Posted by Mário Romano at Tuesday, February 05, 2008 0 comments
Labels: Social
Inside Vista SP1 File Copy Improvements
Here's Mark Russinovich's review's conclusion about Vista SP1 File Copy Improvements:
The changes apply both to Explorer copies as well as to ones initiated by applications using the CopyFileEx API and you’ll see the biggest improvements over older versions of Windows when copying files on high-latency, high-bandwidth networks where the large I/Os, SMB2’s I/O pipelining, and Vista’s TCP/IP stack receive-window auto-tuning can literally deliver what would be a ten minute copy on Windows XP or Server 2003 in one minute. Pretty cool.
Some of you will probably see this review as too much soft for Vista's copy problem, but you'll have to understand, Mark is now a Microsoft employee. Still a technical authority, though.
Posted by Mário Romano at Tuesday, February 05, 2008 0 comments
Labels: Operating Systems
Monday, February 04, 2008
Abandonware
Some weeks ago, I asked if someone could find a Windows 1 and 2 image. I've just received a mail from a devCatharsis reader making reference to a great repository of great software: vetusware.com.
These abandonware repository is loaded with great old software, like:
- Windows 1
- Windows 2
- Windows ...
- CP/M
- Linux 0.99
- MS DOS 1.1
- MS DOS ...
- Netware
- OpenGEM 4
- OS/2 1
- OS/2 ...
- PC DOS
- PC/GEOS 2
I was expecting to find DESQview and DESQview/X, but I didn't.
Thank Julian Smith for this great link!
[update]
Julian just sent me a another link to Windows (and other) screenshots: www.toastytech.com/guis/indexwindows.html.
Tanx again, Julian.
Posted by Mário Romano at Monday, February 04, 2008 0 comments
Labels: Operating Systems
Sunday, February 03, 2008
Sharing Variables Between JavaScript and C#
Here's an article with a nice concept: sharing Variables Between JavaScript and C#. I'm sure it will be handy in a near future...
Posted by Mário Romano at Sunday, February 03, 2008 0 comments
Labels: Development
TDD Proven Effective! Or is it?
Some weeks ago, I've posted about the TDD Test-first paper Phil Haack posted about. Here's a brand new post from Jacob Proffitt questioning about the validity of the original post. I'll probably stop posting about this, as so many post as much about the original post. (Mental note: try not to post as much about the term posting, you're not being funny, just annoying).
Posted by Mário Romano at Sunday, February 03, 2008 0 comments
Labels: Practices
Great Volta quickstart article
Bart De Smet's (B#) has just posted a great Volta introduction.
PS: I've been reading B# for ages missing his great motto:
0x2B | ~0x2B, that's the question.
Fabulously geek!
Posted by Mário Romano at Sunday, February 03, 2008 0 comments
Labels: Development, Fun
Unity
Unity is the name of the DI container that is being built for Enterprise Library 4 - yeap, finally Microsoft is getting strong naming for their products, it was born as DIAB, DI Application Block.
Here's a typical usage scenario:
UnityContainer container = new UnityContainer()
.Register<ILogger, TraceLogger>()
.Register<ISomething, Something>()
.Register<ISomethingElse, SomethingElse>();
ILogger logger = container.Get<ILogger>();
logger.Write("log something", new string[] {"category1", "category2"});
A little more verbose version of the factory abstraction, but definitely a clear one. But above all:
It opens up the software factories and Enterprise Library to something other than ObjectBuilder and allow us to use our DI Tool of choice - whether that be the DIAB or another tool.
Posted by Mário Romano at Sunday, February 03, 2008 0 comments
Labels: Development, Practices
Design patterns, anti-patterns and refactoring
Here is yet another great source about Design patterns, anti-patterns and refactoring. Here's the anti-pattern I often get trapped in: Vendor Lock-In
Posted by Mário Romano at Sunday, February 03, 2008 0 comments
Labels: Practices
A priori best practices
Corey Ladas states:
There are no a priori best practices.Eh, eh, great post in a mix of humbleness, experience and fun. In my opinion the way to tackle this is from an engineering perspective: engineers don't work based on a priori intuition, but over proven practices (our business is not mature enough to call them best, just proven). As architects, we have to choose, whenever possible, from a body of well known proven practices. Whenever we can't find an appropriate one, we have to manage the higher risk of building upon an unproven practice, and hope that this practice is proven.
There are only the practices you are using now.And practices that are better than the ones you are using now.
Posted by Mário Romano at Sunday, February 03, 2008 0 comments
Labels: architecture, Practices
Saturday, February 02, 2008
Vista Service Pack 1
Microsoft has scheduled Windows Vista Service Pack 1 for release to manufacturer (RTM) on Monday, February 4, 2008. In Portugal, we'll have to wait for the second wave, scheduled for release 1-2 weeks later.
Posted by Mário Romano at Saturday, February 02, 2008 0 comments
Labels: Operating Systems
Never Forget a Lens Again
Here an interest Outlook add-in: Microsoft Pro Photo Shoot. This add-in for Microsoft Office Outlook allows photographers to add details of the client and equipment for a photo shoot appointment in Outlook.
I'm an amateur photographer. I have 4 SLRs and a countless number of lenses, flashes and other photo gear, and still can't picture the need of using this add-in.
So how is this interesting? Because this is a new (or refurbished?) class of applications that make use of Exchange messaging platform as a persistence mechanism, making way for future connected/disconnected messaging applications. On the 90s we had some not-so-good (to say the least) experience with Exchange Forms. Let's see where this gets us.
Posted by Mário Romano at Saturday, February 02, 2008 0 comments
Labels: Tools
Moq - yet another mocking library
Moq is a simple strongly typed mocking library, designed from ground up for .NET 3.5 with deep C# 3 integration. Here are some sample usage from the quick start:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Moq;
namespace ConsoleApplication8
{
public interface IFoo
{
int DoInt(int i);
int Do1();
void Execute();
int DoArgument(string str);
int Duplicate(int i);
int ValueProperty { get; }
}
class Program
{
static void Main(string[] args)
{
// ShouldExpectCallReturn
var mock = new Mock<ICloneable>();
var clone = new object();
mock.Expect(x => x.Clone()).Returns(clone);
Assert.AreSame(clone, mock.Object.Clone());
// ShouldExpectCallWithArgument
var mock1 = new Mock<IFoo>();
mock1.Expect(x => x.DoInt(1)).Returns(11);
mock1.Expect(x => x.DoInt(2)).Returns(22);
Assert.AreEqual(11, mock1.Object.DoInt(1));
Assert.AreEqual(22, mock1.Object.DoInt(2));
// ShouldExpectCallWithReferenceLazyEvaluate
int a = 25;
var mock2 = new Mock<IFoo>();
mock2.Expect(x => x.DoArgument(a.ToString())).Returns(() => a);
a = 10;
Assert.AreEqual(10, mock2.Object.DoArgument("10"));
// ShouldExpectReturnPropertyValue
var mock3 = new Mock<IFoo>();
mock3.Expect(x => x.ValueProperty).Returns(25);
Assert.AreEqual(25, mock3.Object.ValueProperty);
// ShouldExpectMethodCallWithVariable
int value = 5;
var mock4 = new Mock<IFoo>();
mock4.Expect(x => x.Duplicate(value)).Returns(() => value * 2);
Assert.AreEqual(value * 2, mock4.Object.Duplicate(value));
// ShouldMatchAnyArgument
var mock5 = new Mock<IFoo>();
mock5.Expect(x => x.Duplicate(It.IsAny<int>())).Returns(() => 5);
Assert.AreEqual(5, mock5.Object.Duplicate(5));
Assert.AreEqual(5, mock5.Object.Duplicate(25));
// ShouldMatchPredicateArgument
var mock6 = new Mock<IFoo>();
mock6.Expect(x => x.Duplicate(It.Is<int>(someValue => someValue < 5 && someValue > 0))).Returns(() => 1);
Assert.AreEqual(1, mock6.Object.Duplicate(3));
Assert.AreEqual(0, mock6.Object.Duplicate(0)); // Invocation on interface member must have a corresponding expectation.
// ShouldExpectCallWithoutReturnValue
var mock7 = new Mock<IFoo>();
mock7.Expect(x => x.Execute());
mock7.Object.Execute();
// ShouldThrowIfExpectingThrows
var mock8 = new Mock<IFoo>();
mock8.Expect(x => x.Do1()).Throws(new FormatException());
mock8.Object.Do1(); // One of the identified items was in an invalid format.
// ShouldExecuteCallbackWhenVoidMethodIsCalled
var mock9 = new Mock<IFoo>();
bool called = false;
mock9.Expect(x => x.Execute()).Callback(() => called = true);
mock9.Object.Execute(); Assert.IsTrue(called);
// ShouldExecuteCallbackWhenNonVoidMethodIsCalled
var mock10 = new Mock<IFoo>();
bool called1 = false;
mock10.Expect(x => x.Do1()).Callback(() => called1 = true).Returns(1);
Assert.AreEqual(1, mock10.Object.Do1());
Assert.IsTrue(called1);
// ShouldExpectRanges
var mock11 = new Mock<IFoo>();
mock11.Expect(x => x.DoInt(It.IsInRange(1, 5, Range.Inclusive))).Returns(1);
mock11.Expect(x => x.DoInt(It.IsInRange(6, 10, Range.Exclusive))).Returns(2);
Assert.AreEqual(1, mock11.Object.DoInt(1));
Assert.AreEqual(1, mock11.Object.DoInt(2));
Assert.AreEqual(1, mock11.Object.DoInt(5));
Assert.AreEqual(2, mock11.Object.DoInt(7));
Assert.AreEqual(2, mock11.Object.DoInt(9));
}
}
}
Moq offers the following features:
- Strong-typed: no strings for expectations, no object-typed return values or constraints
- Unsurpassed VS intellisense integration: everything supports full VS intellisense, from setting expectations, to specifying method call arguments, return values, etc.
- No Record/Reply idioms to learn. Just construct your mock, set your expectations, use it and optionally verify them
- Granular control over mock behavior with a simple MockBehavior enumeration (no need to learn what's the theoretical difference between a mock, a stub, a fake, a dynamic mock, etc.)
- Mock both interfaces and classes
- Override expectations: can set default expectations in a fixture setup, and override as needed on tests
- Pass constructor arguments for mocked classes
- Deep MarshalByRefObject support: constructs underlying proxied object, and passes calls down to it if there are no expectations overriding them. Very useful for WinForms controls and other System.ComponentModel.Component-derived classes.
Posted by Mário Romano at Saturday, February 02, 2008 0 comments
Labels: Development
Friday, February 01, 2008
Microsoft offers to buy Yahoo
Not a surprise, more an announcing waiting to happen for ages. $44.6 billion in cash and stock. 62 percent premium. Operation "Anti-Google".
Posted by Mário Romano at Friday, February 01, 2008 0 comments
Labels: Technology
Serializing HashTable
Ok, dictionaries can't be serialized to Xml, but we can always use SoapFormatter:
SoapFormatter SOAPFormatter = new SoapFormatter();
Stream myStream = ...;
SOAPFormatter.Serialize(myStream, obj);
stream.Close();
Well, not always, actually. Human just can't read it. But it can be sent over the wire - at least to another .NET ecosystem :)
Posted by Mário Romano at Friday, February 01, 2008 0 comments
Labels: Development