Category Archives: software development

Mono may implement Silverlight for Linux

Mono lead Miguel de Icaza likes Silverlight. He says:

It makes tons of sense for us to start looking at an implementation of Silverlight on Linux with Mono. There is already a XAML loader, it is the perfect excuse to use Antigrain for high-speed graphics and that only leaves the pesky media issue to be solved.

In fact, am kind of happy that Microsoft did not do the port themselves as implementing this sounds incredibly fun and interesting.

Microsoft should grab this offer, if it is serious about cross-platform. Although Linux currently only forms a small proportion of desktop operating systems, it is nevertheless significant; Ubuntu in particular is making a big impact. Mac/Windows only may be kind-of good enough for the USA, but that’s not the case worldwide.

 

Technorati tags: , ,

Times Reader and offline Silverlight at Mix07

I’m attending a panel discussion on the WPF-based Times Reader, with Tom Bodkin, Assistant Managing Editor and Design Director at the New York Times, and media designers Roger Black, and Filipe Fortes.

Bodkin is talking about the Times Reader, which is sees as offering the best of both worlds – print and web. He is an enthusiast for the tablet PC, but prefers the smaller ones like the Fujitsu P1610 [I agree 100%, I’m on a Toshiba Portege M400 now, but still miss my old, smaller Acer C110]. He thinks that multi-purpose tablets have more future than dedicated devices like Sony’s reader.

He likes the fact that Times Reader publications feel like a publication – “it’s not webby”, he says. He’s showing off some of the features of Reader, including newer features like “news in pictures”, which is a slideshow of images, and the ability to add ink notes to stories when using a Tablet PC. “It’s a print publication plus”, he says. He demonstrates the intelligent reformatting that Reader provides. There’s also a great new search feature, which includes word search and a graphical topic map that shows related stories.

I asked about the cross-platform issue. According to Bodkin a Silverlight implementation is on the way, which includes most of the features in the full version, in “a matter of months.”

This intrigues me, as I had been told by some Microsoft people that Reader would be difficult to implement in Silverlight. Two obvious issues are the limited text features, and the lack of offline storage. There is isolated storage coming in Silverlight 1.1 (far more than a matter of months away), but this will be inadequate for Reader.

It turns out that Nick Thuesen is here, the lead developer for Times Reader. I spoke to him afterwards. He has a neat solution for Silverlight’s limitations. The plan is to use an embedded browser (Safari web kit) and to host Silverlight within that. This way, the native desktop app can handle offline storage; Silverlight becomes more like Adobe’s Apollo, a desktop rich internet application.     

Why not Adobe PDF? “There’s no reflowing, PDFs are really limited,” says Bodkin. “We had an electronic New York Times in PDF, but to read anything… it’s just impractical.” “And this can update,” adds Roger Black, “But the big thing to me is the type. How this will work in Silverlight is not completely worked out.”

Fortes talks about magazine publishing through a WPF Reader, with a more intensively visual appearance, embedded video, and community features like most popular articles, most popular ads. He is also saying that typical web content still lacks the sophistication that print provides (think fashion images, carefully designed text). I find this thought-provoking: is the Web really so bad for this? Clearly this is impossible for naked HTML, but when supplemented by Flash and/or clever CSS?

There’s discussion about the continuing bias towards metaphors that work in the print world but not in the web world. The suggestion is that we still have a lot to learn about how to present content electronically.

Bodkin says that the NY Times writes two sets of headlines; web headlines are more literal than print in order to work well for search engines. This reminds me of a post I made three years ago called Google edits the internet:

…how much of what we read on the Web is influenced by Google’s search and advertising algorithms?

Black talks about a problem with the Reader, which is its dependence on templates into which XML content is poured. Good though they are, this is restrictive in design terms, compared to the complete flexibility of print.

What’s coming in Times Reader? Bodkin mentions plans for video, downloaded on demand, and the possibility of interactive features such as those Fortes has described.

Finally the panel considers some of the business issues. Income from web sites such as nytimes.com remains only a tiny fraction of what is needed to run a newsroom with a global network of reporters; armies bloggers do not remove the need for professional journalists. If print is slowly declining (and I think it is – Thuessen mentions that he has never bought a newspaper), then the question of “who pays” is important and largely unanswered.

Sadly, I stopped using the Times Reader when it went pay-only.

 

Pay and play: how the Silverlight .Net runtime is kept small

