Archive

Posts Tagged ‘software’

Get line number of the code

July 9, 2013 2 comments
<!--?
class myTest
{
function addMyAddress($street)
{
echo "
In class function at:".__LINE__;
echo "
class function called from:";
$e = new Exception();
$trace = $e->getTrace();
echo '
';print_r($trace);
// OR print_r(debug_backtrace());
}
}
echo "
Class created at:".__LINE__; $obj = new myTest();
echo "
Function called at:".__LINE__; $obj->addMyAddress('A/13 Skyline');
?>

 

Get any Website Page Title From URL in PHP

Hey guys,here below describe the how to get the page title form any website page using  URL. Here for getting the page title we are using the file_get_contents function.This one also achieve using fopen( ) but in some servers disabled this function now a days due to some security reasons.

Here below shows the PHP code to get the page title form the URL.

<!--?php
function pageTitle($page_url)
{
     $read_page=file_get_contents($page_url);
     preg_match("/<title.*?>[\n\r\s]*(.*)[\n\r\s]*<\/title>/", $read_page, $page_title);
      if (isset($page_title[1]))
      {
            if ($page_title[1] == '')
            {
                  return $page_url;
            }
            $page_title = $page_title[1];
            return trim($page_title);
      }
      else
      {
            return $page_url;
      }
}

?>

Jquery Timeago Implementation with PHP.

Nowadays timeago is the most important functionality in social networking sites, it helps to updating timestamps automatically. Recent days I received few requests from 9lessons readers that asked me how to implement timeago plugin with dynamic loading live data using PHP. In this post I am just presenting a simple tip to implement timeago in a better way.

Why Live Query
LiveQuery utilizes the power of jQuery selectors by binding events or firing callbacks for matched elements auto-magically, even after the page has been loaded and the DOM updated.

Code
Contains javascipt code. $(this).timeago()- here this element is refers to timeagoclass selector of the anchor tag.

 

// <![CDATA[
javascript” src=”js/jquery.min.js”>
// ]]>
// <![CDATA[
javascript” src=”js/jquery.livequery.js”>
// ]]>
// <![CDATA[
javascript” src=”js/jquery.timeago.js”>
// ]]>
<script type=”text/javascript”>
$(document).ready(function(){
$(“.timeago”).livequery(function() // LiveQuery
{
$(this).timeago(); // Calling Timeago Funtion
});
});
</script>

//HTML & PHP Code
<!–?php
$time=time(); // Current timestamp eg: 1371612613
$mtime=date(“c”, $time); // Converts to date formate 2013-06-19T03:30:13+00:00
?>

You opened this page <a href=’#’ class=’timeago’ title=”<!–?php echo$mtime; ?>“></a>

 

Step-by-Step guide to Facebook Conversion Tracking

Step 1: Once you log in to your ‘Ads Manager’ tab, click on the Conversion Tracking button on the left side bar.

FB-1

Step 2: Then click on the ‘Create Conversion Pixel’ tab to begin the process.

FB-2

Step 3: You will be directed to this pop-up, which will ask you for a:

1. Name: An appropriate name will help you remember what you are tracking. (Example: Lead Generation – GATE Ad)

2. Category: This will help you decide the type of action that you want to track on your site. You can choose from the following:

1. Checkouts

2. Registrations

3. Leads

4. Key Page Views

5. Adds to Cart

6. Other Website Conversions

(For the purpose of this example, we have selected ‘Leads’).

FB-3

Step 4: You will be able to see a pop-up window with a JavaScript code. This is the code that you will have to add to the page where the conversion will happen. This will let you track the conversions back to ads which you are running on Facebook.

FB-4

The code should be placed on the page that a user will finally see when the transaction is complete.

Here is the tricky part. The code should not go on all pages. For that matter, it should not even go to the landing page of your product. The code should be placed on the page that a user will finally see when the transaction is complete.

For Example: If you want to track when students register for your GATE coaching, paste the code on the registration confirmation page/thank you page and not on the form that they need to submit.

How do you confirm that your conversion is working properly?

1. Check that the javascript snippet has been placed on the correct conversion page. Visit the page where the pixel has been embedded, right click and go to ‘View Page Source’ to find the pixel. The code should have the tag of the HTML. See image below.

FB-5

2. Check that Facebook is receiving the conversion events from your website. Go to the conversion tracking tab in your Ads Manager account. There you will see a list of the conversion tracking pixels that you have created. If the conversion tracking pixel has been successfully implemented and a conversion event has been recorded, it will be reflected in the Pixel Status column. If the status shows active, it means that the page which contains the pixel has been viewed by users. If it shows inactive, it means that over the last 24 hours, the page with the pixel has not been viewed.

FB-6

3.Later, when you  create your Facebook ad , you need to check the track conversions box under the campaign, pricing and schedule tab to enable tracking.

