Showing posts with label Code. Show all posts
Showing posts with label Code. Show all posts

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

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

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

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

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.

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

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);
        }
    }
}