JavaScript Tips & Tutorials

JavaScript: Split and Divide Text String by A Delimiter

Spliting and dividing a string into several chunks is a rather basic need for text parsing. You can do it easily in PHP by the help of explode() function or preg_split(), in JavaScript, you can achieve this task by the split() string function.

The following example illustrates the usage of javascript split() function to slice a string into various parts in an array.

var str = "How are you";
var words = str.split(" "); //split using a single blank space as the delimiter
for (i = 0; i < words.length; i++) {
	alert(words[i]); //alerts "How", "are" and "you" sequentially

Note that split is a method of string objects in JavaScript, not standalone functions. Therefore, you can even use it this way:

var words = "How are you".split(" ");

Computer & Internet Literacy CSS & HTML Tips

HTML Definition: What is HTML Defined – What does HTML stand for?

HTML is the abbreviation of Hyper Text Markup Language invented by Tim Berners-Lee, who’s also been called the father of the Web.

HTML is what websites are written in. All websites on the Web are written in HTML that your browsers and email software recognize. It’s a way of representing, organizing and containing information as well as data that need to be stored in web page format and transferred from websites to client computers to be displayed on the screen.

HTML consists of nearly 100 tags in the form of <tag> … </tag> that contains more tags or plain texts in it. For example, tabular data can be represented and stored in HTML in the following manner:


Notice that there are 3 types of tags used in this example, namely <table></table>, <tr></tr> and <td></td> which represent tables, table rows and table cells respectively. Ideally, this HTML table will be rendered in your browser as something looking like this:

11 12
21 22

A table it is.

All after all, HTML is a programming language that mark things up by tags, thus representing information to help computer programs recognize and process them (such as displaying them). A typical example of such programs is your Internet browser.

Information content marked up in HTML is then styled in CSS to be beautiful.


HTML: Center & Centering

While many still rely on HTML to center things or make page elements centered in the middle of the page, it’s actually the job of CSS.

In HTML, you can center things such as texts or images by using the CENTER tag:

<center>This is in the center of the page.</center>

You can center not only texts but also images:

<center><img src="photo.jpg" alt="" /></center>

However this may seem simple and straightforward, it’s not the correct way to do this. Accordingly to web standards, centering should be produced by CSS:

<div style="text-align:center"><img src="photo.jpg" alt="" /></div>

Notice the style attribute of the div tag, text-align:center prescribes that the inner image is centered in the center of the browser window (page).


HTML: Change Text and Font Colors

As more and more social sites enable their users to make out custom HTML codes for their homepages, many want to learn about HTML and how to write and modify web pages by HTML.

One of the most common questions for a HTML newbie is to change the color of some text or font in the page.

To do this in a web standards way, you just add a styling directive to that HTML element / tag:

<p style="color: red">We are red.</p>

In the example above, the text ‘We are red.’ has now become red on the web page.

You can also change the color of a piece of the text (inline text) by the help of HTML tag SPAN:

<p style="color: red">We <span style="blue">are</span> red.</p>

Now the word ‘are’ are colored blue.

For a list of available HTML colors, please refer to this page.

Computer & Internet Literacy CSS & HTML Tips

CSS Definition: What is CSS Defined and Explained

CSS standards for Cascading Style Sheets. It’s a descriptive programming language that specifies how web pages look like in appearance and style.

Take a book for example. The texts in the book are content, just like the texts you are reading right now in a web page or HTML page. The publishers of the book decide that it would be too boring to the readers if they had simply printed out those texts as a book with nothing but black ink on the white sheets, instead, they spice things up, such as using light blue as the background color of the pages, employing different typeface for different sections and framing here and there to outstand things, though not too much.

It’s the same with a Microsoft Word document, .doc, if you have ever worked with one. The plain texts themselves are the ultimate content and what we care about in the end. However, without proper styling, it’d look dumb and hard to digest in some cases. You will want to give colors to important snippets such as heading texts and possibly also make them bold.

Basically, that’s what CSS does with web pages – styling things and spicing the plain content up so they become appealing or even striking. Web designers rely on CSS to design everything in the web pages. All page elements, visual components on the Web are styled and beautified by the help of CSS.

A quick example of CSS

Let’s say there are some paragraphs in a web page (HTML page) that you want colored red, then you’ll probably write a CSS rule of this:

p {color:red;}

That’s all it takes. Now all modern browsers will load the HTML page and render and display the paragraph texts in red.

Free Web Templates My Personal Reviews Web Design Tips and Insights

Yet Another Joomla Template Including Original PSD, HTML + CSS and Fonts

free joomla template Face2Face is the name of this Joomla template, released free by Template Kingdom. I don’t usually use Joomla but one has to admit there has been many excellent template themes for Joomla like this one, just as there are with WordPress.

I love the colors of this template: relatively light but not too bright to be eye friendly, very enjoyable to look at as a result of all those intermediary colors constantly found in nature. The layout is tight and contains as much content as possible yet leaves enough blank for outstanding texts such as a slogan.

If you are ever looking for a Joomla template that’s as gentle as green tea, refreshing with grass warmth, this theme is it.

You can download it here, it’s completely free.

Still thirst for more? Here’s the extra premium website templates.

Free Web Templates Web Design Tips and Insights

Free CSS + HTML Template: Fashion Club Website (with fonts and PSD source)

fashion web template Template Kingdom is one of the best template and design sources on the Web. Other than a spectrum of website template sets for thousands of different niches and needs such as plain html templates, flash templates, css templates, joomla templates, wordpress templates and newsletter templates, they regularly releases free web templates.

This round, it’s the Fashion Club free html template designed exclusively for fashion websites. You can download the template package including the HTML /CSS source, JPG mockup, PSD source and font files on this page.

However, you have to bear in mind that the problem with all things free is that the value it provides is increasingly diluted by the large number of people who have access to it. To make your website and project truly unique, you’d want a design agency to sculpt an exclusive solution for you or you will need to buy some premium web templates, and Template Kingdom is one of the best at what they do.

Looking for more? Here’s some premium web templates.

Affiliate Programs Make Money Online My Personal Reviews

T-shirt Affiliate Program

tshirt affiliate program:  tshirt hell Custom design and printing is what characterizes online T-shirt businesses that have come into boom since a few years back. A lot of people are making good money selling custom design tshirt. To tap into this niche, you can either come out with your own designs and promote the merchandise at Cafe Press, or you can earn good money by marketing others’ tshirts, that is, by the tshirt affiliate program.

Tshirt Hell makes a perfect example of what an online tshirt business should do in order to achieve success financially.

  1. Make an affiliate program – not only has there to be one but it also has to be an attractive one. In a market as open and free as the Internet, marketing ain’t easy. So it is only fair for marketers to earn a good cut of the profit. Tshirt Hell generously offers $4 affiliate reward for each and every sale, no exceptions on size or price: whether it’s a $15 sale or a $7 one, you get $4, no questions asked. Compare and you shall know, $4 commission per tshirt sale is a rather steep one that few tshirt sites can come up with.
  2. Let there be a 2-tier cut – 2-tier affiliate program means another affiliate marketer can sign up with the program under your name, and you will keep receiving a share of the profit whenever your referred affiliate makes a sale. Tshirt Hell again makes their program an appeal for all tshirt marketers with $1 per 2-tier affiliate sale forever for you. That means, every sale your referred affiliate makes, you will receive $1 reward for it. This is obviously a clever move as it instantly increases the possibility that their business and your earnings both go viral.
  3. Tshirts should be impulse buysTshirt Hell distinctly distinguishes themselves from other Tshirt designers and providers. A black sheep if you will. If you go and take a look at their unique designs, you will have no problem understanding why their products sell so well.

It’s all about the bad tshirts.

Free WordPress Themes WordPress How To

Best Damn Premium WordPress Theme for Professional Blogs: THESIS

Best and most powerful premium wordpress theme for professional blogging Imagine the best WordPress theme you have ever used and then triple the pleasure you enjoyed with it – that’s what Thesis can give you.

Whatever your niche is, if you are ever after a powerful, beautiful WordPress premium theme well balanced between functionality and customizability with best support from the author, this is the deal.

Epic WordPress Theme for Heroic Bloggers

Let’s sum up a list of what an epic WordPress theme should accomplish:

  1. The design – of course, what more can we expect from a theme than the exterior beauty itself. If simplicity is the ultimate aesthetic sophistication, Thesis is the ultimate simplicity.
  2. The functionThesis has all the built-in functions and little gimmicks you have seen across all WordPress themes combined. No more nor less, they are just what you need when you need them.
  3. The code – Forget it, you won’t need a single touch of the theme code to make any customization any more. Thesis comes with its own full-fledged magic panel that’s so powerful and so intuitive to use, your blog instantly becomes WordPress 4.0 while the rest are still using the newly released WP 2.8.
  4. The support – Every theme buyer / owner will have his or her own login details at the official site to access the control panel and support desk as well as tools to resell the theme to their clients at a much discounted price.
  5. The audience – As undoubtedly the One WordPress Theme, Thesis has been adopted by hundreds of pioneer bloggers that are admired by tens of millions of readers and visitors per month. Looking for more?
  6. WordPress 2.8? – No, it’s WordPress Thesis.

I’m personally a user of Thesis and have been extremely happy with it on a bunch of my blogs: Virtual Assistants, Database Press and Induction Heaters.

Domains SQL / MySQL Tips and Tutorials WordPress How To

How to Transfer / Move WordPress Blog from One Domain to Another

Basically, the root URL of your blog which is your domain or subdomain is changing here. Though this doesn’t seem like a sane decision considering the huge SEO impact that might fall upon your site but with HTTP 301 permanent redirection, this can still make sense in some situations.

Assume you won’t change the details of the WordPress database connection, then there’d be no need to change or modify any PHP files at all. Just the database tables and related values concerning the URLs.

The idea is to find all table field values containing the string ‘‘ which is your old domain and change it to the new domain ‘‘. Follow me:

  1. Copy all the WordPress PHP program files from the old directory to the new one which the new domain is pointed at.
  2. Connect to WordPress database by phpMyAdmin or plain mysql command or whatever you are familiar with. But this example will only go with phpMyAdmin.
  3. In phpMyAdmin, at the database level, click ‘Search‘ -> ‘Select All‘ -> Search for ‘‘ -> Click ‘Go‘. In most cases, there are just 2 tables that need to be modified accordingly: wp_posts and wp_options.
  4. Click ‘Browse’ to look for records with the string ‘‘ in them.
  5. For ‘wp_options’, edit each record and find all occurrences of the old string ‘‘ and modify it to ‘‘. Click ‘Go‘ to update.
  6. For ‘wp_posts’, you can leave the guid field intact or update it with the new domain string but it doesn’t matter much. The hard part is to update the post content of all posts and replace all occurrences of the old domain string to the new one. You can get all this done by the following SQL query: UPDATE wp_posts SET post_content = REPLACE(post_content, '', '')

Now you should be set, fire up your browser and navigate to your blog at the new domain and check everything out to see if it’s working properly.