Cees Alberts on February 12th, 2015

Mircules DX Cluster for Android
After working for years as a freelance .NET consultant I decided to use my C# skills also for the mobile platform. Using Microsoft Visual studio you would only be able to support the Windows Phone framework, but using Xamarin studio gives you more options.

Xamarin studio is a development environment that uses C# to make apps for the mobile platform and for Mono. This means that you can write apps in C# for Android, iOS (iPhone / iPad), Mac OSx and Linux.

Mono is comparable to the .NET framework. Although not everything that is available in the .NET framework is also supported in Mono, it comes pretty close!

After making several succesful iPhone and iPad apps using Xamarin I recently decided to also make some apps for the Android platform. Until now I didn’t want to do this because earning money with Android apps is more difficult than for iOS. People want the apps to be free on the Android platform and are a lot less willing to pay for apps. After I found out that putting ads in your apps can even earn you more than charging people for an app, I decided to see how much time it would take to make an Android app.

Because it would be my first real Android app, I decided to port one of my existing iOS apps to the Android platform. This would mean that I could focus on the Android specific things and issues and not on the logic of the program.

I quickly found out that Android has it’s own specific platform quirks. They revolved mostly around the fact that there are so many different devices and device manufacturers! Because of this you need to setup your user interface in a flexibel way, because the app doesn’t know what resolution the device has. Everything should just fit on every screen and screen resolution and if necessary wrap text in the most natural way. A bit like responsive website designs.

Android uses a form of XML and CSS to design the user interface. So in general you can say that, if you know how to program in C# and you know XML, HTML and CSS, you’re good to go and make Android apps! As long as you use Xamarin of course!

In the end, with my existing knowledge, it took me less than a week to port my iOS app to Android. Seeing that this was my first C# app for Android I think a week is ok. I’m now ready for my next Android app which I will built from scratch. This will probably make it a bit more challenging but that’s what makes it fun!

Cees Alberts on June 29th, 2014

I made a small application to get images from Flickr and wanted to display this in a website in random order. I found this little snippet of code, which shuffles any collection (using generics) into a random collection.

It’s an extension method that extends any collection with a Shuffle method. I just love those extension methods and use them a lot!

public static class Extensions
{
    public static void Shuffle<T>(this IList<T> list)
    {
        Random rng = new Random();
        int n = list.Count;
        while (n > 1)
        {
            n--;
            int k = rng.Next(n + 1);
            T value = list[k];
            list[k] = list[n];
            list[n] = value;
        }
    }
}

 

Cees Alberts on May 30th, 2014

I love developing software on my MacBook Air! I got the latest version with the maximum possible specifications (i7, 8GB internal mem, 512GB SSD disk) so it works better than anything I ever had!

One of the things i was missing (a  lot) while developing is that I cannot start 2 instances of the same application on a Mac. In Windows I normally have 2 or 3 instances of Visual Studio open so I can work on several projects / solutions at the same time.

This way of working is not as easy on a Mac as it is in Windows. If you want to do this you should use the terminal command open using the -n switch. The description of the -n switch for the open command is

open -n  Open a new instance of the application(s) even if one is already running.

Now every time opening a terminal window and typing this command is a bit irritating but for this you can use the Automator application that comes with the Mac OSx operating system.

First you need to create a new document in Automator and choose Application as the type of document:

Automator - creating a new document

Click on the picture for a bigger version

Then choose as Action, Run shell Script.  After that you enter the open -n command as the script command, with the Xamarin Studio application as the application that you want to start. So this would be:

open -n “/Applications/Xamarin Studio.app”

Automator - opening multiple versions of Xamarin Studio

Click on the picture for a bigger version!

Save this document and afterwards double clicking on it will open another instance of Xamarin Studio!

Easy, once you know how to do this!

 

Tags: , ,

Cees Alberts on May 20th, 2014

This is a small piece of code I’m using to make the layout of an XML string a bit prettier.

