|
|
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
|
|
|
|
|
I known what you mean but...
I haven't found any ways to do this exercise, i am begener and live in the country that IT is weak. My experience in C# is not really good.
If you have time, plz help me.
thankssssssss alot
|
|
|
|
|
rockxuyenmandem wrote: I haven't found any ways to do this exercise
Have you actually tried? If so what have you tried. It looks like you want somebody to do the whole thing for you!
rockxuyenmandem wrote: am begener and live in the country that IT is weak
This is no excuse for not doing your homework!
rockxuyenmandem wrote: My experience in C# is not really good.
Hence why you are given homework, so that you can learn. If you are totally stuck on where to start can I sugggest you either a) Attend your classes and/or b) Seek advice from your tutor.
rockxuyenmandem wrote: If you have time, plz help me.
More than willing to help, but I wont do your homework as already stated.
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
Voted 1 because:
a) we don't do your homework for you
b) you've posted this before
c) the problem is really neither interesting or all that advanced
If you're really stuck start with the MSDN documentation for the string class. You might also find the Regex class and the DateTime class useful.
Show that you are actually making an effort and somebody can problem help you with specific problems.
-- modified at 11:28 Thursday 11th May, 2006
|
|
|
|
|
d) it is the second time he posts the same question.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
|