faq.jpg

Android (14)

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.

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.

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.

How does the AOSP relate to the Android Compatibility Program?

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

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

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

Permalink.

What does “compatibility” mean?

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

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

Permalink.

What is involved in releasing the source code for a new Android version?

Releasing the source code for a new version of the Android platform is a significant process. First, the software gets built into a system image for a device, and put through various forms of certification, including government regulatory certification for the regions the phones will be deployed. It also goes through operator testing. This is an important phase of the process, since it helps shake out a lot of software bugs.

 

Once the release is approved by the regulators and operators, the manufacturer begins mass producing devices, and we turn to releasing the source code.

Simultaneous to mass production the Google team kicks off several efforts to prepare the open source release. These efforts include final API changes and documentation (to reflect any changes that were made during qualification testing, for example), preparing an SDK for the new version, and launching the platform compatibility information.

Also included is a final legal sign-off to release the code into open source. Just as open source contributors are required to sign a Contributors License Agreement attesting to their IP ownership of their contribution, Google too must verify that it is clear to make contributions.

Starting at the time mass production begins, the software release process usually takes around a month, which often roughly places source code releases around the same time that the devices reach users.

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 kinds of devices can be Android compatible?

The Android software can be ported to a lot of different kinds of devices, including some on which third-party apps won't run properly. The Android Compatibility Definition Document (CDD) spells out the specific device configurations that will be considered compatible.

For example, though the Android source code could be ported to run on a phone that doesn't have a camera, the CDD requires that in order to be compatible, all phones must have a camera. This allows developers to rely on a consistent set of capabilities when writing their apps.

The CDD will evolve over time to reflect market realities. For instance, the 1.6 CDD only allows cell phones, but the 2.1 CDD allows devices to omit telephony hardware, allowing for non-phone devices such as tablet-style music players to be compatible. As we make these changes, we will also augment Google Play to allow developers to retain control over where their apps are available. To continue the telephony example, an app that manages SMS text messages would not be useful on a media player, so Google Play allows the developer to restrict that app exclusively to phone devices.

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.

CakePHP (18)

List some of the features in Cake php.

  1. Compatible with versions 4 and 5 of PHP
  2. MVC architecture
  3. Built-in validations
  4. Caching
  5. Scaffolding

Permalink.

How cakephp URL looks in address bar?

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

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

What are component, helper and why are they used?

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

Permalink.

Why cakephp have two vendor folder?

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

Permalink.

What is the naming convention in cakephp?

Table names are plural and lowercased,model names are singular and CamelCased: ModelName, model filenames are singular and underscored: model_name.php, controller names are plural and CamelCased with *Controller* appended: ControllerNamesController, controller filenames are plural and underscored with *controller* appended: controller_names_controller.php.

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.

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

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

Permalink.

How can we use ajax in cakephp?

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

Permalink.

Cpanel (87)

How can I forward my old website to my new site?

You can do this with a redirect. To set up a redirect, perform the following steps:

  • Log in to your old site's cPanel interface.
  • Navigate to cPanel's Redirects interface. (Home >> Domains >> Redirects).
  • Set the old site's index page to redirect to the new site's index page.

If you wish for the old site and the new site to go to the same place, but you have not yet set up the new site, you can use a parked domain. A parked domain allows you to add a second domain name to your account that goes to the same website.

Permalink.

How do I restore a full backup file to my server?

To restore a full backup file on a server, use WHM's Restore a Full Backup/cpmove file interface (Home >> Backup >> Restore a Full Backup/cpmove File).

Any of following directories must contain the files that you wish to restore:

/home, /home2, /home3, /root, /usr, /usr/home, /web

Permalink.

How can I manage multiple domains through one cPanel account?

To manage multiple domains with one cPanel account, you can use addon domains.

  • Your account will have a main domain associated with it in order to keep track of the account.
  • You can add more domains with the Addon Domains interface ( Home >> Domains >> Addon Domains).
  • Add the domains outside of your public_html directory in order to keep track of them easily.

Permalink.

How can I back up my complete website to a drive on my computer?

To perform a complete backup of your website, use the Download or Generate a Full Website Backup feature in cPanel's Backups interface (Home >> Files >> Backups).

Permalink.

Is there a website builder in the cPanel interface ?

Yes, it is called WordPress. To install WordPress on your server, navigate to cPanel's Site Software interface (Home >> Software/Services >> Site Software) and select WordPress.

There are also several optional content management systems which your web host can install with WHM's Tweak Settings – cPAddons Site Software interface (Home >> cPanel >> Install cPAddons Site Software). Your web host must enable this option for you to access these content management systems.

Permalink.

Why will my server not resolve domains?

This is usually due to an invalid nameserver setting in the /etc/resolv.conf file.

  • Contact your datacenter for suggested nameservers within their network.
  • You can also add a valid public nameserver to /etc/resolv.conf.

Permalink.

How do I customize my error pages?

You can customize your error pages with cPanel's Error Pages interface (Home >> Advanced >> Error pages).

Permalink.

How can I fix ndc connection refused errors?

To fix ndc connection refused errors, run the following scripts:

/scripts/upcp
/scripts/fixndc
/scripts/fixndc

Permalink.

I need to create a login on my website. How do I accomplish this?

To create a login on your website, use cPanel's Password Protect Directories interface (Home >> Security >> Password Protect Directories). Enable password protection and then add the users to whom you wish to grant access.

Permalink.

Why do I receive groupadd/useradd errors when I attempt to create a new account?

Make sure that your /etc/passwd and /etc/group files do not have the +i (immutable) flag.

Run the lsattr /etc/group and lsattr /etc/shadow commands to check.

If it does have a +i flag, run the following commands:

chattr -i /etc/passwd
chattr -i /etc/group

It is also possible that your group shadow file is corrupt. If this is the case, perform the following steps:
Move the /etc/gshadow file to the  /etc/gshadow.corrupted file.

Run the grpconv file to rebuild the file.

You may need to remove the grshadow.lock and group.lock files. 

Permalink.

CSS (73)

Which characters can CSS-names contain?

The CSS-names; names of selectors, classes and IDs 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. The names cannot start with a dash or a digit. (Note: in HTML the value of the CLASS attribute can contain more characters).

Permalink.

What font units are available in CSS?

When using CSS to define font sizes with the font-size or font style properties you have several options when it comes to font size units:

Relative Font Size Units

  • em
    This is the default font size set in the users' browser preferences. It refers to the width of the letter m in the font used. Font sizes are determined relative to this initial measure.
  • ex
    This refers to the x-height of a font, or the size of the lowercase x in the font. Font sizes are determined relative to this initial measure.
  • pixels (px)
    This refers to the number of pixels in the viewing device. Font sizes are determined relative to the viewing device resolution.

Absolute Font Size Units

  • inches (in)
  • centimeters (cm)
  • millimeters (mm)
  • points (pt)
    In CSS 2, points are equal to 1/72th of an inch.
  • picas (pc)
    One pica is equal to 12 points.

Other Measurement Units

  • absolute sizes
    These are:

    xx-small
    x-small
    small
    medium
    large
    x-large
    xx-large

    These are font sizes defined and computed by the user agent, there is a recommended scaling of 1.2 between the different sizes. For example, if the medium font is 12pt, then the large font would be 1.2 times larger or 14.4pt. These sizes are completely up to the browser viewing the document and provide very little control to the Web designer.

  • relative sizes
    These are:

    larger
    smaller

    These are interpreted relative to the parent element's font size. As with absolute sizes, the user agent controls the actual size of the fonts used.
  • percentage (%)
    A percentage font size specifies a value in direct relation to the size of the parent element.

Permalink.

How Can I Create a Watermark on a Web Page?

Watermarks are easy to create using three CSS style properties:

You use background-image to define the image to use as your watermark, background-repeat to make it display only once, and background-attachment to turn it into a watermark.

Add the following to the HEAD of your Web page. Change the URL to your background image, and you'll have a watermark:

 <style>
 <!--
 body {
 background-image: url(image.gif);
 background-repeat: no-repeat;
 background-attachment: fixed;
 }
 //-->
 </style> 

If you want to place the watermark in a specific location on your Web page (say, the middle of the page), add the background-position property to your style to place the image.

Permalink.

Can I include comments in my Style Sheet?

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

/* This is a CSS-comment */

Permalink.

What is selector?

CSS selector is equivalent of HTML element(s). It is a string identifying to which element(s) the corresponding declaration(s) will apply and as such the link between the HTML document and the style sheet.

For example in P {text-indent: 10pt} the selector is P and is called type selector as it matches all instances of this element type in the document.

In P, UL {text-indent: 10pt} the selector is P and UL (see grouping); in .class {text-indent: 10pt} the selector is .class (see class selector).

Permalink.

How to Examine Your HTML and CSS

