New Arduino Q&A site online

If you’re interested in using Arduinos then I recommend checking-out the new Arduino Q&A site over on Stack Exchange. (It’s totally free to use.)

As with most Stack Exchange sites, it was in private beta for a couple of weeks to get it started. It’s now gone into public beta, which means it’s fully functional and anybody can join in. It’s a great place to go if you need help with specific Arduino problems, or if you’ve got some awesome expertise that you want to share.

Tagged with:
Posted in Electronics

NSIS Access Control problem with built-in users group

I was dealing with a subtle issue recently involving setting access permissions using NSIS (Nullsoft Scriptable Install System). In the end, it turned out that the problem was not with NSIS at all. Rather, it was a misunderstanding on our part regarding an unexpected quirk in Windows. However, hopefully this post will help anybody who encounters a similar issue.

Our installer was supposed to enable read/write permissions for all users on certain important files and registry keys. However, some users were finding these files/keys were not accessible, and it was preventing the software from working correctly.

Read more ›

Tagged with: ,
Posted in Programming

What is a serial-to-parallel shift register?

Shift register functional overview

A serial-to-parallel shift register (or SIPO: Serial In Parallel Out) lets you take a sequence of signals on one output, and split them up into several separate outputs. For example, if you don’t have enough GPIO pins on your Raspberry Pi, Arduino, or other computer/microcontroller, you can use a shift register to add more.

In this post, I’ll be looking at the 74HC595, which is an 8-bit SIPO IC (i.e. it gives you 8 outputs). The advantage of this chip over some dedicated port expanders is that it doesn’t require a complex protocol like I2C or SPI, and it doesn’t need a particular clock speed. That means you can control it with pretty much any digital output channels, and it’s very easy to write simple software to communicate with it.
Read more ›

Tagged with: , , ,
Posted in Electronics

Automatically output the callstack on a breakpoint in Visual Studio

When you’re dealing with a large program and multiple developers, it’s not always obvious how and when certain things get executed. One of the very useful ways to debug unexpected behaviour is to set a breakpoint on a suspect line of code, and examine the callstack when it gets hit to see the execution path.

For infrequent events, it’s not always desirable to halt the entire program while you do that though. Instead, you can tell Visual Studio to write the callstack to the output when the breakpoint gets hit, and immediately continue execution.

Read more ›

Tagged with: , ,
Posted in Programming

Swap rows and columns in Excel

A quick spreadsheet tip here for Microsoft’s Excel. If you want to swap the rows with the columns (i.e. ‘transpose’ the data) then you can do it using “Paste Special”. This is useful for turning a row into a column (or vice versa), or transposing a whole table.
Read more ›

Tagged with: ,
Posted in General

Understanding C++11 move semantics

If you’re a programmer, you’ll be familiar with the difference between making a copy of an object, and making a reference (or a pointer) to it. If implemented correctly, the former duplicates the data, resulting in two (or more) independent instances. The latter allows the same original data to be accessed in two (or more) different ways. These concepts are common to many languages, and are essential to passing and returning data in your program.

As of C++11, you can think of ‘move’ as being a third alternative. It’s expanded the core features of the language, adding move constructors and move-assign operators to your class design arsenal. It’s required the introduction of a new type of reference as well, known as “R-value references”, which we’ll look at later.

To quote from Scott Meyers’ excellent C++11 training materials, “move is an optimization of copy”. In practical terms it’s very similar to copying, but can offer a number of advantages, especially where copying and referencing are impossible or undesirable. In this post, I’ll try to cover the basics of moves, so you can understand what they are and how you can start using them yourself.
Read more ›

Tagged with: ,
Posted in Programming

Please update your feed URL

I recently changed Avid Insight over to using WordPress, so my blog’s feed URL has changed. If you’re still subscribed to my old Joomla feed then please update it to point at the new URL:

RSS: http://www.avid-insight.co.uk/feed

Your reader should be getting redirected automatically for the moment, but I won’t be supporting that permanently, as it requires a bit of a hack in WordPress!

Thanks.
-Peter

Posted in News

C++11 auto variables

Among many other things, the new C++11 standard defines the auto keyword. One of its uses is as a bit of short-hand which can make some declarations a bit quicker and easier. It can also improve the maintainability of code if used correctly, as it reduces some redundancy.

Read more ›

Tagged with: ,
Posted in Programming

Improve C++ performance in debug mode with inline expansion

When you’re dealing with an intensive real-time application, such as a game or simulation, a common problem is that debug builds in C++ can run much slower than release builds. This difference in run-time behaviour means it can be hard to reproduce and analyse bugs and other problems. There are several things you can do to improve it, and one which helped me recently was enabling inline expansion (or simply “inlining”).

A quick warning though: it won’t improve performance in all situations, and it can actually hinder debugging. For performance-critical code, you should first try manually optimising your algorithms.

Read more ›

Tagged with:
Posted in Programming

Amazon Kindle review (4th gen)

The 4th generation Kindle is my first eReader, which I bought shortly after they were released here in the UK. I’ve made light-to-moderate use of it for a variety of books, including fiction, non-fiction, and the occasional reference text. On the whole, I’m very pleased with it, and expect to enjoy it for many years to come. Read more ›

Posted in Gadgets
About
Avid Insight is my personal blog about various software, programming, electronics, and occasionally academic things. I also have a few past projects linked in the navigation menu above, so feel free to look around!
Archives