Thursday, April 25, 2013

Installing Mongo driver on MAMP/MAMP PRO

I recently acquired a Mac development station and have been loving it so far. The only hiccup I have hit so far is installing the Mongo driver in MAMP. My progress yesterday can be found here:

http://www.reddit.com/r/mac/comments/1d1iuf/newtomac_web_developer_has_a_few_questions/c9m53j7

As MAMP is running PHP 5.4.10 I tried unzipping the official 5.4.10 release so the paths matched the not found paths in my reddit post from yesterday. While that got me a bit further I hit another stumbling block.


Jareds-MacBook-Air:bin root# ./pecl install mongo
downloading mongo-1.3.7.tgz ...
Starting to download mongo-1.3.7.tgz (126,064 bytes)
............................done: 126,064 bytes
49 source files, building
WARNING: php_bin /Applications/MAMP/bin/php/php5.4.10/bin/php appears to have a suffix /php5.4.10/bin/php, but config variable php_suffix does not match
running: phpize
Configuring for:
PHP Api Version:         20100412
Zend Module Api No:      20100525
Zend Extension Api No:   220100525
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

ERROR: `phpize' failed


Looks like I need autoconf.


So to get autoconf it looks like people are using the brew package manager. To get brew to work properly you need to get the xcode command line tools. How do you get that? You get xcode. Yeesh.


Jareds-MacBook-Air:bin jared$ brew doctor
Your system is ready to brew.
Jareds-MacBook-Air:bin jared$ brew install autoconf
==> Downloading http://ftpmirror.gnu.org/autoconf/autoconf-2.69.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/autoconf/2.69
==> make install
🍺  /usr/local/Cellar/autoconf/2.69: 69 files, 2.0M, built in 8 seconds

Hopefully the mongo driver will build now. Hold onto your butts.....


Well, it got a whole lot futher this time.... then died here:



In file included from /Applications/MAMP/bin/php/php5.4.10/include/php/main/php.h:34:
/Applications/MAMP/bin/php/php5.4.10/include/php/Zend/zend.h:51:11: fatal error: 'zend_config.h' file not found
# include <zend_config.h>
          ^
1 error generated.
make: *** [php_mongo.lo] Error 1
ERROR: `make' failed

Hopefully I'm getting close. After more digging it looks like I first need to configure the source code I downloaded earlier


Jareds-MacBook-Air:php jared$ pwd
/Applications/MAMP/bin/php/php5.4.10/include/php


Jareds-MacBook-Air:php jared$ ./configure

Alright.. Seriously this time...



Jareds-MacBook-Air:bin jared$ sudo ./pecl install mongo
~~~ BLAH BLAH BLAH COMPILING ~~~
You should add "extension=mongo.so" to php.ini



Success! Now to find where it put this thing... Looks like


/Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/mongo.so

Now to add it to MAMP's php.ini...

extension=/Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/mongo.so

Alright.. Saved. Restarting MAMP... Time to check phpinfo()... looks good! If someone would like me to clean this up into something more readable drop me a comment and I will create a new post with just the instructions. 

MacOSX Web Development

I recently picked up a Mac and have been loving it for web development. Here is my current toolchain:


Text Editor: SublimeText 2
PHP Debugger: Codebug
xAMP Stack: MAMP PRO
Package Manager: Homebrew
Xcode
Command Line Tools for Xcode

Saturday, April 13, 2013

Disable Touchpad in Ubuntu or Linux Mint

After tooling around on the net for a bit trying to figure out how to disable the touchpad in Linux Mint 14 I found a simple way to do it via the console and the xinput command.


Start off with an "xinput list" and identify your touchpad. Next provide the device id to a xinput set-prop as shown in the image above.

Friday, April 12, 2013

Linode Backup/Swap Issue

I recently upgraded 2 linodes to the new Linode nextgen plans which involved migrating them to new servers for increased RAM, CPU, disk space & bandwidth. After the merge one system had an issue backing up the swap partition. I tend to leave the #linode IRC channel so as soon as I saw the email notifying me of a backup error I asked in chat if anyone had a similar issue. Immediately I had a Linode employee PM me and offer their assistance. Here is the instructions we ran (lines starting with // are comments):

// This command lists your swaps and it came up blank

root@jwd:~# swapon -s 
Filename                                Type            Size    Used    Priority 

// This command prepared a swap out of xvdb

root@jwd:~# mkswap /dev/xvdb

mkswap: /dev/xvdb: warning: don't erase bootbits sectors
        on whole disk. Use -f to force.
Setting up swapspace version 1, size = 1048572 KiB
no label, UUID=2a4fbf7c-9a8f-4db1-bf45-c374e62e0c18

// After we ran the above command I ran
// swapon -s again to see if I had a swap yet

root@jwd:~# swapon -s
Filename                                Type            Size    Used    Priority

// Nope, looks I jumped the gun, I have to run
// swapon -a to activate the swap

root@jwd:~# swapon -a

// Now lets check swapon -s

root@jwd:~# swapon -s
Filename                                Type            Size    Used    Priority
/dev/xvdb                               partition       1048572 0       -1

// To quote the linode rep "woot"

Monday, April 08, 2013

Installing Sublime Text 2 on a Chromebook with Crouton



Gonna try to get this running on my chromebook with crouton using the following documentation:

HOW TO INSTALL SUBLIME TEXT 2 ON UBUNTU 11.10:

Update #1: You will first need to install the following package to use the add repo command per the documentation.

apt-get install python-software-properties

Update #2: The final command has changed. The following gist fork provides the updated final command.

https://gist.github.com/BobGneu/5239918

sudo apt-get install sublime-text

note the lack of -2 at the end of the command.  Also... it works! Yay!

Basic Server Setup

Basic Server Setup - Google Drive

Use the above link to view my current basic server setup guide.

su to root in crouton for chromeos


I was doing some maintenance on my crouton modded acer chromebook and was wondering how to "su -" to simplify some of the steps. I didn't know the root password to put in but then I thought why not just  sudo -i. done.

sudo -i

I'm sure this is far from elegant or the proper way to do this but if you need to do a bunch of tasks as root this seems like a quick & dirty way to do it.

Paste as Plain Text in Chrome

Random factoid I just learned - Use Control + Shift + V to paste as plain text anywhere in Chrome. No more dumping horrid formatting when copying and pasting into rich text editors! Huzzah!