In order to determine what is going right or wrong with your web page layout, you have to go to the source. This means looking under the hood.

Under the pretty hood of your web page, the nice layout you see on your Internet browser, is a whole bunch of code with strange and foreign sounding references. At first glance, it's like looking under the hood of a racing car. You know that all of that junk makes the car go, but what the heck is all that mess under the hood?

Viewing HTML

To lift the hood on your page, make sure the page is being viewed from your web browser and from within your web browser's top menu, click VIEW > SOURCE or PAGE SOURCE. Another page will pop-up either inside another browser window or inside of a program that comes with your operating system called Notepad, or some variation thereof. This is your HTML page which structures your page.

Viewing CSS

To view your CSS, either know the actual address (or have it already on your hard drive), or scroll down through the HTML page to the following reference:

<link rel="style sheet" type="text/css" href="wordpress/wp-content/themes/default/style.css">

This is the link that loads in your attached CSS style sheet. To view your CSS, either double click on the file name or type in the specific link to the file in your web browser such as:

http://www.yoursite.com/wordpress/wp-content/themes/default/style.css

In WordPress, PHP is used to actually generate the HTML page. This is often complex and confusing code. To view the HTML, view a generated page, such as a sample post. To make changes in the HTML structure and CSS references, you will need to modify the appropriate PHP file. The Codex page on using themes has more information on how to view your Theme Templates and find out which Template is associated with which section on your page.

The problem-solving techniques herein describe how to change the CSS to influence the layout of the page.

Permalink.

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 property?

Property is a stylistic parameter (attribute) that can be influenced through CSS, e.g. FONT or WIDTH. There must always be a corresponding value or values set to each property, e.g. font: bold or font: bold san-serif.

Permalink.

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.

The CSS Parent and Child Relationship

One of the biggest problems in designing web pages is understanding where a problem occurs and whose influence might be affecting the problem. This is called the "parent/child relationship" of CSS. As you know, while parents usually have their children's best intentions at heart, children often feel intimidated and screwed up by their parents, so understanding this relationship may help you solve your problems.

A WordPress user posted a question on the forum complaining that she wanted her page to feature her header spreading fully across the page's width with the content centered on the page with a lot of space on the left and right sides. She's been poking around with the margins in her header to no avail and turned to us for help.

<div id="page">
	<div id="header">Header Title</div>
 <div id="content">
  		<div class="post">Post babble here...</div>

The CSS attributes for the margins in this example are:

#page { margin-top:5px; margin-right: 100px;
	margin-bottom: 5px; margin-left:100px; }
#header { margin-top:5px; margin-right: 5px; 
	margin-bottom: 5px; margin-left:5px;}
#content { margin-top:5px; margin-right: 20px;
	margin-bottom: 5px; margin-left:20px; }
.post { margin-top:5px; margin-right: 5px; 
	margin-bottom: 5px; margin-left:5px; }

Playing detective with her codes, we found that changing the margins on the header weren't working because they were being influenced by the page margins to begin with. This is where the parent/child relationship shows up. The parent page was telling the child header what to do and it wanted to do something else.

If we changed the right and left margins of page, it eliminated the margin problems for the header. But we've created another problem. The parent page continues its influence and now all of the content is spread across the whole page width. A change needed to also happen with the left and right margins of the content so the wide margins are back in place. To make the whole family happy, the new margins looked like this:

#page { margin-top:5px; margin-right: 5px; 
	margin-bottom: 5px; margin-left:5px; }
#header { margin-top:5px; margin-right: 5px; 
	margin-bottom: 5px; margin-left:5px;}
#content { margin-top:5px; margin-right: 100px; 
	margin-bottom: 5px; margin-left:100px; }
.post { margin-top:5px; margin-right: 5px; 
	margin-bottom: 5px; margin-left:5px; }

Permalink.

HTML5 (14)

Is HTML5 ready for prime time?

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

Permalink.

What is new about HTML5?

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

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.

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.

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.

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.

Are there things in HTML4 that are not in HTML5?

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

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

Java (225)

How do I call more than one JavaScript function in a body tag (or other) event handler?

Simple.  End each function call  with a semi-colon ;

Like this:

<body onload="someFunction();otherFunction();">

or, say, in a mouseover…

onMouseOver="someFunction();otherFunction();"

In JavaScript, the semi-colon is essentially an end-of-line marker.  Within reasonable limits, you can actually write a whole script inside of an event handler.

The same thing applies to the href="javascript:etc" structure.  For instance:

<a href="javascript:someFunction();otherFunction();">
Click Here
</a>

Permalink.

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

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

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

Permalink.

Why isn’t there operator overloading?

Because C++ has proven by example that operator overloading makes code almost impossible to maintain. In fact there very nearly wasn't even method overloading in Java, but it was thought that this was too useful for some very basic methods like print(). Note that some of the classes like DataOutputStream have unoverloaded methods like writeInt() and writeByte().

Permalink.

What tools do I need to sign my applet for Internet Explorer?

You need two programs to sign your code for Internet Explorer. Both programs are available for free at http://www.microsoft.com/java/download/dl_sdk2.htm in the Microsoft Java SDK 2.01.

The two programs are: cabarc.exe – this is similar to pkzip, except it will create cab files instead of zip or jar files. signcode.exe – this program will apply your digital signature to the .cab file

The idea is that you put all you applet files (*.class, *.gif, *.au, etc.) into a cab file, then you sign the cab file.

Permalink.

How do I get the length of a string?

Working with strings under Java is far easier than with other languages. Most languages represent a string as a data type, or as an array of characters. Java however treats strings as an actual object, and provides methods that make string manipulation far easier.

Strings under Java are represented by the java.lang.String class. Since the java.lang package is imported by every Java application or applet, we can refer to it just as String. To determine the length of a String, simply call the String.length() method, which returns an int value.

String aString = "this is a string. what is my length?";
int length = aString.length();

System.out.println (aString);
System.out.println (length);

TIP – Remember that the String class is zero-indexed. Even though the String is of length n, you can only access characters in the range 0..n-1

Permalink.

Can I use spaces in file and/or directory names?

To give a definitive answer to this and put this frequently-asked question to rest: You should *never* use spaces in file or directory names on the Internet.

The use of spaces in file and directory names is strictly a Windows convention — perfectly permissible (and almost encouraged) on desktop boxes running the Windows operating system.  It is also permitted and perfectly functional in Microsoft browsers.

The Internet in general and most servers in specific, however, remain devoted to UNIX-based naming conventions. Aside from some servers still having difficulty with this, older browsers (notably Netscape 4.x and prior) will see a space in a URL as the end of the URL, and truncate (ignore) everything after the space.  For instance, this URL

http://www.somewhere.com/my directory/some page.html

would be seen as

http://www.somewhere.com/my

with the usual result being that older browsers will wind up reporting a Bad Request or a 404 – Not Found.

The usual method of correcting this is to replace the spaces with _ underscores, like this:

http://www.somewhere.com/my_directory/some_page.html

While it is indeed true that Microsoft Internet Explorer and newer Netscape (and some other non-Microsoft) browsers will replace the spaces with %20 and proceed properly, there can still be problems with breaking certain JavaScript scripts, some Perl and PHP scripts, and other services, if spaces are used anywhere in a URL.

Until recently, this could also cause problems with (legitimate) search engines, 'bots, and crawlers; and the situation may remain so with some of them.  A more serious nuisance is off-brand private 'bots and "site downloaders" that haven't the sense to properly interpret a space, and fall into endless loops calling non-existent pages on your site thousands of times at relatively high frequency — often burning enormous bandwidth and potentially causing server problems.

In view of these considerations, if you have spaces in directory or file names, it's wise to correct them as noted above — sooner rather than later!

Permalink.

When should I use an InputStream, and when should I use a Reader?

This can be confusing, particularly if you're already familiar with InputStream, and keep getting deprecated API warning messages. Let me simplify it for you.

  • If you're reading data, such as bytes of information, you are best off to use InputStreams and DataInputStream in particular.
  • If you're reading in text, and want to be able to call a readLine() method, its best to use Readers, and BufferedReader in particular.

So what's the difference? Well, DataInputStream's readLine() method is deprecated, because of problems with this method. Readers offer an alternative – though placing a readLine() method in a BufferedReader still seems a little odd to me. Whether its buffered or not has little to do with the fact it can read lines of text – but its easy enough to live with.

Permalink.

I’m trying to compile a Java source file, and get the error message “bad command or filename”. What did I do wrong?

This is a VERY frequently asked question. You need to add a path statement in your autoexec.bat file on windows to allow the javac.exe program to be found.

For example, if you installed java to the c:\java\ directory, you'd add the following to autoexec.bat

set path=%path%;c:\java\bin\

