Nima Dilmaghani’s Technology Blog

Visual Studio Launch Event

Posted in .NET, ASP.NET, Card Space by nimad on February 8, 2008

The 2008 Launch event site is at http://www.microsoft.com/heroeshappenhere/register/default.mspx. The event is not only a good opportunity for networking and learning, but participants will get copies of VS2008,  Windows Server 2008, and SQL Server 2008.  And because of this, the event will sell out.  So sign up for it now before all seats are taken and if you are unable to attend, please cancel your seat so someone else can attend.

Silicon Valley Code Camp is this weekend

While I am sitting far and away from Silicon Valley, I will be watching as the second Silicon Valley Code Camp happens this weekend. I want to tell all the developers, coders, architects, hackers, or whatever techie names they want to call themselves who live in or near the Valley how lucky they are to have such a great event there. Some of my favorite techies will be speaking at this event. People like Douglas Crockford, Juval Lowey, and Matt Mullenweg will be taking time to share their knowledge and experiences with the rest of us and thanks to the hard work of folks like Peter Kellner who have spent countless hours organizing this event, it will all be for free. Believe me, people from other parts of the country or the world do not have this same luxury to drive a few minutes from their home and listen, learn, and share with such a powerful group of software engineers and pioneers involved in such a divers array of technologies. Fortunately, the word has gotten around and over 700 people have registered. Unfortunately, many of those who register will not show up. Mainly because registration is free and the barrier to entry is nothing. So at the last minute, they decide to do something else or feel lazy or … I don’t really know why. All I know is that this is a great opportunity. People pay hundreds of dollars at conferences to see the same speakers give the same talks and folks in the Valley have a wonderful chance to take advantage of it for free this weekend. So don’t let this opportunity go by. If you have not registered, register now. If you have registered, set your alarm clock for Saturday morning and go down there. You are blessed with the opportunity to live in the valley and take advantage of this. Take full advantage of it.

I wish I was there.

The tools folks said they used at Alt.net Conference

At the Alt.net conference Someone put a sheet on the wall and folks filled it out with:

here is a flickr link to the photo of the first page and here is what was on the sheet:

Update:  AltNetPedia has this list in much better order now.

What tools do you use?
Resharper
NUnit
NHibernate
Castle
Reflctor
Subversion
MbUnit
Bugzilla
Visual Studio!
TestDriven.NET
PowerShell
CodeRush
Fiddler
CharlesWebProxy
FogBugz
Jira
Confluence
Fisheye
Big Witeboard Wall!
Mono
Reboot
CruiseControl.net
Rhino Mocks
MS Test
TFS
Team Build
Mac Book
Firebug
Structure Map
Textmate for C# (Really!)
e
Autotest
Active Record Migrations
NAntMy Generation
VMWare
perl
Visual SVN
Socket Wrench
Scredrive
Eclipse
Java
Groovy
JUnit
Gurce

Fitnesse
Rake
NUnitForms
iBatis
Index Cards
WORM
NDepend
FXCop
Putty
Baseball Bat
Simian
Ruby
Watir
NetBeans
Subversion
Selenium
Fiddler
MSBuild
Excel
.NET
Media Wiki
OS X!
Synergy (network KVM)
Tortoise SVN
jQuerry
Hammer
DPack
GreatEX
Subsonic
NCover
NCoverExplorer
SQL Server
Mingle
Git
Vim/ViEMU
Emacs
Trac
Firefox
Cygwin
Grep
Skype
Acrobat Connect
Trillian
Outlook
SQL Diff
Google
(o)(o)
CI Factory
Ethernal
Caffeine
SQL Compare
MANTIS
ADIUM
NotePad
XML Doc Viewer
Fire
Lots of e
Manipulation
Beer
Cross Loop
YUI
WinMerge
Pandora
Parallels

Microsoft announces its new MVC architecture for Web Apps

