Proud to be Mac!

My progress working through the Cocoa Programming for OS X book has stalled a bit, but it’s not what you might think. I’ve been preoccupied by all of those cool-bean Cocoa concepts I’ve been learning over the past two weeks. Reading tech books is one thing, but you don’t really get it until you code it. My journey to the Mac platformbsod started back in 2003, a time when I had become increasingly frustrated with the many failings of Windows.

Not sure why I feel the need to segue to my Mac past, but here I go anyway… Queue the nostalgic soundtrack.

It was bad enough I had to use Windows all day at work, but I decided I wasn’t going to put up with it at home as well. I needed a reprieve and purchased my first Mac on Ebay, an iMac late 2001 model.

iMac
My first Mac, a late 2001 iMac. I got many years out of this awesome machine! *Technically, I my first Apple computer was purchased on Ebay months earlier but those computers arrived busted.

I was stoked to learn more about this new platform. Could it live up to the reputation as being something different and better? I went down to CompUSA to purchase a copy of OS X, Panther (10.3) on the day of the launch. When I arrived I was surprised to find other Mac users had gather to get their own copies. It was the first time that I got a sense that this computer was something different not just because of the machine but the people were special too. They were different and were happy to embrace a computer that seemed to get them. I was curious to know the essence of what made a Mac a Mac. I would tune in to watch the WWDC keynotes where interim CEO Steve Jobs would present the state of the Apple union. It was great feeling part of that special development community. It was so fun learning about the Mac and the unique culture that came with it. I especially loved how the Mac had always distinguished itself from the pack, particularly in the “Think Different” era. (Who doesn’t love Clarus the Dogcow? clarus_dogcow– Moof! )  Apple has evolved a lot since those early days, but I believe the Mac is still a strong, unique and viable platform. Through the years I have come to love using my Mac at home. I may use Windows and such at work, but that just makes me appreciate the Mac even more. There are those who do not see the Mac this way and that’s fine with me. Every now and then I still like to get into it with the IT crowd who often frame Macs in terms of parts or specs, but the Mac guy in me says let it go. I’m a Mac and your a PC and there is room for everybody.

Okay, so back to my Mac development plan, I’ve decided that this year I am going for it. No excuses! I am determined to write an app and get it into the App Store. There, I said it so it has to happen. The Mac platform has really matured since the early days of Xcode development. I am surprised at how far Swift has come in such a short time. Xcode 7 is a terrific development environment. It’s great fun to get instant feedback on how much CPU or memory your app consumes as it is being developed. It’s like a giant sandbox or playground- well of course Xcode actually has a “Playgrounds”, so right there you can see you’re in for a whole lot of fun. Back when I started learning to program on the Commodore 64 I used to love typing in code and seeing what happened on the screen. Playground gives you the same freedom to experiment with ideas and see the the results play out before you. I highly recommend experimenting with your code in Playground. It is a great way to hone your skills without ever having to build and compile your code. As a build engineer by trade, I really appreciate that feature!

Well, I am off to do some Mac development… 🙂

 

Blocking Referrer Spam

I knew there was something wrong. Suddenly, there were tens of visitors coming to Adventures in Play each day! I just knew I wasn’t that popular. Using Google Analytics,  I dug a little deeper to learn more about my sudden jump in popularity.

 

Google_Traffic

If you do not have Google Analytics set up on your WordPress site, I highly recommend investing the time to install it. It’s a statisticians dream, but more than that, it is a great way to drill down into your blog posts to learn where traffic is coming from and which posts are most popular.

There are a multitude of guides on how to get started. I found this particular article to be good. It offers a step-by-step guide for WordPress users:

Link:
http://www.wpbeginner.com/beginners-guide/how-to-install-google-analytics-in-wordpress/

So, I see lots of traffic but is that a bad thing?

Referrer spam is a bad thing because it represents false traffic and it messes with your Google Analytics. I’m interested in the 5 real visitors, not the hundred or so mindless bot hits.

