Swift Program is Swift, Except When it’s Not

swift

This past WWDC Apple revealed a brand new programming language called Swift to the masses and passed it out to Apple Developers packaged in the XCode 6 Beta.

Language Features

  • Type Inferencing and Automatic Reference Counting (ARC)
  • Optional Bindings and Generic Functions
  • Integration with Objective-C
  • First-Class Functions and Closures

My initial impressions were pretty high. However, after some quick benchmarking examples, those feelings later matured to an understanding of it’s "beta" characteristics. Many of the underlying optimization still have some kinks to work through.

And by kinks, I mean some big fixes

Benchmarks

Here are a couple examples of ...
Read More....

Pelican: A Blogging Engine Written in Python

There are many static site generators out there.

The most famous and well known being, Jekyll and Octopress.

Jekyll is used by Github Pages as the default generator, while Octopress is a framework for Jekyll geared specifically for blogging. However, the reason why I decided to use Pelican over both, is because Pelican is written in Python, and therefore support the reStructuredText markup by default and is a language I feel comfortable in case I need to get down and fix the engine. One of my primary forcuses of blogging is so that I can also use it as a ...

Read More....

Swift: Bubble Sort

// Sang Han
// An implementation of a bubble party/bubble sort written in swift

import Foundation

func exchange<T>(inout a: T, inout b: T)
{
    let tmp = a
    a = b
    b = tmp
}

func bubbleSort(inout array: [Int]) -> [Int]
{
    let length = array.count

    var count, pos: Int
    for (count=0; count<length-1; count++)
    {
        for (pos=0; pos<(length-count-1); pos++)
        {
            if (array[pos] > array[pos+1]) {
                exchange(&array[pos], &array[pos+1])
            }
        }
    }
    return array
}

func sortMain(arrayLength: Int) -> [Int]
{
    var array: [Int] = []
    for _ in 0..<arrayLength {
        array.append(
            Int(arc4random_uniform(UInt32(arrayLength*100)))
        )
    }
    return bubbleSort(&array)
}
Read More....

Digital Universe

"In the digital universe, there are two kinds of bits: bits that represent structures (differences in space) and bits that represent sequence (differences in time). Digital computers - as formalized by Alan Turing, and developed by John von Neumann - are devices that translate between these two species of bits according to definite rules."

—George Dyson: Turing’s Cathedral

About a year ago, I finished reading Turing’s Cathedral.

Turing's Cathedral

At that time, my interests were focused towards engineering, and I never really crossed paths with programming or computer science. Even in my academic life as an undergraduate studying chemistry, the world bound ...

Read More....

A New Beginning

Anything you see below this is old news

photoshoot

Around the end of 2011, I stopped blogging. I had created a photography website using wordpress and was trying to make a living as any recent graduate would. I chose photography because I was good at it, and I had experience shooting with some professional photographers in the san diego area.

However, I didn’t go to school in photography, I had studied chemistry.

But upon realizing the difficulties associated with work in science with only an undergrad education, I chose photography. I was ultimately to study medicine, and it was my ...

Read More....

Amber

Date Category tumblr

Before photography, I was a chemist. I worked at GNF No Before photography, I was a chemist. I worked at GNF Novartis doing medicinal chemistry. Those days were full of many great memories and I enjoyed my time there doing chemistry. These days I am still in good contact with the people I met, and worked with. Soon after I had left, word had spread to Yefen, and she had become interested in getting a family portrait with her very young 1 year old daughter Amber. Of course, I was happy to oblige and Yifen and I started to contact ...

Read More....