14 April 2013

How To get Resellerclub Slab 2 Pricing

I am Going To tell you how you can get resellerclub slab 2 pricing without any initial deposit.
Its hard to achieve slab 2 pricing for small hosting providers and freelancers.
If you want to get Directly slab 2 pricing for domain registration Then You can Go for http://www.india.dj
who can provide you .com / .net /.org domain registration starting from 9$ per year registration and renewal, with cheapest registrar for .in domain names. :)


We accept payments By PayPal and Ccavenue.
Domain Registration

30 March 2013

form auto save using jquery

whenever any changes occurs in the form this will make ajax request to save the form data



jQuery(document).ready(
function()
{
jQuery('#form').change(function(e)
{
var str = jQuery("#form").serialize(); //post variables present in the form input,select and all inputs
jQuery.ajax({
type: "POST", //method
url: "/save.php", //url to make request
data: str
}); //end of ajax
});// end of form change

});

1 March 2013

fetch google contacts using access_token and parse it

<?php
$access_token=$_GET['access_token'];
$max_results=$_GET['max_results'];
$api_url="https://www.google.com/m8/feeds/contacts/default/full";
$emails=array();
$content=file_get_contents("$api_url?access_token=$access_token&max-results=$max_results");

//https://www.google.com/m8/feeds/contacts/default/full?access_token=<your access token>&max-results=<maximum contacts>

$parser = xml_parser_create();
xml_parse_into_struct($parser, $content, $contacts);
xml_parser_free($parser);
foreach($contacts as $contact)
{
if($contact[tag]=="GD:EMAIL")
{
$emails[]=$contact[attributes][ADDRESS];
}
}
print_r($emails);//array of all email address
?>

17 January 2013

indian mobile number location database

Last Update on 17/Jan/2012

just an array of data which consists of operator and state name

download from here https://github.com/hebrew878/mobilenumberdb

12 December 2012

setup your own online radio station using shoutcast

requirements

1.shoutcast server (can be downloaded from http://www.shoutcast.com/broadcast-tools)

2.shoutcast transcoder(can be downloaded from http://www.shoutcast.com/broadcast-tools)

3.shoutcast license key  (its cost 5$ can be purchased  from http://shop.winamp.com/store/winamp/en_US/pd/productID.165220700)

4.one linux vps or dedicated with CentOS or Ubuntu OS 32bit prefered (cheap vps worth 6$ can be purchased from http://joesdatacenter.com)
5.small skill about linux 

installation

login to your vps/dedicated server  via ssh

download shoutcast server
# wget http://download.nullsoft.com/shoutcast/tools/sc_serv2_linux_07_31_2011.tar.gz
download shoutcast transcoder
# wget http://download.nullsoft.com/shoutcast/tools/sc_trans_linux_10_07_2011.tar.gz
extract those 2 tar balls
# tar -xvzf sc_serv2_linux_07_31_2011.tar.gz
# tar -xvzf sc_trans_linux_10_07_2011.tar.gz
# ls
now your ssh screen may look like this
now we move to confguration files sc_trans_basic.conf and sc_serv_basic.conf

sample of sc_serv_basic.conf

logfile=logs/sc_serv.log
w3clog=logs/sc_w3c.log
banfile=control/sc_serv.ban
ripfile=control/sc_serv.rip
portbase=8000
password=testing
adminpassword=changeme
streamid=1
streampath=/test.aac

sample of sc_trans_basic.conf

logfile=logs/sc_trans.log
calendarrewrite=0
encoder_1=mp3
bitrate_1=56000
outprotocol_1=3
serverip_1=127.0.0.1
serverport_1=8000
password_1=testing
streamid_1=1
endpointname_1=/Bob
streamtitle=My Test Server
streamurl=http://www.shoutcast.com
genre=Misc
playlistfile=playlists/main.lst
adminport=7999
adminuser=admin
adminpassword=goaway
unlockkeyname=YOUR LICENSE NAME THAT YOU PURCHASED
unlockkeycode=YOUR LICENSE KEY THAT YOU PURCHASED

add your mp3 files

# cd music
download any mp3 file from remotely
# wget http://blog.stephin.in/music.mp3 
you  can add any number of files to music directory
after adding some mp3 files we must have to update the playlist
# find /root/music -type f -name "*.mp3" > /root/playlists/main.lst
now go back to  main directory where shoutcast server,transcoders and config files are located
# cd /root
 

Start shoutcast server

# ./sc_serv sc_serv_basic.conf

now exit the ssh terminal

Start shoutcast transcoder

# ./sc_trans sc_trans_basic.conf

now your radio is ready open this url http://serverip:8000 from web browser

or open this url http://serverip:8000 from any media player like real player to listen the radio

How to add more files later?

just add  your desired mp3 files to music directory then update the playlist

# find /root/music -type f -name "*.mp3" > /root/playlists/main.lst
this will update the playlist

now you must have to re-start the shoutcast transcoder no need to touch shoutcast server parts

#   pkill sc_trans
# ./sc_trans sc_trans_basic.conf


:)


 

 







16 November 2012

sort multi dimentional array by the value of specific key

 

Sample Array

Array (
[0] => Array
    (
        [iid] => 1
        [invitee] => 174
        [nid] => 324343
        [showtime] => 2010-05-09 15:15:00
        [location] => 13
        [status] => 1
        [created] => 2010-05-09 15:05:00
        [updated] => 2010-05-09 16:24:00
    )
[1] => Array
    (
        [iid] => 1
        [invitee] => 220
        [nid] => 21232
        [showtime] => 2010-05-09 15:15:00
        [location] => 12
        [status] => 0
        [created] => 2010-05-10 18:11:00
        [updated] => 2010-05-10 18:11:00
    ))

 Snippet

function cmp($a, $b) {
    if ($a['status'] == $b['status']) {
        return 0;
    }
    return ($a['status'] < $b['status']) ? -1 : 1;
}

usort($array, "cmp");

Note

here array sorted by the value of specifed key(status),u can change status withany key that your array has :)

convert stdClass object array to normal array and normal array to stdClass object




stdClass obect to normal array




function objectToArray($d) {
if (is_object($d)) {
// Gets the properties of the given object
// with get_object_vars function
$d = get_object_vars($d);
}

if (is_array($d)) {
/*
* Return array converted to object
* Using __FUNCTION__ (Magic constant)
* for recursive call
*/
return array_map(__FUNCTION__, $d);
}
else {
// Return array
return $d;
}
}


normal array to stdClassobject

function arrayToObject($d) {
        if (is_array($d)) {
            /*
            * Return array converted to object
            * Using __FUNCTION__ (Magic constant)
            * for recursive call
            */
            return (object) array_map(__FUNCTION__, $d);
        }
        else {
            // Return object
            return $d;
        }
    }

Sample Output

stdClass Object
(
    [foo] => Test data
    [bar] => stdClass Object
        (
            [baaz] => Testing
            [fooz] => stdClass Object
                (
                    [baz] => Testing again
                )

        )

    [foox] => Just test
)

Array
(
    [foo] => Test data
    [bar] => Array
        (
            [baaz] => Testing
            [fooz] => Array
                (
                    [baz] => Testing again
                )

        )

    [foox] => Just test
)

  

Thanks to:

http://www.if-not-true-then-false.com/2009/php-tip-convert-stdclass-object-to-multidimensional-array-and-convert-multidimensional-array-to-stdclass-object/

 

Another simple way

json_decode(json_encode(simplexml_load_string('xml string')),1);