SoSlow Data Import for StackOverflow Data-Dump

Just as a quick update post on my on going series of posts on using PLINQ on Stack Overflow data-dump.

In my initial post where the core of what I was doing was outlined, at the time the popular (and quickly found) option was to use a series of stored procedures made available by Brent Ozar to import the XML data into a SQL database.

XML into DB

Brent recently replied back on the original post tipping me off to an easier more convenient way to get the data into SQL.

… There’s an even faster way to import the XML files now using Sam’s SoSlow.exe tool. You give it a connection string (including the database name) and it’ll create the tables and import the data. Just FYI – it doesn’t warn you, but it does delete and recreate the import tables every time. It’s dramatically faster too.

I’m all for an “easier” and “better” approach, so I gave it a try.

The first step was to get a copy from Sam Saffron‘s GitHub respoistory

http://github.com/SamSaffron/So-Slow/downloads

It is a small C# WinForms application with 3 buttons, so the use of it very simple and suits well with the also simple layout of my PLINQ demo application.

SoSlow Interface

In under 15 minutes all the data was imported (results will vary depending on your machine configuration). This will help out keeping the data more up to date when the next public release of the data is made available.

StackOverflow DataBase Successfully Created

Advertisements

Woo Hoo – 3D Video Effects in PowerPoint 2010

Full disclosure: This is way off topic for my blog and I just wanted an excuse to embed a Simpsons episode in a powerpoint presentation.

Inspired by this post on the PowerPoint MSDN Blog and its associated YouTube video, demonstrating the ability of PowerPoint 2010 to use DirectX and hardware support for its rendering engine. Great effects can be achieved smoothly. Like a lot of us (most unwilling to admit), I’m impressed by reflection of a video as it plays.

Slide Show Preview

Slide Show Preview

Setting up the 3D Rotation Effects were also easy:

Format Video

Format Video

Same goes for the Reflection effect:

Format Video Reflection

Format Video Reflection

Enjoy:

Reflection Overflow

Reflection Overflow

Now saving this pptx file showed me that in-fact the video file is embedded, so it’ll make moving the pptx file easy (so long as it doesn’t require to be emailed).

File Size

File Size

Once a video is added you can make use of it on several slides, and use the ‘Trim Video‘ feature to select a section of it for each slide.

Trim Video

Trim Video

2 Slides each with a segment of the video:

Reusing Video

Resuing Video

The presentation file along with the video that was embedded, there is only 1 copy of the video in the pptx file.

File Size of Multiple Video Copies

File Size of Multiple Video Copies

“Typing” animation effect in SketchFlow

*Update 3 [16-Oct-2010 – Step Improvements]:
Thanks to some feedback from Ricky (in the comments section), I was made aware that my original steps to perform this effect are not detailed enough to follow, I too struggled to follow my own steps 1 year later with a new version of SketchFlow. I have created a demo application and put the source code up on my GitHub account.

I updated the steps below with more details, and consistency in the naming of the controls these animation actions need to be performed on.

*Update 2 [30-Aug-2009 – Just to clarify]:
After seeing this post summarized up on several Silverlight blog aggregation sites in 2-4 sentences it became clear that part of my intended meaning of “a solution that works ok” can be interpreted negatively.

A useful (but not the only) way SketchFlow can be used to to create quick (and rough) animated/transitioning sketches as part of a prototyping phase. In order to get more visual information across to key stakeholders or for designers to experiment. In this kind of scenario a quick “works ok” solution is generally acceptable as it’s not a polished end product that is being built. It allows a design concept to be created quicker and get people discussing it sooner.

*Update 1 [25-Aug-2009 – First Feedback]:
Thanks to Christian Schormann of Electric Beach with a great alternate approaching using a custom behavior in his post Type-On Text For Sketchflow With A Behavior.
Extracting code from WordPress is sometimes a little tricky, so I uploaded Christian’s behavior code class on Gist.GitHub.

On to the post:

After searching for a while I was unable to find an answer to how you would go about:

Simulating a user typing text in a SketchFlow Animation

