Monday, December 21, 2009

PHP - How to generate a unique id

code:

function generateUniqueID() {
return strtoupper(md5(uniqid(rand(),true)));
}

Thursday, November 19, 2009

AS3 ExternalInterface | How to use ExternalInterface in AS3 | javascript to call function in flash using ExternalInterface

With ExternalInterface function in AS3, we can call javascript functions that are outside flash and vice versa.


code (flash):


//we can set a callback to our function in flash to enable javascript function to call it
if (ExternalInterface.available) {
ExternalInterface.addCallback("send_from_external", send_from_external);
}
function send_from_external(newText) {
trace(newText);
}

//to call a javascript function from flash
if (ExternalInterface.available) {
ExternalInterface.call("updateMsg", "your string");
}


code (html):

<script language="JavaScript">
function getFlashId(idIe, idMoz) {
var isIE = navigator.appName.indexOf("Microsoft") != -1;
return (isIE) ? idIe : idMoz;
}
function send_message() {
$("#txt_area").attr("disabled", "disabled");
getFlashMovie(getFlashId("swfObject", "swfEmbed")).send_from_external("test_string"); //trigger function inside flash
}
function updateMsg(string) {
alert(string); //from flash
}
</script>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id="swfObject"
width="1"
height="1"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">
<param name="movie" value="test.swf" />
<param name="quality" value="low" />
<param name="allowScriptAccess" value="always" />
<param name="flashVars" value="" />
<embed id="swfEmbed"
src="test.swf"
quality="low"
width="1"
height="1"
name="ExternalInterfaceExample"
align="middle"
play="true"
loop="false"
quality="high"
allowScriptAccess="always"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer"
flashVars="">
</embed>
</object>

Wednesday, November 11, 2009

AS3 LocalConnection | local connection between flash | flash internal connection

Here're the basic structure to simple LocalConnection for flash as3. LocalConnection is used when you want to connect 2 or more swf in a pc to exchange data.

To receive:

//receive
var receivingLC:LocalConnection;
receivingLC = new LocalConnection();
receivingLC.client = this;
receivingLC.connect('session_name');

function myMethod(textRecieved:String){
//do your things
}


To send:

//sending
var sendingLC:LocalConnection;
sendingLC = new LocalConnection();
sendingLC.send('message_input', 'myMethod', "test");
sendingLC.addEventListener(StatusEvent.STATUS, onStatus);

function onStatus(event:StatusEvent){
switch (event.level) {
case "error":
trace("LocalConnection.send() failed");
break;
case "status":
trace("LocalConnection.send() succeeded");
break;
default:break;
}
}

Wednesday, October 28, 2009

AS3 simple email validation check

function checkMail(pmail:String) {
if (! (pmail.lastIndexOf(".") <= pmail.indexOf("@") || pmail.indexOf("@")==-1)) {
return true;
} else {
return false;
}
}

Tuesday, October 27, 2009

Monday, September 28, 2009

AS3 Socket Connection

This example shows how to successfully connect flash to your ftp server..

var s:Socket = new Socket("YOUR_SERVER", 21);
s.addEventListener(ProgressEvent.SOCKET_DATA, sData);

function sData(e:ProgressEvent):void
{
var d:String = s.readUTFBytes(s.bytesAvailable);
trace(d);
if(d.indexOf("+OK Hello there") != -1)
s.writeUTFBytes("USERNAME\n");
if(d.indexOf("+OK Password required.") != -1)
s.writeUTFBytes("PASSWORD\n");
if(d.indexOf("+OK logged in.") != -1)
s.writeUTFBytes("STAT\n");
s.flush();
}

Tuesday, July 21, 2009

How to impliment fullscreen flash html in browser

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<title></title>
<style type="text/css">
body {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}
body {
background-color: #000000;
}
</style>
<script language="JavaScript" type="text/javascript">
<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 10;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Revision of Flash required
var requiredRevision = 0;
// the version of javascript supported
var jsVersion = 1.0;
// -----------------------------------------------------------------------------
// -->
</script>
<script language="VBScript" type="text/vbscript">
<!-- // Visual basic helper required to detect Flash Player ActiveX control version information
Function VBGetSwfVer(i)
on error resume next
Dim swControl, swVersion
swVersion = 0

