Friday, December 10, 2010

How to not get combobox SelectedIndexChanged be executed on load

we use combobox in our coding at the form on requirements. And its usual to call the all of the events of combobox and the time of formloading. But many of the time, we are nor interested to call those events at the time of form loading. We have tried to do so for one of my need. I have done so by a different way.

When a form arrise to the user. behind the scene, two things happen.

1. Initialize the object of the form.1
2. Constructor is called for performing all others needs.

All the events are declared at the first step of the above in the time of initialization. We can bind the data source for the combo box at the constructor calling in the 2nd step of the above.

So, when a datasource is linked to the combobox, for addaing each single value or data, each time the combo box call its event for that purpose in need. It tooks execution time.

We can exclude this only by following a simple technique. i.e


Try setting your event SelectedIndexChanged handler after setting the data source. Make sure you remove the SelectedIndexChanged event handler set by the windows form designer from your form's constructor.

This is what your code should look like:

myComboBox.DataSource = dataSource;
myComboBox.DisplayMember = "displayMember";
myComboBox.ValueMember = "valueMember";
this.myComboBox.SelectedIndexChanged += new System.EventHandler(this.myComboBox_SelectedIndexChanged);

Assuming
private void myComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
.......................
}
already exists.

Saturday, November 27, 2010

Basic of Crytal Report Creation

You can familiarize yourself with Crystal Reports for Blackbaud by designing a simple report that lists the number of students in each grade level.
First, use Query to group all records with the status Current Student.

1. Select to create a new dynamic, student query. Click OK.
2. Select the filter criteria Status Equals Current Student.
3. Mark the Sort option and highlight Grade Level Now. Click Sort. Sort by Table Order.
4. Highlight Student Name and click Sort. Sort in ascending order.
5. You can select any fields for output, because they are used only for visual verification of your results. Select the minimum number of fields necessary.
6. Select File, Run Query from the menu bar.
7. Save and name the query. Mark Other Users May Execute this Query to allow other users to run but not change your query. They can modify copies of the query only by selecting File, Save As from the menu bar. To protect the original query, unmark Other Users May Modify this Query.

In Export, extract, or copy, certain information from the group of Current Student records to a data file Crystal Reports can read.

1. Select to create a new student export.
2. Choose Selected Records and select the query you just created. Do not mark Load Query Output Fields. (Remember, they are simply used to verify your query results. In this module you select the fields for your report.)
3. Highlight Student Name and Grade Level Now (Short Grade Level) and click Add Field. You can extract fields in any order, though they may be easier to use in Crystal Reports if you choose a practical sequence.
4. Select File, Export from the menu bar. On the Export Format screen, select MS Access Report Writer Database. Mark Print Control Report. Click OK.
5. On the Enter Export File Name screen, enter a file name that does not exceed eight characters plus the three-character extension. Click OK.
6. After processing is complete, print the Custom Export Control Report, which documents the data file’s name and path.

In Crystal Reports, you manipulate your exported data to create a report.

1. Click New Report. Click Custom on the Report Gallery screen.
2. Click Data File. Select the MDB file you just exported.
3. Select Insert, Group from the menu bar. Group by Grade Level Now in ascending order. Click OK. Your final report’s results will appear in grade level order.
4. Select Insert, Database Field from the menu bar. On the Insert Fields screen, place Grade Level Now in the Details section in one of three ways:
* Click on the field name and drag it to the Details section.
* Double-click on the field name and place it in the Details section.
* Highlight the field name, click Insert, and place the field in the Details section.
5. To calculate the number of students in each grade level, select Insert, Summary from the menu bar. On the Common tab, select Count. Click OK. When you print the report, the records appear sorted and grouped by Student Grade Level Now. The number of students in each grade level also prints.
6. Right-click on the gray part of the Details section. Select Suppress (No Drill-Down) from the menu.
7. Select File, Print Preview from the menu bar.

Tips for Using Totals and Counts in Crystal Reports

Having trouble totaling reports in Crystal Reports? These tips should help.

1. To create a subtotal of an amount field, right-click on the field in the detail line and select Insert Subtotal. Select on what to base the subtotal and click OK.

2. To create a grand total of amounts, right-click on the field you want to total and select Insert Grand Total.

3. To underline the totals, right-click on the field and select Format Field. Select Borders. Select single line on top and double line on bottom.

4. To get a total count of records listed on the report, right-click on the field that is not an amount and select Insert Grand Total. Select Count to have the program count each line and give you the total number of records.

