Saturday, July 24, 2010

This week, I attended the Atlanta Powershell Usergroup presentation by Aaron Nelson (aka SQLVariant on twitter). I met Aaron in January after the Atlanta MS Pros meeting where I had volunteered to get a presentation organized on Powershell - I found Hal Rotenberg (aka Halr9000 on twitter) to give people an introduction to powershell (better a local MVP to do that than a novice).Aaron told me when we met in January he was giving a presentation in a couple of weeks on using Powershell with SQL Server. I encounterd Aaron Nelson a second time during the year at SQL Saturday - where he did that presentation again, and showed a method I had not see yet- that had $_.Script(). After SQL Saturday, I researched what that Script method was. After the meeting this week, I told him that I had found that he was using a method on the SMO object. For a DBA this object gives you the power of SSMS (SQL Server Management Studio) via Powershell. For a DBA this method would be one that should certainly be in their toolbox.

In the days following the presentation, I was coding on a development project that is targeting a good number of modifications to a production system. I was fairly sure that the Development databases were partially modified, and needed to prove that to others on the team. I remembered the SMO object and that Script method, and wanted to get the defintions of the database to compare to each other.

 
$load = [reflection.assembly]::LoadWithPartialName( "Microsoft.SqlServer.Smo" )
# Derive the SMO Application Object
$smo = [Microsoft.SqlServer.Management.Smo.SmoApplication]
$server = new-object "Microsoft.SqlServer.Management.Smo.Server" $servername
$database = $server.Databases[$cfg.config.DatabaseOLD.Database]
$tables = $database.Tables
[string] $oldDatabaseDefinitions = $tables |? {$_.Name -match "T_" } |% { $_.Script()}

A few lines of powershell was able to give me the definitions in one string. I output the string to text files and with a file comparison tool could show exactly what changes were in the definitions between the databases we were dealing with.(Production,QA,two development databases, and a 'sandbox' database).

Also this week, I tried catching up on some listening of the powerscripting podcasts (last year my listening to this pocast was how I discovered Hal Rotenburg lived in the Atlanta area, and led me to recruit him for Atlanta MS Pros January presentation). In episode 106 there is an interview of Chad Miller, and they discussed the codeplex project SQLPSX(SQL Powershell Extensions)that he is involved with. From that discussion I learned more about SMO and how Microsoft had done usability studies on that object. Powershell combined with the SMO object seems to be key to those extensions. During the interview he also dicussed his extending the Powershell ISE - which I was not aware was open for extension. He extended it to interact with SQL server - the SMO object was part of the toolkit he used. I will have to start exploring some of the code out there for that project - as I am curious about how he went about this. That could make for an interesting presentation.

I saw on Chad Millers blog he did a Powershell ETL presentation for the Virtual Chapter of Pass, and between that video, and the Powerscripting interview I can tell that Chad Miller is a very capable speaker, and presenter - someone worth looking at to learn from.(Which is why he is a Powershell MVP).

Powershell combined with the power of existing functionality of the SMO object deserves more study. SMO comes with SQL Server 2005 and 2008, however they are different versions. At work I will need to make some room for SQL 2008 R2 on my workstation so I can work with the latest version. (always more to learn).

Saturday, July 24, 2010 7:45:09 AM (Eastern Standard Time, UTC-05:00)
 Thursday, March 18, 2010

I ordered a netbook online this week. I had been looking at the netbook or a really powerful laptop. I liked the idea of the netbook if it had the right amount of battery life, and I liked some of the powerful laptops too - the i7 quad processor from Vaio had me pausing. I went with the netbook from ASUS the 1005PE that claims a 14 hour battery life (review in link and my first running down of the battery looks like it will be about 10 hours)- in a 2.5 lb package.

The Netbook comes with the Windows 7 Starter OS -and it has IE8 installed by default. I happened to do a search on netbook browser and saw an article that claimed Googles Chrome would be a likely choice for a netbooks in the coming year - it was an old article - so I just kept moving about with IE8. I did detect the sluggishness with IE8 on this machine - even if it claims to be a 1.6ghz - I could tell that IE8 was sluggish. I downloaded Google Chrome - and already I can tell a difference. Maybe too early - but I would suggest you try it if you are using a netbook.

Last year at Devlink.net there were a good number of netbooks in use from attendee and presenter alike. Chris Smith from Microsoft did presentations for Visual Studio 2010 on a netbook - but it seemed to be a special build for the machine he was using (that was my impression). What I saw was a lightweight portable way to take notes and get to the web that did not weigh 7 or 8 Lbs. At this point the netbook fits what I want to do with it - reading technical blogs and viewing online technical videos like those on Channel 9, PDC,and MIX. All without a lot of weight in my lap - and no wires or plugs needed.