So I came up with a solution; that is kind of crude, but works “ok”*. The definition of ok is very subjective in this situation. I also describe steps to animate a highlight effect on some text. So if you’re reading this and have a better/easier solution let me know.

I’ve also asked a StackOverflow question, so will see if that yields any useful tips, or alternate approaches.

The steps outlined below are a combination of animating typing and performing a “highlight” and delete action. Making use of frames in the SketchFlow Animation builder.

To summarise first:

This animation effect is a N second transition on a resizing of a white rectangle. The rectangle goes from covering all the text, to a final width of zero. This “wipe” action simulates text being typed (i.e. slowly coming into view).

In this sample the 9 second value is based on how long the text block is and how fast you want the “typing” to occur.

Here’s a more detailed breakdown…

Step 1 – Control Creation:
For this you need 4 controls, the number order describes how they need to be stacked over each other. 1 and 3 are used together in the first part of the animation. 2 and 4 are used together to achieve the typing effect. All these 4 controls need to have the same X and Y (top/left) position.

  1. Create an “existing_typed_text” textblock, this contains the text that you see first before the animation begins. It represents text that exists on load.
  2. Create a “simulated_typed_text” textblock, fill this with the text you want to appear as being typed.
  3. Create a “highlight_rectangle” rectangle that matches the size of the “existing_typed_text” text box set at opacity 50% and appropriate grey (highlight colour). This acts as the “highlight” action when you click on the text box and all the text is highlighted.
  4. Create a “wipe_action_rectangle” white no border rectangle for the animation effect action. This is a rectangle that will cover “simulated_typed_text“.
TypingTextAnimationControls

Controls List

Step 2 – Control set up (still not animating yet):
Here we set up how it is to begin with. Items 2, and 4 above need to be not seen, this can be achieved by toggling their ‘visible state’ to ‘collapsed’. We also want to have the select text action fade in (“highlight_rectangle” – the grey rectangle item 3), so set that item to have an no opacity (0%). The order in which you perform these is not important as we’re still setting up.

Appearance - Visibility - Collapsed

Appearance - Visibility - Collapsed

Set up actions (order does not matter):

  • Collapse the “simulated_typed_text” textblock. (Item 2 above)
  • Set the opacity 0% on the “highlight_rectangle” rectangle. (Item 3 above)
  • Collapse the “wipe_action_rectangle” white rectangle. (Item 4 above)
Base State

Base State

Step 3 – Animation of highlight:
This is where we start the animation process. In this first frame, the action is the “click” so we want the grey box to show up, as if we’ve clicked inside a textbox and all the text has been automatically selected for us (in order to type over it and replace).

Frame 1: Set the opacity to 50% of the “texthighlight” rectangle. So it moves from the starting opacity of 0% to 50% in this frame. Choose an appropriate time span, I left it as 0.5 seconds. Remember you’re selecting the animation time between the frames.

Grey Highlight

Grey Highlight

Step 4 – Animating a “delete existing” action:
Here we’re animating as if the user has pressed the delete key, or has just begun typing the first letter, any action that causes the text to be removed/overwritten. This frame can be a quick action, as we just want the text to disappear, so I have it set to 0.0 seconds (instantaneous).

Tip: Right click to insert frames between steps, or at end.

Insert New Frame action

Insert New Frame action

Frame 2: Two actions. Set the collapse property for existing text and the grey highlight rectangle in animation frame #2. (Appearance -> Visibility -> Collapsed as in the image earlier). The order here doesn’t matter. Timing 0.0 seconds.

Step 5 – Setup frame for new text:
This frame sets up the text we want to appear in the visible state (no longer collapsed), we don’t actually see this step but we need to to occur quickly, another 0.0 second animation. We see nothing because the white rectangle is on top covering up the text still. These are items 2 (“simulated_typed_text“) and 4 (“wipe_action_rectangle“) from the setup list.

Frame 3: Set the collapse property back to visible for the new text and white rectangle. The order here doesn’t matter. Timing 0.0 seconds.

