New MacBook Pro

I got myself a new MacBook Pro this week. (OK, technically not a *new* one, but a refurb.) It’s the 13″ mid-2012 model described here. My previous MacBook was purchased in 2007, so I was definitely due for a new one. I had done a few upgrades on the old MacBook, so the basic specs are pretty much the same — 4 GB of RAM and a 500 GB hard drive. The processor is, of course, newer, and hopefully better (i5 vs Core 2 Duo).

I set it up last night, transferring files from my old MacBook via FireWire. I used the migration capability built into the initial setup program. I’ve used this before, and it always seems to work well. It took about four hours to complete.

The old MacBook was on 10.7, since it’s not upgradeable to 10.8. (The new MBP is, of course, on 10.8.) So, this is also my first experience using OS X 10.8. There’s not much new in it, compared to 10.7, from what I’ve seen so far, so I’m not having any trouble there.

Overall, there really isn’t much difference between this new machine and the old one.The keyboard layout is pretty much the same, so it’s nice not having to get used to a new layout for once. And the general form factor and weight are very similar to the old MacBook.

So far, It doesn’t appear to be noticably faster than the old one, which is a bit disappointing, though I didn’t really expect much in that area. I don’t think I really do much to stress the processor.

I don’t really like the direction Apple is going in, with respect to upgradability, but the basic MacBook Pro is still reasonably upgradeable, per iFixit. So, a year from now, if I want to upgrade it to 8 GB of RAM and maybe replace the hard drive with a bigger one or an SSD, I can probably do that.

Visual Studio 2013 and Build

I watched a little bit of today’s keynote from the Build conference on my iPhone at lunch today. I have to say that Scott Hanselman’s bit was pretty cool. I don’t know if I’ll actually have any reason to use VS 2013 for an ASP.NET project any time soon though. I’m not really doing that kind of work right now, and I’m not sure when I’m likely to get back to it. But I’ll at least have to install the thing and mess around with it on a little sample project, just to keep up with what’s going on in ASP.NET.

On a related subject, I’m somewhat embarrassed to admit that I’ve never really learned much about ASP.NET MVC. I did learn the basics at one point, quite some time ago, but I’ve never used it on a real project, and I haven’t kept up with the most recent releases. Well, I started reading a book on MVC 4 recently. I haven’t gotten very far with it, but hopefully I can get far enough to at least say that I have a clue how it works.

vs 2012 express for web

I thought I was done blogging about VS 2012 for now, but I decided to start messing around with MVC 4 this week, so now I’ve gone ahead and installed VS 2012 Express for Web. I was kind of hoping that the install wouldn’t take that long, since one would assume that most of the components would already be on my machine, from VS Express for Desktop. But no. It took more than an hour to download and install everything. And I had to update NuGet in Express for Web, even though it was already up to date in Express for Desktop. And I had to apply the RemoveAllCaps fix again too. So I’m guessing that there’s less overlap between the Desktop and Web products than I would have hoped. But that’s OK — I’ve got plenty of hard drive space on my ThinkPad!

Meanwhile, Visual Studio 2013 has been announced. That was a bit of a surprise, since I’d assumed that the next major version would be VS 2014. There’s some pretty neat stuff in VS 2013, though a lot of it likely won’t be applicable to anything I’m doing at work or at home right now.

a bit more on Visual Studio 2012

I feel a little bad about yesterday’s screed on the VS 2012 UI. (But not bad enough to delete it or anything. I still wish they hadn’t mucked with the UI so much.) So today I thought I’d try to write a more positive post about VS 2012.

First, I’d like to link to this blog post on how cool it is that Microsoft has kept so much of the functionality of the full VS product in the Express editions. I do agree with him on this, and I am glad that Microsoft is willing to release such a full-featured product for free. Having said that, though, I’d also love to see a $99 “standard” version that comes a bit closer to the $499 “pro” version. I think my biggest issue with the Express product will be lack of support for extensions. I’ve gotten quite used to DPack, for instance, so it’ll be hard to do without that.

Here’s a good article on “Simple but Interesting Features of VS2012“. Some of these features should be pretty useful. I’m glad that Microsoft is still adding little things like this to Visual Studio. It’s easy to let small, useful, features get lost in favor of grand initiatives, and I’m happy to see that someone at MS still thinks about stuff like this.

