Wednesday, August 17, 2011
Following Open Source via RSS
I have recently been working on an ASP.NET MVC project, where I have included many Open Source projects. Most of them were included using NuGet (a great tool by the way, you should get it if you don't already have it!). So, for a lot of these open source projects that I an now using, I like to keep track of what changes are happening in the projects. A great way that I have found to do this, is to track the commits to the projects via RSS. I have subscribed to the RSS feed of the commits for the projects in Google Reader and then grouped them into an OpenSource folder that I can monitor. For me, this is a really easy way to see what is happening on a project and to watch out for interesting updates.
Tuesday, June 14, 2011
My Git Ignore File
I am using Git more and more these days and I really love how easy it is create branches and switch between them. If you have not tried out Git before, I really would encourage you to do so. Here is my current .gitignore file. This file basically tells Git what files to exclude when looking at a repository for changes, etc.
Tuesday, May 31, 2011
Entity Framework Serialization - Circular Reference
I have been working with KnockoutJS recently and needed to serialize an Entity Framework model to the client as JavaScript so that I could convert it to my Knockout ViewModel. Here is the entity that I needed to serialize.
However, when I attempted to serialize this object, I was getting an error "A circular reference was detected while serializing and object of type Person". I did a little research on this issue and found a good blog post by Rick Strahl on LINQ to SQL and Serialization, that discusses this issue.
The problem is the public Tags property. The first suggestion is to change the access modifier from public to internal. I did this and it worked great. I have not fully explored the ramifications of making this change to the rest of my application, but will post an update if I find anything.
However, when I attempted to serialize this object, I was getting an error "A circular reference was detected while serializing and object of type Person". I did a little research on this issue and found a good blog post by Rick Strahl on LINQ to SQL and Serialization, that discusses this issue.
The problem is the public Tags property. The first suggestion is to change the access modifier from public to internal. I did this and it worked great. I have not fully explored the ramifications of making this change to the rest of my application, but will post an update if I find anything.
Monday, April 25, 2011
Synergy 1.4.2 with Mac as Server and Windows 7 Client
I was setting up Synergy today so that I could control my Windows 7 laptop from my Mac. So I went out and installed the latest version of Synergy - 1.4.2 and I followed the great installation guide to get everything setup. Note that I also am using QSynergy to get the GUI on the Mac. I have my Synergy setup with my Mac as the server and Windows 7 as a client. Once I had everything set, I was able to move my mouse over to the Windows 7 machine, but the keyboard was not working. So I did some googling and came across issue #57 on the Synergy Support forums that describes this issue. According to this, it looks like the official fix for this will not be ready until version 1.4.4 of Synergy is released. However, Matthew Toso posted the 1.4.2 version of synergys with a patch applied for this issue. See note #82 in this thread. Once I installed the patched synergys on my Mac, the keyboard was working properly when I was over on my Windows 7 machine.
Tuesday, March 29, 2011
Entity Framework 4.1 Entry Extensions
I have been working with the Microsoft Entity Framework version 4.1 aka "Code First" for about the last 3 weeks and have been really enjoying the ease and flexibility of setting things up and getting my CRUD operation working so smoothly. However, I had the need to create modify some entities in my database and was starting down the path of passing in the new entity, then querying the context for the old entity and finally setting the values of the old entity to those of the new entity. This worked for a little while, when I only had simple entities. However, my entities started getting more complex and I found myself adding more properties and always forgetting to update the modify operation.
So I started doing some research and found that I could use the Attach method on the DbSet to add the modified entity. However, this left the entity in the UnChanged state and that did not really do me any good. So with a little more research I found this Blog Post by Julie Lerman about Round Tripping a Timestamp Field in EF 4.1 with MVC 3 that discusses the DbContext.Entry method and how I can set the State as I attach the entity.
I had also in my secondary research found this post about creating extensions for the ObjectContext in the regular Entity Framework and this led to the creation of my own Extensions for the DbContext object as seen below...
I now use these extension methods as shown below.
So I started doing some research and found that I could use the Attach method on the DbSet to add the modified entity. However, this left the entity in the UnChanged state and that did not really do me any good. So with a little more research I found this Blog Post by Julie Lerman about Round Tripping a Timestamp Field in EF 4.1 with MVC 3 that discusses the DbContext.Entry method and how I can set the State as I attach the entity.
I had also in my secondary research found this post about creating extensions for the ObjectContext in the regular Entity Framework and this led to the creation of my own Extensions for the DbContext object as seen below...
I now use these extension methods as shown below.
Monday, March 21, 2011
Good Drupal Books
Had the following Drupal books recommended today...
I have read Pro Drupal Development and it was an excellent book that helped me get up to speed quickly on developing modules for Drupal. I would highly recommend this book. I have not read the others, but plan on checking them out soon.
I have read Pro Drupal Development and it was an excellent book that helped me get up to speed quickly on developing modules for Drupal. I would highly recommend this book. I have not read the others, but plan on checking them out soon.
Drupal, MAMP & Drush
I am attending a Lullabot.com Drupal API &Module Development course at work this week. Learning a lot of great thoings so far. I worked on a Drupal project last year and created a custom module, but what I have learned so far in one day, could have probably saved me a close to a week as I was trying to figure it out on my own.
At the end of class today, the instructors were going over some tips for Drupal developers and showed off the awesome Drush, Drupal Shell. It is amazing what this tool can do, and being able to have the power of the command line to very nice. However, since I am running Drupal on MAMP, I was getting an error about not having the correct amount of RAM configured. However, I found this "getting drush to work on MAMP setup" article that had the key that worked for me. Create a .bash_profile file and adding an alias:
alias drush='/Applications/MAMP/bin/php5/bin/php /usr/bin/drush/drush.php'
export COLUMNS
At the end of class today, the instructors were going over some tips for Drupal developers and showed off the awesome Drush, Drupal Shell. It is amazing what this tool can do, and being able to have the power of the command line to very nice. However, since I am running Drupal on MAMP, I was getting an error about not having the correct amount of RAM configured. However, I found this "getting drush to work on MAMP setup" article that had the key that worked for me. Create a .bash_profile file and adding an alias:
alias drush='/Applications/MAMP/bin/php5/bin/php /usr/bin/drush/drush.php'
export COLUMNS
Subscribe to:
Posts (Atom)