Click here to Skip to main content
16,008,175 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionRe: Help with Using Windows Forms Controls in Internet Explorer .net 2.0 Pin
Vasudevan Deepak Kumar6-Feb-08 22:24
Vasudevan Deepak Kumar6-Feb-08 22:24 
GeneralRe: Help with Using Windows Forms Controls in Internet Explorer .net 2.0 Pin
GDMFSOB6-Feb-08 22:32
GDMFSOB6-Feb-08 22:32 
GeneralRe: Help with Using Windows Forms Controls in Internet Explorer .net 2.0 Pin
Vasudevan Deepak Kumar6-Feb-08 22:52
Vasudevan Deepak Kumar6-Feb-08 22:52 
GeneralRe: Help with Using Windows Forms Controls in Internet Explorer .net 2.0 Pin
Christian Graus6-Feb-08 22:52
protectorChristian Graus6-Feb-08 22:52 
GeneralRe: Help with Using Windows Forms Controls in Internet Explorer .net 2.0 Pin
Christian Graus6-Feb-08 22:51
protectorChristian Graus6-Feb-08 22:51 
GeneralRe: Help with Using Windows Forms Controls in Internet Explorer .net 2.0 Pin
Vasudevan Deepak Kumar6-Feb-08 22:55
Vasudevan Deepak Kumar6-Feb-08 22:55 
GeneralRe: problem Closed Pin
GDMFSOB7-Feb-08 0:26
GDMFSOB7-Feb-08 0:26 
GeneralXML Deserialisation to slow.. Pin
hakervytas6-Feb-08 21:55
hakervytas6-Feb-08 21:55 
Any ideas how to improve deserialisation for binary data when reading from file for DataTable.

Becouse I tested deserialisation from binarry file and compared with the same data using MySql Database and got strange results that from Database reads and fills ~2x times faster to DataTable then Deserialise and read from finary file stream. I serealised as binary data of DataTable to file.
I tested deserialisation and the same functions for SortedArrayList and similar HashTable arrays works ~6x times faster that reading the same data from Database.

May anybody know how to improve deserialisation or are exist any algorithms for DataTables or DataSets a lot faster then I founded method?

Here a code example in VB.NET that I use for deserialisation of binary data from file for DataTable:
Public Shared Function DeserializeByte(ByVal b As Byte()) As Object
    If b Is Nothing Then Return Nothing
    Dim f As Runtime.Serialization.IFormatter
    Dim ms As System.IO.MemoryStream = Nothing
    Dim obj As Object = Nothing
    Try
        f = New Runtime.Serialization.Formatters.Binary.BinaryFormatter()
        ms = New System.IO.MemoryStream(b)
        obj = f.Deserialize(ms)
    Catch ex As Exception
    Finally
        If Not ms Is Nothing Then
            ms.Close()
            ms.Dispose()
        End If
    End Try
    Return obj
End Function


And here file reading, may nead improve:
Public Shared Function ReadBytesFromFile(ByVal sFileName As String) As Byte()
    Dim b As Byte() = New Byte() {}
    Dim fs As System.IO.FileStream = Nothing
    Dim iLen As Integer = 0
    Try
        fs = New System.IO.FileStream(sFileName, System.IO.FileMode.Open, System.IO.FileAccess.Read)
        iLen = CType(fs.Length, Integer)
        b = New Byte(iLen) {}
        fs.Read(b, 0, iLen)
    Catch ex As Exception
    Finally
        If Not fs Is Nothing Then
            fs.Close()
            fs.Dispose()
        End If
    End Try
    Return b
End Function


Here translated code for C# users:
public static object DeserializeByte(byte[] b)
	{
		if (b == null) return null; 
		Runtime.Serialization.IFormatter f;
		System.IO.MemoryStream ms = null;
		object obj = null;
		try {
			f = new Runtime.Serialization.Formatters.Binary.BinaryFormatter();
			ms = new System.IO.MemoryStream(b);
			obj = f.Deserialize(ms);
		}
		catch (Exception ex) {
		}
		finally {
			if ((ms != null))
			{
				ms.Close();
				ms.Dispose();
			}
		}
		return obj;
	}


	public static byte[] ReadBytesFromFile(string sFileName)
	{
		byte[] b = new byte[];
		System.IO.FileStream fs = null;
		int iLen = 0;
		try {
			fs = new System.IO.FileStream(sFileName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
			iLen = (int)fs.Length;
			b = new byte[iLen + 1];
			fs.Read(b, 0, iLen);
		}
		catch (Exception ex) {
		}
		finally {
			if ((fs != null))
			{
				fs.Close();
				fs.Dispose();
			}
		}
		return b;
	}


P.S. If somebody post in C# or in VB.NET no was a problem, I understand both languages.
GeneralVisual web developer to production server Pin
eyeseetee6-Feb-08 21:31
eyeseetee6-Feb-08 21:31 
Questionlogin page & browse button coding Pin
gag876-Feb-08 21:30
gag876-Feb-08 21:30 
GeneralRe: login page & browse button coding Pin
pmarfleet6-Feb-08 21:52
pmarfleet6-Feb-08 21:52 
GeneralRe: login page & browse button coding Pin
Gandalf_TheWhite6-Feb-08 22:53
professionalGandalf_TheWhite6-Feb-08 22:53 
GeneralRe: login page & browse button coding Pin
dilipv7-Feb-08 20:05
dilipv7-Feb-08 20:05 
QuestionHow to send newsletter to multiple clients [modified] Pin
thinkers6-Feb-08 21:12
thinkers6-Feb-08 21:12 
GeneralRe: How to send newsletter to multiple clients Pin
Vasudevan Deepak Kumar6-Feb-08 21:20
Vasudevan Deepak Kumar6-Feb-08 21:20 
GeneralRe: How to send newsletter to multiple clients Pin
thinkers6-Feb-08 22:22
thinkers6-Feb-08 22:22 
Questionhow to Download Binary file stored in the database [modified] Pin
Member 44071146-Feb-08 20:38
Member 44071146-Feb-08 20:38 
GeneralRe: how to Download Binary file stored in the database Pin
Vasudevan Deepak Kumar6-Feb-08 21:22
Vasudevan Deepak Kumar6-Feb-08 21:22 
Generalonclick event for anchor tag Pin
sirisha guttikonda6-Feb-08 20:32
sirisha guttikonda6-Feb-08 20:32 
GeneralRe: onclick event for anchor tag Pin
sulabh20206-Feb-08 20:37
sulabh20206-Feb-08 20:37 
GeneralRe: onclick event for anchor tag Pin
sirisha guttikonda6-Feb-08 20:39
sirisha guttikonda6-Feb-08 20:39 
GeneralRe: onclick event for anchor tag Pin
Kunal Pawar7-Feb-08 0:47
Kunal Pawar7-Feb-08 0:47 
GeneralRowcommand with Multiple Datakeys [modified] Pin
Vinay Dornala6-Feb-08 20:17
Vinay Dornala6-Feb-08 20:17 
Questionhow do I refresh a page? Pin
Shimmy Weitzhandler6-Feb-08 20:03
Shimmy Weitzhandler6-Feb-08 20:03 
GeneralRe: how do I refresh a page? Pin
sulabh20206-Feb-08 20:18
sulabh20206-Feb-08 20:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.