insomnihack

When sleep eludes, the keyboard beckons

IPython Color Console Output

December 16, 2009 Dale 1 Comment

IPython does a decent job of providing console output in color on all the platforms I use it on. If you’re like me and you’ve wanted to use its coloring functionality for your own terminal output, here’s a snippet that should get you started.

[python]
from IPython import ColorANSI
from IPython.genutils import Term
tc = ColorANSI.TermColors()
red = tc.Red + "Red" + tc.Normal
print >> Term.cout, red
blue = tc.Blue + "Blue" + tc.Normal
print >> Term.cout, blue
[/python]

Assuming you have color output enabled (if you’re on Windows, you’ll need PyReadline), you should be able to %paste the plain text from the snippet above into IPython and see the output below.

Red
Blue

Programming IPython, Python

Upgrading Visual Studio Team System 2008 Trial on Windows 7

December 6, 2009 Dale 1 Comment

So I ran into my first major incompatibility issue with Windows 7. Somewhat ironically its with a Microsoft product. In the setup for the Visual Studio Team System 2008 Trial, there is typically a maintenance mode page with an Upgrade field for you to enter your update key when the trial ends. That is, its typically there for Windows XP or Vista. On Windows 7 (I’m using the 64-bit version), the upgrade fields are missing.

The issue has been reported to Microsoft, but despite subsequent posts by customers with identical problems, its been marked as unreproducible. However, the instructions on that page as listed did not work for me, at least not without uninstalling the main Visual Studio 2008 Team System application. Here’s exactly what I did.

Step 1: Uninstall Visual Studio 2008. I couldn’t get this process to work without uninstalling.

Visual Studio TS Uninstall

Step 2: Copy the installation files from the Visual Studio 2008 Team System setup disk.

Step 3: In the Setup folder, open setup.sbd in an editor.

Step 4: Change the temporary key under the [Product Key] tag to your upgrade key. Remove any spaces or dashes.

[text firstline=”127″ highlight=”137″]
[Error Log]
dd_error_VS_VSTSCORE_90.txt

[Event Log]
dd_install_VS_VSTSCORE_90.txt

[Suite Requirements]
vsbasereqs.dll, GFN_CID VS Baseline Requirements

[Product Key]
YOUR25CHARACTERSERIALHERE

[Dialog Page Order – AdminMaintenance]
[/text]

Step 5: Save the file and run the setup.exe at the root of the installation.

You should see the key you entered in the setup.sbd file in the read-only license key fields on the installation screen. If you encounter the screen and you uninstalled Visual Studio Team System 2008, you may have edited setup.sbd.

Visual Studio 2008 TS Setup Error

As a last resort, try copying the files over once more and try again. Hope this helps.

Programming Visual Studio

git init

December 1, 2009 Dale Leave a Comment

After a bit of trial and error, I’ve managed to get git running on my Windows box under Cygwin, on my Macbook Pro using the latest MacPorts, and on a remote repository located on NearlyFreeSpeech.net. I’m pretty much a git newb, so what follows may only be interesting to other git newbies.

I was able to get Bash completion working with git by using the instructions I found here. Bash completion is really nice, especially when typing out branch names.

I’m not currently using any GUIs (although I downloaded GitX on my Mac to look at branches), preferring to immerse myself in the command line in hopes of increasing my understanding of how git works. So far, the experience has been pretty positive. I’m still just doing basic stuff, and my only branch usage has been to create one-off development branches to hack out a feature. I’ve been deleting them after I merge back to master.

I have ran into a few issues. Moves aren’t has carefree was I was led to believe. Simple moves without file modifications are pretty transparent to git, but it doesn’t like it when you move and significantly edit a file. Instead of a nice rename in git status like this:

[text highlight=”6″]
$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>…" to unstage)
#
#       renamed:    bar.py -> foo/bar.py
#
[/text]

You get something more frustrating, like this:

[text highlight=”6,12″]
$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>…" to unstage)
#
#       new file:   foo/bar.py
#
# Changed but not updated:
#   (use "git add/rm <file>…" to update what will be committed)
#   (use "git checkout — <file>…" to discard changes in working directory)
#
#       deleted:    bar.py
#
[/text]

This is a bit of a drag. When refactoring, I don’t think of where I’m going to move files first, then edit them. Its all one flow. With subversion, I could always go to the repository and specifically tell svn that a new file and an missing file are the same. With git, I ended up archiving my changes, restoring my working folder, committing the moves, then copying the updated files from my archive. It may take awhile for me to start thinking in terms of move, edit, then commit in order to avoid this kind of problem.

I ran into a odd issue with test file permissions getting set to executable. I suspect the issue is related to git on Cygwin. Cygwin on an NTFS drive apparently assumes the file mode of new files is +x. I’ve temporarily worked around the issue by configuring git on Cygwin to ignore file modes.

[text]
git config core.filemode false
[/text]

Programming git

« Previous Page
Next Page »

About Me

Hi, my name's Dale, and this is my tech blog. Read More…

Search

Tags

blogging c# database Django documentation Email furniture git hacks htpc IPython Linux mac nas packaging PyCharm Python Roleplaying tools twitter unit tests virtualenv Visual Studio vmware Windows

Copyright © 2025 · Equilibre Theme on Genesis Framework · WordPress · Log in