<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://ali.so/feed.xml" rel="self" type="application/atom+xml" /><link href="https://ali.so/" rel="alternate" type="text/html" hreflang="en" /><updated>2026-08-01T08:25:32+00:00</updated><id>https://ali.so/feed.xml</id><title type="html">Omar Ali</title><subtitle>Senior engineering leader building and scaling distributed engineering organizations across Europe, the Middle East, Asia and Australia. Director at Deutsche Bank / DWS Core Platforms, Berlin.</subtitle><author><name>Omar Ali</name></author><entry><title type="html">On the MacBook and the rumored switch to ARM architecture</title><link href="https://ali.so/2020/04/27/on-the-macbook-and-the-rumored-switch-to-arm-architecture.html" rel="alternate" type="text/html" title="On the MacBook and the rumored switch to ARM architecture" /><published>2020-04-27T00:00:00+00:00</published><updated>2020-04-27T00:00:00+00:00</updated><id>https://ali.so/2020/04/27/on-the-macbook-and-the-rumored-switch-to-arm-architecture</id><content type="html" xml:base="https://ali.so/2020/04/27/on-the-macbook-and-the-rumored-switch-to-arm-architecture.html"><![CDATA[<p>With rumors and confirmed leaks, it seems like Apple will introduce an ARM laptop in 2021 sporting its upcoming A14 chip. While the step makes a lot of sense given Intel’s recent struggle with improving its 14nm, trying to move to 10nm, and watching AMD storming the market with its Ryzen 7nm chips.</p>

<h2 id="challenges">Challenges</h2>
<p>The advantages are plenty for Apple, but the switch comes with its complications. For the scope of this article, I would like to handle the following challenges:</p>

<h3 id="1-performance">1. Performance</h3>
<p>While Apple can introduce more than 8 cores in its upcoming A14 chip, for consistent, long, single-threaded workloads, AMD64 architecture remains king.</p>

<h3 id="2-compatibility">2. Compatibility</h3>
<p>App Developers need to compile their apps against both AMD64 (for backwards compatibility), and ARM architectures (not to mention x86 which was supported until the release of MacOS Catalina).</p>

<h2 id="solutions">Solutions</h2>
<p>In order to create a smooth transition, like the one Apple pulled off with the switch from PowerPC (Motorola and IBM) to x86 (Intel), here’s how I think #apple can create a similar transition:</p>
<ol>
  <li>Compile all their apps against #arm: easy to achieve if not already in progress.</li>
  <li>Reach out to popular apps creators who already have apps running on iPadOS, already running ARM architecture. And with the newly introduced mouse support, iPadOS is inching closer to conversion with MacOS, and it should be relatively easy to convince major app developers to support both architectures on MacOS.</li>
  <li>Introduce the new architecture solely in small and light laptops. This would be a major selling point: laptops with no fans, much lighter, and if Apple would pass savings to users, cheaper: slightly harder </li>
  <li>Introduce dual processor support for MacBook Pro, with a similar approach used in GPU Switching (already supported),  where the ARM would be running the show until a CPU-demanding application kicks in, and the Intel chip would be spinning its fans and handling the extra power.</li>
</ol>

