|
Well, if he truly was a rookie, it wasn't bad. But he could be a very good C programmer that is about to learn OOP, in that case, he would probably find rookie a bit insulting
I was a consultant in a .NET project a couple of years ago (a very bold decision from a big company to use the brand new technology), where more than half of the staff were new to OOP, and they certainly weren't at home with GC.
I used a lot of hours reeding out resource leaks by inserting dispose() invocations and encapsulating functionality inside using(...) blocks.
I even had to expose my ears to statements like: "Hey, look what Bob did!, isn't it clever?, now we can use this code in blah blah blah", the guy was talking about 'bob' having implemented a class for Gods sake!
But I never considered them rookies, at many points, some of them were much more experienced programmers, than I was.
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
jan larsen wrote:
But he could be a very good C programmer that is about to learn OOP, in that case, he would probably find rookie a bit insulting
Oh yeah... I was thinking in contex of what he is learing... bt no one can know what I am thinking unless I write it down - my fault. I understand now...
thx
David
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
Hi
I have done a c# program which reads a schema file and automatically inserts data's according to the datatypes. Now I have another xml file which has original values in it. So while my program is raeading a schema file, if there is field which is same field name of an original values cxml file. my program should read the values of the the original values xml file of that field and insert into the resultant one.
i AM TRYING AS SUCH
ie,
I have used switch ..case in my program
[b]switch(dColmn.DataType.ToString())
{
case "System.String":
if(dColmn.ColumnName.Equals("billto_name"))
{
XmlTextReader xtr = new XmlTextReader("D:\\billtoname.xml");
oValues[i] = ((xtr.NodeType == XmlNodeType.Element) & (xtr.Name == "billto_name"));
}
else
oValues[i] = (string) "Castle Hampers" + j;
break;[/b]
Note:
//***** billto_name is the field which exists in both the schema and original values xml file.//
// j is a for loop for about 0 to 200
the if statemnt given inside is the one I am trying . But when run , the data's inside are shown as "false".
santhosh
|
|
|
|
|
hi,
I wrote you long and detailed response, bt I hit some mouse combo or what and lost it before I post it
so:
don't even try [b] there are <b> and better <code> for marking code snippets in post
johnsanthosh wrote:
XmlTextReader xtr = new XmlTextReader("D:\\billtoname.xml");
shouldn't be inside loop.. you don't have to create it again and again... inefficient. And it's even mistake here!
Plus you don't call xtr.Read()
You must call XmlTextReader.Read() method in order to advance to next node in XML stream... that's why it gets wrong there...
hope it help I rush to post it I don't want to screw again
best regards,
David 'DNH' Nohejl
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
Hi
Thank you for your response.
Can U please give a some more detailed note about it.
As its very urgent for me to do.
pls
santhosh
|
|
|
|
|
sorry for late response as I am +6 time zone so you ca count what time it was for me
<br />
if(dColmn.ColumnName.Equals("billto_name"))<br />
{<br />
XmlTextReader xtr = new XmlTextReader("D:\\billtoname.xml");<br />
oValues[i] = ((xtr.NodeType == XmlNodeType.Element) && (xtr.Name == "billto_name"));<br />
<br />
}<br />
You must call XmlTextReader.Read()[^] to move to another node in XML stream (File, in this case). Since you don't do it, xtr.NodeType & xtr.Name are null (IMO)...
(btw there should be && not bitwise & operator)
As I reread you post, I must ask why there is loop from 1 to 200 or so...
If I understand you have xml file with schema, xml file with values and you are trying to create one more file with...? or? now I don't know
At least you know now how to read XML files with XmlTextReader...
tell me more about what exactly you want to do and I'll (or somebody else) will hopefully tell you how to do it...
David
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
Hi
First of thank you for replying.
I have to read any schema file, and according to their datatype, it should load values for about 200 into a new xml file.
ie, a rough xml(first file -resulatant file)
<name>john1
<salary>8100
<name>john2
<salary>8200
<name>john3
<salary>8300
<name>john4
<salary>8400
like so on.. for about 200 values.
Now I have another xml file which has same "name" field all meaningful values for about 50.
(second xml file)
<name>john milton
<name>stephen
<name>george
<name>thomas
<name>paul like so on for about 50 data's.
Now coming to my program, when it reads the schema, and when the schema file has the field"name" then it should read the second file and insert the data's from second file into the first xml (resultant file) for that particular field.
This is my requirement.
and this is my coding done, after running this program i find the values for the particular field are changed to false.
private void button2_Click(object sender, System.EventArgs e)
{
dataSet1.ReadXmlSchema(txtSchema.Text);
foreach (DataTable dTbl in dataSet1.Tables)
{
for(int j = 0; j <= 20; j++)
{
object[] oValues = new object[dTbl.Columns.Count];
int i = 0;
foreach (DataColumn dColmn in dTbl.Columns)
{
switch(dColmn.DataType.ToString())
{
case "System.String":
if(dColmn.ColumnName.Equals("billto_name"))
{
XmlTextReader xtr = new XmlTextReader("C:\\CDEV\\testdatagenerator\\meelu.xml");
oValues[i] = ((xtr.NodeType == XmlNodeType.Element) && (xtr.Name == "billto_name"));
}
else
{
oValues[i] = (string) "sachin" + j;
}
break;
}
i = i+1;
}
dTbl.Rows.Add(oValues);
}
}
dataSet1.WriteXml(txtXml.Text,XmlWriteMode.WriteSchema );
}
santhosh
|
|
|
|
|
sorry
I had given tags for the above program so, it is not in clear xml format.
for first xml file
ie john1,john2,.... comes for a field "name" tag(element)
and 8100,8200,8300..etxc comes for "slary" tag(element)
second xml file
ie, john milton, stephen,george, thomas,paul all comes for a field " name" tag(element)
so now i have insert the data's form second xml file and load those values to the same field of first xml file.
santhosh
|
|
|
|
|
Is there a way to 'lock' an entire folder, not just a file in side? I read this: http://www.codeproject.com/csharp/CryptoSafe.asp[^] and it lays out the info very well, but is there a way to adapt it to do an entire folder so that it cant be opened?
|
|
|
|
|
The only way you're going to accomplish anything like this is to Crpto every file in the folder. There is no way to do the same for the folder itself.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
this will be difficult as some files will be very large ( 500mb or bigger). I and speed is very important.
|
|
|
|
|
Like I said, it's not possible to do it on the folder itself. In order to accomplish something like this, you'd have to replace the NFTS File System with your own implementation.
Since security is an issue, look into using the security system that's built into Windows and/or whatever network your using to control access to these resources. That's what it's there for...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote:
Like I said, it's not possible to do it on the folder itself. In order to accomplish something like this, you'd have to replace the NFTS File System with your own implementation.
Maybe I missed the point here but I though this thread is about encrypting all files in a folder and that is actually supported by NTFS.
Best regards
Dennis
|
|
|
|
|
Like I told him, encrypting the FOLDER isn't possible because it's just a pointer to a list in the file table. Encrypting the contents of the folder is possible using either an external program or using the NTFS encryption. But in the latter case, he'll still need to go read the documentation on it to understand how to use it.
Most of the time, when someone posts a question like "how can I password protect a file or folder so noone else can open it", it usually means that they want to protect every file in a folder so you can't even open it in Notepad without a password box coming up.
This question was no different, and I referred him to the security features of the OS, be it using ACL's to control access or encryption. The choice is up to him, so long as he reads about the features and pitfalls of each and understands them.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote:
Like I told him, encrypting the FOLDER isn't possible because it's just a pointer to a list in the file table.
A folder is actually a file with certain attributes (see The NTFS File System[^] section NTFS File Attributes). As folders have an encryption attribute too, you can use this to ensure encryption of files that will be created in that folder (given that nobody disables ACL inheritance). By the way, the documentation states that you can encrypt files and folder so I assume that in case you set the encryption flag for a folder the file (which represents the folder) is also encrypted (yeah, I know, that does not answer the original question ).
Dave Kreskowiak wrote:
But in the latter case, he'll still need to go read the documentation on it to understand how to use it.
It seems that you only need the function EncryptFile()[^] (but there is also a more detailed article about that titled A Programmer's Perspective on NTFS 2000[^]).
Dave Kreskowiak wrote:
This question was no different, and I referred him to the security features of the OS, be it using ACL's to control access or encryption. The choice is up to him, so long as he reads about the features and pitfalls of each and understands them.
I definitely agree about that!
Best regards
Dennis
|
|
|
|
|
Great! Now that the detail of his project actually come out, all of this was moot.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Ok so then I guess my next question is about folder hiding. How secure is this method?
|
|
|
|
|
Not at all...
Like I said, look into the security features of NTFS. It's the ONLY method that will allow you to secure a folder so only certain people/groups can see what's inside.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Let me explain what I am trying to do. I am trying to create an electronic file distribution program, much like Steam. Unlike Steam, I want any game developer who wants to use it, the option to. What I am looking to do is require as little code moddification on the devs part. What I want to happen is that the entire game is downloaded in one file (could be an encypted folder or some varient of a zip file). When the user runs this program it checks the database (online mode) or a file stored on the user's machine (offline mode) to see if the user has permission to unencrypt / unzip the folder and run the contents. This leads to a problem that the decrypted / unziped files can not be placed onto the user's harddrive in as accessible manner as doing so would allow a devious user to just obtain these files from another user who has legit permission. Thus receiving a free game. Any thoughts on how this can be done?
|
|
|
|
|
IMHO ... If your worried about someone cracking your scheme, give up now because it WILL happen no matter what you do. Copy protection has been a pipe dream for a couple decades now. Every scheme is crackable because every scheme comes down to a single little IF statement that can be changed by the "devious user" to ignore the conditions setup to protect your app. Suddenly, your app won't care if it was protected or not, encrypted or not, licensed or not, ...
Even Steam has been cracked six ways from Sunday. And on top of that, Steam is also locking out ligitimate users! Is this really what you want?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hey is there a way to have mousewheel panning in a custom UserControl? I meen like in Internet Explorer when you click the middle mouse button you enter in panMode.
or can you give me a link to information on how to make a implementation of this!!
|
|
|
|
|
Hi,
Can anybody help me on how to develop a online poll using ASP.NET with C#. Pls let me know if you have any example.
Tx
|
|
|
|
|
Hi, i'm making a serverbrowser...(program that sends out udp sends with asynch sockets to videogame servers and listens for what comes back which contains info about the servers status)...and sometimes when i exit from the program i notice that it doesn't leave from the taskmanager...i.e. still running.
I have no clue why this is happening though because i set the socket timeout options to end if a query hangs (wonder if that even means anything when doing stuff asnchly)
zzz confussed.
|
|
|
|
|
Last month I asked a question on this forum about the relative efficiency of passing value types that were member of reference types or member of arrays as parameters to functions using ref and out. My original question was whether or not it would be more efficient to pass a large structure that was a member of a class using ref even if I didn’t need to make modifications to the stuct t needed to be passed back to the calling routine. In C or C++ it would be more efficient to pass by address and Jeffrey Richter in his excellent book: “Applied Microsoft .NET Framework Programming” also says that it is more efficient in to pass large value types using ref in C# (although he isn’t specifically referring to value types that are embedded in reference types). Anyway, the answer that I got back on this forum was that passing a value type that was embedded in a reference type using ref or out would require boxing the value type which of course would be very inefficient. I was also told that if I was going to pass something around a lot that it should be class rather than a struct. And I was also told that large objects should also be classes for efficiency.
Anyway, I am hoping to get some more opinions on this. I checked several C# books and searched the internet and I haven’t found anyone saying that passing a struct that is embedded in a class using ref would cause the struct to be boxed. Also I have looked at some IL code of that circumstance and I don’t see any Box instructions. Rather I see a ldflda instruction which: “Finds the address of a field in the object whose reference is currently on the evaluation stack” which sure looks to me like it is passing the address of the struct. If C# really does pass an address, that would be the more efficient way to pass a large struct. So from my understanding, it looks like passing structs embedded in classes using ref does not cause boxing therefore, I still don’t have any reason to believe that it would be more efficient to make large structs classes or that large objects that need to passed around a lot should be classes. Can anyone enlighten me further about this? Also, assuming that C# really does pass structs that are embedded in classes or arrays using ref by passing the address of the struct, how does C# get around not having to pin the enclosing class or array to prevent it from being moved by the garbage collector and there by making the passed address invalid? I know I am not supposed to think about addresses anymore but I really do need to figure out what the most efficient way of passing large structs around or if I really should make them classes – even though they don’t need to be classes for any other reason. Thanks so much for the help.
Paul Sawyer
|
|
|
|
|
hi,
i got several settings objects stored in a ArrayList. i can do the simply single object serialization. but, any method to serialize the whole ArrayList to a xml file?
thanks,
jim
|
|
|
|
|