Hint: change the path to your installation dir (e.g. c:\jdk1.1.7\bin)

Remember to rerun the autoexec.bat file or reboot before trying to compile again, or the path setting will not be acted upon.

Permalink.

What does the keyword ‘static’ mean?

The static keyword denotes that a member variable, or method, can be accessed without requiring an instantiation of the class to which it belongs.

In simple terms, it means that you can call a method, even if you've never created the object to which it belongs! Every time you run a stand-alone application (which requires a static main method), the virtual machine can call the main method without creating a new application object. Of course, unless the application's methods are all static, you will need to create an instance of it at some point.

With regard to member variables, it means that they can be read from, and written to, without creating an object. You may have noticed that many classes create constants that can be read, without creating an object.

static final int VERSION = 2;

Static member variables are shared by all instances of the class to which they belong. When writing classes, this can be a handy feature. Consider the following example, where a counter is used to track how many myObject instantiations have taken place.

public class myObject
{
	static int objectCount = 0;

	public myObject()
	{
		objectCount++;
	}

	public String toString()
	{
		return new String ("There are " + objectCount + " objects");
	}
}

As each new myObject is created, the counter increments. If you were writing an Internet server application, you could track how many concurrent connections existed (remembering that you'd have to include in the destructor or at the end of the connection code a decrement to your count). When used correctly, static member variables and methods can be quite useful!

Permalink.

How do I change the thickness of the line?

Java 1.1 and earlier only support 1 pixel wide lines. There's no easy way around this. You can, however, draw multiple, parallel lines offset from each other by one pixel:

  public void paint(Graphics g) {

    int x1=5;
    int x2=278;
    int y1=8;
    int y2=93;
    

    // Draw a ten pixel thick line
    for (int i = -5; i < 5; i++) {
      g.drawLine(x1+i,y1+i,x2+i,y2+i);
    }

  }

This isn't perfect. The ends of the line are excessively tapered. You really need to take the slope of the line into account when incrementing x and y, but this should give you the idea. If you're doing a lot of this, you can write a class or method to do it for you.

There are other hacks you can use. For example, a thick line is essentially a filled rectangle. Therefore you can calculate the endpoints of the rectangle and use fillPolygon() to draw it.

The real solution is going to have to wait for a more complete graphics API for Java, possibly in Java 1.2.

Permalink.

Joomla (200)

How do you install an extension?

Before starting it always is wise to read the documentation associated with an extension. Most extensions have homepages and forums, and it is a good idea to look at them first. If there is a README file included with the extension, you should read it.

For most extensions and most users, the procedure will be:

  • Download the extension to your local machine as a zip file package.
  • From the backend of your Joomla site (administration) select Extensions -> Install/Uninstall.
  • Click the Browse button and select the extension package on your local machine.
  • Click the Upload File & Install button.
  • Some extensions may provide further instructions on installation.
  • Note that modules and plugins must be enabled before they will work.

There are some situations in which this procedure will not work.

Sometimes you need to unzip the file locally prior to installing. If you get an error saying that the file is not in the correct format, the need to unzip is a common cause of this. After unzipping try installing the individual items. Note that the files you upload using the installer still need to be zipped.

Sometimes you cannot use the automated installer. For example, very large extensions may exceed the maximum upload size allowed by your host.

Also, If you see an error like this:

Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/) is not within the allowed path(s): ...

this is because of a restriction of your hosting account which leads Joomla! to try to check if the root directory exists. You will not be able to use the automated installer.

Permalink.

Why do the pop ups in my WYSIWYG editor not work or show gibberish?

Depending on the editor, this problem may occur when trying to edit the html, insert tables or perform a similar function that requires javascript.

Most likely the problem with the livesite…

You look in your site configuration (General Configuration, select the Server tab) you will see that the livesite is given. Usually it is either www.mydomain.com or mydomain.com.

When you log into your site, you must log in from the exact livesite. if you don't the javascript in your editor will not work.

One way to deal with this is to put a redirect from, for example, mydomain.com to www.mydomain.com so that you and your users always login from the correct url. You can do this with .htaccess.

Permalink.

To customise the information shown in the Login Form module

The information shown in the Login Form module can be customised from the Module Edit screen. The following list describes the various settings that will change the appearance of the Login Form module.

  • Title: Changes the title shown for the Login Form module if Show Title is set to Yes. The default is "Login Form".
  • Show Title:
    • If Yes then the Title will be shown at the top of the Login Form. This is the default.
    • If No then the Title will not be shown at the top of the Login Form.
  • Pre-text: This text will be shown above the Login Form but below the Title. It may contain HTML markup.
  • Post-text: This text will be shown below the Login Form. It may contain HTML markup.
  • Greeting:
    • If Yes then a simple greeting message is shown above the Logout button once the user is logged in. For example, it might say "Hi, Joe Bloggs". This is the default.
    • If No then no greeting message is shown above the Logout button.
  • Name/Username: Determines whether the user's real name or the user's username is shown as part of the simple greeting message.
Additionally, the "Create an account" link will only be shown if the Allow User Registration field in Global Configuration is set to Yes.

Permalink.

Help! My site’s been compromised. Now what?

Directions

  • Change all relevant passwords: Assume your passwords have been harvested and immediately change all critical passwords, including shell access, FTP access, Joomla! Administrator accounts, and the database account.
  • Check raw logs: Identify when and how the attackers gained access to your site by carefully reviewing your raw server logs. Make careful note of the date/time and names of attacked files. Note that these logs may have been deleted or altered, so a lack of evidence does not prove a lack of activity.
  • List recently modified files: Before making any changes to your site, generate a list of recently modified files. Here's a php script that will list the files for you. Remove this script as soon as you have your list and don't publish a link to it!
  • Note suspicious newly-created files: Use this list to identify new files that don't belong. Pay particular attention to their creation and modification dates, and correlate them to the dates of attacks shown in your log files.
  • Note suspicious recently-modified files: Check the modified files list for any files that were recently changed. Pay particular attention to the modification, and correlate them to the dates of attacks shown in your log files.
  • Check for bogus CRON Jobs: Hacked cron jobs can be setup to reinfect your site over and over again.
  • Coordinate with your host: If you have identified how you were cracked, report the method to your host. If you are on a shared server, you may have been attacked through another vulnerable site on your server. Report this to your host. A reputable host will appreciate your efforts in this area.
  • Delete the entire public_html directory: This is the best way to guarantee that every potential vulnerability in that site is removed.
  • Delete related database records: This step may only be possible if you have good backups. Simple script kiddies, who are only trying to mark your index page, may not attack your database, but professionals are usually very interested in confidential data, such as passwords. They may pose as script kiddies to avoid suspicion while repeatedly harvesting confidential information from your database.
  • Reinstall everything: Use pre-crack backups. If you don't have good backups, reinstall everything anyways.
  • Reset critical passwords again: You must reset your passwords again now that your server is finally cleaned of any possible hidden trojan horses.
  • Rebuild site: If you are unable to rebuild from clean backups, rebuild your entire site using original, pre-crack installs. Use only the latest stable versions of all software, and check the List of Vulnerable Extensions
  • Review security processes: Follow standard security precautions for important settings in php.ini, globals.php, configuration.php, .htaccess, etc.
  • Review backup processes: If you don't already have one, add a dependable backup process to your site administration practices.
  • Stay watchful: Attackers often return repeatedly. Closely monitor your raw logs for suspicious activity.

Permalink.

How can you check your Joomla! installation’s overall security and health?

Use the free Joomla extension, Joomla! Tools Suite (JTS), which is a Joomla! environment audit, maintenance and diagnostic application written in PHP. The JTS suite of tools can diagnose, report and advise on common installation, health and security issues, including performing several common performance and recovery actions.

Permalink.

What is the calculation for an extension to be ‘Top Rated’?

An extension has to have at least 15 votes to be eligible to be listed as Top Rated Extension. Top Rated extensions are ordered by the average rating given by users.

Permalink.

How is ‘Most Reviewed’ list calculated?

Extensions with the highest number of reviews are listed in Most Reviewed.

Permalink.

How to write a new Article in Joomla 3.0

  1. Step 1: Log into your Joomla 3.0 dashboard
  2. Step 2: From here, you have two options:
     

    Option 1 – use QUICK ICONS Option 2 – Use the top menu
    In the right menu under QUICK ICONS, click Add New Article.
    In the top menu, click Content and then click Article Manager. Then, click New in the top left.
  3. Step 3: On the article editor page, enter a Title for your article and choose a Category next to that. Then, enter the content for your article beneath. Refer to our screenshot below:
  4. Step 4: When finished writing your article, click the Save button in the top left menu. You should receive the following message:

    Message
    Article successfully saved

Permalink.

What are the best practices for site backups?

There are three traditional backup types–full, cumulative and differential.

Full Backups