One thing that I noticed when I was shopping around in the stores was that the network connections being advertised were using a lot of N-Dual or Dual Band Wireless 802.11n and how it had a much better range. In our house the wireless router is old, and there are a couple of dead spots for the computers with older wireless hookups. I walked into the known dead zones with the netbook and it continued to function which made it even more practical in using it around various parts of the house.

So for now - I can see using the netbook for looking up information, reading,some web based email, and watching online content. I can use my investment in the i7 desktop I built last year for the hard core programming learning I want to do. That feels like the right machine for the right job.

I have seen the videos about the new IE9 tonight that is being released as a preview and how it uses the GPU (which also exist in netbooks). The HTML5 and SVG with CSS3 sounds like web development is about to get a huge shot of demand to use these new technologies. I may be trying that on the netbook too. It sounds like they rewrote a lot of the aspects of IE for the new version - and performance was a key point that I was hearing from the developers involved. A perfomant browser will be key to surviving on low voltage devices - netbooks and phones - and they may become some of the more prevalent devices out there.

The IE9 Preview really is just that - seems like a presentation of what they are working on - perhaps an iteration proof of concept of various pieces of functionality. The hints of HTML 5 and its impacts are starting to be seen.

Thursday, March 18, 2010 5:34:58 PM (Eastern Standard Time, UTC-05:00)
 Sunday, January 03, 2010

Powershell 2.0 is considered to be part of the "Windows Manangement Framework" and has a download page. Powershell 2.0, WinRM(remoting service), and BITS 4(Background Intelligent Transfer Service) makeup this management framework. Powershell 2.0 was shipped with Windows 7 and Server 2008 R2, and was made available for Windows XP SP3 and Vista SP1. Version 2 is completely compatible with version 1 - so any scripts written with version 1 will work in version 2.

On Dec 22, 2009 a new Powershell 2.0 SDK was put out for dowload by Microsoft.

There are two videos from the Micrsoft PDC2009 - SVR12 and SVR13 that show writing a simple GUI using the powershell API. During these videos it is mentioned that the powershell ISE (Integrated Scripting Environment) was developed with this same API.

There are Microsoft examples on how to host powershell within an application- which is what a developer would do to utilize powershell within their own application. This is the direction that Microsoft has started with their enterprise level tools. Now developers can embed powershell so that you can develop functionality as a cmdlet/script and the exercise that functionality from the GUI (Silverlight,Web,Windforms, or WPF).

The first hurdle in hosting powershell is getting a reference to it. System.Management.Automation does not show up in the .Net list of items. Browse to
C:\Program Files\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0\
and there you find the System.Management.Automation.dll. Verify that your reference works. If you can enter the code line below in the project and Intellisense works (the create method is visible) - you have the right version of the DLL in place.

PowerShell ps = PowerShell.Create();
(Note the example line of code is from a Microsoft example.)

The Microsoft links on how to host powershell have a good number of starting projects to show the usage of some parts of the API. The examples there are only Console examples. The Code posted on the Powershell blog for the SVR12/13 did use GUI's, however I did not appreciate these exampels as much - as it added a few users onto my machine for showing the security aspects that they used in the demo. The examples are a start, however it will take more for work to get a command of using the full power of the Powershell 2.0 SDK.

Powershell SDK can also execute powershell commands on remote machines using the WinRM functionality - if the remote machine allows the execution and the credentials of the user attempting are authorized. This remote execution allows for collecting information from remote machines back to one location for reporting/processing.

The Microsoft PDC 2009 presentations were targeting development using powershell API toward the Admin community, and controlling what access a given a user - programatically controlling this based on security roles.

With functionality being stored completely in PowerShell cmdlets/scripts, the practice forces a complete seperation of Logic and Presentation - which simplifies testing. Reworking the presentation layer is also greatly simplified. The PDC2009 videos described how the Exchange 2007 team wrote their first GUI in 10 months,as they developed their powershell cmdlets- when they were asked to reskin their GUI; it took only two weeks - the Exchange team was euphoric with that result. They did not have to put everything in the GUI, as the more advanced, or special case scenarios, could be handled by a powershell cmdlet only - thereby reducing clutter in the GUI and overall simplified maintenance.

Sunday, January 03, 2010 11:04:36 AM (Eastern Standard Time, UTC-05:00)
 Thursday, September 10, 2009

