Archive for the ‘Programming’

Mac Developer Network01.22.09

It’s been a few months now and I’ve been listening to the podcasts from Mac Developer Network (MDN). The podcasts I like to listen to are the Developer Lives because they provide an insight how they got started. They also have other podcasts which are all good like Mac Developer Roundtable and Late Night Cocoa. Take a listen to them. They are good.

Posted in Mac, Programmingwith Comments Off on Mac Developer Network

iPhone Development Craziness…12.31.08

This week I finally gave apple $99 so I can test some of these apps I’m experimenting with on my iPhone and see what I can come up with. I was having so much trouble getting it to run on my iPhone I was getting the following error:

mobile device error

So, to get this error to go away, wheather it’s the correct way to solve this problem, I’m not sure but it works and it allows you to test on your iPhone. Just do the following, Change from Debug to Release and that should be it.

picture-11

Update:
So I fell into the same trouble I could not debug under the iPhone device the key answer for me this time was to go under the Build menu and click on Clean All Targets. After that just make sure you set your Bundle Identifier in the info.plist and lastly make sure it is code signing your build under Get Info the left panel Targets > AppName right click select Get info in Code Signing Identity.

Posted in iPhone, Programmingwith Comments Off on iPhone Development Craziness…

Development: Skatr, Update12.31.08

As I wrote earlier, I was trying to release skatr.us on the first of january but unfortunately that is not going to happen. I just don’t have the strength to pull it off.. I’m going to push back the release date for Skatr for mid February, I think that is a good enough time, thats like 8 full-days to work on it plus whatever time I have after work. I’m sure I’ll get it done, it’s better than half-complete.

Happy New Year!

Posted in Me, Programming, Projects, Ruby, Ruby On Railswith Comments Off on Development: Skatr, Update

Development update: Skatr12.26.08

Just a small updated on my development of skatr. It’s almost ready to go for beta release.

If anyone has taken notice, the site is currently down on purpose. I figure I will take it down it gives me more reason to complete my project. The site is being developed using the Merb Framework. After reading some news about Merb being Merged into Rails 3, was actually good I think. Anyways, my project skatr.us will be up live sometime soon, I’m aiming for the first of January, of course this will be beta release and I say beta because things might not be correct on the site, etc..

Posted in Me, Programming, Projects, Ruby, Uncategorizedwith Comments Off on Development update: Skatr

Capturing iSight from Macbook11.04.08

Lately I’ve been writing Objective-C/Cocoa code, and lately I’ve learned how-to capture video from an iSight on a Macbook. It’s actually easy. Here is the code. and I’ve also attached the example application I was writing so you can take a look at it.

[Download Source]
[Download Application]

#import <Cocoa/Cocoa.h>
#import <QTKit/QTKit.h>


@interface MyRecorderController : NSObject {
  IBOutlet QTCaptureView * mCaptureView;
  QTCaptureSession       * mCaptureSession;
  QTCaptureDeviceInput   * mCaptureDeviceInput;
}

- (IBAction)startRecording: (id)sender;
- (IBAction)stopRecording: (id)sender;

@end



@implementation MyRecorderController

- (IBAction)startRecording: (id)sender
{
  // Create a new Capture Session
  mCaptureSession = [[QTCaptureSession alloc] init]; 
  
  //Connect inputs and outputs to the session
  BOOL success = NO;
  NSError *error;
  
  // Find a video device
  QTCaptureDevice *device = [QTCaptureDevice defaultInputDeviceWithMediaType:QTMediaTypeVideo];
  if(device) {
    success = [device open:&error];
    if(!success) {
      // Handle Error!
    }
    // Add the video device to the session as device input
    mCaptureDeviceInput = [[QTCaptureDeviceInput alloc] initWithDevice:device];
    success = [mCaptureSession addInput:mCaptureDeviceInput error:&error];
    if(!success) {
      // Handle error
    }
    
    // Associate the capture view in the UI with the session
    [mCaptureView setCaptureSession:mCaptureSession];
    
    // Start the capture session runing
    [mCaptureSession startRunning];
    
  } // End if device
}

- (IBAction)stopRecording: (id)sender
{
  if([mCaptureSession isRunning]) {
     [mCaptureSession stopRunning];
     [mCaptureSession release];
     [mCaptureDeviceInput release];
  }
}


@end

Posted in Mac, Programmingwith Comments Off on Capturing iSight from Macbook

Apple Drops iPhone Developer NDA On Released Software10.01.08

Apple announced today that it has decided to drop the controversial iPhone developer non-disclosure agreement because it ‘created too much of a burden on developers, authors and others interested in helping further the iPhone’s success.”

via Techcrunch

Posted in iPhone, Mac, Programmingwith Comments Off on Apple Drops iPhone Developer NDA On Released Software

RubyCocoa09.12.08

For while now, I’ve been learning Objective-C, and while I’m writing in Ruby more often I figure I would also learn RubyCocoa. I figure I’m going to create a few screencasts on getting started with RubyCocoa and anything I learn with it. If you don’t know what RubyCocoa is, it is described as:

“…a bridge between the Ruby and the Objective-C languages, allowing you to manipulate Objective-C objects from Ruby, and vice-versa. It lets you write full-stack Cocoa applications in Ruby…”

Posted in Mac, Programming, Rubywith Comments Off on RubyCocoa

LA Ruby Meetup 6/1906.19.08

