Archives

Archives / 2011
  • Building the Ultimate Developer Computer for $1000 - The Parts List

    I am due for a new computer.  Following on the foot steps of Scott Hanselman (Ultimate Developer PC 2.0) and Jeff Atwood (Building a PC, Part VII: Rebooting) I decided to build my own computer.  I have built my own machine before but in the past it has been with mixed success.  Usually I have run into issues with getting a complete set of compatible parts, or fitting all of the components into the case.

    Prior to giving building my own computer another try, I did shop around for pre-built computers (Dell, CyberPower).  The prices of some pre-built computers certainly do make just buying one from a company like Dell or CyberPower very attractive (and also you are practically guaranteed a fully compatible set of hardware), but you do not always get the high-performance machine that I wanted (at least not without paying a premium).  So not only is building my own machine about putting together a high-performance computer, it also has to be very cost effective to be a better deal than prebuilt off-the-shelf computers. 

    I set $1000 as the goal because above $1000 I felt I could get a pretty decent machine from one of the pre-built shops (albeit maybe with some components that I did not necessarily want).  The $1000 price goal also made an assumption that I might sacrifice on some parts knowing that I could upgrade them in the future if this goes well. 

    So here goes... below is the list of parts that I selected to build my $1000 Ultimate Developer Machine.

    I borrowed heavily from Jeff Atwood’s latest post on rebuilding his machine.  He posted it in July 2011 so the parts list was still very up to date.  The only issue was that his selected parts cost just under $2000 and, as mentioned above, I wanted to have it at or under $1000.

    Pulling from his list of parts and skimping and saving where I could I came up with the following parts that I finally went with.  I will talk about each of these later in this post.

    The total cost of the parts above was $972.62.  So below my goal of $1000.  To be fair though, I did reuse a hard drive from another machine: a Seagate 500 GB Hard Drive (Seagate Barracuda 7200.12 SATA 3Gb/s 500GB Hard Drive). 

    So that’s pretty much all you need to know to purchase an awesome machine for $1000. See this post (COMING SOON) which gives a decent set of step-by-step instructions on building this $1000 Ultimate Development Computer.  And then below I dive into each of the parts and why I decided to go with the one that I did (and also recommendations on potential substitutes).  Everything is just my opinion so take it as you may.

    And finally, here is the required Windows Experience Index screenshot after I had built the machine:image

    Motherboard - ASUS LGA 1155 - Z68 - SATA 6Gb/s and USB 3.0 - ATX Intel Z68 ATX DDR3 2200 Motherboard (P8Z68-V LE)

    • This was one of the big differences between Jeff Atwood’s build (Building a PC, Part VII: Rebooting) but it was also a big cost savings.  Below is a comparison of the major differences between the P8Z68-V PRO and the P8Z68-V LE motherboards from the Asus website (http://usa.asus.com/Compare/).  The major difference which caused a minor issue was the lack of a IEEE 1394a port.  The Corsair case that I went with has an IEEE 1394a (firewire) outlet on the front so with the LE motherboard I did not have a place to plug it in.  This was not an issue for me because 1) I currently do not have any firewire devices and 2) I had an old (very old) IEEE 1394a PCI card which I added to allow me to plug it in (just because).  Depending on your Firewire needs you may want to upgrade (either a 1394 PCI card or the P8Z68-V PRO Motherboard). 
      • image
      • image
      • image

    Computer Case - Corsair CC600TWM-WHT Special Edition Graphite Series 600T Mid Tower Gaming Computer Case

    • This is the case recommended in Jeff Atwood’s build.  It is big and it is expensive but after building the machine I have absolutely no regrets spending the extra money on this case.  This case made it so much easier to put the machine together and the extra air flow is awesome.  Don’t skimp here... just buy this one.  I also assume that when I rebuild I will be able to reuse this case so it is a good investment. 

    Power Supply - Corsair Enthusiast TX V2 Series 550-Watt 80 Plus Bronze Certified High Performance Modular Power Supply

    • I did save some money on the power supply.  I knew I would not need as much power as the PSU recommended in Jeff Atwood’s build so I moved down to the 550-Watt and only Bronze certified power supply.  Nothing more to say here other than I traded a lower up-front costs with higher costs to power the machine (Bronze vs Gold). 

    Processor - Intel Core i5-2500K Processor

    • Big difference here compared to Jeff Atwood’s build (i5 vs i7) but it saved me about $100.  I can always upgrade in the future.  Notice that the processor is the limiting factor in the machine’s Windows Experience Index.  If you have the extra money then I would recommend the Intel Core i7 Processor but to keep costs under $1000 I stuck with this Intel Core i5.

    Solid State Drive (SSD) - Crucial 64 GB m4 2.5-Inch Solid State Drive SATA 6Gb/s

    • Once you step into the world of Solid State Drives you will never want to go back.  to quote Jeff Atwood: “I can't imagine using a computer without a SSD any more; it'd be like going back to dial-up internet or 13" CRTs or single button mice.” - The Hot/Crazy Solid State Drive Scale (May 2, 2011).  The SSD drive is what makes this machine blazing fast.  Notice the 7.9 on the Windows Experience Index for Primary Hard Drive.  I went with the small 64GB Crucial SSD once again to save on costs.  This is small for the operating system drive but it is doable.  Windows had to move the page file to the 7200 RPM drive with this small SSD so I am seeing a small performance decrease because of that.  Again if you have the money an excellent upgrade would be to the Crucial 128GB SSD.

    RAM - Corsair Vengeance Blue 16 GB DDR3 SDRAM Dual Channel Memory Kit

    • I didn’t want to go cheap on the RAM so I went with Jeff Atwood’s recommendation.

    Video Card - Sapphire HD 6850 PCIE Video Card

    • I don’t know much about video cards and I always have trouble figuring out why one is better than another.  I do know that one of my biggest complaints with my old machine is the video performance so I didn’t want to skimp here.  So without knowing better options I just went with Jeff Atwood’s recommendation.

    DVD Drive - Asus 24xDVD±RW Drive DVD-RAM/±R/±RW 24x8x16x(DVD) 48x32x48x(CD) Serial ATA Internal OEM DRW-24B1ST

    • I needed one of these.  This one was highly recommended on Amazon and it is an Asus.  Enough said.
      • image

    Hard DriveSeagate Barracuda 7200

    • I reused a Seagate 7200 RPM drive from another machine so technically you could say that I cheated and this development machine really cost more than $1000 if you take into account purchasing this drive.  But I imagine nearly all of us developers that are embarking on building our own machine already have several decent 7200 RPM drives sitting around to use.  If not you can get this one Seagate Barracuda 7200 for $129.
  • Final Flower

    photo

    Winter is on the horizon….

  • Remote Desktops MMC Snap-in on Windows 7

    Windows Server 2008 has a nice MMC Snap-in called “Remote Desktops” which provides a tree view of all of the Remote Desktop Connections for the various servers that you manage and then allows you to switch between them easily by just clicking on one of them in the tree view.  Windows 7 does not have this snap-in built-in by default but you can get it from the Remote Server Administration Tools update for Windows 7.  Below are instructions on how to configure your Windows 7 computer to use the Remote Desktops MMC Snap-in.

    Download and install the Remote Server Administration Tools for Windows 7 -     http://www.microsoft.com/download/en/details.aspx?id=7887.

    Browse to Control Panel > Programs > Turn Windows features on or off.

    image

    Scroll down to the “Remote Server Administration Tools” > “Role Administration Tools”.

    Check the “Remote Desktop Services Tools” checkbox.

    image

    Now you will have the Remote Desktops Snap-in which allows you to have a tree view of the various Windows servers that you manage.

    Start > Run > mmc.exe

    File > Add/Remove Snap-in…

    And then add the Remote Desktops snap-in:

    image

     

    image

  • The configuration section 'system.web.extensions' cannot be read because it is missing a section declaration

    After upgrading an ASP.NET application from .NET Framework 3.5 to .NET Framework 4.0 I ran into the following error message dialog when trying to view any of the modules in IIS on the server.

    2011-11-08 11h01_09

    What happened is during the upgrade, the web.config file was automatically converted for .NET Framework 4.0.  This left behind an empty system.web.extensions section:

    image

    It was an easy fix to resolve, just remove the unused system.web.extensions section.

     

    ERROR DIALOG TEXT:
    ---------------------------
    ASP
    ---------------------------
    There was an error while performing this operation.
    Details:
    Filename: \\?\web.config
    Line number: 171
    Error: The configuration section 'system.web.extensions' cannot be read because it is missing a section declaration
    ---------------------------
    OK  
    ---------------------------

  • Interop type 'AssemblyName.ClassName' cannot be embedded

    I recently upgraded some Visual Studio 2008 projects to Visual Studio 2010.  Most everything went very smoothly but I did run into one issue with some COM assemblies that were part of the project.

    At first the ASP.NET Web Application project built without issues, but then I ran into this error when visiting one of the pages:

    Could not load file or assembly 'Interop.AssemblyName' or one of its dependencies. An attempt was made to load a program with an incorrect format.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    Exception Details: System.BadImageFormatException: Could not load file or assembly 'Interop.AssemblyName' or one of its dependencies. An attempt was made to load a program with an incorrect format.

    My solution to this issue was to remove the COM Assembly from the Visual Studio references and then to add it back in.  (I am not sure this was the proper solution but it worked.)

    But then when I added the COM assembly back into the project as a reference I could not build the project with errors such as:

    Interop type 'AssemblyName.ClassName' cannot be embedded. Use the applicable interface instead. 

    And others indicating that the project was not seeing the reference to the COM assembly.  Luckily this StackOverflow question (Interop type cannot be embedded) had the answer.

    The solution is to change a property on the referenced COM assembly.  To do this, in your Visual Studio 2010 project expand the References section and right-click on the COM assembly and select Properties.  This will bring up the Properties dialog for the COM assembly reference.

    2011-11-03 06h42_17

    Just change the “Embed Interop Types” property from True to False.  Now just rebuild your project and everything will be working.

     

    UPDATE (2011-12-13): The above solution to remove the assembly and then add it back and then set the Embed Interop Type to false does resolve the issue but the problem is that after a Visual Studio 2008 project is upgraded to Visual Studio 2010 there is not EmbedInteropTypes element in the COMReference node in the Visual Studio project XML.  And also there is not a PlatformTarget node in the build configuration (see next item).

    By default the Visual Studio Properties Dialog shows no value as false.  The missing element is probably causing an issue elsewhere during the compilation.  The easy fix, instead of removing and adding the COM Interop assemblies back in, is to just toggle the Embed Interop Types property from False to True and then back to False.  This will put the element in the COMReference properties (as shown below in the screenshot) and then everything else will continue to work.

    image

    In addition I have found that you need to toggle the Platform Target:

    image

    Just change it to one of the other values and then change it right back to “Any CPU”. This will insert the appropriate PlatformTarget element in the project file (see screenshot below).  Make sure you do this for all build configuration (and not just the debug).

    image

  • VB.NET IF() Coalesce and “Expression Expected” Error

    I am trying to use the equivalent of the C# “??” operator in some VB.NET code that I am working in.

    This StackOverflow article for “Is there a VB.NET equivalent for C#'s ?? operator?” explains the VB.NET IF() statement syntax which is exactly what I am looking for... and I thought I was going to be done pretty quickly and could move on.

    But after implementing the IF() statement in my code I started to receive this error:

    Compiler Error Message: BC30201: Expression expected.

    image

    And no matter how I tried using the “IF()” statement, whenever I tried to visit the aspx page that I was working on I received the same error.

    This other StackOverflow article Using VB.NET If vs. IIf in binding/rendering expression indicated that the VB.NET IF() operator was not available until VS2008 or .NET Framework 3.5.  So I checked the Web Application project properties but it was targeting the .NET Framework 3.5:

    image

    So I was still not understanding what was going on, but then I noticed the version information in the detailed compiler output of the error page:

    image

    This happened to be a C# project, but with an ASPX page with inline VB.NET code (yes, it is strange to have that but that is the project I am working on).  So even though the project file was targeting the .NET Framework 3.5, the ASPX page was being compiled using the .NET Framework 2.0.  But why?  Where does this get set?  How does ASP.NET know which version of the compiler to use for the inline code?

    For this I turned to the web.config.  Here is the system.codedom/compilers section that was in the web.config for this project:

    <system.codedom>
        <compilers>
            <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
                <providerOption name="CompilerVersion" value="v3.5" />
                <providerOption name="WarnAsError" value="false" />
            </compiler>
        </compilers>
    </system.codedom>

    Keep in mind that this is a C# web application project file but my aspx file has inline VB.NET code.  The web.config does not have any information for how to compile for VB.NET so it defaults to .NET 2.0 (instead of 3.5 which is what I need).

    So the web.config needed to include the VB.NET compiler option.  Here it is with both the C# and VB.NET options (I copied the VB.NET config from a new VB.NET Web Application project file).

        <system.codedom>
            <compilers>
                <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
                    <providerOption name="CompilerVersion" value="v3.5" />
                    <providerOption name="WarnAsError" value="false" />
                </compiler>
          <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
            <providerOption name="CompilerVersion" value="v3.5"/>
            <providerOption name="OptionInfer" value="true"/>
            <providerOption name="WarnAsError" value="false"/>
          </compiler>
        </compilers>
        </system.codedom>

     

    So the inline VB.NET code on my aspx page was being compiled using the .NET Framework 2.0 when it really needed to be compiled with the .NET Framework 3.5 compiler in order to take advantage of the VB.NET IF() coalesce statement.  Without the VB.NET web.config compiler option, the default is to compile using the .NET Framework 2.0 and the VB.NET IF() coalesce statement does not exist (at least in the form that I want it in).  FYI, there is an older IF statement in VB.NET 2.0 compiler which is why it is giving me the unusual “Expression Expected” error message – see this article for when VB.NET got the new updated version.

    EDIT (2011-06-20): I had made a wrong assumption in the first version of this blog post.  After a little more research and investigation I was able to figure out that the issue was in the web.config and not with the IIS App Pool.  Thanks to the comment from James which forced me to look into this again.

  • Find stored procedures that reference a table column

    We recently moved away from SQL Server replication and the database still has all of the rowguid columns and their associated indexes and constraints in it. We wanted to gain all of that disk space back so we went ahead with scripting out the delete of the indexes, constraints, and columns.

    One thing though is that there are many stored procedures in use and we needed to make sure none of these referenced the rowguid column.  The stored procedures really should not have used the rowguid column at all since it is solely created and used for SQL Replication, but you never know so we needed to confirm.

    The below script is what I created to search all of the stored procedures in the database for the rowguid column.  It could easily be modified to find any information within the stored procedures of a database.  (Note: One thing to watch out for is encrypted stored procedures.  This wouldn’t find anything in those so you would need to handle it through another method.)

    SELECT p.name, c.text FROM syscomments c
    JOIN sys.procedures p ON p.object_id=c.id
    WHERE c.text LIKE '%rowguid%'
    ORDER BY p.name

  • Lock request time out period exceeded

    I was trying to drop a foreign key for a table I was working on and I ran into a time out exception from SQL Server Management Studio:

    image

    TITLE: Microsoft SQL Server Management Studio
    ------------------------------
    Drop failed for ForeignKey 'fk_MyForeignKey'.  (Microsoft.SqlServer.Smo)
    ------------------------------
    ADDITIONAL INFORMATION:
    An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
    ------------------------------
    Lock request time out period exceeded. (Microsoft SQL Server, Error: 1222)
    ------------------------------
    BUTTONS: OK
    ------------------------------

    I also tried dropping the foreign key manually using:

    ALTER TABLE MyTable DROP CONSTRAINT fk_MyForeignKey

    But this time the query was just sitting there running and running.  I let it run for some time and then when I checked the currently executing requests I found it was sitting in a suspended state.  What was interesting about the request was that the wait_time equaled the total_elapsed_time, so it was just waiting there for something else before proceeding.

    This is the sql query I used to see the currently executing requests (one of which was mine):

    SELECT r.session_id, r.status, r.start_time, r.command, s.text,
    r.wait_time, r.cpu_time, r.total_elapsed_time, r.reads, r.writes, r.logical_reads, r.transaction_isolation_level
    ,r.*
    FROM sys.dm_exec_requests r
    CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) s

    And this in the particular row in question that made me realize my query was waiting on something else:

    image

    Now I needed to find out what is blocking my Alter Table command from running.  For that I used a query I found on this blog post Error 1222 Lock Request Time Out Period Exceeded When Set up Replication by Andrew Chen:

    select distinct object_name(a.rsc_objid), a.req_spid, b.loginame
    from master.dbo.syslockinfo a (nolock) join
    master.dbo.sysprocesses b (nolock) on a.req_spid=b.spid
    where object_name(a.rsc_objid) is not null

    I found that another SPID from SQL Server Management Studio was holding onto the table I was trying to alter.  Using sp_who2 with the SPID showed me the owner and where it was coming from, and also that it had been holding onto the table for 2 hours... and guess what!?!  It was me!  Smile

    I had been looking at the execution plan and client statistics of a query that I was performance tuning and that SQL Server Management window had a hold of the table I was trying to Alter.  As soon as I closed that window (and canceled that transaction) then I could drop the foreign key without a problem.

    Hopefully this will help someone else in the future!

  • ScrewTurn Wiki and Load User Profile

    Recently ran into an issue setting up a ScrewTurn Wiki site in a production environment.  The production environment uses a local account as the identity for the application pool.  After deploying the site I then went to visit it for the first time and the ScrewTurn wiki site gave me this exception:

    [SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]

    After some checks to make sure the local account had the proper permissions to all of the necessary files, I finally tracked it down to a configuration setting on the Application Pool.  By default all of the application pools on this server were configured with the App Pool not to load the user profile.  Changing this to true resolved the issue.

    image

    Thanks to this blog post from Dave Burke and this ScrewTurn Wiki forum post for getting me to the solution.

  • How to create a page in Orchard that allows comments

    I am setting up a new Orchard site.  I want to use it for a simple list of articles and allow users to post comments on the articles. Out of the box this seems like it is enabled since the Orchard documentation for Adding Pages to Your Site indicates that you can enable user comments by just clicking the “Allow new comments” check box:

    User Comments

    To enable users to post comments on the page, select the Allow new comments check box. A form will be added to the bottom of the page for user comments. The following image shows the form that is added to the published page.

    But an out of the box installation of Orchard (1.1) does not have this checkbox when you create a new page.  So where is it and how do I enable comments on a Page in Orchard?

    To fix this problem you need to modify the Page content type to include the Comments content part.  Here are the instructions on how to do this:

    How to modify the page content type in Orchard to allow comments.

    Log in as an administrator and then head over to the Admin Dashboard.  On the left hand navigation, select the Content item.

    image

    Then click on the Content Types tab at the top.

    image

    Find the Page Content Type and click the edit link.

    image

    Click the Add Parts button.

    image

    And then check the Comments part check box.

    image

    Click Save on this page and then Save again on the Page content type.

    Now when you create a new Page in your Orchard site you will see the Allow new comments check box so that your users can leave comments on the page/article that you create.

    image

  • Unable to close Visual Studio 2008

    I ran into an issue with not being able to close Visual Studio 2008 today.  My Visual Studio 2008 solution opened and work fine but then when I tried to close it, Visual Studio would just freeze up.  Something was going on since the processor was saying about 25% usage or so and the mouse was blinking back and forth between the wait cursor and the default arrow but no matter how long I waited, Visual Studio 2008 would not close (it definitely looked like it was stuck in a loop doing something while trying to close down). 

    I was able to open and close another Visual Studio 2008 solution without any problems so this confirmed it was something specific to the this solution. 

    After trying a couple random things (such as closing all files, removing a reference, etc.) I tried deleting the Visual Studio Solution User Options .suo file.

    image

    Deleting the file solved the problem!

    So if you are ever in the same situation consider a corrupt .suo file to be the problem. 

  • What version of Adobe Flash are you running?

    If you have ever done any customer support, you probably have a tool box full of different tools and utilities to help you get to the bottom of any customer issue that you run into.  I found another great tool the other day to help with investigation into Adobe Flash issues.

    This simple Adobe flash file will display the customers current Adobe Flash version:

    http://www.adobe.com/swf/software/flash/about/flashAbout_info_small.swf

    In Internet Explorer 8 I get this:

    image

    In Google Chrome I get:

    image

    Simple but yet so powerful.  So mighty customer support representative, make sure you have this tool on your utility belt.

    Technorati Tags: ,,
  • MIME Type for .MP4 files is video/mp4

    I almost made a mistake and put the wrong MIME Type into IIS7 for some MP4 videos that I am serving from a web server.  A search for “MP4 mime type” returns two different results:

    • video/mp4 (correct)
    • video/mpeg (not correct)

    I was not so sure if there was a difference (although most results did lean toward video/mp4, there were a good number of video/mpeg recommendations out there to make me question the correct one).

    To resolve the issue I tried both in IIS7 and Chrome.

    For video/mp4 Chrome will give you the HTML5 video player (a very nice user experience):

    image

     

    For video/mpeg Chrome will launch QuickTime... blah!

    image

     

    I didn’t test any other browsers... this was proof enough for me that video/mp4 is the correct MIME type of .MP4 files.

     

    Technorati Tags: ,,
  • How to disable an ASP.NET linkbutton when clicked

    Scenario: User clicks a LinkButton in your ASP.NET page and you want to disable it immediately using javascript so that the user cannot accidentally click it again. 

    I wrote about disabling a regular submit button here: How to disable an ASP.NET button when clicked.  But the method described in the other blog post does not work for disabling a LinkButton.  This is because the Post Back Event Reference is called using a snippet of javascript from within the href of the anchor tag:

    <a id="MyContrl_MyButton" href="javascript:__doPostBack('MyContrl$MyButton','')">My Button</a>

    If you try to add an onclick event to disable the button, even though the button will become disabled, the href will still be allowed to be clicked multiple times (causing duplicate form submissions).  To get around this, in addition to disabling the button in the onclick javascript, you can set the href to “#” to prevent it from doing anything on the page.  You can add this to the LinkButton from your code behind like this:

    MyButton.Attributes.Add("onclick", "this.href='#';this.disabled=true;" + Page.ClientScript.GetPostBackEventReference(MyButton, "").ToString());

    This code adds javascript to set the href to “#” and then disable the button in the onclick event of the LinkButton by appending to the Attributes collection of the ASP.NET LinkButton control.  Then the Post Back Event Reference for the button is called right after disabling the button.  Make sure you add the Post Back Event Reference to the onclick because now that you are changing the anchor href, the button still needs to perform the original postback.

    With the code above now the button onclick event will look something like this:

    onclick="this.href='#';this.disabled=true;__doPostBack('MyContrl$MyButton','');"

    The anchor href is set to “#”, the linkbutton is disabled, AND then the button post back method is called.

    Technorati Tags:

  • Visual Studio Shortcut: Surround With

    I learned a new Visual Studio keyboard shortcut today that is really awesome; the “Surround With” shortcut. 

    You can trigger the Surround With context menu by pressing the Ctrl-K, Ctrl-S key combination when on a line of code.

    Ctrl-K, Ctrl-S means to hold down the Control key and then press K and then while still holding down the Control key press S.

    Here is where this comes in handy:

    You type a line of code and then realize you need to put it within an if statement block. So you type “if” and hit tab twice to insert the if statement code snippet.  Then you highlight the previous line of code that you typed, and then either drag and drop it into the if-then block or cut and paste it.  That is not too bad but it is a lot of extra key clicks and mouse moves.

    Now try the same with the Surround With keyboard shortcut.  Just highlight that line of code that you just typed and press Ctrl-K, Ctrl-S and choose the if statement code snippet, hit tab, and POW!... you are done!  No more code moving/indenting required.

    Here is what the Surround With context menu looks like:

    image

    Just up or down arrow inside the drop down list to the code snippet that you want to surround your currently selected text with.  Did I mention this is AWESOME!

    Now it is so simple to surround lines of code with an if-then block or a try-catch-finally block... things that usually took several key clicks and maybe one or two mouse moves.

    And this works in both Visual Studio 2008 and Visual Studio 2010 which means it has been around for a long time and I never knew about it.

     

  • jQuery: Textbox in sortable is not clickable/selectable

    I am using the jQuery UI Sortable and ran into an issue where a textbox (<input type="text" /> that is within one of the sortable elements was not clickable (You could not put the insertion caret into the textbox).  Trying to use your mouse to put the cursor within the textbox would do nothing.  

    Eventually I was able to track it down to the use of the Sortable.Cancel Option.  I have some elements within each of sortable rows which I do not want to trigger the sorting if they are clicked on.  For instance there is an anchor tag for deleting the sortable item that I do not want to trigger the start of sorting.  In other words, if someone clicks on the delete link and then accidentally drags their mouse a little, I do not want sorting to start.

    So to prevent sorting on the anchor tag, I used the Cancel Option:

    $(".selector").sortable("option", "cancel", 'a');

    What I did not realize was this setting of the jQuery UI Sortable Cancel Option overwrites the default cancel settings of:

    $(".selector").sortable("option", "cancel", ':input,button');

    So instead of cancel working on “:input, button, AND a” it is ONLY working on “a”.  Not what I wanted... and also explains the behavior where the textbox is not clickable... because of my overwriting of the default cancel option, textbox elements now trigger the sorting, and this prevents them from the insert caret getting placed in the textbox when clicked.

    So the solution to my problem was to set the jQuery UI Sortable Cancel option and include the default elements when being set like this:

    $(".selector").sortable("option", "cancel", ':input,button,a');

  • Machine Setup: OneNote 2010 Sort Pages Powertoy

    I use Microsoft OneNote a lot for notes, tasks, projects, reference, etc.  One of the addins that I recommend for OneNote is the Sort Pages powertoy. 

    The OneNote 2007 version can be found on Daniel Escapa's Blog > Sort Pages powertoy post.

    And now there is a new OneNote 2010 version of Sort Pages created by John Guin.

    This one handles subpages and also has an undo feature (very nice!).

    Just download the zip file from John’s blog and run the setup.exe.  Under the Addins tab now you will have a “Sort Pages” button:

    image

    Beautiful!

    Technorati Tags: