Asp.Net : Unable to make the session state request to the session state server

April 24, 2015

Asp.Net : Unable to make the session state request to the session state server

Unable to make the session state request to the session state server

That error message means the ASP.NET State service is not running in services.msc


Please select a row error popup message

April 2, 2015

In IE 11
if you are getting “Please select a row” error pop up message then u have to check the below solution.

Tools – >Compatibility View settings ->

uncheck the checkbox of “Display intranet sites in Compatibility View”

Please select a row


SqlServer notes : sqlserver script to find a string in entire database

April 1, 2015

http://www.sqlmatters.com/Articles/Searching%20all%20columns%20in%20all%20tables%20in%20a%20database.aspx

DECLARE @SQL VARCHAR(MAX)
DECLARE @SearchString VARCHAR(100)
SET @SQL=”

— ——————————————
— Enter the string to be searched for here :

SET @SearchString=’bracket’
— ——————————————

SELECT @SQL = @SQL + ‘SELECT CONVERT(VARCHAR(MAX),COUNT(*)) + ” matches in column ”+”’
+ C.name + ”’+” on table ” + ”’ + SC.name + ‘.’ + T.name +
”’ [Matches for ”’+@SearchString+”':] FROM ‘ +
QUOTENAME(SC.name) + ‘.’ + QUOTENAME(T.name) + ‘ WHERE ‘ + QUOTENAME(C.name) +
‘ LIKE ”%’ + @SearchString +
‘%” HAVING COUNT(*)>0 UNION ALL ‘ +CHAR(13) + CHAR(10)
FROM sys.columns C
JOIN sys.tables T
ON C.object_id=T.object_id
JOIN sys.schemas SC
ON SC.schema_id=T.schema_id
JOIN sys.types ST
ON C.user_type_id=ST.user_type_id
JOIN sys.types SYST
ON ST.system_type_id=SYST.user_type_id
AND ST.system_type_id=SYST.system_type_id
WHERE SYST.name IN (‘varchar’,’nvarchar’,’text’,’ntext’,’char’,’nchar’)
ORDER BY T.name, C.name

— Strip off the last UNION ALL
IF LEN(@SQL)>12
SELECT @SQL=LEFT(@SQL,LEN(@SQL)- 12)

EXEC(@SQL)

–PRINT @SQL


Sharepoint : Div tag with ExternalClass

December 16, 2014

Every time I insert enhanced rich text in a field in SharePoint and
save it, SharePoint inserts DIV tags with an external class reference
around my content.

Why does it do this? Where is this class? What does it specify?

have multilined text field. When it is empty it is rendering in the list view as below. Can anyone tell me why and how to fix it?

– See more at: http://www.go4sharepoint.com/Forum/externalclass-enhanced-rich-text-fields-7091.aspx#sthash.lS18KFks.dpuf

Solution :

You can use Regex.Replace(currentItem[“Your Field Name”].ToString(), “”, string.Empty); Basically this will replace your div tag with empty string so you will get your plain text

http://www.sp-blogs.com/blogs/adnan/Lists/Posts/Post.aspx?ID=15

In Jquery use regex like this – stringvalue.Replace(“”, “”);


Convert File to Byte Array and Byte Array to Files

November 14, 2014

http://www.c-sharpcorner.com/UploadFile/1a81c5/convert-file-to-byte-array-and-byte-array-to-files/

In this article, let us see how to convert a file content to a byte array and restore the original content from the byte array and display it in its original file format such as pdf, doc, xls, rtf, jpeg, png etc.

Step 1: Create an ASP.Net application and add a class Document.

public class Document {
public int DocId { get; set; }
public string DocName { get; set; }
public byte[] DocContent { get; set; }
}

Step 2: Create a file of format doc/pdf/rtf etc. and convert the file content to a ByteArray using the following method. Then create an object of type Document and assign the Docname and DocContent property values from filename and filecontent.

public Document FileToByteArray(string fileName) {
byte[] fileContent = null;

System.IO.FileStream fs = new System.IO.FileStream(fileName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
System.IO.BinaryReader binaryReader = new System.IO.BinaryReader(fs);
long byteLength = new System.IO.FileInfo(fileName).Length;
fileContent = binaryReader.ReadBytes((Int32)byteLength);
fs.Close();
fs.Dispose();
binaryReader.Close();
Document = new Document();
Document.DocName = fileName;
Document.DocContent = fileContent;
return Document ;
}

Step 3: Now we need to convert the byte array back again to the file content and display it to the user with download options. For that I am using another method, ShowDocument, as below:

private void ShowDocument(string fileName, byte[] fileContent)
{
//Split the string by character . to get file extension type
string[] stringParts = fileName.Split(new char[] { ‘.’ });
string strType = stringParts[1];
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.AddHeader(“content-disposition”, “attachment; filename=” + fileName);
//Set the content type as file extension type
Response.ContentType = strType;
//Write the file content
this.Response.BinaryWrite(fileContent);
this.Response.End();

}
Step 4: In the page_load event, I have the following code, which will read the contents from the file and convert it to a ByteArray using the FileToByteArray method and convert it back to content using the ShowDocument method.

protected void Page_Load(object sender, EventArgs e)
{
FileToByteArray(“C:\\Users\\santhosh.kumar\\Documents\\Test for rht format.rtf”);
ShowDocument(Document.DocName, Document.DocContent);
}


object oriented progring in javascript

October 16, 2014

object oriented progring in javascript :

if there is no reusability then there is no need to keep the function name in memory .so go for anonymous or lamba functions

self invoking in javascript.

variables cannot be forward referenced
funcations can be forward referenced

too many arguments will be ifnoted
too less will be undefined

can be called in four ways:
1.as a function
2.as a method of another function
3.call and apply
4.as a constructor
5. inner function
6. inner function can acces the variables of outside functions

call method
Apply methods in javascript

in javsript scope is defnined by function and not by block

javascript closure.

undefined vs null
null : compiler is telling able to identify u but u have not given any value
undefined means : compiler is telling not able to identify u

———

to achieve inheritance, and obj oriented features in javscript “prototype based progring” was introduced.

namespace: grouping of all classes

in javscript namespace will be treated as another object

“this” keyword

extension methods using prototype keyword

there is no class,namespace concepts in javascript but only functions r ther

how to achieve inheritance in javscript
Object.Create

there is no interface concept to achieve inheritance like in c#

———————-

object oriented progring in javascript :

Prototype based programing.
Namespace –it is nothing but another object
contructor– a function itself constructor here.
properties-variables of function
methods
extension methods using prototype keyword
private variables
inheritence
abstruct
object method calling
function method calling
apply, call keywords
scope of variables in function
closure **
-> javascript garbage collector eg: if you declared and called a function named “fun” inside of “circus” function that “fun function ” wo’t went off from memory untill “circus ” function memory sruf off by garbage collector
->anomysys function
-> javascript arrays are not type specific
-> calling a function as constructor

——————————————————

if there is no reusability then there is no need to keep the function name in memory .so go for anonymous or lamba functions

self invoking in javascript.

variables cannot be forward referenced
funcations can be forward referenced

too many arguments will be ifnoted
too less will be undefined

can be called in four ways:
1.as a function
2.as a method of another function
3.call and apply
4.as a constructor
5. inner function
6. inner function can acces the variables of outside functions

call method
Apply methods in javascript

in javsript scope is defnined by function and not by block

javascript closure.

undefined vs null
null : compiler is telling able to identify u but u have not given any value
undefined means : compiler is telling not able to identify u

Data Access throw entity framework and Fluent API:-

? Micorsoft ORM Tool-entity Framework
? What is agile
? Data annotations / comments
? DTO(Data transfer Object) –it means pulling entire layer and objects and using it
? Is it database version dependent? Ans) same conditions need to take as per general DB migration
? Isolation from other layers entity framework
? Development approache:- DB First,Model First,Code First
? Architectural Concers:-
1) Persistence Ignorence(POCO)
2) Application patterns(Repository & unit work)
3) N-tire application
? Default mapper class will crated by frame work.
? What id Doamin Driven design ?
? Bulid with patterns of entity entity framework
? POCO?
? Sql Helper?
? 1)Entity Object(DTO),2)mapper class for DTO, data context & add mappings
? Lazy loading
? Attributes & annotations
? Indexing & performance in production deployment need to do as in separate concern
? What is n-Hybernate.

