Pages

Friday 26 April 2013

Javascript, Jquery : How to get all elements which name starts with some string?


A quick and easy way is to use jQuery and do this:

var $eles = $(":input[name^='q1_']").css("font-color","yellow");

That will grab all elements whose name attribute starts with 'q1_'. To convert the resulting collection of jQuery objects to a DOM collection, do this:
 
var DOMeles = $eles.get();
 
see http://api.jquery.com/attribute-starts-with-selector/

In pure DOM, you could use getElementsByTagName to grab all input elements, and loop through the resulting array. Elements with name starting with 'q1_' get pushed to another array:
var eles = [];
var inputs = document.getElementsByTagName("input");
for(var i = 0; i < inputs.length; i++) {
if(inputs[i].name.indexOf('q1_') == 0) {
eles
.push(inputs[i]);
}
}
 
 
 
You can use getElementsByName("input") to get a collection of all the 
inputs on the page. Then loop through the collection, checking the name
on the way. Something like this:

 <!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>

</head>
<body>

<input name="q1_a" type="text" value="1A"/>
<input name="q1_b" type="text" value="1B"/>
<input name="q1_c" type="text" value="1C"/>
<input name="q2_d" type="text" value="2D"/>

<script type="text/javascript">
var inputs = document.getElementsByTagName("input");
for (x=0;x<=inputs.length;x++){
myname
= inputs[x].getAttribute("name");
if(myname.indexOf("q1_")==0){
alert
(myname);
// do more stuff here
}
}
</script>
</body>
</html>
 
Demo 

Javascript : get all the object where id is like log_XXXX

Easy with jQuery

$("*[id\^='log\_']")
 
Otherwise...
var matches = [];
var elems = document.getElementsByTagName("*");
for (var i=0; i<elems.length; i++) {
if (elems[i].id.indexOf("log_") == 0)
matches
.push(elems[i]);
}
//matches now is an array of all matching elements.
 
 

Ok, here's a straight JavaScript answer:
 
/ a handy function to aid in filtering:
// takes an array and a function, returns another array containing
// only those elements for which f() returns true
function filter(a, f)
{
var ret = [];
for (var i=0; i<a.length; ++i)
{
if ( f(a[i]) )
ret
.push(a[i]);
}
return ret;
}

// this collects all elements in the current document
var elements = document.getElementsByTagName("*");

// and this filters out all but those that match our pattern
var logElements = filter(elements, function(el)
{ return /log_/.test(el.id) } ); // simple expression
 

PHP convert decimal (Float ) into fraction


if you want as like below : 
 

(.5); // return "1/2"

 then
 
call 

decimal_to_fraction(.5);

 
function decToFraction($float)
{
$whole = floor ( $float );
$decimal = $float - $whole;
$leastCommonDenom = 48; // 16 * 3;
$denominators = array (2, 3, 4, 8, 16, 24, 48 );
$roundedDecimal = round ( $decimal * $leastCommonDenom ) / $leastCommonDenom;
if ($roundedDecimal == 0)
return $whole;
if ($roundedDecimal == 1)
return $whole + 1;
foreach ( $denominators as $d ) {
if ($roundedDecimal * $d == floor ( $roundedDecimal * $d )) {
$denom = $d;
break;
}
}
return ($whole == 0 ? '' : $whole) . " " . ($roundedDecimal * $denom) . "/" . $denom;
}
 

JavaScript Array Delete Elements

Q. What is the difference between using the delete operator on the array element as opposed to using the Array.splice method? For example:



myArray = ['a', 'b', 'c', 'd'];

delete myArray[1];
// or
myArray
.splice (1, 1);
 
 

Ans.

Delete won't remove the element from the array it will only set the element as undefined.
So,

> myArray = ['a', 'b', 'c', 'd']
["a", "b", "c", "d"]
> delete myArray[0]
true
> myArray
[undefined, "b", "c", "d"]
> myArray.splice(0, 2)
[undefined, "b"]
> myArray
["c", "d"]
 
 

Array.remove() Method

John Resig, creator of jQuery created a very handy Array.remove method that I always use it in my projects.
// Array Remove - By John Resig (MIT Licensed)
Array.prototype.remove = function(from, to) {
var rest = this.slice((to || from) + 1 || this.length);
this.length = from < 0 ? this.length + from : from;
return this.push.apply(this, rest);
};
and here's some examples of how it could be used:
// Remove the second item from the array
array
.remove(1);
// Remove the second-to-last item from the array
array
.remove(-2);
// Remove the second and third items from the array
array
.remove(1,2);
// Remove the last and second-to-last items from the array
array
.remove(-2,-1);

