|
The actal test had 5 million.
I would say thats 5/3 slower still than 3 million.
|
|
|
|
|
You won’t be able to improve significantly performance while using .Net built in serializers. They are inheritably slow. I bumped into this many times. If performance is an issue I would recommend considering implementing custom destabilization (another word for “read you file and parse data in you code”).
|
|
|
|
|
Hello Ilia,
can you please give me any example or some link for cusuom deserialization to start of with it would be a great help
abhinav
|
|
|
|
|
Well, what I basically recommend using StreamWriter, StreamReader class to write to file /read from the file data stored in your objects. The approach requires specifying format of the file and how pieces of the data stored / retrieved from the file.
When applied to your example is might look something like this
<code>
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Diagnostics;
namespace ConsoleApplication1
{
public class CTempClass
{
public int m_uCrc64;
public int M_uCrc64
{
get
{
return m_uCrc64;
}
set
{
m_uCrc64 = value;
}
}
public CTempClass()
{
m_uCrc64 = 0;
}
}
class Program
{
static void Main(string[] args)
{
List<CTempClass> lsTemp = new List<CTempClass>();
for (int i = 0; i < 1000000; i++)
{
CTempClass oTemp = new CTempClass();
oTemp.m_uCrc64 = i;
lsTemp.Add(oTemp);
oTemp = null;
}
Stopwatch s = new Stopwatch();
s.Start ();
using (Stream stream = File.Open("c:\\data.bin", FileMode.Create))
{
BinaryWriter writer = new BinaryWriter(stream);
foreach (CTempClass instance in lsTemp)
writer.Write(instance.M_uCrc64);
writer.Close();
}
s.Stop();
System.Console.WriteLine ("Serialize " + s.Elapsed.TotalMilliseconds + " mils");
s.Reset();
s.Start();
byte[] buffer = File.ReadAllBytes ("c:\\data.bin");
lsTemp = new List<CTempClass>();
using (MemoryStream stream = new MemoryStream(buffer))
{
BinaryReader reader = new BinaryReader(stream);
try
{
while (true)
{
int i = reader.ReadInt32();
CTempClass oTemp = new CTempClass();
oTemp.m_uCrc64 = i;
lsTemp.Add(oTemp);
oTemp = null;
}
}
catch (EndOfStreamException)
{
reader.Close();
}
}
s.Stop();
System.Console.WriteLine("Deserialize " + s.Elapsed.TotalMilliseconds + " mils");
}
}
}
</code>
modified on Monday, February 1, 2010 11:23 AM
|
|
|
|
|
hi...to all...
plz help me...
|
|
|
|
|
Go here[^].
Unless you want to do it from code, in wich case you might want to give some more details
I are Troll
|
|
|
|
|
yaahhhhhhh.....Eddy Vluggen
its like ..how to decrease line spacing for paragragh in word document
|
|
|
|
|
i mean......im asking code ....i wrote code like dis....
Microsoft.Office.Interop.Word.Paragraph oPara1;
oPara1 = oDoc.Content.Paragraphs.Add(ref oMissing);
oPara1.Format.SpaceAfter = 0;
oPara1.Range.Start = 0;
oPara1.Range.End = 0;
oPara1.Range.ParagraphFormat.LineSpacing = oWord.MillimetersToPoints(0.7f);
oPara1.Range.ParagraphFormat.LeftIndent = 0.70f;
oPara1.Range.ParagraphFormat.LineSpacingRule = WdLineSpacing.wdLineSpaceExactly;
oPara1.Range.ParagraphFormat.SpaceAfter = oWord.MillimetersToPoints(0F);
oPara1.Range.ParagraphFormat.SpaceBefore = oWord.MillimetersToPoints(0f);
oPara1.Range.ParagraphFormat.SpaceAfterAuto = 0;
oPara1.Range.ParagraphFormat.SpaceBeforeAuto = 0;
oPara1.Range.Text = "Sigma LLC\n 501 hyd Rd, Suite 105\n";
oPara1.Range.InsertParagraphBefore();
oPara1.Range.AutoFormat();
but i cant getting sapce in b/w that adress...line by line..with spaces
|
|
|
|
|
ravindra chintha wrote: i mean......im asking code ....i wrote code like dis....
Microsoft.Office.Interop.Word.Paragraph oPara1;
Does it work with a LineSpacingRule of "wdLineSpaceDouble"?
ravindra chintha wrote: but i cant getting sapce in b/w that adress...line by line..with spaces
The space is defined in your code with a LineSpacing of 0.7. That's also the suggested property according to this[^] article.
Does it help to decrease the value, or does changing the value have no effect at all?
I are Troll
modified on Friday, January 29, 2010 12:39 PM
|
|
|
|
|
Hello,
I want to build an application for writing text in textbox using speech recognition. i.e. if i speak "This is my first application" it should be displayed on textbox.
I have tried but failed. Here is my code.
System.Speech.Recognition.SpeechRecognitionEngine recognizer;
private void Form3_Load(object sender, EventArgs e)
{
recognizer = new System.Speech.Recognition.SpeechRecognitionEngine();
GrammarBuilder dictaphoneGB = new GrammarBuilder();
GrammarBuilder dictation = new GrammarBuilder();
dictation.AppendDictation();
dictaphoneGB.Append(new SemanticResultKey("StartDictation", new SemanticResultValue("Start Dictation", true)));
dictaphoneGB.Append(new SemanticResultKey("DictationInput", dictation));
dictaphoneGB.Append(new SemanticResultKey("EndDictation", new SemanticResultValue("Stop Dictation", false)));
GrammarBuilder spelling = new GrammarBuilder();
spelling.AppendDictation("spelling");
GrammarBuilder spellingGB = new GrammarBuilder();
spellingGB.Append(new SemanticResultKey("StartSpelling", new SemanticResultValue("Start Spelling", true)));
spellingGB.Append(new SemanticResultKey("spellingInput", spelling));
spellingGB.Append(new SemanticResultKey("StopSpelling", new SemanticResultValue("Stop Spelling", true)));
GrammarBuilder both = GrammarBuilder.Add(dictaphoneGB, spellingGB);
Grammar grammar = new Grammar(both);
grammar.Enabled = true;
grammar.Name = "Dictaphone and Spelling ";
recognizer.LoadGrammar(grammar);
recognizer.SetInputToDefaultAudioDevice();
recognizer.RecognizeAsync(RecognizeMode.Multiple);
recognizer.SpeechRecognized += OnSpeechRecognized;
}
private void OnSpeechRecognized(object sender, System.Speech.Recognition.SpeechRecognizedEventArgs e)
{
textBox1.Text = e.Result.Text;
}
There is no output.
Please help me i am new to speech recognition.
Thanks in advance.
|
|
|
|
|
Give us more information on your problem. You have an exception, no sound... ?
|
|
|
|
|
Thank you for reply.
And i am sorry for my late reply.
I am not getting any response from the application, if i speak into Mic there is no response, it does not go into the speech_recognized() event.
So i really don't understand what is going wrong.
Please help me.
Thanks in advance.
|
|
|
|
|
No sound, the problem may be the input device which is not the default one.
I will try to replay your sample
|
|
|
|
|
hi friends,
i am trying to blend the edges of the polygon region can any one help me to do so..
regards
Samir
|
|
|
|
|
Hi All,
I am using third party COM dll. In my machine it is working fine. but its not working on any other machine event registering dll. I got below error
System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {E064BB22-22CE-4E01-BB63-10EF4058CAF9} failed due to the following error: 80040154.
What is the error exactly? any body can explain?
Thanking You,
Sunil G.
|
|
|
|
|
Google gives loads of results for "error: 80040154" - MSDN[^] is probably the most usefull.
All those who believe in psycho kinesis, raise my hand.
My 's gonna unleash hell on your ass. tastic!
|
|
|
|
|
Ever heard of "google"? It's that new-fangled search engine that's been available on the web for more than ten years...
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Hello every one !
I'm a beginer in this forum and I'm researching about network computer.
I need a source code of a program as multichat to researching fastly.I tried to search source code VC# about this but can't.
I hope receive many helping !
Thanks all !
|
|
|
|
|
ccfqs wrote: .I tried to search source code VC# about this but can't.
Did you tried searching articles on Codeproject?
Look at the first hit i got: TCP/IP Chat Application Using C#[^]
|
|
|
|
|
ccfqs wrote: I need a source code of a program ... I tried to search source code VC# about this but can't.
Try harder.
MVP 2010 - are they mad?
|
|
|
|
|
Try System.LiquidNitrogen
Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
ccfqs wrote: Hello every one !
I'm a beginer in this forum and I'm researching about network computer feeling really lazy.
I need a source code of a program as multichat to researching fastly hand in as my own work. I tried to search source code VC# about this but can't be bothered to get google to work.
I hope receive many helping you will do my homework for me!
Thanks all !
All those who believe in psycho kinesis, raise my hand.
My 's gonna unleash hell on your ass. tastic!
|
|
|
|
|
I'm really sorry!
I'll try harder !
|
|
|
|
|
Hello to all,
I am developing an application that implements speech recognition module, now i need to implement voice authentication. Is it possible through sapi? And please guide me for that.
Please help me its urgent.
Thank you in advance
|
|
|
|
|
krinaljariwala wrote: i need to implement voice authentication. Is it possible through sapi?
What does the documentation[^] say on this subject?
krinaljariwala wrote: its urgent.
Only to you.
MVP 2010 - are they mad?
|
|
|
|