It’s going to be one of those days…

14 07 2008

VS2008 has crashed 20+ times today.  Reboots aren’t helping.  I’m slowly uninstalling plug-ins at the moment.  Ugh.

Obviously a Monday

I broke'd it...

Tags: ,




AnkhSVN 2.0 Released - How’s it look?

11 07 2008

When I first started using Subversion full time for all of my personal projects, I stuck with the VisualSVN server and AnkhSVN as a Visual Studio client.  Both were free, easy to install, and easy to use.

However, after a few weeks, the AnkhSVN client could almost be called “annoying.”  It trampled over the existing SCC plugins for SourceSafe (for work) and made a mess out of several of my project uploads.  I ended up going back to using TortioiseSVN and doing everything through Explorer.

When AnkhSVN 2.0 was released, I figured I’d give it another shot.

The site claims quite a bit—including several unique additions:

  • Pending changes window; subversion status and commands available in one place
  • Full support for Visual Studio 2005 and 2008; AnkhSVN is now a SCC package instead of just an addin
  • Better log viewer
  • Merge support
  • Property editor
  • AnkhSVN now supports most project types previously unsupported via the SCC api
  • All solution explorer actions (rename, copy&paste, drag&drop) keep subversion history now
  • Enhanced build process and setup
  • Automatic check for updates
  • And last but certainly not least end user documentation

All of those look great—especially the SCC package and changes window.  But how does it compare once installed?

After installation and starting up VS2008, everything looks normal.

Brief Look

Pending Changes Window

The new pending changes window is FANTASTIC—much improved over the old 1.x versions.  I did run into a snafu when trying to resize the window where the scrollbars didn’t update on the screen; however, I’m not sure if it’s a VSS or AnkhSVN issue.

SCC Package

Under Options > Source Control, AnkhSVN shows up just like it should.

What does boggle me is that all of the Subversion commands and menus are available no matter what—even when the VSS SCC is enabled.  It still has the stink of VSS and SVN trying to step on one another (“pick me! control your project with me! no, I’m better! pick me!”).

Log/History Viewer

I really like the new history viewer.  It’s clean and easy to read; however, if you change the options at the top—there doesn’t appear to be a way to “change it back” and see the history again, close the view and review.

Annoyances

  • Opening a project from Subversion (File > Subversion > Open from Subversion) will open a project just fine, copy it down, but never opens it.  You have to go back and open the solution after it’s created the local structure.  Not huge, but annoying.
  • When viewing history; you cannot view the history of a single file (that I’ve found) in the Repository Explorer. 

I’m still planning to give it a whirl for the next couple of weeks and see what happens.  Hopefully over a couple weeks I’ll have more time to code—it’s been a busy July so far!





Catching Async Postbacks from Server Controls

11 07 2008

In my current project, I created a custom server control that presented the user with questions and answers—they select the answer and move on.

However, a requirement was that the user could push a button and “select all”.  Unfortunately, DropDownList objects are not as easy to select as, say, a CheckBox.  In addition, all controls are dynamically generated—I knew the IDs, but couldn’t specify the Async trigger in the MasterPage’s Script Manager.

I could, however, find the name of the control and do a bit of magic with it.

Here’s how:

First, in your server control, check to see if a ScriptManager control is even present.  For this example, I’m leaving out the try/catches—so we’ll assume that it’s there.

private ScriptManager _scriptManager;

Then, in OnInit (or OnLoad, depending on your controls):

_scriptManager = ScriptManager.GetCurrent(Page);

GetCurrent fetches the current AJAX ScriptManager control from the context you specify—in this case, the current Page object.

Now we’re ready to consume the ScriptManager.  First, we ensure that it’s not null AND, most importantly, that the line of code is being hit during an Async Postback.  Regular postbacks, for the point of updating an UpdatePanel don’t matter to us.

if (_scriptManager != null && _scriptManager.IsInAsyncPostBack)

