Swift Weekly – Issue 10 – The Swift Runtime (Part 8) – Switch Statement

I was thinking of writing an article this week about the switch statement but i almost fell asleep half way through the article. that’s super boring. to write it even! so I thought I’ll do something more exciting and that is looking at how theswitch statement and its complementary case statement works.

Click here to read the full article on Swift Weekly’s GitHub page…


Swift Weekly – Issue 04 – The Swift Runtime (Part 3) – Operators

I have always been interested in finding out how different compilers work with basic operators such as +, -, % and so on. This week on the train I was thinking that it would be nice if somebody could explore how Swift deals with operators so, long story short, I decided to do it myself.

In this edition of Swift Weekly, I will show you how the Swift compiler works deals with (system and your own) operators and how to use operators to ensure you get the maximum performance.

Note: in this edition of Swift Weekly, I’m going to change things a little bit and instead of building for the debug configuration, I am going to build for Release to ensure that the assembly code that we are going to analyze is as optimized as what you will get when you release the app for the App Store. Optimization is hence enabled and the assembly output is long. That means setting the Optimization Level in your build settings to Fastest, Smallest [-Os] to ensure you get the export GCC_OPTIMIZATION_LEVEL=s export when you build your project.

Note: to ensure that the assembly code which we will look at is clean and nice without too much unnecessary code, I will remove bits and pieces of it but will keep all the assembly code that is relevant.

Continue reading this article on Swift Weekly’s home page here.

Build and Run Python Scripts Using Xcode 5

Edit 1 (20th October 2014): Xcode 6.1 instructions can be found here: https://vandadnp.wordpress.com/2014/10/20/building-and-running-python-scripts-with-xcode-6-1/

In this video, I’ll demonstrate how you can use Xcode 5 to build and run Python scripts.

[Feature Request] Audio Comments in Xcode? That would be great!

So I have had this idea for a while. The idea is simple. Audio comments in your favourite IDEs, such as Xcode.

What do I mean by that? Well, think about all the times where you were coding something complex and wanted to leave some comments in the code explaining to a fellow programmer how your algorithm works. Wouldn’t it be better if you could just record your voice and say what the algorithm does? And have that recording attached to the code and viewable right in the IDE?

That would be great!

I know I would use that. To demonstrate, I’ve attached how I envision this feature looking in Xcode (Click on the image to enlarge it)

Leave your comments below if you think this is a good idea too and would like to see it in action.

Audio comments in Xcode

This is a new feature which I hope all IDE makers, like Apple, will start incorporating into their product. I really think this will be the next evolution on code commenting.

Update 1: 11th July 2013:

So after I submitted this feature request to Apple, this is the email I get back from their team:

Hi Vandad,
This is a follow-up regarding Bug ID# 14370555.   
Engineering has determined that this is not to be fixed based on the following information:
OSX has voice over etc. You can also add file links to an audio file in a comment for example. 
Thank you very much for the suggestion.
If you have questions regarding the resolution of this issue, please update your bug report with them.
We are now closing this bug report.
Please be sure to regularly check new Apple products for any updates that might affect this issue.
Thank you for your assistance in helping us discover and isolate bugs within our products. 
Best Regards,
Developer Bug Reporting Team 
Apple Worldwide Developer Relations
Seriously, Apple? VoiceOver? I don’t even think their engineers understood the suggestion 😀


Jenkins doesn’t load under OS X Mountain Lion (or Server)? Here is the fix!

Answer: your machine doesn’t have Java installed on it. This happened to me. Jenkins installed fine, but then when I opened it on its default port of 8080, nothing happened.

To fix it, open Terminal and type “java” without the quotation marks.

This will tell you that you have to have Java SE installed on your computer and then will download and install Java SE automatically for you. Done! 🙂

Network-Connect 2 Macs

I was looking for a way to connect my two Mac Minis and transfer files between them, see the other Mac’s desktop and etc.

People were suggesting, FireWire, Thunderbolt cables, etc. Save your money. None of that really works.

The solution? Good old Gigabit Ethernet (CAT5E) cable and connect the two Macs together. Even if you have the latest MacBook Pro or MacBook Air that don’t have Gigabit Ethernet ports, there are Ethernet to USB cables that you can get from Apple which will do the job for you. So you still use the ethernet cable but at both ends or 1 end use the Ethernet to USB cable. Easy peasy.

In case you don’t know what an Ethernet cable looks like, it’s like this: