Archive for July, 2012

Apple Pulls Web Sharing (Apache) Control from OS X 10.8

Tuesday, July 31st, 2012

Mountain Lion

This morning I read an interesting fact about OS X 10.8 Mountain Lion - they removed the Web Sharing from System Preferences -> Sharing. Odd. I didn't use it a lot, but they also reset the config files for Apache, so it's something that I'm going to need to work on when I finally upgrade to 10.8.

Thankfully, the post talks about how to get all this functionality back and includes nice screen snapshots, so when I need to, I'll have a nice reference to walk me through anything I haven't seen before.

I know I need to get Apache, PHP, PostgreSQL all working together as my work on SyncKit requires it. So I'll have to factor that into the time for the upgrade.

Still planning on doing it, just not right today.

I Wonder if it’s Ruby Devs – Or is it just Not Finance?

Tuesday, July 31st, 2012

cubeLifeView.gif

I've had a couple of really good days at The Shop. It's a really neat environment, and while I can't say it's been without friction, it's all my fault, and what I'm used to from the world of Finance. I've learned a ton about ruby, rvm, rspec, all the tools used in what I think is a traditional ruby stack. It's fun, it's very different, but what's struck me the most has been the really solid skill set of the people I'm working with.

These are some really solid guys. Amazingly so, when compared to the finance world. Maybe it's too incestutious, I don't know. But the folks I was used to working with on a daily basis in the past are not nearly as skilled in the fine art of software development as these guys. Maybe it's ruby?

There's far more refactoring. Far more iteration. Far more devotion to the best answer - and they don't sacrifice too much speed in the process. I'll admit it's not nearly the same stress level as Finance, but it's still getting done, and the business is happy, so who am I to argue with the speed of development?

It's amazing. Really. I like these guys. I really do. That's a new feeling for me.

And it's a nice feeling to be sure.

I think I'm going to really like being out of Finance for a while. Who knows… maybe it's permanent. That would certainly be fine with me.

Google Chrome dev 22.0.1221.0 is Out

Tuesday, July 31st, 2012

Google Chrome

I just noticed that Google Chrome dev 22.0.1221.0 is out and save the inclusion of a new version of the V8 javascript engine (3.12.16.0), the release notes are a little skimpy to say the least. I mean, would it really kill them to put more than 2 mins into the release notes? Are SVN commit logs really sufficient for release notes?

I'd like to think not. But I'm not in their group, so it's not my call. Still… it makes you wonder what their attention to detail level really is...

Lovely Little Ruby Logger

Monday, July 30th, 2012

Ruby

This afternoon I wanted to create a log4j-like logger for the ruby app we're working on. I was hoping to find a gem that did it - singleton, thread-safe, the works. What I found was that the default logger: "logger" is really pretty close, and it's easy to make it what we need.

First, it's thread-safe. Doesn't say that in the docs, but the code has synchronize blocks on a mutex, and that appears to be working, so while I can't guarantee that it's implemented correctly, it appears that it is, and that's good enough for now.

Second, it's not a singleton, but that's easy to fix:

  require "singleton"
  require "logger"
  require "app_config"
 
  class AppLog
    include SIngleton
 
    def initialize()
      # get the location to log to and the level
      where = AppConfig.application.log_to || "stout"
      level = AppConfig.application.log_level || "WARN"
      # now make the logger for our singleton
      case
      when where == "stdout"
        self.log = Logger.new($stdout)
      when where == "stderr"
        self.log = Logger.new($stderr)
      else
        self.log = Logger.new(where)
      end
      # now set the log level
      case
        where level == "FATAL"
          self.log.level = Logger::FATAL
        where level == "ERROR"
          self.log.level = Logger::ERROR
        where level == "WARN"
          self.log.level = Logger::WARN
        where level == "INFO"
          self.log.level = Logger::INFO
        where level == "DEBUG"
          self.log.level = Logger::DEBUG
      end
    end
  end

This can then be placed in all our code and we get singleton-based logging for next to nothing. Very nice. At the same time, we can control the logging location and level very easily in the app config file.

I then took this and integrated it into the code I was working on for matching up the demand data with the merchants. It's something that we really need to do to productionize our app, and this is an important step.

Changing Git Author/Committer in the Repo

Monday, July 30th, 2012

gitLogo.gif

This morning I wanted to correct the CVS import problem that I didn't have the correct entries in the Authors file for the import, and so I wanted to update the converted repos to have my name and email. It's a little thing, but it's something that's been nagging at me for a while.

Anyway, the solution is pretty simple. Get into the directory of the git repo, and issue the once command:

  $ git filter-branch --env-filter 'GIT_AUTHOR_NAME="Bob Beaty"; \
      GIT_AUTHOR_EMAIL="drbob@themanfromspud.com"; \
      GIT_COMMITTER_NAME="Bob Beaty"; \
      GIT_COMMITTER_EMAIL="drbob@themanfromspud.com";' HEAD

