Archive for the ‘ASP.NET’ category

Free Microsoft Press E-Books !

2008/01/02

Microsoft Press is handing out 3 books:

– Introducing Microsoft LINQ by Paolo Pialorsi and Marco Russo

– Introducing ASP.NET Ajax by Dino Esposito

– Introducing Microsoft Silverlight 1.0 by Laurence Moroney

Silverlinght 1.0 is probably a bit outdated (with 1.1/2.0 close), but the others should be good, judging by the authors. Dino Esposito wrote couple of very good books on ASP.NET and .NET.

See this blog for more details and download links.

Microsoft will ship MVC for ASP.NET ?

2007/09/27

From Scott Guthrie’s interview on .NET futures

SG: We’ve seen demand for an MVC framework on two fronts. One is for even more testability, having the ability to completely mock-up a request. We’ve also always seen with ASP.NET that some people like having the server control, postback model; some people say, “I just want absolute control.”

The MVC framework we’re coming up with is a fairly simple MVC model, it’s very clean, it’s a front controller model, and it integrates very well into ASP.NET so you can use ASP.NET forms authentication, session state, security, personalisation, caching, all the standard features, but with an alternative to the postback model where you have a more traditional controller-view separation and have complete control over your HTML.

The other thing is that for the view, you can use .aspx templates, master pages and all the Visual Studio tool features. It integrates nicely into ASP.NET and preserves everyone’s investment. You can have a single app that has both pages built with MVC and pages built with postback. People can choose.

See http://www.itwriting.com/blog/?page_id=329

Finally – if that happens, maybe next time when I will be crossing the platform boundaries going back from Java and Spring to ASP.NET on the next project, I will not have that old feeling as in 2005: yes, this ASP.NET thing works, one can build pretty decent application in it and is not really so bad after you get used to it – but is still sooo inflexible and limiting compared to the beauty and simplicity of Spring MVC, or Webmacro.

Looking forward 🙂

MSDN Documentation – the worst in class ?

2007/06/14

Did it ever happened to you that you were using some tool day after day – and never realized it’s pretty big deficiencies ? Until somebody, coming from different background pointed out what everything is wrong with the tool ? Before that moment of revelation, the issues were just inconvenience, but right after that they became real annoyance ?

Exactly this happened to me last week and the credit for pointing out what is wrong with MSDN documentation (and the “standard” .NET documentation format in general) goes to Joel 🙂

For developer using object oriented language such as C#, Java or Ruby, what you need on daily basis is to find information about a class, see its public interface,members, constructors, method signatures. Ideally, on single page, with possibility of drilling down to the details of a method and to a code example. You also very often need to see all implemented interfaces, have easy access to parent class and (in case of e.g. an interface inside a framework) to access the implementing classes or derived classes within this context.

Unfortunately, the Microsoft .NET documentation makes this simple task not exactly easy, pleasant or fast. As an example, lets take something really simple e.g. DateTime struct. In the documentation, information about this simple class are separated to 6 pages: datetime structure itself, Members, Fields, Constructor, Methods and Properties. If you would expect that with this devotion of low level categorization the particular page for e.g. Methods will give you all details about all DateTime methods, you are wrong. What Methods page gives you is just list of names, not even a method signatures – parameter types and return values are missing. To get this information, you must click through into the page dedicated to that method. If the method is overloaded (take e.g. omnipresent ToString), the Methods page contains only one name and only the next page gives you the signatures, linked to another page with details. See for yourself

picture-2.png

In addition to bad information structuring, almost every link causes full page reload.

Compare with how much more usable is the Java documentation: it is very easy to see all interfaces, methods, constants, parent classes, implemented interfaces in single page. The dated frames-based UI actually makes lots of sense and is (except AJAX based dynamic site) much better way how navigate the documentation.

With all that said, I am not surprised that the tools such as Reflector are so extremely popular in .NET world. It not only provides very useful debugging/inspection tool, but thanks to excellent and compact presentation of information about the class retrieved from reflection, they are the fastest way how to get meaningful information on core classes API. Other than Reflector, the other fast way how to get information on .NET core library details is Google search.

Try for example how fast you can access a documentation for particular class starting with Google search – let’s take e.g. WebConfigurationManager. Google search returns blazingly fast (as always) – with the MSDN page as first hit. Now compare how fast you will get the same information starting from MSDN home page, (which is btw, advertising ‘new and improved search and navigation‘). Your mileage may vary, but I usually see 3-8 seconds delay in search response (compare to <0.5 sec for Google). Few seconds seems like no problem, but when you do it all the time, it easily becomes pretty annoying. Even more so when you realize that Google is searching WHOLE WEB, with content they do not own or control, only index and rank, whereas MSDN search is searching MSDN data repository, which is – however you measure it – by many orders of magnitudes smaller and Microsoft fully controls most of it’s content.

