I just released a little project in Github that provides an easy way to generate data sample and push them to something like a AWS Kinesis stream. This is quite handy if you need for example to build a POC or a demo and require some data set.

Here is the link to the github project : https://github.com/alfallouji/ALFAL-AWSBOOTCAMP-DATAGEN

Or to make it easier, you can click here to deploy it on AWS.

Please keep in mind the following. This code is provided free of charge. If you decide to deploy this on AWS (using the cloudformation script), you may incur charges related to the resources you are using in AWS (e.g. EC2, S3, Kinesis, etc.).

The structure of the generated data can be defined within a configuration file.

The following features are supported :

  • Random integer (within a min-max range)
  • Random element from a list
  • Random element from a weighted list (e.g. ‘elem1′ => 20% of chance, ‘elem2′ => 40% of chance, etc.)
  • Constant
  • Timestamp / Date
  • Counter (increment & decrement)
  • Mathematical expression using previously defined fields {{field1} + {field2} / 4) * {field3})
  • Conditional rules : {field3} equals TRUE if {field1} + {field2} < 1000 {field4} equals FALSE if {field1} + {field2} >= 1000
  • Any of the feature exposed by fzaninotto/faker library
  • Ability to defined the overall distribution (e.g I want 20% of my population to have a value of ‘Y’ for {field3}). The generator will run until it meets the desired distribution.

Here is an example of a configuration file :