Besides, there is an easy fix to keep these sites out. All you need to do is modify your .htaccess in the root of your WordPress website. There are several ways to go about this, but I found using the cPanel dashboard to be one of the most direct.

How to Block Span Referrers

Go to your cPanel management website and locate the Files section. This is not possible if your WordPress is hosted at WordPress.com. The steps below only apply to WordPress.org websites.

Within Files click on File ManagerCPanel_FileManager

File Manager Directory Selection window will appear.
From the Document Root for: choose your website from the dropdown box, then click GoCPanel_SiteSelect

Before we modify the .htaccess file, let’s make a backup. That way, if you mess it up, your website won’t be hosed.

From the File Manager, click on Copy.
cPanel_Copy

Next, a Copy window will appear.
Enter the destination of the backup file. I choose the name “bak.htaccess“.
Click Copy File(s) button to save a backup.cPanel_Backup

Now you are ready to edit the .htaccess file directly.
Select .htaccess and then click Code EditorCPanel_FileEdit

Code Editor window may appear prompting for the character encoding type.
For now, click edit (UTF-8 is fine for me).CPanel_CodeEdit

Now for the fun part. Insert the site referrer banning rules just before the WordPress <IfModule mod_rewrite.c> section:

Example commands to filter our referrer websites:

RewriteEngine on 
Options +FollowSymlinks

RewriteCond %{HTTP_REFERER}  ^([^.]+.)*?trafficmonetize\.org [NC,OR]
 # Add other RewriteCond rules here
 
RewriteRule .* - [F]

What is the [NC,OR] doing at the end of the statement?

  • [NC] Tells WordPress to do a case insensitive comparison
  • [OR] Is a logical OR operation

*Tip: Do not add [OR] to the last RewriteCond in your filter list.

My .htaccess file looks like this:


AddHandler application/x-httpd-php52 .php .php5 .php4 .php3
## SITE REFERRER BANNING
 # Block traffic from multiple referrers
 RewriteEngine on
 Options +FollowSymlinks
 RewriteCond %{HTTP_REFERER} ^([^.]+.)*?trafficmonetize\.org [NC,OR]
 RewriteCond %{HTTP_REFERER} ^([^.]+.)*?4webmasters\.org [NC,OR]
 RewriteCond %{HTTP_REFERER} ^([^.]+.)*?webmonetizer\.net [NC,OR]
 RewriteCond %{HTTP_REFERER} ^([^.]+.)*?floating-share-buttons\.com [NC,OR]
 RewriteCond %{HTTP_REFERER} ^([^.]+.)*?www.event-tracking\.com [NC,OR]
 RewriteCond %{HTTP_REFERER} ^([^.]+.)*?free-social-buttons\.com [NC]
 RewriteRule .* - [F]
 # BEGIN WordPress
 <IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /
 RewriteRule ^index\.php$ - [L]
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /index.php [L]
 </IfModule>
 # END WordPress

Warning: Be careful when editing the .htaccess file. If you don’t edit the file correctly, your website might not load or will inadvertently filter out otherwise welcome visitors.

Click Save and you should be all set. Be sure to test if your homepage loads properly. If you did something wrong you can always restore the backup and try again.

Zero_VisitorsNow that’s more like the blog I know!

 

My First Laptop

It is not everyday that a new computer comes into my life, but I am getting ahead of myself. The story starts back in February when I had the unfortunate incident with my hard drive and came to the realization that I do not actually have my own computer. I’m not exactly sure when it happened or how such a thing is even possible in a tech-filled house, but I think it started like this- When my wife’s Macbook finally died, I transferred her files to my roomy Mac Mini. Over time she grew to love the Mini, so I moved on to the spare gaming PC that I had built a few years ago. Back then I owned an iMac and decided to sell it to build a couple of PCs for me and my son. My plan was to build gaming rigs that would allow for epic multiplayer madness. The project was a great success but it ended up costing me twice what I budgeted for. Although we had some great gaming sessions throughout the years, these days he prefers to go solo.

