Programming

Keith and The Girl Twitter Feed on iPhone Lock Screen

Monday, March 30th, 2009

Eagerly awaiting KATG Iphone App
In the meanwhile I was playing around and now I have the Keith and The Girl Twitter feed on my lock screen.
Every time my iphone locks, it grabs the latest twitter updates, if it can't connect to the internet at that moment then it's left blank and you have your regular lock screen.

Requirements [with tutorials]:

  • Hacked/Modded iPhone - [link]
  • Winterboard - an app you install through Cydia - [link]
  • Server Lock Screen - a theme extension? you install through Cydia and activate with Winterboard - [above link will explain this too]
  • SSH - [link]

How To:

  1. Make sure Server Lock Screen is activated in Winterboard. When your iPhone is locked you should see some text below the time that says it was loaded from a remote server.
  2. Start SSH on your phone and connect to it with an ftp client, the ftp client in the tutorial is called Fugu, but any will do that has SFTP. Once connected you'll see your iphone's directory structure.
  3. Open /Library/Themes/Server Lock Example.theme in an html editor. Some text editors will parse the html.. if you can't see the html code then you opened it wrong or with the wrong program... notepad/textmate should be fine.
  4. You should see a line that looks like this: src="http://cydia.saurik.com/lock/"
  5. change it to this: src="http://fightskillz.com/lock.php"
  6. Save the changes to your phone.

img_0004

Every Time…

Thursday, March 19th, 2009

Setting up my own server is a little more involved than I originally envisioned. It seems every ounce of functionality I want requires several different open source projects to work together, and I have to go hunting and learning about the history and versions and how each service, server, community, app, etc. works and what's compatable with what and which workarounds, plugins and everything is best to use and which isn't and why and what to keep an eye on. It just goes on and on. This is all running on the new server which is a lot faster(after a reboot) although at the time of writing I just configured a whole lot of stuff and it's all lagging a bit. I don't even want to mention the dent in traffic from repetitively having to restart the server, apache, rails, etc.

I can't wait till I'm happy with the set up and can get knee deep in writing code again. I don't want to evaluate anymore, I just want to program. I've got all this ambition and innovation locked away in a special compartment of my neural network, hopefully it won't have gone stale by the time I get around to implementing it. grrrr.

US Department Of Defense Goes Open Source

Sunday, February 1st, 2009

The Department of Defence has put up a site based on SourceForge.net. As for now they only have a few projects and contributing to those projects is restricted to feds with high security clearance, ie: U.S. military, DoD government civilians and DoD contractors for Government authorized use.

Forge.mil is a family of services provided to support the DoD's technology development community. The system currently enables the collaborative development and use of open source and DoD community source software. These initial software development capabilities are growing to support the full system life-cycle and enable continuous collaboration among all stakeholders including developers, testers, certifiers, operators, and users.

From Forge.mil[link]

Matt Asay of Cnet.com wrote about Forge.mil noting:

The Defense Department, which has been pushing hard to get involved in open source for some time as a consumer, is now involved as a developer. In just a few years, open source has gone from being "risky" to one of the best ways to mitigate risk.

From News.Cnet.com[link]

OAuth

Saturday, January 31st, 2009

I first heard about OAuth(Open Authentication) while skimming throught the Twitter API[link] where there was a notice that Twitter would be supporting OAuth in the near future.

When will Twitter support OAuth?

We'll be launching a private beta in January, 2009 (early February at the very latest). We'll be allowing pretty much anyone who can provide us with cogent and comprehensive bug reports to participate in the private beta. Once we're happy with how OAuth is working, we'll move to a public beta. Once the rest of the bugs are ironed out, OAuth will become the supported authentication system for Twitter, and HTTP Basic Auth will be deprecated after six months.

via Twitter Api FAQ[link]

So what is Oath? It's an open protocol for working with protected remote data services, and it's a big step forward in data portability. A big part of the next iteration of the web will be the ability to have one profile, that follows you around, so instead of signing up for 8 social network services and filling out your profile on each one, you'll be able to take your one profile and apply it to whatever service you sign up for. OAuth while making a number of other data access scenarios more palatable, like RIA's, mashups... It will make it easier to build a social network or tool that not only interacts with other services you've signed up for, but pulls your profile info, and applies it or uses it across services. The reason it's so important is that by being open source and having the backing it does, it will evolve as similar projects are to be secure, free, easily accessable, and widely adopted.

For consumer developers, OAuth is a method to publish and interact with protected data. For service provider developers, OAuth gives users access to their data while protecting their account credentials. In other words, OAuth allows a user to grant access to their information on one site (the Service Provider), to another site (called Consumer), without sharing all of his or her identity.