A complete backup of all associated files and database at a known point in time.
Both of these are considered Incremental backups, they can be used independently of each other or in conjunction with each other but always relate back to a FULL backup.

Cumulative Backups

This is a backup of the differences since the last FULL backup, so each cumulative backup gets bigger each cycle as it is also backing up data previously backup, since the last FULL backup.

Incremental Backups

This is a backup of the changes since the previous backup of any type, i.e., full, cumulative, or incremental.
If you site is not too large, then FULL backups are the way to go, once a week at least. If your content changes quite regularly or more importantly cannot be recreated or is too costly to recreate, once a night or more may be more effective.
If time, server resources, or the rate of data change is too high to successfully obtain a FULL backup every night then the incremental backups are needed.
If you choose to use a cumulative backup following a weekly full, the backups each night will run quicker than a full backup, however as the week progresses, each nightly cumulative backup will increase in size and time, due to not only backing up the changes since last night's backup, but it also backing up all changes each night and previous nights since the last full backup was made. The benefit of this type of backup, in conjunction with full backups is the speed of restoration. To restore, you now only need to recover the most recent full and cumulative backups to fully recover all information.
If time or server resources are paramount or data change overwhelms cumulative backups, turn to differential backups, this style of backup when used in conjunction with a full backup will provide a very similar level of protection, but restoration will be slower. Differential backups will only backup changed data since the last backup of any type, not since the last full backup, as with a cumulative backup. Thus, when restoring data, you will need to recover the full backup, then each differential backup in turn (oldest first) in order to fully recover all information. This method also has the drawback of recovering any legitimately deleted files, potentially "over-filling" the file-system.

