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

QVNZ Viewer (ASC file viewer)

Info.Tech, Software Development Comments Off on QVNZ Viewer (ASC file viewer)

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.

 

QVNZ Viewer (613) ย  | ย  QVNZ Editor (536)

or

Download at: https://www.abcs.co.nz/download/qvnz/

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

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

 

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

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

Gambas 2.x in Ubuntu

Gambas, Info.Tech, Operating Systems, Software Development Comments Off on Gambas 2.x in Ubuntu

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;

 

GAMBAS First App

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

 

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