Adobe Updater Crashes on Mac OS X and a Fix (CS3)

Everytime I reinstall my mac I have to go find this. I’m guessing I’m not the only one. Just paste this into a terminal window and updater should return to a functional state.

sudo /Applications/Utilities/Adobe\ Utilities.localized/Adobe\ Updater5/Adobe\ Updater.app/Contents/MacOS/Adobe\ Updater

cocos2d Transition Issues – ” undeclared (first use in this function)

Just a short post. I was trying to get a simple transition working using some code similar to below this:

[[Director sharedDirector] replaceScene:[RotoZoomTransition transitionWithDuration:1.0 scene:[PlayScene node]]];

Oddly enough I was getting an error:

'RotoZoomTransition' undeclared (first use in this function)

Although it was really quite obvious, I didn’t see the issue and on searching the net I didn’t find much. Eventually I clicked that I was just not reading the error very carefully. Looking at transitions.h I quickly realized the names of the classes were now different.

The transition classes were renamed:
Old <–> New
CCXXXTransition <–> CCTransitionXXX
Example
CCFadeTransition <–> CCTransitionFade

Just figured I would put it out there for anyone else who is missing the obvious 😉 For more information have a look here:
http://www.cocos2d-iphone.org/wiki/doku.php/release_notes:0_99_5

cocos2d – Basic Menu

I figure I will start off with something nice and simple. All apps need a menu and games are of course no different. With cocos2d is is fairly simple to create a menu.

I’m going to presume you already have cocos2d installed and the templates installed. You are going to need at least two images, a button-up state image and a button-down state image. You could also create “-hd” versions of these for the iPhone 4.

1. Start off by creating a new cocos2d application.

2. Add your button-up and button-down images to the resources by dragging them into it. Copy them to your project.

3, Find the HelloWorldScene.m file and the remove the code between the if statements

// on "init" you need to initialize your instance
-(id) init
{
	// always call "super" init
	// Apple recommends to re-assign "self" with the "super" return value
	if( (self=[super init] )) {
		
		// create and initialize a Label
		CCLabelTTF *label = [CCLabelTTF labelWithString:@"Hello World" fontName:@"Marker Felt" fontSize:64];

		// ask director the 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];
	}
	return self;
}

Becomes

// on "init" you need to initialize your instance
-(id) init
{
	// always call "super" init
	// Apple recommends to re-assign "self" with the "super" return value
	if( (self=[super init] )) {
	}
	return self;
}

4. Add you menu items. These will be CCMenuItemImage items.

CCMenuItemImage *item1 = [CCMenuItemImage itemFromNormalImage:@"item1.png" selectedImage:@"item1Down.png" target:self selector:@selector(menuAction1:)];	
CMenuItemImage *item2 = [CCMenuItemImage itemFromNormalImage:@"item2.png" selectedImage:@"item2Down.png" target:self selector:@selector(menuAction2:)];	

The code is here is fairly self explanatory. Substituting your image names for me add this code between the if statement in the init method. “menuAction1” and “menuAction2” are methods that are called one touching the menu item

5. Create the menu
Add the after the code you added above.

CCMenu *menu = [CCMenu menuWithItems:item1, item2, nil];
[menu alignItemsVertically];

6. Add the menu to the scene

[self addChild: menu];

7. FInally you need to add the event methods to .h and .m files
.m

-(void) menuAction1: (id) sender
{
// do something
}
-(void) menuAction2: (id) sender
{
// do something
}
.h
-(void) menuAction1:(id) sender;
-(void) menuAction2:(id) sender;

And that’s about all there is to it.

I know this is a little breif, so feel free to ask if you have any questions. I will try make my future posts more detailed if time permits.

cocos2d for iPhone

I’ve spent quite a bit of time looking into different 2d and 3d engines. I came across Cocos2d a while back but have only recently started playing around with it. It’s very nice and well supported. The forum is active and the developers are active. All good things IMO.

“cocos2d for iPhone is a framework for building 2D games, demos, and other graphical/interactive applications. It is based on the cocos2d design: it uses the same concepts, but instead of using python it uses objective-c.”

So far it seems very well thought out and well documented. Well worth a look if your doing 2d games on iOS.

http://www.cocos2d-iphone.org/about

I will post some tutorials on using it soon 😉

Selenium IDE – Automated testing of websites

Someone at work came across Selenium IDE. It is a nice little add-on for Firefox for testing websites. It allows you to script out tests and run them. Seems pretty powerful for a free tool. I’m not going to say a lot since the documentation on there site can do that for me. But if you need something for scripted website testing then this is worth a look.

Documentation found here: http://seleniumhq.org/docs/03_selenium_ide.html

The plug-in is based on Selenium Core which is a DHTML test execution framework. There are all sorts of nice things built from and around this framework, allowing everything from browser based testing too integration with unit tests.

Worth a look anyway.

http://seleniumhq.org/projects/core/

“FREE” WordPress Themes – Base 64 encoded footer

