What we like, what we do & bump into

Innobyte Team is proud to have two Magento Certified Developers

One clue to knowing you’ve got a team composed of quality members is their wish to develop professionally. We are amongst the companies that managed to create a team of such people.

Driven by their wish to gain even more experience and also to have a solid basis that can support their Magento development knowledge, two of our colleagues, Rares and Ion, became Magento Certified Developers.

Magento developer certification

This didn’t happen by night. The preparation for the Magento exam has been continuous, theoretical – with the aid of Magento bibliography, but mostly practical through developing numerous projects on this platform.

Thus, after taking a 70 Magento Community based question exam, our two colleagues successfully passed it, gaining the Magento Certified Developer title and adding credibility to Innobyte, the first Magento Professional partner from Romania

Magento Development Environment

If you read the post written by Andru, “Web Development using the Virtual Machine (VM): why and how” you know that here at Innobyte we use Virtual Machines for the development of any project along with some other cool tools / services like GitHub.

At the same time we have a staging environment for almost every project, so the clients can see the progress, suggest changes and so on.

This works great for us, especially for new projects.

But when we have projects that are already live and we just need to develop new features/ modules it`s a bit tricky.

At such a project we are working right now, a very big project with over 100 custom Magento modules.

Beside the new modules, we also develop various tools to automate stuff.

One of the biggest challenges is making sure that every tiny thing we develop would work out of the box on our VM, the staging environment and of course when we deploy it on the live servers.

Let`s take for example one of the latest tools we had to develop: a little tool (php script run from CLI ) that would create 16 new categories and for each of those categories we have to copy products from 3 to 5 categories already in the shop.

The part in which we create the categories is easy. The main problem is matching categories IDs on our VMs, stage website and of course live one.

So … here comes the need for a development environment.

Out of the box Magento doesn`t support this, like other software or frameworks ( Code Igniter, Symfony, etc).

You guessed it, we build our own.

Well… we need a multi-dimensional array with IDs from which we need to copy the products for each environment (Virtual Machine, Stage, Live)

After much debating with the Innobyte team, we decided to write a custom Magento module so we can use it in more modules. We also decided to hack the index.php a little so we can do some checks (if needed) before everything is loaded-up.

Part 1 – Hacking

In index.php we have the following code :

[php]

/* START DEVELOPMENT ENVIRONMENT */
$allowEnvs = array( ‘live’, ‘stage’, ‘dev’ );

$defaultEnv = ‘live’;

if ( isset($_SERVER['DEV_ENV']) && in_array( trim($_SERVER['DEV_ENV']), $allowEnvs) ) {
$env = trim($_SERVER['DEV_ENV']);
}
else {
if ( PHP_SAPI == ‘cli’ ) {
$env = ‘cli’;
}
else {
$search = array(
‘dev’ => array( ‘dev.’, ‘devel.’, ‘test.’),
‘stage’ => array( ‘stage.’, ‘staging.’),
‘live’ => array( ‘www.’ )
);
$found = false;
$host = $_SERVER['HTTP_HOST'];
$parts = explode(‘.’, $host);
foreach ( $parts as $part ) {
foreach ( $search as $dev => $bits ) {
if ( in_array($part.’.', $bits) ) {
$found = true;
$env = $dev;
}
}
}
if ( !$found ) {
$env = $defaultEnv;
}
}
}
define(‘DEV_ENV’, $env );
/* END DEVELOPMENT ENVIRONMENT */
[/php]

As you can see, this is done before any other thing being loaded.

It first checks if there is a SetEnv directive in .htaccess. If there is any and it is in the allowed array (prevent typos) it skips to the section where we define our constant.

If not, the code checks the HTTP_HOST and sets the variable based on it.

If no match is found, it sets the default environment (live, in our case).

Part 2 – the Magento Module

We created a new module in the Innobyte namespace, called Base.

We are going to place the code here so we can reuse it everywhere we need to by simply calling a Helper.

Just create the file Innobyte_Base.xml in the app/etc/modules dir with the following contents:

[php]

<?xml version="1.0"?>
<config>
<modules>
<Innobyte_Base>
<active>true</active>
<codePool>local</codePool>
</Innobyte_Base>
</modules>
</config>

[/php]

This tells Magento to load our module.

Next, create the following directory structure:

app/code/local/Innobyte

app/code/local/Innobyte/Base

app/code/local/Innobyte/Base/Helper

app/code/local/Innobyte/Base/etc

Now let`s create the configuration file for our module.

