|
Saturday, 04 April 2009 20:53 |
|
This is my first real attempt at a semi-useful program in Erlang. It is the Sieve of Eratosthenes, which is a prime number generator. The main function is primes() which accepts the number that you would like to count up to. Luckly, Erlang is a Functional language, so I was able to do some fun things. I had to modify the algorithm, as the original algorithm uses arrays, and arrays aren't really used in Erlang. I suppose this is probably due to the functional roots that Erlang has. Scheme in practice tends to stay away from vectors and uses lists more. I decided to use lists in Erlang, and was able to do some nice recursion, as is normal with Scheme. -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 at each recursion. primes(N) -> primes(N, lists:seq(2,N)). primes(N, [H|T]) -> StopNumber = math:sqrt(N), if H < StopNumber [H|primes(N,remove_multiples(H, T))]; %% Does this blow your mind? true -> [H|T] end.
I'm not experienced with Erlang yet, so my apologies if I have bad Erlang style. I wanted to put N < math:sqrt(N) in the guard for the function, but apparantly, you can't put function results in guards, so I had to store it in the StopNumber variable, and use an if statement. |
|
Tuesday, 31 March 2009 14:55 |
|
The sunrise sunset app has just hit the app store. Please check it out and tell everyone you can about it! The app website is: http://iphone.kekoav.com/sunrise Enjoy! |
|
Sunday, 22 March 2009 11:51 |
|
My first iPhone app is submitted and in review by Apple, it should be approved soon, so make sure you go and download it in the App Store! Here are some screenshots to give you an idea of what it is: This app may not look like it does much, but it really takes care of a lot of the painful details. For example, timezone and daylight savings time offsets. This is a detail that you don't have to worry about, just pick a location, and we use the timezone of that location, and also automatically calculate if daylight savings applies to the given date, and of course perform the detailed calculation of the sunrise, and sunset, along with the others. You can also use the current GPS location of the device, this will cause the calculations to use the current coordinates along with the current timezone specified in the device. The location tab gives you over 10,000 world locations to choose from, so you can find the sunrise and sunset times for basically anywhere you'd ever want to go(or dream of going). Uses for Sunrise and Sunset timesYou can really do a lot of fun things if you know when the sun is going to rise and set: - Plan a romantic date, even if it is last minute, you can know what time the sunset is going to happen
- Know when to wake up for an early morning sunrise hike(this is how we took the picture that is on the background of the app)
- Important for photographers(like my wife) who want to take advantage of the prettiest lighting of the day. If you need to plan your photo shoot weeks in advance you can quickly use this app to know what time to plan for.
- Know when not to drive to keep the sun out of your eyes.
- If you are planning to go camping, know when you need to get your tent setup before it's too dark. At the end of civil twilight, it's no fun setting up a tent in the dark.
- If you are a student and live in the basement of the library, or computer lab, you can know what is happening outside, without ever needing to go outside!
- I'm sure there are a lot more!
Anyhow, I will announce when the app is released. The first update to the app will fix a lot of things in the first version that we changed last minute. Update 3/31/2009 The app is in the app store! Please download it and use it, it's FREE! Website Link: http://iphone.kekoav.com/sunrise |
|
Saturday, 14 March 2009 18:18 |
|
I just had to post this it is so funny! Sorry, no political commentary though.
I think this is from http://bushama.com |
|
Wednesday, 11 March 2009 22:52 |
|
Just got an email from the Google Checkout folks saying that they are reining in the parade, and raising prices. Just when you thought Google Checkout was a better alternative to PayPal-- think again. Their new prices are as follows, according to their updated fees: | Monthly Sales Through Google Checkout | Fees Per Transaction | | Less than $3,000 | 2.9% + $0.30 | | $3,000 - $9,999.99 | 2.5% + $0.30 | | $10,000 - $99,999.99 | 2.2% + $0.30 | | $100,000 or more | 1.9% + $0.30 |
Hmmm, let's look at PayPal's fees: | $0.00 USD - $3,000.00 USD | 2.9% + $0.30 USD | | $3,000.01 USD - $10,000.00 USD | 2.5% + $0.30 USD | | $10,000.01 USD - $100,000.00 USD | 2.2% + $0.30 USD | | > $100,000.00 USD | 1.9% + $0.30 USD |
Well I'm glad the guys at Google Checkout didn't have to research their price points too hard. Now let me see where does Google Checkout have the competitive edge? Hmm. Nowhere, oh yeah that's right. So they're trying to sell me that Google Checkout is better than Paypal, when Paypal is years ahead in that business sector. Are you kidding me? I love Google, and was even warming up to Google Checkout, but this change from 2.0% + $.20 all the way to 2.9% + $.30 is ridiculous. I think the Google Checkout team is severely premature in this price hike, it must be a sign that this hasn't been very profitable for them. I used to be worried that I could get lower fees with Google Checkout, and thought I needed to switch all my payments to use Google Checkout, but now, I am content that I have the lower fees, and maximum protection through Paypal. I think Google is really expecting people to trust them here. Paypal has had to earn trust the hard way, making plenty of mistakes, and even locking my own account once or twice. I haven't had any problems as of late with them. Just because they're Google doesn't mean that they're the best at everything, I am content to keep doing business with PayPal until there's a compelling reason to switch. As of yet, Google Checkout has provided no compelling reason. |
|
<< Start < Prev 1 2 3 4 5 6 7 Next > End >>
Page 2 of 7
|