Translator
Categories
Archives

Flash Compile Error 1126

1126: Function does not have a body.

This error typically means that you have a misplaced semi-colon, usually at the end of a function name declaration.

function foo() : void;
{
	/*function content*/
}

Flash Compile Error 1042

1042: The this keyword can not be used in static methods. It can only be used in instance methods, function closures, and global code.

This typically means you are using the reserved word ‘this’ inside of a class file, but do not have it within the curly braces of a function. If you wish, you can double-click the error to see the offending line of code. Be careful to verify that the keyword ‘this’ is after the opening ‘{‘ and before the closing ‘}’ of a function. If the ‘this’ keyword exists in a ’static’ function, error 1040 will be thrown. If you’re also getting flash compile error 1126 (1126: Function does not have a body.), you will need to correct that error first. Usually error 1126 is related to a misplaced semi-colon.

iPhone App Review: Gowalla

I’ve decided to put together an occasional iPhone app review. This is the first, so hang in there, hopefully they will improve over time.

Gowalla is one of the most interesting apps I have seen on the iPhone to date. It has single handedly held my attention for the last two days straight.

The concept is simple:
1) Share your experiences through Gowalla with your Facebook & Twitter friends
2) Stamp your passport and earn rewards at the places that you visit
3) Discover and create locations anywhere in the world with your iPhone

I would review this app as iPhone crack… if you don’t want to be totally addicted, this app isn’t for you.

[Read More]
[Download Gowalla]

Improve the SEO of your website in one step

Search Engine Optimization (SEO) is a hot topic these days. In an ailing economy, free website traffic is becoming much more important and the competition is more fierce than ever! There are many things that you could probably improve about your website that would eventually lead to improved website SEO, but there is one very important thing that is often overlooked.

If your website does not redirect the www and non-www version of your website to the same www or non-www url, you are not maximizing the SEO capabilities of your website. For example, if you visit http://noobflash.com, you will see that the url immediately redirects to http://www.noobflash.com. If this is not done, search engines will consider the www and non-www versions of your website url as two separate websites. As you can imagine, this can damage your SEO efforts greatly! It’s up for debate as to whether www or no-www is best, but most people agree that is really comes down to personal preference. I decided to stick with the traditional www, but many of you may not like that for your website.

Luckily, the Noob is here to help you get out of this mess! I will walk you through two different ways of fixing this issue. Both options can be configured to use either www or no-www.

Option 1 – PHP 301 Redirect
This option will obviously only work if you use PHP, but you could take the same concept and apply it to any programming language. This option also redirects http://www.yourwebsite.com/index.php to http://www.yourwebsite.com/, which is another good idea.

<?php
        // SET THIS TO THE URL THAT YOU WANT TO USE (with or without www)
	$url = 'http://www.yourwebsite.com';

	if ( $_SERVER['REQUEST_URI'] == str_replace('http://' . $_SERVER['HTTP_HOST'], '', $url.'/index.php' )) {
		header('HTTP/1.1 301 Moved Permanently');
		header('Location: '.$url);
		exit();
	}

	if ( strpos($_SERVER['HTTP_HOST'], 'www.') === 0  && strpos($url, 'http://www.') === false ) {
		header('HTTP/1.1 301 Moved Permanently');
		header('Location: http://' . substr($_SERVER['HTTP_HOST'], 4) . $_SERVER['REQUEST_URI']);
		exit();
	} elseif ( strpos($_SERVER['HTTP_HOST'], 'www.') !== 0 && strpos($url, 'http://www.') === 0 ) {
		header('HTTP/1.1 301 Moved Permanently');
		header('Location: http://www.' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
		exit();
	}
?>

Option 2 – .htaccess URL rewrite
This option uses .htaccess to rewrite your website url. Many consider this a better option from a performance standpoint, but I can’t see enough of a difference to say if I agree.

301 Redirect to url with no www
RewriteEngine on

RewriteCond %{HTTP_HOST} ^www.yourwebsite.com$ [NC]
RewriteRule ^(.*)$ http://yourwebsite.com/$1 [R=301,L]

301 Redirect to url with www
RewriteEngine on

RewriteCond %{HTTP_HOST} ^yourwebsite.com$ [NC]
RewriteRule ^(.*)$ http://www.yourwebsite.com/$1 [R=301,L]

Create SEO Friendly URLs

If you’re like me, you get tired of seeing those ugly query strings tacked onto your website url. On really nice (and easy) solution for this is to use Apache Mod_Rewrite. This generally only requires adding a few lines to your .htaccess file. When I started trying to create my first SEO friendly URLs, I could not get my website to recognize any of the code in my .htaccess file. Obviously, this is was very frustrating. After a couple of weeks of searching the internet and wondering why my “perfect” code wasn’t working, I realized that my GoDaddy PHP hosting account was being hosted on a Windows server running IIS7. The answer to my problems hit me like a ton of bricks! Windows does not support or use .htaccess files! Once I switched to a Linux server my .htaccess code ran perfectly.

The code below will internally redirect http://www.yoururl.com/location/texas/dallas to http://www.yoururl.com/index.php?state=texas&city=dallas. The SEO friendly URL will be displayed but the page will be executed as if the complete, query string laden url was used.

The [L] at the end of each line tells the server to stop executing the .htaccess code if the previous line was successful.

Options +FollowSymLinks
Options -MultiViews
RewriteEngine on

RewriteRule ^location/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ index.php?state=$1&city=$2 [L]
RewriteRule ^location/([a-zA-Z0-9_-]+) index.php?state=$1 [L]

For More Apache Mod_Rewrite rules, check out the Apache Rewrite Cheatsheet.