Install Node on OSX El Capitan for beginner

Problems when installing Node on OSX with brews, the default node path on OSX. For some reason my node modules where all installed in /Users/[homedir]/.npm_packages and Node Modules end up here 

 /Users/[homedir]/.npm_packages/lib/.node_modules

This result in a lot of errors when i try to install JS-Minify for Sublime Text. special if i install modules Globally. 

This is a BlogLog post to reproduce the path if sometime a similar Error occurs in my node environment. At the end you find the stackoverflow links who helped to solve most problems

Installing node through Homebrew can cause problems with npm for globally installed packages. .
$ rm -rf /usr/local/lib/node_modules $ brew uninstall node $ brew install node --without-npm $ echo prefix=~/.npm-packages >> ~/.npmrc $ curl -L https://www.npmjs.com/install.sh | sh </code></p> <p>to the new npm to  PATH environment variable <code class="prettyprint">$ export PATH="$HOME/.npm-packages/bin:$PATH"</code></p> <p>To make the new Path permanent we add it to our .bash_profile add following line <code> #NODE GLOBAL PATH PATH=$HOME/.npm-packages/bin:$PATH </code></p> <p>Reload the bash in Terminal</p> <p><code>source ~/.bash_profile</code></p> <p>Check PATH <code>$ echo $PATH</code></p> <p>Edit $PATH</p> <p><span>vi $HOME/.bash_profile</span></p> <h2>NODE Commands:</h2> <p><code>$ npm config get prefix</code></p> <p><strong><em>Show Version</em></strong></p> <p>$ npm -v</p> <p><strong><em>Show node Version</em></strong></p> <p><span>$ node –version </span></p> <p><em><strong>Get Path where NPM is installed</strong></em></p> <pre class="lang-js prettyprint prettyprinted"><code><span class="pln">$ npm config </span><span class="kwd">get</span><span class="pln"> prefix</span></code>

Set the nvm default Dir DONT use Sudo

$ npm config set prefix /usr/local

List Global NPM Packages
$ npm list -g

Will show the global installation root regardless of current working directory.

npm root -g</code><span> </span></p> <h4 class="gh-header-title instapaper_title">Complete Remove NODE.JS</h4> <pre class="lang-bash prettyprint prettyprinted"><code><span class="pln">brew uninstall node</span><span class="pun">;</span><span class="pln"> </span><span class="com"># or `brew uninstall --force node` which removes all versions</span><span class="pln"> brew prune</span><span class="pun">;</span><span class="pln"> rm </span><span class="pun">-</span><span class="pln">f </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">npm </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">dtrace</span><span class="pun">/</span><span class="pln">node</span><span class="pun">.</span><span class="pln">d</span><span class="pun">;</span><span class="pln"> rm </span><span class="pun">-</span><span class="pln">rf </span><span class="pun">~/.</span><span class="pln">npm</span><span class="pun">;</span></code>

Reinstall  NODE.JS

brew install node;
which node # => /usr/local/bin/node
export NODE_PATH='/usr/local/lib/node_modules' # <--- add this ~/.bashrc

Get Node info regarding your node installs

brew info node

Temporary show hidden Files

defaults write com.apple.finder AppleShowAllFiles TRUE

killall Finder

and at the end set back to hide the files again

defaults write com.apple.finder AppleShowAllFiles FALSE

killall Finder

Installing global node modules

Installing Node MAC Linux Nodeschool 

Complete Unistall & reinstall Node  

Install Minify for Sublime Text 

 

Source : DAnHerbert GIST

Trello to WordPress Plugin

Try to debug the Trello 2 WordPress Plugin , a wonderful idea but sadly the Plugin is not updated or supported by the developer now for quite a time .

Why is the concept of using a Trello board to edit & rearrange content on your website sweet ? Trello offers a very intuitive drag and drop style card system with a json api . This way we can reorganise content by simply dragging it from one place to a other we can assign multiple user to the board as editor , no WordPress skills or admin Editor rights are needed.

What the Plugin supports : Trello List and  Cards

Shortcut Parameter : ID , type , link

 