<h2 id="conclusion">Conclusion</h2>
<p>Only time will tell how Apple will handle this. Nonetheless, this is exciting time for the industry. ARM has been adding to its massive base on small devices like phones and tablets, small laptops like Chromebooks, AWS introducing Graviton on servers, and now Apple on laptops. The future of devices with no fans and no heatsinks is getting brighter.
What do you think? Let me know what you think in the comments section below.</p>]]></content><author><name>Omar Ali</name></author><category term="apple" /><category term="macbook" /><category term="arm" /><summary type="html"><![CDATA[With rumors and confirmed leaks, it seems like Apple will introduce an ARM laptop in 2021 sporting its upcoming A14 chip. While the step makes a lot of sense given Intel’s recent struggle with improving its 14nm, trying to move to 10nm, and watching AMD storming the market with its Ryzen 7nm chips.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://ali.so/images/omar-ali.jpg" /><media:content medium="image" url="https://ali.so/images/omar-ali.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Deploying Rails using AWS CodeDeploy</title><link href="https://ali.so/2015/11/29/rails-aws-code-deploy.html" rel="alternate" type="text/html" title="Deploying Rails using AWS CodeDeploy" /><published>2015-11-29T00:00:00+00:00</published><updated>2015-11-29T00:00:00+00:00</updated><id>https://ali.so/2015/11/29/rails-aws-code-deploy</id><content type="html" xml:base="https://ali.so/2015/11/29/rails-aws-code-deploy.html"><![CDATA[<h2 id="assumptions">Assumptions</h2>
<p>The following tutorial uses:
us-east-1, Ubuntu 14.04, Rbenv, Foreman</p>

<h2 id="iam">IAM</h2>
<p>We will create a new role that we will be launching our EC2 with.
EC2 instances launched with the new role will be able to:</p>

<ol>
  <li>Download and install CodeDeploy Agent from S3.</li>
  <li>Grant CodeDeploy access to our EC2 instances.</li>
</ol>

<h4 id="create-iam-role">Create IAM Role</h4>

<ol>
  <li>Create a new role, give it a name.</li>
  <li>Attach Policy:</li>
  <li>AWSCodeDeployRole</li>
  <li>AmazonS3ReadOnlyAccess</li>
  <li>CodeDeployEC2Permissions</li>
  <li>
    <p>Edit trust relationship:</p>

    <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> {
   "Version": "2012-10-17",
   "Statement": [
     {
       "Sid": "",
       "Effect": "Allow",
       "Principal": {
         "Service": "codedeploy.amazonaws.com"
       },
       "Action": "sts:AssumeRole"
     },
     {
       "Sid": "",
       "Effect": "Allow",
       "Principal": {
         "Service": "ec2.amazonaws.com"
       },
       "Action": "sts:AssumeRole"
     }
   ]
 }
</code></pre></div>    </div>
  </li>
</ol>

<h3 id="vpc">VPC</h3>

<h1 id="create-a-new-vpc">Create a new VPC</h1>
<p>I prefer setting up a separate VPC for every application, feel free to ignore this step if you don’t really care about this.
Class B private IPs provide a decent number of hosts and that’s what I’ll use here.</p>

<ol>
  <li>Create a new VPC</li>
  <li>Use CIDR 172.16.0.0/16</li>
  <li>Leave Tenancy as default unless you know what you’re doing.</li>
</ol>

<h4 id="subnets">Subnets</h4>
<p>Using multiple subnets will allow Scalability Groups to utilize multiple 
availability zones improves redundancy.</p>

<ol>
  <li>Create a new subnet for availability zone.</li>
  <li>For the CIDR, use 172.16.X.0/24, this would give you 251 IPs per subnet.</li>
  <li>Repeat for each availability zone or to your liking.</li>
</ol>

<h4 id="internet-gateway">Internet Gateway</h4>
<ol>
  <li>Create a new Internet Gateway to allow your VPC to receive traffic from the Internet.</li>
  <li>Choose the gateway and attach it to your VPC.</li>
</ol>

<h4 id="route-table">Route Table</h4>
<p>For Internet requests to reach your gateway, you need a routing table.</p>

<ol>
  <li>Create a routing table or use the one created alongside the VPC</li>
  <li>Go to: Routes &gt; Edit &gt; Add another route</li>
  <li>Set Destination as: 0.0.0.0/0</li>
  <li>Target should be have one autocomplete option: the gateway you created above.</li>
  <li>Save.</li>
</ol>

<h4 id="security-group">Security Group</h4>
<p>To make things more tidy, we will create a per-VPC security group and we will
attach it to all resources we create. This would allow globally enabling certain
ports or block certain IPs from accessing all resources.</p>

<h3 id="ami">AMI</h3>
<p>We now need to create an AMI that has all our project’s OS dependencies installed.
If you already have an AMI, skip to “Install CodeDeploy Agent”</p>

<p>We will use a setup similar to 
<a href="https://devcenter.heroku.com/articles/procfile">Heroku’s handling of Procfile</a> 
by using a single AMI that can dynamically be assigned one of the processes
defined in the <code class="language-plaintext highlighter-rouge">Procfile</code>.</p>

<h3 id="launch-a-new-instance">Launch a new instance</h3>
<p>Launch a new EC2 Instance and make sure you have AMI Role set to: <code class="language-plaintext highlighter-rouge">CodeDeployProfile</code>.</p>

<h3 id="install-ruby-and-bundler">Install Ruby and Bundler</h3>
<p>Install Rbenv and your chosen Ruby version:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
cd
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' &gt;&gt; ~/.bashrc
echo 'eval "$(rbenv init -)"' &gt;&gt; ~/.bashrc
exec $SHELL
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' &gt;&gt; ~/.bashrc
exec $SHELL
git clone https://github.com/sstephenson/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash
rbenv install 2.2.3
rbenv global 2.2.3
ruby -v
</code></pre></div></div>

<p>Reference: <a href="https://gorails.com/setup/ubuntu/14.04">GoRails</a></p>

<h3 id="install-codedeploy-agent">Install CodeDeploy Agent</h3>
<p>To install the agent, run the following commands:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ssh -i {PEM_FILE_PATH} ubuntu@INSTANCE_IP_OR_DNS_NAME
sudo apt-get update
sudo apt-get install awscli
sudo apt-get install ruby2.0
cd /home/ubuntu
# Replace us-east-1 with your VPC region.
sudo aws s3 cp s3://aws-codedeploy-us-east-1/latest/install . --region us-east-1
sudo chmod +x ./install
sudo ./install auto
</code></pre></div></div>

<p>If you get an error on <code class="language-plaintext highlighter-rouge">aws s3</code> command, then you either didn’t launch the EC2 
instance with the role we created in IAM section or you didn’t
follow the steps correctly.</p>

<p>Reference: <a href="http://docs.aws.amazon.com/codedeploy/latest/userguide/how-to-run-agent.html">AWS CodeDeploy</a></p>

<h3 id="create-upstart-script">Create Upstart script</h3>
<p>We need to have our application process start automatically on machine start.
In order to get this to work, we will be using Ubuntu’s Upstart.</p>

<p>The following script uses <code class="language-plaintext highlighter-rouge">Foreman</code> to run the correspondant process defined 
in the <code class="language-plaintext highlighter-rouge">Procfile</code>.
Make sure you install <code class="language-plaintext highlighter-rouge">Foreman</code> gem by running the command:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>gem install foreman
</code></pre></div></div>

<p>Then, proceed to creating the Upstart script.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sudo cat &gt; /etc/init/app.conf &lt;&lt; EOS
respawn
start on (local-filesystems and net-device-up IFACE!=lo)
stop on [!12345]
setuid ubuntu
script
set -e
chdir /app/current
export PATH=/home/ubuntu/.rbenv/bin:/home/ubuntu/.rbenv/shims:$PATH
export RAILS_ENV=production
export PORT=3000
export PROCESS=$(cat /app/role)
echo " * Starting process: $PROCESS..."
foreman start $PROCESS
end script
EOS
</code></pre></div></div>]]></content><author><name>Omar Ali</name></author><category term="aws" /><category term="rails" /><summary type="html"><![CDATA[Assumptions The following tutorial uses: us-east-1, Ubuntu 14.04, Rbenv, Foreman]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://ali.so/images/omar-ali.jpg" /><media:content medium="image" url="https://ali.so/images/omar-ali.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Sample Files for Testing</title><link href="https://ali.so/2015/06/15/file-testing-samples.html" rel="alternate" type="text/html" title="Sample Files for Testing" /><published>2015-06-15T00:00:00+00:00</published><updated>2015-06-15T00:00:00+00:00</updated><id>https://ali.so/2015/06/15/file-testing-samples</id><content type="html" xml:base="https://ali.so/2015/06/15/file-testing-samples.html"><![CDATA[<p>I often need sample files to test my code. Somtimes I need more specific files like a small MP4 file or a large PNG file, etc.
Instead of Googling, I collect samples that I think may help you.</p>

<p>The files can be accessed directly via URL:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>http://owahab.github.io/downloads/samples/{file}
</code></pre></div></div>

<p>The list of samples can be found here:
<a href="https://github.com/owahab/owahab.github.io/tree/master/downloads/samples">https://github.com/owahab/owahab.github.io/tree/master/downloads/samples</a></p>

<p>Enjoy!</p>]]></content><author><name>Omar Ali</name></author><category term="samples" /><category term="testing" /><summary type="html"><![CDATA[I often need sample files to test my code. Somtimes I need more specific files like a small MP4 file or a large PNG file, etc. Instead of Googling, I collect samples that I think may help you.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://ali.so/images/omar-ali.jpg" /><media:content medium="image" url="https://ali.so/images/omar-ali.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Rails with AWS CloudFront</title><link href="https://ali.so/2015/04/07/cloudfront-cors-rails.html" rel="alternate" type="text/html" title="Rails with AWS CloudFront" /><published>2015-04-07T00:00:00+00:00</published><updated>2015-04-07T00:00:00+00:00</updated><id>https://ali.so/2015/04/07/cloudfront-cors-rails</id><content type="html" xml:base="https://ali.so/2015/04/07/cloudfront-cors-rails.html"><![CDATA[<p>Let’s confess, Rails isn’t very good at serving static assets.
Ideally, you’d have Nginx taking care of this job which it does pretty well.</p>

<p>However, in some cases, you can’t have Nginx running in front of your
application server. For example, when you’re running on Heroku.</p>

<p>To serve your assets more efficiently, a good way to do it is to serve those
assets from a CDN. For this, my favorite pick is Amazon AWS CloudFront.</p>

<h3 id="create-a-new-distribution">Create a new distribution</h3>

<p>You need an Amazon AWS account to get this done.
Log in to the CloudFront control panel and select ‘Create distribution’.
When prompted for the delivery method, select ‘Web’.</p>

<p>You should type the domain name for your application as the
‘Origin Domain Name’ field. Just make sure to include www if you serve
from www because CloudFront won’t play nice with redirections. You will
see 302 Moved Permanently and CloudFront will redirect back to your domain
every time you request an asset.</p>

<p>Also make sure you choose ‘Whitelist’ from the ‘Forward Headers’ dropdown then
pick ‘Origin’ from the ‘Whitelist Headers’ and hit ‘Add »’.</p>

<p>Once the distribution is created (takes less than 10 mins), test it by
requesting an asset from your newly created CloudFront distribution.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>http://www.example.com/assets/application-&lt;HASH&gt;.css
</code></pre></div></div>

<p>becomes:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>http://&lt;YOUR DISTRIBUTION SUBDOMAIN&gt;.cloudfront.net/assets/application-&lt;HASH&gt;.css
</code></pre></div></div>

<h3 id="configure-rails-to-serve-static-assets">Configure Rails to Serve Static Assets</h3>

<p>Now we need to configure Rails to serve assets from CloudFront. In order to do 
so, you need to uncomment and modify the following line:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># config/environments/production.rb
config.action_controller.asset_host = "&lt;YOUR DISTRIBUTION SUBDOMAIN&gt;.cloudfront.net"
</code></pre></div></div>

<p>When you deploy this, your application should start serving assets from 
CloudFront. Yay!</p>

<h3 id="cors">CORS</h3>

<p>So far, your JavaScript, Stylesheets and images would work fine. However, some
other asset types like fonts won’t work due to CORS (Cross-Origin Resource
Sharing).</p>

<p>In this case, you will see the following error in Chrome Console:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Font from origin 'http://xyz123.cloudfront.net' has been blocked 
from loading by Cross-Origin Resource Sharing policy: No 
'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://example.com' is therefore not allowed access.
</code></pre></div></div>

<p>This basically means that your Rails application should grant CloudFront 
access to its by-default-private assets like fonts because only then CloudFront
will pass the CORS headers back in its response, browsers will know that 
CloudFront (which is the owner of the asset from the browsers’ point of view) 
is granting your domain access to CloudFront’s assets.</p>

<p>One easy way to do this is by adding <code class="language-plaintext highlighter-rouge">rack-cors</code> to your <code class="language-plaintext highlighter-rouge">Gemfile</code>:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>gem 'rack-cors', :require =&gt; 'rack/cors'
</code></pre></div></div>

<p>After running <code class="language-plaintext highlighter-rouge">bundle</code>, you need to configure your application to insert the 
headers in the Rack Middleware. The following sample is quite permissive but it
will suffice for the purpose of this blog post:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>config.middleware.insert_before 0, "Rack::Cors" do
  allow do
    origins '*'
    resource '*', :headers =&gt; :any, :methods =&gt; [:get, :head, :options]
  end
end
</code></pre></div></div>

<p>This, combined with the ‘Whitelist’ option we chose in the first step, would
allow CloudFront to serve your fonts correctly.</p>

<p>References:</p>

<ul>
  <li>https://devcenter.heroku.com/articles/using-amazon-cloudfront-cdn#amazon-cloudfront</li>
</ul>]]></content><author><name>Omar Ali</name></author><category term="rails" /><category term="aws" /><category term="cloudfront" /><category term="cors" /><summary type="html"><![CDATA[Let’s confess, Rails isn’t very good at serving static assets. Ideally, you’d have Nginx taking care of this job which it does pretty well.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://ali.so/images/omar-ali.jpg" /><media:content medium="image" url="https://ali.so/images/omar-ali.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Goodbye OverC Studios</title><link href="https://ali.so/2015/01/16/Goodbye-overc-studios.html" rel="alternate" type="text/html" title="Goodbye OverC Studios" /><published>2015-01-16T00:00:00+00:00</published><updated>2015-01-16T00:00:00+00:00</updated><id>https://ali.so/2015/01/16/Goodbye-overc-studios</id><content type="html" xml:base="https://ali.so/2015/01/16/Goodbye-overc-studios.html"><![CDATA[<p>A year and a half ago, I left Raya to start a new business with Yousef Osman 
and Chris Miller.</p>

<p>I have had already joined few startups at different stages but OverC Studios 
was the first time I start from scratch.</p>

<p>I made a lot of mistakes, learnt a lot of lessons. Most of these lessons are
already mentioned in the great book “The Lean Startup” by Eric Reis. I highly 
recommend the book for everyone working for a startup, not just founder.</p>

<h4 id="few-lessons-i-learnt">Few lessons I learnt:</h4>

<h5 id="1-be-aggressive">1. Be aggressive:</h5>

<p>Approach your ideas using the most straightforward way. Fail fast or succeed
fast.</p>

<h5 id="2-ship-before-youre-ready">2. Ship before you’re ready:</h5>

<p>Another very common mistake was trying to ship something that we are not 
ashamed of.
Lesson learnt: if you are not ashamed of your product then you probably 
haven’t built anything.</p>

<h5 id="3-recruit-the-right-team">3. Recruit the right team:</h5>

<p>One of the few things we did right was hiring the right team. For a startup in
this early stage, we needed a team that can pivot fast, learn a lot and build
things that we weren’t sure how their final status would be.</p>

<h5 id="4-identity">4. Identity:</h5>

<p>I can’t emphasize on the importance of your company identity.
Don’t waste your time trying to be everything for everyone.
We wasted a lot of time trying to get services and build products and that time
was very dear.</p>

<p>It has been a great journey and I truly enjoyed every day of it. 
Goodbye OverC Studios.</p>]]></content><author><name>Omar Ali</name></author><category term="overc" /><category term="work" /><category term="entrepreneurship" /><summary type="html"><![CDATA[A year and a half ago, I left Raya to start a new business with Yousef Osman and Chris Miller.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://ali.so/images/omar-ali.jpg" /><media:content medium="image" url="https://ali.so/images/omar-ali.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Saving Paperclip Attachemnts Encoded Base64</title><link href="https://ali.so/2013/08/26/Saving-Base64-Paperclip-Rails.html" rel="alternate" type="text/html" title="Saving Paperclip Attachemnts Encoded Base64" /><published>2013-08-26T00:00:00+00:00</published><updated>2013-08-26T00:00:00+00:00</updated><id>https://ali.so/2013/08/26/Saving-Base64-Paperclip-Rails</id><content type="html" xml:base="https://ali.so/2013/08/26/Saving-Base64-Paperclip-Rails.html"><![CDATA[<h3 id="the-problem">The problem:</h3>
<p>You need to upload an image from a mobile device to a Rails application which uses Paperclip.</p>

<p>Your model might look similar to this:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>class User &lt; ActiveRecord::Base
  attr_accessible :name
  has_attached_file :image,
  styles: {
    small: '90x90#',
    medium: '160x120#',
    large:  '300x200#',
  } And you want to be able to upload user images.
</code></pre></div></div>

<h3 id="the-solution">The solution</h3>

<p>You need to add the following to your model:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>def image_data=(data_value)
  StringIO.open(Base64.strict_decode64(data_value)) do |data|
    data.class.class_eval { attr_accessor :original_filename, :content_type }
    data.original_filename = "temp#{DateTime.now.to_i}.png"
    data.content_type = "image/png" #TODO: get content type from file
    self.image = data
  end
</code></pre></div></div>

<p>Voila!</p>]]></content><author><name>Omar Ali</name></author><category term="ruby" /><category term="rails" /><summary type="html"><![CDATA[The problem: You need to upload an image from a mobile device to a Rails application which uses Paperclip.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://ali.so/images/omar-ali.jpg" /><media:content medium="image" url="https://ali.so/images/omar-ali.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Why switch to Ruby on Rails?</title><link href="https://ali.so/2012/12/13/Why-switch-to-Ruby-on-Rails.html" rel="alternate" type="text/html" title="Why switch to Ruby on Rails?" /><published>2012-12-13T00:00:00+00:00</published><updated>2012-12-13T00:00:00+00:00</updated><id>https://ali.so/2012/12/13/Why-switch-to-Ruby-on-Rails</id><content type="html" xml:base="https://ali.so/2012/12/13/Why-switch-to-Ruby-on-Rails.html"><![CDATA[<p>I kind of have been asked this question over and over so this is a reference if 
you were ever asked the same question.</p>

<p>###Preamble</p>

<p>Rails is an extremely mature RAD Framework to the extent that it’s currently 
driving the MVC bandwagon. A lot of effort has been put by Java, PHP, Python and a lot more languages’ communities to port or clone what Rails has offered. CakePHP, Symfony (PHP), PHP on Trax, Code Igniter (PHP), Grails (Java) and Django (Python) to name a few.</p>

<p><strong>The major pillars of Rails strength are:</strong></p>

<p>###Reusing open source components</p>

<p>With a central repository of reusable modules, numbers can easily speak for 
themselves. There has been 56,022 gems (Ruby and Rails modules/plugins) created 
since July 2009. The second best after Rails is Drupal (LAMP CMS) with a shy 
19,358. References: rubygems.org and drupal.org.</p>

<p>###Creating reusable components</p>

<p>Rails has a very unique advantages over many web application frameworks 
(including but not limited to PHP ZendFramework, Drupal and Django) which is 
being very strict MVC model, great attention to core backward-compatibility, 
being an integrated framework and the Ruby gems architecture (dependency 
management, package management, etc) has helped making gem creating a very easy 
job. Reference: being a Drupal module maintainer for years 
(http://drupal.org/user/75702) and a Ruby gems maintainer for couple years.</p>

<p>###Productivity</p>

<p>With Rails’ scaffolding, easy Form APIs, strong ORM, Ruby’s simple syntax, huge 
resources (documentation, tutorials, podcasts, video casts, code samples, etc) 
and being open source, starting a new project from scratch can not be quicker.
Learning curve has always been the greatest challenge when starting with a new 
technology. With Ruby on Rails, teams I worked with started producing working 
code since day 1 and while still knowing very less about both the language and 
the framework.
The great thing about Ruby is that it’s a mixture between Java, PHP, Perl and 
Lisp which makes it a lot easier to learn for our team where everyone is coming 
from Java and PHP background.</p>

<p>###Deployment</p>

<p>Ruby on Rails currently offers a plenty of possibilities to run it on production
, it can even run under Apache, the way PHP does. Which makes it very easy to 
install on development and production.
With a lot of mature deployment tools like Capistrano, updating code and 
database on production is an easy job.
Rails also leverages a great deal of support from cloud providers: Heroku, 
Amazon AWS, and EngineYard to name a few.</p>

<p>###Testing</p>

<p>With Rails, Unit Testing is integrated in the framework, Behavior testing tools 
like Cucumber are very mature, UI testing tools are already used in other 
technologies (like Watir).
While we won’t start with all these types of testing, we will definitely 
increase our quality by automating testing on many levels which is something we,
 as a small team, need to do.</p>]]></content><author><name>Omar Ali</name></author><category term="ruby" /><category term="rails" /><summary type="html"><![CDATA[I kind of have been asked this question over and over so this is a reference if you were ever asked the same question.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://ali.so/images/omar-ali.jpg" /><media:content medium="image" url="https://ali.so/images/omar-ali.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Organize your downloads, the OS X way</title><link href="https://ali.so/2010/06/20/Organize-your-downloads-the-osx-way.html" rel="alternate" type="text/html" title="Organize your downloads, the OS X way" /><published>2010-06-20T00:00:00+00:00</published><updated>2010-06-20T00:00:00+00:00</updated><id>https://ali.so/2010/06/20/Organize-your-downloads-the-osx-way</id><content type="html" xml:base="https://ali.so/2010/06/20/Organize-your-downloads-the-osx-way.html"><![CDATA[<p>If you are one of these guys who move files and organize them manually under the correct directory, this blog post isn’t for you.</p>

<p>I usually download lots of files and I keep trying to cleanup my Downloads folder in so many ways. First, I configured every application to download in its own folder so I had Firefox, iChat, Mail, etc…</p>

<p>This didn’t really help. When the time comes to cleanup the Downloads folder, I usually need to delete very old downloads because I no longer need a software update from mid-2009.</p>

<p>So next I tried one of Firefox’s extensions to organize my downloads and used Glims for Safari. The idea was to organize downloaded files in a directory hierarchy where I can identify older files and remove them.</p>

<p>The problem with that solution is that it didn’t work for all the applications I use so I decided to write a script to do that for me.</p>

<p>Writing that script in Bash, PHP or Python is an easy job but I wanted to do it the Mac way so I created this AppleScript and attached it to the Downloads folder using Folder Actions in OS X.</p>

<h3 id="try-it-out">Try it out!</h3>

<script src="https://gist.github.com/445641.js"> </script>]]></content><author><name>Omar Ali</name></author><category term="mac" /><category term="osx" /><category term="applescripts" /><summary type="html"><![CDATA[If you are one of these guys who move files and organize them manually under the correct directory, this blog post isn’t for you.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://ali.so/images/omar-ali.jpg" /><media:content medium="image" url="https://ali.so/images/omar-ali.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Firefox finally did it!</title><link href="https://ali.so/2009/12/22/Firefox-finally-did-it.html" rel="alternate" type="text/html" title="Firefox finally did it!" /><published>2009-12-22T00:00:00+00:00</published><updated>2009-12-22T00:00:00+00:00</updated><id>https://ali.so/2009/12/22/Firefox-finally-did-it</id><content type="html" xml:base="https://ali.so/2009/12/22/Firefox-finally-did-it.html"><![CDATA[<p>Yaay! Firefox is now the world most popular browser:</p>

<p>http://gs.statcounter.com/#browser_version-ww-weekly-200827-200951</p>

<p>Viva Open Source!</p>]]></content><author><name>Omar Ali</name></author><category term="foss" /><category term="firefox" /><category term="browsers" /><summary type="html"><![CDATA[Yaay! Firefox is now the world most popular browser:]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://ali.so/images/omar-ali.jpg" /><media:content medium="image" url="https://ali.so/images/omar-ali.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Entering the Mac world</title><link href="https://ali.so/2009/06/06/Entering-the-Mac-world.html" rel="alternate" type="text/html" title="Entering the Mac world" /><published>2009-06-06T00:00:00+00:00</published><updated>2009-06-06T00:00:00+00:00</updated><id>https://ali.so/2009/06/06/Entering-the-Mac-world</id><content type="html" xml:base="https://ali.so/2009/06/06/Entering-the-Mac-world.html"><![CDATA[<p>After a long time of comparing Notebooks and Netbooks, I decided to buy a MacBook from Apple. I must say it feels a lot comfortable than GNOME, as stylish as KDE, much stable than Ubuntu and a heart full of BSD. I quickly installed most of the stuff I needed for my daily stuff, migrated my stuff from my last Linux laptop, got few things tweaked here and there and everything was as good as I wanted it. Another happy mac user.</p>]]></content><author><name>Omar Ali</name></author><summary type="html"><![CDATA[After a long time of comparing Notebooks and Netbooks, I decided to buy a MacBook from Apple. I must say it feels a lot comfortable than GNOME, as stylish as KDE, much stable than Ubuntu and a heart full of BSD. I quickly installed most of the stuff I needed for my daily stuff, migrated my stuff from my last Linux laptop, got few things tweaked here and there and everything was as good as I wanted it. Another happy mac user.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://ali.so/images/omar-ali.jpg" /><media:content medium="image" url="https://ali.so/images/omar-ali.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Delivering emails to GMail, Yahoo! and Hotmail</title><link href="https://ali.so/2007/05/18/Delivering-emails-gmail-yahoo-hotmail.html" rel="alternate" type="text/html" title="Delivering emails to GMail, Yahoo! and Hotmail" /><published>2007-05-18T00:00:00+00:00</published><updated>2007-05-18T00:00:00+00:00</updated><id>https://ali.so/2007/05/18/Delivering-emails-gmail-yahoo-hotmail</id><content type="html" xml:base="https://ali.so/2007/05/18/Delivering-emails-gmail-yahoo-hotmail.html"><![CDATA[<p>Introduction: in the mid-2002, many e-mail providers like Yahoo and Hotmail (no GMail at that time) started the war against spam and they went on improving spam fighting since then.
Now domain owners are fighting with anti-spam solutions which are blocking their innocent e-mails.
This blog entry is a result of one of the fights happening everyday :)</p>

<p>GMail:</p>

<p>Google was the easiest mail vendor to deal with, it relies solely on an open standard called SPF which is simply a TXT record a domain owner can put on his domain’s DNS zone to state that the domain is fully responsible for e-mails sent from it under specific circumstances.
Read more at http://www.openspf.org/Introduction
In the OpenSPF website you will find a wizard that will help you generate your SPF signature.
After adding the SPF TXT record, e-mails started to appear in the Inbox instead of junk.
I must confess that I strongly believe that GMail does <em>NOT</em> discard any e-mail coming to your account even if it recognized it’s even a phishing e-mail!</p>

<p>Yahoo!:</p>

<p>Yahoo is also fond of open source solutions and the folks there started relying on DomainKeys Identified Mail, aka DKIM, which is a collaborative work between many IT big names like: Alt-N Technologies, AOL, Brandenburg Internetworking, Cisco, EarthLink, IBM, Microsoft, PGP Corporation, Sendmail, StrongMail Systems, Tumbleweed, VeriSign plus Yahoo! for sure.
PS: Microsoft was participating in DKIM and then it used its own technology instead of DKIM! These guys keep surprising me.
Anyways DKIM is a bit tough solution since it requires patching your mail server to attach your DKIM Public Key with every outgoing e-mail which is then being matched with what the mail receiver requests from the sender domain and in case they match then Yahoo, for example, will allow this e-mail to its inbox if the sender domain isn’t blacklisted by Yahoo or by any public blacklist.
Read more at http://www.ietf.org/rfc/rfc4871.txt
The interesting thing was: when Yahoo doesn’t find a DKIM in the message, it falls back to SPF and will behave like GMail will do with a message.</p>

<p>Hotmail:</p>

<p>Microsoft, as I mentioned above, was collaborating in the DKIM. But they use their own technology, called SenderID. Sender ID is basically SPF with Microsoft’s spices. SenderID is a caching system for SPF records. Thus you will find things a bit quicker if you e-mailed senderid@microsoft.com to inform them you changed your SPF record or created one. Then they will reload your domain’s cache.
Read more at http://www.microsoft.com/senderid
Once again this means that Microsoft relies on SPF. After creating SPF record for the domain under investigation, e-mails started to appear in Hotmail’s junk mail which isn’t expected and is an indicator that there’s something else to do.</p>

<p>I hope this helps anyone.</p>]]></content><author><name>Omar Ali</name></author><summary type="html"><![CDATA[Introduction: in the mid-2002, many e-mail providers like Yahoo and Hotmail (no GMail at that time) started the war against spam and they went on improving spam fighting since then. Now domain owners are fighting with anti-spam solutions which are blocking their innocent e-mails. This blog entry is a result of one of the fights happening everyday :)]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://ali.so/images/omar-ali.jpg" /><media:content medium="image" url="https://ali.so/images/omar-ali.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">PHP on Cake vs Ruby on Rails</title><link href="https://ali.so/2006/05/15/PHP-Cake-vs-Ruby-on-Rails.html" rel="alternate" type="text/html" title="PHP on Cake vs Ruby on Rails" /><published>2006-05-15T00:00:00+00:00</published><updated>2006-05-15T00:00:00+00:00</updated><id>https://ali.so/2006/05/15/PHP-Cake-vs-Ruby-on-Rails</id><content type="html" xml:base="https://ali.so/2006/05/15/PHP-Cake-vs-Ruby-on-Rails.html"><![CDATA[<p>Recently I had the opportunity to attend a seminar about Ruby on Rails, things were nice with Ruby and Rails, I liked scaffolding, I also liked the various features of Rails and I think it’s the real power of RoR.</p>

