C++/C#

News, resources and discussions for C#/.NET and C++ developers.

Passing Functions as Parameters

Passing a Function as Parameter in C#
When I first started programming in the late 1970s, I was heavily into Pascal and the concept of passing an address as a parameter was just unheard of outside of academic circles. Procedural programming treated functions as something that were called, not passed around. Had I known C then—which had been around since the early 1970s—I might have been more aware of function pointers. If you don’t know C that well, a pointer is a variable that holds the memory… continue…

Creating Random Access Text in C#

Contents of the Two Files
Back in April I looked at disk folders as a possible alternative to NoSQL or using a relational DB. My conclusion wasn’t encouraging—I was concerned about poor performance, especially on Linux. The use case I examined was for a server that had from 100,000 to 1 million users. I wanted to store and retrieve text files for any user. Those files could vary in length from a few bytes to a few KB. Back in the dark ages—before the Web… continue…

How to Write a Game Runner Program

Cards
I wrote the runsevens game runner program to automate the running of the Tournament of Sevens programming challenge, and it was an interesting little project. It’s designed to do the following: Maintain a ladder of players. Run games of Sevens for a number of players by executing standalone exes. Update the ladder with games’ results. That’s a fairly high-level view. Running each game of Sevens also requires shuffling a deck of cards, dealing them to the players and tracking card… continue…

How One Line of Code Forced a Full OS Release

Posted In C++/C#, iOS, Working in Tech
iPhone Update
It’s not often that Apple ‘fesses up about a bug, but the release iOS 7.0.6 came about because somehow an extra line of code got added to a function and broke it. Normally a bug would probably not warrant a complete release, but unfortunately this one-liner broke SSL connection verification. This is the code that checks that the connection is talking to the correct destination and uses SSL and TLS to verify it. You can take a look at the… continue…

A Look at Microsoft’s PCL for SQLite

Posted In C++/C#, Working in Tech
SQLiteSpy
Having grown up in a world where the concept was anathema to Microsoft, it seems strange to think of them now on the side of open source. In 2002, for instance, there was public debate about the GPL with Microsoft taking a stand against it. Now, there’s a part of Microsoft that’s pushing out open source, “Building bridges between Microsoft and non-Microsoft technologies.” Now it has to be said that this does not come from sheer altruism. Microsoft has come… continue…

2 Free C Compilers Worth a Look

Posted In C++/C#, Working in Tech
Debugging in Pelles
It’s surprising how important the C programming language remains, as it’s now over 40 years since it was first created. It’s a simple but useful language that gives you a very low level view of memory and how variables are stored. It doesn’t have any high-level libraries for hash maps or lists; ANSI C only gives you arrays and pointers. If you want advanced data structures you have to either write them yourself using pointers or get third party or… continue…

Tournament of Sevens: Week 1 Results

Marathon
Though the Tournament of Sevens coding challenge took much longer to get off the ground than expected, I’ve taken steps to sort out the bot bugginess and the contest is now roaring ahead. The first week included 16 viable competitors, out of 19 entries. One obstacle in getting this going was from Eclipse projects. The problem with them is that their source files end up in different places and the IDE is a bit fiddly building and deploying the class… continue…

Programming for iOS With Xamarin Studio

Posted In C++/C#, iOS, Working in Tech
Xamarin Thumbnail
Back at the start of July I began a contract to develop an iOS app for a Taxi firm. I decided to invest in Xamarin Studio so that I could develop the app in C#. The development took a bit longer than expected due to issues with the server, but it’s now very near completion. Xamarin, while appearing to have come out of nowhere, is actually a renamed and rebranded version of MonoTouch, so it’s a couple of years old… continue…

Tournament of Sevens Contest Update: A Saga

Posted In C++/C#, Living in Tech
Tired Runner
I picked the game for this contest with the thought that it would be simple and straight forward. Was I ever wrong! The contest was due to start Jan. 1, but a sudden unexpected vacation took me to Vegas through Jan. 2. With jet lag and such, I wasn’t really up to sorting the entries it for a day or two after. I had most of my competition runner created, though I hadn’t debugged it. By that point, there were… continue…

Why Managed Code Is Safer

C# as Machine Code
One of the biggest sea changes in computing took place in the late 1990s, with the switch over to running managed code, first with Java and then a couple of years later with .NET. Prior to this, compiled code (typically written in C, C++, Visual Basic or Delphi/Pascal) produced unmanaged code. Yes, both of these run machine code. So what’s the difference? Unmanaged Code Unmanaged code is just low level code (machine code) that the CPU (Central Processing Unit) executes… continue…