RSS Feed
Sunrise Sunset Satisfied User PDF Print E-mail
Tuesday, 11 August 2009 08:15

Garth Wunsch posted a nice review of my Sunrise Sunset Pro app.  Check it out: http://garthwunsch.com/sunrise-sunset-pro/

I'm excited that photographers are actually finding it useful, I have seen more comments and ideas from photographers than any other profession.   It is a great utility to plan in advance and know exactly what the sun is going to be doing on a particular day.

 
Sieve of Eratosthenes in Scala PDF Print E-mail
Friday, 19 June 2009 08:50

Lately, I have been interested in the Scala programming language.  It is actually quite nice, and seems to really work with me and not against me.  I really like the way the functional aspects are combined with imperative, as it makes it so much easier to think about things when my mind is not in a pure-functional mindset.

Here's one little snippet that I've been working on to learn some Scala, another sieve of eratosthenes.  It will work if pasted into the scala interpreter, and then just call the primes function.

def primes_aux(currentList:List[Int], stopNumber:Int) : List[Int] = {
if(currentList == Nil)
Nil
else {
val H = currentList.head
if (H <= stopNumber)
H :: primes_aux(currentList.tail.remove(num => (num % H) == 0), stopNumber)
else
currentList
}
}

def primes(maxNumber:Int) : List[Int] = {
primes_aux((2 to maxNumber).toList, Math.sqrt(maxNumber))
}

I tried really hard to shrink the code from the erlang version, and I was successful. It is much more succint.  I will probably find some better functions that can help me get rid of or at least simplify the logic.  I have a feeling this can be done in a few short lines of code.

 
Check Out My Amazon Wish List PDF Print E-mail
Tuesday, 09 June 2009 22:03

So, you may be wondering, "I would like to get something nice for Kekoa, but don't know what to get him!"  Well, today I have your answer!  I have created a list of books on Amazon that I would love to read, and would be so happy to receive as gifts.  You can view my list, and have the books shipped directly to me.

I added the widget in a convenient location on my site(look on the right) so that it will be easy for you to see what books are left on the list.

If you're in the mood to just do something nice and would love to help me out by getting me books that will increase my knowledge and skills, I would appreciate the support.  That is the best present I could ask for!

 
stringByAppendingString:@"Ha!" PDF Print E-mail
Wednesday, 22 April 2009 11:03

Playing with iPhone stuff and Objective-C has been very interesting to say the least.  I am to the point where I think I like it but don't really know why.

Here are some initial thoughts, after a couple months of use...

Developers have to be really good at knowingWhatMethodTheyAreWantingToCall, as the methods are ridiculously wordy.  I say this now, but it is slowly rubbing off on me.  I don't know who developed in objective-c prior to code completion, because it would be impossible without constantly searching the documentation.

There is good documentation though, once you figure out what it all means.

I like the message passing idea, it adds some dynamic flexibility to an otherwise inflexible language(C).  I do like the built in reference counting and memory management system(retain and release).  You have to do it yourself in C++ or find a set of classes that does it for you.

Interface Builder was a challenge to figure out.  The program itself was easy to use, but figuring out how all the connections are to be made, and how to connect and instantiate things was a little bit of a pain at first.  But now I'm pretty comfortable with creating my own .nibs and using them.

XCode is a beast.  It's not really my taste, but I'm learning to use it. Unfortunately, it is no Eclipse, more like Visual Studio.

It took a little while to get used to how things work, I've still got questions, but generally things are working smoothly now.

 

 
Sieve of Eratosthenes Redux PDF Print E-mail
Thursday, 09 April 2009 13:56

So I was a little disappointed by my last effort, it just wasn't elegant enough.  I'm probably going to venture to list comprehensions, but haven't gone there yet.  I have a cleaned up version of the last one, it is nicer, and makes more sense(and fixes a bug- 5 points for you if you can find it).

-module(sieve).
-export([primes/1]).

%% Removes the multiples of a number from a list
remove_multiples(_, []) -> [];
remove_multiples(N, [H|T]) when (H rem N == 0) ->
remove_multiples(N, T);
remove_multiples(N, [H|T]) ->
[H|remove_multiples(N, T)].

%% Generate primes by creating a list of numbers from 0 to N.
%% Then recurse through the list, eliminating multiples off the tail at each recursion.
primes(N) ->
primes(lists:seq(2,N), math:sqrt(N)).
primes([H|T], StopNumber) when H =
[H|primes(remove_multiples(H, T), StopNumber)]; %% Does this blow your mind?
primes(L,_)-> L.
 
<< Start < Prev 1 2 3 4 5 6 7 Next > End >>

Page 1 of 7

Book Wish List

StackOverflow