MD5 File Hash for C# and PHP

Info.Tech, Software Development, Visual C# .Net Comments Off on MD5 File Hash for C# and PHP

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

Facebook Messenger Desktop

Info.Tech, Software Development, Visual C# .Net Comments Off on Facebook Messenger Desktop
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:

Visual C# .Net and rsync

Experimentals, Info.Tech, Software Development, Visual C# .Net 2 Comments »

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: Visual C# .Net and rsync (619)

Visual C# Express 2010 + Firebird SQL

Info.Tech, Software Development, Visual C# .Net Comments Off on Visual C# Express 2010 + Firebird SQL

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: TestFirebirdConnect (617)

Duck Scraper for fb

Info.Tech, Software Development, Visual C# .Net Comments Off on Duck Scraper for fb

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.

Duck Scraper (616)

 

Enjoy!

 

Prerequisites:

  1. Internet Explorer 7 or latest version
  2. .Net Framework 4.0

Warranty: NO WARRANTY! πŸ˜›

Zendify: windows application to auto-populate to the host file and httpd.conf for ZendFramework Projects

Info.Tech, Software Development, Visual C# .Net, Web Development Comments Off on Zendify: windows application to auto-populate to the host file and httpd.conf for ZendFramework Projects

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: zendify (589)

Visual C# Upload File/Image via PHP with Squid-Cache in the Network

Info.Tech, Linux System Administration, PHP, Software Development, Visual C# .Net Comments Off on Visual C# Upload File/Image via PHP with Squid-Cache in the Network

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… πŸ™‚

Developer’s MySQL Auto-backup for Windows

Info.Tech, Software Development, Visual C# .Net 1 Comment »

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… πŸ™‚

SEO Fart | XML-RPC Ping Tool

Info.Tech, Software Development, Visual C# .Net Comments Off on SEO Fart | XML-RPC Ping Tool

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. πŸ™‚

Pingering – Free Ping Utility Tool for SEO

Info.Tech, Software Development, Visual C# .Net 1 Comment »

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 (682)

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

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in