|
How much data are you receiving from the web request and sending over the socket? I've had problems doing the same thing before where the web service returned too much data to send at once.
joana.simoes wrote: the callback (finish) terminates without actualy sending all the information
What indicates this? Does mySocket.EndSend(asyncResult) throw an exception, return less than you expected or does something else happen? If it simply returns less than you expected you could try sending the rest of the data again.
|
|
|
|
|
hi
i have an app.config file that should be encrypted. is there any way to encrypt it?
this file will be update freuqently . is there any way that encrypt data with less overhead?
thanks
|
|
|
|
|
This[^] article details how to update the config file. I'd be wary of storing frequently updated values in a config file though - that's not what the config file is fore.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
hi
i want to lock some text file in the specified directory
just two applications can access these files
1) first application for reading and writing
2) the second one just for reading
what should i do?
thanks in advance
|
|
|
|
|
reza assar wrote: i want to lock some text file in the specified directory
just two applications can access these files
Locking a file based on the application that's used for opening it is not supported by the file systems that I know.
reza assar wrote: what should i do?
Review the specifications and research alternative solutions. Here's some to get you started;
* Is it necessary to 'lock' the file, or are you trying to prevent other people from reading the file? If the latter is the case, then try encrypting your text before you send it to the file.
* Could a container be used? You can store multiple documents in a zipfile, and protect them with a password.
* If speed is more important than having a textfile, consider using a dekstop-database like SQL CE.
HTH
I are Troll
|
|
|
|
|
i what to prevent users from "writing" and "reading" !!!! one application grant to write it and my application grant to read it but prevent other users from writing is more more important that reading! it may damage my application information
is there any other way?
|
|
|
|
|
reza assar wrote: is there any other way?
So you're just trying to hide what's in the file from the user? In that case, go for zipfiles, a database or plainly encrypt the data.
No other methods that come to mind right now.
I are Troll
|
|
|
|
|
Hi, I am fetching the recored with a sql procedure, which returns a collection of values with the help of ADO.NET Entity framework. Now if I need to use stored procedure then I have to import that procedure in my .edmx file and map with a entity.
Now the problem is that, I am fetching the records with inner join that's why it can not be map any single Entity. Is it compulsory to map the sotred procedure to an Entity? Can we use stored procedure without mapping with an Entity ?
Pankaj
|
|
|
|
|
You can create an entity in the designer that maps to multiple tables then map the stored proc to it. Otherwise, yes you can use stored procs. Check here[^] for some use extensions and samples.
only two letters away from being an asset
|
|
|
|
|
hi
i want to develop an application that , user could not execute more than one instance at a time
for example my application name is: "APP" . if some one click APP icon it will be run if there is no another instance running at the current machine
what should i do?
thanks in advance!
|
|
|
|
|
Take a look at Mutex[^] class.
Best wishes,
Navaneeth
|
|
|
|
|
You need to be very careful when you are using globally available mutexes running on limited OS accounts.
Maybe finding all processes with the same name like the current will be better and safer solution because doesn't require any special permissions.
Life is a stage and we are all actors!
|
|
|
|
|
Hristo Bojilov wrote: You need to be very careful when you are using globally available mutexes running on limited OS accounts
What problems are you seeing?
Best wishes,
Navaneeth
|
|
|
|
|
The method System.Threading.Mutex.OpenExisting could throw UnauthorizedAccessException for sample.Will this method work when the current account doesn't have the desired access and cannot acquire it?I've used this mutexes method for my current project but after discovering this exception is thrown to often when running on limited accounts I had removed it and used just simple scan for the running processes which queries Windows performance counter API.
Life is a stage and we are all actors!
|
|
|
|
|
Hi,
I haven't used the managed mutex class yet, however it seems to me the MutexSecurity parameter in one of the constructors should be the key to solving the problems you've had.
Anyway, relying on GetProcessesByName() does not seem right as:
1. when a user renames an EXE, the resulting process would also be getting a different name;
2. I expect the Process methods also can fail when you have insufficient rights.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
try this code.... this is for just check ur Exe application name is currently running or not
[DllImport("user32.dll", EntryPoint = "SetForegroundWindow")]
static extern IntPtr SetForegroundWindow(IntPtr hWnd);
private static bool AppIsAlreadyRunning()
{
Process c = Process.GetCurrentProcess();
foreach (Process p in Process.GetProcessesByName(c.ProcessName))
{
if (p.Id != c.Id)
{
if (p.MainModule.FileName.ToLower().Equals(c.MainModule.FileName.ToLower()))
{
SetForegroundWindow(p.MainWindowHandle);
return true;
}
}
}
return false;
}
|
|
|
|
|
|
thanks for your attention but the link is not refer correctly please to fix it!
|
|
|
|
|
Link works fine for me.
Google C# Single-Instance Windows Form by Sam Allen.
|
|
|
|
|
Hi,
I am trying to populate an excel sheet with some data .
I do the following to write to an excel:
StreamWriter stream = null;
string separator = " ";
string latitude = "31°49.4515437’S";
using (stream = new StreamWriter("C:\abc.xls", false))
{
StringBuilder builder = new StringBuilder();
builder.AppendLine();
builder.Append("Position");
builder.Append(separator);
builder.Append(latitude);
stream.WriteLine(builder.ToString());
}
stream.Flush();
}
When I do the above I see some junk values like 31°49.4515437’S in my excel sheet.
How do I avoid it and get to see "31°49.4515437’S" in my excel sheet.
Thanks
BV
|
|
|
|
|
You could set the encoding explicitly on the StreamWriter. Even though the default is UTF-8 on my machine, explicitly setting UTF-8 made the correct characters show up.
PS: That stream.Flush() is unnecessary because the using block has already taken care of flushing and closing the StreamWriter.
PPS: In the future, please use the "code block" button to enclose your code in <pre> tags to give it formatting and highlighting. This will make the code easier to read.
|
|
|
|
|
Hi Engelberth,
Thanks for the response,
I shall take care of PS and PPS sections.
WhenI tried the below:
using (stream = new StreamWriter("C:/abc.xls", false, Encoding.UTF8))
by doing so the formatting further detoriatted, earlier I was able to see each element in different cells in my excel sheet, By doing the above everything got clubbed in one cell, also more unknown characters got added
Initailly my separator was 'tab', but looks like after adding Encoding.UTF8 it would add the eqivalent character code forthat in excel , Also theoriginal issue still remained
Regards
BV
|
|
|
|
|
Hi,
I got the solution,
Adding it here so that if someone else needs it can use it.
We need to use Encoding.GetEncoding("Windows-1252")) and this sorts the issue.
Thnaks Engelberth as you gave me hint as to where I can dig more.
Regards
BV
|
|
|
|
|
Thanks guys i was struck was a long time on this issue Encoding.GetEncoding("Windows-1252"))
sloved my issue
|
|
|
|
|
Hello
I've got a comboBox and I want to make a query after a change in the selected item is done.
Inside the "comboBox1_SelectedIndexChanged" function, I wrote these:
string ogretisim;
ogretisim = comboBox1.Text;
SqlConnection conn = null;
conn = new Sqlconnection("Data Source = Veritabani.sdf");
conn.Open()
conn.Close();
I did not do the query yet, just to try.
In the runtime, conn.Open() gives an error like it cannot reach the server.
What can be the problem?
note:
I've tried all of these:
newSqlConnection("Data Source = baglanXXX");
newSqlConnection("Data Source = Veritabani.sdf");
newSqlConnection("Data Source = .\\Veritabani.sdf");
newSqlConnection("Data Source = VeritabaniDataSet.xsd");
newSqlConnection("baglanXXX");
("baglanXXX" is my connection string)
please someone help
|
|
|
|