ailon's DevBlog: Development related stuff in my life

Who Wants HTML5 to Succeed?

11/19/2010 5:45:29 PM

Yesterday I’ve had a short twitter-chat with Laurent Bugnion in response to this tweet:

image

This chat got me thinking about motivations of most of the biggest players driving HTML5 forward. Here’s what I think.

Apple

Apple resorts to praising HTML5 only when they need to justify why there’s no Flash (Silverlight, etc.) on iOS devices. In these cases HTML5 is the answer. But when it comes to comparing HTML5 apps to native iPhone apps there’s no comparison – native apps win hands down. And apparently there’s going to be an app store for the desktop Mac OSX. So Apple’s main interest is in controlling the apps (and I’m not even talking about sales revenue here) that run on top of it’s operating systems/hardware. I don’t see HTML5 fitting well into this plot.

Adobe

Adobe was close to world domination in RIA (or at least de-facto standard) up until Apple killed their dreams with the no-Flash debacle on iOS. And HTML5 was Apple’s weapon. I’m sorry but I’m not seeing Adobe as someone who want’s HTML5 to succeed.

Microsoft

Microsoft came up strong about HTML5 in IE9. It sounded strong enough for some people to pronounce Silverlight dead. But why would Microsoft want something that could run on Linux, Macs, etc. as well as on Windows to be a RIA platform of the future? I can see 2 answers here:

  1. they are confused and will come to their senses later;
  2. they will “extend” the standard to a point that “cool” apps run only on Windows.

Now in the second case that won’t be the HTML5 generating the buzz right now. That will be MSHTML5 or something.

Browser vendors

I’m not talking about Microsoft, Apple or Google here. I’m talking about the other 2 major browser vendors who have browsers at the core of their businesses: Mozilla and Opera. I don’t think they have any end-game in this. They are just trying to make great products that users would want to use to browse the web and what that web is will be decided by other players.

Google

That leaves us with Google. I believe they are the only big party that has a genuine interest in making HTML5 succeed as a cross-platform standard. After all they have the deepest current investment in the area with all of their awesome web apps, Chrome OS, Google TV, etc. But I doubt that they are strong enough to overcome the obstacles in form of above mentioned companies. After all Google is currently in direct competition with all of them, so why would they hand the torch to Google?

Conclusion

I think I’ll have to agree with Laurent’s statement. I believe there will be HTML5 “standard” in the near future, but it will be along the lines of what all the other HTML incarnations always were – good in theory but requires a lot of duct-tape to glue it all together into something working across browsers. And it will be up to enthusiasts (like the creators of libraries such as jQuery) to make it all kinda work.

I’d like to end this post with “History Repeating” by Propellerheads. Enjoy…

Tags: , ,

Flex 4 for Silverlight/.NET Developers. Part 1. Introduction

11/9/2010 11:22:34 AM

As readers of this blog probably know, my main occupation over the last couple of years was .NET (WPF/Silverlight/WP7) side of amCharts product line. If you are familiar with the product you know that it started as Adobe Flash product and now expanded into Adobe Flex world too. I always wanted to be able to understand first hand what’s going on in our Flash/Flex products but was delaying the dive into Adobe world time after time. Now I finally got an opportunity to do something with Flex and had no excuse to skip it once again.

I decided to give Adobe’s own video course titled “Flex in a Week” a try and finished “Day 1” at this point. From the first second I felt that I’m looking at everything through .NET (WPF/Silverlight) developer’s perspective and thought that I’m probably not alone at this and it could be useful for people like me to have some articles about Flex targeted at .NET developers. So here we go…

Disclaimer: I’m not leaving .NET or something like that. This is just a side project to widen my personal professional horizons and be in the loop of stuff happening in other parts of amCharts product family and RIA world.

Tooling

I won’t try to disprove the myth that developers working on MS stack are very dependent on tooling and start straight from the tools.

The Visual Studio equivalent in Flex 4 world is called Flash Builder (formerly Flex Builder). Here’s how it looks

Flash Builder

