Showing posts with label Web Tutorial. Show all posts
Showing posts with label Web Tutorial. Show all posts

Tuesday, May 17, 2011

Cara pasang Random Post di blogger

Random post adalah suatu cara menampilkan posting secara acak, Sebenarnya cara memasang random post sudah lama ada dan sudah banyak yang menulis, namun blogger yang baru memulai membuat blog masih saja bingung, mungkin tutorila yang digunakan/ditemukan masih menggunakan bahasa inggris. Agar gak membuat sahabat blogger kecewa saya tulis aja artikelnya secara singkat.

Langkah mudah membuat Random Post:

Pertama:

Buka Template -> Edit HTML -> Jangan lupa lakukan backup template :)
Kemudian Copy-paste kode dibawah ini biasanya atas tag </head>


<script type="text/javascript">
//<![CDATA[
var _yourBlogUrl = "
http://tutorial-on.blogspot.com";

function randomPost() {
  var script = document.createElement("script");
  script.setAttribute("type", "text/javascript");
  var theUrl = _yourBlogUrl +"/feeds/posts/summary?alt=json-in-script&callback=getTotalPostsCallback&start-index=1&max-results=1";
  script.setAttribute("src", theUrl);
  document.documentElement.firstChild.appendChild(script);
};
function getTotalPostsCallback(json) {
  var totalResults = json.feed.openSearch$totalResults.$t;
  if (totalResults > 0) {
    getRandomPostNumber(totalResults);
  }
};
function getRandomPostNumber(totalResults) {
  var randomNumber = Math.floor((Math.random() * totalResults) + 1);
  getRandomUrl(randomNumber);
};
function getRandomUrl(randomNumber) {
  var script = document.createElement("script");
  script.setAttribute("type", "text/javascript");
  var theUrl = _yourBlogUrl +"/feeds/posts/summary?alt=json-in-script&callback=getTheUrlCallback&start-index=" + randomNumber + "&max-results=1";
  script.setAttribute("src", theUrl);
  document.documentElement.firstChild.appendChild(script);
};
function getTheUrlCallback(json) {
  var theUrl = json.feed.entry[0].link[0].href;
  window.location.href = theUrl;
}
//]]>
</script>



=> Jangan lupa ganti warna merah diatas dengan nama blog kita, jika sudah jangan lupa disimpan


Kedua:

Kemudian Tambahkan sebuah Element halaman -> HTML/Javascript

<a href="javascript:randomPost();">View Random Post</a>

Jangan lupa disimpan dan lihat hasilnya :)

Saturday, March 12, 2011

Quick Search Tricks Google-style

While Google provides many search features, I'm sure not many of us who use it when performing a search of information. Finally we got the information from Google's tsunami storm that ultimately make our own confusion. We discuss yuk, effective search techniques it should be like what the heck.

In general, the type of search on Google there are two: Basic Search and Advanced Search. Basic Search is a search feature that is common when we use the direct access google.com.
basicsearch.gif
Meanwhile, Advanced Search provides a wide selection of good search feature for the operator basis, a file format that we want to find, language, region, etc..

Actually there are very many search features that we can use, but is not available in the Advanced Search menu option. In other words we have to incorporate the query in the search form on the Basic Search directly. Well game this query and search operators that actually we will discuss in this article.
BASIC FEATURES SEARCH

1. AND: Looking for information that contain both search terms. Can use one of the following three alternatives:
Jepara carving
AND Jepara carving
Jepara carving +

2. OR: Looking for information containing either of the two words. Can use one of two alternatives follows:
know OR Tempe
know | Tempe

3. Phrase: Search for information containing the search phrase using the mark ". " Example:
"Software"

4. NOT: The search results contain that word in front, but not the behind the minus (-). The example below will find information that contain the word fish but not the banding.
fish-banding

5. Synonyms (~): Searching for the word and its synonyms-synonyms. The example below will bring the search results: vehicle (car) and the synonym-synonyms.
~ car

6. Asterisk (*): Character replacement words. From the example below, the results obtained can: spicy grilled chicken, spicy fried chicken, cooked spicy chicken, etc.
spicy chicken *

7. SIGNS POINT (.): Character replacement letters, numbers and single character. From the example below, the results obtained can be: coffee, chef, scores, etc.
ko.i

8. Case insensitive: Search on Google considers capital and not capital as something similar. So, Romi satria Wahono, Romi Satria Wahono, or Romi SATRIA Wahono will bring the same results
9. NEGLIGENCE WORD: Google ignores the keyword in the form of single characters and words: a, about, an, and, are, as, at, b, by, from, how, i, ins, is, it, of, on, or , That, the, this, to, We, what, Pls, Nowhere, the which, with. If we still want the search word, can by using the + character in front of the search (example: Star Wars Episode + I), or it could be to regard it as a phrase (example: "Star Wars Episode I")

