Android (14)

What kind of open-source project is Android?

Google oversees the development of the core Android open-source platform, and works to create robust developer and user communities. For the most part the Android source code is licensed under the permissive Apache Software License 2.0, rather than a "copyleft" license. The main reason for this is because our most important goal is widespread adoption of the software, and we believe that the ASL2.0 license best achieves that goal.


What does “compatibility” mean?

We define an "Android compatible" device as one that can run any application written by third-party developers using the Android SDK and NDK. We use this as a filter to separate devices that can participate in the Android app ecosystem, and those that cannot. Devices that are properly compatible can seek approval to use the Android trademark. Devices that are not compatible are merely derived from the Android source code and may not use the Android trademark.

In other words, compatibility is a prerequisite to participate in the Android apps ecosystem. Anyone is welcome to use the Android source code, but if the device isn't compatible, it's not considered part of the Android ecosystem.


Why are parts of Android developed in private?

It typically takes over a year to bring a device to market, but of course device manufacturers want to ship the latest software they can. Developers, meanwhile, don't want to have to constantly track new versions of the platform when writing apps. Both groups experience a tension between shipping products, and not wanting to fall behind.

To address this, some parts of the next version of Android including the core platform APIs are developed in a private branch. These APIs constitute the next version of Android. Our aim is to focus attention on the current stable version of the Android source code, while we create the next version of the platform as driven by flagship Android devices. This allows developers and OEMs to focus on a single version without having to track unfinished future work just to keep up. Other parts of the Android system that aren't related to application compatibility are developed in the open, however. It's our intention to move more of these parts to open development over time.


How does the AOSP relate to the Android Compatibility Program?

The Android Open-Source Project maintains the Android software, and develops new versions. Since it's open-source, this software can be used for any purpose, including to ship devices that are not compatible with other devices based on the same source.

The function of the Android Compatibility Program is to define a baseline implementation of Android that is compatible with third-party apps written by developers. Devices that are "Android compatible" may participate in the Android ecosystem, including Google Play; devices that don't meet the compatibility requirements exist outside that ecosystem.

In other words, the Android Compatibility Program is how we separate "Android compatible devices" from devices that merely run derivatives of the source code. We welcome all uses of the Android source code, but only Android compatible devices — as defined and tested by the Android Compatibility Program — may participate in the Android ecosystem.


Why is Google in charge of Android?

Launching a software platform is complex. Openness is vital to the long-term success of a platform, since openness is required to attract investment from developers and ensure a level playing field. However, the platform itself must also be a compelling product to end users.

That's why Google has committed the professional engineering resources necessary to ensure that Android is a fully competitive software platform. Google treats the Android project as a full-scale product development operation, and strikes the business deals necessary to make sure that great devices running Android actually make it to market.

By making sure that Android is a success with end users, we help ensure the vitality of Android as a platform, and as an open-source project. After all, who wants the source code to an unsuccessful product?

Google's goal is to ensure a successful ecosystem around Android, but no one is required to participate, of course. We opened the Android source code so anyone can modify and distribute the software to meet their own needs.


Do all Activities run in the main thread of an application process?

By default, all of the application code in a single process runs in the main UI thread. This is the same thread that also handles UI events. The only exception is the code that handles IPC calls coming in from other processes. The system maintains a separate pool of transaction threads in each process to dispatch all incoming IPC calls. The developer should create separate threads for any long-running code, to avoid blocking the main UI thread.


Do all the Activities and Services of an application run in a single process?

All Activities and Services in an application run in a single process by default. If needed, you can declare an android:process attribute in your manifest file, to explicitly place a component (Activity/Service) in another process.


What is the Android Open Source Project?

The people oversee the project and develop the actual source code. The processes refer to the tools and procedures we use to manage the development of the software. The net result is the source code that you can use to build cell phone and other devices.


When are source code releases made?

When they are ready. Some parts of Android are developed in the open, so that source code is always available. Other parts are developed first in a private tree, and that source code is released when the next platform version is ready.

In some releases, core platform APIs will be ready far enough in advance that we can push the source code out for an early look in advance of the device's release; however in others, this isn't possible. In all cases, we release the platform source when we feel the version has stabilized enough, and when the development process permits. Releasing the source code is a fairly complex process.


CakePHP (18)

How cakephp URL looks in address bar?

Example: http://example.com/controller/action/param1/param2/param3


What is MVC (model, view, and controller) in cakephp?

Model–view–controller (MVC) is an architectural pattern used in software engineering.
Model: Databases function exist in the model
View: Design parts written here
Controller: Business Login


List some database related functions in cakephp.

find, findAll , findAllBy , findBy , findNeighbours and query.


What are component, helper and why are they used?

A component is an independent piece of code written for specific task that can be used(Eg Email, Ajax, RequestHandler and Session).
A helper is used for helping cakephp in rendering the data to be shown to user with views(Eg Form, HTML etc).


What is a Component in cakephp?

Components are packages of logic that are shared between controllers. They are useful when a common logic or code is required between different controllers.


What is CakePHP ?

CakePHP is a free, open-source, rapid development framework for PHP. It’s a foundational structure for programmers to create web applications. There is number of in built component like Ajax, RequestHandler, Session etc


What are are drawbacks of cakephp.

The learning curve, and it loads full application before it starts your task. Its not recommended for small projects because of its resource heavy structure.


What are commonly used components of cakephp?

  1. Security
  2. Sessions
  3. Access control lists
  4. Emails
  5. Cookies
  6. Authentication
  7. Request handling


What is a component,helper and why are they used, is there other way we can do same thing, what is better.

A component is an independent piece of code written for specific task that can be used by calling in controllers (example : email component), helper is used for helping cakephp in rendering the data to be shown to user with views, these only adds to modularity in code otherwise same coding can be implemented in conrollers.


Why cakephp have two vendor folder?

There is two vendor folder, one folder in root and another is in “app” folder


Cpanel (87)

How do I make sure that my server runs the latest version of cPanel & WHM?

  • When you log in, the cPanel & WHM version displays in the upper right-hand corner of the interface. You can also determine the version with the /usr/local/cpanel/cpanel -V command. 

  • To see the latest available cPanel & WHM version in your chosen release tier, visit http://httpupdate.cpanel.net.
  • To update cPanel & WHM, under the cPanel category, select Upgrade to Latest Version. If you wish to update cPanel & WHM from the command line as the root user, run the /scripts/upcp –force script.
  • For your server to automatically update to the latest version every morning, navigate to WHM's Update Preferences interface (Home >> Server Configuration >> Update Preferences) and select Automatic in the Daily Updates section.


I use the APF firewall rules on my server; which ports should I allow?

You should allow the following ports:

# Common ingress (inbound) TCP ports				
IG_TCP_CPORTS=" 20,21,22,25,26,53,80,110,143,443,465,993,995,2077,2078,2082,				
# Common ingress (inbound) UDP ports					
# Common ICMP (inbound) types					
# 'internals/icmp.types' for type definition; 'all' is wildcard for any					
# Common egress (outbound) TCP ports
# Common egress (outbound) UDP ports
# Common ICMP (outbound) types
# 'internals/icmp.types' for type definition; 'all' is wildcard for any


My website asks for a username and password when I try to view it. How do I remove or change this?

Navigate to cPanel's Password Protect Directories interface (Home >> Security >> Password Protect Directories). In this interface, you can modify the password protection settings for your domain.

If your main domain asks for a password, modify the settings for the public_html directory.


What should I do when my cPanel interface will not display?

You should contact your web hosting provider so that they can determine the cause of the issue or escalate the issue to us.


Why won’t the homepage of a folder automatically default to index.php?

There are a few lines in the /usr/local/apache/conf/httpd.conf file that allow for a index.php file to display automatically. This will resemble the following example:

# DirectoryIndex: Name of the file or files to use as a pre-written HTML # directory 
index.  //Separate multiple entries with spaces.
# <IfModule mod_dir.c>    DirectoryIndex index.ppl 
index.pl index.plx index.perl index.html index.wml index.cgi 
index.shtml index.jsp index.js index.jp index.php4 index.php3 
index.php index.phtml index.htm default.htm default.html 
home.htm </IfModule>

If those lines are not present, you will need to add the following line into a .htaccess file:

DirectoryIndex index.php

For more information about .htaccess files, visit the Apache website.


What is the WHM Autofixer?

The Autofixer is a collection of scripts that you can run from WHM to fix some common issues that are not otherwise fixable or accessible from the command line.

You can find the following Autofixer scripts in cPanel's httpupdate autofixer repository:

  • test — This script is a test autofixer on your system, nothing gets changed.
  • bsdbindfix — This script resolve port issues with BIND 9.
  • compresszlibfix — This script fixes a compress zlib error.
  • dbdmysql — DBD::mysql fix for older versions of Red Hat Enterprise Linux.
  • fpindexfile — This script fixes the FrontPage index.
  • iptablesflush — This script flushes iptables rules from WHM if you are firewalled from SSH access.
  • libxml64fix — This script fixes libXML on 64-bit systems.
  • resellerresourceacctounts — This script fixes reseller resource accounts.
  • safesshrestart — This script restores SSH Config and restarts SSH, if you are locked out.
  • vfilterfix — This script restores /etc/vfilters files.
  • yumduprpmfix — This script attempts to locate and resolve any duplicate RPMs.

Run Autofixer in the following URL, where $serverip represents your server's IP address: 


Consult the list, then enter the Autofixer script name that you wish to run.


How do I fix the License File Expired error?

Your server needs to be able to communicate with the license servers. To confirm that your server's main IP address matches the IP address that is stored in cPanel's license servers, perform the following steps:

Run the following command as the root user:

curl http://www.cpanel.net/apps/myip/

If the IP addresses do not match, you will need to perform one of the following actions:

Change the routing in your server and network to route outbound traffic from the IP address that is licensed.

Change the IP address on the license to match the IP address returned by the curl command.

Check your license on http://verify.cpanel.net to confirm that it is valid. If your license is not valid, contact your license provider.

If your license is valid, run the following commands as the root user:

rdate -s rdate.cpanel.net

Confirm that your server queries the root nameservers and has a valid hostname. If you need assistance with this, contact your hosting provider.

If these steps did not fix the issue, contact your license provider.


How do I delete the mail statistics logs on a daily basis?

Mail statistics are stored in a MySQL database that is located in the /var/lib/mysql/eximstats file. You will need to remove the entries from this database to clean it up.

Alternatively, you must clear the mail logs in the /var/logexim_mainlogexim_rejectlog, and exim_paniclog files daily.

A cronjob can easily execute a script that clears either of these daily.


Can you easily change the A records to point to an IIS server through cPanel & WHM?

There are two ways you can change the A records in the WHM interface:

  • You can edit the DNS zone manually and change the A records for the domain. To do this, perform the following steps:

  • Navigate to WHM's Edit DNS Zone interface (Home >> DNS Functions >> Edit DNS Zone).
  • Select a zone to edit.
  • Click Edit.
  • Make your changes accordingly.

    You can also change the way in which you server creates DNS zones so that they use A records that point to another server. To do this, perform the following steps:

  • Navigate to WHM's Edit Zone Templates interface (Home >> DNS Functions >> Edit Zone Template).
  • Make your changes accordingly.


How do I transfer my website from another control panel?

You can transfer your website, databases, mail, and files to a cPanel & WHM server from one of the following control panels:

  • Ensim
  • Plesk
  • DirectAdmin

To transfer your website, databases, mail, and files, have your new host, or someone on a cPanel & WHM server, use WHM's Transfer Tool interface (Home >> Transfers >> Copy an Account from Another Server).


CSS (73)

What is external Style Sheet? How to link?

External Style Sheet is a template/document/file containing style information which can be linked with any number of HTML documents. This is a very convenient way of formatting the entire site as well as restyling it by editing just one file.

The file is linked with HTML documents via the LINK element inside the HEAD element. Files containing style information must have extension .css, e.g. style.css.

<LINK REL=STYLESHEET HREF="style.css" TYPE="text/css">


Which set of definitions, HTML attributes or CSS properties, take precedence?

CSS properties take precedence over HTML attributes. If both are specified, HTML attributes will be displayed in browsers without CSS support but won't have any effect in browsers with CSS support.


What’s the difference between display: none and visibility: hidden?

These two style properties do two different things.

Visibility: hidden hides the element, but it still takes up space in the layout. In other words, if you place a DIV and give it dimensions to take up 100×100 pixels, the visibility: hidden property will make the DIV not show on the screen, but the text following it will act like it's still there.

Display: none removes the element completely from the document. It does not take up any space, even though the HTML for it is still in the source code. In this example, the text following the DIV would move over as if the DIV had been removed from the HTML.


Can I include comments in my Style Sheet?

Yes. Comments can be written anywhere where whitespace is allowed and are treated as white space themselves. Anything written between /* and */ is treated as a comment (white space). NOTE: Comments cannot be nested.

/* This is a CSS-comment */


What is HTML Tags?

If you want to "design" a specific HTML tag reference, such as a blockquote, the code within the web page may look like this:

<blockquote>This is a pithy and brilliant quote 
that I knew you would enjoy.</blockquote>

In the style sheet, the reference to the blockquote would not have a # or period but would just simply list the HTML and then the design elements. This example indents the quote on both sides and puts a blue line on the left side of the quote and makes the text italic.

<blockquote> { position: relative; margin: 10px 50px 10px 50px;
	padding:5px;  font-style:italic; 
	border-left:solid blue 4px; }</blockquote>

You can apply any design elements to any specific HTML tag such as body, p, H1, H2, H3, ul, li, and more.

Important note! Certain themes have their css styles in more than once place, the Kubrick theme being one of them. If, after changing css attributes in a css file, you don't see the results you wish, it's possible your theme choice has some embedded css in one of the php files (usually a header file) and the embedded css styles are overriding the linked or imported css stylesheet.


What is shorthand property?

Shorthand property is a property made up of individual properties that have a common "addressee". For example properties: font-weight, font-style, font-variant, font-size, font-family, refer to the font. To reduce the size of style sheets and also save some keystrokes as well as bandwidth they can all be specified as one shorthand property font, e.g.:

H1     {font-weight: bold;
        font-style: italic; 
        font-variant: small-caps;
        font-size: 160%;
        font-family: serif}

can be all shorthanded to a space separated list:

style="background: none repeat scroll 0 0 #f4f4f4 !important;H1 {font: bold italic small-caps 160% serif} style="background: none repeat scroll 0 0 #f4f4f4 !important;

Note: To make things even simpler the line-height property can be specified together with the font-size property:

style="background: none repeat scroll 0 0 #f4f4f4 !important;H1 {font: bold italic small-caps 160%/170% serif} style="background: none repeat scroll 0 0 #f4f4f4 !important;


What is attribute selector? [CSS2]

Attribute selector is a selector defined by 1) the attribute set to element(s), 2) the attribute and value(s),  3) the attribute and value parts:

1a) A[title] {text-decoration: underline}

All A elements containing the TITLE attribute will be underlined

1b) A[class=name] {text-decoration: underline}

The A elements classed as 'name' will be underlined

2) A[title="attribute element"] {text-decoration: underline}

The A elements containing the TITLE attribute with a value that is an exact match of the specified  value, which in this example is 'attribute element', will be underlined

3) A[title~="attribute"] {text-decoration: underline}

The A elements containing the TITLE attribute with a value containing the specified word, which in this example is 'attribute', will be underlined


