Recursively remove .svn directories

Sometimes you find yourself in situations where svn cleanup just doesn’t cut it — you need to remove the .svn files and re-add everything. It’s a pain to do that file by file so here’s a little method for doing it all at once.

[bryan@crainbandy] rm -rf `find . -type d -name .svn`

UPDATE (via comments, thanks meinholz) alternatively you can do:

[bryan@crainbandy] find . -type d -name .svn -exec rm -rf {} \;

Don’t say I didn’t tell you.
Bryan

How to find out what Linux Distribution/OS you’re running

Sometimes it’s a pain in the ass to install software on unix based systems without having prior knowledge to the OS/kernel versions.

You’d do something on debian that doesn’t work on CentOS, Fedora has yum pre-installed where as RHEL4 comes with up2date but you have to have a key, then there’s always RPM’s but who really wants to use RPM’s? You might as well just compile it yourself from source.

Here is a few commands that (should) return exactly what kind of linux operating system you are running.

[bryan@crainbandy ~] dmesg | head -1
[bryan@crainbandy ~] cat /proc/version
[bryan@crainbandy ~] cat /etc/issue
[bryan@crainbandy ~] uname -a

I hope that helps. If you can’t figure it out with one of the commands above then I guess you’re S.O.L.

Geaux team.
Bryan

while (Code Quality == WTFs/Minute) { wtf(); }

wtfm

Any experienced coder can testify — sometimes it’s not the amount of time spent infront of the computer that gets the job done, it’s the amount of WTF’s per minute.

I love this comic.

How to Fix the iPhone “Apple Mobile Device has not been started” Error

You plug in your iPhone to transfer some sick beats, a few videos, maybe a picture or two of someone that loves you and Windows brings down the pain with a retarded error message. Don’t get all pissed off. Get all fixed…off?

Daddy can fix this!

cannot-be-started

Apple Mobile Device has not been started error

So here’s the deal, instead of Windows just starting the service on the event that an iPhone/iPod is plugged in via USB to your PC they want to make you loathe the machine and manually enable it yourself. I can’t remember the last PC I didn’t have to enable this stupid service on. This isn’t a tutorial about Windows services so don’t ask. It was painful enough to bring myself to write this article

Open up the Control panel
Start > Control panel

control-panel-open

Open up the control panel

After you opened the control panel you want to open the Administrative Tools
(WTF Note: If you don’t see Administrative Tools in the list of icons under your Control panel click “Switch to Classic view” on the top left)

administrative-tools

Open up administrative tools

After you open Administrative Tools double click the Services icon to bring up the services manager

services

Open up services

V’oila, the services manager appears — now, find the service in the list entitled “Apple Mobile Device

mobile-select

Open up the apple mobile device service

Double click that and you will see this screen:

dropdown

Change from "Disabled" to "Automatic"

It should automatically open up as “disabled” if it isn’t disabled, then I don’t know wtf you’re doing here. Anyways, as you can see we want to change it from “Disabled” to “Automatic” or “Manual” — I’m going with automatic. After you do that, click “Apply” on the bottom right and you should see some voodoo like this happening:

start-device

Start the Apple Mobile Device service

After that, you’re essentially done and you have “fixed” the problem.

Finally, your Apple Mobile Device HAS been started.

You can close all the Windows.

started

Finished!

Be sure to unplug and re-plug in your iPhone/iPod!

Quick capsule summary

  • Start menu  > Control Panel
  • Drink.
  • Administrative Tools > Services
  • Find “Apple Mobile Device” and Double-click
  • Change “Startup type” from Disabled to “Automatic”
  • Click apply on the bottom right
  • Drink heavily.
  • Start the service
  • drnk hvly…

There. Now your shits not weak.

MMmmMm foot,
Bryan

How to fix the __PHP_Incomplete_Class Object error in PHP $_SESSION’s

I ran into a problem recently where I was instantiating an object and passing it login credentials in order to authenticate a user. If the users email address and password were correct my method will return me an object containing all of an individual users information that’s important to their $_SESSION so it can persist across pages, as you normally want in an authenticated system.

Note: I have not tested this with normal arrays. I have only tested this with the $_SESSION superglobal array.

The __PHP_Incomplete_Class Error

If you initialize a session (session_start) before you have instantiated the object and then you assign the object to a $_SESSION variable then you print_r($_SESSION) you will receive this error.

