Amr Elgarhy

/Amr Elgarhy

About Amr Elgarhy

Senior Software Engineer.

Why mailchimp-mandrill driving me nuts?

By |2018-08-11T23:02:08+00:00August 11th, 2018|Categories: Programming|Tags: , , |

I have used mailchimp and its API mandrill in couple of projects recently. Both of these projects had requirements to send a relatively complex emails such as confirmations to customers, detailed invoice and account totals which required a strong email template engine to allow sending object list and let the template itself loop through the objects and display them. I found Mandrill and their template engine which you can set it to use Handlebars.js is very powerful and fit my needs pretty well. Because Mailchimp templates design editor is robust and easy to use, we started to build the templates in [...]

Some of them want to Interrupt you, Some of them want to be Interrupted

By |2018-08-11T21:08:03+00:00August 11th, 2018|Categories: Productivity|Tags: , |

Interruptions at work can be maddening. Researchers at the University of California, Irvine, found after careful observation that the typical office worker is interrupted or switches tasks, on average, every three minutes and five seconds. And it can take 23 minutes and 15 seconds just to get back to where they left off. Jonathan Spira, author of “Overload! How Too Much Information Is Hazardous To Your Organization,” estimates that interruptions and information overload eat up 28 billion wasted hours a year, at a loss of almost $1 trillion to the U.S. economy. https://www.washingtonpost.com/news/inspired-life/wp/2015/06/01/interruptions-at-work-can-cost-you-up-to-6-hours-a-day-heres-how-to-avoid-them/?utm_term=.f7d3c2f49fb5 https://www.youtube.com/watch?v=qeMFqkcPYcg   Quite few years since this [...]

Properties – the basics

By |2018-06-19T13:12:15+00:00March 4th, 2017|Categories: Technical|Tags: , |

Properties in C# is a special type of methods called accessors, they are accessed as if they are public member fields but with read, write and compute the value. Is is declared like a field but with a get and set blocks inside, get is to read the property value and must return the same property type, set is to write to the property, using an implicit parameter called value. Typically properties read and write from/to fields, private int _salary; public int Salary { get { return _salary; } set { _salary = value; } }   but we can also [...]

Different ways to hide an HTML Element

By |2016-09-05T23:22:20+00:00September 5th, 2016|Categories: Technical|Tags: , |

There are different ways to hide an HTML element from the client, just hiding not removing. <div> <p>Line 1</p> <p class="hide">Line 2</p> <p>Line 3</p> <p>Line 4</p> </div> We need to hide p.hide element, so the user can't see it. Display: Display css property, display is the most important and most used css property to control HTML elements layout. display:none; can be used to hide an HTML element from the view and it will appear as if it was not there on the page, means the HTML element will be hidden without blocking any space. Example: Text 1 | Text 2 | Text [...]

Amazon Cloud Drive Windows Client

By |2015-05-27T23:40:11+00:00May 27th, 2015|Categories: Web|Tags: , , , , , |

Amazon Cloud Drive is your place for everything digital. Cloud Drive offers free mobile apps, secure access from any computer, and it's built in to your Amazon devices—so you can access your digital content everywhere you are. When it comes to files hosting I trust amazon based on my previous experiences, and based on the cheap offers they have. Also there are many file hosting web services are bases on Amazon cloud hosting and file hosting such as Dropbox which is built on Amazon S3. So when Amazon released the Cloud drive, I signed up and started using their website, but [...]

nopcommerce: How to get Role Name from applied discount coupon?

By |2012-10-11T11:08:02+00:00October 11th, 2012|Categories: Programming|Tags: , , , |

- Create a discount from the cms admin - Add  a requirement for that discount and select "Must be assigned to customer role" and choose a role. The next steps can be done anywhere in the website, I will use the CommonController to show the role name inside the website header beside the user email -  Go to CommonController  and inside the HeaderLinks method add these lines: // Added by treenodes 10 Oct 2012 string discountRoleName = string.Empty; if (discount !=null && discount.DiscountRequirements != null) { var requ = discount.DiscountRequirements.FirstOrDefault(); foreach (var customerRole in customer.CustomerRoles.Where(cr => cr.Active).ToList()) if (requ != null [...]

Large file upload – asp.net

By |2012-04-23T23:08:05+00:00April 23rd, 2012|Categories: Programming|Tags: , , , |

Uploading large files in ASP.Net or MVC is a little confusing for some of us. I faced this confusing issue more than a year ago and solved it by the help of some articles online, but recently I faced the same issue I faced 1 year ago, and totally forgot how to fix it. So I wanted to list here the URL which solved all my issues a year ago, and solved it recently as well: Telerik Uploading Large Files , This article contain everything which helps to edit the web.config and IIS to make uploading large files a nice task. To know more [...]

Organize JavaScript and jQuery events – DOM-ready execution

By |2012-04-19T17:32:31+00:00April 19th, 2012|Categories: Programming|Tags: , |

In complex websites javascript and jquery events can conflict with each other, especially if you are using the same javascript files for different website pages. There are many techniques to solve this issue, and I found a good solution by following these articles: Automate firing of onload events Markup-based unobtrusive comprehensive DOM-ready execution Extending Paul Irish’s comprehensive DOM-ready execution But while using this technique I faced an issue, I wanted to call more than one init function on the same page load, for example if I have my page as sections: header, login popup, inner form, footer. And each section needs [...]

Simplest menu using CSS

By |2018-06-19T14:15:23+00:00October 3rd, 2011|Categories: Technical|Tags: , |

Many web designers I met had problems while  creating menus, specially which contains nested sub menus. In some cases it is a real pain, but in most of cases it is simple, and the problem come when the designer start to implement the simple menu the hard wrong way, it will take ages from him to implement a simple menu while it just need few lines of css code. Also he may think it can’t be done without javascript and jquery. Try to think simple while writing your next menu and may be you will need my code as a starting [...]

Avoid sending Ajax request parameters in query string style

By |2011-06-29T17:36:36+00:00June 29th, 2011|Categories: Technical|Tags: , , |

While reviewing some code, I found someone calling jQuery Ajax like this: $.ajax({       type: "POST",       url: "/AddPost",       data:  "postText="+ PostText ,       dataType: "json",       success: function (status) {        }}); //$.ajax({ And as you see in the previous code, it is sending the data using this line: data: "postText="+ PostText , This is like a query string style, this will work well but image the user inserted a special char in PostText, such as ?? you will get on the server un expected value “"jQuery15107041011152323335_1309357585354"” So never use this style while dealing with Ajax calls, you need to post it in JSON [...]