How do you set the height of an element to 100%?

When you define the height of an element using the CSS height property, that property will take up that much vertical space in the browser. For example, a paragraph with a height: 100px; will take up 100 pixels of vertical space in the design.

According to the W3C specification, percentage heights are calculated with respect to the container's height. So if you put a paragraph with a height: 50%; inside a div with a height of 100px, the paragraph will be 50 pixels in height.

Why Percentage Heights Fail

If you're designing a web page, and you have a column that you'd like to take up the full height of the window, the natural inclination is to add a height: 100%; to that element. After all, if you set the width to width: 100%; the element will take up the full horizontal space of the page, so height should work the same, right?


To understand why, you need to understand how browsers interpret height and width. Web browsers calculate the total available width as a function of how wide the browser window is opened. If you don't set any width values on your documents, the browser will automatically flow the contents to fill the entire width of the window.

But height is calculated differently. In fact, browsers don't evaluate height at all unless the content is so long that it goes outside of the view port (thus requiring scroll bars) or if the web designer sets an absolute height on an element on the page. Otherwise, the browser simply lets the content flow within the width of the view port until it comes to the end. The height is not calculated at all.

The problem occurs when you set a percentage height on an element who's parent elements don't have heights set. In other words, the parent elements have a default height: auto;. You are, in effect, asking the browser to calculate a height from an undefined value. Since that would equal a null-value, the result is that the browser does nothing.

If you want to set a height on your web pages to a percentage, you have to set the height of every parent element of the one you want the height defined. In other words, if you have a page like this:

	    <div style="height: 100%;">
	        Make this division 100% height.

The div that you want to give a 100% height to has two parent elements: <body> and <html>. In order to define the height of the div to a relative height, you must set the height of the body and html elements as well.

	<html style="height: 100%;">
	  <body style="height: 100%;">
	    <div style="height: 100%;">
	        Make this division 100% height.

Here's an example of the same page as before, with the height set on the parent elements.

Some Things to Note When Working with 100% Heights

Now that you know how to set the height of your page elements to 100%, it can be exciting to go out and do that to all your pages. But there are a few things you should be aware of:

Margins and padding can add a scroll bar where you don't want one.
One of the most annoying things I've found with working with percentage heights (and widths) is that then the padding and margins on those same elements can add scroll bars to the page, even though all the content displays without needing scroll bars. This is because the height or width of the element is the first thing that is calculated. Then the margins and paddings are added on. So if you have an element with a height of 100% and top and bottom margins of 10 pixels each, there will be a scroll bar for the extra 20 pixels.

If your content takes up more than the defined height, it will overwrite anything after it.
In other words, if you have a design with a column that is 80% in height, and the content that is inside of it will take up 100% of the height, that extra 20% will continue below the column. And if there is content below that column, the text will simply write over the top of it.

The fix for this is to set the overflow of the element as well. I usually set it to auto so that scroll bars will appear if they are needed, but disappear when they aren't. But you can also set it to hidden which simply clips the content when it reaches the limit of the height.


What does !important mean in CSS?

Cascading Style Sheets cascade. This means that the styles are applied in the order they are read by the browser. The first style is applied and then the second and so on. What this means is that if a style appears at the top of a style sheet and then is changed lower down in the document, the second instance of that style will be the one applied, not the first. For example, in the following style sheet, the paragraph text will be black, even though the first style property applied is red:

p { color: red; }
p { color: black; } 

The !important directive is a way to make your CSS cascade but also have the rules you feel are most crucial always be applied. A rule that has the !important directive will always be applied no matter where that rule appears in the CSS document. So if you wanted to make sure that a property always applied, you would add the !important property to the tag. So, to make the paragraph text always red, from the above example, you would write:

p { color: red !important; }
p { color: black; } 

User Style Sheets

However, the !important directive was also put in place to help web page users cope with style sheets that might make pages difficult for them to use or read. Typically, if a user defines a style sheet to view web pages with, that style sheet will be over-ruled by the web page author's style sheet. But if the user marks a style as !important, that style will overrule the web page author's style sheet, even if the author marks their rule as !important.

This is a change from CSS1 to CSS2. In CSS1, author !important directives took precedence over user !important directives. CSS2 changed this to make the user's style sheet have precedence.


What is contextual selector?

Contextual selector is a selector that addresses specific occurrence of an element. It is a string of individual selectors separated by white space, a search pattern, where only the last element in the pattern is addressed providing it matches the specified context.

TD P CODE {color: red}

The element CODE will be displayed in red but only if it occurs in the context of the element P which must occur in the context of the element TD.

TD P CODE, H1 EM {color: red} 

The element CODE will be displayed in red as described above AND the element EM will also be red but only if it occurs in the context of H1

P .footnote {color: red} 

Any element with CLASS footnote will be red but only if it occurs in the context of P

P .footnote [lang]{color: red} 

Any element with attribute LANG will be red but only if it is classed as "footnote" and occurs in the context of P


HTML5 (14)

Are there things in HTML4 that are not in HTML5?

Yes, but only a handful of elements and these are not really gone; they are just marked as obsolete. Browser makers can continue to support these elements in their new versions and most will. Among the elements marked as obsolete in HTML5 are: frame, frameset, big, center, font, strike, acronym, applet, isindex and dir.


Is HTML5 a new technology?

No. It’s an extension of existing HTML, adding new elements to the set recognized by HTML4 level browsers and removing some of the restrictions of xhtml.


What exactly is HTML5 Video?

Nothing, really. The term HTML5 video is used to differentiate the playing of a video directly by a browser encountering a web page’s video element, as opposed to being played by a third-party browser plugin via an object or embed element. There is nothing intrinsic about any video that makes it HTML5-ish as opposed to Flash-ish. The distinction is entirely a matter of how the a web page is coded to present the video.


What is new about HTML5?

Several things. The biggest change is that HTML5 documents are explicitly recognized as interactive applications. Every document element in HTML5 has a corresponding JavaScript API that describes how that element should behave in response to user actions and other events.


Are there new HTML5 tags?

Yes, there are new HTML5 elements that provide richer semantic descriptions of documents: section, article, header, hgroup, footer, aside and nav; new media elements: audio, video and canvas; new form input types: email, url, number range and search; and a bunch of new element attributes.


Is HTML5 is a threat to Microsoft?

No. Microsoft embraces HTML5. The IE9 beta has received high marks for its HTML5 support. Silverlight is not the only path to interactivity in Redmond


Where can I get an HTML5 browser?

Opera, Chrome and Safari provide pretty solid support for HTML5 in their current versions including their browsers for iPhones, iPads and Droids. Firefox’s support for HTML5 is weak in its current version (3.6) but quite robust in the Firefox4 public beta.


Is HTML5 ready for prime time?

Some of it is and some of it isn’t. New HTML5 semantic elements have good support in all modern browsers, including IE if an HTML5 shim or the Modernizer JavaScript library is loaded into a web page. The audio, video and canvas elements are not supported in Internet Explorer yet, but these elements are designed to gracefully fail and fallback to other technologies, like Flash and Silverlight, in legacy browsers. Other technologies that are associated with HTML5 such as Mathematical Markup Language (MathML), Scalable Vector Graphics (SVG), Web Sockets, Web Storage and Geo-location have only limited support in the current crop of browsers.


Is HTML5 video better than Flash video?

Yes, but not in terms of video quality which is a function of how the video data is encoded. HTML5 video is better because the video element can interact with other elements on the page and can be styled using CSS. Also, HTML5 video should use less resources because it is built into the browser.


Will HTML5 kill Adobe’s Flash?

Nope, Flash will be around for a long time. As a media player, Flash accommodates digital rights management (DRM) which hasn’t been addressed in the HTML5 specs. As an applications platform, Flash has a large, installed base in corporate environments where there’s no compelling rationale for rewriting working applications in HTML5. For new applications, HTML5 has advantages over Flash: content is better exposed to search engines, there’s complete integration with other document elements, no plugins are required and HTML5 tools are free.


Java (225)

How do I convert from a char to an int?

If you want to get the ASCII value of a character, or just convert it into an int (say for writing to an OutputStream), you need to cast from a char to an int.

What's casting? Casting is when we explicitly convert from one primitve data type, or a class, to another. Here's a brief example.

public class char_to_int
      public static void main(String args[])
           char myChar = 'a';
           int  i = (int) myChar; // cast from a char to an int

           System.out.println ("ASCII value - " + i);

In this example, we have a character ('a'), and we cast it to an integer. Printing this integer out will give us the ASCII value of 'a'.


How do I detect if command line arguments are empty?

Whenever you write Java applications, its vital that you check your command line arguments before using them. Not all users will remember to put in the correct number of parameters, and your application will terminate with an ArrayIndexOutOfBoundsException. Fortunately, its extremely easy to check!

Here's an example program, that checks that at least one parameter exists :

public class argsdemo
public static void main(String args[])
if (args.length == 0)
System.err.println ("No arguments!");

Just add a if statement before using a parameter, and then perhaps exit with a message. You can check for a specific number of parameters, and terminate if they're missing.


Do I need to know C++ to learn Java?

No. Java is in fact a much easier language to learn than C++.

A little further out in left field, it isn't even necessary to know Java to write Java programs. Intermetrics is beta testing an ADA-95 to Java byte code compiler. Other such cross-compilers are probably possible including ANSI Fortran-77, COBOL, and Basic. However the one most people probably want, a C/C++ to Java byte code compiler, is probably not possible due to Java's lack of pointers.


How do I make a window “pop under” when it is opened?

Put this as early in the <head> of the page as possible:


That tells the window to "lose focus" as soon as it reads the self.blur(); — which makes the window "jump behind" the window that is currently in focus.


Can I record audio from an applet?

This is what is known as "a third-party opportunity". In other words not this year and probably not next year either. This would make a neat Java plug-in if anyone cares to write one in C.


What does the ++ or — signs after a variable mean?

These operators date back to the days of C programming. These operators increment or decrement a variable by one. They're quite handy for using in expressions, because they will increment or decrement the variable after the expression has been tested.

A common example of their use is in for loops. Consider the following loop, which counts from one to ten.