{

var fromWhere =

_scriptManager.AsyncPostBackSourceElementID;

The ScriptManager’s AsyncPostBackSourceElementID (seriously, can we get longer field names?) provides just that, a hashed heirarchy of the control that caused the Async Postback.  For this to work, it’s important to remember that you must either have ChildrenAsTriggers set to True or have explicitly registered your dynamic control with the ScriptManager.

The hashed output looks like the standard ASP.NET control heirarchy:

ctl00_pbph_tc_ctl01_selectallbutton_123

In this case, when I dynamically created my button, I named it “selectallbutton_{id}” to make it easy to find AND store the information I need in this Select All step.

if (fromWhere.Contains(selectallbutton_”))

       {

var id =

fromWhere

.Substring(fromWhere.IndexOf(‘_’) + 1)

.ConvertTo<int>();

       MyMethod(id);

}

The full code block looks like:

_scriptManager = ScriptManager.GetCurrent(Page);

if (_scriptManager != null && _scriptManager.IsInAsyncPostBack)

{

var fromWhere =

_scriptManager.AsyncPostBackSourceElementID;

 

       if (fromWhere.Contains(selectallbutton_”))

       {

var id =

fromWhere

.Substring(fromWhere.IndexOf(‘_’) + 1)

.ConvertTo<int>();

       MyMethod(id);

}

}

Now my dynamically created button’s Click event is caught during the Async postback (inside an UpdatePanel), validated, and my custom method is executed—in this event, taking the “id” that was part of the Button’s ID and modifying other controls on the page accordingly.





Wrapping TabPanel Tabs With A Simple CSS Change

10 07 2008

The last few weeks have been filled with taking an old ASP legacy application and updating it to ASP.NET.  Fun stuff and not to challenging.

However, a “feature” of the AJAX Control Toolkit’s TabContainer finally hit a nerve.  In the past, I’ve ignored the fact that I couldn’t “wrap” the tabs or set how many rows of tabs to create.  I chalked it up to an annoyance and designed applications with this in mind.

After hunting through the Control Toolkit’s source code, the problem is simple.  There’s a line in the CSS explicitly telling it not to wrap.

Well, recompiling the toolkit can get annoying and hurts mobility of your applications—it’s no fun to bundle “custom” copies for a simple styling change.

.ajax__tab_header

{

    white-space: normal !important;

}

That will override the nowrap that is built into the Toolkit’s CSS.

Hopefully, someday, this will be a boolean property on the TabContainer control.





Ready for ReSharper 4.0.1 Nightly Builds?

8 07 2008

I swear that they don’t sleep at JetBrains.  Sleep is good!  :)

Fresh off of ReSharper 4.0’s great EAP and full release, they’re hard at work for ReSharper 4.0.1.  According to Confluence, there’s already been almost 220 bug fixes (as per build 907). 

As usual, caution should be used when evaluating an EAP product (e.g. not on your one-and-only production workstation), but it looks like another great opportunity to kick in some feedback for ReSharper.

You can find the nightly builds here.





Bought a Home! The Epic

22 06 2008

Over the next few days, I’ll be moving into my first home.  I’ve spent the past 6 months scowering the housing market and finally found one I really like.  Unlike most the country, homes in the midwest are going UP in price, so finding what I wanted (in what I could afford) was quite tricky. I’ll post up some pics over the next few days. So, time is tight and I probably won’t be posting much for the next couple of weeks. See you soon! As I do have access to the internet, I’ll be updating this post with news about the new place and photos (if/when I find my camera in the box it’s in).

UPDATE: noon, 26 June - Sellers are unable to meet the requirements of a new roof (my insurance won’t cover the highly hail damaged roof) by the closing deadline–if I can’t insure it, I can’t close on it.  No extensions apply–I fear that they’ll just keep dragging it out.  I let the agent know that the deal’s off.  We’ll work up the paperwork tomorrow when she’s in town.  Grr, guess back to the drawing boards.  Now to call EVERYONE back.

UPDATE: 11:30pm, 26 June - Sellers are now able to meet the requirements (*lots of shouting, angry feelings, angst*) and we’re going to closing tomorrow even though they said they can’t make it this afternoon.  I swear I’ve never felt more out of control or mislead in my life.  Come to find out that what is said means absolutely nothing and requires all parties to SIGN for it.  So, apparently we’re closing tomorrow afternoon.  Now to call EVERYONE back… AGAIN!

UPDATE: 12:00pm, 27 June – The insanity continues.  The closing time is now iffy because the title agency can’t get everything together by the 2:00pm closing time.  I’m frantically trying to get utilities back on since, due to the weekend and the Sunday possession date, I don’t want to walk into a hot, waterless house on Monday morning.

UPDATE: 9:45pm, 27 June – Well, everything is done and I have keys in my hand.  With what seemed like a hundred signatues, countless stacks of papers and agreements, and some awkward moments with all the shuffle of the past few days—it’s finally over.  We take possession midday Sunday.  If nothing else, this has been a wild ride.  Pictures and more coming soon.

UPDATE: 8:00am, 30 June – Well, a day of cleaning (and partial box moving yesterday) and things are taking shape.  Here’s a few photos that I’ll add to as we clean the house.  Click for full images. :)

Front entry

Front entry with real hardwood floors.

Living rom

Living room with passthrough to kitchen, dutch door, and fireplace.

