Posts Tagged ‘Multiple’

Understanding MySQL Table Types

Tuesday, September 30th, 2008

MySQL supports various of table types or storage engines to allow you to optimize your database. The table types are available in MySQL are:

* ISAM
* MyISAM
* InnoDB
* BerkeleyDB (BDB)
* MERGE
* HEAP

The most important feature to make all the table types above distinction is transaction-safe or not. Only InnoDB and BDB tables are transaction safe and only MyISAM tables support full-text indexing and searching feature. MyISAM is also the default table type when you create table without declaring which storage engine to use. Here are some major features of each table types:
ISAM

ISAM had been deprecated and removed from version 5.x. All of it functionality entire replace by MyISAM. ISAM table has a hard size 4GB and is not portable.
MyISAM

MyISAM table type is default when you create table. MyISAM table work very fast but not transaction-safe. The size of MyISAM table depends on the operating system and the data file are portable from system to system. With MyISAM table type, you can have 64 keys per table and maximum key length of 1024 bytes.
InnoDB

Different from MyISAM table type, InnoDB table are transaction safe and supports row-level locking. Foreign keys are supported in InnoDB tables. The data file of InnoDB table can be stored in more than one file so the size of table depends on the disk space. Like the MyISAM table type, data file of InnoDB is portable from system to system. The disadvantage of InnoDB in comparison with MyISAM is it take more disk space.
BDB

BDB is similar to InnoDB in transaction safe. It supports page level locking but data file are not portable.
MERGE

Merge table type is added to treat multiple MyISAM tables as a single table so it remove the size limitation from MyISAM tables.
HEAP

Mysql-Use multiple-row inserts

Thursday, July 24th, 2008

Use multiple-row INSERT statements to store many rows with one SQL statement.

Search Engine Optimization-Inter-link your Blogs

Tuesday, July 15th, 2008

Increasingly bloggers are starting or joining blog networks to enjoy the benefits of multiple sites and writers working together. One of the advantages of networks of sites is that they usually link to one another. In doing so you have complete control over how your sites are linked to from multiple domains. It is worth noting that you should be careful with this approach - if all your sites are hosted on the one server many think that Search Engines will work out what you’re doing and the impact will be lessened.

PHP:Dealing with Dependencies

Monday, June 30th, 2008

Compositional programming style
In the object oriented programming style, it’s preferable to split functionality out to multiple objects, that can work together to solve a single task. Taken to the extreme, this results in more, but smaller, classes and generally relies less on inheritance and more on composition. In lack of better words, I’ll call this compositional programming style. It’s a style which is usually more prevalent with experienced programmers.

For someone coming from an imperative style of programming, this style can appear abstract and confusing, but the benefits are in the flexibility of the code. If different objects are related through composition, parts can be replaced, without changing the code. This makes it easier to reuse components, and to hook into the code, by providing a wrapper here or there. This is especially useful during testing, since it becomes easier to mock out external dependencies (Such as a database or an smtp server).

There is, however, a dark side to composition — dependencies.

So what is a dependency?
For the sake of this post, I’ll use a rather naïve example. Assume, that we were building an addressbook application. This would feature an entity of type Person. In our code, we might have a class …

PHP:send cookie to multiple subdomains

Monday, June 30th, 2008

<?php
setcookie(’myCookie’, ’some value’, time() + 60*15, ‘/’, ‘.mydomain.com’);
?>

A List of PHP Editors

Saturday, June 28th, 2008

Windows

ConTEXT - version 0.97.4; freeware
Crimson Editor - version 3.60; freeware
Programmer’s Notepad -
PSPad - version 4.3.0; freeware
Notepad++
NuSphere PhpED - version 5.0; commercial
NuSphere Nu-Coder - version 1.4; commercial

Mac OS X

skEdit
Smultron - version 1.0.1; freeware
TextWrangler
TextMate
Coda

Linux

Bluefish - version 1.0; other
Geany
gedit
gPHPEdit
Kate - version 2.2; freeware
Quanta Plus - version 3.2.1; freeware

Multiple OS

NetBeans
Eclipse
Aptana
Emacs - version 21; freeware
jEdit - version 4.1; freeware
SciTE - version 1.53; freeware
Vim - version 6.1; freeware
nano

Getting results from a select multiple HTML tag.

Saturday, June 28th, 2008

The select multiple tag in an HTML construct allows users to select multiple items from a list. These items are then passed to the action c for the form. The problem is that they are all passed with the same widget name. I.e.
<select name=”var” multiple=”yes”>
Each selected option will arrive at the action handler as var=option1, var=option2, var=option3. Each option will overwrite the contents of the previous $var variable. The solution is to use PHP’s “array from form element” feature. The following should be used:
<select name=”var[]” multiple=”yes”>
Now first item becomes $var[0], the next $var[1], etc.

Tips for optimizing your php code

Saturday, June 28th, 2008

# If a method can be static, declare it static. Speed improvement is by a factor of 4.

# echo is faster than print.

# Use echo’s multiple parameters instead of string concatenation.

# Set the maxvalue for your for-loops before and not in the loop.

# Unset your variables to free memory, especially large arrays.

# Avoid magic like __get, __set, __autoload

# require_once() is expensive

# Use full paths in includes and requires, less time spent on resolving the OS paths.