FB-7

Upload Cover Photo to Facebook via PHP

January 4, 2013 1 comment

Here is a tutorial to upload a Cover Photo on Facebook via PHP. We will need Facebook Application ID and Secret, and Facebook files from Github.com then upload to your web space only the src  folder. Now create a file called upload.php and upload it to your web space. Open upload.php with notepad and add this code:

<?php
 
ini_set('display_errors', 1);
 error_reporting(E_ALL);

 require 'src/facebook.php';

 $facebook = new Facebook(array(
 'appId' => "xxxxxxxxxxxxxxxxxxx", //Facebook App ID
 'secret' => "xxxxxxxxxxxxxxxxxxx", // Facebook App Secret
 "cookie" => true,
 'fileUpload' => true
 ));

 $user_id = $facebook->getUser();

 if($user_id == 0 || $user_id == "")
 {
 $login_url = $facebook->getLoginUrl(array(
 'redirect_uri' => 'https://selvabalaji.wordpress.com/upload.php?cover='.$_GET['cover'].'', // Replace with your site url
 'scope' => "publish_stream,user_photos"));

 echo "<script type='text/javascript'>top.location.href = '$login_url';</script>";
 exit();
 }

 //get user album
 $albums = $facebook->api("/me/albums");
 $album_id = ""; 
 foreach($albums["data"] as $item){
 if($item["type"] == "cover_photo"){
 $album_id = $item["id"];
 break;
 }
 }

 //set timeline cover atributes 
 $full_image_path = realpath($_GET['cover']);
 $args = array('message' => 'Uploaded from hhttps://selvabalaji.wordpress.com/');
 $args['image'] = '@' . $full_image_path;

 //upload cover photo to Facebook
 $data = $facebook->api("/me/photos", 'post', $args);
 $picture = $facebook->api('/'.$data['id']);

 $fb_image_link = 'http://www.facebook.com/profile.php?preview_cover='.$data['id'].''; //redirect to uploaded facebook cover and change it
 echo "<script type='text/javascript'>top.location.href = '$fb_image_link';</script>";
?>

Now that just type in the URL of your site followed by the name of the image file and you’re done!
Example : http://yoursitename.com/upload.php?cover=selvabalaji.gif

10 More Useful WordPress Code Snippets For Your Blog

July 6, 2012 1 comment

WordPress is the best open source sofware which is completely free to use.The advantage of being open source for a software is that developers can see its codes an write plugins to make it more functional.And also developers add or change small piece of codes especially in functions.php file to unleash the power of your favorite blogging engine.

In today’s post we are again sharing wordpress code snippets.I think you will find a useful wordpress code snippet for your wordpress blog.

You may also take a look at our past wordpress theme collections;

htaccess Gzip Compression

Add the following code in your .htaccess file.Gzip will drastically reduce HTTP response time.

# BEGIN GZIP

AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript

# END GZIP

Instructions:
Just add this to your .htaccess file. Gzip will drastically reduce HTTP response time.

How to Remove the Width and Height Attributes From WP Image Uploader

add_filter( ‘post_thumbnail_html’, ‘remove_width_attribute’, 10 );
add_filter( ‘image_send_to_editor’, ‘remove_width_attribute’, 10 );

function remove_width_attribute( $html ) {
$html = preg_replace( ‘/(width|height)=\”\d*\”\s/’, “”, $html );
return $html;
}

If you upload images via the WordPress image uploader and insert it into your post, it will include the image width and height attribute in the html tag. Here’s what it will look like.

In most cases, this is absolutely alright. However, if you are using a responsive theme or are dealing with responsive web design, the “width” and “height” attribute will be a major roadblock that you need to get rid of.

Here’s how you can do it.

1. Open your theme’s functions.php file.

2. Copy and paste the following code:
add_filter( ‘post_thumbnail_html’, ‘remove_width_attribute’, 10 );
add_filter( ‘image_send_to_editor’, ‘remove_width_attribute’, 10 );

function remove_width_attribute( $html ) {
$html = preg_replace( ‘/(width|height)=\”\d*\”\s/’, “”, $html );
return $html;
}

3. Save the changes.

That’s it. Next time when you insert image into the post via the WP image uploader, the width and height attribute will no longer be there.

How to Change the Font in HTML Editor In WordPress 3.3

add_action( ‘admin_head-post.php’, ‘wpdb_fix_html_editor_font’ );
add_action( ‘admin_head-post-new.php’, ‘wpdb_fix_html_editor_font’ );

function wpdb_fix_html_editor_font() { ?>

<!–?php }

Add/remove Contact Info Fields

To add or remove fields from this section, just add the following to your functions.php.

Login with Username or Email Address

Adding this snippet to the functions.php of your wordpress theme will let users login using an email address or a username. The second snippet will change the text on the login page from “username” to “username / email” but feel free to change the login text to anything you would like.

