Geeks With Blogs

News Please visit me at my new blog!!

profile for Aligned at Stack Overflow, Q&A for professional and enthusiast programmers
"free in Christ Jesus from the law of sin and death." Romans 8:2 (ESV) Check out the Falling Plates video on YouTube.
more about the Gospel
And then listen to Francis Chan speaking at LifeLight in SD.

Programming and Learning from SD January 2013 Entries
MVC Forms Styling from Twitter Bootstrap
I was looking at Twitter’s Bootstrap awhile back and found that their CSS, plus some validation CSS from the MVC template, and approach to forms will work nicely for my MVC project. I didn’t want to use all of the Bootstrap CSS, so I took out only what was needed. /* Surround the * after the form label on required fields*/ .requiredFormLabelDiv { display: block; } .requiredFormStar { color: red; margin-left: 10px; } .message-info { border: 1px solid; clear: both; padding: 10px 20px; } .message-error ......

Posted On Friday, January 25, 2013 1:24 PM

Google map div id must be map_canvas
The examples from Google use <div id=”map_canvas”></div... for their element. I changed it to something more specific to my project, and the zoom controls started looking funny. I reverted and tried again with the same results. I finally came across this StackOverflow question and answer (thank you again StackOverflow!) and also added an answer to the bottom to clarify what I found. The lessons are: Make sure you use map_canvas. Make sure you don’t have a max-width on the image ......

Posted On Thursday, January 24, 2013 10:12 AM

Using Json.Net JObject with WebApi
I needed to pass some data from JavaScript to my WebAi Controller and came across Rick Strahl's passing multiple POST parameters to Web API article, his use of the JObject from Json.Net and dynamics works really well. Note usage of the jsondata[“UserId”].Value<... This is a simplified example of the code I‘m using.Note: you can also return the JObject. System.Web.Mvc.HttpPost] public HttpResponseMessage UpdateUserInfo(JObject jsonData) { // ......

Posted On Thursday, January 17, 2013 3:21 PM

Setting a var property in the JavaScript Revealing Module Pattern requires a setter and a getter
See John Papa's article for more information on the revealing pattern.See for a great reference as well. I was trying to expose a property in my JavaScript object and setting it from an outside caller. When I ran the code, the value didn’t change. This held me up for awhile yesterday. When I Googled, GoodSearched the problem today, I found a question on Stackoverflow that was similar and lead me in ......

Posted On Tuesday, January 15, 2013 8:31 AM

Set the DateModified in the Repository
I have database tables that have DateCreated and DateModified as DateTime types. I was getting the error (“The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value.”) when I tried to save through the context.SaveChanges() for Entity Framework. First I added GetGETUTCDATE() to the default of the column in the database. Then in my Repository Update Method, I used reflection to set the DateModified property. public void Update(T entity) { var entry = this._context.Entry(entity); ......

Posted On Thursday, January 10, 2013 4:01 PM

Include your JavaScript references in the correct order
I was stuck for 2 hours on this. I was using Wijmo library and was including the complete library before the open js file. I kept getting’Uncaught TypeError: Cannot call method 'formatString' of undefined’. Finally, I switched the order and put the open js file before the complete js file and the error went away. The lesson is that undefined means you haven’t defined it yet . Make sure it isn’t defined below it and that you didn’t forget to include it ......

Posted On Monday, January 7, 2013 3:51 PM

Copyright © Aligned | Powered by: