|
He means "How do you know it doesn't work? Do you get an exception? If so, what is the message?"
Your original question is vague, and not answerable. You need to provide better information.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
No where did you say what errors you was getting or any exceptions. "It does not work" is not at all helpful in any way in describing your problem. How do you know it doesn't work? Did you get an error? Did you get an exception? Did your harddrive melt? We can't see your database or read your mind.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
catch (OleDbException)
{
ok = false;
}
What is the point of catching an exception if you then throw it away?
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
|
|
|
|
|
In fact I have another idea that will start with this idea, in fact I have a WPF application, following the click on the button I want to select the name of the database via an open file dialog and display the name source in textebox, the method returns a message box to display the exception, but I used the bool type because my class is linked to a library and I can't use the message box
|
|
|
|
|
So have you heard of Debug.WriteLine() ?? Wihtout the exception messages, it's pretty much impossible to tell you what's wrong with any accuracy.
|
|
|
|
|
if you are under win7 x64 make sure target solution's plateform is x86
|
|
|
|
|
Hi! I am renewing a program I made in a university-class in Java.
The program is a library system where you can save books as objects, customer as objects and then make a loan.
In the old program we saved to disc in a binary-file.
How would you do it in C#?
I also been thinking about LINQ (which I don´t know very much about), is that and alternative?
I final question is if It is a good design or if it would have been better to man a traditional relationship database with no objects.
|
|
|
|
|
larsp777 wrote: In the old program we saved to disc in a binary-file. How would you
do it in C#?
The direct "translation" is .net serialization[^]. You don't need to use the binary formatter described, there is an XML one too (and a SOAP one, but the isn't useful in this context) or you could write your own. Note that it (the binary one) almost certainly won't deserialize the Java files properly.
Personally, I wouldn't store anything "complicted" (say with relations or mutliple rows) this way unless I had really good reasons to. You mention LINQ, "LINQ to SQL" and "Entity Framework" are good ways of persisting data and are similar to eachother. You should Google these. A third (non-Microsofty) option is NHibernate, it has similarities to the Entity Framework, but comes with the added advantage, from your point of view, that there is a Java Equivalent ("Hibernate") so by learning one, you learn the Java version (mod any documented differences).
larsp777 wrote: I final question is if It is a good design or if it would have been better to
man a traditional relationship database with no objects.
If I understand you correctly, I'd always go for proper relational design, but that doesn't mean you lose good OO at all. The Entity Framework pretty much expects proper relational design (if you design the DB first, it creates well normalised Schema from an OO model if you start with the model first). NHibernate works better under a properly normalised DB too, but is more forgiving of mismatches between the OO and the DB. That said the same things that drive good OO desgin tend to drive DB schemas: A type is pretty much a table, a property to a simple type pretty much a field and a property to a custom class a relationship to another table. Many-to-One maps to a list property at one end and a single property at the other, Many-to-many has maps to lists at both ends.
My advice is to try Entity Framework, starting with the model. Some people have reported performance problems on large data sets, but you can pre-compile LINQ queries and even go the whole hog and use Stored Procs so the perforance is comparable with a little work and you gain more than you lose IMO.
modified 22-Apr-12 6:59am.
|
|
|
|
|
Thanks!
The course we took in university was alot about OOP. So that was probably the reason we did it this way, to learn OOP.
|
|
|
|
|
larsp777 wrote: I final question is if It is a good design or if it would have been better to
man a traditional relationship database with no objects.
Depends what you really mean.
If you really want to store a binary image of a book into a database then you have two choices
1. Store it as a blob
2. Store it as a file with a link reference in the database.
However if you want to store information about a book, then you should be using a relational database.
|
|
|
|
|
Hi.
Yesterday I started a new project. It's about a bitmap checker which check if the bitmap it's modificated in photo editor or not. The funny problem is that my application doesn't recognize if a bitmap file is modificated in Paint, but it's recognize if a bitmap file is modificated in Gimp/Photoshop and other .
Is a possible way do recognize a bitmap file modificated in Paint? How I can do that? Can you give me a clue?
I want to specify that I check with the ExifInformation but it doesn't give me the information about de *.bmp files.
I tried with the length of image, but it doens't work because it have the same length with the original bitmap file.
I am sorry for my bad english.
Thank you in advance.
|
|
|
|
|
Create a hash of the contents of your original file and save this information. Then when you want to check it, hash the file again and compare the hashes.
|
|
|
|
|
I can do that if I have the both file and I check the both file . I want to check just with a single bitmap file and application to say if it's modificated in Paint or not. I am sorry because I wan't so precise .
Thank you for response
|
|
|
|
|
You don't need to have a copy of the original to check it. All you need is to write the hash to a file. This is a common technique for scenarios where you want to identify if the file changed.
|
|
|
|
|
Sorry, I dont't get the point . To compare the hash of files you need 2 files .
Let's say that a friend give me a bitmap file to check if is modificated in paint or not . How I do that ? I can't compare the hashes because I have just a file .
|
|
|
|
|
Ahhh. I see what you are after here. Sadly for you, you're stuffed here. There's no way, given a single source file, for you to check if Paint modified the file.
|
|
|
|
|
amx_tiger wrote: but it's recognize if a bitmap file is modificated in Gimp/Photoshop and other
How do you recognise these changes, and why can you not use the same test for MSPaint?
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
|
|
|
|
|
I use Flags from Bitmap Properties, Image.Flags Property to recognize these changes , but on Paint doesn't work . My application detect these bmp modificated in Paint like unchanged/original.
Thank you for response
|
|
|
|
|
amx_tiger wrote: I use Flags from Bitmap Properties, Flags Property to recognize these changes
How?
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
|
|
|
|
|
|
amx_tiger wrote:
if (flags.Contains("a value") || bitdepth.Contains("32"))
According to the links you provided above, the Flags field is of type System.Int32 , and the PixelFormat value is an enumeration, so I do not see what the above test is based on, or how it works.
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
|
|
|
|
|
Simple answer; you can't.
I'm going to make it worse; if you claim that you app "detects" a modified bitmap, you'd be legitimizing a cheater. The cheater would simply take a hex-editor and change those flags, and you'd be standing there with the app that claims that it was "not modified".
You want a clean game? Have a witness
Bastard Programmer from Hell
|
|
|
|
|
I still haven't seen a smart cheater. Do you?
So, I can't see if the bitmap was modified in Paint ? Any solution?
Almost all the bitmap checker application / script I know doesn't recognize the bitmap which was modified in Paint.
|
|
|
|
|
amx_tiger wrote: I still haven't seen a smart cheater. Do you?
I know quite some, but they don't play games anymore.
amx_tiger wrote: So, I can't see if the bitmap was modified in Paint ? Any solution?
Depends on circumstances. Are all computers under you control? If so, create a small app that draws a red pixel in an unknown location - it should show up on every screenshot. (..and no, that's merely a bump, not a protection)
..or perhaps CS puts a watermark in it's screenshots. That would be neat, but I doubt that they do. Even if, wouldn't stop anybody from using the print-screen button.
amx_tiger wrote: Almost all the bitmap checker application / script I know doesn't recognize the bitmap which was modified in Paint.
Paint (or other apps) don't distinguish between an original file and a duplicate. As far as they're concerned, a bitmap is a description of colors and points, and it looks exactly the same in binary if it's a duplicate.
Bastard Programmer from Hell
|
|
|
|
|
amx_tiger wrote: So, I can't see if the bitmap was modified in Paint ?
If Paint does not add some specific documented signature then you will not be able to.
amx_tiger wrote: Any solution?
Check the last modified date against the created date.
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
|
|
|
|