<p>Afterwards I deceided to put Rails versus Cake PHP, a PHP framework that works on all recent PHP versions from 4.3.2 till 5.0 (I haven’t tested it on PHP 5.1 but I think it will need some hands-on work to have it error-proof).</p>

<p>I started by creating a simple e-commerce database-driven site with them both and overall result I get is: I really see that Cake PHP is a PHP version of Rails.
But here’s what I found in details:</p>
<ol>
  <li>MVC: both follow the MVC pattern (Model, View and Controller) and both are OOP.</li>
  <li>Naming convention: the smart English recognition provided is cool (simply you have to call all your DB tables in plural, but both are smart enough to understand that people is the plural of person!).</li>
  <li>Directory structure: Cake PHP has the same directory hirarchy of a typical Rails application.</li>
  <li>Web 2.0: Both support AJAX, maybe in a little bit different ways but still both can create AJAX stuff with ease.</li>
  <li>Testing: Both were built with testing in mind, you simply provide your application with three databases: testing, developing and production. This way you can always guarantee your testing team leader will be satisfied or you can guarantee a no-white-screen-of-death pages in your application.</li>
  <li>Plugins: are great addons to Rails while Cake is still laking community, but I think it will sooner attract more developer and I think the white page in Cake PHP’s site will one day have some text!</li>
  <li>Caching: caching is supported in both of them, I haven’t yet tested this myself on them both.</li>
  <li>IDE: Ruby on Rails has now many some nice IDE’s, they’re already MVC ready, while PHP is still laking a good IDE (forget about it’s free or not), I still see only Zend Studio offering some real power of an IDE (though it’s very expensive for the punch of features it offers.</li>
</ol>

<p>Conclusion:
I liked how creating blogs, forums and other famous applications is some lines of code, things can go easy with your combo-sized applications, I also liked the idea of structuring your applications the same way, this has two sides: it will allow everyone to understand your data flow, we will all enjoy ease of coding and refactoring other’s code, and this is the good part of it, the bad part is simply it will allow everyone to fool your application because everyone knows your directory structure, this is a big security risk –IMHO. And unless your choice of the framework is right, you may find yourself having many security halls not because what you types, it’s because the framework has these bugs already installed! I do not think I can afford the time to debug a framework, thus it’s better off using a framework of a reasonable community to have my bugs solved quickly.</p>

<p>I think if you’re in a hurry to start an application, or have a very near deadline for an application, you should take a look at your flavor of MVC framework (Rails or Cake), you will be astonished. But I, for many reasons, don’t like having everything going that rapid, I still won’t go the MVC framework way without getting things more obvious and more stable.</p>]]></content><author><name>Omar Ali</name></author><summary type="html"><![CDATA[Recently I had the opportunity to attend a seminar about Ruby on Rails, things were nice with Ruby and Rails, I liked scaffolding, I also liked the various features of Rails and I think it’s the real power of RoR.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://ali.so/images/omar-ali.jpg" /><media:content medium="image" url="https://ali.so/images/omar-ali.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Ruby 1.8.4 on Ubuntu</title><link href="https://ali.so/2006/05/09/Ruby-Ubuntu.html" rel="alternate" type="text/html" title="Ruby 1.8.4 on Ubuntu" /><published>2006-05-09T00:00:00+00:00</published><updated>2006-05-09T00:00:00+00:00</updated><id>https://ali.so/2006/05/09/Ruby-Ubuntu</id><content type="html" xml:base="https://ali.so/2006/05/09/Ruby-Ubuntu.html"><![CDATA[<p>I tried installing Ruby and Rails on Ubuntu 5.10 (Breezy), I followed exactly 
what was written in the article: 
<a href="http://fo64.com/articles/2005/10/20/rails-on-breezy">http://fo64.com/articles/2005/10/20/rails-on-breezy</a></p>

<p>But I ran into trouble with Rails after the installation, Rails said: “Rails 
does not work with Ruby version 1.8.3”.</p>

<p>After some search and a friend’s help, it appears that you have to do the 
following BEFORE you follow what’s in the article:
download your architecture-specific packages from:</p>

<pre><code class="language-http://packages.ubuntu.com/dapper/libs/libruby1.8">http://packages.ubuntu.com/dapper/interpreters/ruby1.8
</code></pre>

<p>Then <code class="language-plaintext highlighter-rouge">dpkg -i</code> for both packages.</p>

<p>Finally <code class="language-plaintext highlighter-rouge">apt-get install rails</code></p>

<p>Now you have Ruby 1.8.4 on Ubuntu.</p>

<p>Enjoy!</p>]]></content><author><name>Omar Ali</name></author><category term="ruby" /><category term="rails" /><category term="ubuntu" /><summary type="html"><![CDATA[I tried installing Ruby and Rails on Ubuntu 5.10 (Breezy), I followed exactly what was written in the article: http://fo64.com/articles/2005/10/20/rails-on-breezy]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://ali.so/images/omar-ali.jpg" /><media:content medium="image" url="https://ali.so/images/omar-ali.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">PHP6: Is it a suitable time?</title><link href="https://ali.so/2006/04/29/PHP6-is-it-a-suitable-time.html" rel="alternate" type="text/html" title="PHP6: Is it a suitable time?" /><published>2006-04-29T00:00:00+00:00</published><updated>2006-04-29T00:00:00+00:00</updated><id>https://ali.so/2006/04/29/PHP6-is-it-a-suitable-time</id><content type="html" xml:base="https://ali.so/2006/04/29/PHP6-is-it-a-suitable-time.html"><![CDATA[<p>Since I started to read the news about PHP5, I was happy that Zend has finally deceided to bring us some real OOP to the world of PHP, regardless whether the OOP approch in PHP5 is what really we all wanted or not, still a good step I see in PHP5.</p>

<p>The major problem with PHP5 was its bad backword-compatibility with PHP4; forget about PHP3; thus major PHP scripts specially open-source mostly faild to work on PHP5 environment. The reason I saw behind this failure was mainly in the pass-by-reference since PHP5 passes by reference while PHP4 passes by value (which is extremely strange thing).</p>

<p>Anyways, I; like many PHP coders; started to gather news and stuff about PHP5: what’s new, how to convert current code, and so forth. I do not think I was that late to do this but after I was OK with all the new stuff in PHP5 I suddenly read in the news about PHP6!!</p>

<p>I was really astonished! The point is: the duration between the release of PHP4 and PHP5 compared to the duration between the release of PHP3 and PHP4 gives you the impression that Zend is really keen to have the market and the developers setteled with every PHP version, and when all the juice is squeezed from the PHP version Zend releases the new version. So what happened? What changed all this?</p>

<p>The PHP6 Meeting in Paris has shown some great amount of features for PHP6, some of them are really long-awaited, but why lagging all this until PHP6? Why not just add them all to PHP5?</p>

<p>I; for one; think that if PHP5 is going to break most PHP4 programs and scripts with the changes applied to the OOP model, so what was the problem with adding the changes in PHP core that the meeting in Paris introduced to the core of PHP?</p>

<p>I strongly recommend all of us to hold upgrades to current PHP scripts until Zend sets a date for the release of PHP6 which is expected to be the end of 2006 or the mid of 2007, instead of upgrading current work twice.</p>]]></content><author><name>Omar Ali</name></author><category term="php" /><category term="php6" /><summary type="html"><![CDATA[Since I started to read the news about PHP5, I was happy that Zend has finally deceided to bring us some real OOP to the world of PHP, regardless whether the OOP approch in PHP5 is what really we all wanted or not, still a good step I see in PHP5.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://ali.so/images/omar-ali.jpg" /><media:content medium="image" url="https://ali.so/images/omar-ali.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry></feed>