.htaccess, mod rewrite and forward slashes

we had forward slashes in our user-generated URLs that caused 404 errors.

e.g. http://domain.com/products/Prom%2FHomecoming+dress

after several g searches we were able to piece it together. recent releases of apache allow sys admin’s to use allowencodedslashes for each virtual host. thing is it can’t be added to .htaccess like so:

Allowencodedslashes on

http://serverfault.com/questions/295664/mod-rewrite-not-working-with-url-encoded-values

It needs to be added to Apache as a VirtualHost definition. Lovely, how do we do that? Well, we found this:

http://www.karlrixon.co.uk/writing/editing-virtualhost-settings-in-whm-cpanel/

Putting all these pieces together fixed this issue.

Posted in Apache, SEO | Leave a comment

flex 4, air – close all child windows when parent window is closed

parentWindow.mxml
<?xml version="1.0"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
width="100%" height="100%"
closing="_closingHandler(event)">
<fx:Script>
<![CDATA[
private function _closingHandler(event:Event):void
{
var openedWindows:Array = nativeApplication.openedWindows;
var i:uint;
var count:uint = openedWindows.length;
for(i; i < count; i++)
{
openedWindows[i].close();
}
}
]]>
</fx:Script>
</s:WindowedApplication>

childWindow.mxml
<?xml version="1.0"?>
<s:Window xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
width="300" height="300">
<s:Label text="Test Window" />
</s:Window>

Posted in Adobe AIR, AS3, Flex 4 | Leave a comment

as3, AIR control video stream volume using a slider

to control a video stream’s sound try the following:

function volumeCntrl_changeHandler(event:Event):void
{
SoundMixer.soundTransform = new SoundTransform(volumeCntrl.value);
}

<s:VSlider x=”387″ y=”72″ height=”178″ id=”volumeCntrl” minimum=”0″ maximum=”1″ stepSize=”.1″ change=”volumeCntrl_changeHandler(event)”/>

Posted in Adobe AIR, AS3, Flex 4 | Leave a comment

Change Facebook Share title, summary, url, and image

We found this tutorial to be the best:

http://www.daddydesign.com/wordpress/how-to-create-a-custom-facebook-share-button-for-your-iframe-tab/

Posted in Facebook | Leave a comment

actionscript socket data and no response from socket server

sending btye arrays to and from the client/server via actionscript’s socket class may not return a result from the server.

the issue is when sending data to the server it must have the \r\n at the end of the string.

socket.writeUTFBytes(username.text + password.text + "\r\n");

Posted in Actionscript | Leave a comment

div clear

the div style=clear is the same as a html br tag.

Posted in CSS, HTML | Leave a comment

cannot login to linux server via ssh

we knew the hostname, username, password, port, etc. we’re all correct. they had been working just fine. then one day putty and ftp via ssh stopped working.

the culprit is fork bomb protection. to fix we had to increase the number of processes each user could run. to do this we added the following to etc -> security -> limits.conf as root

user1 soft nproc 40
user2 soft nproc 40

after making the updates we restarted the service that controlled the most processes.

Posted in Apache, FTP, Linux, Putty, SMTP, SSH | Leave a comment

debug: print_r, fb(), and mail()

you can read about how we debug using print_r and fb().

here is another way we debug our PHP code:

mail("blah@blah.com","subject",print_r($aVariable,true),"from:system@blah.com");

Posted in Firephp, PHP | Leave a comment

mysql, select in, join()

we needed to use SELECT first_name FROM tbl_users WHERE city IN (‘chicago’,'new york’). chicago,new york was a comma delimited string with no spaces and no single quotes. we used join() to add the single quotes.

$sql = "SELECT city FROM tbl_city WHERE city_name ='".$_POST['city_name']."' AND active = 'Y'";
$result = dbQuery($sql);
$row = dbFetchAssoc($result);
$explode_city = explode(",",$row['city']);
$ids = join("','",$explode_city );
$sql2 = "SELECT first_name FROM tbl_users WHERE city IN ('".$ids."')";

Posted in MySQL, PHP | Leave a comment

IE border around image

if you see an image border in internet explorer, set border=”0″ in img tag.

image src=”blah.png” border=”0″

Posted in CSS, HTML | Leave a comment