Why cannot the largest and most powerful software company create documentation that is useful and usable ? Even the documentation for the OpenSource Mono project (port of .NET to Linux and other platforms) is *much* better than the original. See the class DateTime there for comparison: the menu is dynamic and does not reload page every time you click on a link, the methods have full signatures and everything is on single page with local links and only details are on second level page.

Code in Ruby under ASP.NET: coming soon ?

2007/06/02

The support for using dynamic languages such as Ruby or Python to code ASP.NET pages was announced for future versions of ASP.NET in the ASP.NET futures.

Unless I am mistaken, it means that we eventually will be able to write control event handlers in Python or even Ruby – which is certainly more fun than in VB.NET or even in C#, but is it really so important ?

What would be *really* cool if the whole ASP.NET become more agile and more “rail-ish”. To make overall architecture more flexible – such as departure from not very flexible page-centric architecture towards MVC and routing. Maybe some version of ActiveRecord ? Or even multiple (and pluggable) template languages ? That would be really something.

Rails' ideas everywhere

2007/05/09

Since I got through “Rails immersion”, I keep seeing the implementations of the same idea everywhere. Latest find is Subsonic, which implements Active Records in .NET space. Rather than writing more, see this screencast.

Fixing broken ASP.NET development environment

2007/05/03

I had again the not-so infrequent pleasure of setting up fresh copy of Windows development stack. We were moving few machines between projects and to make sure that no forgotten source files are left on the harddisk, we reformatted and reinstalled Windows from scratch. It is usually good idea anyway, because developers like to install strange tools and utilities and generally customize machines to their own taste, which tend to be unique and is seldom shared.

We needed to set up usual development tools: Framework 2.0, Visual Studio, SQL Server 2005 with AS, as we will be doing few OLAP related modules. Plus Subversion client, some 3rd party tools (such as Notepad++, TotalCommander, Putty, Firefox with developers plugins) and so on. Not a rocket science, obviously – just needs to be done in proper order and not forget to include all needed components. If you install on Windows XP Pro, the usual catch is to forgot installing IIS first. Without IIS, the ASP.NET does not get configured out of the box and you have to register it manually by running aspnet_regiis.exe -i command, well hidden inside the Framework directory. Which is exactly what happened – on two machines, because both were imaged from same image, lacking the IIS component.

So we did the above step and afterwards one of the machines worked just fine, whereas the other kept throwing weird error on every attempt to debug an ASP.NET application with VS 2005. Now the fun began. The error message was a bit misleading – indicating that the problem is in running/attaching debugger on ASP.NET process. But even the access to ASP.NET application was broken, giving back 500 Server error and recommending to check event log. Which we did – and found absolutely nothing useful in there. After some digging, fruitless googling, checking the user membership in various groups and accounts under which the ASP.NET process was running … the solution to the problem were directory permissions. On the machine which worked, the directory hosting Web app was writable by group Users. On the other it was not. Setting permissions that allowed ASPNET account read and write the directory fixed it all.

So what is my point and why am I documenting this fairly uninteresting issue ? Few points and observations actually. First, it would be very helpful if with such huge and complex tools as Visual Studio Microsoft would provide some checks and diagnostics that would indicate which parts of tools work and which do not work. The error messages should be much more detailed and provide some context about what went wrong. In Java world, having the stack trace in Tomcat log file would immediately clarify what can and what cannot be the cause. Using plain old text files for logging is probably better that stuffing everything into event log. Event logs may be great for system admins and remote access, but for developers, text file with meaningful content is more than adequate.

Second, the approaches that some people use when troubleshooting installation problem are unbelievable. Relying on Google results will often lead you in completely wrong direction. I was amazed how many crazy things were people trying to get rid of the error message as ours: “What worked for me was to install framework 1.1, switch ASP.NET from 2.0 to 1.1 and then back”. One cannot exclude that this may have impact – and even fix the problem – but obviously, the fix is caused by some side effect which may or may not work on your machine. What is actually happening is people are trying to fix something they do not really understand, by attempting random actions and observing the impact. The problem may be in low experience level of the users – but also in bloated, messy environment of Windows system files components and their complex inter-dependencies. These two together create strange culture of frustrated users trying to catch black cat in dark room – and in half of the cases, the cat is even not there.

Last but not least – without deep understanding what exactly gets installed where and how it depends on other components, you can be 100% sure what is the root cause of the problem – and where to look for solution. It would take us much less time to fix the issue if we were not try to fix assumably broken ASP.NET installation – because we knew we did skip one step, this was first thing to look at.