How to find the Trello Board ID

To get temporary get the plugin work on the front end
If your Board have a link like

https://trello.com/b/mOu3B0ce/web-developer
just add “.json” at the end it will show a json file with a section for the id
the url will now look like
https://trello.com/b/mOu3B0ce/web-developer.json

What works : The authentication with your Trello account. REndering of your trello content with minimal styles – here is some work to do to make it realy sweet

What don’t works : The Selection of a Trello Card or Board ID in the admin section .

Trello API : Reffernce https://developers.trello.com/advanced-reference/board

Solution : Was to simple to believe , after a lot of code change and Trello APi Responds later . You need a Organization in your trello Board. as my Board was Private only the Plug don’t work in this mode and fail to update the Trello Ids in the admin screen .

Now its time to make something beautiful out of the simple links .

 

  • Saved Facebook Posts from Treallo
  • Recommended Twitter Follower from Trello
  •  Team Post Planing from Trello with WP Front end
  • Google Material Cards from trello
  • Dynamic Member User List Sortable from Trello
  • Idea Board
  • ect

 

Test Cards from Trello embedded with the shortlink

BOARDS

Thu, Jan 01. 12:00 AM

To Do

By Code Cowboy Thu, Jan 01. 12:00 AM

Thu, Jan 01. 12:00 AM

MARKETING-BIZZ

By Code Cowboy Thu, Jan 01. 12:00 AM

Thu, Jan 01. 12:00 AM

Doing

By Code Cowboy Thu, Jan 01. 12:00 AM

Thu, Jan 01. 12:00 AM

Done

By Code Cowboy Thu, Jan 01. 12:00 AM

Thu, Jan 01. 12:00 AM

DESCRIPTION TXT

By Code Cowboy Thu, Jan 01. 12:00 AM

Thu, Jan 01. 12:00 AM

RESOURCES

By Code Cowboy Thu, Jan 01. 12:00 AM

Thu, Jan 01. 12:00 AM

IDEAS PLUS

By Code Cowboy Thu, Jan 01. 12:00 AM

Thu, Jan 01. 12:00 AM

InstaApps

By Code Cowboy Thu, Jan 01. 12:00 AM

MySQL WordPress oprhan postmeta CleanUp

If your blog get agged probably it get slow . To clean up old SQL entrys there are several plugins but some time like in my case you need to delete millions of outdated Orphaned Post Meta  , than plugins will timeout your SQL Database.

Especially if you experiment with  post  plugins loops can cause very fast tausend of duplicated post and metas.

[divider line_type=”Small Line” line_thickness=”1″ divider_color=”default”]

This is the first try to explore and dig a bit deeper into the Developer World , not only from the code and benefit side but also to learn more about the style and thinking that build the red line thru all his work . Many times phantastic people nearly disappear online and there Blogs get abandoned . Most likely one of the Big 5 IT cooperation already hired him and no time for free plugins or Blogging .

  • Revisiones
  • Auto drafts
  • Deleted comments
  • Unapproved comments
  • Spammed comments
  • Deleted comments
  • Orphaned post meta
  • Orphaned comment meta
  • Orphaned user meta
  • Orphaned term meta
  • Orphan term relationships
  • Unused terms
  • Duplicated post meta
  • Duplicated comment meta
  • Duplicated user meta
  • Duplicated term meta
  • Transient options
  • Optimizes database tables
  • oEmbed caches in post meta
[nectar_gradient_text heading_tag=”h1″ color=”extra-color-gradient-1″ gradient_direction=”horizontal” text=”WP Sweep”]

Wp- Sweep is from the Developer Lester Chan a well known high profile WordPress Developer . The Plugin works smooth and clean following WordPress Tables and Terms as long they stay below 100.000 entry then it still works but can take extremely long and outtime your SQL Database on a shared host

The image below show the wp sweep admin screen after cleanup .

