Blog Archives

2 Steps to make PHP GD library enable


If you plan to use php to process some images, you should make PHP GD library enable, to make it enable you can do like this.

Step 1: Check it enable?

You can create a php file and paste code below, then open it by your browser.


<?php

phpinfo();

?>

If you find result like below, you can be sure PHP GD library enable has been enable in your php develope evironment, and you can use it to process some images. If not, you can read step 2.

php gd library


To study python programming you should to know how to run python scripts, if you are using windows system, you can read ‘2 steps to run python command line in cmd‘, however, if you are using BSD’ish Unix system, you can do as follow steps.

Step 1: Check python interpreter has been installed on your unix system

Before you start to follow steps, you should make sure python interpreter has been installed, if not, you should install it, because executing python scripts need it. After you have installed, you should find the install path of it. Continue reading

2 steps to run python command line in cmd


Some friends are studying python programming in windows system, but they all meet with a problem: python command line can not be executed in cmd window.

That is a easy problem, we can solve it by steps blow:

Step 1: Check path you install python

If you have installed python interpreter, you should find its installed path, for example, it is C:\pyhon25, this path will be used in step 2.


MD5 is an encryption algorithm and is be used in many applications. It also have some types, for example, 16-bit,32-bit or 128-bit, In java, if you want to use 32-bit md5 to encrypt string, you can do like this:

Step 1: Create a 32-bit MD5 class in java

In java, a sample source code of  32-bit MD5 class is :


import java.security.MessageDigest;
public class MD5 {
 public static String encryptStr(String s){
 char hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
 try {
 byte[] bytes = s.getBytes();
 MessageDigest md = MessageDigest.getInstance("MD5");
 md.update(bytes);
 bytes = md.digest();
 int j = bytes.length;
 char[] chars = new char[j * 2];
 int k = 0;
 for (int i = 0; i < bytes.length; i++) {
 byte b = bytes[i];
 chars[k++] = hexChars[b >>> 4 & 0xf];
 chars[k++] = hexChars[b & 0xf];
 }
 return new String(chars);
 }
 catch (Exception e) {
 return null;
 }
 }

}

In android programming, we often should create bitmaps from a byte array, for example, when you want to take picture, you should create a photo from a byte array, meanwhile when you want to show a image from online, you also need create a bitmap from byte array.

So if you want to create a bitmap from byte array, if can do like this:

Step 1: Get a byte array which contains bitmap data

If you want to create a bitmap from a byte array, you should be sure this byte array contains the data of a image, if not we will not create one. This byte array can be got easily, for example, this byte array can be create by camera, reading a image on local or online website.


To run php script by command line in window system, first of thing you should concern is php script can run at you computer system, if php script can not run at you computer, you can see this article 4 Steps to run php script in your computer.

If php script can run at you computer, you can view steps follow.

Step 1: Find php.exe path

If you install php.exe by appserv, you can find php.exe path, for example this path is called:F:\PHP\server\php-5.3.5

4 Steps to run php script in your computer


If you plan to study php programming, you may want to know how to run php script in computer, if you say this, you can realize by follow steps:

Step 1:  Download appserv

Appserv logo

You can download this software at Appserv download,after you downloaded, you can view step 2.


If you have prepared environment of running android in eclipse, you can create an android project by it, the action steps is simple, you can do as follows:

Step 1: Open eclipse

Eclipse ico you can click Eclipse ico like this to open eclipse.


Method setImageDrawable(Drawable) is usually used to change image of imageview, If you have a png image in res/drawable folder in android project, you can use it as follow, meanwhile, if you do not know how to use it in android, you also can read steps below.

Step 1: Create an android project in Eclipse

You can use eclipse to create an android project easily and quickly, after you have done, you can continue;

3 Steps to run javascript in html


If you are studying javascript, you may want to know have to run it in html, you can do like this.

Step 1: Create a html file

You can create a html file by dreaweaver, TxtEdito or editplus, which named ‘test.html’, then open it.