RSS 2.0
# Wednesday, January 12, 2011

Ok, so maybe that’s not correct … do Roman numerals even have decimals.  Hmmm… maybe I should have paid a bit more attention in that class. In Part I we set up our classes and data access “layer”.  Thanks to ErikEJ letting me know of a provider that he – uh – provided for SQL CE, we’ll integrate that in.  Since this wasn’t in the original plan, we’ll call this I.V or 1.5.  Smile

You can go get the files from here.  I’m just going to include the files rather than the binary.  I found an issue in the SqlCeMembershipUtils.cs file in the CreateDatabaseIfNeeded method.  It has to do with how the path shows up.  When checking for the file, the connection returns the following for the Database (path) property, which of course is not the path to the actual sdf file.  The connection works however.

image

So, I’ve modified that method like so:

        public static void CreateDatabaseIfRequired(string connection)
        {
            string dataDirectory = AppDomain.CurrentDomain.GetData("DataDirectory") as string;
            string physConnectionString = connection.Replace("|DataDirectory|", dataDirectory);
            string[] parts = connection.Split('|');
            string physFileString = Path.Combine(dataDirectory, parts[parts.Length - 1]);

            string sdfPath = string.Empty;
            lock (_lock)
            {
                using (var testConn = new SqlCeConnection(physConnectionString))
                {
                    sdfPath = testConn.Database;
                }
                if (string.IsNullOrWhiteSpace(sdfPath))
                    return;

                if (!System.IO.File.Exists(physFileString))
                {
                    //OK, try to create the database file
                    using (var engine = new SqlCeEngine(connection))
                    {
                        engine.CreateDatabase();
                    }
                }
                ValidateDatabase(connection);
            }
        }

You will of course need to modify the connections in web.config for the membership provider and add using System.IO; to the top.  The other option would be to skip the file check and just eat the exception if it’s because of the file already existing.

Technorati Tags: ,
Wednesday, January 12, 2011 7:42:48 PM UTC  #    Comments [2] -
Entity Framework | mvc
# Saturday, January 08, 2011

If you haven’t already, go install mvc 3 RC.  This will also install NuGet which we will be using.  You can read more about mvc 3 and NuGet on ScottGu’s blog.

Create a new MVC 3 Web Application and use Razor for the view engine.  Probably a good idea to tick on the unit test box to create unit tests.

image

Next get the Package Manager Console open.  View | Other Windows | Package Manager Console

Now we want to install the Entity Framework Code First libraries.  NuGet makes this very easy:

image

The console window support auto-completion, so just type Ins [TAB] and a list of options will show. Choose Install-Package then type EFC [TAB] to choose through a list of packages.  Couldn’t be easier.  I’m not going to go into details about what that does, you can read all about it in ScottGu’s posts and the video of Scott Hanselman’s talk.

In our first post in the series, our first goal was to make a quick site.  Doing it quickly means we are going to let the Entity Framework create the database for us.  We will also be using SQL CE so there won’t be a full database dependency.  SQL CE 4.0 is now bin deployable, so we can just copy it up and it’ll work.

EF, much like MVC, uses convention over configuration.  So, since our context (code to follow) is going to be named Cookbook, if we create a connection string entry called Cookbook, EF will automatically use that.

  <connectionStrings>
    <
add name="Cookbook" connectionString="Data Source=|DataDirectory|KimmysCookbook.sdf" providerName="System.Data.SqlServerCe.4.0"
/>
  </
connectionStrings>

As an aside, if you don’t create a connectionstring at all, EF CTP5 will create a Sql Server CE 4.0 database under the App_Data directory for you using the fully qualified type name as the name of the database.

Now for our Context class.  We’ll create each of our supporting classes as we go.  Right click on the Models folder and add a class.  As you are typing, as you put in the classes for the generic collections, pressing Ctrl-. will present you with a context of options.  Since the classes won’t exist yet, you can have VS create the classes for you right then.  They will of course be empty, but the shell is there.  VS is also intelligent enough to put them in the same folder as the current class with the same namespace.  So, when you type public DbSet<Recipe, you’ll get a squiggly saying that Recipe doesn’t exist.  Ctrl-. and choose to have it create the class for you.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;

namespace KimmysCookbook.Models
{
    public class Cookbook : DbContext
    {
        public DbSet<Recipe> Recipes { get; set; }
        public DbSet<Ingredient> Ingredients { get; set; }
        public DbSet<Comment> Comments { get; set; }
        public DbSet<Favorite> Favorites { get; set; }
        public DbSet<Tag> Tags { get; set; }
        public DbSet<Rating> Ratings { get; set; }
    }
}

The above context class is all that is needed for data access.

