Cron crashes with Fatal error: Call to undefined function dsm() in….

Fatal error: Call to undefined function dsm() in /home/content/63/10229663/html/sites/all/modules/ed_classified/modules/classified_notifications/classified_notifications.module on line 188

Here is the offending line of code:

182 /**

183 * Callback for cron to send queues mail jobs.
184 *
185 * @param array $job
186 */
187 function classified_notifications_deliver($job) {
188   dsm($job, __FUNCTION__);
189   drupal_mail_system('classified_notifications', $job['key'])->mail($job['message']);
190 }
Here just comment or remove 188 line will help you for sure 🙂

How to have number field in drupal

Hello pals,

I knew many of you are searching for number field type like mobile/landline field types in drupal. As drupal integer type wont support 10numbers for mobile or landline..hence we will install a module names bigint to achieve this functionality

Just download and install that module..after enabling the module..

Goto structure->content types->your content type(basic page/classified ad/product)->manage fields

their create a new field with field type big int and configure it.

Thats it..now you can have any number in that field…enjoy 😀

how to remove text format in drupal 7

Folks,

I have gone thru many solutions to remove the text format options(shown below)

24-02-2014 10-22-31

 

But there is a simple solution instead of adding code snippets in some templates..bla bla..

Just install simplify module and enable it.

Then go to configuration->userinterface->simplify and check text format selection to hide in nodes and click save..

you are done dude..go n have a look 😉

Show results while script is still executing

Guys,

Would you like to see results while script still executing..??

good..try the below code..i tested this and its working perfect..finally understood output buffering a bit 😉

<?php

if (ob_get_level() == 0) ob_start();

for ($i = 0; $i<10; $i++){

echo “<br> Line to show.”;

//echo str_pad(”,4096).”\n”;

ob_flush();
flush();
sleep(1);

}

echo “Done.”;

ob_end_flush();

?>

How to find execution time in php

Guys,

For every project we will check performance of execution..In order to check performance first and foremost thing we do is..checking execution time..right?

Now lets see how can we write a script to check execution time..

Basically we will use microtime() function to calculate execution time..

At starting of execution we will call microtime() and ending of script also we will call microtime()..Now we will calculate endtime-starttime to get execution time..for more clickhere

Example:

<?php
$time_start = microtime(true);

// Sleep for a while
usleep(100);

{or}

//your code here

$time_end = microtime(true);
$time = $time_end – $time_start;

echo “Did nothing in $time seconds\n”;
?>

Example2:

<?php
/**
* Simple function to replicate PHP 5 behaviour
*/
function microtime_float()
{
list($usec, $sec) = explode(” “, microtime());
return ((float)$usec + (float)$sec);
}

$time_start = microtime_float();

// Sleep for a while
usleep(100);        (or)  //your code here

$time_end = microtime_float();
$time = $time_end – $time_start;

echo “Did nothing in $time seconds\n”;
?>

with this you can display execution time in seconds..if you want to display in mins..just add “$min = $time/60;” and echo $min.

Thats it..you are done with your code now 😀

How to convert php web application to native desktop application

Guys,

I successfully converted my php application to native desktop application using phpdesktop

I will let u know how can u successfully convert your web application to desktop application..

Steps:

1. Download phpdesktop from the above link(phpdesktop)

2. Extract zip file

3. Now you can see www folder in that extracted package..right? just copy your files in that..

4. Now the important thing is settings.json file..all you need to configure here..

5. If you dont want to see console on back of your application then just give “show_console”: false

6. Note always your your webserver url is http://127.0.0.1 not http://localhost and port number is default ‘0’ if you wish to change that..you can do that in settings.json “listen_on”: [“127.0.0.1”, 263]. By this you can use this 127.0.0.1:263 where ever you need to redirect to home page..

7. Willing to change the title of desktop application from php desktop chrome to your title..then do that in settings.json  “title”: “Your title”

Still you have queries ?? then post your quesions here

How to generate StatCounter code for wordpress

How to generate StatCounter code for wordpress:

1. Go to the stat counter site and create a new account.
2. Login to your account and click on Add a StatCounter project.
3. Enter your blog URL and other details in the form and click on Next.
4. Now click on “Configure and Install code”.
5. Configure the counter and click Next.

6.Goto your wordpress dashboard->widgets->Text widget-> Paste code->Save.

You are done with your statcounter now..just go and verify your blog once 😀