faq.jpg

Android (14)

How can I check if an Activity is already running before starting it?

The general mechanism to start a new activity if its not running— or to bring the activity stack to the front if is already running in the background— is the to use the NEW_TASK_LAUNCH flag in the startActivity() call.

Permalink.

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.

Permalink.

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.

Permalink.

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.

Permalink.

How is the Android software developed?

Each platform version of Android (such as 1.5, 1.6, and so on) has a corresponding branch in the open-source tree. At any given moment, the most recent such branch will be considered the "current stable" branch version. This current stable branch is the one that manufacturers port to their devices. This branch is kept suitable for release at all times.

Simultaneously, there is also a "current experimental" branch, which is where speculative contributions, such as large next-generation features, are developed. Bug fixes and other contributions can be included in the current stable branch from the experimental branch as appropriate.

Permalink.

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.

Permalink.

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.

Permalink.

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.

Permalink.

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.

Permalink.

CakePHP (18)

What is default function and default controller of cakephp which is called automatically?

Default controller is indexController.php and Default function is index.

Permalink.

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.

Permalink.

What are commonly used components of cakephp?

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

Permalink.

What is the name of Cakephp database configuration file name and its location?

Default file name is database.php.default.
Its located in “/app/config/database.php.defaut”

Permalink.

How can you include a javascript menu throughout the site. Give steps.

By adding the javascript files in webroot and call them in default views if needed everywhere or just in the related veiws.

Permalink.

List some database related functions in cakephp.

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

Permalink.

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

Permalink.

How can we use ajax in cakephp?

By calling ajax helper and then using it in controller for rendering.

Permalink.

If you have to validate a registration module for a user, what all can be possible ways , which one is the best?

Can be done on submission in controller, or using javascript/ajax while user is still filling the data. second option is better.

Permalink.

How cakephp URL looks in address bar?

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

Permalink.

Cpanel (87)

Some services (like MySQL) do not start on reboots. Why do I get errors about create/write to file (Errcode: 13) in the /tmp file?

This is most likely due to improper permissions on the real /tmp directory.

If you use the /scripts/securetmp script at boot time, you may not notice the problem because the script sets permissions correctly after it boots.

The most common error that you will see related to this is that the mysqld daemon will not start with errors that resemble the following example:

061113 00:14:46 mysqld started 
/usr/sbin/mysqld: Can't create/write to file '/tmp/ibEkcOgQ' (Errcode: 13) 
061113 0:14:47 InnoDB: Error: unable to create temporary file; errno: 13 
061113 0:14:47 [ERROR] Can't init databases 
061113 0:14:47 [ERROR] Aborting 
061113 0:14:47 [Note] /usr/sbin/mysqld: Shutdown complete 
061113 00:14:47 mysqld ended

To fix this, unmount the  /var/tmp and  /tmp  partitions and set the permissions correctly on the real  /tmp  directory. To do this, perform the following steps:

Run the following commands:

umount /var/tmp
umount /tmp
chmod 1777 /tmp

Edit the  /etc/rc.sysinit  file and add the following line near the other references to the  /tmp  directory:

chmod 1777 /tmp

Then you can reenable the  /scripts/securetmp script.

If you have trouble with other services, confirm that they are enabled with the  chkconfig –add pure-ftpd  command.

If you still receive messages after each reboot from the  chkservd  daemon about services that are not down, perform the following steps:

Disable the service with the  chkconfig command. 
Add the service to the end of  /etc/rc.local  instead, to ensure that other services have time to start up first.

Permalink.

How do I change the skin back to X3 after I changed it to RVSkin?

You will need to contact RVSkin to use the themes that they distribute. If you are a reseller or server owner, you can change the account's theme in WHM's Modify an Account interface (Home >> Accounts >> Modify an Account).

Permalink.

Why do I receive the message “unable to add the user” when I create an account?

Log in to your server as the root user and check the /home/username directory to see if the user has a home directory.

  • Check the contents of the /etc/passwd directory to see if there is an entry for that user.
  • You may need to use your operating system's user deletion tool to delete that user.

Permalink.

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.

Permalink.

I cannot compress or extract .zip files in File Manager

If you cannot compress or extract .zip files in cPanel File Manager interface (Home >> Files >> File manager), then Zip is not installed on your system. Your system administrator must install Zip at the command line with the yum install zip command.

Permalink.

How do I change the maximum number of POP3 connections per IP address?

You can change the value of the  Maximum POP3 Connections Per IP  setting in WHM's Mailserver Configuration interface (Home >> Service Configuration >> Mailserver Configuration).

Permalink.

How do I delete an account?

You can delete an account with WHM's Terminate an Account interface (Home >> Account Functions >> Terminate an Account).

Permalink.

How do I change the 401 error that is caused when I cancel a username/password login window for a protected directory?

To change the error message that a user receives, use cPanel's Error Pages interface (Home >> Advanced >> Error Pages). Choose the domain for which you wish to modify the error pages.

Select any of your error pages to make your changes.

Permalink.

How do I set up personal nameservers in WHM?

To set up a personal nameserver, perform the following steps:

  • Navigate to the Nameservers section of the Basic cPanel & WHM Setup interface (Home >> Server Configuration >> Basic cPanel & WHM Setup)
  • Add your nameservers in the available text boxes. 
  • Click Assign IP Address next to each nameserver to assign it an IP address. 
  • Click Add an A entry for this nameserver to allow each nameserver to resolve through DNS.
  • Click Nameserver Selection under Service Configuration to enable the nameservers.

Permalink.

How can I copy files from one domain directory to another?

You need root user privileges to copy the files with the cp command.

  • For example, copy one directory to another place with the cp -R /home/dave/public_html/photos/; /home/john/public_html/images/; command.

For more information on the cp command, run the man cp command on the command line.

You can also download the files that you wish to copy in cPanel's File Manager interface (Home >> Files >> File Manager). Then, log in to the other domain's account and use the File Manager to upload the files to that account.

Permalink.

CSS (73)

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.

Permalink.

What is The CLASS?

The CLASS is a reference to any element on a page that needs to look a specific way when this reference is used. For example, if you frequently want to highlight a word or two within your text (we'll use red as a highlight color in this instance), you might have a CLASS selector in your style sheet like this:

.hilite { color: red}
and the reference in your HTML might look like this:
...this is some text about something
I want <span class="hilite">in red</span>. And 
some more rambling here...
As you can see, the difference between ID and CLASS selectors in the style sheet is that an ID uses a pound sign (#name) and a CLASS uses a period (.name) . ID references must be unique on a page and used once. CLASS references can be used repeatedly in the same page.

Permalink.

Are Style Sheets case sensitive?

No. Style sheets are case insensitive. Whatever is case insensitive in HTML is also case insensitive in CSS. However, parts that are not under control of CSS like font family names and URLs can be case sensitive – IMAGE.gif and image.gif is not the same file.

Permalink.

What is cascading order?

Cascading order is a sorting system consisting of rules by which declarations are sorted out so that there are not conflicts as to which declaration is to influence the presentation. The sorting begins with rule no 1. If a match is found the search is over. If there is no match under rule no 1 the search continues under rule no 2 and so on.

  1. Find all declarations that apply to a specific selector/property and declare the specified style if the selector matches the element if there isn't any
    Let the element inherit its parent property if there isn't any
    Use initial value

  2. Sort by weight (! important)
    Increased weight take precedence over normal weight

  3. Sort by origin
    Rules with normal weight declared in author's style sheet will override rules with normal weight declared in user's personal style sheets
    Rules with increased weight declared in user's personal style sheet will override rules with normal weight declared in author's style sheet
    Rules with increased weight declared in author's style sheet will override rules with increased weight declared in user's personal style sheets
    Author's and user's rules will override UA's default style sheet.

  4. Sort by selector's specificity
    More specific selector will override less specific one:

    ID-selector (most specific), followed by
    Classified contextual selectors (TABLE P EM.fot)
    Class selectors (EM.fot)
    Contextual selectors – the "lower down" the more weight, (TABLE P EM), (TABLE P EM STRONG) – STRONG has more weight than EM.

  5. Sort by order specified
    If two rules have the same weight, the latter specified overrides ones specified earlier. Style sheets are sorted out as follows:

    The STYLE attribute (inline style) overrides all other styles
    The Style element (embedded style) overrides linked and imported sheets
    The LINK element (external style) overrides imported style
    The @import statement – imported style sheets also cascade with each other in the same order as they are imported

Permalink.

When Should You Change a Class to an ID Attribute?

Classes are used when you think you're going to use that style multiple times in multiple places on the page. For example, you might want to highlight abbreviations on a page. Some pages might have 1 abbreviation, some have 10, and others have none. When you write the abbreviation class, you give yourself the option to have multiple elements using that class on any given page.

The only time I would change a class to an ID is if I needed the ID to act as a specificity marker or an anchor on the page as well.

Permalink.

How can I create a variable-width container without a table?

Unfortunately, this is one situation where browser support isn't consistent. This is an effect of tables themselves, so Web browsers should act this way when you set the display to "table" ie:

<div style="background:#cfc;border:double #c8c 5px;padding:0 1em; display: table;"> 

When rendered, this box is exactly as wide as it needs to be.

But Internet Explorer doesn't render it correctly (Firefox, Safari, and Opera do).

According to the IEBlog "display:table is not part of the IE7 release. We know it is a highly requested feature and it is on our "to do" list."

One thing to remember however, is that this is a fairly rare occurrence that you would want the block to vary with the width of the content. If you have a design that requires that functionality and you can't get around it by setting percentage widths or other functions, then you should use a table. But this is not a good enough reason to refuse to move to CSS for layout.

Permalink.

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.

Permalink.

What is a User Style Sheet?

User style sheets allow you to control how Web pages that you visit look. This is especially useful if you have accessibility issues. But it's also helpful if you just want to avoid seeing annoying things like the <blink> tag or <marquee>.

Permalink.

What are inline, block, parent, children, replaced and floating elements?

Inline
Elements which do not have line breaks. Can occur in block elements or other inline elements, cannot contain block elements.

Inline elements in HTML 3.2; EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, A, IMG, APPLET, FONT, BASEFONT, BR, SCRIPT, MAP, INPUT, SELECT, TEXTAREA.

Inline elements in HTML 4.0; EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, ABBR, ACRONYM, TT, I, B, BIG, SMALL, SUB, SUP, A, IMG, OBJECT, BR, SCRIPT, MAP, Q, SPAN, BDO, INPUT, SELECT, TEXTAREA, LABEL, BUTTON, (INS, DEL).

Inline elements in HTML 4.0 Transitional; EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, ABBR, ACRONYM, TT, I, B, U, S, STRIKE, BIG, SMALL, SUB, SUP, A, IMG, APPLET, OBJECT, FONT, BASEFONT, BR, SCRIPT, MAP, Q, SPAN, BDO, IFRAME, INPUT, SELECT, TEXTAREA, LABEL, BUTTON, (INS, DEL).

Block
Elements which do have line breaks. May occur in other block elements, cannot occur in inline elements, may contain both block and inline elements.

Block elements in HTML 3.2; H1, H2, H3, H4, H5, H6, ADDRESS, P, DL, DT, DD, UL, OL, DIR, MENU, LI, DIV, CENTER, BLOCKQUOTE, PRE, HR, ISINDEX, TABLE, FORM.

Block elements in HTML 4.0; P, H1, H2, H3, H4, H5, H6, UL, OL, PRE, DL, DIV, NOSCRIPT, BLOCKQUOTE, FORM, HR, TABLE, FIELDSET, ADDRESS, (INS, DEL).

Block elements in HTML 4.0 Transitional; P, H1, H2, H3, H4, H5, H6, UL, OL, DIR, MENU, PRE, DL, DIV, CENTER, NOSCRIPT, NOFRAMES, BLOCKQUOTE, FORM, ISINDEX, HR, TABLE, FIELDSET, ADDRESS, (INS, DEL).

Parents and children
Elements which either contain (parents) or are in the content of (children) other elements, e.g. <P>text<STRONG>text</STRONG>text</P>. P is a parent of STRONG. STRONG is a child of P. If not specified otherwise, children will inherit parent's properties. NOTE: not all properties are inherited. For more information, see INHERITANCE.
Replaced
Elements which content is replaced. For example content of the IMG element is replaced with an image, content of the INPUT element is replace with a field.
Floating
Elements which follow the flow of a parent – inline elements.

Permalink.

What is class?

Class is a group of 1) instances of the same element to which an unique style can be attached or 2) instances of different elements to which the same style can be attached.

