I occasionally run into weird permission problems after a restore of files and folders on my machine, I think it has to do with OSX trying to protect me from myself.

Today I needed to fire up my coding environment on my Mac Mini, so I jumped into the folder for the code that I wanted to update using SourceTree, and did (what I thought was going to be) a quick pull, only to get a weird error message.

I figured it was probably something goofy, so I went to the command line, only to get another weird error:

Well, I’ve seen that before, and knew that message was probably because I’ve updated the OS a few times since I last coded. Basically it means the XCode command line tools are missing. Fixing that is easy: just run:

This fires up the Xcode installer, which will ask you if you want to install Xcode, or just the command line tools. In this case I don’t need Xcode, so I chose the latter.

That took a pretty long time (it was on “about a minute left” for at least 10 minutes), which was a bit worrisome, but not all that unusual.

Going back to the command line, I tried to do my “git pull” only to get another error:

OK, weird – why can’t it write that. Found a few things online that suggested running “git gc” might fix it, so I tried that, but that just gave me this error:

More curious Googling, and finding the suggestion to look at the extended file permissions, so I tried that:

Wait, what’s this “group:everyone deny delete” ? Well, no wonder I can’t run stuff that updates these folders. More Googling and I find the right switch for chmod to clear out the extended permissions:

Note that I had the two flags reversed the first time and the command told me it couldn’t find a file named “-R”. After running the above, the folder permissions looked more normal:

And my commands worked as expected.

Sometimes I get my branch in a state where I need to reset things to what is on the server. Most of the time a simple switch of branches is enough to get everything back in shape, but once in a while I need to actually reset to what is in the parent repo.

To reset your local working copy to exactly what is in the remote (typically called origin) do the following:

These should be done in the root of your project.

Sometimes I find myself working backwards up a tree of errors to fix a problem. Today was a case in point.

Since I’ve been doing a bit of WordPress grooming, I have the development build checked out locally. Previously I had run phpunit against the unit tests included in the code, but for some reason when I tried to run things under NetBeans, it would error out (Bug 247704).

Continue reading

Screen Shot 2013-06-08 at 10.35.06 AMIf you read my previous post (WordPress Recovery), you know I’ve been writing some code to recover my old posts. It occurred to me I could take a small segment of what I’ve been doing with that code to demonstrate my approach to TDD.

Since I’m a hacker from way back, and also because I was in semi-panic mode about losing the content, I didn’t approach this task with testing in mind. Now that doesn’t always result in bad code: I’ve been doing this long enough that I can usually think through a fairly good model and code something that isn’t one long method full of inline code.

In this case however, once I had started coding, I realized again that this was an opportunity to practice coding the “right” way. I had already begun with a Maven project, and generated unit tests as I went through the process of starting to build the code, so I had at least some good functioning unit tests.

Continue reading

Homer Simpson
Homer Simpson (Photo credit: Wikipedia)

I just shot my blog in the foot, or more accurately, I didn’t follow IT 101 and back things up before making a change.

I had moved my site to be completely WordPress based a while ago, and as a result I had a bit of a convoluted setup on my server.

When I first set up my WordPress blog it was as a sub-domain of accuweaver.com, and was housed at http://wordpress.accuweaver.com/ (also aliased to http://blog.accuweaver.com/). The http://www.accuweaver.com/ site just static pages that hadn’t changed for years.

So when I finally got my blog set up to host the few static pages I had, I just changed the directory on my server to have a symbolic link to the directory where wordpress.accuweaver.com had it’s content:

  1. Removed the directory httpdocs from /var/www/vhosts/accuweaver.com
  2. Added a link in that folder to /var/www/vhosts/accuweaver.com/subdomains/wordpress/httpdocs.

This actually worked really well, since the content was only in one place, and all I had to do was change the host name in WordPress. Continue reading

I decided I’d walk through creating a new app to replace one I’ve used for years on my iPhone that no longer appears to be maintained. The app in question is called GasBag which as near as I can tell stopped being updated in 2009 (see: http://blog.jam-code.com/).

 

I could just write a quick and dirty web app to store my mileage, but I figured I’d approach this as an exercise in building an iOS application with a design first approach.

 

At a high level, what I want is an app that easily captures my mileage, and allows me to save that information somewhere that won’t get destroyed. There are a number of features that GasBag had that I liked (for instance being able to send an email with my mileage information), and a number that it doesn’t have that would be nice (like allowing me to use it for multiple cars, or to do some data capture from a gas station receipt).

 

Continue reading

Screen Shot 2013-02-25 at 9.16.20 AMI volunteer and provide technical support for a few non-profits, one of which is the Project Management Institute San Francisco Bay Area Chapter (http://www.pmi-sfbac.org) where I serve as the VP of Operations and CGO.

One of the moves I made in my first year with them was to migrate our event calendar to Eventbrite and Meetup. One of the gaps I found with Eventbrite is that it doesn’t have a way to provide a feed of events that can be used to update an external calendar, so I embarked on a little programming effort to create one.

Most calendar programs allow you to pull external events using the iCalendar (ics) format, and Eventbrite actually has a pretty decent API to allow you to pull the events, so I decided to write a simple PHP script to allow me generate an iCalendar feed.

Screen Shot 2013-02-25 at 8.47.53 AMThis started as a simple one-off for PMI-SFBAC, but has turned into an open source project at https://code.google.com/p/eventbrite-ics/

Looking at the code, you can see it’s pretty basic, just a few PHP classes, some unit tests, Netbeans project and data.

Once the code was working, I used the iCalendar validator at http://severinghaus.org/projects/icv/ to make sure the results are good, and (at least for PMI-SFBAC) they are.

Eventually this results in a URL that I used as a feed into the All-in-One Calendar from Time.ly which lets me show events on my site’s calendar along with any other iCalendar feeds I choose to add.

Screen Shot 2013-02-25 at 8.59.20 AMTo configure the All-in-One calendar, I just go to the Events in the WordPress admin panel, and add the feed.

After I add the feed I click the “Refresh” button to make sure the events show up on my calendar immediately. The events then get updated on a periodic basis (daily by default), and should keep you up to date.

Screen Shot 2013-02-25 at 9.06.58 AMAnother use I put this feed to is to add the Eventbrite calendar to my Google Calendar.  I have a calendar feed from Meetup, and several of my friends so that I can quickly see what is going on that day.

The same basic idea for Google Calendar: you go to your Google Calendar, click the drop down on “Other Calendars” and choose “Add by URL”.

This gives you a nice view of events so that when you are scheduling things you can see what’s coming up that you might be interested in.

For those of you poor souls still using Outlook, the same feed can be used there as well see: http://office.microsoft.com/en-us/outlook-help/view-and-subscribe-to-internet-calendars-HA010167325.aspx

 

 

Enhanced by Zemanta