Compiling Flex Classes in Flash CS3

Yes it is possible and these folks here have found out a way to do it:

http://labs.qi-ideas.com/2007/12/25/using-flex-compiled-code-within-flash/

So happy happy happy…….

Simple. Logical of course the classes are available because of the way flash works. I was going to spend two days rewriting the friggin rpc classes!! Very interesting stuff they’re doing over there….

Posted in Flash, Flex | Tagged , , | Leave a comment

Firefox Search Plugin Localization

Are you also living in a forreign country and want your firefox search results to return in english?

Alter the Firefox.app/Contents/MacOS/searchplugins/google.xml simply so that all the URLs within the XML file point to www.google.co.uk!!

This has been driving me crazy and is so easy to fix!

Posted in Efficiency | Tagged , , | Leave a comment

Apache Virtual Hosts iTunes and cant connect to port 0.0.0.0:80

I recently attempted to install Apache webserver for local development and had a tough time getting it to start as it couldnt connect to port 80 on localhost. I found out that the problem was iTunes and all the stupid services it installs. somehow iTunes had taken over my port 80 on 127.0.0.1. so before sarting Apache you need to go into task manager and stop all the pesky apple services!! Anyway so the process for installing and configurig Apache for Virtual Host names on IIS goes as follows:

1) Make sure all iTunes services have stopped

2) Install Apache choosing localhost as your domain names and admin@localhost for your server name and use default settings for every thing else.

3) change the following in the httpd.conf file :

#LoadModule vhost_alias_module modules/mod_vhost_alias.so

to

LoadModule vhost_alias_module modules/mod_vhost_alias.so

and


# Virtual hosts
# Include conf/extra/httpd-vhosts.conf<span> </span>

to

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

4) For each vhost add the following to the \conf\extra\httpd-vhosts.conf file and delete whatever is there. For a site called tacsite I have done the following:

<VirtualHost *:80>
DocumentRoot "D:\((SERVER))\03 BUILD\TAC 20070906 TAC WEBSITE\source"
ServerName tacsite     ServerAlias tacsite
</VirtualHost>
<Directory "D:\((SERVER))\03 BUILD\TAC 20070906 TAC WEBSITE\source">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

5) Then alter your hosts file (C:\\WINDOWS\system32\drivers\etc\hosts) adding the following:

127.0.0.1       tacsite 

6) then point your browser to the following URL: ‘http://tacsite/‘ or as I do simply type ‘tacsite‘ into mozilla!

Posted in Apache | Tagged , , , | Leave a comment

SEO and Flash

I have been doing a bit of research on the subject of SEO accessibility and full flash websites and have put together a few responses on common queries or concerns regarding the subject:

  1. Flash can not be indexed by google using flash is bad for SEO.
  2. Users cannot click the back button in a flash site
  3. Users cannot directly link into a content page on a flash only site

In response I have put together a couple of guidelines:

  1. Prepare a CMS serving content to two different output templates one for flash one for html. Serve flash using SWFObject within every html page of content into the div that contains the html content. Representatives from Google have said that whilst this method can draw attention since it is open to being exploited, so long as the content is identical to the site content should not be considered as cloaking and should not be penalised.
  2. Serving the Flash on every page is done so that should a user click a link in google the website will load up the web page should inject a flash var to the swf as well so that the swf can redirect to the correct content.
  3. Deeplinking can be accomplished by writing an anchor to the url that is relavent to the page or by using SWFAddress
  4. Another way of creating permanent links to content is to have a link to this page link which displays the link url (cf google maps). This method is considered a little safer appending an anchor esp due to bugs within ie although browser history will be compromised.
  5. A last homebrew method for creating browser history is to add an iframe to the page and mirror page changes with the iframe this is the method that Flex uses withi its history template.
Posted in Flash | Tagged , , , | Leave a comment

Bash Scripting a new SVN Repository with Plesk API

I have recently found myself trying to automate setting up SVN repositories for my projects via shell scripts and thought I would share how I did it. I needed a script that would create a new SVN repository linked to a global user and password file. Since I was already using plesk I needed it to be compatible. Here’s how you do it:

Create your shell script

Open up your favorite editor and lets create the following script I called mine svncreate:


#!/bin/bash
set -e

This bit is just for telling our shell to use bash as opposed to any other scripting languages. The set -e bit is making our script exit if any command returns an error.

Check your script input


# Check user input
SUBDOMAIN=$1
DOMAIN=$2
SUBDOMAINPATH=/var/www/vhosts/$DOMAIN/subdomains/$SUBDOMAIN
if [ -z $SUBDOMAIN ] || [ -z $DOMAIN ]; then
	echo invalid input
	exit
fi

We then accept the command line input parameters ($1,$2 etc.) and turn them into variables with meaningfull names. This is not really necessary although it is something I like to do as it makes the code easier to read later on which is important. The if statement is there to check if the input strings are both not null.