It’s an Eclipse based IDE which is available as both Eclipse plugin or standalone package. I haven’t worked much with it yet but from what I’ve seen even though it’s not as sexy as VS2010 or Blend it looks like a pretty capable decent modern IDE with all the color-coding, code completion, design mode, property editors and other stuff one would expect.

Flex itself is an open source framework and it’s SDK is available for free. Flash Builder on the other hand is a commercial product which will set you back from $249 for Standard Edition to $699 for Premium Edition. There’s a 60 day trial which I’m currently using, but there’s no equivalent of Express editions of Visual Studio. So if you want an official professional IDE be prepared to shell out real money.

Terminology and conventions

Flex projects are compiled into SWF files (pronounced as “swiff”) which are equivalent of XAP in Silverlight. You can run Flex projects in browser via Flash Player or on desktop/mobile via AIR runtime. However (at least as I understand it at this point) unlike Silvelright you have to decide upfront if your project is targeted at Flash Player or AIR.

image

Flex uses a markup language called MXML for declarative UI layout (XAML in Silverlight) and ActionScript for code. ActionScript is ECMAScript based language (think JavaScript on steroids). A default MXML page looks like this:

   1: <?xml version="1.0" encoding="utf-8"?>
   2: <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
   3:                xmlns:s="library://ns.adobe.com/flex/spark" 
   4:                xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
   5:     <fx:Declarations>
   6:         <!-- Place non-visual elements (e.g., services, value objects) here -->
   7:     </fx:Declarations>
   8: </s:Application>
Pretty familiar, eh?

Visual Studio solution equivalent is called workspace, projects are just projects. Projects can be packaged (exported) into a single FXP file (for easy sharing?) and imported back into workspace.

What we, .NET developers, call controls is called components in Flex world. In standard component world there are 2 sets of components with basically equivalent default look and feel. Why is that? Well, historical reasons.

First is the older MX library which can be customized via property settings and styled with CSS (!) but has a hardcoded layout. So, if you want to customize it beyond what you can achieve via properties, you have to create your own class inherited from the standard component.

The new component library is called Spark and can be customized via what .NET developers call templates, which are called skins in Flex. The skinning/templating mechanism is pretty similar to Silverlight. One thing I’ve noticed so far is that Flex skins (can) contain ActionScript code.

   1: <s:Button x="70" y="126" label="Button" skinClass="mySkin"/>

As for custom/user components there doesn’t seem to be any differentiation like in Silverlight (user controls vs. custom controls).

Classes are named using Pascal case notation which was called “upper camel case” in the videos. Differently from .NET world all class members are named using camel case.

Data binding is done using curly bracket syntax where you just place the name of the object and property to bind to:

   1: <s:Panel x="38" y="12" width="198">
   2:     <s:TextInput id="myTextBox" text="test" x="14" y="12"/>
   3:     <s:Label text="{myTextBox.text}"  x="14" y="46"/>
   4: </s:Panel>

This code results in the output like this:

image

As you can see even though obviously there are differences so far it doesn’t feel like a totally unfamiliar ground for Silverlight developers.

to be continued …

Tags:

MVPonT – Most Valuable People to Follow on Twitter

10/9/2010 11:40:44 AM

A week or so ago I was watching my twitter timeline with all the new and renewed Microsoft MVPs announcing their MVP statuses and congratulating one another. Then I tweeted this:

Too bad they don't award MVP to people who talk MS related sh*t on twitter and blog occasionally. In such case I'd be MVP for sure. #mvpbuzz

And immediately had that “aha!” moment. Less than week later I’ve launched MVPonT.

largeLogo

The idea is that twitter users can nominate other tweeter users as most valuable tweeps in their field (as identified by hashtag) and then other users can vote for them or nominate their own.

Here are some categories that should be of interest to the readers of this blog:

There’s much more. Check out the complete tag cloud for more hash tags or start your own!

As you can obviously see the site was started by developer in a community of developers but it’s totally not limited to developers and might go well into mainstream. The only noticeable venture in mainstream so far was with Russian hashtag #ru where fake Russian president totally dominates over the real one (well deserved btw).

I need your help with going into new areas! Nominate tweeps in your area of interest and we’ll all have a good resource to find most valuable people to follow in any field.

Thank you!

Tags: , ,

Unit Testing Combo WPF/Silverlight Projects

9/23/2010 8:24:52 PM

With release of WPF 4 and Silverlight 4 creating WPF and Silverlight applications sharing the same code became easier and less frustrating than it was before. The main techniques that I described in my series for WPF 3.5/Silverlight 3 (“Add as Link”, partial classes and preprocessor directives) are still the most reasonable approach for this task.

It is also commonly agreed that your ride will be smoother if you start with Silverlight. This doesn’t mean that you have to leave WPF for later. What this means is that you create files in your Silverlight project and “Add as Link” to your WPF project (not the other way around). The main benefit of this approach is that you get Intellisense , etc. for Silverlight and, since Silverlight doesn’t have all the classes, methods and overloads that full .NET framework has, you won’t be tempted to use them.

A very simple solution utilizing this approach would look something like this:

image

So What About Unit Testing?

If you are some unit testing fanatic you might want to unit test WPF part with MSTest (or other testing framework) and separately unit test Silverlight part with Silverlight Unit Test Framework. Now this would be good in test reliability but I can bet you won’t run both of them anyway and since most of your code is identical you would probably want to unit test that common code with only one of the testing suites.

It wouldn’t come as a surprise if you decide to use MSTest running inside Visual Studio over SilverlightUT running in browser. The problem here is that you are doing Silverlight project first and you can’t add a reference to your Silverlight project to the MSTest project.

image

So what you have to do if you want to go this route is constantly add new files to your WPF project and reference that project from the test project.

image

Problems with this Approach

Unfortunately this approach is far from perfect.

First of all it’s problematic to do TDD/tests first. When you write a call to a not yet defined method and try to generate method stub using Visual Studio you get this error:

image

This happens because you have MyControl.cs file open from a Silverlight project and the tool tries to generate the stub into WPF project and fails because the file is already open from another project. Now if you close the file as the message box suggests, the generation will succeed but it will open the file from the WPF project and you won’t be doing Silverlight-first unless you close the file again and reopen it from the Silverlight project again.

Then there’s a similar problem with refactoring/renaming. When you have your file open from the Silverlight project and you rename a method, class, property, etc. using Visual Studio refactoring tool it won’t be renamed in the test project. So you’ll have to go and do a bunch of manual finding and replacing.

These are obviously not critical issues but pretty annoying nevertheless. It’s very important that writing tests is as painless as it could be or you won’t write them. And pain is pretty much a part of the process considering these issues.

Hopefully there’s a better way to unit test such projects and I’m just not aware of it. If so, please, let me know in the comments.

Shout it kick it on DotNetKicks.com

Tags: , , ,

Side Effects of Silverlight Marketing

7/1/2010 9:47:07 AM

Note: this post is about marketing to developers (not general public).

Yesterday Tim Heuer published a blog post titled “Top issues for Silverlight” where he summarizes reported Silverlight issues. Apparently number one issue is “WPF and Silverlight feature (dis)parity”. Tim writes:

It’s a little weird to call this one an issue with Silverlight, but this was seen requested more often in these areas that it is worth calling attention to.  Some of the genesis of this angst comes from an expectation that WPF applications ‘just work’ in Silverlight and not understanding the areas of the subset in both XAML and the .NET base class libraries (BCL).

Now this is true but one has to wonder where this expectation comes from.

Silverlight is NOT a subset of WPF

The root of this problem (at least how I see it) is the initial marketing message of Silverlight for developers was that it is a subset of WPF. Now Microsoft is a serious and cautious company and you would hardly find any direct evidence of this but this is what gets stuck in minds of developers who know about WPF and/or Silverlight from various presentations before they dig deeply into development.

It’s hard for Microsoft insider to realize this. That is not that obvious even for someone who is working with both WPF and Silverlight. But if you take someone who does some real work with either WPF or Silverlight but not both and ask them what’s the relation between WPF and Silverlight, most of the time you are going to hear the mantra – “Silverlight is a subset of WPF”. I’ve heard developers, project managers, etc. with no experience in WPF and/or Silverlight repeat this numerous times. And that was exactly as I saw things before I started coding with both. This is encrusted deeply in the minds of developers and is the main source of frustration when they realize that this is not exactly the case.

