Saturday, November 03, 2012

Differences between isql, osql, sqlcmd and Invoke-Sqlcmd

What's the difference between isql, osql, sqlcmd, and Invoke-SqlCmd?
My GreatGreatGrandFather, Elijah Fincher, playing the part of "isql"
All four of these tools let you interact with SqlServer via the command line.
I'm not a big database guy, so I thought I was cool a few years ago moving to osql from isql. Wrong. The cool kids are on Invoke-SqlCmd
What's the difference:
isql - the grandfather, last used in SQLServer 2000. You should only be using this if you are working for some government agency.
osql - the father, introduced in SqlServer 2000, will probably be phased out soon. Use this if you work for a large corporation like GM.
sqlcmd - new kid, introduced in SqlServer 2005, used in current SqlServer insta
lls. This is what everybody else should be using.
Invoke-SqlCmd - the new cool kid, used inside PowerShell. Use this if you are really cool and have installed linux on your old computers at home.


Example using sqlcmd:
sqlcmd -S MyServerName\SqlExpress -E -Q "CREATE DATABASE Movies"
sqlcmd -S MyServerName\SqlExpress -d Movies -E -i "C:\workfiles\Movies_CreateTables.sql"

The "-E" option says to use trusted identity;
"-Q" the query to execute
"-d" the database to access
"-i" the command input file

Friday, November 02, 2012

Austin Java Users Group - RESTful Web Services

On October 30, 2012 Ryan Stewart of Rackspace gave a wonderful presentation to fifty people on creating RESTful web service using Gradle for building, JAX-RS(Jersey) for the web services and Spock for testing. It was very impressive. In 100 minutes Ryan wrote the tests for a small web service in Groovy using the Spock framework, created the code to implement those tests, and deployed to Red Hat's cloud. He reiterated the mantra of HTTP verbs:
POST is to create
PUT is for updates
DELETE is for well, deleting
Ryan used the sublime editor for small things and IntelliJ for coding (he really liked IntelliJ more than Eclipse, even the community edition).
jacoco used for a code coverage tool.
"Test your source code with a more powerful language." So we used Groovy for testing.
I learned that the 201 status code is for "OK, I created an object" and by convention the objects location (identity) is passed back in a header.
Ryan liked, what .Net people call "Fluent" style, where methods can be chained together if we return the object, e.g., user.withRole("admin").expires("never")...
public User withRole(String role) {
  this.roles.add(role);
  return this;
}
Ryan demonstrated "JerseyTest" which was amazing.
For REST systems, instead of wsdl like SOAP used, we have a simpler format called "wadl", which is not standard at the moment.
When retrieving info from a REST server we can imply the format by appending an extension, /usr/345.xml or /usr/345.json
JerseyTest impressed me with the excellent separation of code possible. Ryan went out of his way to write all the code to be testable, and only use the meta info on the methods to describe their web behavior, so we could test their POJO behavior easily with NUnit.
He used projectlombok.org to autogenerate accessors.
"gradle distZip" created the distribution package
The most impressive part of the demo was to take our shiny new web service and seemlessly deploy to RedHat's OpenShift cloud service. His slides are here and the web service is here.

Saturday, October 13, 2012

Pictures from the Overview of Kanban - Austin SPIN Oct 11, 2012

David Hawkes CEO of Agile Velocity gave an overview of some Kanban concepts to the Austin Software Process Improvement Network

Here's the notes I jotted down during his talk:
Multitasking is bad
Why do we work on too many projects at one time?
- Not focused on deliverying value
- Maximizine utilization
- stakeholders need to have their project "In progress"

getKanban.com

Little's Law

Work In Progress
----------------   = Aggregate cycle Time
Throughput           

Stop Starting and start finishing

If we focus on fewer items at a time we can:
1. Increase productivitiy and deliver more
2. Get our customers more engaged
3. Have agility to adjust when changes occur
4. Lower our cycles times, less time to finish after getting a project
5. Limit the costs of delay

David Anderson wrote a Kanban Book for software development 2010

How to limit WIP
Throttling the input (demand) into the system