Building APP:
? Two kind of apps:-
1) Native( it’s like windows application in mobile)
2) Hybrid ( its like web application in mobile)

? Requirements :- 1) simulator
2) Phone gap not know what it is
3) IDE eg: eclipse
4) Plugins eg: ADT plugin
5) Java
? PhoneGAP.com go to this link for more info

———
JavaScript OOD :-

to achieve inheritance, and obj oriented features in javscript “prototype based progring” was introduced.

namespace: grouping of all classes

in javscript namespace will be treated as another object

“this” keyword

extension methods using prototype keyword

there is no class,namespace concepts in javascript but only functions r ther

how to achieve inheritance in javscript
Object.Create

there is no interface concept to achieve inheritance like in c#
———————————


Sqlserver : Saving changes is not permitted. The changes that you have made require the following tables to be dropped and re-created.

October 8, 2014

Saving changes is not permitted. The changes that you have made require the following tables to be dropped and re-created.
http://www.sql-server-performance.com/2009/saving-changes-not-permitted/
ERROR:

“Saving changes is not permitted. The changes that you have made require the following tables to be dropped and re-created. You have either made changes to a table that can’t be re-created or enabled the option Prevent saving changes that require the table to be re-created.”

This error happens because “Saving Changes is not permitted” when using SQL Server 2008 Management Studio to modify the structure of a table especially when SQL Server needs to drop and recreate a table to save the structural changes. It is always advised to make a structural change for a table using TSQL. However, it is a convenient option for database developers to use SQL Server Management Studio make such changes as the Prevent Saving Changes That Require Table Re-creation option is enabled by default in SQL Server 2008 Management Studio.

Disable “Prevent saving changes that require the table re-creation”

1. Open SQL Server 2008 Management Studio (SSMS). Click Tools menu and then click on Options… as shown in the snippet below.

2. In the navigation pane of the Options window, expand Designers node and select Table and Database Designers option as shown in the below snippet. Under Table Options you need to uncheck “Prevent saving changes that require the table re-creation” option and click OK to save changes.

This option when enabled prevents users from making structural changes to table using SQL Server Management Studio especially when SQL Server needs to recreate the table to save changes. By default, this option is checked and you need to uncheck this option to allow users to make any structural change through SSMS that require table recreation.


Follow

Get every new post delivered to your Inbox.