Friday, February 28, 2014

Global can earn money wordpress blog Advertising Alliance Introduction–1 BidVertiser

1.what is bidvertiser

Pay per click advertising - online advertising directly on sites of your choice, internet marketing solution for online advertisers. Webmasters make money online.

it can earn money for your wordpress blog.

Office Web

2.Screen shots

2.1 my blog screenshots

In my blog, it will show like this:


3.Register and login

After your register,it no need audit,and can easy passed.

4.add websites

4.1 "MANAGE BIDVERTISERS” => “Add new BidVertise”:


4.2 checked “Add new BidVertiser under a new domain”

Use this option only if you would like to run the BidVertiser ads on another domain name.

Please fill in the information of the website you would like to place the BidVertiser ads on. After filling out the form, click "Finish".

4.3 BidVertiser Title:

Unique identifier to help you better manage your BidVertisers, for example, "index page", or "about us"

i typed “”

4.4 URL of your website:

Only enter the main URL of your website, as you will be able to place ads on every page under this URL
(e.g. on any page under

i typed “

not checked “3rd party ad server / URL forwarding: (optional)”

Check this box only if your ads are served from a different domain,
such as 3rd party ad server or URL forwarding that serves your website/blog in a frame with a different domain.

4.5 Primary language of your website:

i selected “english”

4.6 Select a category that most accurately describes your website:

Select main category

i selected “Computer and internet”

4.7 Select sub category

i selected “Web master and blog resource”

4.8 note:

Please be as accurate as possible, as the above information will be reviewed by our editorial team. Choosing the wrong language or category may lead to URL rejection.

4.9 clicked “finished”.

5.choose template

in “MANAGE BIDVERTISERS” => “BidVertiser Center”:

5.1 screenshots


5.2 selected your want to used for websites

i selected “”

5.3 clicked “choose template”

then popup one window ,and  screenshots:


it haved:

bannels: Full Banner (468x60) Leaderboard (728x90)

skyscrapers:Wide Skyscraper (160x600) Skyscraper (120x600)

rectangles:Medium Rectangle (300x250) Large Rectangle (336x280)

mobile: Mobile Banner (300x50)

5.4 selected your want choose

5.5 clicked update


6. preferences

6.1 click “preferences”


6.2 it will popup one options window:



Change preferences for the ads displayed on

BidVertiser Title:
Unique identifier to help you better manage your BidVertisers, for example, "index page", or "about us"
(optional) 3rd party ad server / URL forwarding:

Check this box only if your ads are served from a different domain, such as 3rd party ad server or URL forwarding that serves your website/blog in a frame with a different domain.
Display eBay Ads
Yes No
(Choose "No" to have only text ads running. eBay Ads are live eBay auctions ads. See example.)
(Choose "No" to have only text ads running. Image Ads are standard graphical ads)
Display Pop-Under Ads
Yes No
(Choose "No" to disable Pop-Under Ads. Please remember that Pop-Under Ads will result in much higher conversion bonuses in your monthly payment!)
Display Slider Ads
Yes No
(Choose "No" to disable Slider Ads. Allowing Slider Ads will result in higher revenues and we recommend having them enabled!)
Primary language of your website : English
Category: Computer & Internet --> Webmasters & Blogging Resources
* Your website category has been assigned and locked by our editorial team. If you feel that there is another category that better match your website, please contact us.

7 get advertisement code

7.1 clicked “get ad code”:


7.2 it will be popup one window:


Get the Ad Code for

Below you can find your personalized BidVertiser HTML code. Simply Copy (CTRL+C) and Paste (CTRL+V) it into the BODY of your HTML pages.
This code is specific for and for any inner pages under it. Placing it on different domain will result in clicks that will not be counted as valid.
(If you wish to run BidVertiser ads on another domain, simply click on "Add new BidVertiser" on the menu.)
Try to place the code above the scroll, near the top of your web pages, which can be viewed without scrolling. This will dramatically increase your click ratio, thus, your earnings.

Note: you will only need to paste this code once. Any future changes you will apply to the layout of the ads, like colors and fonts, will be updated automatically on your website.
Please note:
If you have just created this ad spot, please make sure to refresh the web pages where the code is placed on a few times to allow our ad servers to fully utilize.

8.result code

put your ad code to your web blogs.

 <!-- Begin BidVertiser code -->
<SCRIPT LANGUAGE="JavaScript1.1" SRC="" type="text/javascript"></SCRIPT>
<noscript><a href="">make money online</a></noscript>
<!-- End BidVertiser code -->

Tuesday, February 25, 2014

zend2 framework develop log 1– mysql and mvc and view helper and json response


This blog is about zend 2 framework,and not good. because is have so hard to read.


  • mysql profile.
  • mvc
  • no view render
  • json output
  • gzip compress
  • view helper


1.db profile (mysql)

1.1 db profile

1.1.1 config/autoload/local.php

(description:this is local private profile file.)

* Local Configuration Override
* This configuration override file is for overriding environment-specific and
* security-sensitive configuration information. Copy this file without the
* .dist extension at the end and populate values as needed.
* @NOTE: This file is ignored from Git by default with the .gitignore included
* in ZendSkeletonApplication. This is a good practice, as it prevents sensitive
* credentials from accidentally being committed into version control.


return array(
// Whether or not to enable a configuration cache.
// If enabled, the merged configuration will be cached and used in
// subsequent requests.
//'config_cache_enabled' => false,
// The key used to create the configuration cache file name.
//'config_cache_key' => 'module_config_cache',
// The path in which to cache merged configuration.
//'cache_dir' => './data/cache',
// ...
'db' => array(
'driver' => 'Pdo',
'username' => 'root',
'password' => '',
'dsn' => 'mysql:dbname=db1;host=localhost',
'driver_options' => array(
'service_manager' => array(
'factories' => array(
'Zend\Db\Adapter\Adapter' => function ($serviceManager) {
$adapterFactory = new Zend\Db\Adapter\AdapterServiceFactory();
$adapter = $adapterFactory->createService($serviceManager);


return $adapter;

1.1.2 config/autoload/global.php

(description:this is global profile file.)

* Global Configuration Override
* You can use this file for overriding configuration values from modules, etc.
* You would place values in here that are agnostic to the environment and not
* sensitive to security.
* @NOTE: In practice, this file will typically be INCLUDED in your source
* control, so do not include passwords or other sensitive information in this
* file.

return array(
// ...
'service_manager' => array(
'factories' => array(
=> 'Zend\Db\Adapter\AdapterServiceFactory',

1.2 model

data table is “Keyword”:

CREATE TABLE `pkrss_rsskeyword` (
`key` varchar(32) NOT NULL,
`count` int(11) NOT NULL,
`type` char(4) NOT NULL DEFAULT 'r' COMMENT 'r:rss b:bookimage',
UNIQUE KEY `key` (`key`,`type`)

and i used in module name “api”.

1.3 Module/Api/src/Api/Model/Keyword.php

(description:this is model data class.)

namespace Api\Model;

class Keyword
public $id;
public $key;
public $count;
public $type;

public function exchangeArray($data)
$this->id = (isset($data['id'])) ? $data['id'] : null;
$this->key = (isset($data['key'])) ? $data['key'] : null;
$this->count = (isset($data['count'])) ? $data['count'] : null;
$this->type = (isset($data['type'])) ? $data['type'] : null;

public function toArray(){
$ret = array();
$ret['id'] = $this->id;
$ret['key'] = $this->key;
$ret['count'] = $this->count;
$ret['type'] = $this->type;
return $ret;

1.4 Module/Api/src/Api/Model/KeywordTable.php

(description:this is model data table operator class.)

(i only test getkeywords function.)

namespace Api\Model;

use Zend\Db\TableGateway\TableGateway;
// use Zend\Console\Prompt\Select;
use Zend\Db\Sql\Select;

class KeywordTable
protected $tableGateway;

public function __construct(TableGateway $tableGateway)
$this->tableGateway = $tableGateway;

public function fetchAll()
$resultSet = $this->tableGateway->select();
return $resultSet;

public function getKeywords($type,$start=0,$limit=1)
$start = (int)$start;
$limit = (int)$limit;

$rowset = $this->tableGateway->select(function(Select $selector) use ($start,$limit,$type){
->order('count DESC')
->where(array('type' => $type));

$ret = array();
foreach ($rowset as $row) {
$ret []= $row->toArray();

return $ret;

public function getKeyword($id)
$id = (int)$id;


$rowset = $this->tableGateway->select(array('id' => $id));
$ret = $rowset->current();
$ret = $ret->toArray();

return $ret;

public function saveKeyword(Keyword $keyword)
$data = array(
'id' => $keyword->id,
'key' => $keyword->key,
'count' => $keyword->count,
'type' => $keyword->type,

$id = (int)$keyword->id;
if ($id == 0) {
} else {
if ($this->getKeyword($id)) {
$this->tableGateway->update($data, array('id' => $id));
} else {
throw new \Exception('Keyword id does not exist');

public function deleteKeyword($id)
$this->tableGateway->delete(array('id' => $id));

1.5 Module/Api/src/Api/Controller/SearchController.php

(description:this is one sub controller,it call model and output with gzip compress json and no view render.)

namespace Api\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;

* SearchController
* @see
* @author
* @version 1.0.0
class SearchController extends AbstractActionController
protected $keywordTable;

public function getKeywordTable()
if (!$this->keywordTable) {
$sm = $this->getServiceLocator();
$this->keywordTable = $sm->get('Api\Model\KeywordTable');
return $this->keywordTable;

* The default action - show the home page
public function indexAction()
// TODO Auto-generated SearchController::indexAction() default action
return new ViewModel();

//public function nolayoutAction()
// $view = new ViewModel();
// $view->setTerminal(true);
// return $view;
// }

* example: http://localhost/book/public/api/search/list
public function listAction(){

// get request param
$type = $this->params('type','b');
$start = (int)$this->params('start','0');
$limit = (int)$this->params('limit','20');

$table = $this->getKeywordTable();
$result = $table->getKeywords($type,$start,$limit);


// output json,and exit,then can no render view.

return false;

2. mvc

2.1 screen shots:


2.1 module


(description:this is module profile.)

* Zend Framework (
* @link for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (
* @license New BSD License

namespace Api;

// Add these import statements:
use Api\Model\Keyword;
use Api\Model\KeywordTable;
use Zend\Db\ResultSet\ResultSet;
use Zend\Db\TableGateway\TableGateway;

use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
use Zend\Mvc\ModuleRouteListener;
use Zend\Mvc\MvcEvent;

class Module implements AutoloaderProviderInterface
public function getAutoloaderConfig()
return array(
'Zend\Loader\ClassMapAutoloader' => array(
__DIR__ . '/autoload_classmap.php',
'Zend\Loader\StandardAutoloader' => array(
'namespaces' => array(
// if we're in a namespace deeper than one level we need to fix the \ in the path
__NAMESPACE__ => __DIR__ . '/src/' . str_replace('\\', '/' , __NAMESPACE__),

public function getConfig()
return include __DIR__ . '

public function onBootstrap(MvcEvent $e)
// You may not need to do this if you'
re doing it elsewhere in your
// application
$eventManager = $e->getApplication()->getEventManager();
$moduleRouteListener = new ModuleRouteListener();

// Add this method:
public function getServiceConfig()
return array(
'factories' => array(
'Api\Model\KeywordTable' => function($sm) {
$tableGateway = $sm->get('KeywordTableGateway');
$table = new KeywordTable($tableGateway);
return $table;
'KeywordTableGateway' => function ($sm) {
$dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
$resultSetPrototype = new ResultSet();
$resultSetPrototype->setArrayObjectPrototype(new Keyword());
return new TableGateway('pkrss_rsskeyword', $dbAdapter, null, $resultSetPrototype);

2.2 module config:


(description:this is module router profile.)

return array(
'controllers' => array(
'invokables' => array(
'Api\Controller\Search' => 'Api\Controller\SearchController',
'router' => array(
'routes' => array(
'api' => array(
'type' => 'Literal',
'options' => array(
// Change this to something specific to your module
'route' => '/api',
'defaults' => array(
// Change this value to reflect the namespace in which
// the controllers for your module are found
'__NAMESPACE__' => 'Api\Controller',
'controller' => 'search',
'action' => 'index',
'may_terminate' => true,
'child_routes' => array(
// This route is a sane default when developing a module;
// as you solidify the routes for your module, however,
// you may want to remove it and replace it with more
// specific routes.
'default' => array(
'type' => 'Segment',
'options' => array(
'route' => '/[:controller[/:action]]',
'constraints' => array(
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'defaults' => array(
'view_manager' => array(
'template_path_stack' => array(
'Api' => __DIR__ . '/../view',

2.3 view helper


(description:this is output with json and gzip detect.)

* Application
* @author
* @version
namespace Application\View\Helper;

use Zend\View\Helper\AbstractHelper;

class ArrayToXML
* The main function for converting to an XML document.
* Pass in a multi dimensional array and this recrusively loops through and builds up an XML document.
* @param array $data
* @param string $rootNodeName - what you want the root node to be - defaultsto data.
* @param SimpleXMLElement $xml - should only be used recursively
* @return string XML
public static function toXml($data, $xmlDoc, $xmlNode=null)
// loop through the data passed in.
foreach($data as $key => $value)
if (is_numeric($key))
// make string key...
$key = 'item';

// if there is another array found recrusively call this function
if (is_array($value))
$xmlNode2 = $xmlNode->appendChild($xmlDoc->createElement($key));

ArrayToXML::toXml($value, $xmlDoc, $xmlNode2);
$xmlTextNode = $xmlDoc->createTextNode($value);
$xmlUrlNode = $xmlDoc->createElement($key);

$log_file = null;
* OutputHelper Action Helper
* @uses actionHelper Zend_Controller_Action_Helper
* View Helper
class OutputHelper extends AbstractHelper

public function __invoke($in)
// TODO Auto-generated OutputHelper::__invoke
return $in;

public static function outputErrorMessage($code = -1,$msg = "Error"){
self::outputArray(array('code' => $code, 'message' => $msg));

public static function log($output){
global $log_file;
$log_file = fopen('1.txt','w');
fwrite($log_file,$output . "\r\n");

public static function outputArray($output,$type = 'json'){
$ret = self::getDataFromArray($output,$type);
return self::outputData($ret,$output);

public static function outputData($output,$type){
//header('Access-Control-Allow-Origin: *');

if ($type=='xml') {
header("Content-Type: text/xml");
} else if ($type=='js') {
header("Content-type: application/x-javascript");
} else if ($type=='txt') {
header("Content-type: text/plain");
} else {
header("Content-type: application/json");

return self::ob_echo($output);

public static function getDataFromArray($output,$type){

if ($type=='xml') {
$xmlDoc = new DOMDocument("1.0","utf-8");
$xmlNode = $xmlDoc->appendChild($xmlDoc->createElement("items"));

ArrayToXML::toXml($output, $xmlDoc, $xmlNode);

$xmlDoc->formatOutput = true;
return $xmlDoc->saveXml();
}else if ($type=='js') {
return @json_encode($output); // 'var result=' .
}else if ($type=='htm') {
return $output; // 'var result=' .
} else {
return @json_encode($output);

public static function is_gzip(){
if(defined('PKRSS_DEBUG') && PKRSS_DEBUG)
return false;
return false;
return substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip');

public static function ob_echo($content){
if (self::is_gzip())
echo $content;

return $content;

class UtilsHelper {
public static function getPost($name){
if(defined('PKRSS_DEBUG') && PKRSS_DEBUG)
return self::getParam($name);
return $_POST[$name];
return null;

public static function getGet($name){
return $_GET[$name];
return null;

public static function getParam($name){
return $_GET[$name];
else if(isset($_POST[$name]))
return $_POST[$name];
return null;

public static function getReferHost(){
if(defined('PKRSS_DEBUG') && PKRSS_DEBUG){
return '';

if(!isset($_SERVER["HTTP_REFERER"]) || empty($_SERVER["HTTP_REFERER"]))
OutputHelper::outputErrorMessage(-1,'http header referer checked fail!');
return parse_url($url, PHP_URL_HOST);

public static function safe_require($file){
require $file;
return true;
return false;


Sunday, February 23, 2014

jquery automatic translate plugin with bing and google publish– by pkrss developer log

pkrss toolset website

auto translate in web html


This php and javascript source can worked fine with jquery and other javascript framework.

This author want to used it in windows metro javascript application,and mobile web app and websites.


  • Simple
  • Efficient
  • Convenient
  • Free to modify
  • Scalable


Download source Online demo


(If simple usage,can skip this step)

  • On server, create mysql table:
    CREATE TABLE `pkrss_kv` (
    `key` varchar(767) NOT NULL COMMENT 'key',
    `value` TEXT NOT NULL COMMENT 'value',
    PRIMARY KEY (`key`)

  • On server, modify:

    // if want used HTTP header referer value mixed for "ap",then set to false or undefine this.
    // it can used for share for identify the same "ap" value with different websites.

    // if want to return http header "cache-control" value.
    if(!defined('PKRSS_DEBUG') || !PKRSS_DEBUG)

    //-- start mysql db setting
    //-- end mysql db setting

    //-- start bing translate api
    // if want to used bing translage api,then uncomment bellow lines:
    if (!defined('BING_ACCOUNT_KEY'))
    define('BING_ACCOUNT_KEY', 'xxx');
    //-- end bing translate api

    //-- start google translate v2 api
    // if want to used google v2 translage api,then uncomment bellow lines:
    // if (!defined('GOOGLE_API_KEY')) {
    // define('GOOGLE_API_KEY', '???');
    // define('GOOGLE_API_APPLICATION', '???');
    // }
    //-- end google translate v2 api

  • On client, see this demo with: client/index.html


simple usage

in your html,add some line:(If my website allow cross domain)

<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">
window.pkTOptions = {"apname":"your_demo_name"};
<script type="text/javascript" src="" async="async"></script>

Used your language.js and server.php:

<script type="text/javascript">
window.pkTOptions = {"url":"../server/server.php","apname":"your_demo_name"};
<script type="text/javascript" src="language.js" async="async"></script>

For want to translated dom,add class "pkT":

<span class="pkT">This is one example line!</span>

It looks like this:(If your browser language is not english)

This is one example line!

Advanced usage 1

Not auto translate:

<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript" src="//" async="async"></script>

And,want to do it in any time:

<script type="text/javascript">
if(_demo_usaged == 2){
window.pkTOptions = {"apname":"your_demo_name"};
window.pkTOptions._user_interval = window.setInterval(function(){


window.pkTOptions._user_interval = null;

window.pkTOptions.objT = new window.pkTranslateCls(window.pkTOptions);

Advanced usage 2

Dynamic translate dynamic doms

After that,want to translate by dynamic add dom elements:

<script type="text/javascript">	

After that,want to show all support languages:

<script type="text/javascript">	
if(result && result.langs)
;// result.result current is ["zh_CN","en","ja","ko"...]
// it will be modify by next timer,i will changed my news website:
// and will publish one country locale flag plugin with this plugin.
// wait for me...

Output languages:(result.langs)

And,there are javascript options manual:

window.pkTranslateCls = function(options) {
var extend = null;
if(options.fn && options.fn.extend){
extend = options.fn.extend;

// array item/object attribute, merge function
extend = jQuery.extend;

this.options = extend({
"service":"bing", // bing or google or other your server implement.
"delayToServer":3000, // in this microseconds,can merge many translate request in one,and sended one request to server.
"delayToDb":3000, // delay to save local storage
"currentUILanguage":null, // client browser language, if not set, plugin will auto detect this value.
"defaultHtmlLanguage":"en", // default html language code.if your html source not used english,then can changed this value.
"clsOnline":window.pkTCls, // you can custom implement pkTCls
"loadfun":this._loadfun, // load cached data to local storage,default used:window.localStorage.getItem()
"savefun":this._savefun, // save cached data to local storage,default used:window.localStorage.setItem()
"selector":".pkT", // dom selector,by this value,doms will work translated by this plugin.
"datakey":"pkTO", // if dom has this attribute, and options.fn.querytext is not null, and options.fn.setattr is not null,then will auto set this attribute
"donekey":"pkTD", // if translate dom,then set this attrbute.
"apname":'pkrss_demo', // ap name,can used in difference application.
"curretrytimer":1, // current retry network not fine condition.
"retrytimer":3, // total retry network not fine condition.
"url":'//', // translate server url
"startedCB":null, // if started,then call this function.ex: function cb(ok,objT){}

// if your not used jquery,then need set this value in options.fn.
this.options.fn = {};

// log function,can worked in ie6-
this.options.fn.log = function(s){
if(window.console && window.console.log)
// network ajax function
this.options.fn.ajax = jQuery.ajax;

// query dom function
this.options.fn.querydom = jQuery;

// query dom attribute function
this.options.fn.queryattr = function(obj,name){
return obj.prop(name);

// set dom attribute function
this.options.fn.setattr = function(obj,name,val){
return obj.prop(name,val);

// query dom text function
this.options.fn.querytext = function(obj){
return obj.text();

// set dom text function
this.options.fn.settext = function(obj,txt){
return obj.text(txt);
} = {};
this.queryed = {};
this.prepareList = [];


Bing translate languages Google translate languages

contact us

sitemap news blog shop api

Tuesday, February 18, 2014

xmpp jabberd2–part 1 – windows bin – publish here

windows win release binary comporess package can download from here:








source code will published some part,wait for me…

start: router.exe => c2s.exe => sm.exe => mu-conference.exe => bosh.exe


3.1 import db from db dir.

3.2 modify xml

in router.xml c2s.xml sm.xml bosh.xml muc.xml for your mysql profile and domain profile.default is localhost domain.

3.3 i need more time to finished this doc.

4 appendix

if your not install visual studio 2010,it can download it from here