Recent Updates RSS Toggle Comment Threads | Keyboard Shortcuts

  • admin 11:09 am on July 6, 2010 Permalink | Reply  

    Client says “proceed to checkout” empties cart and returns to homepage 

    A customer would come to the website, place items in their shopping cart, and then click the “proceed to checkout button” from the shopping cart. Rather than take them to the cart, our Magento website would immediately forward them to the home page and empty all the items from their cart.

    Cause: ISPs like AOL, Comcast, and Shaw.ca use a technique of changing IP addresses that cause security settings in Magento to empty the cart and not allow people to check out.

    Fix: Change the Session Validation settings in the Magento Admin, found under System > Configurations > Web,  to ‘no’ on everything except “Validate HTTP_USER_AGENT.” After doing this,  go to System > Cache Management and refresh the configuration cache to apply the changes.

     
  • admin 10:41 am on July 6, 2010 Permalink | Reply  

    syntax error [Break on this error] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML…3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">” 

    I received some clients website files today in which Firefox was throwing a syntax error on the DOCTYPE. To fix this make sure that each of your javascript calls contains type=”text/javascript”. The client had only language=”javascript”. This attribute has been deprecated. It was used to select other programming languages and specific versions of JavaScript. You don’t need it. Don’t use it.

    After I added the TYPE the file validated just fine at W3C.

     
  • admin 11:37 am on June 29, 2010 Permalink | Reply  

    Types of Includes 

    The include statement is only one of four statements that you can use to include another PHP file in a currently running script. Those four statements are:

    • include
    • require
    • include_once
    • require_once

    include and require are almost identical. The only difference between them is what happens when the specified file is unable to be included (that is, if it does not exist, or if the web server doesn’t have permission to read it). With include, a warning is displayed[1] and the script continues to run. With require, an error is displayed and the script stops.

    In general, therefore, you should use require whenever the main script is unable to work without the script to be included. I do recommend using include whenever possible, however. Even if the db.inc.php file for your site is unable to be loaded, for example, you might still want to let the script for your front page continue to load. None of the content from the database will display, but the user might be able to use the Contact Us link at the bottom of the page to let you know about the problem!

    include_once and require_once work just like include and require, respectively — but if the specified file has already been included at least once for the current page request (using any of the four statements described here), the statement will be ignored. This is handy for include files that perform a task that only needs to be done once , like connecting to the database.

    Figure 1 shows include_once in action. In the figure, index.php includes two files: categories.inc.php and top10.inc.php. Both of these files use include_once to include db.inc.php, as they both need a database connection in order to do their job. As shown, PHP will ignore the attempt to include db.inc.php in top10.inc.php because the file was already included in categories.inc.php. As a result, only one database connection is created.

    Figure 1. Use include_once to avoid opening a second database connection

    include_once2_5

    include_once and require_once are also useful for loading function libraries.


    [1] In production environments, warnings and errors are usually disabled in php.ini . In such environments, a failed include has no visible effect (aside from the lack of content that would normally have been generated by the include file); a failed require causes the page to stop at the point of failure. When a failed require occurs before any content is sent to the browser, the unlucky user will see nothing but a blank page!

    Types of Includes
    by Kevin Yank

     
  • admin 9:45 pm on April 22, 2010 Permalink | Reply  

    How to easily suspend a client website on Media Temple grid server hosting 

    In this economy getting your small business web hosting clients to pay for their web hosting can prove to be quite a challenge. I don’t charge very much to my clients for web hosting so I expect to be paid on time for their annual renewals. Therefore I have taken a zero tolerance policy towards late pays. With that said I would like to share a couple of things I do to my clients that FAIL to pay on time.

    The first thing I do is disable their email. Media Temple Grid Server account holders can log into their Account Center and click on the Admin button and then on the (gs) Grid-Service Control Panel page click on Enable/Disable Email from this page you can disable the whole domain’s email capabilities.

    Now that we have that done we can disable their web site. I chose to take care of this task programmatically through use of a very simple shell script (Linux Shell Scripting Tutorial). The following is script I created and you can take this and fill in the blanks for your own script:

    
    clear
    echo "What website would you like to suspend?"
    read website
    mv /nfs/c02/h11/mnt/XXXXX/domains/$website/html /nfs/c02/h11/mnt/XXXXX/domains/$website/html.bak
    mkdir /nfs/c02/h11/mnt/XXXXX/domains/$website/html
    touch /nfs/c02/h11/mnt/XXXXX/domains/$website/html/index.html
    echo "Website Suspended" > /nfs/c02/h11/mnt/XXXXX/domains/$website/html/index.html
    

    Now to explain the script a bit:

    1. Open vi and paste this in and replace XXXXX with your account number. You will also need to replace the part at the beginning of the paths that starts with ” /nfs/c02/h11/mnt/” as that part is specific to the server you are on.
    2. Once you have that done save your script with an “sh” extension (ie disablesite.sh). I saved my script in my home directory so that I can execute it right after I log in through SSH.
    3. Finally, to execute the script, navigate to the directory you saved it in an then type “sh yourscriptname.sh” and hit enter! The script will clear the screen and leave you with a question… “What website would you like to suspend?”. Answer that question with the precise domain name of directory you want to suspend and hit Enter again. At this point the script will rename that domains html directory to html.bak and create a new html directory with a new index.html file that displays “Website Suspended”.

    There are many other things one could do with this script like set up a Cron job to check a file that contains expiration dates for each of your sites and automatically disables them for you. Whatever you do be very careful in how you set up your script as this is pretty powerful and you could easily mess things up for yourself .

    Also, it’s worth noting that if you use this script on your clients site you could very well embarrass them to the point where they just decide to not use your services ever again.

     
  • admin 2:40 pm on April 1, 2010 Permalink | Reply  

    Navicat for MySQL 

    I must humbly admit that Navicat beats my trusty and beloved phpmyadmin for speed, usability, and functionality sake. If you are a dbadmin and haven’t tried it yet give it a whirl and I think you’ll be pleasantly surprised how easy yet robust this piece of software is.

    http://www.navicat.com/en/products/navicat_mysql/mysql_overview.html

     
  • Bruce 3:56 pm on March 9, 2010 Permalink | Reply  

    WordPress: remove category posts from RSS feed 

    Want to say thanks to jangro.com for having a WordPress function to block a specific WordPress category from appearing in my RSS feed. I just added this to my theme’s function.php file and changed the category number to the number of the category to omit and voila, the RSS feed is now free of the other category.

    function myFilter($query) {
    if ($query-&gt;is_feed) {
    $query-&gt;set('cat','-5');
    }
    return $query;
    }
    add_filter('pre_get_posts','myFilter');
    
     
  • Bruce 11:33 am on March 8, 2010 Permalink | Reply  

    PHP Array output offset by 1? 

    Today I was writing some code for another site and I was looping through a DB query and outputting the results and I noticed that the output was one index off. If you ever encounter this problem make sure that you do not have your query string followed by $row = mysql_fetch_array($query) and then have $row = mysql_fetch_array($query) in the WHILE statement for your loop.

     
  • Bruce 10:47 am on February 2, 2010 Permalink | Reply  

    Google dumps IE6 support 

    This morning at 12:26AM I received the following email from Google:

    *************************************************
    Dear Google Apps admin,​

    In order to continue to improve our products and deliver more sophisticated features and performance, we are harnessing some of the latest improvements in web browser technology. This includes faster JavaScript processing and new standards like HTML5. As a result, over the course of 2010, we will be phasing out support for Microsoft Internet Explorer 6.0 as well as other older browsers that are not supported by their own manufacturers.

    We plan to begin phasing out support of these older browsers on the Google Docs suite and the Google Sites editor on March 1, 2010. After that point, certain functionality within these applications may have higher latency and may not work correctly in these older browsers. Later in 2010, we will start to phase out support for these browsers for Google Mail and Google Calendar.

    Google Apps will continue to support Internet Explorer 7.0 and above, Firefox 3.0 and above, Google Chrome 4.0 and above, and Safari 3.0 and above.

    Starting this week, users on these older browsers will see a message in Google Docs and the Google Sites editor explaining this change and asking them to upgrade their browser. We will also alert you again closer to March 1 to remind you of this change.

    In 2009, the Google Apps team delivered more than 100 improvements to enhance your product experience. We are aiming to beat that in 2010 and continue to deliver the best and most innovative collaboration products for businesses.

    Thank you for your continued support!

    Sincerely,

    The Google Apps team

    Email preferences: You have received this mandatory email service announcement to update you about important changes to your Google Apps product or account.

    Google Inc.
    1600 Amphitheatre Parkway
    Mountain View, CA 94043

     
  • Bruce 5:37 pm on January 28, 2010 Permalink | Reply  

    Linux: Move files and directories up one directory 

    Here’s a quick answer to a Linux CLI question that I am asked on a regular basis. The scenario goes like this. You just unpacked a gzip’d file and you have a directory full of files and directories now. You don’t want those files and directories in that directory but rather up one directory…what do you do. First thing you can do is to cd into the directory and then you can either:

    Copy the files/directories up one directory by running: cp * ../

    or you can…

    Move the files/directories up one directory by running: mv * ../

     
  • Bruce 2:51 pm on January 18, 2010 Permalink | Reply  

    Joomla: cannot login to administration 

    Today Joomla decided it wanted to kick me out as Super Administrator…so I went into the users table and reset the admin password using MD5. No Luck!

    After a bit of Googling I found that the Joomla core_acl_aro table gets corrupted from time to time. Fortunately for me I had a backup of this table. For anyone needing the schema for this table you can use the following to at least get back into the admin area:

    DROP TABLE IF EXISTS `core_acl_aro`;
    CREATE TABLE `core_acl_aro` (
    `aro_id` int(11) NOT NULL auto_increment,
    `section_value` varchar(240) NOT NULL default ’0′,
    `value` varchar(240) NOT NULL default ”,
    `order_value` int(11) NOT NULL default ’0′,
    `name` varchar(255) NOT NULL default ”,
    `hidden` int(11) NOT NULL default ’0′,
    PRIMARY KEY (`aro_id`),
    UNIQUE KEY `gacl_section_value_value_aro` (`section_value`(100),`value`(100)),
    KEY `gacl_hidden_aro` (`hidden`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;

    INSERT DELAYED IGNORE INTO `core_acl_aro` (`aro_id`, `section_value`, `value`, `order_value`, `name`, `hidden`) VALUES
    (10, ‘users’, ’62′, 0, ‘Administrator’, 0);

     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
esc
cancel