Archive for June, 2012

A Couple of Interviews Today

Monday, June 25th, 2012

It's been a long day, and I'm not feeling exceptionally great about the possible outcome of the day's work. It all had to be done, but I'm worried about what might, and what might not, come of all the talking and walking.

Today I had two interviews at places in Chicago, and so I got up this morning and went forth, determined to land not now, but two, offers, and be able to pick my favorite of the two. I had a more 'corporate' interview first, and I believe they are going to offer me a position, but I could be wrong. It's certainly happened before. And even if they offer me the position, I'm concerned that it'll be so low I won't be able to take it without also having to some up with some other source of income to supplement it - or move and drastically reduce our living expenses.

The second was with a start-up, and while I really liked the guys, and can see myself working with them on this venture, again, I don't see them coming up with the money I told them I'd have to have to work there. I can appreciate why they don't have the money, but then I'd really almost have wished that they hadn't have me talk to them if they knew they couldn't pay me. It just gets kinda dissappointing.

In the end, I don't know anything at this point, and I just need to sit tight, follow other leads, and see where things lead. Who knows? Maybe they will surprise me both.

That would be really nice.

Getting ZeroMQ 3.2.0 Compiling on Mac OS X 10.7 Lion

Wednesday, June 20th, 2012

ZeroMQ

This afternoon I decided that maybe it was time to see if I could get ZeroMQ built and running on my MacBook Pro running OS X 10.7 as well as my Ubuntu 12.04 laptop. I'm thinking it might be nice to write a few little test apps again with the latest ZeroMQ APIs between the machines to make sure that I have everything I need - should it come to that and I need to implement a little ZeroMQ action into DKit, or some other library.

The first step is downloading it from the ZeroMQ site. I picked the POSIX tarball as it's the one with the created ./configure script, and I needed that in order to get things kicked off.

Next, we try to build it on OS X 10.7 and Ubuntu 12.04. There are a few changes that have to be made to the OpenPGM code in order for it to compile on OS X. They are basically the includes needed, and not allowing duplicate definition of values.

In ./foreign/openpgm/build-staging/openpgm/pgm/include/pgm/in.h :

Replace:

  1. /* sections 5 and 8.2 of RFC 3768: Multicast group request */
  2. struct group_req
  3. {
  4. uint32_t gr_interface; /* interface index */
  5. struct sockaddr_storage gr_group; /* group address */
  6. };
  7.  
  8. struct group_source_req
  9. {
  10. uint32_t gsr_interface; /* interface index */
  11. struct sockaddr_storage gsr_group; /* group address */
  12. struct sockaddr_storage gsr_source; /* group source */
  13. };

with:

  1. #ifndef __APPLE__
  2. /* sections 5 and 8.2 of RFC 3768: Multicast group request */
  3. struct group_req
  4. {
  5. uint32_t gr_interface; /* interface index */
  6. struct sockaddr_storage gr_group; /* group address */
  7. };
  8.  
  9. struct group_source_req
  10. {
  11. uint32_t gsr_interface; /* interface index */
  12. struct sockaddr_storage gsr_group; /* group address */
  13. struct sockaddr_storage gsr_source; /* group source */
  14. };
  15. #endif // __APPLE__

In ./foreign/openpgm/build-staging/openpgm/pgm/sockaddr.c :

Replace:

  1. #include <errno.h>
  2. #ifndef _WIN32
  3. # include <sys/socket.h>
  4. # include <netdb.h>
  5. #endif

with:

  1. #include <errno.h>
  2. /* Mac OS X 10.7 differences */
  3. #ifdef __APPLE__
  4. # define __APPLE_USE_RFC_3542
  5. # include <netinet/in.h>
  6. #endif
  7. #ifndef _WIN32
  8. # include <sys/socket.h>
  9. # include <netdb.h>
  10. #endif

In ./foreign/openpgm/build-staging/openpgm/pgm/recv.c :

Replace:

  1. #include <errno.h>
  2. #ifndef _WIN32

with:

  1. #include <errno.h>
  2. /* Mac OS X 10.7 differences */
  3. #ifdef __APPLE__
  4. # define __APPLE_USE_RFC_3542
  5. # include <netinet/in.h>
  6. #endif
  7. #ifndef _WIN32

The final change is to the ZeroMQ source itself:

In ./src/pgm_socket.cpp :

