Archive for January, 2008

Working with plists in C++/CKit

Wednesday, January 16th, 2008

CKit.jpg

While I know there are a ton of linux libraries that deal with plists, I needed to have my 'data tree' class in CKit read and write them. It's not going to be 100% plists, but it's awfully close, and for all the times I'm going to need it, it's going to work perfectly.

I've been spending the last two days hammering on this and I have to admit that it's making my head hurt. It's a ton of work with the variants, and that means a lot of if/then/else work for each data type the variant can hold. Nothing really romantic about it, just practical code that's going to make it a lot easier for me to have nice, useful application preferences from here on out.

The nicest thing about it, I suppose, is that I retain the use of the serialization codings for the variant data type. This means that should I want to store a table in the plist, it's possible without it being a total mess. Yes, it's going to require that the person editing it is going to have to know what they are doing, but that's not a horrible thing, either. I'm hoping that this is going to be a nice base to work off of in the future.

It’s scary when you know the product better than the vendor

Wednesday, January 16th, 2008

cubeLifeView.gif

Here's something that happened to me today that makes me a little scared of the vendor relationship I have with our price feeder. First, it's another group in the Bank, so it's not like they are a real vendor - and for that I'm eternally grateful. But even so, today I saw a problem in the feed and I was able to figure it out faster than they were. More to the point, when I explained it to them, they had to take a step back and think about it before they realized what the problem was.

It's all about trying to be clever and efficient - which normally, I'd be in support of, except where it causes problems for others. Get it right then get it fast. That's the way to do it. Unfortunately, they have it right, but using it then becomes very difficult as what they send (only the diffs from the last tick) isn't really enough to do the job of interpreting the data.

There are two fields of importance in this example: the price and the time it was sent from the exchange. Let's say they aren't properly mapping out the time from the Reuters FIDs, and so all I get is a date - no time. When a new tick comes in, the date hasn't changed and the time hasn't been mapped, so the date/time hasn't changed from it's last value, and so it's not sent. The price is, but without the time, when was this price issued? Today? Is it current at all?

Had they sent the date/time every time then this would not be an issue - but they can't do that - inefficient. So because they want to only send the diffs we have to put in a lot of extra logic to figure out what it was they meant to send.

It only gets more complex when you think that a "tick" may come form the exchange with a date/time of 'today' and a price of 0.0 - meaning it's not really a tick. So I properly ignore that. But if the date/time is never resent, then all subsequent ticks don't have an 'old' date/time to run with. As I said... it's problematic.

But it's the fact that this doesn't seem to represent a problem to them that bothers me. You should be in the mode of helping your customers, not making it harder for them. In this case, they were definitely making it harder by not being a little less efficient and sending the date/time again. Sigh...

MacWorld Keynote

Tuesday, January 15th, 2008

Apple-logo.jpg

It's not that every keynote needs to have something for me. I didn't really expect anything from this one - based on the rumor sites, and I wasn't surprised. I like the Time Capsule, and I think the MacBook Air has an audience (it's not me, but it's got an audience), and while I like the option of movie rentals, I have that in Comcast OnDemand, so there's nothing new there.

The addition of the apps to the iPhone and iPod Touch are nice, but since I don't have either, I'm not impacted by the announcement. I was a little taken aback by the $20 fee for the iPod Touch users, but I guess they have to sell it for something - like the 802.11n update for Tiger. I did think that $20 is steep, but what the heck... it's the cost of early adoption.

I will say that the only thing that looks even remotely like something I might get is the Time Capsule. The problem there is that the drive is contained in the box. It'd be great to be able to configure the unit to use a network drive - or let Time Machine use a network drive itself, so that I wasn't stuck with their drives.

I want to put in a RAID 5 system with lots of expansion, and that's not in the cards at this time with this solution. Well... maybe soon enough, they'll have some update for this to Time Machine. Until then, I don't really mind the cord all that much. It's an inexpensive solution to a hard problem that I really like having with me.

Making a tarball of CVS Changes

