Free Outlook - for Microsoft 365 Business Basic
Posted: 13 Dec 2024, 9:12am - Friday

As you know, you are force to use Outlook in Windows 10 nor Windows 11 which sucks because Windows Mail is fine. They are deprecating Windows Mail and force users to use Outlook. And when you are Microsoft 365 Business Basic account holder, using outlook will shut you down, in short you cannot use it. Even you pay for it, you just can't.

I wrote a work around to repel Outlook from installing in Windows 10/11 machine in my previous blog. It works! But I thought, maybe I should make another solution. So here's the solution.

Wrote few lines of code in Visual C# Desktop applicaiton with using WebView2 from Nuget and load outlook.office.com.

Download FreeOutlook_Setup.exe or FreeOutlook.zip and install it. Go to installed directory, double click FreeOutlook.exe. Then you'll get outlook in your desktop with separate window and not bothering your browser stuff.

enlarge
C# WebRequest: Headers pitfall
Posted: 4 Jun 2020, 6:36am - Thursday

I have written my own WebRequest wrapper and it took me ages why I am getting a response of bad request. Hours of debugging, I realize that I have overwritten my Content-Type header with my Authentication-Authorization entries.

the issue:

            WebRequest request = WebRequest.Create(url);
            request.Method = method_request;
            request.ContentType = "application/x-www-form-urlencoded";
            /**
             * dont add content-type header on authenticate
             */
            if (!url.Contains("/authenticate"))
            {
                WebHeaderCollection whc = new WebHeaderCollection();
                whc.Add("Auth-username", authorizationEntity.getUsername());
                whc.Add("Auth-session-key", authorizationEntity.getSessionKey());
                request.Headers = whc;
            }

            if (method_request.ToUpper() == "POST")
            {
                Stream stream = request.GetRequestStream();
                byte[] postArray = Encoding.UTF8.GetBytes(flatten_post_data);
                stream.Write(postArray, 0, postArray.Length);
                stream.Close();
            }

            string Result;
            try
            {
                Console.WriteLine(request.Headers.ToString());
                StreamReader sr = new StreamReader(request.GetResponse().GetResponseStream());
                Result = sr.ReadToEnd();
            } catch(WebException e)
            {
                Console.WriteLine(e.Message);
                Result = "[]";
            } 

the correct approach:

            WebRequest request = WebRequest.Create(url);
            request.Method = method_request;
            /**
             * dont add content-type header on authenticate
             */
            if (!url.Contains("/authenticate"))
            {
                WebHeaderCollection whc = new WebHeaderCollection();
                whc.Add("Auth-username", authorizationEntity.getUsername());
                whc.Add("Auth-session-key", authorizationEntity.getSessionKey());
                request.Headers = whc;
            }
            request.ContentType = "application/x-www-form-urlencoded";

            if (method_request.ToUpper() == "POST")
            {
                Stream stream = request.GetRequestStream();
                byte[] postArray = Encoding.UTF8.GetBytes(flatten_post_data);
                stream.Write(postArray, 0, postArray.Length);
                stream.Close();
            }

            string Result;
            try
            {
                Console.WriteLine(request.Headers.ToString());
                StreamReader sr = new StreamReader(request.GetResponse().GetResponseStream());
                Result = sr.ReadToEnd();
            } catch(WebException e)
            {
                Console.WriteLine(e.Message);
                Result = "[]";
            }

So that's it. lesson learn! LOL

enlarge
Facebook Messenger Desktop
Posted: 13 Jan 2016, 2:36am - Wednesday
1452673926_Facebook_Messenger
Just for fun I made a Facebook Messenger Desktop version. This can be used if you don't want to use the browser and would be ideal when you're at work. :) The application can minimize at the taskbar notification area which will be hidden away from your other opened applications. Disclaimer: This is not the official facebook messanger desktop version but this is just framing facebook web-based messenger. Download:
enlarge
Visual C# Express 2010 + Firebird SQL
Posted: 29 May 2013, 2:10am - Wednesday
Requirements:
  1. Firebird .NET Provider
  2. Visual C# Express 2012
  Code:
