Feeds:
Posts
Comments

Archive for the ‘DotNet 3.0’ Category

I am working on windows application after long time, after completing application when I decided to create a setup file in Visual Studio 2012 and found that there is no Setup and Deployment project as it was in Visual Studio 2008. I search for sometime and InstallShield which allows user to create Setup project. Let me share how to create a simple Setup or MSI package for your application.

Step 1: Download and Install InstallShield Express edition from here.

Step 2: Open visual Studio and select File New Project. From new project dialog select Other Project Types – Setup & Deployment and you can see InstallShield project as shown below.

InstallShield-Sample-1

Fig –1 Create Setup Project

 

Once you press OK button, it will create a project and open a screen as shown in below image. As you can see InstallShield provide 6 simple steps to create Setup file.

InstallShield-Tutorial-2

Fig –2 InstallShield home screen

 

Step 3: Application Information – This step allows you to provide detail about your company, application and current version of application. You can version number as MajaorVersion.MinorVersion.BuildNumber . For simplicity I have used Sample detail in all fields.

InstallShield-Tutorial-3

Fig –3 InstallShield – Application information

 

Step 4: Application requirement – This step allows you to OS and necessary prerequisites to be installed on client machine to run your application. You can select all version of windows by choosing “No” or select appropriate version of windows by choosing “Yes”. Select version of .NET framework require on client machine to run your application. Make sure you choose all necessary options, this is important as if you miss any, your application will not work on client machine.

InstallShield-Tutorial-4

Fig –4 InstallShield – Installation Requirements

 

Step 5: Installation Architecture – This step allows you to choose features you want to include in this setup. As this is limited/express edition you can not choose features, everything will be installed. For example, if you have develop two new modules in this version however you just want to release only one module, you can select that module here.

InstallShield-Tutorial-5

Fig –5 InstallShield – Installation Architecture

 

Step 6: Application Files – Here you have to select files/folders which is required to run your application. If you are not sure which configuration files and exe are required, the easiest way is to select all files from BIN folder. If you have XML configuration files in different folder you can select Add folder option to add them.

InstallShield-Tutorial-6

Fig –6 : InstallShield – Application Files

 

Step 7 Application Shortcut – Decide where do you want to add shortcut of your application. Select icon for shortcuts by selecting .ico file. This icon will appear as shortcut at selected path.

InstallShield-Tutorial-7

Fig –7 InstallShield – Application Shortcuts

 

Step 8: Application Registry – If your application is reading specific value from registry than it must be available in client machine’s registry. Here is you can add these values in registry. For example, if you want that your Application will run for 15 days only, than add a key in registry which store installation date and every time your application compares system date with registry entry to check number of days. This is not most secure way or desirable way to make sure your application run for 15 days only however I am just giving an example. Please do not mess with registry if you are not sure how to use it.

InstallShield-Tutorial-8

Fig –8 InstallShield – Application Registry

 

Step 9: Installation Interview – The first option says “Do you want to display a license agreement dialog?”. If you have your terms and condition and agreement defined than create .rtf file and select that file using browse button. Choose “No” and agreement dialog will not be displayed to client. Other options listed on screen is very simple to understand so select appropriate option in that.

InstallShield-Tutorial-9

Fig –9 InstallShield – Application Interview

 

This was the last step and now you are ready to generate your Setup/MSI package. Right click on project name from solution explorer and click on Rebuild option. This will generate Setup/MSI in “<your solution file path>\Express\DVD-5\DiskImages\DISK1” folder.  \Express\ can be different depending on InstallShield version you have installed.  Here is the Setup file generated by our steps.

InstallShield-Tutorial-10

 

Fig –10 InstallShield – Generated Setup files

 

Let me know if you have any questions.

Happy Programming !!!

Read Full Post »

After installing Windows 8 today, I started receiving error “The best overloaded method match for ‘System.Web.UI.HtmlControls.HtmlTableRowCollection.Add(System.Web.UI.HtmlControls.HtmlTableRow)’ has some invalid arguments” in my existing project. The project was working fine in VS 2010 till yesterday and it was still compiling and running fine in my colleagues PC.

After spending time on internet and surfing various sites I came to know that it is .NET Framework 4.5 which causes the issue. Once you install .NET Framework 4.5 in your PC and your website is pointing to .NET Framework 4.0 you will still receive the same error.

I was using html <table> with <tbody> tag and runat=”server” as shown in code below.

 

<table id="Table1" runat="server" >
        <tbody>
            <tr>
                <td align="left">
                <td />
            <tr />
        </tbody>
  </table>

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