Having a PC to fall back on was great. It was a powerhouse of a machine, great for running games, a fact the my daughter quickly picked up on. When I built the PCs, my daughter was too young to use the computer, but since then she has become a computer whiz. She plays Minecraft with her brother and soon she will need the computer for homework. I thought I could bide my time by using a Raspberry PI 2 to fill in while the computers were booked. The problem with this plan was that the PI, although a truly amazing $45 computer, it was simply too slow to function as a desktop. The more time I spent with it, the more I yearned for power. I feel like a should break out into Dr. Evil laughter at this point, but seriously the PI tested my patience. I wanted a machine that would snap to attention when I clicked and would carry out my every wish with unrelenting determination, brute-force speed and efficiency.

Now, it might sound ridiculous that everyone in our house has their own computer, but we are a family of gamers and nerds. In fact as I write this, my kiddos are sitting behind me playing Minecraft. I know there will come a day when I will sit alone in my office but for now, I am enjoying their little noises, laughter and company. They are fun to be around.

OK, so I decided I wanted my own computer, but what kind of computer should I buy? This was going to be a tough decision. I knew from my previous purchases that once you choose a computer, the best way to get the most from your investment was to use until it stopped working. The decision was complicated by the fact that this wasn’t just about Mac versus PC anymore. There is a reason Apple stopped that campaign a while back. The lines between the traditional desktop and laptop have become blurred. Now there are phones that look like tablets, laptops that work like tablets but with a tethered keyboard, mini tablets that are as portable as phones and large tablets that function like laptops but without the keyboard. It seems tablets are blurring lines everywhere. The central theme here is portability. Historically, I had always focused on power and never gave much thought to portability. I equated value with power, but computers aren’t really about power anymore, no more than they are about the OS that runs on them. People have stopped asking more from their computer for quite some time now. If you don’t believe me, watch your CPU activity for a while and unless you are using a Raspberry PI, you will likely find that your computer is completely idle 99% of the time.

I started my search off in the PC camp, looking at DIY builder  websites, pricing parts and looking for great deals. I was attempting to get the most bang for my buck by building a machine with great specs but for a price less than a store bought model. My mindset was all specs and hardware. I started to price things out and things got pricey pretty fast. I just didn’t have it in me to build another PC again. It is a time consuming process and there is an element of chance that the components you put together may not play nice. If that happens, the defective parts need to be mailed back and try, try again. I’d rather spend my time playing Minecraft with my kiddos.

So, I stepped back and took a look at the personal computing landscape. Maybe it was PC versus Mac after all, but now seen in a new light of portability. I had been happily tethered to my desktop for years, or so I thought. When I owned an iMac, it was a beautiful computer but I felt something was missing. Back then I thought I just needed to upgrade it, but even after maxing out the memory, I still found the experience lacking. I started sniffing about on the Apple website at different models. I must have run through 50 variations of iMacs, MacBooks and MacBook Pro configurations. By the way, I love shopping for computers on Apple’a website. It is such a better experience than at Dell.

I kept coming back to the MacBook Pro, particularly the 13″ model. It had the power I wanted and with the new Broadwell processor, I knew it would offer unmatched battery life. But could it play games? If I was to be honest with myself, I knew I wanted a computer that could play games. After a bit of research, I learned that the new integrated Iris Pro chip was fully up to the task of running my favs, Star Craft II and Civilization V. Now the MacBook Pro has a lot more going for it than that. It had the new Force Touch Trackpad, something that I was eager to try out.

At first I headed to Best Buy, but they didn’t have the computer that I wanted and the sales guy kept hovering over us, even after I asked for some time to discuss the decision over with my wife. Decisions like these are best made at the source, no I’m not talking about RadioShack, I mean the Apple Store.

If you are going to buy an Apple anything, go to the Apple Store. The people there are so good at what they do. Somehow they are there when you need them, but give you space when you need it and seem to empathically know the balance (Could some Apple Store employees actually be from the planet Betazoid?). I truly loved the experience and left the Apple Store totally stoked! They helped me make the best choice for my needs and I came home with exactly the right computer. I cannot express how much I love this computer! It feels like an extension of me. The Force Track Pad is nothing short of magical. How can it be clicking without actually moving?!