set swControl = CreateObject("ShockwaveFlash.ShockwaveFlash." + CStr(i))
if (IsObject(swControl)) then
swVersion = swControl.GetVariable("$version")
end if
VBGetSwfVer = swVersion
End Function
// -->
</script>
<script language="JavaScript1.1" type="text/javascript">
<!-- // Detect Client Browser type
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
jsVersion = 1.1;
// JavaScript helper required to detect Flash Player PlugIn version information
function JSGetSwfVer(i){
// NS/Opera version >= 3 check for Flash plugin in plugin array
if (navigator.plugins != null && navigator.plugins.length > 0) {
if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
descArray = flashDescription.split(" ");
tempArrayMajor = descArray[2].split(".");
versionMajor = tempArrayMajor[0];
versionMinor = tempArrayMajor[1];
if ( descArray[3] != "" ) {
tempArrayMinor = descArray[3].split("r");
} else {
tempArrayMinor = descArray[4].split("r");
}
versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
} else {
flashVer = -1;
}
}
// MSN/WebTV 2.6 supports Flash 4
else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
// WebTV 2.5 supports Flash 3
else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
// older WebTV supports Flash 2
else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
// Can't detect in all other cases
else {

flashVer = -1;
}
return flashVer;
}
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
reqVer = parseFloat(reqMajorVer + "." + reqRevision);
for (i=25;i>0;i--) {
if (isIE && isWin && !isOpera) {
versionStr = VBGetSwfVer(i);
} else {
versionStr = JSGetSwfVer(i);
}
if (versionStr == -1 ) {
return false;
} else if (versionStr != 0) {
if(isIE && isWin && !isOpera) {
tempArray = versionStr.split(" ");
tempString = tempArray[1];
versionArray = tempString .split(",");
} else {
versionArray = versionStr.split(".");
}
versionMajor = versionArray[0];
versionMinor = versionArray[1];
versionRevision = versionArray[2];

versionString = versionMajor + "." + versionRevision;
versionNum = parseFloat(versionString);

if ( (versionMajor > reqMajorVer) && (versionNum >= reqVer) ) {
return true;
} else {
return ((versionNum >= reqVer && versionMinor >= reqMinorVer) ? true : false );
}
}
}
return (reqVer ? false : 0.0);
}
// -->
</script>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">
<link rel="Shortcut Icon" href="/favicon.ico">
<script language="JavaScript" type="text/javascript">
<!--
var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
if(hasRightVersion) {
var oeTags = '<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">'
+ '<tr>'
+ '<td width="100%" height="100%">'
+ '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
+ 'width="100%" height="100%"'
+ 'codebase="http://get.adobe.com/flashplayer/">'
+ '<param name="movie" value="loader.swf" /><param name="menu" value="false" /><param name="quality" value="high" />'
+ '<embed src="loader.swf" menu="false" quality="high"'
+ 'width="100%" height="100%" name="index" align="middle"'
+ 'play="true"'
+ 'loop="false"'
+ 'quality="high"'
+ 'allowScriptAccess="sameDomain"'
+ 'type="application/x-shockwave-flash"'
+ 'pluginspage="http://get.adobe.com/flashplayer/">'
+ '<\/embed>'
+ '<\/object>'
+'</td>'
+ '<td><div align="center"><img src="html_img/1x600.jpg" width="1" height="600"></div></td>'
+ '</tr>'
+ '<tr>'
+ '<td><div align="center"><img src="html_img/900x1.jpg" width="900" height="1"></div></td>'
+ '<td></td>'
+ '</tr>'
+ '</table>';
document.write(oeTags);
} else {
document.write('This content requires the Macromedia Flash Player.<a href="http://get.adobe.com/flashplayer/">Get Flash Player 10</a>');
}
// -->
</script>
<script type="text/javascript">
objects = document.getElementsByTagName("object");
for (var i = 0; i < objects.length; i++)
{
objects[i].outerHTML = objects[i].outerHTML;
}
</script>
<noscript>
This content requires the Macromedia Flash Player.
<a href="http://www.macromedia.com/go/getflash/">Get Flash</a>
</noscript>
</body>
</html>

Friday, July 3, 2009

PHP - cURL | how login to facebook without going to the site using cURL

1 - Update your Facebook status

Wanna update your facebook status, but don't want to go to facebook.com, login, and finally being able to update your status? Simply save the following code on your server, define the variables, and voilà!

<?PHP
/*******************************
* Facebook Status Updater
* Christian Flickinger
* http://nexdot.net/blog
* April 20, 2007
*******************************/

$status = 'YOUR_STATUS';
$first_name = 'YOUR_FIRST_NAME';
$login_email = 'YOUR_LOGIN_EMAIL';
$login_pass = 'YOUR_PASSWORD';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://login.facebook.com/login.php?m&next=http%3A%2F%2Fm.facebook.com%2Fhome.php');
curl_setopt($ch, CURLOPT_POSTFIELDS,'email='.urlencode($login_email).'&pass='.urlencode($login_pass).'&login=Login');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_COOKIEJAR, "my_cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "my_cookies.txt");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3");
curl_exec($ch);

curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_URL, 'http://m.facebook.com/home.php');
$page = curl_exec($ch);

curl_setopt($ch, CURLOPT_POST, 1);
preg_match('/name="post_form_id" value="(.*)" \/>'.ucfirst($first_name).'/', $page, $form_id);
curl_setopt($ch, CURLOPT_POSTFIELDS,'post_form_id='.$form_id[1].'&status='.urlencode($status).'&update=Update');
curl_setopt($ch, CURLOPT_URL, 'http://m.facebook.com/home.php');
curl_exec($ch);
?>

