March
24
a2zVideoAPI

a2zVideoAPI

March
7
browser search plugin

browser search plugin

OpenSearch is a collection of simple formats for the sharing of search results.

OpenSearch description file

http://www.svnlabs.com/opensearch.xml

We have to create  a simple xml file for websites and search engines to publish search results in a standard and accessible format.

See below the code in action…….

<?xml version=”1.0″ encoding=”UTF-8″?>

<OpenSearchDescription xmlns=”http://a9.com/-/spec/opensearch/1.1/”> <ShortName>svnlabs</ShortName>

<LongName>svnlabs – Concentrate > Observe > Imagine > Launch</LongName>

<Description>Search through articles posted on svnlabs.com</Description>

<InputEncoding>UTF-8</InputEncoding>

<OutputEncoding>UTF-8</OutputEncoding>

<AdultContent>false</AdultContent>

<Language>en-us</Language>

<Developer>svnlabs</Developer>

<Contact>svnlabs@gmail.com</Contact>

<Description>svnlabs – Concentrate – Observe – Imagine – Launch svnlabs, Linux, Apache, Mysql, PHP, Video Encoding, Youtube API, Facebook API, Twitter API, Amazon Web Service, OSCommerce, Joomla, Wordpress</Description>

<Tags>svnlabs Linux Apache Mysql PHP Video Encoding Youtube API Facebook API Twitter API Amazon Web Service OSCommerce Joomla Wordpress</Tags>

<Attribution>Search Articles on svnlabs, http://www.svnlabs.com/</Attribution> <SyndicationRight>open</SyndicationRight>

<Query role=”example” searchTerms=”India”/>

<Image height=”16″ width=”16″ type=”image/vnd.microsoft.icon”>http://www.svnlabs.com/favicon.ico</Image>

<Image height=”130″ width=”130″ type=”image/jpeg”>http://www.svnlabs.com/sv.jpg</Image>

<Url type=”text/html” template=”http://blog.svnlabs.com/?s={searchTerms}”/>

</OpenSearchDescription>

Paste below block of code to HTML Heading section to add browser search plugin….

<link rel=“search” type=“application/opensearchdescription+xml” href=”http://www.svnlabs.com/opensearch.xmltitle=“svnlabs blog search” />

Source:
https://developer.mozilla.org/en/Creating_OpenSearch_plugins_for_Firefox

February
3

Have the fun with json….

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate.

# yum -y install php-pear

# pecl install json

# vi /etc/php.d/json.ini
extension=json.so

# service httpd restart

October
2

Below is the code to check file type in javascript..

<script type=”text/javascript” language=”javascript”>

function isImage(file) {
var image    = /\.(jpg|jpeg|bmp|gif|png|jpe)$/i;
if (image.test(file))
return true;
else
return false;
}

function isAudio(file) {
var audio    = /\.(mp3|wav|mid|midi|mp2|ul|ra|m3u|ram|rm)$/i;
if (audio.test(file))
return true;
else
return false;
}

function isArchive(file) {
var archive    = /\.(zip|rar)$/i;
if (archive.test(file))
return true;
else
return false;
}

function isVideo(file) {
var video = /\.(mov|mpg|mpeg|avi|asf|wmv|mpe|3gp|swf)$/i;
if (video.test(file))
return true;
else
return false;
}

</script>

If you really want to validate uploaded file… you have to use “Mediainfo” on linux to check/validate file mime type.

MediaInfo provides technical and tag information about a video or audio file.

# mediainfo --help

Features/Download: http://mediainfo.sourceforge.net/en/Download

Mediainfo: http://mediainfo.sourceforge.net/en

September
28

Today I faced a strange problem …. I have to add drop-down menu by javascript.

<a href=”http://www.svnlabs.com” style=”border:2px dotted #0000FF”><img src=”svnlabs.gif” border=”0″ style=”border:2px solid #009966″ /></a>

this is the code where I have to add a menu but menu dancing on this image.. when I mouse over the image menu appeared to bottom of the image…

anchor height

here you can see output of above html code… I have marked a border around image in green and on anchor with blue color.

I think now you got the problem :)

Yes, now we have to apply height and width to anchor in blue color below is the code for this….

<a href=”http://www.svnlabs.com” style=”border:2px dotted #0000FF; float:left; width:70px; height:80px;”><img src=”dateblock.gif” border=”0″ style=”border:2px solid #009966″ /></a>

This is the magic for “float: left” of CSS .. here you can use “float: right” as well to apply height/width to anchor tags…..

height of anchor
Here you can see the output of above code the blue border with width/height of anchor tag.

September
13

Today I got problem to load TinyMCE as dynamic loaded textareas by Ajax?

Solution:

<a href=”javascript:void(0)” onclick=”ajaxEdit(); showEditor();”>Edit Content</a>

here ajaxEdit() is ajax function where textarea loaded by ajax as html response.

here we have use showEditor(); to load TinyMCE editor … page loaded by Ajax

<script>

function showEditor()
{

setTimeout(”initEditor(’newsdesc’)”,4000);

}

tinyMCE.init({………………………
…………………………………………………});

function initEditor(id)
{

tinyMCE.execCommand(’mceAddControl’, false, id);

}

</script>

tiny

September
1

Meld is a visual diff and merge tool. Meld is used for comparing two or three files and editing them. We can compare two or three folders and launch file comparisons….

Source: http://meld.sourceforge.net/