How to stop / start / restart Gearman Server

How to stop, start and restart Gearman server via command line took me a bit to find, so I figured I would post it for future reference…

First, know the path to gearmand and gearadmin, on my server it is:

How to STOP Gearman Server

How to START Gearman Server

Note: If you are not using a database to queue Gearman worker jobs, that means all pending jobs are in memory, all pending jobs will be lost when you shutdown! If you do use a database, your pending jobs will be available upon restart and will not be lost.

Hope this helps!


How to integrate Kiip ads into Cocos2d

Here is a quick example of how to integrate Kiip rewards into your Cocos2d game.

If you have questions or updates, please post them in the comments below, thanks! ;)


Kiip Account:
Kiip SDK:

1. Add #import <KiipSDK/KiipSDK.h>
2. Add KiipDelegate to the AppController interface

1. Add Kiip init code at the end of the didFinishLaunchingWithOptions method just above the return YES;

Note: You will need to get your “KEY” and “SECRET” from your Kiip dashboard.


1. Add #import <KiipSDK/KiipSDK.h>
2. Add <KiipDelegate> to interface


1. Added Kiip rewards call inside a CCMenuItem block call ( you would make your own method and triggers to call Kiip rewards )

That’s it, if you have questions or comments, write them below!

How to Integrate AppLovin rewarded video ads into Cocos2d

Here is a quick basic example of how to start showing rewarded video ads from AppLovin using Cocos2d 2.x.

NOTE: This is just a base template, there are several bits to be improved like:
+ Handling auto load for next video
+ Handling prompting player after the video box is closed
+ Whatever you guys can think of…

Hope this helps gets you guys started with making some money using AppLovin in your apps.

If you do update the code, post it in the comments and I will update the code here, thanks!

+ AppLovin Account:
+ Cocos2d 2.x
+ AppLovin SDK 2.4.0



#import "cocos2d.h"
#import "AppDelegate.h"
#import "ALSdk.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
//towards end of method
[ALSdk initializeSdk];
return YES;


