Measurement Lab is “an open platform that researchers can use to deploy Internet measurement tools.” One of their first measurement tools is to “measure the speed of [your] connection, run diagnostics, and attempt to discern if [your] ISP is blocking or throttling particular applications.” It appears that the Measurement Lab website and several of the servers running these tools are getting bombarded with traffic, but I thought it was quite funny given Comcast’s net neutrality history when I first got the error…
I first checked out Project Euler a couple years ago when one of my friends mentioned it to me. If you haven’t heard of it before it is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve.
I took a couple classes in college for basic C++ programming, but we never got too deep. It was mostly principles of programming, etc. and, since it was a class aimed at Electrical Engineers first programming class and not Computer Science majors, we spent a bit of time on structures of programs and other general concepts that are core to most programming languages. I was (and still am) interested in strengthening my C++ knowledge, so I decided to try the Project Euler problems in C++.
So far I haven’t completed many (13 out of 228), but haven’t spent too much time on it, even though I started a couple years ago… The questions range in difficulty from Problem #1 Find the sum of all the multiples of 3 or 5 below 1000. to Problem #198 How many ambiguous numbers x = p/q, 0 x 1/100, are there whose denominator q does not exceed 108? The higher number problem # doesn’t necessarily mean it is more difficult, but difficulty is measured by how many people have solved the problem. You can see a trend of how people may start doing some of the problems, but quickly the numbers dwindle. For example, over 48,000 people have completed problem #1, but less than 20,000 people have completed more than 10 and less than 2,000 people have completed more than 25 problems. Once you’ve solved a problem, you can look at other ways people have solved it in other languages or even by hand. However, you can’t see any hints or other posts about a problem on the site until you’ve typed in the correct answer for that problem.
Today I spent a little bit of time optimizing some of the old algorithms I had used for previous problems. (Several algorithms can be re-used between problems and the less time it takes for them to run, the less time you have to wait to see if your answer is correct…) I started with optimizing my function to check if a number is a prime number.
There are basic things you can do to make figuring out if a number is prime or not. For example, it’s very easy and quick to find the remainder of a number when it is divided by 2 or 3. Since this is a lot of the cases for non-prime numbers, it’s best to check these cases first before checking if a number is divisible by any other number. A couple other quick (and perhaps obvious) things to do is to not check every single number from 1 … n where n is the number you are trying to check is prime or not… We know that anything even is divisble by 2 , so instead of checking if the number is divisible by 2, 4, 6, 8… start by checking if it’s divisible by 5 (since we’ve already checked 2 and 3) and check every odd number from there (5,7,9,11…). This cuts your computations in half. Also, we know that we only have to check up to the square root of the number (16/2 = 8, so there’s no point in checking if there is a remainder with 16/8). This cuts the computations in at least half again. After adding this optimizations, my code went from a minute or two to run down to a few seconds.
If you enjoy programming, math, or especially both, I would recommend checking out some of the problems on the site. It is a great way to keep your math skills from getting too rusty and a great way to learn how to do some math programming in a new language. If nothing else, you’ll get your mind thinking of different ways to solve problems.
It was a nice week away in Walt Disney World, but we’re getting back to the real world now. I’ve just finished uploading some pictures I took to Flickr if you want to see some of the sights.
This was a good trip for us. We celebrated both my and my dad’s birthday (consecutive days, not the same) and it’ll definitely be one of the most memorable. Our daughter was of course always excited and happy, which makes everything great on top of already being at Disney World. We went to Disney World in September with our daughter for our first family vacation since our marriage 4 years earlier. She was very excited then, so we couldn’t want to go back. We found out Disney had a great deal this year where if you booked 4 nights, you got 3 free, including room and park admissions. On top of that, they gave you a $200 gift card, plus since we already had park tickets, a $75 gift certificate on our birthdays. It was really a no-brainer to take advantage of the deal, so we did!
If you follow me on Twitter, you probably saw where our original flight down to Orlando got smoked out. You can follow the timeline through my twitters and apparently it was on the local nightly news too. If only the local news groups had followed me on Twitter, they would have known some more info about what was going on. Luckily, AirTran was able to cancel another flight and let us use that plane to get down to Orlando before too late at night. They even gave us meal vouchers and a $75 credit on our next flight. I’m glad we waited around the airport, though. We had the opportunity to trade in our tickets for a flight the next day and get a free flight somewhere else, but I think getting to Disney that night worked out best. (The flight back went without a hitch.)
I won’t bore you with the details of the trip, but it was fun. We rode everything suitable for our 2 year old at the parks, met with other family we hadn’t seen in a while, and had good meals with different Disney characters. (I would recommend that the character meals are worth the extra costs if you have children.)
Now that we’re back home, we can’t wait to get back to Disney again, but who knows how long that will be now. Our next trip to Disney will probably be with my wife’s family, but we’re not sure when yet. I don’t think we’ll be making it back before the end of March (when the $200 gift card deal expires), but maybe we’ll make it back by the end of the 3 free nights deal (end of June I think).
The first day back is always a bummer, but today was a pretty good transition. Work was pretty slow today, so I was able to catch back up on e-mails without any major issues to worry about resolving immediately. It helps that nothing really went wrong while I was gone, too. I was able to delete about 75% (~300) of my unread e-mails right from the start because they were just automated “FYI” e-mails. Sometimes, well often, I wonder the usefulness of those e-mails… They would be much better delivered in RSS or through a Jabber client or similar. I suppose that’ll be another post some day. Enough of my late night rambling… For now, it’s on to the rest of the week…
If you’re reading this, you probably already know that we’ll be in Disney world for the next week. So it goes without saying that I won’t be posting again till next week. Hope everybody has a good first full week of the year!
Well it’s 2009 and I’ve finally started blogging again… So, with it being the first day of the year, it only seems fit that I post about some of my goals for the year. (And gives me an excuse to cross one off already). Leave a few of your goals for 2009 in the comments.
Start blogging (again). I had a blog a few years ago that I posted on pretty frequently for a while. Then I got busy and I just dropped it and the domain name. I’ve wanted to start blogging again for a while, but just hadn’t taken the time to start the process of getting the domain names and hosting. I think blogging is important for anyone working in the computer industry because it helps you stay on top of things. So hopefully I’ll be posting some note-worthy things here in the coming year to help people besides myself.
Read more of the Bible. I’ve started reading a chapter from the Bible every night recently and it’s been going well so far. I just finished reading Ezekial, and if you’ve ever read it, you know it’s hard to comprehend so I’ve just started Psalms, which should be a little easier of a read. I want to read more of the Bible besides just one chapter a night, though. There are 1189 chapters in the Bible, so even if I read two chapters per day, it would still take over 1.5 years straight to read the entire thing. (I plan on reading the whole Bible, but that is a lifetime goal.) I read Proverbs recently and would recommend anyone, Christian or not, to read through it. A majority of it, as you can guess, are sayings that most people hear or say throughout their lifetime.
“Hatred stirs up dissension, but love covers over all wrongs.” Proverbs 10:12
Work out regularly. I’m sure this one is on most everyone’s New Year’s Resolutions. I started doing small work outs semi-frequently towards the end of last year. If you follow me on Twitter, you probably saw me tweet about hundred push ups. If you need a place to start, I would greatly recommend this program. You only do push ups three days a week (Monday, Wednesday, and Friday worked best for me) for six weeks. It felt great to do the exercises and the difference it was making. Of course since the program only goes for 6 weeks, you can guess what happened at the end… I’ve started doing pushups again the past few nights, but I would also like to do some other exercises to help the rest of my body, too.
Take more, and hopefully better, pictures. I’ve had a digital SLR camera for about 8 years now and it wasn’t till last year that I actually started working with the manual settings on the camera. Ever since starting that, I’ve had more inspiration to take more pictures. Since I don’t really do any post-corrections on my pictures, just adjusting the manual settings has made them look much better. I’d like to take many more pictures, and possibly even some that could be sold or used for someone besides myself.
Contribute to an open source project. I think contributing to something like an open source project is a great way to both become a better programmer and meet other people like yourself. I’m not sure which project I would try to help out, but I’m sure one will stick out at me sooner or later.
Finish (and start) some of the projects I haven’t made time to work on. I’ve sadly been neglecting a few projects that I’ve been meaning to work on for a while (one I started with someone almost 2 years ago). Hopefully we can get kicking on that one and a few others and get some products/services out there for people to use and enjoy.
Wake up at 5am, every day. Like a few of my other goals, I had been doing this for a bit last year, but stopped for one reason or another. I’ve changed my alarm so it is much more annoying and loud, which gives me extra incentive to turn it off so I don’t wake the rest of the family too much. This should give me some time to work on all of these things without having to forfeit anything on my final goal…
Continue to spend good quality time with my family. If none of these other goals get done because I don’t have time, that’s alright, as long as I get to be with my loved ones.