private void Form1_Load(object sender, EventArgs e)
        {
            FbConnection con = new FbConnection("User=SYSDBA;" + "Password=masterkey;" + "Database=" + currentDir + "\\vshb.fdb;" + "DataSource=127.0.0.1;" + "Port=3050;" + "Dialect=3;" + "Charset=UTF8;");
            try  
            {
                con.Open();
                FbTransaction t = con.BeginTransaction();
                t.Commit();
                FbCommand cmd = new FbCommand("SELECT * FROM \"Bank_Branches\"", con);
                FbDataReader reader = cmd.ExecuteReader();

                textBox1.Text = "Ref. No.\t\tBranch\t\t\t\n";
                while (reader.Read())
                {
                    textBox1.AppendText(reader.GetValue(0) + "\t\t\t" + reader.GetValue(3) + "\n");
                }
                reader.Close();
                con.Close();

            }
            catch (Exception ex) 
            {
                MessageBox.Show(ex.ToString());
            }

        }
---- Sample Source: [download id="38"]
enlarge
Today, I've been developing an oDesk-like activity monitoring application but for local network for my company, Innermax Support, and I came across with a problem of an errors:
  • An exception occurred during a WebClient request.
  • The remote server returned an error: (417) Expectation failed.
And during my search in Google -- from forums, MSDN and other developers' resources -- they face same problem. The common issue was the 100-Continue problem passing to a network with squid-cache. So there's a websites that I combined their codes and luckily it works. Just forgot the URLs, I can't credit thank-you's to them.. hehehe! The setup is like this... there's a firewall which has squid-cache in the local network and my server where I will upload my file/image is at the other network with public IP address. I will directly upload the file/image to my server using the assigned public IP address via PHP script. Here's my code to solve the problems;
public void uploadFile()
{
    try
    {
        // decleration of webclient
        ServicePointManager.Expect100Continue = false;
        System.Net.WebClient webby = new System.Net.WebClient();

        //initiate credentials
        webby.UseDefaultCredentials = false;
        webby.Credentials = new NetworkCredential("anonymous", "");

        //add headers
        webby.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.832)");
        webby.Headers.Add("Content-Type", "binary/octet-stream");

        //initiate upload file
        Byte[] result = webby.UploadFile("http://120.0.0.1/upload.php", "POST", @filename);

        string s = System.Text.Encoding.UTF8.GetString(result, 0, result.Length);
        MessageBox.Show(s);
        webby.Dispose();
    }
    catch (Exception)
    {
        // do nothing...
        MessageBox.Show("Upload failed!");
    }
}
So far, it works fine with me and satisfied of my solution. Hope this will help your problem too... :)
enlarge
SEO Fart | XML-RPC Ping Tool
Posted: 4 Aug 2011, 6:31am - Thursday
As my latest creation which boost me up to create this desktop application are my SEO staff which they have been searching for a good ping tool for their SEO. So instead of buying a software, I created my own and let them use it for their SEO campaign. I call it XML-RPC Ping Tool and under a brand name of SEO Fart because most of us always fart in the office. Hahahhahaha!
XML-RPC Ping Tool - A made-easy tool that poke Search Engines via ping service websites that your blog or website has been updated. Capable of mass URL pinging and scheduled URL pinging to make your SEO tasks easy and fast.
However, in the office the application is for free but to other people, its for sale. Sweat and effort must be paid of course. :)
enlarge
Link List
Posted: 2 Oct 2010, 12:56pm - Saturday
Past few weeks, been busy with my online jobs.. yet back to my study in C++, dev-C++. I'm having difficulty on understanding link list coz I'm in the mode of refuse to learn. However, forcing myself will achieve my goal. hehehehe.. Link below is the problem;
  1. Swapping a Link List elements
  2. Search and Delete an elements from Link List
Source Codes:
  1. [download id="17"]
  2. [download id="18"]
Again, its a rush coding.. its kinda messy.. bwuahahha..
enlarge
dev-C++ : Bubble Sort with Graphic Plotting
Posted: 24 Jul 2010, 21:01pm - Saturday
I'm having difficulties in creating good programming algorithm with C++. I find its very difficult. Somehow, I would like to share my accomplishment in creating this program, Bubble Sort with Graphic Plotting. But first, what is bubble sort? Bubble sort is a simple sorting algorithm. It works by repeatedly stepping through the list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted. The algorithm gets its name from the way smaller elements "bubble" to the top of the list. Because it only uses comparisons to operate on elements, it is a comparison sort. Below is the demo, source codes and libraries needed...
  • [download id="12"]
  • [download id="10"]
  • [download id="11"]
