Blog Archives


As a website designer, when we are designing our website, we should know whether people are using mobile ,pad or pc to visit our website, then our website can display them different scale page, mobile is small, pad is media and at last display big page in pc.

To answer this question we can use php, if your website is built by php, you can do like these two steps.

Step 1: Create a php function to check visitor are using mobile

To create a php function which can tell you whether visitors are using mobile or not, you can use code below:


function is_mobile_request()
{
 $_SERVER['ALL_HTTP'] = isset($_SERVER['ALL_HTTP']) ? $_SERVER['ALL_HTTP'] : '';
 $mobile_browser = '0';
 if(preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|iphone|ipad|ipod|android|xoom)/i', strtolower($_SERVER['HTTP_USER_AGENT'])))
 $mobile_browser++;
 if((isset($_SERVER['HTTP_ACCEPT'])) and (strpos(strtolower($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml') !== false))
 $mobile_browser++;
 if(isset($_SERVER['HTTP_X_WAP_PROFILE']))
 $mobile_browser++;
 if(isset($_SERVER['HTTP_PROFILE']))
 $mobile_browser++;
 $mobile_ua = strtolower(substr($_SERVER['HTTP_USER_AGENT'],0,4));
 $mobile_agents = array(
 'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac',
 'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno',
 'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-',
 'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-',
 'newt','noki','oper','palm','pana','pant','phil','play','port','prox',
 'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar',
 'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-',
 'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp',
 'wapr','webc','winw','winw','xda','xda-'
 );
 if(in_array($mobile_ua, $mobile_agents))
 $mobile_browser++;
 if(strpos(strtolower($_SERVER['ALL_HTTP']), 'operamini') !== false)
 $mobile_browser++;
 // Pre-final check to reset everything if the user is on Windows
 if(strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'windows') !== false)
 $mobile_browser=0;
 // But WP7 is also Windows, with a slightly different characteristic
 if(strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'windows phone') !== false)
 $mobile_browser++;
 if($mobile_browser>0)
 return true;
 else
 return false;
}

2 Steps to know install.rdf file in firefox


You have read article:3 Steps to create XPI file for FireFox by ZIP, you may find a special file:install.rdf, and do you know what it is and what effect of it? I think this article will help you.

create a xpi file for firefox

Step 1: What is install.rdf

install.rdf  file exists in process of creating a firefox extension, its  effect is provide some useful information on an extension, for example:

(1)The author’s name and home page

(2)The extension’s name and decription

(3)The extension’s version and about page etc.

3 Steps to create XPI file for FireFox by ZIP


To create a XPI file for firefox is very simple, you can read article 2 Steps to create XPI File for Firefox to get more detail informaiton.

However, if you want to know more detail, you can read this article, here i will give you a example.

Step 1: You should have a firefox extension source code

Before you plan to create a xpi file, you should have to have some source code for firefox extension, these source may like this:

create a xpi file for firefox

Step 2: Use zip application  you have installed on computer to zip these file

As above, you can zip .js, .json, .rdf file to a zip file.

Step 3: Rename zip file to xpi file

You can rename your created zip file into a xpi file, like showed above, it is called a Short URL Submit.xpi,then you can install and use it in firefox.

Category: Internet

TAG


As a website master, you must know a term: Doorway pages from google webmaster help, and we can not place your google adsense on this pages, however, do you know what is doorway pages and do you know how to create a doorway page?  This article will give you some good information.

Step 1: Know what is doorway pages

From google,we can know some basic information on Doorway pages, we can summarize to one sentence: doorway page is a kind of page that can cheat search engine and redirect visitors to other website.

Step 2: Create a test doorway page to know detail of it

To create a doorway page is very simple, before we create one, you should prepare some information.

(1)If you have a website, which introduce some football games, its domain name is http://www.stepor.com

(2)The traffic of my website is very small, i want to increase it

(3)I find people are interested in make money

(4)I plan to build a website which contains many pages on how to make money (These pages onley contains some words or sentence on how to make money), and search engine will index them.Fox example, this site domain name is http://www.makemoney.com

(5)When people search my makemoney.com and click to view it, my page will redirect to my site:http://www.stepor.com

For above i will find pages on site:http://www.makemoeny.com are doorway pages, because every page only contains some words or sentences on how to make money, but can not provide some useful information to visitors.

We can create a test doorway page:

<html>
<head>
<meta name="description" content="How to make 1000 dollars per day">
<meta name="keywords" content="make money">
<title>How to make 1000 dollars per day </title>
<meta http-equiv="refresh" content="0" url="http://www.stepor.com">
</head>
<body>
</body>
</html>

This is a doorway page, it can be indexed by google, however, when you click search result of google,you want to know some information on make money, but this page will open my football game site:http://www.stepor.com

Tips and Warnings:

(1)Do not create doorway pages because they are unworthiness.

Category: Internet

TAG

2 Steps to create XPI File for Firefox


If you have created a firefox extension, you should create a “.xpi” file in order to it can be installed, how to create it you may ask, you can do like these steps:

Step 1: Zip all your code and rename it into xpi file

In post Build an extension for firefox, we can get answer of create a xpi file for firefox, what you should do is zip your files and rename it into xpi file, however, you may get a fail result by this way, if you say yes, you can do like step two.

Step 2: Use Java jar.exe to create a xpi file

You also can use java jar.exe to create your xpi file, before you start, you should make sure you have installed a java jdk.

Then you can create a bat file to create, code like below:


set EXTENSION_NAME=content_blocker
set EXTENSION_HOME=C:/myextension/firefox
set EXTENSION_PATH=%EXTENSION_HOME%/%EXTENSION_NAME%
set JAVA_HOME=C:/ARCS/Dev/jre1.5
%JAVA_HOME%/bin/jar.exe cvfM %EXTENSION_PATH%.xpi -C %EXTENSION_PATH% .
pause

Then only thing what you do is run this bat file.

Category: Internet

TAG


In an android project, I need create a oval shape textview to show some warning information, a demo like below.

oval shape textview in android

In this demo, i created a oval shap textview to show “This is a text”, if you also want to realize it, you can do as these steps.

Step 1: Create a background drawable xml file for this textview

You can create a xml file in res/drawable , it may call floatwarning_text.xml, then you can copy code below into this file and save it.


<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
 <solid android:color="#cce8cf" />
 <corners android:radius="100dp"/>
 <stroke android:color="#cccacb" android:width="1dp"/>
 <padding android:left="5dp" android:top="5dp"
 android:right="5dp" android:bottom="5dp" />
</shape>

3 Steps to make a successful website


Every website master really want to build a successful website, however, most of them can not realize their dream. Do you know why? if you want to build a successful website too, this post may help you.

Step 1:  What service you can provide for your visitors

Think of this question: Why people visit your website?

Your website can provide a good news to them? or your website can provide a solution for their problems or your website can save their money when they plan to buy something?

Usually, visitors like to visit some websites only for they can get some help or valuable information from them, so if you wan to build a successful website, you must think what you can give for others.

Only you have solve this problem, you can start to build a website.

Tips and Warnings:

(1) Do not focus on the things that how to make money from my website, you should focus on your content and service you can provide for visitors.

(2)Do not ask yourself this question: what kind of website i should build continuously, you should ask yourself how can i provide better content and service to my visitors.


Yesterday, my boss asked me to write a program demo to get data at other website.His need is: if we use url:http://www.***.com/coord.php?coord=51.00, coord.php page will send a post request to website: http://www.***.com to and get ,print data.

From need, i know i should program a jsp demo, this functions are:

1.JSP page should send a post request to other website

2.JSP page should get response data and echo it.

To realize this need, we can do as follow:

Step 1: Create a jsp file

We can use eclipse to create a jsp file,meanwhile, you should make sure your created jsp file can be executed in your program, which means you should have a tomcat+jdk environment.


I have been built this blog for several days, however, i will receive many new user registration email notification every day,image below is my email list.

stepor new user registration

Is there any way to disable this kind of email notification for me? yes, you can do it like this.

Step 1: Download a disable new user registration notification plugin in wordpress

In wordpress system, there is a plugin called “Disable New User Notification Emails” that can disable  new user registration notification,which means wordpress will never email to you when someone have registered.

You can download this wordpress plugin at here.

Step 2: Install Disable New User Notification Emails

To install this plugin is very simple, if you do not know how to install, you can view this article “2 Steps to install wordpress plugin

2 Steps to use http referer in php


Recently, When i see the traffic number of my blog, i notice most of visitors come form other website. Google Analytics shows what they are,as picture below shows.

php link reference

By Google Analytics, i find most of visitors of my sites are from linkreferral.com, once i find it, i have a question:How to know google analytics know where these visitor come from?

I have search some papers by google and know it is that http referer helps google analytics to know where these visitors are from.

Step 1: What is http referer

I think http referer is a link, which means if you visit my blog by click a google search result, the information ‘google.com’ will be stored up in http referer, then my website or other website statistics tool,like google analytics, will know where you are from.


Today i open a url by my browser, i find my eclipse show error:java.lang.OutOfMemoryError: PermGen space,which means tomcat use too much memory.Then the web system can not be opened correctly.

To fix this problem is easy, you can search much solutions by google, today i introduce my solution steps.

Step 1: Close your eclipse and edit eclipse.ini

If you have opened window of eclipse, you should close it.

Then you should open eclipse.ini file and edit it.

If you do not know where this file is, you can find it at the install path of your eclipse. For example, paht:D:\Program Files\eclipse is my eclipse install path and eclipse.ini file is in directory of D:\Program Files\eclipse.


Nowadays,QR code is used widely,we can see it almost everywhere, cell app, advertisements and some news websites. It is a type of tow-dimensional barcode and provide a new and fashion way to get new message for us. if you plan to add it to your website, your advertisement or video, you may wonder how to create it and today we introduce  to use php and google api to create one.

Step 1: Check some useful information before creating a qr code

qr code is a carrier of message and massage it can carry is limited, 4,296 alphanumeric characters is its toplimit. So if you plan to use a qr code to store up your information, you must be sure the length of your information is not longer than 4,296.

Category: PHP Programming

TAG