Archive

Posts Tagged ‘Programming’

Regular Expressions Cookbook

June 14th, 2009

I have in my hand the book “Regular Expressions Cookbook”, by Jan Goyvaerts and Steven Levithan. Very well written and I would like it to be part of your library, if it is not already there.

I think that reading on many programming languages simultaneously can be confusing for readers. I would have liked to see the book written for only one language. That way, the reader could have focused only on one language at a time.

I found a typo on page 275. The excerpts

Discover

16 digits, starting with 6011, or 15 digits starting with 5.

I think that this should be replaced with

16 digits, starting with 6011, or 16 digits starting with 65.

I think that the reular expression itself is correct.

Hope that this error stands corrected in next edition of the book.

Vikas Shukla is currently working as Senior Design Engineer at BL Healthcare. He has degree in Computer Science and Engineering from IT-BHU, Varanasi, India. Mr. Shukla has over 15 years of experience in design of microprocessor-based systems. His expertise includes signal integrity, architecture and design of remote patient monitoring systems. The views expressed are his own.

Programming , ,

Adsense Account Disabled

June 11th, 2009

Today my adsense account was disabled. I am not sure of the exact reason. But I am not sure it was something that I manipulated deliberately or deliberately. I had purchase a traffic from ebay ( something like 10,000 page views for $10). It did gave some traffic – mostly from China. I saw a number of clicks on my ads because of that – although there was no money from that. This could have created problems.

I am following it up with google. Here is the letter I received.

Hello,

While going through our records recently, we found that your AdSense
account has posed a significant risk to our AdWords advertisers. Since
keeping your account in our publisher network may financially damage our
advertisers in the future, we’ve decided to disable your account.

Please understand that we consider this a necessary step to protect the
interests of both our advertisers and our other AdSense publishers. We
realize the inconvenience this may cause you, and we thank you in advance
for your understanding and cooperation.

If you have any questions about your account or the actions we’ve taken,
please do not reply to this email. You can find more information by
visiting

xxxxxxx

Sincerely,

The Google AdSense Team

internet marketing ,

Installing WordPress for Blog / News Section

June 10th, 2009

Many persons wanted to know how I got my wordpress blog up and running. Actually this is much simpler than you actually think. This can be used for a news section of your website, or a blog section of your main website. In some cases, it can be the main page of your website.

Here are the steps.

1. First create a mysql database and keep the database name, database username and password handy.

2. Download the latest version of wordpress from http://wordpress.com – At the time of writing, the latest wordpress version was 2.7.1. Unzip it to the “news” subfolder of your website.

3. Rename the wp-config-sample.php file to wp-config.php and fill in the database details.

4. Open the browser and run the installation script wp-admin/install.php

5. The basic wordpress should be up and running. You can login into it and create new blog or news. However, it looks too common. You may like to change the wordpress theme. Look for some good wordpress themes and install the themes. Place the unzipped theme file is /wp-content/themes. This particular theme is inove theme. Now login to wordpress admin panel and activate the new theme.

6. Activate akismet ( search google for – Akismet WordPress) more information about it. This is required for stopping spam comment.

7. YOu may like to disable the pingback. Search google for “pingback disable wordpress”.

The basic worpress based page should be up and running. You may like to improve the looks, graphics etc.

Programming

Using explode function in php

January 17th, 2009

Problem

I have a list of emails separated by comma. This is stored in a string For example

$to = “x1@abc.com,x2@abc.com,x3@abc.com”

I need to read this string, separate them and print them in one line each in php.

Solution

You can use php explode function to achieve the result.

<?php

// Example to show usage of explode function in php

$to = “x1@abc.com,x2@abc.com,x3@abc.com”;
$pieces = explode(“,”, $to);

$x = count($pieces);
while ( $x >=0)
{
echo $pieces[$x];
echo “<br />”;
$x–;
}

?>

Copy paste the code and run it. It will print the things in reverse order

x3@abc.com
x2@abc.com
x1@abc.com

I will leave it as an excercize to you to modify the program to print the array element in normal order.

Programming ,

Changing the links of the META

December 25th, 2008

In the side bar of the wordpress there are links like this

Meta
Site Admin
Logout
Entries RSS
Comments RSS
WordPress.com

Now you want to remove or change these links. To do this go to Design -> Theme Editor. Click on Sidebar (sidebar.php) Look for

<?php wp_register(); ?>
<li><?php wp_loginout(); ?></li>

Now remove or change the following lines after that

<li><a href=”http://validator.w3.org/check/referer” title=”This page validates as XHTML 1.0 Transitional”>Valid <abbr title=”eXtensible HyperText Markup Language”>XHTML</abbr></a></li>
<li><a href=”http://gmpg.org/xfn/”><abbr title=”XHTML Friends Network”>XFN</abbr></a></li>
<li><a href=”http://wordpress.org/” title=”Powered by WordPress, state-of-the-art semantic personal publishing platform.”>WordPress</a></li>

This will remove the links you wanted to. You may like to retain the Site-Admin and the log in button.

seo ,

How to Add Sidebar to Individual Posts

December 25th, 2008

My word press blog in up and running with issues. I do not know why the wordpress does not include sidebar navigation in individual posts.

By default they only include link to the previous and the next page. Hardly anything interesting.
The navigation menu is very important for you as it may take readers to the links you want. There may be links to your main websites.

It needs only two minor changes to make your sidebar visible. Goto Design -> Theme Editor. Click on the single post. The file single.php opens.

Now find

div id=”content” class=”widecolumn”>

and replace with

div id=”content” class=”narrowcolumn”>

This will ensure that there is enough room for the side bar.

The next is look for

just before this add

Programming ,