If you have better algorithm solutions, if you don't mind, can you email it to me... Like to see how others solve the problem.
enlarge
Visual C#: Retrieving Image (BLOB) from MySQL database
Posted: 14 Dec 2009, 15:48pm - Monday
I've been searching an article about storing and retrieving an image (BLOB data type) from MySQL database. Somehow, I only found the retrieving process but I created the storing process using PHP... :) You may download my works, link provided below...
  • idsystem_database.sql.zip - the dump file of MySQL database; import this SQL file before running the project
  • the rest of the files are the project sample files
-> [download id="5"] or http://blog.camilord.com/my.files/retrieveImg_public.zip For the credits, Thanks to Markusek Peter...
MySqlConnection myConnection = new MySqlConnection(myConnString); string testQuery = "SELECT sp.studePhoto, s.firstName, s.lastName FROM students AS s, student_photos AS sp WHERE s.id = sp.studentID"; MySqlCommand myCommand = new MySqlCommand(testQuery, myConnection); myConnection.Open(); MySqlDataReader myReader = myCommand.ExecuteReader(); FileStream fs; // Writes the BLOB to a file (*.jpg). BinaryWriter bw; // Streams the BLOB to the FileStream object. int bufferSize = 100; // Size of the BLOB buffer. // The BLOB byte[] buffer to be filled by GetBytes. byte[] outbyte = new byte[bufferSize]; long retval; // The bytes returned from GetBytes. long startIndex = 0; // The starting position in the BLOB output. while (myReader.Read()) { DateTime tmp = new DateTime(); tmp = DateTime.Now; // Create a file to hold the output. string filename = camilordMD5(tmp.ToLongDateString().ToString() + tmp.ToLongTimeString().ToString()) + ".jpg"; string dest = Directory.GetCurrentDirectory() + "/" + filename; fs = new FileStream(dest, FileMode.OpenOrCreate, FileAccess.Write); bw = new BinaryWriter(fs); // Reset the starting byte for the new BLOB. startIndex = 0; // Read the bytes into outbyte[] and retain the number of bytes returned. //myReader.GetBytes(0, startIndex, outbyte, 0, bufferSize); retval =(long) myReader.GetBytes(0, startIndex, outbyte, 0, bufferSize); lblName.Text = myReader.GetString(1) + " " + myReader.GetString(2); // Continue reading and writing while there are bytes beyond the size of the buffer. while (retval == bufferSize) { bw.Write(outbyte); bw.Flush(); // Reposition the start index to the end of the last buffer and fill thebuffer. startIndex += bufferSize; retval = myReader.GetBytes(0, startIndex, outbyte, 0, bufferSize); } pictureBox1.ImageLocation = Directory.GetCurrentDirectory() + "/test.jpg"; //pictureBox1.Image = retval; // Write the remaining buffer. bw.Write(outbyte, 0, (int)retval - 1); bw.Flush(); // Close the output file. bw.Close(); fs.Close(); }
enlarge
Gradle Project Tests
Posted: 6 Jun 2020, 9:59am - Saturday

The Error:

gradle Caused by: org.junit.platform.commons.PreconditionViolationException: Cannot create Launcher without at least one TestEngine; consider adding an engine implementation JAR to the classpath

I've been writing tests on my java gradle project and I thought the tests was running every time I compile. I'm using IntelliJ IDEA and when I right click the test folder and `Run All Tests`, seems to work well.

Then I found out that it wasn't running at all when I ran the report.

gradle didn't find my tests

"Five hours later..." I almost gave up and decided to go back to maven. Then thought maybe I will search the error one last time. Landed to this page: https://discuss.gradle.org/t/gradle-4-6-and-junit-5/26061 -- then decided to give one last try. So I change my build.gradle

plugins {
    id 'java'
    id 'project-report'
}

group 'nz.camilord.alphaone.sample'
version '1.0.0-SNAPSHOT'

sourceCompatibility = 11
targetCompatibility = 11

repositories {
    mavenCentral()
}

dependencies {
    compile 'postgresql:postgresql:9.0-801.jdbc4'
    compile 'com.google.code.gson:gson:2.8.0'
    testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.6.2'
    //testCompile 'junit:junit:4.13'
}

to this new configuration:

plugins {
    id 'java'
    id 'project-report'
}

group 'nz.camilord.alphaone.sample'
version '1.0.0-SNAPSHOT'

sourceCompatibility = 11
targetCompatibility = 11

repositories {
    mavenCentral()
}