Here is a short series of photos from my unboxing:

This slideshow requires JavaScript.


Happy!

*Technically, this is not my first laptop. Back in 1997 my brother graciously gave me his old PC laptop. If I remember correctly, it ran Windows 3 and was about as powerful as a Texas Instrument calculator. In those days, laptops were a different breed. What you can do today with a laptop is a world of difference since those times.

I Want My Data Back

For the record, I know about keeping good backups, but sometimes stuff just happens in the perfect sh#t storm and you lose your data. That’s what happened to me a couple of months ago. Since then, I learned a lot about file recovery and the enormous investment of time and effort it takes to get back just some of the files. I also learned a little about letting go. Most of those lost gigabytes were files that I was meaning to get around to, but I just never had the time to sort through the virtual pile. That’s one way to clean house, but I wouldn’t recommend it.

In my case, the data was lost due to a formatted drive, and so the files had to be recovered using file signatures. I was able to retrieve thousands of files, but most of them didn’t have proper file names, so there was no folder structure to give a file its context. That’s okay for pictures but not great for source code. The worst part was not knowing what was lost, although I now feel pretty good about what I was able to get back. When all of my data went away, I quickly thought about the important stuff that was on my drive. There are a few documents, but really it all came down to the irreplaceable pictures and videos. That is what keeps you up at night, running through scenarios of how all of this could have been prevented, but what’s done is done and it does no good to dwell on things that can’t be changed. Data recovery was made more complex because my drive contained backups of my wife’s computer, so I had to deal with hundreds of thousands of duplicate files.

Throughout the file recovery process, I found a few fantastic tools which did a lot of the heavy lifting for me. These tools are awesome on their own and as a bonus, they are free! I could not have retrieved my files and sorted out the mess without them. So, given that I did a lot of research and testing, I thought I would present you with the best of breed software for data recovery and backups. If something like this ever happens to you, these programs can help you get back your data without having to spend hundreds of dollars and countless hours finding the right tool.

Please Contribute to the Authors

The software I recommend below is not a watered-down version of a commercial product. This software is awesome and absolutely free, but if you find it useful, please donate to the authors. It takes a lot of time and effort to write high quality programs and these talented folks deserve to be compensated for their hard work.

Best Data Recovery Tool

Getting your data back all starts with good data recovery software. When I lost my data, I initially sought commercial software believing that it would be higher quality than the free stuff and would provide me with a more complete recovery. That erroneous belief was dispelled after a few failed attempts at using the commercial product. These programs tend to be expensive, starting at $100 or more. Data recovery is time consuming too, so you want to choose a product that doesn’t waste your time by returning incomplete or corrupted data. For my particular data loss situation, I needed something that could recover files using file signatures. I discovered a truly remarkable and free piece of software called  PhotoRec by  CGSecurity. The software has a bit of learning curve, but don’t be scared off by the console interface. This utility scourers your hard drive for a wide range of file types that it can detect (for a complete list of file formats, go here).

For a detailed step-by-step guide to using PhotoRec, go here

Link: http://www.cgsecurity.org/wiki/TestDisk_Download
PhotoRec

I should warn you that this kind of file recovery takes hours and sometimes days to complete. When the process is done you’ll have a whole mess of directories (dir.001, dir.002, dir.912, etc) to sort through, and that is when you’ll need a good file duplication finder which brings me to my next best in class category…

Best Duplicate File Finder

In my experience, the absolute best file duplication finder software is:

dupeGuru Picture Edition

When recovering data from large backup drives, you will really need a great file duplicate finder; one that is fast but accurate. DupeGuru is exceptional in that it is able to find all of your dups quickly and accurately. It has intelligent file selection, allowing you to weed out the dups without accidentally deleting both files.

Link: http://www.hardcoded.net/dupeguru_pe/