How do I remove objects from a javascript associative array?

Use the "delete" keyword in Javascript.

delete myArray["lastname"];

Checking if an associative array key exists in Javascript

How do I check if a particular key exists in a Javascript associative array?

If a key doesn't exist and I try to access it, will it return false? Or throw an error?

It will return undefined.
var aa = {hello: "world"};
alert
( aa["hello"] ); // popup box with "world"
alert
( aa["goodbye"] ); // popup boc with "undefined"
undefined is a special constant value. So you can say, e.g.
// note the three equal signs so that null won't be equal to undefined
if( aa["goodbye"] === undefined ) {
// do something
}
This is probably the best way to check for missing keys. However, as is pointed out in a comment below, it's theoretically possible that you'd want to have the actual value be undefined. I've never needed to do this and can't think of a reason offhand why I'd ever want to, but just for the sake of completeness, you can use the in operator
// this works even if you have {"goodbye": undefined}
if( "goodbye" in aa ) {
// do something
}

Thursday 25 April 2013

How to Make your First iPhone App in XCode 4


How to Make your First iPhone App in XCode 4

 

Build Your First iPhone App


I hope you have configured your development environment properly with Xcode installed. If you haven’t done so, check out our previous article about what you need to begin iOS programming. We’ll use Xcode 4.3.2 to work on the tutorial. However, you can also Xcode 4.2 to build the app in case you can’t upgrade to the latest version of Xcode.
You may have heard of “Hello World” program if you have read any programming book before. It has become the traditional program for first-time learner to create. It’s a very simple program that usually outputs “Hello, World” on the display of a device. In this tutorial, let’s follow the programming tradition and create a “Hello World” app using Xcode. Despite its simplicity, the “Hello World” program serves a few purposes:
  • It gives you a better idea about the syntax and structure of Objective C, the programming language of iOS.
  • It also gives you a basic introduction of the Xcode environment. You’ll learn how to create a Xcode project and create user interface with the built-in interface builder.
  • You’ll learn how to compile a program, build the app and test it using the Simulator.
  • Lastly, it makes you think programming is not difficult. I don’t want to scare you away. :-)


Take a Look at Your First App

Before we go into the coding part, let’s first take a look at our version of the “Hello World” app. The final deliverable will look like this:
Hello World Deliverable
Your First iPhone App - Hello World
It’s very simple and shows only a “Hello World” button. When tapped, the app prompts you a message. That’s it. Nothing complex but it helps you kick off your iOS programming journey.

Start Coding!

First, launch Xcode. If you’ve installed Xcode via Mac App Store, you should be able to locate Xcode in the LaunchPad. Just click on the Xcode icon to start it up.
Xcode Folder
Once launched, Xcode displays a welcome dialog. From here, choose “Create a new Xcode project” to start a new project:
Xcode - Welcome Dialog
Xcode - Welcome Dialog
Xcode shows you various project template for selection. For your first app, choose “Single View Application” and click “Next”.
Choose Xcode Template
Xcode Project Template Selection
This brings you to another screen to fill in all the necessary options for your project.
Xcode Project Options
Project Options for Hello World App
You can simply fill in the options as follows:
  • Product Name: HelloWorld – This is the name of your app.
  • Company Identifier: com.appcoda – It’s actually the domain name written the other way round. If you have a domain, you can use your own domain name. Otherwise, you may use mine or just fill in “edu.self”.
  • Class Prefix: HelloWorld – Xcode uses the class prefix to name the class automatically. In future, you may choose your own prefix or even leave it blank. But for this tutorial, let’s keep it simple and use “HelloWorld”.
  • Device Family: iPhone – Just use “iPhone” for this project.
  • Use Storyboards: [unchecked] – Do not select this option. You do not need Storyboards for this simple project.
  • Use Automatic Reference Counting: [checked] – By default, this should be enabled. Just leave it as it is.
  • Include Unit Tests: [unchecked] – Leave this box unchecked. For now, you do not need the unit test class.
