A - Z Tricks and Tips for Layout Optimization and Highest CTR

Google Adsense is perhaps the easiest way to attract advertisers from across the globe to your blog. Just submit your blog to Google for approval. If Google likes what it sees, it will place contextual ads linking to products likely to appeal to the readers. Each time a reader clicks a link, the advertiser pays Google a small fee, and Google splits that with you.

The next interesting question - How to Make Money with Google Adsense ? Here are The best Google Adsense Tips and Tricks for making more money (profit) from Google adsense program.

Precautions for Google AdSense before testing on your website

If you are testing your new website layout, you might be reloading your website pages again-n-again. And if these pages contain Google Ads, each time your reload your page, you make a request to Google Ads Server for a new set of ads.

Certainly Google is unaware that you are testing your website and it might even penalize your account for "click-fraud" since the IP requesting ads remains same. And if in the worst-case scenario, you might accidently click on your own ads. And these extra "ad impressions" will also chance your CTR data.

One simple way to avoid this serious problem is to remove the Adsense code altogether from your page before testing. But this may not be the best solution as your Google Ads are an important part of your layout. So here are a few simple but effective workarounds:

1. Instead of using Adsense code, add a static graphic (jpg image) with the same dimesions as your adsense code. (Google itself provides static images of various ad formats.)

2. Modify the value of google_ad_client to something like "pub-googleIamTesting"

3. Add another line to Google Adsense code google_adtest = "on"; Don't forget the semicolon.

4. Though there is no official comment, it is safer to remove the google_ad_channel variable.

Or contact Google Adsense Team with your query. Google folks are very quick to respond.

Google AdSense policies require that websites displaying Google ads be active and not under construction. When your site is complete and active, you may add the AdSense
ad code.

Show Adsense ads in individual post

First of all you should know how to show adsense ads in between the posts.
For that You will have to follow the steps below :

Step 1: Sign in to your adsense account and get the adense code.
Now, you have to parse the code using online parser. Paste your adsense code here and you will get the parsed code.

Step 2 : Sign in to your blogger account and from Template panel go to Edit-HTML. Expand HTML and then put your adsense code in the following format.
Example is given here :


For Wordpress users : I will prefer a plugin “Shylock Adsense” using which you can have adsense ads of different sizes, type on selected posts. You can fully customize your ads’ looks, it’s placement and much more.

Guide for Google AdSense Publishers

If you are a regular visitor to my site, you might have noticed some changes in the style. Well, I drew most of the inspiration from the picture above also known as the "heat map".


This “heat map” illustrates ideal ad placements on a sample page layout. Google folk have published an elaborate Optimization Tips page for Google Adsense publishers.


Looking at my recent adsense statistics, I must admit that the above illustration is fairly nice. The colors fade from dark orange (strongest performance) to light yellow (weakest performance). All other things being equal, ad placements above the fold tend to perform better than those below the fold. Ads placed near rich content and navigational aids usually do well because users are focused on those areas of a page.


Google has done an impressive presentation to woo new Adsense Publishers.


Adsense for Content remains my primary source of revenue from this blog. I do not use "Adsense for Search" as Googlebot doesn't index my site too well. Yahoo! spiders do a better job, atleast in my case.

How Invalid Adsence Clicks Detect by Google

Fooling Google Adsense is like you make a donkey yourself
Thinking to cheat AdSense?Stop that. It will never bring you anywhere. You might pull it off with smaller ads network, but definitely not with Google. Here are some detection methods they might use. At the very least, they have the resources to do so.

IP Address If the AdSense click is originated from the same IP Address as the one used for accessing your AdSense account, your account is flagged.

Cookies Most home users do not use static IP Address for Internet connection. In most cases just disconnect and reconnect will give you a new IP Address. But don’t forget, Google has set cookies on your computer.

How I Place Adsense Code in Blogger Post

There is trick to add Google AdSense and other advertising network such as AdBrite ad unit right beside and inside within Blogger post content, so that the ad block will appear wrapped and floated inline to the top left or top right next to the blog text. If you do not like this layout and dislike the prominent location the ads are displayed, there are other places within blog post to put the ad code.