It’s very useful if you want to write some XML to a text file that will be edited later.

protected string PrettyPrintXml(string xmlString)
{
    XmlDocument xmlDoc = new XmlDocument();
    StringWriter stringWriter = new StringWriter();
    XmlTextWriter xmlWriter = new XmlTextWriter(stringWriter);
    xmlWriter.Formatting = Formatting.Indented;
    xmlDoc.LoadXml(xmlString);
    xmlDoc.WriteContentTo(xmlWriter);
    return stringWriter.ToString();
}
Cees Alberts on May 19th, 2014

Submitting an app to the Apple app store isn’t as easy as you would think it would be.

You need certificates, profiles and accounts to manage everything and to get the app admitted for review and after that admitted in the store.

As you know, I’m using Xamarin’s MonoTouch to write my apps because I already have a lot of .NET experience and I can use that in MonoTouch.  Xamarin made a very nice How To in which they describe what steps to take when submitting an app that is written in C#, using their product.

I use this How To as a step by step guideline whenever I’m putting an app in the app store.

It’s highly recommended reading for every MonoTouch developer, I think, and it can be found here!

Cees Alberts on May 18th, 2014

It has already been almost a year since I wrote my last blog entry on this blog site. I have been busy working for a big client, making a big MVC .NET intranet website for searching and displaying internal files and dossiers.

I did a lot of MVC, Razor, jQuery and WCF work so all in all it was very interesting, but it also meant that I couldn’t put any time in some of my other projects. Like .NET iPhone / iPad programming!

Now I decided to do a very necessary upgrade of one of my apps in the Apple app store. The name of the app is “Mircules DX Cluster“, Mircules being the name of my own company. The main upgrade I did was to convert it to iOS 7, because it was still iOS 6! I noticed a significant drop in sales because people are looking for the newest apps of course and iOS 6 apps just don’t fit that category.

So now that I put the new and improved app in the store, I need to add a few new features to it. Next to this I have another (new) app I want to put in the store. There are some other iOS and Mac OSx projects I want to finish and finally put out there so they can start making me some money! 😉

Cees Alberts on April 3rd, 2013

Making my first iOS app went rather quick and without any major problems. It helped of course, that I already made an app for a client of mine!

After the app was accepted by the Apple review process and was available for the public I found out there was a small problem with the app.

It turned out that the server I was using to get the info for the app was having some problems. If I wouldn’t do anything about it this could grow out to be a big problem!

In the end this could mean my app would show nothing at all!

The solution was easy enough; I added another server to the app so if one is not available it will automatically use the other one.

The bigger problem was that I needed to put the app again in the Apple review process which would take another six days to get reviewed! Six days would be too much for my app, not showing any data! This would for sure give me some bad reviews in the store!

After googling a bit I found that there is an “expedited review process” for the App Store! This means if you ask nicely and the Apple review guys agree that you have a “situation” that needs looking at, they will review the app as soon as possible! I tried to describe my problem as good as possible and they agreed to the expedited review!

From solving my app problem, to having a new version in the app store took all in all 1 day!

Great! The review guys from Apple really helped me out here!

The link to the expedited review process is:

https://developer.apple.com/appstore/contact/appreviewteam/index.html

The link to my app (Mircules DX Cluster) is:

https://itunes.apple.com/en/app/id595659818

Cees Alberts on February 13th, 2013

My last project was for a client where I was in a position to study how to make apps for the iPhone and the iPad.

After 10 months the project finished and I decided to make an app that I could use myself. It should also be of such quality that I could sell it in the Apple app store through my own company!

Some of you might know that, next to being a professional programmer, I’m also a Radio Amateur so I wanted to make an app that would be useful also for me as a Radio Amateur.

I decided to make an app that would work on the iPhone and the iPad and that would show DX Cluster info. A DX Cluster is a “chatroom” or node into which amateur DX hunters can post information about DX either worked or heard. (see also the Amateur Radio Wiki )

