Thursday, July 28, 2011

Sample app or project for the MVC ?

Looking from a long time to get the opportunity to work in MVC framework and I know the basic what is MVC and how it works? How it differs from the traditional web forms, but not getting any project in my companies and lot of other issues are regularly facing which keep myself busy so the main point is that missing the right time and right opportunity to clean my MVC hands.

In those days I am big fan of http://stackoverflow.com so there I got lot of knowledge today any user similar to me in MVC knowledge asked “What will be the right way to start a project on MVC” and the answer is http://nerddinner.com/ (NerdDinner 2.0 Complete ASP.NET MVC Sample App) and source code is also available on codeplex (Project Hosting for Open Source Software) http://nerddinner.codeplex.com/ so the objective of my blogging share my knowledge to my readers. So this is the answer of sample app or project for the MVC ?

Wednesday, July 27, 2011

date formats

Date and Time Format Patterns






All

the

patterns:
0MM/dd/yyyy07/27/2011
1

dddd, dd MMMM yyyy
Wednesday, 27 July 2011
2dddd, dd

MMMM yyyy HH:mm
Wednesday, 27 July 2011 08:40
3dddd, dd

MMMM yyyy hh:mm tt
Wednesday, 27 July 2011 08:40

AM
4dddd, dd MMMM yyyy H:mmWednesday, 27 July 2011

8:40
5dddd, dd MMMM yyyy h:mm ttWednesday, 27 July 2011

8:40 AM
6dddd, dd MMMM yyyy HH:mm:ssWednesday, 27 July

2011 08:40:28
7MM/dd/yyyy HH:mm07/27/2011

08:40
8MM/dd/yyyy hh:mm tt07/27/2011 08:40

AM
9MM/dd/yyyy H:mm07/27/2011

8:40
10MM/dd/yyyy h:mm tt07/27/2011 8:40

AM
11MM/dd/yyyy HH:mm:ss07/27/2011

08:40:28
12MMMM ddJuly 27
13MMMM

dd
July

27
14yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK2011-07-27T0

8:40:28.2891564-04:00
15yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK2011-07-27T08:40:28.2891564-04:00
16ddd, dd MMM yyyy

HH':'mm':'ss 'GMT'
Wed, 27 Jul 2011 08:40:28 GMT
17ddd,

dd MMM yyyy HH':'mm':'ss 'GMT'
Wed, 27 Jul 2011 08:40:28

GMT
18yyyy'-'MM'-'dd'T'HH':'mm':'ss2011-07-27T08:40:28< /td>
19HH:mm08:40
20hh:mm

tt
08:40

AM
21H:mm8:40
22h:mm

tt
8:40

AM
23HH:mm:ss08:40:28
24yyyy'-'MM

'-'dd HH':'mm':'ss'Z'
2011-07-27 08:40:28Z
25dddd, dd

MMMM yyyy HH:mm:ss
Wednesday, 27 July 2011

08:40:28
26yyyy MMMM2011

July
27yyyy MMMM2011 July

The patterns for

DateTime.ToString ( 'd' )

:
0MM/dd/yyyy07/27/2011

The patterns for

DateTime.ToString ( 'D' ) :
0dddd, dd MMMM

yyyy
Wednesday, 27 July 2011

The patterns for

DateTime.ToString ( 'f' ) :
0dddd, dd MMMM yyyy

HH:mm
Wednesday, 27 July 2011 08:40
1dddd, dd MMMM yyyy

hh:mm tt
Wednesday, 27 July 2011 08:40 AM
2dddd, dd MMMM

yyyy H:mm
Wednesday, 27 July 2011 8:40
3dddd, dd MMMM

yyyy h:mm tt
Wednesday, 27 July 2011 8:40 AM

The patterns for

DateTime.ToString ( 'F' ) :
0dddd, dd MMMM yyyy

HH:mm:ss
Wednesday, 27 July 2011 08:40:28

The patterns for

DateTime.ToString ( 'g' ) :
0MM/dd/yyyy HH:mm07/27/2011

08:40
1MM/dd/yyyy hh:mm tt07/27/2011 08:40

AM
2MM/dd/yyyy H:mm07/27/2011

8:40
3MM/dd/yyyy h:mm tt07/27/2011 8:40

AM

The patterns for DateTime.ToString ( 'G' )

:
0MM/dd/yyyy HH:mm:ss07/27/2011

08:40:28

The patterns for DateTime.ToString ( 'm' )

:
0MMMM ddJuly 27

The patterns for

DateTime.ToString ( 'r' ) :
0ddd, dd MMM yyyy HH':'mm':'ss

'GMT'
Wed, 27 Jul 2011 08:40:28 GMT

The patterns for

DateTime.ToString ( 's' )

:
0yyyy'-'MM'-'dd'T'HH':'mm':'ss2011-07-27T08:40:28

The patterns for DateTime.ToString ( 'u' )

:
0yyyy'-'MM'-'dd HH':'mm':'ss'Z'2011-07-27

