Speaking at the Dallas PHP User Group

On January 11, 2011 I spoke at the Dallas PHP User Group on the topic of the Kohana v3 MVC Framework and Facebook integration. The introductory slides are below. To download the sample code yourself, head on over to the GitHub project page. Scroll to the bottom of the GitHub page to see the instructions on how to install it on your own server. An example site is available for you to view the running code on the Internet.


First Impressions with Google’s Cr-48 Chrome OS Netbook

On December 7, 2010, Google announced their Chrome OS Notebook reference hardware, the Cr-48 (a bit of a chemistry joke). They also announced a pilot program, by which participants would receive a free netbook running the release version of Chrome OS, with the understanding that the user would provide Google feedback about the operating system. I immediately signed up, since I was listening to the live broadcast of the announcement.

When they announced the pilot program, they put a QR code on the screen at 1:20:24 on the applicable slide. I scanned the QR code using my iPhone and it took me to a signup page. After filling in the information it thanked me for my information and said they would follow up or something. I didn’t think I’d actually get a notebook, but on the following Thursday, people all across the United States started receiving Cr-48s; I hoped I would be one of them. By the end of the day, I was very disappointed.

However, late in the afternoon on Friday, December 10, 2010, I went out to the mailbox to check the mail and a Cr-48 was sitting on my porch.

Here is my initial video right after unboxing:

Additionally, I took pictures of the unboxing, in case anyone cares, because I was so excited (click to see the album):

chromeosalbum

 

Initial thoughts

  • The setup process confused me because I kept tapping to click. I didn’t know you needed to press down hard to click the actual trackpad itself. The entire trackpad is a physical button. This is apparently common to Apple notebooks, I have been told. After the setup process, you can change this in settings to allow “tap-to-click”.
  • It boots up from a power-off state really quickly.
  • It came with at least half a charge. Thanks Google!
  • It takes awhile to set up the free Verizon 100MB data. They really need your information first; I assume this is to address DMCA/child pornography type violations, so they can associate an IP with a physical person.
  • It wakes from sleep instantly, just like in the presentation.
  • The keyboard is insanely good, and all the letters are lower case: an odd touch, not that I spend most of my time looking at the keyboard.
  • In the car at night, I did find myself wishing the keyboard was backlit, so I could see some of the new buttons they’ve replaced, like the function keys.
  • It bogs down really hard on internet videos that are not from you-tube. Comedy Central works fine. Hulu and NBC do not work well at all. They get very choppy. None of these are in HD.
  • YouTube has no option to enable HD. I even tried to force it with “hd=1” in the URL and it ignored it, forcing 480p. I knew it wouldn’t be good, but I wanted to test it and they won’t let me.
  • Logging into the netbook logs you into your Google Account. You don’t have to log in anymore for things like YouTube, Gmail, Reader, Voice, and all the other things that Google runs in my life (Latitude, etc).
  • It’s heavier than it looks; I haven’t weighed it yet, but I’m sure that info is already out there.
  • There was nothing I wanted to do on it that I wasn’t able to do with a webapp or a webpage yet. I even set up IRC through IM+ and IRC through Mibbit.
  • The back on the bottom gets a bit warm after extended use.
  • The battery seems to last forever, but takes awhile to charge.
  • You don’t seem to be able to login with Google Apps accounts. My girlfriend could not login, even when I’d added her ID as a valid ID for use with the Netbook in settings.

If anyone has any questions I haven’t addressed, please ask them in the comments and I’ll answer in my next blog post.


Hosting Windows Workflow Foundation in a Console Application without Ugly Code

I’ve been using Windows Workflow Foundation for a small personal project to learn more about it and see what it can do. It’s pretty powerful and I’m looking forward to delving more into it. For my purposes though, I’m hosting the workflow in a console program.

If you look around the internet, you’ll see lots of examples of hosting a sequential workflow in a synchronous manner, even though the WorkflowRuntime only support asynchronous operations. That code usually looks like this (example adapted from wf-training-guide.com to add support for input/output arguments):

static void Main(string[] args)
{
  Dictionary<string, object> inputArguments = new Dictionary<string, object>();
  inputArguments.Add("Argument1", args[0]);
  Dictionary<string, object> outputArguments;
    
  // Create the WF runtime.
  using(WorkflowRuntime workflowRuntime = new WorkflowRuntime())
  {
    // Hook into WorkflowCompleted / WorkflowTerminated events.
    AutoResetEvent waitHandle = new AutoResetEvent(false);
    workflowRuntime.WorkflowCompleted
      += delegate(object sender, WorkflowCompletedEventArgs e)
        {
          outputArguments = e.OutputParameters;
          waitHandle.Set();
        };

    workflowRuntime.WorkflowTerminated
      += delegate(object sender, WorkflowTerminatedEventArgs e)
        {
          Console.WriteLine(e.Exception.Message);
          waitHandle.Set();
        };

    // Create an instance of the WF to execute and call Start().
    WorkflowInstance instance =
      workflowRuntime.CreateWorkflow(typeof(WorkflowClass));
    instance.Start();

    waitHandle.WaitOne();
  }
}

