20 April

Don’t be a Dick Public License

I just had to breath some life back into this classic from Phil Sturgeon. You can see the original post in its entirety at philsturgeon.co.uk.

And here we go the full license in its entirety!

 

License text

DON'T BE A DICK PUBLIC LICENSE
  Version 1, December 2009

  Copyright (C) 2009 Philip Sturgeon 
 
  Everyone is permitted to copy and distribute verbatim or modified
  copies of this license document, and changing it is allowed as long
  as the name is changed.

  DON'T BE A DICK PUBLIC LICENSE
  TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  1. Do whatever you like with the original work, just don't be a dick.

     Being a dick includes - but is not limited to - the following instances:

    1a. Outright copyright infringement - Don't just copy this and change the name.
    1b. Selling the unmodified original with no work done what-so-ever, that's REALLY being a dick.
    1c. Modifying the original work to contain hidden harmful content. That would make you a PROPER dick.

  2. If you become rich through modifications, related works/services, or supporting the original work,
     share the love. Only a dick would make loads off this work and not buy the original works 
     creator(s) a pint.
 
  3. Code is provided with no warranty. Using somebody else's code and bitching when it goes wrong makes 
     you a DONKEY dick. Fix the problem yourself. A non-dick would submit the fix back.

Related Posts:

  • No Related Posts

01 April

Half of U.S. Households Own At Least One Apple Device

Apple has taken firm root in America. Just over half of all households in the country own at least one Apple product, a new survey says, showing just how far the reach of the company has come in the last decade.

At the turn of the 21st century, Apple was in rough shape. It had narrowly avoided bankruptcy, and Steve Jobs’ return as CEO a few years earlier was turning the company around, but the market share of its products — then almost exclusively Mac computers — was dismal, at about 2% worldwide. Read Full Post »

Related Posts:

  • No Related Posts

03 March

Day 2: Windows 8 not ready for the masses

I have to say that I was very excited to finally get a chance to play with the new Windows 8 Consumer Preview bits this past week. I pulled down the ISO the morning of the release and installed it on an old Vista laptop I had. The install went great and the machine performed surprisingly good. So I thought why not running a little test with my wife as my subject. So that is what I have been doing.

After loading this machine I took her old laptop away and told her to use the new one. I have been observing her use of Windows 8 as she  attempts to use it in the normal manner she used her old Windows XP machine. I am actually quite amazed at the shear level of frustration she has had.

She first had an issue with one of the websites she uses frequently for creating photo books. Yes it is has a flash based editor. Once I got her going in the desktop mode she was fine for a short period of time. Then I began hearing grumblings of issues browsing our network. We quickly resolved these and were on to the next round of issues such as frequent hangs in the flash application she is using.

Today’s final failure was when she wanted to pull some photos off of her iPhone. We went to Apple’s website, downloaded iTunes and began the install process. Everything was going smoothly and then bam the installer just quit installing. It remained in the state for well over 5 minutes before she clicked cancel. Doing so had no effect so she then attempted to restart the machine. It sat on the logging out screen for several more minutes until finally a hard reset was done.

Seeing her frustrations too date leads me to believe that Windows 8 in its currently released state is not ready for the masses. This mixture of Metro and desktop mode is quite confusing to the average user and I believe is a major flaw that needs to be addressed before the final bits are RTM’d.

I plan on continuing to watch her usage until she finally tells me to give her old laptop back.

Related Posts:

29 February

Windows 8 Consumer Preview Available For Download

Yes you read correctly you can now download the ISO for the Windows 8 Consumer Preview at http://windows.microsoft.com/en-US/windows-8/iso. I will be doing some write-ups on it as I begin to explore it. I would love to hear your initial thoughts and opinions on this beta build.

 

Related Posts:

  • No Related Posts

29 February

Windows 8 Consumer Preview bits today

We should be getting bits for the Windows 8 Consumer Preview (aka beta) today. I have heard many good things with the features build out and stability and am quite excited to play with it on my tablet and an old laptop. As soon I hear of the release I will be providing a link to the download on this blog. Get yourself a Windows tablet today and enjoy the feeling of touch and Windows 8.

Related Posts:

  • No Related Posts

13 February

Fixing MVC 3 Html.DropDownListFor selected item

I recently ran into an issue with when using the SqlFunctions.StringConvert function (as required by LINQ to cast scalars to a string). What I didn’t realize at first is that the StringConvert function pads the string that it casts to. As it turns out this causes some issues with defining a selected item in the list.

To best describe this issue it is probably best to quickly walk through an example of how I ran into this and resolved it.

The Problem

The editor is to provide a drop down list of available options for a given property on the Entity being edited. In my case this was a POCO being used with the Entity Framework. Straight forward enough. I started with the following in my view model.

public class foo
{
  public MyObject MyObject { get; private set; }
  public List MyObjects{ get; private set; }

  public foo(int id){
    this.MyObject = MyObjectRepository.GetById(id);
    this.MyObjects = (from c in MyObjectRepository.All
                      where c.Id != id
                      select new SelectListItem {
                        Text = c.Name,
                        Value = SqlFunctions.StringConvert((double)c.Id)
                      })
                      .ToList());

  }
}

In my view I had the following code.

 @Html.DropDownListFor(m=>m.MyObject.ParentID, Model.MyObjects)

MyObject has a property that references its parent, if it has one. This is the trigger for our selected item.

Upon running this code I quickly noticed that the parent was not being selected. I looked and the LINQ statement was getting the correct ID’s and the ParentID was correct. So what was happening?

