It is not really possible to tell if it's encrypted since, if it is done properly, there is not information in the file about the encryption method or keys. And a file is just a stream of bytes, so an encrypted file looks just the same as an unencrypted one.
That's not an audit-trail, but an indication who made the last change.
heh, I realise, couldn't think of a better term for it.
Eddy Vluggen wrote:
The database - that way it won't matter whether it's a webservice, a WinForm or any other UI/app reading from the database.
As EF is 'creating' my database, and with migrations keeping it up to date, does that mean I add it there as C# code?
Or somehow make the migrations side run additional sql to either add trigger or constraint etc?
I have a grid with empid's now if a person selects 2 grid by selecting checkboxes and click on download button 2 files should be offered to download.
I know that we can create a file and can send the location of the physical file.
But is there a way i can stream the files
public ActionResult GetFile()
var theStream = new Memorystream();
// create your file and add to memorystream or open a filestream instead.returnnew FileStreamResult(theStream, string appropriateContentType);
Hello. I am using an ActiveX plugin (which is freely available) in .Net to play videos. Now whenever I switch from Code View to Designer View, Visual Studio 2010 crashes and restarts itself. I have tried to start the VS2010 as an administrator but in vain. What could be wrong and what could I try to prevent this? Thanks for any pointer.
This world is going to explode due to international politics, SOON.
From the point of view of that ActiveX control, its use on a form may look like "run-time" instead of "design-time".
In your code (constructor of the form, InitializeComponent), determine run-time/design-time and set some properties of that control accordingly (is there an Enabled property or something like that?).
public Type t;
return s.GetHashCode() ^ t.GetHashCode();
publicoverridebool Equals(object obj)
_Key o = obj as _Key;
if (o == null)
if (s == o.s && t == o.t)
and it yielded 60ms. Seems kinda pricey still. Compared to the Type key alone (20ms).
EDIT: tried something else... made the key an int and called GetHashCode() on the object to get the key. That knocked it down to 40ms.
EDIT #2: tried just returning the GetHashCode() on one of the members. Type = 50ms, string = 50ms.
Not really sure of a better way to implement GetHashCode().
It's really that simple. I know that's only 1 key, so my mileage may vary with a bunch of keys. I tried that same thing with various types to get the benchmarks I originally posted.
HOWEVER, I had a brilliant break through haha. Would something like this work?
Dictionary<int, string=""> dict;
Now, instead of overriding the GetHashCode and IsEquals, I just have a method:
public int GetKey(string s, Type t)
return s.GetHashCode() ^ t.GetHashCode();
whenever I want to insert a new object, I call GetKey() on it and use that as the key?
As I'm typing this, I'm beginning to poke holes in this idea... there would be no way to retrieve the string and type as I would just be keying off the hash code.
I'm also wondering if it would be possible to get two s and t combinations that produce the same key? Theoretically, I'm assuming the .net hash functions are strong. Although since I wouldn't be inserting the _Key struct into the list (and thus not override the IsEqual(), the dictionary wouldn't know for sure it was grabbing the right one...
If I do it "right" and insert the _Key, that's 60ms... better then 120ms or 590ms I guess.
It will probably be difficult to beat the inbuilt hash code functions for the general case
however there might be something about your specific data that you can exploit to make a stronger hash function
Example: If you know the first 4 chars of your strings are nearly always unique, you could just turn those into the 32 bit hash. This would save .NET framework from hashing the entire string so it will be faster.
It will also be stronger because you used knowledge specific to your data (Eg, the first 4 chars are enough)
If there are any features of your keys like above you can exploit. The chances of doing better than the inbuilt stuff will be much better
Yes, I was running in debug with the debugger attached. I understand it is a trivial / not full scope test. However, I did the same test on all the various types I mentioned to get a *rough* idea of the differences before I implemented the real thing.
I think seeing that an int was 10ms and a struct was 590ms is pretty indicative the struct is not a good solution (without overriding the IsEquals and GetHashCode methods).
I did try hack in the _Key struct with the overridden IsEquals and GetHashCode methods into my real test application & class that does a lot with the values. I did not use the int key hacky thing I was questioning as that wouldn't work.
My original dictionary<type, someclass=""> took 110ms to run 1M iterations with the debugger attached and 3 items in the dictionary in the real application. Switching it to _Key and properly initializing the struct and the real hash code method bumped it up to 140ms to 150ms. So it actually added 30ms to 40ms of overhead which is what my trivial benchmarks kinda showed it would with 1M iterations.
FYI: Just for fun, I tried commenting out the IsEquals and GetHashCode overrides and it slowed to a crawl @ 1390ms! Wow. That is a lot more then I thought it would.