Source: http://codesnippets.joyent.com/posts/show/1204

2 - Get download speed of your webserver

Do you ever wanted to know the exact download speed of your webserver (or any other?) If yes, you'll love that code. You just have to initialize the $url variable with any resources from the webserver (images, pdf, etc), place the file on your server and point your browser to it. The output will be a full report of download speed.

 $value)
{
printf("%-30s %s\n", $label, $value);
}
?>

Source: http://cowburn.info/2008/11/29/download-speed-php-curl

3 - Myspace login using cURL

<?php

function login( $data, $useragent = 'Mozilla 4.01', $proxy = false ) {
$ch = curl_init();
$hash = crc32( $data['email'].$data['pass'] );
$hash = sprintf( "%u", $hash );
$randnum = $hash.rand( 0, 9999999 );
if( $proxy ) curl_setopt( $ch, CURLOPT_PROXY, $proxy );
curl_setopt( $ch, CURLOPT_COOKIEJAR, '/tmp/cookiejar-'.$randnum );
curl_setopt( $ch, CURLOPT_COOKIEFILE, '/tmp/cookiejar-'.$randnum );
curl_setopt( $ch, CURLOPT_USERAGENT, $useragent );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_POST, 0);
curl_setopt( $ch, CURLOPT_URL, 'http://www.myspace.com' );
$page = curl_exec( $ch );
preg_match( '/MyToken=(.+?)"/i', $page, $token );
if( $token[1] ) {
curl_setopt( $ch, CURLOPT_URL, 'http://login.myspace.com/index.cfm?fuseaction=login.process&MyToken='.$token[1] );
curl_setopt( $ch, CURLOPT_REFERER, 'http://www.myspace.com' );
curl_setopt( $ch, CURLOPT_HTTPHEADER, Array( 'Content-Type: application/x-www-form-urlencoded' ) );
curl_setopt( $ch, CURLOPT_POST, 1 );
$postfields = 'NextPage=&email='.urlencode( $data['mail'] ).'&password='.urlencode( $data['pass'] ).'&loginbutton.x=&loginbutton.y=';
curl_setopt( $ch, CURLOPT_POSTFIELDS, $postfields );
$page = curl_exec( $ch );
if( strpos( $page, 'SignOut' ) !== false ) {
return $randnum;
}
else {
preg_match( '/MyToken=(.+?)"/i', $page, $token );
preg_match( '/replace\("([^\"]+)"/', $page, $redirpage );
if( $token[1] ) {
curl_setopt( $ch, CURLOPT_POST, 0 );
curl_setopt( $ch, CURLOPT_URL, 'http://home.myspace.com/index.cfm?&fuseaction=user&Mytoken='.$token[1] );
$page = curl_exec( $ch );
curl_close( $ch );
if( strpos( $page, 'SignOut' ) !== false ) {
return $randnum;
}
}
elseif( $redirpage[1] ) {
curl_setopt( $ch, CURLOPT_REFERER, 'http://login.myspace.com/index.cfm?fuseaction=login.process&MyToken='.$token[1] );
curl_setopt( $ch, CURLOPT_URL, $redirpage[1] );
curl_setopt( $ch, CURLOPT_POST, 0 );
$page = curl_exec( $ch );
curl_close( $ch );
if( strpos( $page, 'SignOut' ) !== false ) {
return $randnum;
}
}
}
}
return false;
}
?>

Source: http://www.seo-blackhat.com/article/myspace-login-function-php-curl.html

4 - Publish a post on your WordPress blog, using cURL

I know that most of you enjoy WordPress, so here is a nice "hack" as the ones I regulary publish on my other blog WpRecipes.
This function can post on your WordPress blog. You don't need to login to your WP dashboard etc.
Though, you must activate the XMLRPC posting option in your WordPress blog. If this option isn't activated, the code will not be able to insert anything into WordPress database. Another thing, make sure the XMLRPC functions are activated on your php.ini file.

function wpPostXMLRPC($title,$body,$rpcurl,$username,$password,$category,$keywords='',$encoding='UTF-8')
{
$title = htmlentities($title,ENT_NOQUOTES,$encoding);
$keywords = htmlentities($keywords,ENT_NOQUOTES,$encoding);

$content = array(
'title'=>$title,
'description'=>$body,
'mt_allow_comments'=>0, // 1 to allow comments
'mt_allow_pings'=>0, // 1 to allow trackbacks
'post_type'=>'post',
'mt_keywords'=>$keywords,
'categories'=>array($category)
);
$params = array(0,$username,$password,$content,true);
$request = xmlrpc_encode_request('metaWeblog.newPost',$params);
$ch = curl_init();
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_URL, $rpcurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 1);
$results = curl_exec($ch);
curl_close($ch);
return $results;
?>

