Tuesday, January 15, 2008

Signs of a Bad Boss (seen by me in the wild)

A certain someone at a certain company fit this to a T.

Bosses are supposed to ask themselves these questions:

1. Have you ever publicly criticized an employee?

2. Do you take credit for your employees’ work?

3. Do your employees fear you?

4. Do you expect employees to do what you tell them without question?

5. Do you believe employees should know what to do without you telling them or providing guidelines?

6. Are you a yeller?

7. Do you demean employees as a form of punishment?

8. Do you play favorites?

9. Do you hate delegating?

10. Do you check everyone’s work?

Friday, January 11, 2008

How to find files that are different between two git trees (working with git and, *gulp*, SourceSafe)

I do this a lot in my project. I change a bunch of files, and since I'm working with SourceSafe, I need to know which files to check out of SourceSafe so that I can replace them with the changed versions.

Use this command:
git diff-tree -r --name-status branch1 branch2
where branch1 is the branch I'm going to check into SourceSafe and branch2 is the upstream branch.

$ git diff-tree -r --name-status master POS-safe
M Databases/OpenBook/Alter Scripts/THE ONLY 2.2 ALTER SCRIPT YOU NEED.sql
M OpenBookSolution/HotL/DirectBillPaymentForm.cs
M OpenBookSolution/HotL/EditReservationForm.cs
M OpenBookSolution/HotL/NonGraphicalReserveForm.cs
M OpenBookSolution/HotL/OpenBook.cs
M OpenBookSolution/HotL/ReportForms/ReportSelectorForm.cs
M OpenBookSolution/HotL/SelectDirectBillAccountForm.cs
A OpenBookSolution/HotLOnly.sln
D OpenBookSolution/HotLOnly/HotLOnly.sln
M OpenBookSolution/Yellowstone.OpenBook.BusinessEntities/MonetariesBusinessEntity.cs

The basic procedure is:
  1. hack hack hack
  2. Get my tree in good shape, usually by rebasing my branch onto the SourceSafe tracking branch.*
  3. Run the diff-tree command above to find changed files.
  4. Check out those files. If there are any warnings from SourceSafe about the files being different (and not just writable), then do the following:
    1. Get latest from SourceSafe into the SourceSafe tracking branch (typically "master") in my project.
    2. Commit.
    3. Go back to step 2 above.
  5. Merge development branch into master. Sometimes I do this step a commit or three at a time instead of an en masse merge of the branch all at once.
  6. Check changed files back into SourceSafe.
*I realize that rebasing my development branch onto "master" probably isn't the wisest thing in the world, as it loses information -- specifically, the fact that I had branched the code. It was an interesting experiment, though. Perhaps I'll go back to merging again. Although the fact that we're using SourceSafe, which doesn't have the concept of a branch, probably means that what I'm doing isn't all that un-kosher.

The flavor of git I use is msysgit.

Linus clarifies "Central Repository" issue on git in a way palatable to managers

Linus was previously rather dogmatic about having no "official" version of a project. But here he's not quite so religious and explains how you can effectively satisfy those who would like a central repository. The distinction, he says, is social, not technical:
I certainly agree that almost any project will want a "central" repository
in the sense that you want to have one canonical default source base that people think of as the "primary" source base.

But that should not be a *technical* distinction, it should be a *social* one, if you see what I mean. The reason? Quite often, certain groups would know that there is a primary archive, but for various reasons would want to ignore that knowledge: the reasons can be any of ....

ExtJS javascript library

Tres cool!
"Ext (pronounced "extent"[citation needed]) is an open-source JavaScript library, for building richly interactive web applications using techniques such as AJAX, DHTML and DOM scripting.

Originally built as an extension of YUI, Ext can now also extend jQuery and Prototype. As of version 1.1, Ext can run stand-alone without relying on any of those external libraries, though they remain an option for integration.

Ext version 2.0 can now use many different base libraries (adapters) like YUI, jQuery, Prototype or it can work Stand-alone"

Tuesday, January 08, 2008

PyPy "dot" graph viewer (Python)

Referred to from this site: http://morepypy.blogspot.com/2008/01/visualizing-python-tokenizer.html:
"For debugging purposes I implemented a visualization tool for DFAs using PyPy's pygame-based graph viewer. The graph viewer is able to visualize interactively any graph given in the graph-description language of Graphviz. Looking at the tokenizing DFA for Python is rather instructive, both for understanding how tokenizing works and (maybe) for understanding the Python language. To try it, download the dot file of the DFA and run from a pypy checkout:
$ python pypy/bin/dotviewer.py tokenizer.dot
The following is a screenshot of the graphviewer: "

Monday, January 07, 2008

TCL: Creating Temporary Files

From the page:
"Tcl doesn't have a built-in command to create a temporary file and there are no built-in variables for temp directories, so you have to do a little work.


I had some luck with the following procedure on a UNIX box. Maybe, somebody can check if it works for windows.

 proc tempfile {prefix suffix} {
set chars "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
set nrand_chars 10
set maxtries 10
set access [list RDWR CREAT EXCL TRUNC]
set permission 0600
set channel ""
set checked_dir_writable 0
set mypid [pid]
for {set i 0} {$i < $maxtries} {incr i} {
set newname $prefix
for {set j 0} {$j < $nrand_chars} {incr j} {
append newname [string index $chars \
[expr ([clock clicks] ^ $mypid) % 62]]
append newname $suffix
if {[file exists $newname]} {
after 1
} else {
if {[catch {open $newname $access $permission} channel]} {
if {!$checked_dir_writable} {
set dirname [file dirname $newname]
if {![file writable $dirname]} {
error "Directory $dirname is not writable"
set checked_dir_writable 1
} else {
# Success
return [list $newname $channel]
if {[string compare $channel ""]} {
error "Failed to open a temporary file: $chanel"
} else {
error "Failed to find an unused temporary file name"

Igor Volobouev"