Fire-up your favourite IDE or text editor and create a new file in App/code/local/Innobyte/Base/etc called config.xml and paste the following :

[php]
<?xml version="1.0"?>
<config>
<modules>
<Innobyte_Base>
<version>0.0.1</version>
</Innobyte_Base>
</modules>
<global>
<helpers>
<base>
<class>Innobyte_Base_Helper</class>
</base>
</helpers>
</global>
</config>
[/php]

Now that we have this set-up, it`s time to write our helper class.

We just have one method  in it and it .

We send it an array with all values for all environments and it returns the one for the current environment. Pretty simple.

Just create a new file called Data.php in the app/code/local/Innobyte/Base dir and paste the code:

[php]

<?php
class Innobyte_Base_Helper_Data extends Mage_Core_Helper_Data {
public function getValues ( $input ) {
$allowEnvs = array( ‘live’, ‘stage’, ‘dev’, ‘cli’ );

if ( PHP_SAPI === ‘cli’ ) {
define(‘DEV_ENV’, ‘cli’);
}

if ( !defined( ‘DEV_ENV’ ) || !in_array( DEV_ENV, $allowEnvs )  ) {
return false;
}
else {
if ( !array_key_exists( DEV_ENV, $input ) ) {
return false;
}
return $input[ DEV_ENV ];
}
}
}
[/php]

After that it checks if the constant is defined it is one of the one that we need ( $allowEnvs array ). It then returns as the array we need based on the keys of the input array.

An input array would look like:

[php]
$input = array (

‘dev’ => array ( 1, 2, 3 ) // array of ids for dev env

‘stage’ => array( 1, 2, 5) // values for stage

‘live’ => array( 1, 7, 14) // values for live

);
[/php]

Assuming that we would use this on our dev environment, calling:

[php]print_r(Mage::helper(‘base’)->getValues($input))[/php]

would print out the first array (  1, 2, 3 );

It`s a very simple piece of code but it helps us a lot in our development process.

If we didn`t use this we will have to modify our files every time before we deploy them on the stage or live environment , add them to git,  commit , etc .

If there were any problems, we would have to modify that file again with the first values for our VM and do the whole process all over again.

For any of you reading this that don`t want to hack your index.php file, you can take out that code and put it in a __construct() method of the helper class .

Why I love red frogs!

If I tell you that some frogs can solve your communication issues within your team, department or even the entire company, all that within one month, will you consider this crazy?

Well, I hope your answer will be “it depends”, so I get the chance to explain myself.

Here is an hypothetical situation in an imaginary company X: the people don’t know to communicate with each other, they don’t work together, they don’t help each other, for each issue there is always somebody else at fault, they often deliver late so the company X keep loosing clients … managers try to find out who’s fault is but no results – “trainings and team-buildings were useless.”

Red frog

An external consultant magically appears and propose a game. He said:

“I’ll rent you some frogs.

There are red ones and green ones, all rubber.

Those frogs are trained to search and find issues within your company.

Here is how:

- each of you in this company will receive three numbered red frogs

- you’ll offer one of these red frogs to someone you consider closest to the root of an issue you may have (you can offer maximum two red frogs each day).

- a referee will keep track who offered a red frog to whom, recording also the reason / the issue

- if the receiver is in the other team / department then you should offer the frog to the manager of that team / department

- everyone should accept a red frog and keep it at least 24 hours.

- if the one that received the frog has a solution for the issue, then:

- the referee will change the red frog with a green frog, save the solution and close the issue.

- more than that, the referee will give back one new red frog so other issues can be detected

- else, the owner of the red frog should pass along the red frog to someone he consider to be closest to the root of the issue.

I’ll come back in a month to see what my frogs found”

Q1: What are the expected results of this game?

This could be the shortest way to find out what are the real roots of any issue within the company and, more important, the solution.

And you’ll get that while not the people but the frogs will carry all the emotions deducted from mark someone as the possible root of an issue.

Mainly, when the game is over, when we talk about the issues left open, there are 2 situations:

1. the red frog reached the root of the issue: probably low skills or low motivation for that person.

2. the red frog is in a loop back: there are big chances to have a huge issue since nobody took responsibility or had a solution. maybe a paradigm-shift is needed.

Q2: What are the data collected about teams, roles and information flow within company X?

One could find out all the tasks he is supposed to take care of.

Another one could learn how others rely on him, why his results are important, what is the value of his work.

