RSS

Monthly Archives: April 2009

Resize YouTube Embed Video

Here is the code how to resize youtube video embed code, even this code will work to non-youtube embed videos…..


<?php

$embed = '<object width="425" height="344"><param name="movie" value="http://www.youtube.com/ v/SOiGqFceMYo&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/SOiGqFceMYo&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>';

//$alt = preg_match_all('/(width|height)=("[^"]*")/i', $embed, $matches);

$embed = preg_replace('/(width)=("[^"]*")/i', 'width="200"', $embed);
$embed = preg_replace('/(height)=("[^"]*")/i', 'height="200"', $embed);

echo $embed;

?>

Now try to resize youtube player with php regular expression replace preg_replace()……

 
13 Comments

Posted by on April 22, 2009 in 1, php

 

Tags: , , , ,

Javascript Event Log ~ Console

This is the javascript function used for tracking javascript events as in alert(). This may be replacement of alert() to better track the javascript events and error/success messages.


/*
Below is the function where to call console()
*/
window.document.onclick = function(){ console(window.event.target.onclick) }; 

function console(msg)
{

	mywin = window.open('', 'console', 'width=500,height=150,left=800,top=800,scrollbars=yes,location=no');
	
	if (mywin && msg!=null)
	  mywin.focus();	
	
	mywin.document.title='Javascript Console...';
	//mywin.document.writeln('<h4>Javascript Log here..</h4>');
	if(msg!=null)
	mywin.document.writeln('<div style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; border-bottom: 1px dotted #FFB64A; padding:4px;">'+msg+'</div>');
	
	//mywin.document.writeln("<br /><a href=\"javascript:void(0)\" onclick=\"this.document.write='';\" >Clear</a>");
	
	//sleep(10); mywin.blur();
	
}

 
Leave a comment

Posted by on April 15, 2009 in 1, Ajax, javascript

 

Tags: , , , , ,

Managing Amazon S3 on Windows with CloudBerry Explorer freeware

CloudBerry Explorer is a freeware Windows Client for Amazon S3 and CloudFront services.  CloudBerry Explorer makes managing files in Amazon S3 storage EASY. By providing an FTP client like user interface to Amazon S3 accounts, files, and buckets, CloudBerry lets you manage your files on cloud just as you would on your own local computer. And best of all it is absolutely free!

With CloudBerry Explorer you can

* Allow end users to accomplish simple tasks without special technical knowledge
* Automate time-consuming tasks to improve productivity
* With CloudBerry Explorer, Amazon S3 becomes an extension to your local storage. You are no longer limited to the classic data storage on your local drive(s). With CloudBerry Explorer, you can move files to Amazon S3 just as easily as managing them on your local drive(s).
* CloudBerry Explorer allows you to move large files such as photos, videos, and music to Amazon S3 and free up your local storage.
* The files on your Amazon S3 can be shared with anyone who has access to the internet. For security purposes, the S3 accounts can be password protected and access can be restricted
* Manage CloudFront distributions to publish content in multiple geographical zones

CloudBerry Explorer

CloudBerry Explorer


This is a long list of CloudBerry Explorer features

· Register and connect to any number of Amazon S3 accounts
· Work with any number of Amazon S3 accounts simultaneously
· Fast copy files between your S3 accounts
· Share buckets and files located on Amazon S3 with other users
· Create, browse, and delete S3 buckets
· Copy and move files between Amazon S3 and your local computer
· Set up file access permissions
· Automate common tasks with Microsoft PowerShell
· Generate external URLs
· Copy/Move in background
· Support for MD5 to ensure files are not corrupted while transferred to S3
· Copy files from Windows Explorer
· Support for Amazon CloudFront service
· Support for CNAMEs
· Support for time limited or signed URLs
· Apply ACL list to child objects (files inside a bucket)
· Remember user settings
· Rename objects in S3
· Support for Requester Pays Option for Amazon S3
· Support for streamincloud.com FLV encoder for Amazon S3
· Generate BiTorrent URLs
· Generate short URLs using http://chilp.it
· Hide to tray
· Built-in feedback form


Conclusion

CloudBerry Explorer is a solid Amazon S3 client that can help developers, web designers and other users who want to exploit Amazon S3 and CloudFront services.  If you work with Amazon S3 on Windows or considering using Amazon S3 it is a good reason to start now and download CloudBerry Explorer from CloudBerry Lab website at http://cloudberrylab.com/

 
1 Comment

Posted by on April 13, 2009 in Amazon S3

 

Tags: , ,

Get js css source of web page

These are some javascript functions which can be used for getting js, css files included on web page.

Also we can view source of these files……


function trim(s) {return s.replace(/^\s*\n/, '').replace(/\s*$/, ''); };
function add(h,b) {b.appendChild(h);}
function makeTag(t) {return document.createElement(t);}
function makeText(tag,text) {t=makeTag(tag); t.appendChild(document.createTextNode(text)); return t;}

function get_all_js(divid)
{

var s=document.getElementsByTagName('SCRIPT');
var d=window.document;
var b=document.getElementById(divid);

add(makeText('style', 'iframe{width:100%;height:18em;border:1px solid;'),b);
add(makeText('h3', d.title='Scripts in ' + location.href),b);

for(i=0; i<s.length; ++i) { if (s&#91;i&#93;.src) { add(makeText('h4','script src=&quot;' + s&#91;i&#93;.src + '&quot;'),b);
iframe=makeTag('iframe'); iframe.src=s&#91;i&#93;.src; add(iframe,b); } else { add(makeText('h4','Inline script'),b);
add(makeText('pre', trim(s&#91;i&#93;.innerHTML)),b); } }

return b;
}

function get_all_css(divid)
{

var s=document.getElementsByTagName('LINK');
var s1=document.getElementsByTagName('STYLE');
var d=window.document;
var b=document.getElementById(divid);

add(makeText('style', 'iframe{width:100%;height:18em;border:1px solid;'),b);
add(makeText('h3', d.title='Styles in ' + location.href),b);

for(i=0; i<s.length; ++i) { if (s&#91;i&#93;.href) { add(makeText('h4','style href=&quot;' + s&#91;i&#93;.href + '&quot;'),b);
iframe=makeTag('iframe'); iframe.src=s&#91;i&#93;.href; add(iframe,b); } else { add(makeText('h4','Inline style'),b);
add(makeText('pre', trim(s&#91;i&#93;.innerHTML)),b); } }

for(i=0; i<s1.length; ++i) { if (s1&#91;i&#93;.href) { add(makeText('h4','style href=&quot;' + s1&#91;i&#93;.href + '&quot;'),b);
iframe=makeTag('iframe'); iframe.src=s1&#91;i&#93;.href; add(iframe,b); } else { add(makeText('h4','Inline style'),b);
add(makeText('pre', trim(s1&#91;i&#93;.innerHTML)),b); } }

return b;
}

function get_view_source(divid)
{

var s=document.getElementsByTagName('HTML');
var d=window.document;
var b=document.getElementById(divid);

add(makeText('style', 'iframe{width:100%;height:18em;border:1px solid;'),b);
add(makeText('h3', d.title='Source of ' + location.href),b);

for(i=0; i<s.length; ++i) { add(makeText('h4','View Source'),b);
add(makeText('pre', trim('<html>'+s[i].innerHTML+'<html>')),b);  }

return b;
}

 
1 Comment

Posted by on April 11, 2009 in Ajax, javascript, php

 

Tags: , , , , ,