Finally, here’s a post about some really great new features in VS2012. I was pretty stoked about a few of these, until I realized that it was an April Fool’s post. (Actually, a couple of these *would* be useful, and not that hard to implement…)

Visual Studio 2012, take two

So I managed to get VS 2012 installed. (See previous post for details on my first failed attempt.) I’d love to write up a blog post detailing some weird issue and how I worked around it, but I don’t really have anything useful to offer along those lines. I basically just installed some pending Windows Updates, had a cup of coffee, then tried again.

After the install, I was prompted to install a patch that apparently fixes some compatibility issue. Then, I was prompted to install VS 2012 update 2. I did both of those things, and now have a usable VS 2012 install. I’m still not sure why Microsoft can’t post updated installers for their products when they release patches and updates, but I’m used to the silliness now, so I just grin and bear it.

I had read a good bit of negative feedback about the UI changes in VS 2012, and I have to say that I agree with most of it, now that I’ve seem the product up close. It’s much less pleasant to look at, compared to VS 2010. First, the upper-case menus are ridiculous. Whoever thought that was a good idea has hopefully been fired by now. (Who am I kidding, he probably got promoted!) You can fix that pretty easily with this NuGet package. And the guy who put it together gets extra points for the instructions: “YOU NO LIKE NO SHOUTING?! Run Disable-AllCaps”.

The next easily-fixed interface blunder is the color scheme. The default is called “light”, and it’s kind of an all-grey mess, with a little bit of white, black, and blue.  If you switch to the “blue” theme, you get something a little like VS 2010, and much more usable.

The general flatness of the interface, though, is still pretty blah. There was really nothing wrong with the VS 2010 interface, and no reason to arbitrarily change stuff for the worse like this, and it’s so hard to believe that anybody really thought they were making things better here.

There’s a blog entry on the VS team blog that discusses the all-caps thing in specific. If you read it, you’ll get a good picture of how a very large company can make really poor decisions about specific products, based on big-picture corporate strategies and directions, and how they can be (apparently) clueless about what they’re doing. They talk about how the use of uppercase text is a “strong signature element” of MS user interfaces, including Zune and Bing. Now, really, how much thought does it take to figure out that the menu bar for a complex programming IDE has nothing to do with the user interface on a failed MP3 player or a web search engine? They end the blog post by saying that “we will enable you to customize the casing, and we are exploring options for how to expose that choice.” Well, the blog post is about a year old, VS 2012 has had two update releases, and still no option in the product itself to change the menu casing.

Alright, so that was way too much grumbling about fairly trivial user interface stuff. I guess I’m just in a bit of a cranky mood today! I still look forward to trying out VS 2012, and seeing what useful new features have been added to the product, and to C#!

Visual Studio 2012

I haven’t bothered with VS2012 yet, but today I decided to try to install VS Express 2012 for Windows Desktop on my laptop. I really only want it, at this point, for developing console apps. I wanted to take a shot at using it for the Project Euler stuff that I’ve been playing around with, and I was also interested in trying out some of the async stuff in C# 5. So nothing fancy; I just wanted to get familiar with it.

Well, no luck. The install got about halfway through (judging by the progress bars), then got no further. I know some of the VS installs in the past have been notoriously slow. (I’m looking at *you* VS 2005 SP 1! Or was it VS 2008 SP1…?) But this one just stalled at the same spot for 2 or 3 hours, with no change, so I gave up on it.

I’m starting to wonder if I need to do a fresh install of Windows 8 on that laptop, just to clear up the cruft from previous VS installs. I really wish Microsoft could make an IDE that didn’t cause so much grief just to install…

Project Euler

I started messing with Project Euler this week. It’s actually a lot of fun. I’ve only solved three problems so far, but I’ve been enjoying it, so I think I’ll keep going and see how far I get before I get tired of it, or I get pulled into something else, or the problems get too hard.
I’d been thinking that maybe I’d try a new language for this, but I decided to stick with C#, as I’m not really doing much C# at work, and I want to keep in practice with it.
I’ll also admit that I haven’t had any reason to do the kind of math problems that are found at Project Euler in a very long time, so my skills there are a bit rusty. But I’m managing to remember what Fibonacci numbers are and all that fun stuff!

Here’s my badge:

TFS Scripts