function login_with_email_address($username) {
$user = get_user_by(’email’,$username);
if(!empty($user->user_login))
$username = $user->user_login;
return $username;
}
add_action(‘wp_authenticate’,’login_with_email_address’);
function change_username_wps_text($text){
if(in_array($GLOBALS[‘pagenow’], array(‘wp-login.php’))){
if ($text == ‘Username’){$text = ‘Username / Email’;}
}
return $text;
}
add_filter( ‘gettext’, ‘change_username_wps_text’ );

Add PayPal Donate Button

Add this snippet to the functions.php to add ‘Donate’ Button on your WordPress Website

// paypal donate button
function cwc_donate_shortcode( $atts ) {
extract(shortcode_atts(array(
‘text’ => ‘Make a donation’,
‘account’ => ‘REPLACE ME’,
‘for’ => ”,
), $atts));
global $post;
if (!$for) $for = str_replace(” “,”+”,$post->post_title);
return ‘‘.$text.’‘;
}
add_shortcode(‘donate’, ‘cwc_donate_shortcode’);

vela vela song Lyrics from Velayudham

September 13, 2011 Leave a comment

ada vela vela vela vela velayudham
nee otha paarva partha podhum nooraayudham

coming down town, coming to the sea
he is the man like shiny bee
breaking to the barriers …..
gonna come and carry us
don shout out
come get some
you cant get down, he is velayutham

ada vela vela vela vela velayutham
nee otha paarva partha podhum nooraayudham

chillax chillax song Lyrics From Velayutham

September 13, 2011 1 comment
Velayudham

Image via Wikipedia

chillax chillax chillax chillax chillax..
chillax chillax chillax chillax chillax..

manjanathi marathu katta
maiya vechi mayaki puta
naatu katta townu katta
rendum kalandha semma katta
kaiyu rendum urutu katta
kannu rendum vetta vetta
nenjukulla ratham sotta
eduku vara kitta..

sooriyane thevaiyille vithudalama
rathiriya inga mattum inga vachukalama
thirupachi meesaiyile sikkikalama
neeyachu naanachu paathukalama

manjanathi marathu katta
maiya vechi mayaki puta
naatu katta townu katta
rendum kalandha semma katta
kaiyu rendum urutu katta
kannu rendum vetta vetta
nenjukulla ratham sotta
eduku vara kitta..

dheem dheem thananam dheem dheem thananam
ah ah..ahhaaa..ah ah ahhaa

en odhattu sayathula
ottikolla vaada ulla
patthu veral theekuchiya
pattha veika vaadi pulla
kattabomma peran ne katthi meesa veeran
muthan vechu kuthi kollu sethu poren
mayavi tha neeyum inga mayangiputta nanum
athangara moginiyum vaa nee enna katti pudikka

chillax chillax chillax chillax chillax
chillax chillax chillax chillax chillax
chillax chillax chillax chillax chillax
chillax chillax chillax chillax chillax
chilllllaaaaa….x chillax baby

en odambu panju metha
kitta vandhu kaatu vitha
un iduppu vaazha maata
naa pudicha thaanga maata
sandhu pondhu veedu nee vanthu vilayadu
patta vaanga thevaiyilla kotta podu
vetiya na sethu un marapula korthu
ennanamo pannuriye nenjukitta ketta kanava (ketta kanavu..)

chillax chillax chilla chilla chillax
chillax chillax chilla chilla chillax

manjanathi marathu katta
maiya vechi mayaki puta
naatu katta townu katta
rendum kalandha semma katta
kaiyu rendum urutu katta
kannu rendum vetta vetta
nenjukulla ratham sotta
eduku vara kitta..

sooriyane thevaiyille vithudalama
rathiriya inga mattum inga vachukalama
thirupachi meesaiyile sikkikalama
neeyachu naanachu paathukalama
chillax chillax chillax chillax chillax..
chillax chillax chillax chillax chillax..
chillax chillax chillax chillax chillax..
chillax chillax chillax chillax chillax..
chillax chillax chillax

2 WordPress Plugins to Keep Track of 404 Errors

We already know how 404 errors run your SEO and usability. And long ago I shared some ways to keep track of 404 pages that may occur on the site. Today I am adding two tools to your arsenal: for those who use WordPress to run their sites.

So here you go: two WordPress plugin that alert you once your blog visitor lands on an error page:

1.404 Notifier

This plugin sends email alerts once the visitor of your blog comes across a 404 page.

After you install it, go to the plugin settings and provide your email for alerts:

The email alert looks as follows:

The plugin also offers an RSS feed (if you don’t want to clutter your email inbox) tracking all 404 logs:



2.JH 404 Logger

This plugin adds a Dashboard Widget showing recent 404 urls. The widget is easy to use and Ajax powered.


