User Profile
Collapse
-
Yes I actually found that BigInteger datatype an hour or two after posting this and it does seem to solve the problem but thank you for your comment. -
Binary Number Generation
Hello.
I want to be able to generate large binary numbers in C#, based on an integer, and later perform a bitwise operation on them - I'm talking being able to support numbers up to (and hopefully even beyond, just in case, 2^100)
The basis is that I have a database table with roughly 70 rows, each row has a unique identity value (1, 2, 3, 4, etc) and from that ID I want to generate a matching binary number, something... -
Computed Binary Field
Hello.
I have a table with a primary key, identity value. In addition to some other fields I also have a computed field to generate a binary identifier for the row based on the identity value (eg. PK ID of 1 would generate a binary ID of 1 (Power(2, [1] -1) = 1), PK ID of 4 would generate a binary ID of 8 (Power(2, [4] - 1) = 8). The problem is that there are +70 rows in this table so the binary ID gets quite large - out of the scope... -
I think that's done it, forgot all about HttpRuntime.
Thanks PRR.Leave a comment:
-
IHttpHandler and Web Caching
Hello.
I have a class implementing the IHttpHanlder interface within a Website project. Through this class I am able to access variables in the Session object and Application object that have been set through the website. I don't seem to be able, however, to access variables stored within the Cache object. I can't think of any reason for this. I know in order to access the Session variables I need to implement the System.Web.Sess ionState.IRequi resSessionState... -
(C#) Pass multiple enum values to function
Hi all,
A constructor for System.Text.Reg ularExpressions .Regex includes a 2nd parameter for the RegexOptions enum. With this you can pass multiple RegexOptions as below:
My enum...Code:System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex("PATTERN", System.Text.RegularExpressions.RegexOptions.IgnoreCase | System.Text.RegularExpressions.RegexOptions.IgnorePatternWhitespace) -
Change Recovery Mode from Full to Simple
Hello all,
The HDD that holds the logs for one of our DB servers has run out of space (More has been ordered). Part of the reason for this is the log files have gotten rather large, as such the decision to drop the recovery mode of a few of the DB's to simple was reached. Daily differential backups are taken and this is enough for us at the moment. Now, what is the best practice way to change the recovery mode from Full to Simple?... -
-
-
Cheers.
The only other option that I can really think about, aside from reading some DB value (as the whole point of caching is to avoid DB calls) is to have a CacheDependency on a file and simply update that file through the admin system; thus the cache for the website will expire.Leave a comment:
-
Double post, see below.Leave a comment:
-
Thanks, I did read that but it didn't fully delve into what I was after. I have learnt, though, that this is not possible.
Is there a way, then, of two different projects being able to manipulate the Cache items of one another? For example, say there is a .NET website and a .NET admin section for that website. The dream is to have the 2 as seperate projects so that a deploy of the website doesn't mean a deploy of the admin, and vice...Leave a comment:
-
.NET Caching and App Pools
Hi,
As far as .NET caching goes on IIS, if 2 .NET websites are in the same app pool can they access the same cache items (Using HttpContext.Cur rent.Cache) ? Or is this cache collection always seperate for each .NET application?
Cheers -
Correct, but my question centred more around that one method only required one connection to the db to perform multiple queries; but it also meant that it was bringing back a bigger result set.
So the question, really, is the time it takes to transform those multiple result sets into a datatable faster than using the mutiple db connections needed if they were returned as single result sets?Leave a comment:
-
Multiple Queries vs Dataset
Hello all.
I was wondering if there is much of a performance difference between multiple DB queries, which return a single datatable, vs a single query that returns multiple datatables.
eg:
vsCode:DataTable dt1 = "SELECT * FROM tbl" DataTable dt2 = "SELECT * FROM tbl2" DataTable dt3 = "SELECT * FROM tbl3"
...Code:DataSet
-
Table Data from Name
Hi.
Pulling back table information is easy enough;
However, I want a stored proc to be able to pull back all data from any table simply by passing the name of the table in. Aside from dynamically generating TSQL within the stored proc, is this possible?Code:SELECT * FROM information_schema.tables WHERE TABLE_NAME = 'pubs'
Cheers -
Reflection
Aside from looking at a types namespace / assembly name; is there any way to distinguish if a class is .NET inbuilt or a custom one?
Basically, I want a function that accepts an object as a parameter. Using reflection the properties of that object are iterated through and the resulting property names / values are added as SQL Stored Proc params. This is easy enough for the parameters in the original object... but if, say, one of those... -
There are options using reflection, and even options to dynamically generate functions/classes.. but for my purposes I found using generics worked.
It works the same as a list or dictionary, in which you specify the return type in the method call; for an example in a datalayer:
...Code:private List<T> SetReturnTypeObjects<T>(DataTable source) { List<T> returnListLeave a comment:
-
Yes but I didn't want to have to cast it everytime I call the function:
As opposed to:Code:CustomClassA obj = DoStuff(typeof(CustomClassA)); CustomClassB obj2 = DoStuff(typeof(CustomClassB));
I've seen it done with nhibernate. Basically it decides the return type at runtime.Code:CustomClassA obj = (CustomClassA)DoStuff(typeof(CustomClassA));
Leave a comment:
-
Conditional Return Type
Hello all.
How is it possible for a function to have a conditional return type, based on the type of an argument passed into it?
While this is invalid, something like:
Code:public List<source.GetType()> PerformAction(object source) { // do stuff... }
No activity results to display
Show More
Leave a comment: