|
Use DOS/cmd scripts with WIPZIP
|
|
|
|
|
|
You can use the zip libraries through J#. I did this a while back, but I completely forget the details. I don't remember whether I wrote that part in J# and exposed it to C#, or whether it was directly accessible from C#. Now I'm being too lazy to go look it up for you, but this should get you going in the right direction... You can always post back more questions if you need more help.
|
|
|
|
|
Guys,
I need to developed a program in C# that runs every midnight and this program will be executed by our server. This will read data from SQL server and send notification to specific person. The question is which Type of project will I be using "Console Application", "Windows application", "Windows Server"????
I tried to use the Console Application but when I tried to execute the sqldataadapter statement it gives me an error <code>"Additional Information: Request for the permission of type System.data.sqlclient.sqlclientpermission,System.Data, Version=1.0.5000 ...</code> but when I run the same sqldataadapeter in WEb project it works perfect.
Please I need the answer ASAP... thanks.
|
|
|
|
|
How are you connecting in your code, use a SQL server account rather than trusted account as it will be lost once the system service runs the code.
The console app is the righ one to use.
|
|
|
|
|
Yes, I am glad I am on the right track. This is how I connect.
SqlConnection objconn = new SqlConnection("server=server1;database=Personnel;uid=person;pwd=person123;");<br />
objconn.Open();<br />
SqlDataAdapter objadap = new SqlDataAdapter(sSelect,objconn);<br />
objadap.Fill(DSEmployee);<br />
objconn.Close();
Does it mean the I will replace the current connection ID with the connection ID/password that I am using in connecting to the sql server?
Thanks for your help.
|
|
|
|
|
Yes,
you need a connection string like this
SERVER=SQLserver;uid=user;password=pass;DATABASE=Sales
Also you have to go into SQL server enterprise manager and create a SQL Server user (one not based on a domain account) with enough rights on the required database to insert change data etc..
|
|
|
|
|
Dear ones,
I have a specified width, and a long string. I want to know with complete accuracy how much of the string fits in that width for a give font. I have used MeasureString,GenericTypographics, TextRenderingHint etc. But i am not satisfied with the results. Give me any clue,function,API etc that could give the exact string that fits in that specified width.
|
|
|
|
|
In what way are you not satisfied with the results?
---
b { font-weight: normal; }
|
|
|
|
|
hi,
I create in my application a new custom system log and send all my logs to it. In some cases, the log gets corrupted, and the solution I have is to either clear the log or remove it and create a new one instead.
Is there a way to actually find which entries are invalid and remove them and keep the rest of the entries available for me? Or is it possible to go through the entries, and copy the valid ones to a new log file?
Thanks
|
|
|
|
|
|
I know what leads to corrupt my log. sometimes a hard shutdown makes my logs corrupt, a system crash can give me that. I'm not looking for a way to prevent it, I'm looking for a way to repair it without clearing or deleting the log.
|
|
|
|
|
|
Thanks, this did help in minimising the cause of getting a corrupted log.
And I found on the net an actual way of reparing the corrupted one and/or export the entries to HTML or Excel sheet.
|
|
|
|
|
Hi all,
My question is about how to intercept Office event in a C# add-in. I want to intercept file printing, saving, copying etc. I know that I can intercept events in VBA by supplying the rights macros, eg for file print,
Sub FilePrint()
MsgBox "I am printing " + ActiveDocument.Name
ActiveDocument.PrintOut
End Sub
The Application.Class in Word does not seem to have a FilePrint event
So my question is how do I achieve this functionality in a C# add-in ?
Thanks in advance
|
|
|
|
|
Hello all.
First of all I'm trying to send CTRL+ESC using SendKeys.Send("^{ESC}");
It doesn't work. Why?
Second, can you tell me how can i send LWIN (Left Windows key) using SendKeys? Thx
|
|
|
|
|
Hi guys, I am facing a problem regarding static methods, what happens when we call a static method (accessing only local variables),
public static void HelpMePlease()
{
int a=0;
a++;
Console.WriteLine("A must be 1 " + " a :" + a.ToString());
a++;
Console.WriteLine("A must be 2 " + " a :" + a.ToString());
a++;
Console.WriteLine("A must be 3 " + " a :" + a.ToString());
a++;
Console.WriteLine("A must be 4 " + " a :" + a.ToString());
}
Lets suppose, I call this method from 50 threads simultaneously.
will All methods keep single copy of a. or each one will have its own copy.
Please explain it comprehensively, compiler internals etc.
Thanks in advance
M.Waseem
|
|
|
|
|
M.Waseem Chishti wrote:
Lets suppose, I call this method from 50 threads simultaneously.
will All methods keep single copy of a. or each one will have its own copy.
You already wrote the code, what does it do? On the latter part, local variables are created and placed on the stack, so each call will have its own locals.
xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots
|
|
|
|
|
yeah all methods are maintaining their own copies.
all i wanted to know is what copiler does when a method is called ??
is there any diffrence between behaviour of compiler when you call a static method ??
|
|
|
|
|
When you call a static method, there is no reference to the object, as there is no object. Other than that, there is no difference.
Calling a static method does not use the address of an object:
Console.WriteLine("test");
=
ldstr "test"
call void [mscorlib]System.Console::WriteLine(string)
Calling a non-static method uses the address of the object:
num.ToString("d4");
=
ldloca.s num
ldstr "d4"
call instance string int32::ToString()
---
b { font-weight: normal; }
|
|
|
|
|
Hello...
In other words:
1. Every Thread contains his own stack...
2. Local variables are always stored on the stack from the specified thread (each one have its own copy)...
--> The static keyword before functions haves no effect on there locals...
|
|
|
|
|
Thankx
|
|
|
|
|
Here is how the IL code looks like:
.method public hidebysig static void HelpMePlease() cil managed
{
.maxstack 2
.locals (
int32 num1)
L_0000: ldc.i4.0
L_0001: stloc.0
L_0002: ldloc.0
L_0003: ldc.i4.1
L_0004: add
L_0005: stloc.0
L_0006: ldstr "A must be 1 a :"
L_000b: ldloca.s num1
L_000d: call instance string int32::ToString()
L_0012: call string string::Concat(string, string)
L_0017: call void [mscorlib]System.Console::WriteLine(string)
L_001c: ldloc.0
L_001d: ldc.i4.1
L_001e: add
L_001f: stloc.0
L_0020: ldstr "A must be 2 a :"
L_0025: ldloca.s num1
L_0027: call instance string int32::ToString()
L_002c: call string string::Concat(string, string)
L_0031: call void [mscorlib]System.Console::WriteLine(string)
L_0036: ldloc.0
L_0037: ldc.i4.1
L_0038: add
L_0039: stloc.0
L_003a: ldstr "A must be 3 a :"
L_003f: ldloca.s num1
L_0041: call instance string int32::ToString()
L_0046: call string string::Concat(string, string)
L_004b: call void [mscorlib]System.Console::WriteLine(string)
L_0050: ldloc.0
L_0051: ldc.i4.1
L_0052: add
L_0053: stloc.0
L_0054: ldstr "A must be 4 a :"
L_0059: ldloca.s num1
L_005b: call instance string int32::ToString()
L_0060: call string string::Concat(string, string)
L_0065: call void [mscorlib]System.Console::WriteLine(string)
L_006a: ret
}
.maxstack 2 -- this allocates space for your variable on the stack.
As the local variables are allocated on the stack, every call to the method has it's own set of variables.
Your function is thread safe. (As the Console class is also thread safe, even the writing to the console is thread safe. It might look awful if you have several threads writing to it at the same time, but it's safe.)
---
b { font-weight: normal; }
|
|
|
|
|
is there no diffrence between how compiler treats a static method and an instance method (if both are only accessing their local variables) ??
|
|
|
|
|
Other than sending a object reference to the instance method, no, there is no difference.
---
b { font-weight: normal; }
|
|
|
|