__PHP_Incomplete_Class Object (
[__PHP_Incomplete_Class_Name] => user
[user] => __PHP_Incomplete_Class Object (

No bueno

)

Here’s a code example

session_start();
$user = user::authenticate($email, $password);

if ($user !== false) {
$_SESSION['user'] = $user;
}

// __PHP_Incomplete_Class
print_r($_SESSION['user']);

This will give you a similar error to the example provided above. Don’t ask me why.  I haven’t gone balls deep (forgive the crude analogy) in the parser code to analyze the origination of this issue, I just know how to fix it.

Fix the __PHP_Incomplete_Class Error

If you instantiate the object before you initialize the session then you’re golden.  Take this code in its for instance:

$user = user::authenticate($email, $password);

if ($user !== false) {
session_start();

$_SESSION['user'] = serialize($user);
}

// Fixed!
print_r($_SESSION);

P.S. You  want to turn  session.auto_start OFF in the php.ini
If you don’t know how to do this make sure in your php.ini that session.auto_start = Off.

That’s basically it. If you have any questions, feel free to post in the comments section.

Your welcome,
bryan

Back in business

After a ridiculous amount of downtime and laziness, I am back with my 99.99% up-time guarantee. It was down for longer than a month, okay, I get it. I’m sorry.

I know, okay, I know. The internet was a cold, heartless place without me. It was a gloomy day with no sun in sight. It was like being covered with a chocolate haze of sadness. It was probably like having a winnebago and then all of a sudden, you don’t have one anymore. Quit bleeding. I had to get my shit together. I was spending $60/month USD on a dedicated server over at cari.net. I got a “deal” on their Celeron D. I mean, it was pretty impressive:

  • Celeron Dual-Core
  • RAM 1GB
  • Storage 250GB
  • Transfer 1300GB

Too bad it was in California. That’s like having the hottest girlfriend in the world, but she lives in slow motion. How much would that suck? You ate dinner yesterday and she’s still eating breakfast. Wrap your dome around that, trick. J/K, J/K.

That server’s great and all but I’m closer to Dallas, Texas than I am California. I used cari.net for a project about 2 and a half years ago but I think we used one of their New York partners data centers instead of their California datacenter, anyways point is it was slow, crainbandy wasn’t getting enough traffic to justify paying for 1300GB/month and only using 5GB, or whatever amount it was, I’ve since lost the log files and don’t really care to be honest.

Crainbandy, meet Linode.

I switched hosts to linode.com. Linode uses Xen for it’s Virtual Private servers. Having attempted to setup Xen and XenServer I can testify to the stability of these platforms. I also have a friend who switched to linode recently and we were messing around with Ruby on Rails on his server, that’s when I decided to switch. It’s a VPS but it’s fast, it’s scalable and very affordable.

For $20/month I get (extremely low latency, obviously — about 20ms ping response time):

  • RAM 360MB
  • Storage 16GB
  • Transfer 200GB

It’s $240/year vs. $720/year. I think that’s a better deal.

Anyways, I’m back. Crainbandy is back and we have bandwidth to use, so tell all of your friends about me.

All of them.

I’m f-ing serious. “Follow me on twitter” gah.

Encore: iPhone, Objective-C, Groovy/Grails, CodeIgniter — all coming up this week. Get ready for crainbandy.

scadeusche.
Bryan

Crainbandy’s on Twitter

twitter.com/crainbandy

I know, I know. I talk a lot of trash about twitter but you have to admit, it’s very appealing from a “marketing” perspective.

There you go, there really isn’t anything else I want to write about. Just wanted to let everyone know that I will be “tweeting” cool stuff.

Good talk,
Bryan

Bespin - Browser based IDE by Mozilla Labs

Bespin is the latest thing out of Mozilla Labs. It’s a browser-based IDE written in Javascript using HTML 5.

There’s a video of two guys basically showing you how far along the development process they — aren’t. Highlighting some of the functionalities… whatever.

bespin

What’s cool

  • It runs on Firefox so hopefully once it’s been developed more (because Firefox does have some very talented developers.) it will increase the speed and options available to a programmer.
  • It could eventually be the solution for a universal IDE that supports any architecture as well command line integration and possibly collaboration across programmers. Bridging that communication gap between code and conversation.
  • You get to write your own methods for the command line.
  • It’s a new project so you could help make it what it should be.

They figured out how to do text highlighting purely in javascript and it’s architecture is such, that it’s increasingly easy to run commands that you’ve created in the console. Perhaps a custom commit, switching environments, who knows. It’s still pretty cool

What’s not cool

  • It’s slow. No matter what they say, it won’t ever replace a solid desktop development environment.
  • It runs on Firefox.
  • As of today, it’s just not practical for real-time development.
  • It doesn’t have FTP/SCP.
  • Code highlighting is seriously lacking.

I program primarily in PHP and there’s no PHP code highlighting. I guess I could extend GeSHi but my IDE already has code highlighting. Why would I want to use another one that’s worse than the one I currently use? I know where they’re going with Bespin but I think they released it a little too early. No FTP? I do plan on trying it out once a lot of these features get developed though.

Looking forward to it.

Check out Bespin, see what you think for yourself.

WordPress Plugins you shouldn’t not have

Let’s all agree that the wordpress plugin repository blows. The wordpress theme repository blows. I’m not flaming wordpress because I have found a good amount of plugins through their website but I hate when I search for something that’s very specific and I get the same results returned. That doesn’t make any sense to me. I dare you to go google “search engine optimization wordpress plugins” or anything of the like then google “huge dwarfs with tiny hands and feet” and get the same results. You’d be furious with this free search engine that you had nothing to do with nor made any attempt to improve. I’m just saying, it’s frustrating.

Over the past 4 months I’ve installed/uninstalled probably 100 wordpress plugins and kept a few, but I only want one plugin to do one thing. I’m not a big seventy-in-one plugin kind of guy.

WordPress Plugins

Below you’ll find the (up-to-date) plugins that I find most useful with wordpress in their respective category. This obviously isn’t every single awesome wordpress plugin but this list isn’t an end all be all. I also hate people that write 50 “top 10″ posts about wordpress plugins for the sake of traffic rather than resourcefulness and quality. Quality is what I aim for.

All of these wordpress plugins are FREE.

Spam protection

Akismet
Hands down the best in spam protection for your money (it’s completely free.)

Search Engine Optimzation (SEO)

All in One SEO Pack
Update posts with meta data specific to that post/page. This is invaluable if you want to SEO your blog properly for rankings in Google, Yahoo, MSN et cetera.

Google XML Sitemaps
Generate your Google XML Sitemap with valid XML that’s always up to date. This helps tremendously if you want google to take your blog seriously.

Robots Meta
Manage your robots.txt file dynamically

Usability

Multi-page Toolkit
Write multi-page articles, tired of using the “kitchen sink”? this plugin will do all you need.

Aesthetics & Imagery

Lightbox 2
‘Nuff said.

SyntaxHighlighter
If you write a lot of source code in your articles like I tend to do this helps a lot. What else are you going to do? Plaintext source code is extremely “web 1.0″

Social Marketing & Media

DiggZ-et
Put that sexy digg button on your articles/pages. Manage the icon as well as where to exclude/include it. Very useful.

ShareThis
On all of my posts I have a “ShareThis” link at the bottom. I personally hate reading an article on a blog with 900 buttons to click, this encompasses more than just social media, you can send to a friend and various other functions through one javascript window.

WordPress Specific Plugins

Wordpress Automatic Upgrade
Upgrade your wordpress to the latest installation (Note: This plugin will probably be rendered useless in future releases of wordpress as I’m sure they’ll build this functionality into the core more effectively, but for now it’s helpful.)

WordPress Related Posts
Show posts related to tags in specific posts.

WP Super Cache
If you get the digg effect through one of your articles at random, you don’t want to be caught naked. This will cache high traffic pages saving your server the beating that digg undoubtedly would have delivered had you not been the wiser.

WordPress.com Popular Posts
Display your most popular posts (related by # of comments from your wordpress.com stats)

Search & Replace
Sometimes you want to replace every “apple” with an “orange” or the like. This comes in handy at random times but when you need it, it really comes in handy. Replace any string with a string over all your posts pages, or anything.

That should get you started. There are tons of useful wordpress plugins so know that this is just a few that I picked. I will be updating this article weekly most likely so be sure to check back.

Be about it,
Bryan

Twisten.FM - Listen to Twitter

twisten2

Disclaimer: I never, I repeat never – liked twitter until I saw this. 

I used to use it every once in awhile to get in “twights” (twitter fights) with my “followers” and random schananagans, but even the times I’d use it I’d want to slap myself for using it because no matter how you use it, you just sort of feel like a fanboy. Then I found #nerdpickuplines and a few other cool twitter personalities and it got bearable.

It’s like Last.fm but for twitter.

Discover new music through Twitter with Twisten.FM

Here comes Twisten.FM from the makers of Grooveshark (which is probably still cooler, but not as unique.) 

Twisten lets you “hear” twitter. Hear meaning people that recommend songs get thrown into the twisten database and in return you get a huge amount of information based on current music trends and other things. Last hours the song of the hour was angels by wax poetic. Great song. I’m already liking this.

twitter-listen1

If you need a place to discover new music then this is it. On top of that you can twitter music that you’re listening to. Giving back into the collective bad-ass that is the makers of grooveshark, and now the makers of Twisten.

rock_hand

Link it up
Discover new music with Twisten.FM
Play any freaking song you want with Grooveshark

Wrock and Wroll,
Bryan