dependencies {
    compile 'postgresql:postgresql:9.0-801.jdbc4'
    compile 'com.google.code.gson:gson:2.8.0'
    testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.6.2'
    testCompile 'org.jetbrains.spek:spek-junit-platform-engine:1.0.89'
    testRuntime 'org.junit.jupiter:junit-jupiter-engine'
    //testCompile 'junit:junit:4.13'
}

test {
    useJUnitPlatform()
}

configurations {
    externalLibraries
    compile.extendsFrom (externalLibraries)
}

... and the result is a success! It works!

enlarge
How do I backup my e-mails?
Posted: 26 Mar 2017, 10:03am - Sunday
I was asked by my workmate if I could help him create backup of his email. So I've been search for a simple software that can do the job. The result was stunning, there's no free software and everyone are selling to a stunning price. So I created my own software to create backup on your emails with reasonable cheapest price out there in the internet. I called it, Email Backup Tool. A very simple UI and easy to use and will download all your email straight to your hard drive. See screenshot below:                                                                         If you need a tool like this, just go to: http://www.howtobackupmyemails.com/
enlarge
Visual C# .Net and rsync
Posted: 28 Oct 2015, 1:40am - Wednesday
Today, I was wondering if possible to use rsync in Visual C# .Net. After couple of searches, I finally got my answer and working sample project. cSharp_gdrive I would like to share my Visual C# .Net source code project since I found many developers were looking for a working sample. I am planning to create a class wrapper too and deposit it on GitHub soon. My GitHub: https://github.com/camilord Download: [download id="44"]
enlarge
Duck Scraper for fb
Posted: 7 Dec 2012, 11:10am - Friday
Duck Scraper is a facebook (fb) about page scraper. Kind of manual and semi-auto scraper, it scrape the name, email, contact number and address of the about page in fb. Since I am having a problem with google search result, you have to click the search result manually and once in the fb about page, click "Quack Choook!" to scrape the contents. Then you can save the collected data to MySQL dump file (.sql) or CSV format (as .csv or .txt). It was written from Visual C# .Net. The version is 1.0 -- initial release. And of course its free and clean. Just sharing! Just check it out and explore how to use it.

[download id="36"]   Enjoy!   Prerequisites:
  1. Internet Explorer 7 or latest version
  2. .Net Framework 4.0
Warranty: NO WARRANTY! :P
enlarge
Developer's MySQL Auto-backup for Windows
Posted: 18 Sep 2011, 12:49pm - Sunday
2 days ago, my 7 years old computer motherboard, Intel Desktop Board DP965LT Classic series, died and as I replace with Intel Desktop DG31PR, I experienced with disturbing incident in MySQL databases. It got corrupted, some of the tables of .MYI and .MYD of the databases are missing. I tried to recover using REPAIR TABLE command in MySQL, got not luck. I tried using Stellar Phoenix Database Recovery for MySQL don't work well at all. So it means that I cannot recover my lost databases.

So I developed a software which protect my databases, this is to auto-backup all my MySQL databases to other drive or user-defined backup location. This application is for Windows XP, I haven't tested it in Windows 7 and other Windows OS yet. :) I called this software as "Developer's MySQL Auto-backup". The software is freeware or just totally FREE. You can use it but of course no warranty. :P Enjoy my software... :)
enlarge
Pingering - Free Ping Utility Tool for SEO
Posted: 27 Jan 2011, 18:02pm - Thursday
Yesterday, my friend Elvar ask me to create a tool for his SEO campaign. So since I have nothing to do even though my Adv. Stats exam is 2 days ahead yet I haven't read my notes even a glance, I still have a change to create this tiny tool for Elvar, you and to whom who need it somewhere out there in the vast space of the cyber world. :) Download: [download id="19"] By the way, if your running on Windows XP and older version of Windows, please install .NetFramework before running the Pingering. Download .NetFramework 2.0: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=0856eacb-4362-4b0d-8edd-aab15c5e04f5&displaylang=en
enlarge
dev-C++: Bank Queue Simulation using Graphic
Posted: 8 Sep 2010, 0:18am - Wednesday
Again, I'm not good in C++. Yet I managed to finish my assignment in Advanced Data Structure for MIT. As required, I need to use graphic.h and struct (structure type variables) in dev-C++ to create Bank Queue Simulation.

[caption id="attachment_448" align="aligncenter" width="577" caption="theBank Sim Screenshot"]theBank Sim Screenshot[/caption]

Here's the Demo Executable file: [download id="15"]