// Define the desired distribution (optional)
'distribution' => array(
    // We want to have 30% of our distribution with a value of 'Y'
    // for the result field and 70% with a value of 'N'
    'result' => array(
        'Y' => 3,
        'N' => 7,

// Define the desired fields (mandatory)
'fields' => array(

    // You can use date function and provide the desired format
    'time' => array(
        'type' => 'date',
        'format' => 'Y-m-d H:i:s',

    // Randomly pick an integer number between 10 and 100
    'field1' => array(
        'type' => 'randomNumber',
        'randomNumber' => array(
            'max' => '100',
            'min' => '10',

    // Field2 is a constant equalts to 1000 (could be any string)
    'field2' => array(
        'type' => 'constant',
        'constant' => '1000',

    // Randomly pick an element from a defined list of values
    'field3' => array(
        'type' => 'randomList',
        'randomList' => array(

    // Pick an element from a weighted list
    'field4' => array(
        'type' => 'weightedList',
        'weightedList' => array(
            'men' => 40,
            'women' => 60,

    // You can use mathematical expression
    'field5' => array(
        'type' => 'mathExpression',
        // Value => condition
        'mathExpression' => '{field1} + {field2} + sin({field2}) * 10',

    // You can use any of the faker feature
    'field6' => array(
        'type' => 'faker',
        'property' => 'name',

    'field7' => array(
        'type' => 'faker',
        'property' => 'email',

    'field8' => array(
        'type' => 'faker',
        'property' => 'ipv4',

    // You can define conditonnal rules to be evaluated in order to get the value
    // if this condition is true :
    // {field1} + {field2} > 1060, then the value for {result} is 'Y'
    'result' => array(
        'type' => 'rules',
        // Value => condition
        'rules' => array(
            'Y' => '{field1} + {field2} > 1060',
            'N' => '{field1} + {field2} <= 1060',
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks

I just got the AWS DevOps Engineer Professional Certification. That’s all 5 AWS certifications !

  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks

I just passed the AWS Certification SA Pro Certification.


One more left !

  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks

Two left

In: Uncategorized

24 Aug 2017


  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks

This one was easier to get than the Solution Architect one.


  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks

I am going to switch job in a few weeks. As I mentioned, I decided to take the AWS Solution Architect Certification exam before starting on that new position.

In case of you want to do the same, those course notes were a nice summary of what is covered during the exam.


  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks

I started preparing to pass the AWS Solution Architect Certification.

One of my colleague at Origin just recently re-passed the exam. He was nice enough to share his course notes on his blog at : http://www.beddysblog.com/marks-aws-solution-architect-course-notes-aprmay-2017/

I just went through them and they are pretty useful. I encourage you to take a look if you are interested to pass the AWS Solution Architect certification also.

  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks

In this first article, we will talk about how to integrate a strong and flexible search engine within your web application. There are various open source search engine available in the market. This talk will be about Solr. I have been using it for different projects and it offers a nice solid set of features.

What is Solr ?

Solr is an open source enterprise search server based on the Lucene Java search library, with XML/HTTP and JSON APIs, hit highlighting, faceted search, caching, replication, a web administration interface and many more features. It runs in a Java servlet container such asTomcat.
Source : http://lucene.apache.org/solr/

What features does it offer ?

Solr is a standalone enterprise search server with a web-services like API. You put documents in it (called “indexing”) via XML over HTTP. You query it via HTTP GET and receive XML results.

Advanced Full-Text Search Capabilities
Optimized for High Volume Web Traffic
Standards Based Open Interfaces - XML,JSON and HTTP
Comprehensive HTML Administration Interfaces
Server statistics exposed over JMX for monitoring
Scalability - Efficient Replication to other Solr Search Servers
Flexible and Adaptable with XML configuration
Extensible Plugin Architecture
Source: http://lucene.apache.org/solr/features.html

One of the “sexy features” offered by Solr is faceted search. If you are not familiar with that notion. You will often see facets in e-commerce sites.

Faceted navigations are used to enable users to rapidly filter results from a product search based on different ways of classifying the product by their attributes or features.
For example: by brand, by sub-product category, by price bands
Source : http://www.davechaffey.com/E-marketing-Glossary/Faceted-navigation.htm

It helps a lot when user are searching. Here are some examples of facets displayed on various websites.
Example of facets

How to use Solr with a PHP application ?

Solr has a full Rest interface, making it very easy to talk with.
It can output response in different format (XML, JSON, etc.), it can even output response in PHP or PHPS.

  • PHPS = Serialized PHP
  • PHP = PHP code

We will discuss later how you can enable and use this feature.
Some open source libraries are available in PHP. There is also a PHP extension for Solr.

  • PHPSolrClient
  • SimpleSolr
  • Solr PHP extension

In our this article, we will use a custom made client (named SimpleSolr). The SimpleSolr class is available for download but as said earlier there are many existing frameworks or libs that can be used for that purpose. I personally decided to build my own little class for the purpose to learn more about the Solr API.
We will assume in this tutorial that you have a functional Apache / PHP 5.2+ installation ready also we will assume you are running with a Unix platform. The first thing you need to do, is to install Solr.

Installing Lucidworks Solr

We recommend using the lucidworks package for Solr. Based on the most latest stable release of Apache Solr, it includes major new features enhancements. For further details, you can check their website (www.lucidimagination.com). Here is the URL to download it: http://www.lucidimagination.com/Downloads/LucidWorks-for-Solr
Installing Solr is very easy, Lucidworks offers an installer (that run with Windows and Linux since it is a .jar)
You will need to install JRE, for all the details on how to install lucidworks, please refer to this documentation : http://www.lucidimagination.com/search/document/CDRG_ch02_2.1
Whenever you are ready go to the folder where Solr is installed, to see all the option, you can type this :
sh lucidworks.sh –help

Using CATALINA_BASE:   /var/www/solr/lucidworks/tomcat
Using CATALINA_HOME:   /var/www/solr/lucidworks/tomcat
Using CATALINA_TMPDIR: /var/www/solr/lucidworks/tomcat/temp
Using JRE_HOME:       ./../jre
Usage: catalina.sh ( commands … )
debug             Start Catalina in a debugger
debug -security   Debug Catalina with a security manager
jpda start        Start Catalina under JPDA debugger
run               Start Catalina in the current window
run -security     Start in the current window with security manager
start             Start Catalina in a separate window
start -security   Start in a separate window with security manager
stop              Stop Catalina
stop -force       Stop Catalina (followed by kill -KILL)
version           What version of tomcat are you running?

In order to start Solr, you need to type the following :
sh lucidworks.sh start

Using CATALINA_BASE:   /var/www/solr/lucidworks/tomcat
Using CATALINA_HOME:   /var/www/solr/lucidworks/tomcat
Using CATALINA_TMPDIR: /var/www/solr/lucidworks/tomcat/temp
Using JRE_HOME:       ./../jre

Now you can check if Solr is running by going there: http://localhost:8983/solr/admin You should see the Solr backoffice admin page.

Solr Admin
Now that you have an install ready to be used, lets build a simple Search.

Configuring schema.xml and solrconfig.xml

You can configure Solr to use various cores. That way, the same Solr instance can serve various applications. In order to do that, you can check the following link : http://wiki.apache.org/solr/CoreAdmin

You need to edit the solr.xml, and add the new core :

<solr persistent=”false”>
<cores adminPath=”/admin/cores”>
<core name=”tutorial” instanceDir=”tutorial” />
<!– You can add new cores here –>

Then, edit the solrconfig.xml file, make sure the right path is set for the dataDir property.

<!– Used to specify an alternate directory to hold all index data
other than the default ./data under the Solr home.
If replication is in use, this should match the replication configuration. –>

Make sure also that the PHP and PHPS responseWriters are enabled ! Otherwise, it won’t work !

<queryResponseWriter name=”php” class=”org.apache.solr.request.PHPResponseWriter”/>
<queryResponseWriter name=”phps” class=”org.apache.solr.request.PHPSerializedResponseWriter”/>

Now, edit the conf/schema.xml file and add the following fields within the <fields> node :

<!– Unique Solr document ID (see <uniqueKey>) –>
<field name=”solrDocumentId” type=”string” indexed=”true” stored=”true” required=”true” />
<!– Fields for searching –>
<field name=’id’              type=’integer’ indexed=’true’ stored=’false’ />
<field name=’text’        type=’text’    indexed=’true’ stored=’false’ multiValued=’true’ />
<field name=’title’           type=’text’    indexed=’true’ stored=’false’ />
<field name=’author’          type=’text’    indexed=’true’ stored=’false’ />
<!– Facet fields for searching –>
<field name=’category’  type=’text_facet’ indexed=’true’ stored=’false’ multiValued=’true’ />
<field name=’concept’   type=’text_facet’ indexed=’true’ stored=’false’ multiValued=’true’ />
<field name=’location’  type=’text_facet’ indexed=’true’ stored=’false’ multiValued=’true’ />
<field name=’person’    type=’text_facet’ indexed=’true’ stored=’false’ multiValued=’true’ />
<field name=’company’  type=’text_facet’ indexed=’true’ stored=’false’ multiValued=’true’ />

In this article, we will index and search on articles. An article has an title, text, author and some special metadata such as : category, concept, location, person and company.

Make sure to restart solr every time you do a change on your solrconfig or schema files !

Now it is the time to start with the PHP code.

A simple search controller


IMB article on Solr

Refer to http://wiki.apache.org/solr/SolPHP?highlight=((CategoryQueryResponseWriter)) for more information.

  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks

I recently released a PHP client to consume Optimal Netbanx services on Github.


You can integrate your application using this agnostic Card Payments API to process all major credit cards through the NETBANX payment gateway.

It implement a wide variety of REST-based API requests - including purchases, refunds, and authorization reversals. Obtain output in JSON format – it’s easy to parse in a large variety of Web and mobile applications.

An account with Optimal Payment is needed in order to use this library. You can create testing account here : https://developer.optimalpayments.com/en/

This library can be loaded via composer. This is an open source project, feel free to contribute !

  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks

I just discovered a new web application named IFTTT.

The concept is so simple and so powerful at the same time.

It allows to create simple rule : If This Then That

Where “This” is a trigger and “That” is an action. Both happens in what they call “Channels”. Channels are applications like Facebook, Linkedin, Weather, Email, etc.

In a nutshell, you can build an integration between third parties in a matter of seconds.

Here are some examples of rules :

Show your support for the Texas Rangers on Twitter every time a game starts

Post videos from your YouTube favorites playlist to Tumblr

Build a Twitter List from a specific #hashtag

If you are interested to know more : https://ifttt.com/wtf

I also encourage you to create an account and try it.

  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks

Who am I?

My name is Bashar Al-Fallouji, I work as a Enterprise Solutions Architect at Amazon Web Services (Sydney, Australia).

I am particularly interested in Cloud Computing, Web applications, Open Source Development, Software Engineering, Information Architecture, Unit Testing, XP/Agile development, etc.

On this blog, you will find mostly technical articles and thoughts around PHP, OOP, OOD, Unit Testing, etc. I am also sharing a few open source tools and scripts.

  • dipan: Hi Bashar It's really awesome that you wrote this code. IT'll save tones of time of all developer. [...]
  • Bashar: Glad that you liked it ! [...]
  • Angel S. Moreno: well, there goes wasting a couple of hours of development and a couple of days of testing. I owe you [...]
  • Bashar: Thats right, the setSaveFile create a files containing an associative array of classname => filen [...]
  • Loggy: Jim's clarification in particular was pretty useful although I did have to dig down into the tree to [...]