Wednesday, March 26, 2008

silverlight 2 and IIS

if you want to access your silverlight 2 app from IIS, make sure you add a mime type in IIS for “.xap”:

Extension: .xap

MIME Type: application/x-msdownload


took me forever to figure out why it was working fine when running via the development server but not via IIS…

Wednesday, March 19, 2008

getting VS to launch in admin mode when double-clicking .sln file

this has been bugging me forever, finally got it worked out: the trick is that .sln files are associated with the ‘Visual Studio Version Selector’, not with Visual Studio itself. so you have to set the version selector, not visual studio, to run in administrator mode by default. first you have to find it:

C:\Program Files\Common Files\microsoft shared\MSEnv\VSLauncher.exe

then you just go to the .exe’s Properties window -> Compatibility tab -> Privilege Level frame and check 'Run this program as an administrator'.

Friday, March 7, 2008

Mix08 days 2 and 3

Mix08 finished up today, lots more good stuff. especially want to call out the "Story of the Office Ribbon" presentation, the speaker (jensen harris) was awesome as he showed various Ribbon prototypes, and it was super-interesting to see the evolution and all the thinking that went into it. you can watch it here:

http://msstudios.vo.llnwd.net/o21/mix08/08_WMVs/UX09.wmv


the ASP.NET MVC talk was also very interesting. MVC will live side-by-side with WebForms, and it gives a really clean (java) way to build test-driven web sites. it definitely has a future with us (it's in somewhat early beta now). you can watch or see slidedecks of it and others here:

http://sessions.visitmix.com/


-----


What's New in .NET 3.5, Rob Reylea, MSFT
- hardware-accelerated bitmap effects
- performance improvements
o cold-startup speed improvements of 15-40%
- easier install process

AOL Silverlight Mail Client Lessons Learner, AOL
- poorly attended, bad speakers, AOL irrelevant to this crowd even with ~50 million users

Silverlight 2.0, Karen Corby, MSFT
- design-ability improvements from 1.0
o user controls (encapsulation, re-use)
- derive from UserControl
o events at element level, as opposed to application level
o tabbing works automatically (like it does in html)
- custom controls - derive from Control
o use generic.xaml to specify style and template
- Parts Model for template support (override visual tree) - easy way for template designer t o say "these are the parts i'm expecting"
o ElementParts
§ Named elements in template
o StatesParts
§ Storyboard that controls the parts
o specify [TemplatePart()] attributes for each parts element
- Blend 2.5 has built-in support to build UserControls from selected set of controls


Steve Ballmer Keynote
- he's crazy and he loves developers
- silverlight is part of msft's long-term vision of web/desktop fusion
o 1.5 million silverlight downloads (did he say per day? possible?)
- in response to msft's diversity of businesses: you either broaden or you become irrelevant
- heathfall -> msft investment in healthcare

Social Networks, panel with Garret Camp (msft live) Marc Canter, Allen Hurff (MySpace), David Morin (business sn), someone from Facebook
- openId - relies on URL, not consumer friendly
o major players (facebook, msft live) are watching, but not adopting
- facebook charges $.50/app install
- privacy is the biggest issue, bigger than security and pedophiles
- lack of data portability is major issue, users need to preserve anonymity at times and share data across the web at other times
- 4/10,000 click through an ad

ASP.NET MVC, Scott Hanselman, MSFT
- implemented using HttpHandlers and HttpModules
- release expected later this year/early next
- side-by-side with WebForms
o more control over <html> output
o makes possible unit testing and test-driven development
o SEO and REST friendly url structures
o ideal separation of tiers
- request engine
o "route" is determined (routes specified in Application_Start) from specified URL (by default "/Controller/Action")
§ routing engine handles friendly url parsing and is decoupled from MVC
o controller method is invoked
o controller optionally talks to model
o controller passes off something to view
o view knows what its getting and how to render it
§ view can spit out html (WebForm, xslt, etc.), rss, json, etc.
§ view engine can be replaced (e.g. NHaml)
- to test controller, use empty view engine that implement IViewEngine

The Office Ribbon, Jensen Harris, MSFT (http://blogs.msdn.com/jensenh)
- easily the best presentation of the conference
- lots of prototyping; can we buy time in the UI lab?
- small buttons close to cursor or large buttons far away
- side vs. top
o people felt more comfortable on top in testing
o fear that sidebar would devolve into scrolling list
- evaluate
o longitudinal visibility - usage over time (i.e. 2 months, not 2 hours)
o feature affinity - how people use things together
o command loops - eliminate tab switches
o get fresh eyes!
o eye tracking - heat map, gaze tracking
- ask users where they think items should go
o some features like header/footer had 50/50% split
- iterate!
o account for iteration in dev schedule
o 5 major revisions, 4 later in the cycle
- when is a ribbon appropriate?
o real estate tradeoff, so make sure to take other things out
o lots of commands
o galleries, visual representations of features

Next Gen User Interfaces with WPF, Electric Rain
- workflow, design, build
o workflow = goals, foundation
o research, prototype, functional not pretty
- avoid monolithic specs in favor of rapid prototyping
o developers ask for product design specification when needed

Thursday, March 6, 2008

Mix08 day 1 notes

Key Note Addresses


- ray ozzie spends 30 minutes describing something we've all heard before and unfortunately have to hear more about once again, aka "cloud computing"

- msft still without a legitimate strategy to transform desktop monopoly to a web one

o connected pcs/devices

o web presence

o business apps

o virtualized servers/horizontal apps is key

- scott guthrie recounts his blog postings

- dean hachamovitch (ie8 general manager) reads too much from his script

o ie8 key focus on standard compliance and interopability (as opposed to ie7's focus on security)

§ w3c spec itself is vague and open to interpretation with regard to standards

§ css 2.1 support

§ poked fun at ie7's differences from firefox and safari

o looks more or less like ie7

o ie7 "compatability mode" controlled by developers

o html5

§ back button can work as expected with ajax

§ smooth experience when connectivity is lost

o integrated developer tools similar to firebug or webdevelopmenthelper (script debugging, css inspection)

o "activities" allow in-place right-click actions on selected text (i.e. select address, right-click, view map); very cool

o subscribe to "webslices" (slices of web pages); richer content/simpler implementation than rss

o ie8 beta 1 released

- scott guthrie returns to discuss silverlight 2.0 beta 1 release

- media and advertising

o adaptive streaming

o windows media services 2008 – scalable media hosting and delivery

o bandwidth savings: iis 7 bitrate throttling allows you to specify distinct bitrates for different downloads, so you deliver initial burst, then slower follow up

o jon harris discussed rich advertising: tracking with atlas admanager, iis7 playlists to force ads before video, ad overlays with xaml

o ari paparo from doubleclick discussed doubleclick/silverlight integration vs template

o perkins miller from nbc described silverlight for 2008 Olympics (2200 live hours plus broadcast coverage)

- wpf features

o almost full wpf control library

o sockets support

o protected isolated storage

- controls shipped with OPEN source and test code; you can modify and resell

- roy ben-yoseph and eric hoffman from aol described aol’s next mail client in silverlight 2.0


Lou Carbone, UX Guru – Experience Management

- effect vs. function: manage how users feel as opposed to what you are doing for them (fedex, airlines, rotorooter, etc.)

- think about the details! users remember how they felt more than they remember what they did



Nathan Buggia, MSFT, Live Search – SEO

- 30% of all traffic to web sites is from search engines

- html tips

o <title> and <h1> tags are the 2 most heavily weighted; <h1> is actually SUPER important on live.com since it’s used to parse organization of content

o semantic html is impt (i.e. <h1>title</h1> more easily read by robots <span class=’header’>title</span>);

o make text in href tags meaningful (i.e. not ‘click here’)

o <meta>: keywords is unused, description is used for snippet

o fqdn is important (i.e. x.y.com is higher than y.com/x) since rank is aggregated at fqdn, not at folder level (although google does consider folders)

o use RIA for spice within html pages, or at the very least have distinct urls for desired search rankings

- google is only search engine of the big 3 (google/yahoo/live) that will follow javascript redirects; need to use 301 redirect if you care

- yahoo site explorer (http://siteexplorer.search.yahoo.com) : see inbound links to your page

- prefer hyphen to underscores, since search engines are likely to interpret “_” as part of word, not as word delineators

- casing matters (since 50% of since run apache). links and links distributed to other sites need to always use the same case.

- link to the root, not to a specific page (i.e. http://www.blogger.com/exchweb/bin/redir.asp?URL=http://y.com/items not http://y.com/items/default.aspx).

- http codes

o 304 – conditional get (useful for letting engines know your page hasn’t changed to save you bandwidth)

o 503 – down for maintenance

o 302 – temporary redirect (BAD! since “temporary” is ambiguous; always use 301)

- links and tools

o http://seomoz.org/

o blogs.msdn.com/webmaster

o upcoming adcenter – msft competitor to google analytics



Silverlight 2.0, Mike Harsh, Program Manager, MSFT

- support for almost everything in WPF, plus some new controls

o MutliScaleImage – tool recursively splices a large image into 256x256 tiles, and the MutliScaleImage control automatically renders necessary tiles based on where on image the user zooms

- UserControl support!

- Local storage

o up to 1MB; if you want more, user must approve via prompt

o cross-browser “cookies on steroids”

- HTML DOM Interop

o make calls into the DOM and call javascript functions like alert()

o add items to browser’s history list

- OpenFileDialog support


Thursday, February 28, 2008

set @variable then select @variable = no rows

here’s a strange one that came up the other day. if you have the following sql statement:

DECLARE @AppId INT

SET @AppId = 1

SELECT @AppId = 2

WHERE 0 = 1 --i.e. a condition that forces an empty recordset to be returned

SELECT @AppId

since @AppId was selected from a table with no rows (WHERE 0 = 1), i was expecting it to be NULL after this executes… but it turns out that the variable maintains its value from the SET call , so it’s 1. just an unexpected side effect to be aware of--

Tuesday, February 26, 2008

web service response caching: CacheDuration property doesn't work

if you want to cache the results from a web service call on the server, you’d think you just set the CacheDuration property the way you can with aspx pages (i.e. [WebMethod(CacheDuration=5)] and everything would be happy. turns out... no.
  • web service output is NEVER cached for http-post web service requests, so you have to use http-get, which is disabled by default for web services and enabling it is not a recommended practice. great.
  • browsers can stipulate “no-cache” in their request header, and the server will ignore its own cache for these requests. so even once you get http-get caching working, Firefox requests force the server to ignore its cache.

why this isn’t configurable on the server, i have no idea, but the short of it is: if you want real control over web service output caching, don’t use CacheDuration (i.e. write it yourself using Context.Cache, Application[] variables, or static variables). Context.Cache is a very cool class; you can specify an absolute expiration date, or dependencies on the cached content, so that the item is cleared from the cache when a dependency changes, or a sliding expiration date, like “5 seconds from last access”—

Thursday, February 21, 2008

beware of flash

sorry for the rant, but a couple of things came up today that wasted hours of time for me and are worth filing away in your flash development mental compartment.

adobe releases new flash builds frequently:

you can see what version of flash you have installed here: http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_15507

so what, you say? well, i mention this because i encountered a nasty bug with specific versions of flash 9 and ExternalCallback today. ExternalCallback is the interface that makes it easy to call from javascript into a flash movie. the bug is this: in IE, when a flash movie is inside a <form> tag, a cached flash movie is not properly re-loaded when it is pulled from the cache, and ExternalCallback just stops working. the bug was present or introduced at some point up to 9.0.44.0, but fixed by 9.0.115.0 (so i didn’t see it at first).

the fix (hack, really), is to append a unique querystring value to the .swf filename, so that IE never pulls the movie from the cache. this was acceptable in my case (an 8kb flash movie), but obviously wouldn’t have worked if the movie was larger.

another bug that was present in earlier versions of flash 9 caused IE to crash when a flash object was unloaded as the browser quit. the fix for that is just as nasty; get a load of this:



function cleanUpCounterObjects()
{
var objects = document.getElementsByTagName("object");

for (var i=0; i < objects.length; i++)
{
for (var x in objects[i])
{
if (typeof objects[i][x] == 'function')
objects[i][x] = null;
}
}
}

beforeUnloadCounterObjects = function()
{
//fix for memory bug with flash 9 and IE
__flash_unloadHandler = function(){};
__flash_savedUnloadHandler = function(){};

window.attachEvent( "onunload", cleanUpCounterObjects );
}

if (window.attachEvent)
window.attachEvent( "onbeforeunload", beforeUnloadCounterObjects);

i get it that cross-browser, cross-platform is hard to do, but doing flash development right is almost impossible with adobe’s versioning strategy. seems to me that side-by-side installations would solve all of these problems; developers could say “flash 9.0.45.0 only”, and when users update to 9.0.115.0, they actually just install it side-by-side with 9.0.45.0, so apps released for 9.0.45.0 continue to run in 9.0.45.0! or am i missing something?

again, just make sure you do as much testing as possible in different configurations. you can download older flash versions from adobe here:

http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14266&sliceId=1

and the flash uninstaller is here:

http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14157

good luck…