[nectar_image_with_hotspots image=”5933″ preview=”https://metaprime.at/blogapp/wp-content/uploads/2016/09/Screen-Shot-2016-09-29-at-12.53.49.jpg” color_1=”Accent-Color” hotspot_icon=”plus_sign” tooltip=”hover” tooltip_shadow=”none”][nectar_hotspot left=”96.31236442516268%” top=”37.2093023255814%” position=”top”][/nectar_hotspot][nectar_hotspot left=”11.496746203904555%” top=”41.08527131782946%” position=”top”][/nectar_hotspot][nectar_hotspot left=”13.882863340563992%” top=”13.178294573643413%” position=”top”][/nectar_hotspot][/nectar_image_with_hotspots]

MYSQL query to delete orphaned postmeta

Of course before you make any change or clean up in your database dont forget the full backup . For a faster access i use a client like Sequel Pro to manage all the Databases

<code>

DELETE pm
FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL

</code>

[image_with_animation image_url=”5938″ alignment=”center” animation=”Fade In” box_shadow=”small_depth” max_width=”100%”]

Helpful HomeBrew and Terminal Commands for Mac OSX

Since i just learn to work with brew and debug some build problems this is a little resoruce to help beginner who like compile there builds. This resource was created by experimenting with a custom MLT build. Read also the Formula Cookbook to learn more . Some note

Xcode is required for adding PHP modules

Brew install all kegs in a Cellar   /usr/local/Cellar/[FORMULA]/   and simlink them

How to modify brew scripts ? 

Once downloaded all brew scripts can be found following dir . The ruby Install scripts can be edited or extended as you like

/usr/local/Library/Formula

Where is your recent install of Fromula ?

brew --prefix [FORMULA]

All installed Packages via brew

brew list

All Homebrew Logs

[USER]/Library/Logs/Homebrew

How to turn on Debug mode for Brew ?

brew install --verbose --debug [Formula]

More Brew install with flags

brew install [FORMULA]--universal
brew install [FORMULA]--build-from-source

Unistall Brew Package

brew uninstall [FORMULA]

How to create a Folder SimLink

ln -s ~/"Foo Bar/" Foo

How to reload .bash_profile from the Terminal 

source ~/.bash_profile

How to identify 32-bit and 64-bit file types on MacOS X ? With  [file]

 file /usr/lib/fooooooo.dylib

Mac Terminal Permission

List all USER  in Terminal

dscl . -list /Users UniqueID

Repair Home User Permission : Replace username with your username all lower case no space
 sudo chown -R username:admin /Users/username

Show Logged in User Name

id -un

List all Groups

dscacheutil -q group

Edit PATH environment vars

Will open the bash_profile with your default editor , in our case with sublime text 2

touch ~/.bash_profile; open ~/.bash_profile

Apache Mac Terminal Commands

start apache Server

sudo apachectl start

Stop Terminate apache

sudo apachectl stop

Restart Apache from Terminal

sudo apachectl restart

Show Apache Version

httpd -v

apache start with terminal output for Error and debugging

apachectl -t

Common Brew install messages

Even after insalling a package dont mean its available for the system if its keg-only its not linked as the system have already a version. If you whant to build with that lib or package you must include the LDFLAGS  and CPFLAGS in your make file or you can try to –force linking for your compile .

keg-Only 

This formula is keg-only, which means it was not symlinked into /usr/local.

OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/curl/lib
    CPPFLAGS: -I/usr/local/opt/curl/include

Apache versions for differnt OSX

OSX Lion

OSX Yosemite is Apache/2.4.10

OSX Snow Leopard Apache/2.2.24

Interesting Follow ups

How to Homebrew install specific version of formula?

Setting up a local web server on OS X

ImageProzessor Compiling make stills2dv for OSX

First of all i have to mention that comping software i am very new to had just compiled ffmpeg and imagic for my Dev MAMP work field. But after got hot with image and video processing software like MLT . I just found the gorgeous branch stills2dv . Zooming probably is not the big thing but how the lib speed and slow up the pans and zooms is the best and most intuitive i have seen. Building the workfile is like writing a Text script how to zoom and Pan . Very simple if you have a bit of feeling for Pans & Zooms .

This stills2dv package have some very sweet Zoom and Pan options for still images but was build for Linux and some outdated lybs and commands made it a bit hard for me compile. for future i will note here what i change to get it work .Last but not least dropped in as i would like huge panorama images and return a video that can be shared on social media platforms like Facebook or Instagram. That as a terminal batch proces without opening any editing software.

Future idea is to create the workfile for pan zoom with a html editor.

First of all watch the video to get a impression what is the still2dv can do

First make sure you have the needed libs Installed

X11 installed

most likely this packages are already on your machine

libc
gcc
make
libjpeg-dev
libpng-dev

 

Some changes for the PATH to work on OSX below my make file with corrected paths. The only change was in the first lines  -lXext and -lX11 made me some trouble till i installed XQuartz .

PREFIX = /usr
CC = gcc
COPTIONS = -Wall -g -O4
CLIBS = -ljpeg -lpng -lm -I/opt/X11/include -L/opt/X11/lib/ -lXext -lX11

all: stills2dv

hash: hash.c stills2dv.h
	$(CC) -o hash $(COPTIONS) hash.c

stills2dv: s2d_main.o s2d_ppm.o s2d_jpg.o s2d_png.o s2d_smoothing.o x_lowlevel.o
	$(CC) -o stills2dv  $(COPTIONS) s2d_smoothing.o s2d_ppm.o s2d_jpg.o s2d_png.o s2d_main.o x_lowlevel.o $(CLIBS)
	echo You may try the command: make example

s2d_main.o: s2d_main.c stills2dv.h
	$(CC) $(COPTIONS) -c s2d_main.c

s2d_jpg.o: s2d_jpg.c stills2dv.h
	$(CC) $(COPTIONS) -c s2d_jpg.c

s2d_png.o: s2d_png.c stills2dv.h
	$(CC) $(COPTIONS) -c s2d_png.c

s2d_ppm.o: s2d_ppm.c stills2dv.h
	$(CC) $(COPTIONS) -c s2d_ppm.c

s2d_smoothing.o: s2d_smoothing.c stills2dv.h
	$(CC) $(COPTIONS) -c s2d_smoothing.c

x_lowlevel.o: x_lowlevel.c
	$(CC) $(COPTIONS) -c x_lowlevel.c

clean:
	rm -f *.o stills2dv hash Example/out.mpg tmp/* out.mpg tmp.mpg ffmpeg2pass*.log *~

clean_temp:
	rm -f *.o tmp/* tmp.mpg ffmpeg2pass*.log

example: stills2dv
	mkdir -p tmp
	rm -f tmp.mpg out.mpg
	./stills2dv -tmpdir tmp -showoutput exampleworkfile.s2d
	ffmpeg -r 30.00 -f image2 -i tmp/%05d.jpg -i example_data_files/09_1_2_3_4.mp3 -vcodec mpeg4 -vb 9000k -ab 128k -aspect 16:9 -pass 1 tmp.avi
	ffmpeg -r 30.00 -f image2 -i tmp/%05d.jpg -i example_data_files/09_1_2_3_4.mp3 -vcodec mpeg4 -vb 9000k -ab 128k -aspect 16:9 -pass 2 out.avi
	rm -f tmp/* tmp.avi
	mplayer out.avi -fs



install: stills2dv
	cp -f stills2dv $(PREFIX)/bin
	chmod 755 $(PREFIX)/bin/stills2dv
	chown root:root $(PREFIX)/bin/stills2dv

To run the Install you need also to adapt the install part since root:root doesn’t exist on osx .The install done manually in the terminal

One more change on s2d_png.c since libpng updated some commands will not work. My s2d_png.c following error found on stackoverflow

Chances are you are compiling IM with png.h from libpng-1.5.x but
* Bugs png_longjmp” only exists inlibpng-1.5.x.
* libpng-1.6.17 already installed

changeds2d_png.c to following . Mostly replaced the old format to the new strukture

png_create_info_struct
/**********************************************************************
 *
 * s2d_png.c
 *
 * Author: Denis-Carl Robidoux
 *
 * Copyrights and license: GPL v3 (see file named gpl-3.0.txt for details
 *
 *  
 *
 ***********************************************************************/


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <ctype.h>
#include <png.h>

#include "stills2dv.h"

Image *readpng(char *fn)
{
  unsigned char header[8]={0};
  int x, y, width, height;
  unsigned char *row;

  png_structp png_ptr;
  png_infop info_ptr;

  unsigned char  ** row_pointers;
  unsigned char *data;
  Image *img;
  FILE *in;
  TRACE;
  in = fopen(fn, "rb");
  if (!in)
    {
      fprintf(stderr," File %s could not be opened for reading", fn);
      return NULL;
    }
  if (fread(header, 1, 8, in)!=8)
    {
      fprintf(stderr, "Failed reading header of %s\n", fn);
      fclose(in);
      return NULL;
    }
  if (png_sig_cmp(header, 0, 8))
    {
      fprintf(stderr," File %s is not recognized as a PNG file", fn);
      fclose(in);
    }
     
  png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
	
  if (!png_ptr)
    {
      fprintf(stderr," png_create_read_struct failed");
      fclose(in);
      return NULL;
    }

  info_ptr = png_create_info_struct(png_ptr);
  if (!info_ptr)
    {
      fprintf(stderr," png_create_info_struct failed");
    }

  if (setjmp(png_jmpbuf(png_ptr)))
    {
      fprintf(stderr," Error during init_io");
    }
  png_init_io(png_ptr, in);
  png_set_sig_bytes(png_ptr, 8);
  png_read_info(png_ptr, info_ptr);

  
  height = png_get_image_height( png_ptr,  info_ptr);
  width = png_get_image_width( png_ptr,  info_ptr);
  
  png_set_interlace_handling(png_ptr);
  png_read_update_info(png_ptr, info_ptr);
  if (setjmp(png_jmpbuf(png_ptr)))
    {
      fprintf(stderr," Error during read_image");
    }
  if((row_pointers = (unsigned char **) malloc(sizeof(unsigned char *) * height))==NULL)
    {
	fprintf(stderr, "Out of memory allocating rows index for png\n");
	png_destroy_info_struct(png_ptr, &info_ptr);
	//png_destroy_struct(png_ptr);
	return NULL;
    }
  for (y=0; y<height; y++)
    if((row_pointers[y] = (unsigned char *) malloc(  png_get_rowbytes(png_ptr, info_ptr) ))==NULL)
      {
	    fprintf(stderr, "Out of memory allocating rows for png\n");
	    while(y>1)
	  {	   
	    free(row_pointers[--y]);
	  }
	free(row_pointers);
	png_destroy_info_struct(png_ptr, &info_ptr);
	//png_destroy_struct(png_ptr);
	return NULL;
      }
  png_read_image(png_ptr, row_pointers);
  fclose(in);
  if((img=(Image *)malloc(sizeof(Image)))==NULL)
    {
      fprintf(stderr, "Out of memory creating header while opening png\n");
      png_destroy_info_struct(png_ptr, &info_ptr);
      //png_destroy_struct(png_ptr);
      for (y=0; y<height; y++)
	free(row_pointers[y]);
      free(row_pointers);     
      return NULL;
    }
  memset(img, 0, sizeof(Image)); 

  if((img->data=(unsigned char *)malloc(width * height * 3))==NULL)
    {
      fprintf(stderr, "Out of memory for image while opening png\n");
      png_destroy_info_struct(png_ptr, &info_ptr);
      //png_destroy_struct(png_ptr);
      for (y=0; y<height; y++)
	free(row_pointers[y]);
      free(row_pointers);     
      free(img);
      return NULL;      
    }
  if( png_get_color_type(png_ptr, info_ptr)  == PNG_COLOR_TYPE_RGB)
    {
      
      for (y=0;y<height;y++)
	{	  
	  memcpy(&img->data[y*width*3], row_pointers[y], width*3);
	}
    }else if ( png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGBA)
    {
      data=img->data;
      for (y=0;y<height;y++)
	{
	  row=row_pointers[y];
	  for(x=0;x<width;x++)
	    {
	      *(data++)=*(row++);
	      *(data++)=*(row++);
	      *(data++)=*(row++);
	      row++;
	    }
	}
    }else if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY)
    {
      data=img->data;
      for (y=0;y<height;y++)
	{
	  row=row_pointers[y];
	  for(x=0;x<width;x++)
	    {
	      *(data++)=*row;
	      *(data++)=*row;
	      *(data++)=*(row++);
	    }
	}
    }else if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY_ALPHA)
    {
      data=img->data;
      for (y=0;y<height;y++)
	{
	  row=row_pointers[y];
	  for(x=0;x<width;x++)
	    {
	      *(data++)=*row;
	      *(data++)=*row;
	      *(data++)=*(row++);
	      row++;
	    }
	}
    }else
    {
      fprintf(stderr, "Unsupported PNG format, we do not support indexed color (yet)\n");
      png_destroy_info_struct(png_ptr, &info_ptr);
      //png_destroy_struct(png_ptr);
      for (y=0; y<height; y++)
	free(row_pointers[y]);
      free(row_pointers);     
      free(img->data);
      free(img);
      return NULL;
    }
  img->width=width;
  img->height=height;
  png_destroy_info_struct(png_ptr, &info_ptr);
  //png_destroy_struct(png_ptr);
  for (y=0; y<height; y++)
    free(row_pointers[y]);
  free(row_pointers);     
  img->fn=strdup(fn);
  return img;
}

