|
If I formatted my code in such an ugly, unreadable fashion I would consider it to be an inconvience, not a bug.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Really? Well, you have been very helpful. Thank you for your mature reply.
If you think I am the only person using this formatting in a C-esque language then you are very wrong.
Take a quick look at the Linux source code. They use it too. (Ex1, Ex2)
In PHP's primary else example they use it too.
Since I have used C and PHP for a long time before starting with C#, you really can't blame me for using this formatting. And obviously you can't argue that the formatting is unreadable since millions of people are using it. The fact that you use something else because you prefer that is irrelevant to this thread.
|
|
|
|
|
Don't take it so personally. Everyone has their own style of formatting code, and yours just happens to look like crap to a number of us here. No big deal.
BTW, if Tools|Options doesn't allow you to configure the auto-formatting the way you want it, there's this key on the left side of your keyboard, labeled "Tab" (I know, it's a fairly new feature of most computer keyboards, so you may have missed it), and it inserts a tab character when you press it. And that long one at the bottom center of your keyboard is the "Space" bar, and it adds one space each time you press it.
F2dk wrote: Take a quick look at the Linux source code. They use it too. (Ex1, Ex2)
In PHP's primary else example they use it too.
Well, if that's the case, everyone else must be wrong.
F2dk wrote: Since I have used C and PHP for a long time before starting with C#, you really can't blame me for using this formatting.
I haven't yet seen any blame cast in one direction or another.
F2dk wrote: And obviously you can't argue that the formatting is unreadable since millions of people are using it.
You mean the two people you cited represent MILLIONS of people? I'm aghast! AGHAST I SAY! WE MUST ALL CONFORM OR LOSE WHAT LITTLE SELF RESPECT WE HAVE LEFT IN OUR PITIFUL LIVES! REPENT SINNERS!
F2dk wrote: The fact that you use something else because you prefer that is irrelevant to this thread.
Not at all - this is a thread about code formatting.
.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
|
|
|
|
|
YEAH! THANKS MR. WEENIE HEAD!
.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
|
|
|
|
|
Touche
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I heard that Obama is going to require all programmers to make all lines of code the same length so that no single line feels less important than any other line. Formatting, as we know it, will be a thing of the past.
EDIT ===========
Whoever is 1-voting me - you have a big job ahead of you - I have almost 18,000 messages in the system. Have fun.
EDIT ===========
Added "single" in original statement.
.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
modified on Saturday, January 30, 2010 3:10 PM
|
|
|
|
|
He has, and the millions of PHP programmers, i.e. both of them, have proclaimed their support for such a common standard but have vowed to vote one for everyone who doesn't use their formatting standard.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hello,
i would like to know if its possible to build an application that can SANDBOX an monitor an EXE.
this is part of an application i am building for a project in university. i'm building a prototype of a behavior based antivirus.
techniques used:
-Signature detection using the CLAMWIN AV database. "as it is the most common method"
-N-grams "a new way to detect malicious code using N-grams more commonly used in NLP"
-sanboxing "which is what all the AV companies say they do"
any feedback would be appreciated.
thank you
Mohamed Hossam
|
|
|
|
|
|
yes EliottA like a virtual machine, but not with the interface. preferably something like sanboxie..
thx.
modified on Friday, January 29, 2010 3:41 PM
|
|
|
|
|
You may want to consider running the app within its own AppDomain - also see System.AddIn .
/ravi
|
|
|
|
|
i'll try that.
Ravi Bhavnani wrote: You may want to consider running the app within its own AppDomain - also see System.AddIn.
/ravi
thx Ravi.
|
|
|
|
|
Hello Guys,
Need some help from you guys.
I have Generic List having a Class object.
I have added around 3000000 items in the list
List <CTempClass> lsTemp = new List <CTempClass> ();
when i tried to Serialize the with binary formater it is working fine
but when I deserialize the List it takes a lot of time around 30 Seconds.
But when i fill the Generic List with any datatype like
List<ulong> lsTemp = new List<ulong>();
and follow the same procedure the speed difference is drastic the while thing deserializes in 1 -2 Seconds
My Class object is Declared Serializable.
I dont understand why it is serialzer is behaving like this.
Am i Missing something.
Here is the Sample Code :
List<CTempClass> lsTemp = new List<CTempClass>();<br />
<br />
for(int i=0; i < 5000000;i++)<br />
{<br />
CTempClass oTemp = new CTempClass();<br />
oTemp.ID = i;<br />
lsTemp.Add(oTemp);<br />
oTemp=null;<br />
}<br />
<br />
using (Stream stream = File.Open("c:\\data.bin", FileMode.CreateNew))<br />
{<br />
BinaryFormatter bin = new BinaryFormatter();<br />
bin.Serialize(stream, lsTemp );<br />
<br />
}<br />
<br />
using (Stream stream = File.Open("c:\\data.bin", FileMode.Open))<br />
{<br />
BinaryFormatter bin = new BinaryFormatter();<br />
var lsTemp1 = bin.Deserialize(stream);<br />
<br />
}
here is the code of temp class
[Serializable]<br />
public class CTempClass : ISerializable <br />
{<br />
<br />
<br />
private ulong m_uCrc64; <br />
<br />
public CTempClass ()<br />
{<br />
m_uCrc64 = 0; <br />
}<br />
<br />
public CTempClass (SerializationInfo info, StreamingContext ctxt)<br />
{<br />
m_uCrc64 = info.GetUInt64("m_uCrc64");<br />
<br />
}<br />
<br />
public void GetObjectData(SerializationInfo info, StreamingContext ctxt)<br />
{<br />
<br />
info.AddValue("m_uCrc64", m_uCrc64);<br />
<br />
}<br />
<br />
}
Can any one please tell me why it is taking so much of time.
Any suggestion will be a great help
abhinav
|
|
|
|
|
One of the most obvious differences is between value types and references. It takes time to allocate memory for 3 million objects.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
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... ?
|
|
|
|