via Wikipedia[link]

Read more about the project, how it started and where it's going click here.

Read over the docs click here.

Grab an OAuth library for your language of choice here.

ShadowBox JS Plugin For Wordpress

Friday, January 9th, 2009

I just added this to FightSkillz, and it looks amazing. It's like other lightboxes, thickboxes, greyboxes etc. When you click on images, and certain links it dims the background, and loads a larger version of the image or the linked content.

The ShadowBox JS plugin for Wordpress doesn't have all the features of the original shadowbox.js, like maps and external sites, but it does take care of images, audio, and video. The plugin does it automatically so I don't have to add special tags to content links, although there is a manual mode, and has tons of customization behind the scenes. It auto generates galleries with the images in each post and it's just really really awesome.

To see it at work on FightSkillz:

  • visit the ChalkBoard gallery here.
  • visit this post and click on my sketch, it'll load a hi-res version which may take a few seconds, so be patient. Once it's loaded you can drag it around to see the whole thing.
  • visit the Pixels, Ink & Graphite category.

To get the original Shadowbox.js for use on non-Wordpress sites:

To get ShadowBox JS plugin for Wordpress:

  • visit the plugin page on Wordpress here.
  • visit the author's plugin page here.

Firefox 3 Bug and 3.1 BETA Hidden Feature

Thursday, January 8th, 2009

A small Firefox quirk another developer pointed out to me the other day is that Flex applications that make HTTP Service requests, when running in said browser, cause the status bar to perpetually say 'transferring data from yourdomain.com...' after making the request. It only seems to happen in Firefox, and only goes away if you switch to another tab and then return or if the application grabs some other kind of data from the server.