This information is very useful for a radio amateur that is searching for that interesting station operating from the other end of the world and that is not yet in the “collection” of the radio amateur. I use a web based version of this a lot but if you’re on the go, the web version isn’t a good solution. I looked in the app store and found that there are a few apps that do the same thing but none of them shows the location (country) of the stations in the list of items found!

I think this is the most important piece of information that you would want to see, so I put it in the list where you would expect to find it!

So, because the versions already in the app store didn’t meet my needs, I decided to make my own app for this. After some hard work and testing I finished the app and put it in the Apple app store. It’s become also my own most used app which shows that it is useful, at least for me! 😉

You can find it in the app store here: Mircules DX Cluster.

The info page is also on my own radio amateur website here.

It’s a universal app which means if you buy it once, you can use it on the iPhone AND the iPad without paying twice.

My next project is making a Mac OSx version of this app which will be put in the Mac OS app store.

You can find it there in not such a long time; weeks rather then months!

Tags: , , , ,

Cees Alberts on February 7th, 2012

Lately I haven’t been doing a lot of iPhone and iPad development in my spare time, so I haven’t also been writing a lot of blogs about software development.

The reason for all of this can be found almost 30 years ago!

I used to be very much interested in CB radio (27 mc). For those of you that don’t know what this is, wikipedia describes it as; a system of short-distance radio communications between individuals on a selection of 40 channels within the 27 mhz (11 m) band. I used to play around with this when I was between 12 an 15 years old.

Previous October (2011) a friend of mine started to play around with CB radio and he got me also involved again in this. After this we started talking about getting the amateur radio license. The license is like a grown up version of CB radio and is actually a lot of studying electronics, electronic circuits and the dynamics of electro magnetic fields, propagation, (types of) antennas and the inner workings of transceivers. My friend is canadian so it’s a bit difficult for him to take a (Dutch) license exam. For me it was a bit easier, so the end of October I got the study material from the Veron (Radio Amateur Organization in the Netherlands) and studied several hours every day in November.

The 8th of december I took the official government N license exam and I had 0 mistakes; I aced it! The end of December I registered my call sign (PD1CA) with the Agentschap Telecom in the Netherlands. After this I made a quick website ( www.pd1ca.nl) and started to make the airwaves “unsafe” with my second hand bought Yaesu FT-817 and Yaesu FT-897D transceivers!!

There is still a lot to learn although I think the license study prepared me good for my start in the radio amateur / HAM radio world. I started my quest for the perfect antenna, took my first steps in digital HAM radio (PSK31, RTTY etc..) and am making my first contacts around the world talking to a lot of  people even with the limitations I have with my CEPT Novice license (N License).

The next step will be making iPad and iPhone software for HAM radio, and I’m looking forward to starting this.

Combining my new and my old hobby would be perfect!!!

Tags: ,

Cees Alberts on July 26th, 2011

The ASP.NET development server is a very useful tool but now and then I find that I need to use a service or website that I’m developing in another solution than in the one I’m working in. I found that it is easiest just to add the instances of often used services and websites to the external tools list in Visual Studio.

To do this go to the Tools menu in Visual Studio and click on External Tools.
Then click the Add button to add a new item. Give it a title and enter as a command the following:

C:\Program Files (x86)\Common Files\microsoft shared\DevServer\10.0\WebDev.WebServer40.EXE

The path may differ depending on your windows version and installation. I’m using Windows 7 with Visual Studio 2010.
The arguments should be:

/port:XXXXX /path:SSSSS /vpath:/

Where XXXXX is a port number used for the development web server and SSSSS is the web server / web service path. The /vpath points to the application root of the service or site

For instance:

/port:21000 /path:C:\Sources\MyProject\WcfHost /vpath:/

Now you can start the service from any solution and you don’t need to keep the solution in which the service or site is made open. Just remember at some point to stop the development server again because it will not stop automatically by closing Visual Studio.

Tags: , ,