Auto post into Blogspot using php code?

January 7, 2010 22 comments

$email = “blogger_email@gmail.com”;
$pass = “password”;
$blogID= urlencode(“blogger_id”); // like 6304924319904337556

// Do Not Modify Below Code
if(!isset($_SESSION[‘sessionToken’])) {

$ch = curl_init(“https://www.google.com/accounts/ClientLogin?Email=$email&Passwd=$pass&service=blogger&accountType=GOOGLE”);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1);
curl_setopt($ch, CURLOPT_HEADER,0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER ,1);
$result = curl_exec($ch);
$resultArray = curl_getinfo($ch);
curl_close($ch);
$arr = explode(“=”,$result);
$token = $arr[3];
$_SESSION[‘sessionToken’] = $token;
}

$entry = “

Title of blog post

This is testing contnetto post in blog post.

”;

$len = strlen($entry);

$headers = array(“Content-type: application/atom+xml”,”Content-Length: {$len}”,”Authorization: GoogleLogin auth={$_SESSION[‘sessionToken’]}”,”$entry”);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, “https://www.blogger.com/feeds/$blogID/posts/default”);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 4);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_UNRESTRICTED_AUTH, 1);
curl_setopt($ch, CURLOPT_POST, true);
$result = curl_exec($ch);
$ERROR_CODE = curl_getinfo($ch);
curl_close($ch);

echo ‘

’;

    print_r($headers);

    var_dump($result);

    print_r($ERROR_CODE);

    exit;
 

    ?>

Android attacks the business phone market

August 24, 2009 1 comment

The Android cellphone platform is already making inroads into home communications devices and is now heading for the business multimedia phone, available as either a white label device or a software hardware platform that can be customised to create a range of products.

These emerging Android-based home and business communications products feature tight integration with Android based mobiles and if they achieve significant market penetration will add considerably to the momentum of Android in the handset market.

The latest development comes from San Francisco based software company, Cloud Telecomputers, which has produced a platform called Glass for creating Android-based media phones for business. The product has a 20 cm touch screen, HD audio and bluetooth allowing integration with mobile devices. It also support WiFi.

According to Cloud’s web site “We license this platform – which includes next-generation hardware, software and cloud-based applications – to phone and PBX manufacturers and telecom service providers, so they can deliver devices and web services in a fraction of the time and cost required by in-house development. We focus on platform design, software and cloud applications, while customers concentrate on branding, channel development, customer acquisition and operational scale.”

Cloud claims that “Glass’s Android-based environment and open API enable each partner to establish a unique presence in the market, and third parties such as VARs and integrators can tailor application-based solutions to the needs of particular customers or verticals.” Read more…

911Websiterepair announces Emergency Website Repair and Restore services for the do it yourself webmaster and the professional.

April 25, 2009 Leave a comment

Waterbury, CT, April 21, 2009 John A. Monteleone, CEO, launched 911websiterepair.com for the growing market of “Do It Yourself” webmasters in need of “Pay As You Go” website development solutions. Customers hire dedicated Virtual Programmers by the hour or by the task and reduce costs by using the “Pay As You Go” pricing structures. Through a partnership with SecureNext Software Corporation (SNS), 911websiterepair.com provides skilled virtual developers to our customer base who build and manage their own websites, but occasionally need assistance to get the tasks done that are outside of their skill level. Monteleone stated ”online website building assistance is generally done by quote only, but through our relationship with SNS, there are no quotes, 911websiterepair provides virtual programming assistance for a low cost hourly or per task fee.”

App Store tally: 20,000 apps in seven months

February 11, 2009 Leave a comment

iPhone and iPod touch users looking to download software from Apple’s App Store now have 20,000 programs to choose from—at least according to one Web site’s count.\ 

Apptism, an iPhone app activity aggregator, says that the 20,000th iPhone app was added to the store some time on Tuesday. Rob Libbey of apptism says his site monitors the App Store hourly and constantly updates the total number of apps available. As this article was posted, apptism’s tracker had already topped 20,150 apps.

 

If apptism’s count is accurate—when contacted for comment, Apple declined to confirm the number of apps available for download—it would mean that 5,000 new programs had arrived on the App Store in less than a month. After all, it was only January 16, when Apple officially announced that it had topped the 15,000 app mark.

Then again, a 5,000 app influx isn’t outside the realm of possibility. On December 5, Apple announced that there were 10,000 apps in the store—meaning it took the company a little more than a month to add the 5,000 apps needed to reach the Apple-confirmed 15,000 mark.

That’s a lot of gas-passing simulators and novelty noisemaker apps.

No matter how many apps are in the store officially, the App Store has seen booming business since it came online nearly seven months ago. The store opened its virtual doors on July 11, 2008, with just 500 apps.