08:40:28Z

The patterns for DateTime.ToString ( 'U' )

:
0dddd, dd MMMM yyyy HH:mm:ssWednesday, 27 July 2011

08:40:28

The patterns for DateTime.ToString ( 'y' )

:
0yyyy MMMM2011 July




download box instead of direct open file in new window.

#region download-file
static public void DownloadFile(string filePath)
{
try
{
filePath = filePath.Replace(" ", "_");
HttpContext.Current.Response.ContentType = "application/octet-stream";
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + System.IO.Path.GetFileName(filePath));
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.WriteFile(filePath);
HttpContext.Current.Response.End();
}
catch (Exception ex)
{
throw ex;
}
}
#endregion

Friday, July 8, 2011

How to insert complete dataset values into sql server 2005+ using XML

First we have to convert the ds into xml and pass it to the stored

procedure.
For the sake of simplicity i created here a xml schema @xml-schema and temporary table #TempTable.


DECLARE @ixml int
DECLARE @xml-schema varchar(max)
SET @xml-schema ='





'

--Create an internal representation of the XML document.
EXEC sp_xml_preparedocument @ixml OUTPUT, @xml-schema
-- Execute a SELECT statement that uses the OPENXML rowset provider.


SELECT *
Into #TempTable
FROM OPENXML(@ixml, '/ROOT/Trans',1)
WITH
(
TransId varchar(10),
[Add] bit,
Edit bit,
[Delete] bit,
[View] bit,
Block bit
)

Select * From #TempTable

drop table #TempTable




You can change it as per your requirement . have any query please contact me rahularyansharma@gmail.com

Friday, September 3, 2010

how to create ms acess database at runtime for seprate finance year




using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ADOX; (for this u have to add refrence)





private void button1_Click(object sender, EventArgs e)
{
try
{
CatalogClass cat = new CatalogClass();
string tmpStr;
string filename = txtStartingYear.Text + "-" + txtEndingYear.Text;
tmpStr = "Provider=Microsoft.Jet.OLEDB.4.0;";
tmpStr += "Data Source= C:\\" + filename+".mdb" + ";Jet OLEDB:Engine Type=5";
cat.Create(tmpStr);
Table nTable = new Table();
nTable.Name = "PersonData";
nTable.Columns.Append("LastName", DataTypeEnum.adVarWChar, 25);
nTable.Columns.Append("FirstName", DataTypeEnum.adVarWChar, 25);
nTable.Columns.Append("Address 1", DataTypeEnum.adVarWChar, 45);
nTable.Columns.Append("Address 2", DataTypeEnum.adVarWChar, 45);
nTable.Columns.Append("City", DataTypeEnum.adVarWChar, 25);
nTable.Columns.Append("State", DataTypeEnum.adVarWChar, 2);
nTable.Columns.Append("Zip", DataTypeEnum.adVarWChar, 9);
cat.Tables.Append(nTable);
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(nTable);
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(cat.Tables);
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(cat.ActiveConnection);
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(cat);
}
catch (Exception ex)
{
MessageBox.Show("Database with this name already exists");
}
}

Saturday, August 21, 2010

when executing a sql file getting "system.outofmemoryexception" in sql server 2005

hi dears
today i m face a very interesting problem is that in our erp system we gnerate .sql file from database publishing wizard and server genrate .sql file successfully . but when i am execute that file on our local system in sql server 2005 we will get error that "system.outofmemoryexception" .i google it and found the solution that this problem is related to sql server memory configuration
. actually default setting of sql server use 2 gb memory for executing the any query in database sql server 2005
then there is two option
1-first one is suggested by msdn is that expand your memory from 2gb to 3 gb

2- second which i try and got success which is dont execute query at once , divide ur query in bunch of some lines so you can execute them.and after one by one execute all bunch of sql queries

i know that my solution is temporary but its work for me..

Friday, August 20, 2010

how to Show HTML/JavaScript Code inside Blogger Blog Posts on your blog

as you read different posts on my blog you see that there are many post in which there should be some code but its not show . why is there is a reason behind this which is in detail show below

"The Blogspot’s XML parser takes it as a code, and shows the result whatever is written in the code you pasted… Its only you who knows that you wanted to show the code deliberately without wanting it to be parsed automatically ."



so now as always solution in problem it self . so in this our problem the solution is that our code should not be parsed automatically for this ...........



Google’s Blogger Team realized this, and have added a solution for this in Blogger’s settings.

1. Login to your blogger account
2. Go to Settings.
3. Go down to the page.
4. Under “Select Post Editor”, choose “Updated Editor”.
5. Save the Settings.

after this setting for a new post which have code use following

Now Go and make a post, click “Post Options” below the post editor, and select “show HTML Literally”.

Insert any HTML codes in the post and preview or publish it.

ASP.NET Core

 Certainly! Here are 10 advanced .NET Core interview questions covering various topics: 1. **ASP.NET Core Middleware Pipeline**: Explain the...