1) The rule P {color: red} will display red text in all paragraphs. By classifying the selector P different style can be attached to each class allowing the display of some paragraphs in one style and some other paragraphs in another style.

2) A class can also be specified without associating a specific element to it and then attached to any element which is to be styled in accordance with it's declaration. All elements to which a specific class is attached will have the same style.

To classify an element add a period to the selector followed by an unique name. The name can contain characters a-z, A-Z, digits 0-9, period, hyphen, escaped characters, Unicode characters 161-255, as well as any Unicode character as a numeric code, however, they cannot start with a dash or a digit. (Note: in HTML the value of the CLASS attribute can contain more characters). (Note: text between /* and */ are comments).

CSS
P.name1 {color: red} /* one class of P selector */
P.name2 {color: blue} /* another class of P selector */
.name3 {color: green} /* can be attached to any element */
HTML
<P class=name1>This paragraph will be red</P>
<P class=name2>This paragraph will be blue</P>
<P class=name3>This paragraph will be green</P>
<LI class=name3>This list item will be green</LI> 

It is a good practice to name classes according to their function than their appearance; e.g. P.fotnote and not P.green. In CSS1 only one class can be attached to a selector. CSS2 allows attaching more classes, e.g.:

P.name1.name2.name3 {declaration} <P class="name1 name2 name2">This paragraph has three classes attached</P>

Permalink.

HTML5 (14)

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.

Permalink.

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.

Permalink.

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

Permalink.

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.

Permalink.

What is an HTML5 application?

There are several new capabilities in HTML5 which directly address the need for creating interactive applications. Of course, HTML has had interactive capabilities since its early days with text-based input forms and HMTL5 expands these with new input types. New capabilities include page and session-based data storage in the user’s browser, Web sockets for inter-application communications, and a drawing environment, the canvas element, for creating and manipulating image data.

Permalink.

What about Internet Explorer?

Internet Explorer is late to the HTML5 party. There’s no HTML5 support in IE8 or previous versions. However, adding a JavaScript library such as Google’s HTML5 shim or Modernizer enables IE 6, 7 & 8 to recognize the new semantic level elements so they can be styled with CSS. HTML5 support is good in the beta version of IE9 which is available for Windows Vista and Seven users. Unfortunately, the Windows 7 mobile browser is built largely on the IE7 code base.

Permalink.

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.

Permalink.

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.

Permalink.

How does HTML5 affect my existing HTML4 website?

It doesn’t. The HTML5 specifications require browser makers to support valid HTML4 web pages. You should update your HTML editing tools when new versions are available. If your web pages require a diet of strict xhtml, you should validate any third-party HTML5 code to one of the xhtml standards before embedding that code into your own pages.

Permalink.

Have any HTML elements changed their meaning or how they are used?

Yes, but not many. The small element, which in HTML4 has no semantic value—it just means make the text smaller—is used in HTML5 to markup disclaimers, legal notices and the like—the small print. The anchor element, which creates hyperlinks, can now enclose any other elements excluding other links and buttons. In HTML4, the anchor was strictly an inline element.

Permalink.

Java (225)

How can I write primitive data-types to disk? In C/C++, the printf statement could write integers, floats, as well as other types.

Writing primitive data-types can be easily done, using the DataOutputStream class. DataOutputStream provides simple methods to write primitive data-types out to any output stream, whether it be the user console, a network connection, or a file.

Data Type

Method

boolean writeBoolean(boolean v);
byte writeByte(int v);
writeBytes(String s);
char, string writeChar(int v);
writeChars(String s);
double writeDouble(double v);
float writeFloat(float v);
int writeInt(int v);
long writeLong(long v);
short writeShort(int v);
string writeUTF(String str);

Java also provides a corresponding DataInputStream, which will allow you to read data back. This means you can write a data structure out to a disk or network connection, and read it back at a later date.

Permalink.

What’s an interface?

An interface is an idea taken from Objective C. It describes the public methods that a class implements and their calling conventions without saying anything about how those methods are implemented. It is the responsibility of each class that implements an interface to provide code to handle the cases where the methods of the interface are called.

For example suppose you're writing an inventory database. The inventory may include many different items of many different types and classes. However each item in the warehouse needs to be able to tell you its price. Normally you would implement this by having each class extend a common superclass. However that's not always convenient. Instead you can declare an interface called Price with a price() method like this:

 

public interface Price {

  public float price();

}

Any class which implements the Price interface must contain a method with the signature public float price(). The code of the price() method is included separately in each separate class which implements Price, not in the Price interface itself.

Different classes in your warehouse can each implement the Price interface like this:

 

public class Monopoly extends BoardGame implements Price {

  // other methods

  public float price() {
    return 14.95;
  }

}

When other code is passed an object, it can test whether the object implements Price with the instanceof operator. For example,

if (o instanceof Price) System.out.println("Subtotal is " + o.price());

In fact, interfaces can be used to tag objects. The java.rmi.Remote interface declares no methods. Its sole purpose is to indicate that an object is a remote object. In general, sub-interfaces of java.rmi.Remote will declare remote methods, however. For example,

 

public interface Hello extends java.rmi.Remote {

  public String sayHello();

}
public class HelloImpl extends UnicastRemoteServer implements Hello {

  public String sayHello() {
    return "Hello";
  }

}

Permalink.

How do I do automatic timed popups with PopUp Maker?

Step One:

Make up your popup code per usual with PopUp Maker.

Important: Remember to use a different Function Name and PopUp Name for each one if you are using more than one popup in a given page.

Insert the script(s) in the head of the page, just as you usually do.

We'll show an outline of how this all goes together at the end — it's fairly easy to do.

Step Two:

For each popup — after the popup scripts you inserted in Step One — then you will insert a call for a timer, like this:

<script>
setTimeout("doPopUp1()", 15000);
</script>

Call the popup function as shown in red.  The 15000 shown in this sample is how long to wait before launching the popup.  The figure is in milliseconds (1000 =  1 second), so, for example, the sample above is set to wait 15 seconds before launching the popup.

General Outline:

This shows how it will all go together in the <head> section of your page.  Here, we show how to do two such poppers with different start times.

<head>
<script>
// PopUp Maker 5.0 by CodeBrain.com
// PopUp Window Script
// Place this script in the <head> of your page.

function doPopUp1(){ doPopUp1Window = window.open(... etc. ...); }

</script> <script> // PopUp Maker 5.0 by CodeBrain.com // PopUp Window Script // Place this script in the <head> of your page.

function doPopUp2(){ doPopUp2Window = window.open(... etc. ...); }

</script> <script> setTimeout("doPopUp1()", 15000); </script> <script> setTimeout("doPopUp2()", 30000); </script> </head>

Thus, we have two different popups — doPopUp1( ) and doPopUp2( ) — which will fire respectively at 15000 milliseconds (15 seconds) and 30000 milliseconds (30 seconds).

To do more than two — just follow the overall pattern.

This was written to try to make it as clear as possible to newcomers to the art.  More experienced coders can clean up the code by removing the // comment lines and all but the very first <script> and very last </script> tags around the code, as they're redundant.

Permalink.

How can I read from, and write to, files in Java?

Stand-alone applications written in Java can access the local file-system, but applets executing under the control of a browser cannot. With this in mind, lets take a look at two simple applications that write a line of text to a file, and read it back.

import java.io.*;

public class MyFirstFileWritingApp
{
	// Main method
	public static void main (String args[])
	{
		// Stream to write file
		FileOutputStream fout;		

		try
		{
		    // Open an output stream
		    fout = new FileOutputStream ("myfile.txt");

		    // Print a line of text
		    new PrintStream(fout).println ("hello world!");

		    // Close our output stream
		    fout.close();		
		}
		// Catches any error conditions
		catch (IOException e)
		{
			System.err.println ("Unable to write to file");
			System.exit(-1);
		}
	}	
}

This simple application creates a FileOutputStream, and writes a line of text to the file. You'll notice that the file writing code is enclosed within a try { …. } catch block. If you're unfamiliar with exception handling in Java, this requires a little explanation.

Certain methods in Java have the potential to throw an error condition, known as an exception. We have to trap these error conditions, so we 'catch' any exceptions that may be thrown.

The task of reading from a file is also just as easy. We create a FileInputStream object, read the text, and display it to the user.

import java.io.*;

public class MyFirstFileReadingApp
{
	// Main method
	public static void main (String args[])
	{
		// Stream to read file
		FileInputStream fin;		

		try
		{
		    // Open an input stream
		    fin = new FileInputStream ("myfile.txt");

		    // Read a line of text
		    System.out.println( new DataInputStream(fin).readLine() );

		    // Close our input stream
		    fin.close();		
		}
		// Catches any error conditions
		catch (IOException e)
		{
			System.err.println ("Unable to read from file");
			System.exit(-1);
		}
	}	
}

Permalink.

How can I use ICMP in Java?

Java does not support ICMP, the Internet Control Message Protocol, at this time; nor does it allow you to send raw IP packets. You must use TCP or UDP. Therefore protocols that rely on ICMP like ping and traceroute cannot yet be implemented in Java.

Permalink.

How do I download Java technology and/or Java 2 SDK software? How do I install it?

You can get our releases either with a World Wide Web (WWW) browser or by anonymous ftp. For details, including installation instructions, visit:

The Java 2 Platform web site
Choose the software you want, and go from there.

Permalink.

How can I redirect a page to a different address, even if the user has JavaScript turned off?

Use suspenders and a belt — both the Refresh pragma and a JavaScript redirect in the <head> of the page, like this:

<meta http-equiv="Refresh" content="0; url=http://site.com/page.html">

<script> window.location="http://www.mysite.com/mypage.html"; </script>

Make sure to set both url's the same, and be careful of the punctuation in the Refresh pragma.

The other way to do this is server-side via the .htaccess file in your web root.  Do this with caution, and always check your server documentation or with your server administrator to be certain it's allowed on your host — though the technique is very much standard on UNIX/LINUX boxes.

Add a Redirect request to your .htaccess file in the following general form:

Redirect whatpage.html http://www.mysite.com/otherpage.html

In this example, whatpage.html>/span> is redirected to http://www.mysite.com/otherpage.html.

Permalink.

What is the difference between being a Java EE licensee and being Java EE compatible?

A Java EE licensee has signed a commercial distribution license for Java EE. That means the licensee has the compatibility tests and has made a commitment to compatibility. It does not mean the licensee's products are necessarily compatible yet. Look for the Java Compatible, Enterprise Edition brand which signifies that the specific branded product has passed the Compatibility Test Suite (CTS) and is compatible.

