From the Course Programming Methodology CS 106A Offered at Stanford University Having spent more hours than I am willing to admit, finally solved Karel the Robot Problem 3 (from Assignment 1). Please don’t look at the solution until you have solved it yourself. Otherwise you will be depriving yourself of … Continue Reading Solution to Karel the Robot Assignment 1: Problem 3
Platform: iOS 8.x or later Device: iPhone Language: Swift Motivation: when user unplugs their headphones, you wan’t to stop playing audio (iTunes like behavior) in your app The following code snippet shows how to detect if headphones are plugged in (when the app starts or is woken up). The println() … Continue Reading Detecting if Headphones are Plugged-in to an iOS Device in Swift
The problem: From page 37, Exercise 4, Chapter 2, Programming Erlang by Joe Armstrong Run the file client and server code. Add a command called put_file. What messages do you need to add? Find out how to consult manual pages. Consult the manual pages for the file module. Additional Specifications … Continue Reading Solution to Exercise 4, Chapter 2: Programming Erlang by Joe Armstrong
Apple’s latest language Swift provides some nifty behaviors and characteristics. Three things we are loving about Swift so far are: Awesome OOP features: Structs, Enums, Classes can all have methods, optional binding, type safety Cool Functional language features: Closures (the shorthand syntax is a delight to use), nested functions and types … Continue Reading Fun with Apple’s Swift: Using the @prefix operator to mimic Lisp’s + function
Assignment 3 (Set Card Matching Game with History) from “Developing iOS7 Apps for iPhone and iPad (Fall 2013) by Stanford University” took a bit longer than usual to complete. The major highlights of the assignment are: Set card matching in addition to the playing card game implemented in the last … Continue Reading Solution to Assignment 3: Set Card Matching Game with History
One should rewrite code for improved performance, structure and design. But how many times? In the beginning my thought was to possibly rewrite code twice. Later I found rewriting my own code three or four times made it better. This lead to very stable code and useful particularly as a … Continue Reading How Many Times Should One Rewrite Code?