I guess with all the advances in Silverlight over the recent years this disparity became a little more expected than before but the “subset” idea is pretty much still alive. Now I don’t know what needs to be done to kill this mantra and I’m not even sure Microsoft’s business departments want to kill it but I think this is the main source of this “issue” being number one.

Silverlight for Windows Phone 7 is NOT Silverlight

This subtitle is a little too drastic on my part but I’ll explain what I mean in the next few paragraphs.

One might think that WPF vs. Silverlight case was one of it’s kind but just this spring during MIX10 conference while unveiling Silverlight as one of the main developer platforms for Windows Phone 7 Scott Guthrie said this: “It’s not Silverlight Lite. It’s not Silverlight Mobile. It’s Silverlight.” (watch MIX10 Day 1 Keynote).

Now the wording is really clever. And later he explained that it’s Silverlight 3 with some parts of Silverlight 4 and phone specific stuff. He never said that you can run exactly the same code on the phone as you can on desktops and those who were interested in WP7 development understood that. But majority of the folks who just listened to this as high level overview have this notion stuck deeply in their minds. They believe that they can continue working on their Silverlight apps as they did before and then if they decide to move the app to WP7 they will only have to shuffle the UI a little to fit the smaller screen.

Do you think they are going to be frustrated when they find out that this is not the case? What do you think is going to be the top issue for Silverlight for Windows Phone 7? My guess is “Silverlight and Silverlight for WP7 (dis)parity”.

Shout it kick it on DotNetKicks.com

Tags: , , ,

Book Review: Framework Design Guidelines. Conventions, Idioms, and Patterns for Reusable .NET Libraries by Krzysztof Cwalina and Brad Abrams (Second Edition)

6/11/2010 3:38:05 PM

5138dM4PHnL._SS500_ This book is a must-read and a must-have for anyone developing .NET libraries and frameworks. It’s basically an internal Microsoft document describing how .NET itself and related frameworks should be developed.

Guidlines are divided into DO, DON’T, CONSIDER and AVOID depending on how strong authors feel about them. In addition to official guidelines the book is filled with notes and commentary from other Microsoft gurus. Quite often these notes are even more valuable than guidelines themselves. That said there were a few places where guideline was just thrown out there without any explanation of the reasoning behind it. Sometimes it was obvious but a few times not so much.

If you are an experienced .NET developer you probably follow most of these guidelines automatically but this book provides all of them in one place. You can force your less experienced colleagues read this book and save them from learning these rules the hard way. And when in doubt it’s an excellent reference to turn to.

I must say this is not a fascinating read. To tell the truth it’s one of the most boring books I’ve ever read. Nevertheless it’s extremely valuable and I don’t hesitate to recommend it to any .NET developer. And even if you don’t do .NET you can gather quite some wisdom from it.

If you follow tech news you probably know that Brad Abrams left Microsoft and went to Google, so, I guess, we shouldn’t expect a third edition of this book (at least by the same authors) in the foreseable future. So this is probably as good as it gets for now.

Buy this book from Amazon

Tags: ,

Online Tool to Get RSA Public Key in XML Signature format

5/24/2010 6:14:01 PM

Last month I’ve posted a short how-to about getting XML Signature foramatted public key from Base64 encoded certificate. Now that I’ve launched a sub-site for my online tools I thought there’s no reason to leave that post as a how-to only, when most people just need to use it once.

So I’ve made a simple online tool that does just that – you paste your base64 encoded RSA public key into a form and get XML signature formatted version. No need to implement this yourself.

What's that for?

If you need to say verify data in .NET signed with private key and you don't have/want the public key (certificate) installed on your machine, the easiest way to go is to load public key data from XML string using RSACryptoServiceProvider.FromXmlString() method.

Problem is that it accepts key information in XML Signature format (the one with <RSAKeyValue><Modulus> etc.) and there is no easy way to get it in that format. Most of the time you get the key in base64 encoded form or in binary form from which you can get the base64 version.

This tool lets you get the XML Signature version from that base64 representation.

Tags: ,

Automatic Unit Converter