5. To get a total count of individual records (such as vendors with multiple invoices), right-click on the Name field, select Insert Grand Total and Distinct Count. This counts items that are the same only once. For example, if ABC Company were listed three times on the list, the program would count it as only one record.
Changing Report Field Properties in Crystal Reports

Have you ever wanted to add or sort on a text field that is a number? The ToNumber function in Crystal Reports can convert a non-numeric field, specifically a text field, into a numeric field when you need to perform arithmetic on the field or sort the field in numeric order. For example, you export Constituent ID for sorting or grouping in a report, but discover that because it is an alphanumeric field, it sorts in alphanumeric order instead of numeric order. To sort or group by this field numerically, convert the field using the ToNumber function.

For the ToNumber function to work properly, the field you want to convert must be populated with numbers only. When using this function, you should first test the value with the NumericText function. If NumericText returns the value TRUE, then you can convert it to a number. If you try to convert a value to a number that is not numeric, the formula produces an error in the report.

The following example uses both functions: If the text string, Constituent ID, can be converted to a number, then convert it to a number else, use zero as the value.

If NumericText ({Constituent.ConstituentID}) Then ToNumber ({Constituent.ConstituentID}) Else 0

With this formula, the Constituent ID field is converted from a text string to a number and may now be used for sorting or grouping in numeric order.

This function might also be used for an Attribute Description or Comment field. The formula would be if the text field, Attribute, can be converted correctly from a text string to a number, then convert it to a number otherwise, use zero as the value.

If NumericText ({Attribute}) Then ToNumber ({Attribute}) Else 0

The field Attribute, originally a text field that contained only numbers, is now considered by Crystal Reports to be a numeric field and may be subtotaled or used in other arithmetic functions.

The combination of the NumericText and ToNumber functions allows you to easily convert report fields. These formulas can be used for any text field providing the values are solely numeric.

Source: Blackbaud

Friday, October 8, 2010

Configure Netbeans with Jdk at Ubuntu

recently I have tried to use the netbeans for programming Java at my ubuntu platform. For this purpose I hacve to wandering many paths. I spent a little more times for that purpose. At the end I came to undersatnd if I wolud followed the following steps one after another I complete to satrt quickly

1.Install JDK atfirst
Downlaod JDK for ubuntu(.bin formated) from the following link

Download JDK

To install it, at first keep the downloaded file at the desired location of you.
Opening the Terminal, go to that location using the command
(i.e for keeping the file in desktop)

cd ~/Desktop

After that,Run the script:

sh jdk-6-linux-i586.bin

By following those steps you have completed the jdk installation successfully.

2.Netbeans Intallation
Download the OS independent Zip from the following link

Download Netbeans OS Independent Version

I like to use OS independent version as it can be used in all platforms. So,
just download One and use it everywhere.

After Downloading the Zip folder, you need to unzip it. And actually Unzipping
the folder is the installation of the Netbeans.

3.Run Netbeans
Our target is to run the netbeans in ubuntu. So we have to use the terminal for
running it. Opening the terminal, we have to write the command
location/netbeans/bin/netbeans

We may face a error to switch the Java location for running netbeans. As we
have not kept the jdk at the default location of netbeans.

So we need to switch the location through wrtting the location at the end of previous command as

location/netbeans/bin/netbeans --jdkhome /location/jdk1.6.0_21


For my case, the command line was
/media/Campus/JavaEE/netbeans/bin/netbeans --jdkhome /home/paul/jdk1.6.0_21

Its a hazard to write the command everytime I want to run the netbeans. For removing this problem, I made an Launcher with the commandline at my desktop. And this helps me to start the netbeans easily.

Tuesday, September 14, 2010

Multibooting Option: GRUB BootLoader

GRUB stands for GRand Unified Boot loader.


GRUB Boot loader is an important part for multi booting PC that eans when more than one option is available for booting a PC. Now-a-days, most of the computer users keep at least two operating system for their PC. It helps a lot to them. When any one try to black mail the user, user don't be worry about that as there is an another option for him to complete his task at that moment.
i.e I use Ubuntu for using Internet and for developing windows based software I use Xp. If both the option can not be displayed at the start up of the pc, we have to need two PC for two different requirements.
GRUB Boot-loader is one of this solution provider. we can use the GRUB boot-loader according to our needs. But we have to be more cautions when we will try to work with GRUB Boot loader.GRUB is an excellent and highly flexible boot loader. It's designed to boot a wide range of operating systems from a wide range of file systems.GRUB is now pretty much the standard used in the very many variations of Linux available today.
Before doing any work on GRUB, we need to back up a copy of that file which will help us for any problem in future. Recently, I have tried to change some option in my GRUB file. And then I accessed many website for getting some help. And some website helps me a lot. These are as
Website 1
Website 2
Website 3

