Category Archives: Left Brain

Facebook is your friend. And so can you!

This is a blog post that I started in around 2008. I’m going to post it, and then hopefully follow up with my more current thoughts on Social networking.

Social Networking. That’s one of those buzzwords that I almost cringe when I hear.

There is a gap in Social Networking, and it’s right in the middle. When you fall through it, you start to think of Facebook as an end point instead of a starting point. You think Twitter is actually a place to hang out with your friends. You think that Myspace… well, unless you think that Myspace is garbage, you’re probably not thinking, and we’ll leave that one alone.

The gap in Social Networking is where all the people who don’t get it are hanging out. They’re the people who keep sending you Farmville invitations and wonder why you’re not jumping all over their need for irrigation. For them, the games are a way of hanging out with their friends online. A need to connect like this will prompt people to set their status to something like “nothing to report” which makes everyone else wonder why you’d actually make a status update like that. Why continue updating, when you’ve admitted that there’s nothing left to say?

I’m not going to wax poetic on the transcendental need to shout out that we exist, or by the ennui of hanging out in a virtual world. But what is Social Networking actually for? It’s actually pretty simple: Social Networking, in most cases, is just a synonym for Marketing. For most intents and purposes, Social Networking is just a tool to shout out I Exist! But it’s no substitute for getting outside and actually talking to your friends (he says in his blog post).

I’m not saying that social sites are bad. I’ll admit that I’m not a big fan of TheMyFace, but I use Twitter pretty extensively. So I’m a fan of social networking, but I also hate social networking.

And that’s about when I lost steam with my rant on Social Networking. You can still find me on TheMyFace if you look hard, but it’s better to find me on the TweetMaker: @andrewphoenix

Guelph Coffee and Code + Project Euler

I’m talking about Project Euler at tonight’s Guelph Coffee and Code. My talk is going to be short, but here’s the main talking points.

Lenhard Euler: Mathematician

Euler (pronounced “Canada’s Worst Hockey Team that’s not The Senators”) was a Mathematician in the 1700s. He was a genius, and he helped shape the world of mathematics that we know and love today. Check out Euler on Wikipedia for more in depth info about the fellow.

What’s this all about?

Project Euler is gets you to combine mathematical insights with computer programming in an effort to find answers to a series of over 300 problems. It’s not tied to a particular language, though there are some languages that will serve you better than others. It’s all about finding the answer in an elegant fashion.

Why should I care?

Project Euler will help you to identify areas of interest for you, and to make you a better all around programmer (and mathematician). There’s a ton of different subjects that are covered, and it’s an opportunity to push your self in new directions.

Let’s do an example!

Sure thing! Look at Question #1.

Add all the natural numbers below one thousand that are multiples of 3 or 5.

Not hard right? Make a loop that goes from 1 to 1000, and for each number check if it’s divisible by 3 or divisible by 5. If it is, add it to a running sum. Pseudocode looks something like this:

x=1
sum=0
while x is under 1001
    if x is a multiple of 3 then sum = sum + x
    if x is a multiple of 5 then sum = sum + x

And at the end return sum. Does that give the right answer? Are we forgetting something?

Of course, if x is a multiple of both 3 and 5, then we’ve counted it twice. We can fix that in a few ways, like subtracting off x one time if it’s a multiple of 3 and 5.

if x is a multiple of 3 and 5
then sum = sum - x

Or we could just solve it with an else

if x is a multiple of 3 then sum = sum + xM
else if x is a multiple of 3 then sum = sum + x

Now a lot of people will understand that the “trick” is not really tricky in this case. Remember not to count multiples of 3 and 5 twice is pretty simple. But the curve is pretty steep – after 20 or 30 questions, it’s much more hidden.

And that’s the gist of what I’m saying tonight.

By the way, here’s that pseudocode in python:

f=0
x=1
while x < 1000:
    if x%3==0:
        f=f+x
    elif x%5==0:
        f=f+x
    x=x+1
print f

Deregistering Parent Theme Widgets in WordPress