Today at the alt.net conference, Scott Guthrie demoed the new MVC architecture that Microsoft will be releasing in Spring 2008 for web apps. The first CTP should be available in two weeks. This architecture is very similar in many ways to the Rails architecture but takes full advantage of Microsoft .NET 3.5’s features and the strong typing in .NET. The crowed of alpha geeks that where incredibly critical of Microsoft the night before all gathered in one room and intently listened. Many questions were asked: Does this framework work with such and such? Can I do so and so. Scott’s answer was yes to all of these questions. The crowed was enchanted by Guthrie. No one had anything negative to say. There were a few syntactic and minor suggestions. And some mental wresting from some of the geeks, but Scott’s technical answers addressed the issues raised. Everyone was incredibly impressed. Scott’s presentation and rapid fire answers to questions demonstrated his detailed understanding of all the testing frameworks as well as alternative development frameworks out there and his team’s synthesis of all this knowledge in what appears to be a superior product to what currently exists in the market.
This will be a MVC pattern similar to Rails with a similar URL mapping convention and an architecture that allows you to plug in your favorite testing tools. Both Scott Hanselman and Philip Wheat taped the talk and will post it shortly. I strongly recommend watching it. This architecture is far superior in separation of concerns, testability, maintainability, and scalability to the existing ASP.NET architecture that was basically mimicking a state-full WinForms environment in a stateless web world to bring existing WinForms developers up to speed with web application development quickly. It will enter a heated battle with Ruby on Rails for the top spot as the best way to develop modern web apps. The Microsoft .NET Framework will have certain advantages such as WCF, Linq, and strong typing while the dynamic nature of Ruby and it’s faster innovation rates due to its open source nature will have other advantages. It will be interesting to see how this fight will pan out.

Note that because of a fundamental change in the design, there will be a new (smaller) set of ASP.NET controls that will work in this model. This architecture relies more on the native html controls (which is a good thing. See my CSS blog post to see what hoops you need to jump through to make ASP.NET controls work well with CSS). AJAX Control Toolkit controls that talk to the server also will get counter parts that will work in this model. There will be no change to the Microsoft Ajax Library or the networking stack of the Microsoft Ajax offering. This stack will also improve the existing ASP.NET architecture by replacing the UpdatePanel that was designed to wrap existing ASP.NET controls which were not originally designed for Ajax with a control that can be passed into the app as a JSON object and placed in a placeholder.

To read other perspectives please read the following blogs:

Bob Grommes, Chris Holmes, Howard Dierking, Jeffery Palermo, Jason Meridth, Joshua Flanagan Mike Moore, Roy Osherove,

Update: Sergio Pereira has written nice blog post that goes in more detail with sample code.

topics at alt.net

jay flowers: loop diagrams from system thinking

jeffery palermo: advanced nhybernate techniques

paul juliean : different styles of pair programming

mvc stuff and plugging the dlr into that ruby view,

can we call it msft does rails

ndunit and xunit

ddd domain driven design

scott belware behavior driven design

rod how to sell agile to management

making tests pretty

eric anderson how to introduce bdd to developers who are not actively seeking better ways to do that. how to lower barrrier to writing specs

passion, what to do to build that passion

what is going on with architecture, what you have learned about

unit testing

futurespective on msft. give msft ideas on where to go.

mono,

boo

what we lack in .net community that they have in ruby and java community

scott gu new mvc pattern from msft. use nunit to test it.

simon guest guidance or lack of from msdn. how to fix or replace it

westin benford monorailmoving from asp.net to monorail. why would someone spend 6 months on monorail and then move to ror

dynamic languages on the cl

aspect oriented programming

why move from tdd to bdd.

how to move organizational skill up

kevin d? how to move legacy code under test

jacob boris. how to avoid xml hell

howard turking. runs msdn magazine (laughter which was not cool) how to systematically moving it up to the masses vs c++ hates the vb community.

moving a .net team to ror. tips tricks

it is harder to build software this way how to make it easier.

intersection of the domain moder pattern and rich internet app built on silverlight

dave ohara. how do we take these ideas and sell them to folks in a way that they see the value.

tom integration tests involving databases. i am fan of nhybernate and active record. (use sql light with database in xaml -joke)

lightning talk for 5 min. to do quick demos, …

roy: a famous speaker said that td will deteriorate your design, can it really do that. when to use it or not. how it compares with bdd.

mike from uk you are all a freindly bunch… i am a java manager now. all alpha geeks have left as martin has already left. apple is taking over the desktop. is vista is the last nail in the coffin. why should i care about msft anymore.

vista ME will be out in just 2 years.

where does a model go, what is the lifespan. when to use mockin, when not.

agile project management.

scott: writing and understanding user stories.

jean paul — becoming a catalyst for change in your organization. how to introduce things like agile into the organization

james kovacs — why are we facinated with executable xml. it is terribly verbose. painful.. can we do better. most msft devs diddnet go to college.

ruby for dummies, i mean .net developers.

testing guis.

fostering passion within a company to grow.

are executable requirements possible. are … better. can we do better.

domain specific languages for business and geeks.

language oriented progamming is challenging. design asthetics and environment is challengeing with mocking and dependency injection.

