UTOS Hack Day!

UTOS is having another hack day! 

These are great events where you can show up and work on your own open source project, and get help, or you can show up and help with other open source projects.

This time they are giving away a Xoom tablet too! Why not go and try and win? That is all you have to do, is show up and participate, that is too easy!

Hope to see you all there!

New Xbox360 Media Remote

The Xbox 360 has been going strong with new media offereings, more games, and better titles than all the other consoles. Now they have announced a new media controller that looks to bring more solid proof that DVR functions and TV functions are destined for the set top box from Microsoft.

Xbox 360 Media RemoteThe new remote seen here as DVR style buttons including “Live TV” and “Guide”. It appears to also control the basic functions of a TV with TV Power, INPUT, DISP, Mute, Ch +/-, and Vol +/-.

The remote sports a nice sleek black design as well, instead of the stark white oddly shaped predecessor.

I like the new remote, and when the TV options for Xbox hit the consumer level, I will probably drop the funds to get this new remote.

MyGeekScore++

Ah yeah! I have finally done it! I have forked, committed, pushed, sent a pull request and now… I HAVE BEEN MERGED!

12:25 < Fuel-Bot> [oil] philsturgeon pushed 2 new commits to master: https://github.com/fuel/oil/compare/a8e1387…4be84aa                                                   eighty4
12:25 < Fuel-Bot> [oil/master] Making more use of the Form::label() in the scaffold builds – Adam Barrett                                                                    el2ro
12:25 < Fuel-Bot> [oil/master] Merge pull request #18 from utahcon/master – Phil Sturgeon

Today at 12:25MST my pull request for Oil was merged into the master line, which means it is gold!

$geekScore++;

Spotify on Linux

Now that I have a Spotify account I wanted to run the Spotify software on my machine. Although technically they don’t support Linux yet they have a repo for Fedora available. However I found a small problem when trying to install it on FC15, it isn’t supported, sorta.

Here is the repo file provided by Spotify:


[spotify]
name=Repository for the Spotify client
baseurl=http://repository.spotify.com/fedora/releases/$releasever/$basearch
enabled=1
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-spotify

When you install that repo file and try to update it automatically resolves to the baseurl


http://repository.spotify.com/fedora/releases/15/x86_64

which if you try and go to in a browser returns a 404, it doesn’t exist. This is the problem.

If you go to http://repository.spotify.com/fedora/releases/ you will see there are only options for 13 and 14, no 15 (or anything before 13).

The simple fix is this:


[spotify]
name=Repository for the Spotify client
baseurl=http://repository.spotify.com/fedora/releases/14/x86_64
enabled=1
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-spotify

Technically it is NOT the right version, but it does run well enough under FC15 that I am not worried, and easy enough to fix when they have a valid client.

UPDATE: Spotify for Linux will only work on paid accounts, no free trial run here, and I don’t want to worry about WINE, so I guess Spotify use will still have to wait.

New Pricing @ Netflix

Netflix has started down a slippery slope of making their awesome value not so awesome. Allow me to explain.

New Pricing

Netflix has announced that all accounts will change in pricing come September 1st (or before). The new pricing is:

  • $7.99 – For unlimited streaming
  • $7.99 – For 1 DVD at a  time
  • $15.98 – For unlimited streaming + 1 DVD at a time
  • $17.98 – For unlimited streaming + 1 DVD or Blu-Ray at a time
For reference I currently am subscribed to the 1 DVD/Blu-Ray + Unlimited Streaming for $11.98. That means I will be paying 50% more for the same service I am already getting.
Don’t get me wrong I know that Netflix has to cover costs, and heaven forbid make money, but I feel like the service is a bit on the steep side for the combo pack.

Netflix’ Reasons

The good folks at the Netflix blog have stated:

Last November when we launched our $7.99 unlimited streaming plan, DVDs by mail was treated as a $2 add on to our unlimited streaming plan. At the time, we didn’t anticipate offering DVD only plans. Since then we have realized that there is still a very large continuing demand for DVDs both from our existing members as well as non-members. Given the long life we think DVDs by mail will have, treating DVDs as a $2 add on to our unlimited streaming plan neither makes great financial sense nor satisfies people who just want DVDs. Creating an unlimited DVDs by mail plan (no streaming) at our lowest price ever, $7.99, does make sense and will ensure a long life for our DVDs by mail offering. Reflecting our confidence that DVDs by mail is a long-term business for us, we are also establishing a separate and distinct management team solely focused on DVDs by mail, led by Andy Rendich, our Chief Service and Operations Officer and an 11 year veteran of Netflix.

