Posts

The butterfly side effect in making later appointments

One of the things I learned in life when dealing with appointments at service centers, specifically Visa Related appointments, is to be there as early as possible.  pick the first appointment possible. KSA visa appointments with  vfstasheel  in Egypt starts at 9:00 and is available as 15 minutes slots. The point is,  if you picked 9:00, you should be there 15 minutes earlier which might be too early for some people. However, picking 9:30 appointment doesn't mean you are simply shifting everything for 30 minutes.  You will be subjecting yourself to lots of factors that cause delay in the processing of your paperwork.  you might be actually 1.5 hours later in finishing time.  Picking an appointment at 2:00 pm  might cause you to finish at 7:00 pm or even later. Shit happens,  and the less early you are,  the more you are to be affected by issues with other people or even issues with the employees themselves. Best practice,  be ...

Sharing Is Caring

As they always say "Sharing is caring",  However, it struck me that for new generations, specially with those heavily using Facebook , that it might need emphasize on the different meanings that the term sharing started to have. "Sharing is caring"  means allowing others to use or consume something that belongs to self. usually food or toys among children. The term has evolved in the modern Facebook sphere. Sharing on Facebook started as actually something similar. You find something nice, you share it with others because you care about those others. However, when "others" become a mass, things gets different.  You can care about someone but you cannot care about "others",  that's why we call them "others". The caring implied by sharing drifted from those to whom we share,  to the person who is involved in the topic of sharing. Or the voice of original author of something, who will be offered more exposure and outreach by you...

Android Marshmallow highlights

Image
Nearly a couple of weeks ago, I got system update of Android 6 , Marshmallow on my  Google Nexus 5 . Having system updates early is one of the things I like much about  Google Nexus devices. There are several wonderful things in the new android, but I was eagerly waiting for this update, specifically for the selective permissions module. Lots of android apps use lots of excessive permissions. too much than necessary IMHO. However, let me tell you about how I found things. One of the things I liked a lot since my last version of android is the launcher app menu,  I used to have to swipe left several times to get to apps with names starting with letters coming late in the alphabet (Z, x, S,  and arabic names).  Android 6 default app menu avoids this horizontal scrolling. and: 1) Uses vertical scrolling which is more natural and usable for users 2) Allows you to search apps, to reach the app quickly by typing a couple of letters form its name 3) The mo...

Converting a batch of files of csv format to xls or xlsx

While working with data, we tend to deal a lot with CSV files. It is more efficient and trivial to manipulate csv data either through command line tools or through programming languages like ruby. However, occasionally we need to convert files to MS Excel format before sending them to 3rd party. Gnumeric is a wonderful opensource spreadsheet program.  It contains a command line convertion tool called ssconvert that can be used to perform direct conversion among lots of supported formats easily from the command line. For example, conversion from csv to xlsx can be done via ssconvert  file.csv file.xlsx OR ssconvert  file.csv --export-type=Gnumeric_Excel:xlsx It can be installed in ubuntu via apt-get install gnumeric In order to convert lots of files, I wrote a simple bash script that will process all csv files in the current directory and generate the corresponding xlsx files.  The script came pretty handy in data preparation. I believe i can be h...

Google Adsense Sensitive Categories

Image
According to a note from Google Adsense website,  starting last month, they rolled out new beta inventory of ads that might be bothering to some people, which is "Social Casino Games". This includes poker, bingo, lotteries among other games. If you are like me, do not like showing such ads even with the slightest possibility that they could be seen by the ads engine as relevant to some of your content,  you can opt out of them.  Simply by clicking "Allow and block ads" at the top, then choosing "Sensitive Categories", and block the categories you do not like. (see the image below)

Smarter Egypt Hackathon, Nov 2014

Image
Last weekend, IBM Egypt in cooperation with ITI  and other parties organized a 4 days hackathon in the theme of applying big data technologies to solve national problems in Egypt . The organizing parties involved: Information Technology Institute (ITI) that hosted the event and highly promoted it, in belief of the value of such activity towards the national development of the country, as well as allowing its students, among others, a chance to refine their skills, gain hands on experience on real world critical problems and a chance to make sounding success stories. IBM, Beside the national target, IBM has ongoing cooperation with ITI. and the event was a good chance to promote IBM Technologies, specially in the national projects domain. possible success stories would have high ROI for IBM. Government representatives from few domains that were target of the hackathon theme. The representatives brought sample amounts of data, and their domain experience about their fields...

Facebook "Thank you" moments

Few years ago, Facebook launched their "7 years look back" videos. where any Facebook user can go to  https://www.facebook.com/lookback  to find a video generated for him, showing highlights over his historical activities and photos, beautifully animated along with a nice background music, and it went viral. everybody like to watch and share his highlights. Nowadays, something more of that kind is up.  Facebook launched "Thank you" videos. Facebook users can visit  https://www.facebook.com/thanks  with a list of friends on the side. Upon selecting a friend, a video will be generated with a wonderful theme and soundtrack showing highlights between you both. with generic thank you words. The content is usually photos where  are you both tagged in, or posts made by one of you where the other is tagged. Of course starting with your spouse by default :) The wonderful part is that you can go through the list, and see highlights of you and different people...

Stress Testing with Siege and Bombard, know your limits

Image
I couldn't find a clear quick intro on getting siege and bombard in action, so I'm writing one here. Siege is a load testing and benchmarking utility that has been available for quite a while, It allows you to hit your web application on a specific url (or a set of urls in a file) with specific concurrency and size settings.  siege summarizes the measures of the test outcome including: Transaction rate (requests/sec) Actual concurrency (even if you hit with 200 concurrent connections, your server might be responding with just 80) Average, longest and shortest response time example: triggering 200 concurrent users, each hitting the url twice siege -c200 -r2 http://www.modsaid.com/ summary: Transactions:         400 hits Availability:      100.00 % Elapsed time:       38.44 secs Data transferred:        0.26 MB Response time:       10.09 secs Tra...