what is the persona for .net. mort, einstien, elvis, belware

sorry for misspelling everyone’s names.

Back to the future with source code viewing with Visual Studio 2008

Posted in .NET, ASP.NET, engineering, Microsoft, programming, software, Technology and Software by nimad on October 4, 2007

Today Microsoft announced that it will be releasing many of the .NET Framework libraries under the Microsoft Reference License (Ms-RL).   Scott Guthrie’s post details what this means.  We have been able to see this source code using Reflector for a number of years so while getting the code in one big chunk is nicer (and now properly licensed) it is not that big of a deal.   A feature that has been lacking since the days of MFC is the ability to step into Microsoft source code in the Visual Studio debugger from your own code.  This was a great feature in MFC and I among others had asked Microsoft’s product team for it in 2005.  Today, my wish has been granted.  Starting with VS2008 you can actually step into Microsoft source code from your own code.  This will help developers everywhere better understand how Microsoft code works and write their code better.  It also puts Microsoft source code more in the spotlight and I hope this visibility will cause Microsoft developers to write better code.

My new wish is that future pieces of source code released in this manner should have the signature or alias of the developer who wrote it so if they did a poor job, the whole world would know.  While this wish coming true is very unlikely for many many reasons, I thought I put it down in writing none the less.

10 Rules for effective use of CSS in ASP.NET

Posted in .NET, ASP.NET, Cascading Style Sheets, CSS, engineering, expression', html, web design by nimad on October 2, 2007

Becoming standards compliant, effective, and successful when using Cascading Style Sheets (CSS) with ASP.NET is not always obvious, straightforward or easy. Here I am putting together a series of tips and best practices that can help you on the way.

  1. Always prefer CSS over ASP.NET’s Skins for the following reasons:
    • CSS is a well accepted standard.
    • Designers understand CSS but may not understand ASP.NET’s proprietary mechanisms.
    • Skins lead to Classitis. Each skin creates an html class attribute that has its associated styles. This does not follow the principle of reuse.
    • A well designed external CSS implementation will have a smaller payload and faster download times than its equivalent Skin implementation.
    • Microsoft is heavily investing in tooling for CSS design (Expression Web and inclusion of the Expression Web engine in VS2008), and is really not doing anything more with Skins. So follow their lead. Going forward CSS will have the best tooling support from Microsoft.
  2. Use CSS within the Themes construct in ASP.NET in order to get all the good CSS support in VS2008. In particular, instead of linking to CSS files in the <head> section of your HTML document,
    • Create one or more theme folders under the App_Themes folder.
    • Put your CSS files inside these themes folders.
    • Link to these themes by setting the Themes attribute in the page directive.
  3. When you drag a control from the toolbox onto your form, ASP.NET, depending on the control, may add inline styling to your control. Delete these inline styles in Code View, otherwise due to the specificity rules, they will override anything you set in the CSS files and you will be scratching your head trying to figure out what happened while trying to find out why the styles you specified are not applied.
  4. Furthermore, note that most ASP.NET controls have several formatting properties that can be set via the properties window or directly in the markup. All of these will end up becoming inline styles and should totally be avoided. The only formatting property that I recommend using (in moderation to avoid Classitis) is CssClass.
  5. CSS files are written against pure HTML elements not ASP.NET Server Controls. Therefore, understanding the mappings between the two is vital to writing quality CSS files and separating the structure (HTML) from the presentation (CSS). See the bottom of this post for the mappings.
  6. Understanding the mappings between ASP.NET web control and HTML types is is also vital for making sure that your site is following well established web design standards and guidelines. If you consider using an ASP.NET web control, you need to make sure that the corresponding HTML type was intended for that usage. For example, you can use a LinkButton to submit values to the server. However, the LinkButton converts to an <a href> element (along with some JavaScript that does the postback). The <a href> element is intended for hyperlink. The HTML 4.01 specification clearly states: “A link is a connection from one web resource to another.” To submit data to a server, it is better to use the Button control which converts to input type=”submit”. Why is following these standards important? For example, if we choose the LinkButton over the Button control, if the user has JavaScript turned off, the site will no longer function properly. Also following standards is probably the most important step to making your site accessible.
  7. Often times one has to choose between an ASP.NET Server Control and the corresponding HTML element. Here are some rules of thumb. For simple controls like a TextBox or a Label, if you need to map the control to ASP.NET server side functionality, or if you would like to take advantage of the ASP.NET validation controls, use ASP.NET controls. If you don’t, use the lighter html controls. Obviously sophisticated controls such as the Calendar Control can save you hours of development time since they have no equivalents in HTML. On the other end of the spectrum, do not forget that there are a good number of HTML elements that do not have (and should not have) ASP.NET counterparts. An example is <input type=”reset”>. Use these as necessary to do your work.
  8. Use the YUI Library CSS Tools. They will save you many hours of work. These tools consist of four style sheets that Yahoo uses for their own production websites. They include a reset style sheet that neutralizes browser specific styles, a base style sheet which creates a consistent style foundation for common HTML elements, a style sheet for setting and managing fonts, and a grid style sheet for managing grids. If you like, Yahoo will even host these sheets for you.
  9. Note that you can use ID selectors only with HTML elements. The ID you assign to an ASP.NET Control will most probably change as the HTML is rendered for the control. So for ASP.NET Controls, use the CssClass attribute to define the style. If the control does not have this attribute, wrap it in a <Div> tag. Wrapping in Div tags should be the last resort. Usually you can refactor your CSS by using contextual selectors on Div tags that wrap a group of elements.
  10. The designer behaviors in both VS2008 and Expression Web (note that they have the same engine so they work pretty much the same way) focus on styling ASP.NET controls using ID Selectors. This can easily be changed to class selectors. So for a complex ASP.NET web control you add the CssClass attribute with a value. Then, in the CSS file, you add details to it. The CSS designers help you set the CSS properties of the control itself, but to set the properties of individual elements in the control, you need to go in the CSS file and hand code. Remember two powerful CSS selectors, contextual selectors and attribute selectors. (Note that attribute selectors are not supported in IE6 or older browsers). Here is a simplified example:

 