Lowering the WIP highlights the bottlenecks

Prioritization is no longer about ordering all the work, 
  but picking the next one

We need to optimize the whole system not just one part.

Kanban
Start with what you do now
Agree to continuous improvement
Respect the current process, roles, responsibilities
Encourage acts of leadership at all levels 

5 Core Properties of Kanban
1. Visualize Workflow
2. Limit WIP
3. Measure Meausre and Manage Flow
4. Make Process Policies Explicit - document what done means
5. Improve Collaboratively (Using Models/ Scientific Method)


Throttle demand to meet throughput in order to gain leveled flow

Shortening cycles and increasing the rate of delivery will build trust

Identify the constraint in your system and focus on optimizing the whole

Kanban companies here in Austin:  BankVue, HomeAway, BaazarVoice
Dan Pink RSA Drive video

Sprint time is how long you can resist change

64% of features are never or rarely used

Do we ever measure the usage of the features we delivery?

Monday, September 24, 2012

Awesome FireFox AddIn, Blank Your Monitor

I tried switching completely over to Chrome recently to get the better threading of tabs, but one thing stopped me - the lack of a good darkening addin or feature. I tried a few chrome addins, but always got a bright flash between sites. My eyes are photophobic, so staring at a white page with black letters gives me a headache after a while. Blank Your Monitor works great in Firefox. You can toggle between normal and dark mode with just hitting Ctl-Alt-B, which is much easier than "Tools/Options/Content/Colors...". I still need to toggle because some sites (I'm looking at you Facebook) are not made for sensitive eyes - all the buttons are black with no hint or title. I love Blank Your Monitor. Thanks dlento for creating it!

Thursday, September 06, 2012

"Don't Just Do Something, Sit There!"


 
During a recent upgrade I panicked. We were upgrading our system to be on a Universal Time so all the countries could schedule and see events in their local time (don't get me started on daylight savings time).
Our team in India ran my upgrade script to convert all the historical records to Universal Time from the local server time, but my web application was still showing the old time, just as if the script had not run. I spoke with the person doing the SQL script execution and he assumed me he already ran it.
 
But our system wasn't showing the new times. This is when I panicked. Instead of carefully thinking the situation through and talking with some other knowledgeable people, I had the India team rerun the script. Then it hit me. The servers where caching the times. The database had really been updated, but the app was clever enough to cache the time to save load on the database.
 
I restart the web app and sure enough the historic times were now changed by twice the intended amount. After rerunning the upgrade script with a negative time to set the clock back everything was fine. The upgrade proceeded and I learned a valuable lesson,
 
"Don't just do something, sit there! (and think)."
 

Saturday, September 01, 2012

Keeping up with Tech

Besides the bizzion tech blogs and twitter feeds which litter the internet, I find book publishers' email newsletters to be a good source of what is new and upcoming in the tech field.
The advantage of dead-tree publishers is that they take the time to see what is really viable and take a little longer term view than web-only sources.
A print publisher has more at stake if a book bombs - a warehouse full of unsold books.
A few that I subscribe to:
The Pragmatic Programmer newsletters and magazines.
Mannings subscribe to Newsletter.

The Myth of the Better Alternative

For some reason, we believe the Myth of a Better Alternative. We believe that, if someone or something is bad, there must be a Better Alternative. We see an evil despot overseas and believe that if he were overthrown, the Better Alternative - democracy and freedom - would flower.
 
The problem is, of course, we don't know who will rise to power after a bad dictator is disposed. Will the new government be better? Hopefully, but it could easily be worse. We just don't know. We can't know. Removing a dictator could result in a long, bloody civil war that kills thousands of people and literally destroys the country, only to be followed by a more evil dictator.
 
Czar Nicholas was not the best ruler, but I think many Russians - the 20 million killed by Stalin come to mind - would have preferred the Czar to the communists.
 
The United States does not need to intervene everywhere in the world that has what we consider a less than optimal government. We just can't afford it. Besides, we don't know what's best for other countries. Why don't we just save thousands of our soldier's lives, trillions of dollars and let the rest of the world work out their own problems?