Development

Codename: Roslyn - the next generation of the C# & VB.NET compilers

Submitted by Robert MacLean on Mon, 08/15/2011 - 13:55

277341190_3f098a08a4_oThis past weekend I had the opportunity to present at a fantastic event, Dev4Devs which is a free event where anyone can present on anything (software developer related) for 20min. It is a lot of fun, because of the variety of talks, the variety of people (some new speakers and some experiences speakers) and the HORRID 20min timeline.

This time I presented on a topic I am very interested in, Codename: Roslyn which is the next version of the C# & VB.NET compilers which are fully managed code (C# one written in C# and the VB.NET one written in VB.NET).

Since there is no public bits available I made use of the compiler from Project Mono – which has had similar things (the REPL environment and hosted compiler) for years.

As with all presentations here (or at the end of the post) are my slides, demo notes, demo files and other info!

During my research and prep, I found a bunch of interesting posts and information about it so here is the info I found. I’ve bolded the ones I think are especially interesting.

Image from Ezu

Nugget: Little compiler optimisation

Submitted by Robert MacLean on Wed, 08/03/2011 - 11:28

Found this little C# compiler optimisation which is really cool. Here is start code

int y = 0;
int x = 10;

if (x * 0 == 0)
{
    y = 123;
}

Console.WriteLine(y);

If you know a bit of math, anything multiplied by 0 always equals 0 (line 4). So the compiler optimises that out and then because x is never used that is also optimised out and you end up with

int y = 0;

if (0 == 0)
{
    y = 123;
}

Console.WriteLine(y);
So very smart Smile

Are you using the .NET name correctly & other interesting brand info

Submitted by Robert MacLean on Tue, 07/26/2011 - 15:58

Not talking about the technology but various identifiers in the .NET world are often abused. I know this is SUPER pedantic of me, but it is something I come across watching lots of presentations. Getting this right shows a level of polish and knowledge, and getting it wrong shows that either you not paying attention, don’t know what you are talking about or just don’t care.

So here are some brand/naming problems I see:

  • .NET – I often see people use .net or .Net, the correct capitalisation is ALL caps. There is NO excuse for this one, just do it right.
  • .NET Framework 4 – With .NET 4, the marketing people dropped the .0 like we had with 2.0 or 3.5, so stop saying four-oh, it’s just 4.
  • Windows Phone 7 – It is Windows Phone 7, not Windows Mobile 7 (no such product) or Windows 7 Phone.
  • Microsoft Visual C♯ 2010 – I make this one often and call it C♯ 4, it is actually Microsoft Visual C♯ 2010.
  • Should you use ♯ or # with C♯ – either is acceptable. However Microsoft recommends the “Music Sharp Sign” for marketing material.
  • Microsoft Visual Studio 2010 Ultimate – That is the full product name. The issue I see often is people putting .NET in there, ala Microsoft Visual Studio .NET 2010. There is NO .NET in the name. There was a release in 2002 called Visual Studio .NET, but that was a specific release and is not the product name.
  • Microsoft SharePoint Server 2010 – A lot of people are using the term MOSS to describe SharePoint Server. It is not MOSS in 2010. In 2007 it was Microsoft Office SharePoint Server, but the Office part was dropped for the 2010 release and the MOSS acronym along with it.
  • Microsoft SharePoint 2010 Foundation – Like MOSS above people love to use WSS for SharePoint Foundation. It’s not called that in 2010…. there isn’t even a W in the whole name now.
  • Microsoft Visual Studio 2010 Documentation – There is a very bad habit (I do it too) to call this MSDN. MSDN is not the help that is install on your machine with Visual Studio! MSDN is a website Microsoft runs for developers which has help on it and also a subscription service where you can get Microsoft software legally and cheap for development purposes. So while it is two things on the Internet, it is NOT on your machine.
  • MacLean – Thought I would just throw this one in, it’s my surname. It has a ‘a’ in the second position and a capital L. It is not Mclean, McLean, Maclean or ‘Hey you, stop kicking my dog…’ Smile with tongue out

Community night in August

Submitted by Robert MacLean on Tue, 07/26/2011 - 15:35

Important Notice for August 2011

Community night is normally the second Tuesday of the month, however since that is a public holiday it has been moved to Monday the 15th of August!

What is community night?