Source Code: [download id="16"]

enlarge
Prototype POS System - Transparent GUI
Posted: 23 Apr 2010, 16:48pm - Friday
POS System - Transparent GUI

My article is about a prototype POS system for grocery stores or 24 hours mini marts using Transparency graphical user interface. Transparency in MS Visual C# works similar to chroma keys in Adobe After Effects or Premiere. All you have to do is set a color key to make it transparent.
  1. As you create a form as Form1, go to Form1 properties and set TransparencyKey to Black.
  2. Then set your Backcolor of your form to Black.
  3. In Photoshop or any image editing tools, create an GUI or layout design then save as PNG format.
  4. In Form1 properties, set BackgroundImage and select the PNG image you created from Photoshop or other image editing tools.
  5. Set also the FormBorderStyle to None and Opacity to 95%.
  6. Then run your project. You'll see the transparency works well. :)
See my sample source code. [download id="7"]

 

 

 

enlarge
IntelliJ IDEA + Java versions + Maven + Gradle
Posted: 5 Jun 2020, 11:57am - Friday

Ok, I have been writing java codes from quite some time now. And most common I forgot to set are the following areas to configure in IntelliJ IDEA.

  1. Project Structure - always set both Project SDK and Project Language Level

2. SDK - you have to define the JDK home path to use in your project

3. Java bytecode - ensure that you set the Project bytecode version and add your project in per-module bytecode version and define the target bytecode version.

4. Maven - pom.xml file

5. Gradle - build.gradle file

And if you fail to configure these versions, you'll end up seeing RED texts/icons.

Gradle JVM not set properly, was set to 13 instead of 11.
Gradle JVM setup correctly.

enlarge
MD5 File Hash for C# and PHP
Posted: 14 Aug 2016, 10:06am - Sunday
I encountered again on how to generate MD5 File Hash in C# and compare generated C# file hash to PHP md5_file() function. This is to make sure the file integrity are maintained on copying files. It took me while to find the function but I know I have created one of my previous projects. And this time, I will post here in my blog for future use. Hehehe! For C#:
public static string md5_file(string fileName)
{
    FileStream file = new FileStream(fileName, FileMode.Open);
    MD5 md5 = new MD5CryptoServiceProvider();
    int length = (int)file.Length;  // get file length
    byte[] buffer = new byte[length];      // create buffer
    int count;                      // actual number of bytes read
    int sum = 0;                    // total number of bytes read

    // read until Read method returns 0 (end of the stream has been reached)
    while ((count = file.Read(buffer, sum, length - sum)) > 0)
        sum += count;  // sum is a buffer offset for next reading
    byte[] retVal = md5.ComputeHash(buffer);
    file.Close();

    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < retVal.Length; i++)
    {
        sb.Append(retVal[i].ToString("x2"));
    }
    return sb.ToString();
}
For PHP:
<?php

echo md5_file($filename_with_fullpath);

?>
Hope this helps... Thanks to: http://stackoverflow.com/questions/15705676/different-md5-file-hash-in-c-sharp-and-php
enlarge
QVNZ Viewer (ASC file viewer)
Posted: 3 Aug 2015, 23:57pm - Monday
For everyone looking for ASC file viewer or QVNZ .asc file, if you are wondering what application can view the file, you can download and use the application I have created. This will view the contents of ASC file for QVNZ.

qvnz_ss

Update 4 August 2015: I improved the viewer, its QVNZ Editor now. So you can edit the Cell then Save or Save As.   [download id="41"]   |   [download id="42"] or Download at: https://www.abcs.co.nz/download/qvnz/
enlarge
I'm been studying again about ZendFramework and its been a hassle for me to edit the hosts file from "C:\WINDOWS\system32\drivers\etc\" and the Apache httpd.conf file from "C:\Program Files\Apache Group\Apache2\conf\". So I created my windows application to auto-populate my ZendFramework project entry. To check how hassle in setting the configurations, see ZendFramework - Intro video and you'll know. :)  

  Here it is... Below is the download link of my windows application, you can use it also if you want. I am sharing it to the world for free and of course no warranty. :)   Requirements: .Net Framework 2.0 or latest version Download: [download id="28"]
enlarge
Gambas 2.x in Ubuntu
Posted: 12 Aug 2011, 16:49pm - Friday
Its been a while that I'm not using Linux especially Ubuntu. While reading in CDO Information Technology Group in facebook, one person ask about an opensource similar to visual basic and somebody answer that use GAMBAS. So I searched and found GAMBAS and its samples. I'm getting curious more. So install VMware 7.1 and downloaded Ubuntu 11.04. Also installed right away the GAMBAS after the OS installation.

 