Well as it turns out the StringConvert functions casts the Id to a padding string and adding a call to the Trim function fixed everything. This is definitely a bit clunky in my opinion. Why did the LINQ team not let us simply cast our scalars using the ToString function?

Well that is it, below is the final LINQ statement that worked for me.

    this.MyObjects = (from c in MyObjectRepository.All
                      where c.Id != id
                      select new SelectListItem {
                        Text = c.Name,
                        Value = SqlFunctions.StringConvert((double)c.Id).Trim()
                      })
                      .ToList());

Related Posts:

  • No Related Posts

10 February

EF 4.2 Update POCO with ObjectContext

I recently worked on a project that used the Entity Framework and T4 POCO generation. I ran into a little snag during the implementation of the Repository pattern that took a few minutes for me to figure so I thought that I would save someone else the time and share here.

First let’s start off with the Interface.

  public interface IRepository : IDisposable
  {
    IQueryable All { get; }
    T GetById(int id);
    void Add(T model);
    void Update(T model);
    void Delete(T model);
    void Save();
  }

Next we’ll look at my first try at the concrete implementation of the Update method. The DataContext is a private property containing a reference to the object context object.

  public class MyRepository : IRepository
  {
    public IQueryable All { get{...} }
    public MyEntity GetById(int id) {...}
    public void Add(MyEntity model) {...}

    public void Update(MyEntity model)
    {
      DataContext.Users.Attach(model);
      if (model.Id == null )
      {
        // no UserId denotes new object to the database.
        DataContext.ObjectStateManager.ChangeObjectState(model, System.Data.EntityState.Added);
      }
      else
      {
        // object is not new. We need to get the original object and apply original values.
        // Applying current or original values, changes the state
        // of the attached object to Modified.
        var originalObject = GetById(model.UserId);
        DataContext.ApplyCurrentValues("MyEntities", originalObject);
      }

      Save();

    }

    public void Delete(MyEntity model) {...}
    public void Save() {...}
  }

Everything looked good to me so I ran a quick test set. To my surprise the Update method was failing. Why would this be? Well as it turns out since I was generating my POCO’s I needed to set the EntityState to Modified manually. So added the line below after the ApplyCurrentValues call.

DataContext.ObjectStateManager.ChangeObjectState(model, System.Data.EntityState.Modified);

I fired up the test cases once again and was happy to see all tests passed.

Well that is it, I hope that this post helps you and others in the future.

Related Posts:

  • No Related Posts

10 February

Windows 8 Consumer Preview February 29

By all accounts Microsoft will be releasing Windows 8 Consumer Preview at the Mobile World Congress (MWC) in Barcelona. A few sources are stating that build 8250 will be the bits released.

At Windows8Beta.com confirmation has been made that build 8227 has been compiled and is quite stable. This is great news if Microsoft is to have any chance of getting Windows 8 running on device yet this year.

In a recent post on Building Windows 8 Blog, Microsoft in a video showcased many apps for Windows 8 on Arm (WOA). The results appear to be pretty impressive. What is even more exciting is the demo of Office 15 on ARM (3:54) was shown along with a few more features and things to expect from the consumer preview. In the video, they also momentarily, showed how Google’s services work with Windows 8 and the Windows Store even makes an appearance.

I don’t know about you but I am very excited to get my hands on this upcoming build!

Related Posts:

  • No Related Posts

01 February

Kinect for Windows is here!

kinect

Kinect for Windows Hardware buy yours today on Amazon

YES it is here! Today Microsoft announced they have officially released the Kinect for Windows SDK and Hardware and yes it is commercial friendly. Check out this quote from the Kinect for Windows FAQS.

The Beta license was restrictive and did not allow for distribution of commercial applications. How does the license work with this release?

The commercial license for this release authorizes development and distribution of commercial applications. The prior SDK was a beta, and as a result was appropriate only for research, testing and experimentation, and was not suitable for use with a final, commercial product. The new license will enable developers to create and sell their Kinect for Windows applications to end user customers using Kinect for Windows hardware on Windows platforms.

Now all you have to do is get started developing your kick a$$ application and use it commercially. I know I already have several ideas I have been playing with. Join me in helping to change the way the world interacts with PC’s by developing your very own Kinect for Windows application.

Here are some quick links to help you get started.

Download the Kinect for Windows SDK: http://goo.gl/ieHKn.

Download the Kinect for Windows run-time for distribution: http://goo.gl/4W3I3.

Getting started with the Kinect for Windows resources section http://goo.gl/SmdgZ.

Needing hardware? Makes sure to get yours ordered soon as I am sure supplies will be limited initially. Here are a few helpful links to get you going.

Buy Kinect for Windows

Kinect for Windows

Need the farther throw of the original?

Buy Kinect for Xbox

Microsoft XBOX 360 Kinect Sensor

Already have the Kinect and want a shorter depth of field (zoom)?

Buy Zoom for Kinect

Zoom for Kinect

Related Posts:

30 January

Kinect for Windows big event February 1, 2012

If you have been keeping up with the Kinect SDK for Windows then you are probably pretty excited about whats coming in just 2 days. If you have not been following it I recommend you visit the Kinect for Windows Blog. We are getting a 1.0 SDK and it looks like a Kinect with what they call near-mode. I am totally pumped and cannot wait to dive into the SDK and see what has changed and most importantly what is new!

Kinect

Related Posts:

  • No Related Posts