Data Protection Best Practice says

  1. You should be able to completely recover from a catastrophic failure from at least two previous full backups. Just in case the most recent full backup is damaged, lost, or corrupt.
  2. A good backup regime should contain at least one full backup within a chosen cycle, normally weekly.
  3. A good backup practice is to store backups away from the current data location, preferably off site.
  4. Dynamic data should be backed up offline or hot to avoid fuzzy backups (data is changing as you back it up, potentially leading to related information not being in sync when backed up.
For the average Web site, a daily or weekly full backup of both site files and database records is normally more than enough. Keeping a number of backups for a period of time is always a good plan, maybe keep each weekly backup for one month. This allows you to recover an old site in the case of emergencies or if for some reason you have local backup file corruption.
There are many PHP and Perl scripts on the Web that can be automated through CRONTAB and can either email (if small enough) or FTP the backup files to an off- or cross- server location. Remember that to some degree with Joomla! you already have an instant backup of the core files, if you haven't modified core, the Joomla! distribution files can be easily restored. Then you need only worry about backing up changed files and the database.

Permalink.

How do I recursively adjust file and directory permissions?

Using Joomla! Administration

In the Back-end, go to Site –> Global Configuration –> Server.

Using the UNIX shell

Note: The find command automatically assumes that it should start from the current directory. To be safe, go to your public_html directory and specify a path as the first argument. Some shells, such as bash on Apple OS X, must have a path specified in the find command.

find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
chmod 707 images
chmod 707 images/stories
chown apache:apache cache

Notes:
 

  • Test all third party extensions after changing permissions.
  • You may need to reset write permissions to install more extensions.

 

Permalink.

Magento (57)

How will you add/remove content from core’s system.xml file?

You can do that by overriding system.xml configuration. Examples:

<config>
    <sections>
        <catalog>
            <groups>
                <frontend>
                    <label>Overriding Catalog Frontend in system config</label>
                </frontend>
            </groups>
        </catalog>
    </sections>
</config>
<config>
   <sections>
        <payment>
            <groups>
                <cashondelivery>
                    <fields>
                       <!--changing cashondelivery payment method settings-->
                    </fields>
                </cashondelivery>
            </groups>
         </payment>
    </sections>
</config>

 

Permalink.

How Magento ORM works?

ORM stands for Object Relational Mapping. It’s a programming technique used to convert different types of data to Objects and vice versa.

In Magento, ORM is shown as Model (based on Zend Framework’s Zend_Db_Adapter), which further breaks down to two types of Models.

– First is the “simple” i.e. Regular Models which is nothing but flat table or our regular table structure.

– Second Model is EAV (Entity Attribute Value), which is quite complicated and expensive to query.

All Magento Models interacting with database are inherited from Mage_Core_Model_Abstract class, which is further inherited from Varien_Object.

Difference between two Models is, Simple Model is inherited from Mage_Core_Model_Resource_Db_Abstract> class,

while EAV is inherited from Mage_Eav_Model_Entity_Abstract.

For those who don’t know what EAV is, please read my 3rd answer below.

So, to end up this question,

when you want to get some data in Magento, you call it like this:

Mage:getModel('module/model')->load(1);

where 1 is the primary key id for some Regular/Simple table, while in EAV so many tables are joined to fetch just single row of data.

Permalink.

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.

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 is an acceptable page load time?

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

Permalink.

How to Make Mass Product Changes in Magento?

Important aspect of Magento store running is meticulous planning and ongoing product catalog monitoring and maintaining. Dynamic and organized Magento product catalog creating demands online entrepreneurs to be constantly involved in Magento product update accomplishment.
To maximize the efficiency and productivity of Magento products management and set accurate store content, it’s obligatory to recline upon robust data arranging tool. Store Manager for Magento has built-in Multi Editor tool, which is committed to provide efficient Magento product update.
 
Store Manager for Magento Multi Editor extension foresees modification of large amount of data at once. Just in a few clicks Magento user can carry out Magento update price operation, change Magento product quantity, status, description, etc. It’s extremely convenient and advantageous to manage Magento products and inventory via Multi Editor tool.
What are main peculiarities of Multi Editor functionality and what entities can be managed via it?
The extension consists of two sections: Products Multi Editor and Inventory Multi Editor
Products Multi Editor section allows to modify all products related information – description, prices, images, etc
By means of Inventory Multi Editor you can efficiently manage products inventory – update Magento products quantity, control products status, change the minimum quantity of products for status to be “Out of stock”, etc
All the necessary alterations can be implemented either to one or numerous items selected from Magento products list
It’s possible to do database backup before changing data with Store Manager for Magento Multi Editor tool and resort to data recovery, on condition that incorrect modifications were brought to Magento data.
 
The mechanism of modifications bringing is easy and approachable. For example, one needs to perform Magento update price operation. Required products has to be chosen, after this Magento user should choose “Products Multi Editor” option from products toolbar. In the window appeared a shopkeeper should enter new products price or resort to Expression option and change the price value by means of the rule applied. There should be checked the box in front of the field one has to update. Having pressed the “Ok” button, one can see the progress bar on the screen, displaying the course of the process.
Multi Editor is a perfect instrument, which helps to maintain product catalog when online store is up and running. It ensures smooth Magento product update performing and contributes to creating accurate store content.

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.

What causes a page to load slowly?

There are many causes to slow page load times including poor server configuration and images that are too large and have to be re-sized by a browser.

Permalink.

Is any core code or templates overwritten?

Overwriting core code is at the heart of many performance problems and can lead to problems when making any upgrades in functionality (new extensions or when moving to a new version of the platform).
To ensure that you are getting the most out of Enterprise Edition, make sure you are working with a certified Magento developer. Developers spend hundreds of hours learning the Magento code in order to become certified and show their dedication to the Magento platform by taking (and passing) a rigorous test.

Permalink.

How to set up log cleaning in Magento

In order to make sure that your Magento is not being slowed down by a huge amount of old log records, it is recommended that you set up its log cleaning function to automatically purge old logs.

You can do this from the Magento admin area > System > Configuration > Advanced section > System > Log Cleaning. Once there, modify the value for Save Log, Days. The default value is 180 but we recommend changing it to 60 or even 30 days. Then set Enable Log Cleaning to Yes and click Save Config to save the changes.

Note that the Log Cleaning functionality depends on the Magento cron. You need to make sure you have set up the cron in order for your log cleaning to work properly.

Permalink.

Magento Go (14)

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

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

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.

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.

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

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.

What are Add-ons?

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

Permalink.

Do You Charge a Set Up Fee for Magento Go?

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

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.

Can I Customize The Design of My Store?

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

Permalink.

MySQL (116)

What is MySQL?

Prided for its cost-effective delivery of high performance eCommerce on a large scale, MYSQL is a relational database management system (RDBMS) that performs as a server. Used to populate website content, MYSQL is widely used.

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

What is query cache in MySQL?

MySQL server from version 4.0.1, has introduced Query Cache. When the Query Cache is enabled, the Query Cache stores the each SELECT query text and its corresponding result. Later on, if an identical query is received, MySQL trieves the results from the query cache instead of parsing and executing that query. When to use Query Cache

The query cache is extremely useful when your application executes a particular query again and again and tables don't change very often. MySQL caches the result, thereby avoiding the overhead of running through data over and over and thereby increase the execution time. In case your tables change very often or if your queries are textually different every time, the query cache may result in a slowdown instead of a performance improvement.

How to enable Query Cache

Query caching can be enabled by setting the server variables query_cache_type, query_cache_size, and query_cache_limit. If any of these three variables is set to 0, query caching will be disabled.

  1. query_cache_type This variable has three status which can be set as follow:

    1. query_cache_type = 0 // disabled
    2. query_cache_type = 1 // enabled (except SELECT SQL_NO_CACHE … queries)
    3. query_cache_type = 2 // enabled but works on demand (cache only SELECT SQL_CACHE … queries)
  2. query_cache_size The memory allocated to store results. In case of 0, the query cache is disabled. query_cache_size needs a minimum size of about 40KB to allocate its structures.
  3. query_cache_limit The results bigger than this are not cached. (Default 1M).

How to set Query Cache Type

query_cache_type can be set at both GLOBAL level and SESSION (user) level. Setting the GLOBAL query_cache_type value determines query cache behavior for all clients that connect after the change is made. Each client can also control cache behavior for his own connection by setting the SESSION query_cache_type value. Take the following two examples, one for GLOBAL level and second for SESSION level:

SET GLOBAL query_cache_type = 1; //Enable query cache for all clients
SET SESSION query_cache_type = 0; //Disable query cache for current client

How to set Query Cache Size

query_cache_size is global variable that accepts numberic value and considers that as bytes. query_cache_size value can be set by SET GLOBAL statement like below:

SET GLOBAL query_cache_size = 46080; //45KB

Some Sample of Query Caching

After enabling query cache, if you do not want the result of a particular query to be cached, you can specify by SQL_NO_CACHE parameter like below:

SELECT SQL_NO_CACHE book_id, book_name FROM books WHERE auhor_id = 9;

After execution of the above query, the result will be added to the cache memory and will be used if the same query is executed again.

How to check Query Cache Status

You can check query cache status variables by SHOW STATUS statement like below:

SHOW STATUS LIKE "Qcache%";

You can defragment the query cache by the following command:

FLUSH QUERY CACHE;

Some Facts about Query Caching

Query cache works in case-sensitive mode. So the following queries will be cached separately:

SELECT * FROM books WHERE auhor_id = 9;
select * from books WHERE auhor_id = 9;

In some cases queries are not cached. Any query making use of the following functions will not be cached:

  • User-Defined Functions
  • GET_LOCK
  • MASTER_POS_WAIT
  • CURRENT_TIMESTAMP
  • CURTIME
  • ENCRYPT (with one parameter)
  • UNIX_TIMESTAMP (without parameters)
  • CONNECTION_ID
  • RELEASE_LOCK
  • NOW
  • CURDATE
  • CURRENT_TIME
  • LAST_INSERT_ID
  • USER
  • FOUND_ROWS
  • LOAD_FILE
  • SYSDATE
  • CURRENT_DATE
  • DATABASE
  • RAND
  • BENCHMARK

Also the following type of queries will not be cached

  • queries contains user variables
  • queries references the mysql system database
  • queries like below:
    1. SELECT … IN SHARE MODE
    2. SELECT … FOR UPDATE
    3. SELECT … INTO OUTFILE …
    4. SELECT … INTO DUMPFILE …
    5. SELECT * FROM AUTOINCREMENT_FIELD IS NULL

Before a query result is fetched from the query cache, MySQL checks that the user has SELECT privilege for all databases and tables involved. If this is not the case, the cached result is not used.

How to clear Query Cache
MySQL clear the query cache automatically whenever a change is made to the table. So any statement like INSERT, UPDATE, DELETE, TRUNCATE, ALTER, DROP TABLE or DROP DATABASE will clear the cache. However, MySQL also provides RESET QUERY CACHE command to clear query cache manually.

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.

What is difference between ON Clause and WHERE Clause?

There is little difference between them. The ON Clause works just like a WHERE Clause but the ON Clause is specific to a JOIN condition. If you need to, you can add extra conditions to the ON Clause using AND, just as you can with WHERE Clause.

Permalink.

How do I fix the following error SQL/DB Error errcode 13 Can’t create/write to file?

The MySQL variable tmpdir is set to a directory that cannot be written to when using PHP to access MySQL.

To verify this, enter MySQL at the command line and type show variables

You'll get a long list and one of them will read: tmpdir = /somedir/ (whatever your setting is.)

Solution: Alter the tmpdir variable to point to a writable directory.

Steps:

  1. Find the my.cnf file. On *nix systems this is usually in /etc/.

  2. Once found, open this in a simple text editor and find the [mysqld] section.

  3. Under this section, find the tmpdir line. If this line is commented (has a # at the start), delete the # and edit the line so that it reads: tmpdir = /writable/dir where /writable/dir is a directory to which you can write. Some use /tmp, or you might also try/home//

  4. Save the file.

  5. Shutdown MySQL by typing mysqlshutdown -u -p shutdown

  6. Start MySQL by going to the MySQL directory and typing ./bin/safe_mysqld &. Usually the MySQL directory is in/usr/local or sometimes in /usr/ on Linux systems.

If none of this make sense and you have someone to administrate your system for you, show the above to them and they should be able to figure it out.

Permalink.

How to skip repeating values from the query results?

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

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

Permalink.

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

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

SELECT ab_1.ab_author_id, ab_1.ab_book_id
FROM author_books ab_1
INNER JOIN
(

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

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

Permalink.

OsCommerce (22)

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

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

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

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

In order to disable the SSL you will have to replace

		define(‘ENABLE_SSL’, true);
	

with

		define(‘ENABLE_SSL’, false);
	

Permalink.

How do I change the title in my shop?

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

	define('TITLE', 'osCommerce');

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

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

Permalink.

How do I add a new page to my shop?

To add a page, first make a copy of the privacy file in the root directory (the same directory that the index.php file is in). Rename that copy to about_us.php .
Open that file and replace all occurrences of FILENAME_PRIVACY with FILENAME_ABOUT_US .
Next, make a copy of the includes/languages/english/privacy.php file and name it about_us.php .
Open that file and change all occurrences of Privacy Notices to About Us.
Open the includes/filenames.php file and add the following line anywhere before the ending ?>
define('FILENAME_ABOUT_US', 'about_us.php');
Add a link somewhere on your home page to the about us page and you are all done.

Permalink.

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

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

Lets get rid of the "Top"

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

$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);

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

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

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

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

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

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

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

define('HEADER_TITLE_TOP','Top');

And change it too:

define('HEADER_TITLE_TOP', 'Home');

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

Permalink.

I don’t see LinkPoint as an option during checkout

You need to log into the administration for Oscommerce, the following is an example URL address:
http://www.website.com/catalog/admin/modules.php
Click on Modules Click on LinkPoint, then connect and click on the edit button. Make sure payment zone is set to "None".

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 can I see the exact version of my osCommerce?

In order to check the version of your osCommerce, you should open theincludes/application_top.php file located in your osCommerce installation folder.

Look for these two lines:

	// define the project version
  define(‘PROJECT_VERSION’, ‘osCommerce Online Merchant v2.2 RC2a‘);

The value after PROJECT_VERSION defines your current osCommerce version.

Permalink.

Page displays unexpected T_STRING

Php uses apostophes ( ' ) as control characters. If it encounters one where it shouldn't be, an error is generted. When writing text for a page, many people use contractions like what's instead of what is. The apostrophe in what's will cause this failure since the php code wasn't expecting to find it there. To get around this, add a backward slash (\) before the apostrophe so that it is what\'s. The file the error is in and the line number it is on, is given in the error. It will be something like: Page displays unexpected T_STRING in /home/some path/some_file.php on line X, meaning, in this example, the error is in some_file.php at line X.

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

PHP (126)

I have followed all the steps to install the Apache module version on Unix, and my PHP scripts show up in my browser or I am being asked to save the file.

This means that the PHP module is not getting invoked for some reason. Three things to check before asking for further help:

  • Make sure that the httpd binary you are running is the actual new httpd binary you just built. To do this, try running: /path/to/binary/httpd -l If you don't see mod_php4.c listed then you are not running the right binary. Find and install the correct binary.
  • Make sure you have added the correct Mime Type to one of your Apache .conf files. It should be: AddType application/x-httpd-php .php Also make sure that this AddType line is not hidden away inside a <Virtualhost> or <Directory> block which would prevent it from applying to the location of your test script.
  • Finally, the default location of the Apache configuration files changed between Apache 1.2 and Apache 1.3. You should check to make sure that the configuration file you are adding the AddType line to is actually being read. You can put an obvious syntax error into your httpd.conf file or some other obvious change that will tell you if the file is being read correctly.

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.

Explain type of inheritance that php supports.

PHP supports single inheritance. Using the extend keyword A class can inherit methods and members of another base class (only one).

Permalink.

I’m trying to use an tag, but the $foo.x and $foo.y variables aren’t available. $_GET[‘foo.x’] isn’t existing either. Where are they?

When submitting a form, it is possible to use an image instead of the standard submit button with a tag like:

<input type="image" src="image.gif" name="foo" />

When the user clicks somewhere on the image, the accompanying form will be transmitted to the server with two additional variables: foo.x and foo.y.

Because foo.x and foo.y would make invalid variable names in PHP, they are automagically converted to foo_x and foo_y. That is, the periods are replaced with underscores. So, you'd access these variables like any other described within the section on retrieving variables from external sources. For example, $_GET[‘foo_x’].

Permalink.

How can I run COM object from remote server ?

Exactly like you run local objects. You only have to pass the IP of the remote machine as second parameter to the COM constructor.

Make sure that you have set com.allow_dcom=<TRUE in your php.ini.

Permalink.

How much work and time will this take?

If your web host provides the alternative, moving from PHP 4 to PHP 5 should be painless and fast. If there are problems with WordPress Themes, Plugins, and other scripts and PHP code, it could be more work, though most are updated by now. In most cases, though, it is as simple as clicking a button or two and waiting for it to happen.

Permalink.

When running PHP as CGI with IIS, PWS, OmniHTTPD or Xitami, I get the following error: Security Alert! PHP CGI cannot be accessed directly..

You must set the cgi.force_redirect directive to 0. It defaults to 1 so be sure the directive isn't commented out (with a ;). Like all directives, this is set in php.ini

Because the default is 1, it's critical that you're 100% sure that the correct php.ini file is being read. Read this faq for details.

Permalink.

Where is my document root?

The location of your default Zend Server document root depends on the operating system and the Web server you are using:

For Windows

If Zend Server is running on Microsoft IIS – C:/inetpub/wwwroot

If Zend Server is running on Apache – C:/Program Files/Zend/Apache2.2/htdocs

If you changed the location of your Zend Server installation, your document root will be located at <Zend_Server_installation_directory>/Apache2.2/htdocs , where <Zend_Server_installation_directory&gt ; is the location of the directory in which your Zend Server is installed.

For Linux

the location of your document root is defined by your distribution's Apache packages, and will vary depending on your distribution and configuration.

Common locations include:

  • Debian, Ubuntu – /var/www
  • Fedora Core, RHEL, CentOS, Oracle Enterprise Linux – /var/www/html
For Mac OS X

/usr/local/zend/apache2/htdocs

Permalink.

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

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

Note: directive note: magic_quotes_gpc

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

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.

PhpMyAdmin (120)

My server is crashing each time a specific action is required or phpMyAdmin sends a blank page or a page full of cryptic characters to my browser, what can I do?

Try to set the $cfg['OBGzip'] directive to false in your config.inc.php file and the zlib.output_compression directive to Off in your php configuration file.

Permalink.

I see a lot of databases which are not mine, and cannot access them.

You have one of these global privileges: CREATE TEMPORARY TABLES, SHOW DATABASES, LOCK TABLES. Those privileges also enable users to see all the database names. So if your users do not need those privileges, you can remove them and their databases list will shorten.

Permalink.

Why can’t I display the structure of my table containing hundreds of columns?

Because your PHP’s memory_limit is too low; adjust it in php.ini.

Permalink.

I want to understand some Export options.

Structure:

  • “Add DROP TABLE” will add a line telling MySQL to drop the table, if it already exists during the import. It does NOT drop the table after your export, it only affects the import file.
  • “If Not Exists” will only create the table if it doesn’t exist. Otherwise, you may get an error if the table name exists but has a different structure.
  • “Add AUTO_INCREMENT value” ensures that AUTO_INCREMENT value (if any) will be included in backup.
  • “Enclose table and column names with backquotes” ensures that column and table names formed with special characters are protected.
  • “Add into comments” includes column comments, relations, and MIME types set in the pmadb in the dump as SQL comments (/* xxx */).

Data:

  • “Complete inserts” adds the column names on every INSERT command, for better documentation (but resulting file is bigger).
  • “Extended inserts” provides a shorter dump file by using only once the INSERT verb and the table name.
  • “Delayed inserts” are best explained in the MySQL manual – INSERT DELAYED Syntax.
  • “Ignore inserts” treats errors as a warning instead. Again, more info is provided in the MySQL manual – INSERT Syntax, but basically with this selected, invalid values are adjusted and inserted rather than causing the entire statement to fail.

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.

When using HTTP authentication, a user who logged out can not log in again in with the same nick.

This is related to the authentication mechanism (protocol) used by phpMyAdmin. To bypass this problem: just close all the opened browser windows and then go back to phpMyAdmin. You should be able to log in again.

Permalink.

How can I use the zoom search feature?

The Zoom search feature is an alternative to table search feature. It allows you to explore a table by representing its data in a scatter plot. You can locate this feature by selecting a table and clicking the Search tab. One of the sub-tabs in the Table Search page is Zoom Search.

Consider the table REL_persons in 6.6 How can I use the relation table in Query-by-example? for an example. To use zoom search, two columns need to be selected, for example, id and town_code. The id values will be represented on one axis and town_code values on the other axis. Each row will be represented as a point in a scatter plot based on its id and town_code. You can include two additional search criteria apart from the two fields to display.

You can choose which field should be displayed as label for each point. If a display column has been set for the table (see 6.7 How can I use the “display column” feature?), it is taken as the label unless you specify otherwise. You can also select the maximum number of rows you want to be displayed in the plot by specifing it in the ‘Max rows to plot’ field. Once you have decided over your criteria, click ‘Go’ to display the plot.

After the plot is generated, you can use the mousewheel to zoom in and out of the plot. In addition, panning feature is enabled to navigate through the plot. You can zoom-in to a certail level of detail and use panning to locate your area of interest. Clicking on a point opens a dialogue box, displaying field values of the data row represented by the point. You can edit the values if required and click on submit to issue an update query. Basic instructions on how to use can be viewed by clicking the ‘How to use?’ link located just above the plot.

Permalink.

I get the error “navigation.php: Missing hash”.

This problem is known to happen when the server is running Turck MMCache but upgrading MMCache to version 2.3.21 solves the problem.

Permalink.

Transformations: I can’t enter my own mimetype! For what is this feature then useful for?

Defining mimetypes is of no use, if you can’t put transformations on them. Otherwise you could just put a comment on the column. Because entering your own mimetype will cause serious syntax checking issues and validation, this introduces a high-risk false- user-input situation. Instead you have to initialize mimetypes using functions or empty mimetype definitions.

Plus, you have a whole overview of available mimetypes. Who knows all those mimetypes by heart so he/she can enter it at will?

Permalink.

I have display problems with Safari.

Please upgrade to at least version 1.2.3.

Permalink.

Prestashop (10)

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

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.

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.

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.

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

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.

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.

Responsive Website Design (22)

What is px?

Px stands for pixels, which represent the width of a particular device.

Permalink.

What about older browsers?

For older versions of browsers, such as those of IE JavaScript based solutions – such as respond.js and modernizr – are available.

Permalink.

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.

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

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

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

Permalink.

How long will it take to launch my responsive website after the initial meeting?

While time frames vary depending on the scope of the project, on average it takes about 3-4 weeks to create a responsive website.

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.

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.

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.

SEO (7)

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.

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.

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

Sugar CRM (41)

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.

How secure is Sugar?

Sugar is only as secure as your users make it. We do everything we possibly can to ensure the security of your data, but ultimately security comes down to passwords. Sharing passwords, or using simple words as passwords is asking for trouble. Ideally, you should use a strong password consisting of a minimum of 8 characters, including upper and lowercase letters, plus numbers.

Permalink.

Why can’t I delete a user?

To preserve data associated with a user, there is no option to delete a user. However, you may change a user's status to Inactive, which prevents them from logging in. To change a user's status to Inactive, follow these steps:

1) Login as an administrator
2) Click the Admin link in the top-right corner
3) Click User Management
4) Click the username you'd like to set as Inactive
5) Select Inactive from the Status dropdown
6) Press Save to confirm your changes

