Sorry, this isn’t the cool PowerShell version, just an ubiquitous one:
sc delete <windows_service_name>
Here a useful link to get more info.
Sorry, this isn’t the cool PowerShell version, just an ubiquitous one:
sc delete <windows_service_name>
Here a useful link to get more info.
Posted by Mário Romano at Wednesday, December 31, 2008 0 comments
Labels: Operating Systems
Arghh, here’s a recurring one I hadn’t posted yet. In my case, it happened after a hard checkout – I forced the checkout after offline changes, Visual Studio didn’t detect the changes – no Go Online…
Most of you suggest:
I just touched the ‘<whatever>.designer.cs’ file and recompiled it. Oh, I’ve finally undone the change :). It was suggested here.
Posted by Mário Romano at Tuesday, December 30, 2008 0 comments
Labels: Development
Here’s a cool list of 5 Reasons for Software Developers to Do Code Reviews (Even If You Think They're a Waste of Time):
Posted by Mário Romano at Monday, December 29, 2008 0 comments
Labels: Practices
Now that the holiday season is on, here a great way to help us through the season family and friend’s parties: UltraStar.
Ultrastar is a PC conversion of famous karaoke game - SingStar. It allows a computer to evaluate how good you are when you sing by analyzing your voice pitch.
Great way to waist some drinking time over the new years’ eve :)
Posted by Mário Romano at Wednesday, December 24, 2008 0 comments
Labels: Fun
I got a digital signature policy error message when installing a large Microsoft Windows Installer (VMWare 2) on an old box.
The problem seems to be related to insufficient virtual memory to represent all the msi. Here’s the patch that saved me.
Merry Christmas everyone :)
Posted by Mário Romano at Wednesday, December 24, 2008 21 comments
Labels: Operating Systems
Arghh, this one is recurring with me. If you can’t open a WebDav document library on WSS3, check if the “WebClient” service is running!…
If not, try this.
Posted by Mário Romano at Monday, December 22, 2008 0 comments
Labels: Technology
We can now grab the beta of the Windows Live Essentials beta from download.live.com. Besides the new features and upgraded versions, we get a new installer that finally runs on Windows Server 2008. It's about time!
Posted by Mário Romano at Wednesday, December 17, 2008 0 comments
Labels: Technology
Yes, I know, not a new topic, but I just can help loving these cool lists :)
Posted by Mário Romano at Monday, December 15, 2008 0 comments
Labels: Project Management
Here’s the Pocket Guides available so far:
Thanks for the tip, Cab_ux.
Posted by Mário Romano at Thursday, December 11, 2008 0 comments
Labels: Development, Education, Practices
Microsoft has released an open-source content management platform targeted to blogs or large Web sites. It's named Oxite, and it is available at CodePlex.
According to Microsoft:
Oxite is an open source, standards compliant, and highly extensible content management sample that can run anything from blogs to big web sites. We know this because it runs MIX Online.
Oh, did I mention that it is an ASP.NET MVC implementation? :)
Posted by Mário Romano at Wednesday, December 10, 2008 0 comments
Labels: Development
Here's a new one: we can now burn ISO images on Windows 7. Unfortunately, we still can't open the ISO itself, for that you'll have to rely on Daemon Tools.
Posted by Mário Romano at Monday, December 08, 2008 0 comments
Labels: Operating Systems
Uhmm, I'm giving Windows 7 another try for a day or two. It has accepted all my Vista x64 drivers, some configuration features are just great, and the video experience is just awesome! With the same driver as my Windows Server 2008. Cool...
Posted by Mário Romano at Sunday, December 07, 2008 0 comments
Labels: Operating Systems
Ok, after trashing my Windows Server 2008 with Azure .NET Services (yes, WCF stopped working), I've finally got the excuse I needed to install Windows 7.
The installed version was the PDC one, build 6801, a x64 version. Installed like a charme, asked for a serial but continue working without it.
To be honest, I didn't found much differences from Vista. Even on memory usage, on my D830 it used 848MB of mem on startup, and 15,8GB of disk.
About the new features most of them have already been written by others. About the experience, most applications that failed to install on my Server 2008 (because they were desktop apps) did install on Windows 7. I'm posting from Windows Live, without need of any hacking to install on Windows 7.
After writting this post I'll install a Windows Server 2008, or maybe a Vista just to get a better experience. So why didn't I kept Windows 7?
Until we meet again, Windows 7 :)
Posted by Mário Romano at Sunday, December 07, 2008 0 comments
Labels: Operating Systems
Apparently Apple started encouraging users to install Antivirus on Mac OS. Informed people did never believe on the virus-proof Mac OS theory, Mac users (me included, just using ClamAV on demand!) could afford not to use those just until the critical mass was reached. And it seem to have been reached now.
Is this a bad indicator to Mac OS? Hell, no! It's a natural consequence of Apple's growing market share. Good for them. Congratulations!
PS: if this info is confirmed Windows will receive an apology letter from Mr. Jobs, right?
Posted by Mário Romano at Wednesday, December 03, 2008 0 comments
Labels: Operating Systems
Here's a cool tiny utility: Remote Desktop Manager. It's the best to organize your remote connections, supporting Microsoft Remote Desktop, Terminal Services and RealVNC.
Here is the features list:
Posted by Mário Romano at Tuesday, December 02, 2008 1 comments
Labels: Tools
Not that HttpHandler is hard to create, but it can get quite intrusive mainly because of configuration issues.
The ashx extension simplifies all this process. Here's all you've got to do:
namespace MyProject
{
using System;
using System.Web;
using System.Web.Services;
/// <summary>
/// Summary description for FederationLogin
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class FederationLogin : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
try
{
//
// set content type to jpeg
// TODO: consider changing to smaller footprint png version
context.Response.ContentType = "image/jpeg";
// dump image according to credential presence
context.Response.WriteFile(Credentials != null ? "SignedInOnFederation.jpg" : "NotSignedInOnFederation.jpg");
}
catch
{
//
// Oops, something went wrong: opt for a non-intrusive (but non-assertive)
// KISS approach: just assume no federation ticket was issued.
// Please note: no log is being issued.
context.Response.ContentType = "image/jpeg";
context.Response.WriteFile("NotSignedInOnFederation.jpg");
}
}
public bool IsReusable
{
get
{
return false;
}
}
}
}
This is a simple SignIn on federation button. But more about it later, I'm still on an NDA on this one.
Posted by Mário Romano at Friday, November 21, 2008 0 comments
Labels: Development
You can find it at http://www.microsoft.com/ie8
<update>
Oops, I'm so embarrassed, I've got it since last August... oops...
</update>
Posted by Mário Romano at Friday, November 21, 2008 0 comments
Labels: Internet
Cloning VM machine's is something we usually do, but SQL Server doesn't like it's machine's name to be renamed. Here's a cool one I didn't know of - I used to re-run the setup, it really didn't installed it again, just clean it up. But here's a better way:
sp_dropserver <old_name>
GO
sp_addserver <new_name>, local
GO
Now all we have to do is:
There you have it :)
Posted by Mário Romano at Tuesday, November 11, 2008 0 comments
Labels: Database, Operating Systems
Ok, I haven't the faintest idea how to do it other than the experience given by Olav Tollefen. I've applied for access and I'm still waiting - the list is long, I'm afraid. Here's the site to go: http://www.azure.com. Be sure to take your time reading Olav's great post!
PS: be sure to register soon, the list is getting bigger!
Posted by Mário Romano at Thursday, October 30, 2008 0 comments
Labels: Development
Unfortunately I didn't find any site with the PDC videos. All I can find is channel 9 PDC videos sections. Here are some of Roy Osherove's recommendations:
Posted by Mário Romano at Wednesday, October 29, 2008 0 comments
Labels: Education
Here's a nice alternative to MSDN Downloads for downloading Visual Studio 2010 CTP - once you have the direct links :)
Posted by Mário Romano at Wednesday, October 29, 2008 0 comments
Labels: Development
Enterprise Library 4.1 – October 2008 is Available for Download. Heard it on Guy Burstein's blog:
This release includes:
- Support for Visual Studio 2008 and Visual Studio 2008 SP1.
- Interception mechanism in the Unity Application Block.
- Performance improvements.
- Usability improvements of the config tool.
- Fixes.
I'm always divided about EL adoption. Should we adopt best-of-breed libraries or incorporate best-of-breed concepts on a unique and consistent point? Oh well, until them I'll just use both :)
Posted by Mário Romano at Wednesday, October 29, 2008 0 comments
Labels: Development
Here's Windows Azure, not a classic OS as some could expected but many had already realized. Here's a cool presentation from Das:
Manuvir Das: Introducing Windows Azure
I've blogged about it some weeks ago, I'll be fun to see how are my forecasts :)
Posted by Mário Romano at Tuesday, October 28, 2008 0 comments
Labels: Operating Systems
This was pretty annoying... after a while getting an unexpected 'Row not found or changed', here's the solution:
disabled concurrency checks on *all* fields, then added them back one at a time. Turns out the culprit was a string field that was nullable in the DB but not set as nullable in the designer.
Should probably have chosen EF. No comments...
Posted by Mário Romano at Monday, October 27, 2008 1 comments
Labels: Database, Development
Here a great little LINQ to SQL bug. Consider the following code:
IEnumerable<MasterEntity> masters = db.ExecuteQuery<MasterEntity>(
@"select * from MasterEntity master join DetailEntity detail on master.id = detail.MasterId
);
Not imagine if you have the same name column both on MasterEntity and DetailEntity, let's say 'IsMandatory'. When you try and get a this property form a MasterEntity object, what should you get?
Well, on my code it happen to return... DetailEntity.Name! Yes, on my dev box the implementation seems to return the first projection by name. If you really want MasterEntity.Name to get returned, you'll have to get:
IEnumerable<MasterEntity> masters = db.ExecuteQuery<MasterEntity>(
@"select master.* from MasterEntity master join DetailEntity detail on master.id = detail.MasterId
);
Funny, right? I'd expect MasterEntity.Name to get returned, as your asking for a MasterEntity object, right? No ambiguousness here, or am I wrong?
Posted by Mário Romano at Monday, October 20, 2008 0 comments
Labels: Database, Development
Nothing new here except for the confirmation of what we already new: the return of the Microsoft / Apple wars!
Here a great chart (original chart here):
Yes, it's a tax. It's called a luxury tax, and only those who can afford it will pay it. It's not fair, it's not rational, but's that's how it is.
Yes, from the hardware value, the price we pay for Macs is too high. The value has been centered on the exclusivity, and that is changing as we can see by Apple's crescent market share, price dropping and Microsoft's discomfort.
Daily I use XP, Vista, Windows Server 2008, Mac OS X and Ubuntu. If I had to choose, I didn't have to think twice: I had to choose Windows. For it's maturity, for it's completeness, for it's application support, for it's hardware support, for it's backward compatibility, for it's great development experience.
But I believe in diversity, so I'm happy with Mac OS X raise on the market. And this is the turning point to Apple, has they seem to already have saturated the market of geeks and people that buy luxury products. Though comfortable with the consumer market, let's see how they cope with the price dropping. And finally, let's see if Apple continues to feel uncomfortable on Microsoft's stronghold: the enterprise market.
Posted by Mário Romano at Wednesday, October 15, 2008 0 comments
Labels: Hardware, Operating Systems
Whenever I have to create the structure of a site using CSS I usually end up here. Mind as well share it :)
Posted by Mário Romano at Wednesday, October 15, 2008 0 comments
Labels: Development, Education
Silverlight 2 has been released! Let's see how deep can it go. For me, I've bought the concept - boy, won't HTML/javascript ever go away?...
Posted by Mário Romano at Wednesday, October 15, 2008 0 comments
Labels: Development, Technology
No, not blogging about the rumor on the name Strata - strata.com is taken, and unless Microsoft has already purchased the domain name, no strata here for them.
Just posting wikipedia's definition on cloud computing:
It is a style of computing in which IT-related capabilities are provided “as a service”, allowing users to access technology-enabled services from the Internet ("in the cloud") without knowledge of, expertise with, or control over the technology infrastructure that supports them. According to the IEEE Computer Society, "It is a paradigm in which information is permanently stored in servers on the Internet and cached temporarily on clients that include desktops, entertainment centers, table computers, notebooks, wall computers, handhelds, etc."
Cloud computing is a general concept that incorporates software as a service (SaaS), Web 2.0 and other recent, well-known technology trends, in which the common theme is reliance on the Internet for satisfying the computing needs of the users. For example, Google Appsprovides common business applications online that are accessed from a web browser, while the software and data are stored on the servers.
Uhmm, and what can Microsoft offer us here? Let's try and guess: well, they have been investing like crazy on huge datacenters, so they will clearly sell “as a service”, but what? Besides the obvious storage and databases, Microsoft can provide a desktop in a cloud to manage it (Live Mesh?), integrated with officelive.com, above the "interconnecting devices" paradigm. They will probably start offering on the cloud all enterprise as services products they offer today as servers (ex: Exchange and Sharepoint) on multitenancy. They will probably lend their platform to others on the SaaS (sorry, Software + Services), making use of the BizTalk Services platform. Finally they can bring a huge marketplace with UDDI and infrastructure services, along with identity, claiming and federation.
On the client, all of this will probably run mostly over a cross-platform desktop application, not over browser. And what about the connected / disconnected model? Well, it has to be supported by a cross-platform framework, and there is where Silverlight can play a significant role. Though Microsoft has not yet decided what is the disconnected persistence framework to adopt, I'd love if they chose something like Bamboo Prevalence over a classical relational based engine.
But what about the consumer market? Lately Microsoft has been traditionally in trouble on consumers. Can they pull an anti-iTunes service? Most unlikely. Can they capitalize their not so cool Mobile Platform by integrating into the Cloud? Well, there's a cool way to go, though traditionally Windows Mobile support is always the last one to get updated.
Let's wait and see.
Posted by Mário Romano at Monday, October 13, 2008 0 comments
Labels: Operating Systems
I was reading InfoQ's article on MPI.NET and the trend keeps on going: hardware is getting cheaper! Yes, this post is not about MPI, is about getting a Cray CX1 for $25k!
On the early 90's I remember a lecture at college where about a distributed system of Unix servers taking over the responsibility of a Cray supercomputer - apparently the only reason the Cray wasn't disconnected was for the tape library it controlled.
So then I believed Cray were a dying breed of dinosaurs. I was wrong, they are alive and kicking, and you can get one for the price of a regular server 10 to 15 years ago.
I never had so much need for computational power has I did on project SADPOF, an operational decision system for the forest. I'm talking about Simulated Annealing with multi-objective evaluation, huge parallel processing needs of huge chucks of data, with inner LP solving problems. When I'm talking about huge data, I'm talking about simulation variables of matrixes of floats of 6000 x 36 x 32 x 15. And calculating about 30 complex restrictions and a huge objective function.
Our test box was a 2x Quad core and it costed about $5K. A Cray would be welcomed, though MPI doesn't seem to much appealing to work with. What seems appealing is PLINQ, which will no doubt updated to work on HPCs using MPI.
Posted by Mário Romano at Sunday, October 12, 2008 0 comments
Labels: Hardware
I hate javascript. And the more you hate it, the more you'll like jQuery. Usually it shelves us from browser implementations, this time it didn't.
I have a standard pair of dropdowns with depending values I'm loading with jQuery. Something like:
$.getJSON(
"myJsonService",
"ID=" + $(dropdownlistFrom).val(),
function(data) {
$(dropdownlistFrom).fillSelect(data);
}
);
On Firefox all works as expected. But on IE8 beta, it activates the caching mechanism! I had to rewrite it to something like:
$.ajax({
url: "myJsonService",
cache: false,
dataType: "json",
success: function(data) {
$("dropdownTo").fillSelect(data);
},
data: "ID=" + $("dropdownFrom").val()
});
I've also tested on Chrome and Opera working as expected, not caching the data.
Finally I've tested on Safari 3 on Windows, and it just didn't work, cache or no cache! Strange, as jQuery should work on Safari.
Man, I hate javascript...
Posted by Mário Romano at Saturday, October 11, 2008 0 comments
Labels: Development
I've just installed my first ASP.NET MVC application on a IIS6 staging server. It's was a Preview 5, and here's how to:
This tells IIS 6 to process all requests using ASP.NET, so routing is always invoked, and there’s no problem. It’s dead easy to set up: open IIS manager, right-click your app, go to Properties, then Home Directory tab, then click Configuration. Under Wildcard application maps, click Insert (not Add, which is confusingly just above), then enter C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll for “Executable”, and uncheck Verify that file exists.
Done! Routing now just behaves as it always did in VS2008’s built-in server.
Option 1 is a temporary one, I have some time to choose the final one. This solution raises the performance problem posed by Omar AL Zabir that I'll have to address.
Posted by Mário Romano at Tuesday, October 07, 2008 0 comments
Labels: Development
Searching for development information is paradoxically getting easier and harder. Easier because there is more data to search. Harder for the same reason.
Though Google is always an option, it may be too broad place to search. So I often look for .NET related info on http://searchdotnet.com/, and probably should use more often the http://pipes.yahoo.com/pipes/ concept.
A cool site that has been re-launched http://blogsearch.google.com/. It's a bless if you're lost on a sea of results. One feature I just love is the published date filtering.
Posted by Mário Romano at Monday, October 06, 2008 0 comments
Labels: Development, Education, Technology
Mono 2 has been released!
Here are my highlights from Mono's highlights:
Microsoft Compatible APIs
- ADO.NET 2.0 API for accessing databases.
- ASP.NET 2.0 API for developing Web-based applications.
- Windows.Forms 2.0 API to create desktop applications.
- System.XML 2.0: An API to manipulate XML documents.
- System.Core: Provides support for the Language Integrated Query (LINQ).
- System.Xml.Linq: Provides a LINQ provider for XML.
- System.Drawing 2.0 API: A portable graphics rendering API.
Compilers
- C# 3.0 compiler implementation, with full support for LINQ.
Windows.Forms: New Controls
- ToolStrip and MenuStrip
- DataGridView
- WebBrowser (based on Gecko!)
- TableLayoutPanel
- FlowLayoutPanel
- SplitContainer
Pretty cool. Can't wait to get it on my Mac OS - hopefully I can get Windows.Forms to work there, Apple has broken Mono's Windows.Forms on 10.5. Let's see if can get back to writing cross-platform Windows.Forms apps again :)
Posted by Mário Romano at Monday, October 06, 2008 0 comments
Labels: Development
The Web Platform Installer Beta (Web PI) provides a single, free package for installing and configuring Microsoft's entire Web Platform, including IIS7, Visual Web Developer 2008 Express Edition, SQL Server 2008 Express Edition and the .NET Framework. Using the Web Platform Installer’s simple user interface, you can select specific components or install the entire Microsoft Web Platform onto your computer. To help you stay up-to-date with product releases, the Web Platform Installer always contains the most current versions and new additions to the Microsoft Web Platform.
Haven't tried it yet, but Hanselman has mentioned some cool options like "PHP Developer" or "Classic ASP Developer".
Posted by Mário Romano at Monday, October 06, 2008 0 comments
Labels: Tools
Now that IIS6 is being replaced by IIS, here a cool set of best practices. Don't worry, most of them should be used on IIS - you just have to figure out where they are hidden :)
Posted by Mário Romano at Saturday, October 04, 2008 0 comments
Labels: Technology
Well, Microsoft clearly is not as cool as Apple. But with this man as CEO, they seem to be on the right track:
Yes, I know, some of you must be saying: "are we aiming for cool or goofy? ". Well, it seems to work, as Microsoft developers seem to feel supported by this approach. And it is cool to work on technology on a company still lead by techies, not by suits.
Be sure to follow the related videos. Here's one about MacBook Air:
Posted by Mário Romano at Saturday, October 04, 2008 0 comments
Labels: Social
Ballmer is announcing a new operating system, Windows Cloud, at the company’s annual developer conference later this month, on a series of presentations.
Yesterday he did it again in Lisboa at Dreamway - unfortunately I couldn't attend, but everyone that I talked with was quite excited about it.
Microsoft has been working on the software + services for long (for instance in devCatharsis: Microsoft is Googling up, Software+Services != Software as a Service and Microsoft Architect Forum 2007 :: Session1: Software+Services), but this is the first time it is branded as a Cloud Operation System. Will the PDC show us a really all new concept, or just a service placeholder for connecting OSs to?
Posted by Mário Romano at Saturday, October 04, 2008 0 comments
Labels: Operating Systems
On the early 2000s I remember having a conversation with a friend about name branding, and used Pararede as an example.
Pararede started its business on networking infrastructures, hence the name (in english something like "For-net"). But the company grew out of its early market and the name just stopped making sense.
On that conversation I advocated Pararede should change its name. My friend disagreed, as a brand's name is a value asset that takes ages to build.
Well, it seems like Pararede opted to change it's name after all. Now it's called Glintt. How strange, a Web2 like name on a company like Pararede...
If you're reading this post, my friend, I'm imaging your reaction: "this doesn't mean they are right, they could be making a big mistake". Well, you're right, Borland did go forth and back to Inprise, only time will tell.
<update>
Well, Glintt is not really Pararede rebrandind, is more like the result of Pararede and Consiste merge. Still Pararede is acquiring Consiste...
</update>
Posted by Mário Romano at Saturday, October 04, 2008 1 comments
Labels: Social
One of the first errors I've detected on my early MVC code was the tendency to load some list of values directly on the view. For instance:
<%= Html.FormHelper().Select(
"MyListOfValuesID",
Web.Factories.ServiceFactory.Resolve<IMyListOfValuesService>().FindAll(),
"Name",
"ID",
new Hash(selectedValue => new[] { ViewData.Model.Item.MyListOfValuesID }, firstOption => "")
)
%>
This loading is clearly a controller's responsibility, but I've found it very easy and natural code to write. Too easy.
That brings's me a question: aren't we making a design error when we write controller and views on the same assembly? Shouldn't we make sure all behavior a view could get their hands on should be given by controllers, and never by services? We do it for ages on other layers, for instance we don't expose data layers to UI.
That said, it's really strange no MVC project I got my hands on has ensured this isolation. Probably because these project are all demos, and demos have to be short and concise.
Posted by Mário Romano at Saturday, October 04, 2008 0 comments
Labels: Development
Today I learned the hard way the problem of assuming behavior. I assumed IDisposable would clean up the session, but I was wrong.
It seems like we still have to invoke Close explicitly. The documentation clearly recommends the following pattern:
try
{
...
client.Close();
}
catch (CommunicationException e)
{
...
client.Abort();
}
catch (TimeoutException e)
{
...
client.Abort();
}
catch (Exception e)
{
...
client.Abort();
throw;
}
I wasn't closing the client proxy, so I was reaching the default WCF 10 concurrent calls limit. The funny thing is that the integration tests were working fine, but not the corresponding ASP.NET usage. Why? Here's a possible explanation:
Hopefully, you were clued in enough to know you need to dispose these objects... but the problem is that (...) the (...) code blocks will cause major problems in a production environment. The choice the WCF developers made here is questionable at best and goes against everything you thought you knew about the IDisposable interface. Everywhere else in the .NET framework, you can count on Dispose cleaning up your object... not so in this case. The problem is that Dispose actually calls Close, and if you are using something like the WsHttpBinding, Close doesn't just clean up resources managed by the object. Close actually needs to make a call to the server and tell the server to clean up your session before it shuts down. When that call back to the server can't be made for any reason--which can happen quite often--Close fires an exception and the object is not disposed. There is another method, Abort, which you need to call to clean up the object's state.
Posted by Mário Romano at Tuesday, September 30, 2008 0 comments
Labels: Development, Technology
Microsoft has published some information about Visual Studio 2010 and the .NET Framework 4.0 today. Here are some links about it:
http://www.microsoft.com/presspass/press/2008/sep08/09-29VS10PR.mspx
http://msdn.microsoft.com/en-us/vstudio/products/cc948977.aspx
Visual Studio Team System 2010 Week on Channel 9:
http://channel9.msdn.com/posts/VisualStudio/Visual-Studio-Team-System-2010-Week-on-Channel-9/
Heard about it here.
Posted by Mário Romano at Tuesday, September 30, 2008 0 comments
Labels: Development, Tools
Uau!... Scott Guthrie as just announced that Microsoft is distributing jQuery with Visual Studio!
This is awesome, instead of re-creating what already exists, Microsoft is learning to integrate. Wouldn't it be incredible if Microsoft didn't have to re-create a DI, a logging platform, a full blown ORM mapper, among others?
Keep them coming. You're on the right track :)
Posted by Mário Romano at Sunday, September 28, 2008 0 comments
Labels: Social, Technology
Ok, Android is a cool phone, but it still lacks a bunch of obvious features like:
My old WM6 does it all.
Posted by Mário Romano at Sunday, September 28, 2008 0 comments
Labels: Gadgets
Yes, is true, I finally got myself a real project willing to accept the ASP.NET MVC Preview 5. I'll save my impressions for a future post, for now I'm just interested on sharing my options.
My first thing I had to opt was how to express the model. I've opted by a strongly-typed approach. For the backoffice models I've decided to create the following classes:
/// <summary>
/// Base class for data driven models.
/// </summary>
public abstract class BaseViewData
{
private readonly List<string> displayList = new List<string>();
/// <summary>
/// List of messages to display.
/// </summary>
public IList<string> DisplayList
{
get
{
return displayList;
}
}
}
This is the base class for all the models - for now it just hold the list of messages to display. Please note that this is the MVC model, not the domain model.
Let's move to the first implementation: ListViewData<T>. This class is a generic of domain model entity classes, and represents a simple listing view data:
/// <summary>
/// Model view data for simple listing pages.
/// </summary>
/// <typeparam name="T">Domain model entity class.</typeparam>
public class ListViewData<T> : BaseViewData
{
/// <summary>
/// List of items of type T.
/// </summary>
public IList<T> Items { get; set; }
}
Not precisely rocket science, but if simplicity is important to software process in general, adn according to my readings, it seems to be critical for the success of MVC implementations. Armed with this simple classes, we can now do a simple change to the view code behind:
public partial class List : ViewPage<Models.ListViewData<DomainModel.MyEntity>>
{
}
So we can now fire away our view and code something like:
<%= Html.DisplayMessages(ViewData.Model.DisplayList)%>
DisplayMessages is a simple extension that implements... the messaging displaying itself...
Now for the grid. I've opted for the MVCContrib Grid implementation. Ok, not as cool as rendering the markup from scratch, but what can I say, I'm lazy.
<%
Html.Grid<MyEntity>(
ViewData.Model.Items,
column => {
column.For(p => p.Name, "Name");
column.For(p => p.Description, "Description");
column.For(p => Html.ActionLink("Edit", "Edit", new { id = p.ID }), "Edit").DoNotEncode();
column.For(p => Html.ActionLink<MyEntity>(
c => c.Delete(p.ID),
"Delete",
new { onclick = "javascript:return confirm('Confirm operation?');" })
).DoNotEncode();
}
);
%>
The only radical option I had was not to use ASP.NET server-side controls (like repeaters, textboxes and others). If I understand correctly, though these controls can be use on MVC, they are not MVC-ecosystem friendly, as they are fat, not always XHTML compatible, don't guarantee support for accessibility and still depends on ViewState for some operations.
For editing the entity itself, I wrote an equivalent class, ViewData<T>:
/// <summary>
/// Model view data for simple editing pages.
/// </summary>
/// <typeparam name="T"></typeparam>
public class ViewData<T> : BaseViewData where T : new()
{
private T item = new T();
/// <summary>
/// An item of T.
/// </summary>
public T Item
{
get
{
return item;
}
set
{
item = value;
}
}
}
Same with the view code behind:
public partial class Edit : ViewPage<Models.ViewData<DomainModel.MyEntity>>
{
}
And with the view itself:
<form action="<%= ViewData.Model.Item.ID != 0 ? Url.Action("Update", new {id = ViewData.Model.Item.ID}) : Url.Action("Insert") %>" method="post">
<table>
<tr>
<td>Name:</td>
<td><%= Html.TextBox("Name", ViewData.Model.Item.Name)%></td>
</tr>
<tr>
<td>Description:</td>
<td><%= Html.TextBox("Description", ViewData.Model.Item.Description)%></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="<%= ViewData.Model.Item.ID != 0 ? "Update" :" Insert" %>"/></td>
</tr>
</table>
</form>
Naturally not all models depend entirely on a sole Domain Entity. Some do depend on depending entities, like:
<%
Html.Grid<YetAnotherEntity>(
ViewData.Model.Item.YetAnotherEntities,
column => {
column.For(p => p.Name, "Name");
}
);
%>
But for the rest of the scenarios, we should define a class for the model. Something like:
public class MySpecialListViewData : ViewPage<Models.ListViewData<DomainModel.AnotherEntity>>
{
public bool ShowSomething { get; set; }
}
Posted by Mário Romano at Sunday, September 28, 2008 0 comments
Labels: Development
I spend a considerable part of my time reviewing and refactoring code. Code written by interns I coach, master thesis students I accompany, external projects I'm asked to audit, and last but not least my own code.
For ages, code reviewing and refactoring was considered a luxury most projects could easily live without, but on the last years it finally got mainstream acceptance - yes, today I can even explicitly add refactoring tasks to my projects planning :)
Tools have been accompanying this trend. Tool like Resharper on what Patrick Smacchia refers as the micro level (i.e methods' body structuring). But when projects fail technically, they usually do it on a macro level (i.e class, namespace, assembly structuring), and here is where NDepend comes to the rescue.
NDepend is a tool that analyze .NET code base structure against a set of design rules, suggesting refactoring and allowing version metrics comparisons. Yes, making part of my job. Oopss...
Here are some of the basic metrics anyone would expect to find:
And here are some cooler ones:
Most of this metrics come with recommendations. For example:
Methods where NbLinesOfCode is higher than 20 are hard to understand and maintain. Methods where NbILInstructions is higher than 40 are extremely complex and should be split in smaller methods (except if they are automatically generated by a tool).
Or this:
Code where the percentage of comment is lower than 20% should be more commented. However overly commented code (>40%) is not necessarily a blessing as it can be considered as an insult to the intelligence of the reader. Guidelines about code commenting can be found here.
Let's give it a try against a small R&D project written with NetTiers. I'll use VisualDepend, the interactive tool. A command line utility is also available, but I'll save it for a future post on continuous integration.
The rules are expressed using a cool DSL for code metrics: Code Query Language (CQL). You can express queries like:
// <Name>A stateless type might be turned into a static type</Name>
WARN IF Count > 0 IN SELECT TOP 10 TYPES WHERE
SizeOfInst ==0 AND
NbInterfacesImplemented == 0 AND // To be accurate, this constraint doesn't take
// account of types that implement some interfaces.
!IsStatic AND
!IsGeneric AND
!IsInterface
// It indicates stateless types that might eventually be turned into static classes.
// See the definition of the SizeOfInst metric here http://www.ndepend.com/Metrics.aspx#SizeOfInst
Cool, you can use the set of rules that come defined out-of-the-box, and you can always write your own.
Here's another favorite of mine:
// <Name>Fields should be marked as ReadOnly when possible</Name>
WARN IF Count > 0 IN SELECT FIELDS WHERE IsImmutable AND !IsInitOnly
// A field that matches the condition IsImmutable is a field that is assigned only by constructors of its class.
// For an instance field, this means its value will remain constant throught the lifetime of the object.
// For a static field, this means its value will remain constant throught the lifetime of the program.
// In both cases, such field can safely be marked with the C# readonly keyword (ReadOnly in VB.NET).
// The condition IsInitOnly matches fields that are marked with the C# readonly keyword (ReadOnly in VB.NET).
And look, we can see it against the metric view:
Oopos, lots of potential refactoring here (the blue components)... This view components are directly proportional to the metric - in this case, number of fields by type. Yes, NetTiers appications tend to do it.
As expected, NDepend help you identifying dependencies. For a start, it does it graphically:
But graphical dependencies are hard to scale, so the matrix representation is my favorite one to keep track of dependencies:
Finally an important artifact to give you an idea of where you stand is this graph that represents abstractness and stability:
I read a lot of code - anything I can get my hands on. One thing I've been doing lately is running NDepend against all the code I can - I find it most educating.
The tool itself is very drillable and effective. The only problem I had with it was the lack of support on some actions on x64, but since version 2.10 full 64 bit support was added.
Give it a try. A must.
Posted by Mário Romano at Sunday, September 28, 2008 0 comments
Labels: Development, Tools
Guthrie has just announced it.
I'm having some troubles with visual studio sudden disappearance (the dreadful .NET Runtime version 2.0.50727.3053 - Fatal Execution Engine Error (742A5E00) (80131506)) after SP1 or Silverlight 2 beta2 installation, so I'll probably skip this one.
Posted by Mário Romano at Friday, September 26, 2008 0 comments
Labels: Development, Tools
Here they are Not much revolution here, it looks like some minor shell changes, some old applications got to be redesigned with the Office ribbon, a lighter media player, among others. And UAC seems to be less poppy. Hopefully it will be less resource hungry.
Is Microsoft finally learning to keep their secrets?...
Posted by Mário Romano at Sunday, September 21, 2008 0 comments
Labels: Operating Systems
The trend doesn't stop: Google search keeps rising, Microsoft plunging. The latest data reports Microsoft US Search dropping below 1 Billion hits last August.
And with respect to Mobile things are preparing to get worse: in a couple of days T-Mobile will release the first Google based phone. A phone with Google's brand and usability and opened to application development will surely eat much of Microsoft's share.
On the browser market, IE is still loosing space against Firefox (ok, Firefox is not Google, nevertheless Google pays 85% of Firefox's bills). And Chrome will rise, the only doubt is who will give away more market share to Google.
So what should Microsoft do about it?
The time to sell just using Microsoft's brand as come to an end. Worse, Microsoft is experiencing a brand erosion effect, at least when compared to Apple and Google's branding.
So part of the solution is on the march: the PC Is not a Stereotype campaign. Ok, it doesn't work against Google, just Apple, but still a great start.
Posted by Mário Romano at Sunday, September 21, 2008 0 comments
Labels: Social
When talking about Java and .NET people tend to get radical and irrational - I know I do. So I'll try to be write this post as objectively as the sacred .NET and heretic Java deserve.
On the beginning there was C and C++. Well, not exactly the beginning, let's say at the beginning of this war.
Then some enterprises embraced VB as a RAD platform, and VB ruled. VBScript and ASP came following and also ruled.
Then the Devil created Java. Java was beautiful on the blueprints, but lacked maturity. The ubiquity it observed made some believe it would be the solution for enterprise integration - they were wrong, the dictatorship of one language just failed. But slowly Java appeared as a solid enterprise environment, so it started to gain position on the financial markets.
Then God create .NET. It was basically a Java ripp-off, a virtualized environment with a great and well organized class library armed with a solid garbage collector. Where Java environment was multi-platform, .NET was multi-language - yes, today JVM supports a lot of languages, but not back there.
.NET was everything Java wanted to be. Solid, well designed, learning from the Java errors, it only had a problem: it was locked to Windows.
So .NET was immediately accepted even by most of those who hated Microsoft. More, Microsoft promoted a different kind of community, much broader and open-sourced, and it worked! .NET was now the new Java! More, it learned to incorporate Java concepts with ease, so kept growing side-by-side with his evil brother.
.NET had another advantage: it was drawn from one division, so it grew solid and consistent.
So where are we now in respect to Java / .NET war? Well, from my experience:
Here are some cool links about it:
Posted by Mário Romano at Wednesday, September 17, 2008 0 comments
Labels: Technology
Arghh, I have some hundreds of megs of file standing on Mozy and can't get them into my Windows Server 2008:
MozyHome may not be used for server backups.
What you can do:
Transfer your MozyHome license onto a valid desktop or laptop, or sign up for a MozyPro Server license to back up your server.
Arghh, how can you explain Mozy I use Windows Server 2008 as a desktop?... Well, seem like I have to use Mac to restore them.
Posted by Mário Romano at Monday, September 15, 2008 0 comments
Labels: Tools
I waste a lot of time archiving mail by project. So the question is: why can't we just extend mail fields?
Just imagine:
If we could extend mail, a "Project" field would probably the first one we's use. a
PS: here's how I use the "Project" field today: I embed it on the subject field, something like "[Project A] Kick-off meeting".
Posted by Mário Romano at Monday, September 15, 2008 0 comments
Labels: Tools
Ok, automated guidance in context is cool, but you can't just replace good old classic guidelines. Here they are, from the patterns & practices App Arch Guide 2.0 Project:
(from the Guidelines Index page).
Here's the announcement from J.D. Meier.
Posted by Mário Romano at Friday, September 12, 2008 0 comments
Labels: architecture, Education
I've been getting some "Project location is not trusted" on my local drive. I've finally decided to google it, and found out the answer here. And yes, it makes sense, the problem arises when downloading code from zip files, leaving the files blocked on a low thrust zone.
Unblocking all the files is a tedious task, so ZoneStripper is a life safer!
Posted by Mário Romano at Friday, September 12, 2008 0 comments
Labels: Tools
I'm trying a free account of Dropbox, a easy to use sync and share tool. For now I'm syncing a Windows and Mac, but I'll probably install it on my Linux desktops. My favorite features: desktop integration (though pretty much Tortoise-like icons...) and version control.
Here's a cool list of sync utilities: Five Best File Syncing Tools.
Posted by Mário Romano at Friday, September 12, 2008 0 comments
Labels: Tools
I was reading Hanselman's Microsoft IE8 and Google Chrome - Processes are the New Threads and found this cool Chrome links:
about:network
about:stats
about:dns
about:memory
<update>
about:cache
about:histograms
</update>
Posted by Mário Romano at Thursday, September 11, 2008 0 comments
Labels: Tools
Scrolling through tabs is a common operation that can be achieved through CTRL-PageUp and CTRL-PageDown shortcuts. It works on Excel, Firefox, Chrome, but strangely isn't supported on IE8 beta2. Did it stop working, or IE never implemented this useful feature?
Posted by Mário Romano at Wednesday, September 10, 2008 0 comments
Labels: Tools
Let's face it: Entity Framework suffers from a huge architectural problem: the business entities are tightly couple with Entity Framework.
Here a band-aid: Persistence Ignorance (POCO) Adapter for Entity Framework.
It uses an adapter layer that will translate between POCO objects and Entity Framework-aware objects and provide services on top of POCO objects, such as:
Change tracking (snapshot-based and proxy-based when possible)
Transparent lazy loading
Immutable Value Objects
Queries (LINQ and Entity SQL)
Shadow state (maintaining certain persistence-related fields outside of entity class)
It includes a library helper and a code generator which generates the adapter layer.
And here's Kowalsky's article about it.
Posted by Mário Romano at Wednesday, September 10, 2008 0 comments
Labels: Tools
Google has just launched a High-resolution satellite. The corporation that Claims Ownership of Everything You Create on Chrome, From Blog Posts to Emails, the same that holds much of our mails, consumer habits and search trends, the company that wants a sub-continent-wide radio-frequency, the company that want's to control the internet end-to-end with Chrome (and a sure to come supporting Google OS), that very same corporation now can take high-res pictures for their own usage.
For some strange reason, people just feel comfortable with this.
Arghh, I give up.
Posted by Mário Romano at Tuesday, September 09, 2008 0 comments
Labels: Social
After a brief discussion about Firefox / IE market share with my colleagues, I've (arbitrary) decided to trust MarketShare to tell me this kind of info. According to them, IE falled to 72.15%, and Firefox is still gaining track with 19,73%. Last October it was 78.36% / 14.97%.
Can you suggest a better stats report?
Posted by Mário Romano at Monday, September 08, 2008 2 comments
Labels: Tools
Douglas Purdy is on his way to PDC, where he will begin unveiling project Oslo. So what is Oslo?
- A tool that helps people define and interact with models in a rich and visual manner
- A language that helps people create and use textual domain-specific languages and data models
- A relational repository that makes models available to both tools and platform components
So what else is new, Oslo is the modeling platform that will allow us expressing DSLs. But wait, here's what I like about Douglas's vision:
Oslo is the first step in my vision “to make everyone a programmer (even if they don’t know it)”.
And this can very well be the first step toward The future of my profession.
Posted by Mário Romano at Sunday, September 07, 2008 0 comments
Labels: Technology
Here is the first Seinfeld / Gates ad. Good news is that is not being offensive to Apple, the bad news is that you must have a master in advertisement to understand it.
Posted by Mário Romano at Sunday, September 07, 2008 0 comments
Labels: Social
Google Chrome task management is one of the cooler features. And the task manager is just awesome. The only problem I have is that, until the rich RIA applications start poring down on our browsers, the resource we all know that wastes CPU and networking is Flash. And it looks like their is only one and only reference to the Flash plug-in on Chrome task manager:
That being said, I'd risk to predict that for this class of resource usage, Chrome won't help us identifying the guilty tab for most of our present cases.
Still a great feature and browser.
Posted by Mário Romano at Friday, September 05, 2008 0 comments
Labels: Tools
Here's a great TFS guide. Thanks for the tip, Cab_Ux.
Posted by Mário Romano at Friday, September 05, 2008 0 comments
Labels: Development, Education
Oops, I'm not the only lunatic. Here's another one.
PS: my hand is raised :)
<update>
Here's another one: Google on Chrome EULA controversy
</update>
Posted by Mário Romano at Wednesday, September 03, 2008 0 comments
Labels: Tools
Here's a cool IE8 add-on: AdBlock Pro. I've been using it for a week, and it works fine.
Ad blocking your browser is one of the feature most geeks can't live without. I have mixed emotions about them. Business that depend upon them advertising just hates them. Google will be happy to control ad blocking over their new browser, but until them, you'll have to stick to Firefox and IE to get it done.
Thanks for the tip, Pita.
Posted by Mário Romano at Wednesday, September 03, 2008 0 comments
Labels: Tools
Nothing much to say here. Google now has it's browser, Google Chrome. It is opensourced, light and minimalist, fast and easy to use. WebKit is a fast rendering engine, V8 promises to be a faster javascript engine. RIA experience will most probably explode, and this is the best news. Tab fault isolation is my preferred feature. Next is the well designed tab memory management,
Not all Chrome's features are new - Firefox and IE8 share some if not most of them.
For now it is quite harmless, but when armed with a future Google minimalist OS, and over Google minimalist window manager, will bring end to end autonomy to Google. Can't it be possible that nobody cares about being totally controlled by Google?
Now I'm beginning to understand those conspiracy theory lunatics warning us about aliens and underground politics ...
<update>
My current experience: IE8 is now the browser that uses less memory. Followed by Chrome (it problably didn't have a chance to make use of it tab memory management features). Firefox3 is absolutely disastrous - please note, I'm loading 7 or 8 add-ins. Some thing with startup time.
</update>
Posted by Mário Romano at Wednesday, September 03, 2008 0 comments
Labels: Tools
Here's an integrated code duplication analyzer: Clone Detective. A Simian like Visual Studio integrated tool. Cool!
Posted by Mário Romano at Wednesday, September 03, 2008 0 comments
Labels: Tools
I've already blogged about it, but now it seems more mature - and named differently? Anyway, here's a tool to follow. It can help us produce elegant and consistent code. As Fowler wrote:
Any fool can write code that a computer can understand. Good programmers write code that humans can understand
Posted by Mário Romano at Monday, September 01, 2008 0 comments
Labels: Development, Tools
Atwood warned us of an old way to defeat a class of cross-site-scripting. Yes, it deserves a re-issuing and refreshing, but above all we do it the guidance way. Yes, it is there...
Posted by Mário Romano at Monday, September 01, 2008 0 comments
Labels: Development
It is not new, and quite obvious, the way to access HyperV networking over the wireless adapter. Here's why we can't do it directly:The reason for this is because in order to perform our virtual networking - we implement an OSI layer 2 filter driver that creates network packets with the MAC address of the appropriate virtual machine. Unfortunately the wireless networking standard explicitly forbids the creation of network packets with different MAC addresses to that of the physical computer (for security reasons). To handle this - when we detect that we are using a wireless network adapter we create packets where some of the MAC addresses in the packet match that of the virtual machine - while the other MAC addresses match that of the physical computer.
It seem like it was too much AP dependent - sometimes it worked, sometime it didn't.
Posted by Mário Romano at Monday, September 01, 2008 0 comments
Labels: Operating Systems
I have mixed feelings about this tool. It is simple to use, allows GPS data to be added to my photos, integrates with Virtual Earth, and finally: it is a .NET application :)
On the other side it seems quite unpolished. For instance, it often crashes upon unexpected scenarios, and uses the regional settings to load the NMEA data. Yes, I have to change my settings in order to run this tool... Another particularity about this piece of software is that its first versions weren't obfuscated.
It's a pity that the application I use for my photo capture workflow, Adobe LightRoom, doesn't support it yet. But wait, there's a plugin, geotag-lightroom-plugin. I'll give it a try.
Posted by Mário Romano at Saturday, August 30, 2008 0 comments
Labels: Tools
Though using IE, Firefox, Opera and Safari, the truth is Firefox is the browser I end up spending more time in. This trend may change with IE8 beta2. After a disappointing and unstable Firefox3 (and the first IE8 beta), IE8 Beta 2 is finally showing it's claws!
IE8 is full of new features like WebSlices, Accelerators, auto complete, multiple-engine support (IE7, IE8 compatible and native mode), InPrivate browsing and other cool safety features, out-of-the-box developer tool and finally a decent firefox-like text search tool.
Having the possibility to make the sites compatible is an important asset, now that Microsoft decided to pay the price for not following the standards. What I still lack is the cool FireFox add-ins. Wouldn't it be great if someone developed a Firefox/IE addin translator?...
Posted by Mário Romano at Friday, August 29, 2008 2 comments
Labels: Tools
In the 30s of the last century, the Lisboa-Porto line was never on time. Though users kept complaining about delays, the train records kept logging no such delays, and both train and station managers stood by those logs.
Something was terribly wrong, so the train company's president himself decided to take a train to sort it out. For each and every station the train arrived later and later, and for each and every station the train and station managers logged it as being on time. It was quite amusing, being as late as 30 minutes and hearing the station's manager screaming "On table!!!".
The president confronted the data with the train and station managers, and they finally told him what was wrong: it was impossible to keep the proposed timetable, so they opted to fake the logs. The president took two obvious measures: updated the timetable and fired those who faked the logs.
Why am I talking about trains on what should be a geek's blog? Because in a way we also suffer from this problem. As we presently are still unable to predict correctly our project's effort we keep getting late on our timetables. And for the same strange reason as with the train people, some people don't report the delay as soon as we should, not leaving too much track to recover from.
Right now we have no way to anticipate correctly our timetables. But once our train starts, we can measure our effective speed and measure where we are against these timetables. Though our project management practices already enforce these measures, they are only as accurate as the information they receive, so the teams should be trained to log delays as soon as possible. I'm talking about intra-task delays and that gut feeling only the team can sense as that all the estimation is going down after just a week's work.
And finally, as timetables are presently hard to do accurately, we should do something about it: better effort history management, and sharing the timetable's risk with our client. At least until our project's effective speed is taken.
Posted by Mário Romano at Thursday, August 28, 2008 0 comments
Labels: Project Management
Sorry, couldn't help picking on Entity Framework. Ayende has annouced it, NHibernate 2 final is out! May the best win. Wait, better yet, may they both win.
Posted by Mário Romano at Tuesday, August 26, 2008 0 comments
Labels: Database, Technology
I've been doing some off-trail hiking on this holidays, and logging them on my GPS. To convert them into KML, I've started using an online tool, GPSVisualizer. This is a cool converter, but I really needed an offline tool, so here are a couple of free tools that also run on Mac OS:
Posted by Mário Romano at Monday, August 25, 2008 0 comments
Labels: Tools
Microsoft finally got tired of Apple's advertisements of bad manners, and decided to answer with the same guns. For ages, Apple has been investing on a series of bad taste advertisements thrashing Microsoft, so they come up with a new $300 million advertising campaign, devised by a newly hired ad agency.
Microsoft enlisted Jerry Seinfeld in its ad battle against Apple, but this is just one of the new troops on the way.
To be honest, I'd rather Apple stopped the bad manners trend. Unfortunately, this won't happen, and Microsoft is lowering the war to Jobs level.
Posted by Mário Romano at Thursday, August 21, 2008 0 comments
Labels: Operating Systems