On walkabout in life and technology

CD to Current Finder Path

To open a new terminal in the current Finder path in OS X, you can use the built-in service (See below on how to enable). But if you are already in a Terminal session, you need to leave the keyboard, mouse to Finder and drag and drop the path back. Here’s a trick that gets you to the frontmost Finder path without leaving the Terminal or keyboard.

Add the following to your .bash_profile:

## Get the frontmost finder path
fp () {
  osascript << EOT

  tell application "Finder"
      if (${1-1} <= (count Finder windows)) then
          get POSIX path of (target of window ${1-1} as alias)
          get POSIX path of (desktop as alias)
      end if
  end tell


## alias to cd to the frontmost finder path
alias cdf='cd "`fp`"'
## alias to copy it to the clipboard
alias cfp='fp | pbcopy'

In a new Terminal (or reload the current), you now have the following commands available:

  • cdf which will cd you to the frontmost finder path
  • cfp which will copy the frontmost finder path onto the pasteboard

I usually leave my current working folder visible in Finder so I can see the files available while working in Terminal. To get back to that folder, a quick cdf and I’m there.

OR: Enable the Service

To open a new terminal window at the current Finder path from Finder, you need the New Terminal at Folder service enabled. Make sure it’s checked in System Preferences / Keyboard / Keyboard Shortcuts / Services under Files and Folders.

Once enabled, you can right click on any folder in Finder, choose Services / New Terminal at Folder to open a new Terminal at that location.

Follow the author as @hiltmon on Twitter or @hiltmon on App.Net.

How to Flexify a Class

OK, so you managed months ago to stop yourself from Premature Flexification when creating a class (or someone else did), but now the time has come to add features or flexify the existing feature set of the class.

There are many wrong ways to do this, and I have seen all of them in practice:

  • Duplicate the existing class, rename it and add the flexibility to the new class. This sounds great as existing code remains unaffected, but sucks if a bug is found in the original and both need to be maintained.
  • Wrap the existing class in a new class (or sub-class it), passing through the original methods, and adding new methods for the flexible class. Replace all calls to the original with the new wrapper or sub- class (or not!). This time, it seems that the maintenance problem above is dealt with, but the code base becomes crufty, and the workarounds in the wrapper start to break.
  • Create a new class that has nothing to do with the original and write a new implementation. Great, now you have two problems.
  • Extract the class implementation code into a new implementation sub-class, and default the original to use the extracted implementation class. Then create a new implementation class for the new flexibility version and add a method to the original class to enable you to change the implementation. This is why the suicide rate for Java programmers is so high.

Why do people do this? For a lot of not very good reasons. Some do it because they do not own the code, as in they did not write it or do not have permission to modify it. Some do it because they have no idea where the code is being used and are afraid to break something else somewhere else. Some do it because they think they can write a better class. And some do it because it is easy to be lazy and copy and paste code. And some do it because they just don’t have the time to do it right. And some just don’t care.

Excuses, excuses, excuses.

This is the path to the dark side of programming. In flexing classes incorrectly, the programmer is creating a maintenance nightmare, a more rigid and fragile product, and more cruft. It’s not worth it.

There is only one right way to do this:

  • Document where the class is used
  • Wrap the class in a test suite
  • Make the necessary modifications
  • Use the test suite to prove that all existing uses of the class will remain unaffected.

That’s right, use test driven development and good old refactoring techniques to do it right.

Finding where a class is used is not as hard as it seems. Just do a search through the code-base to find the class name. IDE’s and programmers editors have it built in. Or use a shell command like:

 find -type f -name "*" | xargs grep ‘<classname>’

If the class already has a test suite, check to make sure that all methods are tested for both success and failure conditions, and that the tests run and run correctly. If the test suite does not exist, take the time to write one. You’d be surprised how quickly you can do this after creating your first few. Test each method with a bunch of expected valid values, and a bunch of invalid values. Do a quick scan of existing uses to determine any edge cases. Then run the suite.

Now refactor the class, add the new features or add the flexibility. As you go along, keep running the test suite making sure the original tests continue to pass. Oh, and while you are at it, add tests for the new flexibility and features.

When the new flexibility has been added and you have a passing test suite, you can be sure that existing code will run with the new flexible class. The best parts of doing it right are that the existing code can now take advantage of the new class features, maintenance and cruft are minimized and you have the tools in place to come back and add more flexibility later.

But you are not done yet. Invariably adding flexibility adds dependencies, either meta-data files or artwork. Document the dependencies, so that future users of the class can find them quickly. Then walk through all uses of the pre-flexed class and ensure the dependencies are added and compile properly.

If you flex your classes properly, your code-base remains maintainable, your product does not become fragile and it becomes easier and easier to add features and flexibility in the future.

Follow the author as @hiltmon on Twitter or @hiltmon on App.Net.

Premature Flexification

I was sitting down to design an iOS widget to display an analogue clock face for an upcoming app. I wanted to make sure, as we all do, that the widget will work for all scenarios needed by the app. The app needs to display the time in different time zones, given a reference time in a reference timezone.

✓ User defined background image and hand images

STOP! You Aren’t Gonna Need It. It’s my widget for my app, it’s OK to hardcode the image assets.

✓ Draw hour hand
✓ Draw minute hand
✓ Draw second hand

STOP! You Aren’t Gonna Need It. The clock face will display a fixed time up to the minute. No need for a second hand then.

✓ Timezone and DST support
✓ Timer to update the face

STOP! You Aren’t Gonna Need It. The application needs to display a clock face for a time in the past or future which does not change, no need to be live.

✓ Scaling to fit variable view sizes

STOP! You Aren’t Gonna Need It. The application will display the clock in 2 sizes, large and small. No need for complex scaling code.

✓ Hand wobble as hands move to new locations (that little vibration that is caused by the flexibility in the hand when it comes to rest)

STOP! You Aren’t Gonna Need It. I can animate the hour and minute hand using rotation code (which will already be used to align the hands) to get them into position, no need to add a skeuomorphic wobble when the hand comes to rest.

I wrote this to remind myself not to prematurely flexify classes. YAGNI FTW!

Follow up: How to Flexify a Class tells you what to do when the day comes that you do need to add features or flexibility to a class.

Follow the author as @hiltmon on Twitter or @hiltmon on App.Net.

Depersonalize Because You Can’t Quit

My Twitter stream today is full of people quitting Instagram because of the new Terms of Service, see You’re the Advertisement. Six months ago, it was Twitter, and six months before that it was Facebook. Quitting over privacy.

Except they didn’t quit. They are all still on Twitter and Facebook and will remain on Instagram, because we, their friends are still there and the service remains awesomely useful.

If you are worried about privacy, but wish to remain on these services, just depersonalize. Turn off locations, use a login and display name that is not yours (but your friends will recognize and accept), remove or fake the remainder of your data, and never post photos of yourself, friends and family. Let these services use your depersonalized data however they want, because it’s not you. A falsely advertised recommendation from “xyzzy68000” means nothing compared to a real recommendation from “hiltmon”.

Follow the author as @hiltmon on Twitter or @hiltmon on App.Net.

You’re the Advertisement

It used to be said that:

If you pay for a product, you’re a customer. If you don’t, you’re the product.

Now its getting worse. The new Instagram Terms of Use make you the advertisement for any unknown third party product. Anyone can pay Instagram to use your user name, your image, and your photos to advertise their product to anyone else, without your knowledge or consent.

2. Some or all of the Service may be supported by advertising revenue. To help us deliver interesting paid or sponsored content or promotions, you agree that a business or other entity may pay us to display your username, likeness, photos (along with any associated metadata), and/or actions you take, in connection with paid or sponsored content or promotions, without any compensation to you. If you are under the age of eighteen (18), or under any other applicable age of majority, you represent that at least one of your parents or legal guardians has also agreed to this provision (and the use of your name, likeness, username, and/or photos (along with any associated metadata)) on your behalf.

It seems there is no way to prevent this.

Facebook recently did the same thing, just more sneakily. They state you can use your privacy settings to opt out of having your name and profile picture used in anyone else’s advertisement, but default the setting to opted in, of course. Go to your privacy settings on Facebook to disable.

1. You can use your privacy settings to limit how your name and profile picture may be associated with commercial, sponsored, or related content (such as a brand you like) served or enhanced by us. You give us permission to use your name and profile picture in connection with that content, subject to the limits you place.

Personally, I prefer to endorse products I like on my blog. I do not want nor permit Facebook or Instagram to use my name, likeness or any of my images to promote, endorse, advertise or sell products without my express permission (and I should get paid for it too).

I understand these companies need to find ways to make money. Abusing their user’s reputations is the wrong way to go.


Twitter too:

You agree that this license includes the right for Twitter to provide, promote, and improve the Services and to make Content submitted to or through the Services available to other companies, organizations or individuals who partner with Twitter for the syndication, broadcast, distribution or publication of such Content on other media and services, subject to our terms and conditions for such Content use.

Such additional uses by Twitter, or other companies, organizations or individuals who partner with Twitter, may be made with no compensation paid to you with respect to the Content that you submit, post, transmit or otherwise make available through the Services.

And Path:

Our Service may change from time to time and/or we may stop (permanently or temporarily) providing the Service (or features within the Service), possibly without prior notice to you. Our Service may, at some point, include advertisements, which may be targeted to the content or information on the Service, queries made through the Service, or from other information. The types and extent of advertising on the Service are also subject to change over time. In consideration for providing you the Service, you agree that we and our third party providers and partners may place advertising on our Service or in connection with the display of content or information on our Service.

Follow the author as @hiltmon on Twitter or @hiltmon on App.Net.

Gun Control Does Work

Personal note: I have lived in the USA for 9 years now, and think this place is magnificent. Two days ago, in Newtown CT, 20 children and 6 adults were massacred. The dark side of America that is in denial about gun violence, that refuses to even discuss gun control, that treats massacres as a normal and regular part of life, a country that gives up its civil rights over a single terrorist act, but takes no action on a score of massacres of its children, well, that just scares the shit out of me. Whether you are religious or not, parent or not, patriotic or not, surely we can all agree that we can and should do everything in our power to prevent this kind of horror. It can be done, it has been done elsewhere, lets make it happen here.

We did it in my home country, Australia, and it has worked well. I live in New York, I wish for it to work here in the USA too.

Key points

  • A radical gun law reform occurred in Australia after a gun massacre (35 dead and 18 seriously injured) in April 1996. Semi-automatic and pump-action shotguns and rifles were banned; a tax-funded firearm buyback and amnesties saw over 700 000 guns surrendered from an adult population of about 12 million.

  • The total firearm deaths, firearm homicides and firearm suicides had been falling in the 18 years preceding the new gun laws. In all, 13 mass shootings were noticed in the 18 years preceding the new gun laws.

  • In the 10.5 years after the gun law reforms, there have been no mass shootings, but accelerated declines in annual total gun deaths and firearm suicides and a non-significant accelerated decline in firearm homicides. No substitution effects occurred for suicides or homicides.

We also have universal healthcare, which means that the mentally disturbed get the best help. And of course, those with mental illness have no access to legal weaponry.

We don’t have or need a second amendment type law, or anything similar. We deal with problematic governments the true democratic way, with votes, even going so far as to make voting mandatory. And we have the political nuclear-button option, a Governor General who can dismiss the government at any time by the will of the people. This has happened once already.

As such, Australia is a model of what could be in the USA. We still have access to handguns and hunting rifles, but the combination of great mental healthcare and strict gun control make it one of the safest places in the world to live and raise your children.

For more, read the full detailed report: Australia’s 1996 gun law reforms: faster falls in firearm deaths, firearm suicides, and a decade without mass shootings.

De Fault With Default

The word default has many meanings:

  • To a geek means the value set for a preference by the developer, as in “the default value for the web server port is 80”.
  • To a finance person means the failure to fulfill an obligation, like pay off a security, as in “the company’s corporate bond is in default”.
  • To a sports person means the failure of a team to arrive in time to participate in a sports match, thereby losing the match, as in “Qatar lose the soccer game by default to Uzbekistan”.
  • To a lawyer means the failure to appear in court, as in “an order for default as entered in case XYZZY”.
  • And to everyone else means “De Fault”, as in “the replacement ref’s incompetence is de fault of the league.”

Just a quick reminder to ensure you use the right terms in the right context for the right audience.

Follow the author as @hiltmon on Twitter or @hiltmon on App.Net.

On Customer and Developer Entitlements

en·ti·tle·ment /enˈtītlmənt/ Noun
The fact of having a right to something, or the amount to which a person has a right.

There has been a huge amount written this year about software pricing, availability and support, especially in light of the “race to the bottom” pricing and lack of trials and upgrade pricing in the Apple App Stores. Developers feel they are entitled to more money and respect for the effort they put in, customers feel entitled to free upgrades, multiple platforms and cheaper prices. Yet the discussion has quickly gotten off topic in the incessant white noise of name calling and the use of words like “greedy”, “double-dipping”, “unfair” and “angry”.

It’s time to clear the air, and present the true software entitlements for both sides, developers and customers. And maybe next time you see someone complaining about price or lack of platform support, send them here.

Customer Entitlements

The customer is the person who purchases and uses the software. These are their post-purchase entitlements:

  • The customer is entitled to get software that works as advertised. Forget “let the buyer beware”, if the software blurb declares that the software provides certain features, then the customer is entitled to get them on purchase. Not only should the software contain the features advertised, these features should also work as advertised, produce correct and expected results and not fail or crash. On the flip side, the customer is not entitled to undocumented features, the “I just assumed it would also have” or “missing” features. And clearly the developer is not entitled to change the blurb after release to hide or mislead what was sold.
  • The customer is entitled to get software that runs on the documented platform. The application should run on the version(s) of the platform(s) included in the blurb. It is not expected to run on any other versions of that platform, or on any other platforms, nor is the customer entitled to have it do so. As such:
    • The customer is not entitled to run the software on more than one platform, unless that is explicitly stated. For example, to run OmniFocus on my iPad and my Mac, or to run Excel on my Mac and on Windows, both require two separate purchases.
    • The customer should not expect the software to run on future versions of the documented platform. Most developers and operating systems vendors do provide backwards compatibility for a few versions of platforms (enabling older software to run longer). But then things get deprecated. Since the developer has no idea what is going to change in the next iteration of the platform, they cannot guarantee or even promise that the software will function on it. The customer is not entitled to a free upgrade to make a product work on the next version of the platform. It is just fortunate for customers that most developers do issue free patch updates for this.
  • The customer is entitled to know, up front, the total cost of the software. If the software requires additional purchases to function (external or in-app), or access to additional third party services, or is advertisement supported, or is subscription priced, it should be known before the customer purchases it. That way, the customer knows what they are getting in to and who they will be dealing with. If the product has multiple levels (a standard and a pro perhaps), the customer is entitled to know the limits and features of each at each price point. I further believe that a customer is entitled to an advertisement and nag free environment if they paid for the application.
  • The customer is entitled to support. The customer is entitled to get after-sales services to solve software installation and usability problems, for as long as the software is in the support window (and the customer is entitled to a generously long support window). This means access to help and support documentation, access to a support line or email address and a quick response to any and all support requests.
  • The customer is entitled to bug fix updates for supported software. With complexity comes cases where the software fails, we call these bugs. The customer is entitled to bug-free software, but since this is practically impossible, the customer is entitled to having the known bugs fixed and these patches deployed to their systems for currently supported software. If the software is old and out of support, this entitlement goes away.
  • The customer is entitled to a refund soon after purchase. As with all other purchases, the customer is entitled to a refund if the software does not work for them. However the customer is not entitled to use the software after being refunded, or to request a refund after using the software for a significant amount of time. I personally think a 15 to 30 day refund period is acceptable.
  • The customer is entitled to software that contains no malware, spyware or viruses. This seems an obvious entitlement, customer’s systems security should not violated by the software purchased. If the software does introduce third-party packages that may do other things (like that browser toolbar spyware or packages that crack open operating systems), this should be known up-front. Further, if the software shares any information with third-parties other than the developer, this too should be known upfront.
  • The customer is entitled to continue to use the software even when the product is terminated. If the customer wishes to remain on an old platform and use software after support is terminated (or the product killed), they should be able to (unless it is subscription software). However, the customer is not entitled to support, bug-fix updates or any services on that product. However, if the product depends on a third-party service and that is terminated, the customer is not entitled to continued service or a refund.

Developer Entitlements

Developers have the obligation to provide customer entitlements, but have their own entitlements too:

  • The developer is entitled to charge a fair price. Software, especially good software, requires many months of developer time to craft and polish, as well as money for design, art, hosting and support. As with all businesses, the business is only worthwhile if the income of the business exceeds the expenses. In software, the income is license sales, the expenses are developers, support staff, designers, offices, health-care, legal, marketing and all the other usual business expenses. If the business cannot be profitable, there is no purpose in starting or continuing it. The developer is entitled to earn a living doing what they do, just as everyone else is. I have no idea how developers, never-mind the whole software industry, can survive at 99c a pop. If developers cannot earn a living income by making the products customers desire, they simply will not make them.
  • The developer is entitled to charge for major updates. It takes even more months of effort to craft and graft additional features onto software, and the developer is entitled to be compensated for that too. One cannot reasonably expect all future features and support to be included in the initial license purchase, just as one cannot reasonably expect the builder of your house to add rooms, revamp the kitchen or redo the roof as part of the initial house price. I think it’s very nice that some developers offer upgrade discounts, but they do not have to.
  • The developer is entitled to charge for multiple platforms. Different platforms require different code bases, each of which has to be designed, developed, tested and supported. Even iPhone and iPad applications, which seem on the surface to just be iOS, contain significantly different user interfaces that need to be designed and coded separately. If they do not, you get the Android tablet application problem where the majority of tablet applications there are just blown up versions of the phone user interfaces and are thus awful. The developer is entitled to be compensated for the time and effort involved in developing for multiple platforms. Once again, I think it’s nice that some developers release universal applications, but they do not have to.
  • The developer is entitled to decide what features get added or removed in each version. The developer is entitled to decide what constitutes a feature that should be included in a paid update and what constitutes a bug fix that that should be included as a customer entitlement. Essentially, the developer has the final say as to what features do get developed, which get delayed, which never get developed and which get removed, yes folks, removed. The developer is entitled to manage the plan and scope of their application. Great developers, of course, listen to their customers first. If the customer does not like the new feature set or direction of the product, they are entitled to stay with the old, unsupported version.
  • The developer is entitled to terminate unprofitable products. If the developer spends a massive amount of their time creating a product and cannot earn enough to continue to work on it or support it, they are entitled to terminate it. Just like my local bookstore was unprofitable, so it closed. In fact, the developer is entitled to stop working on a product if something else comes up or they lose interest, although that is quite unprofessional and it reflects badly on them. Remember, the customer entitlement is to use the purchased version of the product on the purchased-for platform and so the developer does not have to take it further.
  • The developer is entitled to usage information from the product. This may be controversial, but I believe that the developer does have the entitlement to gain information from the customer as to how they use the product, but that this usage information be anonymized and never shared with others. Web application developers are entitled, for example, to use Google Analytics to see which features are accessed by which browser from which region so they can improve popular features, popular browser support and popular regional language versions. But the developer is not entitled to any of the customer’s data and may not share it with any third parties.

No Entitlement To

I have covered what the customer and developer are entitled to, but there are some things they are simply not entitled to either:

  • The customer is not entitled to run the software on an unsupported platform and claim any entitlements above. If the customer tries to run the software on an unsupported or jailbroken platform, on an emulator or on an undocumented platform, they are not entitled to any of the above entitlements. Developers document what they know the software works on and cannot support and bug-fix software on any other platforms. Further, the customer is not entitled to issue a bad review because they tried to run it on an unsupported platform, that’s just rude.
  • The customer is not entitled to use software without a license (and paying for it). Just as you are not entitled to make a phone call without paying for it, or fill up with gas without paying for it, the customer is not entitled to use software that is unlicensed, and if not free, that they have not paid for it. The press calls it piracy, but it’s really theft. Just as a customer is not entitled to walk into an AT&T store and steal an iPhone because it’s too expensive, the same applies to software. Of course, the software pirate is in no way entitled to any after-sales services and support from the developer. It’s rather sad but common for developers to receive emails from pirates stating that they would buy the product if a specified feature was added. I believe that’s called attempted extortion. And the reality is, they never do.
  • The developer is not entitled to use or profit from the customer’s personal data in any way. This bears repeating, the developer can use analytic information (anonymous statistics on application usage) but may not use or sell the customer’s data under any circumstances. Period!
  • Neither the developer nor the customer is entitled to abuse the other. Customers, if you purchased the software and there is a problem, contact the developer and discuss the issue, there is no need to go public and be abusive about it. Developers, if the customer has purchased your software, you are obligated to service and support them (or refund them), there is no need to go public and abuse them back. Much of the pain felt by both sides here is because the “trolls” go public and the conversation gets vitriolic instead of just talking to each-other.

So next time you see a tweet or review complaining about the price of software, the lack of features, the end-of-life of a software product, or see words like “unfair” or “greedy”, let them know what the true entitlements are, and ask them to correct their invalid statements.

If we all know what our entitlements are at the start, our expectations and relationships will be that much easier and smoother.

Follow the author as @hiltmon on Twitter or @hiltmon on App.Net.

Forced Arbitration and the Right to Sue

One of the things that is bothering me these days is the number of vendors changing their contracts unilaterally to require us to use their own arbitration and giving up our right to sue. You can ‘opt out’ of this change, where ‘opt out’ means they will immediately terminate service. The mobile carriers in the USA have had these for a while, as have the credit card companies and many employers. Paypal is implementing it now.

Now, I have no interest in suing any of these companies. I have no reason to (yet) and cannot afford it anyway even if I did as they have practically unlimited legal budgets. But why must we give up our legal rights to keep using their services?

It turns out that this practice is not only common and legal, it’s encouraged by the courts as well. Have a read of Stephanie Mencimer’s article Have You Signed Away Your Right to Sue?:

Since then, judges have used the Supreme Court ruling to legitimize and further expand the use of mandatory arbitration, even though, as Justice Hugo Black once observed, arbitrators can be "wholly unqualified" to oversee complicated cases. Indeed, private arbitrators aren't required to follow the law or established precedent, or even issue written decisions. Many have legal backgrounds, but there is no standard dictating that they be lawyers or credentialed in any way—yet their decisions can't be appealed.

So the situation is that you have unqualified arbitrators paid by the companies that are forcing you into arbitration in the first place who get to decide disputes against the selfsame company! And their decisions are legal, binding and cannot be fought. Who the heck would agree to that?

One could argue that you have a choice to not sign the agreement that forces arbitration. Bullshit! The argument assumes that there is an alternative service that you can get without the forced arbitration clause. Try and find a mobile carrier that does not force arbitration. If you want or need a mobile phone in the USA, you have to give up your right to sue. Credit card? Same. Job? If there is a union anywhere near the industry, same.

Since companies with forced arbitration clauses know that they will “win” any and all disputes cheaply, what forces them to keep their promises? They are free to lie about services offered, and if you, the consumer, feels ripped off, tough. They don’t need to compete because their competition does the same. They don’t need to innovate or update or upgrade, they can get away with usurious prices and awful service with no consequences. And when the government does attempt to step in, they have all this money to spend on “friendly” politicians.

This is yet another step in the great American process of taking away the rights granted to individuals. This is no longer a place where the rule of law applies, it’s a place where the rule of power and money applies.

I’ve had this note on the boil for a while since I tried to ‘opt out’ of illegal credit card fees last year and they gave me two choices: accept the fees or lose all credit cards with the bank. Recently, PayPal changed its terms and conditions to force arbitration, and after seeing the many PayPal horror stories, well, I do not want to be yet another victim of theirs. Fortunately, there are other payment services. Unfortunately, no other credit card providers or mobile phone services.

Follow the author as @hiltmon on Twitter or @hiltmon on App.Net.