Add AdMob ad on your Android App [ XML Implementation ]

Download AdMob SDK and put jar file on your project libs folder.

Include this code in your mainfest file before  </application> tag:

 


<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

 

Include this code in your mainfest file before  <application  tag:


<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

 

Add this on your xml layout:

 


<com.google.ads.AdView android:id="@+id/adView"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 ads:adUnitId="a14e176c0a170e2"
 ads:adSize="BANNER"
 ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID"
 ads:loadAdOnCreate="true"/>

“a14e176c0a170e2″ is sample AdUnit ID. Replace this with your AdUnitID in real app.

or you can check full xml file:

 


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
 android:orientation="vertical"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent">
 <com.google.ads.AdView android:id="@+id/adView"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 ads:adUnitId="a14e176c0a170e2"
 ads:adSize="BANNER"
 ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID"
 ads:loadAdOnCreate="true"/>
</LinearLayout>

 

Import import com.google.ads.*;

Add this on your Java code:

 


AdView adView = (AdView)this.findViewById(R.id.adView);
 adView.loadAd(new AdRequest());

My Full Java Code:

 


package com.example.admob;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.LinearLayout;

import com.google.ads.*;

public class MainActivity extends Activity {

 @Override
 public void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);

// Look up the AdView as a resource and load a request.
 AdView adView = (AdView)this.findViewById(R.id.adView);
 adView.loadAd(new AdRequest());
 }

 }

You can run now and able to see the result.

Write Mathematical Formula and Equation on WordPress post or page

Hi,

I just developed a simple Plugin for wordpress. That will help you to write Mathematical Equation on your WordPress Blog.
It’s easy and you can add any Mathematical formula on your wordpress post or page by equation shortcode.

Add or edit a post or page, put your Formula or Equation. Like


[ equation]\frac{1+sin(x)}{y}[/equation]

NB: If you copy code from here, Remove Space before equation shortcode.

You will see like below:

\frac{1+sin(x)}{y}

Now try to anything you need.

(a + b)^3 = a^3 + 3a^2b + 3ab^2 + b^3

E=mc^2

Some Path Findings Algorithms you may Like

http://qiao.github.com/PathFinding.js/visual/ is  nice Visual Representation of Some PathFinding Algorithms. It is really help me to understand some basic difference among those algorithm.

You can also search about these algorithm: 

  • D*
  • Field D*
  • IDA*
  • Fringe Fringe Saving A* (FSA*)
  • Generalized Adaptive A* (GAA*)
  • Lifelong Planning A* (LPA*)
  • Simplified Memory bounded A* (SMA*)
  • Theta*

Remove You may use these HTML tags and attributes from WordPress comment Form

By default, after your  comment form, you will see:

You may use these HTML tags and attributes: <a href=”” title=””> <abbr title=””> <acronym title=””> <b> <blockquote cite=””> <cite> <code> <del datetime=””> <em> <i> <q cite=””> <strike> <strong>

If you want to remove it form Comment Form you can remove it by very easy CSS trics:

Add this in your CSS stylesheet:


.form-allowed-tags{

display:none;

}

Then it will removed from your Comment form. Very easy, is not it?

Robot-als-project

Operating System for Robot

I was thinking to develop a Robot myself as i like Robot so much. I believe one day Science Fiction about Robot and Robotics will come true.
You know we need to operate our robot by a System name Operating System. Many days ago, i was thinking to develop a Operating System for Robot to invest my time as  there is so many Operating System for Computer and Mobile.

When i am thinking something new, every time i come Google and search about it. Then i discover myself a Backdated inventor. Cause there is so many solution about my idea already in this planet. And the Idea was invented many years ago. Then i am thinking, Why i did not born before??
Oh! i lost my track, i was talking about Operating System for Robot. When i was thinking Developing Operating System for Robot will a good idea and i search about it, i also found some solution :( yeah! i am also backdated here.

If i am going to develop a Operating System for my robot that will not kill too much time of mine? Is “Reinventing the wheel” is a better idea? I don’t think so as others. Today i am going to introduce a Operating System for Robot. Name Robot Operating System (ROS).
ROS (Robot Operating System) provides libraries and tools to help software developers create robot applications. It provides hardware abstraction, device drivers, libraries, visualizers, , package management, low-level device control, implementation of commonly-used functionality, message-passing between processes, and package management and many more.

ROS was originally developed in 2007 under the name switchyard by the Stanford Artificial Intelligence Laboratory in support of the Stanford AI Robot  project.

From 2008, development continues primarily at Willow Garage, a robotics research institute/incubator, with more than twenty institutions collaborating in a federated development model.

ROS is completely open source (BSD) and free for others to use, change and commercialize upon. Our primary goal is to enable software developers to build more capable robot applications quickly and easily on a common platform.

Want to Develop a Robot? These Link my help you:

Good luck for your Robot :) Happy Robotics!

Finding root directory in php

Sometime we need to get root directory for access some content form root directory or other directory that can be access form root directory.

You can print root directory by:

Example:

<?php
print ($_SERVER[‘DOCUMENT_ROOT’]);
?>

<?php

echo $_SERVER[‘DOCUMENT_ROOT’];
?>

Practically you may do not want to print the directory address, you use to locate some file form your directory, at that case you can use like:

<?php

require(($_SERVER[‘DOCUMENT_ROOT’]).’/test/test.php’);
?>

is not it easy??

Break long post into two or more pages

Sometimes you have written a long post and it become very lengthy and uncomfortable for your reader to read. At that case you need to Break long post into two or more pages. What you can do is to split it into several short posts. To do it, simply add a

<!--nextpage-->

to the part of the post that you want to split.

To show the pagination at the bottom of the post, insert the line

<?php wp_link_pages();?>

to your theme single.php after the line  <?php the_content(‘read more …’); ? >

Add Top Level Theme or Plugins Option Page in WordPress

If you want to appear you theme or plugins option page on top of the menu like Dashboard, Tools, or Settings. You need to add a function that will create a new top level menu section in the admin menu sidebar and registers a hook to callback your function for outputting the page content when the linked menu page is requested. Here is the example:

<?php
add_action('admin_menu', 'register_custom_menu_page');

function register_custom_menu_page() {
 add_menu_page('custom menu title', 'custom menu', 'add_users', 'call back url', '', 'level icon url', 6);
}
?>

If you want to learn more, visit WordPress function reference page.