|
i can't check it at the moment but that sounds about right. So thank you very much.
Where did you fid that strange bit of information. Can't think I would have come up with that.
|
|
|
|
|
>> Where did you find that strange bit of information
It is not so strange if you analyze it. Those aren't "magical" numbers in that equation:
DateTime.FromFileTime(10000000 * (long)timet + 116444736000000000)
You can see from the method name that the quantity in parentheses is a FileTime. You already know that time_t is seconds since 1/1/1970. A FileTime is a long representing 100 nanosecond intervals since 1/1/1601. So all you need to do is multiply the time_t by 1e7 to get 100 nanosecond intervals, and then add the number of 100 nanosecond intervals between 1/1/1601 and 1/1/1970, which is easily calculated. Perfectly logical, no? Hahaha.
|
|
|
|
|
Went to work , tested and thats it.Thank you
|
|
|
|
|
how do i fill my dataset with a parameter.
i use a access database.
I use the following select command:
WHERE T075_BORGTOCHTNUMMER_1 LIKE ?
and this code i use to fill my dataset:
<br />
this.dBANBM_T075_BORGTOCHTTableAdapter.FillBy1(this.testdb1DataSet.DBANBM_T075_BORGTOCHT, textBox1.Text.ToString);<br />
The value that's in my textbox on the form is called VAL.
this VAL i put in a string.
the error he returns is:
No overload for method 'FillBy1' takes '1' arguments
I really have no idee to do this.
|
|
|
|
|
Hii,
In ASP.Net Application how can i show tool tip...
Aur any other alternative...
Thanx & Regards
Anuj Kamthan
Software Developer
Solversa Technologies,
Pune - 411007, India.
http://www.solversa.com
|
|
|
|
|
|
I have read the artical but there is no property given in this custom control where i can give tool tip text...
Thanx
Anuj Kamthan
Software Developer
Solversa Technologies,
Pune - 411007, India.
http://www.solversa.com
|
|
|
|
|
From the front end just add <foo title="my tooltip text" >.
Code behind: control.Attributes["title"] = "my tooltip text";
Look at NiceTitle.js to make it prettier
|
|
|
|
|
Thanx for your reply...But the way u wrote it's not Working...my side.
-- modified at 7:55 Friday 12th May, 2006
|
|
|
|
|
Hi
In an XML file, I am getting date as YYYYMMDD and time as HHMMSS.
How can I convert this date to DD-MM-YYYY or DD/MM/YYYY
and time as HH:MM:SS
Thanks for the response
|
|
|
|
|
r u reading the xml file with dataset object...
Anuj Kamthan
Software Developer
Solversa Technologies,
Pune - 411007, India.
http://www.solversa.com
|
|
|
|
|
Convert.ToDateTime( ) function will help you out
|
|
|
|
|
I am reading it like:
<br />
XmlNode date= document.SelectSingleNode("Response/Date");<br />
string newDate = Convert.TodateTime(date.InnerText).toString(); <br />
But at run time, I get ths error:
"String was not recognized as a valid DateTime. "
The value of the xml element is: 20060502
regrds
|
|
|
|
|
huh, why would you first convert it to a DateTime object and then again to a string?
But okay you get an error and we'll solve it!
Okay indead, when you should have 2006-05-02 then the previous solution should work, but you don't have that! So the next solution is:
string strDate = "20060502";
DateTime dtDate = DateTime.ParseExact( strDate, "yyyyMMdd", CultureInfo.InvariantCulture );
strDate = dtDate.ToString();
Greetings,
KrIstOfK
|
|
|
|
|
Thanks KrIstOfK . Your solution worked perfectly well.
I am just curious whats the difference between 'YYYYMMDD' and 'yyyyMMdd'
Similarly, if I have time=091200:
why does hhMMss return '09:00' and HHmmss return '09:12'
thanks
|
|
|
|
|
|
I have been using the following code for a long time to retrieve service information from WinNT 4 server SP6a, Windows2000 (most service packs) and Windows 2003 :
ServiceController[] AvailableServices;
AvailableServices = ServiceController.GetServices("ServerName");
We have recently just installed SP1 for Windows 2003 on a number of servers and now I get an acces denied/permissions error come back when running the code
I have tried most combinations of putting the the network account running the application with the code in to the built in local groups on the remote server and the only combination that works is if i add the network account to the local admin group.
Does anyone know if there is a way to allow this to work with out the need for having the network account in the local admin group (we dont really want this on all our servers)
Thanks for any help
|
|
|
|
|
This is a very annoying security "enhancement" foisted upon you by SP1. We had the same issue. Fortunately, although our software might not be running as the administrator user, it does know the account and password of the administrator user. Given that, we check if the OS we are running on is Windows 2003 SP1. If so, we impersonate the administrator user and then run the following program. Sorry that the formatting is gone from the code below, but I don't know how to avoid that on code project.
<br />
<br />
<br />
<br />
#include <windows.h><br />
#include <aclapi.h><br />
#include <stdio.h><br />
#include <tchar.h><br />
<br />
void DisplayError(DWORD dwError, LPTSTR pszAPI)<br />
{<br />
char szMessageBuffer[2048];<br />
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,<br />
NULL, dwError,<br />
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),<br />
szMessageBuffer, sizeof(szMessageBuffer), NULL);<br />
<br />
_tprintf(TEXT("ERROR: API = %s.\n"), pszAPI);<br />
_tprintf(TEXT(" error code = %u.\n"), dwError);<br />
_tprintf(TEXT(" message = %s.\n"), szMessageBuffer);<br />
<br />
ExitProcess(dwError);<br />
}<br />
<br />
void _tmain(int argc, TCHAR *argv[])<br />
{<br />
BOOL bDaclPresent = FALSE;<br />
BOOL bDaclDefaulted = FALSE;<br />
DWORD dwError = 0;<br />
DWORD dwSize = 0;<br />
EXPLICIT_ACCESS ea;<br />
PACL pacl = NULL;<br />
PACL pNewAcl = NULL;<br />
SC_HANDLE schManager = NULL;<br />
SC_HANDLE schService = NULL;<br />
SECURITY_DESCRIPTOR sd;<br />
<br />
PSECURITY_DESCRIPTOR psd = (PSECURITY_DESCRIPTOR)malloc(10000);<br />
BOOL bFreed = FALSE;<br />
<br />
if (argc != 3)<br />
{<br />
_tprintf(TEXT("Usage: %s [service name] [non-Administrator-acct]\n"), argv[0]);<br />
return;<br />
}<br />
<br />
char szService[80];<br />
strcpy(szService, argv[1]);<br />
<br />
schManager = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);<br />
if (schManager == NULL)<br />
DisplayError(GetLastError(), TEXT("OpenSCManager"));<br />
<br />
schService = OpenService(schManager, argv[1],<br />
READ_CONTROL | WRITE_DAC);<br />
if (schService == NULL)<br />
DisplayError(GetLastError(), TEXT("OpenService"));<br />
<br />
if (!QueryServiceObjectSecurity(schService, DACL_SECURITY_INFORMATION, psd, 0, &dwSize))<br />
{<br />
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)<br />
{<br />
free(psd);<br />
bFreed = TRUE;<br />
psd = (PSECURITY_DESCRIPTOR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize);<br />
if (psd == NULL)<br />
{<br />
DisplayError(0, TEXT("HeapAlloc"));<br />
}<br />
<br />
if (!QueryServiceObjectSecurity(schService, DACL_SECURITY_INFORMATION, psd, dwSize, &dwSize))<br />
DisplayError(GetLastError(), TEXT("QueryServiceObjectSecurity"));<br />
}<br />
else<br />
DisplayError(GetLastError(), TEXT("QueryServiceObjectSecurity"));<br />
}<br />
<br />
if (!GetSecurityDescriptorDacl(psd, &bDaclPresent, &pacl, &bDaclDefaulted))<br />
DisplayError(GetLastError(), TEXT("GetSecurityDescriptorDacl"));<br />
<br />
BuildExplicitAccessWithName(&ea, argv[2], SERVICE_START | SERVICE_STOP | READ_CONTROL | DELETE,<br />
SET_ACCESS, NO_INHERITANCE);<br />
<br />
dwError = SetEntriesInAcl(1, &ea, pacl, &pNewAcl);<br />
if (dwError != ERROR_SUCCESS)<br />
DisplayError(dwError, TEXT("SetEntriesInAcl"));<br />
<br />
if (!InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION))<br />
DisplayError(GetLastError(), TEXT("InitializeSecurityDescriptor"));<br />
<br />
if (!SetSecurityDescriptorDacl(&sd, TRUE, pNewAcl, FALSE))<br />
DisplayError(GetLastError(), TEXT("SetSecurityDescriptorDacl"));<br />
<br />
if (!SetServiceObjectSecurity(schService, DACL_SECURITY_INFORMATION, &sd))<br />
DisplayError(GetLastError(), TEXT("SetServiceObjectSecurity"));<br />
<br />
if (!CloseServiceHandle(schManager))<br />
DisplayError(GetLastError(), TEXT("CloseServiceHandle"));<br />
<br />
if (!CloseServiceHandle(schService))<br />
DisplayError(GetLastError(), TEXT("CloseServiceHandle"));<br />
<br />
LocalFree((HLOCAL)pNewAcl);<br />
if (bFreed)<br />
HeapFree(GetProcessHeap(), 0, (LPVOID)psd);<br />
else<br />
free(psd);<br />
}<br />
|
|
|
|
|
Hi,
Thank you very much for your reply (and code)
It sounds like the only way is to access as a local admin, but we do not want to do this by any method, we are monitoring service status on 80+ servers (not all windows 2003 sp1) and do not want 1 (or any application) knowing local admin password to any of the servers let alone all of our servers
Maybe creating a service that runs as system on each of the servers, so that the application asks the service on each server for the status of the required services on that server and the service then queries the services. Did not really want to install any compenent on the servers though.
Do you know if running as system would be able to access service information?
Thanks for your help
|
|
|
|
|
Rendili wrote: Do you know if running as system would be able to access service information?
Yes, that is actually the preferred method.
|
|
|
|
|
ok, thank you, i will think about writing a client service for those servers
|
|
|
|
|
hi all,
i want user to define table names but i dont know how to use textbox.texts in queries ???
for example :
this: c = new OleDbCommand("Create Table textbox1.Text ( name char(10), surname char(10), age integer , phone char(12), email char(20))",s);
or this : c = new OleDbCommand("Create Table {0} ( name char(10), surname char(10), age integer , phone char(12), email char(20))",s,textbox1.Text);
gives error
how can i use textbox1.Text as my table name ?
and secondly :
c = new OleDbCommand("insert into {0} values({1},{2},{3},{4},{5})", s, textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text, textBox6.Text);
how should i change the line above ?
thanks in advance ...
|
|
|
|
|
Mehmet Fatih Akbulut wrote: this: c = new OleDbCommand("Create Table textbox1.Text ( name char(10), surname char(10), age integer , phone char(12), email char(20))",s);
or this : c = new OleDbCommand("Create Table {0} ( name char(10), surname char(10), age integer , phone char(12), email char(20))",s,textbox1.Text);
You could do this:
c = new OleDbCommand("Create Table " + textbox1.Text + " (name char(10), surname char(10), age integer, phone char(12), email char(20))",s);
or this:
c = new OleDbCommand("Create Table ? (name char(10),surname char(10), age integer, phone char(12), email char(20))",s);
c.Parameters.Add("table",textbox1.Text);
|
|
|
|
|
HTTP has been In use by the WWW global Information Initiative since 1990 and nowadays It Is one of the most widely used protocols on the Internet
HTTP application have historically allowed three different formats for the representation of date/time stamps (described In RFC 2616)
1. RFC 1123 format, for example
Sun, 06 Nov 2005 08:49:37 GMT
2. RFC 1036 format, for example
Sunday, 06-Nov-05 08:49:37 GMT
3. ANSI C's asctime() format, for example
Sun Nov 6 08:49:37 2005
An Implementation Is not HTTP 1.1 compliant If It fails to understand one of the above date/time formats
Question 1
You are require to write an HTTP 1.1 compliant program to parse a string containing one of the above date/time formats. The program must detect the date/time format automatically based on the Input string and store the result In the following object
Class MyDate
{
public Int day; /*1 to 31*/
public Int month; /*1 to 12*/
public Int year; /*1970 to 9999*/
public Int hour; /*0 to 23*/
public Int minute; /*0 to 59*/
public Int second; /*0 to 59*/
public Int dayofweek; /* 0= Sun, 1=Mon,etc* /
}
Question 2
Develop a program to display the system date/time In the RFC 1123 format(as show In example)
=====================================================
I have no idea to do this exercise, please help me.
Thanks alot.
Good luck.
|
|
|
|
|
Do your own homework! If/When you get stuck on a specific coding question then feel free to post it and people here will be more than happy to help.
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|