Remember, before doing any work with GRUB, you must know the version of your GRUB and then follow according to that. And then take a backup of that GRUB file before any modification. Lets try and enjoy..

Monday, September 13, 2010

Tips on Database Design

1.Develop A Prototype
Significant time can be saved by creating the structure in a simple desktop database (such as Microsoft Access) before finalising the design in one of the enterprise databases. The developer will be able to recognise simple faults and makes changes more rapidly than would be possible at a later date.

2.Split database structure into multiple tables
Unlike paper-based structures, databases do not require the storage of all fields in a single table. For large databases it is useful to split essential information into multiple tables. Before creating a database, ensure that the data has been normalised to avoid duplication.

3.Use understandable field names
The developer should avoid field names that are not instantly recognisable. Acronyms or internal references will confuse users and future developers who are not completely familiar with the database.

4.Avoid illegal file names
It is considered good practice to avoid exotic characters in file or field names. Exotic characters would include ampersands, percentages, asterisks, brackets and quotation marks. You should also avoid spaces in field and table names.

5.Ensure Consistency
Remain consistent with data entry. If including title (Mr, Miss, etc.) include it for all records. Similarly, if you have established that house number and address belong in different fields, always split them.


6.Avoid blank fields
Blank fields can cause problems when interpreting the data at a later date. Does it mean that you have no information, or you have forgotten to enter the information? If information is unavailable it is better to provide a standard response (e.g. unknown).

7.Use standard descriptors for date and time
Date and time can be easily confused when exporting database fields in a text file. A date that reads ‘12/04/2003’ can have two meanings, referring to April 12th or December 4th, 2003. To avoid ambiguity always enter and store dates with a four-digit century and times of day using the 24 hour clock. The ISO format (yyyy-mm-dd) is useful for absolute clarity, particularly when mixing databases at a later date.

8.Use currency fields if appropriate
Currency data types are designed for modern decimal currencies and can cause problems when handling old style currency systems, such as Britain’s currency system prior to 1971 that divided currency into pounds, shillings and pence.

9.Avoid proprietary extensions
Care should be taken when using proprietary extensions, as their use will tie your database to a particular software package. Examples of proprietary extensions include the user interface and application-specific commands.

10.Avoid the use of field dividers
Commas, quotation marks and semi-colons are all used as methods of separating fields when databases are exported to a plain text file and subsequently re-imported into another database. When entering data into a database you should choose an alternative character that represents these characters.


Collected From:Website

Friday, August 20, 2010

little bit on Windows Forms

In .Net, the most important namespace is System.Windows.Forms. this namespace can be grouped into the following broad categories:

Core infrastructure:
represent the core operations of a Windows Forms program and activeX control.

Controls:Button, MenuStrip, ProgressBar,
DataGridView, etc. are related to control. its is used to create rich user interface.

Components:are not visible at runtime, but can be configured visually at design time, i.e timer, backgroundworker.

Common dialog boxes:provides a number of canned dialog boxes for common operations

To set the default input button of a form we need to use AcceptButton. Suppose, to set the button btnPaul as teh default buttorn for the form(Enter invokes this button directly), we need to write the following code

this.AcceptButton = btnPaul;

Wednesday, June 30, 2010

To send sms through http port

We can send sms through a dedicatd http port to mobile no. To implement that, we need a very small code in c#.net. And we can use that code on the basis of the requirement of the server.
----------------------
String httpAddress = "http://192.164.4.224:8237/cpSubscriptionService/Default.aspx?key=ppl_450w98";
String mobileNo = txtMobile.Text;
String sentMessage = txtMessage.Text;
String out_Msg_Id = txtOutMsg_id.Text;
String sendRequest = httpAddress+ "&mobileNo="+mobileNo+"&body="+sentMessage+"&msg_type=4&send_port=003225&in_Msg_Id=1&out_Msg_Id="+out_Msg_Id;

HttpWebRequest loHttp = (HttpWebRequest)WebRequest.Create(sendRequest);

//loHttp.Timeout = 10000;
loHttp.Method = "GET";

HttpWebResponse loWebResponse = (HttpWebResponse)loHttp.GetResponse();

Encoding enc = Encoding.GetEncoding(1252); // Windows default Code Page
StreamReader loResponseStream = new StreamReader(loWebResponse.GetResponseStream(), enc);

