Anyone who has written C code has probably at one point or another had to write a small function to find the minimum value in a set of integers. When the set contains only two numbers, a macro like
#define min(a,b) ((a) < (b) ? (a) : (b)) is frequently used. When the set is expanded to three it is possible to add to that macro, but I generally prefer to err on the side of code readability whenever possible, so I just write a little function to do it. Recently, as I was performing research for my master’s thesis, I saw some C++ code which implemented the minimum_of_three function slightly differently than my standard naïve approach. The comment said something to the effect of, “spend a register to reduce the number of branches and increase performance.” I’m always looking for ways to improve my code, so I thought that I would try out this better way. However, I am not one to just blindly believe stuff I read in code comments, so I had to test it out for myself. Below are the results of my analysis.
This details the hardware design for a simple 12-bit microporcessor. I created it for an undergraduate class which I took a few years ago. It is not really usefull for anything besides learning how computer hardware works, but I still think that it is pretty cool. I found the documentation for it on my hard drive and remebered how proud I was to have actually completed it; I am a computer scientist, not a computer engineer. Simple logic gates are used as the basis for the creation of more complex digital electronic circuits; those circuits, including a control unit, are in turn connected via a datapath to form a completed processor. The processor datapath is designed to implement the Simple-12 instruction set.
I have heard that it is more efficient, in C based languages, to pre-increment (
++counter) than it is to post-increment (
counter++). However all the online discusions of the topic that I have seen did not provide actual evidence as to why that might be. One of the things I have learned about technology is that there are very few rules of thumb that last, especially when it comes to limitations. So, I decided to run a couple small tests using my current language of choice, Objective-C.
Let’s start with the most basic example. We will define an integer, post-increment it, pre-increment it, and then look at the generated asembly code. I entered the following Objective-C code into Xcode. (By the way, using
int instead of
NSInteger will produce the same results, but Apple recomends using
NSInteger since it is a 32-bit int on 32-bit platforms and a 64-bit int on 64-bit platforms)
NSInteger i = 0; i++; ++i;
The Mayor of Barberton, William Judge, is always looking for ways to engage the community, and I have been working with him to accomplish that on the technology front. In 2013 I did a complete overhaul of the City’s website; the goal was to structure the website in a way which would make it easier for citizens to interact with local government while also promoting the City’s strengths to visitors and potential residents. The website was designed with mobile use in mind, but people are coming to expect the experience provided by a dedicated mobile apps, so in 2014 Barberton will begin introducing dedicated mobile apps.
MarkShown is a very simple iPhone app for quickly creating textual presentations which can be shown on an external display. Markdown syntax is used to format presentation slides and presenter notes; the presentation slides will show on an AirPlay device or other attached display, and the presenter notes will show on the local screen.
Version 2.0 of Markshown is now available in the App Store. This version uses Discount 2.1.6 to parse the Markdown, so it does SmartyPants transformations and supports other Discount specific syntax. Discount takes Markdown and generates HTML, so UIWebViews replaced UIViews with CoreText. This means that CSS can be used to style the presentations, and the style portion of the app is now nothing more than CSS. Since each slide and presenter note is essentially a web page the navigation was changed to act like Safari, swiping left from the right edge navigates to the next page and swiping right from the left edge navigates to the previous page.
I recently worked on a project which required extracting bug details from a Bugzilla database; we were attempting to reproduce the results of an academic paper in which the authors attempted to establish a link between object-oriented software metrics and program buginess. Bug data was obtained from a Bugzilla database to determine the buginess of a class. The original authors obtained a copy of the entire bug database and ran queries against it directly. We would not have been able to get a copy of the entire database, but fortunately it is now available on-line. We started by using the Bugzilla web search interface to get a list of bugs for the time period covered in the original research. We then fed that list of bug IDs into the script below to get the details we needed: which files, or classes, were associated with each bug.