Debug Logging in .NET

This post provides useful references for tackling debug logging in .NET. It does not delve deeply into any of them.

Most Java developers are familiar with and routinely use Log4J from Apache Foundation. In fact, Log4J used to be the single big cause of package incompatibility in the Java world. Several Java libraries have been ported over to the .NET world. Log4J is one of them, its .NET equivalent is Log4Net.

If your company makes using open source components exceedingly difficult, .NET has the built-in Debug and Trace classes in System.Diagnostics package. Use TraceSwitch to determine log level. Use TraceListener or any of its subclasses to determine where the log output should go.


Monthly news review

This post reviews news in the month that has passed.

Everything Google announced at Google I/O 2014 in one handy list

Google announced a lot in one long keynote at I/O. Android One, Android Auto, Android Wear, and Android TV, are probably the big announcements this year. Looks like Google is prefixing all mobile-oriented hardware with Android, web-oriented hardware with Chrome, and services with Google. Unless it is something coming out of Nest, who’ve just launched a developer program for the programmable home.

Aereo Lost. What Now?

TV broadcasters are celebrating while the tech industry is up in arms. Are customers the real losers? Why should we need airwaves to transmit TV in the era of mobile internet? Why hasn’t the TV business adopted on-demand programming more actively? It isn’t as if their business isn’t being slowly driven to the ground.

This is Microsoft’s first Android smartphone, the Nokia X2

Nokia could have hedged its bets with Android a long while back. So why now? It is a cheap but attractive Android Smartphone full of Microsoft software and services.

Amazon’s Fire phone launch: Hits, misses, and takeaways

From inexpensive tablets to a fairly expensive phone, Amazon as come a long way. Lack of Bluetooth 4.0 (especially Smart) is annoying. It does seem to sport universal LTE, like the Moto G 4G. Will the Fire Phone truly delight users?

Google Donates Mod_Spdy To The Apache Foundation

HTTP 2.0 is around the corner and changes one crucial aspect of HTTP 1.x. It will no longer be a text-based protocol. An important feature is that data will be multiplexed over a single connection a browser maintains with a server.

Docker hopes its container platform will ease the lives of developers

Will an open container help big companies and other providers overcome the dependency on and momentum of Amazon, Google, and Microsoft?

Turing Test breakthrough as super-computer becomes first to convince us it’s human

Not everybody is convinced though, but the implications are important nevertheless. How do you know an e-mail message wasn’t sent by a real person? Are we at the cusp of having to deal with endless amount of believable spam? Looking at the positive aspects, customer support, distance education, and other areas that depend on personal interaction, may benefit.

Skype Translator Will Change the World

Real-time voice translation is a hard problem. You have to translate speech to text. The text then needs to be translated to the target language. The translated text then needs to be converted to speech. Imagine doing all of that in real time. Imagine doing that wrong in a UN session discussing climate change.

Google’s secretive 3D-mapping project now has a tablet

Google is keen to map the indoors. I see huge potential for indoor mapping. Imagine your interior designer mapping your house so that she can show you exactly how your renovated indoors will look? A robot that can go about your house tidying it? Are we heading towards becoming Wall-E lazy?

Apple announces iOS 8 at WWDC 2014

Easily one of Apple’s best WWDC considering all the news. A new programming language called Swift, Mac OS X Yosemite, Metal, HomeKit, CloudKit, and extensions in iOS 8. For those eager to learn Swift, Apple has provided an iBook for it already. A good news for all Netflix viewers, Safari on Mac OS X Yosemite now allows streaming using HTML5, no Silverlight required.

Smartphones on busses in Recife

Those who can afford cars in Recife love to hate busses. They’ll tell you busses are noisy, over-crowded, infrequent, uncomfortably hot inside… you get the picture. I’ve been using busses for the past couple of years for several reasons. I don’t like driving, busses are cheaper, and the congested streets have one less car due to me.

Getting back on topic, I have observed that almost everybody has at least a low-end Smartphone. Samsung manufactured phones look to be the majority, but it is not uncommon to see phones from LG and Motorola. Apple and Nokia built phones are less commonly seen.

Phones stay mostly invisible, tucked in pant or shirt pockets, and handbags, as they are attractive targets for the opportunistic robber. Most people run a headphone from the phone to their ears, which leads me to conclude that they are actively listening to music or FM radio. I also see an increasing number of people using Facebook. The fact that they can do it for free on some carriers probably helps.

Fewer people actively talk into their phones. That the bus environment is noisy probably discourages more of that. Young, college going adults, seem to message more often than talk.