for (int i=1; i<=10; i++) {
   System.out.println (i);

In this case, the variable is incremented by one each time, until the terminating condition of greater than ten has been reached. It could just have easily been a while loop, or other expression.


What tag do I need to use?

<applet width="550" height="300" code="MyApplet.class" codebase="/mycodebase/" archive="myjar.jar"> <param name="cabinets" value="mycab.cab"> You need a Java 1.1 capable browser to see this applet </applet>

This tag allows both Netscape and Microsoft browsers to read the same tag. Most browsers ignore the "cabinets" parameter.


NullPointerExceptions with arrays of objects

When you allocate an array of objects, each component of the array is initialized to null. The individual components of the array must still be initialized with a constructor or an assignment statement. For example, consider this statement:

Integer[] scores = new Integer[10];
int m = scores[5].intValue(); // throws NullPointerException

This creates an array called scores containing ten references to Integer objects. Then it tries to get the value of the fifth component. However, each of those references is initially set to null. Thus when you try to call a method on one of the components of the array or pass the component to a method that expects a non-null argument, a NullPointerException is thrown.

To fix this, you need to initialize the components of the array, either with constructors or with assignment statements For example:

Integer[] scores = new Integer[10];
for (int i = 0; i < scores.length; i++) scores[i] = new Integer(i);
int m = scores[5].intValue(); 

You do not need to initialize all the components of the array though it's a good idea to do so. You can initialize just those you'll use, or you can make sure you catch and handle NullPointerExceptions in the appropriate places.

This is different from how Java handles uninitialized non-array reference variables. By way of contrast when you write,

Integer score;
int m = score.intValue();

the compiler catches the null reference in score and complains. You have to fix the problem before you can compile the program. However in general the compiler has no way to know whether an array component has or has not been initialized. Therefore the check for the non-nullness of an array component is deferred till runtime when the NullPointerException may be thrown.


Are Java programming language courses available? Where? At what price?

SunService is providing Java programming language courses at sites around the world; see

Sun Educational Services (http://www.sun.com/sunservice/suned/)


System Level Security

On a system level Java applets live in a cage. They can do pretty much anything they want inside their cage, but they cannot get outside the cage and do damage unless the user unlocks the door to the cage. Even then they wear shackles that prevent them from doing things like writing to arbitrary addresses in memory.

In Netscape the user doesn't even get the keys to the cage so you can't let the applets out into your system even if you wanted to. With the Applet Viewer it is possible to give your applets more access to the network. However they still can't do everything a C program can do.

Specifically a Java applet cannot write anything to a hard drive. It cannot write directly to memory, and it cannot introduce a virus into your system. A Java applet can use a lot of your CPU time though not 100% of it. It cannot crash your system (though a Java enabled browser can).


Joomla (200)

Am I giving up to OSM the copyright on any modifications I make?

No, you retain copyright on all the modifications or additions that you make. The intention here is merely to ensure that nobody can make the documentation proprietary.


How do I stop users from being able to register?

Go to your site >> global configuration and change "allow user registration" to no.


How do I redirect users after a successful login?

After logging into the Administration backend, go the module manager. A list of all the modules installed on your site will appear. Edit the one that says "Login Form" under Module Name ("mod_login" under the Type column).

Under Parameters, enter the URL of page where you want to redirect successful logins to where it says "Login Redirection URL."


How do you upgrade a site to Joomla! 1.5?

You can migrate a Joomla! 1.0.x site or a Mambo 4.5.x to Joomla! 1.5.

Joomla 1.5 does not provide an upgrade path from earlier versions. Converting an older site to a Joomla 1.5 site requires creation of a new empty site using Joomla 1.5 and then populating the new site with the content from the old site. This migration of content is not a one-to-one process and involves conversions and modifications to the content dump.

There are two ways to perform the migration:

  • An automated method of migration has been provided which uses a migrator component to create the migration dump out of the old site (Mambo 4.5.x up to Joomla 1.0.x) and a smart import facility in the Joomla 1.5 Installation that performs required conversions and modifications during the installation process.
  • Migration can be performed manually. This involves exporting the required tables, manually performing required conversions and modifications and then importing the content to the new site after it is installed.

Automated migration

This is a two phased process using two tools. The first tool is a migrator component named 'com_migrator'. This component has been contributed by Harald Baer and is based on his 'eBackup' component. The migrator needs to be installed on the old site and when activated it prepares the required export dump of the old site's data. The second tool is built into the Joomla 1.5 installation process. The exported content dump is loaded to the new site and all conversions and modification are performed 'on-the-fly'.


How do I add my own php to a content item?

You can either create your own Joomla component or else install a mambot, such as kl_php or moslate.

Another option is to use the wrapper menu item, so you can add your own custom made php files.


Common problems when enabling Search Engine Friendly (SEF) URLs

Enabling Search Engine Friendly (SEF) URLs can cause problems if your website hosting is not properly configured to support the re-writing of URLs. There are many different combinations of server technologies and operating systems, so it is not possible to give definitive answers to every problem with SEF URLs.


Why don’t all of my menu items show up in the module assignment lists?

Modules are assigned to specific pages using a list of menu links that is visible when you edit the module in the module manager (on the right of the page). In older versions of Joomla! this list does NOT include menu links of the type "URL." This is an anomaly from the history of the development of Joomla! carried over from Mambo. Although you can use the URL type for any link, including internal Joomla! links, the original idea was that these would be used for links to external sites which would not display Joomla! modules. Some Joomla! component extensions use URL links (rather than component links with parameters) as a simple way to access specific views of the components.


What is the contact creator?

The contact creator is a plugin that automatically creates a linked contact record every time you create a new user.

The contact creator is disabled by default; enable it in the plugin manage.


What is the Joomla! Administrator’s Security Checklist?

The Security Checklist is a concise selection of the best tips and tricks from the many contributors in the Joomla Security Forums. Review this list BEFORE you install Joomla for the first time.


How to implement XML-RPC in a component

XML-RPC is a specification and set of implementations which allow software running on different software platforms and written in different languages to make procedural calls over the internet using standard eXtensible Markup Language.

There are two ways to implement XML-RPC in a component:

  • Implement it using an XML-RPC plugin or
  • Implement it in the component itself using raw views


Magento (57)

How to install Magento

These instructions document the default installation for Magento. At the end, Magento will be installed without sample data to a directory called magento on your web server. There are four main steps covered here:

  • Step 1 – Download Magento
  • Step 2 – Set file permissions for the Setup Wizard
  • Step 3 – Create your store database
  • Step 4 – Run the web-based Setup Wizard
  • All done!

Step 1—Download Magento

Method 1: Download Magento to your computer and FTP it up to your server

  1. Using a browser, download the latest full release archive file from MagentoCommerce.com ( http://www.magentocommerce.com/download)
  2. On your computer, extract Magento from the downloaded archive. A folder named magentocontaining all of the Magento files will be created
  3. Using an FTP client, upload the extracted magento folder and all its contents to the web root on your web server (usually public_html)

Method 2: Download Magento directly to your server (requires SSH access)

If you have SSH access to your server, using wget to download the archive directly to your server is much faster and simpler than Method 1.

  1. Using SSH, log onto your server and go to the web root directory (usually public_html)
  2. Get the full release archive using the wget command below
  3. On your server, extract Magento from the downloaded archive. A directory named magentocontaining all of the Magento files will be created under  public_html

	cd publc_html wgethttp://www.magentocommerce.com/downloads/assets/ tar -zxvf magento-

(Replace in the commands above with the desired version number. Current and previous version numbers can be seen on the Download page on MagentoCommerce.com)

Step 2—Set file permissions for the Setup Wizard

On your web server, make the directories that the Setup Wizard needs writeable by the web server

Files & directories that must be writeable are:

  • – file: magento/var/.htaccess
  • – directory: magento/app/etc
  • – directory: magento/var
  • – all the directories under: magento/media

If you are using FTP, set the permissions of each to 777 or check read/write/execute for owner, user and group. If you are using SSH, use the following commands:

	chmod o+w var var/.htaccess app/etc
chmod -R o+w media

Step 3—Create your store database

  1. Create an empty MySQL database for your store 
    This step varies by hosting provider and is out of the scope of this document. Consult your System Administrator or your web host’s support/documentation for instructions on how to do this. PHPmyAdmin or the MySQL command line are the most commonly used tools/methods for creating and managing a MySQL database
  2. Create a database user with full privileges to the database
  3. Make note of the database name (dbname), db user (dbuser), db user password (dbpassword)
  4. If you want to load sample data, you must do it now, before you run the setup Wizard in the next step

Step 4—Run the web-based Setup Wizard

  1. Using a browser, run the Setup Wizard 
    Go to your website by domain or IP address http://www.yourDomain.com/magento or http://yourIP.0.0.1/magento) and the Setup Wizard will run automatically
  2. In the Setup Wizard, finish configuring your Magento installation

         a. License Agreement – Read and accept the terms and conditions

         b. Localization (settings can  be changed later via the Admin Panel)

  • Locale – default country $ language
  • Time zone – default time zone
  • Default currency

c. Configuration


  • Host


    for most basic installations

  • Database name


    when you created the database

  • User name


    when you created the database

  • User Password

    when you created the database

Web access options (will be pre-filled based on your installation, settings can be changed later via the Admin Panel)

  • Base URL—for default installation into a magento directory, base URL should be  http://www.yourDomain.com/magento or http://www.yourIP.com/magento . (If you’re installing Magento locally on PC or Mac, this should be –you cannot put “localhost” here unless you’ve previously set it up in your local hosts file.)
  • Admin path—default is “admin” (will be appended to base URL to reach Admin Panel)
  • Skip Base URL Validations Before the Next Step
  • Use Web Server (Apache) Rewrites
  • Use Secure URLs

Session Storage Options—Choose file system or database. Most installations should use “file system” because it’s faster and doesn’t cause the database to grow. But if your site will run on multiple servers, you should select “database” so that a user’s session data is available regardless of which server his/her request is served from.

Admin account

  • Name & contact info for 1st Admin user
  • Login info for 1st admin user (username & password)
  • Encryption key—Database encryption key. If you do not provide one, Magento will automatically generate one. It will be displayed to you and saved in the app/etc/local.xml file.

Magento stores this set up information in the file  app/etc/local.xml. If you’d like to run through the Setup Wizard again you do not have to download all the Magento files again. Just delete the  local.xml file and any files and directories in the var/ directory and go back to  http://www.yourDomain.com/magento&nbsp; with your browser. The Setup Wizard will run automatically again. (Why does this work? The Setup Wizard writes the values you provide during the setup process to the local.xml file and it will not run if it finds a local.xml file already. The var folder contains cached session information from the frontend and will have cached any previous settings, so deleting these files will prevent the incorrect cached content from being used.)


magento installation softaculous

After you finish the set up wizard, you will be redirected to the Magento storefront. You can access the Admin Panel and start adding categories and products.

  • Your frontend store will have the URL  http://www.yourDomain.com/magento
  • Your Admin Panel will have the URL  http://www.yourDomain.com/magento/admin
    (Log in using the username and password you created in the last step of the Setup Wizard)


What is an acceptable page load time?

That’s a great question, and the answer is the faster the better. SEO experts often quote the two second rule (which has nothing to do with eating food you dropped on the floor), but, in reality, even a page that loads in a second can stand for improvement so a page that takes more than five seconds to load is most certainly going to have a material effect on your conversion rates.


How to speed up product imports and exports in Magento

Magento product imports and exports tend to gradually slow down. The reason for this usually is that the Magento database fills up with records and the larger it becomes, the slower product imports and exports become.

Fortunately, there is an easy solution. To reduce the database size and speed up product imports and exports, you can delete old records by truncating a few tables. The tables that need to be truncated are log_url, log_url_info, log_visitor, log_visitor_info, dataflow_batch_import,dataflow_batch_export, index_event and report_event.

You can truncate these tables through phpMyAdmin. Simply tick the 8 tables and from the With selected drop-down menu at the bottom of the page select Empty.

An alternative of the above is to click the SQL tab in phpMyAdmin, paste these queries:

TRUNCATE `log_url`; TRUNCATE `log_url_info`; TRUNCATE `log_visitor`; TRUNCATE `log_visitor_info`;  TRUNCATE `dataflow_batch_import`; TRUNCATE `dataflow_batch_export`; TRUNCATE `index_event`;   TRUNCATE `report_event`;

and click the Go button to execute them.

It is also recommended that you set up log cleaning in Magento so that your Magento can purge its logs automatically.


When will you need to clear cache to see the changes in Magento?

In Magento, when you have added/modified XML, JS, CSS file(s).


Basic Features of Magento

Magento is an open ecommerce source platform which is powerful and has many applications. It provides all features and tools to build ecommerce website as quick as possible.

There are features which Magento Tutorial for Beginners summarized:

  •  Analytics and Reporting – the script is integrated with Google Analytics and offers many different reports.

  • Product Browsing – multiple images for products, options for extensive reviews, wishlists and much more.

  • Catalog Browsing – easy navigation, advanced product filtering system, product comparison.

  • Catalog Management – inventory management, batch import and export of products, different tax rates per location, additional product attributes.

  • Customer Accounts – order status and history, e-mail and RSS feeds for products in the wishlist, newsletter subscription, default billing and shipping address.

  • Customer Service – enhanced features for customers’ accounts, Contact Us form, comprehensive order tracking and history, customizable order e-mails.

  • Order Management – create orders through admin area, create multiple invoices shipments and credit memos, call center order creation option.

  • Payment – different payment methods: credit cards, PayPal, Authorize.net, Google Checkout, checks, money orders, support of external payment modules like Cybersource, ePay, eWAY and many more.

  • Shipping – shipping to multiple addresses, flat rating shipping, supports UPS, UPS XML (account rates), FedEx (account rates), USPS and DHL.

  • Checkout – one page checkout, SSL support, checkout without having an account.

  • Search Engine Optimization – 100% Search Engine Friendly, Google SiteMap support.

  • International Support – multiple languages and currencies, list of allowed countries for registration, purchasing and shipping, localization.

  • Marketing Promotions and Tools – coupons, discounts and different promotion options.

  • Site Management – control of multiple web sites, multiple languages, tax rate with support for US and International markets, customizable outlook through templates.


What is Expression? How to Use It Performing Magento Import?

Requently in the process of Magento import you face dilemma: the procedure cannot be completed, because there are no all the necessary fields listed in the file, your data structure placement does not correspond to your import tool requirements or you simply forgot to add some values and made up your mind only in the middle of Magento product update process. What to do? Should you return, do the changes in your file and start all over again? No way, it is not acceptable to waste your time this way.
Performing Magento import via Store Manager for Magento you will forget about having to do any modifications of your data manually. By means of expression rules, that can be applied during import process, you basically, can do almost all the possible adjustments of your file information automatically. 
What exactly is expression?
Expressions are special formulae that allow to add missing information or change present data on the basis of some logical rules that can be applied to indicated in the file values. With expressions the data modifications are made on the fly right in the process of Magento product update, thus the usage of those useful rules will deprive you from having to spend hours on manual product-after-product changes, especially if the amount of products you have in your import file is big.
Where to create/apply expression rule in the process of import?
At the step of Magento import where you are assigning .csv columns to database fields, check the on the left part of the window. There you can see your database columns. Select the column where you need to input changes for Magento product update by means of expression rule. Then press … button and you will see Expression Editor Window, where you can add the necessary formula.
There is also “Auto Complete Window” button, that contains useful prompts that might help you to create correct expression. There you will see the set of available in .csv file fields, the list of commands, functions and macroses for formula creation.
If you need help with functions or more info on how to use them, you can use “SQL help” button.
What info can be changed by means of expressions in the process of Magento import?
Generally, by means of the expressions it is possible to change all the fields available in the list and add certain values to those fields on the fly in the process of Magento product update.
You can add, modify, replace, delete, divide, multiply values of your file or which are already in database. With this purpose all the SQL commands which are in the list can be used. Check our related article on what can be the situations when you need to use expressions and example of most common expressions


How to fix the Magento adminhtml grid sort & filter options causing the whole page to be reloaded within a frame

If you’ve recently added a grid into your module and you’re experiencing issues when sorting or filtering like this:

How to fix the Magento adminhtml grid sort

This is because the Ajax request is trying to reload the same page you’re on. One way of resolving this would be to override the grid URL through the getGridUrl() function and then creating an entirely new action, with potentially a new layout entry or by calling the block directly. If you’re wanting to use this method you can find out exactly how here.

By default the Mage_Adminhtml_Block_Widget_Grid contains the following code to determine the grid URL.

public function getGridUrl (){								
return $this -> getCurrentUrl();

This piece of code is telling the grid to use the current URL as the grids URL. Obviously the current URL would be the grid container including the header and footer which is causing the issues we’re seeing in the screenshot.

We can easily resolve this with 4 lines of code added into the controller action as follows:


This checks to see whether the request is done via an Ajax call and then returns the contents of the grid as HTML. You’d need to add this at the top of your action as follows.

public function indexAction()important;">{


How­ to­ correctly­ configure­ a­ Magento­ cron­ job


Step 1

To add the Cron job, the first step is to log into your cPanel account and click on the Cron Jobs menu item in the Advanced section.

Step 2

You will now get to the screen where you can configure the cron jobs for your account. If you would like to receive an email report after each cron is run, enter your email address and click on Update Email. Then, under Add New Cron Job, you need to enter the following:

  1. Select how often the cron should run (every 5-10 minutes is recommended);
  2. Enter the command to run. In case of Magento, this will usually be:
    /usr/local/bin/php -f /home/username/public_html/cron.php
    This assumes Magento is installed in the root folder of your account (public_html). Make sure to put in your username.
  3. Click the Add New Cron Job button.
  4. You should now see a new entry in the Current Cron Jobs table below.

Add Magento Cron Job



Reindex Magento Data via SSH

The fastest way to reindex Magento data is manually via SSH.

To reindex the Magento data manually, you need to have an SSH access to your web hosting account. All SiteGround hosting accounts come with SSH access.

All you need to do to reindex your Magento data manually is to log in your hosting account via SSH, go to your Magento installation directory (e.g. public_html/store) and execute the following command:

/usr/local/bin/php shell/indexer.php reindexall

This command will reindex data by all indexers.


What does Magento cost?

The Magento Community Edition is available as a free download under the open source OSL 3.0 license. The premium, Magento Enterprise Edition solution is available based on an annual subscription. For pricing and additional information please visit this page.


Magento Go (14)

How do I Integrate Add-ons?

On the Add-ons page, simply select the Add-on you'd like to integrate and click the 'get this Add-on' link for easy to understand instructions on how to start using your new functionality.


What Are Store Views and How Many May I Use For My Store?

Store views are used to support multiple languages in Magento. They can also be used to create different areas of the website that are styled differently, all under the same base URL. The number of languages supported by a plan are the number of store views that are available with that plan. Please refer to the Plans and Pricing page for details.


What is Magento Go?

Magento Go is an online service for entrepreneurs and small businesses that lets you build your own online store to sell your products and services online. Magento Go makes it easy for you to start selling quickly. You don't need to worry about servers and software. Magento Go handles everything for you.


Where can I Find Add-ons Once They Have Been Integrated?

After you've installed an Add-on, it will display in your control panel when you log on to manage your site.


What are Add-ons?

Add-ons are a group of marketing and business management products that you can easily integrate with your Magento Go online store. Add-ons were developed through our broad network of partners to give you the flexibility to build and maintain your store the way you want.


Which Payment Processors Do You Support?

Magento Go works with many different payment gateways including PayPal, Authorize.net, OGone, Sage Pay Direct, WorldPay and more. For a full list of payment gateways refer to our payment gateways page within the knowledge base or search by country on our gateways page. You can also configure your online store to accept alternative payment methods including check or money orders, cash on delivery or zero subtotal checkout. Our payment methods page lists all alternative payment methods for your reference. Magento is quickly adding many new payment processing and gateway options from around the world, so be sure to check these pages often to see what’s new with Magento Go.


Can I Customize The Design of My Store?

Yes, Magento Go gives you lots of options for designing your store. You can start with one of many professional themes and then customize them to meet your needs. You can upload your own logo and images, edit the theme's CSS or even upload your own CSS file. You can even upload JavaScript blocks into your design. Magento Go makes it very easy to achieve your desired look and feel of your store without sacrificing functionality.


Can I migrate my existing catalog to my Magento Go Store?

Yes, Magento Go lets you import your existing catalog by uploading a .CSV file. Magento will soon provide you with automated tools to migrate your catalog to Magento Go with just a few clicks.


How do Add-ons Work?

Add-ons leverage Magento Go's web services Application Programming Interfaces (APIs) to seamlessly connect with our partners' systems to exchange information. The data is then imported from the partner directly into Magento Go's control panel for you to easily access.


Can I Run Multiple Sites From a Single Store?

At present, you can run one website that is associated with a single base URL with each Go plan you purchase.


MySQL (116)

How to alter or drop a database?

The ALTER DATABASE statement changes options for an existing database. The allowable options are the same as for CREATE DATABASE; that is, CHARACTER SET and COLLATE. The following statement changes the default collation of the db_name database to utf8_polish_ci:

ALTER DATABASE db_name COLLATE utf8_polish_ci;

This statement changes both the default character set and collation:

ALTER DATABASE db_name CHARACTER SET latin1 COLLATE latin1_swedish_ci;

Changing the default character set or collation affects only creation of new tables in the database. It does not affect existing tables. The database name is optional for ALTER DATABASE. If no database is named, the statement changes the options for the default database. This requires that there be a currently selected database. Otherwise, an error occurs.

You cannot use ALTER DATABASE to rename a database. One way to accomplish this is to dump the database, create a database with the new name, reload the data into the new database, and drop the old database.

When you no longer need a database, you can remove it with DROP DATABASE:


It is an error if the database does not exist. To cause a warning instead, include an IF EXISTS clause:


Any warning generated when IF EXISTS is used can be displayed with SHOW WARNINGS . DROP DATABASE does not require the database to be empty. Before dropping the database, MySQL removes any objects that it contains, such as tables, stored routines, and triggers.

DROP DATABASE is a dangerous statement and you should use it with care. There is no statement to “undo” DROP DATABASE. If you drop a database by mistake, your only option is to recover the database and its contents from your backups.


What is difference among –defaults-file, –defaults-extra-file and –no-defaults?

To connect with MySQL server, client programs may be required to invoke connection options while making connection. However, the options can also be placed in file(s) as an alternative to specifying options on the command line. Such file(s) can be created besides MySQL standard option files (my.ini and my.cnf). The standard MySQL client programs look for option files at startup time and use any appropriate options they find there. Thus, –defaults-file, –defaults-extra-file and –no-defaults options are invoked while connecting with MySQL server to look for or ignore such options file(s). Take an example:

shell > mysql --defaults-file=C:\my-options

–defaults-file option is used to tell a program to read a single specific option file instead of the standard option files. For example, to use only the file C:\my-options for mysql and ignore the standard option files, you may use the program like this:

shell > mysql --defaults-file=C:\my-options

–defaults-extra-file is used to tell a program to read a single specific option file in addition to the standard option files.

–no-defaults option is used to tell a program to ignore all option files.


I get this error when I’m installing Sugar: Database admin user name and/or password is invalid (Error 1251: Client does not support authentication protocol requested by server; consider upgrading MySQL client).

There are multiple ways to workaround the error that you're seeing, including upgrading pieces of the architecture, or modifying MySQL to utilize the old password hashing algorithm.

One quick workaround is to issue the following MySQL query:
SET PASSWORD FOR 'username'@'localhost' = OLD_PASSWORD('new_password_here');


How to find the books which have authors with more than one book in the table

This is can be done through creating drive table of author_books table and then joining the both. First part of the query will find the authors with multiple books. Then join the drive table to that on ab_author_id. Take the example below:

SELECT ab_1.ab_author_id, ab_1.ab_book_id
FROM author_books ab_1

     SELECT ab_author_id, COUNT( ab_book_id )
     FROM author_books ab_2
     GROUP BY ab_author_id
     HAVING COUNT( ab_book_id ) >1

) AS ab_3 ON ab_1.ab_author_id = ab_3.ab_author_id;


What does –safe-updates option in mysql?

It’s possible to inadvertently issue statements that modify many rows in a table or that return extremely large result sets. The –safe-updates option helps prevent these problems. The option is particularly useful for people who are just learning to use MySQL. –safe-updates has the following effects:

  • UPDATE and DELETE statements are allowed only if they include a WHERE clause that specifically identifies which records to update or delete by means of a key value, or if they include a LIMIT clause.
  • Output from single-table SELECT statements is restricted to no more than 1,000 rows unless the statement includes a LIMIT clause.
  • Multiple-table SELECT statements are allowed only if MySQL will examine no more than 1,000,000 rows to process the query.


What is index terminology or concept and how does index work in MySQL?

An INDEX is essentially an ordered (or indexed) subset of table columns, with each row entry pointing to its corresponding table row.

We index the specific columns to keep them in organized versions. An indexed column just provides a sorted data structure so that some searches on that column could be faster. For example, a telephone book. It's in sorted order by name. So it makes it a lot faster to find someone by name. So a telephone book is a form of an index.

MySQL allows to create indexes to facilitate quick retrieval of desired data. Using indexes, MySQL can jump directly to the wanted record. Without using index(s), MySQL has to read the entire data file to find the required record(s). In short, with INDEX select queries work considerably faster and without INDEX such queries works slow. Take an example, create a table called "buyers":

CREATE TABLE buyers(buyer_id INT NOT NULL, buyer_name CHAR( 50 ) NOT NULL );

Then insert 1000 buyers with different names into the table in a completely non-alphabetic order. A small portion of the data file may be represented like below:

buyer_id buyer_name
 1        Zeshan
 2        Aqeel
 3        Nick
 [...]    [...]
 998      Lara
 999      Barbara
 1000     Ken

By above there seems no recognizable order to the "buyer_name" column. However, if we create an index on the "buyer_name" column, MySQL will automatically order this column's data alphabetically:


In case of indexed column, for each data entry, MySQL also internally maintains a "pointer" to the inserting row in the actual data file. So if I want to get the buyer_id of Lara like

SELECT buyer_id FROM buyers WHERE buyer_name='Lara';

MySQL can jump directly to the correct row in the data file using buyer_name index "pointer", and return the value of buyer_id (998). So with the index MySQL only has to look at one row to get the wanted result. Without an index on "buyer_name", MySQL would’ve scanned all 1000 rows in the data file to find the wanted buyer_name 'Lara'. In other words, with the index(s) MySQL has to evaluate very less rows to respond the query.

In short, indexes are one of the keys to get speedy responses in large databases. It does not matter how simple the table is, the scan will never be fast when a table has 500000 rows. If a dynamic site has 500000 rows table, the developer should really analyze possible indexes and possibly has to rewrite queries to optimize the application.


When does multi column index come into use in MySQL?

Multi column index is a useful feature to optimize searches. MySQL allows to create an index either on single column or on multi columns of the table however single column index and multi column(combination of columns) index behavior differs. To understand the behavior of single column index and multi column index, we will walk through the following examples. I assume after this we will be able to decide when to use multi column index. To continue, let's create a table named "buyers" to take it as an example:

 first_name CHAR(19) NOT NULL,
 last_name CHAR(19) NOT NULL,
 zip CHAR(5) NOT NULL,
 state_code CHAR(2) NOT NULL,
 PRIMARY KEY (buyer_id)

A small portion of the data file (we inserted) may be represented like below:

buyer_id first_name last_name zip state_codess
[…] […] […] […] […]
991 zeshan Nadeem 92082 CA
992 Ken Marcus 92082 CA
993 Tariq Iqbal 92082 CA
994 Tariq Iqbal 92082 CA
995 Hasnat Ahmad 92083 NY
996 Tariq Iqbal 92082 DC
997 Keith Worlf 93083 NG
998 Ashley Lewis 92088 NJ
999 Tariq Mehmood 99088 TX
[…] […] […] […] […]

In the above table, there are four Tariqs (three Iqbals, one Mehmood), three from 92082 zip, and one from another zip 99088 (Tariq Mehmood).

Now our requirement is to get the buyer_id for buyers with a specific first_name, last_name, and zip. For example, we want to find the buyer_id for Tariq Iqbal, zip 92082 so we write the following query to the desired record:

SELECT buyer_id FROM buyers WHERE first_name='Tariq' 
                AND last_name='Iqbal' AND zip=92082;

As per our above query and structure of examplory defined table "buyers", MySQL will scan all the table three times to find the requested record. Of course this may take considerable time to find out wanted record particularly when the table has records in millions in it.

Since we want to ask MySQL to avoid a full table scan, therefore we would like to take advantage of indexes to get them in use. First option is to create an index on each column (so called "single column index") viz first_name, last_name, or zip. Let's we put the index on each column like below so that MySQL should skip to scan all table three times:

ALTER TABLE buyers ADD INDEX idx_firstname (first_name);
ALTER TABLE buyers ADD INDEX idx_last_name (last_name);
ALTER TABLE buyers ADD INDEX idx_zip (zip);

In this case at the first instance MySQL will use the idx_firstname index to limit the records to those where first_name=’Tariq’. At the next step, using this "temporary result set" MySQL will apply other indexes conditions individually i.e. last_name='Iqbal' and zip=92082. First it eliminates those whose last_name is not Iqbal. And then it eliminates those who are not from zip 92082. MySQL has now applied all conditions and can return the results after more than one sorting.

Of course, the above is more efficient than forcing MySQL to do a full table scan, but we are still forcing MySQL to scan significantly more rows than it needs to.

Now here's where the multi column index comes into use. If we add a single index on the three columns, we can get the correct set in a single pass! However, here is the code we use to add multi column index (index on combination of columns):

ALTER TABLE buyers ADD INDEX idx_flname_zip(first_name,last_name,zip);

Since the MySQL keeps the index files in an organized versions, MySQL can jump directly to the correct first_name, then move to the correct last_name, and finally go directly to the correct zip. Therefore, MySQL has found the correct rows without having to scan a single row of the data file!

Thus creating three single-column indexes on (first_name), (last_name), and (zip) is completely different from one "multi column index" on (first_name, last_name, zip). While running a query, MySQL can only use one index. So, if we have three single column indexes instead of multi column index(first_name, last_name, zip), MySQL will attempt to pick the most restrictive one, but the most restrictive single column index will be significantly less restrictive than our multi column index.

Point to note about Multi Column Index

With the multi column index (first_name, last_name, zip) then queries can only use the index if you have a WHERE clause that partially matches the index from left to right. Check below:

1. [SELECT * FROM buyers WHERE first_name=? AND last_name=? AND zip=?] will use the index.
2. [SELECT * FROM buyers WHERE last_name=? AND first_name=? AND zip=?] can't use the index.


What is difference between \g and \G characters in mysql client program?

MySQL allows several queries to be entered on a single input line and uses the terminators to distinguish where each query ends. You may use any of several terminators to end a statement. Two terminators are the semicolon character (';') and the \g sequence. They're equivalent and may be used interchangeably.

The \G sequence also terminates queries, but causes mysql to display query results in a vertical style that shows each output row with each column value on a separate line.

The \G terminator is especially useful if a query produces very wide output lines because vertical format can make the result much easier to read. Take an example below.

mysql>  SELECT * FROM user\G


What is partial-column and prefixed-column index or key in MySQL?

An index is used if a particular column in your table will be the focus of a considerable number of your SELECT queries. For example, suppose an buyer profile table consists of four columns: a unique id, first_name, last_name, and email address. You know that the majority of the searches will be specific to either the buyers ’s last_name or the email address. You should create two indexes for these columns: one normal index for the last_name and a unique index for the email address, like so:

 first_name VARCHAR(35) NOT NULL,last_name VARCHAR(35) NOT NULL,
 INDEX (last_name),

To beautify the above idea and make it more useful, MySQL allows to create indexes on columns partially taking their specific length of characters, based on the idea that the first N characters of a given column often are enough to ensure uniqueness, where N is specified within the index creation parameters. These type of indexes are also known as "partial-column indexes" or "Leftmost Prefixing". Creating partial-column indexes requires less disk space and is considerably faster than indexing the entire column. Taking again the above example, you can imagine that using the first seven characters of the last_name suffices to ensure accurate retrieval:

 first_name VARCHAR(35) NOT NULL,last_name VARCHAR(35) NOT NULL,
 INDEX ( last_name(5) ),


How to skip repeating values from the query results?

Repeating values can be skipped using GROUP BY in the query as follow:

SELECT col_1, col_2, col_3, .... FROM  table_name  GROUP BY col_1;


OsCommerce (22)

I am­ not­ getting­ an­ email­ from­ oscommerce!

In the admin panel it should be
Email Address:–    example@yourdomain.com
Email From:–    YourSite <example@yourdomain.com>
Send Extra Order Emails To:–    example@yourdomain.com

your domain on a real time blacklist.


Why am I getting Fatal error: Unknown function: curl_init()?

This error is a result of cURL not being enabled in PHP. If you are using a Windows server make sure uncomment the cURL extension in the php.ini file which is located in the following directory:
Edit php.ini, look for the following code, and remove the semicolon at the beginning:



The requested URL /account.php was not found on this server.

This issue is most commonly caused by incorrectly configured SSL settings for your OS Commerce. If you don not have private SSL and your OS Commerce is enabled you will receive this error.

Enabling/disabling SSL in osCommerce is quite straightforward. You have to edit /includes/configure.php to disable SSL and the code takes care of the rest. This is an example of SSL enabled configuration:

		// Define the webserver and path parameters
// * DIR_FS_* = Filesystem directories (local/physical)
// * DIR_WS_* = Webserver directories (virtual/URL)
define(‘HTTP_SERVER’, ‘http://www.yourdomain.com’); // eg, http://localhost – should not be empty for productive servers
define(‘HTTPS_SERVER’, ‘https://yourdomain.com’); // eg, https://localhost – should not be empty for productive servers
define(‘ENABLE_SSL’, true); // secure webserver for checkout procedure?
define(‘HTTP_COOKIE_DOMAIN’, ‘www.yourdomain.com’);
define(‘HTTPS_COOKIE_DOMAIN’, ‘yourdomain.com’);
define(‘HTTP_COOKIE_PATH’, ‘/catalog/’);
define(‘HTTPS_COOKIE_PATH’, ‘/catalog/’);
define(‘DIR_WS_HTTP_CATALOG’, ‘/catalog/’);
define(‘DIR_WS_HTTPS_CATALOG’, ‘/catalog/’);

In order to disable the SSL you will have to replace

		define(‘ENABLE_SSL’, true);


		define(‘ENABLE_SSL’, false);


What is osCommerce?

OsCommerce stands for open source commerce. It is a free program for eCommerce management. Though any program has its advantages and disadvantages, osCommerce allows for free and easy creation of workable and user friendly eCommerce sites. It hinges on the collaborative efforts of users, who help one another troubleshoot, as well as customize their software to meet the individual needs of one’s particular business.


Customizing OsCommerce Catalog

The next step is to add categories that will contain the products you will be selling in your store. To do that, please open the Catalog category from the administrator's index page and click on Categories/Products. You will be taken to a page where the default categories are being displayed. You will be able to edit or delete an existing category, or add a brand new one.

After clicking the New category button the page will refresh and a box for the new category name will appear in the right column.

Since osCommerce is a multi-language shopping cart you can add category names for the installed languages. You can also select an image to represent the specific category (images are optional and you can ignore warnings for a missing image). It can be uploaded from your local computer. The last thing to do before clicking the Save button is to select the order number for the category. The lower the number – the higher in the list your new category will appear (zero will represent the top of the list).

Next you should add a product to your new category. Open it and click on New Product.

Select whether you have the product in stock or not. Then pick the availability date and the manufacturer. Type in the name of the product on the languages you have installed and decide whether the item is taxable or not; select the Net and the Gross prices.

Enter the product description, the quantity of the product and its model. Images can also be uploaded from your local computer – osCommerce automatically creates a thumbnail. If you are linking to an external product page, please enter the address without the http:// part for the specific languages. Last thing to add is the product weight, since this will help in determining the shipping costs. When done, hit the Save button to keep the product or Cancel to skip this entry.

When you insert the product, you will be taken to the category/product list. If you wish to move the product in another category, click on Move, select the desired category from the drop-down list and click the Move button again.

You will be able to see the new addition at the top of your product list when you visit the store. The new item will also increase the count of items in the chosen category.


Why do my secure pages display a message that states, “This page contains both secure and nonsecure items?”

Secure and non-secure content, or mixed content, means that a webpage is trying to display elements using both secure (HTTPS/SSL) and non-secure (HTTP) web server connections. This often happens with online stores or financial sites that display images, banners, or scripts that are coming from a server that is not secured. The nonsecure link that is causing the problem will have to be found and either removed or edited so that it works with secure pages.


How­ to­ remove­ qtopq from­ the­ breadcrumb­ trail?

The breadcrumb trail is the links in the header bar on the left of the page. A stock install says Top>>Catalog .

Lets get rid of the "Top"

First open /catalog/includes/application_top.php and find the line: 

$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);

And comment it out. PHP comments are two forward slashes, like this //.

And you are done. Save and upload the file to your server and check your work. 

A variation is link it to a diffrent page. Just change the same line above to this:

$breadcrumb->add(HEADER_TITLE_TOP, 'http://www.yourlink.com');

Make sure you don't have it commented, otherwise the link won't show. Also make sure you have single quotes around your URL or it won't work either.

You can also rename the links like change "Top" to "Home"

Open /catalog/includes/languages/your_language.php and find this line.


And change it too:

define('HEADER_TITLE_TOP', 'Home');

Or whatever suites your fancy. You can also do the same for "Catalog" the code is just below in the same file.


How do I change the title in my shop?

The shops title is contained in the includes/languages/english.php file. Open that file and search for this string

	define('TITLE', 'osCommerce');

To change the title, you edit the word osCommerce. Be sure to leave everything else in place.

A better method of changing titles is to install the Header Tags Controller contribution. This will allow you to have unique titles and meta tags for all pages in your shop, which is very important for getting better search engine rankings.


How to configure osCommerce to work with SSL?

In order to configure osCommerce to work with SSL you should open the file public_html/catalog/includes/configure.php and make the following changes:

	define(‘HTTP_SERVER’, ‘http://www.yourdomain.com’); // eg, http://localhost – should not be empty for productive servers
define(‘HTTPS_SERVER’, ‘https://yourdomain.com’); // eg, https://localhost – should not be empty for productive servers
define(‘ENABLE_SSL’, true); // secure webserver for checkout procedure
define(‘HTTP_COOKIE_DOMAIN’, ‘www.yourdomain.com’);
define(‘HTTPS_COOKIE_DOMAIN’, ‘yourdomain.com’);
define(‘HTTP_COOKIE_PATH’, ‘/catalog/’);
define(‘HTTPS_COOKIE_PATH’, ‘/catalog/’);
define(‘DIR_WS_HTTP_CATALOG’, ‘/catalog/’);
define(‘DIR_WS_HTTPS_CATALOG’, ‘/catalog/’);

Similar to the above changes have to be made in the file public_html/catalog/admin/includes/configure.php which is responsible for the admin area configuration.

In the above example we are configuring an osCommerce installation in the catalog directory with domain yourdomain.com . You should adjust the above settings to your details.

If you are having problems configuring osCommerce to work with SSL, contact your host for assistance.


How to setup osCommerce to use SMTP

osCommerce could be setup to use the SMTP functionality inside its back-end, but there are some manual modifications needed in order to fully setup the SMTP functionality of this application. Follow these steps to complete the setup:

  1. Access the osCommerce administrative panel. The URL should be similar tohttp://yourdomain.com/admin .
  2. Go to Configuration > Email Options.
  3. Choose “SMTP” as the Transport Method.
    Also verify these other settings:

  • Email Line Feels: LF
  • Verify E-Mail Addresses Through DNS: false
  • Use MIME HTML When Sending Emails: false
  • Send E-Mails: true

Under the General Store configuration you have to check that the Email Address and Email From fields are set with the ones that you want to use for sending the messages.

Before we proceed, the phpMailer script must be installed so that we could set the SMTP functionality properly.

(Please backup your files before proceeding with the following steps)

To install phpMailer:

1. Download a copy of phpMailer: http://addons.oscommerce.com/info/5233

2. Connect with FTP or File Manager to your osCommerce installation folder and copy the files class.phpmailer.php and class.smtp.php into these folders:



3. Access the following files and edit them according to the examples provided below:



Inside each of the email.php files you have to locate the following section around line 519:

	[sourcecode language="php"]
if (EMAIL_TRANSPORT == ‘smtp’) {
return mail($to_addr, $subject, $this->output, ‘From: ‘ . $from . $this->lf . ‘To: ‘ . $to .   $this->lf . implode($this->lf, $$
} else {
return mail($to, $subject, $this->output, ‘From: ‘.$from.$this->lf.implode($this->lf, $this->headers).$this->lf.implode($this$

Please comment the following lines as described:

	[sourcecode language="php"]
if (EMAIL_TRANSPORT == ‘smtp’) {
//        return mail($to_addr, $subject, $this->output, ‘From: ‘ . $from . $this->lf . ‘To: ‘ . $to . $this->lf . implode($this->lf, $$
//      } else {
//        return mail($to, $subject, $this->output, ‘From: ‘.$from.$this->lf.implode($this->lf, $this->headers).$this->lf.implode($this$
//      }
//    }

Next, copy and paste the following code directly below the last commented line. The Host, Username and Password fields should be set according to your outgoing mail server. Note that the Username fieled should contain the full email address!

	[sourcecode language="php"]
require_once(DIR_WS_CLASSES . "class.phpmailer.php");
$pMail = new PHPMailer();
$pMail->From     = $from_addr;
$pMail->FromName = $from_name;
$pMail->Host     = "mail.yourdomain.com";       // replace with your SMTP server
$pMail->Username = "account@yourdomain.com";      // replace with your SMTP username
$pMail->Password = "password";          // replace with your SMTP password
$pMail->SMTPAuth = true;                        // SMTP authentication must be always turned on (true)
$pMail->Subject = $subject;
$pMail->Body    = $this->output;
$pMail->AddAddress($to_addr, $to_name);
return $pMail->Send();

The aforementioned changes should be appyed to both of the email.php files so that both the front-end and back-end of your application could successfully sent emails.


PHP (126)

Why should I hash passwords supplied by users of my application?

Password hashing is one of the most basic security considerations that must be made when designing any application that accepts passwords from users. Without hashing, any passwords that are stored in your application's database can be stolen if the database is compromised, and then immediately used to compromise not only your application, but also the accounts of your users on other services, if they do not use unique passwords.

By applying a hashing algorithm to your user's passwords before storing them in your database, you make it implausible for any attacker to determine the original password, while still being able to compare the resulting hash to the original password in the future.

It is important to note, however, that hashing passwords only protects them from being compromised in your data store, but does not necessarily protect them from being intercepted by malicious code injected into your application itself.


How can I handle the bz2 compressed manuals on Windows?

If you don't have an archiver-tool to handle bz2 files » download the command line tool from Redhat (please find further information below).

If you would not like to use a command line tool, you can try free tools like » Stuffit Expander, » UltimateZip, » 7-Zip, or » Quick Zip. If you have tools like » WinRAR or » Power Archiver, you can easily decompress the bz2 files with it. If you use Total Commander (formerly Windows Commander), a bz2 plugin for that program is available freely from the » Total Commander site.

The bzip2 command line tool from Redhat:

Win2k Sp2 users grab the latest version 1.0.2, all other Windows user should grab version 1.00. After downloading rename the executable to bzip2.exe. For convenience put it into a directory in your path, e.g. C:\Windows where C represents your Windows installation drive.

Note: lang stands for your language and x for the desired format, e.g.: pdf. To uncompress the php_manual_lang.x.bz2 follow these simple instructions:

  • open a command prompt window
  • cd to the folder where you stored the downloaded php_manual_lang.x.bz2
  • invoke bzip2 -d php_manual_lang.x.bz2 , extracting php_manual_lang.x in the same folder

In case you downloaded the php_manual_lang.tar.bz2 with many html-files in it, the procedure is the same. The only difference is that you got a file php_manual_lang.tar. The tar format is known to be treated with most common archivers on Windows like e.g. » WinZip.


Will I have to redo my whole site over?

No, in most cases there would be no need to change anything on your site. If you are running a very old version of WordPress you may see better compatibility from upgrading, but then that's good advice no matter what PHP you're using.


Explain how to store the uploaded file to the final location.


Files in PHP can be uploaded using move_uploaded_file ( string filename, string destination).

The filename is moved to the destination provided the file was uploaded via PHP's HTTP POST.

      move_uploaded_file($tmp_name, "$uploads_dir/$name");


I need to convert all single-quotes (‘) to a backslash followed by a single-quote (\’). How can I do this with a regular expression? I’d also like to convert ” to \” and \ to \\.

Assuming this is for a database, use the escaping mechanism that comes with the database. For example, use mysql_real_escape_string() with MySQL and pg_escape_string() with PostgreSQL. There is also the generic addslashes() and stripslashes() functions, that are more common with older PHP code.

Note: directive note: magic_quotes_gpc

The magic_quotes_gpc directive defaults to on. It essentially runs addslashes() on all GET, POST, and COOKIE data. stripslashes() may be used to remove them.


Windows: I can’t access files shared on another computer using IIS

You have to change the Go to Internet Information Services. Locate your PHP file and go to its properties. Go to the File Security tab, Edit – Anonymous access and authentication control.

You can fix the problem either by unticking Anonymous Access and leaving Integrated Window Authentication ticked, or, by ticking Anonymous Access and editing the user as he may not have the access right.


Why is it not working with the browser/web server?

PHP-GTK is not meant to be used in the Web environment. It is intended for creation of standalone applications (run via command-line, user's desktop, etc.).


What does thread safety mean when downloading PHP?

Thread Safety means that binary can work in a multithreaded webserver context, such as Apache 2 on Windows. Thread Safety works by creating a local storage copy in each thread, so that the data won't collide with another thread.

So what do I choose? If you choose to run PHP as a CGI binary, then you won't need thread safety, because the binary is invoked at each request. For multithreaded webservers, such as IIS5 and IIS6, you should use the threaded version of PHP.


Some operating systems: I have installed PHP without errors, but when I try to start Apache I get undefined symbol errors:

[mybox:user /src/php5] root# apachectl configtest
 apachectl: /usr/local/apache/bin/httpd Undefined symbols:

This has actually nothing to do with PHP, but with the MySQL client libraries. Some need –with-zlib , others do not. This is also covered in the MySQL FAQ.


Is it possible to load/manipulate an ActiveX object in a page with PHP ?

This has nothing to do with PHP. ActiveX objects are loaded on client side if they are requested by the HTML document. There is no relation to the PHP script and therefore there is no direct server side interaction possible.


PhpMyAdmin (120)

I cannot insert a text file in a table, and I get an error about safe mode being in effect.

Your uploaded file is saved by PHP in the “upload dir”, as defined in php.ini by the variable upload_tmp_dir (usually the system default is /tmp). We recommend the following setup for Apache servers running in safe mode, to enable uploads of files while being reasonably secure:

  • create a separate directory for uploads: mkdir /tmp/php
  • give ownership to the Apache server’s user.group: chown apache.apache /tmp/php
  • give proper permission: chmod 600 /tmp/php
  • put upload_tmp_dir = /tmp/php in php.ini
  • restart Apache


I get error messages when using “–sql_mode=ANSI” for the MySQL server.

When MySQL is running in ANSI-compatibility mode, there are some major differences in how SQL is structured (see <http://dev.mysql.com/doc/mysql/en/ansi-mode.html>). Most important of all, the quote-character (”) is interpreted as an identifier quote character and not as a string quote character, which makes many internal phpMyAdmin operations into invalid SQL statements. There is no workaround to this behaviour. News to this item will be posted in Bug report #1013.


I’m having troubles when uploading files with phpMyAdmin running on a secure server. My browser is Internet Explorer and I’m using the Apache server.

As suggested by “Rob M” in the phpWizard forum, add this line to your httpd.conf:

SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown

It seems to clear up many problems between Internet Explorer and SSL.


Authentication window is displayed more than once, why?

This happens if you are using a URL to start phpMyAdmin which is different than the one set in your $cfg['PmaAbsoluteUri']. For example, a missing “www”, or entering with an IP address while a domain name is defined in the config file.


My Apache server crashes when using phpMyAdmin.

You should first try the latest versions of Apache (and possibly MySQL). If your server keeps crashing, please ask for help in the various Apache support groups.


How can I produce a PDF schema of my database?

First the configuration variables “relation”, “table_coords” and “pdf_pages” have to be filled in. Then you need to think about your schema layout. Which tables will go on which pages?

  • Select your database in the navigation panel.
  • Choose “Operations” in the navigation bar at the top.
  • Choose “Edit PDF Pages” near the bottom of the page.
  • Enter a name for the first PDF page and click Go. If you like, you can use the “automatic layout,” which will put all your linked tables onto the new page.
  • Select the name of the new page (making sure the Edit radio button is selected) and click Go.
  • Select a table from the list, enter its coordinates and click Save. Coordinates are relative; your diagram will be automatically scaled to fit the page. When initially placing tables on the page, just pick any coordinates – say, 50×50. After clicking Save, you can then use the 6.28 How can I easily edit relational schema for export? to position the element correctly.
  • When you’d like to look at your PDF, first be sure to click the Save button beneath the list of tables and coordinates, to save any changes you made there. Then scroll all the way down, select the PDF options you want, and click Go.
  • Internet Explorer for Windows may suggest an incorrect filename when you try to save a generated PDF. When saving a generated PDF, be sure that the filename ends in ”.pdf”, for example “schema.pdf”. Browsers on other operating systems, and other browsers on Windows, do not have this problem.


Now that phpMyAdmin supports native MySQL 4.1.x column comments, what happens to my column comments stored in pmadb?

Automatic migration of a table’s pmadb-style column comments to the native ones is done whenever you enter Structure page for this table.


What is currently not supported in phpMyAdmin about InnoDB?

In Relation view, having more than one index column in the foreign key. In Query-by- example (Query), automatic generation of the query LEFT JOIN from the foreign table.


I can’t use phpMyAdmin on PWS: nothing is displayed!

This seems to be a PWS bug. Filippo Simoncini found a workaround (at this time there is no better fix): remove or comment the DOCTYPE declarations (2 lines) from the scripts libraries/Header.class.php and index.php.


Prestashop (10)

How to import product features by csv import­?

(Importing for PS 1.3x go here)
Import Products – You are here
Prestashop version : 1.4.x
Before posting questions/issues with importing make sure you use the latest Prestashop version!

Google Docs
With google docs you can create nice 'excel' like sheets that are also UTF-8. If you have an gmail account you can use Google Docs. I have included some sample files below for you to use.
Some important notes:
* Date fields have a fixed format that is not compatible with the date field in Prestashop
Google uses this : 2010/03/26
Presta uses this : 2010-03-26
If you want to use the prestashop format, be sure to use a ' in front of the date. Otherwise google docs will convert the date to its own format
* Multiple Field Seperator is , and cannot be changed
HTML or multiple lines in your Product Description field
Finally html support is available in These codes will work:
New fields in 1.4.4
This version adds 3 new fields compared to 1.4.3. These fields are :

  1. Available for order – Checkbox in BO. Needs to be set to 1, otherwise order button is disabled
  2. Date Add Product – Still vague
  3. Show Price – Checkbox in BO. Needs to be 1, otherwise order button is disabled.


How to clear the cache in Prestashop

When making changes in Prestashop they will often not appear right away due to old cached information. The solution is to clear the cache of the application.

Prestashop version 1.4 and above caches data using Smarty. Cached data is stored in the following folders:





all of which are located in your Prestashop’s installation folder. For example, if your Prestashop store has been installed in the public_html folder of your hosting account, cached information can be found in:





To clear Prestashop’s cached data, delete the content of these folders and reload your website in your browser to take a look at the changes you have made.

You can also disable or manage how Prestashop caches information from the application ’s back office -> Preferences -> Performance.


Process ­to­ follow­ to­ update­ prestashop?

The steps of the upgrade process are:

  1. Save and Backup Your Current Store:

    • Deactivate your store ("Maintenance" page of the "Preferences" menu).
    • Back up your files to your desktop, using your FTP client in a new "prestashop-prod" folder. This will be a complete copy of your production site.
    • Back up your database ("Advanced Parameters/DB Backup" page, or using phpMyAdmin).
    • Back up your customized translation ("Export a language" section in "Tools/Translations" tab).
  2. Getting ready for the new version:
    • Download and unzip the latest version of PrestaShop: http://www.prestashop.com/en/download, and unpack it in a new "prestashop-prep" folder.
    • Copy your personal files (images, logos, photos, translations, modules, etc.) from "prestashop-prod" to "prestashop-prep" on your computer. A detailed list is available further down in this guide.
    • Copy the "prestashop-prep" folder to the web folder on your local server (/htdocs/www, or any other name used by the server package you chose). This is the folder where you will first try to upgrade your PrestaShop, keeping your original backed-up files (prestashop-prod) and the files you prepared (prestashop-prep).
    • Recreate the production database on your local server: using phpMyAdmin, create a local database in which you will put the data from your production shop, using the SQL files that were backed-up at the start of the process.
  3. Starting the Local Update:
    • Launch the update script on your local server by accessing it with your browser. In version 1.5, that script is located at/install/upgrade/upgrade.php.
    • Verification of all parameters before the update: follow the instructions on screen and make sure your server conforms to the new version technical requirements.
    • Finishing the update: once the updater has finished, delete the /install folder and access both your front and back-office to make sure it works.
  4. QA and Testing:
    • Import your translations ("Import a language pack manually" section in "Localization/Translations" page).
    • Check that your theme is still working as expected. If this is not the case, you will have to edit its files.
    • Test your shop thoroughly: create accounts, buy products, cancel orders, check the invoices, etc.
  5. Start the update on your production web server:
    • Using your FTP client, replace the files for your online shop with those from your "prestashop-prep" folder.
    • Launch the update script on your production server by accessing it with your browser. In version 1.5, that script is located at/install/upgrade/upgrade.php.
    • Verification of all parameters before the update: follow the instructions on screen and make sure your server conforms to the new version technical requirements.
    • Finishing the update: once the updater has finished, delete the /install folder and access both your front and back-office to make sure it works.
    • Import your translations ("Import a language pack manually" section in "Localization/Translations" page).
    • Check that the main domain name is correct ("Preferences / SEO & URLs" page, "Shop URL" section).
    • Regenerate your robots.txt files ("Preferences / SEO & URLs" page, "Generate robots.txt" section).
    • Check that your theme still works as expected. If not, you will have to edit its files.
    • Test your store thoroughly: create accounts, buy products, cancel orders, check invoices, etc.
  6. Going live with your up-to-date store
    • Activate your store ("Maintenance" page under the "Preferences" menu).


Prestashop Quick Access – fix “Invalid security token”

PrestaShop admin panel has quick menu to your favorites pages, at the right-top of every page of the PrestaShop back-office. The “Quick Access” menu administration page enables you to create customized shortcuts, and make your navigation within the administration area much more comfortable and faster. You can open page in a new web browser tab or in new window.

How Adding a new link

Please got to Prestashop admin panel: Administration > Quick Access, click on “Add new”.
Name – enter shortcut unique name
URL – page address:

Copy page address from the browser’s address bar. Example:
You need remove token and Prestashop admin panel base directory, so final result looks like this:  index.php?controller=AdminCustomers

But is one problem when you want a short reference to the module.
If you’ve done as required by Prestashop, you get token security error:

Invalid security token
I understand the risks and I really want to display this page
Take me out of here!

Module address:


This url we need refactoring to link like this:
index.php?controller= AdminModules &configure=bankwire

With controller=AdminModules small fix you avoid this annoying “Invalid security token” page.


How To Fix Prestashop 1.5. * Ajax Cart Bug In Internet Explorer

In the first versions of Prestashop 1.5.* there is a bug which is reproduced in old versions for all browsers as well as in all Internet Explorer versions. This bug does not allow to save cookies when adding a product to the cart if the Block Cart module is enabled, thus your shopping cart remains empty. To fix this you need to modify the js-file /modules/blockcart/ajax-cart.js:

Comment out the following condition in the method аjаxCаrt.add(): //if($('#cart_block #cart_block_list').hasClass('collapsed'))


Place an аjаx-request in the method аjаxCаrt.expand() before slideUp is invoked.

Then set the same аjаx request for a synchronous execution, i.e.set the async option as false, instead of true.

After that clear your browser cookies.


How to install a PrestaShop theme on my ecommerce website?

The installation of PrestaShop themes is simple and can be completed in a matter of clicks. 

From your Addons account click on “Order” page, download the zip file of the theme that you just purchased. Choose the file that fits the version of PrestaShop you are using.

If you use PrestaShop version 1.6:

1. From your PrestaShop back office, click on the “Modules” tab.

2. In the sign in window, enter your Addons ID and password then click on “Connect.”

If you are using PrestaShop version 1.4 or 1.5:

1. From your PrestaShop back office, click on the “Modules” tab.

2. Search for the Import/export a theme module and install it. The configuration of this module will help you install the theme you just purchased.

PrestaShop Addons does not provide support on Community developed themes. We ask that you contact the seller directly for any type of support regarding the theme(s).


Generate­ the­ htaccess­ with­ prestashop.

1·Create an empty file on your desktop with a simple text-editor, such as Windows’s Notepad (not Word!) or OS X’s TextEdit.

2·Save the file as htaccess.txt, in a folder where you can easily find it. If possible, save it as an purely ASCII or ANSI file.

3·Upload it to your server using an FTP client, such as FileZilla. Put the file at the root of your shop’s directory.

4·Change its permissions to read and write everyone (CHMOD 666 in Unix), with your FTP client for instance.

5·Go to the PrestaShop back-office, and under the Preferences tab and “SEO & URLs” sub-tab, enable “Friendly URL” (bottom of the page).

6·Go to the “Tools” tab, then the “Generators” sub-tab, and click the “Generate the .htaccess file” button.


How to install a PrestaShop module on my online store?

The installation of PrestaShop modules can be completed in just a few clicks!

From your Addons account click on the “Order” page then download the module’s zip file that you just purchased. Be sure to choose the file that fits your running version of PrestaShop. 

If you are using PrestaShop version 1.6:

1. From your PrestaShop back office, click on the “Modules” tab.

2. In the sign in window, enter your Addons ID and password then click on “Connect”. Once this step is completed, every purchase you make on PrestaShop Addons will automatically appear in your back office modules.

If you are using PrestaShop version 1.4 or 1.5:

1. From your PrestaShop back office, click on the “Modules” tab.

2. On the top right you’ll find “Add a New Module”, click on it and download the module file that you previously purchased and saved.

3. Finally, click “Install” to begin configuring it.

PrestaShop Addons does not provide support on Community developed modules. We ask that you contact the seller directly for any type of support regarding the module(s).

For further information, please read the official documentation.


How to configure Prestashop to work with another domain

Prestashop, like many other applications out there, works based on a domain name. In case you wish to use your Prestashop application with a different domain you should change the PS_SHOP_DOMAIN and PS_SHOP_DOMAIN_SSL options in your Prestashop’s database. To edit these options you can use the phpMyAdmin tool available in cPanel.

Log into cPanel and access phpMyAdmin, after which select your Prestashop database and browse the table ps_configuration where the PS_SHOP_DOMAIN and PS_SHOP_DOMAIN_SSL records are located. Change their value to match your new domain name.

You should also make sure that your Prestashop’s base directory is correctly set in the application’s configuration file – settings.inc.php . You can find the configuration file in the config folder, located in the root of your Prestashop installation. You can edit the configuration file via FTP or by using cPanel’s File Manager tool.

Once you have opened the file for editing look for the line:

define(‘__PS_BASE_URI__’, ‘/‘);

In case your Prestashop installation is located in the web root folder of your domain name, this line should remain as above. If the installation is located into a sub folder, the line should be changed to reflect its location:

define(‘__PS_BASE_URI__’, ‘/subfolder/‘);

Where “subfolder” is the actual name of the folder where Prestashop has been installed.


Problem­ of­ memory­ allocation­ with­ 1and1.

Due to resource limits on our Shared Hosting machines, it is not possible to allocate more memory to PHP than the maximum for your package. Using a php.ini file or the memory_limit directive to increase memory for PHP may result in the phpinfo() output reflecting the change however the server will not allocate more memory than the limit imposed by 1&1.

Older packages were limited to a maximum of 30MB for PHP memory regardless of package. Starting with the Dual Hosting packages, the limits have increased. You can view the PHP Memory Limit for each Dual Hosting package on our order site.


Responsive Website Design (22)

Can I convert my existing website into a responsive one?

Of course. Here, at http://flauntresponsive.com/, we’re there to not only create a responsive website from scratch, but also convert existing ones to become mobile-friendly.


Why should you use Responsive Design?

Think about your typical desktop browser. Even if it is not maximized, it almost certainly has a width of at least 960 pixels — that is a lot of space to place lots of columns of text and images. If you compare that with a smartphone in portrait mode, you are looking at a device with about 480 pixels of width. That is half the screen space. And a feature phone has even less space, 320 pixels or less in many cases.

If you create a page with a fixed-width layout 960 pixels wide, it will look great on your desktop monitor. But the first time you view it in a tablet, it’s going to look small. And then on a smartphone it will look even more cramped or the customer will have to scroll sideways to see the entire thing. And on a feature phone, the page might not display correctly at all.

Instead, with responsive design you create a design that works for the devices that visit your site. But unlike previous methods for handling mobile designs, you don’t create a separate site for every type of mobile browser that you want to support. You would use a detection script that might or might not work to send the mobile devices to another website that you had to maintain. Responsive design simply looks at the features of the device viewing the page, and delivers the styles appropriate for that device.


How do you create a Responsive Web Design?

CSS media queries are the answer. Back with CSS 2.1 we were introduced to the idea of print style sheets. These are style sheets written just to style how the page should look when it is printed out by using media types. For example:

<link rel="stylesheet" type="text/css" href="print-styles.css" media="print">

Media types were a good start, but some devices didn't use them as they were intended, sending information that said they were a desktop browser when they were really a small handheld device. This made it difficult to use them correctly for anything beyond print.

CSS media queries were introduced as part of CSS3 and they improved on the idea of media types by looking at the actual physical specifications being sent from the browser to the computer. A mobile browser could easily pretend to be a desktop browser by simply sending that media type, but it would still have to display the contents in a smaller window.

For example, to send a specific style sheet only to iPhones, you would write:

<link rel="stylesheet" type="text/css" media="screen and (max-device-width: 480px)" href="480-styles.css">

This tells the browser to use this style sheet if the media is a screen device (rather than print, for example) and has a width of no more than 480 pixels. Note: this will catch any device that has a width less than 480px, even desktop browsers, because it is not a device dependent script. It is just looking at the width and displaying the contents accordingly.

Advantages of CSS Media Queries

You may be thinking that this isn't really that different from using a resolution detection script to pass on the correct style sheet. But there are some definite advantages to using media queries for responsive design:

  • You are not relying on JavaScript support. While most browsers out there do allow JavaScript, it is possible for users to turn it off, and once they do your efforts at responsive design are gone.
  • CSS media queries go well beyond just testing the resolution. There are, in fact, 13 different features you can evaluate against to get very specific with your designs. Plus media queries let you combine multiple queries to get, for example, only devices that are 600x800px in landscape orientation and not HD.
  • You can implement CSS media queries against just one or two rules in an existing style sheet by using the @media rule.
  • You can also import media specific style sheets with the @import rule and media queries.


There are too many technical terms. What is a responsive website in laymen terms?

Explained very simply, a responsive website is one that adapts to the screen size of the device where the website is being served. So when the page resizes, the layout adjusts according to the fit of the screen.


What is Responsive Web Design?

Responsive design is a style of web design that responds to the user as they arrive at the web page. Rather than forcing a mobile user to see a desktop site, a laptop user with a small screen to scroll horizontally to see a wide-screen monitor site, or a wide-screen monitor to view a site as a mobile customer might like, instead the design looks at each of these scenarios and adapts to display the content most effectively.

Web Pages Must Be Flexible and Adapt

I've said it many times, the web is not print. And with more and more different types and sizes of devices coming online, the sooner you accept that your pages will look different, no they must look different depending upon what is displaying them, the happier you will be.

The best web designs are the ones that make things easy. But not just easy for the website customers. The best web designs make things easy for the client as well. And responsive web design does that, but the down side is that it's not exactly easy for the web designers.

Creating a Whole Separate Website is a Bad Idea

It can be tempting, and I admit I've done it myself, to create a “mobile” site with a separate sub-domain or site location. Then you just slap up all the mobile friendly site features like single-columns, limited content, and reduced navigation in that one location and point mobile users there.

In the short term, this can work, as it gets up a mobile site quickly. But eventually it will start to cause problems. The first pain point comes when the site owner realizes that he has to post every article twice—once to the main site and once to the mobile site. This realization usually comes months after you trained them in how to maintain their new mobile site, and they have forgotten what they need to do to make the articles mobile friendly and they probably have dozens of articles that need to be ported.

Many web developers, at this point, start thinking of ways to programmatically copy files posted to the “real” website (the one for desktop browsers) into the mobile site. This can result in very complicated scripts and programs and ultimately the mobile user is still treated like an afterthought.

Responsive Design Treats Mobile and Desktop the Same

A responsive web design uses the exact same content to create a page that works whether you are viewing it at 1800 pixels wide or 320 pixels wide. But the pages that are created may look vastly different, while containing the same content. This means that whether you come to the site on an iPhone or a 27-inch iMac, you will get the same content, in fact you will go to the same URL. But on the iPhone you might see the page with only one column while the iMac gets five. But they are both considered equally important when delivering the content.


Is there a way of checking whether a website is responsive or not?

Yes! Just open the website in your desktop browser window, and resize the window. If the layout of the website changes, you’ve got a responsive website. Resize this website to see!


What are other benefits of responsive web designs?

With a responsive website, you don’t have to have separate websites for desktops and mobile phones, so you also end up saving money. They are also easy to maintain because they do not involve any server-side components.


What about ads on a responsive website?

Until responsive website ads become the norm, it’s a good idea to choose standard ad sizes, such as 300×250 which can fit easily on any screen size.


Which devices do we talk about in relation to responsive websites?

When we speak of multi-screens, we’re talking about different devices such as ultrabooks, iPads, iPhones, and even HDTVs and assorted android phones and tablets.


Is my responsive website going to be compatible with any browser?

All major latest versions of browsers such as Chrome, Firefox, Safari, etc., support responsive websites.


SEO (7)

What is SERP?

A shortened form of Search Engine Results Page, SERP is a webpage that is returned when a search engine comprises a list of matching search results from a specific term or question. This page includes website html, titles, and a brief description of the matching content.


What is a Title Tag?

One of the most important factors for search engine optimization, title tags include specific keywords, names, and phrases that are unique to individual web pages. Though often overlooked, title tags appear in the clickable link on search engine result pages.


What is a Keyword?

A commonly known term, keyword is a word within a specific webpage that dictates the nature of the content. Multiple keywords provide a summary or semantic meaning for search engine pages. In fact, keyword phrases may even influence whether a user desires to view the content portrayed on a web page by search engine descriptions. Without a doubt, keywords are perhaps the most important inclusion in web pages and SEO.


What is a Backlink?

Search engines rank websites based on the number of backlinks it utilizes. Simply speaking, a backlink is a link from one website to another. These links increase visibility to audiences researching specific topics, because they lead users to other websites that feature desired information and content in a linear manner.


What is PageRank?

Pagerank is a commonly understood concept of a page’s rank based on others that serve a similar purpose or contain linear content. Web pages with the highest relevance are displayed at the top of a search engine list. Undoubtedly, these positions are highly sought-after. Once reached, they are also challenging to maintain, as well.


AdSense Banned My Sites, What to Do?

A reinstating procedure is more like proving the AdSense team that it wasn’t you who made the fraud and you have nothing to do with any type of terms and policies breaking actions.

  1. Always write your e-mails in a perfect grammar.
  2. Write the letters addressing yourself to a 3rd person, without taking the manner personally.
  3. Be corporate, be understanding and nice.
  4. Try to offer every little bit of help possible, so that the AdSense team can check all the possible variables.
  5. If you are a fairly known figure, for it’s whitehat techniques or just for it’s truly honest behavior.
  6. Try not to spam the AdSense team with repeated e-mails sent to multiple e-mail addresses, telling them the exact same thing. If you sent it once (maximum twice) that’s all you can do. ALL the e-mails are read.
  7. Do not reply to the first horrifying e-mail telling you your AdSense account has been disabled.

    Why not reply ? Because the first Google AdSense Account Disabled e-mail comes from the e-mail address adsense-adclicks@google.com (which is NOT ticket based) , and because the e-mails that come to you after you use the appeal form, come from adsense-adclicks-appeal@google.com (which IS ticket based).

    Use the AdSense invalid clicks appeal form. After you will get your first reply from the message sent to the appeal form, from a Google representative (they have a ticket system), you can then reply to that.

  8. Try to offer them server logs, tracking and analytics logs, and any other useful information, that they can use to determine if your account got click-bombed or not.
  9. Whenever you write e-mails, please try to sign your full name, telephone, mobile telephone, e-mail address, website, and so on, in the e-mail (please see the template below).
  10. In the AdSense appeal form, at the e-mail part (Email Address:), always write your AdSense publisher e-mail, and not another e-mail.
  11. One again, write in a polite manner, always. Polite + corporate + helpful + not spamming = success.


What is SEO?

Search Engine Optimization, or SEO, is the process of increasing website visibility via a search engine’s natural or organic results. The more frequently a site appears in a search results list, the more visitors that frequent the webpage. SEO targets various search genres, such as news, industry-specific, and image searches.


Sugar CRM (41)

How do I change the default theme?

To change the default theme, follow these steps. In this example, we will be changing the default theme to Retro:

1) Open your config.php file, located in the main Sugar directory
2) Locate this line:
      'default_theme' => 'Sugar',
3) Change the line to:
      'default_theme' => 'Retro',
4) Save the file

Note: This setting will affect all users.


How do I change the company logo displayed on the top-left of the screen?

Replace the company_logo.png file, found in the include/images/ directory, and in each theme's images/ directory. Each theme has its own directory in themes/, such as themes/Sugar/.

*company_logo.png is a 212×40 transparent image.


After I install Sugar and login as an administrator user, I see a warning message, Warning: To safeguard your data, the “install” directory must be set to unreadable. How do I get rid of the warning?

There are a number of ways to eliminate the warning message, including:

  • Move the install directory to backup location on your disk

  • Rename the install directory to something other than "install"

  • Change the file permissions on the install directory so that your web server user does not have read privileges for the install directory

  • Delete the install directory


Error 1251: Client does not support authentication protocol requested by server

Database admin user name and/or password is invalid (Error 1251: Client does not support authentication protocol requested by server; consider upgrading MySQL client).
MySQL 4.1 introduced a new password hashing algorithm that older versions of Apache (1.x) and PHP (3.x and 4.x) don't support. For more information about the new password hashing algorithm in MySQL, see http://dev.mysql.com/doc/mysql/en/old-client.html.

There are multiple ways to workaround the error that you're seeing, including upgrading pieces of the architecture, or modifying MySQL to utilize the old password hashing algorithm.

One quick workaround is to issue the following MySQL query:
SET PASSWORD FOR 'username'@'localhost' = OLD_PASSWORD('new_password_here');


“Maximum execution time” error when populating demo data

In the file SUGAR_HOME\install\populateSeedData.php, there are lines that read:

Set the max time to one minute. ini_set("max_execution_time", "60");

Modify the value of 60 to a larger amount. The value is in seconds, so a new value of 300 equates to 5 minutes, 600 equates to 10 minutes, and 3600 equates to 60 minutes.


Does SugarCRM offer an API?

Yes, SugarCRM has an API available for use.


Security­ layers­ for ­user­ authentication­ in­ sugar?

In order to address security issues that can arise with user authentication, Sugar offers multiple layers of security. These are listed below:

  1. A sophisticated password enforcement mechanism that allows administrators to set security configurations for password strength, password aging, system generated passwords, and reCAPTCHA password reset.
  2. Automatic termination of the user session (forced logout) if the IP address changes in the course of the session. This prevents hijacking of the user session.
  3. Automatic termination of the user session (forced logout) if a new user session is started from a different web browser. This prevents multiple concurrent user sessions.
  4. The ability to run Tracker reports, as a Sugar administrator, to track all IP addresses used by users.
  5. The ability to use LDAP or Active Directory for centralized management of passwords across multiple systems.

With the release of version 6.1, Sugar also provides SAML support for single sign-on as another option for centralized management of passwords across multiple systems.


Why did SugarCRM change from the SPL to GPL v3?

SugarCRM believes the GPL v3 will become the standard for all open source licenses, and wanted to get a head start on adopting that standard.


After I install Sugar and login as an administrator user, I see a warning message, Warning: The config.php file needs to be made unwritable for security purposes. How do I get rid of the warning?

On Linux/UNIX systems, navigate to your Sugar installation directory. You can see the current file permissions of the config.php file with this command:

# ls -al config.php 
-rw-r--r--  1 nobody  nobody  2485 18 Apr 18:06 config.php

To change the file to unwritable, use this command:

# chmod 444 config.php

Then confirm the file permissions have changed by using the first command again:

# ls -al config.php 
-r--r--r--  1 nobody  nobody  2485 18 Apr 18:06 config.php

The warning message within Sugar should no longer be present.


What is the GPL v3?

The GNU General Public License v3 (GPL) is the latest iteration of the most widely used free and open source software (FOSS) license in the world. The GPL was created and sponsored by the Free Software Foundation (FSF). Read the full license here. http://www.gnu.org/licenses/gpl.html


Vtiger (1)

What­ is ­vtiger ­crm­ licensing­ policy?

Vtiger CRM software is built over the following open source software:

  • Apache web server software, under the Apache License

  • MySQL database software, used under the GPL

  • PHP software, under the PHP License, version 3.0

  • SugarCRM software used under the SugarCRM Public License (SPL 1.1.2) (SPL – a copy of Version 1.1.2 is found here)

  • gdwin32 (graphic library) from http://www.boutell.com/gd/

  • PHPMailer software used under the LGPL

  • ADOdb software used under the BSD

  • phpSysinfo software used the GPL

  • Vtiger's modifications to the SugarCRM code are under vtiger Public License 1.1 based on Mozilla Public License (MPL). Additional components written by vtiger, not coming under the purview of the SPL, are provided under MPL.


Web Design and Applications (87)

How to Test Web Page Designs

How to Test

Take your testing seriously enough to make some simple test cases (a software design concept). You should also document them at least to some moderate degree. For example, you could list your expected results, save screenshots for every “browser and test subject” pair, and add a note stating what is problematic and what needs to be fixed. You should also indicate the date of the test and maybe the revision id of the version control system your tested design is residing on. By the way, I am strongly for using a version control system. It could be SVN, Git, or something else, but the little extra effort it might take to use it will save you tons of problems if you accidentally delete something, overwrite the wrong code, or when (not if) your work machine breaks down irreparably.

If your test concludes that something needs to be fixed, once you have made the modifications, you should perform a second test, exclusively for the parts which are affected by your changes. Remember to note the reason for the modification along with your documentation, and possibly also in the code. You should repeat this step until, hopefully, your design looks sufficiently well in all of your tested browsers, and no more changes are needed.

Lastly, you should also test for cases when a certain feature in your design, like Adobe Flash or JavaScript, is not available or not switched on in the viewer’s browser. This is another place to use the principles of graceful degradation and progressive enhancement.

But what if due to various factors you end up repeatedly making changes to fix a problem in one browser, just to find that your fixes cause another problem in the same browser or in a different one?

Problems While Testing

Sometimes a testing session gets stuck, or starts to go in circles. This could be due to the complexity of the design, the strictness of the requirements, the variety of browsers chosen to test against or a combination of all these. If the problematic browser is in the IE family, you could use conditional comments to load a custom style-sheet for the troublemaker. Otherwise, if your server software lets you sniff for different browsers and serve separate styles based on that, this could aid in solving your problem. You should also research the issue—someone may have already come up with a solution, or there may be a tool out there for the job. In some cases, you might need to use a different technology—like Adobe Flash or a JavaScript library, when something is not achievable across browsers. You may just use it as a fallback or decide to switch to it entirely.

If you cannot fix the problem with the above methods, you should make a compromise. In order to remedy it, you could either choose to revisit the design, use a different approach if possible, ease the requirements, or maybe as a last resort, pick out an unfortunate browser to take the fall. Of course, this is something the customer must agree to as well. If it is the case, there is no shame in admitting that something is not possible in the current circumstances.

Testing Additional Changes

The key is to estimate what the changes will affect and to concentrate your testing on these parts. This estimation should draw on your knowledge of HTML and CSS and on the previous history of changes you had with this project. If you know that a change is not supported well in a certain browser, or you know that it will appear differently, test it. If it involves a new technology, also test it. If it is in an area of the design which took a large amount of corrections in order to get it, then test it as well.

In general, the more structured and organized you are with your testing the less time you will waste hunting down issues during the initial implementation and further changes and maintenance. A real test case procedure might appear too tedious, but it is time well spent, as it increases the quality of your work. If you follow through with it properly, you will have a design that looks good across all your target browsers and to all your target audience, while future alterations will be easier to perform.


The Elements of Design

The elements of design are the building blocks of design. These elements are what make up every page you build. And understanding the basic elements you'll be able to put together more powerful Web pages.

There are five basic elements of every design:

Lines and Linework

Lines include borders and rules. They can be horizontal or vertical and help delineate the spaces around elements on Web pages. Linework increases the readability of the design.


Shapes make up any enclosed contour in the design. Shapes on most Web pages are square or rectangular. But they don't have to be. You can use images to generate other shapes within your designs.


Texture gives a design a feeling of surface. Texture on Web pages is all visual, but you can use natural textures or artificial to get the effect in your designs.


Color is the one design element that most Web designers are acutely aware of. But remember that color is not a required element of any design. In fact, a good plan in design is to create the design without color first, then add as little color as you can to enhance the design.


Direction gives your Web designs motion. In most designs there is a sense of movement in a direction across the design. Good designs lead the eye through the design in a deliberate fashion so that the viewer sees what the designer wants.


What is Unity in Design?

Unity in design is also called proximity. Unity provides cohesiveness to your designs. It is what pulls the elements together. Elements that are positioned close to one another are related while elements that are farther apart are less related.

Unity looks at how close or far apart various elements on the page are to one another. The closer two elements are, the stronger the relationship is between the two elements.
Using the design principle of unity, you can assign your content into logical groups that make it easier for your readers to navigate through your designs.


What technologies have been developed to fit mobile devices?

Over the past years, W3C has developed a number of Web technologies that explicitly take into account the specificities of mobile devices:

  • CSS Mobile, a profile of the cascading style sheet language that matches the need of mobile Web authors
  • SVG Tiny, a profile of the Web’s scalable vector graphics format well-suited to the capabilities of mobile devices
  • XHTML For Mobile, which defines a subset of XHTML for mobile

The latest generation of mobile browsers are capable of using more advanced Web technologies, including features from HTML5, CSS 2.1 and 3, a number of rich JavaScript APIs, opening the way for Web-based mobile applications (including widgets).


The Principles of Design

The basic principles of design are true for Web design as well as other design. They show you how to put together design elements in an effective manner. Design is more than just slapping HTML tags up onto a page, and using these principles will help you build more pleasing and useful designs.


Balance is the distribution of heavy and light elements on the page. Larger, darker elements appear heavier in the design than smaller, lighter elements. The principle of balance shows you how to lay out your pages so that they work.


When most people think of contrast, they typically think of colors or black and white. But there is more to contrast than color. You can have contrasting shapes (square vs. circle), or contrasting sizes (large vs. small), or contrasting textures (smooth vs. rough).


Emphasis is what the eye is drawn to in a design. It's tempting to give everything equal emphasis or try to emphasize everything in a design, but this ends up making the design bland and flat. Instead, as a designer you should determine the hierarchy of the page and then apply the emphasis to the elements based on that hierarchy.


Rhythm is also called repetition. Rhythm brings an internal consistency to your Web designs. Patterns are easy for humans to comprehend, and repetition provides patterns that make your site easier to comprehend.


Unity is also called proximity. It is the principle of keeping like elements together and diverse elements further apart. Unity pulls elements together.


What is MathML used for?

Conceptually, MathML has two parts: presentation and content. They form a single language and it is easy to mix them, but they focus on different goals: the presentation part expresses the two-dimensional look of a formula and is most suitable for publications, such as articles and books; the content part focuses on the semantics and is most suitable as the interchange format between applications for engineering, statistics, etc.

MathML “presentation” markup is typically inserted in XML-based document formats, including XHTML (and soon HTML) mixed with the document's text. MathML “content” markup is more often used on its own.


What Parts of a Website Can Be Designed?

The User Interface
When you design a user interface you are creating a structure for how the website will be perceived intellectually. It includes things like the theme or metaphor of the site – how readers will know what to click and what path to take through the site. It also includes information architecture to classify and structure the site.

The Visual Elements
When you design the visual elements of a website, you are building the look and feel of the site. This includes the graphics, color, styles, and layout. Things like the elements of design and the principles of design.

The Site Structure
When you design the site structure, you are designing how the site will be built. This is the HTML, CSS, JavaScript, and any programming you do for a website. Most of this type of design is informed by the decisions made for the user interface and the visual elements, but it’s just as important a design step as the other two.


Use of Emphasis in Design

One of the biggest mistakes designers can make is trying to make everything in the design stand out. When everything has equal emphasis at best it can make the piece appear busy, and at worst the design will be boring and unappealing.

Instead, focus on creating a visual hierarchy in your designs. If you've worked to create a semantic flow to your HTML markup, that will be easier. Because your Web page will already have a hierarchy, all your design needs to do is put the emphasis on the correct elements – such as the H1 element for the most emphasis and so on.


What is a Vocabulary?

On the Semantic Web, vocabularies define the concepts and relationships (also referred to as “terms”) used to describe and represent an area of concern. Vocabularies are used to classify the terms that can be used in a particular application, characterize possible relationships, and define possible constraints on using those terms. In practice, vocabularies can be very complex (with several thousands of terms) or very simple (describing one or two concepts only).

There is no clear division between what is referred to as “vocabularies” and “ontologies”. The trend is to use the word “ontology” for more complex, and possibly quite formal collection of terms, whereas “vocabulary” is used when such strict formalism is not necessarily used or only in a very loose sense. Vocabularies are the basic building blocks for inference techniques on the Semantic Web.


How does the element relate to the Page Goals?

Knowing your goals and the goals for the page are key to placement. That's why ads are found in similar places on Web pages. If the goal is to get people to click on them or notice them, then placing them in locations where historically people look and click helsp them to meet their goals.


Wordpress (145)

How do I change the “Permanent Link to” in my Title link?

The title of your links includes text that explains what the link is to, in concordance with web accessibility standards. By default, your title may look like this example, which uses the title attribute with the words "Permanent Link to" and the template tag that displays the title of the post.

<a href="<?php the_permalink() ?>" rel="bookmark" 
title="Permanent Link to <?php the_title(); ?>">
<?php the_title(); ?></a>

To change the "Permanent Link to" text, simply delete it and replace it with your own words:

<a href="<?php the_permalink() ?>" rel="bookmark" 
title="Post about <?php the_title(); ?>">
<?php the_title(); ?></a>

Or remove it completely, leaving only the title tag.

<a href="<?php the_permalink() ?>" rel="bookmark" 
title="<?php the_title(); ?>">
<?php the_title(); ?></a>


How Many Products Can WooCommerce Handle?

Can WooCommerce Handle Thousands of Products? Yes, of course! This really is dependent on both WooCommerce and your web host. WooCommerce by it’s nature needs a little more memory than a bare bones WordPress install, this isn’t usually an issue on any decent host though. We have heavily optimized WooCommerce already, and continue to do so as we make it better and better. WooCommerce can handle a big site with lots of orders, and we prove so using it on our own site.


Can I embed a contact form into my template file?

Yes, but you cannot insert a contact form shortcode into your template file directly. You will need to pass the code into do_shortcode() function and display its output like this:
<?php echo do_shortcode( '[contact-form-7 404 "Not Found"]' ); ?>


How do you get cruft free URIs for search results?

To return clean URIs for search results in WordPress from the search form (www.example.com/search/searchterms instead of www.example.com/?s=searchterms )

First create a file called search.php which contains:

<?php header('Location: http://www.example.com/search/' . $_GET['s']); ?>

Put that file in the root of your WordPress install and alter the action for the search form to this:

action="<?php bloginfo('url'); ?>/search.php"


How do I stop my Flash and HTML tags from being stripped in my Posts?

Disable the WYSIWYG editor or click the HTML icon and enter code in the popup box.


I see a response message “Your message was sent successfully” with green border, but I never receive a mail for that.

Showing the green border message means that the PHP function for sending the mail has certainly completed successfully. So if you can’t receive the mail, it’s highly possible that the mail has been kidnapped or killed after that.

If you can check the log of your mail server, it could give you some clues. Spam filter often causes this kind of problem.


How can I change URL directly in the database?

If you know how to access phpMyAdmin on your host, then you can edit these values directly to get you up and running again.

  1. Backup your database and save the copy off-site.

  2. Login to phpMyAdmin.

  3. Click the link to your Databases.

  4. A list of your databases will appear. Choose the one that is your WordPress database.

  5. All the tables in your database will appear on the screen.

  6. From the list, look for wp_options. Note: The table prefix of wp_ may be different if you changed it when installing.

  7. Click on the small icon indicated as Browse.

  8. A screen will open with a list of the fields within the wp_options table.

  9. Under the field option_name, scroll down and look for siteurl.

  10. Click the Edit Field icon which usually is found at the far left at the beginning of the row.

  11. The Edit Field window will appear.

  12. In the input box for option_value, carefully change the URL information to the new address.

  13. Verify this is correct and click Go to save the information.

  14. You should be returned to your wp_options table.

  15. Look for the home field in the table and click Edit Field. Note: There are several pages of tables inside wp_options. Look for the> symbol to page through them.

  16. In the input box for option_value, carefully change the URL information to the new address.

  17. Verify this is correct and click Go to save the information.


How Do I Update My Theme?

First note, in every theme package we include a changelog.txt which includes all the changes for each version. This changelog is also available in your downloads page and under each theme documentation. It’s worth reading to see if the changes made are worth an update for you and your site. Of course we always recommend to stay as updated as possible. If you haven’t made any modifications to your theme files, then you can simply overwrite your existing theme files. If you have made modifications to your theme, you will need to study the changelog to see which files need updating. You can also compare your old modified file against the updated file with any good HTML Editor or use an online tool. We’d suggest using child themes in any future theme modifications. This will save you the headache of comparing files and worrying about overwriting your modifications.


What is a “security” issue?

A security issue (or security vulnerability) is a type of bug that affects the security of WordPress installations.

If you've found a bug in the WordPress core code that you have determined can be used to gain some level of access to a site running WordPress that you should not have, then that is a security issue.

Before you report a security issue, please bear in mind the following:

  1. Your blog being "hacked" is not a security issue. A security issue will involve knowing how the attacker got in and hacked your site. If you have details on the attack vector, then email us. If not, report the issue on the Support Forums.
  2. Forgetting your password or losing access to your site is not a security issue. You should try resetting your password or contacting your site administrator or host for help.
  3. Generally, security issues are complex problems. If you want to report a security issue, then that's great! You're in the right place. However, be sure that what you're reporting is actually a security issue so you don't waste your own time or that of the experts you report it to.
  4. The security mailing addresses are NOT for support. Don't send general problems to them. Your message will not be replied to. Use the Support Forums instead.


Why did I lose custom changes to the WordPress Default Theme during the last automatic upgrade?

A core upgrade copies all the new files from the distribution over the old ones, so if you changed existing files in the WordPress Default Theme (e.g. wp-content/themes/default/style.css), those changes got overwritten with the new version of that file.

Please note, a core upgrade goes through a list of "old files", as defined in wp-admin/includes/update-core.php, and deletes those files. Any files not on the list, and not in the distribution, are preserved.

Remember, that before upgrades, whether automatic or manual, both the WordPress Files and database should be backed-up as explained in WordPress Backups.

This does mean that you should not modify the default theme, but your changes will not be lost if you create a child theme in a new folder importing the default theme, there are many good tutorials, start by reading the Codex.


Yii (36)

Why Form / ActiveForm is not doing ajax validation ?

In most of the cases this code snippet will help to generate a form via gii:

<?php $form=$this->beginWidget('CActiveForm', array(
    'clientOptions' => array(
)); ?>

If you create your own form, and trying to do this… better create CRUD with gii, and see how it is done there!

You need to echo the validation results if this is an Ajax request! By using:

echo CActiveForm::validate($model);


How does Yii compare with other frameworks?

Like most PHP frameworks, Yii is an MVC framework.

Yii excels other PHP frameworks at being efficient, feature-rich and clearly-documented. Yii is carefully designed from the ground up to be fit for serious Web application development. It is neither a byproduct of some project nor a conglomerate of third-party work. It is the result of the authors' rich experience with Web application development and their investigation of the most popular Web programming frameworks and applications.


How to the get current page in CListView from partial rendering view?

There are special variables available to the partial rendering view in CListView. These are:

  • $data – the current object or hash being rendered
  • $index – the zero-based index of the item being rendered (0, 1, 2, …)
  • $this – the owner of the widget, usually the calling controller
  • $widget – the CListView widget itself

From partial rendering view, you can access currentPage, pageCount, count of data in the current page. Here's how you can get it:

$pageCount = $widget->dataProvider->pagination->pageCount;
$currentPage = $widget->dataProvider->pagination->currentPage + 1;
$dataCount = count($widget->dataProvider->data);


I got an error: Call to a member function getAttributes() on a non-object; and I don’t unserstand why.

First of all you should always read the error… The problem is actually indeed that you trying to use a function on some variable that is not an object, and because it is not an object – it doesn't have the method you want to use!

Use var_dump or echo CVarDumper::dump($param, 10, true); ** or **print_r , to understand why it is not an object!

For example if you tried to get a user via active record it can be null if it does not exist, you need to check it.


Why am I having problems with password repeat or with other fields not in the model?

Property “User.passwordVerify” is not defined.

In CActiveRecord, if you want to have a property that isn’t connected to a column of the database table, you can do so by declaring it as a public variable.

class User extends CActiveRecord
public $password_repeat;


Why is $model->save() not saving the record/object/model?

Because save method performs validation CActiveRecord::save

As you can see in the source code:

public function save($runValidation=true,$attributes=null)
    if(!$runValidation || $this->validate($attributes))
        return $this->getIsNewRecord() ? $this->insert($attributes) : $this->update($attributes);
        return false;

If you don't want it to validate just do $method->save(false);

Other possible reason is that "beforeSave" method (if overridden) doesn't return "true".


How to change site/page?id=123 to site/page/id

For this you should use urlManager

It is actually very-well documented… URL Manager

The direct answer to the question is – using that rule:

    'site/action/<id:\d+>' => 'site/actionm '

In your example you can set How to change site/page?id=123 to site/page/id$id like this: actionPage($id)

Or you can get it via Yii::app()->request->getQuery('id');


How can I make the extension work with CTabView?

Because of how Yii includes the scripts with registerScript, all the variables used for this extension are inside an anonymous javascript function. As such, they are out of scope for the rest of the document.

Because of this, we have to use Yii to insert the code we want to use into this same anonymous function. We can do this by using the same scripts that the extension uses. Replace '#tab2' with the selector for the tab in which the map is located.

$click_script = <<<SCRIPT
        google.maps.event.trigger(gmap, "resize");
Yii::app()->getClientScript()->registerScript("resizemap_js", click_script, CClientScript::POS_END);

This adds an event to the tab to force google map to invalidate and redraw itself as soon as the tag is activated.


How to enable #Gzip compression in Yii?

Enabling Gzip compression in delivering your webpage will improve your sites performance. If you used Yii PHP Framework in developing your website, you only need two lines of code to enable Gzip compression.

In your main.php configuration file, just add the following code:

//GZIP compress   
'onBeginRequest'=>create_function('$event', 'return ob_start("ob_gzhandler");'),
'onEndRequest'=>create_function('$event', 'return ob_end_flush();'),

Now, if you are using Google's PageSpeed Insight to get optimization suggestion for your website, it might still be saying that your page needs to enable compression. As per Google's PageSpeed Insights FAQ:

PageSpeed Insights' results are based on headers that were actually returned to your client, so if you are running the analysis on a client machine that is using such anti-virus software, or that sits behind an intermediate proxy server (many proxies are transparent, and you may not even be aware of a proxy intervening between your client and web server), they may be the cause of this issue.

You can use PageSpeed Insights Chrome extension to verify as suggested from PageSpeed Insights FAQ.


Yii::app()->CreateUrl generates & instead of &. How can I fix this?

“I was checking my link trough W3C validator and it give me an error saying:”

& did not start a character reference. (& probably should have been escaped as &amp;.)

Considering that this is what Yii::app()->CreateUrl generated, to fix this you have to change from & to &amp;.
You can use CHtml::link(). This generates a hyperlink tag and encodes & to &amp;.


Zend (57)

Can Z-Ray work in production?

Z-Ray can be used in production using the Secure Mode. This mode enables administrators to allow access to Z-Ray according to IP, URL and time duration by passing a specially created access token in the URL.


What is Zend registry?

It is container for object and values in applications, when you set an object in zend_registry you can access in whole site.


What is Front Controller?

It is used for Front Controller pattern. Zend also uses singleton pattern.
Below are the functions specific to Zend_Controller_Front:

  • ‘routeStartup’: This function is called before Zend_Controller_Front calls on the router to evaluate the request.
  • ‘routeShutdown’: This function is called after the router finishes routing the request.
  • ‘dispatchLoopStartup’: This is called before Zend_Controller_Front enters its dispatch loop.
  • ‘preDispatch’: called before an action is dispatched by the dispatcher.
  • ‘postDispatch’: is called after an action is dispatched by the dispatcher.


What do you know about zend layout?

It works as a site template and has the following features:

  • Automatic selection and rendering layout;
  • Provides separate scope for calling element i.e parital, render, partialLoop.


Do I need to change my application to use Zend Server?

No. Zend Server is built using regular PHP from php.net and everything that runs on php.net can run on Zend Server. To start using Zend Server’s features, you can either put your code in the document root of your web browser, or you can use the Zend Server Deployment mechanism, which helps you eliminate key sources of deployment failures and ensure consistency across development, staging and production.


What is the ‘Web server user’?

When the Web server starts up, its processes will run as a particular user. You can use this user to set permissions for the Web server and PHP to write to various system resources.

The following are the default user values. If you have modified your configuration, use the modified values:

  • If Zend Server is running on Microsoft IIS – IUSER
  • If Zend Server is running on Apache – SYSTEM
  • DEB installation – www-data
  • RPM installation – apache
  • Debian, Ubuntu – /var/www
  • Fedora Core, RHEL, CentOS, Oracle Enterprise Linux – /var/www/html
Mac OS X



Can I upgrade to Zend Server 7.0 from a previous version of Zend Server?

Yes. For more details, see the installation and upgrade guide for your operating system:


What is Zend Server?

Zend Server is an integrated application platform for mobile and web applications, which:

  • Provides superior tools to enable developers to create higher quality code faster
  • Provides best-in-class app life-cycle automation capabilities from code to production
  • Provides the best back-end platform for scaling, performance and application management


When do we need to disable layout?

At the time of calling AJAX to fetch we need to disable layout.



What is a document root?

The document root is the file system directory in which files need to be placed in order to be run by the Web server. Files placed in your document root can be accessed by browsing to http://localhost:<port_number>/<file_name> . Files and directories under the document root will generally be available for download (if they are static files such as HTML or images) or for execution (if they are dynamic files such as PHP scripts).


Marius Ion ANGEL HOT SOFT LLC (800) 316-7677