Thursday, July 28, 2011

BlogEngine.NET open source projects for .NET, great learning source for developers

There are few open source projects available which help to learn more in creating blogs, portals,
intranet site and e - commerce also.
some of them are :



Source Code: Grab the source code here
Project Description
BlogEngine.NET may be the simplest and most light weight ASP.NET blog at the moment,
but still full featured. Here are some of the features:

- Multi-author support
- Pingbacks and trackbacks
- Event based for plug-in writers
- Theming directly in master pages and user controls
- Gravatar and coComments implemented
- Live preview on commenting
- Comment moderation
- BlogML import/export
- Extension model
- Code syntax highlighting
- Mono support
- Full editing and creation of pages that are not posts
- Extended search capabilities
- Tag cloud
- Self updating blogroll
- Runs entirely on XML or SQL Server. Your choice.


YAF is a Open Source discussion forum or bulletin board system for web sites running
ASP.NET. The latest production version runs on ASP.NET v2.0 with a Microsoft SQL
Server backend.

Source Code: Grab the source code here


DotNetNuke is an open source web application framework ideal for creating, deploying and
managing interactive web, intranet, and extranet sites securely.

Source Code: Grab the source code here



Source Code: Grab the source code here



Running on C# nopCommerce is a fully customizable shopping cart. It's stable and highly
usable. nopCommerce is a open source e-commerce solution that is ASP.NET 3.5 based
with a MS SQL 2005 backend database.

Source Code: Grab the source code here



Tuesday, July 26, 2011

progress Bar in swing

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

class SplashScreen extends JWindow
private static JProgressBar progressBar = new JProgressBar();
private static SplashScreen execute;
private static int count;
private static Timer timer1;
public SplashScreen()

JPanel panel = new JPanel();
panel.setBorder(new javax.swing.border.EtchedBorder());

JLabel label = new JLabel("Hello World!");
label.setFont(new Font("Verdana",Font.BOLD,14));

progressBar.setBounds(55, 180, 250, 15);

public void loadProgressBar()
ActionListener al = new ActionListener()
public void actionPerformed(java.awt.event.ActionEvent evt)
if (count == 51){

//load the rest of your application

timer1 = new Timer(300, al);

public static void main (String args[]){
execute = new SplashScreen();

Wednesday, July 20, 2011

Importance of Enumerations

Enumerations are simple value types that allow developers to choose from a list of constants.

Behind the scenes, an enumeration is just an ordinary integral number where every value has

a special meaning as a constant. However, because you refer to enumeration values using their

names, you don’t need to worry about forgetting a hard-coded number, or using an invalid


To define an enumeration, you use the block structure shown here:

public enum FavoriteColors







This example creates an enumeration named FavoriteColors with three possible values:

Red, Blue, and Yellow.

Once you’ve defined an enumeration, you can assign and manipulate enumeration values

like any other variable. When you assign a value to an enumeration, you use one of the predefined

named constants. Here’s how it works:

// You create an enumeration like an ordinary variable.

FavoriteColors buttonColor;

// You assign and inspect enumerations using a property-like syntax.

buttonColor = FavoriteColors.Red;

In some cases, you need to combine more than one value from an enumeration at once.

To allow this, you need to decorate your enumeration with the Flags attribute, as shown here:


public enum AccessRights


Read = 0x01,

Write = 0x02,

Shared = 0x04,


This allows code like this, which combines values using a bitwise or operator:

AccessRights rights = AccessRights.Read | AccessRights.Write | AccessRights.Shared;
You can test to see if a single value is present using bitwise arithmetic with the & operator

to filter out what you’re interested in:

if ((rights & AccessRights.Write) == AccessRights.Write)


// Write is one of the values.


Enumerations are particularly important in user-interface programming, which often has

specific constants and other information you need to use but shouldn’t hard-code. For example,

when you set the color, alignment, or border style of a button, you use a value from the appropriate



The Roles of Classes in Object-oriented programming

It’s important to remember that although all classes are created in more or less the same way

in your code, they can serve different logical roles. Here are the three most common examples:

Classes can model real-world entities. For example, many introductory books teach

object-oriented programming using a Customer object or an Invoice object. These

objects allow you to manipulate data, and they directly correspond to an actual thing in

the real world.

Classes can serve as useful programming abstractions. For example, you might use a

Rectangle class to store width and height information, a FileBuffer class to represent a

segment of binary information from a file, or a WinMessage class to hold information

about a Windows message. These classes don’t need to correspond to tangible objects;

they are just a useful way to shuffle around related bits of information and functionality

in your code. Arguably, this is the most common type of class.

Classes can collect related functions. Some classes are just a collection of static methods

that you can use without needing to create an object instance. These helper classes are the

equivalent of a library of related functions, and might have names like GraphicsManipulator

or FileManagement. In some cases, a helper class is just a sloppy way to organize code

and represents a problem that should really be broken down into related objects. In

other cases, it’s a useful way to create a repository of simple routines that can be used in

a variety of ways.

Understanding the different roles of classes is crucial to being able to master object-oriented

development. When you create a class, you should decide how it fits into your grand development

plan, and make sure that you aren’t giving it more than one type of role. The more vague a

class is, the more it resembles a traditional block of code from a non-object-oriented program.


check directory Exists in Ftp Server


public bool FtpDirectoryExists(string directoryPath, string ftpUser, string ftpPassword)


            bool IsExists = true;



                FtpWebRequest request = (FtpWebRequest)WebRequest.Create(directoryPath);

                request.Credentials = new NetworkCredential(ftpUser, ftpPassword);

                request.Method = WebRequestMethods.Ftp.PrintWorkingDirectory;


                FtpWebResponse response = (FtpWebResponse)request.GetResponse();


            catch (WebException ex)


                IsExists = false;


            return IsExists;



I have called this method as:
bool result = FtpActions.Default.FtpDirectoryExists( "",
                                                    txtUsername.Text, txtPassword.Text);

Sunday, July 17, 2011

check string exists in the enum and convert string to an Enum

/// <summary>

/// File Type Enum - The extensions that our application

/// support to work.. check at the time of work with the

/// file.. e.g. read the file and save to database etc.

/// </summary>


enum FileTypes


     BMP ,

     JPG ,






string fileExtension = Path.GetExtension(filePath).ToUpper();


//check string exists in the enum.. it will match the case also..

if (Enum.IsDefined(typeof(FileTypes),fileExtension.Trim('.')))


    //convert string to enum

    FileTypes  c = (FileTypes) Enum.Parse(typeof(FileTypes), "MOV", true);



Note: Enum.IsDefined() doesn't offer the ignoreCase parameter. If you don't

know whether the casing is right, it seems the only way to do the conversion is using

the Parse method and catching the ArgumentException.

Saturday, July 9, 2011

Get textbox server control value using jquery in

Retrieve the server control id in the java script (jQuery code) and do as usual
jQuery code for getting the value at the ASPx page.

<html xmlns="">
<head runat="server">
    <script src="scripts/jquery-1.6.1.min.js" type="text/javascript"></script>
    <script type = "text/javascript">
        $(document).ready(function () {

            $("#<%= btnSend.ClientID %>").click(function () {
                alert($("#<%= txtInfo.ClientID %>").val());
                return true;
    <form id="form1" runat="server">
    <div style=" margin : 0px auto">
        <asp:TextBox ID="txtInfo" runat="server"></asp:TextBox>
asp:Button ID="btnSend"  runat="server" Text="Send" />