This is one thing where Java got it right – or at least much better than Windows. All you need to have is correct path settings (to include the version of JRE you want) plus JAVA_HOME variable pointing to it and rest is just making sure you have correct classpath that contains all jars. Adding components or plugins is matter of copying files to proper place, no installers and registry is involved. You can (and I do) have six different configurations and versions of Eclipse on your harddisk: one barebone, to test the new plugins, one with MyEclipse IDE, one with Web Tool Project, one with Ruby Development tools and RadRails (all 3.2 based), plus old 3.0 version to support older projects. I also do have three different installation of Apache Webservers – version 1.x, version 2.x and the “portable” version inside XAMP without any issues at all. Not speaking about approximately 5 versions of Tomcats and few other J2EE servers coexisting peacefully …

Now just try to install and run side by side just two installations of VS2005 with different set of plugins – and compare the experience. Your best bet is run two full Windows installations inside VM or using two workstations …

New great podcast

2007/04/27

Running out of Security Now! and TWIT episodes, I have subscribed and started listening to few newly discovered podcasts.

I have started to listen to the .NET specific one from Scott Hanselman named Hanselminutes. There are couple of factors that makes it better that other geeky blogs out there. First reason is the content quality. There is very high signal-to-noise ratio, pretty much all content counts and both guys in addition to being smart are quite good at achieving right balance between keeping on topic and spontaneity.

Second reason – it is not technology-religious and quite pragmatic. Scott obviously likes .NET and is passionate about Microsoft technologies – but there is no sucking-up, Scott is very open minded – just listen to the Dynamic languages where they talk about Ruby on Rails. He even owns a Mac and tests multiplatform software on multiple platforms 🙂

Third reason: there is PDF transcript available with lots of good links which would be otherwise lost (unless you listen with pen in your hand and in front of computer, and not driving or walking as myself.)

And last but not least – very good audio quality, professionally recorded and processed. After listening to this episode about professional audio processing, it was clear why. Episodes are reasonably short – 20 to 40 minutes

I have learned quite a lot from the about variety of interesting things – e.g that WPF/E (recently named Silverlight) may be actually something I really want to look at :-). It almost sounded too good to be true.

So if .NET is part of your world – or you want it to become part of your world – go for HanselMinutes.

Ready for a new day – or Vista-Office-Exchange launch

2006/12/12

Today was a big day in Ottawa Microsoft community. The Congress Centre was hosting large event – simultaneous launch of Windows Vista, Office 2007 and Exchange server 2007. Because I have almost registered about two months ago, I attended the event. The “almost” means that I tried to register right after receiving MSDN Flash email, but many people must have been faster – I was put on waiting list on two of the 3 tracks (Developers and IT Pros) and before I could even try to register for the third track (Business), everything crashed, Web site hang and I have never heard back from them, nor received any email. Until yesterday, when an automated voice reminder service managed to catch me by phone in underground garage under Brookstreet Hotel, and delivered first part of reminder – telling me that I was registered to attend something … Too bad it did not tell me to what, when and where did I registered, before it broke off and I lost the signal. But I deducted that the only reason to call me would be a reminder of the Launch and after logging on to My Events, voila – the ticket was there. So I went. It was a tough decision, whether to sacrifice full work day and possibly evening ping-pong at Igor’s – but – what the heck. Microsoft does not produce new releases that often so going away once in 5 years should be OK. And now I am glad I did go.

My attitude in the Tuesday morning was: I am really curious about Vista from developer’s point of view, I do not care at all about new Office (who needs another version, Office 2003 is an overkill and besides we have Google docs and OpenOffice) and certainly not about Exchange. Well, I think different about two of the three topics above right now – but let’s keep the sequence.

It was nice change to take bus to downtown for a change, after daily driving to Kanata. The location was Ottawa Congress Centre, conveniently attached to Rideau Shopping Centre. The attendance was huge – I guess there must have been well over 1000 people. It was well organized and everything went very smoothly and professionally – as far as logistic is concerned.

The show started with a keynote delivered by the president of Microsoft Canada. I have visited few similar venues, and I must tell this was probably the most uninteresting and uninspiring keynote I have seen so far. It lacked spirit, personality, leadership, charisma – everything that I was expecting from a leader representing company of Microsoft’s calibre. Maybe I had too high expectations, after seeing (recorded) keynotes of Steve Jobs from last year MacWorld and WWDC – but even the keynotes at the few Ottawa Linux conferences I have attended in the past (I stopped after 2002) were much more interesting. For any other company, the keynote would probably do. But with Microsoft, one cannot have just a lukewarm, i-do-not-care opinion: people either like them a lot or dislike them a lot. Or both at the same time.