5/21/2010 2:54:45 PM

What & Why?

On my recent trip to USA one of the biggest challenges was a constant need to evaluate all the US units and figuring what they mean to me. Miles, feet, inches, gallons, ounces, Fahrenheit… Come on, guys, it’s about time to switch to normal measurement system! ;)

Nevertheless I’ve liked it there and would definitely want to go again. So, Microsoft Lithuania contest to make an Internet Explorer 8 accelerator with trip to MIX11 as a grand prize couldn’t come handier.

When first paragraph met the second one in my head, I knew immediately what to make for this contest.

Please welcome my Automatic Unit Converter IE8 accelerator and complimentary site. You just select some text on some site, click the blue accelerator button, hover over “Convert to Metric” and get all the known units in your selection converted to metric.

Automatic Unit Converter for IE8

Why not just use Google, Bing, etc.?

  1. Not everything work automagically with Google and Bing. 60 ft 5 inch works, but 60'5" doesn’t. Often you have to tell Google what your target is. Building an engine to figure that out is one short step away from just converting the values. So I just made that step myself.
  2. Multiple values in arbitrary text. When you are looking at a text containing multiple values (like in the screenshot above) you don’t want to select and convert them one by one.

What about other systems and directions?

I would probably improve US-to-Metric over time and add Imperial-to-Metric. As for converting these back from metric I’m not personally interested in it. That said I’ve created a conversion module in away to allow expansion and I’m ready to make it open source. So, if someone is up for the task, let me know and I’ll post the project online and implement selection and specific accelerators for different scenarios into the site.

Vote for me!

My accelerator is listed on the contest page as “Matų konvertavimas”. Click on “Patinka” if you like the accelerator.

Tags: , , ,

Quick Charts for WPF & Silverlight v.1.0 Beta Released

5/10/2010 3:48:46 PM

We are happy to announce availability of feature complete version of amCharts Quick Charts for WPF & Silverlight.

Quick Charts is an easy to use, fast set of charting controls for WPF & Silverlight. And it's FREE and Open Source (Ms-PL)!

Quick Charts for WPF & Silverlight

Quick Charts motto is: Ease of Use, Speed, Small Footprint. It is amCharts Bundle's little brother. It has less features, but concentrates on what's important for the majority of users. In order to achieve this we didn't just strip the features off of amCharts Bundle, but created Quick Charts from scratch.

Check them out and, please, spread the word. Thanks!

Shout it kick it on DotNetKicks.com

Tags: , ,

Get RSAKeyValue from Base64 Encoded Public Key

4/27/2010 6:54:55 PM

Note: I don’t know much about encryption and certificates. This is not a tutorial or good explanation of things. It’s just a note to myself for future reference.

I needed to verify data sent to my ASP.NET app signed by 3rd party using their private RSA key. They’ve sent me their public key in base64 encoded form. You’ve probably seen it many times. It looks something like this:

-----BEGIN CERTIFICATE-----
MIIECTCCA3KgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBujELMAkGA1UEBhMCTFQx
EDAOBgNVBAgTB1ZpbG5pdXMxEDAOBgNVBAcTB1ZpbG5pdXMxHjAcBgNVBAoTFVVB

-----END CERTIFICATE-----

Problem is (as far as I understand) to verify data using RSACryptoServiceProvider you either need the key installed on your system or have it in XML Signature format. I’ve searched high and low for a way to convert that encoded key to XML equivalent but couldn’t find a simple way. Most likely I wasn’t searching for the right thing and I admit I’m not an expert in this area. I guess this can be done some other way but after combining some breadcrumbs I found here and there I came up with only 3 lines needed to to get <RSAKeyValue> representation of the key:

   1: byte[] binaryCertData = Convert.FromBase64String(mimeKey);
   2: X509Certificate2 cert = new X509Certificate2(binaryCertData);
   3: string xmlKey = cert.PublicKey.Key.ToXmlString(false);

And that was it. Does the trick.

Update: I’ve created an online tool to convert Base64 encoded public key to XML Signature format.

Tags: ,

Copyright © 2003 - 2013 Alan Mendelevich
Powered by BlogEngine.NET 2.5.0.6