Report to the user


# Report to the user
echo
echo -e "    subdomain:   $SUBDOMAIN"
echo -e "       domain:   $DOMAIN"
echo -e " repolocation:   http://$1.$2"
echo -e "disk location:   $SUBDOMAINPATH/svn/"
echo
echo -e "Are you sure? (y/n) \c "
read confirm
if [ "$confirm" != "y" ] && [ "$confirm" != "Y" ]; then
	exit
fi

This section just presents a little report stating what the script is going to do and asks for a y or n answer. if the user doesnt enter y or Y the script will exit

Create a subdomain using the Plesk CLI


# Create subdomain in plesk
echo -e "Creating subdomain."
cd '/usr/local/psa/bin/'
./subdomain --create $SUBDOMAIN -domain $DOMAIN
echo -e "Finished Creating Subdomain."

This part of the script creates the subdomain in plesk. First we change our working directory to the CLI folder in Plesk. Then we run the subdomain command which creates the subdomain passing in the relavent user input from the commandline script call. The echo statements let us know where we are in the code execution.

Create the SVN Repo


# Create SVN Repo
echo -e "Creating SVN Repo."
svnadmin create $SUBDOMAINPATH/svn
chown -R apache:apache $SUBDOMAINPATH/svn

Here we create an svn repo with the svn admin tool within the subdomain path folder under a folder called svn. We then set the folders permissions so that apache can read and write to it.

Link the Apache domain to the SVN Repo


# Create Apache config file
cd $SUBDOMAINPATH/conf
cat > vhost.conf << EOF
<Location />
    DAV svn
    SVNPath $SUBDOMAINPATH/svn
    AuthType Basic
    AuthName "Subversion Repository"
    AuthUserFile /etc/svn-auth-file
    Require valid-user
</Location>
EOF

We then create the apache config file within the conf folder of the plesk domain by using the cat unix tool here we are piping the output of cat into a file called vhost.conf. Plesk uses this file to create Apache include files within the domain settings.

The Location directive here is telling Apache to connect to the SVN repository located at $SUBDOMAINPATH/svn as well as the auth file I had set up before at /etc/svn-auth-file which simply contains the login credentials of my SVN user.

Reconfigure apache to accept the new settings


# Reconfigure the host to accept new settings
/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=$DOMAIN
echo -e "Finished Creating SVN Repo."

Here we are simply telling plesk to accept the configuration and create the include files.

Uploading the script

The whole script should look something like this:

#!/bin/bash
set -e

# Check user input
SUBDOMAIN=$1
DOMAIN=$2
SUBDOMAINPATH=/var/www/vhosts/$DOMAIN/subdomains/$SUBDOMAIN
if [ -z $SUBDOMAIN ] || [ -z $DOMAIN ]; then
	echo invalid input
	exit
fi

# Report to the user
echo
echo -e "    subdomain:   $SUBDOMAIN"
echo -e "       domain:   $DOMAIN"
echo -e " repolocation:   http://$1.$2"
echo -e "disk location:   $SUBDOMAINPATH/svn/"
echo
echo -e "Are you sure? (y/n) \c "
read confirm
if [ "$confirm" != "y" ] && [ "$confirm" != "Y" ]; then
	exit
fi

# Create subdomain in plesk
echo -e "Creating subdomain."
cd '/usr/local/psa/bin/'
./subdomain --create $SUBDOMAIN -domain $DOMAIN
echo -e "Finished Creating Subdomain."

# Create SVN Repo
echo -e "Creating SVN Repo."
svnadmin create $SUBDOMAINPATH/svn
chown -R apache:apache $SUBDOMAINPATH/svn

# Create Apache config file
cd $SUBDOMAINPATH/conf
cat > vhost.conf << EOF
<Location />
  DAV svn
  SVNPath $SUBDOMAINPATH/svn
  AuthType Basic
  AuthName "Subversion Repository"
  AuthUserFile /etc/svn-auth-file
  Require valid-user
</Location>
EOF

# Reconfigure the host to accept new settings
/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=$DOMAIN
echo -e "Finished Creating SVN Repo."

Upload the script to your /root/bin folder under the filename svncreate and then run the following:

chmod 755 /root/bin/svncreate

Running the script

Now we have the script created we can run it if all is set up correctly we should see the following when we run it:

[root@server ~]# svncreate svn1 mydomain.net

    subdomain:   svn1
       domain:   mydomain.net
 repolocation:   http://svn1.mydomain.net
disk location:   /var/www/vhosts/mydomain.net/subdomains/svn1/svn/

Are you sure? (y/n) y
Creating subdomain.
SUCCESS: Creation of subdomain 'svn1' complete.
Finished Creating Subdomain.
Creating SVN Repo.
Finished Creating SVN Repo.
[root@server ~]#
Posted in Server Admin | Tagged , , , , | Leave a comment