How to put adsense anywhere in your blog post!

Friday, December 14, 2007 | Labels: | 1 comments |

[Source] This is a tutorial to let you put adsense anywhere inside your blogger post. It works for both the old blogger and the beta blogger. If you look through my blog, you'll see that I got it pretty much in every post. You can experiment with this and put multiple ads in, but in here i will only tell you how to put a single block of ads anywhere inside your post.

It should look like this when it's done.Ok, first, start off by logging into your adsense account and create a new ad. I suggest something small, like a banner or a small square. Get the code, copy it, and paste it into the adsense parser. Press parse, now copy that parsed code.

For new Blogger
Go to your template section, press edit html, check expand widget templates, hit ctrl-f and find "data:post.body", now replace that tag with the following code.

<div expr:id='"aim1" + data:post.id'></div>

<div style="clear:both; margin:10px 0">

<!-- Your AdSense code here -->

</div>

<div expr:id='"aim2" + data:post.id'>

<data:post.body/>

</div>

<script type="text/javascript">
var obj0=document.getElementById("aim1<data:post.id/>");
var obj1=document.getElementById("aim2<data:post.id/>");
var s=obj1.innerHTML;
var r=s.search(/\x3C!-- adsense --\x3E/igm);
if(r>0) {obj0.innerHTML=s.substr(0,r);obj1.innerHTML=s.substr(r+16);}
</script>
Replace "your adsense code" with your parsed adsense code.

For old Blogger
Find the $BlogItemBody$ tag, and replace it with the following code.

<div id="prv<$BlogItemNumber$>"></div>

<div style="clear:both;margin:10px 0">

<!-- Your AdSense code -->

</div>

<div id="fst<$BlogItemNumber$>">

<$BlogItemBody$>

</div>

<script type="text/javascript">
var obj0=document.getElementById("prv<$BlogItemNumber$>");
var obj1=document.getElementById("fst<$BlogItemNumber$>");
var s=obj1.innerHTML;
var r=s.search(/\x3C!-- adsense --\x3E/igm);
if(r>0) {obj0.innerHTML=s.substr(0,r);obj1.innerHTML=s.substr(r+16);}
</script>

Now
Now in every blog post, simply type
<!-- adsense -->
wherever you want adsense to appear.
Ps. Remember that google only allows 3 ad blocks per page. If you try to display more, it just won't show.

Have fun and good luck monetizing!

Your First Java program - Part 2 - Console

Thursday, December 13, 2007 | Labels: | 3 comments |

This series is not yet finished. Stay tuned!
A console is where people can test code and run simple programs. It is mostly made for the sake of finding bugs from a program. Thus, it is not the most versatile way to display things, but it will do for now.

In most video games (half life, sims, etc), cheating requires you to toggle the "console", which is usually accomplished by the "~" key. If you remember this, you'll know that a console appears to be mostly lines... and yes, it is, most of the time, lines.

That's the command "println", as you saw on part 1.

Ok, now let's make our own console, continuing from where we left off in part 1.
import hsa.Console;

public class HelloWorld
{
public static void main (String[] args)
{
Console c = new Console ("My Console");
c.println ("Hello World! Again...");
}
}
As we can see here, we have imported a package from the built in library of Java commands. In fact, all these programming languages (C#, C++, delphi, java, etc) are all competing to have the largest library so coders don't have to write everything! Honestly, if I were to teach you how to write the Console class, I would probably get carpal tunnel.

Inside the main method, we have made a console named "c". Notice, a console is an object by itself, so we are using an object (console) inside an object (HelloWorld). The point of OOP is to reuse objects to make our life easier.

For now, you must, when defining any object, use the proper syntax of

Object objectName = new Object;

Or else it won't work.

You must also understand Camel Notation, which is what the godly Java community came up with the make Java code readable. The rules are simple, for names of objects, start each word with a capital letter, like "Console" or "HelloWorld". For names of primitives, start each word with a lower cased letter, and any preceding words with capitals, ie. "thisIsAnInteger" or "costPerMillion".

And since there is a method called "println" in the class "Console", we can use

c.println("text");

to print out a line on the console.

By the way, notice how there are ";" after some lines? The semicolon is to indicate that a statement is finished. I will talk more about this when we do loops.

Stay tuned for Part 3 - Primitives and Loops!

Your First Java program - Part 1 - Hello World

Wednesday, December 12, 2007 | Labels: | 0 comments |

This series is not yet finished. Stay tuned!

Welcome to Object Oriented Programming (OOP). When I used to read tutorials, I hated long introductions where the author rambled on about his biography, precautions, etc. Most of those junk are actually useless. So for this tutorial, I’m going to get right to the point.

We are going to make a simple program today. It will give you a feel of Java, and object oriented programming. Be sure to read every word, for every word is important.

To start, you need an Integrated Development Environment (IDE), which is a program where you can write code in. Why don’t just use notepad you say? Because with an IDE, it compiles and catches errors for you; it is much easier.

For starters, there are many free IDEs such as Eclipse, JCreator, and NetBeans. The code I will talk about here will work for all these IDEs, you simply have to copy them in and press the “compile” button, wherever it is in your IDE.

After installing the IDE, let’s play with some code :)

public class HelloWorld
{
public static void main (String[] args)
{
System.out.println("Hello World");
}
}
What this did: public class HelloWorld creates a new object called "HelloWorld" (the class is an object). Inside the object, we created a method called "main", this is by default what the program runs no matter what other methods you put into the class. Inside main, we use the system console to print out a line on the screen, "Hello World."
When we defined the main method, we can see that it is public: any other object can access this (other choices are private and protected) it is also static: an easy way to explain this would be that you can't use "this" command inside the method... we are going to talk about this later. It is also a void: it returns nothing (other options can be anything, we are going to talk about returning stuff later). The Strings[] args inside the brackets are the method's arguments, or the parameter by which it must be ran.

Sorry, a lot of thing I'm leaving to explain later, because they are truly beyond you right now.

Find your compile button on your screen and compile the code. You will see a single line on the screen, nothing too exciting -_-'

To make things funner, we can make a console. Proceed to Part 2.

 
Free URL Redirection @ .co.nr