I also notice the other day(and haven't seen this documented anywhere), that the 3.1 beta has links in source code view. If you're a developer you're probably already intimate with hitting ctrl+u on windows, or command+u on mac to view the source code of a site. Well now when the site has linked javascript files you can just click on it in the source code and jump to viewing the source of that document. Where previously you would have to copy and paste the links to these files, visit them in your browser and then view source again. You can even use back/forward keybaord shortcuts to navigate the source.

picture-42

Adding Another Sidebar to Wordpress

Monday, January 5th, 2009

I'm using Wordpress 2.7 at the time of writing, but my theme is modified from the default theme of version 2.5 or something. My current sidebar uses the widgets feature with some manually added stuff, sort of a lazy way of customizing stuff. I keep adding stuff to it and now I need a second one, which will inevitably require a wider site but my analytics shows most people these days have more than the formerly standard 1024x780 screen resolution and so it should be fine.

So if you're in the same boat as me, hand me that paddle, I'll show you what I did.

In your theme folder open your functions.php file, and find the following code:

 
if ( function_exists('register_sidebar') )
register_sidebar(array(
'before_widget' => '
<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>
 
',
'before_title' => '
<h2 class="widgettitle">',
'after_title' => '</h2>
 
',
));
 

You may not have the above code, instead look for:

 
if ( function_exists('register_sidebar') )
register_sidebar();
 

In either case we want to replace it with the following:

 
if ( function_exists('register_sidebars') )
register_sidebars(2);
 

Note: changed sidebar to sidebars, and the number 2 indicates the total sidebars we want.

In your theme folder open your index.php file, and find the following code:

 
<?php get_sidebar(); ?>
 

Or depending on your theme:

 
<?php include(TEMPLATEPATH."/sidebar.php");?>
 

Since I want to add another right sidebar, add the following code below:

 
<?php get_sidebar('2'); ?>
 

Note: Anything between the ' ' is representative of the new file you have to create called in this case sidebar-2.php

Or in the later case for consistency you can instead add:

 
<?php include(TEMPLATEPATH."/sidebar-2.php");?>
 

The call for your sidebars in your index.php file should now look something like the following:

 
<div id="sidebar">
<?php get_sidebar(); ?>
<?php get_sidebar('2'); ?>
</div>
 

In my case since I already had a sidebar, the "sidebar" div was inside sidebar.php. As you can see from the code above, it needs to be in the index.php file. Change the div id in sidebar.php to "sidebar1", and in sidebar-2.php to "sidebar2".

Note: At this point you should see the two sidebars, and be able to add widgets or custom php. But it will likely appear below the other sidebar.

Since I have css rules for sidebar, and not sidebar1 or 2, I can just re-assign some of the rules to sidebar 1, create a similar set for sidebar two and adjust the overall body and content width. This all depends on your theme and where you want your new sidebar.


Adobe AIR 1.5 For Linux – Out Of Beta

Friday, December 19th, 2008

Adobe AIR 1.5 Linux was publicly released yesterday :

We released an alpha version of Adobe AIR for Linux today so now we’ve got some form of support for Mac, Windows, and Linux with the exact same code/.air file. I’ve been playing with it for a few weeks and it’s really impressive to see most AIR applications just work on Linux exactly the way they do on Mac or Windows. Linux support is one of the things I’m most excited about with AIR because I love using Ubuntu and I hope that a lot of the applications I use will be built on AIR so I can spend more time in Linux and have the same experience I do on Mac/Win.

We also announced we’re joining the Linux Foundation so we can help push the idea of RIAs on Linux. In addition to the AIR Linux release we also released an updated alpha version of Flex Builder for Linux so we’re hoping developers can both build AND consume RIAs on Linux.

We’re working on a 1.1 version of AIR that will include some localization as well as some bug fixes from the 1.0 release. The Linux 1.1 version will lag a little but but after 1.0 our plan is to release a Linux version of AIR together with Mac and Windows so all three platforms will have the same release cycle.

Download it http://get.adobe.com/air/

If you have the AIR Linux Beta installed, you'll have to remove it, and all your AIR apps or 1.5 won't install. Here's a step by step guide by the AIR Dev Team on how to do that [ http://blogs.adobe.com/air/2008/12/tips_on_resolving_application.html ].

Update:

After trying everything and racking my brain and the internet, I still couldn't get the installer to start. So I headed back over the the AIR Dev Team Blog and actually read the faq which plainly points out that AIR 1.5 doesn't work on the latest Ubuntu. If only I'd read that before I did a clean install of Linux Mint.

Will AIR run on newer versions of Linux distributions? For example, Adobe AIR's system requirements say Ubunutu 7.10, but I am running 8.10.
While we have not tested fully against newer versions of these distributions, we believe AIR should run fine in most cases. If you run into an issue, please send us a bug description using our feedback form and we will look into addressing it in a future version. For a list of our supported Linux distributions, please see our System Requirements page.

Flex 3-RegExp: Find Urls In Text And Html

Thursday, December 18th, 2008

There are a number of situations where you'd want to grab the urls from a block of text. For example you may be loading in some external or dynamic data and want to make the links clickable, or change their colour. Regular expressions are used in a multitude of languages; they define patterns that can be matched against a string, thus certain key characters used in defining a RegExp have to be escaped so they are interpreted as special characters like \d matches any digit. In Actionscript, you can define a RegExp by either wrapping it in double quotes "", or forward slashes//. In each case you would have to escape any characters that match the wrapping in addition to the characters that need to be escaped in the actual pattern. Further more Actionscript requires you to separate out the last part of the regular expression, called flags, and insert it as the second argument when defining a new RegExp object.

Here's how you find a url in text or html:

var str:String = new String('This is a url www.fightskillz.com, and this is another one: <a href="http://chalk-it-out.com">Chalk It Out</a>');
var reg:RegExp = new RegExp("\\b(((https?)://)|(www.))([a-z0-9-_.&=#/]+)", 'i');
var result:Object = reg.exec(str);
trace(result[0]);

First off if you're new to Flex/Actionscript you have to copy and paste this into a function and the variables created will only be accessable within that function while it's running as they are created and destroyed as it runs. If you wanted more permanence you'd just define the variables outside the function.

Now Let's break it down. The first \ is used as a character escape for Actionscript. In actionscript when defining a string within double quotes you'd escape a double that's part of the string like this "Look at this double quote \"". \b searches for a word boundary ie: a whitespace, or the beginning or end of a string.The next part ((https?)://)|(www.)) defines the first part of a 'word' that passes for a url. It's made up of two substrings, the first looks for http, the question mark deems the preceding character optional, so it'll match to https as well. It then looks to see if the protocol is followed by ://. The | character means OR, so if there is no protocol specified, it checks for (www.). Next we have [a-z0-9-_.&=#/] which is a list of characters a to z, 0 to 9, and various others commonly found in urls. This is followed by a + which instructs the pattern to match the preceding list of characters until it can't anymore. It can't anymore when it reaches whitespace, a single or double quote, brackets, or any other non-url character. Finally the RegExp flag i informs the pattern to be case insensitive.

reg.exec(str); executes the pattern on the specified string and returns the results as an array. Since the example is only designed to match the first url it encounters and then stop, the array will only have one result. The method reg.exec(str) is interchangable with str.match(reg)