How to install/uninstall the preview tool of AdSense?

The preview tool is available in all active AdSense languages. Installing the tool is easy, and only takes a few minutes. To install it, you'll need to add a registry file to your Windows system, by following the instructions below.

By installing and/or using the AdSense Preview Tool, you agree to abide by the Google Toolbar Terms of Use (which can be found at http://toolbar.google.com/terms) as if such terms applied to the AdSense Preview Tool and Google's advertising services.  Notwithstanding the Terms of Use, you agree to use the AdSense Preview Tool solely to manage your AdSense account or as part of a good faith evaluation of the AdSense program to help you determine whether to enroll as an AdSense publisher.  You may not use the AdSense Preview Tool in any manner that could damage, disable, overburden, or impair any Google services.

No AdSense Ads Below Blog Title or Post Title

By referring to Google AdSense placement heat map, we put Google AdSense ads above blog content (below post title) for better performance. But Google AdSense team does not quite agree with the ads placement.


QuickOnlineTips received an email from Google AdSense support pointing out the issue on their site.

In fact, Google Adsense Blog published 2 guidelines earlier and one of them is “ads shouldn’t be placed under a title or section heading in a way that implies that the ads are not ads.”

I didn’t take much attention to the guideline because I thought mine is different than the example. My AdSense ads was separated by categories and date. But it seems AdSense team think the different.

AdSense team advised QuickOnlineTips that:

publishers may not label the Google ads with text other than ’sponsored links’ or ‘advertisements’.

As a result, QuickOnlineTips now put a “ADVERTISEMENT” word above the AdSense ads.

Cleaning (Refreshing) Cache in Magento

The Magento Admin panel calls it refreshing (Refresh) the cache, while within the code it’s refered to as “cleaning” the cache.

If you want to Refresh your cache within the admin panel, simply go to System > Cache Management. Drop the box labeled “All cache” down to the Refresh option and hit the Save cache setting button near the upper-right of the window.

If you want to clear your cache from the command line, SSH into your server and get into the base directory of your magento installation. Type the following commands:

cd var/cache
rm -rf *

If you want to clean the cache from within your code (maybe within a cron or something), you’ll need to place the following PHP code within your script wherever you need the cache cleaned:....

Create Custom Category Attributes with phpMyAdmin (Tutorial)

The following is a brief tutorial for creating a custom category attribute. This has only been tested by creating a textfield-type attribute in Magento’s version 1.3.2. However, to the best of my current knowledge, it should work in any versions 1.2+ and for any type of attribute. Note: changing the attribute type will require a couple changes to the SQL below. So on we go…

  • 1. Open your Magento database using phpMyAdmin.
  • 2. We will first find the proper attribute_id for your new attribute.  Run the following SQL statement and keep the resulting number handy: 

Some Best Practices for C# Application Development

Few days ago, in one my earlier posts, I discussed about “Some Best Practices for Silverlight Application Development (XAML)” which got a huge hit by my readers. I got a lot of feedback on that too. Someone from the community also suggested that I write some best coding practices on C#. This struck my mind and hence I decided to write some best practices about C# coding here from my past few years of experience.
For the past few years, I learned a lot and tried to share the best of my knowledge to others who are new in the software development field. I contribute this post to those fellow members. Hope, I will get more feedback and/or suggestions here too.
I liked C# programming when I started with .NET technology. I never tried to write code in VB.NET as I decided my career on that. When I was new to this field, I made a lot of mistakes and from those mistakes I learnt more things. There’s a proverb: “Mistakes make you learn more & more…”. My career was one of them. Also there’s a proverb: “There’s no end to learning in life. Each second, a person can learn”. So, if there are any more suggestions, please share those with me. It will help me and others to learn more in a proper way.
One second, there are various posts available on the internet regarding the same topic. If you do a Google, you will get a number of them. But these collections are based on my experiences, those I learnt and thought of sharing.
Let’s stop here and start discussing the Best Coding Practices of C# application development. Here are some of them:

  • Use proper Naming Conventions
    • Always use Camel or Pascal naming format
    • Avoid all uppercase or lowercase names
    • Never use a name which begins with numeric character
    • Always prefer meaningful names for your class, property, method, etc.
    • Never build different names varied by capitalization
    • Don’t use the same name used in .NET Framework
    • Avoid adding prefixes or suffixes for your identifiers
    • Always use “I” as prefix for Interfaces
    • Always add “Exception” as suffix for your custom exception class
    • Never prefix or suffix the class name to its property name
    • Prefix “Is”, “Has” or “Can” for boolean properties
    • Don’t add prefix for your controls
  • Decide between Value Types and Reference Types
  • Always Use Properties instead of public variables
  • Use Nullable data types whenever required
  • Prefer Runtime Constants over Compile time Constants
  • Prefer “is” and “as” operators while casting
  • Prefer string.Format() or StringBuilder for string concatenation
  • Use Conditional attributes when you need them
  • Use ‘0’ (zero) as default value enum value types
  • Chose between Equals() and Equal (==) operator
  • Always prefer the foreach(…) loop
  • Initialize member variables at the time of assignment
  • Initialize static member variables with static constructors
  • Use constructor chaining whenever possible
  • Minimize boxing & unboxing of objects
  • Properly utilize try/catch/finally blocks
  • Catch only that Exception which you can handle
  • Use IDisposable interface
  • Utilize LazyInitializer in most of the cases
  • Split your logic in several small and simple methods
  • Try to use Patterns & Practices like MVP/MVC/MVVM
  • Always prefer DataBinding to populate values in the UI

Delete Data in GridView Using Template Button

This article snippet explains how to delete data from GridView using template buttons.
Now we look at how to add template button in GridView. First select Edit Columns in GridView.



UserControl/Control : How to get a reference to an element of the template

When you want to create your own custom control, you have two choices: create a UserControl or inherit from one of the "Control's classes" (ContentControl, ItemsControls or Control itself). When doing so, you'll surely need to access to the visual parts of your template from the code to add to it a nice behavior.

In this post, we'll discover how to access the template children by using the FindName method even on UserControl.

You Create a Control

I won't explain how to create a custom control, so here is its base code:

[TemplatePart(Name = "PART_MyGrid", Type = typeof(Grid))]
  public class MyCustomControl : ContentControl
  {
    private Grid myAimedGrid;
 
    static MyCustomControl()
    {
   //Overrides the style by ours
      DefaultStyleKeyProperty.OverrideMetadata(typeof(MyCustomControl),
          new FrameworkPropertyMetadata(typeof(MyCustomControl)));
    }
  } 
 
 

Limitation of Blogger ( Blogspot) Blogs

There are usage limits imposed by every free service, including Blogger.com. Often, the limits are necessary for design purposes (e.g., how much space to cater for each form field), logistics (e.g., server space and speed) and financial considerations. Most of the answers on the amount of storage space, limitations on posts, etc. are found in Blogger Help. However, since we still receive queries on that, we thought we shall add a few more items to that list for the benefit of the new Bloggers. These limits apply to one Google account, and if you find yourself exceeding these limits, one solution would be to register for an additional Google account to enjoy the services.

SQL DB Restore using PowerShell

If you are looking for a PowerShell script that lets you restore a database from a backup (.bak) file to MSSQL server, then this is the right place for you.

Database Restore - SQL

Let’s say you have a .bak file (Example: AdventureWorks), and you would like to restore it to an SQL server using PowerShell. If you use SQL Server 2008 Management Studio and click on the “Script” button, you will get the SQL statement that will do that restore for you.



The way to find a hotspot

Today I want to describe the way to find a hotspot without profilers. I often use this approach and find it effective and simple enough. The only tools you need are any Windows debugger (I prefer WinDbg, but you can use your favorite one) which should always be in your hands if you decided to investigate some performance issue (as well as any other problem with your software) and tool like Process Explorer which are available free from Windows Sysinternals. You can use this method without profiler at all or in conjunction with profiler to clarify the result of profilers work.

Before explaining the approach, I want to define the term “hotspot”. There are different definitions which can be applied in different contexts. In this article, we consider a hotspot as a limited set of instructions on which execution spends significant CPU time or more CPU time than you expect from it.

The process is divided into the three steps. If you used a profiler and have a call graph, you can miss the first two steps and jump to step number three to verify the profilers result and find out the hotspot most precisely. Nevertheless, I recommend you to go through all the steps because the results returned by profilers sometimes can be very obscure and you will lose time rolling around a call graph or other related information. Even if your profiler was absolutely right, you’ll have one more confirmation of its result. Sometimes it’s better to check twice. :)