That seems fair, if you aren’t making the money then you aren’t making the money, and you have to adjust.

Now I am not saying I want Netflix to loose money, and I am not saying I want them to give me things for free. However I feel that after several years of being a happy customer and praising them for things they have done right, and fighting for them when they are loosing the battles with Hollywood, that we should be treated as something better than a common customer when it comes time to split services.

I am sure having insight to the numbers of cost of streaming vs DVD rentals, and such would make it easier to accept their argument but honestly I feel like it is a steep price change from $12/month to $18/month.

Pricing Suggestions

I personally think that the base prices of $8/month for each service is fair. If you only want DVDs, fine, $8. If you only want instant streaming $8. However I feel as though we are not being given incentive to purchase both packages from Netflix anymore.

A simple example is a family like mine. We have the full package now for $12/month and on average we watch 1 DVD a week. For the suggested $6 price hike I could instead opt for the instant streaming service only and take my $8 to RedBox and get 8 movies where I would get 4 with Netflix. The difference of course is I have to do a little leg work to find the DVD I want and go and get it, instead of having it mailed to me from Netflix.

My suggestion to Netflix would be, offer either package as an add-on for a discounted price, even $2 off would make it seem like a damn good deal.

  • $7.99 for Streaming
  • $7.99 for DVD
  • $13.98 for Both
  • $2/month to add BluRay
That would make my family situation $15.98 for the whole package. Still only saving me on the entire process $2, but that is a more affordable plan in my eyes and more competitive with the market (Blockbuster Express, and RedBox).
Netflix’ Move
I am sure Netflix won’t give a second thought to this plan, and it seems like a majority of people are ok with it, but I think Netflix will find more customers will opt for 1 of the two plans rather than both, and save their hard earned dollars for use at a RedBox or Blockbuster Express to get the new releases and the exact movie they want, the day they want to watch it.
I think I should also note that if Netflix offered a better catalog of newer movies in their instant streaming packages, then they would see that DVD shipments would drop drastically. I think it time they go down to Hollywood and bash in some heads to get the new releases available sooner, as in at all.

FuelPHP: My new favorite framework

I have posted on FuelPHP once before, and I think it is time I share more about it and why I have chosen it as my PHP Framework of choice.

From FuelPHP.com:

Fuel is a simple, flexible, community driven PHP 5.3 web framework based on the best ideas of other frameworks with a fresh start.

How much clearer can they get?

The Geeks Behind FuelPHP

Dan Horrigan, Phil Sturgeon, Jelmer Schreuder and Harro Verton. If those names mean nothing to you, let me shed some light.

Dan Horrigan

Coding in PHP for 10+ years Dan has contributed to projects like CodeIgniter and PyroCMS, as well as PancakeApp.

Phil Sturgeon

Another great mind behind CodeIgniter. Just look at Phil’s blog, he has done it all!

Jelmer Schreuder

Look through Jelmer’s Github and you can see he is quite experienced as well. He is also super friend in the #fuelphp channel on Freenode.

Harro Verton aka WanWizard

After a long and sordid past as a mainframer he has found roots in programming and contributes a lot of support in #fuelphp as well. He has personally helped me through some of the beginning steps of using FuelPHP.

To all the geeks involved in FuelPHP, a huge thanks!

What Make Fuel Different?

Fuel is young, under a year as of this writing, but already it has seen support and contributions from 30+ developers. The maintainers are really open to anyone committing code cause they believe that since we all use it, we all deserve to support it. Or something like that. Basically if you use it and identify a bug, and you can fix it, then they will let you.

That is probably the best thing about this young framework is the amount of involvement everyone has. Being open source and hosted on GitHub anyone can get the source, and anyone can submit a pull request for changes to the code. I have personally been watching the commits in the IRC channel and I can attest that they are sincere in saying that things are getting done. And fast!

What Make Fuel Awesome?

Gleaming from other great frameworks (and languages) Fuel has been given some great tools. Like Oil.

Oil

Oil is a utility for the CLI that allows you to Generate code, Refine (run tasks, more on this later),  Package (install, update and remove packages) and Console (test code).

Tasks

Tasks are classes that can be run through the command line or set up as a cron job. They are generally used for background processes, timed tasks and maintenance tasks. Tasks can calls models and other classes just like controllers.

Because Tasks actually use the whole framework you can write scripts using the native language of FuelPHP and all things work. All the controllers, all the helpers etc are available to the user.