Silverlight 1.1, currently in Alpha, will include a cross-platform version of the .NET runtime. The desktop version of this runtime is over 22MB, yet Microsoft is promising to keep Silverlight at around 4MB. How is this size reduction achieved? In part by stripping down the libraries to a minimal core, but Microsoft is also using another technique which it calls pay and play. This means that further class libraries are downloaded as needed, increasing the effective range of available libraries without impacting the size of the core runtime. Sleight of hand perhaps, but it does make sense for online apps.

Developers coding for Silverlight will need to know which of the libraries available in desktop .NET are also in the Silverlight framework. Because of pay and play, some will be in the core, some will be available on demand, and others will never be available. Apparently Visual Studio will give you a visual indication of which is which.

How big will the Silverlight runtime be if you include all the pay and play libraries? Here at Mix07, Microsoft’s Joe Stegman would not say, but I got the impression it will be substantially larger. Of course this is still Alpha; everything can change, and final decisions about what is core and what is pay and play are yet to come. Stegman was also uncertain about some aspects of delivery. You would imagine that pay and play DLLs would be downloaded from Microsoft’s servers, and that once downloaded they would be persisted and shared so that other applications can use them without a further download. Stegman says this is probably what will happen, but there seems to be some doubt.

The Silverlight 1.1 runtime will not be as small as it first appears.

 

Technorati tags: , , ,

Silverlight on the Mac: picture

Here at Mix07 we’ve seen some impressive demos of Silverlight running on the Mac. All the demos worked; the applications looked the same on the Mac as on Windows. Scott Guthrie showed “Silverlight Airlines”, which uses .NET code to call an ASP.NET web service. You draw a line between cities to show where you want to travel, select a date, and a grid populates with the available flights. Here’s my fuzzy picture, though I imagine the demo itself may be put online soon:

 

Technorati tags: , , ,

AppForge: a product activation nightmare

Nobody likes product activation, but it is used increasingly by software vendors in search of more effective anti-piracy measures. Microsoft is the most prominent example, but many smaller vendors do the same. Codegear, for instance, use activation for Delphi. Even if you have a valid registration key, you cannot use the product until it has checked in with Codegear’s license server.

Last month Appforge went bust. The company made a development tool called CrossFire, which lets you code in Visual Basic or C# but cross-compile for numerous platforms including Palm, Nokia’s Series 60 and Series 80, Blackberry and Windows Mobile. A useful tool, but AppForge has an activation system that applies both to the development tool and in many cases to the client runtimes.

The AppForge license server is now offline. Result: developers with CrossFire applications and fully paid-up licenses can no longer deploy their products.

AppForge has been acquired by Oracle, but apparently Oracle has no interest in continuing the CrossFire product. Here’s what Oracle says:

Please note that Oracle’s acquisition of AppForge’s intellectual property did not include the purchase of the company as a whole, or the purchase of other AppForge assets including its customer contracts. Accordingly, Oracle does not plan to sell or provide support for former AppForge products going forward.

Former customers are fighting back. There is talk of a competition to crack AppForge activation: money for the prize is being put on the table.

What about Oracle? Is it really so difficult to resurrect the AppForge license server? Ending all support and development for a product is bad enough; robbing existing users of the right to use it seems extreme.

There may yet be a happy ending. But for now, this really is the nightmare scenario that opponents of the product activation concept feared. No, I don’t think something similar could happen to Windows and Office; but clearly there are real risks when using products from smaller vendors.

A solution is to use some form of escrow where unlocked versions of the software are guaranteed to be made available in the event that the original company can no longer offer activation services. The AppForge saga suggests that customers should insist on this or some alternative protection before committing to activation-protected software.

 

How not to get support

I’ve had four successive emails of increasing urgency from someone using my simple sqlite wrapper.

It’s sometimes difficult to handle such requests – the code is free and there is a limit to how much time you can give away – but in this case I’m unable to reply. The sender is using an email address that is not valid on the internet; the domain ends .local and it is not obvious what the real email address is.

If that’s you – please reconfigure your email client and try again.

 

Technorati tags: ,

C# code to detect UAC elevation on Vista

A couple of days ago I posted about programmatically detecting whether UAC is enabled. I was proposing to read a registry entry. Thanks to the power of blogs, my post drew a comment from Andrei Belogortseff, who has posted C++ code that does this properly. His library has functions for detecting whether the current process is elevated, detecting whether UAC is enabled, and running new processes both elevated and non-elevated (the last of these is the hardest to do).

I liked the libary but wanted to use it from .NET. I compiled his code to a DLL and did a C# wrapper; then I considered the hassles of adding a dependency on the Visual C++ runtime libraries. I therefore did a quick C# implementation of the functions I cared about; I haven’t included the code for running new processes. Please go ahead and download the code, and let me know if you have any suggestions, or even if there is a much easier way to do this that I have missed. There is an app called UACElevationCheck, which calls functions in VistaTools.cs.

