|
The "NO CARRIER" message indicates that there is no connection to the telephone line. Maybe you need to check your circuitry, or whether the receiver hangs up after getting the "RING" message. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
so, why one of the modems returns CONNECT 9600 message?!
|
|
|
|
|
saeidfarahi wrote: so, why one of the modems returns CONNECT 9600 message?
Sorry, no idea, you need to check that your program is not causing a hang-up, or that there is no problem in the modem.txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
I created a custom timer class (MyTimer). The class is basicaly just a wrapper that internaly uses System.Threading.Timer. Class MyTimer will be used in a windows service app. Since the Timer class signals it events on the background thread, I am using Dispatcher.Invoke to marshal the requests to the current thread. Below is the event handler for the internaly used System.Threading.Timer.
private void timer_Elapsed(object state)
{
if (Dispatcher.CurrentDispatcher != _dispatcher)
{
_dispatcher.Invoke(
new System.Threading.ThreadStart(delegate
{
onTick();
}), DispatcherPriority.Send);
}
else
{
onTick();
}
}
private void onTick()
{
if (Tick != null)
{
Tick(this, new EventArgs());
}
}
The problem is that in some casses the _dispatcher.Thread is in stopped or WaitSleepJoin state, and the onTick() method doesn't execute. Does anybody has a solution to this problem? Any ideas will be appreciated.
Urošmodified on Friday, February 12, 2010 11:29 AM
|
|
|
|
|
Please read this[^]
Look at #3, "Hi" is not a descriptive subject line and is why your question is being ignored. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Thanks for the warning, it was a honest mistake.
Uros
|
|
|
|
|
Is there a tool that would help me examine the application domains in a running process that hosts the .NET runtime (BizTalk for instance)? Or the DLL's loaded by the said process?
|
|
|
|
|
In order to get the Dlls loaded by a process, you can make use of Process.Modules property. Not sure about getting the list of AppDomains in a process. In case you know the AppDomain , AppDomain.GetAssemblies method would do same for you."No matter how many fish in the sea; it will be so empty without me." - From song "Without me" by Eminem
|
|
|
|
|
Thank you for your answer. I will start with that, that should be enough.
I wanted to do this because you can instruct BizTalk to load specific assemblies into named domains and not to unload those domains when idle.
|
|
|
|
|
You can also use the Fusion Log Viewer, it's installed with most visual studio installs, if not it is easily downloaded from Microsoft Downloads. Open up a visual studio command prompt, and type FUSLOGVW. have this open whily you run your process, and it will log all the assembly binds that occur.
|
|
|
|
|
Hi i am trying to write a tree view control however have come accross difficulty in drawing the vertical lines.
The bellow method currently works by fining the cumulative height of the last branch it was in and then calls AmountToDeduct(nodes[i].Nodes) to reduce this to the correct height for the next line.
However this is very slow. Does anyone know a way i can simply not add nodeheight to the newLineFinishPoint if it is not needed apposed to taking away from the total heigh.
private Point PositionNodes(List<Node> nodes, Point point)
{
Point newStartPoint = new Point();
Point newFinishPoint = new Point();
newStartPoint = point;
int nodeHeight = nodes[0].Size.Height;
for(int i = 0; i < nodes.Count; i++)
{
nodes[i].Location = point;
point.Y += nodeHeight;
if (nodes[i].Nodes.Count > 0 && nodes[i].Expanded)
{
point.Y = PositionNodes(nodes[i].Nodes, new Point(point.X + m_xIndentation, point.Y)).Y;
}
newFinishPoint = point;
newFinishPoint.Y -= (int)(nodes[0].Size.Height * 0.5);
if (nodes.Count == 1 && nodes[i].Expanded)
{
newFinishPoint.Y -= AmountToDeduct(nodes[i].Nodes);
}
m_linePoints.Add(newStartPoint);
m_linePoints.Add(newFinishPoint);
}
return point;
}
Thanks in advance
|
|
|
|
|
hi there,
I need to read a text file, but i want to read only the first 5 lines.
please help me
Thanx
|
|
|
|
|
muka66 wrote: I need to read a text file, but i want to read only the first 5 lines
Stop reading after 5 lines. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
help please, dnt forget we all hv to start somewhere, so im a 9 year old in development
thanx
|
|
|
|
|
muka66 wrote: im a 9 year old in development
Well, at least that explains the txtspeak. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
|
Here is one way:
string[] lines = new string[5];
using (StreamReader sr = new StreamReader(@"c:\XXTemp\data.txt"))
{
for (int i = 0; i < 5; i++)
{
if (!sr.EndOfStream)
{
lines[i] = sr.ReadLine();
}
}
}
If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
|
|
|
|
|
when i read the whole file, i manage to sisplay the content on a label, now I need to display only the first five line of the text file, but currently the program just display one line.
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
try
{
StreamReader objStream;
string myfile = Request.QueryString["txtreader"] + ".txt";
string reading = Server.MapPath(myfile);
string[] lines = new string[5];
using (objStream = new StreamReader(reading))
for (int i = 0; i < 5; i++)
{
if (!objStream.EndOfStream)
{
lines[i] = objStream.ReadLine();
lblDispaly.Text = lines[i];
}
}
objStream.Close();
}
catch(FileNotFoundException exc)
{
lblerror.Text = exc.ToString();
}
}
Thanx
|
|
|
|
|
You are overwriting the Label.Text property each time ...
try this :
lblDispaly.Text += lines[i] + @"\n";
|
|
|
|
|
Thanx a lot, it worked
|
|
|
|
|
muka66 wrote: lblDispaly.Text = lines[i];
You just replace the text (up to) 5 times..
What exactly do you want on that label? All up-to-5 lines?
|
|
|
|
|
for (int i = 0; i < 5; i++)
{
if (!objStream.EndOfStream)
{
lines[i] = objStream.ReadLine();
lblDispaly.Text = lines[i];
}
}
This will only display line 5
because each line diplayed ...
lblDispaly.Text = lines[i];
replaces the previous line.
The five lines are stored in 5 strings
inside the array lines, lines[0] holds
the first string while lines[4]
holds the 5th string. The seperate
strings may be combined into one string
with the Join function.
for (int i = 0; i < 5; i++)
{
if (!objStream.EndOfStream)
{
lines[i] = objStream.ReadLine();
}
}
lblDispaly.Text = String.Join(" ",lines,0,5);
Do a google for C# string join.
|
|
|
|
|
Thanx it works
|
|
|
|
|
I see from later messages that you got it sorted anyway, but there are a comments. Please do not assume I am "getting at you", I'm not - I'm just trying to make your life easier later on!
1) When you post code fragments, use the "code block" widget on the message entry page. This preserves the formatting and makes it easier to read. It doesn't make much difference with a tiny bit of code like yours, but any bigger and it really can improve things. There are people here who won't read tour code unless it is formatted - and they include some people who seriously know what they are doing!
2) Get into the habit of using "too many" curly braces - whenever you can use them do. Particularly in the early days, they make it a lot more obvious where the flow of control is going. If you don't then there is always the temptation to add a new line of code which is outside the scope you intended:
if (condition)
statement; becomes:
if (condition)
statement;
statement; and then you are wondering why the second one is always executed!
if (condition)
{
statement;
} becomes:
if (condition)
{
statement;
statement;
} Is a lot more obvious. (And yes, I know VS re-formats code automatically - but it doesn't always.)
3) You don't need the "objStream.Close()" - the using statement Disposes of the file stream, so there is nothing to close!
4) Try to be consistent with your naming: lblerror and lblDispaly can't both be right! Use lblError and lblDisplay instead. Remember that VS will rename variables for you if you ask it nicely...
5) Use names that describe what something does, not what it is: objStream is neither helpful nor accurate! srInputFile is a lot more useful when you come back to it in six months time.
6) Try to declare things in a minimum scope: for example:
StreamReader objStream;
string myfile = Request.QueryString["txtreader"] + ".txt";
string reading = Server.MapPath(myfile);
string[] lines = new string[5];
using (objStream = new StreamReader(reading))
{
for (int i = 0; i < 5; i++)
{
if (!objStream.EndOfStream)
{
lines[i] = objStream.ReadLine();
lblDispaly.Text = lines[i];
}
}
}
objStream.Close(); Because objStream is only usable within the using block, declare it in the using block. That way, if you try to use it outside, the compiler will complain and you will realize there is a problem before you can run the code. Catching bugs in the compiler is way faster than at runtime!
string myfile = Request.QueryString["txtreader"] + ".txt";
string reading = Server.MapPath(myfile);
string[] lines = new string[5];
using (StreamReader objStream = new StreamReader(reading))
{
for (int i = 0; i < 5; i++)
{
if (!objStream.EndOfStream)
{
lines[i] = objStream.ReadLine();
lblDispaly.Text = lines[i];
}
}
}
objStream.Close();
This may seem a lot of criticism, but it's not really - it's just good coding practices (hopefully) explained as to why we do things the way we do! It really does speed things up when projects get more complex, and it's is worth getting right from the start, because that way you don't have "bad habits" to break later on.If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
|
|
|
|
|
Thanx, I will use the advice
|
|
|
|