Lightweight

Autoloading is fun, and useful, but you don’t want to load everything everywhere. Fuel has an extensive (and configurable) configuration to allow you to only load what you want when you want.

Docs

The documentation is a ongoing project, and no where near perfect right now, but it certainly is coming along. Don’t take that to mean it isn’t helpful, cause it absolutely is! Also you can update the docs and commit the changes to the project ;)

ORM and Active Record or just DB

ORM has been done, and done again. FuelPHP has an ORM, or you can opt for ActiveRecord, or if you don’t like either of those you can just use good old SQL. Fuel is flexible and this is a great example of how flexible they really are.

Why Not?!

If you haven’t been sold by my simple blog post on Fuel, then perhaps you need to play with the framework yourself. You can get it from http://fuelphp.com or  from GitHub.

What’s Next?

I am working on a series of blog posts showing how to do things with FuelPHP, so keep tuned for those.

1 Tech Post Challenge

Why The Face?

A little over a week ago I made the suggestion in #utos that we should encourage all #utos members to post at least 1 tech-centric blog post a week. This will inspire a lot of good conversation, put more of us on the map as to people we can turn to for solutions, and also help each of us learn more. So I am taking the initiative to write my first tech-centric blog post.

Although the details aren’t worked out yet, it’s time to start thinking about things you can post about, and don’t worry it doesn’t have to be an IBM Knowledge base article. Simply write about what you love, or have been thinking about, or studying.

As there are more details about the challenge, I will post them here, and I will see that they get posted with the #utos team, so we can all participate and get cool things in return!

Ok, enough yapping, I have tech blog posts to write!

Timezones in FuelPHP

Just thought I would make a note that if you are seeing weird timezones in your FuelPHP programs that you should checkout fuel/app/config/config.php around line 72


/**
 * DateTime settings
 *
 * server_gmt_offset    in seconds the server offset from gmt timestamp when time() is used
 * default_timezone        optional, if you want to change the server's default timezone
 */
'server_gmt_offset'    => 0,
 'default_timezone'    => 'America/Denver'

I have already set these to my local timezone of  ‘America/Denver’ but you can simply comment them out and the default from your php.ini will take effect.

E3 Keynotes: And the winner is…

First, I feel I should admit to not actually attending E3, I can’t afford that kind of ticket, and I have no real ties to media.

That out of the way, let’s talk nerdy.

Microsoft

Microsoft didn’t make any really amazing announcements this year except that their already solid platform is getting even more refined with better support for the Kinect, both in the core element (dashboard) and from game developers.

Lots of new titles with Kinect support, including shooters, fighters, and more. That should be awesome to see flesh out. I am personally excited to try my hand at Madden 12 and FIFA 12, and in the past I have ignored and even ran  away from sports titles cause I hated the controls. Now that I can actually “play” these games I may give it another try.

Microsoft is also bringing TV offerings to the Xbox environment. I haven’t seen many details about when or how or what it will cost, but I am sure the details are out there somewhere.

Kinect has been really refined and Microsoft really doesn’t want you to use the controllers unless you must and so all things are now navigable by voice alone. Good work Microsoft!

The only critic I have, and have had for a while, is they need to open up the SDK and access to the environment. I am not at all surprised they are keeping this garden walled, but it would be fun to have the SDK and develop apps for their system.

Sony

Personally I think Sony had nothing of real excitement. They revamped the PSP, gave it a bigger screen, more power, and 3G. So now there will be more to clog the wireless intertubes of the world. The rest of the keynote was “We fixed things, and here are some more titles that use our Wii like controller”

Nintendo

Ok, I get that Nintendo really made this whole gaming world what it is today. We all owe a lot of gratitude to them for making the NES, the Gameboy, the DS, the 3DS, and the Wii. However, just because you “innovate” doesn’t mean you should do this one Nintendo. The Wii U is stupid. My opinion may change when I have a chance to play with the system, but really it is a dumb idea from where I sit.

Basically the Wii U is a new console with HD support. About time. Add to that they gave you a controller with a 6.2 inch screen. So now your HDTV becomes the top half of a really elaborate DS and the controller is the bottom half. The second screen gives you a lot of neat things to build off of and some of the demo videos show some neat concepts. But as my good friend Monnok said it

Oh shit, we cant beat NO controller.. how about we make ours bigger and more unwieldy and just call it better?

I will give some respect to Nintendo and let them finish fleshing out the world of Wii U, but I can’t see myself purchasing one in the near future.