Now we are at the point that make and sudo make install works without any error.

IMPORTANT

We need XQuartz  works fromOS X 10.6.3 till  El Capitan  , Download and install this part output the images to the window and will get started from the terminal as soon Showoutput get executed.

Run in Terminal

stills2dv -tmpdir tmp -showoutput workfil_pano.s2d

Terminal returns and start prozessing your workfile and place all images in the tmp folder. My  workfil_pano is a simple pan from left to right

resolution 1200×830

fps 25

type jpg

img Kaiserpano.jpg zoom FITHEIGHT startpoint LEFT endpoint RIGHT duration 29.00Creating framCreating fCreaCreating frame #00024 at x= 244.22 y= 165.00 and zoom 4.06

After all Zoom Pan prozessed the tmp is full of single images now combine them with ffmpeg to get the final movie

ffmpeg -r 25.00 -f image2 -i tmp/%05d.jpg -i myaudiofile.mp3 -target pal-dvd -s 1920x1080 -vb 9000k outvid.mpg

I hope i dont forget anything , its already some days ago

Mac Apache setup new DocumentRoot

Since most stuff get tested on my MAMP server i look for a second local test environment . Some server related packages are just much easier to install under Apache than to compile it for MAMP.  Default MAMP port is 8888 and some software need the default 80 port .