Fixed -problems installing Windows Phone Developer Tools

Today, I had some troubles first uninstalling my existing CTP release of the Windows Phone Developer Tools. It was a required step to be able to install the newest release of these tools.

Now that I managed to uninstall the previous version, I have found other problems installing the newer one. More precisely, the problem appeared when trying to install the Windows Phone Developer Resources package, getting an error like the following in the automatic web installer (it surprisingly required a reboot when starting to install it, and the error did pop up when resuming the install process after the reboot).



How to create an animated expander

The expander control can be used in a lot of situations but the one proposed by default is quite "rigid".

In this post we will discover how to animate it quite simply just via XAML !


The WPF engine lets us redefine the template of the controls and we'll just do that.

The goal aimed

What we aim is to get the same functionnality as the original expander.
This is not as simple as we tought and I've seen a lot of expander loosing some of their behaviors when they became "animated" : original value of IsExpanded ignored, ExpandDirection ignored, etc...

The Compound Case of the Outlook Hangs

This case was shared with me by a friend of mine, Andrew Richards, a Microsoft Exchange Server Escalation Engineer. It’s a really interesting case because it highlights the use of a Sysinternals tool I specifically wrote for use by Microsoft support services and it’s actually two cases in one.

The case unfolds with a systems administrator at a corporation contacting Microsoft support to report that users across their network were complaining of Outlook hangs lasting up to 15-minutes. The fact that multiple users were experiencing the problem pointed at an Exchange issue, so the call was routed to Exchange Server support services.