Source: http://porn-sex-viagra-casino-spam.com/coding/poster-automatiquement-sur-wordpress-avec-php/

5 - Test the existence of a given url

I know, it sounds basic. In fact, it is basic, but it is also very useful, especially when you have to work with external resources.

 

Source: http://www.jellyandcustard.com/2006/05/31/determining-if-a-url-exists-with-curl/

6 - Post comments on WordPress blogs

In a previous article, I have discussed how spammers spams your WordPress blog. To do so, they simply have to fill the $postfields array with the info they want to display and load the page.
Of course, this code is only for educationnal purposes.


Source: http://www.catswhocode.com/blog/how-spammers-spams-your-blog-comments

7 - Follow your Adsense earnings with an RSS reader

Most bloggers uses Adsense on their blog and (try to) make money with Google. This excellent snippet allows you to follow your Adsense earnings...with a RSS reader! Definitely awesome.
(Script too big to be displayed on the blog, click here to preview)
Source: http://planetozh.com/blog/my-projects/track-adsense-earnings-in-rss-feed/

8 - Get feed subscribers count in full text

If you're a blogger, you're probably using the popular FeedBurner service, which allo you to know how many people grabbed your rss feed. Feedburner have a chicklet to proudly display your subscriber count on your blog. I personally like the chicklet's look, but I heard lots of bloggers complaining about it. happilly, cURL can simply grab the count value and return it to you as a variable so you can display it as you want on your blog.

//get cool feedburner count
$whaturl="https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=feedburner-id";

//Initialize the Curl session
$ch = curl_init();

//Set curl to return the data instead of printing it to the browser.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

//Set the URL
curl_setopt($ch, CURLOPT_URL, $whaturl);

//Execute the fetch
$data = curl_exec($ch);

//Close the connection
curl_close($ch);
$xml = new SimpleXMLElement($data);
$fb = $xml->feed->entry['circulation'];
//end get cool feedburner count

Source: http://www.hongkiat.com/blog/display-google-feed-subscriber-count-in-text/

9 - Get the content of a webpage into a PHP variable

This is a very basic thing to do with cURL, but with endless possibilities. Once you have a webpage in a PHP variable, you can for example, retrieve a particular information on the page to use on your own website.


10 - Post to Twitter using PHP and cURL

Twitter is very popular since some time now, and you probably already have an account there. (We have one too) So, what about using cURL to tweet from your server without connectiong to Twitter?


Source: http://morethanseven.net/2007/01/20/posting-to-twitter-using-php/

Original source: http://www.catswhocode.com/blog/10-awesome-things-to-do-with-curl

Thursday, June 11, 2009

AS3 - Load xml, another approach

var xmlloader:URLLoader = new URLLoader();
xmlloader.addEventListener(Event.COMPLETE, handleComplete);
xmlloader.load(new URLRequest("test.xml"));
var theXML:XML = new XML();
theXML.ignoreWhitespace = true;

function handleComplete(e:Event){
theXML = XML(e.target.data);

var itemList:XMLList = theXML.child("*");

for each (var _item:XML in itemList) {
trace(_item.title.toString());
trace(_item.description.toString());
}

}

Wednesday, June 10, 2009

Tuesday, June 9, 2009

ASP - Create dsn less connection to ms access | ms access database dsn less connection

<% Set MyConn = Server.CreateObject("ADODB.Connection")
ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & server.mappath("your.mdb") & ";"
'ConnectionString = ConnectionString & "Password=YourPassword;"
MyConn.Open ConnectionString
SQL_query = "SELECT * FROM user"
Set RS = MyConn.Execute(SQL_query)
IF (RS.EOF) then response.write("nothing")
WHILE NOT RS.EOF %>
<li><%=RS("Name")%>
<% RS.MoveNext
WEND
%>
</li>

Sunday, June 7, 2009

PHP - Bad words filter using eregi_replace | bad words filter list

//bad word filter function

$openFileBW = fopen("badwords.txt", "r"); //open the text file
while(!feof($openFileBW))
{
$bw .= fgets($openFileBW);
}
fclose ($openFileBW);
$bad_words = explode(',', $bw);
$strToReplace = $theSentence; //the sentence u want to check
foreach ($bad_words as $naughty)
{
$strToReplace = eregi_replace($naughty, "#love#", $strToReplace); //replace with #love# ;)
}
$theSentence = $strToReplace;



The bad words filter list (save it to badwords.txt):

