Project Euler

If you’re into puzzles and enjoy some light coding, you should check out Project Euler. It’s a site devoted to problems (mostly mathematical) which require a computer to be solved.

Problem 35

The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime.

There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97.

How many circular primes are there below one million?

Sure, you could solve that kind of problem on paper, but it would take you a lifetime. On the other hand, it is pretty simple if you attack it with a computer.

  1. Find all the prime numbers under a million.
  2. Split each number into a string and recombine it using all possible rotations.
  3. Test each rotation, if all are prime, add 1 to the tally.

When you have the answer, you can go back to ProjectEuler.net and punch it in.  The site will keep track of which problems you’ve solved, and if you have lots of time on your hands, you might even make it on to a list of the top 1000 problem solvers.

If you like mulling over a problem in the back of your mind all day, Project Euler is worth a look.

Have fun, and let me know what you think!

favorite SF short story

Years ago I read this short SF story that has hung with me ever since… long after I forgot what book it was in or who wrote it. Today, thanks to several awkward google searches (aliens + probes + AI = the dark side of the internet) I found the story again! And the frosting on the cake is that the author has it freely readable on his website!!

The story is called Lungfish. It was written by David Brin, and falls into the category of hard SF. In other words, no faster than light travel, no super-mega-death-rays, no monsters. The story centers around this strange culture made up of million year old, self replicating probes.

The idea is simple, it takes hundreds of thousands of years to travel to even nearby stars. So why not let machines do it for you? If the destination proves interesting or habitable, the probe will build a society, replicate itself as necessary, and when ready will clone beings of your race from DNA data in its memory banks. It can then teach the clones about your culture, and bingo - autonomous space colonization.

Now imagine a universe where many alien societies (over the last 100 million years) have launched probes like this, but with differing intent… some for colonization, some for exploration, but some are simply xenophobic. They send out probes to self-replicate, and then detect and destroy other societies.

So some probes meet and form alliances. Some lay in wait to trap and destroy predatory probes… some will simply orbit a planet waiting for the life there to evolve so it can make contact!

The story is only about 20 pages when printed in trade paperback, so it’s a quick read, but the idea is truly amazing. Like I said, it’s one of my favorites—but don’t take my word for it…

LeVar Burton

sync folders across multiple machines

syncbig.gif

I work from all over, on many machines. In the past I’ve just had to be absurd about carrying my files with me and always killing the old versions that stack up on whatever machine I didn’t use that day… in other words, a huge pain.

You’d think there would be an easy way to just automatically have your computers make sure that the most recent version of all your necessary files are on every computer - and that the files you’ve deleted are removed from every computer.

Well, you’ve guessed it, there is!

Today I found FolderShare, a free little app by our friends over at Microsoft (hey - they can’t be all bad).  You install a tiny app on your computers, go to foldershare.com and create a free account, and then you can just log in through foldershare.com to tell your account (which then tells the apps on your computers) what folders you want synced!

It’s super easy, and once it’s set up FolderShare works in the background to sync your folders any time the content in one of them changes.

adding a Slideshow feature to a SimpleViewer gallery

SimpleViewer is a great, easy to impliment, polished little gallery written in flash that lets you tie your photos and thumbnails in with XML. It’s got a decent feature set as far as changing the aesthetic of the viewer, but no option for an automated slideshow.

One of my clients wanted this option, and it took me a while to figure it out - so for those of you who are wondering how to incorporate a slideshow into simpleviewer, here’s how!

My finished project can be seen at SixEightyThreePhoto.com

(note - if you’re going for the free version of SimpleViewer this won’t help you - you need access to the source code, so you will need SimpleViewer Pro for this)

Step one - simpleviewer.fla

  1. Open simpleviewer.fla
  2. Create a new layer in the timeline.
  3. Create a keyframe by selecting frame 30 on your new timeline and hitting F6.
  4. Create your start/stop button and put it here, on this keyframe, on this layer. I’m calling mine ssButton. (for those in the know, I’m not really using a “button” element… I find them awkward to work with… I’m using a MovieClip as a button… but really, either way should work)
  5. Now we’re going to need a bit of code. This is all pretty simple stuff. A setInterval to iterate the slideshow, and instead of having a boolean to look at to determine whether or not the slideshow is playing, I’m just looking at whether the “play” layer of the button is visible. Open up the actions panel (F9) and copy this…