Click “Next” to continue. Xcode then asks you where you saves the “Hello World” project. Pick any folder (e.g. Desktop) on your Mac. You may notice there is an option for Source Control. Just deselect it. We’ll discuss about this option in the later tutorials. Click “Create” to continue.
Select Xcode Project Folder
Pick a Folder to Save Your Project
As you confirm, Xcode automatically creates the “Hello World” project based on all the options you provided. The screen will look like this:
Main Xcode Window for Hello World Project
Main Xcode Window for Hello World Project

Familiarize with Xcode Workspace

Before we move on to code your app, let’s take a few minutes to have a quick look at the Xcode workspace environment. On the left pane, it’s the project navigator. You can find all your files under this area.
Xcode Project Navigator
Project Navigator in Workspace
The center part of the workspace is the editor area. You do all the editing stuffs (such as edit project setting, class file, user interface, etc) in this area depending on the type of file selected.
Xcode Editor Utility Area
Editor and Utility Area in Xcode
The rightmost pane is the utility area. This area displays the properties of the file and allows you to access Quick Help. If Xcode doesn’t show this area, you can select the rightmost view button in the toolbar to enable it.
Lastly, it’s the toolbar. It provides various functions for you to run your app, switch editor and the view of the workspace.
Xcode Toolbar
Toolbar in Workspace

Run Your App for the First Time

Even you haven’t written any code, you can run your app to try out the Simulator. This gives an idea how you build and test your app in Xcode. Simply hit the “Run” button in the toolbar.
Xcode Run Button
Run Button in Xcode
Xcode automatically builds the app and runs it in the Simulator. This is how the Simulator looks like:
Run Hello World First Time
The Simulator
A gray screen with nothing inside?! That’s normal. As your app is incomplete, the Simulator just shows a blank screen. To terminate the app, simply hit the “Stop” button in the toolbar.
Xcode Stop Button
Terminate the Running App

Back to Code

Okay, let’s move on and start to add the Hello World button to our app. Go back to the Project Navigator and select “HelloWorldViewController.xib”.
Hello World XIB File
Select HelloWorld XIB File
As you select the file, the editor changes to an Interface Builder and displays an empty view of your app like below:
Hello World Interface Builder
Interface Builder in Xcode
In the lower part of the utility area, it shows the Object library. From here, you can choose any of the UI Controls, drag-and-drop it into the view. For the Hello World app, let’s pick the “Round Rect Button” and drag it into the view. Try to place the button at the center of the view.
Hello World Drag Rect Button
Drag the Round Rect Button to the View
To edit the label of the button, double-click it and name it “Hello World”.
Edit Hello World Button
Try to run the app again and you should have an app like this:
Run Hello World with Button
Now Hello World with a Button
For now, if you tap the button, it does nothing. We’ll need to add the code for displaying the “Hello, World” message.

Coding the Hello World Button

