Thursday, April 26, 2012

It's been a long time. I went back to work and had zero time for this blog. But I'd like to get back to it.

4/26/2012 7:44:26 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |   |  Trackback
 Thursday, January 21, 2010
I just tried out Eclipse/CDT with gcc on the Mac with Snow Leopard and it fights back. You have to specify -arch i386 on both linker and compiler flags for it to work because Snow Leopard is now making 64-bit binaries by default (which I did not know until today!)

Mac
1/21/2010 6:18:28 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |   |  Trackback
 Friday, January 15, 2010

This blog entry only makes sense if you've read Chapter 14 of the Bucky Book.

I have a Mac Book Pro with Snow Leopard. I tried with both Eclipse 3.5.1 and Eclipse 3.6M4. It works with neither. It does work, however, with Linux (Ubuntu) and Eclipse 3.5.1. I haven't tried Eclipse 3.6M4 on Linux.

Installation Issues

There's something going on with installation that I don't understand. I think of the Buckminster installation as having three steps.

Why is the headless SVN Subclipse client from the cloudsmith site and not from eclipse.org? The Bucky Book refers to the software as

The headless integrations for Subclipse and Subversion contain plug-ins has licenses which prohibits them from being redistributed from Eclipse.org. Instead, we distribute them from Cloudsmiths website. The update site can be found at http://download.cloudsmith.com/buckminster/external. (page 233)

When I worked with Eclipse 3.6M4, I used the site http://download.eclipse.org/tools/buckminster/updates-3.6 instead of http://download.eclipse.org/tools/buckminster/updates-3.5

Now I cannot install all three of the above into the same eclipse.

I cannot install both the Buckminster SVN Support (Subclipse) from http://download.eclipse.org/tools/buckminster/updates-3.5 and the headless SVN Subclipse client from http://download.cloudsmith.com/buckinster/external. This problem does not depend on the order in which I install them.

To get the exmple to work I need Buckminster and the headless SVN Subclipse client.

Buckminster, headless SVN Subclipse client, Buckminster SVN Support (Subclipse)

If I install Buckminster, then the headless SVN Subclipse client, and then try (fail) installing Buckminster SVN Support (Subclipse), I get the following error.

Cannot complete the install because of a conflicting dependency.
Software being installed: Buckminster - Subclipse support 1.0.0.r11055 (org.eclipse.buckminster.subclipse.feature.feature.group 1.0.0.r11055)
Software currently installed: Buckminster - Subclipse based SVN support for headless operation 1.0.0.r10759 (org.eclipse.buckminster.subclipse.headless.feature.feature.group 1.0.0.r10759)
Only one of the following can be installed at once:
Buckminster Subclipse Support Plug-in 1.0.0.r10356 (org.eclipse.buckminster.subclipse 1.0.0.r10356)
Buckminster Subclipse Support Plug-in 1.0.0.r11055 (org.eclipse.buckminster.subclipse 1.0.0.r11055)
Cannot satisfy dependency:
From: Buckminster - Subclipse support 1.0.0.r11055 (org.eclipse.buckminster.subclipse.feature.feature.group 1.0.0.r11055)
To: org.eclipse.buckminster.subclipse [1.0.0.r11055]
Cannot satisfy dependency:
From: Buckminster - Subclipse based SVN support for headless operation 1.0.0.r10759 (org.eclipse.buckminster.subclipse.headless.feature.feature.group 1.0.0.r10759)
To: org.eclipse.buckminster.subclipse [1.0.0.r10356]
 

Buckminster, Buckminster SVN Support (Subclipse), headless SVN Subclipse client

If I install Buckminster, then the Buckminster SVN Support (Subclipse), and then try (fail) installing the headless SVN Subclipse client, I get the following error.

