Episode 50 – Do You Have O(air conditioning)?

This week we follow up on Apple Music issues, iTunes, the judicious use of shitty code with Design Stamina Hypothesis  and Apple’s rumored Car. Greg and Aaron go on a couple of tangents on AI and the new Cross Point memory. Our Picks: Ghostery, open source Objective-C, ASCIIwwdc, Paint Code and Telekinesis (beta).

Episode 50 Show Notes:

Episode 50 Picks:

Hire Tim

Tim Mitra avatar

A few people have asked about hiring me on contract. So I put together this post:

I am and independent developer and designer working in iOS and web technologies. I have been involved in many app deployments on the AppStore, as the main idea guy or architect of apps; doing client work and some personal apps. Collectively we had over 500K downloads over the last 5 years, which I think it’s better than most. My background is in the graphic arts, print and publishing, and the IT work involved in those trades. However I have always made stuff and consider myself a solutions provider – my unique ability.

While I do wrangle developers, writers and artists, I spend the majority of my time actually writing code and assembling the apps. I am also the person who deals with the actual submission to the AppStore. So I can start an app from pen and paper sketches all the way to the App Store and analytics. While doing so I make stops to assemble copy, create graphics & UX, write the code, assemble the apps, localization, distribute the builds, wrangle git & branches, write server APIs, product management, as well as marketing and promotions. Soup to nuts as any indie IOS developer should be (and hiring out help on big projects).

I am located in Toronto Canada, where I try to run a small development company. I teach introductory courses on iOS development. I write for raywenderlich.com and I founded and host the More Than Just Code podcast.

Tim

resume and references available on request.

Mountain Lion Server MySQL Install Weirdness

I’ve been using mySQL on Macs since I was running debian linux on a Quadra 700 in the late nineties. So you can say that I’ve had to deal with every curve that Apple throws at us with respect to web services. After debian, I ran darwin until Apple released Mac OX Beta in 1999.

