Wednesday, November 9, 2016

Jenkins fails Maven/Java builds when running API tests using HTTPS

Recently discovered the problem with Jenkins, when projects builds were failing due to REST API tests (RestAssured) fails for an unknown reason.

We've recently switched our infrastructure to HTTPS and that change was obviously the root cause as the tests on HTTP were passing successfully.

On local developer's machines, the QA servers or even on Jenkins machine tests were passing when running from bash.

Also tried to run them from the "jenkins" user, on Jenkins machine, from the build's workspace -
in the exact same way Jenkins runs during a build, and all tests were passing successfully on both HTTP and HTTPS.

HTTPS tests were failing only when started from Jenkins UI "Build Now" button. We were not able to reproduce these fails any other environment except this Jenkins instance.


Saturday, August 22, 2015

Cheap ExtJS 4.x SASS watcher (ready to be wrapped with gulp/grund or any other build tool)

ExtJS 4.x does't has reliable SASS watcher out of the box. Recommended approach of "compass watch" introduced in ExtJS 4.x doesn't works anymore in ExtJS 4.2 as it doesn't understand the structure of themes, leaving "sencha ant sass" as only option to build SASS, which is so slooooow and takes around 30-40 seconds to rebuild the whole theme.

Wednesday, September 10, 2014

URL params parsing on pure JavaScript

ES3 compatible URL params parsing on pure JavaScript:

/**
* Detects hash params and builds an array of values
*
* We have the following URL: "http://www.domain.com/path/page.html#param1=value1&param2=value2"
* this function will extract the part: "param1=value1&param2=value2" and build an array:
* param1 = value1
* param2 = value2
*
* inspired by: http://jquery-howto.blogspot.com/2009/09/get-url-parameters-values-with-jquery.html
*
* @returns {Array}
*/
function getHashVars()  {
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('#') + 1).split('&');
    for(var i = 0; i < hashes.length; i++) {
        hash = hashes[i].split('=');
        vars.push(hash[0]); 
        vars[hash[0]] = hash[1];
    }
    return vars; 
}

Saturday, July 26, 2014

Selenium WebDriver + Xvfb + PHP PHPUnit

Selenium WebDriver is one of the best and most mature tools for functional testing of WEB applications, supports wide range of browsers and bindings for all major language platforms.

Here is brief overview of possible selenium setup, which by the way has a lot of possibilities for improvement but can be good for quick and easy start.


Tuesday, September 10, 2013

Add sidepars in Wordpress theme

The shortest post ever.
The file names for the right and left sidebars should be
sidebar-right.php and sidebar-left.php respectively.





Wednesday, October 10, 2012

PHP Copy and Paste detection tool installation

In order to install it you will need to:

1. Upgrade to latest PHPUnit 3.7
2. Install https://github.com/theseer/fDOMDocument (see instructions inside)
3. Install https://github.com/sebastianbergmann/phpcpd (see instructions inside)

Then you can run it like:

$ phpcpd /path/to/project/directory

You will see the copy&paste report:


Found 3 exact clones with 53 duplicated lines in 5 files:

  - /usr/local/src/phpunit/PHPUnit/Framework/Constraint/Or.php:136-157
    /usr/local/src/phpunit/PHPUnit/Framework/Constraint/And.php:143-164

  - /usr/local/src/phpunit/PHPUnit/Framework/Constraint/Or.php:136-157
    /usr/local/src/phpunit/PHPUnit/Framework/Constraint/Xor.php:141-162

  - /usr/local/src/phpunit/PHPUnit/Framework/Comparator/Scalar.php:121-132
    /usr/local/src/phpunit/PHPUnit/Framework/Comparator/Numeric.php:102-113

0.19% duplicated lines out of 27640 total lines of code.

Thursday, September 6, 2012

Zend Framework 2.0 stable release

Finally after all these years I'm glad to announce the Zend Framework 2.0 stable release. It is still not ideal but as we have stable release now - we can start polishing it and try and use it for our needs.
Congratulations to everyone!

Sunday, June 10, 2012

Easy start with Jenkins for PHP developer

Lets look into the quick and minimal Jenkins setup for middle sized fast growing PHP project.
In order to easy follow this article you should at least:
  • have PEAR installed on server
  • use phpUnit for unit tests
  • build your app with Phing

Wednesday, May 16, 2012

Drupal produces warnings with file_check_directory() on low bootstrap levels

I've found interesting issue with file_check_directory() in Drupal. It generates errors like:

Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /.../public_html/includes/module.inc on line 245

Friday, April 6, 2012

Convert OpenSSH keys to Putty on Linux with puttygen