Permalink.

What SugarCRM product does the GPL v3 affect?

Sugar Community edition (formally known as Sugar Open Source). Only Sugar Community edition (starting with the 5.0 release) is affected by GPL v3. Sugar Professional and Sugar Enterprise editions are both offered under commercial licenses, and are thus not affected by this license. SugarCRM's on-demand customers are also not affected by the GPL v3.

Permalink.

What are the main features of SugarCRM?

SugarCRM offers the following features:

  • Email Integration
  • Marketing Automation
  • Sales Force Automation
  • Customer Support
  • Social CRM

Permalink.

What URL is needed for the Outlook Plug-in?

The server URL to use will be similar to the URL that you use to login to the Sugar application. However, you will replace the index.php filename at the end of the URL and replace it with soap.php. For example, change http://host.domain.com/sugarcrm/index.php to http://host.domain.com/sugarcrm/soap.php .

Permalink.

What are the advantages of the GPL v3?

Since GPL v3 is based on the most popular license in the open source universe, the community is able to adopt and develop on what is sure to be the de facto standard license. This will insure greater interoperability and enhanced community collaboration as GPL v3 becomes widely adopted in the same manner as earlier versions of the GPL.

Permalink.

How do I change the default theme?

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

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

Note: This setting will affect all users.

Permalink.

