Webistrate - Draw Your Own Conclusions

ASP.NET: Entity Framework’s Code-First with an ObjectContext

Posted by Jamie Munro | April 30, 2012 | Tags: , , ,

If the following blog interests you, it’s probably because you’re using Entity Framework with a Code-First approach and whatever it is you are trying to do *must* use an ObjectContext instead of the standard DbContext.  I’m sure, like me, you thought this shouldn’t be too hard.  Then you started hitting roadblocks like, Metadata is required in your connection string.  What’s metadata?  This is only needed in Database-First so you can tell the framework where your edmx and other definition files are, so why do I need this with Code-First, I don’t have these files?

This was definitely my first reaction as well.  So after much trial-and-error and research, I have the solution!

See the solution »

Share


CSS3: Creating Diagonal Lines

Posted by Jamie Munro | March 19, 2012 | Tags:

The hr tag has been around for quite some time to provide a nice horizontal line to visually separate content.  To achieve a vertical line, it’s typically been accomplished via border-left or border-right.  However, this is when you can get into height issues or columns that don’t extend the whole way, etc…  Instead CSS3 allows for the rotation of elements and allow for vertical or diagonal lines to be created with some basic CSS.

See the solution »

Share


MSSQL/MySQL: Delete Duplicate Rows in a Table

Posted by Jamie Munro | March 12, 2012 | Tags: ,

No more must you think about how to find a clean way to delete duplicate records in your database table.  The following article will provide a single SQL query that will delete rows that are duplicated in your table.  Before you begin, be sure you’ve tracked down the bad code that is causing this; otherwise, you will need to run it multiple times!

See the solution »

Share


CSS3: Rotating DOM Elements

Posted by Jamie Munro | March 5, 2012 | Tags:

As more and more browsers support HTML5 and more importantly CSS3, it begins to allow us much more freedom using standard text without the need of images.  Not only does this speed up page load times, it also lowers bandwidth costs as well.  Using CSS3, many standard DOM (Document Object Model) objects can easily be rotated, such as: images, text, block elements, etc…

See the solution »

Share


MySQL: Concatenate Multiple Rows From a Table Into One Field

Posted by Jamie Munro | February 27, 2012 | Tags:

This is an excellent little trick that will save some processing time by a server-side language having to loop through the data to achieve the same result.  In this article, I am going to demonstrate how you can merge multiple rows into one field separated by a specific character.

See the solution »

Share


CSS3: Creating a Transparent Background

Posted by Jamie Munro | February 20, 2012 | Tags:

Do you have a nice background image that you don’t want hidden by a solid color and your content?  With some CSS3, a background color can be set with an opacity value so that the content or image beneath will be visible through it.

See the solution »

Share


JavaScript: Set Cursor Position of textarea

Posted by Jamie Munro | February 13, 2012 |

Probably not required often, but you just never know when you might need to set the cursor position inside a textarea tag that you have on your website.  Perhaps you want to add a button that will insert some text before the current cursor position and set the cursor back to where the user left it afterwards.  In the following example, I will create some basic functions to allow you to set where the cursor goes inside of a textarea.

See the solution »

Share


MVC 3: Pass Model or Form Data through a Redirect

Posted by Jamie Munro | February 6, 2012 | Tags:

Have you ever wanted to pass form data or perhaps even a full model from one action to another through a RedirectToAction?  By adding a new library package from NuGet, this can be accomplished with a few small changes to your controllers.

See the solution »

Share


jQuery: Padding a Variable or String with a Specific Character

Posted by Jamie Munro | January 30, 2012 | Tags:

Every so often you will receive data from a database or potentially user input, but a specific number of characters might be required to format or display the data properly.  As an example, you may wish to ensure that a number less than 9 is prefixed with a 0 where numbers that are 10 or more do not need the padding.  By extending jQuery, two functions can be created to either prefix or postfix a specific value to a DOM element using a jQuery selector.

See the solution »

Share


CSS3: Creating a Background Gradient

Posted by Jamie Munro | January 23, 2012 | Tags:

Do you see the gradient blue above for the title of this article?  If you don’t then your browser doesn’t support CSS3 gradients.  However, if you do see it, you’ll be happy to know that I saved you and me some bandwidth by not using an image!  Instead, some CSS3 is used.  So next time a designer provides you a PSD with a bunch of gradient images forget “chopping” them out and use the following example instead.

See the solution »

Share


Page 1 of 41234

Buy one of my books