The solution was simple. Just remove <tbody></tbody> tag and code will compile.

For more detail please check http://stackoverflow.com/questions/12500332/html-table-tag-with-col-colgroup-tbody-and-thead-throws-compile-error-in-visu

Happy Programming !!!

Read Full Post »

     Today I read another god article about JQuery selector tutorial. Here is a link for that. Two great articles about JQuery in one day, amazing !!!

Happy Programming  !!!

Chirag Darji
ASP.NET Consultant & Trainer

Read Full Post »

           Today while reading about JQuery I came across really helpful and well narrated article about JQuery Selector, JQuery Event Binding and use this key word in JQuery by Elijah Manor. You can read it here.

 

Happy programming !!!

Chirag Darji
ASP.NET Consultant

Read Full Post »

       While analyzing Payroll management system, I came across an interesting question that how can we find second and fourth Saturday of every month. As in India we still do not have five days a week in most of organization, bad humm……:( . Most of organizations offer only second and fourth Saturday off. Below is the code to find particular day of week and its occurrence in given month and year,

 

/// <summary>
/// Returns date for specific week day and its occurrence in month.
/// </summary>
/// <param name="DesiredDay">Perticular day of week, System.DayOfWeek</param>
/// <param name="Occurrence">Its occurrence, System.Int32</param>
/// <param name="Month">Month, System.Int32</param>
/// <param name="Year">Year, System.Int32</param>
/// <returns></returns>
private int GetDateForWeekDay(DayOfWeek DesiredDay, int Occurrence,int Month,int Year)
{
    
    DateTime dtSat = new DateTime(Year, Month , 1);
    int j = 0;
    if (Convert.ToInt32(DesiredDay) - Convert.ToInt32(dtSat.DayOfWeek) >= 0)
        j = Convert.ToInt32(DesiredDay) - Convert.ToInt32(dtSat.DayOfWeek) + 1;
    else
        j = (7 - Convert.ToInt32(dtSat.DayOfWeek)) + (Convert.ToInt32(DesiredDay) + 1);
 
    return j + (Occurrence - 1) * 7;
 
    
}

Fig – (1) Code to find Second Saturday and Fourth Saturday of Month.

 

Happy Programming !!!!

Chirag Darji

ASP.NET Consultant & Trainer

Read Full Post »

        Last week I installed Microsoft Dynamic 4.0 on my virtual machine and I found that it will be helpful for beginner like me, if there is a step by step installation guide. Lets start with OS selection.

1. You can use Windows Server 2003 or later server version. I had Windows Server 2003 R2.

2. Install latest service pack for OS you installed.

3. Install Internet Information Service.

4. Install Active Directory.

5. Configure DNS Server.

6. Create new user for domain and make him member of Administrators group.

7. Install SQL Server 2005 with Reporting Service and Analysis service.

8. Configure new account as service account for Report Server and Analysis server.

9. Install Visual Studio 2008.

10. Start installation of CRM 4.0

11. Enter display name for your Organization.

clip_image002

12. Next step is to select installation path, you can leave this as it is or select specific folder,

clip_image004

13. Next select website for CRM, I choose new website with different port address in my case it was 5555 as shown in image below,

clip_image006

14. Next you need to enter URL for Reporting server.

15. Next you have to select Organization Unit. Click on Browse button and select the root node of your domain in my case it is chirag.

clip_image008

16. On next step you need to specify security account, choose the one you created in step 6. Enter the password in password textbox and click next.

17. Select your local machine as Email Router setting or select specific machine on domain which you are using at email server. I chose my local machine so localhost.

18. Once you click next you will see System Requirements screen. If Domain user, SQL Server Reporting Service and ASP.NET are installed properly you will receive no error or warning else you will receive error message. I received following errors,

clip_image010

19. If you receive error message for SQL Server or SQL Server Reporting Service don’t be afraid. Open Services from Start – All Programs – Administrative Tools – Services. Check whether SQL Server Agent is running. If not right click on service and select property. Select Startup Type as Automatic and click on start button.

20. Another common error is for Indexing service. Follow the steps mention in point 19 to start Indexing Service.

21. You can see a warning mentioning Verify Domain User account SPN for the Microsoft Dynamics CRM ASP.NET Application Pool account. This will usually shows when you add specific domain account for security account in step 16. You can solve this warning now or after installation by following steps mentioned at http://billoncrmtech.blogspot.com/2008/08/now-i-am-master-tips-for-running-crm-40.html

22. If System Requirements screen show no error or warning on next step installation will be started.

23. Finally you will see following screen, this means your CRM is installed.

clip_image012

 

Happy Programming !!!!

Chirag Darji

ASP.NET Consultant & Trainer

Read Full Post »

        In my recent project I need to identify all columns on which full text index is created. You can find that in management studio from Database – Storage – Full Text Catalogs and right click on catalog name and select property. It display all tables and columns as shown below,

Full Text Index

Fig – (1) All columns on which full-text index is created.

      An alternative is to use query to find all columns on which full-text index is created.

SELECT tbl.[Name] TableName,clm.[Name] ColumnName FROM
Sys.Tables tbl INNER JOIN Sys.Columns clm
ON tbl.[object_id] = clm.[object_id]
INNER JOIN sys.fulltext_index_columns fic
ON clm.[column_id] = fic.[column_id]
WHERE tbl.[Type] = ‘U’

Happy Programming !!!!

Chirag Darji

ASP.NET Consultant & Trainer

Read Full Post »

            While reading MSDN today I came across very interested topic. This is very use full specially in interview. Link shows maximum character allow in NVARCHAR(MAX), NTEXT, VARCHAR(MAX), Maximum cluster index per table, maximum columns per table, Maximum columns per Foreign Key, Maximum Columns in Group By and so on. Here is the link from MSDN OR you can read here copied from MSDN.

The following table specifies the maximum sizes and numbers of various objects defined in SQL Server databases or referenced in Transact-SQL statements.

SQL Server Database Engine object Maximum sizes/numbers SQL Server (32-bit) Maximum sizes/numbers SQL Server (64-bit)

Batch size1

65,536 * Network Packet Size

65,536 * Network Packet Size

Bytes per short string column

8,000

8,000

Bytes per GROUP BY, ORDER BY

8,060

8,060

Bytes per index key2

900

900

Bytes per foreign key

900

900

Bytes per primary key

900

900

Bytes per row8

8,060

8,060

Bytes in source text of a stored procedure

Lesser of batch size or 250 MB

Lesser of batch size or 250 MB

Bytes per varchar(max), varbinary(max), xml, text, or image column

2^31-1

2^31-1

Characters per ntext or nvarchar(max) column

2^30-1

2^30-1

Clustered indexes per table

1

1

Columns in GROUP BY, ORDER BY

Limited only by number of bytes

Limited only by number of bytes

Columns or expressions in a GROUP BY WITH CUBE or WITH ROLLUP statement

10

10

Columns per index key7

16

16

Columns per foreign key

16

16

Columns per primary key

16

16

Columns per nonwide table

1,024

1,024

Columns per wide table

30,000

30,000

Columns per SELECT statement

4,096

4,096

Columns per INSERT statement

4096

4096

Connections per client

Maximum value of configured connections

Maximum value of configured connections

Database size

524,272 terabytes

524,272 terabytes

Databases per instance of SQL Server

32,767

32,767

Filegroups per database

32,767

32,767

Files per database

32,767

32,767

File size (data)

16 terabytes

16 terabytes

File size (log)

2 terabytes

2 terabytes

Foreign key table references per table4

253

253

Identifier length (in characters)

128

128

Instances per computer

50 instances on a stand-alone server for all SQL Server editions except for Workgroup. Workgroup supports a maximum of 16 instances per computer.

SQL Server supports 25 instances on a failover cluster.

50 instances on a stand-alone server.

25 instances on a failover cluster.

Length of a string containing SQL statements (batch size)1

65,536 * Network packet size

65,536 * Network packet size

Locks per connection

Maximum locks per server

Maximum locks per server

Locks per instance of SQL Server5

Up to 2,147,483,647

Limited only by memory

Nested stored procedure levels6

32

32

Nested subqueries

32

32

Nested trigger levels

32

32

Nonclustered indexes per table

999

999

Number of distinct expressions in the GROUP BY clause when any of the following are present: CUBE, ROLLUP, GROUPING SETS, WITH CUBE, WITH ROLLUP

32

32

Number of grouping sets generated by operators in the GROUP BY clause

4,096

4,096

Parameters per stored procedure

2,100

2,100

Parameters per user-defined function

2,100

2,100

REFERENCES per table

253

253

Rows per table

Limited by available storage

Limited by available storage

Tables per database3

Limited by number of objects in a database

Limited by number of objects in a database

Partitions per partitioned table or index

1,000

1,000

Statistics on non-indexed columns

30,000

30,000

Tables per SELECT statement

Limited only by available resources

Limited only by available resources

Triggers per table3

Limited by number of objects in a database

Limited by number of objects in a database

Columns per UPDATE statement (Wide Tables)

4096

4096

User connections

32,767

32,767

XML indexes

249

249

1Network Packet Size is the size of the tabular data stream (TDS) packets used to communicate between applications and the relational Database Engine. The default packet size is 4 KB, and is controlled by the network packet size configuration option.

2The maximum number of bytes in any index key cannot exceed 900 in SQL Server. You can define a key using variable-length columns whose maximum sizes add up to more than 900, provided no row is ever inserted with more than 900 bytes of data in those columns. In SQL Server, you can include nonkey columns in a nonclustered index to avoid the maximum index key size of 900 bytes.

3Database objects include objects such as tables, views, stored procedures, user-defined functions, triggers, rules, defaults, and constraints. The sum of the number of all objects in a database cannot exceed 2,147,483,647.

4Although a table can contain an unlimited number of FOREIGN KEY constraints, the recommended maximum is 253. Depending on the hardware configuration hosting SQL Server, specifying additional FOREIGN KEY constraints may be expensive for the query optimizer to process.

5This value is for static lock allocation. Dynamic locks are limited only by memory.

6If a stored procedure accesses more than 8 databases, or more than 2 databases in interleaving, you will receive an error.

7If the table contains one or more XML indexes, the clustering key of the user table is limited to 15 columns because the XML column is added to the clustering key of the primary XML index. In SQL Server, you can include nonkey columns in a nonclustered index to avoid the limitation of a maximum of 16 key columns. For more information, see Index with Included Columns [ http://msdn.microsoft.com/en-us/library/ms190806.aspx ] .

8 SQL Server supports row-overflow storage which enables variable length columns to be pushed off-row. Only a 24-byte root is stored in the main record for variable length columns pushed out of row; because of this, the effective row limit is higher than in previous releases of SQL Server. For more information, see the "Row-Overflow Data Exceeding 8 KB" topic in SQL Server Books Online.

The following table specifies the maximum sizes and numbers of various objects defined in SQL Server Replication.

SQL Server Replication object Maximum sizes/numbers SQL Server (32-bit) Maximum sizes/numbers SQL Server (64-bit)

Articles (merge publication)

256

256

Articles (snapshot or transactional publication)

32,767

32,767

Columns in a table1 (merge publication)

246

246

Columns in a table2 (SQL Server snapshot or transactional publication)

1,000

1,000

Columns in a table2 (Oracle snapshot or transactional publication)

995

995

Bytes for a column used in a row filter (merge publication)

1,024

1,024

Bytes for a column used in a row filter (snapshot or transactional publication)

8,000

8,000

1If row tracking is used for conflict detection (the default), the base table can include a maximum of 1,024 columns, but columns must be filtered from the article so that a maximum of 246 columns is published. If column tracking is used, the base table can include a maximum of 246 columns. For more information on the tracking level, see the "Tracking Level" section of How Merge Replication Detects and Resolves Conflicts [ http://msdn.microsoft.com/en-us/library/ms151749.aspx ] .

2The base table can include the maximum number of columns allowable in the publication database (1,024 for SQL Server), but columns must be filtered from the article if they exceed the maximum specified for the publication type.

Happy Programming !!!

Chirag Darji

Read Full Post »

        Today while working with JQuery-Ajax, I found an interesting error. I have used $.ajax() function to retrieve data from remote page. While testing I found that the page always show error : XML Parsing Error: no element found. Error does not contain specific information about the source of error. The common reason for XML Parsing Error: no element found is missing closing tag for one or two html element, so I double checked everything to make sure not miss any closing(</td> </tr>) tags.

        After searching for while I found that somehow ASP.NET treat the response of page as XML document and that’s why we receive XML Parsing Error: no element found error.

        To solve this error I added a line Response.ContentType = "text/HTML" to .cs page. This line tells ASP.NET runtime that response is HTML text and not XML.

 

Happy Programming!!!

Read Full Post »

           We all may have use JQuery in our application to build rich UI. While working with JQuery today I found that JQuery is not working on some pages where I have user mootool scripts. I search on net and found a very descriptive solution at JQuery site.

           According to this article the reason for JQuery conflict is the use of $ function. mootool and prototype.js files have their own $ function. So when we use $() and try to access JQuery (as it is shorten form of jQuery()) browser is not able to resolve which $() function it has to use. To avoid JQuery conflict we have to use jQuery.noConflict() function.

           While you read JQuery site article you may have observe the order of java script files added to web page.  Read carefully and you find that you have to add other libraries first and then add JQuery library to page. If you change the order and add the JQuery library first, either mootool(or other library which you have included) or JQuery will not work.

 

Happy Programming !!!

Read Full Post »

Older Posts »