Permalink.

Can the Java software team keep me informed of latest developments?

We no longer keep a list of people to inform; when we started that, we never expected that so many people would be writing to us every day! If you'd like to keep informed, the best way is to visit our Web site

Java Software Home Page

periodically and participate in the Java technology-related newsgroups. Note in particular that our "What's New" page:

What's New at Java Software

provides an overview of the most recent developments, press releases, and so on concerning Java technology.

Permalink.

Other Netscape Problems

As of version 3.0, Netscape has many problems handling Java applets.In no particular order they are:

  • Netscape can only run applets that are compiled with the Java 1.0 beta compilers through the Java 1.0.2 compiler. It cannot handle .class files compiled for the various alpha versions of Java or Java 1.1. As a general rule, make sure you're using Sun's javac 1.0.2 to compile all applets you distribute. (Microsoft and Natural Intelligence's compilers have non-trivial bugs of their own.)
  • Not all versions of Netscape support Java. Notably the Windows 3.1 version does not, though a beta version that does has recently become available.
  • Netscape will not import any user-defined packages from the local CLASSPATH.
  • Netscape does not flush classes when you reload a page. If you need to reload a changed applet, for instance if you made a change to the applet source code and regenerated the .class file, there are a number of things you can try. On some platforms holding down the shift key and pressing the reload button will get Netscape to reload the .class file. You can also try manually clearing both the memory and disk caches, in order to reload an applet. Turning Java off and then on again in the Options/Security Preferences menu may also do the trick. If none of these work, you'll simply have to quit and relaunch Netscape.
  • Netscape calls your init() method many times more than the applet viewer will. In particular Netscape calls init() anytime your reload, resize or otherwise restart your applet. I am not sure whether or not this is a bug, but it does indicate that you should try to keep your init() methods as small and quick as possible. Similarly it may call destroy() when the applet viewer would only call stop().
  • Netscape won't run any applet that calls Object.clone().
  • Netscape can't print applets.

Permalink.

Joomla (200)

How can I view a live site while developing, but hide it from others?

Introduction

The method described below should be used for relatively minor modifications, such as adjusting menus or quickly reorganizing content sections. More complex tasks, such as installing new components or adjusting complex configuration settings should be performed and tested on a development server first. Not only does this keep your public site up and running, but it also lets you test at your leisure, thus reducing errors. One way to do it is to create a sub-domain (i. e., dev.yourdomain.com) and install Joomla! there just as it is installed on your public site.

Directions

1. Login to the administrator section, and choose: Site > Global Configuration.

2. The first option you'll see is is to set the site offline. Choose "Yes" and press the Save button. This will hide prevent display of all site pages, and replace them with the following message:

"This site is down for maintenance. Please check back again soon. message instead."

3. While you are logged into the "back end" administrator system, you can still view the "front end," by choosing Site > Template > Preview. This will display the site as it would appear to users along with a warning at the top that the site is down for maintenance.

Permalink.

How much disk space do you need to install Joomla!?

15 megabytes (mb) of disk space should be enough for a default installation without additional extensions or media (such as image, audio, or video files). The database will be small when starting, and will grow when adding more content.

Permalink.

What is a template?

The Template controls the overall look and layout of your site. It provides the framework that brings together common elements, modules and components as well as providing the cascading style sheet for your site. Both the Front-end (Site) and the Back-end (Administrator) of your site have templates.

When Joomla! is installed several templates are automatically included. You can find many more templates at other websites. Some are available without charge under various licenses, and some are for sale. In addition, there are many designers available who can make custom templates. You can also make your own template.

Templates are managed with the Template Manager, which is located on the site menu on the Back-end of your site.

Permalink.

Why do you get a “Fatal error: Call to undefined function: stripos()” when editing Joomla! 1.5.7 Articles from the frontend when using PHP 4?

"Fatal error: Call to undefined function: stripos() in /libraries/joomla/environment/uri.php on line 675"

Articles are still successfully posted,

Possible resolutions:

  • Add this to the end of /libraries/joomla/utilities/compat/php50x.php
if(!function_exists('stripos')) {
function stripos($haystack, $needle, $offset = 0) {
  return strpos(strtolower($haystack), strtolower($needle), $offset);
 }
}

  • OR – Upgrade to PHP 5. PHP 4 end of life was August 8, 2008. There will not be any more PHP 4 releases, even for security. (Switching PHP versions may cause problems with some 3rd Party Plugins – be sure to test thoroughly).
  • OR – Ignore until Joomla! 1.5.8 since the Article is saved correctly. However, if you are having problems with user logins this will not be appropriate.

Permalink.

Unable to Connect to the Database: Could Not Connect to MySQL

If during or after installation, you received "Unable to connect to the database" error, verify that you have entered your MySQL database details correctly. The installation script will not allow you to continue unless the details are correct. The error might be due to writing a password which doesn't exist: you are not expected to create a password for the database during installation.

If the failure occurs after moving your site to another host, check the following items of your configuration.php file. The normal database settings are the following:

var $dbtype = 'mysql';
var $host = 'localhost';
var $user = 'user_with_database_access';
var $db = 'the_actual_database_name';
var $dbprefix = 'table_prefix_';

Permalink.

How to add a span element to menu entries

To add a span element to your menu items (like there was in Joomla 1.5), you have to override the layout for mod_menu. You can follow the general approach described in How to override the output from the Joomla! core.

You need to override the following layout from mod_menu:

  • defult_url.php
  • default_component.php

After copying the files into your template (see How to override the output from the Joomla! core for details) do the following:

In both these files look for the following statement:

<?php echo $linktype;?>

It should occur three times in both files.

Replace each of these with:

<span><?php echo $linktype;?></span>

And you're done.

Permalink.

Changing the Login Form module settings

To change settings which control the information shown in the Login Form module and some aspects of its behaviour, do this:

  1. Log in to the Administrator back-end. To learn how to do this read: Logging in or out of the Administrator back-end.
  2. Click the Extensions > Module Manager menu item.
  3. From the list of Modules find the one called "Login Form". There may be several pages of Modules listed so you might need to look on subsequent pages. You can make the search easier by clicking the drop-down list containing Select Type and clicking the "mod_login" item (they are listed in alphabetical order).
  4. Click the Module Name, ie. Login Form.
  5. You will see the "Module: [Edit]" screen which contains three groups of fields: Details, Menu Assignment and Parameters.
  6. Make the changes you need to make.
  7. Click the Save or Apply toolbar button to implement the new settings:

    • The Save toolbar button will save your changes and return you to the Module list screen.
    • The Apply button will save your changes but leave you in the Module Edit screen.
  8. You should see a blue message: "Item saved." which confirms that your changes have been saved.

    • If you see a red error message refer to Cannot save Module changes.

Permalink.

Should PHP run as a CGI script or as an Apache module?

There are two ways to configure Apache to use PHP:

  • Configure Apache to load the PHP interpreter as an Apache module
  • Configure Apache to run the PHP interpreter as a CGI binary

(PS: Windows IIS normaly configures as CGI by the way)

It is the intention of this post to provide you information relating to the configuration and recognition of each method. "In general" historically only one method or the other has been implemented, however, with the architectural changes made to PHP starting with PHP5, it has been quite common for hosting firms to configure for both. One version running as CGI and one version running as a Module. It is generally accepted more recently that running PHP as a CGI is more secure, however, running PHP as an Apache Module does have a slight performance gain and is generally how most pre-configured systems will be delivered out of the box.

Permalink.

What is the framework?

The Joomla! Framework, renamed the Joomla! Platform is the set of files located in the libraries/joomla folder of your Joomla installation.

Starting in 2011 the Joomla! Platform will also be available as a separate downloadable package.

The platform files contain the set of PHP classes which implement what is collectively known as the Joomla! API.

Permalink.

Magento (57)

What Payment Gateways are compatible with Magento?

You can find a list of all compatible payment gateways in the Feature list under Payment or in Magento Connect under Payment Gateways.

Permalink.

How are we set up to handle cases when we need to roll the site back to a stable, previous version?

If the answer is, ‘we aren’t,’ you may want to consider a new development resource! The best answer is that a version control system of some kind is in place. You should also have both a production server and a development or ‘staging’ server in place. All of your experimentation should be done on the staging/development server. Changes should only be passed to your production server when it has been thoroughly tested.

Permalink.

Which version of Magento should we be using?

If you're more than 1 version behind the latest Magento release, you may be missing out on some important features or security patches if you are running an older version. Visit the Magento web site to see the latest version of Enterprise Edition. If you are more than one version behind, you should ask why.

Permalink.

The­ Magento­ Trademark

  • Magento’s Trademark policy strictly forbids the use of the term “Magento” in any form within the domain name. This means you can’t use it even with some other words ( examplemagento.com, example-magento.com… )

  • You can use the word “Magento” anywhere within your sub-domain. Example: magento.example.com, magento-services.example.com…

  • You can promote your Magento related services using the term “Magento” anywhere within the text.

  • You shouldn’t use the word “Magento” within the name of your extensions. Plese note that you also may NOT use the term “Magento” within your username at magentocommerce.com, but this is more due to the Extension Guidelines than due to the Trademark Policy.

  • Your extensions will not be approved at Magento Connect. If you hold a domain name with Magento within, Magento Inc. could take that domain away from you if they wanted to since they do hold a trademark on that term.

Permalink.

How will you enable product’s custom attribute visibility in frontend?

In the Manage Attributes section of the custom attribute, select Visible on Product View Page on Front-end and Used in Product Listing to Yes.

Permalink.

What is codePool in Magento?

CodePool is a tag which you have to specify when registering new module in app/etc/modules/Company_Module.xml. There are 3 codePools in Magento: core, community and local, which are resided at app/code/ directory. Core codePool is used by Magento core team, Community is generally used by 3rd party extensions and Local codePool should be used for in-hour module development and overriding of core and community modules for custom requirement.
So in short, codePool helps Magento to locate module inside app/code/ for processing.

Permalink.

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.

Permalink.

What licenses does Magento use?

The Magento Community Edition is licensed under the Open Software License (OSL) v3.0, an open source certified license. More information about Magento's license can be found at http://www.magentocommerce.com/license/. The premium, Magento Enterprise Edition product is licensed under a commercial license.

Permalink.

How to enable a theme for my Magento mobile web site?

In order to use one theme for a Magento web site when it is loaded through a personal computer and a different one for mobile devices follow the steps listed below.

Do NOT enter its name in the Default theme field. This way the default theme will be loaded when the web site is opened through a computer.

Next you should add exceptions for the mobile devices. Navigate to the Magento administrative area -> System -> Configuration -> Design -> Themes. Click on the Add Exceptions buttons besides the Templates, Skin and Layout labels.

Enter the following line in the Matched Expression field:

iPhone|iPod|BlackBerry|Palm|Googlebot-Mobile|Mobile|mobile|mobi|Windows Mobile|Safari Mobile|Android|Opera Mini
	

In the Value field enter the name of your newly installed mobile theme and Save the changes.

Then you can open your web site through your computer and your mobile phone. You will see that it loads with two different themes depending on the device

Permalink.

What is our current resource load and how much of a spike in traffic can we handle?

Merchants who run promotions need to be prepared for spikes in traffic. If your server is already running close to capacity, it may slow down, deny access to some users, or, heaven forbid, crash during an important marketing campaign. To make sure you have sufficient CPU power, RAM and disk space, you should provide traffic forecasts to your developers and ask… can we handle it?

Permalink.

Magento Go (14)

Do You Charge a Set Up Fee for Magento Go?

No, Magento Go plans do not have any set up fees.

Permalink.

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.

Permalink.

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.

Permalink.

Can I use My Own Domain?

Yes. Magento lets you customize your online store with your own domain name on any Magento Go plan. Once you have purchased a plan, you can add your own domain to your store through your Account Settings. Please follow the instructions in the Magento Go Knowledge Base to add your own domain to your Magento Go online store.

Permalink.

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.

Permalink.

Can I use My Own SSL certificate?

Magento Go provides all of its customers with a shared SSL by default, enabling you to offer a secure checkout to all of your customers. If you wish to use a custom SSL, you can purchase a Magento SSL, transfer an existing SSL, or purchase a new SSL from the third party provider of your choice. Simply log into your account and select one of these options under the tab, ‘My Products and Services’. Then follow the prompts to either upload your current SSL file or generate a new CSR file to use when you are purchasing an SSL from another third party provider.

Permalink.

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.

Permalink.

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.

Permalink.

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.

Permalink.

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.

Permalink.

MySQL (116)

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:

CREATE TABLE buyers (
 id INT UNSIGNED NOT NULL AUTO_INCREMENT,
 first_name VARCHAR(35) NOT NULL,last_name VARCHAR(35) NOT NULL,
 email VARCHAR(55) NOT NULL UNIQUE,
 INDEX (last_name),
 PRIMARY KEY(id)
);

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:

CREATE TABLE buyers (
 id INT UNSIGNED NOT NULL AUTO_INCREMENT,
 first_name VARCHAR(35) NOT NULL,last_name VARCHAR(35) NOT NULL,
 email VARCHAR(55) NOT NULL UNIQUE,
 INDEX ( last_name(5) ),
 PRIMARY KEY(id)
);

Permalink.

What is difference among mysqld, mysqladmin, mysqldump, mysqlimport and mysqlcheck?

Mysqld is the MySQL database server program, which manages access to the actual databases on disk, in memory etc. Whereas mysqladmin, mysqldump, mysqlimport and mysqlcheck are MySQL client programs. mysqladmin is used for server administration, mysqldump for making backups, mysqlimport for importing data files, and mysqlcheck for checking the integrity of the database files.

Permalink.

How to connect mysql client program with MySQL Server from the command line?

mysql understands the standard command-line options for specifying connection parameters. So to invoke mysql interactively from the command line, you have to specify any necessary connection parameters after the command name like mysql –user=user_name –password=password –host=host_name.

Take example:

shell> mysql --user=root --password=root --host=localhost

You can also use short forms:

shell> mysql -u root -proot -h localhost

You can also ask mysql providing a database name to select that database as the default database:

shell> mysql -u user_name -p -h host_name db_name

On Windows, you can do like this:

C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql  -u user_name -p -h host_name db_name

Permalink.

How to set control conditions on query data with IF funtion?

Control flow functions enable you to choose between different values based on the result of an expression. IF() tests the expression in its first argument and returns its second or third argument depending on whether the expression is true or false:

mysql> SELECT IF(1 > 0, 'yes','no');
+-----------------------+
| IF(1 > 0, 'yes','no') |
+-----------------------+
| yes                   |
+-----------------------+

Permalink.

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');

Permalink.

How do you repair a MySQL database table?

Every once in a while, it may be necessary to repair one or more MySQL database tables. According to the How to Repair Tables article at dev.mysql.com there are a number of reasons to repair a table including errors such as "tbl_name.frm is locked against change", "Can't find file tbl_name.MYI (Errcode: nnn)", "Unexpected end of file", "Record file is crashed", or "Got error nnn from table handler".

Here are the steps to repair a table in a MySQL database using phpMyAdmin:

  1. Login to hosting account.
  2. Login to phpMyAdmin.
  3. Choose the affected database. If you only have one database, it should choose it by default so you don't need to do anything.
  4. In the main panel, you should see a list of your database tables. Check the boxes by the tables that need repair.
  5. At the bottom of the window just below the list of tables, there is a drop down menu. Choose "Repair Table"

Remember, that it is advisable to have a current backup of your database at all times.

Permalink.

Is it possible to apply more than one keys on a single column?

Yes, it's possible that more than one keys can be applied to a given column. For example, a column that is a PRIMARY KEY or any other type of KEY might also be part of other indexes.

Permalink.

How to rename existing database in MySQL?

Currently, MySQL does not provide any command to rename an existing database. However, you can rename the existing database through some ways. You can choose any of the following ways to rename a database in MySQL.

  • If you have access to the directory where MySQL stores its databases. As per default MySQL installations, this is usually in the data directory under the directory where MySQL was installed. Locate the name of required database under the data directory and rename it as desired. Note: You must stop MySQL Server before renaming the database and may restart it after this operation. In this case, you may also grant permissions again on the renamed database.
  • Another way that seems safest, is to use mysqldump utility to back up the old database. Create a new database with desired name, then restore the dumped database under this database using the mysql utility. Finally, use the DROP DATABASE old_database_name; command to get rid of the old database.

Permalink.

How to delete or update records of multiple tables in one go?

To perform a single-table DELETE, you refer only to the columns of one table and thus need not qualify the column names with the table name. For example, to delete all records in a table t that have id values greater than 100, you'd write a statement like this:

DELETE FROM t WHERE id > 100;

But what if you want to delete records based not on properties inherent in the records themselves, but rather on their relationship to records in another table? Suppose that you want to delete from t those records with id values that are found in another table t2?

To write a multiple-table DELETE, name all the tables in a FROM clause and specify the conditions used to match up records in the tables in the WHERE clause. The following statement deletes records from table t1 where there is a matching id value in table t2:

DELETE t1 FROM t1, t2 WHERE t1.id = t2.id;

Notice that the FROM clause names all the tables involved in the operation, just as when writing a join. In addition, if a column name appears in more than one of the tables, it becomes ambiguous and must be qualified with a table name something like t1.id, t2.id. This too is similar to writing a join.

The syntax also allows for deleting records from multiple tables at once. To delete rows from both tables where there are matching id values, name them both after the DELETE keyword like:

DELETE t1, t2 FROM t1, t2 WHERE t1.id = t2.id;

What if you want to delete non-matching records? A multiple-table DELETE can use any kind of join that you can write in a SELECT, so employ the same strategy that you'd use when writing a SELECT that identifies the non-matching records. That is, use a LEFT JOIN or RIGHT JOIN. For example, to identify records in t1 that have no match in t2, you'd write a SELECT like this:

SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.id = t2.id 
WHERE t2.id IS NULL;

The analogous DELETE statement to find and remove those records from t1 uses a LEFT JOIN as well:

DELETE t1 FROM t1 LEFT JOIN t2 ON t1.id = t2.id 
WHERE t2.id IS NULL;

MySQL supports a second multiple-table DELETE syntax. With this syntax, use a FROM clause to indicate which tables records are to be deleted from and a USING clause to list the tables that determine which records to delete. The preceding multiple-table DELETE statements can be rewritten using this syntax as follows:

DELETE FROM t1 USING t1, t2 WHERE t1.id = t2.id;

DELETE FROM t1, t2 USING t1, t2 WHERE t1.id = t2.id;

DELETE FROM t1 USING t1 LEFT JOIN t2 ON t1.id = t2.id 
WHERE t2.id IS NULL;

Multiple-table UPDATE Statements

The principles involved in writing multiple-table UPDATE statements are quite similar to those used for DELETE: Name all the tables that participate in the operation and qualify column references as necessary. Suppose that the quiz you gave on May 5, 2005 contained a question that everyone got wrong, and then you discover that the reason for this is that your answer key was incorrect. As a result, you must add a point to everyone's score. Without multiple-table UPDATE capability, you might accomplish this using two statements. First, look up the event id corresponding to the quiz for the given date:

SELECT @id := event_id FROM grade_event 
WHERE date = '2005-05-05' AND category = 'Q';

Then use the id value to identify the relevant score records:

UPDATE score SET score = score + 1 WHERE event_id = @id;

With a multiple table UPDATE, you can do the same thing with a single statement:

UPDATE score, grade_event SET score.score = score.score + 1 
WHERE score.event_id = grade_event.event_id AND 
grade_event.date = '2005-05-05' AND grade_event.category = 'Q';

You can not only identify records to update based on the contents of another table, you can copy column values from one table to another. The following statement copies t1.a to t2.a for records that have a matching id column value:

UPDATE t1, t2 SET t2.a = t1.a WHERE t2.id = t1.id;

If you want to perform multiple-table deletes or updates for InnoDB tables, you need not use the syntax just described. Instead set up a foreign key relationship between tables that includes an ON DELETE CASCADE or ON UPDATE CASCADE constraint.

Permalink.

How to manage case sensitivity in string comparisons?

String comparisons are somewhat more complex than numeric or temporal comparisons. Numbers sort in numeric order and dates and times sort in temporal order, but string comparisons depend not only on the specific content of the strings, but on whether they are non-binary or binary. A letter in uppercase may compare as the same or different than the same letter in lowercase, and a letter with one type of accent may be considered the same or different than that letter with another type of accent. Here is a summary:

  • A non-binary string contains characters from a particular character set, and is associated with one of the collations (sorting orders) available for the character set. Characters may consist of single or multiple bytes. A collation can be case insensitive (lettercase is not significant), case sensitive (lettercase is significant), or binary (comparisons are based on numeric character values).
  • A binary string is treated as raw bytes. It has no character set and no collation. Comparisons between binary strings are based on numeric byte values.

The rules that govern string comparison apply in several ways. They determine the result of comparisons performed explicitly with operators such as = and <, and comparisons performed implicitly by ORDER BY, GROUP BY, and DISTINCT operations.

The default character set and collation for literal strings depend on the values of the character_set_connection and collation_connection system variables. The default character set is latin1. The default collation is latin1_swedish_ci, which is case insensitive as indicated by the "_ci" at the end of the collation name. Assuming these connection settings, literal strings are not case sensitive by default. You can see this by comparing strings that differ only in lettercase:

mysql> SELECT 'Hello' = 'hello';
+-------------------+
| 'Hello' = 'hello' |
+-------------------+
|                 1 |
+-------------------+

A given collation might cause certain accented characters to compare the same as other characters. For example, 'ü' and 'ue' are different in the default latin1_swedish_ci collation, but with the latin1_german2_ci collation ("German phone-book" collation), they have the same sort value and thus compare as equal:

mysql> SELECT 'Müller' = 'Mueller';
+----------------------+
| 'Müller' = 'Mueller' |
+----------------------+
|                    0 |
+----------------------+

mysql> SET collation_connection = latin1_german2_ci;

mysql> SELECT 'Müller' = 'Mueller';
+----------------------+
| 'Müller' = 'Mueller' |
+----------------------+
|                    1 |
+----------------------+

For binary strings, lettercase is significant. However, this is not because binary strings are case sensitive per se, because binary strings have no character set. Rather, it is because uppercase and lowercase versions of a character have different numeric values.  A non-binary string can be treated as a binary string by preceding it with the BINARY keyword. If either string in a comparison is binary, both strings are treated as binary:

mysql> SELECT BINARY 'Hello' = 'hello';
+--------------------------+
| BINARY 'Hello' = 'hello' |
+--------------------------+
|                        0 |
+--------------------------+

mysql> SELECT 'Hello' = BINARY 'hello';
+--------------------------+
| 'Hello' = BINARY 'hello' |
+--------------------------+
|                        0 |
+--------------------------+

The sorting principles just described were demonstrated using literal strings, but the same principles apply to string-valued table columns. Suppose that a table t contains a column c and has the following rows:

mysql> SELECT c FROM t;
+-----------+
| c         |
+-----------+
| Hello     |
| goodbye   |
| Bonjour   |
| au revoir |
+-----------+

If c is a CHAR column that has the latin1_swedish_ci collation, it is a non-binary column with a case-insensitive collation. Uppercase and lowercase letters are treated as identical and a sort operation that uses ORDER BY produces results like this:

mysql> SELECT c FROM t ORDER BY c;
+-----------+
| c         |
+-----------+
| au revoir |
| Bonjour   |
| goodbye   |
| Hello     |
+-----------+

If c is declared as a BINARY column instead, it has no character set or collation. ORDER BY sorts using raw byte codes and produces a different result. Assuming that the values are stored on a machine that uses ASCII codes, the numeric values for uppercase letters precede those for lowercase letters and the result looks like this:

mysql> SELECT c FROM t ORDER BY c;
+-----------+
| c         |
+-----------+
| Bonjour   |
| Hello     |
| au revoir |
| goodbye   |
+-----------+

String comparison rules also apply to GROUP BY and DISTINCT operations. Suppose that t has a column c with the following contents:

mysql> SELECT c FROM t;
+---------+
| c       |
+---------+
| Hello   |
| hello   |
| Goodbye |
| goodbye |
+---------+

If c is a non-binary, case-insensitive column, GROUP BY and DISTINCT do not make lettercase distinctions:

mysql> SELECT c, COUNT(*) FROM t GROUP BY c;
+---------+----------+
| c       | COUNT(*) |
+---------+----------+
| Goodbye |        2 |
| Hello   |        2 |
+---------+----------+

mysql> SELECT DISTINCT c FROM t;
+---------+
| c       |
+---------+
| Hello   |
| Goodbye |
+---------+

On the other hand, if c is a BINARY column, those operations use byte values for sorting:

mysql> SELECT c, COUNT(*) FROM t GROUP BY c;
+---------+----------+
| c       | COUNT(*) |
+---------+----------+
| Goodbye |        1 |
| Hello   |        1 |
| goodbye |        1 |
| hello   |        1 |
+---------+----------+

mysql> SELECT DISTINCT c FROM t;
+---------+
| c       |
+---------+
| Hello   |
| hello   |
| Goodbye |
| goodbye |
+---------+

The preceding discussion shows that to understand sorting and comparison behavior for strings, it's important to know whether they are non-binary or binary. This is important when using string functions as well. String functions may treat their arguments as non-binary or binary strings, or return binary or non-binary results. It depends on the function. Here are some examples:

  • LENGTH() returns the length of a string in bytes, whereas >CHAR_LENGTH() returns the length in characters. For strings that contain only single-byte characters, the two functions return identical results. For strings that contain multi-byte characters, you should choose the function that is appropriate for the type of result you want. For example, the sjis character set includes characters that require two bytes to represent. The value of LENGTH() for any string containing such characters will be greater than the value of CHAR_LENGTH().
  • The UPPER() and LOWER() functions perform case conversion only if the argument is a non-binary string. Suppose that 'AbCd' is non-binary. In that case, the two functions return a value in the requested lettercase:

    mysql> SELECT UPPER('AbCd'), LOWER('AbCd');
    +---------------+---------------+
    | UPPER('AbCd') | LOWER('AbCd') |
    +---------------+---------------+
    | ABCD          | abcd          |
    +---------------+---------------+
    

    However, if 'AbCd' is a binary string, it has no character set. In that case, the concept of lettercase does not apply, and UPPER() and LOWER() do nothing:

    mysql> SELECT UPPER(BINARY 'AbCd'), LOWER(BINARY 'AbCd');
    +----------------------+----------------------+
    | UPPER(BINARY 'AbCd') | LOWER(BINARY 'AbCd') |
    +----------------------+----------------------+
    | AbCd                 | AbCd                 |
    +----------------------+----------------------+
    

    To make the two functions perform case conversion for a binary string, convert it to a non-binary string. For example:

    mysql> SELECT UPPER(CONVERT(BINARY 'AbCd' USING latin1));
    +--------------------------------------------+
    | UPPER(CONVERT(BINARY 'AbCd' USING latin1)) |
    +--------------------------------------------+
    | ABCD                                       |
    +--------------------------------------------+
    
  • MD5() takes a string argument and produces a 32-byte checksum represented as a string of hexadecimal digits. It treats its argument as a binary string:

    mysql> SELECT MD5('a');
    +----------------------------------+
    | MD5('a')                         |
    +----------------------------------+
    | 0cc175b9c0f1b6a831c399e269772661 |
    +----------------------------------+
    
    mysql> SELECT MD5('A');
    +----------------------------------+
    | MD5('A')                         |
    +----------------------------------+
    | 7fc56270e7a70fa81a5935b72eacbe29 |
    +----------------------------------+
    

Permalink.

OsCommerce (22)

How to generate the necessary certificates for PayPal IPN?

The PayPal IPN contribution for osCommerce offers OpenSSL public/private key encryption to securely send the order information to PayPal during checkout.

Here is information on how to generate the necessary certificates:

1. You should have OpenSSL installed on your computer. Linux distributions should have it installed by default, and a Windows version can be downloaded from here.

2. You should generate a private key using this command:

open ssl genrsa -out my-prvkey.pem 1024

This will create a 1024-bit RSA private key in the file my-prvkey.pem.

3. You should generate a public certificate using this command:

	openssl req -new -key my-prvkey.pem -x509 -days 365 -out my-pubcert.pem

This will create a public certificate in the file my-pubcert.pem.

4. Then you should upload your public certificate to the PayPal website:

4.1. Log in to your PayPal account.
4.2. Click the Profile tab.
4.3. In the Seller Preferences column you should click the Encrypted Payment Settings link. TheWebsite Payment Certificates page should appear.
4.4. Scroll down to the Your Public Certificates section and click the Add button. The Add Certificate page should appear.
4.5. Click the Browse button and select the public certificate that you want to upload to PayPal from your local computer.
4.6. Click the Add button. After you upload the public certificate successfully, it appears in the Your Public Certificates section of the Website Payment Certificates page.

5. A certificate ID will be assigned to your public certificate. You need this certificate ID to encrypt your payment buttons by using PayPal’s Encrypted Website Payments program.

For more information about PayPal’s certificates and their integration please check the official integration documentation.

Permalink.

How do I fix the following error: “Warning: session_start(): Cannot send session cache limiter – headers already sent”

The session start error usually means that an extra character (usually a space) has been added at the beginning or end of a file. If it is at the beginning, it will be easy to find since the first character should always be <. If it is at the end, you will need to move your cursor to the very end of the file and backspace until you reach the > character. The difficult part in fixing this problem is in finding the correct file. Always start with the last one you edited, the one in the url or the one mentioned in the error. Those are the most likely.

Permalink.

I keep getting “There has been an error processing your credit card”.

This error can be caused by two things.

  1. Port 1129 may be blocked. Contact your web host and make sure port 1129 is not blocked.

  2. The PEM file is missing. Make sure you uploaded the PEM file into the following directory:
    catalog/includes/modules/payment/linkpoint_api

    You can download the PEM file from LinkPoint Central.

  3. After you login, click on Support at the top, then click on Download Center.

  4. Click on Download next to PEM and make sure to save the file to the desktop.

Permalink.

How to configure osCommerce to work with a new domain?

In order to configure osCommerce to work properly with another domain, you should modify the two configure.php files in includes/ and admin/includes/ folders to reflect the new domain.

The settings that should be changed in includes/configure.php are:

HTTP_SERVER – you should change this to your new domain name, e.g. http://newdomain.com :

	define(‘HTTP_SERVER’, ‘http://newdomain.com’);

HTTP_COOKIE_DOMAIN – again, this should be changed to reflect your new domain name:

	define(‘HTTP_COOKIE_DOMAIN’, ‘newdomain.com’);

If you are using SSL you should also modify:

HTTPS_SERVER – for example:

	define(‘HTTPS_SERVER’, ‘https://newdomain.com’);

HTTPS_COOKIE_DOMAIN – set this to:

	define(‘HTTPS_COOKIE_DOMAIN’, ‘newdomain.com’);
 

In admin/includes/configure.php you should modify:
 

HTTP_SERVER – you should change this to your new domain name, e.g. http://newdomain.com :

	define(‘HTTP_SERVER’, ‘http://newdomain.com’);

HTTP_CATALOG_SERVER – again, this should be changed to your new domain name:

	define(‘HTTP_CATALOG_SERVER’, ‘http://newdomain.com’);

If you are using SSL, you should also change HTTPS_CATALOG_SERVER to:

	define(‘HTTPS_CATALOG_SERVER’, ‘https://newdomain.com’);

Permalink.

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.

Permalink.

OsCommerce Admin Login Problems

If you cannot log into your OsCommerce admin area try the following:

1. Open your OsCommerce database through PhpMyAdmin. If you are not sure which it is check the file includes/configure.php and look for a constant called ‘DB_DATABASE’ .

2. Run the following two queries:

	CREATE TABLE IF NOT EXISTS `administrators` (
  `id` int(11) NOT NULL auto_increment,
  `user_name` varchar(32) NOT NULL,
  `user_password` varchar(40) NOT NULL,
  PRIMARY KEY  (`id`)
) ; INSERT INTO `administrators` (`id`, `user_name`, `user_password`) VALUES
(1, ‘adm’, ’2272bd2219e0bbc353e33f1e774c9d1e:11′);

3. The above will create a new administrator with login ‘adm’ and password ‘pass11′ .

Usually problems with admin login in OsCommerce are caused after an upgrade, contributions installation or security issues. In some cases the above steps might not help you resolve the problem and it is recommended to seek professional assistance.

Permalink.

How do I change Top in the breadcrumb?

The normal installation of osCOmmerce has Top -> Catalog displayed in the breadcrumb trail The suggested way to change this is to make just state Home. The following instructions will accomplish this: -Open the includes/languages/english.php file in your editor. -Find the line that contains HEADER_TITLE_CATALOG -Change that line so it looks like this: define('HEADER_TITLE_CATALOG', 'Home'); -Open the includes/application_top.php file in your editor, find the code $breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER); and remove it.

Permalink.

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.

Permalink.

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:
/usr/local/php5/lib/php.ini
Edit php.ini, look for the following code, and remove the semicolon at the beginning:

;extension=php_curl.dll

Permalink.

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
 
or

your domain on a real time blacklist.
 

Permalink.

PHP (126)

Is it possible to use Apache content negotiation (MultiViews option) with PHP?

If links to PHP files include extension, everything works perfect. This FAQ is only for the case when links to PHP files don't include extension and you want to use content negotiation to choose PHP files from URL with no extension. In this case, replace the line AddType application/x-httpd-php .php with:

AddHandler php5-script php
AddType text/html php

This solution doesn't work for Apache 1 as PHP module doesn't catch php-script.

Permalink.

Unix/Windows: I have installed PHP, but when try to access a PHP script file via my browser, I get a server 500 error.

Something went wrong when the server tried to run PHP. To get to see a sensible error message, from the command line, change to the directory containing the PHP executable (php.exe on Windows) and run php -i . If PHP has any problems running, then a suitable error message will be displayed which will give you a clue as to what needs to be done next. If you get a screen full of HTML codes (the output of the phpinfo() function) then PHP is working, and your problem may be related to your server configuration which you should double check.

Permalink.

During make, I get errors in microtime, and a lot of RUSAGE_ stuff.

During the make portion of installation, if you encounter problems that look similar to this:

microtime.c: In function `php_if_getrusage':
microtime.c:94: storage size of `usg' isn't known
microtime.c:97: `RUSAGE_SELF' undeclared (first use in this function)
microtime.c:97: (Each undeclared identifier is reported only once
microtime.c:97: for each function it appears in.)
microtime.c:103: `RUSAGE_CHILDREN' undeclared (first use in this function)
make[3]: *** [microtime.lo] Error 1
make[3]: Leaving directory `/home/master/php-4.0.1/ext/standard'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/master/php-4.0.1/ext/standard'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/master/php-4.0.1/ext'
make: *** [all-recursive] Error 1

Your system is broken. You need to fix your /usr/include files by installing a glibc-devel package that matches your glibc. This has absolutely nothing to do with PHP. To prove this to yourself, try this simple test:

$ cat >test.c <<X
#include <sys/resource.h>
X
$ gcc -E test.c >/dev/null

If that spews out errors, you know your include files are messed up.

Permalink.

Creating Your First PHP Cookie.

A cookie is created by using setCookie() function. This function takes 3 arguments:

– Name – The name of the cookie to be used to retrieve the cookie.

– Value – The value is persisted in the cookie. Usually, user names and last visit date / time are used

– Expiration – The date until which the cookie is alive. After the date the cookie will be expired. If the expiry date is not set, then the cookie is treated as a default cookie and will expire when the browser restarts.

Example code:

<?php

//Set 60 days as the life time for the cookie.
//seconds * minutes * hours * days + current time
$inTwoMonths = 60 * 60 * 24 * 60 + time();
setcookie('lastVisit', date("G:i - m/d/y"), $inTwoMonths);

?>

Permalink.

Can I ask my web host to install PHP 5 or do I have to do it myself?

This will vary from host to host. In some cases, a request via a support ticket will get you an answer from your web host provider. Others will offer the option through your host's control panel. It is usually a simple procedure.

Permalink.

How can I trap COM errors ?

In PHP 5, the COM extension throws com_exception exceptions, which you can catch and then inspect the code member to determine what to do next.

In PHP 4 it's not possible to trap COM errors beside the ways provided by PHP itself (@, track_errors, ..).

Permalink.

What encoding/decoding do I need when I pass a value through a form/URL?

There are several stages for which encoding is important. Assuming that you have a string $data, which contains the string you want to pass on in a non-encoded way, these are the relevant stages:

  • HTML interpretation. In order to specify a random string, you must include it in double quotes, and htmlspecialchars() the whole value.

  • URL: A URL consists of several parts. If you want your data to be interpreted as one item, you must encode it with urlencode().

Example #1 A hidden HTML form element

<?php
    echo '<input type="hidden" value="' . htmlspecialchars($data) . '" />'."\n";
?>

Note: It is wrong to urlencode() $data, because it's the browsers responsibility to urlencode() the data. All popular browsers do that correctly. Note that this will happen regardless of the method (i.e., GET or POST). You'll only notice this in case of GET request though, because POST requests are usually hidden.

Permalink.

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.

Permalink.

PhpMyAdmin (120)

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.

Permalink.

Bookmarks: Can I execute a default bookmark automatically when entering Browse mode for a table?

Yes. If a bookmark has the same label as a table name and it’s not a public bookmark, it will be executed.

Permalink.

With Mozilla 0.9.7 I have problems sending a query modified in the query box.

Looks like a Mozilla bug: 0.9.6 was OK. We will keep an eye on future Mozilla versions.

Permalink.

With Firefox, I cannot delete rows of data or drop a database.

Many users have confirmed that the Tabbrowser Extensions plugin they installed in their Firefox is causing the problem.

Permalink.

I am running Apache with mod_gzip-1.3.26.1a on Windows XP, and I get problems, such as undefined variables when I run a SQL query.

A tip from Jose Fandos: put a comment on the following two lines in httpd.conf, like this:

# mod_gzip_item_include file \.php$
# mod_gzip_item_include mime "application/x-httpd-php.*"

as this version of mod_gzip on Apache (Windows) has problems handling PHP scripts. Of course you have to restart Apache.

Permalink.

Nothing is displayed by my browser when I try to run phpMyAdmin, what can I do?

Try to set the $cfg['OBGzip'] directive to false in the phpMyAdmin configuration file. It helps sometime. Also have a look at your PHP version number: if it contains “b” or “alpha” it means you’re running a testing version of PHP. That’s not a so good idea, please upgrade to a plain revision.

Permalink.

How can I use the relation table in Query-by-example?

Here is an example with the tables persons, towns and countries, all located in the database “mydb”. If you don’t have a pma__relation table, create it as explained in the configuration section. Then create the example tables:

CREATE TABLE REL_countries (
country_code char(1) NOT NULL default '',
description varchar(10) NOT NULL default '',
PRIMARY KEY (country_code)
) TYPE=MyISAM;

INSERT INTO REL_countries VALUES ('C', 'Canada');

CREATE TABLE REL_persons (
id tinyint(4) NOT NULL auto_increment,
person_name varchar(32) NOT NULL default '',
town_code varchar(5) default '0',
country_code char(1) NOT NULL default '',
PRIMARY KEY (id)
) TYPE=MyISAM;

INSERT INTO REL_persons VALUES (11, 'Marc', 'S', '');
INSERT INTO REL_persons VALUES (15, 'Paul', 'S', 'C');

CREATE TABLE REL_towns (
town_code varchar(5) NOT NULL default '0',
description varchar(30) NOT NULL default '',
PRIMARY KEY (town_code)
) TYPE=MyISAM;

INSERT INTO REL_towns VALUES ('S', 'Sherbrooke');
INSERT INTO REL_towns VALUES ('M', 'Montréal');

To setup appropriate links and display information:

  • on table “REL_persons” click Structure, then Relation view
  • for “town_code”, choose from dropdowns, “mydb”, “REL_towns”, “code” for foreign database, table and column respectively
  • for “country_code”, choose from dropdowns, “mydb”, “REL_countries”, “country_code” for foreign database, table and column respectively
  • on table “REL_towns” click Structure, then Relation view
  • in “Choose column to display”, choose “description”
  • repeat the two previous steps for table “REL_countries”

Then test like this:

  • Click on your db name in the navigation panel
  • Choose “Query”
  • Use tables: persons, towns, countries
  • Click “Update query”
  • In the columns row, choose persons.person_name and click the “Show” tickbox
  • Do the same for towns.description and countries.descriptions in the other 2 columns
  • Click “Update query” and you will see in the query box that the correct joins have been generated
  • Click “Submit query”

Permalink.

I get an error when entering USE followed by a db name containing an hyphen.

The tests I have made with MySQL 5.1.49 shows that the API does not accept this syntax for the USE command.

Permalink.

In edit/insert mode, how can I see a list of possible values for a column, based on some foreign table?

You have to setup appropriate links between the tables, and also setup the “display column” in the foreign table. See 6.6 How can I use the relation table in Query-by-example? for an example. Then, if there are 100 values or less in the foreign table, a drop-down list of values will be available. You will see two lists of values, the first list containing the key and the display column, the second list containing the display column and the key. The reason for this is to be able to type the first letter of either the key or the display column. For 100 values or more, a distinct window will appear, to browse foreign key values and choose one. To change the default limit of 100, see $cfg['ForeignKeyMaxLimit'].

Permalink.

Prestashop (10)

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).

Permalink.

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.

Permalink.

How to import product features by csv import­?

Index
(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 1.4.4.0. These codes will work:
<br>
<p></p>
 
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.

Permalink.

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.
 

Permalink.

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.

Permalink.

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:

/tools/smarty/cache

/tools/smarty/compile

/tools/smarty_v2/cache

/tools/smarty_v2/compile

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:

public_html/tools/smarty/cache

public_html/tools/smarty/compile

public_html/tools/smarty_v2/cache

public_html/tools/smarty_v2/compile

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.

Permalink.

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'))

//this.expand();

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.

Permalink.

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:
http://www.iprestashop.com/adminXX/index.php?controller=AdminCustomers&token=f326b0415646545645649147
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:

http://www.iprestashop.com/adminXX/index.php?controller=adminmodules&configure=bankwire&token=a02e81d236feb1caf24880225c063dfb

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.

Permalink.

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).

Permalink.

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.

Permalink.

Responsive Website Design (22)

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.

Permalink.

Why do I need to have a responsive website?

Besides desktops, web browsing on tablets and mobile phones is on the rise, helped by their greater capabilities and lower prices. Therefore, if you don’t have a responsive, mobile-friendly website in the technically advanced environment today, you risk losing valuable traffic.

Permalink.

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.

Permalink.

What about SEO and responsive websites?

Making your website responsive is actually great from an SEO point of view because you’ll have just one URL. Besides, you won’t have to worry about some sites linking to your mobile website and some to the desktop version.

Permalink.

What are some important considerations to keep in mind when getting a responsive website designed?

Important factors to consider before getting your responsive website designed are money, the particular time frame for completion you have in mind and the content to be included.

Permalink.

What is Query used for?

The Semantic Web is a Web of data — of dates and titles and part numbers and chemical properties and any other data one might conceive of. RDF provides the foundation for publishing and linking your data. Various technologies allow you to embed data in documents (RDFa, GRDDL) or expose what you have in SQL databases, or make it available as RDF files.

However, just as relational databases or XML need specific query languages (SQL and XQuery, respectively), the Web of Data, typically represented using RDF as a data format, needs its own, RDF-specific query language and facilities. This is provided by the SPARQLquery language and the accompanying protocols. SPARQL makes it possible to send queries and receive results, e.g., through HTTP or SOAP.

Technically, SPARQL queries are based on (triple) patterns. RDF can be seen as a set of relationships among resources (i.e., RDF triples); SPARQL queries provide one or more patterns against such relationships. These triple patterns are similar to RDF triples, except that one or more of the constituent resource references are variables. A SPARQL engine would returns the resources for all triples that match these patterns.

Using SPARQL consumers of the Web of Data can extract possibly complex information (i.e., existing resource references and their relationships) which are returned, for example, in a table format. This table can be incorporated into another Web page; using this approach SPARQL provides a powerful tool to build, for example, complex mash-up sites or search engines that include data stemming from the Semantic Web.

Permalink.

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.

Permalink.

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.

Permalink.

What other adaptations are there besides the layout?

Other than the general layout, some websites are also designed to detect the nature of the device. So, for example, a responsive website may allow touch scrolling on a touch screen in addition to the ‘previous’ and ‘next’ buttons or the scroll bar.

Permalink.

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.

Permalink.

SEO (7)

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.

Permalink.

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.

Permalink.

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.

Permalink.

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.

Permalink.

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.

Permalink.

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.

Permalink.

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.

Permalink.

Sugar CRM (41)

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');

Permalink.

Can I authenticate my SugarCRM instance with inBOX25, using a Non-System Administrator account?

Well, the answer is maybe.  The integration function properly does not work as it should, even when all of the permissions are set correctly in SugarCRM (manually).  So it is always recommended using a System Administrator account to properly authenticate.

Permalink.

What happens if a target opts-out or bounces?

If a target opts-out, then we 'check' opted-out in their profile in SugarCRM.  If they bounce and its a temporary error (soft bounce), then we simply count the soft bounce and once it reaches a certain point, they're email address is checked 'invalid' in SugarCRM.  If they bounce and its a permanent error (hard bounce), then they're email address is checked as 'invalid'. 

A target that is 'checked' as either opted-out or invalid, will not be included in future inBOX25 email campaigns.

Permalink.

During my Sugar install, there’s a warning that says “PHP Memory Limit >= 10M Warning: (Set this to 10M or larger in your php.ini file)”. How do I get rid of it?

1) The installer should point you to the location of your php.ini file. Open that file.
2) Look for a line that reads:
memory_limit = 8M ; Maximum amount of memory a script may consume (8MB)
3) Change the 8 to a value 10 or higher, depending on the available memory on your web server.
4) Save the change to the php.ini file.
5) Restart your web server.

NOTE: PHP will only honor the memory_limit parameter in php.ini if you compiled PHP with the –enable-memory configuration option (see http://us2.php.net/manual/en/ini.core.php#ini.memory-limit).

Permalink.

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.

Permalink.

How do I disable exporting for non-admin users?

To disable exporting for all non-admin users, follow these steps:

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

Permalink.

How do I change my webserver’s Memory Limit?

Locate your php.ini file, which is commonly found in C:\WINDOWS\ on Windows machines or /etc/ on Linux machines. In this file, search for this line:

      memory_limit = 8M

Change the "8M" value to reflect the memory limit you'd like to use, such as:

      memory_limit = 20M

After making this change, save your php.ini file and restart your webserver.

Permalink.

How do I set or change a Sugar user’s password?

Follow these steps:

  1. Login as a user with administrative privileges
  2. Click the Admin link in the top-right corner
  3. Click User Management
  4. Click the username whose password you'd like to change
  5. Click the Change Password button displayed next to the Edit button
  6. Enter and confirm the user's new password

Permalink.

Does SugarCRM offer an API?

Yes, SugarCRM has an API available for use.

Permalink.

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.

Permalink.

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.

Permalink.

Web Design and Applications (87)

The importance of white space in Web Designs

When we're building Web pages we often focus on the stuff that shows in the design, you know, the fonts, colors, images, etc. But often the part of a design that has the most impact is the part that doesn't really show – the white space or negative space between the elements. Unfortunately, most Web designers (and many Web clients as well) think of white space as "empty space". In other words, it's space that could (and should) be filled with content to get people to read, click, and buy. But white space serves a very important purpose. White space sets the tone of your design and affects the usability dramatically.

Permalink.

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.

Permalink.

Web Design troubleshooting Checklist

I get asked all the time how to fix various problems in Web designs. The challenge is that while there is usually only one way to get your design right, there are hundreds or thousands of ways to get it wrong. Problems can be as simple as not uploading a file or as complex as having the CSS cascade cause unexpected conflicts. But finding the problem can be frustrating.

By being methodical in your approach to problems, you can do two things:

  • Remove the aspects that are working
  • Narrow down your focus to just the areas that are not working

It can be tempting to ignore some of the steps, especially the first few steps. But you'd be surprised how many problems are caused because a class name was misspelled or a file wasn't uploaded. When you're havig problems, I recommend going through all the steps on this checklist, even if you know that a step is correct. By verifying, you remove that as a possible error, and don't get caught up in a long testing process only to discover that the style sheet didn't get uploaded.

Web Design Checklist

 

Are all related files uploaded?
Paste the URL of all relevant files into your browser, and make sure they don't get 404 errors. This includes:

  • The HTML
  • The CSS
  • The Images
  • External JavaScripts
  • Other external files, like multimedia

Are you using the correct URLs for the files?
If your Web page itself isn't coming up, and you know you've uploaded it, go back to your hosting provider and make sure that you have the correct URL.

For files linked to within the HTML, make sure you have referenced the exact URL you browsed to in the first step. The easiest way to do this is to copy the working URL from your browser window and paste that into your HTML.

Does your HTML validate?
Using an HTML validator can often solve many problems. It's not that it's vital to have valid HTML, but that if your HTML is valid, you know that that isn't causing the problem. If you don't know how to use an HTML validator, I have an article that can help: Common Validation Problems and How to Fix Them.

Does your CSS validate?
Just like validating your HTML can help solve problems, validating your CSS can eliminate that as the cause of your problem.

Is your page cached?
Web caches can cause a lot of heartache. You edit your page, upload it, and your changes don't display. The easiest way to clear the cache for specific pages is to hold down the shift key while you click on the "refresh" button in your browser. Most browsers will go back to the server and reload the page when you do this.

Are you editing the correct page or CSS file?
This may seem like an obvious question, but when file names are the same (such as index.html) and the files are just stored in separate directories, it can be very easy to edit one file, and even upload it, and then test on a different page. One way I will test this is to add a simple comment with my name in it into the code. If I'm editing the wrong file, my comment won't be in the code after I upload.

Did you remember that CSS and most Web servers are case-sensitive?
What this means is that if you name a CSS class "JennsClass" and then define it as "jennsclass" in your CSS, it won't display on your Web pages. The same is true for most filenames on Web servers. If you are building your website on a Windows machine and then uploading the pages to a Unix or Linux server, you should look carefully at the filenames on the server side. If you used any capital letters in the filenames (for images, CSS files, linked HTML pages, or any other external document), they won't work if your HTML references them in lowercase.

Note: you should have caught any incorrect file names in the first couple of steps on this checklist, but it never hurts to check again.

Did you use the right DOCTYPE or include one at all?
Many modern browsers have what they call quirks mode, this is a mode that the browser enters when an HTML document doesn't have a DOCTYPE. Quirks mode is, well, quirky. And it's better that you use a legitimate DOCTYPE than leaving it off – especially if most of your customers view your site on IE.

Did you check your page in multiple Web browsers?
It can be tempting to build your page and either only check it in your favorite browser, or even worse, only in your WYSIWYG editor. SinceWYSIWYG isn't really, you can create a great page in your editor and then be sorely disappointed when you look at it in Web browsers.

Permalink.

What is Design?

Dictionary.com has 17 different definitions for design. The ones that seem most relevant to our work include:

  • to prepare the preliminary sketch or the plans for (a work to be executed), esp. to plan the form and structure of: to design a new bridge.
  • to plan and fashion artistically or skillfully.
  • to intend for a definite purpose
  • to form or conceive in the mind; contrive; plan
  • to assign in thought or intention; purpose
  • an outline, sketch, or plan, as of the form and structure of a work of art, an edifice, or a machine to be executed or constructed.
  • the combination of details or features of a picture, building, etc.; the pattern or motif of artistic work
  • a plan or project

But beyond the formal definitions, there are also the loose meanings that teams working on Web pages assign to the word, including:

  • the person or team responsible for making a site "look good"
  • the look of a website as a whole
  • the look of an individual Web page
  • the work of building a website (as oppsed to planning it or writing content for it)
  • the person or team responsible for coding the website
  • the way the website "works"
  • the images and icons required for a website

Permalink.

What is Rhythm in Design?

Rhythm in design is also called repetition. Rhythm allows your designs to develop an internal consistency that makes it easier for your customers to understand. Once the brain recognizes the pattern in the rhythm it can relax and understand the whole design. Repetition rarely occurs on its own and so it embues a sense of order onto the design. And because of this, repetition attracts attention and prompts customers to investigate further.

Permalink.

How to decide where your elements should go in the Layout

When you're starting a new design, no matter what your design methodology is, you start with a blank page. There is nothing on the Web page – so the first thing you'll do is put something up on the page.

But do you think about the placement of those elements or do you just throw them onto the page willy nilly? Good designers don't allow the position and placement of their designs to occur randomly. They think about:

  • what the element is
  • how the element relates to the page goals
  • where the element fits with the other elements on the page

Permalink.

White Space Definition

White space is the empty spaces in a design. White space is used to separate disparate design elements and group similar ones. White space is the lack of graphics or text in the layout.

White space is not always “white” — it is the empty parts of the page, but if the page has a different background color that will be the color of the white space.

White Space Characters

 

In HTML there are several characters that create white space. They are: a space, a tab, and a carriage return (or linefeed).

Also Known As: white space, empty space, negative space, breathing room
Alternate Spellings: white space

Permalink.

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

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.

Contrast

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

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

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

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

Permalink.

What is Balance in Design?

Balance in design is the distribution of elements across the design. Balance is a visual interpretation of gravity in the design. Large, dense elements appear to be heavier while smaller elements appear to be lighter. You can balance designs in three ways:

  • symmetrical balance
  • asymmetrical balance
  • discordant or off-balance

 

Symmetrical Balance:

Symmetrical balance is achieved by placing elements in a very even fashion in the design. If you have a large, heavy element on the right side, you'll have a matching heavy element on the left. Centering is the easiest way to get a symmetrically balanced page. But be careful, as it can be difficult to create a centered design that doesn't look flat or boring. If you want a symmetrically balanced design, it's better to create the balance with different elements – such as an image on the left and a large block of heavier text to the right of it.

Asymmetrical Balance:

Asymmetrically balanced pages can be more challenging to design – as they don't have elements matched across the centerline of the design. For example, you might have a large element placed very close to the centerline of the design. To balance it asymmetrically, you might have a small element farther away from the centerline. If you think of your design as being on a teeter-totter or seesaw, a lighter element can balance a heavier one by being further away from the center of gravity. You can also use color or texture to balance an asymmetrical design.

Discordant or Off-Balance:

Sometimes the purpose of the design makes an off-balance or discordant design work well. Designs that are off-balance suggest motion and action. They make people uncomfortable or uneasy. If the content of your design is also intended to be uncomfortable or make people think, a discordantly balanced design can work well.

Permalink.

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.

Shape

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

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

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

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.

Permalink.

Wordpress (145)

My contact form doesn’t appear. Instead, a code [contact-form-7 404 "Not Found"] appears.

The code [contact-form-7 404 "Not Found"] is a sign that the contact form specified by the shortcode couldn’t be found. Make sure you are using the correct shortcode.

Permalink.

I upgraded WordPress and now I don’t see Custom Fields area, authors area and more

In the newer versions of WordPress, the core User-Interface (UI) team has decided to make the admin interface much cleaner. Therefore, those options are checked off by default. If you look in the top right hand corner of your screen, there is a Screen Options tab. Click on that and check the fields that you would like to see.

Permalink.

Nothing shows up in the email, even after adding a tag to the form! How can I include a new field’s input in the email?

You need to add a new tag to the Mail fields. This tag should correspond to the tag in the Form you wish to include in the email. Thus, when you add a new form tag such as [text your-new-field], the corresponding email tag would be [your-new-field]. Only the second part of the tag (“your-new-field”, in this case) is needed for the email.Oju2HRZ0JANSKbDU-2EE75
A tag in the Mail field will be replaced with the user’s input contained in a form field with the same name.

Permalink.

How do i Fix the Syntax Error in WordPress?

This error usually occurs when you are trying to add code snippets into WordPress and have accidentally missed something or the code has incorrect syntax. This will result into a PHP parse error and you will see a notice like:

Parse error – syntax error, unexpected $end in /public_html/site1/wp-content/themes/my-theme/functions.php on line 278

The error message would indicate the unexpected thing found in the code and the location of the script where the error occurred with line number. To fix this issue you will have to correct the syntax. Most of the time it is a missing bracket, or some unexpected character in the code.

Permalink.

What is “Widgets”?

A WordPress Widget is a small block that performs a specific function. You can add these widgets in sidebars also known as widget-ready areas on your web page.

WordPress widgets were originally created to provide a simple and easy-to-use way of giving design and structure control of the WordPress theme to the user. Widgets can be easily dragged and dropped into a specific widget area. You can find the list of available widgets and widget areas by going to the Appearance » Widgets section in your WordPress dashboard.

Widgets in WordPress allow you to add content and features in the widgetized areas of your theme which is mostly the sidebar. However these widget-ready areas can be in the header, footer, sidebar, below content, and basically any other area in your theme. The available widget areas that you have in your theme will vary from theme to theme.

Most WordPress themes are widget ready and have multiple widget areas. However themes are NOT required to have widget areas. If you do not see any widget areas, then it means that your theme does not support widgets.

There are many different types of widgets. WordPress by default comes with several widgets including categories, tag cloud, navigation menu, calendar, search, recent posts etc. If you drag the recent posts widget in a widget area, then it will contain a list of recent posts.

Widgets are mostly standalone areas of code that perform a certain function. Plugins often add their own widgets to give users more control over the display of plugin functions. An example of a plugin widget would be OIO Publisher which allows you to add a specific banner ad zone in your widget areas by using the widget.

Permalink.

Why is every comment going into the moderation queue?

Go to the Options > Discussion panel and make sure that An administrator must approve the comment (regardless of any matches below) is unchecked. With that option selected, all comments are sent to the moderation queue to await approval. Make sure that Hold a comment in the queue if it contains more than x links is not blank and contains a number higher than zero. If this value is blank or zero, all comments containing links will be moderated. If the option mentioned above is unchecked, the link moderation value is higher than zero, and you still have this problem, your Spam Words list probably has blank lines, punctuation marks, or single letters between the information in the list. There should be spaces between the listed items or each item must be on its own line. If you have done this, then upgrade the comment spam plugins you have installed. If this continues to be a problem, deactivate the comment spam plugins one by one to determine the culprit and contact the plugin author for help.

Permalink.

Why doesn’t my “Publish” or “Save Draft” button work?

To resolve "Publish" and "Save Draft" button and similar issues, disable your plugins one at a time until you find the source of the issue. Generally, this will be due to two or more plugins trying to use the same resources (for example, JQuery or other Java-based tools).
In addition, it could be that there is a problem with your browser. A common resolution is to empty the browser's cache. Please consult the documentation for your preferred browser to learn how to do this.

Permalink.

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.

Permalink.

Why can’t I see the Quicktag buttons when using Apple’s Safari browser?

In early versions of Safari, the Quicktag buttons would function, but not as intended. This was due to a bug in Safari, not WordPress. Since the WordPress developers had no way of correcting this, they chose to disable the Quicktag buttons for Safari users. At this point in time, there are three alternatives for affected users. One could upgrade to Safari 2.0.4 or higher and WordPress 2.0.7 or higher, use Firefox or Camino, or (for earlier versions of WordPress) remove the if statement on line 1085 and the word "else" on line 1092 of /wp-admin/admin-functions.php .

For example, change this:

function the_quicktags() {
	// Browser detection sucks, but until Safari supports the JS needed for this to work people just assume it's a bug in WP
	if (!strstr($_SERVER['HTTP_USER_AGENT'], 'Safari'))
		echo '
		<div id="quicktags">
			<script src="../wp-includes/js/quicktags.js" type="text/javascript"></script>
			<script type="text/javascript">if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 ) edToolbar();</script>
		</div>
';
	else echo '
<script type="text/javascript">

to this:

function the_quicktags() {
	// Browser detection sucks, but until Safari supports the JS needed for this to work people just assume it's a bug in WP
		echo '
		<div id="quicktags">
			<script src="../wp-includes/js/quicktags.js" type="text/javascript"></script>
			<script type="text/javascript">if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 ) edToolbar();</script>
		</div>
';
		echo '
<script type="text/javascript">

Permalink.

How to Create a Contact Form in WordPress?

There is a free plugin called Contact Form 7 which is great for most basic contact forms.We use this plugin extensively throughout our sites as well as on our client’s site.

Permalink.

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(
    'id'=>'form-id',
    'enableAjaxValidation'=>true,
    'clientOptions' => array(
        'validateOnSubmit'=>true,
        'validateOnChange'=>true,
        'validateOnType'=>false,
    ),
)); ?>

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);

Permalink.

What is Yii?

Yii is a high-performance, component-based PHP framework for developing large-scale Web applications rapidly. It enables maximum reusability in Web programming and can significantly accelerate your Web application development process. The name Yii (pronounced Yee or [ji:]) is an acroynym for "Yes It Is!". This is often the accurate, and most concise response to inquires from those new to Yii:

Is it fast? … Is it secure? … Is it professional? … Is it right for my next project? … Yes, it is!

Permalink.

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;.
Or…
You can use CHtml::link(). This generates a hyperlink tag and encodes & to &amp;.

Permalink.

What if this field is pulled from the database? How do I put in a SELECT list on my add/edit page?

A common situation would be needing a list of countries displayed in a select list, that are pulled from a database table.

Assuming a model named ‘Countries’ (try generating with Gii), the basic code for the view is the following. It makes use of the findAll() method to query all rows in the country database, and CHtml:listData which generates an array of data suitable for list-based HTML elements and the dropDownList function.

echo $form->dropDownList(
    $model,
    'country_id',
    CHtml::listData(Countries::model()->findAll(),'id','name')
);

Permalink.

Stop browsers from auto-completing registration form fields

Firefox can autocompleting the username and password fields on registration forms, and change password forms. To disable this, you can set the FORM attribute autocomplete to off. On your CActiveForm options, you can set this in htmlOptions:

'htmlOptions'=>array('class'=>'reg-form', 'autocomplete'=>'off'),

Permalink.

What are the various Helper classes provided by the Yii ?

There are several classes provided by framework:

  • ArrayHelper
  • Console
  • FileHelper
  • Html
  • HtmlPurifier
  • Image
  • Inflector
  • Json
  • Markdown
  • Security
  • StringHelper
  • Url
  • VarDumper
  • Permalink.

Can I render multiple points to the same map?

Yes, as of version 1.0.4 it is now possible to render multiple points to the same map. This can be accomplished in two ways:

  1. by rendering multiple results to the same container;
  2. by manually specifying the lat/lon where the marker is to be placed.

Example:

$result is an array of GeoCode_Result objects from a Google Driver.

$result[0]->renderMap('map_canvas', array(
    'mapTypeId' => 'ROADMAP',
    'zoom' => 13
));

Render the second result to the same map; note that any options passed to the function will be ignored since this canvas has already been initialized

$result[1]->renderMap('map_canvas');

Render a point manually to that same canvas; note that the arguments are in this order because if no canvas is specified, it defaults to using the last one created

$result[0]->renderPoint($my_lat, $my_lon, 'map_canvas');

Permalink.

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.

Permalink.

How do I render a map?

SUMMARY

The map rendering is handled by the GeoCode_Result class. It uses its own internal render functions to generate the maps. It also requires javascript to be enabled.

MAP TYPES

The map types that are rendered need to be passed to the view. These are constants as defined by the map supplier. Only include the constant name, do NOT include namespaces, etc.

CAVEATS

It is possible to change the map provider that is used for rendering a specific GeoCode_Result by passing an optional 3rd parameter to the renderMap function with the name of the provider. However, because some map APIs (eg. Yahoo) require an API key to validate access, these maps can only be rendered from a Result derived from their respective driver.

Because this extension is using v3 of the Google Maps API, it does not require an API key to access the javascript. Therefore, a google map can be rendered from any Result object. The same can not be said for the other map providers.

USAGE

Place the following code into your view

* Yahoo Map Example *

<div id="map_canvas"></div>
<?php
// $result is a GeoCode_Result object from a Yahoo Driver
$options = array(
    'mapType' => 'YAHOO_MAP_REG'
);
$result->renderMap('map_canvas', $options);
?>

* Google Map Example *

<div id="map_canvas"></div>
<?php
// $result is a GeoCode_Result object from a Google Driver
$options = array(
    'mapTypeId' => 'ROADMAP',
    'zoom' => 13
);
$result->renderMap('map_canvas', $options);
?>

* Google Map with Yahoo Result *

<div id="map_canvas"></div>
<?php
// $result is a GeoCode_Result object from a Yahoo Driver
$options = array(
    'mapTypeId' => 'ROADMAP',
    'zoom' => 13
);
$result->renderMap('map_canvas', $options, 'google');
?>

Permalink.

What is difference between Component and and Object?

Classes of the Yii framework usually extend from one of the two base classes: yii\base\Object or yii\base\Component. These classes provide useful features that are added automatically to all classes extending from them.

The Object class provides the configuration and property feature. The Component class extends from Object and adds event handling and behaviors. Object is usually used for classes that represent basic data structures while Component is used for application components and other classes that implement higher logic.

Permalink.

Zend (57)

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:

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

daemon

Permalink.

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).

Permalink.

How can you set Module name, Controller name, and Action name in Zend framework?

$request->setModuleName(‘front’);
$request->setControllerName(‘address’);
$request->setActionName(‘addresslist’);

Permalink.

What is the expected improvement in performance with Zend Server?

With Zend Server, your apps are already running faster than before. You can squeeze even more performance out of them using the following features:

  • Running jobs using Zend Job Queue allows executing time-consuming jobs asynchronously, removing application bottlenecks and improving end user experience.
  • Using Zend Page Cache speeds up recurring access to PHP pages by caching the entire output of specific URLs.
  • Can't cache the entire page? Use the Zend Data Cache API to avoid computing the same data again and again.

Permalink.

What is the difference between Zend_Auth and Zend_Acl?

Zend_Auth is used for authenticating users with a variety of authentication methods, including LDAP, OpenID, and HTTP. Authentication is the process of verifying that the provided credentials are valid for the system. By authenticating to your system, your users can prove that they are who they say they are.

Zend_Acl is an implementation of Access Control List (ACL) authorization. Generally speaking, ACLs are lists of roles that are authorized to perform a particular operation on specific resources in your system. Zend_Acl can support advanced rule definitions with features such as multiple inheritance for roles and assertions for conditional rules.

Zend_Auth and Zend_Acl can be used together to build very sophisticated security systems: first the user confirms their identity with Zend_Auth, then this identity is used to assign one or more Zend_Acl roles to the user for authorization to use or modify resources in the system.

Permalink.

Why are my dates formatted wrong? Why do I get the false year value?

When using own formats in your code you could come to a situation where you get for example 29.12.2009, but you expected to get 29.12.2008.

There is one year difference: 2009 instead of 2008. You should use the lower cased year constant. See this example:

$date->toString('dd.MM.yyyy');

Note the lower cased "y" which makes the difference and outputs the real year.

Permalink.

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.

Permalink.

How can I make all i18n-aware components aware of my ‘Zend_Translate’ object?

A variety of components are translation aware (i.e., accept Zend_Translate objects), including:

  • Zend_View_Helper_Translate
  • Zend_Validate_*
  • Zend_Form

To have them all use the same Zend_Translate instance, simply place it in the registry with the key "Zend_Translate":

Zend_Registry::set('Zend_Translate', $translate);

Permalink.

Which operating systems does Zend Server support?

Zend Server can be installed on a variety of OS: Windows, Linux distributions, Mac OS X and IBM i.

Permalink.

I want to use a SQL function or perform calculations in a statement I’m generating with Zend_Db_Select. How can I do this?

Actually, by default, if your expression includes parentheses, Zend_Db_Select will cast the statement appopriately. However, if it does not, or you are having problems, you can use Zend_Db_Expr to explicitly create the expression:

/* Build the SQL:
 * SELECT p."product_id", p.cost * 1.08 AS cost_plus_tax
 * FROM "products" AS p
 */
$select = $db->select()
    ->from(array('p' => 'products'),
    array(
        'product_id',
        'cost_plus_tax' => new Zend_Db_Expr('p.cost * 1.08'),
    ));

Permalink.

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