Remove lines 88-92, make this:

  1. pgm_error_t *pgm_error = NULL;
  2. struct pgm_addrinfo_t hints, *res = NULL;
  3. sa_family_t sa_family;
  4.  
  5. memset (&hints, 0, sizeof (hints));
  6. hints.ai_family = AF_UNSPEC;
  7. if (!pgm_getaddrinfo (network, NULL, &res, &pgm_error)) {

look like this:

  1. pgm_error_t *pgm_error = NULL;
  2. if (!pgm_getaddrinfo (network, NULL, addr, &pgm_error)) {

At this point, we can get ZeroMQ to compile on Mac OS X 10.7 as well as Ubuntu 12.04. But there's a slight wrinkle… while I'm fine with the linux library being a 64-bit only architecture:

  drbob@mao:~/Developer/zeromq-3.2.0$ file src/.libs/libzmq.so.3.0.0
  src/.libs/libzmq.so.3.0.0: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/
  Linux), dynamically linked, BuildID[sha1]=0x71a160f17833128c864811b25942cdacdb54
  f6d0, not stripped

I'd really like the Mac OS X 10.7 dynamic library to be Universal, with both 32-bit and 64-bit architectures in it. Currently, it's 64-bit only:

  peabody{drbob}82: file src/.libs/libzmq.3.dylib
  src/.libs/libzmq.3.dylib: Mach-O 64-bit dynamically linked shared library x86_64

Hmmm… it's really amazing why some folks choose to write Makefiles in a way that doesn't allow you to use multiple -arch arguments. There really aren't all that many way to mess this up, but it seems that the OpenPGM and ZeroMQ guys have done it really pretty nicely. I can't simply remove the offending compiler flags and add in the necessary -arch i386 -arch x86_64. So I have to make it twice: once for i386 and again for x86_64 and then use lipo to stitch them together.

In the Makefiles, I added the -arch i386 command to the CFLAGS and CPPFLAGS variables after successfully building the 64-bit version of the libraries. I then did a simple:

  $ make clean
  $ make

and then when I looked at the resulting libraries they were 32-bit. I then just created the Universal binary with the lipo commands:

  $ lipo -create libzmq.3.dylib .libs/libzmq.3.dylib -output .libs/libzmq.3.dylib
  $ lipo -create libpgm-5.1.0.dylib .libs/libpgm-5.1.0.dylib -output \
    .libs/libpgm-5.1.0.dylib

Now I can copy these away and install them in the right location for usage. Typically, I'll do a make install and place everything into /usr/local/ and then copy these Universal binaries over the installed mono-binaries and be ready to roll.

UPDATE: I can get ZeroMQ to work with the simple transports, but the OpenPGM encapsulated transport fails miserably. I'm looking at the code and I'm becoming convinced that no one is really using or testing this code. It's a mess and there's no way some of these method calls are going to work. It's all in the PGM portion, so if they stay away from that, it's fine. But that's not good enough for me. So I'm giving up for now. I have asked a few things in IRC, but there aren't any responses (yet), and I don't expect to get any about the OpenPGM part.

I think it's dead, and I need to just move on. Sad to see, but it happens.

[6/21] UPDATE: after a lot of work trying to get the OpenPGM 5.1.118 code to work, I see that the developer knows about the problems, and is just not ready to support Mac OS X 10.7 at this time. I can respect that, but the things he had to have done to make his code this non-standard must be pretty wild. So there's nothing I can do at this point. OpenPGM is a deal-breaker, and that's the entire reason I wanted ZeroMQ.

Appreciating Ubuntu 12.04

Wednesday, June 20th, 2012

Ubuntu Tux

This morning I was once again updating my Ubuntu 12.04 laptop and realized that were it not for a crummy hardware platform - the trackpad is horrible, and the display is very inexpensive, this would be a really nice laptop/development box. It's got all the tools I could ask for, it's got some wonderful fonts for the Terminal and such, it's got Google Chrome for all the web stuff… it's really pretty slick.

I gotta tip my hat to the Ubuntu folks. This is a much better distro than RedHat/Fedora was. I'm guessing Fedora is getting better, and it's probably as nice as you need, but the ability to do the updates easily - and have them on by default, is really nice. It's nice to have it all right there.

Certainly, I'm not giving up my MacBook Pro anytime soon, but I've looked at BestBuy, and you can get nice Wintel hardware for $700 to run this on… all of a sudden, it's something I might actually carry from time to time. Certainly nicer to work with than the crummy trackpad and display.

It's a great compliment to the MacBook Pro. Nice to have.

Updated the Look of the Blog

Wednesday, June 20th, 2012

With the update of my web site, it seemed like a good time to look into refreshing the look of this blog as well. Specifically, look a a complementary theme - blue on white, with a "minimalist" sense, to keep the focus on the content, not the design. I was pleased to see that I'd done this search quite a while ago, and had a nice theme already picked out. Sweet!

The theme is called White as Milk, and it's a nice minimalist theme. There are a lot of little customizations that you can do, and I've had to do a few to get things looking the way I want - specifically, getting the style of a few elements looking right, and making the entire blog a fluid width page. I just got done doing that modification yo my basic web page and wanted to keep the same attribute in the blog.

What's it all about, Alfie?

This matches the look of the web site very nicely, while not trying to be a complete match to every style point. I think it's looking nice, and I'll live with it for a little bit to see how I feel about it.

Google Chrome dev 21.0.1180.0 is Out

Wednesday, June 20th, 2012

Google Chrome

This morning I noticed that Google Chrome dev 21.0.1180.0 was out with several changes for the Retina MacBook Pro as well as the latest V8 javascript engine. These are really nice updates, but what I noticed right off is the mistake in the rendering with the previous version left a slight tell-tale horizontal line in the background every "page" or so. It wasn't horrible, and wasn't even directly repeatable all the time, but it was somewhere on the page, and it was enough that it made me wonder if my machine was bad.

So it seems to be gone, and that's great news, but so are all the other fixes. These HiDPI changes are nice for a lot of people getting the new MacBook Pros, and one day I'm sure I'll have one too… but it's not where I'd hoped Chrome were adding features right now. But that's OK… it'll all work out I'm sure.

UPDATE: Spoke too soon:

Chrome Render Bug II

Interestingly enough, these disappear if I scroll this section out of range, but will return to another location on the page if I just keep scrolling. Nasty bug, but it's in Chrome, and I'm not going to worry too much about them fixing it. They'll get to it - just like they did with the rendering of the Finance page on Zoom.

[6/22] UPDATE: this morning I see 21.0.1180.4 is out and this time, they say they fixed several "alignment issues", and I'm hoping they mean these lines. They also put in the V8 javascript engine 3.11.10.10, which is nice. I'm hoping these lines are gone.

Developing Code in Your Own Style

Tuesday, June 19th, 2012

GeneralDev.jpg

I have been doing a fair bit of coding on a few projects this last week, and yesterday I spent a good bit of time documenting an Xcode project I've spent a couple of weeks on. This was all because I'd moved it to GitHub, and the standard there is to look for a README.md file at the root of the repo and render it in GitHub Flavored Markdown as an introduction or initial documentation on the work in the repo. Since I hadn't had it in GitHub before this, I didn't need to make the documentation. After all, there's only one other guy on the project, and he's not yet done any work with this library, so it wasn't important to do it previously, but it made sense to do it now.

After spending several hours on this documentation - complete with code samples, installation instructions for the server-side required components (PHP, PostgreSQL, Apache), and everything I could think of about the project, my partner in this venture looked at it, deemed it nice, but said "We have to work on de-personalizing the docs".

Immediately, I was taken aback. I worked very hard on the docs, and while they aren't perfect, I was surprised to see exactly how I felt about that comment from him. I wasn't upset - not really. I was just irked.

After 38 yrs of being a professional programmer, and all this is still not making me a dime, I think I was feeling that I deserved the opportunity to write docs the way that I feel they should be written. I'm writing code the way I think it should be written, so why not the docs as well? It's got a wealth of information in there, and while the comment wasn't a serious critique, it was something that I just didn't see coming.

More importantly, it got me to thinking: At what point in your life do you really get to do what you want to do? I suppose the answer to many is obvious: Never. Others will say just as assuredly: Always.

Clearly, neither is right. There are certain times you can do certain things and everything is fine. I'm sure he was thinking that the documentation needed for a 510k medical instrument was more formal than I was writing. Maybe so, and I understand where he was coming from, but it didn't really lesson the question any.

After all, I'm in the middle of my fourth month of forced unemployment, and I'm finding that there are a lot of people out there that are getting jobs after being laid off from the same company a lot faster than I am. I'm not jealous of them, I'm just very surprised at the difficult that I'm having. But I have faith - it'll all come together at the right time with the right company, and things will pick up again.

And my choice to take this time to write code for a project that by all accounts might never see the light of day, let alone generate anything more than lunch-money for me, is all on me. No one forced me into it. No one told me it'd make me rich. OK, I fibbed there, my partner in this said that, but I knew right off he was a little over the top on this.

But I'd still like to think that after 38 yrs of being a professional developer. I know how to document my own code. But maybe for this certain instance, for this certain licensing with the FDA, I don't.

Kinda bites to realize that.

Back to Twitterrific

Tuesday, June 19th, 2012

Twitterrific.jpg

OK, I am a big Twitter fan, and I've used several of the popular Twitter clients on my iPhone and MacBook Pro, but my latest client has been Hibari because it didn't have any of the reported problems that Twitterrific had with switching the graphics from integrated to discrete, as I've noted before.

Well… with the recent updates from Apple, I've come to realize that the display problems are now gone, and I can pick the Twitter client that suits me best. One of the things I really liked about Hibari was the fact that it showed the conversation that a particular tweet had. But this morning, I saw that Twitterrific did this as well:

Menubar

Sweet! 🙂

So I'm back to Twitterrific as it's got the menu bar Ollie that lets me know when I have a new tweet, and it's visually a little easier to read the different colored tweets. I'll admit the inline pics are nice, but I almost always have to click on them to look at them anyway, and in Twitterrific I get the built-in viewer.

So for now, it's back to Twitterrific!

Installing JDK 6 on Ubuntu 12.04

Monday, June 18th, 2012

java-logo-thumb.png

This afternoon I wanted to get a few things going on the new Rackspace Cloud Server Joel had reconfigured to run Ubuntu 12.04. Specifically, I wanted to get the latest JDK 1.6.0 installed on the box as we need that for Mingle, which is the point of all this reconfiguration and such.

As it turns out, it's not that bad you just have to know where to go and what to get, and what to do with it. Isn't that the same thing with all new software for linux? Yes.

OK, first, get the latest JDK 6 download from Oracle here. Then it's a simple matter of unpacking it:

  $ chmod +x jdk-6u32-linux-x64.bin
  $ ./jdk-6u32-linux-x64.bin

Then you need to move that to someplace useful. For me, that's /usr/local and then make a few symlinks to make it easy to upgrade:

  $ sudo mv jdk1.6.0_32 /usr/local/
  $ cd /usr/local
  $ sudo ln -s jdk1.6.0_32 jdk1.6
  $ sudo ln -s jdk1.6.0_32 jdk

Then we can put it into the path using the alternatives system on Ubuntu 12.04:

  $ sudo update-alternatives --install /usr/bin/javac javac /usr/local/jdk1.6/bin/javac 1
  $ sudo update-alternatives --install /usr/bin/java java /usr/local/jdk1.6/bin/java 1
  $ sudo update-alternatives --install /usr/bin/javaws javaws /usr/local/jdk1.6/bin/javaws 1

and then set the default JDK (if needed):

  $ sudo update-alternatives --config javac
  $ sudo update-alternatives --config java
  $ sudo update-alternatives --config javaws

Finally, we can verify that the JDK was installed properly:

  $ java -version
  java version "1.6.0_32"
  Java(TM) SE Runtime Environment (build 1.6.0_32-b05)
  Java HotSpot(TM) 64-Bit Server VM (build 20.7-b02, mixed mode)

Added Lots of Docs to SyncKit Project at GitHub

Monday, June 18th, 2012

GitHub Source Hosting

Today I moved my SyncKit project from Codesion (wanting more than $1000/yr) to GitHub (less than $100/yr) and with that move, it made a lot of sense to add in the standard GitHub README.md file so that the main page of the repo has some nice introductory documentation. While I was at it I did a lot of documentation - including how to set up the server-side box, and how to verify the set-up, and what the organization of the project was, and how it was all wired up to work. It was a lot of docs for a single day. But important to make sure that we are ready for any kind of documentation checking.

I'm glad to have it on the private GitHub side as well - there are just so many nice things about GitHub, I like to support it and use it when I can.

Creating New Users on Ubuntu 12.04 from the Shell

Monday, June 18th, 2012

Ubuntu Tux

Today I needed to create a few new users on a fresh Ubuntu 12.04 install from the command line. Thankfully, I was in as root, so all I needed were the commands to get these accounts set up and ready to go. For each account I did the following steps - doing them twice for the two accounts isn't all that hard to do.

First, create the user (and make the home directory if not there):

  $ useradd -m drbob

next, change the password on the new account:

  $ passwd drbob

next, change the default login shell for the account: (/bin/bash)

  $ chsh drbob

finally, add the user to the sudo group so this user can, well… sudo:

  $ adduser drbob sudo

At this point, I was able to login, make sure I was there, then tar up my .ssh directory and what I needed from my Ubuntu 12.04 home directory on another box, and put it all on the new server with a simple sep command.

When I logged in next, it was all there and I was ready to go. Sweet!