Archive for the ‘Uncategorized’ Category
Failing to learn is learning to fail
Fear of failure discourages people from learning new things. So the trick is to make people classify failing as learning. Failing and learning are essentially the same thing, with the former having a negative connotation and the latter having a positive connotation. Take Thomas Edison for example, he says, “I didn’t fail. I’ve just found 10000 ways that don’t work.”
So people need to be more positive about learning.
Spend most of my time on non-billable items
I find myself spending half the day on non-billable items. Things I do a lot of are:
1) maintenance of my servers
2) researching and playing with new technologies that I may want to include into my business
3) evaluating the processes of past projects to see if I met my objectives
4) devising strategies to improve on item 3)
5) networking and communicating with talented individuals (like scouting out talent)
6) misc. stuff like updating my website, finances, invoices etc…
Engineers work with nature. Businessmen control nature.
I posted this just now on redflagdeals, but will repost here:
I graduated from electrical engineering at U of T in 2004 and now I own and run my own business.
If I had to do it all over again, I would have chosen a business program (with a couple of elective software dev courses) over an engineering program. The reason for this hind-sight decision is also the answer to a question I’m frequently asked, “Why did I start my own IT business”. The answer is as follows:
Imagine you’re an engineeer and this month, you have to design a house in Canada. You’d design it with a good heating system, good insulation, carpeted floors because it gets cold in Canada. Next month, you have to design a house in Iran. You’d design it with a good air-conditioning system, less insulation, stone floors because it gets hot in Iran. Each time you have to build a house in a new location, you have to re-evaluate your existing tools and technology to see if they are applicable.
A well trained engineer will eventually ask, “Isn’t there a way to design a one-size-fits all solution?” Regardless of whether it’s possible or not, a good engineer will ask the question in hopes of devising an efficient and re-useable solution. But of course, within the realm of engineering, a one-house-fits all for all geographies, terrains, seasons and weathers is impossible.
The solution to a one-size-fits all problem requires a business/finance/economic solution. That is, this engineering problem can only be solved with a non-engineering solution.
Through economics, you can drive up the property value in Canada so that no one wants to build there. You can also destroy the economy in Iran so that the builders can’t afford to build houses. Businesses can control the price of raw materials, making certain types of buildings feasible and others not feasible. With capital, you can eliminate all the competing variables that engineers need to deal with such that the word “all” in the phrase “one-size-fits all” becomes “one”. Hence, making it possible for engineers to realize a one-size-fits all solution.
The reason I left working as an engineer for an engineering company is because I realized I can’t develop a one-size-fits all solution if the business people managing me don’t know what the hell they are doing. Everyday, I would create something, then the execs, sales, marketers change their mind, and back to the drawing board I go. I realized the only way to do things properly is to run my own show. So I started my own business, defined and simplified “problems” properly so that my engineers can have a better time.
Engineers build products. Businessmen control nature. Engineers can only build the products business people tell them to build.
So in the end, I went into business because engineering did not give me the skills to build what I want to build. If I had to do it all over again, I would have went straight into business.
Hiring first employee
I hired a full time developer for my company Evermight. It’s a big deal for me because it’s the first person I’ve hired on a full-time basis. It felt like a massive sports trade on the magnitude of buying a Roy Halladay. Now everyone expects me to win it all!
In the past few months, I spent more than half my time meeting clients, writing emails, providing tech support, managing projects, trouble shooting faults, and administrating/deploying servers. I had no time left to develop. Things fell through the cracks. I knew it was time to hire.
But of course, hiring requires money. Will I have enough projects to fuel this new developer? I’ve only been around for 1.5 years, is it too early to expand? How do I manage my finances?
Anyway, wrote it all out on paper and decided to go with an investment. Having a Roy Halladay doesn’t guarantee you’ll win the world series. But it increases your chances significantly. I liked the odds, so I did everything I could to secure my full time developer.
SVN Revert / Rollback
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
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
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
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.
Install PostfixDKIM
This guide is based on Ubuntu guide and someone’s answer on Serverfault.
sudo aptitude install dkim-filter
Open up /etc/dkim-filter.conf and edit it so that it’s like below:
# Log to syslog Syslog yes # Required to use local socket with MTAs that access the socket as a non- # privileged user (e.g. Postfix) #UMask 002 # dkim-milter (2.5.2.dfsg-1ubuntu1) hardy: # Disable new umask option by default (not needed since Ubuntu default # uses a TCP socket instead of a Unix socket). # Attempt to become the specified userid before starting operations. #UserID 105 # 'id postfix' in your shell # Sign for example.com with key in /etc/mail/dkim.key using # selector '2007' (e.g. 2007._domainkey.example.com) # Domain won't really matter because that will be specified in the KeyList file Domain yourdomain.com #KeyFile /etc/mail/dkim.key # See bellow how to generate and set up the key Selector mail # Common settings. See dkim-filter.conf(5) for more information. AutoRestart yes Background yes Canonicalization simple DNSTimeout 5 Mode sv SignatureAlgorithm rsa-sha256 SubDomains no #UseASPDiscard no #Version rfc4871 X-Header no #InternalHosts /etc/mail/dkim-InternalHosts.txt # The contents of /etc/mail/dkim-InternalHosts.txt should be # 127.0.0.1/8 # 192.168.1.0/24 # other.internal.host.domain.tld # You need InternalHosts if you are signing e-mails on a gateway mail server # for each of the computers on your LAN. ############################################### # Other (less-standard) configuration options # ############################################### # # If enabled, log verification stats here Statistics /var/log/dkim-filter/dkim-stats # # KeyList is a file containing tuples of key information. Requires # KeyFile to be unset. Each line of the file should be of the format: # sender glob:signing domain:signing key file # Blank lines and lines beginning with # are ignored. Selector will be # derived from the key's filename. KeyList /etc/mail/mail # # If enabled, will generate verification failure reports for any messages # that fail signature verification. These will be sent to the r= address # in the policy record, if any. #ReportInfo yes # # If enabled, will issue a Sendmail QUARANTINE for any messages that fail # signature verification, allowing them to be inspected later. #Quarantine yes # # If enabled, will check for required headers when processing messages. # At a minimum, that means From: and Date: will be required. Messages not # containing the required headers will not be signed or verified, but will # be passed through #RequiredHeaders yes
Add the following lines to /etc/postfix/main.cf
# DKIM milter_default_action = accept milter_protocol = 2 smtpd_milters = inet:localhost:8891 non_smtpd_milters = inet:localhost:8891
Create the public and private keys with these lines
openssl genrsa -out private.key 1024 openssl rsa -in private.key -out public.key -pubout -outform PEM cp private.key /etc/mail/mail
Add a TXT record to your DNS like so
mail._domainkey.yourdomain.com. IN TXT "k=rsa; t=y; p=yourpubkey"
Where yourdomain.com is the domain you want to authenticate against, and yourpubkey is the contents of public.key WITHOUT the
-----BEGIN PUBLIC KEY----- -----END PUBLIC KEY-----
Create a new file called /etc/mail/dkim_domains.key and put into it
*:yourdomain.com:/etc/mail/mail
Then restart dkimfilter and postfix with
> /etc/init.d/dkim-filter restart
> /etc/init.d/postfix restart
Now you’re done install postfix dkim
Other useful resources:
Happy 2010!
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
Just me at night