Nginx connect() failed error

August 28th 2014, 6:29 amCategory: Web 0 comments

I don't know why I got this error every time I tried to open the page:

2013/04/06 17:52:19 [error] 5040#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client:, server: localhost, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://", host: "localhost:8080"

During upgrading for apache2.2 to apache2.4 I got this error when trying to access localhost via a browser:

AH01630: client denied by server configuration

I checked my site folder permissions using:

sudo chmod 777 -R *

Why offline-storage.js?

January 30th 2014, 5:14 amCategory: Web 0 comments

Historically, cookies were invented early to be used as presistent local storage of small amounts of data but they have several downsides:

  • cookies are sent in each http request which slowing web aplication (in case you have to store data that are not related to sessions)
  • cookies are limited about 4KB of data

So offline storage (localStorage/sessionStorage) is one of the areas which gives native client applications advantages over the web, so it will be very useful to use instead of cookies because of:

  • a lot of storage space ~5MB compared to cookies
  • not transimitted to the server

But it has one downside which is allowing only string value to be saved, from here comes the importance of offline-storage.js to allow application to save objects into offline storage. The idea is simple rather than saving string it converts your object to a json string then saves it, when loading this string it parses this json string back to your original object, more info can be find on its github repo.

AngularJS vs. EmberJS vs. BackboneJs

January 7th 2014, 1:41 pmCategory: Web 0 comments

Nowadays JavaScript is the most famous and popular programming language all over the world, its updates and enhancements speed over time is unbeleivable which lead programmers to think again and again to devolop and update frameworks to gain the maximum use of it and get the best way to develop using it, now each JavaScript framework is fighting others to prove that it is the best, but really there is no best way.

Every time I read about this question in blogs and websites, I found the discussion turn into a war, but the only thing I can say that the kind of application developed is the only factor. Every single framework has its own advantages and disadvatages, after some googling all I can say is just mention the main important global points that we can understand about every framework so we can decide which one to use. In this article main frameworks points are aggregated from many articles to get us a general overview of these frameworks.

Interest over time:

Global view:

  • Most minimal of all the libraries, easy to learn and provides REST-persistable models with simple routing and callbacks to render views. Can work in a small portion of the page without the need to control the whole page.
  • Templates: any template engine can be used, so you can use something like handlebars.js or underscore.js.
  • Model Mutaionit is based on events so it use getters and setters to get or set a value and this is also an efficient way to learn the model change and accordingly reflect it to view.
  • Performance: it doesn't do any dom manipulations for you, so the speed of the app depends a lot on the way you manipulate dom operations.
  • Learning & Development: it is very easy to learn, but while developing, backbone is not enough, it can't will not completeky structure your code, as example you a template engine like handlebarsjs or underscorejs need to be used, so more libraries will be injected.
  • Project point of view: it has a large community and it is easy to find a backbone developer or even if you coudn't learning will not cost a lot.
  • Why not: more repeated structure code so you need a lot of boiler plate code to make it work well, and models have to be wrapped from Backbone.Model.extend introducing unnecessary framework-specific methods.RESTful models is not a perfect fit for real-time communication or offline apps.
  • Biggest framework of them all in both functionality and code size so it is not suitable in small projects, irt strength point comes from common problems,  Ember makes all the common solutions  so you have to worry only about what is unique in your application.
  • TemplatesIt uses built-in string-based templates (mandatory).
  • Model Mutaion: it follows almost the same structure and flow as Backbone, the only diffrence that while rendering the data elements, it adds observers to each element. As the observers are heavy, so it makes the rendering process slower.
  • Performance: because of its observers it is the best when view need to be updated continously with model values like in games or in animations, on the other hands if prject uses a huge amount of models and data Ember will be the most worst one in terms of page load time because of adding observers for each model.
  • Learning & Development: it is not hard to learn but also not enough in development, more libraries will be injected like backbone.
  • Project point of view: it the best thing to insure the quality of code and to obtain a well structured maintainable code, because it forces the developer to follow thier way, the project will never run if you didn't follow thier way in code, so it is the best solution of a huge project need to developed.
  • Why not: Ember is very huge and developers have to follow thier style which is ha
  • DOM-based templating with observability, declarative bindings, and an almost-MVVM code style (they say Model-View-Whatever)
  • Conceptually, it’s a polyfill between what browsers can do today and what they will do natively in a few years (declarative binding and observability), so we should start coding this way right now
  • No impact on your server architecture or file layout. Can work in a small section of your page — doesn’t need to control whole page.
  • Templatesit uses a built-in DOM-based templates (mandatory),  DOM structure is created on pageload to be used later. 
  • Model Mutaion: it is a Dirty Checking based which is faster than traditional setters and getters which used by Backbone and Ember.
  • Performance: it is the best if the project targets a high speed page load, if your app doesn't need a realtime data binding for models Angular (it uses dirty checking which force the controller to check all models for changes) will be the best option.
  • Learning & Development: it is easy to learn and tricky at same time because of html preocessing but once you understanding processing stracutre it will be very easy to develop with.
  • Project point of view: it the best if you haven't enough time to develop because it minizes the written code. also you will have a satisfied structured maintainable code.
  • Why not: will take time  to learn and be familier with, also its views allows to put more logic inside it.


ou haven, After we got a global idea about each framework, the most important thing is to fully understand project need, scope and scale. 


Redis vs. MongoDB Performance

November 18th 2013, 12:20 pmCategory: Web 7 comments

MongoDB is an open source document database, and the leading NoSQL database which is written in C++ and Redis is also an open source NoSQL database but it is key-value store rather than document database. Redis is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.