In the Project Navigator, select the “HelloWorldViewController.h”. The editor area now displays the source code of the selected file. Add the following line of code before the “@end” line:
1
-(IBAction)showMessage;
Your code should look like this after editing:
HelloWorldViewController Show Message
Next, select the “HelloWordViewController.m” and insert the following code before the “@end” line:
1
2
3
4
5
6
7
8
- (IBAction)showMessage
{
    UIAlertView *helloWorldAlert = [[UIAlertView alloc]
                                    initWithTitle:@"My First App" message:@"Hello, World!" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
   
    // Display the Hello World Message
    [helloWorldAlert show];
}
After editing, your code should look like below:
Source Code of HelloWorldViewController
Source Code of HelloWorldViewController After Editing
Forget about the meaning of the above Objective-C code. I’ll explain to you in the next post. For now, just think of “showMessage” as an action and this action instructs iOS to display a “Hello World” message on screen.

Connecting Hello World Button with the Action

But here is the question:
How can the “Hello World” button know which action to invoke when someone taps on it?
Next up, you’ll need to establish a connection between the “Hello World” button and the “showMessage” action you’ve just added. Select the “HelloWorldViewController.xib” file to go back to the Interface Builder. Press and hold the Control key on your keyboard, click the “Hello World” button and drag to the “File’s Owner”. Your screen should look like this:
Hello World Button File Owner Connection
Release both buttons and a pop-up shows the “showMessage” action. Select it to make a connection between the button and “showMessage” action.
Send Event Pop-up from File's Owner
Send Event Pop-up from File's Owner

Test Your App

That’s it! You’re now ready to test your first app. Just hit the “Run” button. If everything is correct, your app should run properly in the Simulator.
Hello World App
Hello World App
Congratulation! You’ve built your first iPhone app. It’s a simple app however, I believe you already have a better idea about Xcode and how an app is developed.

Building Your First Android App


Building Your First App

Dependencies and prerequisites

Welcome to Android application development!
This class teaches you how to build your first Android app. You’ll learn how to create an Android project and run a debuggable version of the app. You'll also learn some fundamentals of Android app design, including how to build a simple user interface and handle user input.
Before you start this class, be sure you have your development environment set up. You need to:
  1. Download the Android SDK.
  2. Install the ADT plugin for Eclipse (if you’ll use the Eclipse IDE).
  3. Download the latest SDK tools and platforms using the SDK Manager.
If you haven't already done these tasks, start by downloading the Android SDK and following the install steps. Once you've finished the setup, you're ready to begin this class.
This class uses a tutorial format that incrementally builds a small Android app that teaches you some fundamental concepts about Android development, so it's important that you follow each step

Start the first lesson ›

Creating an Android Project


Creating an Android Project

An Android project contains all the files that comprise the source code for your Android app. The Android SDK tools make it easy to start a new Android project with a set of default project directories and files.
This lesson shows how to create a new project either using Eclipse (with the ADT plugin) or using the SDK tools from a command line.
Note: You should already have the Android SDK installed, and if you're using Eclipse, you should also have the ADT plugin installed (version 21.0.0 or higher). If you don't have these, follow the guide to Installing the Android SDK before you start this lesson.

Create a Project with Eclipse


  1. Click New in the toolbar.
  2. In the window that appears, open the Android folder, select Android Application Project, and click Next.

  3. Figure 1. The New Android App Project wizard in Eclipse.
  4. Fill in the form that appears:
    • Application Name is the app name that appears to users. For this project, use "My First App."
    • Project Name is the name of your project directory and the name visible in Eclipse.
    • Package Name is the package namespace for your app (following the same rules as packages in the Java programming language). Your package name must be unique across all packages installed on the Android system. For this reason, it's generally best if you use a name that begins with the reverse domain name of your organization or publisher entity. For this project, you can use something like "com.example.myfirstapp." However, you cannot publish your app on Google Play using the "com.example" namespace.
    • Minimum Required SDK is the lowest version of Android that your app supports, indicated using the API level. To support as many devices as possible, you should set this to the lowest version available that allows your app to provide its core feature set. If any feature of your app is possible only on newer versions of Android and it's not critical to the app's core feature set, you can enable the feature only when running on the versions that support it (as discussed in Supporting Different Platform Versions). Leave this set to the default value for this project.
    • Target SDK indicates the highest version of Android (also using the API level) with which you have tested with your application. As new versions of Android become available, you should test your app on the new version and update this value to match the latest API level in order to take advantage of new platform features.
    • Compile With is the platform version against which you will compile your app. By default, this is set to the latest version of Android available in your SDK. (It should be Android 4.1 or greater; if you don't have such a version available, you must install one using the SDK Manager). You can still build your app to support older versions, but setting the build target to the latest version allows you to enable new features and optimize your app for a great user experience on the latest devices.
    • Theme specifies the Android UI style to apply for your app. You can leave this alone.
    Click Next.
  5. On the next screen to configure the project, leave the default selections and click Next.
  6. The next screen can help you create a launcher icon for your app. You can customize an icon in several ways and the tool generates an icon for all screen densities. Before you publish your app, you should be sure your icon meets the specifications defined in the Iconography design guide.
    Click Next.
  7. Now you can select an activity template from which to begin building your app. For this project, select BlankActivity and click Next.
  8. Leave all the details for the activity in their default state and click Finish.
Your Android project is now set up with some default files and you’re ready to begin building the app. Continue to the next lesson.

Create a Project with Command Line Tools


If you're not using the Eclipse IDE with the ADT plugin, you can instead create your project using the SDK tools from a command line:
  1. Change directories into the Android SDK’s tools/ path.
  2. Execute:
    android list targets
    This prints a list of the available Android platforms that you’ve downloaded for your SDK. Find the platform against which you want to compile your app. Make a note of the target id. We recommend that you select the highest version possible. You can still build your app to support older versions, but setting the build target to the latest version allows you to optimize your app for the latest devices.
    If you don't see any targets listed, you need to install some using the Android SDK Manager tool. See Adding Platforms and Packages.
  3. Execute:
    android create project --target <target-id> --name MyFirstApp \
    --path <path-to-workspace>/MyFirstApp --activity MainActivity \
    --package com.example.myfirstapp
    Replace <target-id> with an id from the list of targets (from the previous step) and replace <path-to-workspace> with the location in which you want to save your Android projects.
Your Android project is now set up with several default configurations and you’re ready to begin building the app. Continue to the next lesson.
Tip: Add the platform-tools/ as well as the tools/ directory to your PATH environment variable.

Learn Php step by step


Step By Steps

These tutorials will show you step-by-step how to create many usable applications for your website. These programs are all fully functional and ready to use right away on your website. All the code is presented to you and then explained so you can both use it and understand it. These do not explain each function in detail like our PHP tutorials do, but rather assume you have some basic PHP knowledge and just need help with the finished product.

How to change your website color based on the day of the week
How to use PHP to change the background color of your website based on the day of the week. This same concept than be applied to changing any website variables based on the day of the week.

How To Make a Holiday Countdown on Your Website.
How to make a countdown to Christmas using PHP on your website

Calculating Area with PHP
How to create a PHP program to collect the length and width from the user and then calculate the area of the rectangle. A free PHP Tutorial.

Dynamic PHP Banner with your Latest Twitter Post
How to use PHP to create a banner or signature that displays your latest Twitter post!

Creating Stardates with PHP
How to use calculate the star date (like the stardates on star trek) using PHP.

PHP Hex Color Chart
This simple PHP script lets you generate a chart of hex (hexadecimal) colors for use in web design

10 Cool Things To Do With PHP
So what can I do with PHP? Here are ten of our favorite fun (and useful) things you can use PHP for on your website. Looking for more PHP ideas? Check out our step-by-step section with lots of tutorials on other things you can do with PHP.

Calculating the Hypotenuse in PHP
How to calculate the Hypotenuse of a right triangle using PHP and the hypot function

Upgrade phpBB2 to phpBB3
How to upgrade your phpBB2 to phpBB3 without losing your information.
A Simple Rating System in PHP
A script that allows you to give a 1-5 star ratings for things on your site

Automatic Copyright Dates
This script automatically updates the copyright date on your website every year so that you don't have to worry about it.

Counting Outbound Clicks
Count which sites have the most click throughs off your site.

Extracting the File Extension
How to extract the extension (.jpg), (.gif), (.png), etc from the file name. This is useful if you are renaming the file.

Finding the Document Root
Often when installing scripts you need to know the document root. This simple script can give you that information.

Flip a Coin With PHP
Use PHP to flip a virtual coin for a yes or no answer. PHP code step by step to show you how to flip a digital coin.

Guess The Number Tutorial
This free tutorial teaches you how to write a simple guess the number game in PHP.

How to Template a Site Using PHP
How to create site templates for easy updating using headers and footers in PHP

Learn to convert temperature with PHP
Step by step guide to creating a temperature conversion program in PHP

Make Addslashes more Universal
Make a function that works to add slashes when magic quotes is on or off

Merry Christmas
The holiday version of the classic "Hello World" turned into "Merry Christmas" using the PHP print and echo functions.

PHP CSS Switcher
Allow your users to change CSS style on your site, using PHP and Cookies

PHP Flat File Counter
This tutorial shows you step by step how to create a flat file counter (no database) using PHP

PHP Login Script
PHP code to create a login script - Registration, login, members area, and logout

PHP Magic 8-Ball
Use PHP's Rand () function to create an online magic 8-ball - PHP Script tutorial

PHP Random Quote
This tutorial shows how to use switch () to display a random quote on your website - Free PHP Tutorial

Pregnancy Due Date Calculator
A PHP based online pregnancy due date calculator, step by step instructions on how to add a calculator to your page.

Random Quote Generator
Generate random quotes using a PHP switch loop

Redirect Based on the Day of the Week
Redirect users to a web page based on the day of the week, so you are directed to one page on a Monday, a different on a Tuesday, and a different on a Wednesday, etc. using PHP

Redirect Users to Hidden Pages
A simple password style redirect that sends a user to the word they enter plus .html as a way of hiding pages

Send an Email From a Web Based Form
A step by step guide to creating a program that sends an email to the site staff from a web based form

Setting Up A Short URL Forward
Sometimes when you have a really long, unfriendly URL you want something shorter and easier to remember. We show you how to do this using a PHP redirect.

Simple Address Book with PHP and MySQL
A step-by-step guide to creating an address book using PHP and MySQL

Simple Banner Rotation
Generate random banners on your site with PHP, or have random graphic rotation.

Simple PHP & MySQL Poll
This tutorial explains how to make a basic poll using PHP and MySQL, along with the GD Library to give a pie chart of the poll results.

Simple PHP Calendar
Learn how to generate a simple PHP calendar using our PHP calendar tutorial - Learn PHP free

Time Based PHP Greetings
How to create time based greetings using a PHP script

Today's Date using PHP
An example of how to print the current date on a web page written in HTML using PHP

Web Page Hit Counter
A very simple hit counter using PHP and MySQL

What Day of the Week Does it Fall on?
This script shows you how to find out what day of the week a specific date falls on by using PHP and the mktime function.

When is Columbus Day?
Columbus Day falls on the second Monday of October every year. So when is it this year? You can used PHP to determine it's date.

When Is Thanksgiving?
How to calculate when Thanksgiving day in the USA falls using a PHP script

World of Warcraft PHP Arena Points Calculator
PHP Code to add an Arena Points Calculator to your World of Warcraft website.

You Last Visited PHP Script
How to make a PHP script that welcomes the user and tells them when they last visited.

Monthly Calendar
This article shows you how to display a calendar for a given month, mainly using PHP's date() function. The article talks you through the process of creating a function which allows you to specify the month and year for it to output the calendar for the month.

PHP Based Chat Room
A step by step tutorial about how to create a PHP based chat room for your site.

How to fix it if your variables aren't passing!
How to fix your PHP code if your variable aren't passing

How to find a user's IP address using PHP
How to find a user's IP address using PHP

Calculate the date of Mother's day using PHP
A free PHP script to calculate the date of Mother's day in any particular year.

Five tips for making your PHP website more interactive
Five tips to help turn your PHP website into a more interactive experience for your readers, customers, or followers.

Learning PHP part 1
If you've decided that now is the time to start learning a programming language, let me help get you started with PHP!

Geometry & PHP part 1
A rundown of some of the geometric functions available to PHP Programmers.

Geometry & PHP part 2
More about math related PHP functions

Programing for Special Education
This article contains some helpful hints of tailoring your computer programs for use in special education classrooms.

Learn PHP

The essentials for learning PHP:

Learning a new language (programming or otherwise) can be a bit overwhelming. Many people just don't know where to start and give up before they even begin. Learning PHP is NOT as overwhelming as it might seem, I promise you. Just take it one step at a time, and before you know it you'll be off and running.

1.) Basic Knowledge:

The first thing you need, before you start learning PHP, is a basic understanding of HTML. You can switch between PHP and HTML right in the same document. You can even run PHP from an HTML file.

2.) Tools:

