How To Get The Current Epoch Time (Unix Timestamp)

PHP PostgreSQL powershell Python ruby shell sql server unix Unix Timestamp vbscript Perl: time PHP: time() Ruby: Time.now # (or Time.new). To display the epoch: Time.now.to_i Python: import time # first, then int(time.time()) Java: long epoch = System.currentTimeMillis()/1000; Microsoft .NET C#: epoch = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000; VBScript/ASP: DateDiff("s", "01/01/1970 00:00:00", Now()) Erlang: calendar:datetime_to_gregorian_seconds(calendar:now_to_universal_time( now()))-719528*24*3600. # OR element(1, now()) * 10000 + element(2, now()). MySQL: SELECT unix_timestamp(now()) PostgreSQL: SELECT extract(epoch FROM now()); Oracle PL/SQL: SELECT (SYSDATE - TO_DATE('01-01-1970 00:00:00', 'DD-MM-YYYY HH24:MI:SS')) * 24 * 60 * 60 FROM DUAL SQL Server: SELECT DATEDIFF(s, '1970-01-01 00:00:00', GETUTCDATE()) JavaScript: Math.round(new Date().getTime()/1000.0) // getTime() returns time in milliseconds. Unix/Linux Shell: date +%s PowerShell: Get-Date -UFormat "%s" # Produces: 1279152364.63599 Actionscript: (new Date()).time Other OS’s Command line: perl -e "print time" # (If Perl is installed on your system) ColdFusion (CFML) MX 6.1+: #int( getTickCount() / 1000 )# Bash Command Line: date +%s

30 September 2010 · Shafiq Alibhai

Database Integration – some points to keep in mind

**Always Have a Single, Authoritative Source For Your Schema ** Everyone should know where the official schema resides, and have a frictionless experience in getting a fresh database setup. One should be able to walk up to a computer, get the latest from source control, build, and run a simple tool to setup the database (in many scenarios, the build process can even setup a database if none exists, so the process is one step shorter). ...

18 September 2010 · Shafiq Alibhai

Never use a shared database server for development work.

Like many conveniences in software development, a shared database is a tar pit waiting to fossilize a project. Developers overwrite each other’s changes. The changes I make on the server break the code on your development machine. Remote development is slow and difficult. Avoid using a shared database at all costs, as they ultimately waste time and help produce bugs.

15 September 2010 · Shafiq Alibhai

One Perspective on Improved Software Quality and Reduced Risks

We talk endlessly about improved software quality and reduced risks, but deployable software is the most tangible asset to “outsiders” such as clients or users. The importance of this point cannot be overstated.

15 September 2010 · Shafiq Alibhai

Note to Self – Project Management

You can manage scopes of time, cost, and quality much more effectively by basing your decisions on working software with actual feedback and metrics, not just task items on a project schedule.

9 September 2010 · Shafiq Alibhai

Perl – system load

To find the system load use the following perl snippet : System load of last one minute : my $system_load = exec('<a class="zem_slink" title="Uptime" rel="wikipedia" href="http://en.wikipedia.org/wiki/Uptime">uptime</a> | awk -F "load average: " \'{ print $2 }\' | cut -d, -f1'); my $system_load = qx('uptime | awk -F "load average: " \'{ print $2 }\' | cut -d, -f1'); System load of last 5 minutes : my $system_load = exec('uptime | awk -F "load average: " \'{ print $2 }\' | cut -d, -f2'); my $system_load = qx('uptime | awk -F "load average: " \'{ print $2 }\' | cut -d, -f2'); System load of last 15 minutes : my $system_load = exec('uptime | awk -F "load average: " \'{ print $2 }\' | cut -d, -f3'); my $system_load = qx('uptime | awk -F "load average: " \'{ print $2 }\' | cut -d, -f3');

7 September 2010 · Shafiq Alibhai

Gearman – Can't call method "syswrite" on an undefined value at /usr/local/share/perl/5.10.1/Gearman/Taskset.pm line 202.

If you get the following error while running the client code : Can’t call method “syswrite” on an undefined value at /usr/local/share/perl/5.10.1/Gearman/Taskset.pm line 202. … then change this $client->job_servers('127.0.0.1'); to $client->job_servers('127.0.0.1:4730'); thats it ! 🙂

31 August 2010 · Shafiq Alibhai

Completeness of the Requirements Set

A set of requirements is complete if and only if it describes all significant requirements of concern to the user, including requirements associated with functionality, performance, design constraints, attributes, or external interfaces.

18 August 2010 · Shafiq Alibhai

Requirements Gathering

Just as there is no one right programming language for every application, there is no one right way to develop the more detailed specifications. Different environments call for different techniques, and the requirements managers and requirements writers will probably need to develop a mix of skills suited to various circumstances.

31 July 2010 · Shafiq Alibhai

Software Development Process

The team’s development process defines who is doing what, when, and how. In the waterfall model, software activities proceed through a sequence of steps, with each step based on the activities of the previous step. The spiral model begins with a series of risk-driven prototypes, followed by a structured waterfall-like process. The iterative approach, a hybrid of the waterfall and spiral models, decouples the lifecycle phases from the software activities that take place in each phase. No matter what model you use, you must develop at least one early prototype to get customer feedback.

20 July 2010 · Shafiq Alibhai