# If you need to find out the time when the script started executing, $_SERVER[’REQUEST_TIME’] is preferred to time()

# See if you can use strncasecmp, strpbrk and stripos instead of regex

# str_replace is faster than preg_replace, but strtr is faster than str_replace by a factor of 4

# If the function, such as string replacement function, accepts both arrays and single characters as arguments, and if your argument list is not too long, consider writing a few redundant replacement statements, passing one character at a time, instead of one line of code that accepts arrays as search and replace arguments.

# It’s better to use select statements than multi if, else if, statements.

# Error suppression with @ is very slow.

# Turn on apache’s mod_deflate

# Close your database connections when you’re done with them

# $row[’id’] is 7 times faster than $row[id]

# Error messages are expensive

# Do not use functions inside of for loop, such as for ($x=0; $x < count($array); $x) The count() function gets called each time.

# Incrementing a local variable in a method is the fastest. Nearly the same as calling a local variable in a function.

Multiple Domain Web Hosting

Thursday, June 26th, 2008

Thanks to the low cost of domain names and hosting fees it is possible to own several websites without breaking the bank. There are several ways to manage multiple domains so it is important to know what your options are and the advantages and disadvantages of each method.

The most basic choice when administering multiple domains is whether or not to do so with the same host. Most hosts offer packages which can be set up to allow several sites on one account, or allow individual sites to be operated under separate accounts.

You may have an existing website and are happy with the services your host provides. If you decide to start a new website using the same host, you will have the reassurance of dealing with a company you are familiar with and trust. You may also get a discount for each additional account you open with the same host. On the other hand, using a new host for a second (or third or fourth) website can allow you to compare the quality of hosting offered by different companies. In addition, separate hosts will provide each of your web sites with a different IP address.

Having different IP addresses can be an important factor if you plan to link the sites together to aid in search engine optimization. Incoming links are an important indicator of the importance of a website, so a site with a lot of incoming links can get a higher position in search engines like Google. If all the links are coming from the same IP address, however, their value may be discounted. Hosting your various sites with different hosting companies guarantees that each site has a different IP address. Individual IP addresses, however, are available as an extra from most web hosts. For a yearly fee each website can have its own unique IP address. This can help with search engine ranking and is also needed if you want to have a secure connection (https) on your site.

If you decide to host all your sites with the same company, there are three basic ways to go. Each site could have its own account; you could sign up for a re-seller account; or you could get a dedicated server account.

As a re-seller you are acting as an agent for the hosting company. You are allocated a certain amount of disk space and bandwidth and you are free to use them as you please. There may be a limit to the number of websites you can host with your re-seller account, but if there is space left over after using this account for your own sites you could earn some extra income by selling accounts to other people. The advantage of a re-seller account is that all the technical details are taken care of by the hosting company. Some will even provide gateways for billing your customers.

A dedicated server account gives you control of all the resources of an entire server. You are free to setup as many websites as you wish and allocate disk space and bandwidth as you see fit. The downside to this type of account is that you are responsible for maintaining the server. This can require a significant level of technical know-how so if you don’t have that knowledge or don’t feel like learning about it, dedicated servers are not for you. You can, of course, go with a managed dedicated server. The downside of this is the higher cost involved.

Hosting all your sites with one host can offer lots of advantages but there is one major disadvantage – if your server goes down, all your sites go down. If you are depending on your sites for income this can be a disastrous situation. For this reason, it is a good idea to have at least one of your sites with a different host. If your sites are essential for your livelihood and you can’t afford any down time whatsoever, you would be advised to host everything with (at least) two hosts.

SEO Web Hosting and how its good for you

Saturday, June 21st, 2008

If there is a phenomenon that is making waves in the web hosting industry in recent times, it would be SEO Web Hosting. Search Engine Optimization (SEO) Web Hosting basically encompasses all the strategies involved in ranking well for a particular country-specific version of a popular search engine.

Leading search engines especially Google and Yahoo have country-specific versions for several countries across the globe. The mere fact that one’s website would necessarily rank better if hosted in the target country has given birth to the new genre - SEO Web Hosting.

According to Travis aka “The Farmer“:

SEO Web Hosting is the art of hosting your marketing efforts across multiple IP ranges using multiple name servers. By doing so you are ensuring the true success of your online business.

What web hosts do is to provide multiple IP addresses and multiple nameservers spread across different countries such that the website appears to be hosted in these different countries and thus have the chance of ranking better in the respective countries. The specialized SEO packages typically have the following range of specifications: [20 IPs / 10 class C; 2 IPs per Class C; 10 Nameservers] and [120 IPs / 60 class C; 2 IPs per Class C; 60 Nameservers].

Understandably, these SEO Web Hosting packages come at a relatively high cost since immense effort is put into sourcing this different IP ranges. This makes it feasible for companies with deep pockets, who are specifically targetting web users in specific countries.

It is important to point out however that aside web hosting that provides local IP addresses, successful search optimization for international markets may require professional translation of web pages, registration of a domain name with a top level domain in the target market.

If SEO Web Hosting is not for you and you still want to rank better in specific countries, you want to consider registering your domains under the Country code Top-Level Domains (cc-TLDs) for your target countries. You would then have to put up localized content for maximum effect.