Does SugarCRM support mobile devices?

SugarCRM supports the following devices:

  • Android
  • iPhone-iPad

Permalink.

How do I change a Sugar user’s username?

Follow these steps:

1) Login as an administrator
2) Click the Admin link in the top-right corner
3) Click User Management
4) Click the username you'd like to change
5) Modify the User Name field in the top-right of the form
6) Press Save to confirm your changes

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)

What is Responsive Web Design?

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

Web Pages Must Be Flexible and Adapt

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

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

Creating a Whole Separate Website is a Bad Idea

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

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

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

Responsive Design Treats Mobile and Desktop the Same

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

Permalink.

What is Audio and Video used for?

Audio and video are used for enhancing the experience with Web pages (e.g. audio background) to serving music, family videos, presentations, etc. The Web content accessibility guidelines recommend to always provide alternatives for time-based media, such as captions, descriptions, or sign language.

Permalink.

How does the element relate to the Page Goals?

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

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.

What technologies have been developed to fit mobile devices?

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

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

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

Permalink.

What is Contrast in Design?

Contrast in design is an accentuation of the differences between elements in a design. Most people think of contrast only as it applies to colors, but contrast can work with any design element. For example, if you have a group of lines that are all the same size, there is no contrast. But if one is a lot longer than the others, it contrasts with them.

Permalink.

What scripting interfaces are available ?

The most basic scripting interface developed at W3C is the DOM, the Document Object Model which allows programs and scripts to dynamically access and update the content, structure and style of documents. DOM specifications form the core of DHTML.

Modifications of the content using the DOM by the user and by scripts trigger events that developers can make use of to build rich user interfaces.

A number of more advanced interfaces are being standardized, for instance:

  • XMLHttpRequest makes it possible to load additional content from the Web without loading a new document, a core component of AJAX,
  • the Geolocation API makes the user’s current location available to browser-based applications,
  • several APIs make the integration of Web applications with the local file system and storage seamless.

WAI ARIA offers mechanisms to ensure that this additional interactivity remains usable independent of devices and disabilities. Additional considerations apply to the development of Web applications for mobile devices.

Permalink.

What is POWDER?

POWDER the Protocol for Web Description Resources provides a mechanism to describe and discover Web resources and helps the users to make a decision whether a given resource is of interest. There are a variety of use cases: from providing a better means to describing Web resources and creating trust marks to aiding content discovery, child protection and Semantic Web searches.

Permalink.

How to include Balance in Web Designs

The most common way to incorporate balance into Web designs is in the layout. But you can also use the float style property to position elements and balance them across the page. A very common way to balance a layout symmetrically is to center the text or other elements on the page.

Most Web pages are built on a grid system, and this creates a form of balance for the page right away. Customers can see the grid, even if there aren't any visible lines. And Web pages are well suited to grid designs because of the square nature of Web shapes.

Permalink.

What is the Canvas API?

The Canvas API is a client-side scripting technology to allow for the rich creation or alteration of raster images (bitmaps) . It uses vector-based programmatic methods to create shapes, gradients, and other graphical effects, and because it has no DOM, it can perform very quickly. Dedicated scripters can develop games or even full-featured applications using the Canvas API, alone or integrated into HTML or SVG. It is supported natively in most modern browsers (with script libraries extending support to all major browsers), and even on some mobile devices.

Permalink.

Wordpress (145)

My contact form behaves oddly on certain browsers.

This may be caused due to invalid HTML, CSS, or Javascript. Please check your form page with a validator or debugging tool.

Useful tools:


Permalink.

How do I exclude one or more categories from being listed in the list of categories?

Use the following function to list your categories but exclude category 1:

<?php wp_list_categories('exclude=1'); ?>

Of course, change the 1 to the ID of the category you want to exclude.

To exclude multiple categories, use this:

<?php wp_list_categories('exclude=1, 2'); ?>

Change 1 and 2 to the categories you want excluded. You can exclude more of them by adding their IDs separated by commas.

Permalink.

How do I customize the sidebar?

Step 1 – Activate in the Page Editor

 

Once installed, Per Page Sidebars adds a new panel to the page editor. This panel lets you turn Per Page Sidebars on and off for each page.

To activate the Per Page Sidebars on your page, click the Activate check-box, and then choose which sidebar you want to replace with a custom one. Currently, you can only replace one sidebar- so if you want to customize the footer, you won’t be able to also customize the right-hand column on this particular page.

Save your page as a Draft or Publish it.

Step 2 – Navigate to the Widget Editor

Now that you’ve activated Per Page Sidebars on your page, you need to go to the Appearance>Widgets section to actually create the custom sidebar.
 

Step 3- Add widgets

 

If you’ve never used it before, the widget editor in WordPress keeps all of the available widgets in a panel on the left side of the screen, and the sidebars on the right side of the screen. Before adding a custom sidebar, you may have just had a Sidebar and Footer section.

Now you’ll see a new panel on the right that starts with PPS (for per page sidebars) and followed with the name of your page. In my example, I called my page My New Page 123456, so here’s what I see in the widget editor:


 

Permalink.

I used the Quicktag in a WordPress post, so why doesn’t it work?

In some Themes, such as the WordPress Classic Theme, you may see the <!–nextpage–> work properly on your main page, but other Themes, such as the WordPress default Theme, may only show the page break when viewing the posts individually. It may be necessary to change your Theme's template page.php or index.php file to make this feature work according to your wishes. You'll need to add the following:

<?php wp_link_pages(); ?>

Permalink.

How do I change the file upload path?

The default upload path can be changed by adding a line of code to your wp-config.php file.

Just BEFORE the line that says require_once(ABSPATH.'wp-settings.php'); add this line:

define('UPLOADS', 'wp-content/myimages');

In the example above, this will result in uploads being placed in your wp-content/myimages folder. If 'uploads_use_yearmonth_folders' is enabled your uploads will be saved in wp-content/myimages/2009/01 where 2009 is the current year, and 01 is the current month, in this case January.

If the myimages directory does not exist it will be created as long as the parent folder wp-content is writeable.

Permalink.

How do I fix the following error SQL/DB Error errcode 13 Can’t create/write to file?

The MySQL variable tmpdir is set to a directory that cannot be written to when using PHP to access MySQL.

To verify this, enter MySQL at the command line and type show variables

You'll get a long list and one of them will read: tmpdir = /somedir/ (whatever your setting is.)

Solution: Alter the tmpdir variable to point to a writable directory.

Steps:

  1. Find the my.cnf file. On *nix systems this is usually in /etc/.

  2. Once found, open this in a simple text editor and find the [mysqld] section.

  3. Under this section, find the tmpdir line. If this line is commented (has a # at the start), delete the # and edit the line so that it reads: tmpdir = /writable/dir where /writable/dir is a directory to which you can write. Some use /tmp, or you might also try/home//

  4. Save the file.

  5. Shutdown MySQL by typing mysqlshutdown -u -p shutdown

  6. Start MySQL by going to the MySQL directory and typing ./bin/safe_mysqld &. Usually the MySQL directory is in/usr/local or sometimes in /usr/ on Linux systems.

If none of this make sense and you have someone to administrate your system for you, show the above to them and they should be able to figure it out.

Permalink.

Why are there path disclosures when directly loading certain files?

This is considered a server configuration problem. Never enable display_errors on a production site.

Permalink.

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

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

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

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

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

Or remove it completely, leaving only the title tag.

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

Permalink.

Looking Under the Hood for CSS

Once you have lifted the hood to see the HTML and CSS, it is time to start playing Sherlock Holmes. To start, you have to know what you are looking at and where to find the basic elements to help you find the culprit.

The HTML page features all the structural code that sets up the "grid" into which your page sits. Think of it as a map with notes written all over it. The notes are actually pointers to the directions which are found within the CSS file.

Scroll down past a lot of <link rel='archives'... information until you see <body>. Below this will be the layout "body" of your web page. From here on, every bit of information is critical to the structure and design of your page.

As you scroll through it, look for identifying ID and CLASS statements. For example, you may see the following:

<div id="page">
	<div id="header">
	<h1>My WordPress Site</h1>
		<div id="headerimg">
		</div>
			<div class="description">by Me and Only Me</div>
		</div>
	<div id="content" class="widecolumn">
  		<div class="post">

This may look confusing, but it is basically setting up sections with your content in it.

It begins with the division called "page" which sets up the look of the entire page. If you look in the CSS file for #page selector, you will see the presentation styles associated with it. It is followed by the header division which includes a heading (H1) with the title of your site. This particular layout is based upon the default Theme for WordPress v1.5 called Kubrick which includes an image in the header, set by the "headering" division. After that comes a division with a CLASS reference called "description" which is the place you have a subtitle or description of your site. Again, look in your CSS to find .description to find out how that area is styled.

The next two tags close the header (</div>) and then begins the division ID of "content" which also features a CLASS called "widecolumn", followed by another CLASS called "post". The "content" and "widecolumn" layout the overall look of the containers holding your "post".

This is an example of the parent/child relationship. And, as you will see in the next section, this is one of the major places where CSS layout problems begin!

Permalink.

Webpage/Dashboard is Blank

When attempting to view a webpage or the administration dashboard a blank page is shown.

Please try the following:

Themes are located in /wp-content/themes/
  • Do a fresh installation of WordPress by first downloading it again from http://wordpress.org/download/ and then replacing everything but the contents of /wp-content/

Permalink.

Yii (36)

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

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

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

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

Permalink.

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

Because save method performs validation CActiveRecord::save

As you can see in the source code:

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

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

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

Permalink.

How to Add a Registration Form to Your Model/Controller

In the user model, you can set different rules for different scenarios. Such as, repeated password. The trick is to use the on=> parameter in your rules, which allows you to set the scenario that it applies to. Here’s an example of a rule used for registration only:

array('passwordVerify', 'required', 'on'=>'register'),

In your controller, the scenario you are using can be used when you instantiate your model

$model = new User('register');

…or set manually afterwards:

$model->scenario = 'register';

You also may want to consider using a separate model for this sort of purpose, to avoid any conflicting rules. See the Gii-generated LoginForm.php for an example of that.

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 is the naming convention in Yii?

You can define table prefix when using Gii. In your case you need to set it to tbl_. Then it should generate UserController instead of TblUserController.

The Yii Framework employs a class naming convention whereby the names of the classes directly map to the directories in which they are stored. The root level directory of the Yii Framework is the “framework/” directory, under which all classes are stored hierarchically.

Class names may only contain alphanumeric characters. Numbers are permitted in class names but are discouraged. Dot (.) is only permitted in place of the path separator.

Permalink.

How to include Javascript and CSS file in Yii Framework?

To include Javascript and CSS file in Yii, put the following lines at the top of your view file:

$cs=Yii::app()->clientScript;
$baseUrl=Yii::app()->request->baseUrl;
$cs->registerScriptFile($baseUrl."/javascriptfile.js");
$cs->registerCssFile($baseUrl."/cssfile.css");

Permalink.

How do I install and use YiiGeo?

INSTALLATION

Extract the contents of the archive to 'protected/extensions/' . Rename the default directory (eg: 'yiigeo-1.0.1/' ) to whatever you want the component named in your application. This directory will be referred to as '<extdir>' in this tutorial.

USAGE

Register for an API Key with a support GeoCoder provider
Google registration: http://code.google.com/apis/maps/signup.html
Yahoo registration: http://developer.yahoo.com/maps/rest/V1/geocode.html

There are two ways to use the Yii GeoCoder Extension. The first is as an imported standalone object, the second is as an application component.

*Standalone*

<?php
Yii::import('application.extensions.<extdir>.GeoCoder');
$geocode = new GeoCoder;
$geocode->init();
$geocode->setApiKey('<your API key>'); // As of 1.0.2
$geocode->setDriver('<your driver>'); // 'google' or 'yahoo'
$result = $geocode->query('Las Vegas, NV 89103'); ?>

*Application Component*

STEP 1: Update your application config

<?php 'components' => array(
  …
    'geocoder' => array(
       'class' => 'application.extensions.<extdir>.GeoCoder',
       'api_key' => '<your API key>',
       'api_driver' => '<your driver>', // 'google' or 'yahoo'
     ),
  …

) ?>

STEP 2: Using the component

<?php
$result = Yii::app()->geocoder->query('Las Vegas, NV 89103'); ?>

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.

If I define additional field in my model (AR) that is not stored in DB, only calculated based on other fields, where do I keep code that will calculate this additional field value?

You may have some variables that will be reused, that aren’t a single database field. For example, a rating that is determined by querying some rows. Or perhaps some strings that are always combined, such as the page URL or someone’s location.

Using __get and __set methods in your models allows you to create a function that will act like a class property (member variable). If you create a method in your model named getRating, which returns a value, you can then access it via $model->rating.

Permalink.

How do I access Lat/Lon, etc, after executing a query?

In Yii-style fashion, this extension has a magic __get method that allows for accessing the items inside the protected attributes array as if they were public properties. These items can be accessed as follows:

$result->accuracy; // The accuracy code (integer)
$result->latitude; // The latitude in degrees (float)
$result->longitude; // The longitude in degrees (float)
$result->query; // The query as sent to the driver (string)
$result->clean_query; // The cleaned query string as returned by the driver (string)
$result->state; // The state name as returned by the driver (string)
$result->county; // The county name as returned by the driver (string) – Google only
$result->city; // The city name as returned by the driver (string)
$result->zip; // The zip code as returned by the driver (string)
$result->street; // The street name/address as returned by the driver (string)
$result->country; // The country code as returned by the driver (string)

All of the above listed items can also be set in the same manner. It is, however, recommended that you not override the values that are returned by the driver unless you have good reason.

There are also three public get* methods that return special data: the accuracy string, the latitude in radians, and the longitude in radians. These items can also be accessed through the magic __get method as follows:

$result->accuracy_string; // The accuracy text associated with the accuracy code (string)
$result->latitude_radians; // The latitude in radians (float)
$result->longitude_radians; // The longitude in radians (float)

A magic __isset function is also implemented which allows you to see if an item was retrieved and set by the driver, just call isset on the value. Eg: isset($result->county).

Permalink.

Zend (57)

How can I use the same locale everywhere?

With ZF 1.7 an application wide locale is supported. You can do the following in your bootstrap file:

$locale = new Zend_Locale('en');
Zend_Registry::set('Zend_Locale', $locale);

From now on, all locale aware components will use your locale object stored in the registry as long as you don't give another one manually.

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 do you protect your site from sql injection in zend when using select query?

You have to quote the strings:

$this->getAdapter()->quote(<variable name> );
$select->where( ” <field name>= “,<variable name>);
OR (If you are using the question mark after equal to sign)
$select->where( ”<field name>= ? “,<variable name>);

Permalink.

What is zend helpers?

It can be divided in two parts,

a) Action Helper: the helper is created for the controller;
b) View Helper: the helper is created for view files (.phtml).

Permalink.

Can I automate the installation of Zend Server using Puppet or Chef?

Yes, via Zend Server's Web API it is fully possible to not only install Zend Server, but also set passwords and licences. Furthermore, when working in a clustered environment, it is also possible to automate the joining of a new cluster node to a running cluster. Given that the Web API is available via command line calls this can easily be integrated into Chef/Puppet scripts.

Permalink.

Can we call a model in view?

Yes, you can call a model in view. Simple create the object and call the method.

$modelObj=new Application_Model_User();

Permalink.

I’m using the ContextSwitch or AjaxContext view helper and receiving an exception indicating the error.ajax.phtml view script is missing; what am I doing wrong?

ContextSwitch makes the assumptions that (a) you are not calling _forward() and (b) that your application code will not throw an exception. If you see the above error, your code is throwing an exception – but the context is still in play, and the ViewRenderer is simply trying to load a view script for the current context from the ErrorController.

The easiest way to fix the situation is to have the ErrorController::errorAction() redefine the view script suffix, as follows:

class ErrorController extends Zend_Controller_Action
{
    public function errorAction()
    {
        $this->_helper->viewRenderer->setViewSuffix('phtml');
        // ...
    }
}

Permalink.

How can I install Zend Server using my existing Apache Web server?

In Windows, Zend Server bundles its own Apache Web server and cannot use an existing pre-installed Apache server.

On Linux, Zend Server uses the Apache server which is shipped with the Linux distribution.

Permalink.

How do I get Z-Ray?

Z-Ray comes bundled with Zend Server 7. If you haven’t downloaded and installed Zend Server yet, go to http://www.zend.com/en/downloads.

Permalink.

What is Zend registry?

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

Permalink.

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