#import "cocos2d.h"
#import "ALIncentivizedInterstitialAd.h"
#import "ALAdRewardDelegate.h"
@interface HelloWorldLayer: CCLayer <ALAdLoadDelegate, ALAdRewardDelegate>{
  bool appLovinVideoLoaded;
@property (strong, nonatomic) ALAd* cachedAd;
@property (assign, atomic, getter=isVideoAvailable) BOOL videoAvailable;


// Import the interfaces
#import "HelloWorldLayer.h"

// Needed to obtain the Navigation Controller
#import "AppDelegate.h"
#pragma mark - HelloWorldLayer

// HelloWorldLayer implementation
@implementation HelloWorldLayer
@synthesize cachedAd;

// Helper class method that creates a Scene with the HelloWorldLayer as the only child.
+(CCScene *) scene
   // 'scene' is an autorelease object.
   CCScene *scene = [CCScene node];
   // 'layer' is an autorelease object.
   HelloWorldLayer *layer = [HelloWorldLayer node];
   // add layer as a child to scene
   [scene addChild: layer];
   // return the scene
   return scene;
// on "init" you need to initialize your instance
-(id) init
   // always call "super" init
   // Apple recommends to re-assign "self" with the "super's" return value
   if( (self=[super init]) ) {
     // create and initialize a Label
     CCLabelTTF *label = [CCLabelTTF labelWithString:@"AppLovin Cocos2d Demo" fontName:@"Marker Felt" fontSize:64];
     // ask director for the window size
     CGSize size = [[CCDirector sharedDirector] winSize];
     // position the label on the center of the screen
     label.position =  ccp( size.width /2 , size.height/2 );
     // add the label as a child to this Layer
     [self addChild: label];
     // Default font size will be 28 points.
     [CCMenuItemFont setFontSize:28];
     // AppLovin
     CCMenuItem *appLovin = [CCMenuItemFont itemWithString:@"Show AppLovin Video" block:^(id sender) {
  [self showAppLovinVideo];
     CCMenu *menu = [CCMenu menuWithItems:appLovin, nil];
     [menu alignItemsHorizontallyWithPadding:20];
     [menu setPosition:ccp( size.width/2, size.height/2 - 50)];
     // Add the menu to the layer
     [self addChild:menu];
  appLovinVideoLoaded = NO;
  [self setupAppLovin];
   return self;
// on "dealloc" you need to release all your retained objects
- (void) dealloc
   // in case you have something to dealloc, do it in this method
   // in this particular example nothing needs to be released.
   // cocos2d will automatically release all the children (Label)
   // don't forget to call "super dealloc"
   [super dealloc];
// AppLovin Start
  [ALIncentivizedInterstitialAd preloadAndNotify: self];
  if (appLovinVideoLoaded == NO)
  [self showVideoNotReady];
  [self setupAppLovin];
  [ALIncentivizedInterstitialAd showOver: [[UIApplication sharedApplication] keyWindow] andNotify: self];
  appLovinVideoLoaded = NO;
-(void) showVideoNotReady
  //Handle video not ready message...
#pragma mark AppLovin Custom Event Handling
-(void) rewardValidationRequestForAd:(ALAd *)ad didSucceedWithResponse:(NSDictionary *)response
  // AppLovin servers validated the reward. Refresh user balance from your server.
  // We will also pass the number of coins awarded and the name of the currency.
  // However, ideally, you should verify this with your server before granting it.
  // NSString *currencyName = [response objectForKey: @"currency"];
  // NSString *amountGivenString = [response objectForKey: @"amount"];
  // NSNumber *amountGiven = [NSNumber numberWithFloat: [amountGivenString floatValue]];
  NSLog(@"APPLOVIN rewardValidationRequestForAd didSucceedWithResponse");
-(void) rewardValidationRequestForAd:(ALAd *)ad didExceedQuotaWithResponse:(NSDictionary *)response
  // User watched video but has already earned the maximum number of coins you specified in the UI.
  NSLog(@"APPLOVIN rewardValidationRequestForAd didExceedQuotaWithResponse");
-(void) rewardValidationRequestForAd:(ALAd *)ad wasRejectedWithResponse:(NSDictionary *)response
  // The user's reward was marked as fraudulent, they are most likely trying to modify their balance illicitly.
  NSLog(@"APPLOVIN rewardValidationRequestForAd wasRejectedWithResponse");
-(void) rewardValidationRequestForAd:(ALAd *)ad didFailWithError:(NSInteger)responseCode
  // We were unable to contact the server. Grant the reward, or don't, as you see fit.
  NSLog(@"APPLOVIN rewardValidationRequestForAd didFailWithError");
-(void) userDeclinedToViewAd: (ALAd*) ad
  // When prompted, the user decided they did not want to view a rewarded video.
  NSLog(@"APPLOVIN userDeclinedToViewAd");
-(void) adService:(ALAdService *)adService didLoadAd:(ALAd *)ad
  cachedAd = ad;
  appLovinVideoLoaded = YES;
  NSLog(@"APPLOVIN didLoadAd");
-(void) adService:(ALAdService *)adService didFailToLoadAdWithError:(int)code
  appLovinVideoLoaded = NO;
  NSLog(@"APPLOVIN didFailToLoadAdWithError");
// AppLovin End

MySQL SQL Cheat Sheet

While coding I tend to write or find great SQL scripts from around the web. Below will be a growing collection of SQL that I have found to be useful, time saving or hard to find. Mostly to save me from having to remember, search again for hours or dig through old bookmarks. If any of the scripts below help you out, leave me a comment or do the social sharing thing ;) thanks!

Delete Duplicates

Got a bunch of duplicates in a table that you want to clear out? Here is an easy way to do it…

Copy Table Data

Easy way to update a table from another another table.

Option #1 – If both tables have identical columns.

Option #2 – If tables do not have identical columns or you just some of the data.

Update Column With MD5 Hash

Easy way to update a column with a unique has based on existing row data.
NOTE: MD5 has been well documented as not being the most secure for encryption. Since this was used harmless unique hash and not to protect sensitive data, I used MD5. This ran in 1.5 seconds for 200k rows, much faster than looping via PHP.

App Store Optimization with

App Store Optimization - Appkpi.comLaunched today at 360iDev conference in Denver Colorado! is an App Store keyword optimization tool that helps your app rank for highly searched terms within iTunes.

So the question is, can I find your iPhone or iPad app when I search for it on iTunes? Without using your app title?

What is App Store Optimization?

Let’s say you have an iPhone or iPad app in the iTunes App Store. People who want an app like yours will search on iTunes, NOT by your app name but instead by popular keywords! If your app doesn’t show up in the results, then you are missing sales!

You can use Appkpi to find highly searched keywords with little to no competitors and get your app to return for those specific keywords in iTunes search.

How Appkpi can help you!

1) Add any iPhone or iPad app to your account, even if it’s not yours! No need for an apple username or password like some other sites require.

2) Search for keywords that relate to your app. Appkpi returns competitors, keyword search volume and your current app rank for the keyword.

Appkpi also returns related keywords along with competitors, keyword search volume and your apps current rank. Personally I love the related keywords, you would be amazed at some huge search volume keywords that have NO APPS!

Keyword Analysis via

Note: Who would of thought football picks would be so wide open?

3.) Once you have selected the keywords you want to rank for, Appkpi will give you instruction on how to update your app.

4.) Track the results of your new your new keywords. Once your app and keywords are approved by Apple, your app will begin to show up in search results for the keywords approved.

More about

To learn more about App Store Optimization, go to