I have been wanting to research the idea of using those multiple processors that are now appearing on laptops and desktops. Today I stumbled upon a channel 9 show with Joe Duffy and Eric Meijer. The ease with which these two covered the topic and with such clarity was awesome. If you have an hour to dig into the complexity of concurrency and Software Transactional Memory, and roots of Haskel injecting its principals into to these ideas - give this a try.

Thursday, September 10, 2009 9:24:37 PM (Eastern Standard Time, UTC-05:00)
 Sunday, June 28, 2009

Codestock 2009 wrapped up last night.The event was oversold by 1 - 376 attendees. I enjoyed the selection of talks that were available, and the sessions I attended were good. Of course I had a favorite.

My Favorite session was delivered Rik Robinson of Wintellect. His talk was on PRISM, from the Microsoft Patterns and Practice group (PNP), this is a Guidance that can be used in WPF and Silverlight - and incorporates the Unity IOC framework (but that can be swapped out if you prefer). He kept it simple, he introduced one thing built on another, and he got the main concepts of how PRISM can be used to develop applications that decouple View and ViewModel in a very clean fasion. The session was very interactive and it must have been a bit of pressure to have the Wintellect CEO sitting in the session.

Through another acquaintance I got to have dinner with Rik that night(day of his presentation), and hooked up with him for yet another dinner after the last Codestock session before driving back (we did not attend the giveaways).

Wintellect is local to Knoxville, and is one of the supporters of Codestock. They arranged to have to other presentations besides Rik Robinson's. John Robbins and Jeffrey Richter gave presentations via live meeting - and took questions via cell phone (which you would hear in the room as an echo - but it worked). I attended the John Robbins debugging presentation and it too was excellent (he can make technology humourous) - I picked another session instead of the Jeffrey Richter session - if they recorded it I am going to go watch it.

I feel a bit responsible for a comment from another attendee about one session I attended. The session just seemed like there were more examples that were ready - but not shown - and the session ended earlier than the time slot. I overheard someone else make that comment about it - and it seemed to fit. I had been fine with how it was -and only when I heard the comment did it occur to me that not all of the examples had been touched on. I had sat down to lunch with this speaker before his presentation. It occurred to me that I may have impacted his preparation, and even the thought that I did impact his presentation makes me feel sorry for having disturbed his preparation. I felt it was still a good presentation. I heard how much Rik Robinson prepared and saw the result - it is a lot of work - and it makes me wonder if my trying to be social - was just at the wrong time (My apologies to the speaker)

There were several topic areas of interest for me during codestock. WPF,PRISM, MEF, Debugging, WCF, ORM usage, and TDD. There were sessions that touched on, or spoke to these - and much more.

Another acquaintance suggested I attend Kevin Hazzard's session on "How I learned to love Metaprogramming" - which was a very good look into the way that the compiler creates a dynamic data type in .Net 4.0. The data type of dynamic - is static. That statement seems at first to be an oxymoron - but the element is treated as static and how it resolves at runtime is dynamic. The presentation showed how C# and Python could interact - and gave some examples of dynamically wrapping elements of XML using C# using the Dynamic elements. His XML Example reminded me of something that Powershell can do today - and Kevin said that the powershell team did not go down the Dynamic Language path - which he was not pleased with. Kevin Hazzard is a very good speaker and he gets into the topic very deeply - and explains it well. I would like to hear more about his perceptions on Powershell, and how he thinks it might have been done.

There was one connection that I did not expect to occur. At the CodeStock social event, I was sitting at a table, and a fellow walked over and looked at me and said - I think I know you. After a moment or two - I recogognized him from a twitter photo. When I went to Devlink 2008 - I was trying to use Twitter to find out where people were meeting up, and I had been on twitter for maybe a month at that time. This fellow was not able to attend the DevLink event - but was trying to follow what was going on - and he responded to help me figure out where people would be. Between this fellow and "TheCodeCampJunkie" - I was able to hook up with people at DevLink. So here was my first time meeting a person face to face - based on using twitter. We talked about .Net and his getting certified and how it was not helping him get work.

The main focus of these event is the dissemenation of knowledge of what is new and how to use the technology we deal with. The other part of this is that you are meeting and speaking with other developers, whom you may have not ever met otherwise.

Several people have posted pictures from CodeStock - Alan Barber got one picture of me at the Dinner on the night before the event.

Sunday, June 28, 2009 7:37:48 AM (Eastern Standard Time, UTC-05:00)
 Sunday, June 21, 2009

On Channel 9 Hansleman interviews Jeremy Miller

Sunday, June 21, 2009 8:35:06 PM (Eastern Standard Time, UTC-05:00)