dotnet

Xamarin Forms frame is the wrong color

Oliver Brown
— This upcoming video may not be available to view yet.

screenshotXamarin Forms uses a naive conversion from it’s platform independent Color class to iOS’s CGColor, and as a result, Frame controls end up with inconsistent background colors. I’ve added a demo here.

This is an imported post and may not be formatted correctly. View the original here.

Clarifying my position on ASP.net

Oliver Brown
— This upcoming video may not be available to view yet.

One of my most read (and most commented on) posts was the one claiming “ASP.NET sucks”, which only goes to show being a little offensive goes dissapointingly far on the internet. Since it has now been five years since I posted that, I thought a quick follow-up was in order. I stand by most of what I said my initial post, but with a little specificity. It’s not ASP.net that’s the problem but Webforms. Unfortunately at the time Webforms was all you ever saw. There are alternatives around today (and may have been back then but none were especially high profile and none were by Microsoft). These days of course Webforms are very much out of fashion. Following on from the success of Rails (and then many) Microsoft realised that Webforms weren’t an idea that could keep up with modern web development. A quick glance at the ASP.net home page today shows four out of five articles talking solely about ASP.net MVC and one article talking about both MVC and Webforms (of course that will vary by day I but I doubt the result will be very different). So taking into account a minor title change (ASP.net Webforms suck!) I’d say my original point stands…

This is an imported post and may not be formatted correctly. View the original here.

Silverlight is pretty cool

Oliver Brown
— This upcoming video may not be available to view yet.

More than two months since my last post. Which means I suddenly have a lot to say. Beware, rambling may follow… Nearly five months ago I claimed to be making “rapid progress with language learning”. Well obviously not rapid enough to actually reveal anything. Well that might be at an end soon. One of the problems of writing the app using things like LINQ means most people will have other things to install to use the app (.NET 3.5 specifically - and possibly .NET 3.0 for non Vista users) and even then it’s limited to Windows users as Mono support for Windows Presentation Foundation will be a long way off (if they do it all). Since Silverlight 2.0 is supposed to be really cool and now supports a big chunk of the widgets from standard WPF (and has has quickly developing Moonlight support), why not write the app in that? So that’s what I’ve been doing. And it was a lot easier than I thought. The first piece of easiness I found was that I oly had to make like three changes to my non-UI code to make it compile as a Silverlight DLL. Unfortunately I can’t persuade Visual Studio to compile it as a Silverlight DLL and a normal DLL in one go, so I’ve currently got the same code added as two different projects and I copy the code between them (not ideal). The only real work I had to do was reimplement my data provider. When I started, I cunningly made sure that all resources (lessons, media, user progress) was grabbed from a data class. I wrote a new class that fetches it from a RESTful server (more on that in another post). So hopefully, a nice Silverlight version of the app will be public soon… About Silverlight For those that don’t know, Silverlight is Microsofts answer to Flash. Apparently. I’m not sure if it’s that a good analogy really. Silverlight 1.0 basically gave you access to a nice environment to draw things in the browser and then manipulate it with Javascript. Or something. To be honest I didn’t really care about version 1.0 since writing complicated things in Javascript doesn’t sound like fun. Silverlight 2.0 (formerly Silverlight 1.1) on the other hand gives you that same environment but the ability to manipulate the things with compiled .NET assemblies written in any CLR language and comes with implementations of a lot of the widgets in the WPF.

This is an imported post and may not be formatted correctly. View the original here.

Google Docs rule - if you use them right

Oliver Brown
— This upcoming video may not be available to view yet.

I’ve been vaguely using Google Docs (specifically Spreadsheets) since it came out but never to do anything actually important. Most of the time I just had a list I need sorting, or if I was feeling sophisticated I’d use it to decide on what was best value for money (how much £/GB a range of hard drives were for instance). Recently I started using it to plan lessons for the language learning app. The ability to use it from work (or any other computer I might be on - including viewing it on my Nokia 770) was useful, but in the end I was only really writing a list with it. Until now. I now have a nifty little C# app that generates modules directly from a Google Spreadsheet which is definitely a Good Thing. I’ve been thinking of writing an app for module editing for a while since writing them by hand is tiresome and error prone. Google Spreadsheets does half the work for me by providing the user interface for generating a table and then provides access as simple XML. Which brings me to the matter of actually accessing the data. Google provide a client library in C# for accessing quite a lot of their API. I tried using it but found it a little confusing. Luckily since I was just wanting to query data, I discovered that raw access was actually easier. You simply make a GET request to http://spreadsheets.google.com/feeds/worksheets/_key_/public/values (where key is provided to you when you “publish” a spreadsheet - access to unpublished spreadsheets requires authorization which is more complicated). This gives you an Atom feed of URLs to the individual worksheets which them contain Atom feeds of either rows or columns (your choice). The query power of LINQ (along with XElement, XAttribute etc.) make transforming the feeds into modules really easy. In fact the code that does the hard work (takes a spreadsheet key and generates the XML) is only 102 lines long, and that’s including unnecessary spacing to make the LINQ more readable (the main LINQ query is 35 lines).