Tuesday, January 15th, 2008

Apple-logo.jpg

One of the things I like to do when I've made changes to several files in a CVS directory - and haven't yet checked them in, is to make a tarball (a .tgz file) of them so that I can move them to another machine for testing. For example, working on cross-platform code, it's nice to get it working on one platform and then move it to the next and verify it before checking it in. This way all the changes for the modification are in the one CVS check-in.

I wanted to make a simple alias for TCSH that did this on my Mac. I was doing it all the time and it just seemed smart to finally do this right once and then just use it from here on out. The problem I got into were these "Apple Dot" files (._file) that tar was including in the tarball even though they weren't listed in the list of files to include - nor could I exclude them with the command options.

So I did some googling and found the COPYFILE_DISABLE environment setting in Leopard. If this is set to 'true', then these Apple Dot files will not be copied. But, since I didn't want to make a big change to all my shells, I decided to simply make it defined for the one command.

Finally, then, here is the alias:

  alias tcu 'setenv COPYFILE_DISABLE true; tar zcvf \!* `cvs -q update |
      grep -v \^\? | sed -e "s/^[AM] //g"`; unsetenv COPYFILE_DISABLE'

(it's all one line, of course)

Bank of America Buys Countrywide

Monday, January 14th, 2008

pirate.jpg

OK, I'm not one to care a lot about business moves because the real reasons for them are most often than not inaccessible to the public. Oh, there's a public spin on the deal, but the real underlying reasons are often much less noble, and are far more focused on the profit a few can make on the deal.

However, today's announcement that Bank of America (my personal Bank) buying Countrywide (the holder of my mortgage) has me both interested and a little upset at the sub-prime lenders. I'm a "30 year fixed" person, myself. Yes, it means that I could possibly get more house with less per month if I did some more creative financing, but that's not the purpose of a mortgage, in my opinion. I need a roof over my family's head. I need stability for them. I don't need to play a game with my kid's home. I need to be reasonable, and safe.

So the idea of sub-prime mortgages is just something that may get some people into homes they could not afford otherwise, but in the end, I'm not sure that they can stay in those homes. Face it... if you can't afford the mortgage, then what makes you think you can afford the house? Taxes always go up... fees... assessments... all those costs with a home always rise. So if you can't afford the house to day on even a standard ARM, why get in at a sub-prime level? You're not going to be able to keep the place unless you start to make a lot more money - but at that time you're refinancing the mortgage and you're not sub-prime anymore.

So when I see this I get a little angry. Countrywide is in trouble, and while they aren't going to foreclose on me, they might have to sell assets to stay above water. But then my bank comes in and buys it up, so I'm bailing out myself. I sure hope it works out for me. In the end, it's stability that the markets want, and this offers some, which is good. But wow... I didn't see it coming.

What are you going to do today that’s worthy of me?

Friday, January 11th, 2008

product-15in.jpg

I was watching this TED talk by J.J. Abrams entitled The mystery box, and he was talking about the unlimited possibilities of a blank page, and his love affair with Apple computers. He pointed to his Powerbook and said:

This machine is great. It's like it's looking at me and saying What are you going to do today that's worthy of me?

I share that feeling completely. I've had the 17" Powerbook since it was first created. Now I have a 17" MacBook Pro, and I think I'll always have the best laptop Apple makes. It's just a feeling of the quality of the hardware and the software. The feeling that there's just about nothing I can't do on this guy. It's the creative palette that really does allow you to achieve your best. And in that, it's expecting you to give it your very best efforts as well.

And there are certainly more days than I can remember looking at the screen of this machine and feel it look back at me with the same feeling: what are you going to do today, Bob, that's as good as this? I've listened to Steve's keynotes and they are of that same tone - these are the machines of the dreamers... the creative professionals that will shape thought... change the world. What are you doing that's like that? I just love it to pieces.

Using CKStrings in hash_set and hash_map

Thursday, January 10th, 2008

CKit.jpg

Yesterday I was starting to work on my next little project - a price injector from our price feed to a new vendor app that we're integrating.

Another developer is building a nice C++ wrapper around the proprietary messaging API. It's not terribly complicated, but he's going to wrap it so that we can make a message system that we can use within the Shop without having to worry that we're overloading the vendor's product. So with that part done, or at least getting done, I can focus on the application that will takes prices from the price source (CacheStation) and then send it to the app via our message bus.

Configuration for these apps is something I've worried about over and over for each new app. You want something that's easy to edit... something that's got a central location for easy maintenance... yet not introduce more system dependencies than you absolutely have to. Most of the time this is a configuration file, but I have used configuration databases at times and while I like a lot about that, I think the better solution is to have a flat file that can hold complex objects and structures and then make it possible to have this reloaded on-demand or on a timer and in that way you simply edit the file and the changes will be read in.

So in doing this I was thinking I'd mimic the BKHashMap and BKHashTree in BKit. Both have been very successful for me, and so I started looking at the hash_map in the SGI extensions to STL that have recently been adopted by C++. The problem was that in order to use a CKString as a key in the map (or an element in a hash_set) I needed to specialize the hash<T> template. It was pretty simple once I looked at the header for hash_fun.h:

  /*
   * While I'm not a big fan of the way they have chosen to put in the hash_map
   * and hash_set templates - I think it's too clunky. They should have made
   * it possible to put a hash operator or method on the class, but that's an
   * opinion. Anyway, given how they chose to do it, this template specialization
   * allows us to create sets and maps using the hashing function below.
   */
  namespace __gnu_cxx
  {
    template<>
    struct hash<const CKString &amp;>
    {
      size_t operator()(const CKString &amp; arg) const
      {
        return __stl_hash_string(arg.c_str());
      }
    };
  }

With this, I can create the has_map by simply saying:

  #include <ext>
  #include "CKString.h"
 
  __gnu_cxx::hash_map< CKString, int, __gnu_cxx::hash<const CKString &amp;> > map;
 
  map["when"] = 10;

Once I have the hash_map I can build the CKHashMap and CKHashTree classes. These would then form the basis of the file-based preferences system for the application. I've already done the code for BKHashMap to read and write plists of objects, so it'd be easy for me to make nicely structure-rich preferences files and then simply read them in and manipulate them.

The Conflict Between Individual and Group Goals

Thursday, January 10th, 2008

NetNewsWire.jpg

First, this morning NetNewsWire 3.1 was released, with what was announced as primarily a performance-improvement based release. This is great news. Not that NetNewsWire was a pig, or anything, but when they take the time to work on the code code of an app (like I have been doing to the server) it shows a commitment to the app at a level you don't see when you're just trying to add new features to make users happy. So, Great Job to Brent S. on the release. I'm running it already.

The next bit of news that comes from Brent and the NewsGator folks is that NetNewsWire is now freeware. That's right - totally free. All of the NewsGator 'personal' products are free. They look at this as the way to get mind-share and name recognition and it's probably going to work. There are a lot of people using something like NetNewsWire for personal reasons, and if they see a professional app from the same guys, they'll be more likely to give them the nod - all else being equal.

And at the same time, there's a great article on Rogue Amoeba about the devaluation of all software for a platform when a good piece of software is available for free. The posting says:

There's certainly a place for free software. But when a fully-featured product such as NetNewsWire is suddenly free, it effectively reduces the value of other for-pay software products. "Why should I have to pay for quality tools, when this quality tool is free?", the thinking goes. When something is given away for free, its perceived value is lowered. If software is treated as valueless, it becomes much, much harder to sell. One need only look at a quote from news coverage discussing the move to freeware to see this in action: "And thank [NewsGator] for this grand gesture...While you're at it, do pray that a few other software companies get inspired by this move and follow suit."

So very true. He continues with the browser battle and how when Microsoft started, it was far far behind Netscape, but they threw their weight (and money) behind IE and it became the best choice - and eventually the standard. Then Netscape withered and died. The competition stopped making IE better, it languished, became a petty dictator of the net, and we have what we have today. Power corrupts, and absolute power corrupts absolutely.

Yet at the same time we see that Brent is happy about this decision. Saying in his post:

But I will say that, for me personally, this is a dream come true. Every developer wants to be able to work on the software they love, make a living at it, and give it to the world for free.

Usually you get to pick two out of three — if you’re lucky. Me, I get all three.

So what we have is a situation where the goals of an individual (Brent) collide with the goals of the Mac Development community - possibly even the long-term goals of the Mac Users themselves.

I remember that back in the late 1980s, Prodigy originally test marketed their online service for free - just get the free disk, load it on and get five free accounts. Everything was paid for from the ad revenue. Interesting fact. No one wanted to use it. So they charged $12.50/month for the same thing and they had people signing up by the droves.

Why?

Perceived value. If you don't have to pay for it, can it really be that good? I mean really, if it's free, what's it worth? But if they are asking for money for it, I'll give it a look and see if it's worth that to me.

The decision about NetNewsWire is not that big a deal. Yes, it's going to change the market slightly, and yes, it probably means that RSS readers are going to be driven by NetNewsWire for as long as it's available. But the same it true for TCP/IP stacks. You used to have to pay extra for them on PCs... then they became free downloads... then they were part of the OS... then they were configured automatically out of the box.

The point is, yes, things change. Industries are born, grow, age (hopefully gracefully) and then die. It's life. No matter if it's people, animals or software. And life goes on. Always has... always will.

Comcast Under Investigation by FCC – Yeah Baby!

Wednesday, January 9th, 2008

pirate.jpg

It couldn't happen to a nicer bunch of guys. From ArsTechnica today:

A study conducted last year by the Electronic Frontier Foundation and independently verified by the Associated Press revealed that Comcast interferes with BitTorrent and Gnutella sessions by sending TCP "reset" packets to users. Despite the growing body of unambiguous evidence, Comcast still denies allegations that it specifically targets BitTorrent. Comcast vice president David Cohen told us that the company's traffic control mechanisms conform to the FCC's definition of "reasonable network management" practices (which are allowed by the FCC), but critics don't agree that Comcast's management is anything "reasonable." The FCC today indicated that "reasonable" practices should be transparent.

I don't mind a company making a buck, but when they say they're selling access to the internet only to actually allow access only to those things they want you to have access to, then I think I should get a big discount - and disclaimer. Also, I should be able to opt-out and get access to everything.

Clearly, I'm not the only one who thinks so, and I'm glad that the FCC is going to get involved. The problem is, with so much having already been done, it's not an issue of if they are doing it, it's a question of what will be the outcome of the "investigation". Again, from Ars:

The FCC's investigation will have significant implications for the network neutrality debate. Proponents of network neutrality legislation believe that the FCC's current standards and the manner in which those standards are enforced is largely inadequate to deter Internet service providers from engaging in abusive network
manipulation.

Will there be net neutrality, or will the practice of filtering be given a green light? I'm hoping that we get the former. I'm worried we'll get the latter.

Comcast’s Promise of 160Mbps Speeds

Tuesday, January 8th, 2008

Comcast announced that they will be rolling out hardware enabling up to 160 Mbps over cable. Given my recent experiences with Comcast's port blocking/interception, it's hard to believe that they'll use this for anything more than a token speed bump to get it on par with FiOS from Verizon. As much as I'd like to believe it, I just don't believe this will mean I'll be able to get even 20 Mbps symmetric or even 20/5. It's just not in their business model to allow their customers to use the connection for what they want.

But for those wanting to download stuff from iTunes or updates to applications, I'm sure this is going to be a significant upgrade. Thankfully, Chicago is a major Comcast market, but if they are trying to go up against FiOS, they won't put the new hardware here first.

I guess the best news I can read from this is the fact that new infrastructure is coming to Comcast, and if regulation follows - or they ge their act together, it'll mean better connectivity for me. That's at least something to look forward to.