string lcHtml = loResponseStream.ReadToEnd();
txtResponse.Text = lcHtml;

loWebResponse.Close();
loResponseStream.Close();
---------------------------------

For that purpose, we have just used the http port for the example purpose. Here three text box has been used just to take the no., text and the feedback field. Here in the program these fields have been used.

Sunday, June 27, 2010

unable to connect to asp.net development server

Recently, I have started to make deal with ASP.net to learn that. And I firstly installed the Visual Studio 2008 and wrote the code. But when I start to debugging, I was helpless, as I am not a man with a lot of concentration. And most of the cases at past, I stopped programming when a error arouse me. But at this time I have started to face the problem, as its my target.
But this session isn't different from the before. When I start to debug my first program, I find the message "unable to connect to asp.net development server". As its my challenge, I use the internet and solve he problem. You can solve it following the steps

first download the file from following link
http://www.esnips.com/doc/9ef73cba-6d6a-4e76-a42d-83b58024300e/WebDev.WebServer
extract the file ..
u will get an exe named WebDev.WebServer.exe
simply right click and copy it..
now..
goto your drive containing windows...
by deault this is c drive..
so open
the following path...
C:\Program Files\Common Files\microsoft shared\DevServer\9.0
you will find already a file named WebDev.WebServer.exe..
so what you have to do is simply replace this file...
by right click and paste...
and click yes on the message that you want to replace the file..
yes its done ...

N.B:

Wednesday, January 20, 2010

Image Gallery by CSS

<html>
<head>
<style type="text/css">
div.img
{
margin:2px;
border:1px solid #0000ff;
height:auto;
width:auto;
float:left;
text-align:center;
}
div.img img
{
display:inline;
margin:3px;
border:1px solid #ffffff;
}
div.img a:hover img
{
border:1px solid #0000ff;
}
div.desc
{
text-align:center;
font-weight:normal;
width:120px;
margin:2px;
}
</style>
</head>
<body>

<div class="img">
<a target="_blank" href="klematis_big.htm">
<img src="klematis_small.jpg" alt="Klematis" width="110" height="90" />
</a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="klematis2_big.htm">
<img src="klematis2_small.jpg" alt="Klematis" width="110" height="90" />
</a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="klematis3_big.htm">
<img src="klematis3_small.jpg" alt="Klematis" width="110" height="90" />
</a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="klematis4_big.htm">
<img src="klematis4_small.jpg" alt="Klematis" width="110" height="90" />
</a>
<div class="desc">Add a description of the image here</div>
</div>

</body>
</html>

Readymade CSS

body {
margin: 0px;
padding: 0px;
background-color: ;
background-image: url(../../images/background_yellow.png);
}

div#header {
position: absolute;
width: 100%;
left: 0px;
height: 75px;
top: -4px;
}

div#banner {
background-color: #FFFFCC;
background-repeat: repeat-x;
height: 50px;
}

img#titletext {
top: 40px;
position: absolute;
left: 300px;
}

div#nav{
color : #105BAC;
background-color : #FFFFFF;
height : 15px;
font-size: 80%;
border-top : none;
margin-left: 0px;
border-bottom-style: none;
}

div#nav ul {
list-style-type: none;
margin-top: 0px;
margin-bottom: 0px;
margin-left: 56px;
margin-right: 0px;
padding: 2px 0 0 0;
}
div#nav ul li {
display: inline;
}
div#content {
position: absolute;
left: 225px;
top: 128px;
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 91%;
color: #000000;
line-height: 140%;
width: 707px;
height: 532px;
}
div#sidebar {
position: absolute;
top: 129px;
right: 20px;
width: 180px;
font-size : 70%;
left: 15px;
}
div#content h1 {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 146%;
color: #990000;
font-weight: normal;
}
div#content h2 {
font-family: Georgia, "Times New Roman", Times, serif;
color: #105BAC;
font-weight: normal;
font-size: 120%;
}
div#sidebar div.feature {
font-family: Georgia, "Times New Roman", Times, serif;
color : #666666;
background-color : #fefefe;
border : 1px solid #990000;
margin-bottom : 11px;
padding : 10px;
line-height : 140%;

Sunday, January 3, 2010

5 habits of Productive, Happy Software Developer

1. Be Marketable-Keep Up To Date Skills and Network Contacts
2.Be the Master of Your Domain
3.Accommodate Your Financial Needs
4.Have a life Outside of Work
5.Properly Manage Expectations

Software Engineering is the combination of Common sense and Discipline.