|
Tom Ollar wrote: When attempting to run a 1.1 based exe on 2.0, you get an ugly TypeInitialization exception.
I have not seen this problem. Did you apply the .NET 2.0 element stuff in the App.config file? I have ran my rather complex application without issues on both runtime, binary serialization is even forwards and backwards compatible
xacc-ide 0.0.99-preview7 now with C#, C, C++, IL, XML, Nemerle, IronPython, Perl, Caml, SML, Ruby, Flex, Yacc, Java, Javascript, Lua, Prolog and Boo highlighting support!
|
|
|
|
|
The app is the MiniWalker.
The current version was compiled with VS 2003 and it only runs with the 1.1 Framework. On a machine with only the 2.0 Framework installed, it crashes with the Type Initialization error.
Microsoft says this is correct here.
So it looks like a real setup program is the only answer...
-- modified at 10:20 Saturday 5th November, 2005
|
|
|
|
|
Hello All, Not sure where to post this.
I'm looking for advice on the following. Within Excel, I'd like to have the ability to pass some parameter and get back an image corresponding to that parameter. For example, imagine you pass in "MSFT" and "1yr" and get back a stock trend image. Ideally, I'd be passing in an array of values, and for each image, I'll place it on the adjacent cell of the selected value.
The image is created using a Java tool sitting on a separate server. The tool grabs some data from a db using the parameter passed in and then generates the image accordingly. I can wrap that up as a web service.
I could then consume this service in Excel and get the image for each value passed and place it as a bitmap in a cell in Excel.
Does anyone have advice or can point me to a solution or sample that already exists for this?
I don't really have to do it C# or .NET at all for that matter, but it certainly would be ideal.
I have Office 2003.
Thanks
Julian
|
|
|
|
|
hi,
I am doing a project in C# winform.
When I run the app, I want to display the form in the entire screen (even the taskbar and the status bar should not be shown). The app should take over the entire screen.
How do I do this??
Thanks.
|
|
|
|
|
Set these 3 properties or do it in the designer.
this.MaximizeBox = false;
this.TopMost = true;
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
|
|
|
|
Thanks!!!!
|
|
|
|
|
|
Hello!
I have a big problem...
I'm working with a richTextBox and I need to know how every characters is painted..I dont know if you understand!
The problem is the following:
i have a string in a richTextBox and i can color every characters of it by a different way. Depending by the color, i must put a prefix in front of each char...
Any suggestion..?
Thank You
Enrico
|
|
|
|
|
The easiest way is to use the SelectionColor[^] property. However, moving the Selection character by character doesn't seem to be a great idea.
You can also try getting the Rtf[^] property and then parsing it to figure out the colors. You can find the RTF Spec here[^].
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I would like to develop a control for a mapping program I have, but I don't even have a clue where to start. Any ideas?
Here is what I want the control for: My mapping program effectively reads a list of points with GPS locations and power values. I draw a circle on a map at the GPS point, and the color of the circle is one of four values, depending on the power. In other words, the possible power spectrum is divided with three threshold values into four bands. All of this already works fine.
Here is what I want the control to do: I want the user to have a graphical method of adjusting the power thresholds between the four power bands. I would like to show something like:
Color1 | Color2 | Color3 | Color4
where the ColorN are colored rectangles representing the four bands, each in that band's assigned color, and the vertical bars are splitters than can be moved back and forth with the mouse, representing the power thresholds between the bands.
Any thoughts would be welcome. Thanks.
|
|
|
|
|
Hello,
I need to do following. If object was not initialized then assign variable to it like code below.
Right now it throws an error becouse MyCert is not initialized when compared to null. How do I do what I need to do?
<br />
X509ChainElement MyCert;<br />
foreach (X509ChainElement cert in chain.ChainElements)<br />
{<br />
if ( MyCert == null)<br />
{<br />
MyCert = (X509ChainElement) cert;<br />
continue;<br />
}<br />
else<br />
{<br />
.....;<br />
}<br />
}<br />
<br />
|
|
|
|
|
artisticcheese wrote: Hello,
I need to do following. If object was not initialized then assign variable to it like code below.
Right now it throws an error becouse MyCert is not initialized when compared to null. How do I do what I need to do?
X509ChainElement MyCert;
foreach (X509ChainElement cert in chain.ChainElements)
{
if ( MyCert == null)
{
MyCert = (X509ChainElement) cert;
continue;
}
else
{
.....;
}
}
The quickest way is to initialize your object at the beginning. I am assuming you will be doing some processing between your declaration and your foreach loop, otherwise it makes no sense to check for a null because you know it is uninitialized. So it would look like this:
X509ChainElement MyCert = null;
// do some processing and other things.....
foreach (X509ChainElement cert in chain.ChainElements)
{
if ( MyCert == null) //has not been initialized somewhere before the loop
{
MyCert = (X509ChainElement) cert;
continue;
}
else
{
.....;
}
}
But what I don't understand about your code is that only the first element will ever be assigned to MyCert. Of course I only get to see a small snippet and this may be the functionality you want.
|
|
|
|
|
Hello,
I am loading a file within my app and the way I am refering to it is something like that:
<br />
this.richTextBox1.LoadFile("c:\\tmp\\Document.rtf");
However if I want to deploy the application on some other machine, obviously the file will not be there. So, if I want to include the file in my application how do I refer to the file then?
Thank you.
|
|
|
|
|
Just put it in your application'S folder and do a this.richTextBox1.LoadFile("Document.rtf");
You might also insert the file as a resource
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi,
I am using : Help.ShowHelp (this, "Help\\EconomicAssessmentHelp.chm");
whre Help is the folder in my application folder (the one that contains the solution and all the clasees, forms, etc...). But the statement above still does not work, unless I provide the whole path.
Which is "C:\\MyDocuments\.... etc.
Any ideas why it does not work?
Thank you
|
|
|
|
|
zaboboa wrote: Hello,
I am loading a file within my app and the way I am refering to it is something like that:
this.richTextBox1.LoadFile("c:\\tmp\\Document.rtf");
However if I want to deploy the application on some other machine, obviously the file will not be there. So, if I want to include the file in my application how do I refer to the file then?
Thank you.
Is the file something you will deploy with your code? If so you will know where it should be. You could try something like this:
try
{
this.richTextBox1.LoadFile("c:\\tmp\\Document.rtf");
}
catch
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Title = "Please locate Document.rtf";
ofd.Filter = "RTF File|*.rft";
ofd.ShowDialog();
if ( ofd.FileName != "" ) { this.richTextBox1.LoadFile( ofd.FileName ); }
else {
}
|
|
|
|
|
You could put the .rtf file in the same directory as the .exe. You can access the startup path with:
AppDomain.CurrentDomain.SetupInfo.ApplicationBase
The application base is ALWAYS the location of the .exe, NOT the location you started the .exe from.
|
|
|
|
|
hi there!
i wrote a little application to demonstrate a little issue of mine.
just compile this source and check the memory used by the application (taskman or process-explorer)
the application starts with about 6mb memory.
when the last messagebox is displayed, everything should be disposed and the memory should return nearly to 6mb. but it doesn't.
has anyone any idea how to get the GC to collect this unused (but reserved?) memory?
i have to engineer a little application which will run on a terminalserver for each user. (50users x 10mb unneccessary memory is not very good...)
best regards
#code begin
using System;
using System.Windows.Forms;
namespace GCTest
{
///
/// Zusammenfassung für Class1.
///
class Class1 : Form
{
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private bool running = true;
private System.Collections.Hashtable mem;
///
/// Der Haupteinstiegspunkt für die Anwendung.
///
[STAThread]
static void Main(string[] args)
{
Class1 cl = new Class1();
Application.Run(cl);
MessageBox.Show(GC.GetGeneration(cl) + "","wait");
GC.Collect(2);
MessageBox.Show("wait","wait");
}
public Class1()
{
InitializeComponent();
System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(Runner));
t.Start();
}
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(40, 40);
this.button1.Name = "button1";
this.button1.TabIndex = 0;
this.button1.Text = "alloc";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(40, 80);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(152, 23);
this.button2.TabIndex = 0;
this.button2.Text = "set objects null";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(40, 120);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(152, 23);
this.button3.TabIndex = 0;
this.button3.Text = "set hashtable null";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(40, 160);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(152, 23);
this.button4.TabIndex = 0;
this.button4.Text = "exit";
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// Class1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.Add(this.button1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button3);
this.Controls.Add(this.button4);
this.Name = "Class1";
this.Text = "Bla";
this.ResumeLayout(false);
}
private void Runner()
{
while (running)
{
GC.Collect();
GC.WaitForPendingFinalizers();
System.Threading.Thread.Sleep(5000);
}
}
private void button1_Click(object sender, System.EventArgs e)
{
mem = new System.Collections.Hashtable();
for (int i = 0; i < 1000000; i++)
mem.Add(i,new Consumer());
}
private void button2_Click(object sender, System.EventArgs e)
{
for (int i = 0; i < mem.Count; i++)
mem[i] = null;
}
private void button3_Click(object sender, System.EventArgs e)
{
mem.Clear();
mem = null;
}
private void button4_Click(object sender, System.EventArgs e)
{
this.Close();
running = false;
}
}
public class Consumer
{
private string _str;
public Consumer()
{
_str = "abcdefghijklmnopqrst";
}
}
}
#code end
|
|
|
|
|
Stefan Fohringer wrote: the application starts with about 6mb memory.
when the last messagebox is displayed, everything should be disposed and the memory should return nearly to 6mb. but it doesn't.
has anyone any idea how to get the GC to collect this unused (but reserved?) memory?
i have to engineer a little application which will run on a terminalserver for each user. (50users x 10mb unneccessary memory is not very good...)
You're misunderstanding the way the memory model works. After the GC runs, memory from collected objects is placed in the application heap. It is not immediately returned to the OS, for the same reason that standard win32 apps don't (doing so involves a major performance hit from the context switch). Excess unused memory will be freed eventually under certain conditions, the ones I'm aware of are the app being minimized, the OS asking the app if it can do so (ie when the system needs more than is currently available), when the app has was the GC determines to be an excessive ammount. I'm not sure what the rules on this one are, but apps that breifly allocated hundreds of megs will rapidly return it following a GC. I don't know what size/time thresholds are involved here.
PS this comes up often enough it should probably be faqed somewhere.
|
|
|
|
|
The GC won't free the Reserved memory unless Windows asks for it back. GC keeps this reserve so it can quickly allocate memory for new objects. You can't specify how much and can't control how this reserved pool is managed in any way.
If you want to know how much memory your application is REALLY using, TaskManager is the worst possible place to go. For more accurate information, you need to use the .NET CLR counters in Performance Monitor.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
There are Win32 API calls you can call through PInvoke that will force windows to reclaim the memory that GC has reserved. There is something called "working set" that windows uses to manage memory usage for standard windows apps (primarily, those with a window...vs. a windows service for example. A quick test you can run is to check your apps memory usage when its a window, and check again after minimizing it...most probably, you'll see a change in memory usage, sometimes a significant change). You can force your application to free memory down to its minimum working set size, and you will see a change in your apps memory usage in Task Manager. Just be forwarned, this is NOT RECOMMENDED. As has already been mentioned, the GC tries to keep as much memory in reserve as it can for performance reasons. The GC is also a highly intelligent piece of code, and it will behave differently on different systems, and even on the same system in different conditions. Trying to "force the issue" in regards to freeing memory usually results in a loss, overall, in one way or another. Ultimately, the GC knows best, and you should let it do what it does.
-- modified at 22:34 Friday 4th November, 2005
Oops, replied to the wrong one. Apologies.
|
|
|
|
|
Jon Rista wrote: Just be forwarned, this is NOT RECOMMENDED.
That's why I don't tell anyone this. Nothing like giving someone the key to killing the performance of their app...
Jon Rista wrote: Oops, replied to the wrong one. Apologies.
;)
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Well, there are times when its useful to use it. I don't know Stefan's situation in detail, and if he really does need it, its the only way to do what he needs. I don't think its my place to judge someones capabilities, and if places were reversed, I'd rather be given the knowledge than be keept in the dark by someone who doesn't know my skills or intents.
In Stefan Fohringer case, beeing that his application will be used in Terminal Services, it could very well be neccesary to have a higher degree of controll over his applications memory usage. There are numerous issues with .NET applications running under WTS where memory usage becomes a major issue. You can search the net for numerous blogs on the issue.
-- modified at 16:00 Saturday 5th November, 2005
|
|
|
|
|
Hello,
I wrote singe-threaded console application which goes through the list of IP addresses and quries them individually if they are up and running or not. Each run takes 20 s for non-responsive computer since it's default timeout of socket in Windows, becouse of that it takes 4 hours to run my application.
I want to optimize application with multi-threading features but since I never done it I'd welcome any pointers or good articles or code samples for that matter.
What I ultimitately would like to do is to have like 10-20 threads in pool and feed my list of IP addresses to that pool when thread finished executing I'd like to update global DataSet for applicaiton with results of quieries.
Thanks,
G
|
|
|
|
|
Why not just send a UDP broadcast, then listen for responses? You could then periodically scan the list of responders and mark any that haven't replied in some period of time as down. This would require a small 'responder' program in each node the listened to the 'are you up' query and replied with its own "i'm up" udp broadcast.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|