I'm a computer guy. I've been programming since the early 80s, starting with BASIC on a Commodore Pet. I've worked on HPUX, BSD and various other *nix as well as Windows since 3.0. My new work provides Apple laptops, but I've never learned to use a Mac. How hard can it be?

Tuesday, April 1, 2014

Java Refresh and Photography

I admit that this is not particularly Mac related, but I've started playing with Java.  And, no, as a friend of mine asked, nothing to do with either Peet's or Starbucks.  Owing to the jobs I've had the last several years, I hadn't written a line of code in over 7 years, until today.  Maybe that's a slight exaggeration.  I may have done some programming in the first several months of the job I held from 2006-2013, but I don't think so.  If I did, then it has only been over 6 years.

Anyway, I decided today, while waiting for some processes to finish and, literally, having no other "work" to do, that it was time to start programming again.  One of the jobs I am considering taking may have some programming in Java, Javascript, Coffee, Pig, and or Python.  Of those, I've heard of 3 and used 2, one of them (Java) extensively.  I hadn't even heard of Coffee or Pig before.

I am also a photographer.  I call myself semi-pro - I'm fairly good, and I have gotten to the point of having decent equipment, but I don't do a lot with the many many pictures I take, I've almost no skill with in depth photo editing, and I don't shoot RAW.  See?  Semi-pro.

I also like to organize my pictures a certain way.  My friends who know me will not be shocked.  At this point, organizing them the way I want takes a fair amount of work, because I like to put all the pictures from a single month in a single directory, and then rename them all so the name is in the format yyyy-mm-dd-###.(extension).  Of course, it's slightly more complicated than that, because there are times when I don't put pictures from a given month in the same directory... for example, if I have a significant event (or more than one) where I take lots of pictures in a single month, I'll usually create a sub-directory in the month directory for each event.

OR, if the large group of pictures crosses from one month to another, such as when I'm on a trip that starts in May and ends in June (as often happens when I take my daughter to Yosemite), I'll usually put that in a separate directory entirely, that is in the YEAR directory along with the month directories.  Didn't mention the year directories before, did I?

Unfortunately, the renaming requires that I use an old Microsoft photo editing tool that will only do one day at a time - otherwise, the numbers don't restart at 1 each day.  The Microsoft tool isn't that bad.  It will organize all the pictures by date for me, and then I can sort them by time and batch rename them, but I do have to do each date, and if I change my mind about the exact format, I have to start over, which is a pain in the neck.

On top of that, it doesn't seem to take use the time to the millisecond.  This is important if I've taken a bunch of pictures in a short time, as when I do panoramas, rapid-fire action shots, or HDR.  I want the pictures to be named in the right order, but that won't necessarily happen if the exact time isn't used.

I have looked for other tools, and there are some batch renamers out there, but I haven't found one that does quite what I want, either with respect to naming pictures across multiple directories or using a close enough time.

Soooo... I have long wanted to write my own batch renaming program, which I've started on today.  So far, I'm up to remembering how to create a Java file with code, import packages (and set the classpath), compile (also that compilation is necessary), and run.  I learned how to list all the files in a specific directory and how to get certain attributes such as the create time.

As it turns out, at least with the Canon 7D I shoot with today, the creation time doesn't have milliseconds.  Fine.  Time to dig deeper and find out how to read other attributes beyond the standard OS data.  Hey, look!  The Google tells me that there's a package for that, by... Google: the metadata extractor.  It's pretty cool.  It'll handle numerous different kinds of photo files and by a variety of different cameras.

After a bit of digging, I was able to determine that the majority of the tags don't change from photo to photo, particularly if you're taking a slew of them in rapid succession when things like zoom, aperture, ISO, and shutter speed don't tend to change.  Those are, after all, the main things that you change when you take pictures with a single camera, besides the time.

