Saturday, October 26, 2013

Photos from Pablo's Fiesta October 26, 2013 Austin TX

Lost Techies Fiesta Open Space Conference 2013

Thanks to all the Los Techies for their hard work on making this a great conference.

The opening session:


9:00 Session JavaScript Frameworks Session
Knockout is for data binding, but the syntax is a little awkward
Angular is a better knockout
Ember is a better backbone (it's like Rails, follow conventions and life is easy)
SPA is Single Page Application
Progression:  jQuery -> Backbone -> Marionette -> Ember
                     Knockout -> Angular
Breeze is an ORM for the browser
One strategy is to use Razor template strictly to toss out div tags and have the js framework populate the content.

10:00 Not a Basic Git Introduction by Keith Dahlby
BeyondCompare is a recommended diff tool (a class of tools Microsoft has yet to include in their OS)
Set a union merge strategy in the git attributes file:
*.sln merge=union

Official notes of the conference are at https://github.com/lostechies/fiesta/wiki


11:00 Faster CodeMonkey, Faster
What helps you develop code faster?
Using Bootstrap Themes
Foundation, a competitor of Bootstrap, has flexible grids
PowerPoint 2012 Storyboard is great for prototyping GUIs
Lightswitch
Expresso is a RE utility
https://www.debuggex.com is an online Regular Expression utility - very slick
Dapper is a micro ORM
"Do not write clever code"
Jira has a planning view for Scrum

 Lunch!


 1:00 Care and Feeding of Developers with Gabriel
DISC personality test
Amir recommended "Greatness" by Dabid Marquet for ideas on training developers:
http://www.youtube.com/watch?v=OqmdLcyES_Q

2:00 Continuous Integration
Team City
Jenkins
Culture is the hard part
Toggle new features on a per user basis - have StuctureMap get the right version
Use Octopus for TeamCity for deployment
Rake is used in a lot of .Net builds
GitHub Enterprise is worth the price for some
 3:00 Codebetter.CI
Chocalaty is used to install programs.  It is NuGet package with standard .ps1
2013 version of msbuild.exe has moved, but the old one is still there.  Change your batch files.
Ruby needed by new .Net project
nhibernate has not been actively developed lately
ORMs require a deep understanding of underlying topics
Dapper and Massive are micro-ORM alternatives

Friday, October 25, 2013

Photos from Pablos Fiesta, Austin Tx, Oct 25, 2013



Pablo's Fiesta Pics
Austin TX, October 25 2013



John welcomed the crowd to the Los Techies Annual Open Spaces Conference

Doc List retold the mythical history of Open Spaces
 Participants, like Jeffery Palermo, wrote on sticky notes topics they would like to discuss.


Here's our list for tomorrow's sessions:

Fishbowl exercise on HealthCare.gov


Saturday, September 28, 2013

After iOS 7.0.2 Update, Podcast App Failing

I updated my iPhone 4S to iOS7.0.2 and it immediately put the phone in recovery mode.  The phone was dead.  Fortunately, iTunes had it backed up on my Windows XP (no smirks please, it's historical) and was able to restore the phone, mostly.
The Podcasts app would open and then die immediately.
It took a while to find the fix.  I went to "App Store" on the phone and found an update for the "Podcasts" app.  After applying the update it was all working again.

Wednesday, September 18, 2013

Convert Sql Server DateTime to Milliseconds Since 1970

watch
Photo by Rich Masso
While noodling around with HighCharts, I needed to convert dates from Sql Server's DateTime to what HighCharts needs, which is milliseconds since 1970.



My first attempt to convert the current UTC time was not successful:
 
 
select Datediff(s, '1970-01-01', GETUTCDATE())*1000
Msg 8115, Level 16, State 2, Line 1
Arithmetic overflow error converting expression to data type int.

Since the number of milliseconds is greater than the precision of int, we have to bring up the big guns: "bigint".
 
select cast(Datediff(s, '1970-01-01', GETUTCDATE()) AS bigint)*1000

This worked great. A good site to check the values is www.epochconverter.com.

Monday, September 16, 2013

How to unzip files in Windows 7 and Windows 2008 natively

Photo by: Klafubra

Unix systems have had native unzipping programs for the last few decades that are easily accessible from scripts.  Now Microsoft has darkened the door of the party.
Instead of downloading 7zip or WinZip, you can now natively unzip files provided your server has the latest software.  You need .Net 4.5 and PowerShell 3.0, and then everything is unicorns and rainbows.
In PowerShell scripts to unzip file "$zipFile" into directory "$targetFolder" you can do this:
[System.Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem')
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipFile, $targetFolder)

Monday, August 19, 2013

Pictures from Austin Code Camp 2013

Here's a few pics from the Austin Code Camp 2013.
The Camp was great.  The advanced planning and hard work of all those involved was evident.
It always surprises me that the camp is free, with two free meals thrown in.

Registration was fast and easy.
 My 8:30 class was "Web API Quick Start" by Ryan Vice.
My notes:
* Ryan stressed a resource-centric, guessable URL design like the apogee web site promoted I was not able to find the apogee web site) like Accounts/:id/Withdraw and not AccountWithdraw/:id
* Ryan used Postman for debugging URL, although Fiddler works as well
* HTTP 201 is the freturn code if you create a resource (Accounts/add) and in the headers you return "location: Accounts/12345"
* The MVC framework has HTTP codes so you don't need to put in a magic string, "201".
* They use a web api pipeline poster to discern where to insert their function into the sequence.  Perhaps he was talking about this one.
* To create a Web Api project start with a new "MVC4 Web" app in VS.
* Use the Json.Net framework
* For versioning use something like "uship.com/api/v2/Resource"
* JSON to C# utilities are out there that create a C# object from JSON text
* For documentation, instead of WDSL use HelpPage from NuGet



My next class was Database Optimization with Anil Desai
* Don't look for the longest running query, but the longest time*frequency
* Use the Activity Monitor in mssql by right clicking on the db server in Management Studio
* He showed a bunch of reports I'd never seen by right clicking on the database and selecting "Reports"
* Sometimes autogrowth is set to 1 Meg - too small a value for today.
* When tracing you can add a filter to only catch queries only above a certain threshhold
* It's good to add the name of the app in the connection string.
* He showed a statement with "BETWEEN" which I'd never seen.   BETWEEN 10 and 20
* When running a trace write to a file and then import to database, otherwise it soaks up more resources


John Crowe gave a good overview of Dependency Injection.
* The big problem is the "new" operator, it makes for ridged code that is hard to test.
* Three types of IOC: Factory Pattern, Service Location and Dependency Injection
DI has three types:  Constructor Injection, Setter/Property Injection, and Interface Injection

Anne hosted a "Lightening Talk" round where attendees gave informal 5 minute presentations.
Jeffrey Palermo gave in interesting talk on his new company, Clear Measure, started in January and quickly built the startup company by using Cloud based services.  They use GoogleApps for mail and video calls, GoToMeeting for conferencing, EchoSign for authentication, Ring Central for phones, Quickbooks for accounting, LegalZoom for incorporation and BaseCamp for management.
Latish Sehgal talked about tools for .Net Development, his list is at http://dotnetsurfers.com/tools.
* Use ReSharper to locate unused libraries
* Use Firebug console mode to test jQuery commands; YSlow to get recommendations on speed
* Glimpse (http://getglimpse.com/) does for the server side what Firebug does for the client.
* SMSS Toolpack which is a little like ReSharper for Sql Enterprise Management Studio. It remembers all your handwritten sql queries.
* Gray Wolf was the most interesting. This (hacker) tool allows you to insert code into applications.

Amir Rajan gave an interesting talk on "JavaScript MVC Framework Rundown"
* jQuery - spaghetti code
* Backbone - event driven (most accessible) may use Marionette plugin
* Knockout - MVVM with DuRandal
* Angular.js - redefines HTML
* Ember - all MVC in browser, steep learning curve

https://github.com/tastejs/todomvc has an excellent overview of all the browser-based MVC frameworks.


Friday, August 09, 2013

C# WebClient .DownloadStringAsync Blocking Main Thread

Photo by Max Ronnersjö
While needing to invoke a url in the background from a C# 5.0 program, I was overjoyed to stumble across "WebClient .DownloadStringAsync(url)". I thought I'd found a bird's nest on the ground. 
Here was a single call to solve my problem. 
Great job Microsoft framework group!

Well, not so fast.

My unit tests for bad and malformed URLs were actually blocking.
The problem is that WebClient.DownloadStringAsync() blocks until the connection is made.  If your application happens to call a bad url, the main thread will block until it gets an error code back.  This can be up to 3 seconds for normal malformed urls.  In  one case, our internet proxy had problems with the malformed url and consistently hung for 10 seconds while it was sorting out the problem and eventually returned a timeout error.

If you ever suspect the url you are calling is ever going to have issues (and we know all sites are up all the time!  Right.), don't use DownloadStringAsync, use DownloadString() wrapped in a Thread or Task.  This way if the connection has problems, it's another thread's problem, and your main thread can move forward.

...
new Thread(() => DownloadUrlSynchronously(url)).Start();
...

public void DownloadUrlSynchronously(string url)
{
            using (WebClient client = new WebClient())
            {
                try
                {
                    var x = client.DownloadString(new Uri(url));
                    _logFileWrapper.LogInfo("Url called successful - " + _url);
                }
                catch (Exception e) { ...}
                ...
}