For those who do not know this is a FREE event that happens monthly where a variety of user groups get together at Microsoft's offices. User groups are not influenced by Microsoft, they just use the facilities. User groups that are there on a regular basis:

  • Information Worker: Technical focused SharePoint & Office
  • Business User Workshops: User group that looks at the issues that face power users in enterprises. This month the understanding where a portal ends and CRM begins.
  • Game Dev: One of the biggest with plenty of game developers & artists getting together.
  • JavaScript: For all you JS fixes
  • Mobi: My good friend Rudi Grobler hosts this group focused on mobile (iPhone, Android, Symbian and Windows Phone)
  • UX: For those who understand there is more than 16 colours
  • Architecture: For architects of any IT systems!
  • Languages: For developers who are interested in learning the pros & cons of other languages.
  • SQL: The fantastic Gail Shaw runs the best SQL user group anywhere!

There is also FREE beer, cool drinks & pizza!

Where is Microsoft’s offices?

Microsoft Bryanston Office
3012 William Nicol Drive
Bryanston
2191 Johannesburg
South Africa

Click here for map and more details.

Times?

Various user groups starts at different times. I think the first UG kicks off at 16:00 and it can run to 21:00.
However depends if you attend multiple UG, stay for passage conversation, etc…

So up to you, I have nights where I arrived after 17:30 and other times left at 18:00, no pressure!

Time to move from YallaApps

Submitted by Robert MacLean on Tue, 07/26/2011 - 14:25

Stormtrooper: Let me see your identification.
Obi-Wan: [with a small wave of his hand] You don't need to see his identification.
Stormtrooper: We don't need to see his identification.
Obi-Wan:These aren't the droids you're looking for.
Stormtrooper:These aren't the droids we're looking for.
Obi-Wan: He can go about his business.
Stormtrooper: You can go about your business.
Obi-Wan: Move along.
Stormtrooper: Move along... move along.

This memorable quote above is exactly what is happening at the moment, South African Windows Phone 7 developers are being told to move along away from YallaApps, which has helped us to the official Microsoft AppHub, as it is now available here.

Should you do it though is an important question? The answer – YES!

YallaApps is like when Luke decided to leave Tatooine, there is nothing there for him. Yalla has even confirmed this to me:

image

What about the money you paid to Yalla (or your free $100 credit) – well if you migrate before 20 August 2011 you will  be refunded Smile SO GO GO GO!

Last and importantly, how do you do this?

Please note that there is a deadline to complete this process by August 2011 15 September 2011 (edit: this date was extended, and thus the update! More details are the DPE blog) in order to be eligible for a refund.

  1. Go to http://create.msdn.com. Click on ‘Join to submit your apps & games’ on the left. (You must be a member of a Windows Phone Marketplace supported country, as indicated by your country code – list provided in FAQ).
  2. Click ‘join now’ and sign in using your Windows Live ID.
  3. In the ‘personal details’ step, provide the same email address you used when registering with  Yalla Apps.
  4. In the ‘my profile’ step, choose a display picture and enter a Gamertag. This is required to enable your account for Xbox LIVE development.
  5. In the remaining steps, pay the registration fee using a credit card from one of the Windows Phone Marketplace supported countries (list provided in FAQ). Only the 1st year’s registration fee will be eligible for reimbursement.
  6. Login to your Yalla Apps account and go to http://www.yallaapps.com/dashboard/apphubmigration-refund. Fill the form and tick the option ‘I have created a new AppHub account and wish to cancel my Yalla Apps account’, and click ‘Update’.
  7. Remove all your Apps from Yalla Apps and re-publish them normally to AppHub.
  8. In case you had Paid Apps on Yalla Apps, please send an email to [email protected] to notify Yalla Apps once you have removed your Apps so that your final payout can be processed.
  9. You will receive the final payout of all amounts due to you from Paid App sales from Yalla Apps within 2 months after you have deleted all your Apps from Yalla Apps. Your payout amount must exceed US $25 in order for the payment to be processed. The payout will be conducted via PayPal or MoneyBookers, according to the payout details you have specified on your user profile. In case of any questions regarding pending payouts, kindly send an email to [email protected] .
  10.   Within 2 months of registering on the App Hub, your registration fee will be reversed on your credit card, if you correctly followed all the instructions. You can review your credit card charges at the Microsoft Billing and Account Management website by following the instructions here.

