Archive by Author

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!

Did this help you? Feeling generous? Buy me a beer! (After all, if it wasn’t for me, you wouldn’t be able to transfer music to your iPhone or 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