|
Ferrarih wrote: My first doubts it is if this script (or other that you know that does the same thing) works with other Microsoft Offices Applications, such as Excel and PowerPoint?
No, just word (see line Word.ApplicationClass WordApp = new Word.ApplicationClass(); ).
Ferrarih wrote: If I upload a MSWORD file with ASP.Net, the result of number of pages would show right away or it would take a while for the server open the file and count it?
It would obviously need some time to open it. The question of how fast is down to file size, disk usage, disk speed; loads of factors.
Ferrarih wrote: And would the script be able to count 10 (or more) files for different users at the same time
Yes, you could do 100000000000000000000000000000000000000000000000000 users at the same time, it's more of a question of does the server have sufficient resources (and for 1000000000000000000... it probably wouldn't).
|
|
|
|
|
Hey Guys
I konw this isnt a C# question but i dont know where else to post this question
i use SubVersion(Server) & TortoiseSVN(Client) at work for my ever growing application, now the server my repository is on needs to be formatted next week, dont know why...
does anybody know how to RE-REGISTER my repository on that server once it has been formatted? im new-ish to subversion myself and im the only one at work with half a clue how it works...
thanx
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
hi everyone
How do I get hardware id from client with c# or vb.net, I'd like to get cpu_id and ComputerSystemProduct.
source code I will run on MS windows server 2003 for get hardware id from client
thanks for advance
indy
|
|
|
|
|
Normally "serial hardware" is physical and can only be emulated in C# or VB.NET...
CPU Serial Numbers on the other hand are accessible via windows scripts:
http://www.microsoft.com/technet/scriptcenter/scripts/hardware/basic/hwbavb03.mspx?mfr=true[^]
At times the other info you're looking for is in the reg:
HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName
HKLM\SOFTWARE\Microsoft\PCHealth\HelpSvc\OEMInfo
If it is an OEM machine sometimes you can find that info in this .ini file also:
%systemroot%\system32\OEMINFO.INI under [General] there is a Manufacturer=
|
|
|
|
|
Hi
Please check in below link, for sample
www.eggheadecafe.com
Thank you
|
|
|
|
|
www.eggheadecafe.com[^]
I can't open this website may be server was problem
do you have any opinion for advise
thank you
indy
|
|
|
|
|
sorry
www.eggheadcafe.com
|
|
|
|
|
thank you for website
indy
|
|
|
|
|
HI all
I am trying to set the registry value on the remote machine. I am able to connect to the remote machine.
But while setting the value i am getting the error of INVALID HANDLE..
Here is the code snippet... Can any one tell exactly where i am getting wrong..
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace LastRegTry
{
class Program
{
[DllImport("advapi32")]
static extern int RegConnectRegistry(string machine, UIntPtr hKey, out UIntPtr pRemKey);
[DllImport("advapi32")]
static extern int RegCloseKey(UIntPtr hKey);
[DllImport("advapi32")]
static extern int RegSaveKey(IntPtr hKey, string fileout, IntPtr secdesc);
[DllImport("advapi32")]
static extern int RegOpenKeyEx(UIntPtr hKey, string lpSubKey, int ulOptions , int samDesired, UIntPtr
phkResult);
[DllImport("advapi32")]
static extern int RegSetValueEx(UIntPtr hKey, string lpValueName, int reserved, int dwType, string
lpData, int cbData);
private const int KEY_ALL_ACCESS = 0xF003F;
private const int KEY_READ = 0x20019;
public const int REG_SZ = 1;
static void Main(string[] args)
{
const uint HKEY_CLASSES_ROOT = 0x80000000;
const uint HKEY_CURRENT_USER = 0x80000001;
const uint HKEY_LOCAL_MACHINE = 0x80000002;
UIntPtr key = new UIntPtr(HKEY_LOCAL_MACHINE);
//remKeyUIntPtr hKey = UIntPtr.Zero;
UIntPtr remKey;
int ret = RegConnectRegistry("MYMACHINENAME", key, out remKey);
string appPath = "c:\\sumit";
if (ret == 0)
{
//int r = RegSaveKey(remKey, "c:\\regRootsave", IntPtr.Zero);
int r = RegOpenKeyEx(key, "Software\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx", 0,
KEY_ALL_ACCESS, remKey);
if (r != 0)
Console.WriteLine("Error: {0}", r);
int i = RegSetValueEx(remKey, "sumit", 0, REG_SZ, "vauletoset", appPath.Length);
if (i != 0)
Console.WriteLine("Error: {0}", i);
if (remKey != UIntPtr.Zero)
r = RegCloseKey(remKey);
}
}
}
}
Thanks in advance
|
|
|
|
|
Maybe this[^] helps.
For remote access, see this[^].
SkyWalker
|
|
|
|
|
Permissions?
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
I want to add system drives including dektop, network, my doc icons to my tree view.
How can i get the images of the drives and other drives of the system.
I used dirveinfo() but not doing my work.
|
|
|
|
|
You'd need to load those icons from the windows dll's that hold them and add um to an Imagelist. Then access the correct icon from the image list from there, or (depends on what you are trying to do) just add a System.Windows.Forms.FolderBrowserDialog
|
|
|
|
|
U can get system icon by pass the Index for systemIcon class.
|
|
|
|
|
Hello everyone,
I can not find an asynchronous HTTP server from Google. So, I write my own code. My two questions,
1. I am wondering whether my code is correct? (I have tested basic function, but I would like guru like you to give comments) do you have any better implementations for reference to achieve better throughput of server?
2. I call EndGetContext before retrieving request/response stream from HTTP context, in order to wake up server (so that another incoming HTTP request could be handled while current request is handled in process). My concern is whether call EndGetContext early before complete read/write request/response stream is safe -- is it safe to read/write request/response stream after calling EndGetContext - the data in the streams are still valid and not released?
My code,
public void StartListener()
{
IAsyncResult result;
server = new HttpListener();
server.Start();
while (true)
{
result = server.BeginGetContext(new AsyncCallback(this.MyHttpCallback), server);
result.AsyncWaitHandle.WaitOne();
}
}
private void HttpCallback(IAsyncResult result)
{
HttpListenerContext context = server.EndGetContext(result);
}
thanks in advance,
George
|
|
|
|
|
|
Hi SpacixOne,
All of them are TCP Listener based. I am HTTP Listener based. The APIs are different.
Any ideas to my original code?
regards,
George
|
|
|
|
|
Look alright from me, but depending on how much code/how fast your callback runs the infinite loop could waste lots of CPU time. Might want to put a System.Threading.Thread.Sleep(0); at the end of the loop. This should free it's timeslice if the method runs fast as the exmaple you provided would.
I'm not too sure of this, but you "could" build it this way, without the loop.
Add a delegate to your class, remove the the loop from the start method, and point the delegate to the start method for your HTTP listener.
Add to your callback method an invoke call to the your start method delegate to start another instance. With this the current instance would end when it finished, yet it spawned another instance RIGHT after the 1st one was nabbed. The idea there is that every time something "grabs" a HTTP request a new listener is started before the request is served...
I don't know if this is better or not; I've never needed the HTTPListener, but it might be worth testing out. Then again it might be a load of crap/waste of time... The logic "seems there" but I can't be sure... It might even crap out your server if 10000's of request hit it (to many thread ect..) you could even add a few volatile variables to ensure that didn't happen....
|
|
|
|
|
Thanks Spacix,
I am going to start your another approach, start method with a delegate. Now I want to ask two more questions about your comments to my original code.
1.
SpacixOne wrote: Look alright from me
You mean the asynchronous function is implemented ok? Means while the main HTTP Listener thread listens coming request, the received request will be procedded by HttpCallback method at the same time -- which is true asynchronous model? (what I want to void and want to have a code review is because I am afraid I have a wrong implementation which makes a synchronous model, other than an asynchronous model)
2.
SpacixOne wrote: your callback runs the infinite loop
Why do you think the callback (I think you mean method HttpCallback method) runs the while loop? It should be the HTTPListener main thread which runs the loop?
3.
"and point the delegate to the start method for your HTTP listener"
My understand is you mean pass the callback method as delegate to start method of HTTP Listener class instance. But the start method has no parameter. How could I add a delegate as an input parameter to start method?
http://msdn2.microsoft.com/en-us/library/system.net.httplistener.start.aspx[^]
regards,
George
|
|
|
|
|
1) Your code does the following:
Starts a HTTP listener, waits for a request and processes it in the callback function. Returns, hits the loop and starts another listener. I guess you could call it asynchronous since the implementation is of HTTP Listener waits for a request, processes it, and starts another wait for request. It doesn't run in an asynchronous state though, neither would mine.
2)Your callback function controls how much CPU the infinite loop uses. If it is short with lots of request then it is allowing the infinite loop to check if true==true 1000's of times.
3) The delegate would be used in place of the start method to start your HTTP Listener. You could then call BegineInvoke() on it to restart the listen server.
|
|
|
|
|
Sorry, Spacix!
1.
Do you mean my code is not working in asynchronous mode and I have to processing request one by one? I think my code could have multiple threads running HttpCallback at the same time?
2.
SpacixOne wrote: 2)Your callback function controls how much CPU the infinite loop uses. If it is short with lots of request then it is allowing the infinite loop to check if true==true 1000's of times.
3) The delegate would be used in place of the start method to start your HTTP Listener. You could then call BegineInvoke() on it to restart the listen server.
I am confused your above solution after reading a couple of times. Could you show some pesudo code please?
regards,
George
|
|
|
|
|
hi
i write this code to define a CodeConstructor object, it has a parameter named "connectionString" :
CodeConstructor constructor1 = new CodeConstructor();<br />
constructor1.Attributes = MemberAttributes.Public; <br />
ctd.Members.Add(constructor1);<br />
<br />
string fieldName = this.ToLowerFirstChar("connectionString");<br />
CodeMemberField field = new CodeMemberField(typeof(string), fieldName);<br />
field.Attributes = MemberAttributes.Private;<br />
ctd.Members.Add(field);<br />
<br />
CodeParameterDeclarationExpression p1 = new CodeParameterDeclarationExpression(field.Type, fieldName);<br />
constructor1.Parameters.Add(p1);
now, in body of constructor1, i want to assign value of p1 to field object, i write this code, but i don't know how to assign p1.value to field object :
CodeAssignStatement fieldAssignment = new CodeAssignStatement(new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), fieldName), new CodePrimitiveExpression(what do i write in this place ?));<br />
constructor1.Statements.Add(fieldAssignment);
thanks
|
|
|
|
|
This might be a simple question but I couldn't find a better solution t o resolve it..please help..
What I need is, I need to compare the domain name from my database, to check if it is match from what was being entered by user..
Example:
I have "abc.com" in my database, and when the user enter "hello@hi.abc.com", it need to return as True, meaning the subdomain "hi" will not be taken into consideration. When user enter "hello@hi.abc.com.org", it need to return as False.
I tried to split by "." after a substring of "@", but I couldnt match all of the cases and sometimes I will get the wrong answer..Is there any other better way instead of split, or ping that domain..
please help...thanks!
|
|
|
|
|
If there are a number of varying cases like that, maybe a regular expression would be better.
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
So you need to check whether the email address ends with "abc.com" or not, don't you?
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|