Presentation Dump - Mid 2011: Windows 7 API CodePack, Development for Nokia, Mercurial, VS Tools, AOP, Multitasking, Cloud

Submitted by Robert MacLean on Tue, 07/19/2011 - 14:05

The fact we half way through the year snuck up on me this morning, so it is time again to share some of the presentations I have done in the last 6 months! For those new to the presentation dump, every 6 months or so I share all the slides I can (some I can’t because they contain NDA info, like the one about Microsoft’s Project Double Rainbow) so that you can take these slides and work with them yourself!

So what is included in this dump:

  • Windows 7 API Code Pack: This was a very fun session to do since it was showing off a bunch of cool Windows 7 features.
  • Development for Nokia: This is maybe one of the best looking slides, but one of the worst timed sessions since shortly after it Nokia announced their move to WP7 so not much could be taken away from this Sad smile
  • Mercurial: This is a difficult session, because the demo’s are so boring (how do you make source control sexy?) – however a ridiculous amount of animation about process made this entertaining to create and present.
  • Visual Studio Productivity Tools: This one started off from the idea of answering the question CodeRush vs. Resharper – which is a bit of religious debate more than a this one wins. It includes a bunch of other interesting content about other extensions too. For non-South African’s “Braai Rules” is the same as saying “BBQ Rules” or “Pub/Bar Rules”
  • Aspect Orientated Programming: This is a big one for me as I see general development using more of this and the frameworks, like .NET, moving to it more and more in future. Good to get an early look into it.
  • Multitasking in applications: This session looks at one of the themes of .NET 4 – TASKS. Why should you care, because multi threading is complex, but multi tasking gives the same benefits with less complexity.
  • WebMatrix: Microsoft’s new tool for hobbyist web developers. What is included in that tool? This presentation tells you.
  • Welcome to the cloud: I had a great opportunity to present at Tswane University of Technology with Rudi Grobler on the cloud & mobile. This was a very fun session and allowed me to also talk about why BBD is such an awesome place to work.

Slides available in the post! Click below for more

Windows 7 API Code Pack

Development for Nokia

Mercurial

Visual Studio Productivity Tools

Aspect Orientated Programming

Multitasking in applications

WebMatrix

Welcome to the cloud

YallaApps - Delays in submission!

Submitted by Robert MacLean on Tue, 07/12/2011 - 19:33
Updated: This has been resolved, see comments below for details from YallaApps.

YallaApps, the company that submit Windows Phone Apps in parts of the world Microsoft forgets, has a BIG problem at the moment and to make things worse they are not talking about it publically!

In short something is borked between YallaApps and App Hub (the Microsoft submission side) and as such there is a hold on all submissions! So the very purpose for it has stopped, and there is not a mention on the blog or site about this. Very poorly done Yalla!

How did I find out? I emailed them because after 5 days my app hadn’t been submitted! Below is their response.

image

Security is hard for users, so let us clean up with NEAT & SPRUCE

Submitted by Robert MacLean on Mon, 07/11/2011 - 13:34

Microsoft used to be a horrid company with regards to their security, then they sat down and made security a quality gate – we do not ship if security is wrong. How do they know what is wrong? A 24 page guideline with 68 bullet points?! Perfect holiday reading Smile with tongue out

The security development lifecycle team has recently tried to help us developers improve our applications so we not the next company with a bad security issues with two acronyms which will improve security notices to our users: NEAT & SPRUCE

What is NEAT?

  • N: Necessary – Only show messages that you need. If you can take a safe action automatically or defer the message, do that!
  • E: Explained – If you do interrupt the user, explain in everything to the user. EVERYTHING?! Yes, and the SPRUCE acronym will help explain what everything is.
  • A: Actionable – A message should only be presented to the user if there is steps the user can take to make the right decision.
  • T: Tested – A security message needs to be tested. TDD, Usability Testing, Visual Inspection, every test.

So, we need to show the message now – what do we put in there? SPRUCE:

  • S: Source – Why are we showing this message? Did a website do something or a file or a user action? Tell the user.
  • P: Process – Give the user the steps they need to go through to make sure they make the right decision.
  • R: Risk – Explain what the consequences of getting the decision wrong.
  • U: Unique – If your software knows everything, do the right thing automatically. So if you are showing the message, it means the user has unique information that is needed to make the decision. Explain what information is needed (slightly similar to P).
  • C: Choices – Show the user all the options and recommend the safer one.
  • E: Evidence – Provide any additional information that the user may need to make the decision.