There were actually two speakers and two guests within the keynote. While the main part was not exactly exciting, the second part, delivered the economist and writer Michael Treacy – an author of Double Digit Growth IMHO completely missed target. He tried to provide high level view on outsourcing, new trends in markets and importance of productivity.
Not that the lesson on importance of knowledge in digital economy was incorrect – but it did not fit well with the audience. Certainly not with the group around me. The comments overheard were like: “.. this sounds like Economy 101 at Carleton .. wait, it’s more like second year “. To me, it sounded like fairly incomplete attempt to deliver the key message of Thomas Friedmann’s book The World Is Flat without mentioning Netscape, Yahoo, OpenSource and Google :-). The book is great – read it (I mean Friedmann’s book, did not read the other one). Besides, several claims made during the keynote were tough to digest: what are the data supporting the fact that Ireland has highest living standard in Europe ? What were the indicators used to measure it ? I guess that Swiss, Danes, Norwegians (and other Scandinavians) may quite disagree with that …

A funny little thing: one of the keynote speakers (cannot remember who) was mentioning the Vista new features and used by mistake Apple’s name for the desktop “components” which are called widgets in OS-X (and accessible by using F12) rather the proper Vista term gadgets. Yes, we know: gadgets / widgets – completely different, and the new Vista Aqua look is really great, oops, I meant Aero.

Fortunately, the technical sessions were good and I have learned more than I have expected. The presenters were as usual strong and the demo’s were reasonably well prepared with few hickups.

If I compare this event with the Visual Studio 2005 Launch or with Win2003 introduction, I think there was noticeable change of atmosphere. Somehow the excitement was down, the tone was more like “we are big and serious company, not group of techies”, and generally there was much less “wow” and much more “ok, ok – so what”. Was it because of the different audience ? Was it because of the people were tired waiting 5 years for Vista ? Was it because the scaled down (where is WinFS!!), catching-up-with-Mac (gadgets, Aero, search, ….) featureset of Vista ? Or because Microsoft itself became different company than it was, with Bill Gates stepping down as the icon and leader, being replaced by who-the-heck-is-that-guy-name ? No disrespect Mr. Next Chief Architect, but nobody can really replace such a legend as Bill Gates.

Anyway, back to presentations. I sat on developer’s track and as I said, they were good and interesting. Thanks, Christian and Jean-Luc, you were great as usual. The only remark: please stop that silliness with shouting “Developer Rocks!” really loud so that business group hears us. It is pretty lame and very juvenile. Just because your boss likes to shout Developers! really loud, you do not have to. Fortunately, we were not asked to do monkey dance either :-).

First and most expected product launch was certainly Vista. When companies finish and release large product, they like to do pizza parties. Considering amount of time and money that were invested to Vista, Microsoft should probably have rented Hawai back in November when Vista went gold (as somebody on TWIT suggested).

As a user, what I like about Vista is that it will over time improve security situation on the Net. Built in malware and spyware detection, better security, standard user accounts as defaults (not admin), kernel patch protection are certainly steps in right direction. Compared to introduction of Windows XP, with Vista, Internet will be better place, as soon as the bugs are hunted down to acceptable numbers.

What I do not like is that for certain amount of time, Vista may make security situation worse: the network stack is new and can contain lots of security problems (listen to Security Now on Vista Virgin Stack). What I also do not like is hardware requirements. Come on, guys! It is true that we do have now dual core machine and 1 GB RAM as standard, with 3D accelerator’s card. But the reason why people do buy these terrific machines is to run software that actually *does* something useful, and not just to happily let the operating system itself consume most of the RAM and CPU power just in order to run … Just because users do have lots of RAM and several CPU cores, you do not have to feel an obligation to utilize them and keep them busy – just let them sit idle, there is nothing wrong with that.

As developer, I liked the new additions such as .NET 3.0, WPF, WCF, Workflow and Cards. I am little bit worried about how will the memory consumption and CPU load of XAML-ized apps look like – the demos I saw were routinely allocating few hundred MB of RAM and 80% of CPU cycles just to run simple Winform apps, but that was Beta version of everything. Let’s hope the final version is better. I may have misunderstand the message, but most of the new features for developers will be available for XP and Win2003 platforms as well (maybe except some fancy GUI tricks). I certainly hope it will, because otherwise it makes little sense to use these features sooner than Vista penetration of the Windows market will not be at least 30-40%. Which will take some time.

To sum it up: I have not really used Vista long enough to have qualified opinions, but so far have mixed feelings. I guess it is OK, looks nicer than XP, is comparable to OS-X (some features are better, some are worse) but I am not overly ecstatic about it. I have not seen any features that would make me feel “I must have that” – unlike Leopard with TimeMachine. For example, the search in Vista seems to be using old “indexing service” approach and will be very likely considerably slower and less usable than Spotlight for 100 GB+ volumes of data. Vista certainly is important release and we will jump on it, but not right away there is no rush and no urge to upgrade. The XP and Win2003 will do for now. At least they run OK in Parallels :-).

Unlike Vista, I have changed (and much improved) my opinion about Office 2007. But that is for tomorow.

Will be continued