I don’t see anyone gaming that much, although an occasional person does appear playing casual games akin to Candy Crush Saga, maybe because these don’t require high-end phone specs.

Memory alignment problems in AVR32

This post summarizes some memory alignment problems I’ve had with AVR32 and Atmel’s GNU toolchain that ships with Atmel Studio 6.2.

INTRAM section length in the linker script

My problem began when I changed the INTRAM section length in the linker script. The code fails, and I am not even able to start a debug session using JTAGICE mkII. Lengths of 0x00007FFC and 0x00008000 work all right, 0x00007FFF does not. The former are a multiple of 4 i.e. 32-bit aligned, the latter is not.

Casting to a pointer of different type

Casting an unsigned char pointer, to pointer to a multi-byte scalar type such as unsigned int, and accessing it, for example *((unsigned int*)(&array[index])), may lead to Data Read Address exception. If you are stuck in that exception handler, you’ve got a memory read alignment problem.

Passing pointers to unaligned members of packed structs

I haven’t (yet) had any problems with packed structs, but beware of passing pointers to members of such structs to other functions. If your architecture does not support unaligned access (AVR32 being one such architecture), the processor may fault when functions try to read or write memory through misaligned pointers. Passing a pointer to the struct itself is fine because the compiler knows it is packed, and will access its members in a safe way.

Programming an Arduino using BlocklyDuino

Blockly is an experimental drag-and-drop programming environment not unlike Scratch. BlocklyDuino is based on Blockly and provides an open source drag-and-drop programming editor for Arduino. It doesn’t yet build the resulting code, but you can copy-paste it into the Arduino IDE.

Here’s something quick I built to try it out. If an input digital pin is logic high, it prints text to the serial port.

BlocklyDuino Editor

Try and make it yourself, or open the following XML using BlocklyDuino’s Load XML feature.

<xml xmlns="">
  <block type="controls_if" inline="false" x="59" y="70">
    <value name="IF0">
      <block type="logic_compare" inline="true">
        <title name="OP">EQ</title>
        <value name="A">
          <block type="inout_digital_read">
            <title name="PIN">2</title>
        <value name="B">
          <block type="inout_highlow">
            <title name="BOOL">HIGH</title>
    <statement name="DO0">
      <block type="serial_print" inline="false">
        <value name="CONTENT">
          <block type="text">
            <title name="TEXT">Hello, World!</title>

You can copy-paste code from BlocklyDuino’s Arduino tab into the Arduino IDE.

BlocklyDuino Arduino Tab

You can then use Arduino IDE to verify it, and upload.

Arduino IDE with code copied from BlocklyDuino

Toggle Pin 2 between 3.3 (Arduino Pro) or 5 volts and GND with a wire. You should see text appear in the serial port output when the pin is high.

Monthly news review

This post reviews news in the month that has passed.

Xamarin 3 Enterprise Edition Reviewed

Is cross-platform native GUI development a reality? Forms is something I’d be eager to adopt. Xamarin licensing is a bit on the expensive side of things though, and aimed squarely at enterprise developers that can afford it.

DMV Lays Out Rules Governing Self-Driving Car Tests

If you live in California, you’re now one step closer to riding a self-driving car. The rest of the world will probably benefit too. Google has been making a lot of press this month with their new self-driving car. That its brand has surpassed Apple in value is probably attributable to projects like these, and the good-enough smartphones.

Microsoft announces 12-inch Surface Pro 3, wants to replace your iPad & MacBook

Wish I could replace my laptop, though I think it is hard to beat the one I currently use in versatility. Care to guess which one?

Xiaomi’s 49-inch Android TV boasts 4K for just $640

Xiaomi already sells an Android powered TV, but this one has an incredible 4K display.

Motorola Says It’s Time to Ditch the Feature Phone, Intros $129 Moto E

Not satisfied with the price point achieved by Moto G, Motorola has launched Moto E. Lenovo must be pleased. Motorola has had to make a few trade-offs. Moto E has only 4 GB of internal storage and no front-facing camera. To its credit it comes with a microSD slot and Android KitKat.

GitHub open-sources all of its Atom text editor

Imagine Google Chrome as a full-fledged development environment. Atom is eminently customizable and already has a huge number of packages. Need Lua script editing capability? Just search for Packages with “lua” in their name and install.

Apple Launches Recycling Program for All Old Products

Have old Apple gadgets that friend and family refuse to accept? Apple will now take them back for free or a credit towards new purchases.