First of all i moves the default Apache directory from  /Library/WebServer/Documents

to my webdev disc www add near Line 173

# Mac ApacheServer port80
DocumentRoot "/Volumes/www/ApacheWebserver"

Therefore edited the Apache  httpd.conf  in /private/etc/apache2

to make it available under add ServerName Localhost

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80

ServerName localhost

And one more edit according to stackoverflow to access the folder near line 183

<Directory />
    #Options FollowSymLinks
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order deny,allow
    Allow from all
</Directory>

Dont forget to restart the apache server with the Terminal command monitor in your console log if any error shown.

sudo /usr/sbin/apachectl restart

How too Real Time track Facebook Likes with Google Analytics

Build your Like button on the Facebook Widget Page as you like it should look. Chose XFBML button type.  Inside the <fb:like  we place the javascript to fire a google tracking.

onclick="javascript: _gaq.push(['_trackPageview', 'yourpagepost.com/facebook']);"

<fb:like onclick="javascript: _gaq.push(['_trackPageview', 'yourpagepost.com/facebook']);" href="http://www.youtpagepost.com/" ><fb:like>

These methode is slightly different then the standard way adding the social tracking code on page  and with

FB.Event.subscribe

. Its more usable if you render the like buttons dynamic. For my case i will track that way unlikes on a multi like page with several hundred Like buttons .

You Google Analytics account must be approved for the Beta Program.