Friday, December 21, 2007

NS-2 Installation

NS-2 is a the most famous and universal network simulator

It took from me a lot of efforts to get it installed on my Ubuntu (many installations of the OS, many error messages upon failed installation).

But now it is okay as finally I got this message:

Ns-allinone package has been installed successfully.

Here are the installation places:
tcl8.4.14: /home/zidan/ns-allinone-2.31/{bin,include,lib}
tk8.4.14: /home/zidan/ns-allinone-2.31/{bin,include,lib}
otcl: /home/zidan/ns-allinone-2.31/otcl-1.13
tclcl: /home/zidan/ns-allinone-2.31/tclcl-1.19

ns: /home/zidan/ns-allinone-2.31/ns-2.31/ns
nam: /home/zidan/ns-allinone-2.31/nam-1.13/nam
xgraph: /home/zidan/ns-allinone-2.31/xgraph-12.1
gt-itm: /home/zidan/ns-allinone-2.31/itm, edriver, sgb2alt, sgb2ns, sgb2comns, sgb2hierns

I think that the favor returns to this good tutorial about NS-2 installation

And another important thing that I had run some example on this simulator and here is a screen shot of the simulation output at my desktop


And the favor also returns to this How to tutorials.

Friday, November 30, 2007

Soon my home by Joomla!™

Next step at my home page is to publish my content , I thought in building it from scratch and adding content gradually, but another option that came from my friend Mohamed Saad is to use a CMS like Joomla!™ and only administrate [or may customize in] it

I remember his words when he said that CMS is saying to administrator you can customize every thing with just some clicks and the developer is valueless to your site

So with a CMS I can apply the principle of reusablity and with a CMS I can build a site from a simple home page to any large web solution

And if you are asking Joomla!™ exactly? That is because Joomla! Wins 'Best CMS Award' in 2007!

Tuesday, November 27, 2007

My domain has been born

Thanks God I've released my own domain http://mzidan.com

Really I've many blogs "about 9 now" but; while blogs are doing a great function to me they still miss some communication facilities which made me buy a domain and a hosting space.

I worked in many live sites before and deployed a lot of them, but I never saw the birth of any domain before.

I really enjoyed the birth of my domain and my hosting and I got a new piece of experience with the DNS and Exchange and how to link the domain with the hosting account. "I never imagined that http://www.domain.com is a sub domain or alias of http://domain.com", and it is very inserting to have a mail account like MyName@MyDomain.com.

I can see that this site will help me in my academic path and I will use it as a communication channel with my students and I hope I can release soon an evaluation form for sessions I do in the faculty.

Finally God Willing http://www.mzidan.com will have content

Saturday, November 10, 2007

phpBB™ an Open Source forum solution

phpBB™ one of the most widely used Open Source forum solution. It has an easy to use administration panel and a user friendly installation process, which allows you to have a forum set up in minutes.

With a large and highly customizable set of key features coupled with a standards compliant interface, phpBB™ will grow with, and compliment your website. With millions of installations worldwide, it is no wonder phpBB™ is one of the most popular ways to create and support a community.

I have installed phpBB™ on my local machine and I really thank the open source community for providing the globe with this great script fro free.

I recommend any one new or old to PHP to install phpBB™ and navigate through the source code so that he can understand the logic of the forum sites.

This is the ACM online judge forum that run phpBB™

Friday, November 2, 2007

Smarty: Functions

Every Smarty tag either prints a variable or invokes some sort of function. These are processed and displayed by enclosing
the function and its attributes within delimiters like so: {funcname attr1='val1' attr2='val2'}.

Example function syntax

{config_load file='colors.conf'}
{include file='header.tpl'}
{insert file='banner_ads.tpl' title='Smarty is cool'}
{if $logged_in}
Welcome, {$name}!
{else}
hi, {$name}
{/if}
{include file='footer.tpl' ad=$random_id}

Smarty: Variables

