Learning rsync

rsync_logorsync is a widely-used utility to keep copies of a file on two computer systems. It is commonly found on Unix-like systems and functions as both afile synchronization and file transfer program. The rsync algorithm, a type of delta encoding, is used to minimize network usage. Zlib may be used for additional compression, and SSH or stunnel can be used for data security.

How to use ‘cp’ command to exclude a specific directory?

I found rsync when I was trying to copy all files except “x” and “y” files and directories. You are able to do that as following:

Notice that you can add many –excludes like:

Found some great samples by Ramesh Natarajan I have copied few below with a link to more samples.

Example 1. Synchronize Two Directories in a Local Server

To sync two directories in a local computer, use the following rsync -zvr command.

In the above rsync example:

  • -z is to enable compression
  • -v verbose
  • -r indicates recursive

Example 2. Preserve timestamps during Sync using rsync -a

 

rsync option -a indicates archive mode. -a option does the following,

  • Recursive mode
  • Preserves symbolic links
  • Preserves permissions
  • Preserves timestamp
  • Preserves owner and group

Now, executing the same command provided in example 1 (But with the rsync option -a) as shown below:

Example 3. Synchronize Only One File

To copy only one file, specify the file name to rsync command, as shown below.

More samples at:

 

How to Backup Linux? 15 rsync Command Examples

6 rsync Examples to Exclude Multiple Files and Directories using exclude-from

Metric decimal system of measurement

In metric, one milliliter of water occupies one cubic centimeter, weighs one gram, and requires one calorie of energy to heat up by one degree centigrade—which is one percent of the difference between its freezing point and its boiling point. An amount of hydrogen weighing the same amount has exactly one mole of atoms in it.

from Wild Thing: A Novel by Josh Bazell

Explaining object-oriented programming

Here, in an excerpt from a 1994 Rolling Stone interview, Jobs explains what object-oriented programming is.

Jeff Goodell: Would you explain, in simple terms, exactly what object-oriented software is?
Steve Jobs: Objects are like people. They’re living, breathing things that have knowledge inside them about how to do things and have memory inside them so they can remember things. And rather than interacting with them at a very low level, you interact with them at a very high level of abstraction, like we’re doing right here.
Here’s an example: If I’m your laundry object, you can give me your dirty clothes and send me a message that says, “Can you get my clothes laundered, please.” I happen to know where the best laundry place in San Francisco is. And I speak English, and I have dollars in my pockets. So I go out and hail a taxicab and tell the driver to take me to this place in San Francisco. I go get your clothes laundered, I jump back in the cab, I get back here. I give you your clean clothes and say, “Here are your clean clothes.”
You have no idea how I did that. You have no knowledge of the laundry place. Maybe you speak French, and you can’t even hail a taxi. You can’t pay for one, you don’t have dollars in your pocket. Yet I knew how to do all of that. And you didn’t have to know any of it. All that complexity was hidden inside of me, and we were able to interact at a very high level of abstraction. That’s what objects are. They encapsulate complexity, and the interfaces to that complexity are high level.

The whole interview here

Object and Array literal in JavaScript

This post is mostly for my own reference as I seem to keep messing this up. :O

The basics

{} is an object literal

 

[] is an array literal

 

properties can be accessed via . and [] notation:

 

Object literals can be set using literal values or strings:

 

 

Cloud Compute uptime

disconnect

I have been hearing some criticism on Azure reliability lately. So, I decided to check out if anything I hear has any base by trying to compare Azure VM’s against other IAAS’s and I was quite surprised instability of Azure when putting side-by-side with its competitors.

Even though I don’t use Google Compute Engine personally. I decided to compare it together with EC2 and Azure VM’s since it is among one of the most popular ones.

I think Azure is very nice platform, I use it daily (Office 365 and VisualStudio.com) but they’ve effectively priced me out every time I need to get a server up quickly. Then I always end up to EC2 (Which I like also) but I would like to run some servers on VM’s. Just to get first hand experience how is it to operate real stuff on their beautifully designed Azure Admin.

Disclaimer: I have not used in-depth research on the topic. This is just what I found out by looking numbers from CloudHarmony. If you have more in-depth knowledge on the topic. Please comment the post. I would love to hear it.  

Here are the numbers from CloudHarmony

1 Year Global Uptime

You can see that average downtime has been 3.3 hours per region where as EC2 had 14 minutes. But if you are running IAAS on here it makes much more sense to look about the uptime of the regions (datacenter). As a sample I put up Europe here to see same numbers from 1 year on Europe data centers.

1 Year Europe Uptime

This is actually looking worse for Azure and Google where as very good for Amazon.

If however you are planning to run IAAS on some of these cloud services, do your own research and include the specific services your VM’s are running. I recommend also paying close attention to the monthly/quarterly uptime trend in addition to aggregate uptime numbers.  I would also recommend building your application/infrastructure  cloud agnostic so you are not married to them (yeah, easy to say…).

 

Install Subversion in Yosemite

SubversionI had some problem with Subversion repository because the repo is using version 1.8 but the SVN version that ships with xCode is version 1.7.

To update SVN on MacOS 10.10 you need to first uninstall old version. You can do that just by deleting the binary.

Type in console:

Then remove it

Use then Homebrew to install new version.

It takes few minutes to install.

I also had to link SVN again on homebrew (maybe i had some old references)

… and it’s done.

Screen Shot 2014-11-01 at 16.02.17

 

Time for SSL-only internet

There is really no reason why you should not be running  only HTTPS (also known as HTTP over TLS, or Transport Layer Security), on your website. Even you are not running any authentication today there is a good change you will in the future. Furthermore, if you care about SEO Google is going to rank your site higher when you have taken care of security (See: HTTPS as a ranking signal). 

I have been lately configuring few sites to run in HTTPS and here are some tips.

  • Decide the kind of certificate you need: single, multi-domain, or wildcard certificate
  • You need dedicated IP, it’s easier that way
  • Buying certificate. If you are new on HTTPS and you are not sure which certificate to buy, then buy the cheapest one with single domain. If you are paying more than 10 USD for the certificate and you just need to get your website working on HTTPS then you are probably paying for extra.
  • Make sure you are use 2048-bit key certificates, I don’t think anyone is selling anything else anymore.
  • Use relative URLs for resources that reside on the same secure domain
  • Use protocol relative URLs for all other domains. This means you need to ensure that all third party services support SSL because otherwise you’ll give your users browser warnings alongside some security concerns. For example if you use javascript CDN make sure URL’s are pointing src=”http://cdn. => src=//cdn
  • Check out Google Site move article for more guidelines on how to change your website’s address
  • Don’t block your HTTPS site from crawling using robots.txt
  • Allow indexing of your pages by search engines where possible. Avoid the noindex robots meta tag.
  • Configure redirect from HTTP to HTTPS
  • I recommend RapidSSL or PositiveSSL I have been using PositiveSSL from namecheap but there is even cheaper ones in https://www.cheapestssls.com/. Also there is free certificate at https://www.startssl.com/ but I have not try it personally. Though, free is probably never free. Maybe it is OK for test enviroments and sandboxes but I would use RapidSSL or PositiveSSL for production. 

Be secure out there… you can test your server security level and configuration with the Qualys Lab tool.

 

HTML5 relevant tags for iOS Web App

Here are some tags that are relevant to build great mobile experience. It is mostly for iOS but Android (Chrome) seems to follow it as well.

This is mostly for my own reference as I bump to this all the time.