If you need a Putty ppk key on Linux when you don't have Windows installation, for example when using Windows application that requires ppk-key under Wine. You can use "puttygen" CLI tool in that case.

On Ubuntu:

# apt-get install putty-tools

$ cd ~/.ssh/
$ puttygen id_dsa -o id_dsa.ppk

Make sure you've replaced the "id_dsa" with your private key filename.

Profit!

Thursday, February 9, 2012

Xdebug PHP scipts profiling examples


Look at this presentation to become familiar with PHP profiling:
And also look into this article for more details:


Edit PHP.ini and add the line:
xdebug.profiler_enable = 1
Restart the Apache and you will find the profiling dumps in /tmp/ .

PHP debug process internals with xdebug


Xdebug debugger allows you to interactively walk through script execution and inspect the call traces and variable values in each appropriate scope.

Why install xdebug?


Even without actual integration with your IDE you are able to get benefit from xdebug on your development machine:

Wednesday, December 21, 2011

PHP debug & profiling for dummies

Sometimes very basic debug can be done by dumping the values of variables. The other method is about writing debug values into log files. Such approaches are hard to be successfully used on large sophisticated projects like Drupal or Magento. In such case the best solution is to use the debugger and debug your code via step by step code execution, back traces, breakpoints, variables scope inspection and producing execution flows / profiling dumps.

Here is the short compilation of materials about debug and profiling in PHP where everyone can find links to the interesting materials on the WEB and also my personal experience.

Monday, October 31, 2011

Zend Mail 2.0 to be delivered for upcoming ZF2 beta2

The work under new Zend Mail 2.0 component has been started recently. Matthew Weier O'Phinney created the architectural outline of proposed object relations and interactions. That document can be found under following Wiki page: "RFC - Mail Refactoring"

Mail goals that should be addressed in new Zend Mail component are:
  • handing of mass messaging
  • better separation between message handing and transport
  • improved MIME-types encoding and Unicode support
  • more intuitive handing of attachments and custom message headers
Feel free to provide your comments under the appropriate Wiki page according the proposed architecture.

Revised version of Zend Mail 2.0 is planed to be delivered for upcoming Zend Framework 2 beta2 release.

Saturday, October 29, 2011

Simplest solution to enable PHP mail() function under Ubuntu

If PHP mail() function doesn't works on your development desktop and your Apache error log shows something like "sh: /usr/sbin/sendmail: not found" - then you obviously need to install "sendmail" in order to fix that :)

Just run the following command in Ubuntu:

# apt-get install sendmail

To configure Sendmail for your needs use (see appropriate configuration scripts in output):

# sendmailconfig 

Writing this post for people who asking me quite frequently: "Why PHP mail() function doesn't works after I've successfully installed LAMP development environment on my Ubuntu desktop?"

Monday, August 15, 2011

Preparing Ubuntu Linux desktop for web development

There are a lot of articles on the Internet about configuring Ubuntu desktop for web developer. I'm using Ubuntu for 3 years already as my working desktop station for web development and want to share my own list of software each web developer should have. So here is just another guide to prepare Ubuntu powered desktop for web development.


Wednesday, May 25, 2011

Bug-Hunt Days May 2011 Anouncement!

A new Bug-Hunt days are coming. On 26th, 27th and 28th - join the team of best PHP developers in magnificent quest of resolving Zend Framework bugs and issues.

For each first-time bug hunter it is recommended to view "The list of all Zend Framework open issues" and joining the IRC channel #zftalk.dev on Freenode.

You can read the detailed information about participating in Zend Farmework bug-hunt days and if you will close a lot of bugs you will win a valuable prizes.

Happy hunting!

Wednesday, May 11, 2011

Zend Framework 2 MVC brainstorm

During next 4 weeks everyone can contribute ideas according ZF2 MVC requirements and architecture on the Zend Framework MVC requirements brainstorm page. As it was stated by Matthew Weier O'Phinney, the main idea is to finally come up with a concrete list of deliverables for the ZF2 MVC.

Feel free to give your comments and join discussion on mailing lists, IRC and Wiki.

Sunday, April 17, 2011

Zend Framework core developers update

We had couple ZF code developers changes during last 1-2 months that worth to be mentioned.

Alexander Veremiev is not in the official Zend Framework development core team any more, but will still support the development as community member.

Anyway we have a new core developer introduced by Matthew Weier O'Phinney last month. Enrico Zimuel worked for Zend for several years as a consultant for companies that use PHP solutions.

You can find more information about Enrico on his personal blog: http://www.zimuel.it/blog

Welcome on board!!