ahole,anus,ash0le,ash0les,asholes,ass,Ass Monkey,Assface,assh0le,assh0lez,asshole,assholes,assholz,asswipe,azzhole,bassterds,bastard,bastards,bastardz,basterds,basterdz,Biatch,bitch,bitches,Blow Job,boffing,butthole,buttwipe,c0ck,c0cks,c0k,Carpet Muncher,cawk,cawks,Clit,cnts,cntz,cock,cockhead,cock-head,cocks,CockSucker,cock-sucker,crap,cum,cunt,cunts,cuntz,dick,dild0,dild0s,dildo,dildos,dilld0,dilld0s,dominatricks,dominatrics,dominatrix,dyke,enema,f u c k,f u c k e r,fag,fag1t,faget,fagg1t,faggit,faggot,fagit,fags,fagz,faig,faigs,fart,flipping the bird,fuck,fucker,fuckin,fucking,fucks,Fudge Packer,fuk,Fukah,Fuken,fuker,Fukin,Fukk,Fukkah,Fukken,Fukker,Fukkin,g00k,gay,gayboy,gaygirl,gays,gayz,God-damned,h00r,h0ar,h0re,hells,hoar,hoor,hoore,jackoff,jap,japs,jerk-off,jisim,jiss,jizm,jizz,knob,knobs,knobz,kunt,kunts,kuntz,Lesbian,Lezzian,Lipshits,Lipshitz,masochist,masokist,massterbait,masstrbait,masstrbate,masterbaiter,masterbate,masterbates,Motha Fucker,Motha Fuker,Motha Fukkah,Motha Fukker,Mother Fucker,Mother Fukah,Mother Fuker,Mother Fukkah,Mother Fukker,mother-fucker,Mutha Fucker,Mutha Fukah,Mutha Fuker,Mutha Fukkah,Mutha Fukker,n1gr,nastt,nigger,nigur,niiger,niigr,orafis,orgasim,orgasm,orgasum,oriface,orifice,orifiss,packi,packie,packy,paki,pakie,paky,pecker,peeenus,peeenusss,peenus,peinus,pen1s,penas,penis,penis-breath,penus,penuus,Phuc,Phuck,Phuk,Phuker,Phukker,polac,polack,polak,Poonani,pr1c,pr1ck,pr1k,pusse,pussee,pussy,puuke,puuker,queer,queers,queerz,qweers,qweerz,qweir,recktum,rectum,retard,sadist,scank,schlong,screwing,semen,sex,sexy,Sh!t,sh1t,sh1ter,sh1ts,sh1tter,sh1tz,shit,shits,shitter,Shitty,Shity,shitz,Shyt,Shyte,Shytty,Shyty,skanck,skank,skankee,skankey,skanks,Skanky,slut,sluts,Slutty,slutz,son-of-a-bitch,tit,turd,va1jina,vag1na,vagiina,vagina,vaj1na,vajina,vullva,vulva,w0p,wh00r,wh0re,whore,xrated,xxx,b!+ch,bitch,blowjob,clit,arschloch,fuck,shit,ass,asshole,b!tch,b17ch,b1tch,bastard,bi+ch,boiolas,buceta,c0ck,cawk,chink,cipa,clits,cock,cum,cunt,dildo,dirsa,ejakulate,fatass,fcuk,fuk,fux0r,hoer,hore,jism,kawk,l3itch,l3i+ch,lesbian,masturbate,masterbat,masterbat3,motherfucker,mofo,nazi,nigga,nigger,nutsack,phuck,pimpis,pusse,pussy,scrotum,sh!t,shemale,shi+,sh!+,slut,smut,teets,tits,boobs,b00bs,teez,testical,testicle,titt,w00se,jackoff,wank,whoar,whore,damn,dyke,fuck,shit,amcik,andskota,arse,assrammer,ayir,bi7ch,bitch,bollock,breasts,butt-pirate,cabron,cazzo,chraa,chuj,Cock,cunt,d4mn,daygo,dego,dick,dike,dupa,dziwka,ejackulate,Ekrem,Ekto,enculer,faen,fag,fanculo,fanny,feces,feg,Felcher,ficken,fitt,Flikker,foreskin,Fotze,Fu,fuk,futkretzn,gay,gook,guiena,h0r,h4x0r,hell,helvete,hoer,honkey,Huevon,hui,injun,jizz,kanker,kike,klootzak,kraut,knulle,kuk,kuksuger,Kurac,kurwa,kusi,kyrpa,lesbo,mamhoon,masturbat,merd,mibun,monkleigh,mouliewop,muie,mulkku,muschi,nazis,nepesaurio,nigger,orospu,paska,perse,picka,pierdol,pillu,pimmel,piss,pizda,poontsee,poop,porn,p0rn,pr0n,preteen,pula,pule,puta,puto,qahbeh,queef,rautenberg,schaffer,scheiss,schlampe,schmuck,screw,sh!t,sharmuta,sharmute,shipal,shiz,skribz,skurwysyn,sphencter,spic,spierdalaj,splooge,b00b,testicle,titt,twat,vittu,wank,wetback,wichser,wop,yed,zabourah,puki,pukimak,lancau,cibai,niama,babi,mak kau,bapak kau,nenek kau,sial,siol,taik,kote,anjingan,banjingan,bangsat,bangang,bengong,bodoh,bodo,dogol,pepek,pepet,pantat,konek,kotek,haramjadah,anak haram,sundal,cinabeng,keling,buto,butoh