A manager could optimize the processes within his department by removing the redundancy.

Q3: Do you see any benefit in implementing this game? Any drawback?

+ The issue and the solution are more important than who’s at fault.

+ frustrations and/or fears to address any issue will be gone, the frogs will carry this, not the people involved.

+ people will better understand their role within the company

- for a large company the game should be played more times.

- also for a large company the process of tracking frogs/issues/solutions does not seem to be handy

Do you have any other answers to Q1, Q2 or Q3?

Or maybe you will just want to add something.

Then feel free to post your comments.

 

P.S. I cannot take the credits for the story itself, nor point out the source. It is somewhere in the cloud…

Web development using the Virtual Machine (VM): why and how

I’ll go straight to the subject: you’ll ask “why use VM? It sounds like trouble!”

There is this myth that the host machine works terribly hard when VM starts and there’s nothing else you can do in the meantime. This is probably true if while web developing you also want to encode MPEG4 a raw video at HD resolution.

VirtualBox

The virtualization technology has gone a long way in the past couple of years, and, thus, a decent host machine (dual core, 2 GB RAM) works well if you have a VM with Ubuntu 10.04 without Gnome/KDE (with no X) and with Apache, PHP, MySQL to which you assign 512 MB RAM and that will also run smooth.

There is also the myth that if you work by yourself for your projects, and not with a team whereby you feel the need of standardizing the development environment, you don’t need a VM. If your projects will always be for the same platform (Apache, PHP, APC, MySQl versions) and if they will be small, than you might be right. But, you may encounter the following situations:

  • For the project X you will need a NGINX + PHP5.3 + FPM + MongoDB setup because it’s a great project developed on cutting edge technologies that incites you to the point of working on it day and night
  • For the project Y you will have a APACHE + PHP5.2 + MySQL5.1 setup because it is a project you started two years ago and you have a great maintenance contract
  • For the project Z you will have a APACHE + PHP5.3 + MySQL5.5 setup because it is a project you could not say no to; you’re doing it for a friend even though it brings no money and it’s quite boring, but it needs to be developed on a platform that requires the setup to be mentioned.
  • You know that on a daily basis you need progress with each project  at least for 2 hours of work

The solution for this situation is to have a VM for each project. Joggling with work for the projects is just a matter of start/stop of the VMs.

However, as it probably happens to most of us, we work in one or more teams for several projects, each with its limitations in matters of hosting service.

It frequently happens that new people join one team or another, on one or more projects. Basically, using a VM, the time spent in enrolling into one project or the other decreases from several hours, or even one or two days for complex setups, to minutes.

I had three failed attempts before managing to pull off the first successful project developed in VM. Today I use VirtualBox (excellent and free) and set up the VM with two network interfaces, this way:

  • Adapter 1: Hostonly Adapter, Intel PRO/1000 T Server
  • Adapter 2: NAT, Intel PRO/1000 T Server

I have manually set the first interface:

root@dev:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
auto eth1
iface eth1 inet static
address 192.168.56.10
netmask 255.255.255.0

For easy acces to every system file on Windows  I forced under Samba user and group root:

root@dev:~# cat /etc/samba/smb.conf
#
# …………….
#
[totsystemul]
comment = Global Share
path = /
read only = No
guest ok = Yes
public = Yes
browseable = Yes
create mask = 0666
directory mask = 0777
force group = root
force user = root
[www]
comment = var/www
path = /var/www
read only = No
guest ok = Yes
public = Yes
browseable = Yes
create mask = 0666
directory mask = 0777
force group = root
force user = root

In a future article I’ll discuss about some other aspects of working with VM and I’ll show you a VM already set up with the help of which you can start working for your new project!

Magento Enterprise Premium

Magento announced the launch of Magento Enterprise Premium edition, designed for big e-commerce projects.

Even for its price and revenues we can conclude that it addresses only to serious e-commerce businesses.

Magento Enterprise Premium

What does it consist of (mong others)?

  • Three year pass for two production servers and a development server (Enterprise variant);
  • A system architect and code review offered by a team of consultancy experts belonging to Magento;
  • 10% discount if another 3 year pass is bought for the production servers;
  • 2 places in e-Commerce with Magento training (you can read more details here).

How much is it?

There hasn’t been announced an official price yet, but the bunde is around 89.000 USD.

For detailed information, we invite you to visit the Magento web site.

Source: Somfi.me

Page 1 of 812345...Last »