Numeric/Digits Only Input for Textbox in .NET

Friday, October 09, 2009

To set a particular textbox control to only accept Numeric/Digits values, we do not have any property for textbox .NET control. To do this, we can add add an event handler on KeyPress event - where we check the input key value on each key-press, and then only let the digit to go through.

Below is a simple example of event-handler using VC++ to accept only digits:


System::Void MyButton_KeyPress(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e)
{
if( !(e->KeyChar >='0' && e->KeyChar <= '9' || System::Char::IsControl( e->KeyChar )))
{
e->Handled = true;
}

}//End keyPress handler


The expression 'System::Char::IsControl( e->KeyChar )' is required because we do not want to block the control key functions like Tab/Enter etc.

In your form's class constructor, you will have to assign this event handler function using a statement like below:

this->MyButton->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &TCPListenerForm::MyButton_KeyPress);

Read more...

Free & Open Source PHP IDE

Sunday, September 20, 2009

Aptana Studio with the PHP plugin installed makes for the best free PHP IDE available today.
Aptana is cross-platform and open source web development environment that combines powerful authoring tools for HTML, CSS, and JavaScript. It offers excellent code-hinting, reference, code completion, and edit-time syntax checking. You can also preview your pages in Firefox and IE within the IDE, and you can configure other browsers for preview as well.
The free version of Aptana Studio has Javascript Debugger for Firefox, and has support for all the leading Javascript and Ajax libraries including jQuery, Prototype, YUI, dojo, Ext JS and MooTools.

What more? It also includes support for FTP and SVN to upload/download and synchronize your project files to remote systems easy.

Below are some quick links to get you started with Aptana:
Download Aptana Sudio
Aptana Sudio Online Help
Aptana Knowledge Base and FAQs
Aptana Blog
Wikipedia Article On Aptana

Read more...

Advanced File Search Software For Windows - Astrogrep

Thursday, August 13, 2009

Astrogrep is a free file searching software for Windows with advanced search features including regular expressions and negation search. Its a Windows alternative to grep command on Unix/Linux, and this has a cool user interface. This software serves as great tool for software developers to search source files as it helps in finding tiny details within source files that the default Windows search cannot find/filter. This utility also shows context of the text where the given text in each of the file, including its line number.
Quick Links:
Download Astrogrep
Screenshots
Features List

Note: You need to have .NET framework 1.1 or higher for using Astrogrep.

Read more...

Fixing `SOCKET' does not name a type error - MySQL library in MinGW / VC++ compilers

Sunday, August 09, 2009

Trying to use the recent versions of MySQL library header may give you this error as:

`SOCKET' does not name a type

To fix this error, just include winsock.h before including mysql.h header as shown below:


#include <winsock.h>
#include <mysql.h>


Otherwise, you can add the following lines to mysql_com.h


#ifndef my_socket_defined
#if defined(__WIN32__) && !defined(__WIN__)
#define my_socket SOCKET
#else
typedef int my_socket;
#endif /* __WIN__ */
#endif /* my_socket_defined */


This error is known to occur in VC++ and MinGW(Code::Blocks /Dev C++) compilers on Windows (Win32) platform.

Read more...

Orkut Community Manager - Greasemonkey userscript

Monday, July 06, 2009

There is a new way to fight spam on orkut forums for all community owners and moderators. The new Orkut Community Manager helps you kick out spammers from every your community you own or moderate at once. The script makes your life easier by providing options to ban, boot or delete all spam messages across all your communities with just a click!

The settings page lists out all of your existing communities, from which you can select the communities you want the script to manage/operate on as shown in the below screenshot:


Mass Moderation Settings


The script runs on the community-topics page, member-manage page, and spam-topics folder page providing you with many moderation options as shown in the below screenshot:



Member Manage Page:





This new script is a major upgrade to my previous Mass Moderation Script. This new version of script adds mass-spam reporting feature, and a much more usable settings page for managing your communities. If you had liked my previous script, I'm sure you will like this even more!

To use this script, you need Firefox browser with Greasemonkey addon.

To install the script, just click on the below link:

Install Mass Moderation Script



You can send me your feedback on this script in the script's discussion page or just leave me a comment here.

Read more...

jQuery: Finding/Traversing Child and Descendant Elements

Wednesday, June 24, 2009

To traverse or select child/descendant elements in jQuery, we can use Hierarchical parent>child expression, children() function or the find() function (Perhaps there are more, but these are what I have been using). The difference among children and find functions is that children() only selects the immediate children from the given element, while find() function selects all the descendant elements within the given element.

Example:
Suppose we have we have the following in the document:


<div id="main">
<div id="sub1">
<input id="input1" type="text">
<input id="input2'" type="text">
</div>

<div id="sub2">
<input id="input3" type="text">
<input id="input4'" type="text">
</div>

<div id="sub3">
<input id="input5" type="text">
<input id="input6'" type="text">
</div>
</div>

Using Children() Function:


To select all the children div elements within the 'main' , we can simply write:

$('#main').children('div')
.css("background", "red");

This will select 'sub1', 'sub2' and sub'3'.

Using Hierarchical Parent > Child Expression:


We can select all the children div elements within the 'main' selection using hierarchical expression as below:

$('#main > div')
.css("background", "red");


Using Find Function:


We can also use find function select all the children div elements by writing as below:
    $('#main').find("div")
.css("background", "red");
But you should note that find() function will find every child in the hierarchy of the parent (that is including all its grand children, and grand-grand children!). So if there are some other div elements within 'sub1', 'sub2' or 'sub3', even those elements will be selected. So be careful, and use them according to what you need.

Read more...

.NET Framework 2.0 Configuration Tool Installer - Download

Thursday, March 26, 2009

The .NET Framework 2.0 doesn't come with Configuration Tool (unless you install the SDK). But there is a simple way around to get configuration tool in your Control Panel - Administrative Tools. Just download the Configuration Tool Installer/Setup(MSI) and install the configuration tool, or follow the instructions in Aaron Stebner's blog to manually add the configuration tool.

Download .NET Framework configuration tool installer(MSI)

After you install this, you can go to Control Panel and find the configuration tool in the Adminstrative Tools. This setup also works for .NET Framework 3.0. So now there is no need to install the bulky SDK just to get configuration settings wizard for your Framework.

Read more...

Back to TOP