<asp:RadioButtonList runat=”server” CssClass=”FunkyRadioButtonList”>

<asp:ListItem>first</asp:ListItem>

<asp:ListItem>second</asp:ListItem>

<asp:ListItem>third</asp:ListItem>

</asp:RadioButtonList>

 

.FunkyRadioButtonList

{

/* general styling for the container control goes here*/

}

 

.FunkyRadioButtonList input[type=”radio”]

{

/*styling specific radio buttons in the FunkyRadioButtonList goes here*/

}

 

 

 

 

The list below shows the ASP.NET Server control and the HTML element that is generated from it by the ASP.NET runtime.

 

ASP.NET Control HTML Element
Label span
TextBox input type=”text”
TextBox TextMode=”MultiLine” textarea
TextBox TextMode=”Password” input type=”password”
Button input type=”submit”
LinkButton a href=”javascript:__doPostBack(‘LinkButton1’,”)”
ImageButton input type=”image”
HyperLink a
DropDownList select
ListBox select size=”4″ gives you 4 rows
ListItem option
CheckBox input type=”checkbox”
RadioButton input type=”radio” followed by a label for the text
RadioButtonList table with a tr with one td for each radio button. Inside each td there
is a input type=”radio” and a label
Image img
ImageMap img and a map tag holding one or more of the following 3:
CircleHotSpot area shape=”circle”
PolygonHotSpot area shape=”poly”
RectangleHotSpot area shape=”rect”
Table table
TableHeaderRow tr
TableRow tr
TableFooterRow tr
TableHeaderCell th
TableCell td
BulletedList ul with each list item:
ListItem li
HiddenField input type=”hidden”
Literal Literal is not translated to any html element. The dynamic content
returned by the methodname method is directly displayed.
Calendar a rather sophisticated table
AdRotator a
FileUpload input type=”file”
Wizard a rather sophisticated table. You can Convert the Wizard Control and
related controls such as the CreatUserWizard control into templates, and
then modify the html, remove the tables, and replace them with divs to make
them CSS friendly. Even after all this, the wizard navigation buttons
will still be unreachable via CSS. Therefore, I hand code these
functionalities instead of relying on the Wizard for full control.
Xml <?xml version=”1.0″ encoding=”utf-8″?>
MultiView MultiView and all the Views inside of it are not translated to any html
element. Thier content is directly displayed.
Panel div
PlaceHolder Placeholder is not translated to any html element. The controls added to
it by the PlaceHolder1.Controls.Add() methodare directly displayed.
Substitution Substitution is not translated to any html element. The dynamic content
returned by the methodname method is directly displayed.
Localize Localize is not translated to any html element. It’s content is directly
displayed.
Validation controls span

What does the Visual Studio 2008 Release Date mean

Posted in .NET, 104812, ASP.NET, engineering, Microsoft, software, technology, web development by nimad on October 2, 2007

