11 Apr

8 Bit Color or 256 Color Array

Posted by Mike Categories: Blog
8 Bit Color or 256 Color Array

I’m sending color to an arduino and I’d like to send the entire rgb value in one byte. It’s easy to translate this from rgb values. Something like: int color = ((b&255 & 0xC0)+((g&255 & 0xE0) >> 2)+((r & 0xE0) >> 5))&0xFF; But once you get that byte to the arduino, you need to convert it back to an RGB value more...

10 Apr

xCode Can’t Drag IBOutlets or IBActions

Posted by Mike Categories: Blog
xCode Can't Drag IBOutlets or IBActions

Sometimes life is simple, too simple. Sometimes you get stuck for a day and it was something totally ridiculous that you couldn’t figure out. This is one of those days. Doing IOS Development, I thought I had it down. Create a new UIView, create a new view controller class, and set the UIViewController’s class to the newly created class in more...

09 Apr

Amazon RDS Creating Functions in MySQL

Posted by Mike Categories: Blog
Amazon RDS Creating Functions in MySQL

Had a problem creating functions in MySQL with the standard user for an RDS instance on Amazon. For those who don’t know, Amazon RDS is a sweet place to host a remote database, kind of expensive but worth it if you are using a distributed system. Anyway… The problem is when you try to run something like: DROP FUNCTION IF EXISTS hello_world; DELIMITER more...

30 Mar

Add SSL to EC2 Instance

Posted by Mike Categories: Blog
Add SSL to EC2 Instance

You want https on your ec2 instance with nodejs? easy. First thing is first. There are new rules. You can’t get an ssl certificate anymore that assignes to an IP address (More here). If you don’t know what this means, don’t worry about it. I’ll walk your through. You’re going to need to set a few things up. First, set more...

All Your Autorotate Are Belong To UINavigationController

so if you’re like me, you usually don’t fuck around with screen orientation. You make an app to auto rotate. But if your building an app in a day for a pitch that scans barcodes and plays videos, and you don’t have full res images assets, basically screen shots. You have some pages that should auto rotate and some that shouldn’t. more...

How to make a UIScrollView Programmatically

Ok, so I’ve stilll never made this work in interface builder. But it’s not that hard to make it in code. You want to add a scroll view to the middle of your screen, in your view controller.m file: - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. NSLog(@"viewDidLoad"); scrollView more...

25 Mar

Fastest Loops in Javascript

Posted by Mike Categories: Blog
Fastest Loops in Javascript

I’m always interesting in Javascript and which constructs perform better than others. There are alot of funky things about this language, but for loops always seem to be a moving target for me. I tend to stick with the regular var i = 0 loop, because it’s easy to understand: for(var i = 0, l = something.length; i < l, i++) { // do more...

18 Mar

Launch At Login Cocoa

Posted by Mike Categories: Blog
Launch At Login Cocoa

recently I needed something that launched itself when a user logs in or restarts their computer. Found this nifty little library:¬†https://github.com/biocross/LaunchAtLoginController–with-ARC- Basically, you load those two files into xcode, the do the following: Hook a button or segmented control up to an IBAction in the action load the launchController set more...

How the F*** to Encode URL in Objective-C for IOS

Google it. You’ll find there are a ton of solutions, all of them produce memory related errors because of ARC. if you want to do it in a way that works, just: NSString *charactersToEscape = @"!*'();:@&=+$,/?%#[]\" "; NSCharacterSet *allowedCharacters = [[NSCharacterSet characterSetWithCharactersInString:charactersToEscape] invertedSet]; more...

11 Mar

OMG OMG Tail?

Posted by Mike Categories: Blog
OMG OMG Tail?

So I have been trying to watch for a successful file upload in NodeJS for a while. Sure, you can use something inotify, but the process is heavy when all your looking to do is emit an event in NodeJS when a file is successfully uploaded to a directory on your server. For starters, I have vsftpd running on an ubuntu installation. I upload to a directory more...