Cannot complete the install because of a conflicting dependency.
Software being installed: Buckminster - Subclipse based SVN support for headless operation 1.0.0.r10759 (org.eclipse.buckminster.subclipse.headless.feature.feature.group 1.0.0.r10759)
Software currently installed: Buckminster - Subclipse support 1.0.0.r11055 (org.eclipse.buckminster.subclipse.feature.feature.group 1.0.0.r11055)
Only one of the following can be installed at once:
Buckminster Subclipse Support Plug-in 1.0.0.r10356 (org.eclipse.buckminster.subclipse 1.0.0.r10356)
Buckminster Subclipse Support Plug-in 1.0.0.r11055 (org.eclipse.buckminster.subclipse 1.0.0.r11055)
Cannot satisfy dependency:
From: Buckminster - Subclipse support 1.0.0.r11055 (org.eclipse.buckminster.subclipse.feature.feature.group 1.0.0.r11055)
To: org.eclipse.buckminster.subclipse [1.0.0.r11055]
Cannot satisfy dependency:
From: Buckminster - Subclipse based SVN support for headless operation 1.0.0.r10759 (org.eclipse.buckminster.subclipse.headless.feature.feature.group 1.0.0.r10759)
To: org.eclipse.buckminster.subclipse [1.0.0.r10356]

What I need for the example

The example consists of creating an rmap and a cquery and then bringing up the cquery in the Component Query Editor and selecting Resolve and Materialize. For this Resolve and Materialize to work I need Buckminster and the headless SVN Subclipse client installed.

If I install just Buckminster and Buckminster SVN Support (Subclipse) and try to Resolve ad Matrialize, I get an the following error.

