Friday, December 24, 2010

QR Code Images




QR codes are 2D code images (black and white dots and bars) that have text encoded into them in several formats (text, URL, phone number, SMS), and can be read with qr code reader softwares, available online & in most smart phones.. they are also called "hardlinks" since they can serve as physical world hyperlinks.. you can simply read a printed or even artistically painted qr code image with ur phone & then it will open u the website url that is encoded in the qr image!! same as a soft hyperlink.. They can be and are used widely in marketing to attract traffic to certain websites or to hardlink a brand's website.. it can also be printed on T-Shirts, Mugs and can be formed with colored materials like coffee beans or M&Ms


qr stands for Quick Response

Audi Japan’s World’s Biggest QR Code (so far):


More:
Wikipedia: http://goo.gl/zahiN
QR Code Reader: http://goo.gl/mNdex
Google API: http://goo.gl/sB52F
Another QR Code Generator: http://goo.gl/JhWOG

QR Code Custom Designs:

Sunday, November 28, 2010

Packing Buddy


It's hosted live now, but the prototype is not yet finished, however I added a sample demo to be viewed, you may visit it here.
Still needs lots of work.. I need a UI designer/developer!!

Recent Recommendation :)

My manager said looking for a developer to recruit "I want someone like you" then he proceeded "in fact, there's no one like you!"
- Osama Darawsheh | Development Team Manager | Softact

Wednesday, September 22, 2010

File Shredder

Do you have critical data files that you need to permanently destroy? you can use file shredders for this task, but if you're paranoid and don't want to run executables downloaded from untrusted resources, you can simply write your own file shredder, all you need is an IDE (e.g. Visual Studio, Net Beans.. etc.)

File Deletion Concept (OS 101):
The OS does not physically remove deleted files from your hard disk. Emptying your Recycle Bin does NOT protect you at all. Your sensitive files can be recovered, even after you format your hard disk! When you delete a file from Windows, the OS just marks the file as deleted in the file allocation table (FAT), but the data of the file is still on your hard disk, even though not accessable through the system friendly UI. There are many tools available which can let you or others easily recover your sensitive files even after you format your hard disk. Thus, make sure you ALWAYS shred your sensitive files if you plan to sell your PC later on.

A simple analogy would be like adding a new column to a database table to indicate if a record has been deleted, without actually deleting the record from the database. And in the system front-end, fitching only records of which the Deleted column is set negatively.


Technique:
The simplest technique to shred a file, is to overwrite the contents of that file multiple times with junk data before the file is deleted, so that the previous portions of the hard disk drive that were allocated to that file would be actually overwritten and untracable.

Download Executable
Download Source Code



Have a glance at the code
Main Function (DestroyFile) [Tip]: This function could also be implemented in a separate asynchronous thread to keep the main thread and UI responding and interactive with the user while the file is being shredded, because if the file size is too large, then the main thread (including the UI event handlers) will stop responding until the file shredding operation is completely executed.

private void DestroyFile(string filePath)
        {
            try
            {
                FileStream filestream = new FileStream(filePath, FileMode.Open, FileAccess.Write);
                long length = filestream.Length;
                StreamWriter streamWriter = new StreamWriter(filestream);
                char[] buffer = new char[length];
                for (long i = 0; i < length; i++)
                {
                    buffer[i] = '0';
                }
                streamWriter.Write(buffer);

                streamWriter.Close();
                filestream.Close();

                File.Delete(filePath);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error!");
            }
        }

Wednesday, August 25, 2010

Cloud Computing: Web-Based Screen Recorder

I have previously blogged about CodeRun the cool browser-based IDE, I find the cloud-computing concept as a whole is exciting regardless of the endless debates that we can have about the security and controllability.
Moreover, I recently came across this web-based screen recorder Screenr that allows you to quickly record and screencast!
The product is java-based and -of course- cross-platform, no need for download or installation.


Tuesday, August 3, 2010

Cloud Development

CodeRun Studio is a cross-platform Integrated Development Environment (IDE), designed for the cloud. It enables you to easily develop, debug and deploy web applications using your browser.

CodeRun Studio can be used instead or alongside your existing desktop IDE. You can upload existing code in order to test it in the cloud or for sharing with your peers.

Monday, July 26, 2010

Web Automation - Intro

Did you know that you can automate your daily repetitive tasks that you do on the web, and save yourself time and effort!
This is a very simple automation sample, the automation simulates the user web browsing, I built 2 automation samples:
  1. Automate Google Search: will navigate to google website, enter "Dareen Alhiyari" in the search textbox, and then click the search button.
  2. Automate My Blog: The second automation will navigate to my blog's "Contact Me" page, and then click on my yahoo email link.