2015-02-04 19_09_27-dupeGuru Picture Edition
Figure showing a typical duplicate file scan

 

Once the scan is complete, you will be presented with a results window showing a list of duplicates. From there you can easily delete the duplicates by choosing Edit–>Mark All and then Actions–>Send Marked to Recycle bin. However, it is a good idea to review the results to ensure that you aren’t deleting files that are in fact different photos that only highly resemble another picture. In my experience this only happens in very dark photos or when the pictures were taken in rapid succession and not much changed between shots.

Best Cloud Based Backup

(Tentative recommendation-see update)

Okay, the cloud based (centralized) version of CrashPlan is not free, but the good folks at Code42 do offer a free Computer-to-Computer backup solution that works great if you have a friend or relative who are willing to host your backup drive for you and in kind, you could host a backup drive for  them. All of the data is encrypted, so no one can read files on the offsite hard drive. Although this option is really great, I chose to go with the centralized CrashPlan solution.

For me, CrashPlan is the best online backup solution.
Link: http://www.code42.com/crashplan/

Update:

When performing a restore, I encountered several “Integrity check failed” errors. It seems that the CrashPlan agent occasionally encounters errors backing up files but does not report the error or perhaps is even aware that some files are corrupt. I found a blog post where someone else had a similar experience (see: http://try-dot-ch.blogspot.ca/2010/03/crashplan.html) There is no easy way to tell CrashPlan to re-transfer corrupted files but worse still, the agent doesn’t notify you of files in your backup set that are corrupt. I thought that overtime the files would “heal” but the integrity errors have persisted for months now. Obviously, I cannot wholeheartedly endorse a product with such a flaw. I have opened a ticket with Code42 to see if they can remedy the matter. I’ll keep you posted.

Update 2:

After working with the capable support staff at Code42, they were able to fix my file recovery issues. My support experience was excellent and I can now wholeheartedly recommend CrashPlan as a terrific cloud-based backup solution.
2015_02_04_19_32_51_CrashPlan

I tried other products like BackBlaze, but I recommend CrashPlan for the following reasons:

  • Unlimited backup of a single computer, including external drives.
  • Super-smart, yet unobtrusive backup agent that intelligently scans your system for file changes.
  • Economical cloud-based solution
  • Easy to use interface that makes backing up and restoring a snap. I restored a very large photo database without issue.
  • Keeps all versions of a file, not just the last 30 days. This is great if an important document gets deleted and you didn’t notice until six weeks have past.
  • You almost wouldn’t know that the app is there keeping all of your data backed up.
  • CrashPlan is secure, providing 448-bit encryption on disk and 128-bit encryption during file transfer.
  • Works on PC, Mac and Linux

The cloud is your friend. When you data lives in the cloud, you are far less likely to accidentally delete your entire collection of files.

So there it is. In the very least please consider using a cloud-based backup for your files.

Oh, I almost forgot another key part of my new backup solution. Having my data in the cloud is good, but I also wanted to have a good local backup that would allow me to fully recover my user files AND operating system in case of a hard drive failure. This brings me to my Bonus Software Recommendations:

Best Backup Software

The program I recommend in this category is not free, but sometimes if you want the best, you will have to pay for it. I don’t mind paying a reasonable price for software that is really good. I tried other products like EaseUs backup, but in my experience nothing beats:

 Acronis True Image 2015

2015-02-04 21_31_17-
Here is what I like about True Image 2015:

  • The app has an amazing interface that makes creating and restoring backups a breeze.
  • Has an intelligent restoration process that actually works. I tried other products that left my Windows 8 computer unbootable after a restore.
  • You can schedule full and incremental backups.
  • Runs on PC and Mac!
  • Backups up data to a network drive
  • Comes with a lot of neat tools like Clone disk and Parallels Access.

But don’t take my word for it, you can download the free trial here.

There you have it. Something good can come from a data disaster after all. If you should ever find yourself in a similar situation, I hope my software recommendations and advice help get your data back in good time.