The code is only intended to be called from Vista and will throw an exception otherwise; of course you can modify it as you like.

I’ve included a function IsReallyVista that looks for a Vista-only API call, rather than relying on the reported version information. This is because the version information is unreliable if the app runs in a compatibility mode. On the other hand, IsReallyVista is a hack; if you don’t like it, use IsVista which uses the version information instead.

You may be able to do this using the System.Security namespace rather than PInvoke. I had a quick look but the PInvoke code seemed easier to me, especially since Belogortseff has already done the real work.

 

Technorati tags: , , , , , ,

More Windows Installer confusion: managed code custom actions a no-no

People who should know say not to use managed code custom actions in your Windows Installer setups. Like Rob Mensching of Wix fame who says:

…today the Windows Installer does not support managed code CustomActions and the general direction appears to be to try to reduce the need for CustomActions overall.

Read the blog entry for the reasons. The strange thing is, Visual Studio 2005 has specific support for managed code custom actions; there is an Installer class and an MSDN walkthrough on how to use it

Now, I have always avoided managed code custom actions anyway, but only from instinct. Windows Installer setups are problematic enough as it is; adding .NET Framework dependency seems unnecessary. Mensching’s post above explains why it is also error-prone. See also Aaron Stebner’s post from March 2005.

… in summary, I strongly encourage you to not use managed code in your product setup.  I realize that some teams do this here at Microsoft, but please don’t use our bad (in my opinion) examples to justify doing so in your own setup….

Presuming these guys are right, might it not be wise for the Visual Studio folk to remove support for managed code custom actions from the product? A point of confusion is that the managed installer class works with a utility called InstallUtil which is distinct from the Windows Installer; in fact, I believe that Visual Studio setup projects which include managed code custom actions actually call InstallUtil.

I suggest Delphi as a handy alternative, if you would rather avoid Visual C++.

Finally, I hear many good things about Wix, the free XML-based authoring too for Windows Installer setups. If you are embarking on a new setup project it is worth a look.

 

Technorati tags: , , ,

Programmatically detecting whether UAC is enabled

An application may sometimes need to know whether or not the current user has administrative rights. This is complicated in Windows Vista by User Account Control (UAC) – the user may be in the Adminstrators group on the local machine, but nevertheless running with limited rights. When I came across this blog entry on COM elevation by Christoph Wille(thanks to Daniel Moth) I was interested to see the function he mentions called IsUACEnabledOS. I downloaded his code, but was disappointed to see this:

// a really simple check that does not account for possible UAC-disabledness via group policy
public static bool IsUACEnabledOS()
{
int majorVersion = Environment.OSVersion.Version.Major;
int minorVersion = Environment.OSVersion.Version.Minor;

return (majorVersion >= 6);
}

This just detects Vista or higher; in fact, it won’t always return the correct result, since Vista will lie about the version number if an application is running under compatibility settings. How then do we discover if UAC is enabled? The best I’ve come across so far is to query this registry entry:

HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA

If the entry does not exist or is 0, UAC is not enabled. Of course there is no guarantee that this always work, but it’s unlikely to change. I also haven’t checked that it is there in the base versions of Vista; again, it is probably the same.

Update: See the comments to this post for a better solution from Andrei Belogortseff, using the GetTokenInformation API call.  

I’ve now posted a C# implementation of Andrei’s code.

Technorati tags: ,

A bug in Vista’s UAC

Vista’s User Account Control (UAC) elevation prompt sometimes appears when it shouldn’t. Here is an example which works every time for me. I have a folder in Documents (within my home directory) called recordings, containing MP3 files. I double-click one of these files and it opens in Windows Media Player. Now let’s say I try to rename the recordings folder. I get a dialog saying I need to confirm this operation, complete with a UAC shield.

I click Continue and get the screen flash and the elvation prompt. It’s not enough though; I now get a dialog that says “Destination Folder Access Denied – You need permission to perform this action.” If I click Try Again, I get the same dialog, for ever.

It’s nonsense of course. I don’t need permission; I need to close the MP3 file. Indeed, if I close the file I can then rename the folder.

Oddly, if I try this with a Word document, Vista correctly reports that the folder in in use by Word. But if I try a second time, I get the inappropriate UAC prompt.

It’s possible that some Windows API call is returning an access denied error, when it should indicate a file or folder in use by another process, or there could be some other explanation. The end result is a poor user experience.

If Microsoft can’t always get this right, it illustrates how hard it is for developers to give users appropriate error messages when working with UAC on Vista.

 

Technorati tags: , ,