|
Could you describe a little more clearly what you are trying to accomplish?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
I want to implement with "code" this, in the ISS 7
In IIS when I right-click, I see options "Convert to Application" with Application Pool as “Classic .NET AppPool”
any idea??
thanks
luisnike19
|
|
|
|
|
hello all
I write a simple ftp ware,here's some code
public void Upload(string filename)
{
FileInfo fileInf = new FileInfo(filename);
string uri = "ftp://127.0.0.1";
FtpWebRequest reqFTP;
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(uri));
reqFTP.Credentials = new NetworkCredential(m_userName, m_password);
reqFTP.KeepAlive =true;
reqFTP.Method = WebRequestMethods.Ftp.UploadFile;
reqFTP.UseBinary = true;
reqFTP.ContentLength = fileInf.Length;
int buffLength = 2048;
byte[] buff = new byte[buffLength];
int contentLen;
FileStream fs = fileInf.OpenRead();
try
{
Stream strm = reqFTP.GetRequestStream();
contentLen = fs.Read(buff, 0, buffLength);
while (contentLen != 0)
{
strm.Write(buff, 0, contentLen);
contentLen = fs.Read(buff, 0, buffLength);
}
strm.Close();
fs.Close();
}
catch (Exception ex)
{
}
}
now I have a problem,how to change the path to "ftp://127.0.0.1/test"?of course I can reconnect the server,but every time I change the path must reconnect the server?
I'm very sorry for my English.
|
|
|
|
|
Google it[^]. The answer is in the first result!
(I only looked it up because I'll be needing it too in a couple of weeks)
|
|
|
|
|
Hi,
Sorry if this is a simple question, I'm learning c# and I'm trying to send
a string to another computer, but when I receive the string I want to store that string in an xml file
the problem is that the string comes with "empty" characters at the end.
so my xml looks like "abc.........) follow by many empty chars.
here is the code I'm using to get the data. using tcp sockets
Byte[] received = new Byte[256];
int bytesReceived = server1Tcp.Receive(input, input.Length, 0);
dataReceived = System.Text.Encoding.ASCII.GetString(input);
How can I save the "dataReceived" string without the empty chars.
again, thank you to all of you who have helped me learn C#
-JC
|
|
|
|
|
Add this at below the posted code
dataReceived.Trim();
|
|
|
|
|
Trim the input, IIRC you get the full buffer length in string.
|
|
|
|
|
The way I would do it is to send the length of the string, and then the string itself. So you would have something like:
byte[] myBytes = ...;
int length = BitConverter.ToInt32(myBytes, 0);
string myString = System.Text.Encoding.ASCII.GetString(myBytes, 4, length);
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
nyjcr wrote: the problem is that the string comes with "empty" characters at the end.
No, the string doesn't come with any empty characters.
The problem is that you get the length of the actual data, but then you just ignore that and convert the entire buffer into a string. The unused part of the buffer just happens to be filled with zeroes.
Only convert the actual data:
dataReceived = System.Text.Encoding.ASCII.GetString(input, 0, bytesReceived);
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi fellows, I want to develop an application that display a list of files that needs to be uploaded to the webserver through webservices. Each file is uploaded one by one to the webserver. Webservices read file bytes and create it on the webserver. so how can i be sure that file has been, 1) uploaded, 2)ceated successfully.
My second question is that transferring file one by one may slow down the process so should i transfer files in a package or is there a need to compress files first.
Thanks for answering
|
|
|
|
|
You can speed things up by compressing, sending one by one matters not a jot, the number of bytes is the same. Add a method you call to confirm that the file exists, or just have the web method return a bool to say that it wrote it OK.
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
Christian Graus wrote: You can speed things up by compressing, sending one by one matters not a jot, the number of bytes is the same
This is not 100% correct. Try sending >1000 (or any large number) files from one PC over a network to another PC (for example a shared network drive) and compare the speed with the same files compressed into a single one.
I'm not talking about compression here: the overhead for opening the files, creating the appropriate file handles and sending and receiving status commands (for FTP, e.g.) can decrease the throughput quite a lot. You can even notice the performance drop by simply copying many files from one harddrive (or partition) to another.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
1.1) You can use File.Exists
1.2) Create a hash for the file and send it to webservice along with the file.
Once it has been uploaded verify the hash on the webserver.
2) That depends on many things; including filesize, filecount, etc.
The best answer is to make a test and compare the results if performance is resuired.
Edit: arghhhh Greeeg posted faster than me just because I was making coffee
|
|
|
|
|
I want to make one of our applications auto updating. Previously I have used click-once to meet this requirement, but this time it's not an option.
The app consists of a VB6 exe which uses a bunch of C#.NET dll's. (It's been slowly ported from completely VB6, but replacing the remaining bits with C# is currently not an option).
It also includes a windows service, entirely in C#.
Both parts of the app need to auto update. Not necessarily together.
Clickonce is obviously not an option because of the VB6 and service parts of the app.
We use the enterprise library for a lot of other stuff so I started to look at the enterprise library updater application block, but it looks like it's been dropped from the newer versions.
It's only got to work on the internal network, not over the web. (So file based copies rather than FTP or IIS server downloads is probably preferable)
Are there any recommended ways of doing this?
Anything built into .Net that does it?
Any good 3rd party frameworks out there the help, that people would recommend looking at?
Or is the best thing to do just write my own?
(I'm not asking how to do it, I can manage that. I'm just asking for advice on the best route to take. What have other people done?)
Cheers
Simon
|
|
|
|
|
if i Got U Right
u Need to have a backgroundworker that Will "Pull"
information from where ever u Want to and then distribute that information To Where Ever u Want to
Have Fun
Never forget it
|
|
|
|
|
Thanks, but I've not got a problem with how to do it. If I decide to code my own, it looks pretty straight forward .
What I want to know is if anyone else has done smiler and can share their recommendations. There are frameworks and tools around (Like BITS, and the enterprise library) and I wondered if it's worth looking at them, has anyone used one and can recommend it, or if it's better just to code my own?
Thanks again.
Simon
|
|
|
|
|
|
Thanks Led Mike.
I've looked into BITS and I think its a bit of overkill for my purposes. Not much is said on the patterns and practises web site, they just seem to recommend some different techniques for writing it yourself. (They seem to have deprecated the updater application block which I find a bit odd, as there doesn't seem to be a replacement, I'm sure it would have come in handy now, never mind, they must have their reasons.)
All in all, I think I'm just going to write my own.
Cheers
Simon
|
|
|
|
|
Simon Stevens wrote: they just seem to recommend some different techniques for writing it yourself.
You do realize that is the original meaning of Patterns right? And Best Practices? That you implement them when needed, not that there is a library that you use when you need them. That would be a Library not a Pattern or Practice.
Updating an installation can be quite complex, that may be why they deprecated the library, because it was insufficient to generalized use. It might not even be possible to address all the potential aspects of updating an installation with a generalized library. Generalizations almost always add complexity to the subject and in this case it is already quite complex. How do you generalize database schema modifications which may require migration of existing data into the new schema? That's just one small example. On the other hand if ones project needs are fairly simple why would one want to use a large complex library that is capable of supporting the more complex aspects of updating an installation. I mean you are already saying that BITS is overkill, right?
Also I have no idea why your post got voted down. There is nothing bad enough about it to warrant that. Some people seem to enjoy abusing the whole voting thing.
led mike
|
|
|
|
|
Hey!
I am using a listview in virtual mode and it works fine until I want to manipulate the columns in the listview. I am not sure how to do this "synchronized" with the RetrieveVirtualItem event. Right now my application crashes if I happen to add or remove a column exactly when the listview is updating itself.
Does anyone know how to do this?
|
|
|
|
|
I am writing a C# program to ruturn the permissions of a reg key passed in the program. I have the main registry part working except when the registry path has a space.
RegistryKey
regKey = Registry.LocalMachine
regkey = regKey.OpenSubKey("Software");
regkey = regKey.OpenSubKey("Adobe");
regKey = regKey.OpenSubKey("Adobe Reader");
RegistrySecurity = regKey.GetAccessControl();
the main question is how do I handle spaces so I can read any key I am looking for?
Thanks
Rob
|
|
|
|
|
I just tried this code with "Adobe Gamma" (I don't have the reader installed) and it worked fine for me.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thanks
I did not have the right key name
|
|
|
|
|
I am getting a warning message while sending mails,meeting rquests programatically. How to suppress these warnings?
can you plz help me?
|
|
|
|
|