Here's a video demo of the automation:
Download Executable you also need to check Microsoft.mshtml.dll (?)
Download Source Code

You can also build your own toolbar to the browser with your customized buttons, for example you can add a button that will collect all the images in a web page.. whatever comes to your mind!
You can also use this concept to build automated tests for your web applications, simulating the end user browsing activities.

A quick look at the code

In the event handler of the click event of the sub-menu "Automate My Blog", I attach a new event handler to the DocumentComplete event of the WebBrowser, and navigate the web browser to my blog's "Contact Me" page url, and then wait for the event handler to be invoked to complete the automation.

In the sub menu click event handler:
try
{
    this.webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted_AutomateMyBlog);
    this.webBrowser1.Navigate("http://dareen-h.blogspot.com/p/contact-me.html");
}
catch (Exception ex)
{
    MessageBox.Show(ex.Message, "Error!");
}

In the WebBrowser document complete event handler, I find the yahoo mail link object, and click on it:
try
{
    IHTMLDocument3 doc = this.webBrowser1.Document.DomDocument as IHTMLDocument3;
    if (doc != null)
    {
        IHTMLElement yahooMail = doc.getElementById("yahoomail");
        if (yahooMail != null)
        {
            yahooMail.click();
        }
    }
}
catch (Exception ex)
{
    MessageBox.Show(ex.Message, "Error!");
}
finally
{
    this.webBrowser1.DocumentCompleted -= new WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted_AutomateMyBlog);
}

Microsoft.mshtml.dll
You will need Microsoft.mshtml.dll that usually ships with IE, to make sure if you have it installed in the GAC, open Start Menu->Run and type assembly then hit enter, the GAC folder will open up, make sure that you have the dll in the dlls list
If you don't find the dll in the list, you may download Office 2003 Update that contains the dll, or if you find it too big for you, you may download it from dll download websites
After you get the dll, drag it and drop it into the assembly folder "%OS Drive%\Windows\Assembly"

Wednesday, July 14, 2010

Build impressive flash dashboards and charts

Open Flash Chart is a cool open source flash project that allows you to easily embed impressive dashboards and charts into your website or business portal.

This is one of the 3D-bar chart samples:



And a glass bar chart sample:



The data from which to build the charts can be extracted from any data source or database, and saved into an array that is passed to the OFC library to build the chart.
The basic tutorial in the website shows how to integrate the flash chart along with the data file into your page.
Of course you will have to do some tweaks here and there like changing some include paths, renaming some folders... etc. But the cool result is worth the hassle ;)

I will be posting a detailed step-by-step tutorial of how to build and integrate the charts into a PHP5 website once I get some time.

Wednesday, July 7, 2010

How to change the shortcut items displayed in the common open/save file dialog in Windows

If you're tired of continiously navigating to your most used folders whenever you want to open or save a file, you can change the default items displayed in the left pane of the open/save file dialog

To change those default items, do the following:
  1. Open the Group Policy console, go to Start -> Run -> type gpedit.msc and hit enter, the console will open.
  2. Expand the tree: User Configuration -> Administrative Templates -> Windows Components -> Windows Explorer -> Common Open File Dialog.

  3. Double click on Items Displayed in Places Bar that appears in the right pane.
  4. When the dialog opens up, make sure that the setting is Enabled, and now you can specify your favorite locations to be displayed in the open/save dialog.

  5. Enjoy :)
More information about this setting:


Requirements
At least Microsoft Windows XP Professional or Windows Server 2003 family.
Description
Configures the list of items displayed in the Places Bar in the Windows File/Open dialog. If enable this setting you can specify from 1 to 5 items to be displayed in the Places Bar.
The valid items you may display in the Places Bar are:
1) Shortcuts to a local folders — (ex. C:\Windows)
2) Shortcuts to remote folders — (\\server\share)
3) Common Shell folders.
The list of Common Shell Folders that may be specified:
CommonDocuments, CommonMusic, CommonPictures, Desktop, MyComputer, MyDocuments, MyFavorites, MyMusic, MyNetworkPlaces, MyPictures, Printers, ProgramFiles, Recent.

If you disable or do not configure this setting the default list of items will be displayed in the Places Bar.

How to configure shared folders between Windows-host and Ubuntu-guest on VirtualBox

