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

Architecture
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 … )
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 –>
</cores>
</solr>

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. –>
<dataDir>${solr.solr.home}/tutorial/data</dataDir>

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

References

IMB article on Solr
http://www.ibm.com/developerworks/opensource/library/os-php-apachesolr/

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.

https://github.com/alfallouji/PHP-Optimal-Netbanx

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

The first annual PHP Australia Conference will be in Sydney in 4 weeks !

http://www.phpconference.com.au/

Don’t miss this exciting event !

Cya there.

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

I am glad to learn that I will be a speaker at the 2014 OSDC in the Gold Coast : http://2014.osdc.com.au/

Not only, this is going tobe a very interesting conference seeing the different talks and speakers, but also you can expect some good fun in the Gold Coast.

Hope to see you there !

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

I recently had to work on integrating an ERP with DHL XML API Services. I could not find a PHP open source library to consume their API, so I decided to share the one that I wrote.

You can download the code on github : https://github.com/alfallouji/DHL-API

If you want to read documentation about the DHL XML API Service, their toolkit can be downloaded from here: https://xmlpi-ea.dhl.com/

Description

The library is a PHP Oriented Object client for the DHL XML API Services. DHL XML Services is an online web services integration capability that provides DHL’s service availability, transit times, rates, shipment and courier pickup booking along with shipment tracking from over 140 countries around the world. Using DHL’s XML Services, customers can incorporate DHL shipping functionality into their websites, customer service applications or order processing systems.

Usage

The client does not rely or depend on any framework and it should be fairly easy to integrate with your own code. You can use the autloader that is provided or your own autoloading mechanism.

The sample folder contains examples on how to use the client and perform requests to DHL XML API, such as track a shipment, create a shipment, request a pickup or print labels.

In order to have the samples working, you will need to create a DHL staging account. You can do that by going to that URL : DHL - XML API Services

Then, you need to edit the config/config.php file and provide your account id and password. The samples use those credentials.

return array(
‘id’ => ‘Your_DHL_ID’,
‘pass’ => ‘Your_DHL_Password’,
);

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

I was able to invest time on improving the UI and adding new features to fxalert.net.

Fxalert.net is a web application allowing to create simple and advanced email and SMS alerts on the forex market. It supports more than a 100 of currencies pair.

The new features includes the following :
- Integration with facebook (you can now use your facebook account to login);
- UI Revamp;
- You can now create SMS / Mobile alert for up to 10 different countries and it supports more than a hundred of mobile providers;
- Aggregation of forex news from twitter and around the web;
- New FAQ section.

I hope people will like and find useful this new version.

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

Open your shell script and type  :

telnet towel.blinkenlights.nl

Enjoy :)

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

I recently developed for fun a webapp offering forex currencies alert. It allows users to create 100% free custom currencies alert on approximately 100 currency pairs.

Alerts are sent by email for now, but others channels will be available soon such as SMS, IM.

You can check it out at www.fxalert.net.

Any feedback is welcome :)

www.fxalert.net

www.fxalert.net

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

Who am I?

My name is Bashar Al-Fallouji, I work as a Service Architect at Origin Energy (Sydney, Australia).

I am particularly interested in 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 [...]