Lance Larsen - .NET Architect Madison Wisconsin

imageLittle things make me happy…

Easy way to get the RGB value for images / web pages

Check out ColorZilla plugin for Chrome.

imageAt the February 2014 MADdotNET (@maddotnet) meeting – had David Manske (@davidemanske) from Centare out to talk on what’s new in Visual Studio 2013!  Couple absolute gems of knowledge were passed on – one of them was “SideWaffle Templates for Visual Studio” – I had never seen this – so figure some others may not have seen this either!

Specifically liked seeing the AngularJS templates… Check them out!

Always loved JavaScript and client side scripting ( where appropriate <grin> ) – so when we had a new green field project to start, looked to what the best-in-class technologies were – settled on AngularJS (@angularjs). 

It is a client-side MVC (Model-View-Controller) pattern and it rocks for making SPA (Single-Page-Applications) that emphasize responsiveness.  Take a look at either the AngularJS site, or there are a couple great AngularJS videos on Pluralsight – specifically “AngularJS Fundamentals” and “AngularJS for .NET Developers”.

I know that I have a ton to learn about AngularJS – and wanted to share what I’m learning along the way…

Specifically, have a page that has a list of items to be displayed – and want to filter them by a parameter based on what the user clicked.  So in AngularJS we can separate showing the items to be displayed into one controller – the “CollectionController” – and the filters to be applied into another controller – the “FilterController”.  Found many examples / discussion on how to communicate between the controller, but some seemed to be way overkill or confusing – so got the following code crafted – and wanted to share as it turned out pretty slick! :)

To boot, have the live code running on JSFiddle – which again, if you haven’t played with is WAY awesome!

http://jsfiddle.net/lancelarsen/qjkyM/

Read more

mysqlAs a primarily Microsoft SQL Server developer, when playing around with MySQL database ( specifically using MySQL Workbench ) wanted to be able to press F5 to execute the SQL commands that I was writing, by default you need to press Control-Enter or Control-Shift-Enter – but there is no GUI interface to remap keys shortcuts like there is in most Microsoft programs… so… found that the following worked and wanted to share!

Locate your “main_menu.xml” MySQL configuration file – mine was in “C:\Program Files (x86)\MySQL\MySQL Workbench CE 6.0.6\data\main_menu.xml”.  Find the following XML.
 

   1:  <value type="object" struct-name="app.MenuItem" id="com.mysql.wb.menu.query.execute_current_statementwin"> 
   2:    <link type="object" key="owner" struct-name="app.MenuItem">com.mysql.wb.menu.query</link> 
   3:    <value type="string" key="caption">Execute Current Statement</value> 
   4:    <value type="string" key="name">query.execute_current_statement</value> 
   5:    <value type="string" key="command">builtin:query.execute_current_statement</value> 
   6:    <value type="string" key="itemType">action</value> 
   7:    <value type="string" key="shortcut">Modifier+Return</value>
   8:    <value type="string" key="platform">windows</value>
   9:  </value> 

Replace the “shortcut” xml (line 7 above) with the following, exit and reopen MySQL Workbench – and you’re rocking with F5!

<value type="string" key="shortcut">F5</value>

imageYou should almost always store your date/times in your database as UTC – you may think it’s not important now, but as soon as your application needs to display times to users in different time zones ( to paraphrase Yoda ) …it will be, it will be… 

But do you need to know and store your user’s timezone to display it correctly? 

Nope, JavaScript and momentjs to the rescue…! :)

Read more

large_jquery_logoIn my blog “NuGet – Limiting updates for jQuery and Bootstrap” – we looked at continuing to utilize NuGet to keep us up to date on the latest jQuery 1.x version ( even though 2.x is out ).  Reason being that we needed to stick with 1.x because we are still supporting IE 7/8. :(

So… jQuery 1.x and 2.x have feature parity – but you want to use jQuery 2.x when you can, simply because it’s a smaller download as they were able to take out a lot of IE7/8 “fixes”.  Note, jQuery’s post on conditionally include one or the other based on the version of the browser.

But we also like to use the cool MVC bundling and minification feature – can we have the best of all worlds? Oh ya… :)

