Jan 27
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…
Sep 18
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.
Enjoy my software…
Aug 12
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 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;

GAMBAS First App
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
Aug 04
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.
Jan 27
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: Pingering | Ping Utility Tool (72)
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
Oct 18
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())  |
| 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)  |
| 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)  |
| 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  |
| 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.  |
| 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")  |
| 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); 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
Oct 02
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;
- Swapping a Link List elements
- Search and Delete an elements from Link List
Source Codes:
- Swap Link List (63)
- Link List Search and Delete (60)
Again, its a rush coding.. its kinda messy.. bwuahahha..
Sep 08
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.

theBank Sim Screenshot
Here’s the Demo Executable file: theBank Simulation (217)
Source Code: Bank Queue Simulation Source Code (226)
Aug 08

Graphic Sort
Today, I created different kinds of sorting.
- Bubble sort
- Selection sort
- Insertion sort
- Quick sort
Yet, my Quick sort does not work properly… And I have 6 more sorting method to go…
Download: Graphic Sorting (122) (demo executable file)
Download Source Code: Sorting Source Code (80)
Thanks to: http://www.cs.oswego.edu/~mohammad/classes/csc241/samples/sort/Sort2-E.html
Jul 24
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…
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.
Recent Comments