SVN Revert / Rollback
February 23rd, 2010 at 10:49 am
Revert an entire project to a previous version
svn merge --dry-run -r73:68 http://my.repository.com/my/project/trunksvn merge -r73:68 http://my.repository.com/my/project/trunksvn commit -m "Reverted to revision 68."
Merge differences between a previous version and current version
svn merge -c -303 http://svn.example.com/repos/calc/trunk
svn commit -m ‘undoing changes’
Program as little as possible
February 8th, 2010 at 2:37 pm
Some programmers are so detail oriented that they will try to cover as many scenarios as possible. They will develop for today what they think will happen one or two months from now. I use to be this kind of developer and boy do I regret it.
Businesses grow and requirements change. As a result, the technology that drives businesses also change. Change is difficult when systems are heavy, bloated and inflexible. So don’t go adding potentially useful code unless you’ve got a damned good reason to do it. In fact, don’t add new functionality/code unless 1) it’s in a contract or 2) your client asks you MORE THAN ONCE to do it. Far too often I devoted much time to modules that were eventually scrapped because:
a) client changed his mind
b) at a later time, client requested a new feature that is closely related to an old feature, and thus, I rewrote 80% of the old feature (I realised early one that rewriting 80% of two scripts is less work than 80% of ten scripts)
So keep your code lean and simple. Do as little as possible so that when you inevitably refactor your work, you don’t have to throw out as much.
Designers better at CSS development than programmers
February 7th, 2010 at 4:19 pm
Getting a programmer to develop XHTML+CSS template can be frustrating. Generally, they do not pay enough attention to what they deem as minor cosmetic issues that will drive everyone else crazy.
Examples:
- They don’t pay enough attention to whether they are using the right shade of a particular colour.
- They don’t pay enough attention to margins and spacing between elements
- If designs don’t translate well into CSS + XHTML, they make little effort to “tweak” the template
From a programmer’s perspective, these are superficial details that do not impact functionality or performance. But in the world of graphic design, superficiality is the name of the game. Every pixel matters!
So that’s why when possible, graphic designers should not hand over CSS development to programmers.
PHP Mail() with Postfix on Ubuntu
February 3rd, 2010 at 2:10 pm
I set up my own LAMP VPS on linode.com. Although linode provides a good guide on how to set up the LAMP environment, it doesn’t explain how to enable the PHP mail() function. Additionally, it doesn’t explain how to prevent the server’s outgoing mail from ending up in the spam folder of popular web mail like Gmail, Yahoo and Hotmail. I’ll explain my steps to getting PHP’s mail() function to work, without having to install a full blown mail server. This means the bare minimum installation to get your PHP mail function to do the following:
- send out-going mail
- encrypt out-going mail
- reduce likelihood out-going mail ends up in spam folder
I’m not interested in hosting my own incoming mail box since I’ve got Google Apps to handle my mail (see linode guide for details).
Install Postfix
Postfix will be your mail server. Install it by simply typing into shell:
sudo apt-get install postfix
Install TLS Encryption
You’d want to encrypt your outgoing mail. Issue the following commands (this is an excerpt from ubuntu site):
touch smtpd.key chmod 600 smtpd.key openssl genrsa 1024 > smtpd.key openssl req -new -key smtpd.key -x509 -days 3650 -out smtpd.crt # has prompts openssl req -new -x509 -extensions v3_ca -keyout cakey.pem -out cacert.pem -days 3650 # has prompts sudo mv smtpd.key /etc/ssl/private/ sudo mv smtpd.crt /etc/ssl/certs/ sudo mv cakey.pem /etc/ssl/private/ sudo mv cacert.pem /etc/ssl/certs/ sudo postconf -e 'smtp_tls_security_level = may' sudo postconf -e 'smtpd_tls_security_level = may' sudo postconf -e 'smtpd_tls_auth_only = no' sudo postconf -e 'smtp_tls_note_starttls_offer = yes' sudo postconf -e 'smtpd_tls_key_file = /etc/ssl/private/smtpd.key' sudo postconf -e 'smtpd_tls_cert_file = /etc/ssl/certs/smtpd.crt' sudo postconf -e 'smtpd_tls_CAfile = /etc/ssl/certs/cacert.pem' sudo postconf -e 'smtpd_tls_loglevel = 1' sudo postconf -e 'smtpd_tls_received_header = yes' sudo postconf -e 'smtpd_tls_session_cache_timeout = 3600s' sudo postconf -e 'tls_random_source = dev:/dev/urandom' sudo postconf -e 'myhostname = server1.example.com' # remember to change this to yours
In the last command, make sure you replace server1.example.com with your domain name.
If you have multiple domain names, add them to /etc/postfix/main.cf under
mydestination = domain1.com, domain2.com, domain3.com
Install SPF
Installing SPF will reduce the likelihood your emails go to recipient’s spam folder.
sudo apt-get install python-policyd-spf python-spf
Add this line to the end of /etc/postfix/main.cf
spf-policyd_time_limit = 3600s
Also add the following
smtpd_recipient_restrictions =
...
permit_sasl_authenticated
permit_mynetworks
reject_unauth_destination
check_policy_service unix:private/policy-spf
...
Where the triple dots denote the possible existence of other settings.
Now you should restart your postfix by typing
sudo /etc/init.d/postfix restart
Add the following TXT record in your DNS Manager to utilize SPF
v=spf1 a mx ~all
And that should be it.
Other useful resources:
Happy 2010!
January 5th, 2010 at 2:30 pm
Happy 2010!
I learned quite a bit in my first year (2009) of web start up. My goals for 2010:
- secure enough income to hire a full time PHP developer
- make one of my coop student developers a good wordpress developer
- investigate black berry application development
- spend more time managing and researching new technologies
- do programming only for projects I find interesting (as opposed to grunt work programming for money)
Night
November 7th, 2009 at 11:40 pm
Just me at night
Svn Roll Back
November 7th, 2009 at 12:48 am
This is just for my own reference.
You can subversion roll back a file by using
svn merge -r 102:101 file-name
replace 102 and 101 with the revision numbers.
Business is not about money
October 18th, 2009 at 12:16 pm
I’ve been self-employed for a year now. Last year, I left my 9-5 job with a big company to pursue my own web projects. Along the way, I learned more about business than any four-year-$40k university program could teach me. Although I’m still new to business, I’m compelled to share some of my ideas on the subject - ideas that seasoned entrepreneurs may ridicule as naïve. But hey, here goes…
Business is not about money. It most definitely is not.
I grew up a Trekkie. I dreamed of living in a laissez-faire communist society where humanity’s only wish was to better itself through compassion and understanding. Money was the root of all evil and was abolished in the 21st century shortly after First Contact. So for much of my life, I resented capitalism. I wanted to work for free because it would be for the good of man kind. Naturally, overtime, I realized that my philosophy was naive and misguided because people would always take advantage of free. I needed a compromise between charity and exploitation, and hence, my new found appreciation for business. Business, by my definition, is about making people happy without killing myself to do it.
1and1 vs. Bluehost vs. HostGator
October 11th, 2009 at 8:33 pm
I’ve been looking for new shared webhosting services.  I’ve been using 1and1.com for several years, bluehost.com for one year and hostgator.com for a few days. I’ve been disappointed by all of them. Perhaps my web needs have surpassed what shared hosting services can offer because each of the web hosting companies I’ve mentioned presented me with different debilitating problems. Here’s a quick run-down:
1and1.com (Business Plan)
Pros: Very affordable
Cons: Limited number of databases, each limited to 100 mb, poor tech support, bad reputation
Bluehost.com
Pros: Very affordable, DNS changes are fast, decent customer service
Cons: I’ve experienced 4 downtimes in 1 month. Tech support say they do not support subversion, so although I installed it myself, Bluehost system administrators may one day, without any warning, configure their servers in a way that disables my repositories.
Hostgator.com (Business Plan)
Pros: Very affordable, very good tech support (responds in less than 30 mins)
Cons: You can only connect/disconnect via SSH every 10 minutes. You have to ask their system administrators to white list your IP if you want to repeatedly connect via SSH. Their SSH is on port 2222.
I wish there were one hosting service that could grant me all my wishes. But since I’m hard luck to find one, maybe it’s time for me to purchase a Virtual Private Server so that I can set things up the way I need them to be set up.
Toronto SEO Workshop
October 10th, 2009 at 12:16 pm
I’m proud to present the official launch of Toronto SEO Workshop website.
Visit the workshop to learn how you can drive more organic traffic to your site. There’s also a neat SEO calculator you should checkout.
Have fun!