Now that the training is done, let’s look at real implementations:

A web page contains secure & nonsecure content

Here is what the dialog looked like in the bad old days of IE6:

11[2]

In IE 9 where this logic has been applied:

ie9

Let’s look at the differences:

  • N (Necessary) has been applied – previously this was a blocking model UI, which the user was forced to deal with to continue working. Today it shows discreetly with at the bottom and only if the user needs to work with this they have to, otherwise ignoring it.
  • E (Explained) has had been done with the What’s the risk? – which shows the dialog below. It is not perfect as it hasn't followed SPRUCE fully but it is a good improvement.
  • A (Actionable) has been applied – previously you had both a yes & no, now we have one action that can be done. Close or ignore and nothing happens.
  • T (Tested) there is some weird language issues with the old one especially if English isn’t your primary language because of the yes/no not being perfectly clear. The new dialog has a single very clear labelled button!

whats the risk

Takeaways

Now that we have looked at how it can help you and how to do it, attached is a nice simple 3 page document with more details and reminders about this. GO IMPROVE YOUR APPLICATIONS!

 

Yalla - do it now!

Submitted by Robert MacLean on Mon, 07/11/2011 - 12:37
Update 26 July 2011: Note that once you have done this you must move off of YallaApps to AppHub by 20 August 2011 or you will not get refunded. See this post for details on how to do that

yalla appsThe single reason I don’t tell people to buy Windows Phone 7 devices in South Africa – no market place. This issue for users means a 3rd rate experience on the device compared to other smart phones. For developers this was an issue, because it meant we couldn’t get our phones unlocked and we couldn’t publish… this WAS an issue for developers.

Now we developers have YallaApps, a service to allow developers where Microsoft doesn’t have a marketplace to develop and publish apps. It is a good but slow service, but today is not about Yalla, today is about you.

As a South African, you can signup for YallaApps (no phone needed) and get

  • $100 (about R800) worth of credits for free
  • Your phone unlocked (if/when you get one)
  • A free developer account (value $100) when the marketplace arrives

All you need to do is signup – it takes 5 minutes. My suggestion, regardless if you have a phone now or not or if you plan to develop an app – DO IT NOW! Get those free benefits banked for later so that if you do decide one day it costs you nothing!

Mercurial + Lightswitch : .hgignore file bliss

Submitted by Robert MacLean on Mon, 06/27/2011 - 12:19

Clipboard02Lightswitch is a fantastic tool but has a MAJOR downside to it – it eats disk space like no-ones business. A simple test project with 1 table, 1 screen & some code on the client side and server side is over 90Mb of space!

If you are a developer you will have some sort of version control system in place and you should be following some best practices in version control. For this post, the one I want to look at is to only check into the repo what actually needs to be in the repo. A polluted and huge repo is not only hard to work with, it puts people off and lowers adoption Sad smile

I have been using Mercurial a lot recently and part of a new LS project I took the time to look at how much of the LS project needs to go into the repo – and you know what… it is VERY VERY LITTLE, in fact it is about 0.4%!

Mercurial, for those new to it, has a .hgignore file which uses a regular expression like language to tell it what files to ignore, i.e. don’t commit those files to the repo. Below is what my .hgignore file looks like. That first 4 line group is the LS specific lines while the rest is for general Visual Studio projects:

syntax: glob

*.lsproj.user
ServiceConfiguration.cscfg
*/_Pvt_Extensions/*
*/GeneratedArtifacts/*

*.csproj.user
*.vbproj.user
*/[Oo]bj/*
*/[Bb]in/*
*.suo
*DXCore.Solution
[Tt]humbs.db 
*.user
*.bak.* 
*.bak 
*.[Cc]ache
*/[Pp]ublish/*
*.vssscc
*.vs10x
*/[Dd]otfuscated/*
[Dd]otfuscated/*
*.vsp
[Nn][Dd]epend[Oo]ut/*
*.licx
*.docstates
*.cscfg
*.csdef

It is important to note that when you pull from the repo (or checkout for TFS/VSS/SVN folk) you’ll get the disk saving, until you open it up that is. Once opened LS will regenerate everything and the size on your machine will be back to the massive 90Mb+, however the repo will remain small, commits will remain small, network traffic will remain small and performance improved – just what we wanted from following those version control best practises.