|
Thanks alot,
I'd like to use your advice in another thing related to this application.
Again, this application is pretty simple,
There is a Log-file which is written in very high-rates.
My application(called LogMon) reads the Log-file when it changes and saves in its memory only the last 600 or so records.
When the user scrolls up and back down, i calculate the records that should be loaded and load them before he scrools up to them.
Anyway,
I thought that maybe the whole idea of reading from a file is pretty slow,and came up with the following idea.
I split the LogMon to 2 apps:
* LogMon File2DB
* LogMon Gui
LogMon File2DB:
---------
Reads lines appended to file, and inserts them into a local\remote DB.
LogMon Gui:
---------
Reads the DB and updates when DB has new records.
This makes the GUI much faster and much easier to implement the "virtual ListView".
Quetsions:
1. Will this be faster?
2. regarding the LogMon File2DB, say the parsed log-file has a changing format, meaning there can be some log-files, each one with different format, is there any way, maybe with XML of defining dynamically the structure of the log-file?
Thanks ,
Eytan
|
|
|
|
|
eytan levit wrote:
Will this be faster?
Depending on whether the begin or the end of the logfile is mostly interesting, I would seek to either the begin or the end of the file, and only load a chunk, then build the list view out of it.
eytan levit wrote:
regarding the LogMon File2DB, say the parsed log-file has a changing format, meaning there can be some log-files, each one with different format, is there any way, maybe with XML of defining dynamically the structure of the log-file?
I don't think the structure of a log file changes much, regardless of the application it is used for. A log file has several common fields including "date, user, log class family, severity, description". If that's a log of c++ code, then you add custom records like module name, filename, line. But that's pretty much all about it.
Even though I believe that's would be too much efforts here, your code could read the log structure out of a config file (ini, csv, xml). I believe there are a few ready-to-use log managers here in Cp.
|
|
|
|
|
I'm trying to get the contents of the AxWebBrowser.CreateGraphics(); to a PrintEventArgs.Graphics object. The desired effect is to be able to have the contents of a web page displayed on a printed page with my own graphics printed too. Like a nice title or a surrounding box for the page.
Any ideas?
"Where would you rather be today?"
|
|
|
|
|
I'm new to .NET so perhaps I'm missing something obvious, but is there a simple way to zero a byte array. I have this code:
byte[] byteArray = new byte[some size]; now is there a way to zero that array so that I can use it again?
Also another quick question. Is there a way to set the default button in the form designer? I know there's an IsDefault property but I can't find a way to set it in the designer.
Thanks in advance.
- monrobot13
|
|
|
|
|
im not 100% what you mean, but if you want to reuse byteArray , you can just do this.
byte[] byteArray = new byte[10];
byteArray = new byte[255];
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
that's sort of what I'm looking for, here's my code:
byte[] readBytes = new byte[tcpPop3.ReceiveBufferSize];
readBytes = new byte[tcpPop3.ReceiveBufferSize]; Perhaps I'm wrong but any help is appreciated.
Thanks Again
- monrobot13
|
|
|
|
|
Nope. That looks as if that's how you're gonna have to do it. There is no instruction in IL for redimensioning an array...so it looks as if you're gonna have to do this. Even the Applied Microsoft .NET Framework Programmg book says that you're gonna have to do this or use the Array.CreateInstance static method to do that.
Hey, what can I say? I'm a chick magnet...a babe conductor...a logarithm for the ladies.
-Strong Bad from HomeStarRunner.com
Essential Tips for Web Developers
|
|
|
|
|
From MSDN:
Array.Clear Method [C#]
Sets a range of elements in the Array to zero, to false, or to a null reference (Nothing in Visual Basic), depending on the element type.
public static void Clear(
Array array,
int index,
int length
);
Parameters
array
The Array whose elements need to be cleared.
index
The starting index of the range of elements to clear.
length
The number of elements to clear.
Also from MSDN:
Form.AcceptButton Property [C#]
Gets or sets the button on the form that is clicked when the user presses the ENTER key.
public IButtonControl AcceptButton {get; set;}
Property Value
An IButtonControl that represents the button to use as the accept button for the form.
Remarks
This property allows you to designate a default action to occur when the user presses the ENTER key in your application. The button assigned to this property must be an IButtonControl that is on the current form or located within a container on the current form.
You can use this property to allow the user to quickly navigate a simple form by allowing them to simply press the ENTER key when they are finished instead of manually clicking the accept button with their mouse.
The accept button may not be activated if the currently selected control on the form intercepts the ENTER key and processes it. For example, a multiline text box control allows the ENTER key to be pressed when it is selected to insert a new line character in the control.
MyDUMeter: a .NET DUMeter clone
|
|
|
|
|
THANK YOU VERY MUCH!
Your help is as always very much appreciated!
|
|
|
|
|
Does anyone know how to change the cursor's hotspot at run-time?
|
|
|
|
|
Hotspots are specified within cursors themselves, so you need to dynamically change the cursor to one that has the particular hotspot coordinates you desire. So you will need to create your own cursor(s). Then you can just do:
Cursor.Current = new Cursor("C:\\MyAppDir\\MyCursor.cur");
Cheers
|
|
|
|
|
This will not work because I am going to be creating the cursors from scratch as the program runs.
|
|
|
|
|
i have a problem display the contents of my xml File. im testing it..and telling windows to display a Messagebox with the XmlTextReader.Value and it always comes up with a empty message box. even though my xml file contains a value (a ElementString) My Xml Contains the following :
<br />
UserPreWrt = new XmlTextWriter("NetTextPrefrences.xml",null);<br />
UserPreWrt.Formatting = Formatting.Indented;<br />
UserPreWrt.WriteStartDocument(false);<br />
UserPreWrt.WriteDocType("NetTextSetOptions",null,null,null);<br />
UserPreWrt.WriteComment("TestFile");<br />
UserPreWrt.WriteStartElement("DataEntry",null);<br />
UserPreWrt.WriteElementString("LastUpdate",DateTime.Now.ToString());<br />
UserPreWrt.WriteElementString("GlobalOpacityLevel",MFD.MainFormOpacity.ToString());<br />
UserPreWrt.WriteEndElement();<br />
UserPreWrt.WriteEndDocument();<br />
UserPreWrt.Flush();<br />
UserPreWrt.Close();<br />
to Retrieve the xml File i use the following code from within my program
<br />
private void ReadXml(){<br />
XmlReader = new XmlTextReader("NetTextPrefrences.xml");<br />
while(XmlReader.Read()){<br />
switch(XmlReader.NodeType){<br />
case XmlNodeType.Element:<br />
switch(XmlReader.Name){<br />
case ("GlobalOpacityLevel"):<br />
MessageBox.Show(XmlReader.Value);<br />
break;<br />
case("LastUpdate"): MessageBox.Show(XmlReader.Value);<br />
break;<br />
}<br />
break;<br />
}<br />
}<br />
XmlReader.Close();<br />
}<br />
Thanks for the Help
Jesse M
The Code Project Is Your Friend...
|
|
|
|
|
I have overrided the OnKeyDown method in my UserControl derived class. I use a switch statement to check if it is one of the arrows, and if not, it goes to the default case, that activates a textbox. I want the key that was pressed to be put into the textbox, but if the key pressed was 'k', when i try and put it in the textbox, i get 'K' - it is always capitalised.
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
|
protected override void OnKeyDown(KeyEventArgs e)
{
switch(e.KeyCode)
{
case Keys.Up:
MoveUp();
break;
case Keys.Left:
MoveLeft();
break;
case Keys.Right:
MoveRight();
break;
case Keys.Tab:
case Keys.Enter:
case Keys.Down:
MoveDown();
break;
default:
break;
}
base.OnKeyDown(e);
}
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
|
thats not what im looking to do, its that i want to find out what ey was pressed.....i know i can do e.KeyCode, that always gives a capital letter, what if a lower case letter was pressed?
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
for that u need to check the status of SHIFT or CAPS lock
|
|
|
|
|
Nnamdi Onyeyiri wrote:
what if a lower case letter was pressed?
if(e.KeyCode == 'K' || e.KeyCode == 'k')
{
// your stuff here...
}
Nick Parker
The only man who never makes a mistake is the man who never does anything. - Theodore Roosevelt
|
|
|
|
|
the compiler says that you cannot use '==' to compare Keys to a string/char.
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
Nnamdi Onyeyiri wrote:
the compiler says that you cannot use '==' to compare Keys to a string/char.
This works:
protected override void OnKeyDown(System.Windows.Forms.KeyEventArgs e)
{
if(e.KeyCode.ToString() == "K" || e.KeyCode.ToString() == "k")
MessageBox.Show("You hit K or k");
base.OnKeyDown(e);
}
Goodnight... I'm
Nick Parker
The only man who never makes a mistake is the man who never does anything. - Theodore Roosevelt
|
|
|
|
|
|
Nishant S wrote:
Anyone here knows how to have a remote object that has a method that returns a MFC object? How do you make an MFC object that is remotable? Or is this impossible?
I have tried something like this on a control. But every thing that crosses the boundries needs to Serializable or derive from MarshalByRefObject. Unfortunately, many eventargs is not serializable and those events cant be used. This was via a custom "proxy" i did. I could send you what I have.
O btw this was for my Plugin Manager article. Wanted to attempt to use it on a control. But never uploaded it, as it was rather limited. Writing your own classes seems to be better when going for remoting.
Hope this is what you wanted to know
MyDUMeter: a .NET DUMeter clone
|
|
|
|
|
Nishant S wrote:
How do you make an MFC object that is remotable? Or is this impossible?
Can't you serialize it and then reconstruct it when you receive it?
Nick Parker
The only man who never makes a mistake is the man who never does anything. - Theodore Roosevelt
|
|
|
|