Funniest Thing on the Twitter All Day
A conversation between @cwgabriel from Penny Arcade and @pvponline from PVP.
Brought a tear to my eye after @wilw got involved.

A conversation between @cwgabriel from Penny Arcade and @pvponline from PVP.
Brought a tear to my eye after @wilw got involved.

The Boy Scout Trail has posted the requirements for the twelve new Cub Scout Belt Loops and Sports/Academic Pins on their website.
The new Sports loops and pins are:
The new Academic loops and pins are:
Now, let me get this straight…..We are going to pass a health care plan written by a committee whose chairman says he doesn’t understand it, passed by a Congress that hasn’t read it but exempts themselves from it, to be signed by a president that also hasn’t read it and who smokes, with funding administered by a treasury chief who didn’t pay his taxes…all to be overseen by a surgeon general who is obese, and financed by a country that’s nearly broke. What could possibly go wrong?
~Anonymous
From today’s "The Gartman Letter"
Type: Chardonnay
Year: 2007
Location: Napa County, California
Link: silveradovineyards.com
Rating: 8 out of 10
Opinion: Very good chardonnay comprised of fruit from vineyards in the Napa Valley into Carneros. Minimal oak flavor as to not overpower the fruit. Hints of golden apple and pear aroma with green apple, lemon zest, and honeysuckle flavors provide a refreshing finish.
After feedback from some friends of mine, and doing a little bit of background research, I am writing this update to my original post last week. As it turns out, by checking all the numbers in the form 6k ± 1
instead of checking each number up to the input value, I have increased the speed by 7 times! determineIsPrime3 (line 48 below) is the fastest algorithm so far. determineIsPrime2, a simple comparision against the
, was twice as fast as the original algorithm.
For now, I am putting this one to bed. It was a fun exercise, but I have got what I need from it.
'''
Checks the specified value to determine if it is a prime number.
If it is not prime the divisor will be returned instead.
@author: Eric Silva
'''
import math, time
#Change this value to whatever value you want to test for prime.
#testValue = 65027
#testValue = 155188329701
testValue = 99194853094755497
#testValue = 10888869450418352160768000001
print 'Testing %d...' % testValue
def determineIsPrime(testPrime):
if testPrime % 2 == 0:
return 'Divisible by 2'
if testPrime % 3 == 0:
return 'Divisible by 3'
testNum = 7
testLimit = testPrime
while testLimit >= testNum:
if testPrime % testNum == 0:
return 'Divisible by %d' % testNum
testLimit = testPrime/testNum
testNum = testNum + 2
return '%d is prime!' % testPrime
def determineIsPrime2(testPrime):
if testPrime % 2 == 0:
return 'Divisible by 2'
if testPrime % 3 == 0:
return 'Divisible by 3'
testNum = 5
sqrt = math.sqrt(testPrime)
while testNum <= sqrt:
if testPrime % testNum == 0:
return 'Divisible by %d' % testNum
testNum = testNum + 2
return '%d is prime!' % testPrime
def determineIsPrime3(testPrime):
if testPrime % 2 == 0:
return 'Divisible by 2'
if testPrime % 3 == 0:
return 'Divisible by 3'
testNum = 7
sqrt = math.sqrt(testPrime)
while ((6 * testNum) + 1 <= sqrt) or ((6 * testNum) - 1 <= sqrt):
if testPrime % testNum == 0:
return 'Divisible by %d' % testNum
testNum = testNum + 2
return '%d is prime!' % testPrime
startTime = time.time()
result = determineIsPrime(testValue)
endTime = time.time()
print result
print '1. Calculation took %f s\n' % (endTime - startTime)
startTime = time.time()
result = determineIsPrime2(testValue)
endTime = time.time()
print result
print '2. Calculation took %f s\n' % (endTime - startTime)
startTime = time.time()
result = determineIsPrime3(testValue)
endTime = time.time()
print result
print '3. Calculation took %f s\n' % (endTime - startTime)
Results:
Testing 99194853094755497... 99194853094755497 is prime! 1. Calculation took 202.609000 s 99194853094755497 is prime! 2. Calculation took 114.813000 s 99194853094755497 is prime! 3. Calculation took 28.781000 s
While working on some caching settings, I had a need to know if a number is prime. I wrote this little Python script which will tell you if the number defined in the script is indeed a prime.
'''
Checks the specified value to determine if it is a prime number.
If it is not prime the divisor will be returned instead.
@author: Eric Silva
'''
#Change this value to whatever value you want to test for prime.
testValue = 3011
def determineIsPrime(testPrime):
if testPrime % 2 == 0:
return 'Divisible by 2'
testNum = 3
testLimit = testPrime
while testLimit >= testNum:
if testPrime % testNum == 0:
return 'Divisible by %d' % testNum
testLimit = testPrime/testNum
testNum = testNum + 2
return '%d is prime!' % testPrime
result = determineIsPrime(testValue)
print result
Smart Bear Software recently released a white paper discussing the misconception that peer code review is a hindrance to Agile development methodologies. For anyone who regularly performs peer code reviews, would like to start performing them, or thinks they are an obstacle when it comes to Agile development should read this paper.
The paper talks about the history of code review, how code review aligns with Agile, types of lightweight code review, and techniques to perform optimized code reviews. Some of the key statements that I took away from the paper are this:
I just saw on my RSS that GWT 2.0 has been released. Gonna go play now. Bye.
For anyone looking to upgrade their VS 2005 Web Application project to VS 2008, I found good walkthrough provided by Microsoft here.
I have started working on a new project in .NET and the Problem Domain (PD) was modeled in Visio UML. Fantastic. Now I wanted to forward engineer the UML into C# classes to begin development, but wait, I can’t. I only have Visio 2007 Professional, and the forward engineering features are only available in the Visio for Enterprise Architects version. Okay, not a problem, I’ll go download it from MSDN.
After starting the installation, I got an error message, “You must first install one of the qualified Visual Studio editions”. What the hell? Visual Studio 2008 isn’t good enough? I sure as hell don’t want to install another, older version Visual Studio just so I can install Visio for EA.
After poking around, I came across this registry trick. Visio for Enterprise Architects is looking for the existence of the following key:
HKLM\Software\Microsoft\VisualStudio\8.0\Setup\VS\VSTD\
Within this key should be the String value “ProductDir”. The text value for ProductDir can be anything other than a null value.
Once you add this key to your registry, the Visio for Enterprise Architects installer will work as hoped.