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.
After a few years of using Google Blogger, I decided to switch to a different on-line publishing platform. It is not that there is anything wrong with Blogger, I am just looking for a change; I also think that there is a chance that Blogger will be subsumed by Google+ someday, and that is not the platform I am looking for. Twitter is presently my social network of choice, but I periodically want a way to publish things which are longer than 140 characters. Prior to using Blogger I had my own Wordpress server, but I concluded that keeping a personal server up to date with all the latest security patches was not an effective use of my time, so I am not interested in going back to that arrangement. Besides, today there are so many cloud based solutions available that I see even fewer reason to invest in maintaining a private server. Tumblr has become a very popular platform, but I’m not sure what Yahoo’s acquisition of it will mean in the long run. I could switch to a hosted Wordpress service, but that seems to be more powerful than what I need. I mostly publish text with code examples and a few images, so I could use Panic Coda to publish a static website, but that would mean that for each post I would have to modify at least two pages: the new post and the index. I just need a simple text blogging platform, perhaps one that will accept Markdown and make it super easy to write a post.
For small apps you often need to store some basic settings, and using a plist file in the app’s document directory is an easy way to accomplish this. Below is a little snippet that I have used more than once for this purpose.
It would seem reasonable to expect that an on-screen keyboard would normally be used with a UITextView, but if the UITextView is full screen then when the keyboard displays the bottom half becomes inaccessible. It is easy enough to fix, but there seem to be more ways to get this wrong than there are to get it right. Below is the method that I have found (from examples on the Apple developer site) to work the best, so far.