HttpClient for High-throughput Applications

It’s been a while since I’ve posted anything on the MobTowers blog. In the meantime, Mrs MobTowers and I have created a small human alarm clock. Lack of sleep makes me a bear of very little brain.

So, I’ve been busy! But I thought I’d jump straight into something tricky, and clear up some confusing points around the HttpClient, with particular focus on making it work well in high-throughput scenarios.


PowerShell Log File Viewer

Just a quick post today with a great tip for viewing log files with Powershell.

Get-Content .\alltheerrors.log -wait

This command shows the content of the file line by line, and the -wait switch updates the output whenever the log file is saved, giving you a live feed of logged info.


C# – When to use the var keyword

As long as I’ve been programming with C#, there’s been a civil war. Only one subject polarises developers more than this one; tabs vs spaces anyone?

Essentially, when your app is compiled, the types of any variables declared with var are inferred by the compiler.

var myList = new List<int>();

In the above code, myList is inferred to be of type List<int>.

Generally, I don’t use var all the time, and here’s why.


Thoughts on T4MVC

In short T4MVC uses a T4 template to convert your views, actions, and controllers into types which you can reference rather than using magic strings. T4MVC essentially adds static types to your MVC project, allowing you to catch misnamed views, actions, or controllers at compile time rather than at runtime. This is a great thing, but there’s a subtle problem here which I’ll go into further below. First, a brief overview of what T4MVC does.



Custom Views in Xamarin.Forms

I’m a big fan of Xamarin. It is, in my opinion, the best solution for cross-platform mobile development. Xamarin enables you to produce apps for iOS and Android, written in C#, and to share a large proportion of the code, with only the UI layers for each platform being written independently. The apps produced run natively on each platform, using proper native views.

I’d like to present a quick introduction to Xamarin.Forms. Xamarin.Forms takes another big step toward code-sharing. It allows you to share the UI code as well. So you can write code such as the following in a unified shared mobile project.



Xamarin Android – Image Caching

This is the second in a series of articles on image handling in Android. Check out my first post on using remote images in lists if you missed it.

Put simply, image handling can take its sweet time on slower devices. Once downloaded, or loaded from file, or processed, or all of the above, it would be ideal to cache any images to be quickly loaded from memory later. Simply caching images in memory creates another challenge, as there may not be much memory free on the device, and each app has a set limit.

An ideal solution to this problem is a cache which will automatically evict images once it’s full. (more…)


Xamarin Android – Using Remote Images in Lists

This is the first in a series on image handling in Android. It is specific to Xamarin, but the principles discussed here apply to Java-based Android apps as well. This article assumes prerequisite knowledge of ListViews in Android, and the use of Adapters to supply the data they display.


Xamarin – Date and Time Handling

When sharing code between iOS and Android, it can be important to understand the differences in the way the platforms handle dates and times.

Here’s some key points to note when using Xamarin to handle dates and times.