Step 6 – Animate the wipe/typing effect:
This frames transition gives the illusion of the text appearing as if typed.

This is the real work step that simulates the typing effect via a simple “wipe action” where text “appears” of the length of this animation frame. To achieve this we perform a drag-resize of the “wipe_action_rectangle” rectangle from left to right. The text appears slowly as the rectangle shrinks – as if it’s being typed.

Note: because it’s just a rectangle and resizes smoothly it’s not exactly 1 character at a time appearing, but if it’s quick enough the user won’t really notice or care. This frame animation time is your own magic number, in this case I chose 9 seconds based on the length of my text.

Frame 4: Resized the top most rectangle “wipe_action_rectangle” starting from it’s left side, dragging to the right. Only animating the white covering rectangle. Timing 9 seconds (adjust for your own text length).

Four Frames of Animation

Four Frames of Animation

Done. There you go, a 4 frame animation simulating a user typing some text. The link again to the source code sample. As a further exercise you can have a fake cursor image move via animation before Frame 1 to show the user clicking (activating) the textbox causing the highlight.

Using SketchFlow First Impressions

I’m kicking off a new personal project, and I thought this would be a good opportunity to plan out it’s flow of operation using SketchFlow (get a 60 day trial of Expression Blend 3 here). I intend to develop the application in ASP.NET MVC, not Silverlight. So what I will be outputting from Blend will only be used to refine the UI and get initial feedback from colleagues and friends.

The power of SketchFlow is to create quick informal sketches of screens and to start mocking up interaction through animation (transitions, visual effects). It’s not designed to create final polished artifacts, existing tools already do this well, such as Adobe PhotoShop. So far it seems to be working well.

So I thought I would summarise some initial tips and issues I’ve already had to deal with in the form of questions (and answers).

What if controls in design mode aren’t behaving as you expect?
This was a simple issue, I had forgotten I had placed a transparent rectangle (factor 20%) over a a few groups of controls. Once I adjusted their z-order using Order.. send backwards/forwards, it was working fine. I chalk this up to it having been a while for me in using a tool like this. When controls overlap, you can select controls behind them but not perform all the actions you would like via mouse actions, i.e. resizing is blocked. So either un-overlap them to resize, or use the property windows.

How do you set the default screen size in SketchFlow?
The screens I’m sketching are for a website, I wanted to sketch them down the page so needed a larger Y pixel range. I wanted to adjust the default size of new screens so I wouldn’t have to manually change each new screen. I was unable to find a setting that is per project, only an application wide setting via menu: Tools… Options…

Setting the Default Screen Size in SketchFlow

Setting the Default Screen Size in SketchFlow

For my use I would have liked to see new screens spawning off an existing screen set to match it’s height and width, tho a feature like that may upset users who want default setup screens every time.

How do you create reusable components in SketchFlow?
The approach I’m using is to create “Component Screens” that can then easily be dragged onto other screens. I’m doing this initially for my heading/navigation. But instead I’ll demo creating a reusable login component (the steps are identical).

Create the components on any screen (new or existing), and select them individually via the “Objects and Timeline” window or on the screen itself (if a new blank screen CTRL+A works the fastest).

Objects and Timelines window

Objects and Timelines window

Then right click on the collection either on the screen or in the “Objects and Timeline” window and select “Make Into Component Screen…”

SketchFlow right click action - make into component screen

SketchFlow right click action - make into component screen

That brings up a dialog, so just give your component a name:

Make Into Component Screen Dialog

Make Into Component Screen Dialog

Now you have a new “green object” on your SketchFlow Map, you can simply drag it onto other existing screens, or use the little drop down menu below it to select “Insert a Component Screen” which will add it to the existing screen you drag it to.

SketchFlow Map Insert a Component Screen

SketchFlow Map Insert a Component Screen

Am I enjoying using SketchFlow… Will I keep using it… Will I keep blogging about this…

Yes

Visual Studio Team Test 2010 – Vic.NET Session

Last night I attended the August Victoria.NET user group meeting and it was a good session and it’s timing was great marker to wrap up my sudo-holiday and get me blogging again.