ERROR [0001] : No suitable provider for component org.demo.hello.xml.world was found in resourceMap http://www.eclipse.org/buckminster/samples/rmaps/demo.rmap
ERROR [0001] : No suitable provider for component org.demo.hello.xml.world was found in searchPath default
ERROR [0001] : Rejecting provider svn(http://dev.eclipse.org/svnroot/tools/org.eclipse.buckminster/trunk/org.eclipse.buckminster/demo/{0}): No component match was found
ERROR Unable to load default SVN Client
Errors and Warnings
E [0001] : No suitable provider for component org.demo.hello.xml.world was found in resourceMap http://www.eclipse.org/buckminster/samples/rmaps/demo.rmap
E [0001] : No suitable provider for component org.demo.hello.xml.world was found in searchPath defaultE [0001] : Rejecting provider svn(http://dev.eclipse.org/svnroot/tools/org.eclipse.buckminster/trunk/org.eclipse.buckminster/demo/{0}): No component match was found: Unable to load default SVN Client

Results of running the example

First of all, note that I am installing Buckminster and the headless SVN (Subclipse) client. To run the example, you must Resolve and Materialize the cquery. Three projects are created: org.demo.hello.xml.world, org.demo.xml.provider, and org.demo.worlds. Then, run org.demo.hello.xml.world as an Eclipse application.

If I do this on my Mac with Eclipse 3.6M4, I get the following error when I try to Resolve and Materialize.

If I do this on my Mac with Eclipse 3.5.1, I can Resolve and Materialize, but I fail when I try to run the example as an Eclipse application. I get the following error. This may not be so unreaonable because the Mac is a 64-bit machine.



If I do this on Linux with Eclipse 3.5.1 (my Linux is running vitutally on my Mac under Parallels), it actually works. Here's what the example look like when running in the runtime workbench as an Eclipse application.




Reproducing the example

If I delete (projects and contents) of the three created projects and then Resolve and Materilize, I get the following error.

ERROR [0001] : CSpec se.tada/tada-sax has no action, group, or local artifact named java.binary.archives
CSpec se.tada/tada-sax has no action, group, or local artifact named java.binary.archives
TAG-ID 0001 = Query for org.demo.hello.xml.world

Can I fix this? Sort of. I tried first by reinstalling Eclipse, but this did not solve the problem. If I delete the workspace and make a brand new one, even remaking the project with its rmap and cquery files, the example works. Apparently just deleting the projects is not enough. Even going into the workspace directory and cleaning it out with command lines apparently is not enough.




1/15/2010 11:50:44 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |   |  Trackback
 Thursday, January 14, 2010

So I want to try out Buckminster. I got the book, Eclipse Buckminster, The Definitive Guide by Hendrik Lindberg (affectionately called the Bucky Book). It's a pdf downloadable from the Buckminster site, http://www.eclipse.org/buckminster/ . It's at version 0.6, but hasn't been updated since July, 2009.

I'm running Eclipse 3.6M4 on a Mac with Snow Leopard. To get Buckminster, go to the Buckminster site and click on Downloads. You get the screen below. I took the Buckminster updates-3.6 for the 3.6 bleeding edge.




Then, go to Help -> Install New Software and put in the Buckminster update site.




What follows is a record of my running the example in Chapter 13 of the Bucky Book. This example builds a p2 update site for a simple plugin.

Create a plugin (File New Other Plugin Project) called org.demo.demoplugin and a feature (File New Other Plugin Development Feature Project) called org.demo.demofeature and choose org.demo.demoplugin as the plugin for the feature.

But then the key seems to be that you make another Feature Project called org.demo.demosite for the update site. This describes the update site. This feature (called the site feature) does not itself get published.

For the site feature,

  • Specify the Included Features to include org.demo.demofeature.
  • Add category lines to this feature's build.properties.
category.id.org.demo.democategory=Cool Features (demo)
category.members.org.demo.democategory=org.demo.demofeature
category.description.org.demo.democategory=Cool stuff build in a Buckminster demo

  • Create a buckminster.properties file. I added the file to the project org.demo.demosite.
# Where all the output should go
buckminster.output.root=${user.home}/BuckyFiles/BuckyDemo/demosite
# Where the temp files should go
buckminster.temp.root=${user.home}/BuckyFiles/BuckyDemo/tmp/demosite.tmp
# How .qualifier in versions should be replaced
qualifier.replacement.*=generator:lastRevision

Then, create the update site by right-clicking on org.demo.demosite, selecting Buckminster Invoke Action and pointing action properties to buckminster.properties, then choosing site.p2 as the action.



Click OK.




The update site gets made at /Users/ted/BuckyFiles/BuckyDemo/demosite/org.demo.demosite_1.0.0-eclipse.feature/site.p2.

Then, you can use the new p2 update site by pointing to file:/Users/ted/BuckyFiles/BuckyDemo/demosite/org.demo.demosite_1.0.0-eclipse.feature/site.p2/. Note that the / after site.p2 is important.




Click Next, then Finish. I get a warning that I am installing unsigned content. Click OK. Restart Eclipse, and when it comes up, do a Window -> Show View -> Other and choose the Demoplugin View.



 

This is the default Plugin with a View. To uninstall it, go to Help ->Install New Software and click on already installed. Then, select Demofeature and click Uninstall. Confirm the Uninstall Details and click Finish. Restart Eclipse.


1/14/2010 12:15:54 AM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |   |  Trackback
 Tuesday, January 12, 2010

I want to get ECF code from the Eclipse CVS repository. First, open up a CVS Repositories view and create a new repository location. I choose pserver (for anonymous checkout) and leave the password field blank. If you're a committer, you choose extssh and enter your name and password.

Or sometimes, you're a committer and you just want to use pserver. Note, however, that there is a time lag between extssh and pserver. Usually this is irrelevant. But you might miss the very latest checkins if they are close to when you checkout with server. And sometimes this can cause a build to fail.

The reason there is this time lag is so that extssh can be more performant.



Then, from the CVS Repositories view, checkout org.eclipse.ecf.releng. The result is that there is a org.eclipse.ecf.releng project shown in Package Explorer.

Right click in Package Explorer and choose Import .... Select Team Project Set and click Next. Then, in the window that appears, click the Browse button beside File name: and browse to the file projectSet-anonymous.psf.

Click Finish. A window appears asking if you want to overwrite org.eclipse.ecf.releng. Choose No (although it really doesn't matter).

A bunch of projects get checked out. I make a run configuration and call it Eclipse ECF. For Location, I put in ${workspace_loc}/../runtime-Eclipse_ECF. For Program to Run, I choose Run a product and specify the product as org.eclipse.sdk.ide. Then, I click Run.



 

The runtime workbench comes up. I can customize the perspective to show the ECF menu. This is cool. However, if I drop down the ECF menu and try to connect to Eclipse IM, XMPP, or XMPPS, I get an error. It does not accept my credentials. I think this is a known bug, namely https://bugs.eclipse.org/bugs/show_bug.cgi?id=291797

The IRC provider works just fine.




Click Finish. No password is needed.




1/12/2010 11:37:55 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |   |  Trackback
 Sunday, January 10, 2010

First of all, get the git bundle.

newtricks:~ ted$ cd ~/Library/Application\ Support/TextMate/Bundles
newtricks:Bundles ted$ git clone git://gitorious.org/git-tmbundle/mainline.git Git.tmbundle
Initialized empty Git repository in /Users/ted/Library/Application Support/TextMate/Bundles/Git.tmbundle/.git/
remote: Counting objects: 5018, done.
remote: Compressing objects: 100% (1612/1612), done.
remote: Total 5018 (delta 3342), reused 4957 (delta 3303)
Receiving objects: 100% (5018/5018), 634.79 KiB | 181 KiB/s, done.
Resolving deltas: 100% (3342/3342), done.
newtricks:Bundles ted$

Then, invoke Textmate and navigate to Bundles->Git->Administration ->Update Git Bundle. The following screen appears.



Here are some references.

http://gitorious.org/git-tmbundle
http://blog.macromates.com/2008/git-bundle/

This Textmate git bundle seems to work pretty well. Here's how I tried it out. First of all use Textmate to open a file that is a member of a git repository. Make a change and save it. Then, from the Textmate window do a Bundles -> Git -> Commit.




Double click on the filename in the Choose files to commit pane. A Textmate window opens up that shows the file in a diff format.



Write a description in the Summary of changes pane. Click commit. The window with the Summary and Commit button disappears and the other window shows what happened.



I still have the two Textmate windows open. Close the one with the diff and select the one with the file. Then, from the Textmate menu do a Bundles -> Git -> Log, and the following window appears.



Git
1/10/2010 12:38:29 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |   |  Trackback
 Saturday, January 09, 2010

The one that came with git really doesn't work well. My suspicion is that this problem has more to do with Snow Leopard than the git gui.

Type git gui on the command line. The prompt does not return. The result is variable. Today, nothing happened. Well, I got a git icon in my taskbar. For a while it bounced up and down. Now it is doing nothing. Click on it, and I get the following.



That quit button works. But the menu on the top of my desktop has the Quit Git Gui entry shaded out. In fact, most of the menu entries are grayed-out. I quit by issuing a Control-C in the command window in which I invoked git gui. The prompt returned.

Type git gui again. Now the git screen comes up; remember, it didn't before.

So I click on Open Existing Repository and browse to guess what, an existing repository and click Open.




 

Note the menu bar. It says Git Gui Apple Repository ... Now when it first came up, it didn't look like the figure below. I clicked on Amend Last Commit. This caused the filename to appear in Staged Changes. I then clicked on the filename, and its text appeared in the upper right pane. The change is shown in green.

Two things are key here. One, most of the menu entries are still disabled. Two, the menu bar is what it is. It will change soon.




 

Click on New Commit. Then, right click in the empty space of the upper right pane and choose Options. An options window appears. Click Save. The options window goes away. Now the menu entries are no longer disabled. Sigh. Does this make sense? Not to me.

Click on Repository and from the dropdown, choose Create Desktop Icon. Give the Desktop Icon a name and click Save. Then Click on Git Gui and choose Exit.

Now open the Desktop Icon. Note now that the menu bar entries are different. And now git gui seems to operate as it should.




None of this makes sense to me. This is not the gui I want to use.

So what am I going to use? I installed Textmate's git bundle. So far it looks good. I'll also check out the git plugin for Eclipse.


Git
1/9/2010 11:41:36 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |   |  Trackback
 Friday, January 08, 2010
This MAC, you know. I like it, but sometimes I get very frustrated. For example, I click on a text file, and the editor that comes up is TextEdit, not my favorite. Editors are not a big deal for me ... I'm more interested in what is being edited. Nonetheless, when pressed, I prefer vi just because I have used it for years and years.

But with the MAC  it is very difficult to get vi to be the default text editor. There are ways, of course. Check out http://www.macosxhints.com/article.php?story=20080305012955463

But you can't get vi to be the default editor by right clicking on the file in Finder and choosing Open With. Vi is just not there. If you do a which vi, the path returned is /usr/bin/vi. If I look in Finder in Developer/usr/bin, I see no vi. Or vim for that matter.

I can get vi (and vim) to appear in Finder. To do that, I become root and make a symbolic link in / to /usr .. like ln -s /usr tedusr. Then in Finder I click on Macintosh HD and open up my link. I can then drag bin to the sidebar. If I open up bin, I then see vi and vim, and if I click on vi, vi starts up (actually vim starts up because vi is a link to vim).

But now if I right click on a text file and choose Open With and navigate to vi (using the bin in my sidebar), I see vi but it is shaded and I cannot select it.

So what am I doing? I now mostly choose TextMate.app as the editor for text files. This is a commercial editor that is well worth the investment, but sometimes you just want vi. vi is still available from the command line. I can just open a terminal window and navigate to where my text file is and type vi filename. Just like the old days.


Mac
1/8/2010 4:53:08 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |   |  Trackback
 Thursday, December 31, 2009

I wanted to try out git on the Mac. I'm reading the book Pragmatic Version Control Using Git by Travis Swicegood. There's a forum discussing this book on the Pragmatic Programmer's site, http://forums.pragprog.com/forums/64. The forum seems to be more focused on reviewing the book than discussing git issues, however.

Installing and Configuring

I have a Mac Book Pro (Intel) with Snow Leopard. To get MacPorts I went to the site http://www.macports.org/install.php and clicked on Snow Leopard.




Once MacPorts is installed, I issued the command

newtricks:~ ted$ sudo port install git-core +svn +doc

There's a Pragmatic Programmer forum entry that discusses how this macport installation of git did not work, but it worked fine for me. I can tell git is installed and working by checking its version.

newtricks:~ ted$ which git
/opt/local/bin/git
newtricks:~ ted$ git --version
git version 1.6.5.7
newtricks:~ ted$

There are only two required configuration values: user.email and user.name. Here's how you set them; they are silent commands.

git config --global user.name "Ted Kubaska"
git config --global user.email "ted.kubaska@gmail.com"

Although not required, the configuration value color.ui is useful. It color codes various git output. I'll show some examples later.

Display the configuration as follows.

newtricks:~ ted$ git config --global --list
user.name=Ted Kubaska
user.email=ted.kubaska@gmail.com
color.ui=auto
newtricks:~ ted$

Creating a Git Repository

Creating a git repository is pretty easy, in fact trivial. Just make a directory, enter it, and issue a git init. Then you can add files into this repository with git commit. This directory will be the working tree of code you check out from the repository. The repository metadata is in the directory/.git, and, guess what, its contents don't look like CVS.

So I do this ...

newtricks:GitRepo ted$ mkdir tedsrepo
newtricks:GitRepo ted$ cd tedsrepo/
newtricks:tedsrepo ted$ git init
Initialized empty Git repository in /Users/ted/GitRepo/tedsrepo/.git/
newtricks:tedsrepo ted$ ls -a
. .. .git
newtricks:tedsrepo ted$ pwd
/Users/ted/GitRepo/tedsrepo
newtricks:tedsrepo ted$

Then, in that directory, make a file (call it hello.html) to add to the repository.

newtricks:tedsrepo ted$ git add hello.html
newtricks:tedsrepo ted$ git commit -m "Initial checkin for hello.html"
[master (root-commit) f2c49ba] Initial checkin for hello.html
1 files changed, 6 insertions(+), 0 deletions(-)
create mode 100644 hello.html
newtricks:tedsrepo ted$ git log
commit f2c49baf3abafefb03b941db75ae4c026b0c877e
Author: Ted Kubaska <ted.kubaska@gmail.com>
Date: Tue Dec 29 21:07:15 2009 -0800

Initial checkin for hello.html
newtricks:tedsrepo ted$

Make a change in hello.html. Before you can commit the changed file, you must stage it. This is something that seems unique to git. You edit a file, and then you can't just commit it ... you must stage it first.

newtricks:tedsrepo ted$ git status
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: hello.html
#

no changes added to commit (use "git add" and/or "git commit -a")
newtricks:tedsrepo ted$

Notice that a modified, but unstaged file is shown in red. This is a result of that color.ui configuration value.

So stage the file before committing. Stage with git add. Note that the filename becomes green.

newtricks:tedsrepo ted$ git add hello.html
newtricks:tedsrepo ted$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: hello.html
#
newtricks:tedsrepo ted$

Then, commit.

newtricks:tedsrepo ted$ git commit -m "added head and title"
[master 4b7d2f1] added head and title
1 files changed, 3 insertions(+), 0 deletions(-)
newtricks:tedsrepo ted$

Branches

With CVS, I've always been very careful not to proliferate branches. But I think (from what I've read so far) that branches are key to the way people use git.

The name of the default branch in git (the branch you start with, the mainline, if you will) is called master. Master in Git is what I would call HEAD in CVS.

I thought it was interesting that you can create a branch, checkout the branch, edit a file and commit it to the branch. Then, checkout the master and edit and commit. You now have one version of the file in the branch and another in the master. Now if I rebase the master, the file in master has the changes that were made in the branch as well as the changes made on master. This sounds like a merge to me, although it's not technically a merge because there is a merge command. I suppose I'll see the difference when I start using the merge commands.

Here's what I mean in more detail. The following figure illustrates the actions I'm describing.



Let's say I'm on the master branch of my git repository. I put three lines in that file. I commit the file, then make a branch called R1.0. I edit the file again while still on master (the file now has four lines) and commit it.

Master line 1
Master line 2
Master line 3
Master line 4 <-- this is the line I added on master (not the branch)

Then, I checkout the branch and edit/commit the file.

Master line 1
Release line 1 <-- this is the line I added on the branch (not master)
Master line 2
Master line 3

Then, I checkout the master and rebase master with the branch. My file now has the changes from both the branch and master.

Master line 1
Release line 1
Master line 2
Master line 3
Master line 4

Here's the output I got from the rebase command.

newtricks:tedsrepo ted$ git rebase R1.0
First, rewinding head to replay your work on top of it...
Applying: added 4th master line
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging hello.txt
newtricks:tedsrepo ted$ git branch -d R1.0
Deleted branch R1.0 (was f3a999b).

As I said, it looks like a merge to me, but I've more to learn.

What is also interesting is that (with the branch checked out), you can tag it. Then, you can checkout master, rebase master with the branch, and actually delete the branch. You can restore the branch by make a new branch from the tag, like ...

newtricks:tedsrepo ted$ git branch R1.0 1.0

where 1.0 is the tag. I made the tag when the branch (called R1.0) was checked out as

newtricks:tedsrepo ted$ git tag 1.0 R1.0



Git
12/31/2009 4:32:37 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |   |  Trackback