Thursday, June 4, 2009

jquery - Create rollover image buttons | make rollover image buttons from single function using jquery

//make a duplicate image of each jpg or png and add "_over" behind the filename. Inside the img tag, put class name as "button" png button, and "jpgBtn" for normal jpg buttons

$(document).ready(function() {

if (!$.browser.msie || ($.browser.msie && $.browser.version > 6)) { //if not ie6 png buttons
//png button
$("img.button").hover(
function () {
ori = $(this).attr("src").split(".png");
src = ori[0];
$(this).attr("src",src + "_over.png");
},
function () {
$(this).attr("src",src + ".png");
}
);
}

//jpg button
$("img.jpgBtn").hover(
function () {
ori = $(this).attr("src").split(".jpg");
src = ori[0];
$(this).attr("src",src + "_over.jpg");
},
function () {
$(this).attr("src",src + ".jpg");
}
);

});

jquery - Inserting jquery framework to your html | google host jquery

A simple line of code so that you don't need to host your jquery framework. Let google do that for you :)

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>

Thursday, May 21, 2009

Flash AS3 - Detecting key press | identify Keyboard press | keyCode event

stage.addEventListener(KeyboardEvent.KEY_DOWN, keyboardListener);

function keyboardListener(event:KeyboardEvent):void {
trace("event.keyCode: " + event.keyCode);
}

Flash AS2 - Detect Keyboard press

var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if (Key.getCode() == Key.ENTER) {
trace("enter is pressed");
}
}

Key.addlistener(keyListener);

Saturday, May 16, 2009

AS3 - crossdomain explanation

In AS3, crossdomain.xml must be placed on the server that provided the service itself, for example, I want to get the rss feed from lifehacker.com, when I do the URLRequest to http://feeds.gawker.com/lifehacker/full flash will request http://feeds.gawker.com/crossdomain.xml.

I guest that should explain how AS3 uses the crossdomain.xml to do crossdomain stuffs :)

Flash AS2 - Pixelation effect

Recently I found out this method to put pixel effect to your movieclip in AS2. Here goes the code:

//speed is in seconds
//_mc is the movieclip you want to apply pixel effect to
//pixel_from is the number of pixel to start, 1 is the original pixel size for every image
//pixel_target is the number of pixel to display at result

function pixelation(_mc:MovieClip, pixel_from:Number, pixel_target:Number, speed:Number) {

this.createEmptyMovieClip("pixelated_mc", 1 );
_mc._visible = false;
pixelated_mc._x = _mc._x;
pixelated_mc._y = _mc._y;

var pixelSize = pixel_from;

onEnterFrame = function(){

if (pixel_target > pixel_from) {
if (pixelSize >= pixel_target) {
pixelSize = pixel_target;
}
} else if (pixel_target < pixelsize =" pixel_target;" bitmapdata =" new" scalematrix =" new" _width =" _mc._width;" _height =" _mc._height;"> pixel_from) {
if (pixelSize == pixel_target) {
delete onEnterFrame;
}
pixelSize += (pixel_from*25)/speed;
} else if (pixel_target < pixel_from) {
if (pixelSize == pixel_target) {
delete onEnterFrame;
}
pixelSize -= (pixel_target*25)/speed;
} else {
pixelSize = pixel_target;
delete onEnterFrame;
}

}

}

// must try!

Monday, May 4, 2009

Flash AS3 - Using Caurina tweener

//Download the class here: http://code.google.com/p/tweener/downloads/list

import caurina.transitions.Tweener;

Tweener.addTween(movieClip, { alpha: 1, time: 10, onComplete: function(){}});

//documentation here: http://hosted.zeh.com.br/tweener/docs/en-us/

Wednesday, April 29, 2009

Useful HTML Meta Tags

Note the keywords "HTTP-EQUIV", "Name" and "Content" are case-insensitive. Their values are also case-insensitive.


































































Tag Name Example(s) Description
Author <META NAME="AUTHOR" CONTENT="Tex Texin" /> The author's name.
cache-control <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE" /> HTTP 1.1. Allowed values = PUBLIC | PRIVATE | NO-CACHE | NO-STORE.

Public - may be cached in public shared caches

Private - may only be cached in private cache

no-Cache - may not be cached

no-Store - may be cached but not archived

The directive CACHE-CONTROL:NO-CACHE indicates cached information should not be used and instead requests should be forwarded to the origin server. This directive has the same semantics as the PRAGMA:NO-CACHE.