LA Ruby Meetup was very cool. So I was the first to be at the scene. I helped bring the food to the room since I was in the lobby and greeted by Jody. I meet and greeted all of the LA Times people. Also meet some guy from Yahoo!, sorry I forgot your name already, and one from heroku, BizQuest another from PGP, and another from Experian. As-well as more but I sorta forgot everyones name already… or at least I can’t remember them, yet.

If you’re in the Los Angeles Area check it out.
Yellowpages.com will be hosting LA Ruby Meetup #2 on July 17 2008, so mark that in your calendar. Join the Yahoo Group, LARuby

Posted in Me, Meetup, Programming, Ruby, Ruby On Railswith 1 Comment →

Something in Ruby05.30.08

#!/usr/bin/env ruby

String.class_eval {
  define_method(:translate_to) do |lang|
    text = case lang
           when :spanish 
           "Buenos Dias, Como estas hoy?"
           when :english
           "Good Morning, How are you today?"
           else
           "I don't speak any other language."
           end
  end
}

puts "Sentence".translate_to :spanish
# => Prints out "Buenos Dias, Como estas hoy?"

puts "Sentence".translate_to :english
# => Prints out "Good Morning, How are you today?"

puts "Setenece".translate_to :portuguese
# => Prints out "I don't speak any other language."

puts "Sentence"
# => Prints out "Sentence"

So while messing round I made this in Ruby… I’m not sure if it is considered meta programming? Well, it’s just adding a method to the String class. I get confused when to consider things to be meta programming.. Maybe I over think about it.

Posted in Programming, Rubywith 1 Comment →

PHP Snippet03.08.08

Here is a PHP Snippet I wrote. It’s a cool trick to for calling multiple methods in a much simpler way. Inspired by Ruby’s ActiveRecord.

<?php

interface Member {
	function login($username, $password);
	function update($status);
}

class Base implements Member {
	public function login($username, $password) {
		echo "You will be logged in as: {$username} with Password: {$password}\n";
	}
	
	public function update($status) {
		echo "Your New Status Message is: {$status}\n";
	}
	
	public function __call($method, array $argv) {
		if(preg_match('/^do_*/i', $method)) {
			foreach(explode("_and_", substr($method, 3)) as $k => $v) {
				$param = array();
				foreach($argv[$k] as $value) { $param[] = "'{$value}'"; }
				$param = join(", ", $param);
				$code = '$this->'. $v ."({$param});";
				eval($code);
			}
		}
	}
}


class User extends Base {
	
	public function say_hello($message) {
		echo "Message: {$message} \n";
	}
}


$usr =& new User();

$usr->do_login_and_update(array("username", "password"), array("Hello World"));
# Prints the following:
# You will be logged in as: username with Password: password
# Your New Status Message is: Hello World
#

$usr->do_login_and_say_hello(array("username", "password"), array("Hi how are you?"));
# Prints the following:
# You will be logged in as: username with Password: password
# Message: Hi how are you?
#

$usr->do_login_and_update_and_say_hello(array("username", "password"), array("Hello World"), array("Hi how are you?"));
# Prints the following:
# You will be logged in as: username with Password: password
# Your New Status Message is: Hello World
# Message: Hi how are you?
#

?>

Posted in PHP, Programmingwith Comments Off on PHP Snippet

Ruby Technique: Meta Programming03.02.08

Meta Programming is code that writes code. See the code sample below.
I have made a screencast of this process. View it here

#!/usr/bin/env ruby

class Product
  def initialize(items)
    items.each {|item| Product.product(item) }
  end

  def self.product(item)
    code = %Q{
      def add_#{item}(item)
        @#{item} = [] unless @#{item}
        @#{item} << item
      end

      def display_#{item}s
        @#{item}.each {|item| puts item }
      end
    }
    class_eval(code)
  end
end

class Item < Product
  def initialize(*items)
    super(items)
  end
end

cart = Item.new(:book, :computer, :music)
cart.add_book(:Ruby) # => Add a book to our cart items

cart.display_books # => We want to display All books we have added
puts "\n"

cart.add_computer(:Apple)
cart.add_computer(:Dell)
cart.add_computer(:Sony)
cart.display_computers # => Display All Computers
puts "\n"

cart.add_music(’Modest Mouse‘)
cart.add_music(’Northstar‘)
cart.display_musics # => Display All Music Items

Posted in Programming, Rubywith Comments Off on Ruby Technique: Meta Programming

Lastbridge Stations01.24.08

Added Playlist

New Feature for LastBridge.net – I have added a small list of station you can now select.

Of course more new features are planned ahead.

Posted in Programming, Projects, Ruby On Railswith 1 Comment →

Release: LastBridge01.20.08

Screencast Lastbridge

It is official LastBridge.net is out for public consumption! Again for those who are lost and don’t know what this “LastBridge” is it’s for listening to your last.fm radio stream on the Roku SoundBridge.I have made a screencast on How To use LastBridge. If anyone still needs help or just want to leave your opinions on this project, leave a comment or two. Thanks.Enjoy!

www.LastBridge.net

Posted in Programming, Projects, Ruby On Rails, videowith 25 Comments →

Ruby Code Snippet01.13.08

In Ruby a switch statement looks like this

say = "Hello"

case say
when "Hello" then
	puts "Say Hello"
when "Bye" then
	puts "Say Bye"
end

In PHP a switch statement looks like this


Posted in Programming, Rubywith Comments Off on Ruby Code Snippet

How to: Objective-C – Part 111.12.07

I finally made a screencast of some objective-c mainly because I myself always figured its much easier to learn something when you see it visually. So that in mind. maybe someone will learn something… or maybe not… whatever…

Posted in Me, Other, Programming, videowith 1 Comment →

  • Recent Comments