Shared Folders is a feature provided by VirtualBox to share folders between the 2 operating systems (host and guest).
To configure shared folders on VirtualBox Ubuntu guest, follow these steps:
  1. Make sure that Guest Additions are already installed, if not, install them: From the VirtualBox's menu go to Devices -> Install Guest Additions.

    This will mount a virtual CD on your /media/cdrom. Normally this folder's window will show up.

    As root run the program VBoxLinuxAdditions-x86.run (or VBoxLinuxAdditions-amd64.run if you're using 64bit).

    sudo /media/VBOXADDITIONS_3.2.6_63112/VBoxLinuxAdditions-x86.run
    When the program completes reboot your VirtualBox.

  2. You may now go ahead and define the shared folder(s). From the VirtualBox's menu go to Devices -> Shared Folders. A dialog will show up. In this dialog you can specify which folder from your Windows system you want to share with your Ubuntu. Press the button with the + symbol to add a new shared folder in the list. You will have to specify a Folder Name for each folder you add. Make sure you memorize that name because you will need it in the next step. in this example it's SHARED

    When done with your shared folder(s) specification, you may now go ahead and actually mount these folders from Ubuntu. First you have to create a mounpoint, that is, a directory in your Ubuntu which will reflect the shared folder from Windows:

    sudo mkdir /media/windows-share
    Of course you may choose an alternative path for your mountpoint. With your mountpoint created you can now mount the shared folder, like this:

    sudo mount -t vboxsf folder-name /media/windows-share
    Where folder-name will be the name you assigned for this folder when you were adding it in the shared folders list. in this example it will be SHARED

  3. You could use the /etc/init.d/rc.local script to execute these commands on startup to have the shared folders automatically mounted every time you start your Ubuntu VirtualBox.

Monday, July 5, 2010

How to install and configure Xdebug to work with PHP5 on Ubuntu

The Xdebug extension helps you debugging your script by providing a lot of valuable debug information.
Before you install xdebug you should have PHP5 and Apache2 already working properly. Use the terminal to execute the following steps.

1) Install the latest version of xdebug in PEAR repository:
sudo apt-get install php5-dev php-pear

2) Install xdebug through PECL:
sudo pecl install xdebug

3) Now, you need to find the path of the compiled module (xdebug.so):
find / -name 'xdebug.so'
Copy the found file-path to use in the next steps.

4) Now we need to configure xdebug with PHP5, so open the php.ini file (usually you'll find it in /etc/php/apache2/php.ini) use gedit to edit the file:
sudo gedit /etc/php/apache2/php.ini
OR, use the pwerful text editor vim:
sudo vim /etc/php/apache2/php.ini

5) Add the following lines to the file [Note that the first line should contain the file path found in step number 3]:
zend_extension="/usr/lib/php5/20060613/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000

6) Finally, you need to restart apache for the changes to take effect:
sudo /etc/init.d/apache2 restart


To verify that the extention is loaded and configured correctly, check the phpinfo()
The following line should have been appended to the copyright lines:
with Xdebug v2.0.0, Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, by Derick Rethans


For full xdebug extention information, please read the official documentation at http://xdebug.org/docs/

Wednesday, June 30, 2010

Ascii Char/Decimal/Binary Converter

A very simple converter.
Now you can easily read binary :D
"There are only 10 types of people, Those who understand binary, and those who don't."

Download Executable
Download Source Code

Convert characters to decimal and binary ascii code representations, convert decimal numbers to binary numbers and characters of the corresponding ascii code, and convert binary numbers to decimal numbers and characters of the corresponding ascii codes:

Conversion from decimal to binary

Psuedo Code:

do
{
    bin = ((dec % 2 == 0) ? "0" : "1") + bin;
    dec /= 2;
} while (dec != 0);


C# Syntax:

private string DecToBin(long dec)
{
    string bin = string.Empty;
    string zero = "0";
    string one = "1";
    do
    {
            bin = string.Format("{0}{1}", ((dec % 2 == 0) ? zero : one), bin);
            dec /= 2;
    } while (dec != 0);

    return bin;
}

Sunday, June 27, 2010

Ubuntu under Windows: Use VirtualBox

I've been trying to install and setup Ubuntu 10.4 as a guest OS under Microsoft VPC 2007 on a Windows XP host, it's been a real hassle I have to say until I finally gave up and switched to Oracle VirtualBox instead. Everything went smooth afterwards on VirtualBox.

Presently, VirtualBox runs on Windows, Linux, Macintosh and OpenSolaris hosts and supports a large number of guest operating systems including but not limited to Windows (NT 4.0, 2000, XP, Server 2003, Vista, Windows 7), DOS/Windows 3.x, Linux (2.4 and 2.6), Solaris and OpenSolaris, and OpenBSD.