Clients SHOULD include both PRAGMA:NO-CACHE and CACHE-CONTROL:NO-CACHE when a no-cache request is sent to a server not known to be HTTP/1.1 compliant.

Also see EXPIRES.

Note: It may be better to specify cache commands in HTTP than in META statements, where they can influence more than the browser, but proxies and other intermediaries that may cache information.

Content-Language <META HTTP-EQUIV="CONTENT-LANGUAGE" CONTENT="en-US,fr" /> Declares the primary natural language(s) of the document. May be used by search engines to categorize by language.
CONTENT-TYPE <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=UTF-8" /> The HTTP content type may be extended to give the character set. It is recommended to always use this tag and to specify the charset.
Copyright <META NAME="COPYRIGHT" CONTENT="&copy; 2004 Tex Texin" /> A copyright statement.
DESCRIPTION <META NAME="DESCRIPTION" CONTENT="...summary of web page..." /> The text can be used when printing a summary of the document. The text should not contain any formatting information. Used by some search engines to describe your document. Particularly important if your document has very little text, is a frameset, or has extensive scripts at the top.
EXPIRES <META HTTP-EQUIV="EXPIRES" CONTENT="Mon, 22 Jul 2002 11:12:01 GMT" /> The date and time after which the document should be considered expired. An illegal EXPIRES date, e.g. "0", is interpreted as "now". Setting EXPIRES to 0 may thus be used to force a modification check at each visit.

Web robots may delete expired documents from a search engine, or schedule a revisit.

HTTP 1.1 (RFC 2068) specifies that all HTTP date/time stamps MUST be generated in Greenwich Mean Time (GMT) and in RFC 1123 format.

RFC 1123 format = wkday "," SP date SP time SP "GMT"

wkday = (Mon, Tue, Wed, Thu, Fri, Sat, Sun)

date = 2DIGIT SP month SP 4DIGIT ; day month year (e.g., 02 Jun 1982)

time = 2DIGIT ":" 2DIGIT ":" 2DIGIT ; 00:00:00 - 23:59:59

month = (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec)

Keywords <META NAME="KEYWORDS" CONTENT="sex, drugs, rock & roll" /> The keywords are used by some search engines to index your document in addition to words from the title and document body. Typically used for synonyms and alternates of title words. Consider adding frequent misspellings. e.g. heirarchy, hierarchy.
PRAGMA NO-CACHE <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE" /> This directive indicates cached information should not be used and instead requests should be forwarded to the origin server. This directive has the same semantics as the CACHE-CONTROL:NO-CACHE directive and is provided for backwards compatibility with HTTP/1.0.

Clients SHOULD include both PRAGMA:NO-CACHE and CACHE-CONTROL:NO-CACHE when a no-cache request is sent to a server not known to be HTTP/1.1 compliant.

HTTP/1.1 clients SHOULD NOT send the PRAGMA request-header. HTTP/1.1 caches SHOULD treat "PRAGMA:NO-CACHE" as if the client had sent "CACHE-CONTROL:NO-CACHE".

Also see EXPIRES.
Refresh <META HTTP-EQUIV="REFRESH" CONTENT="15;URL=http://www.I18nGuy.com/index.html" /> Specifies a delay in seconds before the browser automatically reloads the document. Optionally, specifies an alternative URL to load, making this command useful for redirecting browsers to other pages.
ROBOTS <META NAME="ROBOTS" CONTENT="ALL" />



<META NAME="ROBOTS" CONTENT="INDEX,NOFOLLOW" />



<META NAME="ROBOTS" CONTENT="NOINDEX,FOLLOW" />



<META NAME="ROBOTS" CONTENT="NONE" />
CONTENT="ALL | NONE | NOINDEX | INDEX| NOFOLLOW | FOLLOW | NOARCHIVE"

default = empty = "ALL"

"NONE" = "NOINDEX, NOFOLLOW"

The CONTENT field is a comma separated list:

INDEX: search engine robots should include this page.

FOLLOW: robots should follow links from this page to other pages.

NOINDEX: links can be explored, although the page is not indexed.

NOFOLLOW: the page can be indexed, but no links are explored.

NONE: robots can ignore the page.

NOARCHIVE: Google uses this to prevent archiving of the page. See http://www.google.com/bot.html

GOOGLEBOT <META NAME="GOOGLEBOT" CONTENT="NOARCHIVE" /> In addition to the ROBOTS META Command above, Google supports a GOOGLEBOT command. With it, you can tell Google that you do not want the page archived, but allow other search engines to do so. If you specify this command, Google will not save the page and the page will be unavailable via its cache.

See Google's FAQ.

Sunday, April 26, 2009

Flash AS3 - Draw lines

var lineDrawing:MovieClip = new MovieClip();

lineDrawing.graphics.lineStyle(1);
lineDrawing.graphics.moveTo(0,0); //start from 0,0
lineDrawing.graphics.lineTo(50, 50); //draw line to 50,50