Skylights

Living room has old English framing and skylights.

Kitchen

Kitchen with eat-in dining area, bay window.

UPDATE: 11:15am, 3 July – Wow, what a rush of busy days.  Everything is moved, appliances are in, and the important things are setup and working—the computer (and internet), the new HD TV and tuner, and the coffee pot.





ReSharper 4.0 - Cool Features

13 06 2008

There are quite a few new features to ReSharper 4.0 that are great, but it’s the little things that really can impress and speed up usage.  A few of my favorites are below.

camelHumps. :)

ReSharper now supports Go To > and statement completion according to camel casing.  If you’re like me, you tend to write normal sentences in camel case—it’s just habit.

Using the camel casing, it picks up the variable I just created, not the class.

Lambda support.

I’ve become addicted to the simplicity of lambdas—they express intent and you can read them like sentences.  ReSharper 4 does an excellent job of digging into the anonymous type and pulling up IntelliSense information.

ResponseChoicesController()

.SelectOne(x =>

x.IsDefault &&

x.ResponseTypeId == responseTypeId)

From the ResponseChoicesController, select one that meets the requirements that IsDefault is true and ResponseTypeId is equal to the specified responseTypeId.  To me, and I’m sure I’m odd, that is easier to read than the “written” LINQ code.

Convert Static to Extension.

This is FANTASTIC for revamping existing code to take full advantage of the .NET 3.5 Framework.  I’ve been working on a project the past few weeks to migrate a .NET 2.0 project using Enterprise Library 3 up to 3.5 and LINQ-to-SQL and this addition has been fantastic to move data and business logic into controllers and the LINQ data context.

 





FIX: Printing ANYTHING Locks Up Windows Server 2003

12 06 2008

A few days ago, I installed Visual Studio 2008 SP1 Beta and all the goodies that came along with that.  Since then, printing just didn’t work.  If I tried to print, it’d hang up the application for a few minutes (felt like hours) until it’d error out that the printer was not operational.  I could print DIRECTLY from the printer (the test page).  Meh.

Trust me, while trying to prototype a reporting application and print examples there is no happiness when you can’t print.

After several hours of hunting, testing drivers, trying fixes, etc… I finally came across a TOTALLY unrelated MS KB article, #948046.

The article is for Windows Server 2003 with SP2 and XP with SP2–-both x64 and x86 editions.  It focuses on Microsoft Word and not being able to print if the EU Font pack is installed.  The scenario of “Word document is not printed as expected” is pretty vague.

Now, I’ve been using the same HP printer drivers (an 8150 DN and 5550 DTN Color) for ages without any problems, so I can’t fathom that caused the problem, but who knows.  The problem started after installing VS2008 SP1 Beta (I haven’t combed the install logs to see if it reinstalled Unidrv.dll).

Anyway, the fix to this problem, so far (after testing in several applications including Adobe Acrobat, Word, Excel, Visual Studio, and SQL Management Studio), is to download the hotfix in the #948046 article

Install, reboot, and things work perfect.





ReSharper 4.0 Released!

10 06 2008

Finally, after quite a long wait and an exciting EAP period, ReSharper has been dubbed “done” by the guys and gals at JetBrains.

So far, so good on this side.  I’ve kept up-to-date almost every release on my production machine and rarely ran into any issues.

Now, to talk the bosses into upgrading!





Deep Copy Cloning of LINQ Entity Objects - Not Deep Enough

5 06 2008

Yesterday, I wrote about a great IL solution to deep copying LINQ objects.  Unfortunately, it’s not quite deep enough. :(

The problem lies in the entity sets related to LINQ objects.  For example, in what I’m working on, the Report object contains Marks (grades) based on a foreign key relationship.  The previously discussed IL cloning method copies the records, but because it doesn’t generate new primary keys for those, it throws:

“An attempt has been made to Attach or Add an entity that is not new, perhaps having been loaded from another DataContext.  This is not supported.”

I’ve tried zeroing out the PK fields just as I did with the report object iself—no dice.  Removing the Marks (by setting them equal to either null or new EntitySet<Mark>()) and no dice.

The only way I think I can get around it would be to break the FK relationship, clone the report (which would return a new Id), and then copy each of the Marks objects separately with some sort of loop (similar to below):

foreach (var mark in

new MarksController().SelectAll(oldReport.Id))

{

var newMark = new Mark {

              IndicatorId = mark.IndicatorId,

ReportId = newReport.Id,

             ResponseChoiceId = mark.ResponseChoiceId

});

}

That defeats the purpose though… ugh.

Back to the drawing board!

Tags: , , , ,