Then I was able to determine that there is a tag in the standard Exif library that is the sub-second time record.  This is actually JUST the milliseconds (or maybe hundredths of seconds, since I've only see two digits so far).  One thing I was stuck on for a while was that the milliseconds, which I'll continue to call them for convenience, would sometimes drop within a single second of creation time even though the original file name didn't change.

So then I used the handy dandy exif library to get the original time from the exif rather than the file system's creation time.  That got me a table like the following:

file 82: IMG_8108.JPG  2014-02-16T20:46:10Z Sun Feb 16 12:46:09 PST 2014 11
file 83: IMG_8109.JPG  2014-02-16T20:46:10Z Sun Feb 16 12:46:09 PST 2014 24
file 84: IMG_8110.JPG  2014-02-16T20:46:10Z Sun Feb 16 12:46:09 PST 2014 37
file 85: IMG_8111.JPG  2014-02-16T20:46:10Z Sun Feb 16 12:46:09 PST 2014 50
file 86: IMG_8112.JPG  2014-02-16T20:46:10Z Sun Feb 16 12:46:09 PST 2014 62
file 87: IMG_8113.JPG  2014-02-16T20:46:10Z Sun Feb 16 12:46:09 PST 2014 75
file 88: IMG_8114.JPG  2014-02-16T20:46:10Z Sun Feb 16 12:46:09 PST 2014 88
file 89: IMG_8115.JPG  2014-02-16T20:46:10Z Sun Feb 16 12:46:10 PST 2014 1
file 90: IMG_8116.JPG  2014-02-16T20:46:10Z Sun Feb 16 12:46:10 PST 2014 13

I know it's a little hard to read, but if you look closely, you'll see that these are the 82nd through 90th files in the directory I'm testing with (and yes, these are all copied from my master photo directories), they were all taken at 20:46:10 UTC (formerly known as Zulu time, thus the Z), which translates into 12:46:10 PST.  The last 1 or 2 digit number is the aforementioned sub-second time, and you can see that the last 2 are lower than the one before them, which throws the order all out of whack if I use it, because the file names are presently in the right order (I checked the images themselves to be sure, and of course they are).

BUT WAIT!  The first 7 pictures were taken at 12:46:09 PST!  That time, the 2nd one in PST and a longer format, is the actual "original datetime" from inside the file, as written by the camera!  Hallelujah!  Now I know, at least with the Canon 7D, that I can sort these things correctly.

At this point, I think the next task is to change the program so that it can start at the top of (a copy of) my master photo storage and go through all of them, recording the make of camera, file name, original date time, and sub-second time, along with indications where those are not available - I know they're not in some cases, so I'll have to figure out why...


Wednesday, October 9, 2013

Grey Screen of Death

After talking to a couple of my coworkers, I have concluded that the restarting problems I was having are probably related to the RAM upgrade I had put in a few days before it all started.  Interestingly, the first time we brought it up after putting in the RAM, it died almost immediately.  We have ordered another set of RAM and I've been shutting down and restarting the computer every few days.  I also reinstalled the FitBit software with no problems.  Once I get the new RAM in there, I'll stop restarting it, which I'm really looking forward to.

Friday, September 27, 2013

Blue Screen of Death

OK, so it isn't blue, it's grey.  And it doesn't come up when the machine dies abruptly, it comes up after it restarts.  But it's the same thing.  I would have sworn one of the common reasons people give for why you should use a Mac instead of Windows is that "it never crashes, you don't have to restart, " etc.  Well, I have news for you.  Mine has crashed 4 times in the last 48 hours.

I checked with our IT guy about it, and he said that it's a good idea to shutdown the Mac every week or so, or restart it, without having it reopen the active windows.  I guess I'm fixating, but I have been really enjoying NOT shutting it down.  I just close it or, if it's on the stand at my desk, unplug the monitor and power and go.  It always wakes up so nice and fast.

I do note that I have had the FitBit dongle plugged into the machine probably since Sunday night or Monday, so I suppose I'll have to take it out and see whether the crashing stops.  In fact, there's a quick result on Google, albeit a year or more old, that suggests FitBit doesn't play well with Macs.  I'll have to go back to syncing the FitBit at home, which means not as often.  Not a big deal, since I already can't have it sync any old time by connecting it to my phone (which doesn't support BTLE).

But really... Macs aren't supposed to crash, and you're not supposed to have to restart them at regular intervals.

The other thing that comes to mind just now is that at work I put it on one a stand.  I normally have it closed.  This is fine when it is sleeping, because it will wake up for my wireless keyboard or Magic Trackpad.  If it is OFF, however, it will not and I actually have to open it to turn it on.  I wonder if there's a way to have it turn on when I plug it in to power, even if it is off and closed?  I'll have to look into that.

Thursday, September 19, 2013

What's in a Name?

Every so often, my MacBook tells me that it's name is being used by another computer.  This is because the computer was named Company MacBook Pro, which clearly some other people's computers are as well.  Possibly including my new boss, who certainly got a new computer that was set up roughly the same was as mine.

It probably doesn't really matter, but I don't like it when it tells me it is going to use a different name than it was before.  After all, we use Salesforce and Google Apps, so it is undoubtedly going to be rare that we actually need to share things directly from our computers.

I hunted around the System Preferences, looking for a place to make that change.  Network.  Security/Privacy. General.  Users & Groups.  Startup Disk.  Nothing.

Then I started looking through the Finder.  I did find a way to open the containing folder for a folder, but couldn't figure out how to get to a place where I could see the computer name as part of a list.  I thought if I could I would be able to click it and there might be a rename option.

So, I asked The Google.  Unsurprisingly, the first link, in Wikihow, gave sufficient detail.  I had overlooked one likely System Preference option:  Sharing.

Thursday, September 12, 2013

The Magic Devices

I have learned recently that Apple has two magic devices, the Magic Mouse and the Magic Trackpad.  I have learned at least some gestures on the trackpad on the laptop, but now that I have a desk, I got a wireless keyboard and a wireless mouse, the Magic Mouse.

The Magic Mouse may support all the same gestures as the Magic Trackpad, but it is vastly inferior.  For one thing, it doesn't stay in the same place; this is my primary complaint with mice, and the reason that I've pretty much always used trackballs.  It also isn't anywhere near as easy to do some of the gestures on the smaller, curved surface - try doing a two- or three-finger swipe toward the pinkie finger.  The mouse is going to move, the trackpad isn't, at least not when on a computer and probably not the wireless unit.

