|
what is ngen? And where i have to do it?
|
|
|
|
|
NGen is the tool that ships with .net framework. IF you've installed Visual Studio or .net framework sdk, go to sdk or vs commnad prompt (to have the path to ngen.exe) and try to run ngen.exe, it's a command line tool.
AISAC - An Intelligent Sense of A Computer
http://aisac.wordpress.com
|
|
|
|
|
hi all
i am created one windows application with opendialog box and stream reader. it is running fine in my mechine. then i copied that in to my server. when i try to the project in server, i am getting the fallowing exception
Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
i had searched in the net with the above keyword and find that .net won't give permission to run projects in shared/network drives. is there any other solution for this
coolsweety
|
|
|
|
|
Hi all,
We have a functionality that opens a word document on a button click . The user can enter any thing in the word document and it gets saved with a different name.The original document is closed.
The problem is , every time the application is run, it opens a WINWORD.EXE in the processes tab of the task manager, which , after repeated executions of the project, add up to a large number.I cannot figure out why tjis is happening even as the word document is being closed after saving.
So is there any way to close the process as soon as the document is saved with a differenty name?
Thanks in anticipation
|
|
|
|
|
I have the same problem sometimes with Word 2003 when using outlook.
If you use automation you'ld probably be able to use some function from the object model or something.
If all else fails, look into the Process class.
eg.:
Process process = Process.GetCurrentProcess();
process.Kill();
hope this helps.
Coulda, woulda, shoulda doesn't matter if you don't.
<marquee>
|
|
|
|
|
hi,
Process proc =Process.GetCurrentProcess()
Proc.Kill()
is killing my application but not the winword..
Is there a way to identify the winword process uniquely and kill it?
Thanks...
|
|
|
|
|
You didn't read correctly .
Look up the Process class on MSDN.
This was just an example:
Process proc =Process.GetCurrentProcess();
Proc.Kill()
You can find the process by name or by id.
Coulda, woulda, shoulda doesn't matter if you don't.
<marquee>
|
|
|
|
|
If you are using Interop dlls, so you should have used Word.Application object and the Documents collection to Add/Open a new Document.
In this way, when you are done with the object, you can simple use Word.Application.Quit() method. It will close winword.exe automatically.
Be sure you're not just openning the document and let it just be. Take care of that by events implementation.
AISAC - An Intelligent Sense of A Computer
http://aisac.wordpress.com
-- modified at 14:29 Thursday 4th May, 2006
|
|
|
|
|
hi,
Thanks for the reply..
I tried Word.Application.Quit()..
It gave me the following error..
Reference to a non-shared member requires an object reference...
I guess i will have to use process.kill()...
Thanks..
|
|
|
|
|
For Word.Application.Quit I meant the path to the method, actually you should have an object like this:
Word.Application wApp = new Word.Application();
Word.Document wDoc = wApp.Documents.Open("foo.doc");
...
wDoc.Close();
wApp.Quit();
AISAC - An Intelligent Sense of A Computer
http://aisac.wordpress.com
|
|
|
|
|
Thanks for the reply,
I am using
wDoc.Close()
wApp.Quit()
It is closing the document but not the associated winword.exe.
After repeated runs of the application, i have a lot of winword.exe's running
in the task manager.
how to close the associated process after the document is saved and closed??
Thanks in anticipation
|
|
|
|
|
Hi,
Could anyone please let me know How to change the DNS HostName using WMI. I have
the snippet of the code below. The updation of the IPAddress and the SubNetMask
is happening correctly, but the updation of the HostName is not taking place.
using System;
using System.Management;
using System.Threading;
using Microsoft.Win32;
namespace WmiIpChanger {
class IpChanger {
[MTAThread]
static void Main(string[] args) {
SwitchToStatic();
}
static void SwitchToStatic() {
ManagementBaseObject inPar = null;
ManagementBaseObject objNewGate = null;
ManagementBaseObject outPar = null;
ManagementBaseObject hostPar = null;
ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc) {
if (!(bool)mo["IPEnabled"])
continue;
try{
inPar = mo.GetMethodParameters("EnableStatic");
hostPar = mc.GetMethodParameters("EnableDNS");
objNewGate = mo.GetMethodParameters("SetGateways");
//Set IPAddress and Subnet Mask
inPar["IPAddress"] = new string[] { "192.168.1.141" };
inPar["SubnetMask"] = new string[] { "255.255.255.0" };
// Set the HostName
hostPar["DNSHostName"] = "user machine" ;
hostPar["DNSDomain"] = null;
hostPar["DNSServerSearchOrder"] = null;
hostPar["DNSDomainSuffixSearchOrder"] = null;
//Set DefaultGateway
objNewGate["DefaultIPGateway"] = new string[] { "192.168.1.100" };
objNewGate["GatewayCostMetric"] = new int[] { 1 };
outPar = mo.InvokeMethod("EnableStatic", inPar, null);
outPar = mo.InvokeMethod("SetGateways", objNewGate, null);
outPar = mc.InvokeMethod("EnableDNS", hostPar, new InvokeMethodOptions());
catch(Exception ex)
{
Console.WriteLine("Unable to Set IP : " + ex.Message);
}
}
}
}
}
Warm Regards
Sharan
|
|
|
|
|
Hi
I have created a web project in ASP.NET , I want to process one more ASP.NET page which resides in some other virtual dirctory.
Using Server.Execute is not working and giving error
Please help.
Thanks in advance.
N.A.
|
|
|
|
|
Hi,
Why are there so many string conversions to integer? Do they honestly all have different uses? I mainly use Int32.Parse() . There is Convert.ToInt32() as well, and the SqlDataReader has a .GetInt32() method as well.
Why so many, are there maybe more that I don't know of??
Regards,
ma se
|
|
|
|
|
Yes there are more. You have Int32.TryParse, then the integer types Int16 and Int64 each have their own set of parsers and converters.
The reason that there are several similar methods is that they all work a little differently.
:: The TryParse methods returns a status value instead of throwing an exception.
:: The Convert methods also take other data types than strings.
:: The Convert methods that take a string parameter handles a null value as zero, otherwise calls the Parse method.
---
b { font-weight: normal; }
|
|
|
|
|
Interesting question, and not really one answer, as you have asked about things which look similar but in some cases are not!
Ill try to address some of your queries.
Int32.Parse - most non-string datatypes in .NET provide an easy way to convert to that datatype from a string - mainly for convenience as programmers often use string representations. DateTime.Parse, Int16.Parse immediately come to mind.
Convert - this is a convenient helper class that knows how to do many conversions to and from every base type. However, it is just a wrapper around the actual casting & converting which can be done. For example, decompile the Convert.ToInt32(string) method and you get:
public static int ToInt32(string value)
{
if (value == null)
{
return 0;
}
return int.Parse(value);
}
so, in essence Convert.ToInt32(String) is just using int32.Parse under the hood.
SqlDataReader.GetInt32 - This is a type-safety convenience. Rather than have to convert each read column to its a desired type, the data reader provides a type-safe way of reading each value. Without this convenience, you would have alot of this in your code
int myIntValue = (int)myDataReader["MyIntColumn"];
You should also read up on the difference between casting from one type to another, and parsing a string to a different type - that will help you understand a little more.
Hope that helps.
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
|
I want to remove cache form client system programmatically even if the browser cache setting is set to “Automatically”. I have tried following options but it doesn’t work.
1) <%@ OutputCache Location="None" VaryByParam="None" %>
2) Response.Cache.SetExpires(DateTime.Today);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Please help me to sort out this problem.
Thanks is advance.
Amit
|
|
|
|
|
You can't remove anything from the client cache, you can only prevent new pages from being stored in the cache.
Either the OutputCache or SetCacheability should do that. The SetExpires should work as long as the clock of the client computer is correct, but there might be problems for other time zones.
Clear your browser cache and test if any of the methods will keep the page from being cached.
---
b { font-weight: normal; }
|
|
|
|
|
I want to call web service and i want to show with database structure in Clint Window Application by Using jboss-server.My friend make javaside web service and i make client side window application by using C#.Pls help me how can we show XMl Data Grid in C#.
Yan
|
|
|
|
|
Sure you can use Xml as datasource..
Dataset ds=new Dataset();
ds.ReadXml("xmlpath");
Datagrid1.Datasource=ds;
|
|
|
|
|
Hey everyone,
I have an sql database with a table field which is a nvarchar. But the field actually contains a date and time of an event, for each record.
Im trying to count up all the events that occurred today. Here's my code:
for (int i = 0; i < table.Rows.Count; i++)<br />
{<br />
if (table.Rows[i][0] != null)<br />
{<br />
thedate = (DateTime)table.Rows[i][0];<br />
<br />
if ((DateTime)table.Rows[i][0] == DateTime.Now)<br />
count += 1;<br />
}<br />
}<br />
2 problems. Firstly, the line thedate = ...., fails everytime. It will not cast and reports an exception about failing to assign infinity. How else can I convert the string field to a date object?
Also, the field contains a date and time. I need to compare todays date with that field, excluding the actual time. Is that possible?
Any help gratefully appreciated
Andy
|
|
|
|
|
1. You need to use DateTime.Parse(..) or DateTime.ParseExact(..)
2. In order to compare with todays date, you need to use
dt.ToShortDateString() or datetime.Today() because DateTime.Now will give you date along with time.
Note: Format of both needs to be the same
|
|
|
|
|
Thanks very much Sathish and alexey.
Did the job perfect.
Kind regards
Andy
|
|
|
|
|
Try using function:
DateTime.TryParse
To count difference between dates in days use code:
<br />
DateTime date1 = new DateTime(2000, 10, 10);<br />
DateTime date2 = DateTime.Now;<br />
TimeSpan span = new TimeSpan(date1.Ticks - date2.Ticks);<br />
int daysCount = span.Days;<br />
Best regards, Alexey.
|
|
|
|