And the winner is…

Microsoft. Although they really didn’t bring anything new or amazing to the table, they are perfecting their already awesome idea of removing the controller entirely from the picture. They have even started allowing titles that merge the existence of the controller with Kinect. That is going to be a really big winner in my mind.

I think the Kinect experience can still get better, and I think we will only see that over the next year or so while Microsoft prepares the next level of console.

Code Igniter: Hooks

Code Igniter is a great framework, and has some awesome documentation for a lot of what it does, but one place it lacks is in Hooks. What are hooks, how are they used etc, it is explained but not really. So I thought since I just accomplished an awesome example of when to use Hooks in a CI project, I would share it with the world.

What are Hooks?

I’m going to let the folks at Code Igniter field this one:

CodeIgniter’s Hooks feature provides a means to tap into and modify the inner workings of the framework without hacking the core files. When CodeIgniter runs it follows a specific execution process, diagramed in the Application Flow page. There may be instances, however, where you’d like to cause some action to take place at a particular stage in the execution process. For example, you might want to run a script right before your controllers get loaded, or right after, or you might want to trigger one of your own scripts in some other location.

So to clear that up, Hooks let you change the way Code Igniter works, without changing Code Igniter.

10K ft view:

So the problem I had recently was a page that loads a CSS class only when the user selects to change the theme. However it had to be done through a link and had to set the preference in the session to be stored throughout the users session.

To accomplish that I had planned to create a simple controller action called setCssTheme and pass the theme the user had selected. The only problem was I needed to send the user back to the page they had come from, and in some cases the referrer was not being set (different browsers handle things differently).

In order to solve this last problem I had decided to set in the session the last page visited on each page load. This works great in a constructor of a particular class but what if you want to do that site wide, on every single page load like I do?

Force all your site through a single controller? I think not.

Force all your controllers to have this same piece of code? I think not.

Let’s get DRY (Don’t Repeat Yourself).

The solution I decided on was using Hooks in Code Igniter to Hook the system process and set in the session the current page I am on. In order to be able to do this I have to be able to write to the session before the headers are sent to the browser, and so I had to choose the appropriate hook point. CI gives you the follow points to hook in:

  • pre_system
    Called very early during system execution. Only the benchmark and hooks class have been loaded at this point. No routing or other processes have happened.
  • pre_controller
    Called immediately prior to any of your controllers being called. All base classes, routing, and security checks have been done.
  • post_controller_constructor
    Called immediately after your controller is instantiated, but prior to any method calls happening.
  • post_controller
    Called immediately after your controller is fully executed.
  • display_override
    Overrides the _display() function, used to send the finalized page to the web browser at the end of system execution. This permits you to use your own display methodology. Note that you will need to reference the CI superobject with $this->CI =& get_instance() and then the finalized data will be available by calling $this->CI->output->get_output()
  • cache_override
    Enables you to call your own function instead of the _display_cache() function in the output class. This permits you to use your own cache display mechanism.
  • post_system
    Called after the final rendered page is sent to the browser, at the end of system execution after the finalized data is sent to the browser

From those you can see the logic answer is to hook the post_controller so that our controller has a chance to do it’s work, and then to hack in out changes for the session, in this case add data to it.

How To:

Time to put rubber to the road, here is what I had to do to accomplish this task:

  1. Enable Hooks
  2. Configure Hook
  3. Write Hook

Enable Hooks:

To enable the hooks you simply edit

application/config/config.php

and find the line:

$config['enable_hooks'] = false;

and change it to:

$config['enable_hooks'] = TRUE;

Configure Hook:

Now in application/config/hooks.php you need to tell the system what file path, file, controller, method, and parameters you want to run on the hook.

$hook['post_controller'] = array(
  'filepath' => 'hooks',
  'filename' => 'SessionHelper.php',
  'class' => 'SessionHelper',
  'function' => 'setCurrentPage',
  'params' => array(),
);

Here I tell CI that when the controller is done, load hooks/SessionHelper.php and fire off SessionHelper->setCurrentPage() (more or less).

Then I created the file mentioned above as follows:

class SessionHelper extends CI_Hooks {
  public $CI;

  function __construct() {
    parent::__construct();
    $this->CI = get_instance();
  }

  function setCurrentPage(){
    $this->CI->session->set_userdata('current_page', current_url());
  }

This simply loads the current_url() into the session userdata.

Now on every final page load (redirects won’t be caught if they are in the controller) the current_url is stored in the session. So I can check values and redirect back to the current page if needed.