08 August 2015
For years I’ve been trying to get student assistants to use GitHub more effectively to work on larger projects. One of the main problems though has been that the process of using forks + pull requests to submit their code to the main project has always required going back to the terminal for one key step: pulling and merging others’ changes from the upstream branches. Today even for many seasoned programmers, the terminal/command prompt is a bit of a mystery to students. Thus it would be great if the GitHub graphical client made this simple or at least possible.
The most recent versions of the GitHub client (at least on Mac; untested on Windows; I’m on v. 208) don’t exactly make the process simple, but at least they make it possible.
Open the GitHub client and if you haven’t worked on the project in a while, hit Sync. You should see your own fork; I’ll assume that you are working on the “master” branch and want to merge changes from the upstream (main project) master branch into your own branch.
Your screen should look something like this. (I’ll be demoing on the amazing Latin dictionary program “whitakers-words”[*] which I do not have commit access on, so it’s like what my contributors to my projects would see). All I’ve done is created a little demo text file.
Next I’ll pull down the tab on “master” and switch to the main developer’s master, “mk270/master” (third from bottom).
Click “Sync” in the upper left hand corner to copy it down. The sync button will turn into a progress bar:
This actually creates a temporary branch confusingly called mscuthbert/mk270/master (or YOURNAME/THEIRNAME/BRANCH) but will just be displayed as mk270/master on the GitHub client. No matter. Now click the button next to the progress bar to create a pull request. You will want to pull from this branch to your master branch (the one marked default branch):
You can leave the description blank since you’re just making a pull request to yourself. Go ahead and click “Send Pull Request”.
Click the link below the “Good work!” button to open up GitHub in your browser. You should see something like this:
Scroll down to the bottom and you’ll see this. Go ahead and click “Merge pull request” then “Confirm merge”.
Now you’ll see the option to delete this branch. Go ahead and do it. You are actually deleting “mscuthbert/mk270/master” not “mk270/master” — I hope it won’t let you delete the upstream master!
After doing so you’ll see this confirmation.
Now return to the GitHub client and switch back to “master” if it hasn’t already put you back there.
Go ahead and click “Sync” again for good measure. Then you can check your History and see that you have all the most recent upstream commits:
Ta-da! Well, assuming that there aren’t any conflicts or anything of that sort. In a case like that you’ll probably still need to get out the ol’ command-line tools, so you will still need to be a bit familiar with them (or have a friend who can help you out). Hopefully the next version of GitHub for Mac/Windows will make this much easier. But for day-to-day work, it’s now possible to stay in sync with the main repository on a more regular basis for people who use the graphic interface tools almost exclusively.
[*] edit August 10: EEK! Autocorrect originally changed “Whitaker’s Words” to “Whiskers-Words” — Fixed! That app only does Cat-latin (catin?): "maumo, maumare, maumavi, maumatus V (1st) 1 1 [GXXEK] — meow;” not what we want!
06 August 2015
Often while marveling at Ricky Henderson’s amazing stats, I wondered how much greater a leadoff hitter he would have been if he had spent his whole career in the National League. He had 11,180 plate appearances in the AL but only 2,166 in the NL. In both leagues, the leadoff hitter leads off the first inning, but is not guaranteed to bat leadoff in any following inning. However, I figured that in the National League, batting after the pitcher, it’d be substantially more common that the person batting first in the order would get to lead off. The pitcher almost always makes an out, so I figured it’d be pretty common for him to make the third out (and because of situations where the eighth batter is walked to get to the pitcher, probably more common than one in three). The eighth batter isn’t that strong in the AL, but a lot stronger than almost any NL pitcher.
I’ve been working off and on over the past two years (more off before getting tenure, more on after getting tenure) on an extremely flexible python toolkit for examining baseball games and it finally got to the state of development where I could test my findings. I’m not ready to release the toolkit yet (it needs to be polished enough that I’m proud of it), but here’s the code I used to work:
gc = games.GameCollection()
gc.yearStart = 2000
gc.yearEnd = 2014
gc.usesDH = True
allGames = gc.parse()
totalPAs = 0
totalLeadOffs = 0
for g in allGames:
for halfInning in g.halfInnings:
for p in halfInning.plateAppearances:
if p.battingOrder == 1:
totalPAs += 1
if p.plateAppearanceInInning == 1:
totalLeadOffs += 1
print(totalPAs, totalLeadOffs, totalLeadOffs*100/totalPAs)
It gets a collection of games where the DH is used or not used, looks at each game, then at each half inning, then at each plate appearance. If the batter is #1, then it checks whether it’s the first appearance in the inning, then prints out the percentage of all batter #1 plate appearances which are leadoffs. The results were surprising to me.
The average difference in the percentage of leadoff plate appearances between the two leagues (accounting for interleague games) is only about 2.5%. This works out to about 15 PAs a year different for Ricky in his prime. So one hypothesis down, but many more to be investigated soon.
01 August 2015
18 September 2014
- music21j / 21M.051 -- I've been translating music21 to the web to support my teaching of MIT's "Fundamentals of Music" -- feel free to register for an account an play around.
- The Other Tournai Kyrie -- A lost piece of medieval music was sitting right under our noses.
- music21 -- what exactly is a "Toolkit for Computational Musicology"? Older article. The latest version at GitHub
- Conference / Journal Convergence -- When top journals begin publishing only articles presented at invited conferences, do less connected scholars lose out?
- When Computers Listen to Music, What do they hear? -- on music21 and other Boston area projects (Boston Globe)
- Musical examples in web pages -- an easier way to do this than before, using cuthbertLab's music21j.
- Advanced dotting -- the mathematics behind that simple feature of musical notation: the dot.
- An early fifteenth century canon -- unraveled from a manuscript of Strasbourg destroyed in the fire of 1870.
- Bach's voice ranges -- a how-to on music visualization.
- Changing Musical Time -- how rhythm and tempo have evolved over the last 1000 years.
- Sexism and Age in Politics -- are older folks more sexist when it comes to electing a president? The data is unconvincing.
- Are bullpens underused? -- solve for x, and call the bullpen earlier.
11 June 2014
The well known melody...occurs in the T[enor] range in the Tournai MS; the question therefore remains whether one or more voices would have accompanied it. For this reason we decided to include this purely monodic piece in the present edition.
With these adjustments, the piece is almost entirely consonant, with the following breakdown of sonorities (discounting triplets in the middle of a semibreve):
36% Perfect fifth
18 Major triad
12 Major third
12 Minor triad
9 Minor third
8 Minor triad as 6-3
3 Major sixth
2 Minor sixth
0.5 Perfect fourth
Cattin and Facchin note that piece seems to be on the chant cantus firmus of no. 58 of Margaretha Landwehr-Melnicki's catalogue. The first Kyrie is indeed similar to this chant, but as a look at Paris, BNF lat. 14819, f. 34v. or Paris, BNF lat. 17309, f. 27v will show, the rest of the work is unrelated to this chant.
Otherwise the style of the work is similar to many French works from around 1350 (and also Spanish and Italian works from this time or slightly later). Facchin's description of these pieces, largely homophonic but with decorations, as part of a Wandering Style, or Stile Vaganti! seems quite appropriate for this work that wandered around the foot of a more famous Mass, waiting to be rediscovered.
More about the Sanctus and a fuller realization of it to come soon, thanks to an idea from Jan Janovčik. Here's a preview of his great recording with his Cantores Sancti Gregorii
Thanks to Jan Janovčik, Rob C. Wegman, and Dominique Gatté for aid and suggesting the Tournai manuscript as a source worth returning to. And to Anna Grau and Jeremy Jennings for their work on the EMMSAP project that made this work quickly possible.