How To Efficiently Use Weakreferences
Jul 24, 2011
I neeed to create a dictionary that holds objects with a large requirement in memory. Therefore i need to make them a weak reference.I created a dictionary with an ID and a weekerence that holds my object.The annoing thins is that as soon as i finished filling up my dictionary the garbage collector has already reclaimed all of them despite there is a large quantity of RAM avaible and I did not call the gc.collect.
View 2 Replies
ADVERTISEMENT
Nov 30, 2010
What is an easy to implement way to communicate between 2 vb.net (3.5) form applications that are running on the same machine?
The current problem is that in each program a user needs to be logged into to use. If the user is logged into one, and clicks a button to launch another, it should pass who is logged in so they do not need to log in again in the second program.
View 2 Replies
May 23, 2011
I have 20 PictureBoxes named PictureBox2 through to PictureBox 21, where I need to conditionally set the positon of them. I was wondering if there is a more efficient way to set their positions than to copy the code out 20 times. This is what I have so far:
For NextPos As Integer = 2 To 21
Select Case Direction
Case 1
[code]....
View 4 Replies
Jan 5, 2011
It seems to work fine for a small text file but when I use files larger than 100MB it does not give me an accurate count.The program is pretty simple. It should return the number of occurences of a substring from within a text file. I look for a match to the first character of the substring and if found then my code should test to see if the whole substring exists.I have run several tests but for some reason I am not getting an accurate result. I used the windowsupdate.log file. My code trturned 34596 hits but when I used MS Word to find the number of occurences it returned 50096 [code]
View 3 Replies
Jul 7, 2009
i need to use my gridview by using only the keyboard.My clients prefer keyboard rather than using mouse. How can i use my gridview like that?What all events should i use?
View 1 Replies
Dec 16, 2009
I'm making a program as part of a college assignment that requires my to add up the contents of an array. Now the array has 20 places, and the only method I know of atm is:a + b + c + d + e etc...They are all different numbers so I can't just do a * 20, I need a more code efficient way of adding all these numbers up, is this possible?
View 10 Replies
Jul 25, 2009
I need to draw 100 lines between 100 semi-random points in a 800x800 pixel square on the screen.
I've been using the built-in drawlines & drawrecangles functions inside of .NET, but my drawing gets erased everytime the form paints.
So, I've been thinking about perhaps drawing to an in-memory bitmap, but I'm not sure if that's a good solution.
View 5 Replies
Jan 13, 2010
i have a custom SiteMapProvider which I populate from a database. I also have a custom SiteMapNode which has to be constructed with a custom Page argument.[code]Should I return false in AuthorizeCore() to have everything work according to default authorization protocols? (What are these?) Or should I throw my exception.SiteMap.CurrentNode is Null / Nothing (in AuthorizeCore()) if the page which is requested is not accessible to the user (obviously). How should I change my implementation? I want to keep the functionality that the Page objects are only loaded once, so I need to store them somewhere.
View 1 Replies
Sep 12, 2010
I am writing a small tool that identifies digital scielence in non compressed PCM WAV files. Its purpose will be to scan files approximately 1 hour long, containing mostly scilence and spltting the periods of non scilence into files and discarding any digital silence which is encoded as null bytes.I am wondering what the most efficient way of scanning the files is. I am able to derive the number of bytes for each second from the file header (in my case 16000) so am considering reading into a buffer of this size then scanning byte for byte, if I identify a non-null byte I will start siphoning the data off to another file.My issue is with scanning large expanses of digital silence which could be many megabytes of data which would require examining each byte to determine wether or not its digital silence. Surely there is a more efficient way of skipping them as I am not interested in them.
View 7 Replies
Mar 3, 2009
What is an efficient way (must be performed in a loop quite often) for getting the difference between two timestamps that come in form of DateTime-variables?
View 1 Replies
Feb 23, 2009
I've been trying to improve the efficiency of my giant program and I know that using a textbox to deal with a string is terribly inefficient.
Function CollectionSplit(ByVal TheString As String, ByVal TheSeperator As String)
Dim tb As New TextBox
tb.Text = TheString.Replace(TheSeperator, Environment.NewLine)
Dim returnable As New Collection
For Each x As String In tb.Lines
If Not x.Length = 0 Then returnable.Add(x)
Next
Return returnable
End Function
What it does is convert a string of "1,2,3" into a collection of the 3 separate items for use later on.
View 1 Replies
Nov 19, 2011
Basically I want to store an integer efficiently. At the moment I'm using Button1 Click' Or whatever I need it for Label1.text+0 But to do this I need to add in another Label and set it to visible.
View 6 Replies
Jun 21, 2010
I'm attempting to create and populate a table in a new Microsoft Access (Jet) database using VB.Net 2008 Express under Windows XP Pro SP3. The database and table are being created properly, but loading the table proceeds VERY slowly. When I am loading the table, no complicating factors that might impact performance, such as indexes or table relationships have been defined. The table to be loaded is made up of relatively short rows consisting of three single byte columns, and one (four byte) integer column. I am loading approximately 16 million rows, and this is literally taking hours, while the same data can be interactively imported into Microsoft Access from a .csv file in minutes. I am trying to batch load the rows, 64K rows at a time, in order to avoid the overhead of individually transacting/committing each row individually, but suspect that I must not be doing something right. Key code that I am using for this process is provided below.
[Code]...
View 3 Replies
Jun 20, 2010
Is there any way to have the program still run efficiently when connecting to an mysql database? Would System.Windows.Forms.Application.DoEvents() work anywhere?I have it connecting every 3 seconds on a timer and during that connection the program locks for a second.
View 2 Replies
Jul 26, 2010
In VBA / VB.NET you can assign Excel range values to an array for faster access / manipulation. Is there a way to efficiently assign other cell properties (e.g., top, left, width, height) to an array? I.e., I'd like to do something like: Dim cellTops As Variant : cellTops = Application.ActiveSheet.UsedRange.Top..The code is part of a routine to programmatically check whether an image overlaps cells that are used in a workbook. My current method of iterating over the cells in the UsedRange is slow since it requires repeatedly polling for the top / left / width / height of the cells.I'm going to go ahead an accept Doug's answer as it does indeed work faster than naive iteration. In the end, I found that a non-naive iteration works faster for my purposes of detecting controls that overlap content-filled cells. The steps are basically:
(1) Find the interesting set of rows in the used range by looking at the tops and heights of the first cell in each row (my understanding is that all the cells in the row must have the same top and height, but not left and width)
(2) Iterate over the cells in the interesting rows and perform overlap detection using only the left and right positions of the cells.[code]
View 2 Replies
Jun 11, 2012
I'm attempting to make a generic query executer function. I want to be able to send it a query string and have it return a two-dimensional array containing the results. Below is my code for how to do it with a (9,x) array. How can I do it with an (y,x) sized array? Also, I feel like there must be a more efficient way to do this..
[Code]...
View 3 Replies
Aug 6, 2009
I have a form which contains a large number of textboxes covering numerous panels/tab controls and I would like to have the user only have one text box visible at a given time and when the user clicks on the screen to another label with a corresponding text box I would like that to appear and the other currently open to disappear. Currently I have the following loop that goes through and changes the visibility of the appropriate controls unless it is the name of the control I am looking for:
'This is used to iterate through all the controls in the form and ensure the visibility of all other controls
' than the active control is set to false.
[Code].....
View 8 Replies
Sep 23, 2011
We have a GIS application that has some performance issues. It creates and sends an image to a web browser. We start with a Bing Maps imager, add complex polygons (complete with transparent fill), save the finished image as a PNG, and send it to the browser.
The idea has come up that we could possibly install a graphics card and use DirectX or OpenGL to improve performance. I believe this would be the case even though we ultimately generate an image instead of sending the data the the screen. I believe our processes could still make use of the API and the hardware acceleration it provides. Our process is not unlike what CGI film makers do to render individuals frames of a film, though we simply render a single image and send it, as opposed to the hundreds of thousands of images needed for a single CGI film.
So my question is: would a powerful graphics card and use of DirectDraw or OpenGL provide us a worthwhile performance boost? It can take us 20-30 seconds to render a more complex map. Which is a long time to wait on a web page...
View 10 Replies