What API do I call to get the system uptime?

The system call you’re looking for is sysinfo(). It’s defined in sys/sysinfo.h Its signature is: int sysinfo(struct sysinfo *info) Since kernel 2.4, the structure has looked like this: struct sysinfo { long uptime; /* Seconds since boot */ unsigned long loads[3]; /* 1, 5, and 15 minute load averages */ unsigned long totalram; /* Total … Read more

Hot deploy on Heroku with no downtime

You could setup a second Heroku app which points to the same DB as your primary production app and use the secondary app to run your DB migrations without interrupting production (assuming the migrations don’t break the previous version of your app). Let’s call the Heroku apps PRODUCTION and STAGING. Your deploy sequence would become … Read more

How to retrieve the process start time (or uptime) in python

By using psutil https://github.com/giampaolo/psutil: >>> import psutil, os, time >>> p = psutil.Process(os.getpid()) >>> p.create_time() 1293678383.0799999 >>> time.strftime(“%Y-%m-%d %H:%M:%S”, time.localtime(p.create_time())) ‘2010-12-30 04:06:23′ >>> …plus it’s cross platform, not only Linux. NB: I am one of the authors of this project.

Web App: High Availability / How to prevent a single point of failure?

I have found this article on the subject: http://www.tenereillo.com/GSLBPageOfShame.htm Basically if you do not require long lasting sticky sessions you can configure your DNS servers to return multiple A records (IP addresses) for your website. Web browsers are smart enough to try all the addresses until they find one that works.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)