Installing GAMBAS 2.x
Installing GAMBAS 2.x in Ubuntu

So after installation, as a first app -- the "Hello World!". so I start creating a new project and test typing lil' codes. Coding results below;

 

[caption id="attachment_574" align="aligncenter" width="576" caption="GAMBAS First App"]GAMBAS First App[/caption]

Conclusion: GAMBAS is just like MS Visual Basic with some little differences in coding. Hope GAMBAS will be fully developed and become mature, with this Linux Desktop Application Developer will raise (and I want to be one of the developers! hahahaha...).

Comments: I like GAMBAS.. so cute! hahahahaha... want to explore more about this software.

For more information about GAMBAS, please visit http://gambas.sourceforge.net/en/main.html

 

enlarge
Epoch Time
Posted: 18 Oct 2010, 21:44pm - Monday
I saved this information due to I used it all the time in my programming either PHP, JavaScript nor Visual C#. I found very very useful.. :) --------------------------------------------

What is epoch time?

The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds (in ISO 8601: 1970-01-01T00:00:00Z). Literally speaking the epoch is Unix time 0 (midnight 1-1-1970), but 'epoch' is often used as a synonym for 'Unix time'. Many Unix systems store epoch dates as a signed 32-bit integer, which might cause problems on January 19, 2038 (known as the Year 2038 problem or Y2038).
Human readable time Seconds
1 minute 60 seconds
1 hour 3600 seconds
1 day 86400 seconds
1 week 604800 seconds
1 month (30.44 days) 2629743 seconds
1 year (365.24 days) 31556926 seconds

How to get the current epoch time in ...

Perl time
PHP time()
Ruby Time.now (or Time.new). To display the epoch: Time.now.to_i
Python import time first, then 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.
MySQL SELECT unix_timestamp(now()) More information
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
Other OS's Command line: perl -e "print time" (If Perl is installed on your system)

Convert from human readable date to epoch