I’m definitely not a TFS genius, but I’ve written a few scripts that have proven helpful in dealing with some of the issues that come up with version control.
First, here’s a simple one. This just automates a simple TF.EXE command to show the last 50 check-ins in our project. This particular command opens a GUI window to show the output.

# https://gist.github.com/andyhuey/5471064
[string]$tf = "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\TF.exe"
pushd
cd c:\ax2012tfs
& $tf history /r /stopafter:50 *
popd

Second, here’s one to show the TFS status. This command, unlike the previous, sends output to the console, so I’m piping it to Notepad++, so I can see it there.

# https://gist.github.com/andyhuey/5471072
[string]$tf = "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\TF.exe"
[string]$npp = "C:\Program Files (x86)\Notepad++\notepad++.exe"
# [string]$tempFile = [System.IO.Path]::GetTempFileName()
[string]$tempFile = "$env:temp\tfStatus.txt"
pushd
cd c:\ax2012tfs
& $tf status > $tempFile
popd
& $npp $tempFile

And third, here’s a somewhat more complicated one. This one allows you to diff two changesets, and pipes the output to Notepad++. But, if there’s an error, it instead shows a “press any key” message, so you can see the error in the console window. Notepad++ has syntax highlighting for diff files, so the output is reasonably nice-looking.

# https://gist.github.com/andyhuey/5471084
param (
     [string]$cs1 = $( Read-Host "Enter changeset 1 (as c9999)" ),
     [string]$cs2 = $( Read-Host "Enter changeset 2 (as c9999)" )
)
[string]$tf = "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\TF.exe"
[string]$npp = "C:\Program Files (x86)\Notepad++\notepad++.exe"
[string]$tempFile = "$env:temp\tfDiff.diff"
pushd
cd c:\ax2012tfs
& $tf diff cus /v:$cs1~$cs2 /r /f:unified > $tempFile
if ($LastExitCode -eq 0)
{
     & $npp $tempFile
}
else
{
     Write-Host "Press any key to continue ..."
     $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
}
popd

This pretty much concludes the overview of my utility scripts that I started a few days ago. I hope it was helpful to someone. If not, at least I’ve got them documented now, so if I lose them again, I know where to look!

Exporting Projects From AX

After my hard drive crash, I decided that I should really create a way to automatically back up all the code for all of my active projects. So, I’ve added an “exportAllProjects()” method to my “startup projects” class. This method takes my list of active projects, iterates through them, and exports each one to a standard XPO file, in a sub-folder off the My Documents folder.

I’ve created a menu item for this, and attached it to the Development Tools menu. So, now I can backup all the objects in all of my active projects in one fell swoop. It would nice to be able to do this automatically, but I’m not sure I want to start messing around with doing this as a scheduled job just yet.

// https://gist.github.com/andyhuey/5470950
public void exportAllProjects()
{
    // get the project list, and export all projects.
    Array projects;
    int i;
    ProjectNode sharedProjects, privateProjects, projectNode;
    str myDocsPath, filePath;

    #WinAPI

    myDocsPath = WinAPI::getFolderPath(#CSIDL_PERSONAL);
    myDocsPath += @"\xpo_backup";

    // make sure myDocsPath exists.
    if (!WinAPI::pathExists(myDocsPath))
    {
        WinAPI::createDirectoryPath(myDocsPath);
    }

    projects = this.getProjectList();

    sharedProjects = Infolog.projectRootNode().AOTfindChild('Shared');
    if (!sharedProjects)
        throw error("Error: cannot located shared project node!" );

    privateProjects = Infolog.projectRootNode().AOTfindChild('Private');
    if (!privateProjects)
        throw error("Error: cannot located private project node!" );

    for (i= 1; i <= projects.lastIndex(); i++)
    {
        // skip any line starting with a semi-colon
        if (subStr (projects.value(i), 1, 1) == ";" )
            continue;

        projectNode = sharedProjects.AOTfindChild(projects.value(i));
        if (!ProjectNode)
            projectNode = privateProjects.AOTfindChild(projects.value(i));

        if (projectNode)
        {
            filePath = myDocsPath + @"\" + projects.value(i) + ".xpo" ;
            projectNode.treeNodeExport(filePath);
        }
        else
            warning(strFmt("Project %1 cannot be found." , projects.value(i)));
    }
}