Tips for optimizing LAMP stack & Linux server

performance_banner
1. Get a dedicated server
Advantages– Whole server power for you
– You are very flexible in terms of new versions for webserver, database, php …
– There are not other customers which run “bad” scripts which slow down the shop
– You don’t share the same ip, very important for SEO.
If one customer makes a “bad business”, the ip can be blocked by google which affects your search ranking.
My recommendation:I am a big fan of the Amazon EC2 cloud which gives you everything you need (flexibility, scalability, security).
Continue reading

Magento – creating custom breadcrumbs for CMS pages

breadcrumb

I wanted to create a subordinate set of CMS pages in Magento so that the breadcrumb navigation at the top of the page looks like this:

Home > Parent CMS Page > Child CMS Page

Even though I can specify a hierarchical relationship with the URL key field, it seems to be that all CMS pages in Magento are listed in the root directory by default:

Home > Child CMS Page

To override the default, you have 2 options :

Continue reading

The Whens and Whys for Design Patterns

custom-programming-banner

Again, we have another article about Design Patterns. but this time it’s not the same :). There are plenty of articles that explain what design patterns are, and how to implement them; the web doesn’t need yet another one of those articles! Instead, in this article, we will more discuss the when and why, rather than the which and how.

This article covers some of the various Agile Design Patterns, documented in Robert C. Martin’s books. These patterns are modern adaptations of the original design patterns defined and documented by The Gang of Four in 1994. Martin’s patterns present a much more recent take on the GoF’s patterns, and they work better with modern programming techniques and problems. In fact, about 15% of the original patterns were replaced with newer patterns, and the remaining patterns were slightly modernized.

Continue reading

What Starts with F and ends with K

A first-grade teacher, Ms Brooks, was having trouble with one of her students.  The teacher asked, “Harry, what’s your problem?”Harry answered, “I’m too smart for the 1st grade. My sister is in the 3rd grade and I’m smarter than she is!  I think I should be in the 3rd grade too!”Ms. Brooks had enough.  She took Harry to the principal’s office.

While Harry waited in the outer office, the teacher explained to the principal what the situation was. The principal told Ms. Brooks he would give the boy a test.  If he failed to answer any of his questions he was to go back to the 1st grade and behave.  She agreed.

Harry was brought in and the conditions were explained to him and he agreed to take the test.

Continue reading

Technical debt in software development

debt-banner

Technical debt (also known as design debt or code debt) is a neologistic metaphor referring to the eventual consequences of poor or evolving software architecture and software development within a codebase. The debt can be thought of as work that needs to be done before a particular job can be considered complete. As a change is started on a codebase, there is often the need to make other coordinated changes at the same time in other parts of the codebase or documentation. The other required, but uncompleted changes, are considered debt that must be paid at some point in the future.

Continue reading

Unix – Worst way to disable annoyance from auto execute or startup program

Banner-Gears

Is there any programs that you don’t want it to be triggered by any reason ? if so, this article will show you how to deal with it.
There’re many ways and tools that help you to disable programs from startup or auto triggered by other applications in Windows enviroment, and they’re efficient!
Using Unix-based systems, you have less choices to do such thing, and sometime you find it hard and confusing. And, if you hate some annoying programs like me, there’s a dirty method that will free you from annoyance :). All you have to do is to remove execute permission for bin file.
Open your termial and execute the following command :

chmod -x /path/to/file

may be you’ll need to use sudo because some programs require root permissions

Magento – Fix integrity constraint violation issue

Database-banner

Sometimes, you face database issues like this ‘integrity constraint violation: 1062 Duplicate entry ‘100000001’ for key’ . if you are not familiar with Magento, may be you will feel blind (like i was), debugging won’t go smoothly as usual.

After studying Magento deeper to its core, i found that Magento numbering system depends on a table called ‘eav_entity_store’. this table stores increment ids of many entities from Magento.

Continue reading

Magento – price helper code snippet

This piece of codes will help you get final price with tax and formatted nicely using your store currency


<?php
$_coreHelper = $this->helper(’core’);
$_taxHelper = $this->helper(’tax’);
$_finalPriceInclTax = $_taxHelper->getPrice($_product, $_product->getFinalPrice(), true);
$_finalPriceInclTaxNicelyFormated = $_coreHelper->currency($_finalPriceInclTax,true,false);
echo $_finalPriceInclTaxNicelyFormated;

?>

Hope you find it useful ! 😀

Five common PHP design patterns

php

Design patterns were introduced to the software community in Design Patterns, by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides (colloquially known as the “gang of four”). The core concept behind design patterns, presented in the introduction, was simple. Over their years of developing software, Gamma et al found certain patterns of solid design emerging, just as architects designing houses and buildings can develop templates for where a bathroom should be located or how a kitchen should be configured. Having those templates, or design patterns, means they can design better buildings more quickly. The same applies to software.

Continue reading

WordPress – reset your admin password using Command line (quick way)

Sometimes, you lose your credential to your wordpress admin dashboard, i guess many of you had this question in mind : what is the quickest way to reset my admin password ?

error-wp1

In WordPress, there is more than one way to set your password. In normal circumstances, you can do it through the WordPress interface. If you forget your password, WordPress has a built in recovery mechanism that uses email.

But on some hosts, especially when email isn’t working right, sometimes you have to take different steps to reset your password. in this article, i’ll show you how to reset you admin password using command line:

1. log in to MySQL

mysql -u root -p

Continue reading