{$foo} <-- displaying a simple variable (non array/object)
{$foo[4]} <-- display the 5th element of a zero-indexed array
{$foo.bar} <-- display the "bar" key value of an array, similar to PHP $foo['bar']
{$foo.$bar} <-- display variable key value of an array, similar to PHP $foo[$bar]
{$foo->bar} <-- display the object property "bar"
{$foo->bar()} <-- display the return value of object method "bar"
{#foo#} <-- display the config file variable "foo"
{$smarty.config.foo} <-- synonym for {#foo#}
{$foo[bar]} <-- syntax only valid in a section loop, see {section}
{assign var=foo value='baa'}{$foo} <-- displays "baa", see {assign}
Many other combinations are allowed
{$foo.bar.baz}
{$foo.$bar.$baz}
{$foo[4].baz}
{$foo[4].$baz}
{$foo.bar.baz[4]}
{$foo->bar($baz,2,$bar)} <-- passing parameters
{"foo"} <-- static values are allowed
{* display the server variable "SERVER_NAME" ($_SERVER['SERVER_NAME'])*}

Friday, October 26, 2007

Hello World! Smarty

Smarty is a web template system written in PHP.

Although Smarty is known as a "Template Engine", it would be more accurately described as a "Template/Presentation Framework." That is, it provides the programmer and template designer with a wealth of tools to automate tasks commonly dealt with at the presentation layer of an application. I stress the word Framework because Smarty is not a simple tag-replacing template engine. Although it can be used for such a simple purpose, its focus is on quick and painless development and deployment of your application, while maintaining high-performance, scalability, security and future growth.

I'm using Smarty many months ago, But I didn't build an application from scratch so far and I felt that I need to implement the Hello world demo to satisfy my ambition.

Smarty really was very easy installed and used, and here is my demo.

Code Snippet:

index.php

<?php

// put full path to Smarty.class.php
require('smarty/Smarty.class.php');
$smarty = new Smarty();

$smarty->template_dir = 'templates';
$smarty->compile_dir = 'smarty/templates_c';
$smarty->cache_dir = 'smarty/cache';
$smarty->config_dir = 'smarty/configs';

$smarty->assign('name', 'World');
$smarty->display('index.tpl.html');

?>

index.tpl.html

<html>
<head>
<title>Smarty</title>
</head>
<body>
Hello, {$name}!
</body>
</html>


Download Code 100 KB

Friday, October 12, 2007

Rob Chartier's WebLog: Terminals 1.6c has been released

Terminals is a multi-protocol tabbed interface for remote connections. Right now it supports all of these connection types:

1. RDP – Microsoft’s Remote Desktop aka Terminal Services

2. VNC – Virtual Network Computing

3. VMRC – Virtual Machine Remote Control

4. RAS – Remote Access Service (VPN, Dialup)

5. Telnet – Telecommunication Network

6. SSH – Secure Shell

7. ICA Citrix – Independent Computing Architecture

Other features include:

1. Ability to import files such as MuRD and RDP files.

2. Tagging connections (grouping)

3. Shortcuts (to external tools) and Favorites

4. Some toolbar customization

5. Full Screen mode, multiple screen sizes and color depths supported

6. Minimize to tray

7. Single application instance

8. Execute before connect

9. Completely secure password storage

10. Screen capture of entire terminal window

Read post


Some of the best Open Source Project - Copied

Codeproject has the best source code repository for developers. But another site Sourceforge.net also have some of the best quality projects available. Here I lists some of the best open source projects written in Visual C++. These are very good reference for all programmers.

List of Best Open Souce projects written in VC++/MFC

  1. 7-Zip (http://sourceforge.net/projects/sevenzip/) :
    7-Zip is a file archiver with the high compression ratio. The program supports 7z, ZIP, CAB, RAR, ARJ, LZH, CHM, GZIP, BZIP2, Z, TAR, CPIO, RPM and DEB formats. Compression ratio in the new 7z format is 30-50% better than ratio in ZIP format.
  2. eMule (http://sourceforge.net/projects/emule/):
    eMule is a filesharing client which is based on the eDonkey2000 network but offers more features than the standard client.
  3. eMule Plus (http://sourceforge.net/projects/emuleplus/) :
    eMule Plus is an evolution of the original eMule project, created to improve its abilities and features, in both work efficiency and user interface.
  4. eMule Morph (http://sourceforge.net/projects/emulemorph/):
    eMule Morph Mod - eMule Modding Project.
  5. FileZilla (http://sourceforge.net/projects/filezilla/):
    FileZilla is a fast FTP and SFTP client for Windows with a lot of features. FileZilla Server is a reliable FTP server.
  6. KeePass Password Safe (http://sourceforge.net/projects/keepass/):
    KeePass Password Safe is a free, open source, light-weight and easy-to-use password manager for Windows. You can store your passwords in a highly-encrypted database, which is locked with one master password or key file.
  7. K-Meleon (http://sourceforge.net/projects/kmeleon/):
    K-Meleon is a fast and customizable web browser that can be used instead of Internet Explorer on Windows. Powered by the same Gecko engine as the Firefox and Mozilla browsers, K-Meleon provides users with a secure browsing experience.
  8. MiKTeX (http://sourceforge.net/projects/miktex/):
    MiKTeX is an up-to-date implementation of TeX & Friends for Windows (all current variants).
  9. MyNapster (http://sourceforge.net/projects/mynapster/):
    MyNapster is a Win32 client using Gnutella and IRC for chat. It is based on Gnucleus and utilizes MFC (works with WINE).
  10. Nokia Composer (http://sourceforge.net/projects/nokiacomposer/):
    This is a Win32, VC++ MFC application to manage Nokia mobile phones melodies. Includes VC++ source code and Rational Rose UML model.
  11. Peters Backup (http://sourceforge.net/projects/pbackup):
    Peters Backup is a program for backing up your important data files on to diskette, zip drive, fixed disk or CD/RW. It uses an extremely efficient compression algorithm. It keeps track of all versions of your files in full and incremental backups.
  12. Password Safe (https://sourceforge.net/projects/passwordsafe/):
    Password Safe is a password database utility. Users can keep their passwords securely encrypted on their computers. A single Safe Combination unlocks them all.
  13. RenFile (http://sourceforge.net/projects/renfile/):
    rename files and folders in bulk using this vc++ .net program.
  14. Shareaza (https://sourceforge.net/projects/shareaza/):
    Multi-network peer-to-peer file-sharing client supporting Gnutella2, Gnutella1, eDonkey2000/eMule and BitTorrent protocols. Using C++, MFC and ATL, for Windows.
  15. SunshineUN (http://sourceforge.net/projects/sunshineun/):
    SunshineUN is a free Napster based file sharing program for Opennap/Slavanap which allows you to share and download multiple files of different types for example music, pictures and videos. It is for Windows and it is written in C++ using MFC .
  16. TortoiseCVS (http://sourceforge.net/projects/tortoisecvs/):
    TortoiseCVS is an extension for Microsoft Windows Explorer that makes using CVS fun and easy. Features include: colored icons, tight integration with SSH, and context-menu interactivity.
  17. TortoiseSVN (http://sourceforge.net/projects/tortoisesvn):
    TortoiseSVN is a Subversion (SVN) client, implemented as a windows shell extension. It's intuitive and easy to use, since it doesn't require the Subversion command line client to run. Simply the coolest Interface to (Sub)Version Control!
  18. WinDirStat: Windows Directory Statistics (http://sourceforge.net/projects/windirstat/):
    WinDirStat (WDS) is a disk usage statistics viewer and cleanup tool for Windows. It shows disk, file and directory sizes in a treelist as well as graphically in a treemap, much like KDirStat or SequoiaView.
  19. WinDjView (http://sourceforge.net/projects/windjview):
    WinDjView is a fast, compact and powerful DjVu viewer for Windows with continuous scrolling and advanced printing options, based on free DjVuLibre library. MacDjView is a simple DjVu viewer for Mac OS X, also with continuous scrolling.
  20. C++ Library for Windows (http://sourceforge.net/projects/rulib):
    A C++ library for the Windows platform containing classes for MIME, video capture, socket, Windows registry, files, images, and other basic purposes.
  21. WinMerge (https://sourceforge.net/projects/winmerge/):
    WinMerge is a Win32 tool for visual difference display and merging, for both files and directories. Unicode support. Flexible syntax coloring editor. Windows Shell integration. Regexp filtering. Side-by-side line diff and highlights diffs inside lines.
  22. Disk Cleaner (http://sourceforge.net/projects/dclean/):
    Disk Cleaner is a tool to quickly and easily free disk space that is used by temporary files like the system temporary folder, the Internet Explorer Cache and Cookies folder, and the Recycle Bin. It can be expanded with text-based plug-ins & DLLs.
  23. Shared IIS Server Log/Bandwidth-Analyzer (http://sourceforge.net/projects/sharediis/):
    This utility is intended to be used to analyze and present a per-site (in case of WWW logs), or (in case of FTP logs) a per-web summary of bandwidth used, hits, and average bandwidth used.
  24. Remote Control Center (http://sourceforge.net/projects/remotectrlctr/):
    Remote Control Center is an application designed to help a system/network administrators taking control of remote devices in the network from a single GUI.
  25. RevConnect - Enhanced DC++ (http://sourceforge.net/projects/reverseconnect/):
    RevConnect is a file sharing program based on DC++. It is fully compatible with the Direct Connect network and made some major features.
  26. Show Traffic (http://sourceforge.net/projects/showtraf):
    "Show Traffic" monitors network traffic on the chosen network interface and displays it continuously. It could be used for locating suspicious network traffic or to evaluate current utilization of the network interface.
  27. War FTP Daemon Engine (http://sourceforge.net/projects/wfde/):
    A generic C++ class library for FTP server implementations, including a full-featured, mature FTP server.
  28. AxCrypt - File Encryption for Windows (http://sourceforge.net/projects/axcrypt/):
    AxCrypt - Personal Privacy and Security with AES-128 File Encryption and Compression for Windows 98/ME/NT/2K/XP. Double-click to automatically decrypt and open documents. Store strong keys on removable USB-devices.
  29. Open Source Firewall For Windows (http://sourceforge.net/projects/firewallpapi/):
    FirewallPAPI is an open source firewall for Windows 2000 and above. It is a simple utility for filter network traffic.
  30. MinkSonic Jukebox (http://sourceforge.net/projects/minksonic):
    MFC-based front-end to Winamp that provides jukebox behavior as well as "explorer-like" MP3 library management, a web-based network interface and MP3 frame error detection/correction.
  31. p2pfire: super p2p driver firewall (http://sourceforge.net/projects/p2pfire):
    Super P2P firewall 32/64 bits (driver + aplication).
  32. WABAccess (http://sourceforge.net/projects/wabaccess/):
    The WABAccess component give an access to the Windows Address Book (or WAB) used by Outlook Express. It's a COM/ATL component that give an access from Visual Basic language or Scripting language (VBS) to WAB.
  33. Yet Another Fractal Explorer (http://sourceforge.net/projects/yafe):
    Yet Another Fractal Explorer is an interactive fractal renderer for Windows. It features extremely simple and intuitive user interface and is capable of producing mathematically-sound renderings.
  34. CDDA Ripper XP (http://sourceforge.net/projects/cddarip):
    CDDA Ripper XP is an audio CD ripper program that provides support for NT/2000/XP natively (ASPI manager is optional). It supports WAV-MP3-OGG-FLAC-ACM codec encoding and can be used to rip multiple CDs. It uses newest encoders like LAME and Ogg/Vorbis.
  35. [ mp3 - explorer ] (http://sourceforge.net/projects/mp3explorer):
    [ mp3 - explorer ] is a MP3 Manager providing advanced features : multi-folders file scaning with cache - id3v1 and id3v2 tagging - Intellitag - Html view of the tracks displaying album cover and Lyrics.
  36. ultraMaGE (http://sourceforge.net/projects/ultramage):
    ultraMage is a powerful dual-window file manager for Windows with many useful features like bookmarks, advanced file operations and folder synchronisation. It is still very easy to use, because the user interface is similar to that of Windows Explorer.
  37. WinTarBall (http://sourceforge.net/projects/wintarball/):
    WinTarBall adds a control panel and an Explorer shell extension that allow users to compress directories into .tgz or .tbz files simply by right-clicking on them and choosing "compress to tarball".
  38. XML Explorer (http://sourceforge.net/projects/xpathexplorer/):
    A utility to query xml files using XPath and also extend XPath to more documents than one. Win32 platform/MFC.
  39. Emerge Desktop (http://sourceforge.net/projects/emerge/):
    emerge is an alternate windows shell. It's purpose is to replace Windows Explorer as your desktop user interface, providing similar functionality, with the additional plugins to provide even more.
  40. Folder Size for Windows (http://sourceforge.net/projects/foldersize/):
    Folder Size for Windows adds a new column to the Windows Explorer details view that displays the sizes of files and folders. A service scans your hard disk in the background and caches the results. Designed for performance!
  41. Rename-It! (https://sourceforge.net/projects/renameit/):
    Define some filters to apply to a list of files, which can be in multiple folders, to rename the whole list at once. It checks the file names, integrates in the Shell (via Explorer context menu), supports regular expressions, ID3 tags, and much more.
  42. ShellWM (http://sourceforge.net/projects/shellwm/):
    Windows skinning application to be used with a Win32 Shell replacement (like Litestep, geOshell, sharpE, etc.) or just native Explorer.
  43. Blackbox for Windows (http://sourceforge.net/projects/bb4win/):
    Blackbox for Windows is an alternative shell for Microsoft Windows. It is based stylistically on the Blackbox window manager for the X Window System, however it does not use the same codebase except for the gradient rendering code.
  44. HideThatWindow! (http://sourceforge.net/projects/hidethatwindow/):
    HideThatWindow! enables you to Hide or Show a window; minimize, maximize and restore its original size (or change the size to fit your needs). Disable the window's taskbar button or send it to tray. Other features are transparency, docking and top-most.
  45. Security & Privacy Complete 3 (http://sourceforge.net/projects/cmia/):
    Security & Privacy Complete is mainly a security tool for Windows. It can disable all services which might be a securit-risk, harden registry settings... Also included privacy features for Internet Explorer, Media Player, and of course: Mozilla Firefox.
  46. TaskSwitchXP (http://sourceforge.net/projects/taskswitchxp/):
    TaskSwitchXP provides the same functionality as the existing application switching mechanism in Windows XP today. In addition to displaying an icon list, however, the application will also show a thumbnail preview of the window that will be switched to.
  47. Windows Process Tools (http://sourceforge.net/projects/winpstools):
    Command-line utilities to find, list, and terminate running processes under Windows, similar to the Unix ps and kill commands. Good for command-line folks who don't like to use the Windows Task Manager.
  48. OpenSTA (http://sourceforge.net/projects/opensta/):
    Open System Testing Architecture - a distributed software testing architecture designed around CORBA. The current toolset has the capability of performing scripted Web (HTTP and HTTPS) heavy load tests with performance measurements from Win32 platforms.
  49. MFC MUTE (http://sourceforge.net/projects/mfc-mute-net/):
    MFC MUTE is a MS Windows *ONLY* client for the MUTE anonymous P2P network. This application derives from the original MUTE (mute-net.sourceforge.net) app supporting anonymous file sharing. The GUI is the best/most polished Windows MUTE available.
  50. DeepNetScanner (http://sourceforge.net/projects/nbtenum):
    This is a internet security scanner which scans a specified machine or a range of IPs for all possible information like NetBIOS enumeration, gathering sharelist, domain, os, lan manager, remote connection, SNMP walking, ...
  51. WinSCP (http://sourceforge.net/projects/winscp/):
    WinSCP is a SFTP and SCP client for Windows using SSH. Its main function is secure copying of files between a local and a remote computer. Beyond this basic function, WinSCP manages some other actions with files. Plugin to FAR manager is available too.
  52. winfingerprint (http://sourceforge.net/projects/winfingerprint/):
    Winfingerprint is a Win32 MFC VC++ .NET based security tool that is able to Determine OS, enumerate users, groups, shares, SIDs, transports, sessions, services, service pack and hotfix level, date and time, disks, and open tcp and udp ports.
  53. Visual Component Framework (http://vcf-online.org/): The Visual Component Framework is an advanced C++ application framework that makes it easy to produce powerful C++ applications. The framework is a based on a thoroughly modern C++ design and has built in support for Rapid Application Development (RAD).

Some Very good VC++/MFC resources beside Codeproject.com

  1. http://www.naughter.com/ (VC++/MFC huge code repository)
    By PJ naughter Personally my favorite beside codeproject.com. This site contains huge source code repository for MFC programmer. It has some of the best addon classes written for MFC programmers. What I like most about PJ naughter is that he keeps on improving these classes and fix each and every bug in the code. Some of the classes has now is 70 to 80th version.
  2. http://flounder.com/mvp_tips.htm (VC++/MFC)
    BY Joseph M. Newcomer
    This is very nice site containing lots and lots of VC++ tips tricks and very detailed essays + great code examples. Main focus is on how to write the code in right way.
  3. http://www.cheztabor.com/ (ATL/WTL)
    by cheztabor
    This site contains very nice code examples for ATL , WTL and Shell programming.
  4. http://www.viksoe.dk/code/ (ATL/WTL)
    By author of Gmail Drive
    Although code for GmailDrive is not provided but this site contains lots of other code example covering MFC, ATL, WTL and Shell programming.
  5. http://www.codeguru.com/ (VC++/MFC/ATL and lot more)
    Does not need any introduction. I think most of us already know about this site.
  6. http://programmerworld.net/personal/projects.htm (VC++/MFC )
    This is my personal web site. It has one firewall software with source code. Will be adding more code soon.
  7. http://vcfaq.mvps.org/ (VC++/MFC FAQs)
    This is the MVP's Frequently Asked Questions Page for Microsoft Visual C++. In here you'll find answers to several common asked questions about Visual C++, MFC and Windows development in C/C++, as well as other.
  8. http://www.developersvoice.com/programming/article/vc-mfc (VC++/MFC)
    VC++/ MFC related FAQS
  9. http://www.functionx.com/ (VC++/MFC )
    A beginners site for VC++ and MFC programming. Contains some very nice beginner articles.
  10. http://www.softlookup.com/tutorial/vc++/index.asp A beginners site for VC++ and MFC programming. Contains some very nice beginner articles.
  11. http://www.mathcs.sjsu.edu/faculty/pearce/mfc/ A very vice web site. Very well written. One of the best resource for beginner in the field of VC++/MFC.

Original Source

Google - Best Place to Work For

Sunday, October 7, 2007

Feature Article : Building AJAX Enabled File Uploading System with Progress Bar Using ASP.NET 2.0

This article examines how to upload a file to a remote web server using ASP.NET 2.0 and AJAX. The author also discusses how to display a "Please wait ..." message while the upload is happening. Read here

Soon .Net 3.5 open source

ScottGu just made a very exciting announcement - as of Visual Studio 2008 and .NET 3.5, the base class libraries will ship with source and debug symbols! What this means to developers is we'll no longer need to resort to tools like Reflector to see what is going on under the covers when we use framework libraries. These libraries are being released under the Microsoft Reference License (MS-RL), and can be browsed locally as well as being used within the Visual Studio debugger.

In addition to making it easier to see why a certain thing is failing or behaving unexpectedly, this will also make it much easier for developers to see real examples of the established patterns and practices for building classes within .NET. For instance, there are many ways to implement a collection, or a web control, but many of them are wrong (or at best, not consistent with how the rest of the framework operates). With the added transparency of being able to easily see how things are done in the framework, I think many developers will write better code by virtue of the fact that they'll be more likely to follow the best practices embodied in the framework code.

Initially, the source for *everything* won't be included, but most of the heavily used namespaces appear to be in the list, and I think we'll see others coming in the future.

Sunday, September 30, 2007

Autostarting an appliaction

You can add your appliaction to the system startup using the calss CRegKey
Here is the code snippet

#include "atlbase.h" //Required for CRegKey class

void RemAutoStart() // To remove old entry
{
CString strKeyName;
strKeyName = _T("myAppAutoStart");
CRegKey mKey;
mKey.Create(HKEY_CURRENT_USER,
_T("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),
REG_NONE,REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS, NULL,NULL);
mKey.DeleteValue(strKeyName);
mKey.Close();
}

void AddAutoStart() // To add new entry
{
RemAutoStart();
CString strKeyName;
strKeyName = _T("myAppAutoStart");
TCHAR sExeFilePath[490];
DWORD length;
length = ::GetModuleFileName(NULL, sExeFilePath, 490);
if(!length)
return;
CString sFullExeCommand;
sFullExeCommand.Format(_T("%s -AutoStart"), sExeFilePath);
CRegKey mKey;
mKey.Create(HKEY_CURRENT_USER,
_T("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),
REG_NONE,REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS, NULL,NULL);
mKey.SetStringValue(strKeyName, sFullExeCommand);
mKey.Close();
}

Open a working folder

C++ code snippet:

ShellExecute(NULL, NULL, L"C:\\Windows", NULL, NULL, SW_SHOWNORMAL);

C++ code snippet:

System.Diagnostics.Process prc = new System.Diagnostics.Process();
prc.StartInfo.FileName = "explorer.exe";
prc.StartInfo.Arguments = "C:\\Windows";

prc.Start();

Setup Package

If you are using .Net framework then the best and easiest choice for you is to make a Setup and Deployment project or Setup wizard.

Also you can use NSIS (Nullsoft Scriptable Install System), It is a professional open source system to create Windows installers. It is designed to be as small and flexible as possible and is therefore very suitable for internet distribution.

You can edit the script setup for the NSIS package using a simple editor like notepad or you can also use Mihov NSIS Helper, It is a program for graphical creating of script files for NSIS.

There another option for you InstallShield but this tool is not free.

Saturday, September 15, 2007

Recommended Article: Populating a DropDownList using AJAX and ASP.NET

On of my experienced friends when asked do you know Ajax? He replied with the following?

Ajax is single class ,

Ajax = No full post back = No page reload nor Refresh effect.

So here is that class example that I saw zillions in many sites check it.

AjaxWindows: All the benefits of a real OS, but a lot slower

AjaxWindows still don't fully get the whole Web operating system concept. Why run an OS inside a browser when your browser is running in an OS to begin with?

But AjaxWindows, a Web OS and application suite that makes a very good case for the Web OS. It's not ready yet for adoption by the world at large, but the idea behind it, and some of the features in it, are too interesting to write off as just yet another science project.

Ajax13, the company that makes AjaxWindows, was originally started to create Web-based applications. It made a word processor, sketching program, and a presentation application.

AjaxWindows stores its files in Google's Gmail. Considering Gmail's free storage (over 2.5 GB), that's clever, even if Google wasn't consulted for this application. AjaxWindows, and its native applications, store everything except music files in Gmail (Music is stored on MP3Tunes).

Source CNet

Sunday, September 9, 2007

Documentation Tools

This blog "Documentation Tools" contains cool tools for documenting ASP, .NET, SQL, VB, PHP projects.

Sunday, September 2, 2007

Compare Databases

To compare SQL Server databases you can refer to this post -SQL Server Database Comparison and Synchronization-.

However to compare mySql databases you can use EMS DB Comparer for MySQL , It a cool tool for that purpose.

Start and Stop Windows Service

You can check these two MSDN articles:

Starting a Service

Stopping a Service

Or download this code snippet - 3kb

Friday, August 31, 2007

Interview with George Hotz

George Hotz or geohot, is now 17 years old guy, and he is the world's first full hardware unlock of the Apple iPhone if you didn’t see iPhone before play the next video.

Really I saw this Arabic article on BBCArabic, and the topic attracted me.

So I get you this article about the topic. And I hope you enjoy the next interview with this respectful guy.

Also he published the full story of success on his blog, … he deserve to be tracked.

You can also see the end of a successful summer vacation

Wednesday, August 15, 2007

Event Synchronization : only on thread can excute

Code snippet

#include "Windows.h"
#include
using namespace std;

HANDLE thread1;
HANDLE thread2;
HANDLE mEvent;    
char x;

// Test thread routine.
DWORD WINAPI F1(LPVOID lpParameter)
{
bool *bRunning = reinterpret_cast(lpParameter);
while(true)
{
if(x=='q')
{
*bRunning = false;
break;
}
WaitForSingleObject (mEvent,INFINITE);//nonsignaled = wait
cout <<"Start F1\n";
cout <<"Working F1 \n";
cout <<"any service from me if so press any key [q to quit]\n";
cin>>x;
cout <<"Thank you\nEnd F1\n\n";
SetEvent(mEvent); //signaled = finished work
}
return 0;
}

// Test thread routine.
DWORD WINAPI F2(LPVOID lpParameter)
{
bool *bRunning = reinterpret_cast(lpParameter);
while(true)
{
if(x=='q')
{
*bRunning = false;
break;
}

WaitForSingleObject (mEvent,INFINITE);//nonsignaled = wait
cout <<"Start F2\n";
cout <<"Working F2 \n";
cout <<"any service from me if so press any key [q to quit]\n";
cin>>x;
cout <<"Thank you\nEnd F2\n\n";
SetEvent(mEvent); //signaled = finished work
}
return 0;
}



void main()
{

bool bRunning = true;
mEvent = CreateEvent(NULL, FALSE, TRUE, NULL);
thread1 = CreateThread(NULL, 0, F1, static_cast(&bRunning), 0, NULL);
thread2 = CreateThread(NULL, 0, F2, static_cast(&bRunning), 0, NULL);
while(bRunning)
{
}
CloseHandle(thread1);
CloseHandle(thread2);
CloseHandle(mEvent);

}

MFC code snippet

#include "stdafx.h"
#include "CEvent.h"
#include "conio.h"
#include "afxmt.h"

using namespace std;

HANDLE thread1;
HANDLE thread2;
CEvent mCEvent(TRUE,FALSE);
char x;

// Test thread routine.
DWORD WINAPI F1(LPVOID lpParameter)
{
bool *bRunning = reinterpret_cast(lpParameter);
while(true)
{
if(x=='q')
{
*bRunning = false;
break;
}
WaitForSingleObject (mCEvent,INFINITE);//nonsignaled = wait
cout <<"Start F1\n";
cout <<"Working F1 \n";
cout <<"any service from me if so press any key [q to quit]\n";
cin>>x;
cout <<"Thank you\nEnd F1\n\n";
SetEvent(mCEvent); //signaled = finished work
}
return 0;
}

// Test thread routine.
DWORD WINAPI F2(LPVOID lpParameter)
{
bool *bRunning = reinterpret_cast(lpParameter);
while(true)
{
if(x=='q')
{
*bRunning = false;
break;
}

WaitForSingleObject (mCEvent,INFINITE);//nonsignaled = wait
cout <<"Start F2\n";
cout <<"Working F2 \n";
cout <<"any service from me if so press any key [q to quit]\n";
cin>>x;
cout <<"Thank you\nEnd F2\n\n";
SetEvent(mCEvent); //signaled = finished work
}
return 0;
}



int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;

// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
_tprintf(_T("Fatal Error: MFC initialization failed\n"));
nRetCode = 1;
}
else
{
bool bRunning = true;
thread1 = CreateThread(NULL, 0, F1, static_cast(&bRunning), 0, NULL);
thread2 = CreateThread(NULL, 0, F2, static_cast(&bRunning), 0, NULL);
while(bRunning)
{
}
CloseHandle(thread1);
CloseHandle(thread2);
}
return nRetCode;
}

Download source without using MFC
Download source using MFC

Sunday, August 12, 2007

Handling on resize event in Java Script

Code Snippet

window.onresize= message;
function message()
{
alert("The window has been resized!");
}

View Sample[^]
Dwonload Sample

Get window dimensions by java script

Code Snippet


function DisplayWindowDimensions()
{
var myWidth = 0, myHeight = 0;
if( typeof( window.innerWidth ) == 'number' )
{
myWidth = window.innerWidth; myHeight = window.innerHeight;
}
else if( document.documentElement && (document.documentElement.clientWidth||document.documentElement.clientHeight ) )
{
myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight;
}
else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
{
myWidth = document.body.clientWidth; myHeight = document.body.clientHeight;
}
window.alert( 'Window Width = ' + myWidth + ' and Window height = ' + myHeight );
}

View Sample[^]
Download Source

Saturday, July 28, 2007

Google Boring Blog Editor

Every time I create a new post in the blogger I get bored from the post editor

You may ask why???

As I make a series of switches between the html editor and the Rich Text editor

I can't use only one to post a message

For example:

If I want to add an embed object or a movie, I have to use the html editor so I have to format the text in the html editor,… I lose my eyesight inside the html tags.

If I want to add a code snippet I have to format it in the html editor

If switched to html editor and get back to the Rich Text sometimes I lose the format of text formatted before.

Some html tags are not working in the html editor so I can't use an html document generated by MS Word.

Add to this somethings that I forgot.

So I lose a lot of time editing my posts

May I say that I was too lazy, but now I'm not?

And it is the last time to lose time editing my posts

Now I write my post in MS Word and I made simple windows app that convert each text block into its corresponding html format that I need.

That all

This scren shot was edited by the image option


Download Demo - 5 KB
Download Source - 13 KB

Thursday, July 26, 2007

Type.GetProperty Method


public PropertyInfo GetProperty ( string name )

This function Searches for the public property with the specified name.

Example

using System;
using System.Reflection;

class MyClass
{
    private int myProperty;
    // Declare MyProperty.
    public int MyProperty
    {
        get
        {
            return myProperty;
        }
        set
        {
            myProperty=value;
        }
    }
}
public class MyTypeClass
{
    public static void Main(string[] args)
    {
        try
        {
            // Get the Type object corresponding to MyClass.
            Type myType=typeof(MyClass);    
            // Get the PropertyInfo object by passing the property name.
            PropertyInfo myPropInfo = myType.GetProperty("MyProperty");
            // Display the property name.
            Console.WriteLine("The {0} property exists in MyClass.", myPropInfo.Name);
        }
        catch(NullReferenceException e)
        {
            Console.WriteLine("The property does not exist in MyClass." + e.Message);
        }
    }
}

Domain Model

What’s a Domain Model?

A domain model is a project dictionary of all the terms used in your project.

It shows graphically how all these different terms relate to each other.

It’s a simplified class diagram

It shows aggregation and generalization relationships (has-a and is-a relationships) between the domain classes.

Top 10 Domain Modeling Guidelines

1. Focus on real-world (problem domain) objects.

2. Use generalization (is-a) and aggregation (has-a) relationships to show how the objects relate to each other.

3. Limit your initial domain modeling efforts to a couple of hours.

4. Organize your classes around key abstractions in the problem domain.

5. Don’t mistake your domain model for a data model.

6. Don’t confuse an object (which represents a single instance) with a database table (which contains a collection of things).

7. Use the domain model as a project glossary.

8. Do your initial domain model before you write your use cases, to avoid name ambiguity.

9. Don’t expect your final class diagrams to precisely match your domain model, but there should be some resemblance between them.

10. Don’t put screens and other GUI-specific classes on your domain model.

Reference

Use Case Driven Object Modeling with UML: A Practical Approach. Exists at amazon.com.

Wednesday, July 18, 2007

Jing : Free Screen Recording Software

Jing Project is a free screen recording software from the Camtasia folk.

With Jing you can

Capture Images: Snap a picture of anything on your desktop.

Record Video : Record video of what you do, or what you see.

Share Online : Instantly uploaded. Share in email, IM, or blogs.

Go to Jing Now

Friday, July 13, 2007

I/O Brush

The I/O Brush allows you to paint using the world as your palette

See this amazing video "S'il vous plait"



Also see the story

Tuesday, June 19, 2007

Everyscape a 3D Virtual World

Everyscape is a much simpler product technically but is quite a bit more useful in the near term. They turn regular 2D pictures into 3D images that look like they were taken with special cameras. Viewers can pan around a 3D area, and move from point to point. See the demo on their site to get a feel for it.

Everyscape launches this Fall, promising ten cities. Users will also be encouraged to submit their own photos to be included in the models.

The company is attacking Google and Microsoft head on in those companies’ efforts to photograph the world and let people meander through it. They may have a chance - there are no special downloads required and they’ll be relying on users to take many or most of the photos used in the service. Whether they make it or not is unclear, but it’s fun to play with these products anyway. Good luck to them.

source : techcrunch

Saturday, June 2, 2007

Working With Database Metadata

Download Source - 1 KB

In this sample we will work directly with the database schema.
CodeSmith enables this scenario through the use of the SchemaExplorer assembly, which provides types for working directly with SQL Server or ADO data as well as designers that can be used to access those types from CodeSmith.

We will use CodeSmith to generate a stored procedure based on any given table.

We will generate two types of stored procedures; the first will return all the field of a given table, and the second will return only the row for any given key.
We defined enumeration for the two types, an enumration is defined between script block

<script runat="template">
</script>

<script runat="template">
public enum StoredProcEnum

    GetAll,
    GetByPrimaryKey,
}
</script>

And then we can use a CodeSmith Property directive to define a property that makes use of the new type.

<%@ Property Name="StoredProcType" Type="StoredProcEnum" Default="GetAll" Optional="False" Category="Options" Description="Determine the type of the stored procedure" %>

CodeSmith itself doesn't have any special knowledge of the types in the SchemaExplorer library, so we need to tell it to load the assembly containing the library.
It's also useful to import the SchemaExplorer namespace to keep the amount of typing we have to do to a minimum:

<%@ Assembly Name="SchemaExplorer" %>
<%@ Import Namespace="SchemaExplorer" %>

Then we define a Property directive that allows the user to pick a table from a database.
This property of type TableSchema.

<%@ Property Name="SourceTable" Type="SchemaExplorer.TableSchema" Optional="False" Category="Context" Description="Table that the stored procedure will access."  %>

Now we can use this property to retrive ant information about the table and the database.

<%= SourceTable.Name %>
<%= SourceTable.Owner %>
<%= SourceTable.Database.Name %>

The last thing we need to build a function that transform table column native type to is corresponding SQL type.
A function id defined between script block.

<script runat="template">
</script>

<script runat="template">
public string GetVariableType(ColumnSchema column)
{
     switch (column.DataType) 
     {
           case DbType.AnsiString: return "varchar("+column.Size+")"; 
          case DbType.AnsiStringFixedLength: return "char ("+column.Size+")"; 
          case DbType.StringFixedLength: return "nchar("+column.Size+")"; 
          case DbType.String: return "nvarchar ("+column.Size+")"; 
          case DbType.Binary: return "binary("+column.Size+")"; 
          case DbType.Boolean: return "bit"; 
          case DbType.Currency: return "money"; 
          case DbType.Date: return "datetime"; 
          case DbType.DateTime: return "datetime"; 
          case DbType.Decimal: return "numeric"; 
          case DbType.Double: return "float"; 
          case DbType.Guid: return "uniqueidentifier"; 
          case DbType.Int16: return "smallint"; 
          case DbType.Int32: return "int"; 
          case DbType.Int64: return "bigint"; 
          case DbType.Byte: return "tinyint"; 
          case DbType.Single: return "real"; 
          case DbType.Time: return "datetime"; 
          default: 
          { 
               return "__UNKNOWN__"+ column.NativeType; 
          } 
     }
}
</script>

And then we can use this fuction iside a code block.

<%= GetVariableType( SourceTable.PrimaryKey.MemberColumns[i] )%>


Tuesday, May 29, 2007

RSS News Feed Back Reader

Download Source - 44 KB

This sample indicate how to read RSS news feed back using PHP

Sample Code

<?php
require_once('rss/rss_fetch.inc');
error_reporting(E_ERROR);
$rss = fetch_rss ( "http://www.youtube.com/rss/global/top_viewed_today.rss" ) ;
$items = array_slice($rss->items, 0);
$news_feed = ''; 
foreach ($items as $item )
{
       $news_feed .= '' . $item['title'] .'<br>'. $item['link'].'<br>'.$item['summary'] . '<br>' ;
}
echo $news_feed;
?>

This sample uses MagpieRSS library which is attached with the source code and also can be downloaded from the following link
http://magpierss.sourceforge.net

XML Reader

Download Source - 8 KB

This sample indicate how to parse XML file using PHP

Sample Code

<?php
require_once("xmllib.php");
$menufilename= "SampleFile.Xml";
$xml =& new XmlLib_xmlParser($menufilename);
$doc =& $xml->getDocument();
$Maindoc=$doc->children[0];
//$arr = $Maindoc->children[$i]->toArray();
if ($Maindoc->hasChildren())
{
       foreach($Maindoc->children as $group)
      {
            echo'id : '.$group->attributes['id'].' Title :'.$group->attributes['title']."<br>";
           if ($group->hasChildren())
           {
                 foreach($group->children as $menuItem)
                {
                     echo'id : '.$menuItem->attributes['id'].' Title : '.$menuItem->attributes['title']."";
                } echo '<br>';
           }
     }
}
?>


Sunday, May 13, 2007

My First CodeSmith Template

Download source - 1 KB

Consider this template that will generate the output of an AssemblyInfo.cs file

<%@ Property Name="Author" Type="System.String" Description="Lead author of the project." %>
<%@ Property Name="Title" Type="System.String" Description="Title of the project." %>
<%@ Property Name="Description" Type="System.String" Description="Description of the project." %>
<%@ Property Name="Configuration" Type="System.String" Default="Debug" Description="Project configuration." %>
<%@ Property Name="Company" Type="System.String" Default="MegaUtilities, Inc." %>
<%@ Property Name="Product" Type="System.String" Description="Product Name." %>
<%@ Property Name="Version" Type="System.String" Default="1.0.*" Description=".NET assembly version." %>
<%@ Property Name="FileVersion" Type="System.String" Default="1.0" Description="Win32 file version." %>
using System.Reflection;
using System.Runtime.CompilerServices;
//
// Created: <%= DateTime.Now.ToLongDateString() %>
// Author : <%= Author %>
//
[assembly: AssemblyTitle("<%= Title %>")]
[assembly: AssemblyDescription("<%= Description %>")]
[assembly: AssemblyConfiguration("<%= Configuration %>")]
[assembly: AssemblyCompany("<%= Company %>")]
[assembly: AssemblyProduct("<%= Product %>")]
[assembly: AssemblyCopyright("Copyright (c) <%= DateTime.Now.Year.ToString() %> <%= Company %>")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("<%= Version %>")]
[assembly: AssemblyFileVersion("<%= FileVersion %>")]
[assembly: AssemblyDelaySign(true)]

You should notice three distinct types of code in the previous template

1.Content that will never change

CodeSmith treat any code written outside the tag

<%= %>

as a static content that will appear as it was written the output file

2.Content that can be automatically generated

Like the segment

<%= DateTime.Now.ToLongDateString() %>

This will print the date of creation the output file

3. Content that you will prompt the user for

Like the property

<%@ Property Name="FileVersion" Type="System.String" Default="1.0" Description="Win32 file version."%>

This property will prompt the user to enter the value of the FileVersion