Archive for the ‘Cube Life’ Category

Updating Git to the Google Groups Git-OSX-Installer

Friday, September 19th, 2008

gitLogo_vert.gif

As I was reading my Git Book this morning I noted that I was on v1.5.4.3 on my laptop, and it just occurred to me to check what the latest version of Git really is. I liked that this guy made an installer package that worked great as a Universal app on 10.5 (Leopard), but how far behind was he?

Turns out, a little bit.

I found that he had released a v1.5.5.0 Universal for Leopard that fixed the syncing over http, I think, but then I went to the source, and Git is really on 1.6.0.2 (stable), and that's a more significant version jump. Also, I saw that the Google Groups Git-OSX-Installer was on 1.6.0.1, and while it was Intel-only, that's all I've got for Leopard. So that seemed like a good move to make.

The first package deposited a lot of things in /usr/local/bin and such, whereas the Google Groups package is in /usr/local/git and everything is hanging off there (for the most part, we'll get to the exceptions in a minute). This looked like a cleaner uninstall as well, should Apple decide in Snow Leopard (10.6) to add in Git like they did Subversion for 10.5.

So I figured out how to get rid of the old package. Go into it's Contents directory and there should be a file called Archive.pax.gz where all the files are packed together. We can get a look at them with:

  gzip -d < Contents/Archive.pax.gz | pax -v | awk '{ print $9 }'

and all the files will be listed. Nice. I made a script to clear it all out and ran it. I then installed the new Git 1.6.0.1 package and it went in well, but the git commands like git-svn weren't in the /usr/local/git/bin directory, so they weren't going to be seen by the command line. I suppose that's not what this guy's doing, and that makes me a little nervous, but I'll go with it for now.

In order to get the paths right, I had to modify the installed file /etc/paths.d/git to look like:

  /usr/local/git/bin
  /usr/local/git/libexec/git-core

and then make use of the fact that in OS X 10.5, Leopard, the directories /etc/paths.d and /etc/manpaths.d are set up to take files listing directories to add to their respective paths if you know how to use it. So I added to my !/.tcshrc the lines:

  #
  # First, let's pick up all the paths from the system
  #
  if (-x /usr/libexec/path_helper) then
    eval `/usr/libexec/path_helper`
  endif

and we'll get the directories added to the path.

I then set up my Git global environment so that I should be ready to start working with it. I added my name and email... set up to use the colors on the commands... set up the ignore file... that kind of stuff. Nothing necessary, but all nice things to do before starting to use the tool. I think I'm ready.

Note: I like this logo for Git more as it seems to say to me the adding and deleting as well as the cycling nature of source control. And at the same time, like an emoticon, turn your head sideways and it's "Git". Sweet. Clever cats, these guys.

UPDATE: Interesting... it seems that as I read more, the commands like git-svn are really simply alternative ways of calling git commands directly. For example, git-svn is a direct command for git svn (no hyphen). This means that the Google Groups installer was right and I didn't need to add the /usr/local/git/libexec/git-core/ directory to my path! Very interesting. However, as you can imagine, if you want to call git-svn directly, then you need this directory in your path.

I've decided that the book I'm reading does not use the hyphenated commands, so I'm going to leave the install as-is and that's a big load off. It means that the guys building it are thinking the same as the author, and that's the kind of consistency I need in learning a tool like this.

Realizing What’s Important to Me

Thursday, September 18th, 2008

cubeLifeView.gif

I've been doing a lot of thinking this morning about what's important to me. I can't deny that the main reason I'm in the job I'm in is because of the amazing pay. I mean, it's amazing. And I have to admit that the development work is fun. But I can do that anywhere - I'm a developer, after all.

But that's the point. I want to develop. I don't want to mess with Jira tasks. Especially ones that are as poorly written and duplicate the same problem, cover multiple topics, used as email, etc. It's not what a bug tracking system is ment to be doing. It's a hack. Product itself is probably fine. It's the usage.

So I've been thinking about what I want to do. I want to code.

I heard about a job today that just mentioned Mac OS X as a "plus". That single fact was enough to get me interested in the job. Simple things like the platform you really like make all the difference. Heard about another doing more Java work - same thing in reverse. I can do Java, but it's not exciting to me anymore.

I'm reading about Git - sounds fun. Why? Because it's a new way of doing the same old thing, but getting around some of the problems I've had for ages. How to do a CVS check-in on the train in the evening? Can't. Can with Git. Cool. That kind of stuff.

So as I'm sitting here thinking about what I need to be doing next, I'm realizing that a new challenge really does sound like fun. Something new to do, not change for change's sake - something interesting. We'll see what comes up.

Interesting Way to Read Last Line of a Log File

Wednesday, September 17th, 2008

cplusplus.jpg

I was messing around with trying to create a feedback mechanism from one application (server) that I had no control of whatsoever, to my application that was feeding this app tick data. The problem was I seemed to be able to flood the input and create a back-up by sending in too many price events a second, and the only monitoring I had was what I was going to make. So I had to come up with a clever idea.

My clever idea was really pretty simple - monitor the log of the second process, and see if it was done processing the last bit of data I sent. If not, then wait for it, if so, then continue on. It's not rocket science, but the devil is in the details. What to do if the log message is not something I expect? What to do if the log isn't moving? All these details pop up when you put a feedback loop into your code and don't want it to hang when the other app is hanging.

But the interesting part is the reading of the log. It's a fast moving system, so I can't be assured that the file is going to stay the same for any length of time, but I need to get the snapshot of the last line in the file as it's being written. Not easy. But I came up with what I think is a clever solution:

  1. CKString readLastLine( const CKString & aFilename )
  2. {
  3. bool error = false;
  4. CKString retval;
  5.  
  6. // now let's open this file for reading
  7. std::ifstream src;
  8. if (!error) {
  9. // open it for reading
  10. src.open(aFilename.c_str(), std::ios::in);
  11. if (!src || !src.is_open()) {
  12. /*
  13.   * While this is an error, I don't want to throw an exception
  14.   * because it's possible that this file just isn't there. In
  15.   * those cases, log the error and let it go.
  16.   */
  17. error = true;
  18. std::ostringstream msg;
  19. msg << "[readLastLine] While trying to open the file '"
  20. << filename << "' for reading the last message, an error "
  21. "occured: " << strerror(errno);
  22. SPLog::error(msg.str());
  23. }
  24. }
  25.  
  26. // let's back up to the last '\n' and read what we have up to there
  27. if (!error) {
  28. char buff[256];
  29. int i = 0;
  30. // zero this out to make sure it's clean - no matter what
  31. bzero(buff, 256);
  32. /*
  33.   * We need to get to the char *before* the end, and the way this
  34.   * is done is to have an offset of (-1) and the location the 'end'.
  35.   * We need to do this as opposed to start at the end because if
  36.   * we do the latter, we'll never get off the end. This allows us
  37.   * to back up the file to get what we need.
  38.   */
  39. // get to the last character in the file
  40. src.seekg(-1, std::ios::end);
  41. // take a look at it, and if it's not a '\n', keep it
  42. buff[i] = src.peek();
  43. if (buff[i] != '\n') {
  44. ++i;
  45. }
  46. // back-up past this last character so we can loop
  47. src.seekg(-1, std::ios::cur);
  48. // keep backing up until we hit a '\n' and then stop
  49. while ((buff[i++] = src.peek()) != '\n') {
  50. src.seekg(-1, std::ios::cur);
  51. if (i == 255) {
  52. break;
  53. }
  54. }
  55. // see if we backed up so far that we missed the last full line
  56. if (i == 255) {
  57. error = true;
  58. std::ostringstream msg;
  59. msg << "[readLastLine] While trying to read the last "
  60. "line of the file '" << filename << "' for the last "
  61. "message, an error occured and a complete log message "
  62. "couldn't be read.";
  63. SPLog::warn(msg.str());
  64. } else {
  65. // get back to the last good char we read
  66. --i;
  67. // now, strip the beginning newline - if it's there
  68. if (buff[i] == '\n') {
  69. --i;
  70. }
  71. // reverse the line into a CKString
  72. for (int j = i; j >= 0; --j) {
  73. retval.append(buff[j]);
  74. }
  75. }
  76. // close the file
  77. src.close();
  78. }
  79.  
  80. return retval;
  81. }

The interesting stuff starts with the open() on line 10. Typically, you might write that as:

  1. // open it for reading
  2. src.open(aFilename.c_str(), std::ios::in | std::ios::ate);

but if you did that, you'd end up at the end of the file - as if to append to it, and you would not be able to "back up" into the file. This is the key to this code - find the end, sit on it, and then even if the file is added to, the pointer you have won't move and you can back up to get a line.

The seekg() in line 40 puts the 'marker' at the end of the file, and then reversing the buffer as you walk 'up' the file, 'peeking' the data out of it is pretty easy. The tough part was opening and quickly getting to the end while being able to back up.

In the end, this is working wonderfully for me. It's fast, stable, and as long as the log writer is buffered on newlines, we're going to get nice, complete, lines. Sweet.

Thinking About Springing for an Aeron Chair

Monday, September 15th, 2008

aeron.jpg

This last episode with my back is proving to be a real hassle to deal with. The chair in my home office was a $99 chair (I was cheap) purchased many years ago (we had no money) and when I've had to sit in it these last few weeks it seems to make my back problems worse. I know it's the chair because I can sit in other chairs and don't get these aches that I'm getting from my office chair.

Yet I can't help it - I have to be able to get some work done. It's just a fact of the business I'm in. So I'm thinking of springing for a refurbished Aeron chair. I can get one for about $700 - half off. That's not a bad deal, and it's the exact model I've used at a previous job for a while and loved every minute of it. Excellent chair.

I have a hard time spending that much money on a chair for an office that I don't sit in on a daily basis. It is, after all, a lot of money for a chair. Heck, I can get a Lazy-Boy for that money... but it's not a good, working, office chair. I think it's time to realize that I'm not getting any younger and it's time to invest in a good chair for the rest of my professional life.

Warming Up to the Idea of Distributed Source Control

Friday, September 12th, 2008

gitLogo.gif

I've been thinking about Subversion today. It's been brought on by the fact that the main Subversion server for the Shop has been down due to some reason that they never explained. At the same time, my local CVS pserver has been working just fine. But it got me to thinking. svn is nice for the ability to do svn status and get diffs and such. That's really nice. But if that's something you want to have, why not take it another step and make it all on your box - there's a Distributed SCM system. Like Git.

So... is it time to get into something like Git? Not sure. I was talking to a friend a while back and he's going in that direction because there are a lot of advantages to this scheme. Face it - the one thing CVS, Subversion, ClearCase, PVCS, etc. all have in common is that they have a central repository. This is great for a company that wants to have a 'vault' for their code. Some place to lock down, back-up, secure and control.

But if you say that's not important because there will be enough copies of the repository around, you don't have to worry about losing the whole thing. You can get it from your buddy. OK, "bad" for corporate-types, but for guys writing code on Open Source projects, it's ideal. I've got it - you've got it, and I don't have to constantly be connected to "The Source" to work and have version control. I only need to be connected to "The Source" if I want it to have what I've been doing.

Think of the case where one developer fixes one file and some of the other members need to get this file. With CVS you all get it when you do anything SCM-related. Nice if you have a fast network connection to "The Source", but if you don't it's painful. And if you don't need the change, you get it anyway, most likely.

Git (as an example) would let a group develop different parts of the project without having to connect to one another until they decided that it was time to share code - then they'd do it. And only then, share what they wanted. You could choose to have Git hosted in a central location for synching - much like a traditional 'primary' repository, if you wanted. There's no one way to do it.

I'm getting interested in the idea of having a central Git repository for historical records and then using Git locally to do most of the work. It would mean larger disk space usage, but I'm guessing with decent laptop drives it's not that big a deal. And there's TimeMachine to back it up. Might be a good idea. Have to give it more thought.

London Stock Exchange (LSE) Down for a Day

Tuesday, September 9th, 2008

pirate.jpg

I am really surprised that I missed this given that I was dealing with my London counterparts all day yesterday, but the London Stock Exchange (LSE) was down for seven hours yesterday. Now I'm not one to point fingers, but the Slashdot crowd is pointing out that the system they are using is based on Microsoft's .Net platform, and are certainly making fun of that little tidbit. Even so, seven hours is an incredibly long time to have an exchange down. Holy Cow!

I'm guessing that someone is going to be in big trouble, and there will be a scape goat for this issue. There are too many people angry they couldn't trade for a day - and yesterday at that. Fannie Mae, Freddie Mac bailouts... mis-reporting UAL's bankruptcy and losing 80% like a shot... it was a Big Day to be unable to trade.

When Team Work Isn’t – Being Out Sick and Getting Called

Monday, September 8th, 2008

cubeLifeView.gif

Everyone should be entitled to be sick. At least that's the philosophy we created at the company I started. We didn't even put a limit on it because we figured that if you were sick, then there was a reason you were sick, and you'd get back to work as soon as you could, and pick up where you left off.

Well, that was a little optimistic, I realize now, but that's not because it's a bad idea, it's because it's a good idea, and we had bad people taking advantage of it. We just needed to be a little better at the hiring process. That was where we fell down.

But here, I'm in a big company. With paid sick time. And I use very little of it. But this past week I was out because of my herniated disc, and I simply could not stand up. But I got called - three days out of four. Some were understandable, but some were quasi-understandable with a hint of "Hey, now that you're online, can you have a look at these specs, and let us know what you think?"

Thankfully, a few of the guys asked by my Boss to call me on such pretenses tried to abstain. Once emailed me and asked if it would be OK, and the other asked, but said he felt bad about it. I can understand it. You gotta do what the Boss says. But at some point, and I think last week was that point, you cross the line and are asking a sick person to do work. That's plain wrong on so many levels.

So I talked to my manager and told him my feelings. I thought it was over the line, and planned to tell my Boss today. He agreed that asking is OK, but assuming is wrong, and he knows our Boss well enough to know that it's never going to change for him. I still told him, and reiterated my feelings that I wanted off this project that he's got me on. He said that was impossible - he had been told make it work or you're out. And given those choices, I can see why he's going to put his best people on it - even if it burns them out.

Desperation at so many levels... it's not about the Team anymore. I've got to remember that.

Adium 1.3.1 is Out!

Monday, September 8th, 2008

Adium.jpg

This morning I checked for an update to Adium and found that 1.3.1 was out! Excellent! I got the update right away and as I read the release notes, there were a ton of fixes to the app. It's wonderful to see progress on something like Adium as I use it every single day and would be lost without it.

I know they are planning on putting in video conferencing as well, but I'm not connected to enough fat pipes during most of my day to take advantage of that. But I do love IM.

Lots of Pricing Fun this Morning

Friday, August 29th, 2008

MarketData.jpg

We have had an upgrade of our infrastructural ticker system - that which my ticker plant is based on. It happens - things move forward, get better, all that. The problem has been that for the last two days - that's the first two days of the new infrastructure, we've had a good number of pricing issues from this new infrastructure. Not good.

So I was very interested in getting to the bottom of these issues today so that we don't have the same problems next week. What I learned from my contact in the infrastructural team is that this was a bug in their stuff when they restarted it. If we do a clean restart - clearing the cache, after their restart, then we should be OK. They have a bug fix in testing and as soon as I can get ahold of it, I will and kick the tires and give it a good check.

I don't want to get caught in the position where I'm getting these wacky prices. It's a major pain. Like a 2:30 am phone call 'pain'.

Being the Boss Doesn’t Mean You Can be a Jerk

Thursday, August 28th, 2008

PHB.gif

The last two days have been very interesting for me, professionally and personally. Yesterday I was sitting in a meeting with a project team and my Boss asked me if the process created by two other team members was error-free and ready to go. Since it hadn't worked for my part of the project, I had to couch my answer as saying I could not speak to the entire process, but the part where my stuff was impacted did not work. Yet.

Basically, I didn't want to make it appear that these guys failed in their efforts. First, they had precious little time, secondly, I had no idea if my part was 1% or 50%, and if it was 1% and the other 99% went smoothly, then there's reason to be optimistic. Basically, I knew very little because there had been very little time.

I tried to be diplomatic, but my Boss started yelling. At me. Even though it was clear that I was not responsible for this process, and more importantly, I said I just didn't know. Ask someone that knows. He didn't like that answer.

Often times, my Boss will put me on things because they are critical and he knows I'll complete them and make him look good. This has often times made me disliked by the other folks in the Shop as it puts me at odds with their little parts of this and that. This was no exception. I had been told by several levels of managers that these two guys had this process, and it was theirs.

So I left it to them. To my Boss' clear anger.

He yelled - considerably. I said I'd take care of it. It ended up not being right, and there were significant issues that had to be fixed, many of which were uncovered by me - not them. But since I'd taken the yelling, I was allowed to help. Lucky me.

Today I went into my Boss' office and told him that things were on track, and he mentioned that the manager of the two guys stopped by with that same news earlier. Good. I then wanted to talk to him - respectfully, about his behavior towards me in the meeting.

Yelling at me, when it's not my responsibility, success or no, is not professional. It's over the top. Way, way, over the top.

I attempted to tell him the position he puts me in - directly at odds with the managers on the floor - expecting me to simply work it out and make things happen. Well... after seven years, I'm tired of that. Certainly on this project. Where I had started that way and been slapped down so many times, I just didn't feel like getting up.

My Boss responds with "I see your point, but I'm not going to apologize."

I was stunned. Why not just leave it at seeing my point? Why did he have to make the point that he's not going to even offer a trivial apology? In retrospect, if he's the kind of guy that would yell at me in the first place, I shouldn't be surprised that he would not offer even a shallow apology.

My point of writing this is two fold: first, it's significant and it show the mentality of the people I work for, and second, I think there's no doubt in my mind this will happen again. And when it does, I'm going to pull this out and replay it to him. Not that it'll matter, but then I'll send it to HR, and they will have a talking to him.

May not change a thing, but I have warned him.