• Welcome to Valhalla Legends Archive.
 

Storing Information

Started by FrOzeN, February 13, 2006, 01:41 AM

Previous topic - Next topic

FrOzeN

Atm, I'm working on a Chat Bot. One of the features it has is multiple tabs so you can have more than 1 connection open in a single form (not MDI).

As you can only ever see (say one RichTextBox; chatscreen) at any given time. Would it be best (in VB6) to have a control array of RichTextBox's with each bots info, or a array in the background storing the other's information and it gets written in upon tabs changing focus.

Thoughs?
~ FrOzeN

Joe[x86]

I'd create a control array of classes which represent a connection, and in that class have a string that will hold rtb.TextRTF. Of course, then calling AddRTB on hidden bot's will be a pain, but it is nowhere near impossible.
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

FrOzeN

I just thought a control array would be a bit ewy. I find there's no need to store anything in controls that arn't visible, when plain text in general arrays serves the same purpose. I can implement it with ease, just more wondering on other opinions as to all the open-source codes I've seen floating around just use Control Arrays. Not sure if it's there coding slacking off, or the best way..
~ FrOzeN

Yegg

Why not just create a new RichTextBox control for each time a new tab is added? You can simply force all controls except for one to be invisible. And display only the RTB that corresponds with the selected tab. This may be more memory consuming, but it will also allow you to see the current text from each logged in account immediately as you switch tabs, without having to store anything in an array.

Mystical

 RTB() LISTVIEW() are probley the best ways of going on about this then you can just store ur user information info a type, If you wanna store the data then when switching tabs and with all your loops its gunna hurt, loops and fors are just a bad idea when it comes to somthing of this size and when u could be switching constantly, gunna be alot more slower and use some memory, i released a few open sources on the differnce about this.. 

  For a better idea of this, you can simpley load a new project, and load 100 new RTB()s and 100 LISTVIEW()s
memusage only goes up like 113k, but if you put it in other arrays, your looking at alot more....     

--- my lil post here was typed newbly, forgive me.


Eric

Obviously loading multiple objects results in multiplied memory usage and servere decrease in performance as well.  Your only logical option is to store the text from the chat windows which are not in view.

l2k-Shadow

I suppose the only two ways to tackle this would be to either create an index on the given RTB and then load new RTBs with new profiles.. or have one RTB and somehow store the text from all the profiles.. and unless you find an efficient way to store the text outside the program's memory, both ways will rape your memory pretty hard.
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

Yegg

Quote from: l2k-Shadow on February 13, 2006, 10:20 AM
I suppose the only two ways to tackle this would be to either create an index on the given RTB and then load new RTBs with new profiles.. or have one RTB and somehow store the text from all the profiles.. and unless you find an efficient way to store the text outside the program's memory, both ways will rape your memory pretty hard.

Perhaps he could use your idea of keeping a single RTB, but store all the current text of the RTB in a .rtb file. Doing this, you could clear the RTB's text and reload it with the correct .rtb file for each time a different tab is pressed.

MyndFyre

Quote from: Lord[nK] on February 13, 2006, 09:55 AM
Obviously loading multiple objects results in multiplied memory usage and servere decrease in performance as well.  Your only logical option is to store the text from the chat windows which are not in view.

But typically since the controls that are hidden do not consume the working set, the change in memory usage is not particularly relevant beyond the stored text, which is being consumed anyway.

Have you ever seen how much smaller the working set is of a program when it is minimized than when it is in use?  And it's not that the time used to write to the pagefile will be significant for such a pithy amount of memory.

I could see this being a problem if the controls took like, 25mb of memory each.  But that's simply not the case.  In a cursory test generating tab pages on the fly, my program started at 15mb of memory usage and never exceeded 17 after making 20 tab pages.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Stealth

Quote from: Yegg on February 13, 2006, 10:27 AM
Quote from: l2k-Shadow on February 13, 2006, 10:20 AM
I suppose the only two ways to tackle this would be to either create an index on the given RTB and then load new RTBs with new profiles.. or have one RTB and somehow store the text from all the profiles.. and unless you find an efficient way to store the text outside the program's memory, both ways will rape your memory pretty hard.

Perhaps he could use your idea of keeping a single RTB, but store all the current text of the RTB in a .rtb file. Doing this, you could clear the RTB's text and reload it with the correct .rtb file for each time a different tab is pressed.

You would not want to do this. Disk access is highly inefficient, and unless you have hundreds of chat windows open to the point where your RAM is severely impacted by storing their contents in memory (by either method in the debate), there really is no reason to go to the hard drive.
- Stealth
Author of StealthBot

Zakath

Yes, as Myndfyre pointed out, the best solution here is to maintain separate controls and hide them. The ones not in the active display consume very little memory. As a quick illustration of this...this classic screenshot of a minimized application:

Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.

Mystical


I kinda liked that idea of storing the rtb data into an .rtb, but then again, you'd have to continuously add to each .rtb for the tabs that are NOT selected so you don't lose track, but even though RTB() would be icky, its the best way of going about things..

What does everyone else do? because i know a few of you here have created a bot with atleast a

  Friends List, Clan Listings, Channel Users. So do you have seperate ListViews or Just one and store the rest of the data for each tab not Selected?

Zakath

Quote from: MyStiCaL on February 13, 2006, 02:24 PM

I kinda liked that idea of storing the rtb data into an .rtb, but then again, you'd have to continuously add to each .rtb for the tabs that are NOT selected so you don't lose track, but even though RTB() would be icky, its the best way of going about things..

What does everyone else do? because i know a few of you here have created a bot with atleast a

  Friends List, Clan Listings, Channel Users. So do you have seperate ListViews or Just one and store the rest of the data for each tab not Selected?

...Did you miss the bit where we explained why a .rtb was a HORRIBLE idea? Reading and writing to disk is SLOW. You do not want your application doing that constantly during execution!
Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.

MyndFyre

Quote from: MyStiCaL on February 13, 2006, 02:24 PM

I kinda liked that idea of storing the rtb data into an .rtb, but then again, you'd have to continuously add to each .rtb for the tabs that are NOT selected so you don't lose track, but even though RTB() would be icky, its the best way of going about things..

What does everyone else do? because i know a few of you here have created a bot with atleast a

  Friends List, Clan Listings, Channel Users. So do you have seperate ListViews or Just one and store the rest of the data for each tab not Selected?

For the previous iteration of JinxBot (that never got finished), I had developed a user control that had a rich text box along with docked panes on the sides and a flat combobox.  This is similar to how I'm doing the new JinxBot as well.

I would then add one of these user controls to fill up the tab page.  This had the added bonus of self-managing any kind of layout issues (resizing and whatnot).
Quote from: Zakath on February 13, 2006, 02:59 PM
...Did you miss the bit where we explained why a .rtb was a HORRIBLE idea? Reading and writing to disk is SLOW. You do not want your application doing that constantly during execution!

Are you referring to a file?  In which case, are you being snobbish about technical terminology?  :P
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Mystical

 that's why i still said the control and not .rtb file would be still better about do this.