When creating PHP pages, you can use the same program you use to create your HTML pages. Any plain text editor will do. You will also need an FTP client to transfer files from your computer to your web hosting. If you already have an HTML website you most likely already use an FTP program.

3.) The Basics:

Now you can finally get started learning PHP! The first thing you should read is our PHP Basics tutorial. This will take you through creating your first file, using variables, basic math, and basic IF statements (a form of logic).

4.) Learning Loops :

Once you have mastered these skills, it is time to learn about loops. Loops repeat the same actions over and over again until a condition is met. There are several different types of loops which are explained in our Learning Loops tutorial.

5.) PHP Functions:

Finally, you can learn to write your own custom functions. From here the sky is the limit... With a solid knowledge of these PHP basics, adding PHP functions to your arsenal when you need them will be easy.

Now What?:

Where can you go from here? Our step-by-step tutorials show you how to put these PHP skills to use, by making practical scripts for your website. 

Wednesday 24 April 2013

Make money with your blog - Showing ads between your posts


Showing ads between your posts

If you want to show ads between your posts, first go to your Layouts tab. Then, in the "Blog Posts" section, click on "Edit." A pop-up window will appear with options to configure your blog posts. Check the box next to "Show Ads Between Posts." (Note: You must be signed up for AdSense before you can check this box.)
Once you check this box you'll see the configuration options for your ads. You can then select how often you would like ads to be shown after your posts.
For example, if you want ads to be displayed after every post, select "1" from the drop-down menu (please note that AdSense policy limits you to a total of 3 ad units per page, and Blogger will automatically prevent you from going over this limit). You can then select your ad format and colors. Once you have finished configuring your ads, click on the orange "Save" button.