Mohammed Tillawy's Blog

Just another weblog

Jenkins EC2 Plugin setup issues — April 26, 2015

Jenkins EC2 Plugin setup issues

Are you trying to setup ec2 plugin with Jenkins CI on a Fedora 21 and getting some strange issues with bouncy castle, like the following:

Caused by: java.lang.NoSuchMethodError: org.bouncycastle.asn1.ASN1InputStream.readObject()Lorg/bouncycastle/asn1/DERObject;

This is a packaging issue, , my first suggestion is to download Jenkins and JDK manually and set them up, instead of using the prepackaged Jenkins and JDK 1.8 supplied by YUM,

if you insist on using the prepackaged YUM Jenkins, you may need to download couple of JARs, and put them in the right places,

# to to Jenkins Home, and EC2 plugin directory (my case on fedora):
cd /var/lib/jenkins/plugins/ec2/WEB-INF/lib
# mv old jars to /tmp directory
mv cprov* /tmp/
mv kix-* /tmp/
# download the correct JARs
sudo wget '    cprov-jdk15on-1.47.jar'
sudo wget '    kix-jdk15on-1.47.jar'
# restart Jenkins
sudo systemctl restart jenkins

Installing pjproject / pjsip / sipster on Ubuntu 64 bit — April 27, 2014

Installing pjproject / pjsip / sipster on Ubuntu 64 bit

To install pjproject / pjsip / sipster on Ubuntu 64 bit

mkdir ${HOME}/pjsip/
cd ${HOME}/pjsip/
wget “” 
bzip2 -d pjproject-2.2.1.tar.bz2
tar xvf pjproject-2.2.1.tar
sudo apt-get -y install build-essential g++
cd pjproject-2.2.1/
./configure CFLAGS=-fPIC –prefix=${HOME}/pjsip/pj-2.2.1/
make dep
make install
cd ..
sudo apt-get -y install npm
export PKG_CONFIG_PATH=${HOME}/pjsip/pj-2.2.1/lib/pkgconfig/;  npm install sipster
RubyMotion Teacup UISegmentedControl — June 24, 2013

RubyMotion Teacup UISegmentedControl

If you were using RubyMotion and Teacup, and wanted to create a UISegmentedControl, this is a suggestion how to do it.


class ViewController < UIViewController

layout :root do
@male_female = subview( segmentedControl( %w(male female) ), :male_female)

def segmentedControl(items)
segmented_control = UISegmentedControl.alloc.initWithItems(items).tap do |sc|
sc.segmentedControlStyle = UISegmentedControlStyleBar
sc.setTitleTextAttributes(Hash[UITextAttributeFont, UIFont.fontWithName(“Century Gothic”, size:13)], forState:UIControlStateNormal)



Enjoy your Tea Cup

[UIDevice currentDevice].orientation vs [UIApplication sharedApplication].statusBarOrientation / Application startup zero — March 21, 2013

[UIDevice currentDevice].orientation vs [UIApplication sharedApplication].statusBarOrientation / Application startup zero

I have been trying to figure out a combination for using:  [UIDevice currentDevice].orientation vs [UIApplication sharedApplication].statusBarOrientation.

so this is the exact situation:

on application startup: the application is assumed to be portrait, and later if the device is landscape the following function is called


And I also noticed that: [UIApplication sharedApplication].statusBarOrientation is only reliable on startup and  is not reliable during runtime.

So this is the recipe I figured out to reliably determine the device orientation:

this long code is work arround for problem
iPad default behavior is app starts up as portrait, and later (if needed) rotate by calling didRotate ...,
[UIDevice currentDevice].orientation's value is zero on application startup
[UIApplication sharedApplication].statusBarOrientation is slow , and not reliable during application runtime.

NSUInteger o = [UIDevice currentDevice].orientation; /*SAMT */
if (o == 0 /* Unkown */ || o > 4 /* 5 is flat, face up,6 flat, face down */ ) {
          o = [UIApplication sharedApplication].statusBarOrientation;

if ( UIInterfaceOrientationIsLandscape( o)){    // and you continue from here.



Good Luck

cocos2d-x 2 cocosbuilder 2.1 — October 10, 2012

cocos2d-x 2 cocosbuilder 2.1

cocos2d-x is the c++ port of cocos2d.

cocos2dbuilder is a tool for graphically laying out cocos2d/ cocos2d-x sprites

cocos2d-x 2 and cocosbuilder 2.1 are almost released, finding sample codes is not easy.

You need to download cocos2d-x 2 and install the XCode templates, you don’t need to import any other files to run cocosbuilder 2.1 ccbi files. as the default cocos2d-x 2 templates includes the necessary files in the extension (CCBReader)

Please note that cocos2d-x can’t read archive zip files (AFAIK), so you need to uncheck (publish to zip file) in cocosbuilder project settings

I will post some of the  common uses a programmer will need.

First Scene:

To load your first scene as a  cocosbuilder scene: go to file AppDelegate.m

include the following header files at the top of the file :

#include "CCBReader.h"
#include "CCNodeLoaderLibrary.h"

and go to the end of function: applicationDidFinishLaunching()

replace the following lines:

// create a scene. it's an autorelease object
CCScene *pScene = HelloWorld::scene();


cocos2d::extension::CCNodeLoaderLibrary * ccNodeLoaderLibrary = cocos2d::extension::CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary();
cocos2d::extension::CCBReader * ccbReader = new cocos2d::extension::CCBReader(ccNodeLoaderLibrary);
CCNode * node = ccbReader->readNodeGraphFromFile("welcome.ccbi");
CCScene * scene = CCScene::create();
if(node != NULL) {
// run


Relading a ccbi file:

If you have edited a ccb file, and you need to make sure to notify XCode to add/load/refresh/reload the new ccbi file with the new build, do the following:

  1. Delete the old ccbi file, from the file system (the file xcode has).
  2. Publish the ccbi again
  3. build and run,

and hopefully you will get the new ccbi file loaded.

Clickable UIScrollView / Detect Single Tap — February 2, 2012

Clickable UIScrollView / Detect Single Tap

This post is based on the nice work of John Muchow

If you need to detect a click / tap on the UIScrollView and also change the value/position of the scroll cursor, and make the selector target method respond to it:

Subclass UIScrollView

@interface AppScrollView : UIScrollView


AppScrollView Implementation

#import "AppScrollView.h"

@implementation AppScrollView

- (id)initWithFrame:(CGRect)frame
return [super initWithFrame:frame];

- (void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event
// If not dragging, send event to next responder
if (!self.isTracking) {
[self.nextResponder touchesEnded:touches withEvent:event];
UITouch *tch = [[touches allObjects] objectAtIndex:0];
float p = ([tch locationInView:self].x / self.frame.size.width);
float newValue = (p * self.maximumValue );
[self setValue:newValue animated:YES];
[self sendActionsForControlEvents:UIControlEventValueChanged];

[super touchesEnded: touches withEvent: event];

Linux X11 Mac Os Lion natural scroll style — January 12, 2012

Linux X11 Mac Os Lion natural scroll style

If you are using Linux, and would like it to scroll like Mac OS Lion , “naturtal scroll”
that is how it is done:

xinput set-button-map $(xinput list | egrep "slave.*pointer" | grep -v XTEST | sed -e 's/^.*id=//' -e 's/\s.*$//' ) 1 2 3 5 4 6 7

If you are using KDE, you can create an autostart file:

don’t forget to give it right file permissions
chmod +755 ${HOME}/.kde/Autostart/reverse.scroll