Perl Use these Perl Epoch routines
PHP mktime(hour, minute, second, month, day, year) More information
Ruby Time.local(year, month, day, hour, minute, second, usec ) (or Time.gm for GMT/UTC input). To display add .to_i
Python import time first, then int(time.mktime(time.strptime('2000-01-01 12:34:00', '%Y-%m-%d %H:%M:%S'))) - time.timezone
Java long epoch = new java.text.SimpleDateFormat ("dd/MM/yyyy HH:mm:ss").parse("01/01/1970 01:00:00");
VBScript/ASP DateDiff("s", "01/01/1970 00:00:00", time field) More information
MySQL SELECT unix_timestamp(time) Time format: YYYY-MM-DD HH:MM:SS or YYMMDD or YYYYMMDD More on using Epoch timestamps with MySQL
PostgreSQL SELECT extract(epoch FROM date('2000-01-01 12:34')); With timestamp: SELECT EXTRACT(EPOCH FROM TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-08'); With interval: SELECT EXTRACT(EPOCH FROM INTERVAL '5 days 3 hours');
SQL Server SELECT DATEDIFF(s, '1970-01-01 00:00:00', time field)
JavaScript use the JavaScript Date object
Unix/Linux Shell date +%s -d"Jan 1, 1980 00:00:01" Replace '-d' with '-ud' to input in GMT/UTC time.

Convert from epoch to human readable date

Perl Use these Perl Epoch routines
PHP date(output format, epoch); Output format example: 'r' = RFC 2822 date More information
Ruby Time.at(epoch)
Python import time first, then time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.localtime(epoch)) Replace time.localtime with time.gmtime for GMT time. More information
Java String date = new java.text.SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(new java.util.Date (epoch*1000));
VBScript/ASP DateAdd("s", epoch, "01/01/1970 00:00:00") More information
MySQL from_unixtime(epoch, optional output format) The default output format is YYY-MM-DD HH:MM:SS more ...
PostgreSQL PostgreSQL version 8.1 and higher: SELECT to_timestamp(epoch); More information Older versions: SELECT TIMESTAMP WITH TIME ZONE 'epoch' + epoch * INTERVAL '1 second';
SQL Server DATEADD(s, epoch, '1970-01-01 00:00:00')
Microsoft Excel =(A1 / 86400) + 25569 Format the result cell for date/time, the result will be in GMT time (A1 is the cell with the epoch number). For other timezones: =((A1 +/- timezone adjustment) / 86400) + 25569.
Crystal Reports DateAdd("s", {EpochTimeStampField}-14400, #1/1/1970 00:00:00#) -14400 used for Eastern Standard Time. See Timezones.
JavaScript use the JavaScript Date object
Unix/Linux Shell date -d @1190000000 Replace 1190000000 with your epoch, needs recent version of 'date'. Replace '-d' with '-ud' for GMT/UTC time.
PowerShell Function get-epochDate ($epochDate) { [timezone]::CurrentTimeZone.ToLocalTime(([datetime]'1/1/1970').AddSeconds($epochDate)) }, then use: get-epochDate 1279152364. Works for Windows PowerShell v1 and v2
Other OS's Command line: perl -e "print scalar(localtime(epoch))" (If Perl is installed) Replace 'localtime' with 'gmtime' for GMT/UTC time.
----------------------------------- Reference: http://www.epochconverter.com
enlarge
Algorithm: Graphic Sort
Posted: 8 Aug 2010, 16:14pm - Sunday

[caption id="attachment_438" align="aligncenter" width="480" caption="Graphic Sort"]Graphic Sort[/caption] Today, I created different kinds of sorting.
  1. Bubble sort
  2. Selection sort
  3. Insertion sort
  4. Quick sort
Yet, my Quick sort does not work properly... And I have 6 more sorting method to go... :( Download: [download id="14"] (demo executable file) Download Source Code: [download id="21"] Thanks to: http://www.cs.oswego.edu/~mohammad/classes/csc241/samples/sort/Sort2-E.html
enlarge
Visual C#: Detect Conflict Schedule
Posted: 18 Jan 2010, 16:55pm - Monday
[caption id="attachment_329" align="alignright" width="271" caption="Screenshot"]Screenshot[/caption] It seems a lot of people are searching about solving conflict schedule. So I decided to create a sample. Below is the core code of checking conflict schedule...
// sample conflict detection (defined) [start]
DateTime d = new DateTime(2010, 1, 13);
richTextBox1.Text = DateTime.Now.ToLongDateString() + " = " + d.ToLongDateString() + "\n";
if (DateTime.Now.CompareTo(d) > 0)
{
richTextBox1.Text += "true\n" + DateTime.Now.CompareTo(d).ToString();
}
else
{
richTextBox1.Text += "false\n" + DateTime.Now.CompareTo(d).ToString();
}
richTextBox1.Text += "\n\n";
DateTime dx = DateTime.Now;
//MessageBox.Show(dx.Hour.ToString());
DateTime[] dt = new DateTime[4];
// enrolled schedule
dt[0] = new DateTime(int.Parse(dx.Year.ToString()), int.Parse(dx.Month.ToString()), int.Parse(dx.Day.ToString()), 8, 0, 0);
dt[1] = new DateTime(int.Parse(dx.Year.ToString()), int.Parse(dx.Month.ToString()), int.Parse(dx.Day.ToString()), 9, 0, 0);
// adding new schedule
dt[2] = new DateTime(int.Parse(dx.Year.ToString()), int.Parse(dx.Month.ToString()), int.Parse(dx.Day.ToString()), 9, 0, 0);
dt[3] = new DateTime(int.Parse(dx.Year.ToString()), int.Parse(dx.Month.ToString()), int.Parse(dx.Day.ToString()), 10, 0, 0);
// checking schedule conflict
if (((dt[0].CompareTo(dt[2]) < 0) && (dt[1].CompareTo(dt[2]) > 0)) || (dt[0].ToShortTimeString() == dt[2].ToShortTimeString()))
{
richTextBox1.Text += dt[0].ToShortTimeString() + " - " + dt[1].ToShortTimeString() + " against " + dt[2].ToShortTimeString() + " - " + dt[3].ToShortTimeString() + "\nResult: CONFLICT";
}
else
{
richTextBox1.Text += dt[0].ToShortTimeString() + " - " + dt[1].ToShortTimeString() + " against " + dt[2].ToShortTimeString() + " - " + dt[3].ToShortTimeString() + "\nResult: NO CONFLICT";
}
// sample conflict detection (defined) [end]
If you want to download the whole code, link below and enjoy... Do not practice the copy and paste! :) Download: [download id="6"]
enlarge