Linode finally back to the new baseline of VPS Hosting

2 days ago Linode finally announced their new VPS Hosting offering with doubling the RAM and moving to Fast SSD storage SSD Storage will allow much faster operations for both setup operations, compilation and ongoing running services. And the new memory upgrade is considered a drop in the pricing to the half, since people can now use the same server Ram with half the price they used to pay. The smallest Instance offered by linode is now the 2GB Instance with $20/mo as stated in their pricing list: Plan RAM SSD CPU Transfer Outbound Bandwidth Price Linode 2G 48 GB 2 cores 3 TB 250 Mbps $0.03/hr | $20/mo Linode 4G 96 GB 4 cores 4 TB 500 Mbps $0.06/hr | $40/mo Linode 8G 192 GB 6 cores 8 TB 1 Gbps $0.12/hr | $80/mo Linode 16G 384 GB 8 cores 16 TB 2 Gbps $0.24/hr | $160/mo Linode 32G 768 GB 12 cores 20 TB 4 Gbps $0.48/hr | $320/m...

Redmine service hook for github

Github services github.com allows you to activate some service hooks on your code repository. Hooks include lots of interesting functionality like posting email notification about commits among others. At eSpace , we use github.com as our code repository, and redmine as our project management tool and issue tracking. We wanted commits to reflect automatically in the project management tool, which will keep the whole team feeling the progress directly. All service hooks are open source, you'll need to add them to  https://github.com/github/github-services  by Forking  https://github.com/github/github-services implementing ur new service or patch sending pull request to the original repo Redmine service hook A service already existed for redmine to cover the following need: For code browsing to work well in redmine, it was found that the best way to do it with git, is to let redmine watch a local clone of the repo... upon pushing new commits to github...

Organize your readings with Pocket, opportunity for more

I have been using pocket for a while now to queue all the articles I want to read, so I can avoid interruptions and read them when the time is more convenient.  This was actually the philosophy of the app since it was known as Read It Later . This allows me to go through the list later on mobile while i'm in transportation or waiting at some facility. Seems perfect,  but actually things don't go just perfect.  not something wrong in the app, but rather myself.  Like lots of people out there, I'm a lazy procrastinating person. I'm working on fixing this, however, it is a fact I have to admit. This resulted in a fact that I queue lots and lots of stuff in pocket, and read a lot lot less than what's there.  Saving things on pocket queue gives you a sense that it won't be lost and you can always get back to read it whenever you want. well... sometimes this "whenever" is not good with lazy people. With a clear options to ignore those people, which...

Exporting data from remote mysql instance in csv, using mysql client and sed

Mysql allows exporting query results to csv using the INTO OUTFILE , like the following example: SELECT a,b,a+b INTO OUTFILE '/tmp/result.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM test_table; This, however, will cause the data to be exported to the file system of the database server.  Sometimes you do not have access to that server and you are only connected remotely from a different machine using mysql command line. One way to export the data is to pass a query and redirect the output to a file as follows $ mysql -u USERNAME -p PASSWORD -h DB_SERVER mydb -e "SELECT a,b,a+b INTO OUTFILE FROM test_table;" > output.txt This will do the trick, except that the resulting file is TAB separated instead of CSV. You can simply download the file and open it using any text editor and replace all tabs with commas. but that's not practical for large data sets.  Instead, we...

Backup and Restore Git Repositories

Sometimes you need to move repositories from your local git server to github.com, bitbucket.org or vice versa. the situation where you want to archive the whole "bare" repo, not just a clone with the master or a single branch. Backup can be done simply by adding --bare to the clone command git clone --bare git @github .com:modsaid/test-repo.git This will result in a cloned repo on the filesystem that is similar in structure to a bare repository Restoring can be done by creating an empty repository on your git server (github.com or bitbucket.org). and running cd test-repo.git git push --mirror git @bitbucket .org:modsaid/test-repo.git voila

Migrating repos from SVN to git

It is straight forward to migrate your old SVN code to git. I highly advice everyone to do that even if they're not going to publish it on github or actually use it. but backing up a git repo can get to be very handy. Thanks to  Kevin Menard  for his   svn2git , the migration can be very straight forward.  I have created a usage repo,  using-svn2git , to speed things by adding it to Gemfile and using a specific rvm gemset, assuming you are using rvm. to make it as simple as: git clone bundle install start the migration... Of course having the standard SVN repo structure will save you a lot. You will probably only have to maintain the proper author.txt mapping file between svn and git users (example of the file is in the repo). I have tried to keep the  readme  short and to the point. I hope you find it useful. Regards

Writing usable scripts in Ruby

Usable command line tools/scripts There are a lot of command line tools written in ruby, python, bash, c or any other languages. They are usable simply because there is a standard way in dealing with them this way can be summarized in the following points: There has to be a usage example/brief help at the finger tips of the user ( by running with  -- help      or -h) arguments should have default values which are explained in the help misusage or missing mandatory arguments should fire the help message ruby tools OptionParser  is part of the standard library in ruby that takes care of this script packaging.  they show long and short examples This is an example of the script: require 'optparse' options = {} OptionParser.new do |opts| opts.banner = "Usage: script_name.rb [options]" opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|   options[:verbose] = v end end.parse! p options p ARGV # Actual script co...