10. I'm Feeling Lucky: It would take us straight to the first results of our query

ADVANCED SEARCH FEATURE

1. DEFINE: Finding the definition of a term. From the example below, the results obtained are various definitions of e-learning from various sources
define: e-learning

2. CACHE: Showing a web site that has been indexed by Google, although no longer active. The example below will generate a word search on the site ilmukomputer.com php in Google's index.
cache: ilmukomputer.com php

3. LINK: Displays a list of links that point to a site. The example below will display a list of links that lead to sites ilmukomputer.com
link: ilmukomputer.com

4. RELATED: Displays a list of similar sites, similar or have a relationship with a site
related: romisatriawahono.net
5. INFO: Displays the information that Google know about a site
info: romisatriawahono.net

6. SITE: Displays specific search on a site designated
java site: ilmukomputer.com

7. Filetype: Displays search results in the form of a type (extension) a specific file. The file types that can be searched are: doc, xls, rtf, swf, ps, LWP, wri, ppt, pdf, mdb, txt, etc.. The example below will display the search results in the form of PDF files that contain the keyword software engineering
software engineering filetype: pdf

8. Allintitle: Displays all the search terms in the TITLE page. The example below will produce a page that has the title of java programming. allintitle can not be combined with operator (syntax) other. Use the intitle for it.
allintitle: java programming

9. Intitle: Displays a search term in the TITLE page. The example below will produce a page that has java title and content pages containing the word enterprise
intitle: java enterprise

10. Allinurl: Displays all the search terms in the URL. The example below will generate a list of URLs that contain the word java and programming. allinurl can not be combined with operator (syntax) other. Use the inurl for this purpose.
allinurl: java programming
11. Inurl: Displays a search term in the URL. The example below will generate a list of URLs that contain the word java and content pages containing the word enterprise
inurl: java enterprise

Search for what we do will be more effective if we try to incorporate some of the existing operators in the basic or advanced search features. For example, we want to find PDF files that exist on the site www.pdii.lipi.go.id. Then we combine the two operators to:
filetype: pdf site: www.pdii.lipi.go.id

Wednesday, December 15, 2010

Prinsip - Prinsip Desain Grafis

Dalam bekerja seorang desainer grafis harus mempertimbangkan berbagai prinsip demi mencapai hasil akhir yang baik. Prinsip-prinsip desain yang akan dijelaskan di bawah ini bukanlah sebuah nilai mati bahwa desain yang paling baik adalah seperti apa yang dikandung dalam prinsip tersebut. Tetapi sekadar anjuran beginilah seharusnya desain yang baik. Karena sesungguhnya tidak ada penilaian bagus atau jelek atas sebuah desain. Semuanya itu tergantung selera desainer grafis, klien dan khalayak yang menjadi sasaran pesan. Hal ini ditegaskan pakar desain grafis, Danton Sihombing dalam majalah Cakram: penilaian karya desain grafis sesungguhnya adalah menguji tingkat kelayakannya, dalam arti tidak ada karya desain grafis yang benar ataupun yang salah.

Prinsip - Prinsip Desain Grafis adalah sebagai berikut:
Kesederhanaan
Banyak pakar desain grafis menyarankan prinsip ini dalam pekerjaan desain. Hal ini sangat logis demi kepentingan kemudahan pembaca memahami isi pesan yang disampaikan. Dalam penggunaan huruf sebuah berita misalnya. Huruf judul (headline), subjudul dan tubuh berita (body text) sebaiknya jangan menggunakan jenis font yang ornamental dan njilimet, seperti huruf blackletter yang sulit dibaca. Desainer grafis lazim juga menyebut prinsip ini sebagai KISS (Keep It Simple Stupid). Prinsip ini bisa diterapkan dengan penggunaan elemen ruang kosong (white space) dan tidak menggunakan terlalu banyak unsur-unsur aksesoris. Seperlunya saja.
Keseimbangan
Keseimbangan adalah keadaan atau kesamaan antara kekuatan yang saling berhadapan dan menimbulkan adanya kesan seimbang secara visual. Prinsip keseimbangan ada dua, yaitu: keseimbangan formal (simetris) dan keseimbangan informal.