Unfortunately, that’s a ton of code to do only a few things:

  1. Take input arguments
  2. Instantiate a WorkflowRuntime
  3. Create a workflow instance
  4. Run the workflow
  5. Handle any exceptions (poorly)
  6. Return output parameters from the workflow
  7. Do all of this in a synchronous manner.

What if we could just call a method similar to this:

var outputArguments = RunWorkflow<WorkflowClass>(arguments, completedEvent, terminatedEvent);

Well, now you can! I’ve written this wrapper class to allow exactly that:

public class WorkflowManager
{
  public static Dictionary<string, object> RunWorkflow<T>(
    Dictionary<string, object> arguments,
    EventHandler<WorkflowCompletedEventArgs> completedEvent,
    EventHandler<WorkflowTerminatedEventArgs> terminatedEvent)
    where T : SequentialWorkflowActivity
  {
    using (WorkflowRuntime runtime = new WorkflowRuntime())
    {
      Dictionary<string, object> returnValue = null;
      Exception ex = null;

      using (AutoResetEvent waitHandle = new AutoResetEvent(false))
      {
        WorkflowInstance instance = runtime.CreateWorkflow(typeof(T), arguments);
        runtime.WorkflowCompleted += (o, e) =>
        {
          EventHandler<WorkflowCompletedEventArgs> temp = completedEvent;
          if (temp != null)
          {
            temp(o, e);
          }

          returnValue = e.OutputParameters;

          waitHandle.Set();
        };

        runtime.WorkflowTerminated += (o, e) =>
        {
          EventHandler<WorkflowTerminatedEventArgs> temp = terminatedEvent;
          if (temp != null)
          {
            temp(o, e);
          }

          ex = e.Exception;

          waitHandle.Set();
        };

        instance.Start();
        waitHandle.WaitOne();
      }

      if (runtime != null)
      {
        runtime.StopRuntime();
      }

      if (ex != null)
      {
        throw ex;
      }

      return returnValue;
    }
  }
}

Now you really can run the above code to execute your workflow in a synchronous manner without all kinds of messy code. Beware creating multiple WorkflowRuntime instances though. If you are managing multiple simultaneous workflows, you’ll need to pass in instance IDs and keep track in the runtime of which one is completing or throwing errors. It’s generally a bad idea to have multiple WorkflowRuntimes.

Enjoy now being able to write:

var outputArguments = RunWorkflow<WorkflowClass>(arguments, completedEvent, terminatedEvent);

Chase Visa Fraud

I just got a call from the Chase fraud computer voice. He told me that somebody had just charged my card about $250 to a clothing website called ASOS.com. He asked if it was me and I kept pressing zero so I could talk to a person. I knew if I said it wasn’t me that they would just close my card and send me a new one in about a week more or less.

I finally got a person (in India of course), and she told me that not only had they charged that to my card, but also $1.00 to Apple’s iTunes store on February 25th. I didn’t even see that show up in my online activity today on Chase’s web site, so I assume they deactivated the charge when they figured out it was fraud. I assume the Apple charge was to test the card for validity.

I told the lady that a week was unacceptable, because I put everything on that Chase Freedom card. I told her I needed it tomorrow. She obliged without any complaint; she said it will be here tomorrow via UPS and I will have to sign for it. I told her that’s no problem since I work from home.

Kudos to Chase for their aggressive, accurate anti-fraud algorithms and their customer service relating to shipping out a card overnight upon request.


Requirements Completed for Master of Business Administration

Those words in the title now appear at the end of my MBA transcript from Louisiana Tech University. I will graduate Saturday, March 6th, 2010 with a Master of Business Administration and a concentration in Information Assurance. There is nothing else left for me to do; school is over! If I hadn’t gotten the two B’s, I’d have a 4.000 average. Unfortunately, the school doesn’t do any cum laude stuff for graduate degrees.

 -----------------------Winter 2010-------------------------
 MGMT595 084  ADMINISTRATIVE POLICY        A    3.00  12.00
 UNIV610 001  GRADUATION - BUS GRAD             0.00
 -----------------------------------------------------------
 
                     AHRS    EHRS    QHRS    QPTS     GPA
      Current         3.00    3.00    3.00   12.00   4.000
      Cumulative     36.00   36.00   36.00  138.00   3.833
 
      Requirements completed for Master of Business
      Administration
 --End of Louisiana Tech University Graduate Transcript------