iZombie

So I finally bought an iPhone. It’s rockin. I’m going to be getting on a plane to Vegas for the weekend, and I have a 6-hour layover at Dallas-Fort Worth. Between books and phone video, I think I’ll be sufficiently entertained.

I really do like the phone. It’s so convenient. I’ll be walking along somewhere, and thinking of something I need to do (add it to calendar) or wondering about the answer to a question (mobile web browser). I’ll pull out the phone, and start typing, reading, whatever. Next thing you know, I’ll lose the group of people I was with, forget what I was originally doing, or start bumping into people. I’m becoming an iZombie.

Orlando Restaurants (Fratellos & El Cerro)

If you’re in the East Orlando area, and are looking for a good bite to eat, let me clue you in on some local deliciousness.

Fratellos

Fratellos is an Italian-American takeout/delivery store with some amazing pizza and subs. Everything they serve looks like real food, no mystery mush. They say their dough and sauce are made fresh every day, and I believe it. The dough alone has a good yeast taste, so it must be fresh. The oven-baked subs are also awesome.

El Cerro

Mexican-American. Nothing too authentic, but it’s a good choice for a group with picky eaters.

This is the hardest-working staff in the food service industry. The way I see it, if my cup (water, sweet tea, or other delicious thirst-quenching liquid) doesn’t sit empty, the staff is paying attention to the table. It’s like the food service equivalent of “keep your eye on the ball”. At El Cerro, my cup hardly ever drops below half-full. The staff is always friendly, and they get the food to you very quickly.

Also, definitely get the queso dip. It’s delicious.

BTW: Here’s a plug for eFoodi.com from Demetri Spanos. Demetri’s working with us on the Loud3r project (or “those ‘3r’ sites”), and he’s got a thing for making data very useful, so I look forward to good stuff from the site. I’ve started using his site to keep track of my food-related stuff. I like how it’s not just a restaurant site, or a recipe site, but also drinks and informational articles for utensils/techniques.

Quick Tip: Save time on escaping from mysql_real_escape_string()

All data should be escaped before going into a query, to prevent a SQL-injection attack. The current “best practice” is to use mysql_real_escape_string(), which connects to the DB, checks how strings should be escaped, and then returns the safe string.

Unfortunately, this requires a round trip to the DB, and it takes time and resources. Here’s a trick to make things faster.

If the data you’re escaping is supposed to be an integer, and not a string, you can do this:

$_data = (int)$data;

This will force the value to be an integer. There’s no way to do an SQL-injection with a number alone, and this is something that gets done very quickly (as compared to the mysql_real_escape_string).

Central Florida Mountain Biking

Yes, there’s places in Florida worth riding mountain bikes on. It’s not North Carolina or West Virginia (I really want to bike Snowshoe), certainly, but at this time of year, it’ll do.

My buddy Jason is making a map of all the worthwhile biking areas in Central Florida.


View Larger Map

Let me know if there are any places that should get added, and I’ll pass the word along.

Hard work pays off

My local friends know I have been working a lot lately, and not hanging out. They don’t know why, just something about “motorcycles,” “databits,” and “2 AM.”

The Cloudspace team has been working with Lowell Goss of Loud3r, and we’re starting to unveil the fruits of our labor. It’s an amazing system that lets us create sites for people who love to stay informed about a topic. For example, our first site is Fast3r — a motorcycle news site for people who want to keep on top of everything in the motorcycling world. Ducati? Got it. Stunting? Got it.

Somehow, not everyone is interested in motorcycles. So we made another site for people interested in politics, Vot3r. I’ve been our internal beta using it to stay on top of the current political cycle (want to know about Obama?), and it’s amazingly up-to-date. CNN ain’t got nothing on this.

If you’re not interested in bikes or politics, maybe you like video games. For you, there’s Blast3r. I’ve been using it to see what’s coming up next in the gaming world. I’m not a hardcore gamer, but one of the things I like about Blast3r is that it helps me filter though all the BS gaming rumors out there and find the next cool game to play.

Of course if what you really want to keep up on is….well, you get the idea. There’s a lot coming in the next few months.

The Ouroboros, The Recursive Lizard, and Strange Loops

I was reading Reddit the other day and saw a link proclaiming that “the Ouroboros is real!”. Having no idea what this was, I clicked through, and found pictures of a lizard that basically eats it’s own tail when threatened, protecting it’s belly.

Hitting up Wikipedia, I found out that the Ouroboros is a concept that’s been around for years — even Plato is cited as having talked about it. The philisophical idea that it represents seems to be things that come out of themselves; that create and build on themselves; or going backwards, things that “eat” themselves. Things that after they’re done, are the same as when they started. If you were so inclined, you could look at human life like this, where every human essentially has to come from a previous human. This is why the start of human life is such an interesting question.

I find things like this very interesting, especially after reading “An Eternal Golden Braid,” which is a book that is really special in Computer Science. It’s a very large and very intricate book, filled with inside jokes, and another level of inside jokes from there. But it explains some really advanced CompSci concepts through simple stories.

One of the more interesting things in CompSci is recursion, which is a way of solving certain types of problems that involves taking a question, and continually breaking it down into simpler questions, until each simple question has a simple answer, then combining all the simple answers to get an answer to the original question. The trick is that at each level, the simple question is the same type of question as the one that created it, and the same as the question that it will create. For example, if you had 10 people’s names to sort alphabetically, and you split those 10 names into 2 groups of 5, you’d still be alphabetically sorting, but a smaller amount.

This sorting technique is the type of thing that recursion is good at. “Eternal Golden Braid” refers to these type as “strange loops”, because when you break down a question into smaller questions, and end up with the same question, you’ve got something that “eats” itself. Like the Ouroborus — the Recursive Lizard.

How to make a single function call handle one or many

I was browsing through Ning’s codebase the other day. I work directly with the code since I’ve customized a Ning network for one of Cloudspace’s clients in some subtle ways, just because he wanted it that way.

I really like the work they’ve done. Their codebase clearly has a lot of best practices.

I found one neat trick that was used to make a function a bit more versatile, in that it can easily be passed a single object, or an array of objects, with no sweat. If you’re interested, you can find an example of this in /widgets/activity/models/ActivityLogItem.php, in beforeDelete()

This isn’t their code, but here’s an example of the trick.

function eatPie($pie_id) {
    foreach( (is_array($pie_id) ? $pie_id : array($pie_id)) as $current_id) {
        // codez
    }
}

Really straightforward. If an array is passed in, each item in the array gets operated on. If a single item is passed in, it gets turned into an array, then each item in the array gets operated on. I also like how the tertiary statement gets used inline with the foreach. Of course, if you want a bit more code clarity, you can do it like this:

function eatPie($pie_id) {
    $pie_id = is_array($pie_id) ? $pie_id : array($pie_id);
    foreach($pie_id  as $current_id) {
        // codez
    }
}