and then I needed to do the following to push these changes to the server:

  $ git pull
  Merge made by the 'recursive' strategy.
  $ git pull
  Already up-to-date.
  $ git push
  Counting objects: 1591, done.
  Delta compression using up to 8 threads.
  Compressing objects: 100% (400/400), done.
  Writing objects: 100% (1490/1490), 614.05 KiB, done.
  Total 1490 (delta 1103), reused 1263 (delta 1089)
  To git@git.themanfromspud.com:CKit.git
     b5ffd5d..ef9724e  master -> master

Then it's all done. Nice and clean. Pretty slick!

[7/31] UPDATE: I noticed that the repos aren't universally fixed. In fact, there are still commits that have the old username. I did it again, and it's fixed - locally, but when I do the pull in preparation for the push, it "unfixed" several, and I can't figure out the reason. At this point, it's not an issue for me because most of the commits are right, and that's fine for me. Close enough.

Debugging Ruby in JRuby – Not Easy at All

Friday, July 27th, 2012

Ruby

I've been working with Jeff on some changes to the threading model of our app, and I have to hand it to Ruby/JRuby - the exposure of Java's Executors is really very nice:

  require 'java'
  java_import 'java.util.concurrent.Executors'
 
  executor = Executors.new_fixed_thread_pool(10)
  work.each do
    executor.execute do
      begin
        # do all my work here
      rescue => e
        puts e.backtrace.join("\n")
      end
    end
  end

and the beauty of the design is that we now have 10 threads for any number of tasks that need to be done in 'work', and the Executors will handle all the processing and thread management and all the stuff you'd once have to have done manually - it's now free.

This isn't new to Java, but it's really nice that it's sitting in JRuby for free. Very nice.

The problem is that when we get a Java stack trace, it's next to impossible to figure out what's going on. Face it, ruby is dynamic, so the Java classes that are created have a passing resemblance to the original ruby class, but they have been munged into what's needed by a non-dynamic language: Java. It's possible to get some idea, but it's not a lot, and today it's turned out to be not nearly enough to figure out what's happening.

Again, the best debugger is a sharp developer, and that's what we have to go with, but it's just too bad that the JRuby crew didn't foresee this and make something that can take the Java stack trace and turn it into what a ruby developer's stack trace might look like.

Now that would be neat.

Great JSON Beautifier as a BBEdit Text Filters

Friday, July 27th, 2012

BBEdit.jpg

This morning I was looking at some JSON output from a service and realized that my hand-cleaning of JSON was really not a good use of my time. So I googled JSON beautification BBEdit and found this:

  #!/usr/bin/python
  import fileinput
  import json
  if __name__ == "__main__":
    jsonStr = ''
    for a_line in fileinput.input():
      jsonStr = jsonStr + ' ' + a_line.strip()
    jsonObj = json.loads(jsonStr)
    print json.dumps(jsonObj, sort_keys=True, indent=2)

It's a little python script that I can put into ~/Library/Application Support/BBEdit/Text Filters/, call it PrettyJSON.py and then restart BBEdit and get a wonderful reformatter in Text -> Apply Text Filter -> PrettyJSON.

It's impressive. Fast too. I had a pretty big JSON file and it made it look nice and readable in under a second. Very impressive. This is certainly something to keep around.

Facebook and Zynga are in Real Trouble

Thursday, July 26th, 2012

Facebook

I'm not an analyst, but I know what I believe in, and what makes me nervous. Facebook has always been in the latter category, and it's all because of how it's making it money, and what face it presents to it's users. I guess it's also that I'm willing to bet that less than a few percent of the Facebook users really understand how they make money, and what they are doing with the user's personal information.

So today was interesting… Facebook announced earnings, and the result wasn't good:

NASDAQ:FB: 24.84 -2.00 (-7.47%) - Facebook Inc

and it's still falling… down %10 in after-hours trading. But that's not the worst.

No, it seems that Zynga has had it's own round of problems - this in the form of near scandal by the underwriters and massive dumping by the principals in Zynga:

NASDAQ:ZNGA: 3.08 -0.09 (-2.99%) - Zynga Inc

It's amazing that people don't think everyone on Wall Street are crooks. Look at what they are doing to literally millions of investor dollars! It's evaporated. Done. Poof. It's almost a crime.

But I know it's not. Not really. And that's why I can't stand folks like these.

Xcode 4.4 is Out

Wednesday, July 25th, 2012

xcode.jpg

Today along with OS X 10.8 and Safari 6, Apple released to the Mac App Store Xcode 4.4 and while I can't find any release notes for it, I'm guessing it's an uptick in the version of GCC and the LLVM compiler. With the coding I'm doing these days, it makes a big difference with 10.8 a reality, I need to get things up to date reasonably quickly. Glad to see that Apple is continually improving the tools as well as the end-user products.

OS X 10.8 Mountain Lion is Out – Safari 6 on Software Updates

Wednesday, July 25th, 2012

Software Update

Today OS X 10.8 Mountain Lion goes on sale for $19.99 in the Mac App Store, and while I'm certainly going to update - eventually - I'm not going to do it while I'm at work, nor on a work evening. I'm definitely going to wait for a weekend. However, we have updates in Software Updates for Safari 6 - and that's great news.

It's not often we get a major revision of Safari, and this should (hopefully) make a few things a little nicer, but we'll have to wait and see. It's certainly something I can update in the middle of the day comfortably.