|
Hi Ian,
You get me wrong! I just want to know how NAnt can be able to achieve that.
I want to achieve this in my own custom xml script.
<Command id="1">
<DataIn>1234</DataIn>
<DataOut id="output">5555</DataOut>
</Command>
<Command id="2">
<DataIn>${output}</DataIn>
</Command>
I want to achieve the same way like what NAnt can do. But i do not
how know NAnt achieve that. I saw the source code, and there are so
many class files.
I am not looking for how to use NAnt with the property, just how to code the same way in my software.
Any tips please?
Thanks.
Regards,
Chua Wen Ching
Visit us at http://www.necoders.com
|
|
|
|
|
Hi
I am new to CSharp and have a question that might be quite straightforward to you gurus.
I have a system.collection.queue object. One thread X enque objects into this queue and another thread Y dequeues object and process them. I want to add a listener in thread Y so that anytime an object is enqueued into this queue, this method could be invoked. Any idea and code example in CSharp will be highly appreciated.
TIA
|
|
|
|
|
hello ,
I have a problem in retreiving the innerXml values from an XML File . The File is pasted below and the method I use is also listed below .
I want to list out the values Sylesh1,Sylesh2,sylesh3........ sylesh9 to an
arrayList .
The Method I use is... below but somehow I cannot retirve the values under the Path. Please point out my errors ?
XmlDocument _Document = new XmlDocument ();
_Document.Load (FileName);
XmlElement _Root = _Document.DocumentElement ;
XmlNodeList _NodeList = _Document.GetElementsByTagName
("configuration/userNames/sylesh/add/listGridCustomizations/myListGrid");
if (_NodeList.Count > 0)
{
foreach (XmlNode _Node in _NodeList)
{
List.Add(_Node.Attributes.GetNamedItem ("value").InnerText);
}
}
Any help ? suggestions ?
or if I'm wrong please point out ?
thanks Sylesh
<configuration>
<configsections>
<sectiongroup name="userNames">
<sectiongroup name="sylesh">
<sectiongroup name="listGridCustomizations">
<usernames>
<sylesh>
<add key="IsCustomized" value="false">
<listgridcustomizations><mylistgrid>
<add key="Column0" value="Sylesh0">
<add key="Column1" value="Sylesh1">
<add key="Column2" value="Sylesh2">
<add key="Column3" value="Sylesh3">
<add key="Column4" value="Sylesh4">
<add key="Column5" value="Sylesh5">
<add key="Column6" value="Sylesh6">
<add key="Column7" value="Sylesh7">
<add key="Column8" value="Sylesh8">
<add key="Column9" value="Sylesh9">
<listgridcustomizations><wrwerwer>
<add key="Column0" value="Sylesh0">
<add key="Column1" value="Sylesh1">
<add key="Column2" value="Sylesh2">
<add key="Column3" value="Sylesh3">
<add key="Column4" value="Sylesh4">
<add key="Column5" value="Sylesh5">
<add key="Column6" value="Sylesh6">
<add key="Column7" value="Sylesh7">
<add key="Column8" value="Sylesh8">
<add key="Column9" value="Sylesh9">
Thanks
Sylesh
sylesh
|
|
|
|
|
There is no xml in your question. I think you have to check the "Do not trest <'s as HTML tags", when you posting.
|
|
|
|
|
This is the Xml File ...
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="UserNames">
<sectionGroup name="Sylesh">
<sectionGroup name="ListGridCustomizations">
<section name="myListGrid" type="System.Configuration.NameValueSectionHandler,System,Version=1.0.5000.0, Culture=neutral,PublicKeyToken=b77a5c561934e089"/>
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
<UserNames>
<Sylesh>
<ListGridCustomizations>
<myListGrid>
<add key="IsCustomized" value="false" />
<add key="Column0" value="Sylesh0" />
<add key="Column1" value="Sylesh1" />
<add key="Column2" value="Sylesh2" />
<add key="Column3" value="Sylesh3" />
<add key="Column4" value="Sylesh4" />
<add key="Column5" value="Sylesh5" />
<add key="Column6" value="Sylesh6" />
<add key="Column7" value="Sylesh7" />
<add key="Column8" value="Sylesh8" />
<add key="Column9" value="Sylesh9" />
</myListGrid>
</ListGridCustomizations>
</Sylesh>
</UserNames>
</configuration>
Sorry !
|
|
|
|
|
For GetElementsByTagName, you should not pass the Xpath expression of node. Instead you have to pass the Name(should match the XmlElement.Name property) of the element.
In this case pass "add" instead of "configuration/userNames/sylesh/add/listGridCustomizations/myListGrid".
|
|
|
|
|
hello ,
I have a problem in retreiving the innerXml values from an XML File . The File is pasted below and the method I use is also listed below .
I want to list out the values Sylesh1,Sylesh2,sylesh3........ sylesh9 to an
arrayList .
The Method I use is... below but somehow I cannot retirve the values under the Path. Please point out my errors ?
XmlDocument _Document = new XmlDocument ();
_Document.Load (FileName);
XmlElement _Root = _Document.DocumentElement ;
XmlNodeList _NodeList = _Document.GetElementsByTagName
("configuration/userNames/sylesh/add/listGridCustomizations/myListGrid");
if (_NodeList.Count > 0)
{
foreach (XmlNode _Node in _NodeList)
{
List.Add(_Node.Attributes.GetNamedItem ("value").InnerText);
}
}
Any help ? suggestions ?
or if I'm wrong please point out ?
thanks Sylesh
<configuration>
<configsections>
<sectiongroup name="userNames">
<sectiongroup name="sylesh">
<sectiongroup name="listGridCustomizations">
<usernames>
<sylesh>
<add key="IsCustomized" value="false">
<listgridcustomizations><mylistgrid>
<add key="Column0" value="Sylesh0">
<add key="Column1" value="Sylesh1">
<add key="Column2" value="Sylesh2">
<add key="Column3" value="Sylesh3">
<add key="Column4" value="Sylesh4">
<add key="Column5" value="Sylesh5">
<add key="Column6" value="Sylesh6">
<add key="Column7" value="Sylesh7">
<add key="Column8" value="Sylesh8">
<add key="Column9" value="Sylesh9">
<listgridcustomizations><wrwerwer>
<add key="Column0" value="Sylesh0">
<add key="Column1" value="Sylesh1">
<add key="Column2" value="Sylesh2">
<add key="Column3" value="Sylesh3">
<add key="Column4" value="Sylesh4">
<add key="Column5" value="Sylesh5">
<add key="Column6" value="Sylesh6">
<add key="Column7" value="Sylesh7">
<add key="Column8" value="Sylesh8">
<add key="Column9" value="Sylesh9">
Thanks
Sylesh
|
|
|
|
|
I have question about browsable in propertygrid. I am trying to change browsable 's bool value bec sometimes it dont need to show all properties. Like sometimes First dont need to be browsable. I am well-aware that I cant change the browsable's value bec it need to be constant variable while it is run-time. what is your suggestions tht I can change browsable 's bool value while it is run-time?
For example:
for()
{
[Browsable(???)]///can be true or false
public string First
{
get { return m_strFirst; }
set { m_strFirst = value; }
}
[Browsable(???)]///can be true or false
public string Second
{
get { return m_strSecond; }
set { m_strSecond = value; }
}
[Browsable(????)]///can be true or false
public string Third
{
get { return m_strThird; }
set { m_strThird = value; }
}
}
|
|
|
|
|
Havent tested it but something like this should work (at least it should give you the idea of the right way):
<br />
public static void SwitchBrowsable(Type type, string propertyName) <br />
{<br />
object[] o = type.GetProperty(propertyName).GetCustomAttributes(typeof(BrowsableAttribute), true);<br />
if (o != null && o.Length > 0) <br />
{<br />
BrowsableAttribute ba = o[0] as BrowsableAttribute;<br />
ba.Browsable = !ba.Browsable;<br />
}<br />
}<br />
|
|
|
|
|
Thanks for the reply this messages. I followed your advice. I can get SwitchBrowsable working that can determines propertyName(First,Second,Third) is true or false. But I still cant change the bool value in property. I tried to use
ba.Browsable = !ba.Browsable;
but when I compiled and got error. it said:"
.ComponentModel.BrowsableAttribute.Browsable' cannot be assigned to -- it is read only"
I tried to used different ways to get bool value changed but no luck.
Do you have other ideas that need to fix like this:
ba.Browsable = !ba.Browsable;
|
|
|
|
|
Gurus,
Does anyone knows if the TreeView Controls that comes with .Net in WinForm has a sorting method ? Or I have to implement a callback function to achieve this. But before I head on and do this, wants to know if anyone has a better solution for this.
Stanley
|
|
|
|
|
Hi,
When my win app executes it opens in a maximized form and takes up 45,000K in mem. However, as soon as i minimize it, it cuts the mem usage in half. Is there are reason for this and is there any way of doing this type of mem clean up in the code. I tried using the garbage collection but it doesn't seem to do it.
thanks for any help
|
|
|
|
|
Minimising an app causes the OS to farm a lot of the memory it uses out to disk. It happens with every app.
Rugby League: The Greatest Game Of All.
|
|
|
|
|
That’s the OSs memory management and optimization in action
If you minimize an app, it does not need to be as responsive as an active app. So the OS optimizes the situation by moving most of the app data to virtual memory, so the physical memory usage is reduced and that real estate is available for active foreground apps. If you maximize it again, the reverse thing happens.
Salil Khedkar [^]
|
|
|
|
|
hi
i have a form
sometimes(i dont know when and for what)
something happens that i can not close the form ie
when i click on the closeButton on the right upper corner of form
nothing happens and the application doesnt exit.
what should i do???
|
|
|
|
|
Your comments are rather nebulous; it's hard to say what is going on without you posting some code.
|
|
|
|
|
Nick Parker wrote:
nebulous
Yikes... I had to look that one up. Congrats on the MVP, Nick. Well deserved.
--Jesse
|
|
|
|
|
Thanks
|
|
|
|
|
That could be the infamous "Form not closing"-bug that's caused by child controls being removed from the form while they have focus.
Are you removing controls from your form at run-time?
That could be the problem.
In that case try setting the focus to a control remaining on the form before removing the other one.
Regards,
mav
|
|
|
|
|
I'm currently working on a project using a third-party tool. All of the data I'm working with is handled via MemoryStream for the most part, and in most cases need never be written to disk. (Completed document is streamed to the browser, then the stream discarded.)
Unfortunately, the 3rd-party tool I'm using only operates on files (both input and output.) I'd like to avoid having temp files everywhere if at all possible.
Is there any way through .Net that I can create an old-fashioned RAM disk to do this processing on? It'd be even better if there were a way to have a FAT record point to a memory buffer that already exists instead of having to actually duplicate the data on the RAM disk, but even that's preferable to actual disk I/O.
Thanks for whatever pointers anyone can give me.
(BTW, for those who're interested, or if it makes a difference, the 3rd-party tool I'm working with is GhostScript.)
Grim (aka Toby) MCDBA, MCSD, MCP+SB
SELECT * FROM user WHERE clue IS NOT NULL
GO
(0 row(s) affected)
|
|
|
|
|
Not the answer you're directly looking for, but GhostScript is open source, so one solution would be to hack into GS the ability to read your data directly from RAM
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
True, but I'm on a short timeline, which is the main reason I'm using 3rd-party tools in the first place.
We had found a few 3rd-party solutions for doing what we actually need from ghostscript, but they all have their own problems. In some cases, they can't even render the PDF properly. That's the only reason I'm even looking at anything as low-level as Ghostscript.
Grim (aka Toby) MCDBA, MCSD, MCP+SB
SELECT * FROM user WHERE clue IS NOT NULL
GO
(0 row(s) affected)
|
|
|
|
|
Hi
I want to write a little Tool in c# that is scanning
the Network and list all founded Computers.. I think
I should use WMI. But I don't know how to scan te Network.
Can anybody help?
Greetings from Germany
|
|
|
|
|
Use NetServerEnum() API to get the list. Here is the complete code:
<code>using System;
using System.Net;
using System.Runtime.InteropServices;
namespace EnumDomainMachines
{
class AppClass
{
[STAThread]
static void Main(string[] args)
{
NetMachinesEnum NetMachinesEnumurator = new NetMachinesEnum();
NetMachinesEnumurator.PrintList();
Console.ReadLine();
}
}
class NetMachinesEnum
{
// server types accepted by the NetServerEnum function
public enum SV_101_TYPES:uint
{
SV_TYPE_WORKSTATION= 0x00000001,
SV_TYPE_SERVER= 0x00000002,
SV_TYPE_SQLSERVER = 0x00000004,
SV_TYPE_DOMAIN_CTRL= 0x00000008,
SV_TYPE_DOMAIN_BAKCTRL= 0x00000010,
SV_TYPE_TIME_SOURCE= 0x00000020,
SV_TYPE_AFP= 0x00000040,
SV_TYPE_NOVELL= 0x00000080,
SV_TYPE_DOMAIN_MEMBER = 0x00000100,
SV_TYPE_PRINTQ_SERVER = 0x00000200,
SV_TYPE_DIALIN_SERVER = 0x00000400,
SV_TYPE_XENIX_SERVER = 0x00000800,
SV_TYPE_SERVER_UNIX= SV_TYPE_XENIX_SERVER,
SV_TYPE_NT= 0x00001000,
SV_TYPE_WFW= 0x00002000,
SV_TYPE_SERVER_MFPN= 0x00004000,
SV_TYPE_SERVER_NT = 0x00008000,
SV_TYPE_POTENTIAL_BROWSER = 0x00010000,
SV_TYPE_BACKUP_BROWSER= 0x00020000,
SV_TYPE_MASTER_BROWSER= 0x00040000,
SV_TYPE_DOMAIN_MASTER = 0x00080000,
SV_TYPE_SERVER_OSF= 0x00100000,
SV_TYPE_SERVER_VMS= 0x00200000,
SV_TYPE_WINDOWS= 0x00400000, SV_TYPE_DFS= 0x00800000, SV_TYPE_CLUSTER_NT= 0x01000000, SV_TYPE_TERMINALSERVER= 0x02000000, SV_TYPE_CLUSTER_VS_NT = 0x04000000, SV_TYPE_DCE= 0x10000000, SV_TYPE_ALTERNATE_XPORT= 0x20000000, SV_TYPE_LOCAL_LIST_ONLY= 0x40000000, SV_TYPE_DOMAIN_ENUM= 0x80000000,
SV_TYPE_ALL= 0xFFFFFFFF
};
// Server info function, returned by the NetServerEnum function
[StructLayout(LayoutKind.Sequential)]
public struct SERVER_INFO_101
{
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.U4)]
public UInt32 sv101_platform_id;
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
public string sv101_name;
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.U4)] public UInt32 sv101_version_major;
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.U4)] public UInt32 sv101_version_minor;
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.U4)] public UInt32 sv101_type;
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)] public string sv101_comment;
};
public enum PLATFORM_ID
{
PLATFORM_ID_DOS = 300,
PLATFORM_ID_OS2 = 400,
PLATFORM_ID_NT = 500,
PLATFORM_ID_OSF = 600,
PLATFORM_ID_VMS = 700
};
// constants
public const uint ERROR_SUCCESS = 0;
public const uint ERROR_MORE_DATA = 234;
// System functions
// Imported from the NET api (See MSDN for more details)
[DllImport("netapi32.dll",EntryPoint="NetServerEnum")]
public static extern int NetServerEnum( [MarshalAs(UnmanagedType.LPWStr)]string servername,
int level,
out IntPtr bufptr,
int prefmaxlen,
ref int entriesread,
ref int totalentries,
SV_101_TYPES servertype,
[MarshalAs(UnmanagedType.LPWStr)]string domain,
int resume_handle);
[DllImport("netapi32.dll",EntryPoint="NetApiBufferFree")]
public static extern int
NetApiBufferFree(IntPtr buffer);
[DllImport ("Netapi32", CharSet=CharSet.Unicode)]
public static extern int NetMessageBufferSend(
string servername,
string msgname,
string fromname,
string buf,
int buflen);
public string GetIPAddress(string sHostName)
{
try
{
IPHostEntry ipEntry = Dns.GetHostByName(sHostName);
IPAddress [] addr = ipEntry.AddressList;
string sIPAddress = addr[0].ToString();
return sIPAddress;
}
catch
{
return("Unknown");
}
}
public void PrintList()
{
int entriesread=0,totalentries=0;
do
{
// Buffer to store the available servers
// Filled by the NetServerEnum function
IntPtr buf = new IntPtr();
// Server structure
SERVER_INFO_101 server;
// call NetServerEnum function. The '101' defines the type of
// structure returned, in this case, SERVER_INFO_101 which contains
// the type of information we need. In the preferred max length parameter
// '-1' is passed to tell the function to allocate the necessary amount of
// memory for the data. The SV_TYPE_WORKSTATION tells the function to only
// return workstation type servers.
int ret = NetServerEnum(null,101,out buf,-1,
ref entriesread,ref totalentries,
SV_101_TYPES.SV_TYPE_ALL,null,0);
// if the function returned any data, fill the tree view
if( ret == ERROR_SUCCESS ||
ret == ERROR_MORE_DATA ||
entriesread > 0)
{
Int32 ptr = buf.ToInt32();
Console.WriteLine("--------------------------------------------------------------------------");
Console.WriteLine(string.Format("{0,15} {1,17} {2,15} {3} {4} {5}",
"PLATFORM_ID",
"IP_ADDR",
"SERVER_TYPE",
"V",
"NO",
"COMMENT"));
Console.WriteLine("--------------------------------------------------------------------------");
for(int i=0; i<entriesread; i++)
{
// cast the pointer to a SERVER_INFO_101 structure
server = (SERVER_INFO_101)Marshal.PtrToStructure(new IntPtr(ptr),typeof(SERVER_INFO_101));
ptr += Marshal.SizeOf(server);
// add the workstation name to the tree view
Console.WriteLine(string.Format("{0,15} {1,17} {2,15} v{3}.{4} ({5})",
server.sv101_name.ToLower(),
GetIPAddress(server.sv101_name),
(PLATFORM_ID)server.sv101_platform_id,
server.sv101_version_major,
server.sv101_version_minor,
server.sv101_comment));
}
Console.WriteLine("--------------------------------------------------------------------------");
}
else
{
// no servers found
Console.WriteLine("No servers found in network");
}
// free the buffer
NetApiBufferFree(buf);
} while(
entriesread < totalentries &&
entriesread != 0
);
}
}
}
</code>
|
|
|
|
|
Hi Salil
Thank you for your reply! I'm really glad to get something
that I'm looking for a long time. But I get some Syntax Errors
when I try to compile your code. I don't want to change something.
for(int i=0; i **** ; expected******
{ **** invalid expression term'{' *****
Do you got the same Problems??
Regards
|
|
|
|
|