The Exchange team has developed a Performance Monitor data collector set that includes several hundred counters that have proven useful for troubleshooting Exchange issues, including LDAP, RPC and SMTP message activity, Exchange connection counts, memory usage and processor usage. Exchange support had the administrator collect a log of the server’s activity with 12 hour log cycles, the first from 9pm until 9am the next morning. When Exchange support engineers viewed the log, two patterns were clear despite the heavy density of the plots: first and as expected, the Exchange server’s load increased during the morning when users came into work and started using Outlook; and second, the counter graphs showed a difference in behavior between about 8:05 and 8:20am, a duration that corresponded exactly to the long delays users were reporting:

15 Things that Twitter calls spam


Ever wondered what twitter considers spam ? Well here is a list to start with
  1. If you have followed a large amount of users in a short amount of time;
  2. If you have followed and unfollowed people in a short time period, particularly by automated means (aggressive follower churn)
  3. If you repeatedly follow and unfollow people, whether to build followers or to garner more attention for your profile
  4. If you have a small number of followers compared to the amount of people you are following
  5. If your updates consist mainly of links, and not personal updates
  6. If a large number of people are blocking you
  7. The number of spam complaints that have been filed against you
  8. If you post duplicate content over multiple accounts or multiple duplicate updates on one account
  9. If you post multiple unrelated updates to a topic using hashtags
  10. If you post multiple unrelated updates to a trending or popular topic
  11. If you send large numbers of duplicate @replies
  12. If you send large numbers of unsolicited @replies in an attempt to spam a service or link
  13. If you repost other user’s content without attribution.
  14. If you have attempted to “sell” followers, particularly through tactics considered aggressive following or follower churn.
  15. Using or promoting third-party sites that claim to get you more followers (such as follower trains, sites promising “more followers fast,” or any other site that offers to automatically add followers to your account).