Read more

CFNeed to setup a “Created” DateTime field in your SQL table that is auto-computed to add the current date and time that the field is inserted into the database? 

If you’re doing so in SQL – in the “Default Value or Binding” you just need to enter GETDATE() or GETUTCDATE() – insert a record, and you’ll see the date/time value automatically added to that column.  “…that was easy…”

But how to do the same thing when using Entity Framework Code First?

No big deal here either – as long as you add the couple lines of code described here…

Read more

imageimageI love to say “…if it’s not in NuGet, it’s DEAD to me…” – and for the most part that is very true. :)

If you don’t know what NuGet is – you MUST – look at Introducing NuGet: the smart way to bring bits into your projects

However, as I and many developers need to continue to support IE7/8 – we can’t update to the latest versions of jQuery or Bootstrap, as jQuery version 2.+ and Bootstrap version 3.+ no longer support IE7/8…

Also considering jQuery is continuing to update their 1.* version with updates – how do we handle that and continue to use NuGet inside of Visual Studio to show us when there are updates that we DO want to install?

Here’s the solution!

In your “packages.config” file – add the allowedVersions tag to both as follows ( noting that the right parenthesis looks strange, but it is correct – it means ‘less than version X’ )…
 

<package id="jQuery" version="1.10.2" allowedVersions="[1.9.1,2)" targetFramework="net45" />

 

<package id="bootstrap" version="2.3.1" allowedVersions="[2.3.1,3)" targetFramework="net45" />

imageNow when you open up NuGet ( noting that you need to close and reopen VS and the project ) – you see the following!

For this, we were on Bootstrap 2.3.1 – and only saw an upgrade to 3.0 – but now we see we can upgrade to the latest 2.3.2!  And we’re currently at the latest jQuery 1.10.2 – so correctly don’t see an update – but we will when one comes out. :)

I love NuGet… :)

45544_mod_gyroboy_01_LeftAre you are new to robotics? Or do you go to bed dreaming of counting cybernetic-sheep? In either case, Lego Mindstorms EV3 has just released an awesome next generation robot kit that’s made for everyone! EV3 adds never before seen functionality in a format accessible to all current and future programmers. Learn how to start teaching and showing others how to use the Lego programming tools! And just have fun with Robots! :)

PowerPoint presentation from ThatConference 2013 (Big 109MB!)

Check out the EV3 Core Set on Lego Education US!

Some very difficult choices in choosing from so many awesome talks at That Conference – but can’t wait – and wanted to share…

For those speakers and talks that I’m not able to get to – love to have you out to MADdotNET to give your presentations!

Encourage everyone to share their schedule!

 

 

Monday

8:30 AM

Denise Jacobs Denise Jacobs Keynote
 

10:30 AM

Chris May Developing applications for Google Glass
 

1:00 PM

  THAT Wildlife
 

2:30 PM

Chris Gardner Biometrics: Using You Body for Fun and Profit
 

4:00 PM

Mike Rohde Sketchnoting Workshop
 

8:00 PM

  Game Night

Tuesday

8:30 AM

Dave Thomas Dave Thomas Keynote
 

10:30 AM

Leon Gersing Keep Software Weird
 

1:00 PM

Lance Larsen Sewing for Geeks — IL Weaving with AOP
 

2:30 PM

Brian Kalbfleisch We Can with WeDO. Using LEGO to Teach Little Campers Programming.
 

4:00 PM

Lance Larsen Robots Robots Robots!  Lego Mindstorm EV3
 

5:30 PM

  That Pig Roast
 

10:30 PM

  Waterpark Party

Wednesday

8:30 AM

Doc Norton Michael “Doc” Norton Keynote
 

10:30 AM

Sharon Cichelli Hello, Arduino: Write code that interacts with the real world
 

1:00 PM

Keith Burnell Teaching the Junior Campers to Program with the Grown Up Tools
 

2:30 PM

John Hauck Kidz That Code