|
At least with crazy function names it becomes easy to see who copies my code.
|
|
|
|
|
Hi All,
I have a data base, and a C# application.
my application need to import and export the database from and to a XML file.
One of my tables have a DATETIME field, when I try to import from the XML to the DB I got the following error: "Conversion failed when converting datetime from character string."
What should I do?
Thanks in advance for your kind help.
|
|
|
|
|
How are you importing from the XML to DB? You may need to use DateTime.Parse to convert the date string in the XML file
only two letters away from being an asset
|
|
|
|
|
Hi Gang,
I've got an app that I built with ASP linked to a MySQL database (oh please save your BOO's ). I have a field that is encrypted with a salt value, and uses the MySQL AES_Encrypt() and AES_Decrypt() methods. The data must be stored in an ecrypted fashion, use a salt value to be re-used to decrypt it later.
Recommendations?
Thanks.
--
There are only 10 types of people in the world: Those who understand binary, and those who don't.
|
|
|
|
|
Recommendations for what?? You said you already have this stuff, so I fail to see the point of the question.
|
|
|
|
|
Encrypt/Decrypt with a salt value - not one-way encryption like MD5 one-way encryption.
Thanks.
--
There are only 10 types of people in the world: Those who understand binary, and those who don't.
|
|
|
|
|
That doesn't help. I figured that much. I still don't have a clue what you're after...
Are you looking to implement this in SQL Server instead?? (Your subject line mentions SQL Server)
Are you looking for hepl on using the MySQL functions?? A better source of information on tht would be a forum dedicated to MySQL, not C#.
Or are you looking for an entirely C# implementation of a two-way encryption, storing the encrypted value in a database field??
|
|
|
|
|
Dave,
Sorry about that. Let me clarify. I am looking for a C# implementation of a two-way encryption algorythm which uses a salt value.
I'm porting an application's data-store from MySQL to SQL Server.
Thanks!
--
There are only 10 types of people in the world: Those who understand binary, and those who don't.
|
|
|
|
|
What I want to do is to use the shadow service to deal with in-use files when backing up with 7zip.
At the moment my 7zip implementation is merely to launch 7zg with command line parameters from within my C# app. I'm using NTBackup to deal with locked files but I don't want to depend on it due to compatibility issues (no NTBackup in Vista).
So I need a way to create a shadow copy, then 7zip from it. I don't care if it's more command line tools, I just don't have a clue where to start really.
|
|
|
|
|
Extremely difficult at best. There is no managed wrapper for the Shadow Copy Service and the COM exports are spotty at best at this point. You'd be better off writing a wrapper in C++/CLI to expose the functionality you want, then consuming that in a managed code app written in VB.NET or C#.
|
|
|
|
|
i need a program immediately to read and display an image using c code
pls help
dhariiiiiiiii
|
|
|
|
|
You'd better hurry up and write one then...
Paul Marfleet
|
|
|
|
|
Have you tried google... Or yahoo... Or SQLH?
Visit my blog at http://dotnetforeveryone.blogspot.com
|
|
|
|
|
You problem is answered here[^] at #2
|
|
|
|
|
dharikitty wrote: using c code
Go over to the C forum, and don't post this question there.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
dharikitty wrote: i need a program immediately to read and display an image using c code
Dear,
And I need a new widescreen LCD TV real bad. Perhaps we could work out a mutually beneficial deal?
I'm a talented programmer with decades of experience, an author of several patents, and an accomplished synchronized swimmer. Please contact me and let me know if you're interested in my services.
Thanks,
/ravi
PS: Should the program display a specific image or can I choose one of my own liking?
|
|
|
|
|
For my current (and first) project in C# / ASP.net 2.0 I need some set operations (like intersect, union, minus), preferrably for a SortedList. Since I didn't find any, I wrote my own.
The problem is, it seems the method affects the objects outside the method, even though I'm sure I called the method using call by value instead of call by reference.
This is the method Minus:
<code>
public SortedList Minus(SortedList a, SortedList b)
{
/*
* Bildet a \ b
* Values werden aus a übernommen.
*
*/
if (a != null && b != null)
{
for (int i = 0; i < b.Count; i++)
{
if (a.ContainsKey(b.GetKey(i)))
{
a.Remove(b.GetKey(i));
}
}
return a;
}
else
{
return new SortedList();
}
}
</code>
And here's how I call it.
<code>
SortedList sl1 = new SortedList();
SortedList sl2 = new SortedList();
SortedList sl3 = new SortedList();
sl1.Add("1", "eins");
sl1.Add("2", "zwei");
sl1.Add("3", "drei");
sl2.Add("2", "dkjfs");
Response.Write("before: sl1: <br />\n");
helper_show_sortedlist(sl1);
Response.Write("before: sl2: <br />\n");
helper_show_sortedlist(sl2);
//sl3 = Minus((SortedList)sl1.Clone(),(SortedList)sl2.Clone());
sl3 = Minus(sl1, sl2);
Response.Write("<br />\n");
Response.Write("after: sl1: <br />\n");
helper_show_sortedlist(sl1);
Response.Write("after: sl2: <br />\n");
helper_show_sortedlist(sl2);
Response.Write("after: sl3: <br />\n");
helper_show_sortedlist(sl3);
</code>
If I do Minus(sll, sl2), the output is
<code>
before: sl1:
i=0: Key: 1, Value: eins
i=1: Key: 2, Value: zwei
i=2: Key: 3, Value: drei
before: sl2:
i=0: Key: 2, Value: dkjfs
after: sl1:
i=0: Key: 1, Value: eins
i=1: Key: 3, Value: drei
after: sl2:
i=0: Key: 2, Value: dkjfs
after: sl3:
i=0: Key: 1, Value: eins
i=1: Key: 3, Value: drei
</code>
Obviously, the Method acted like if I gave only a reference to sl1 and sl2 and changed sl1!
If I call it explicitly with copies of the two SortedLists, it gives the behaviour I would normally expect from the first way already:
<code>
before: sl1:
i=0: Key: 1, Value: eins
i=1: Key: 2, Value: zwei
i=2: Key: 3, Value: drei
before: sl2:
i=0: Key: 2, Value: dkjfs
after: sl1:
i=0: Key: 1, Value: eins
i=1: Key: 2, Value: zwei
i=2: Key: 3, Value: drei
after: sl2:
i=0: Key: 2, Value: dkjfs
after: sl3:
i=0: Key: 1, Value: eins
i=1: Key: 3, Value: drei
</code>
So I'm just wondering what I'm doing wrong here. I'd like to call methods like this the "normal" call-by-value-way, without explicitly giving them copies of what I'm going to give them.
|
|
|
|
|
In a simplified nutshell, only value types get passed by value. Reference types, like SortedList, always get passed by reference, so yes, if you modify the reference passed in, you're modifying the original object. Objects only get copied if you EXPLICITLY copy them yourself.
|
|
|
|
|
From the MSDN documentation for the SortedList.Clone() method:
A shallow copy of a collection copies only the elements of the collection, whether they are reference types or value types, but does not copy the objects that the references refer to. The references in the new collection point to the same objects that the references in the original collection point to.
In contrast, a deep copy of a collection copies the elements and everything directly or indirectly referenced by the elements.
You need to pass a deep copy of each SortedList instance to your set operation methods if you don't want the contents of the original objects to be affected.
Paul Marfleet
|
|
|
|
|
Hi,
Two comments:
1.
yes a and b are passed by value, but the "value" of a reference type is a reference,
so Minus can (and will) change the objects a and/or b point to, but it can not change
the value of a or b themselves.
if you were to add a "ref" keyword, then Minus could not only modify the SortedLists
you pass to it, but it could also change the references themselves (i.e. make the
caller suddenly hold an entirely different SortedList object).
2.
I don't like your Minus method, for two reasons:
2a.
you should preceed it with some comments explaining exactly what functionality it offers.
Yours would be: "calculates and returns the difference of two SortedLists while destroying
one of them".
2b.
you should choose a better method definition, here are two suggestions, pick one:
(A)
<br />
public void Minus(SortedList a, SortedList b)
The comments makes clear a will be modified, and nothing gets returned.
(B)
// calculates the difference a-b b (i.e. returns a SortedList containing those elements
that appear in a but don't appear in b; it does not modify a nor b)
public SortedList Minus(SortedList a, SortedList b)
Now here the code must make sure a is not altered, so a new SortedList must be created;
you could start of this a Clone of a, or with an empty SortedList and add what is
required.
The way you had Minus() was a mix of both, it did return something and did modify
one of its inputs, not a clear situation for the caller.
Hope this helps.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
there is an error and icant understand it's meaning
Error "Type or namespace definition, or end-of-file expected "
|
|
|
|
|
Where is your code? There's nothing to work with here.
Seriously, how do you expect anyone to help you if you don't post the code that is causing the error? The more information you provide, the more likely it is that your question will be answered.
Paul Marfleet
|
|
|
|
|
You probably have mismatched curly braces in the file, or, you have an open brace for the namespace definition, but no closing brace.
namespace
{
class
{
properties, methods
{
}
}
class
{
...
}
}
|
|
|
|
|
^ yup, what he said. Go through every open '{' and make sure it closes with a '}' at some point. And i bet you'll find one that doesn't.
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
Hi Dave,
a new and creative way of using PRE tags?
I do prefer the standard way though (with code, preferably indented).
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|