var nInterval:Number;

ssButton.onRelease = function():Void {
    ssButton.mcPlay._visible = !ssButton.mcPlay._visible;

    clearInterval(nInterval);

    if(!ssButton.mcPlay._visible) {
        nInterval = setInterval(slideshow, 3000);
        sm.ssNext();
    }
}

function slideshow():Void {
    sm.ssNext();
}

Step two - StageManager.as
I wish I knew a better way to do this, but I guess it’s not too painful… What we’re going to do here is pass our function call right on to another class instance. So at the bottom of StageManager, right before the last close brace, add this function…

public function ssNext() {
    mImageArea.ssNext();
}

Step three - ImageArea.as
Here’s where we actually, finally, DO something. Place this function right before the last close brace at the end of the file…

public function ssNext():Void {
    var nStart:Number = mCurrentImageIndex;
    mThumbArea.selectedThumbIndex++;

    if(nStart == mCurrentImageIndex)
        mThumbArea.selectedThumbIndex = 0;
}

Ta-Da!! If you built your button right, you now have working slideshow button in SimpleViewer! You’ll have to publish the simpleviewer.fla file again to get the updated version of your viewer.swf, and then you’ll probably have to tinker a bit to get the button in the right place - but that’s kid stuff.

screencast tutorials at wikivid.com

WikiVid.com Logo

Well, that didn’t take long! In my last post I talked about how I didn’t know of any free websites that had good collections of screencast tutorial videos. I just stumbled upon….

wikivid.com - A screencast aggregator

There’s nothing very wiki about it, as the videos are all static content collected from sites all over - but it’s still a great resource. Visit the link, and you will see a list of tutorial categories. When you select a category (for instance, Linux or Flash) you will see tutorial videos within that category organized under subheadings (like Intro or Actionscript).

A nice feature wikivid is that it doesn’t send you off to all those frightening, distant websites to view the screencasts. You get to watch everything without ever leaving wikivid. The interface is simple and quick, and even allows you to give quick feedback on the videos you view.

So - it’s all pretty simple, but that’s what makes it so easy to use. I look forward to seeing where the go from here!

screencasting with CamStudio

I’m really excited about CamStudio. The video will introduce you to a few of the basic features. If there’s interest, I may even look into putting together a tutorial that goes through all the settings. My bigger concern for the moment, however, is that there are still a lot of issues that need to be ironed out. The most blatant of which are perhaps the ugly flash player interface (which you can see below in the video), and their sloppy website.

Don’t get me wrong though - the program is super useful even in its current form. I’m just holding out hope that it will get even better.

CamStudio is an open source project, so I’ve gotten in contact with them and offered to pitch in where I can. More on that as it develops.

Enjoy the video!

ready, set, LLC…?

I am desk job averse. It’s one of those things that everyone knows about me - fundamental to who I am.  It’s not the work itself.  Honestly, the odd jobs I do avoiding a 9-5 are probably less fulfilling that the work I could otherwise get.  But what is the average career - 40 years?  I’m not satisfied doing what I want to on evenings, weekends, and vacations.  I want my career to be an expression of my aspirations.  For me, the way to do this is to be an entrepreneur.

So now I’m walking down a road many freelance web developers will find familiar.  I’ve done a few jobs for peanuts, have a portfolio I am beginning to like, and have finally filed the paperwork for an LLC.  It is a joint venture with Michael, and in addition to being an organized venue for us to do web work through, we have a few projects lined up for this summer!  More on those as they progress.

Hello World!!

I’ve been putting off starting a blog for about a week now, wanting my first post to be something monumental.  Enough of that.

Procrastination is evil - value momentum over perfection.

Hello world!!