Is It More Efficient To Use UInteger Instead Of Integer
Nov 7, 2009
if there is no need for my variable to store negative values, is it more efficient to use UInteger instead of Integer? both are 4bytes and i've got a feeling unsigned works faster though i'm nt sure about it. note that the range of my variable is 0 to 2147483647, hence i could use a UInt32 or Int32 and both would give me the same result so i'm wondering about optimum performance.
View 7 Replies
ADVERTISEMENT
Jul 21, 2010
Why is it that in parts of the .Net architecture that ARGB colours are expected be as type Integer when ARGB is outside the range of Integer? (ARGB requires 32 bits of precission, but Int has 31 bits of precission).Now of course I could just do a conversion, but what freaking conversion to use??? (I'm not affluent with all the VB global methods and the sort)
I've tried things like:
Code:
Dim value As Integer = &H80000014
Dim uvalue As UInteger = CType(value, value)
''overflow others include Convert.ToUInt32 -> value was either to large or to small and a few others all offering up nonsense about overflows, when all I freakin' want is a colour that Microsoft's own engineers have done stupid things like expect Integer values in places where UInteger should be, or vice versa. How about some consistency...
Code:
Dim value As UInteger = &H80000014 ''<- not represntable as a Uinteger???
Dim uvalue As UInteger = 2147483668 ''<- same value in decimal, same exact value! and it works this says it's not representable as a UInteger?
View 19 Replies
Jan 7, 2010
Here is some code I am trying to use to read a UShort and UInteger from a filestream[code]...
View 2 Replies
Apr 20, 2012
If I run the following code in C# then it runs fine
UInt32 a a = 0x9E3779B9
But when I run the same code in VB.Net then it gives me error "Constant expression not representable in type 'UInteger'"Dim a As UInt32 a = &H9E3779B9
View 2 Replies
Oct 13, 2010
I am trying to assign a constant with this value:
Public Const FIRST As UInteger = (0UI - 860UI)
View 1 Replies
Feb 25, 2010
How can I convert a Short Time to an Unsigned Integer?
View 1 Replies
Sep 1, 2010
UInteger data type hold any value between 0 and 4,294,967,295. MSDN.
If I try this code in VB.NET I get a compiler error:
Dim Test As UInteger = &HFFFFFFFF
Error: "Constant expression not representable in type 'UInteger'.
Why I can't set 0xFFFFFFFF (4,294,967,295) to a UInteger if this type can hold this value?
View 4 Replies
Nov 20, 2011
[code] I get the error message of "Option Strict disallows implicit conversion from Long to UInteger." [code] I dimensioned each variable as a UInteger and not a Long, the values for both X & Y are well below the maximum values of a UInteger as far as I can tell (Data Types Summary). [code]
View 5 Replies
Nov 4, 2010
It seems that when using With blocks in VB.NET, the resulting MSIL larger than w/o. So this leads me to ask, are With Blocks really more efficient? MSIL is what gets JITed into native machine code, so smaller code size should imply more efficient code, right?
[Code]...
View 5 Replies
May 4, 2010
Where to add this validation, or if there is a more efficient way of doing it and where to put it?
CODE:
View 6 Replies
Aug 9, 2009
How to use MVC Pattern efficient?
View 8 Replies
Jul 26, 2011
Is there a more efficient way of doing this code?
For Each row As DataRow In dt.Rows
Dim ts1 As String = row(0).ToString
For index As Integer = 1 To 9[code]....
View 2 Replies
Aug 26, 2011
just wondering which of these two sort methods would be more efficient movies.OrderBy(Function(m As Movie) m.Title)
[Code]...
View 1 Replies
Jan 5, 2010
I need to verify if a certain user exist on my asp.net site.I want to know if which of these two functions is more efficient, faster and better compared to each other and why.
[Code]...
View 6 Replies
Aug 1, 2009
I am working on an application that will need to read tons of records (close to 500,000) from one table and insert them into another set of tables in the same database. I though about using SSIS package for this but our DBAs don't want to use that. Now, I am thinking of a multi-threaded approach. I am thinking that I can have a few thread started that will read say (500) records at a time and insert them, then come back and read more.
Now, say I spawn off 3 threads of this application. The first thread reads 500 rows and starts processing them. Can I lock these rows that were already read so that the next thread does not pick them up? I am trying to find some articles regarding this on the internet, but perhaps I am not searching for the correct terms in Google.
View 6 Replies
Jul 1, 2010
I'd like to sample the data from the Arduino @ roughly 200Hz. Is there a more efficient way to do this than using a timer (which is what I am currently using)? Currently I am using[code]....
View 3 Replies
Jun 22, 2010
I have been reading books trying to learn .net on my own. I am working on an exercise that asks me to create a 1MB file. what i have below does work, but it seems to me there would be a more efficeient way. It seems like what i am doing would cause a lot of overhead. making a 1MB file easier than what i have?[code]...
View 2 Replies
Jul 28, 2009
I have a program that must initialize a table that is usually about 10-15 thousand records. I have attempted several means to empty the records from it, but it always takes several minutes to accomplish the task or in some cases like a 'bindingsource.clear' command, doesn't work at all. I currently have it working using a simple loop to go through each record at a time and 'removecurrent'. but this seems extremely inefficient and it is quite slow.The real time consumer seems to come in with the tableadapter.update and tableadapter.fill that happens after the loop.[code]
View 6 Replies
Jul 28, 2010
I've an arraylist having 30000 items in it, what's the best way of creating a text file on the fly from an ASP.NEt page? Currently I'm using the code below but it times out with large data,[code]
View 3 Replies
Mar 16, 2010
Let's say I've got: Dim los1 as New List(Of String) los1.Add("Some value")
Dim los2 as New List(Of String) los2.Add("More values")
What would be the most efficient way to combine the two into a single List(Of String)?
Edit: While I love the solutions everyone has provided, I probably should have also mentioned I'm stuck using the .NET 2.0 framework.
View 4 Replies
Nov 9, 2011
I am looping through my dataset to save my database, I thought this might not be the best way. Is there a more resource efficient of doing it?
For i As Integer = 0 To CO.Tables("CO_Del").Rows.Count - 1 'CO is my DataSet
dbCommand.Parameters.Clear()
AddInParameter(dbCommand, "@IsDelete", DbType.Boolean, 0, DBNull.Value)[code].......
View 3 Replies
Jan 15, 2010
I have a Page class and a PageCollection class in a 3d party ORM framework. I can fill the PageCollection based on parameters (pageid, parentid, url etc..) (SQL query). But I need the data multiple times around the ASP.NET MVC website (Sitemap, Authentication), so I chose to load all pages 1 time and reference that (global) collection.
GlobalClass.Pages //is PageCollection containing all pages
I have now created functions which return a temporary subcollection or single entity based on the parameters mentioned before (pageid, parentid, url etc..).
GlobalClass.Pages.GetByPageId(id) //returns single page entity
GlobalClass.Pages.GetByParentId(parentid) //returns subcollection
The site however got very slow.
cache the subcollections (GetByParent())? create internal hash-lookup tables for the collection? Something else...?
Namespace BLL
Public Class PageCollection
Inherits CustomCollectionBase
[Code]....
View 1 Replies
Jan 28, 2011
I have an ASP DataGrid and I'm applying sorting to it. Well, as I was looking at an example, they had a function similar in function, different in name, to[code]...
View 3 Replies
Jun 24, 2011
I'm trying to create an application that reads in a log file, then converts each line to a class(I'm databinding a datagrid to the finished ObservableCollection).The implementation I've done but I'm struggling to reduce the time it takes to itterate the lines and convert them to classes.small log files are fine its the larger log files (25k lines +) which is my concern. I'm wanting to do this with say a max delay of around 5secs from loading the text file.my current implemenation of a log file I have of size 85k lines is several minutes which isn't great.
[Code]...
View 3 Replies
Jan 24, 2011
We have some information that we need to write (about 18KB) to a .txt file stored in one of our network drives. The file is re-written about once every 15 minutes but is read practically at least every second. We are currently using StreamWriter to write file.The file server is in remote location and the round trip ping varies from <1ms to 15ms.
The problem is, sometimes it takes as long as 6 seconds to write the contents to the file, which is definitely way too long even after we take consideration of the network speed. therefore, I am just wondering if there is any efficient way to write the file using VB.Net to improve the performance? Java has a very good tool named BufferedOutputStream, which unfortunately is not available in VB.Net (or I just have not found it).
View 5 Replies
Dec 4, 2010
While learning to Orientate of the Last layers of a rubik's cube, I thought that it would be fun to make a vb.net application for it(I know that it's super hard to do)I'm starting around the center cube, but was wondering if I did a part right..I'm working with squares, and was wondering the length from one corner to another. [code] Trying to figure out the distance from the top left to bottom right,I used the distance formula to test it out and got 70.71067811865475 sqrt((-50-0)^2+(-50-0)^2)Is there an easier or more efficient way to get this number than using the distance formula?
View 2 Replies
Mar 18, 2011
I've been using LINQ so much in the last couple of weeks that when I had to write a one line function to remove < and > from a string, I found that I had written it as a LINQ query: [code] My question is, is it better to do it with LINQ as above or with StringBuilder as I've always done, as below: [code] Both work, the second one is easier to read, but the first one is designed for executing queries against arrays and other enumerables.
View 2 Replies
Oct 15, 2010
I made this small location class so that I can better handle address information which I am going to be sending off in requests to the Google Maps API. One thing I have left to do is some validation to make sure that the address has enough information to return a result back. For the application, the level of accuracy should be as loose as a single City (meaning that it should work as long as a zip code or city/state is provided since it will find the geographic center of that area automatically in Google Maps)
View 4 Replies
Jan 8, 2011
I was wondering what was the best way to search a database. Is it possible to perform bubble sort etc or any sort of binary search to the database instead of doing a linear search. If so how would I go about doing this through an Sql statement.
View 6 Replies
Aug 25, 2011
Ok so I have this program that shows data in a treeview and that data is from a datatable.I'm basically looping through the datatable row by row and adding nodes.The data looks something like the following:
[code]...
I have a thread that is hitting the Database (where these records are stored) every 5 seconds to see if the list is smaller,bigger or changed.If so, I was just recalling the load_form sub but this was taking too long as the lists could potentially be very large. Also, there is a lot of logic that comes into play depending on what user is displaying the records in the treeview.I was wanting to know what would be the fastest way to compare the datatable that was previously used to initially create the nodes in the treeview to a tempdatatable that has the currently updated/added/removed rows and update the treeview accordingly?The only thing I could come up with was basically looping through the tempdatatable and comparing each row to the rows in the original datatable and plucking out the ones that had no match.Then recursively looping through the nodes in the treeview to find the spot that the new node should be added (based on that datarow's values).Or is there a better way to do this and I should scrap this?
View 1 Replies