I was looking at some free WordPress themes today for a little project I’m working on. I’m fairly careful about what I run on my servers so I checked through the source quickly before even considering looking at them. It is amazing how many of these “Free” themes contain links to interesting places and other interesting things like Base 64 encoded sections.  Most of the time these sections are harmless but there is no way I’m going to run something on my server until I have seen what it’s doing.

Example:

eval(base64_decode('Pz4gPC9kaXY+IA0KPGRpdiBpZD0iZm9vdGVyIj4gDQogIDw/cGhwIHdwX2Zvb3RlcigpOyA/Pg0KICA8ZGl2PiAmIzE2OTsgPD9waHAgZWNobyBkYXRlKCdZJyk7ID8+IA0KICAgIDw/cGhwIGJsb2dpbmZvKCduYW1lJyk7ID8+DQogICAgICA8P3BocCBpZihpc19ob21lKCkpIDogPz48YSBocmVmPSJodHRwOi8vMWFjbmVtZWRpY2F0aW9uLmNvbS8iIHRpdGxlPSJBY25lIHRyZWF0bWVudCAiPkFjbmUgdHJlYXRtZW50IDwvYT48P3BocCBlbmRpZjsgPz4NCg0KICAgIDxkaXY+PC9kaXY+IA0KICAgIDw/cGhwIHdwX2xvZ2lub3V0KCk7ID8+IC4gDQogICAgPD9waHAgd3BfcmVnaXN0ZXIoJycsICcgLicpOyA/Pg0KCTw/cGhwIGVjaG8gZ2V0X251bV9xdWVyaWVzKCk7ID8+IHF1ZXJpZXMuIDw/cGhwIHRpbWVyX3N0b3AoMSk7ID8+IHNlY29uZHMuDQogIDwvZGl2Pg0KPC9kaXY+DQo8L2JvZHk+DQo8L2h0bWw+DQogPD8='));

So I had to work out how to rid myself of these things and thought others might like to know where to find information on how to do the same. The FAQ, How to get rid of encoding in a theme’s footer? explains how to get rid of that coding but also has links to topics that will help you.

I personally found the following site very useful though: http://home2.paulschou.net/tools/xlate/ just past the coding in there and play around 😉

More on redirecting with Mod_Rewrite

So it’s all well and good to redirect from one domain to another but how about redirecting to a directory?

I use shared hosting and host 3-4 domains on the same hosting account. To be nice and tidy I like to keep each site in a separate sub folder. There are a few ways I could do this obviously. I could use PHP and do something like the following:

$SiteNameURL = $_SERVER['HTTP_HOST'];
switch (strtolower($SiteNameURL)) {
case "domain.com": //MUST BE LOWER CASE
            header("Location: http://" . $_SERVER['HTTP_HOST'] . "/folder/");
            break;
case "www.domain.com": //MUST BE LOWER CASE
            header("Location: http://" . $_SERVER['HTTP_HOST'] . "/folder/");
            break;
}

But that is rather ugly and it would be nice to keep all the redirecting in one place.
This is what I came up with:

#Turns the rewrite engine on.
RewriteEngine on

#Fix missing trailing slash character on folders.
RewriteRule ^([^.?]+[^.?/])$ $1/ [R,L]

#www.domain.com and domain.com will map to the folder {root}/folder1/
RewriteCond %{HTTP:Host} ^(?:www\.)?domain\.com$
RewriteCond %{REQUEST_URI} !^/folder1/
RewriteRule ^(.*) folder1/$1 [NC,L,NS]

There is a little bit of regex involved but if you step through line by line it’s really fairly simple. Of course the last 4 lines are what matters for me. I added them to my “.htaccess” file from my first post on Mod_rewrite.

Redirecting from one domain to another domain with Mod_Rewrite

Lets get started with some of the things I’m doing while I setup this site and a few others I’m working on. First thing I needed to do was redirect a few domains elsewhere as this shared web hosting is used for some domains I look after for someone else. I can’t be bothered getting the DNS changed so to so I’m going to use mod_rewrite to redirect to the domain that is in use.

So here is what I found.

So if you need to change an existing website to another domain name your web server is using Apache HTTP Server then you can use the mod_rewrite module to do the task. I used something along the lines of the following code:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^OldDomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.OldDomain.com$
RewriteRule ^(.*)$ http://www.NewDomain.com/$1 [R=301,L]

Add this to the existing “.htaccess” file or add a new“.htaccess” file in your OldDomain‘s web root folder(example: /public_html/).

Done! Now all visitors to OldDomain.com(regardless the path) will auto redirected to NewDomain.com(with appending path).

For those of you who don’t want to fiddle with the “.htaccess” file you could just use PHP as follows:

$SiteNameURL = $_SERVER['HTTP_HOST'];

switch (strtolower($SiteNameURL)) {

case "domain.com": //MUST BE LOWER CASE
            include 'page1.php';
            break;
case "www.domain.com": //MUST BE LOWER CASE
            include 'page1.php';
            break;
case "yourotherdomain.com": //MUST BE LOWER CASE
            include 'page2.php';
            break;
case "www.yourotherdomain.com": //MUST BE LOWER CASE
            include 'page2.php';
            break;
default:
            include 'other.php';
}
Exit mobile version