This is an imported post and may not be formatted correctly. View the original here.

LINQ is magical

Oliver Brown
— This upcoming video may not be available to view yet.

The secretly named language learning app has been revamped to use LINQ for most of the XML handling. For those that don’t know, LINQ is a new technology that provides querying functionality in the .NET world. In my case I’m using LINQ to XML and it has seriously cut down on the size of the heaviest methods. Also, the part of LINQ to XML that I found least interesting when I read about it is actually the part I’ve found the best - the new XDocument API. Anyway, LINQ combined with a new USB headset that provides some actually quite good audio means that the important fundamental features have been implemented and work. At the moment it can:

  • Generate lessons based on vocabulary1 modules
  • Generate lessons containing past content with the correct repetition timing.
  • Actually play the lessons (but only on Windows2)

There are a few more things I want to add before I release any of it (like more audio for a start). But I thought I’d at least point out development is still happening :o) 1Instead of the Conversation > Phrase > Term style of Pimsleur I’ve decided to go for a more freeform approach to start with (inspired by me listening to Michel Thomas again). A vocabulary module just contains list of words and phrases that are processed in order. 2I still need a cross platform way to play audio. At the moment I use MCI which is part of winmm.dll which is obviously Windows only. Although Wine has apparently implemented it almost completely but I’m not sure how I’d go about making that help me.

This is an imported post and may not be formatted correctly. View the original here.

So much for Gtk#…

Oliver Brown
— This upcoming video may not be available to view yet.

Well I’ve abandoned my plans to use Gtk# in the language app (which actually secretly has a name now). The main reason for changing is simplicity. I had a look at the TreeView control in Gtk and decided it was too much work. Although the theory of good MVC separation is good, the user interface is such a small, simple part of my app it wasn’t worth it. The stuff I need from System.Windows.Forms should work in Mono (and .NET 1.1 and hopefully even the Compact Framework). I still prefer the way Gtk handles layout of controls in general, but I console myself with the Windows form designer in Visual C# Express…

This is an imported post and may not be formatted correctly. View the original here.

Cross platform games on the PS3 and the Xbox 360

Oliver Brown
— This upcoming video may not be available to view yet.

In case you didn’t know, the PS3 can run Linux. Not only that but it’s officially supported by Sony. You can download (for free) a utility to put a boot loader on to some media (most likely a hard-drive but memory cards, memory sticks and anything else the PS3 can read (and can hold 10Mb) are supported) and set it to boot “Other OS” (that’s what the menu says). There are already videos on the Internet of it running Fedora. Zac Bowling already has one running Mono, a task simplified by the fact that the cell processor appears as a PPC. So where does the Xbox 360 come into this? Well Microsoft are releasing something called XNA, a modified/extended version of the the .NET 2.0 run-time with emphasis on Managed DirectX that is available for Windows and the Xbox 360. A version of XNA called Mono.Xna that is built on top of the Tao framework is in development. The end result is that in theory, games developed using XNA will run on Windows, Linux, Macs, PS3’s and Xbox 360’s. A few problems still exist. The processor that the PS3 uses is rather strictly an in-order processor so most stuff that isn’t written specifically for that will run slowly (although video playback will be pretty zippy) and so far there is no hardware 3D support for an “Other OS” so XNA (if it were available now) would run slowly.

This is an imported post and may not be formatted correctly. View the original here.

ASP.NET sucks

Oliver Brown
— This upcoming video may not be available to view yet.

I recently bought a book about ASP.NET: Pro ASP.NET in C# by Apress, mainly because when I was looking for jobs there were lots of ASP.NET jobs advertised. And I have to say I have no idea why. Part of the problem may be that is book isn’t very good (there are bits of vague contradictions and a general obsessive (and inaccurate) preachiness about it) but I think there are major limitations to ASP.NET.

Firstly the inability to post to a different page. Who the hell decided that was good idea? I know it can be faked but that’s just silly. And you can only really have one form on a page. Well you can only have one “rich” form that ASP.NET can access in a clever and high level way.

I’m assuming people will disagree with me (if not, why is it so popular). If you do, please explain why ASP.NET is supposed to be so amazing because I don’t see it…

Updated - Clarifying my position on ASP.net