The first topic was about Visual Studio Team Test 2010 presented by Anthony Borton which is a preview of his Aus Tech.Ed 2009 presentation, see Anthony’s blog post.

The second topic was to be Team System Database Edition in Visual Studio 2010 but was called off after the presenter had their flight delayed out of Adelaide.

Back to Team Test 2010, which has some great features in particular features to assist with being able to reproduce issues (bugs) raised by testers. The most impressive was the ability to easily record tests, parameterise and repeat. An example is to launch your application executable perform a few steps, and using a simple control selection tool select a control (i.e. textbox) and use that in the test’s Assert action. In conjunction with the macro recording ability to generate automated user interface tests, when a test fails all the environment details are easily submitted as part of the bug report – operating system version, current memory usage, event log dump, screen shot, extra description fields, and a video recording of the test machines screen. Yes a video recording, to catch the actions of the tester who isn’t sure what exactly they did.

The next impressive feature was it’s virtualisation integration (“Lab Management”), assistance in managing both the environments and the snapshot’ing of state for a given test. Making it possible to go back a significant duration back in time to re-create an issue (conditional on snap-shot retention policy).

In summary Team Test 2010 has some very nice features to greatly assist; recreating issues, reusing tests, reporting bugs.

Additional notes I took away from the presentation:

  • There are some 64-bit issues with 2010 beta’s in particular making use of MCE for video recording.
  • The potential for SP1 of 2010 to include integration with Microsoft Expression Encoder to resolve and improve issues with MCE.
  • Take another look at the “Architecture” edition on Visual Studio 2010, as it has had major overhauls to it’s feeble 2008 feature set.

There was also a give-away of a copy of Visual Studio 2008 and a 12 months MDSN subscription, going to a winner who attended a Queensland user group meeting, congratulations to him.

The next meeting hasn’t been scheduled yet but stay tuned to the victoriadotnet site.

ServiceModelEx

I have brought up ServiceModelEx several times already, and thought I’d dedicate a post that I can link back to other times when I mention ServiceModelEx.

ServiceModelEx is a set of WCF extensions primarily written by Juval Lowy from IDesign.net. This library of extensions is called ServiceModelEx it is available as a free download. The library is accompanied by an extensive collection of demo applications covering the use of WCF in conjunction with ServiceModelEx.

To quote the front page of the demo and utility section:
IDesign serviceware are a set of original techniques, tools, utilities and even breakthroughs developed by the IDesign architects. The utilities are largely productivity-enhancing tools, or they compensate for some oversight in the design of WCF.

IDesign WCF Tools Interface

IDesign WCF Tools Interface

At the time of writing the current version of the resources-cd demo count was 133, with some overlaps and but all demonstrating some specific concept or approach.

Pex – Assisted White Box Testing

On a brief side note after attending Mitch Denny’s (from Readify) presentation tonight on “Tools for Improving Software Quality” he introduced us to a great little tool for Visual Studio 2008 and beyond. “Pex (Program EXploration) produces a traditional unit test suite with high code coverage“.

It’s a tool that writes the unit test for you!

This may seem like a contradiction to the purpose of the unit test, and slap in the face for those promoting Test Driven Development (TDD). But that’s incorrect. The purpose of Pex is to assist in catching the missed branches (especially the mundane and tedious ones from switch statements). To be used to polish the unit tests, after the best practice approach is followed; of writing the core of the unit test before coding the actual function begins.

Given a parameterized unit test written in a .NET language, Pex automatically produces a small unit test suite with high code and assertion coverage. To do so, Pex performs a systematic white box program analysis.

Download it here at the Research.Microsoft.com site; available for “Commercial Evaluation” and “Academic Use” as it’s still in Beta.

The tool integrates directly into Visual Studio and assist with MSTest tests. You write click on a method and it explores the code paths determines input variables to test areas of the code your logic currently doesn’t cater for, thereby allowing you to further expand the function itself to cater for more “expected exceptions”.runpex

Here are some more screen shots on the official Pex site, also check out the Channel 9 video on it.