//to clear the drawings:
lineDrawing.graphics.clear();

Thursday, April 23, 2009

Flash AS3 TransitionManager class

//Imports TransitionManager class along with all available transition types and easing functions.
import fl.transitions.*;
import fl.transitions.easing.*;

// Declare global variables
var tMgr:TransitionManager;

// apply the transition to MovieClip object
tMgr = new TransitionManager(MovieClip);
tMgr.startTransition({type:Iris, direction:Transition.OUT, duration:2, easing:Regular.easeOut});
tMgr.addEventListener("allTransitionsOutDone", whenDone); // when the transition done, execute whenDone function

function whenDone(e:Event):void {
//some actions here
}



/*
transition types available:
Wipe
Photo
Blinds
Iris
PixelDissolve
Zoom
*/

Flash AS3 Tweening

// Importing classes from fl package must be done explicitly
import fl.transitions.Tween;
import fl.transitions.easing.*;

// Declare variables for the tween movement. These could just as easily be local below.
var moveBackX:Tween;
var moveBackY:Tween;
var moveRound:Tween;

moveBackX = new Tween(dragger, "x", Strong.easeOut, dragger.x, holder.x, 0.5, true);
moveBackY = new Tween(dragger, "y", Strong.easeOut, dragger.y, holder.y, 0.5, true);
moveRound = new Tween(dragger, "rotation", Strong.easeIn, 0, 180, 0.5, true);

Tuesday, April 21, 2009

AS3 - Set frameRate at runtime

Framerate can now be set at runtime on per-VM instance basis (ie. it will affect all timelines, including loaded SWFs).


stage.frameRate = fps; //0.01 - 1000

AS3 - Use getStackTrace for debugging

You can use the getStackTrace method of an Error instance for general debugging purposes. This will output the execution stack like so:

Test condition @Error
at Untitled_fla::MainTimeline/testingSomething()
at Untitled_fla::MainTimeline/MyThing_fla::frame1()


code:

function testingSomething():void {
if (testCondition) {
//include a stack trace with our debug trace:
trace("Test condition @" + (new Error()).getStackTrace());
}
}

Depths in AS3

In AS3 it is easiest to work with depths in relative terms: Which element should be on top of the other?

Most people think this way anyway, the language reflects that now.


// get the depth of an existing sprite:
var depth:uint = getChildIndex(topMC);

//place mySprite under topMC:
addChildAt(mySprite, depth);

// or just:
addChildAt(mySprite, getChildIndex(topMC));

// directly set depth index:
setChildIndex(myMC, depth);

AS3 New TextField methods

There are a number of new methods on text fields that allow you to work with text in more interactive manner, including methods to convert character indexes to pixel positions, find lengths of lines and paragraphs, get line metrics (ascent, descent, leading, etc), and more.

//px position of chars & vice versa:
myTF.getCharBoundaries(index)
myTF.getCharIndexAtPoint(x,y)

//and a TON more:
myTF.getParagraphLength(index)
myTF.getLineIndexOfChar(index)

Flash - Double click event in AS3

AS3 adds a DOUBLE_CLICK event that uses the system setting for double click speed. Note that you will still get a click event before the double click event.

myButton.addEventListener(MouseEvent.DOUBLE_CLICK, handleDoubleClick);
myButton.doubleClickEnabled = true;

Flash - Create text link in AS3

HTML text fields no longer support "asfunction:" links. Instead they support "event:" links, which will generate a TextEvent.


myTextField.htmlText = "<a href="event:text">test</a>";
myTextField.addEventListener(TextEvent.LINK, handleLink);

function handleLink(evt:TextEvent):void {
trace(evt.text);
}

Monday, February 16, 2009

getURL in as3

As we all know, there's no more getURL in as3. Below is the replacement of getURL,

navigateToURL(new URLRequest("http://google.com"), "_blank");

cheers!

How to set cookies in flash - as3 (Flash SharedObject)

the codes:

var sharedObj:SharedObject = SharedObject.getLocal("anyname");
sharedObj.data.object1 = "whateverYouWantToStore";
sharedObj.data.object2 = "whateverYouWantToStore";
sharedObj.flush();
sharedObj.close();

Monday, January 19, 2009

AS3 - How to call a function in loaded external swf

At the parent code:

package
{
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLRequest;

public class ExampleA extends Sprite
{
private var loader:Loader = new Loader();

public function ExampleA()
{
loader.contentLoaderInfo.addEventListener( Event.INIT, onLoaderInit );
loader.load( new URLRequest( "ExampleB.swf" ) );
}

private function onLoaderInit( e:Event ):void
{
Object( loader.content ).init( "hello" );
}
}
}


at the child code:
package
{
import flash.display.Sprite;

public class ExampleB extends Sprite
{
public function ExampleB()
{}

public function init( param:String ):void
{
trace( param ); // hello
}
}
}