PHP Sequential or Linear Search Algorithm

Sequential search, or linear search, is the simplest searching algorithm. Indeed, given it’s brute force approach of just traversing a collection from the first to last element, it’s hard to justify calling it an algorithm at all. However, here’s an example in PHP:

function sequential_search($needle,$haystack) {
for($i = 0; $i < count($haystack); $i++) { if ($needle == $i) return true; } return false; }

Here's an example of how you would use this algorithm to look for the number 3 inside an array:


$haystack = array(1,2,3,4);
$needle = 3;
$success = sequential_search($needle, $haystack);

| Comments

Who is Going to Organize Social Information on the Web?

Mike Arrington has a good post today on how social media today is a lot like search was 10 years ago. You can read it here. In it, he notes

“The online social landscape today sort of feels to me like search did in 1999. It’s a mess, but we donâ’t complain much about it because we don’t know there’s a better way.

Everything is decentralized, and no one is working to centralize stuff. I’ve got photos on Flickr, Posterous and Facebook (and even a few on MySpace), reviews on Yelp (but movie reviews on Flixster), location on Foursquare, Loopt and Gowalla, status updates on Facebook and Twitter, and videos on YouTube. Etc. I’ve got dozens of social graphs on dozens of sites, and trying to remember which friends puts his or her pictures on which site is a huge challenge.

And the amount of spam and just general nonsense that is flooding all of these services is crippling. As a user, I spend far too much time weeding it all out to find the few gems of real content from people I care about.”

He then goes on to call for someone to organize it:

“Someone will eventually help us make sense of all these various types of services, and help us separate the noise and spam from the real signal. I don’t know who’s going to do it, and I certainly don’t know how (if I did, I’d be doing it, not writing about it). But at some point soon, one of the Internet giants, or some new startup we’ve never heard of, is going to fix this mess for us.”

While I agree with both of his points, I don’t think figuring out the when and who is that difficult. I’m willing to confidently predict that the social media space will be organized in the next two years, and that it will be done by either Facebook or Google. The reason I have such confidence in this prediction is simple. Facebook and Google are the only two companies that have both the computing power, and the ability to collect the information necessary to actually organize the social space. Actually collecting the social information on is the first, and larger, problem. Here, Facebook has a huge advantage over Google, because it’s the largest social network in the world. However, it’s only a relative advantage. Google is a close second in the amount of information it collects. The second problem is that actually organizing the world’s social graph is a large-scale computational problem that is even more difficult than organizing the world’s web pages. Now, I was extremely impressed with the amount of technical energy I felt at Facebook when I visited their campus for the Hip Hop for PHP event, but Google still has a huge advantage in computing resources and skill. Google’s basic computational infrastructure is far ahead of Facebook’s, and indeed anyone else’s infrastructure..
So, out of these two, who would I bet on? I’d make Google the 2-1 favorite. But, as we saw in the Superbowl yesterday, favorites don’t always win.

| Comments

HipHop for PHP

Here’s my quick take on HipHop for PHP that was posted by Larry at ZDNet. I’m attending the HipHop event tonight, and I will add more about it later.

| Comments

Google Chrome Extensions

I’ve been playing with Google Chrome extensions, and I’m impressed by how easy they are to create. It took me about 5 minutes to alter an example, and create one that provides links to the latest ZDNet Blog posts. Should you be interested, you can download it here.

| Comments

Ron Paul Moves Into the Mainstream

According to the LA Times, Ron Paul is no longer a fringe character:

For three decades, Texas congressman and former presidential candidate Ron Paul’s extreme brand of libertarian economics consigned him to the far fringes even among conservatives. Not a few times, his views put him on the losing end of 434-1 votes on Capitol Hill.

No longer. With the economy still struggling and political divisions deepening, Paul’s ideas not only are gaining a wider audience but also are helping to shape a potentially historic battle over economic policy — a struggle that will affect everything including jobs, growth and the nation’s place in the global economy.

His warnings on deficits and inflation are now Republican mantras.

Read more at Mish.

| Comments

From the “If You Only Have a Hammer, Then Everything Looks Like a Nail Department”

The web is abuzz today over Google’s announcement that they have acquired Teracent. Teracent offers a technology to optimize display ads for click-thru in the same way that Google optimizes text ads. Teracent’s secret sauce is it’s ability to mix and match graphical elements to design new ads and then optimize their delivery. As Andy Beal puts it, it’s “multi-variate testing for your banner ads.” But multi-variate testing to what purpose? The only response Teracent can measure is clicks; so that’s what they measure. That’s fine if you are focused on direct response from your display ads, but in that case you are better off buying text ads. Text ads are cheaper, and likely just as, if not more effective.

Traditionally, display advertising has been about brand awareness. Unfortunately, there’s no direct way to measure that, and so it’s ignored by Teracent. My (relatively uninformed) guess is that Teracent will optimize these display ads towards those that have a direct call to action. If what the advertiser wants is a direct action that’s fine. But, if you want to launch a brand with this kind of display ads, then this kind of optimization won’t work.

| Comments

Bill to Audit the Fed Passes Committee!

Despite an attempt to add a crippling amendment, and the (surprise) opposition of Barney Frank, the bill passed. Here’s the Youtube video:

For more details, see Mish.

| Comments

Pay For What You Could Get Free

Mobkool on KindleHey, MobKool is available on the Kindle. Sign up here, and pay money for something you can read for free, but in a much less pretty format. I will really appreciate it.

| Comments

Mandatory FTC Disclosure

Well, the FTC has just laid down a new policy requiring bloggers to reveal any payment (or free stuff) they receive to blog about any subject. For details, check out this post from Larry. So, here’s my disclosure. I’m ashamed to have to admit that I am so lacking in influence that nobody has ever given me anything, or paid me, to endorse anything. Too bad I’m not Mager.

| Comments

Chris Arreola – Vitali Klitschko Fight

Chris Arreola and Vitali Klitschko weighed in today for their heavyweight fight which occurs tomorrow. Arreola tried to have a little fun at the expense of all the people who said he was a fat, overweight fighter. Here’s the video:

Arreola looked better than he has in the past few fights, but he’s still at least ten pounds heavier than he should be. Here’s the fight prediction from Bad Left Hook. I predict either an early knockout of Arreola or a boring Klitschko decision.

| Comments

« Previous Page« Previous Entries ~ Next Entries »Next Page »