The latest challenge was while upgrading my Intel Nahalan Xserve to Mountain Lion Server, 10.8.2. Lo and behold there is no mysql installed. So gleefully I went over the mysql.com to get the latest installer dmg (http://dev.mysql.com/downloads/mysql/). Once I tried to run “mysql” on the command line to test, I kept getting the age old “Cannot connect to /var/mysql/mysql.sock” error. No biggie, just check that the file is there or create a symbolic link to /tmp/mysql.sock…

However no matter what I tried, I kept getting the error… so I needed to dig deeper. Some sage user suggested checking the error log inside /var/mysql/data – by looking for a file matching your hostname and ending with .err . So I set up a tail and ran the mysql startUpItem script by hand and watched the log. (/Library/StartupItems.MySQLCOM/MySQLCOM start). Sure enough it would start and then immediately abort and shutdown.

Turns out the mySQL configuration file was wrong (/etc/my.cnf). I’m not sure where mine came from, possibly an older installer. You may not run into this problem, since Lion and Mountain Lion don’t come with mySQL installed. So the error I saw first was “unknown option skip-locking”. I commented that out (backing up the my.cnf before starting) and ran the start command again. I also had to comment out “table_cache=512” and “skip-thread-priority”. Afterwards mysql started up like it should. So I’m putting this out there, in case it helps the next poor sap.

 

Share Mac external HDs with Windows

Q. I have a MacBook and a couple of PCs. I also have an external 1TB drive on my Mac. I can mount the Mac’s internal hard drive on my PCs but I cannot mount the 1TB hard drive. Is this possible?

A. One of the cool things about Macintosh computers is that we’ve always been able to read data on Windows drives and floppy disks. In the past there were utilities to that enabled Windows computer to run AppleTalk protocol and read Macintosh volumes.

Mac OS X includes Samba which allows users to run SMB (Server Message Block) protocol. SMB was developed by IBM, but has been highly modified by Microsoft. The open source Samba has reverse engineered SMB to provide a version for non-Microsoft systems.

By running SMB on your Macintosh you can share your files with your Windows neighbors. Go to System Preferences -> Sharing and check Windows Sharing. Then PC users can add your Mac to their Network Places or “map” your drive as a network drive by adding \yourIPaddressvolumename.

The problem with external drives is that they are not automatically included in the smb shares. When you enable “Windows Sharing” a configuration file is written to the Unix file system. Most configuration files are stored in the “etc” directory and there you’ll find the “smb.conf” file.

So once again open the Terminal (Applications -> Utilities -> Terminal) and at the prompt enter “cd /etc” and press enter – to “change directories” the “etc” directory. You need to be an administrator to edit the file and you should begin by backing up the file. Enter “sudo cp smb.conf smb.bak” at the prompt to make a copy of the file. “sudo” is a special command that lets you act as an administrator for a short period of time.

Check that you’ve made a copy by listing the files with “ls –la” and Return. You should see both the original and the backup. Now edit the file with “ed”, “vi” or “pico”. With pico the display is similar to most text editors and the commands are at the bottom of the file. Enter “pico smb.conf” and scroll to the bottom (with Control V) and add the following to the bottom of the file:

[LaCie]
path = /Volumes/LaCie_d2_156_GB
valid users = tmitra
writeable = yes

In the example above my “Share name” is “LaCie” – this is what the PC user will see. The Macintosh name of my drive is “LaCie_d2_156_GB” – note that I have replaced the spaces with underscores. The “valid user” is the name of a user on my Macintosh and “writeable” means that I can read and write to the drive.
Now on the PC go to “My Computer” and choose “Map Network Drive” from the Tools menu. Then in the dialog enter the Mac’s IP as the server and the share name:

\192.168.1.100LaCie

Then enter your username and password and the volume should be mounted. You can then copy files to and from your PC – and share them with the Mac.

Becoming root with sudo

This month were going to take a closer look at taking control of MacOS X by becoming a super user. The underpinnings of MacOS X are after all UNIX, so you should be aware of the power a super user wields.
The root account is a “super user” account built into every UNIX system, which you may remember is a multi-user environment. Other systems such as AppleShare IP or Windows Servers had highly privileged administrator accounts, however on a UNIX system the level of access that root has have seems to have no limits.
There are many processes and files are “owned” by root. We’ve looked at “permissions“ in past articles, and you may remember that permissions control what you can do and see. Keep in mind that the all-powerful root account must be treated with respect and root access should be limited to a small group of users. There is no way to stop the root account from altering any file on the system.
You have already experienced becoming a super user while using the Aqua GUI. Whenever you try to install an application or an update, you will have been asked to enter you username and password. Although you’ve already logged in, the “Authentication Manager” is challenging you to prove that you’re an administrator. This is one of the ways that Apple allows users to administrate their own machine.
The “sudo” application is included so you can become a super user on the command line. If you try to run an application or see the contents of a file or folder that belongs to root, you will get an error like “permission denied”.
I’ll tell you a secret – Built into MacOS X is the Apache Web Server. Unlike “Personal Web Sharing”, your Mac can become a fully functional web server. In order to enable it you’ll have to edit a file while becoming a super user.
Let’s start by opening the Terminal application. (Applications => Utilities => Terminal) At that command prompt (%), we’ll change directories to “etc”.
% cd /etc
“etc” is a system directory that contains, among other things, configuration files. The mystery here is that one of the files in “etc” enables the Apache Web Server. Last month I showed you the “fgrep” program, which allows us to find text strings inside files. We’ll look for “WEB” in “etc”. Type this:
% sudo fgrep “WEB” *
Password:
Unlike last month, this time we’re going to precede the “fgrep” with “sudo” so that we’re running the application as a super user. “sudo” , or “super-user do” allows us to assume a high level of authority to search through the files. The first time you use “sudo”, you’ll get a short lecture about respecting others and most importantly “Think before you type.”
If UNIX were like a car, it would be a tank . You can start the tank, put it gear and it will drive forward. Even if parts fell off, it would continue. If you, the driver, fell off – It would continue to drive forward! So, think before you type.
After you enter your password (and hit “Return”) your program will run, and you will see something like this:
fgrep: cups: Is a directory
hostconfig:WEBSERVER=-NO-
fgrep: httpd: Is a directory
…
Ah ha! The file we’re looking for is “hostconfig”. In order to activate the Apache Web Server we’ll change the “NO” to “YES”. Let’s use the “ed” program (you can use “pico” or “vi” if you prefer) but we’ll have to precede the command with “sudo” again. If we don’t start with “sudo”, we won’t have permission to save the file.
First let’s backup the file. Type “sudo cp hostconfig hostconfig.backup” to copy (cp) the original. Just in case! You can also use “ls” to confirm that you made a copy… Then we’ll edit the file with “sudo ed hostconfig”
Begin by printing the file to screen with “1,$p” which will print (p) the file from line “1” to the end ($).
1,$p
AFPSERVER=-YES-
WEBSERVER=-NO-
APPLETALK_HOSTNAME=”Tims G4″
…
Type “/WEB”, to jump to the line that contains the string “WEB”. Next type, “s/NO/YES/p” to substitute (s) “NO” with “YES”, and then print (p) the line.
/WEB
WEBSERVER=-YES-
s/NO/YES/p
At any time, you can type “f” to confirm the name of the file you’re editing. You should also use “1,$p” to confirm your changes before you save the file by writing and quit. Type “w” to write the file and “q” to quit.
You have now enabled the Apache Web Server. Open your browser, and enter “localhost” or “127.0.0.1” in the URL and you will get the default Apache page. This was possible because you became a super user with “sudo”. Now you can put on your “HTML” hat and start writing your web site.