Let’s fill in the rest of our classes.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace KimmysCookbook.Models
{
    public class Recipe
    {
        public int ID { get; set; }
        public Guid UserID { get; set; }
        public string Title { get; set; }
        public string Description { get; set; }
        public long PrepTime { get; set; }
        public long CookTime { get; set; }
        public int Serves { get; set; }
        public string Instructions { get; set; }
        public string IPAddress { get; set; }

        public virtual ICollection<Ingredient> Ingredients { get; set; }
        public virtual ICollection<Tag> Tags { get; set; }
        public virtual ICollection<Comment> Comments { get; set; }
        public virtual ICollection<Rating> Ratings { get; set; }
        public virtual ICollection<Favorite> Favorites { get; set; }
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace KimmysCookbook.Models
{
    public class Ingredient
    {
        public int ID { get; set; }
        public int RecipeID { get; set; }
        public string Name { get; set; }
        public string Description { get; set; }
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace KimmysCookbook.Models
{
    /// <summary>
    /// This is for user based tagging
    /// </summary>
    public class Tag
    {
        public int ID { get; set; }
        public int RecipeID { get; set; }
        public Guid UserID { get; set; }
        public string Value { get; set; }
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace KimmysCookbook.Models
{
    public class Comment
    {
        public int ID { get; set; }
        public int RecipeID { get; set; }
        public Guid UserID { get; set; }
        public string Text { get; set; }
        public string IPAddress { get; set; }
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace KimmysCookbook.Models
{
    /// <summary>
    /// This is to tag a recipe as a favorite for a user
    /// </summary>
    public class Favorite
    {
        public int ID { get; set; }
        public int RecipeID { get; set; }
        public Guid UserID { get; set; }
        public DateTime DateFavorited { get; set; }
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace KimmysCookbook.Models
{
    public class Rating
    {
        public int ID { get; set; }
        public int RecipeID { get; set; }
        public Guid UserID { get; set; }
        public int Value { get; set; }
        public DateTime RatingDate { get; set; }
        public string IPAddress { get; set; }
    }
}

You’ll notice in the classes that the UserID field is a Guid. In this iteration, we are going to use the Membership provider that is baked into asp.net. In a future release, we plan to use OpenID instead. That being said and to keep it simple, we want to have the membership baked into the database that EF is going to create.  Unfortunately, SQL CE 4 still doesn’t support stored procedures so the current implementation of membership won’t work with it.  According to ScottGu’s post, they are looking into create a set of providers that will work with it. 

Technorati Tags: ,
Saturday, January 08, 2011 8:22:55 PM UTC  #    Comments [2] -
.NET | Entity Framework | mvc | SQL Server
# Monday, December 27, 2010

Years ago I purchased the domain KimmysCookbook.com as a joke.  A friend on facebook had posted a picture of her taking a turkey out of the oven and a bunch of us started commenting on it and eventually the domain came to be.  She is a good cook, the joke wasn’t about her cooking, just about making a cookbook.

Anyway, I never did anything with it really, just posted that picture and let it sit.  Got to thinking that it would be a cool recipe site and with all the new stuff coming out of Redmond recently, why not take the time to build it up piece by piece using these technologies. 

I’ve been toying with the idea for a while, so I’ve already created a database locally for storage, but since we are looking to use new technologies and also doing it on the cheap and fast, we’ll use EF4’s code first ability tied with SQL Server CE 4.

Here’s the path I’m looking to take.  Each of these will be a separate iteration and push to the server.

  1. Quick ASP.net MVC 3 with EF4 code first site
  2. Add Silverlight support for ingredient editing
  3. Add OData support
  4. Silverlight out of browser with touch support
  5. Windows Phone 7 application

As with any project, these items may change as we go along.  Next entry will outline step 1.

Monday, December 27, 2010 7:58:51 PM UTC  #    Comments [0] -
mvc | Silverlight | Windows Phone 7
# Monday, December 13, 2010

Registering your phone for development requires the use of Windows Phone Developer Registration tool.

image

In Windows 7, hit the Windows key (or start button) and type “reg”.  It should show up as one of the first items in the list.

You will want to have you phone tethered to your machine and unlocked if you use a PIN.  As it states, you must have an active account developer account for this to work.

Once the tool is up and your phone is tethered and unlocked, simply enter your Windows Live ID and password and hit the register button. Simple as that.  If you need to unregister a phone, just run the utility again with the phone you need to unregister and the button will change from “Register” to “Unregister”.

Technorati Tags:
Monday, December 13, 2010 4:54:23 AM UTC  #    Comments [0] -
Windows Phone 7
# Saturday, December 11, 2010

Recently a friend of mine asked me about digital frames and specifically about the Toshiba DMF102XKU. I hadn’t heard of it, but have had my fair share of digital frames – none of which have really had all that I wanted in a frame.  I want one that can get online wirelessly via at least 802.11g with WPA for security. I read through the specs on Amazon and it sounded good, so I ordered three.  I wanted a couple for gifts as well.

Opening the box shows the remote and the instructions.  One thing to note, the instructions are just a quick start guide.  The little booklet says to get the full owners manual you have to download it.  The link unfortunately does not go to the owner’s manual and doing a search on the site doesn’t turn it up either.  That’s one strike against it.  I’ve emailed them about sending it out.  Will update this post with whatever response I get.  Along with the quick start guide an “important information” guide.  This is only in English, so if you don’t speak English you are out of luck.  Of course if you don’t read English, you probably aren’t reading this anyway.

Another issue is the stickers on the frame – they were a bit difficult to get off and left a bit of residue behind.

IMG_5163IMG_5166IMG_5167

The frame can either be mounted on a wall or use the stand.  The frame feels good, sturdy and well built.

IMG_5187

When you first turn it on, it runs through a demo slideshow which shows the capabilities of the frame and some sample pictures.  The resolution is 800x480 and it has a tilt sensor to detect if it’s in landscape or portrait mode.  That’s nice.

So, the device is powered up and going through the demo.  Grab the remote to start working with it.  Remote doesn’t work.  Hmmm.  Grab one from another unit. Still no go.  So perhaps the unit is bad.  Looks like I’ll need to get in touch with customer support.

Thankfully the unit has a control built into the frame that lights up when you touch it.

IMG_5188IMG_5189

So, let’s get this thing online.  That couldn’t be simpler if you have a modern router.  Just hit the WPS button on the router and the frame and it will do the rest for you.

Getting setup with online stuff is a little confusing.  In the image on the left above, there is an option for “Online Service Settings”.  It would make sense that this would be where you set up all your online stuff.  However, the only thing you can do there is setup 3 different Picasa accounts.  What you need to do is click Mode either on the remote (mine doesn’t work) or on the frame itself.  From there you click on FrameChannel and it will prompt you to activate your frame giving you an access code and a website to enter it into.  If you don’t already have a FrameChannel account, you can create one and the choose the services that will come down Here is a sampling of what can be done on FrameChannel.

image

I have set my facebook account up to feed into it, and within just a couple minutes the pictures started coming in from the facebook friends I selected to have feed it.  The “My Friends Photos” tab allows you to invite people to email or MMS photos to the frame.

There are a couple ads for FrameChannel that cycle through.  I need to figure out how to get rid of that.

You can also add things like Digg, Twitter, Facebook status messages and more to the frame.  I have added local events so when something is available in my area, it will show it to me.

Overall I’m pleased with the device. I hope I can get the couple issues I have worked out. Honestly, I’ll probably never use the remote, but I I want to have it available.

Saturday, December 11, 2010 5:18:42 AM UTC  #    Comments [0] -
Review
# Sunday, December 05, 2010

Ok, so I was chatting with Scott Hanselman the other day about an issue I was having and he asked what the WEI (Windows Experience Index) was on my machine.  I told him was 4.9 to which he said “that’s pretty low” … great.  Ok, I’d been wanting a new machine for a while now anyway and that was one of the things that pushed me to get a new one.

So, here is what I ended up getting.  It’s still in production, but should be here by the middle of the month. I’m very eager to get it!

• Genuine Windows 7 Home Premium 64-bit
• Intel(R) Core(TM) i7-720QM Quad Core processor (1.6GHz, 6MB L3 Cache) with Turbo Boost up to 2.8 GHz
• 1GB ATI Mobility Radeon(TM) HD 5650 Graphics [HDMI, VGA] - For Quad Core Processors
• FREE Upgrade to 8GB DDR3 System Memory (2 Dimm)
• 160GB (Solid State Drive Flash Module)
• No Additional Office Software
• No additional security software
• 9 Cell Lithium Ion Battery (over-sized)
• 15.6" diagonal High Definition LED HP Brightview Widescreen Display (1366x768)
• TouchScreen with HP TouchSmart's intuitive multi-touch applications (includes HP TrueVision Webcam)
• SuperMulti 8X DVD+/-R/RW with Double Layer Support
• Intel Wireless-N Card
• Backlit Keyboard with Fingerprint Reader

 

I will of course upgrade it to Windows 7 Ultimate first thing.  Before I do however, I’ll get the WEI and post it!  The multi touch display will certainly help in developing for Windows Phone 7.

 

Technorati Tags: ,,
Sunday, December 05, 2010 4:39:35 PM UTC  #    Comments [0] -
Microsoft | Windows 7 | Windows Phone 7
# Monday, November 22, 2010

Facebook is now allowing you to download your data that you’ve put up.

image

This is good, because I’m sure most people probably don’t even know what they have posted.  I know I surely don’t.

image

Once the data is gathered, you receive an email to download it.

You are prompted for your password and then you can get the download.

image

Another security check is in place to verify your identity. This check has you verify people in 5 pictures of your friends.  They do allow you to skip twice since I’m sure (like me), many people don’t really know everyone they are friends with and of course there are times when people tag people in photos when there isn’t actually someone there so they’ll be prompted to look at it.  I’m not posting screen shots of this step since it contains pictures of people.

Upon successfully answer the questions of people, you’ll be prompted to actually download the file. In my case, it’s about 236 MB in size.

image

Once you retrieve it and unzip it, you end up with a directory structure like this:

image

My history only went back to 2009, however I know there is much more than that.  So the question is, do they delete it after a while or what?

The layout of the html is very basic, but it gets the job done.

Monday, November 22, 2010 1:56:24 PM UTC  #    Comments [0] -

# Thursday, November 18, 2010

Seems they really don’t want us to read it too easily… Smile

image

Thursday, November 18, 2010 5:36:58 AM UTC  #    Comments [0] -

# Sunday, November 14, 2010

My experience with migrating to BPOS wasn’t the best unfortunately. I’m documenting my experience here for my own recollection as well anyone else who may need help.  My migration is from a hosted exchange account from MailStreet. No real complaints with them, but I’m marketing BPOS, so I need to be using it. Plus there are more benefits to using BPOS over just a hosted Exchange service.  Granted, I won’t use many of them because of the current size of my company, but that should change over time.

My migration is very small – in fact, it’s just me right now, so I figured it would have to be really simple.  Well, one of my first problems was in sending up the csv file – it constantly erred out when I sent it up.

In all my navigation through the help on administration console at the time, I couldn’t find this page which my BPOS contact got from his technical contact.  This article helped immensely!  There is one thing wrong with the article though.  It says Step Three is to determine how to access the hosted exchange server.  This is actually done in the second step of the actual migration portion. The portion that is documented in that article the prep work to get the migration going.

Here is the csv format to use as text:

SourceServer,SourceIdentity,SourceLoginID,SourcePassword,TargetIdentity,DisplayName,ClientLocale, MailboxQuotaSize
<server>.<mailhoster>.net,user1@domain.net,user1@domain.net,password,user1@domain.net,User1,,5 GB
<server>.<mailhoster>.net,user2@domain.net,user2@domain.net,password,user2@domain.net,User2,,5 GB

If you have an administrative account on your hosted account (I do, I imagine most others do too), the only fields necessary in the csv file are “SourceServer”, “SourceIdentity” and “TargetIdentity”.  The identity fields are the email addresses.

One other issue I ran into was the value for the Source Server.  When setting up Outlook previously to work with MailStreet, the server name that was given to me was: mse17be2.mse17.exchange.ms. That never worked.  I logged into the administrative console for MailStreet and popped into OWA from there and the server name was: mail.mse17.exchange.ms. Using that name worked.  I’m certainly not an Exchange administrator by any means, so maybe that’s normal, I don’t know.  In any event, that worked and was another hurdle I had to get over.

Once you have your csv file created, open the migration tool.  If you haven’t already downloaded it, it can be found here.

When you first open it up, it’s going to ask you to log into your Microsoft online account.  After doing that, you’ll want to click “Add Mailboxes” on the right.  This will prompt you to upload the csv file you just created.  Now, because my migration is very small, I had already created my user account via the administration page.  So when I uploaded the file, here is what I saw:

image

At this point, click the migrate option on the right.  The second step in this wizard is where you choose the access method you will use for the hosted exchange account.

image

I chose administrative and put in the username (not the full email address) and password.

If you don’t get a value for your mailbox size, my finding is that the wizard will fail.  Obviously it hasn’t been able to resolve the mailbox. 

image

DNS change information can be found here and here.

And here are some important URLs to keep.

Sunday, November 14, 2010 6:40:12 PM UTC  #    Comments [0] -
Microsoft

Unfortunately, they haven’t updated this page to show Phone 7 connectivity.  Thankfully, this page does.  It is, unfortunately, not as straightforward as it could and should be.  Hopefully the first update to the phone will address this.

Technorati Tags:

Sunday, November 14, 2010 6:20:21 PM UTC  #    Comments [0] -
Windows Phone 7
Archive
<January 2011>
SunMonTueWedThuFriSat
2627282930311
2345678
9101112131415
16171819202122
23242526272829
303112345
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2012
George Handlin
Sign In
Statistics
Total Posts: 51
This Year: 0
This Month: 0
This Week: 0
Comments: 9
All Content © 2012, George Handlin
DasBlog theme 'Business' created by Christoph De Baene (delarou)