In fact, as I type this, our office manager has handed me the trackpad, which I have configured (with the mouse) and I can definitely confirm that the two- and three-fingered gestures do not move the trackpad.  I don't think the mouse supports the four fingered gestures, but I never tried and now that I've removed the mouse (with the mouse) and given it back, I'm not going to.

As a typist, I tend to want to stay on the keyboard, which is why I installed Dashkards as soon as I discovered it.  I generally prefer not to go to the mouse or trackball or trackpad, but the Magic Trackpad is pretty damn cool.

Update, 9/19: I like the trackpad pretty well.  It still shares a certain disadvantage with mice and other touch pads that track balls don't have:  if I'm dragging too far, I can wind up getting to the edge of the pad.  Not a huge problem, and I'm sure I could play with the sensitivity, but I do find trackballs to be easier in that respect.  I don't think I'd give up the gestures at this point, though.

Wifi Networks and Default Applications

Resolved two issues today.  The first was that because my laptop was used by someone else before it was given to me, it had a lot of wifi networks in it.  I knew they were there, and many of them I'll probably not get anywhere near, but I don't want it jumping on the AT&T wifi network (for which I no longer have free access) without my telling it to.  I do, however, want it to get on networks I set up, and I couldn't figure out how to delete the networks I don't want it to use.  Part of me also just didn't want wifi networks I don't know and will never use in there...

I've looked at the Network console in System Preferences more than once.  If you open it and click on wifi and then on Advanced, you'll see a list of all of the networks that have been saved so far.  What I didn't notice was that there are a pair of buttons right below the list, one a plus sign, the other a minus sign.  Highlight one of the networks and click the minus sign, and it will delete the selected network.  Just be careful to select the one you want (although it does ask for confirmation).  I find this pair of buttons a little odd - there are other options for adding a network manually, including one that says 'Join Other Network...', so why isn't there a more obvious 'Delete Network' button?  I suppose I might have noticed it a little more quickly if I were more used to Mac.  Thanks to Joel, our IT guy, for that one.

The other issue I came across was that my PDFs were opening in Previewer.  Previewer is pretty cool, but it doesn't do a great job with PDFs if you need to zoom them (or PowerPoints with animations).  I found that if I user the Open With option on a PDF it would let me tell it to use Adobe Acrobat all the time, but that didn't seem to work even though I did it more than once.  At some point, I figured out that this change actually only applies to the file you selected, not to all files of that type.

So, since I really do want my PDFs to open in Acrobat, I did the highly specific search in Google for "default applications mac".  That is to say, I typed "default appli" and Google offered, among other things, "default applications mac", so I picked it.  The first option that came up was from MacWorld, and explains exactly how to do it...

Thursday, September 5, 2013

Dashkards and the Dashboard

I read some stuff the other day about the dashboard.  I had been trying to get it to be useful with the widgets it came with, and having trouble - mainly because I didn't notice the little information/settings icon when hovering over the widgets.  Not being able to change the ESPN widget away from Hockey wasn't very interesting, so I was glad to find that.  Of course, I don't really need to have ESPN on the dashboard.  I have other ways of finding sports scores that give me the information I'm actually interested in.

That did lead me to a couple of interesting web pages.  The first was from Lifehacker, about making dashboards useful.  It was an interesting article, and I appreciated the different suggestions they made, especially the point that there's a settings icon when you hover over the widget.  More interesting, though, was the link to the Dashkards site.  Dashkards is a widget for the dashboard that lists keyboard shortcuts for lots of different functions in lots of different apps.  It includes the OS (Lion only) as well as gestures.  You can turn off the apps you don't use so they don't show up in the list.

Now when I hit a key combination and it does something strange (like hide the app I'm working in and go back to the desktop), I can hit Fn-F12 to jump to the dashboards and see the keyboard shortcuts for Mac OS X.  Or I can switch to the Chrome dashkard to find out, since Cmd-D created a bookmark instead of putting me in the address bar the way it did in Windows, how to jump to the address bar (Cmd-L).

Some of the other suggestions from the Lifehacker page...

  • monitor system usage - I don't really need this yet... I have noticed that this machine is a bit slow about some things, but I'm also not pushing it enough to worry about usage
  • delivery status, scores, etc - I am anything like the author in that once I know something is en route, I tend to check status on it (far more) frequently (than is useful).  I mentioned not caring about sports scores, but perhaps at some point I'll take a look at some of the widgets for these sorts of things
  • sticky notes - I use evernote already, so I'm not going to start keeping notes on dashboard
  • streaming music - this might be cool, though I don't stream all that often; I'm not sure having it running on the desktop or as a hidden app will really matter, but perhaps if there's a widget for Pandora and/or my favorite radio stations that will be useful...

I am curious about other dashboard widgets that might be useful, but there are thousands of them and I haven't felt like trying to sift through them to find whether any are interesting.  One thing I'm concerned about is that there isn't a lot of room on the dashboard and moving widgets around is a bit of a pain if you can't just have them all visible.  Perhaps I'll play with this more at some point.