|
D'oh! Threads, not processes!
That won't work. Windows requires all painting to occur on the UI thread. If it's somewhere else, then you'll get lots of .NET exceptions.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Anticast wrote: What I would like to do is make two of these forms in their own threads,
Nope. Won't work. The forms will not paint properly on anything other than the UI thread. The browser components will also have nasty issues work on a background thread, if they work for you at all.
|
|
|
|
|
As others have said you have to do all UI work in the UI thread. What you can do is to create worker threads for each form and have them do all the data crunching and then give the results back to the UI thread in order to display them. The only way you could get the forms into separate threads is to make each form a separate process entirely and use IPC to communicate between them and your main app.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
Hello people, I have a project where i need to pass a file approx 2.68Gb or larger from one application to another. Now the problem is that in my project i have to use web services to do this operation.
I currently have the following setup in my code:
BinaryReader binReader = new BinaryReader(File.Open(parser.TemporaryFilesPath + "\\database.zip", FileMode.Open, FileAccess.Read));
binReader.BaseStream.Position = 0;
byte[] binaryfile = binReader.ReadBytes(Convert.ToInt32(binReader.BaseStream.Length));
binReader.Close();
sc.Helllo(binaryfile);
The above code is in my first application. Than in my web service appliciton i have the following code that writes the binary file to the temp location where it is stored.
[WebMethod]
public void Helllo(byte[] fileinbytes)
{
XMLParser parser = new XMLParser();
parser.CreateTemporaryDirectory();
BinaryWriter binWriter = new BinaryWriter(File.Open(parser.TemporaryFilesPath + "\\database.zip", FileMode.Create,FileAccess.ReadWrite));
binWriter.Write(fileinbytes);
binWriter.Close();
parser.Unzip();
parser.DecryptFiles();
parser.MergeXMLDataToDatabae("Centre to Main Database");
}
Now the problem is here in the first code block when the database.zip file increases in size its giving me the error "Value was either too large or too small for an Int32".Do you think there is a way which i can work around this or another way in which i cna program this. Thank you for your help and time guys apprciate it.
|
|
|
|
|
How about if you read the ZIP file into a buffer smaller than
int.MaxValue. Then, you can just loop until you've read it all.<br />
<br />
Just my $0.02, you should probably think of another way to do this than sending a > 2Gb file across the wire every time. <br />
<br />
<div class="ForumSig">"we must lose precision to make significant statements about complex systems."<br />
-deKorvin on uncertainty</div>
|
|
|
|
|
I use XmlTextReader to parse a supplied xml file. It is UTF-8 encoded, but a string read from a CDATA section does not display as a Unicode string.
Here is a very stripped down version of the xml file:
<?xml version="1.0" encoding="UTF-8"?>
<QuestionnaireDoc JobNo="New 1341 C" Description="New 1341 C" Week="2009-03-02" Template="DEV">
<QuesGroup Name="Tracks">
<TrackStudy Type="T" AdId="39240" Track="2">
<Title><![CDATA[Great Wall]]></Title>
<Content><![CDATA[It doesnâ?²t taste very good. Try xx Ciderâ?¢.]]></Content>
</TrackStudy>
</QuesGroup>
</QuestionnaireDoc>
The ReadString() method is used as follows:
o.Content = reader.ReadString(); // o.Content is String
o.Content contains "It doesnâ?²t taste very good. Try xx Ciderâ?¢.", not "It doesn′t taste very good. Try xx Cider™"
I've tried:
UTF8Encoding utf8 = new UTF8Encoding();
Byte[] encodedBytes = utf8.GetBytes(o.Content);
o.Content = utf8.GetString(encodedBytes);
but that makes no difference.
How do I decode this string? I have no control over the supplied xml file.
|
|
|
|
|
I don't think that it's the reader, I think that it's the renderer.
For example, if you're reading this content and rendering it in a browser that does not have UTF-8 as the default character set and you haven't used the META tag to set the character set or passed it as an HTTP header, then it will display badly.
Look at your renderer. The code looks fine.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
I tried it, and with your file containing correctly UTF-8 encoded text it works without problems. I think that the text in the file isn't actually encoded as UTF-8, or that you have decoded UTF-8 as ANSI and then encoded the corrupted string as UTF-8.
Tim Beck wrote: I've tried:
UTF8Encoding utf8 = new UTF8Encoding();
Byte[] encodedBytes = utf8.GetBytes(o.Content);
o.Content = utf8.GetString(encodedBytes);
but that makes no difference.
Of course it doesn't. You are just encoding the string to UTF-8 and then decoding it again. That doesn't change how it's decoded when you read it from the file.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
if i use this code, do it have no sense
private int[] testProtery = new int[3];
public int[] TestProtery
{
get
{
return this.testProtery;
}
set
{
this.testProtery = value;
}
}
i want to uee the property to match the private filed of testProtery,
i feel this code don't work. please let me understand. thank you
|
|
|
|
|
clj19870503 wrote: i feel this code don't work
why would it not work?
If only MySelf.Visible was more than just a getter...
A person can produce over 5 times there own body weight in excrement each year... please re-read your questions before posting
|
|
|
|
|
sure, it'll work.
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
for exampel , do i use this :
this.testProtery[0].TestProtery;
i don't understand, thank you .
|
|
|
|
|
well it depends what you want to access?
if you have, for example, an array of string for different data you might do something like the following.
private string[] stringData = new string[2];
public string Name{
get{return stringData[0];
set{stringData[0] = value;
}
public string JobTitle{
get{return stringData[1];
set{stringData[1] = value;
}
thou in this instance you would prob want to have two different string instances for the data
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Ok, stay with me on this. Let's say that you have
public class TestClass
{
private int[] _field;
} Now, in a method of TestClass , you would have the following to reference the value of _field.
public class TestClass
{
public void DoSomethingWithTheField()
{
if(null == _field)
{
this._field = new int[3];
}
}
private int[] _field;
} Now, let's add a property that allows getting and setting on _field .
public class TestClass
{
public int[] Property
{
get { return _field; }
set { _field = value; }
}
public void DoSomethingWithTheField()
{
if(null == _field)
{
this._field = new int[3];
}
}
private int[] _field;
} Now, you can have a method that will do something like this.
public class TestClass
{
public void DoSomethingWithTheProperty(int secondValue)
{
this.Property[1] = secondValue;
}
public int[] Property
{
get { return _field; }
set { _field = value; }
}
public void DoSomethingWithTheField()
{
if(null == _field)
{
this._field = new int[3];
}
}
private int[] _field;
} You see? When you expose a property as an array of integers, you can just use it like an array of integers.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
I am not getting your question.
The above post is rather a statement.
Can you be a little more specific?
Regards,
Chandra V
|
|
|
|
|
I have no question.
I posted a statement.
I walked through the creation of a class with a field of type "integer array," a property that exposed it, and then methods that consume each. It answers the original poster's "how do I access this" question.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Thanks...
Regards,
Cybernate
|
|
|
|
|
You're welcome.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Hi
I was wondering, is it possible to disable the logon screen when using crystal reports. I would like my app to logon the user automatically. Is this possible and if so how would I go about this?
Kind Regards
F8
|
|
|
|
|
I am not sure which Login you are talking about. But see if this[^] helps.
|
|
|
|
|
Hi,
if you are using CrystalDecisions.CrystalReports.Engine.ReportDocument you can set user name and password with the property DataSourceConnections[0] with method SetConnection.
For explample:
rpt.DataSourceConnections[0].SetConnection(server, connection.CatalogName, connection.UserId, connection.Password);
kind regards
[edit]you should do this before you send the ReportDocument to CrystalReportViewer. [/edit]
|
|
|
|
|
Hello...
I want to make my application as a full screen application. I know, if I set Border=None, I can get it.
But if the application is in fullscreen mode, I want also lock for example Window Button, to avoid user
to open another application.
This application is a Data Acquisition application. If user open another application or just move the
window using mouse, the performance is going down in Data Acquisition.
How to solve it ?
Thanks...
|
|
|
|
|
1. The user should always be able to control how they want to use their computer when any program is running.
2. If you having performance issue when moving the window etc. then you may want to look at handling the data acquisition better.
3. Have you tried setting the size and location of your application to match that of the screen rather than just maximising it. Then maybe try setting your application to be the top most form? this may give the disired effect of full screen mode
If only MySelf.Visible was more than just a getter...
A person can produce over 5 times there own body weight in excrement each year... please re-read your questions before posting
|
|
|
|
|
Link[^]
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
I have an application that combines XNA with Forms
When I move or even hold the mousebutton down (without moving) on a horizontal scrollbar,
it freezes the XNA part (while the forms part still gets updated).
This even happens when all code in the eventhandlers of the scrollbar are commented out!
So far none of the other controls (standard controls and custom controls)
gives me this strange behavior.
Does anyone has an idea what could be causing the problem?
or maybe even a solution?
edit:
Apparently It does not run the Update() methods of the xna part...
modified on Friday, March 6, 2009 7:50 AM
|
|
|
|