Darrell Hawley: Home Page

Monday, May 26, 2008

Syncing with Google

After my last post, a couple of people recommended GMobileSync, a tool for synchronizing your Windows Mobile 5/6 device with Google Calendar. Unfortunately for me, since GMobileSync does not address contacts I had to keep looking. After a bit of research, I finally landed on GooSync. Not only does it sync my Calendar directly to my phone, but also my Contacts, one of my stickiest requirements. It's not a free service, and maybe even a little steep with a £20 ($40) annual cost. But when all I have to do is click three times (opening the application is two of those clicks) and my Contacts and my Calendar sync, I'm happy. I do have the option of an AutoSync, but I don't have a data plan and don't want any surprises on the company phone bill, so I'll do it via Wi-Fi. It wasn't completely pain free. My initial import would not import any contacts from Outlook that had the same email address in Google. To get around this, I had to delete all of my contacts out of Google before retrying the import. Of course, by doing this, all the contacts were deleted from my phone during my first GooSync operation, proving that GooSync works (and possibly that I don't understand synchronization). The problem was quickly resolved after re-importing into Google and a GooSync sync operation. Whew! Thus far, I'm really happy with GooSync though it hasn't been part of my work life quite yet. That test starts tomorrow. My bigger question is, "will I be OK without email if I don't have internet access?"

Friday, May 23, 2008

Gmail - My New Email Client

After years as an Outlook user, I've finally decided that Gmail is the email solution for me. Why? The biggest reason is because I'm tired of running a very resource-intensive application to perform a relatively simple task. Viewing and responding to email is a basic need, not too different than water. For those of you that have city water, you don't think about where your water supply is, it simply comes into your home. Of course, to have this luxury you get no control over the water treatment process. I'm good with this. I have too much to think about in my daily life to be concerned about water. Email is the same. If someone has an application that will allow me to not think about my email delivery system, then I need really need to consider it.

But Gmail's web-based interface is not the only or even best reason for my switch. Google's system of organizing your email is a big improvement. Instead of putting your email into one folder or another, you can apply multiple Labels to any single email. Viewing emails with a specific label requires only a single click. Receiving email is no longer an "event" affecting computer performance. Instead, email just magically appears in your inbox. And, of course, searching your email is a snap.

It's not all roses, however. How do I sync my calendar and my contacts to my phone without Outlook? From what I've found, you really can't. And regardless of the buzz surrounding Web 2.0, RIA, etc., actually writing an email in Outlook is a more pleasant experience than in Gmail.

Of course, I'm still in the honeymoon phase of this switch. Some minor issue that I thought I could live with (syncing comes to mind), may be the pain-point that drives me back to Outlook. Hopefully, that's a blog post I'm not going to write.

Friday, May 16, 2008

IronPython in Toledo

I stopped down in Toledo on Tuesday to talk to the Northwest Ohio .NET Usergroup about IronPython. The talk went well, though the demo gods frowned upon me during my presentation. It all boiled down to adding my Python installtion to my IronPython path.

  

import sys
sys.path.append("c:\python25\lib")
import random



I kept getting a TypeError exception which I had not seen while building my demos. As it turns out, the reason I had not seen them was because I had been running them via Visual Studio using Ctrl+F5 (Start without Debugging) effectively masking the exception. During the demo, I was simply hitting F5 which of course displayed my dirty laundry for all to see. This doesn't solve the problem but certainly explains the behavior change. Though I'm not absolutely sure what the root cause is, I'm almost certain the problem is that I was trying to get code written for CPython to run inside IronPython. This definitely merits a bit more research.

Friday, May 02, 2008

Project Euler Problem Number 3

Project Euler problem 3 reads as follows:

The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ?

There are no special Python features here that really require explaining. The logic is also straightforward: find the smallest prime that divides evenly into "number"; reset "number" to number/prime; if prime is greater than the square root of number, you have your answer. Solution works in both Python and IronPython.

def GetNextPrime(allPrimes):
"""Given a sequential list of prime numbers, return
the next prime number
"""
value = allPrimes[-1]
if value == 2:
return 3

while True:
value += 2
for prime in allPrimes:
if value % prime == 0:
break;
else:
return value

def Euler003(number = 600851475143):
# import the square root function, seed the primes list
# and determine what
# the largest possible factor
from math import sqrt
primes = [2,3]
limit = sqrt(number)

# if the last prime number exceeds our limit, we're out
while primes[-1] <= limit:
for prime in primes:
if number == prime:
# if the prime and the number are the same,
# we've found our answer. break out of
# the loop
return number
elif number % prime == 0:
# number isn't prime! largest prime factor
# will be in number/prime.
number /= prime
limit = sqrt(number)
break
else:
# still didn't find number % prime == 0? Maybe
# we need bigger prime numbers
while primes[-1] <= limit:
# get next prime number
primes.append(GetNextPrime(primes))
# if number is divisible by next prime number
if number % primes[-1] == 0:
if number == primes[-1]:
break
number /= primes[-1]
limit = sqrt(number)
break
return number

print Euler003()

Labels: ,