I had a “fun” time figuring out how to deregister parent theme widgets in WordPress the other day so I went through the codex and learned a lot about how functions are called in function.php. I learned about something I didn’t know – you can specify the order of priority that something has within a hook!

This made deregistering widget areas pretty easy. In twentyten (something I child theme from a fair bit), the widgets are added on line 373 with code that looks like this:

function twentyten_widgets_init() {   
  // Area 1, located at the top of the sidebar.                                                                    
    register_sidebar( array(                                                                                         
    'name' => __( 'Primary Widget Area', 'twentyten' ),                                                          
    'id' => 'primary-widget-area',
   // and so on
 

So, you write an unregister function in your child theme’s functions.php that looks something like this:

function my_unregister_sidebars() {                                                                                  
    unregister_sidebar('primary-widget-area');                                                                       
    unregister_sidebar('secondary-widget-area');                                                                     
    unregister_sidebar('first-footer-widget-area');                                                                  
    unregister_sidebar('second-footer-widget-area');                                                                 
    unregister_sidebar('third-footer-widget-area');                                                                  
    unregister_sidebar('fourth-footer-widget-area');                                                                 
} 

Then you just call that in the widgets init hook, but give it a later priority:

  add_action( 'widgets_init', 'my_unregister_sidebars', 11);                                                           
  add_action( 'widgets_init', 'my_widgets_init',12);

Google wasn’t super helpful for me until after I had figured out the solution to the problem. So, if you need to unregister widgets in a child theme, this is how to do it.

(Feel free to tell me if I have typoed anywhere.)

A Month of Android

A while ago I purchased a samsung galaxy vibrant (the first day they were available here in canada actually) and I thought o would give a but of a review of my thoughts on the phone and the OS after having used it for almost a month.

The phone is beautiful. The screen makes iPhone 3 screens look pretty bad and in my opinion, it beats the iPhone 4 in a side by side comparison. The Samsung is slick and gorgeous, responsive and vibrant; from a purely aesthetic standpoint, the phone is downright sexy. The call quality matches that of my previous phone (which was a real phone, not a handheld with a phone added on like many smart phones seem to be). I do not experience reception loss from holding the phone in a particular way. Using this device as a phone is easy and pleasurable.

The place where the device really starts to shine is when you start to dive into Android. There are a ton of apps and many of them are free, or under $1. Some of them suck; I have deleted 15 or 20 apps that I just didn’t enjoy using, but there’s no real downside to downloading paid apps because you can get a refund. Android market is pretty awesome. There are a ton of apps, some more useful than others; the barcode scanner is pretty cool and a Blizzard authenticator for WoW, I use just about every day. The google maps app works really well as a GPS which is beneficial since someone broke into my wife’s car and style ours. There’s a good selection of decent educational games for kids and, of course, a pretty decent app for wordpress which I am using right now.

I’m a big fan of how intuitive things are. The other day for example, my four year old daughter managed to record new ringtones and set them for events on the phone (“ooo your phones ringing. Blah blah” is now what I hear when someone calls me). The fact my kid can do that without any help from me is pretty impressive. It is true that she is a little geek in training, but it is still great to see how easy it is for her to manage fairly complex tasks.

Swype is impressive. This lets you glide your hand over the on screen keyboard and “draw” the words that you are writing. It does make for some interesting automatic corrections [Edit: Like version one of this article, for example], but significantly increases my (mostly) understandable wpm count. Look for a video of it on youtube and have a look, if you are unfamiliar with it; swype is certainly worth checking out.

Overall I would give this new phone high marks across the board. I have never seen a phone that I like as much. The iPhone 4 comes close, especially the overall aesthetic, but the responsiveness of this little machine and the slightly larger screen along with Android help it win out as far as I am concerned.

[Edit: I've got Hello World done in an Android App, and it took almost no time to do so. App Development is easy and fun.]

Exponential Growth

According to the CBC G8/G20 costs have grown exponentially. I can only infer that if the first 3 days cost $1,000,000,000, then the next 3 days will cost $1,000,000,000,000,000,000 (the cost squared, typically the smallest of what is considered exponential growth). That’s unfortunate, because I think that’s more money than the entire world has, so we’re probably all going to starve to death now.