Keseimbangan formal memberikan kesan sempurna, resmi, kokoh, yakin dan bergengsi. Keseimbangan formal juga menyinggung mengenai konsistensi dalam penggunaan berbagai elemen desain. Semisal wana logo. Dalam desain kartu nama desain dibuat dengan full color (F/C). Tetapi dengan pertimbangan agar desain lebih variatif dan tidak membosankan, maka pada media desain yang berbeda Anda membuat logo tersebut dengan warna duotone. Nah, pada kondisi ini, gagasan variasi desain sebaiknya tidak diperlukan. Apa jadinya kalau logo tersebut adalah logo sebuah produk barang. Konsistensi juga sangat diperlukan sebagai kesan identitas yang melekat pada sebuah merek produk. Kita tidak mau konsumen sampai lupa pada produk yang dijual. Sedangkan keseimbangan informal bermanfaat menghasilkan kesan visual yang dinamis, bebas, lepas, pop, meninggalkan sikap kaku, dan posmodernis.
Kesatuan
Kesatuan adalah kohesi, konsistensi, ketunggalan atau keutuhan, yang merupakan isi pokok dari komposisi. Contohnya adalah ilustrasi, garis dan teks diberi raster sehingga memberikan kesan kesatuan terhadap pesan yang dimaksud.
Penekanan (aksentuasi)
Penekanan dimaksudkan untuk menarik perhatian pembaca, sehingga ia mau melihat dan membaca bagian desain yang dimaksud. Kalau dalam konteks desain surat kabar ini bisa dilakukan dengan memberikan kotak raster atas sebuah berita. Hal ini akan mengesankan pentingnya berita itu untuk dibaca oleh pembaca. Atau juga membesarkan ukuran huruf pada judul berita, sehingga terlihat jauh berbeda dengan berita lainnya. Penekanan juga dilakukan melalui perulangan ukuran, serta kontras antara tekstur, nada warna, garis, ruang, bentuk atau motif.
Irama (repetisi)
Irama merupakan pengulangan unsur-unsur pendukung karya seni. Irama merupakan selisih antara dua wujud yang terletak pada ruang, serupa dengan interval waktu antara dua nada musik beruntun yang sama. Desain grafis mementingkan interval ruang atau kekosongan atau jarak antar obyek. Misalnya jarak antarkolom. Jarak antar teks dengan tepi kertas, jarak antar 10 foto di dalam satu halaman dan lain sebagainya.
Demikian Prinsip - Prinsip desain Grafis, semoga bermanfaat
Terima kasih

Thursday, July 9, 2009

make Emoticon in PHP