I have been getting lots of hits to my post about the VS2008 release date being February 27th 2008. Let me clarify what this date means. This is the official date that VS2008 will be released. There will be lots of events put together and possibly free copies of the software distributed and lots of marketing taking place. This is the launch date of the product and should not be confused with the RTM (Release to Manufacturing) date which most developers (particularly those with MSDN licenses) are interested in. The RTM date is when all coding and testing of the software is done and the product is released to the manufacturing process to burn the DVDs. Usually within a few days of a product’s RTM MSDN subscribers will be able to download it from MSDN. If you look at the blogs of some of the Microsoft Employees particularly Somasegar’s blog, you will see that Microsoft is shooting for an RTM of November 2007 for VS2008. The two dates are a few months apart for several reasons.

The February date is for an event including three products, VS2008, SQL Server 2008, and Longhorn Server. The marketing folk want to throw the parties and the marketing shebangs all at once to capture people’s and the media’s attention. They want to be able to say things like “The biggest release Microsoft Ever Did”. Also launching the products within a few months of each other will put in people’s minds a state of “another release from Microsoft” which is boring and not exiting. So a big launch is the way to go. When you have three big products releasing, you want to have a few months of cushion in case last minute show stopper bugs are found. Also, this gives you time to prepare the physical media that will be given away at the events and other things that can not be done the day after RTM.

I hope this helps clarify things.

 

Enums in JavaScript

Posted in AJAX, ASP.NET, ATLAS, javascript by nimad on October 2, 2007

Enums, (enumerated types) are very simple but incredibly useful programming constructs. However, while the EcmaScript specification has the enum keywork reserved, they have not implemented it in the language. While Microsoft’s JScript has an implementation of Enum, I recommend not using it since your code will not work in browsers other than IE. However by using associative arrays you can get a good deal of the enum functionality easily:

var myEnum =
{
First : 0,
Second : 1,
Third : 2
}

Now
Tabs[Third]
and
Tabs.Third
both return a 2

If you really want enums, the Microsoft AJAX Library implements them. You first declare the enumeration and then register it with the class the enum belongs to. Here is an example from the Microsoft Ajax Control Toolkit:

// Create an alias for the namespace to save 25 chars each time it’s used since
// this is a very long script and will take awhile to download
var $AA = AjaxControlToolkit.Animation;

$AA.FadeEffect = function() {
/// <summary>
/// The FadeEffect enumeration determines whether a fade animation is used to fade in or fade out.
/// </summary>
/// <field name=”FadeIn” type=”Number” integer=”true” />
/// <field name=”FadeOut” type=”Number” integer=”true” />
throw Error.invalidOperation();
}
$AA.FadeEffect.prototype = {
FadeIn : 0,
FadeOut : 1
}
$AA.FadeEffect.registerEnum(“AjaxControlToolkit.Animation.FadeEffect”, false);

You can use this enumeration in this way:

$AA.FadeEffect.FadeIn

ATLAS to be released around the end of the year

Posted in .NET, AJAX, ASP.NET, ATLAS, programming, software, technology, Technology and Software by nimad on September 11, 2006

I can finally talk about this.  The V1.0 of the Microsoft AJAX framework code named ATLAS will be shipped around the end of the year.  It will be “Fully supported” which means that customer support services are available 24 hours a day, 7 days a week, 365 days a year and that any customer can request hotfixes in the event that they encounter a bug affecting their application. 

In order to meet this date, we will be shipping a “core” set of functionality including all the common components needed to enable developers to build client-side controls/components, as well as the server-side functionality that provides integration within ASP.NET (including the super-popular update-panel and other assorted controls).  There are features of the current “Atlas” CTP drops that won’t be in the fully supported “core” bucket. These features will continue to be available in a separate download and will continue to work on top of the supported “core” release.  We will obviously continue to support a Go-Live license for all features going forward.  Overtime we will be moving more and more features into the fully supported bucket.

Naming:

1) The client-side “Atlas” javascript library is going to be called the Microsoft AJAX Library.  This will work with any browser, and also support any backend web server (read these blog posts to see how to run it on PHP and ColdFusion).

2) The server-side “Atlas” functionality that nicely integrates with ASP.NET will be called the ASP.NET 2.0 AJAX Extensions.  As part of this change the tag prefix for the “Atlas” controls will change from <atlas:>to <asp:>. 

3) The “Atlas” Control Toolkit today is a set of free, shared source controls and components that help you get the most value from the ASP.NET AJAX Extensions.  Going forward, the name of the project will change to be the ASP.NET AJAX Control Toolkit.

Watch for a white paper with details in late September.