Hullo halo, udah old likely caw nulis this Come on ane will write the simple article, gimana the way of fetching/parsing/ngambil emoticon-emoticon kept in database, continue to change the selected symbols in text with file image emoticon. Okeh direct.
* First, which udah surely, made the tables by the name of emoticon, his field merely two: "id" with " alt". Practical to so that execute aja direct code below/under in phpMyAdmin.
CREATE TABLE `db_ente`.`emoticon` (
`id` INT NOT NULL AUTO_INCREMENT ,
`alt` VARCHAR( 100 ) NOT NULL ,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM
Don'T forget to change ` db_ente` by the name of the database in computer ente. If there is no could dimembuat formerly with code below/under.
CREATE DATABASE `nama_db` ;

* Database all right, now remained masukkin his data, karna merely for trial and error, masukkin aja one record formerly.
INSERT INTO `db_ente`.`emoticons` (
`id` ,
`alt`
)
VALUES (
NULL , ':lol:'
);
With query above us masukkin alt emoticon ": lol:" ( lol = laughing out loud)
. * To image animation emoticon representing the symbol " lol", bikin/copy image wanted to directory emoticon/lol.gif. Become in the directory [is] equal to especial file, make the directory emoticon, trus copy of file image by the name of " lol.gif" ( haduh ribet gw ngomongnya). Ane [by] xself for this example [of] make animation from Plurk this one.
. * Now, function in PHP to fetching emoticon:
function fetch_emo($strnya) {
$hsl = $strnya;
$qE = mysql_query("SELECT * FROM emoticon") or die(mysql_error());
while ($aE = mysql_fetch_array($qE)) {
$offst = substr($aE["alt"], 1);
$img = "";
$hsl = str_replace($aE["alt"], $img, $hsl);
}
return $hsl;
}

* Last, implementation.
?
mysql_connect("localhost", "user", "password") or die(mysql_error()); //ganti sesuai MySQL ente
mysql_select_db("db_ente") or die(mysql_error());
?
html
head
title>Test Emoticon head
body
?
.$str_test = "Test kacang euy :lol:";
.$sesudah = .fetch_emo(.$str_test);
echo "Sebelum: $str_test

";
echo "Sesudah: $ssd";
?
body
html

Hasilnya:
Sebelum: Test kacang euy :lol:
Sesudah: Test kacang euy
Now, ane jelasin few [of] his [job/activity] way.
In first step and both, we draw up the database mo dipake to nyimpan string selected which mo di-replace with emoticon.
Karna kept in database, we can easily ngapus or nambah emoticon-emoticon newly.
In function fetch_emo() which we make in step fourth, we do query to database, and nge-parse one string emoticon ( in above example [of] ": lol:"), trus changed with image in directory emoticon/lol.gif. So, possibly [at] the questioning, lol.gif dapet where from ?? In this function, so that we is caw require to busy define path image, ane make path imagenya taken away from string among dots of two (":") added with ekstensi ". gif", so that kalo string emoticon-nya ": lol:", mean path image-nya is " lol.gif".

Wednesday, April 22, 2009

Sample developer app Facebook

Facebook installation instructions:
1. Add the developer app (http://www.facebook.com/developers/)
2. Setup a new application to get your API key and Secret key. You will also need to click optional fields and fill in your callback URL (the URL where the app files are stored on your server)
3. You also need to choose an app canvas URL. This can be anything you like that is available, but make a note of what you choose.
4. Finally, click "yes" to "Can your application be added to Facebook?" and then select "Users" for "Who can add it?".
5. That's it. Now install the files on your server and give it a shot!

App installation instructions:
1. Change your API KEY and SECRET in "appinclude.php" flie
2. Create a mysql database in your hosting and import "db.sql"
3. Modify "dbinfo.php" with your database name, database username and password
4. Change www.YOUR_DOMAIN.com to your domain name in all files
5. Change the canvas page url from "http://apps.facebook.com/YOUR_APP/" to your Canvas page url
6. Put gifts images in the "gifts" folder
NOTE: Each page will show 20 gift items... Right now the app is configured for 40 gift items. If you add more gifts please find the following in line 57
echo '<'a href="http://apps.facebook.com/YOUR_APP/?s=0">1<'a> | <'a href="http://apps.facebook.com/YOUR_APP/?s=21">2<'a>';
And add more links like this ... <'a href="http://apps.facebook.com/YOUR_APP/?s=41">3<'a>
7. Upload all files to your server and the app will be ready to go.

download






Friday, September 19, 2008

Tutorial for Decode and Encode Base64 or Decode MD5
this link
Decode and Encode Base64



Wednesday, April 30, 2008

C++ Language Tutorial : Classes (I)

A class is an expanded concept of a data structure: instead of holding only data, it can hold both data and functions. An object is an instantiation of a class. In terms of variables, a class would be the type, and an object would be the variable.
Classes are generally declared using the keyword class, with the following format:
class class_name {
access_specifier_1:
member1;
access_specifier_2:
member2;
...
} object_names;
Where class_name is a valid identifier for the class, object_names is an optional list of names for objects of this class. The body of the declaration can contain members, that can be either data or function declarations, and optionally access specifiers. All is very similar to the declaration on data structures, except that we can now include also functions and members, but also this new thing called access specifier. An access specifier is one of the following three keywords: private, public or protected. These specifiers modify the access rights that the members following them acquire:
private members of a class are accessible only from within other members of the same class or from their friends. protected members are accessible from members of their same class and from their friends, but also from members of their derived classes.
Finally, public members are accessible from anywhere where the object is visible.
By default, all members of a class declared with the class keyword have private access for all its members. Therefore, any member that is declared before one other class specifier automatically has private access. For example:

class CRectangle {
int x, y;
public:
void set_values (int,int);
int area (void);
} rect;
Declares a class (i.e., a type) called CRectangle and an object (i.e., a variable) of this class called rect. This class contains four members: two data members of type int (member x and member y) with private access (because private is the default access level) and two member functions with public access: set_values() and area(), of which for now we have only included their declaration, not their definition.
Notice the difference between the class name and the object name: In the previous example, CRectangle was the class name (i.e., the type), whereas rect was an object of type CRectangle. It is the same relationship int and a have in the following declaration:
int a;
where int is the type name (the class) and a is the variable name (the object).
After the previous declarations of CRectangle and rect, we can refer within the body of the program to any of the public members of the object rect as if they were normal functions or normal variables, just by putting the object's name followed by a dot (.) and then the name of the member. All very similar to what we did with plain data structures before. For example:
rect.set_values (3,4);
myarea = rect.area();
The only members of rect that we cannot access from the body of our program outside the class are x and y, since they have private access and they can only be referred from within other members of that same class.
Here is the complete example of class CRectangle:
// classes example
#include
using namespace std;

class CRectangle {
int x, y;
public:
void set_values (int,int);
int area () {return (x*y);}
};
void CRectangle::set_values (int a, int b) {
x = a;
y = b;
}

int main () {
CRectangle rect;
rect.set_values (3,4);
cout << "area: " << rect.area();
return 0;
}
The most important new thing in this code is the operator of scope (::, two colons) included in the definition of set_values(). It is used to define a member of a class from outside the class definition itself.
You may notice that the definition of the member function area() has been included directly within the definition of the CRectangle class given its extreme simplicity, whereas set_values() has only its prototype declared within the class, but its definition is outside it. In this outside declaration, we must use the operator of scope (::) to specify that we are defining a function that is a member of the class CRectangle and not a regular global function.

The scope operator (::) specifies the class to which the member being declared belongs, granting exactly the same scope properties as if this function definition was directly included within the class definition. For example, in the function set_values() of the previous code, we have been able to use the variables x and y, which are private members of class CRectangle, which means they are only accessible from other members of their class.
The only difference between defining a class member function completely within its class or to include only the prototype and later its definition, is that in the first case the function will automatically be considered an inline member function by the compiler, while in the second it will be a normal (not-inline) class member function, which in fact supposes no difference in behavior.
Members x and y have private access (remember that if nothing else is said, all members of a class defined with keyword class have private access). By declaring them private we deny access to them from anywhere outside the class. This makes sense, since we have already defined a member function to set values for those members within the object: the member function set_values(). Therefore, the rest of the program does not need to have direct access to them. Perhaps in a so simple example as this, it is difficult to see an utility in protecting those two variables, but in greater projects it may be very important that values cannot be modified in an unexpected way (unexpected from the point of view of the object).
One of the greater advantages of a class is that, as any other type, we can declare several objects of it. For example, following with the previous example of class CRectangle, we could have declared the object rectb in addition to the object rect:
// example: one class, two objects
#include
using namespace std;

class CRectangle {
int x, y;
public:
void set_values (int,int);
int area () {return (x*y);}
};

void CRectangle::set_values (int a, int b) {
x = a;
y = b;
}

int main () {
CRectangle rect, rectb;
rect.set_values (3,4);
rectb.set_values (5,6);
cout << "rect area: " << rect.area() << endl;
cout << "rectb area: " << rectb.area() << endl;
return 0;
}
rect area: 12
rectb area: 30
In this concrete case, the class (type of the objects) to which we are talking about is CRectangle, of which there are two instances or objects: rect and rectb. Each one of them has its own member variables and member functions.
Notice that the call to rect.area() does not give the same result as the call to rectb.area(). This is because each object of class CRectangle has its own variables x and y, as they, in some way, have also their own function members set_value() and area() that each uses its object's own variables to operate.
That is the basic concept of object-oriented programming: Data and functions are both members of the object. We no longer use sets of global variables that we pass from one function to another as parameters, but instead we handle objects that have their own data and functions embedded as members. Notice that we have not had to give any parameters in any of the calls to rect.area or rectb.area. Those member functions directly used the data members of their respective objects rect and rectb.
Constructors and destructors
Objects generally need to initialize variables or assign dynamic memory during their process of creation to become operative and to avoid returning unexpected values during their execution. For example, what would happen if in the previous example we called the member function area() before having called function set_values()? Probably we would have gotten an undetermined result since the members x and y would have never been assigned a value.
In order to avoid that, a class can include a special function called constructor, which is automatically called whenever a new object of this class is created. This constructor function must have the same name as the class, and cannot have any return type; not even void.

We are going to implement CRectangle including a constructor:

// example: class constructor
#include
using namespace std;

class CRectangle {
int width, height;
public:
CRectangle (int,int);
int area () {return (width*height);}
};

CRectangle::CRectangle (int a, int b) {
width = a;
height = b;
}

int main () {
CRectangle rect (3,4);
CRectangle rectb (5,6);
cout << "rect area: " << rect.area() << endl;
cout << "rectb area: " << rectb.area() << endl;
return 0;
}
As you can see, the result of this example is identical to the previous one. But now we have removed the member function set_values(), and have included instead a constructor that performs a similar action: it initializes the values of x and y with the parameters that are passed to it.
Notice how these arguments are passed to the constructor at the moment at which the objects of this class are created:
CRectangle rect (3,4);
CRectangle rectb (5,6);
Constructors cannot be called explicitly as if they were regular member functions. They are only executed when a new object of that class is created.
You can also see how neither the constructor prototype declaration (within the class) nor the latter constructor definition include a return value; not even void.
The destructor fulfills the opposite functionality. It is automatically called when an object is destroyed, either because its scope of existence has finished (for example, if it was defined as a local object within a function and the function ends) or because it is an object dynamically assigned and it is released using the operator delete.
The destructor must have the same name as the class, but preceded with a tilde sign (~) and it must also return no value.
The use of destructors is especially suitable when an object assigns dynamic memory during its lifetime and at the moment of being destroyed we want to release the memory that the object was allocated.
Default constructor
If you do not declare any constructors in a class definition, the compiler assumes the class to have a default constructor with no arguments. Therefore, after declaring a class like this one:
class CExample {
public:
int a,b,c;
void multiply (int n, int m) { a=n; b=m; c=a*b; };
};
The compiler assumes that CExample has a default constructor, so you can declare objects of this class by simply declaring them without any arguments:
CExample ex;
But as soon as you declare your own constructor for a class, the compiler no longer provides an implicit default constructor. So you have to declare all objects of that class according to the constructor prototypes you defined for the class:
class CExample {
public:
int a,b,c;
CExample (int n, int m) { a=n; b=m; };
void multiply () { c=a*b; };
};
Here we have declared a constructor that takes two parameters of type int. Therefore the following object declaration would be correct:
CExample ex (2,3);
But,
CExample ex;
Would not be correct, since we have declared the class to have an explicit constructor, thus replacing the default constructor.
But the compiler not only creates a default constructor for you if you do not specify your own. It provides three special member functions in total that are implicitly declared if you do not declare your own. These are the copy constructor, the copy assignment operator, and the default destructor.
The copy constructor and the copy assignment operator copy all the data contained in another object to the data members of the current object. For CExample, the copy constructor implicitly declared by the compiler would be something similar to:
CExample::CExample (const CExample& rv) {
a=rv.a; b=rv.b; c=rv.c;
}
Therefore, the two following object declarations would be correct:
CExample ex (2,3);
CExample ex2 (ex); // copy constructor (data copied from ex)

Wednesday, April 16, 2008

Content Management Systems Explained

There are many benefits to adding a content management system to your website, not least being that it allows you to add and update content and images yourself without the need to use a web designer after it is initially set up and configured. Another major benefit is that it keeps your content fresh which search engines love.
This article introduces content management systems and gives an overview of their features and benefits.
What is a Content Management System?

A content management system (often known as a CMS) is a piece of software that allows you to edit the content on your website without having any web design skills.
In the first instance, a web designer creates a series of CMS templates which form the basis of your web pages. You then use a simple interface to add, edit or delete the content on your pages. New pages can be added with ease simply by creating new entries and your website reflects the changes instantly.
This part of the Line of Site website is an example of a content management system.
What are the benefits of installing a CMS?
There are many benefits to installing a CMS. The most important is that it offers an easy way to refresh the content on your site which search engines love. Regular updates can have a dramatic effect on your search engine rankings.
A CMS can be added to an existing website with the templates made to match your site's current style and layout or your existing pages can simply be recreated by adding the information to the CMS. You can then update it yourself as often as you like, without the need to call a web design company and pay for the changes each time.
Do I need one?
For anyone planning to update content more than a couple of times each month, creating your website using a CMS is highly recommended. If you already update your website on a regular basis, and do not currently use a CMS, you could save a lot of time and money by implementing one.
To stay competitive in this day and age, websites need to be far more than a static brochure. A website that has interesting articles which may be of interest to your customers will generate return visits, as well as offer greater search engine indexing opportunities. Search engines love content and by adding new content regularly you are increasing the opportunity for your site to be found by visitors searching to buy, or find information about your product, or area of expertise.
For example perhaps you offer life coaching services or a solution to garden pests and diseases. By adding a CMS to your site you could add client testimonials or case studies. Some CMS allow the facility for visitors to add comments or ask questions adding a degree of interactivity to your site. Beware though of adding content indiscriminately. Quality is still more important than quantity.
If you do not currently update your website at all, you should be asking yourself whether you ought to start. If your customers see something new which interests them each time they visit your website, they are more likely to return. A CMS will allow you to quickly and easily transform your website into an interesting and dynamic marketing tool.
What features do they offer?
A huge variety. Apart from the ability to update content, some other features that a CMS can offer are: automatic archiving of content eg weekly or monthly archives, dynamic site maps, e-commerce, email alerts, newsletter management, image uploads, automatic categorisation of topics, keyword updates, site search functionality, accessibility compliance and so on.
What about pricing?
This will largely depend on the size of your website, whether it is to be added to an existing site, the degree of complexity and the amount of functionality you require.
As a (very) rough pricing guide a CMS suitable for a small or medium site can range from as little as £795. If you think your site would benefit from the inclusion of a CMS, then please contact us for more information.

Thursday, March 6, 2008

PHP::Strings - PHP count_chars() Function

Definition and Usage
The count_chars() function returns how many times an ASCII character occurs within a string and returns the information.
Syntax
count_chars(string,mode)
Parameter Description
string Required. The string to be checked
mode Optional. Specifies the return modes. 0 is default. The different return modes are:

0 - an array with the ASCII value as key and number of occurrences as value
1 - an array with the ASCII value as key and number of occurrences as value, only lists occurrences greater than zero
2 - an array with the ASCII value as key and number of occurrences as value, only lists occurrences equal to zero are listed
3 - a string with all the different characters used
4 - a string with all the unused characters
--------------------------------------------------------------------------------

sample 1
In this example we will use count_char() with mode 1 to check the string. Mode 1 will return an array with the ASCII value as key and how
many times it occurred as value (e.g. in the example below, the ASCII value for the letter "l" is 108, and it occurs three times):
"$str = "Hello World!";
print_r(count_chars($str,1));
"?> "
The output of the code above will be:
Array
(
[32] => 1
[33] => 1
[72] => 1
[87] => 1
[100] => 1
[101] => 1
[108] => 3
[111] => 2
[114] => 1
)
Example 2
In this example we will use the count_char() with mode 3 to check the string. Mode 3 will return a string with all the different characters used:
"$str = "Hello World!";
echo count_chars($str,3);
"?> "
The output of the code above will be:
!HWdelor

Sunday, March 2, 2008

Content Building

We're going to take a break from programming and concentrate on another aspect of being a webmaster that we've mentioned once before in this series of articles and that's content. Content is going to be different for every site as each site contains different information as each site will deal with different main subjects. So the first thing I’d like to go over is how to determine the type of content we're going to use in our own sites.

First things first, we must fist decide what the site will be geared towards. Many webmasters make a common mistake; which sometimes isn't a mistake at all, but most webmasters tend to gear their sites toward more then one main topic or subject. In most cases a website is run by one webmaster and is normally a hobby or something they will do in their free time. So it's harder for most webmasters to keep a site updated the way it needs to be with more then one main topic or subject.
So if a site is ran by just one webmaster or a smaller group of webmasters, it's a good idea to keep the main topic for the site to just one thing and then branch out from that main topic. Many webmasters are unaware that a site dealing with specific information will tend to be more popular then a site dealing with a multitude of information and topics, these types of sites are also referred to as portals. For instance a site like MSN would be considered a portal and a very good portal at that. The only reason a site like MSN can pull a portal site off, is because they have the resources and man power to do it. Smaller sites can't even begin to keep up with a site of that magnitude.
Pick a Topic
Deciding what a site will be about is one of the most aggravating things for a webmaster to decide. Many times a site will need to be geared toward a main subject that can be added or branched out from. So it shouldn't be too specific, unless that is the type of site the webmaster would like to build. When deciding the main topic or subject a site there are few things the webmaster must take into consideration.
1. What are they good at and what type of information do they know a lot about?2. What types of information is easiest for them to teach others?3. Which would be fun for the webmaster producing the site?
These are just a few questions we must ask ourselves before we even begin to start a website or content for a website.
Once we have a good topic picked out that we will be able to build a site on, we can then start thinking about the type of content that we’ll fill the site with. A good rule of thumb is to pick a topic you know well so when it’s time to start writing content for the site it will not become a problem or be overly hard to do.
Build Content
Now that we know what we want to make a web site about, we now need to start determining the type of content we’re going to develop for the site. First we must decide the type of content we’ll be displaying on the site, and then we can start working on the content. So let’s take a look at a few different types of content we can put on the site.
Message Boards - Databases (Links, Downloads, Lists)
Message boards and databases are just a few examples of this form of content, which I like to call builder content. Builder content is the type of content that helps support the main content and builds it up; we’ll go over main content next. Any type of content that doesn’t take much time to do, or is a sort of add-on to existing content can be labeled as builder content and should never be used or considered main content.
Main Content
The main content to a web site would be the main focus of the site, for instance the articles on Webmaster Stop would be considered main content and the referrals or links to other resources similar would be considered builder content. Be sure to keep these two types of content in mind when building content for your own site.
We now know the different types of content and we’ve also decided what our site will be about, from this point we can actually start building content for the site. This part of building a web site can get confusing to some webmasters, as they like to get a site finished and then start adding content to it. This IS NOT the best route to take and will end up hurting the site in the long run.
Keep in mind that if we build content before any sort of design or management system is completed, we’ll be able to focus more on the content and build it to what it should be and then model the site around the content. This is always the best route to take with building any site and yes there are some sites that have exceptions but if the site is content driven then it is not an exception.

Saturday, February 23, 2008

Next Tutorial .htaccess

Introduction
In the last part I introduced you to .htaccess and some of its useful features. In this part I will show you how to use the .htaccess file to implement some of these.
Stop A Directory Index From Being Shown
Sometimes, for one reason or another, you will have no index file in your directory. This will, of course, mean that if someone types the directory name into their browser, a full listing of all the files in that directory will be shown. This could be a security risk for your site.

To prevent against this (without creating lots of new 'index' files, you can enter a command into your .htaccess file to stop the directory list from being shown:
Options -Indexes
Deny/Allow Certian IP Addresses
In some situations, you may want to only allow people with specific IP addresses to access your site (for example, only allowing people using a particular ISP to get into a certian directory) or you may want to ban certian IP addresses (for example, keeping disruptive memembers out of your message boards). Of course, this will only work if you know the IP addresses you want to ban and, as most people on the internet now have a dynamic IP address, so this is not always the best way to limit usage.
You can block an IP address by using:
deny from 000.000.000.000
where 000.000.000.000 is the IP address. If you only specify 1 or 2 of the groups of numbers, you will block a whole range.
You can allow an IP address by using:
allow from 000.000.000.000
where 000.000.000.000 is the IP address. If you only specify 1 or 2 of the groups of numbers, you will allow a whole range.
If you want to deny everyone from accessing a directory, you can use:
deny from all
but this will still allow scripts to use the files in the directory.
Alternative Index Files
You may not always want to use index.htm or index.html as your index file for a directory, for example if you are using PHP files in your site, you may want index.php to be the index file for a directory. You are not limited to 'index' files though. Using .htaccess you can set foofoo.blah to be your index file if you want to!
Alternate index files are entered in a list. The server will work from left to right, checking to see if each file exists, if none of them exisit it will display a directory listing (unless, of course, you have turned this off).
DirectoryIndex index.php index.php3 messagebrd.pl index.html index.htm
Redirection
One of the most useful functions of the .htaccess file is to redirect requests to different files, either on the same server, or on a completely different web site. It can be extremely useful if you change the name of one of your files but allow users to still find it. Another use (which I find very useful) is to redirect to a longer URL, for example in my newsletters I can use a very short URL for my affiliate links. The following can be done to redirect a specific file:
Redirect /location/from/root/file.ext http://www.tutorial-on.com/new/file/location.xyz
In this above example, a file in the root directory called oldfile.html would be entered as:
/oldfile.html
and a file in the old subdirectory would be entered as:
/old/oldfile.html
You can also redirect whole directoires of your site using the .htaccess file, for example if you had a directory called olddirectory on your site and you had set up the same files on a new site at: http://www.newsite.com/newdirectory/ you could redirect all the files in that directory without having to specify each one:
Redirect /olddirectory http://www.tutorial-on.com/newdirectory
Then, any request to your site below /olddirectory will bee redirected to the new site, with the
extra information in the URL added on, for example if someone typed in:
This can prove to be extremely powerful if used correctly.
Although there are many uses of the .htaccess file, by far the most popular, and probably most useful, is being able to relaibly password protect directories on websites. Although JavaScript etc. can also be used to do this, only .htaccess has total security (as someone must know the password to get into the directory, there are no 'back doors')
The .htaccess File
Adding password protection to a directory using .htaccess takes two stages. The first part is to add the appropriate lines to your .htaccess file in the directory you would like to protect. Everything below this directory will be password protected:
AuthName "Section Name"
AuthType Basic
AuthUserFile /full/path/to/.htpasswd
Require valid-user
There are a few parts of this which you will need to change for your site. You should replace "Section Name" with the name of the part of the site you are protecting e.g. "Members Area".
The /full/parth/to/.htpasswd should be changed to reflect the full server path to the .htpasswd file (more on this later). If you do not know what the full path to your webspace is, contact your system administrator for details.
The .htpasswd File
Password protecting a directory takes a little more work than any of the other .htaccess functions because you must also create a file to contain the usernames and passwords which are allowed to access the site. These should be placed in a file which (by default) should be called .htpasswd. Like the .htaccess file, this is a file with no name and an 8 letter extension. This can be placed anywhere within you website (as the passwords are encrypted) but it is advisable to store it outside the web root so that it is impossible to access it from the web.
Entering Usernames And Passwords
Once you have created your .htpasswd file (you can do this in a standard text editor) you must enter the usernames and passwords to access the site. They should be entered as follows:
username:password
where the password is the encrypted format of the password. To encrypt the password you will either need to use one of the premade scripts available on the web or write your own. There is a good username/password service at the KxS site which will allow you to enter the user name and password and will output it in the correct format.
For multiple users, just add extra lines to your .htpasswd file in the same format as the first. There are even scripts available for free which will manage the .htpasswd file and will allow automatic adding/removing of users etc.
Accessing The Site
When you try to access a site which has been protected by .htaccess your browser will pop up a standard username/password dialog box. If you don't like this, there are certain scripts available which allow you to embed a username/password box in a website to do the authentication. You can also send the username and password (unencrypted) in the URL as follows:
http://username:password@www.tutorial-on.com/directory/
Summary
.htaccess is one of the most useful files a webmaster can use. There are a wide variety of different uses for it which can save time and increase security on your website.