|
There's still a small problem.. The example is given like this
XslTransform xslt = new XslTransform();<br />
<br />
xslt.Load("http://server/favorite.xsl");<br />
<br />
XPathDocument mydata = new XPathDocument("inputdata.xml");<br />
<br />
XmlWriter writer = new XmlTextWriter(Console.Out);<br />
<br />
xslt.Transform(mydata,null,writer, null);<br />
<br />
The XmlWriter is throwing its output on the console but how can i throw the output on my webbrowser control w/o making a new file? the transormation doesnt create HTML it only chnges the way XML is diaplayed. infact it just collapses all the nodes
|
|
|
|
|
Rocky71 wrote: how can i throw the output on my webbrowser control
Hey Rocky, glad to see things are progressing. Before we move on to the next problem I would take a moment to note that your original post was rather vague on this second problem. Strict interpretation of it notes that you didn't want to re-write your XML "Source" file. The solution we discussed solves "that" problem.
Next make sure that writing the transformation output to disk actually is a problem and if it is then you can use the WebBrowser.Document property to access the HtmlDocument object which has a Write(...) method.
However, my experience doing that with complex javascript in the resulting HTML tells me that some odd behavior can occur using this approach. I don't remember the details but in one instance I had to accept the limitations presented at the DHTML level while in another instance I had to adopt a temporary file solution that wrote the transformation to disk.
Hope that helps
|
|
|
|
|
<blockquote class="FQ"><div class="FQA">led mike wrote:</div>your original post was rather vague on this second problem</blockquote>
u know what you're absolutely right!! I wasnt very clear in my mind myself
<blockquote class="FQ"><div class="FQA">led mike wrote:</div>The solution we discussed solves "that" problem</blockquote>
well I'm not so sure abt that. Bcz when i tried to make a new file I adds those <HTML> and some other 'unwanted' tags from HTML and the resultant output is not what I want. The problem is that when i add the refrence to my XSL file in the XML file and then open it in IE it shows the thing I want to see that is all nodes collapsed but when i try to put the transformation on the same XML file (without the reference to xsl file) it gets all messed up bcz of the added HTML tags in the new file made.
The XML files in my case can be very large in size I thinkits size can go into MBs as well so that was the reason I was trying to avoid this rewriting of file.
Actually to be honest I'm totally agaisnt this idea of showing an XML file in WebBrowser Control bcz large XML file can take forever to open up and I dont think there's any way in the world tat we can put some kind of transformation (like collapse all nodes) on without having to refresh the file and open it again + there is alot of chance of having to rewrite it again and offcourse that would be disastrous. I'm the junior most person in the team so who listens to a guy like me
Hope I got it quiet clear this time
Thanks for ur help
Rocky
|
|
|
|
|
Rocky71 wrote: I adds those and some other 'unwanted' tags from HTML and the resultant output is not what I want.
Then modify the XSLT to output "exactly" the HTML that you desire. Or I don't understand what you are saying.
Rocky71 wrote: I dont think there's any way in the world tat we can put some kind of transformation (like collapse all nodes) on without having to refresh the file and open it again
This is the first I am hearing about "collapse all nodes". Is this one of your requirements? When you post a question on a forum like this and leave out critical requirements you might get answers that take you down the wrong path. This may be one of those instances.
|
|
|
|
|
led mike wrote: This is the first I am hearing about "collapse all nodes". Is this one of your requirements?
well it was a requirement and I've already made an XSL file that collapses all nodes of an XML file in IE that is. I'll show you the code when i go back to office on Monday.
led mike wrote: Or I don't understand what you are saying.
well I've got a bit confused myself I think I have to look at the xsl file again when i get back on monday
Thanks a lot I appreciate it
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
Hi,
I have a windows forms GUI app which I would like to convert to run sliently.
The forms app has three input variables, which I have now put in a .config file.
Now, within the main program, I would like to call a module - it keeps coming back with error message.
within main - module - processXML(_source);
module definition: public void processXML(string _source)
error:
Error 1 An object reference is required for the nonstatic field, method, or property 'convertXML.onLoad.processXML(string)'
Any thoughts?
Many thanks.
|
|
|
|
|
This really needs more information, but making a couple of assumptions:
1. convertXML is your main form
2. onLoad is an event handler for the Form's Load event
Based on these assumptions, you can't write code like:
convertXML.onLoad.processXML(string) You would need to call your processXML method from inside the onLoad method.
A few other things...you really should adjust your naming conventions to follow the de-facto standard of camel casing. This would change your names to "ConvertXml", "OnLoad", and "ProcessXml".
Also, what is the intention of running this "silently"? Is this a process that is always supposed to be running in the background? If that is the case, you should think about converting this to run as a Windows service.
|
|
|
|
|
I need to then schedule this out on a windows scheduler to automate this whole process.
I cannot put this windows gui app in scheduler since it would require human interaction to enter those three input variables.
you are right about the assumptions.
Thanks - will try what you mentioned.
|
|
|
|
|
In that case, putting them in a config file or being able to accept them as command line parameters would be the right way to go.
|
|
|
|
|
I'm developing an application.It runs on a network.There is a login form .I want the application if i logged on another machine to exit the first application which logged first .Such as Yahoo login form.
How can i do that.
MD_NADA
|
|
|
|
|
Yahoo would do it by having the app always talk to a central server, which would know when you log in, that you already are, and send a message to the currently logged in copy, telling it to log out.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i have problem with using & operator to compare bytes[]
|
|
|
|
|
What kind of problem?
What is it that you are trying to do exactly? What have you tried? What did it do? How does that differ from what you expected?
---
single minded; short sighted; long gone;
|
|
|
|
|
i want to compare two byts array in c# or two binary value in sql , not diffrent .
and for this , i used the (&)(logic operator) to compare them but in both of them (C# and sql) an error appeared
|
|
|
|
|
You can't apply a binary operator on an array, you have to compare each byte in the arrays.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi there,
We are doing a particular C# project which has three sub systems running independent of each other. Three of us have done the development independently.
We need to combine all the three, in to one project now. Which is the best way to do it?
Each of them has a database. What should be done in order to make the final program run on just one database? Having three database would have certain concurrency issues, right?
Regards,
A
|
|
|
|
|
Sounds like a disaster. There's really no way to merge three projects magically into one.
You need a rewrite, probably.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
If each sub system needs to run independent of each other, would they be separately running executables? If so, you would want to leave them as separate projects and add all of them into a single solution.
When you say "Each of them has a database", do you mean each system has an embedded database or they each access SQL Server (or SQL Express)? If they are embedded databases, you might be ok as long as each process doesn't need access to the data from the other process. Having 3 databases would cause problems, but you can have one database that all three processes share using the same connection string.
|
|
|
|
|
if i have a image that is stored within a database, what is the syntax for me to view it on my asp page, preferabbly in an asp image control? what it is doing at the moment is loading the image onto the asp page but it takes up the full screen
Thanks
|
|
|
|
|
ASP, or ASP.NET ?
You probably want to resize it, otherwise you end up sending the full image down, even though it's viewed at a smaller size.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Dear Fellow Programmers,
I'm writing a console-based, portbinding shell program. The program listens on TCP port 4444. I then telnet, putty or netcat to port 4444 and I immediately get a shell. For example, from another PC:
C:\telnet 192.168.0.2 4444
and i get:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\>
Using only one PC, I could also telnet 127.0.0.1 4444 and it will also work.
However, my problem is, when I type a command, eg,
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\>dir
Nothing happens. There was not even any error response from the shell. i tried repeating many commands many times even providing the full path name, but no response. Any help and advise would be much appreciated. The complete source code is as below:
<br />
using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
using System.Runtime.InteropServices;<br />
using System.Net.Sockets;<br />
using System.IO;<br />
<br />
namespace RemoteCmdExe<br />
{<br />
class Program<br />
{<br />
#region win32 API Imports<br />
[DllImport("kernel32.dll", SetLastError = true)]<br />
static extern int CreatePipe(ref IntPtr phReadPipe, ref IntPtr phWritePipe,<br />
ref SECURITY_ATTRIBUTES lpPipeAttributes, int nSize);<br />
<br />
[StructLayout(LayoutKind.Sequential)]<br />
public struct SECURITY_ATTRIBUTES<br />
{<br />
public int Length;<br />
public IntPtr lpSecurityDescriptor;<br />
public bool bInheritHandle;<br />
}<br />
<br />
<br />
<br />
[DllImport("kernel32.dll")]<br />
private static extern bool CreateProcess(<br />
string lpApplicationName,<br />
string lpCommandLine,<br />
IntPtr lpProcessAttributes,<br />
IntPtr lpThreadAttributes,<br />
bool bInheritHandles,<br />
int dwCreationFlags,<br />
IntPtr lpEnvironment,<br />
string lpCurrentDirectory,<br />
ref STARTUPINFO lpStartupInfo,<br />
ref PROCESS_INFORMATION lpProcessInformation<br />
);<br />
<br />
[StructLayout(LayoutKind.Sequential)]<br />
private struct STARTUPINFO<br />
{<br />
public int cb;<br />
public string lpReserved;<br />
public string lpDesktop;<br />
public string lpTitle;<br />
public int dwX;<br />
public int dwY;<br />
public int dwXSize;<br />
public int dwYSize;<br />
public int dwXCountChars;<br />
public int dwYCountChars;<br />
public int dwFillAttribute;<br />
public int dwFlags;<br />
public short wShowWindow;<br />
public short cbReserved2;<br />
public IntPtr lpReserved2;<br />
public IntPtr hStdInput;<br />
public IntPtr hStdOutput;<br />
public IntPtr hStdError;<br />
}<br />
<br />
[StructLayout(LayoutKind.Sequential)]<br />
private struct PROCESS_INFORMATION<br />
{<br />
public IntPtr hProcess;<br />
public IntPtr hThread;<br />
public int dwProcessId;<br />
public int dwThreadId;<br />
}<br />
<br />
[DllImport("kernel32.dll", SetLastError = true)]<br />
static extern int PeekNamedPipe(IntPtr hNamedPipe, StringBuilder lpBuffer, int nBufferSize, ref int lpBytesRead, ref int lpTotalBytesAvail, ref int lpBytesLeftThisMessage);<br />
<br />
[DllImport("kernel32", SetLastError = true)]<br />
static extern bool ReadFile(IntPtr hFile,<br />
StringBuilder lpBuffer, int nBytesToRead,<br />
ref int nBytesRead, IntPtr overlapped);<br />
<br />
[DllImport("kernel32", SetLastError = true)]<br />
static extern bool WriteFile(IntPtr hFile,<br />
StringBuilder lpBuffer, int nBytesToWrite,<br />
ref int nBytesWritten, IntPtr overlapped);<br />
<br />
<br />
#endregion<br />
<br />
#region winAPI constants<br />
private const short SW_HIDE = 0;<br />
private const short SW_NORMAL = 1;<br />
private const int STARTF_USESTDHANDLES = 0x00000100;<br />
private const int STARTF_USESHOWWINDOW = 0x00000001;<br />
private const int UOI_NAME = 2;<br />
private const int STARTF_USEPOSITION = 0x00000004;<br />
private const int NORMAL_PRIORITY_CLASS = 0x00000020;<br />
private const long DESKTOP_CREATEWINDOW = 0x0002L;<br />
private const long DESKTOP_ENUMERATE = 0x0040L;<br />
private const long DESKTOP_WRITEOBJECTS = 0x0080L;<br />
private const long DESKTOP_SWITCHDESKTOP = 0x0100L;<br />
private const long DESKTOP_CREATEMENU = 0x0004L;<br />
private const long DESKTOP_HOOKCONTROL = 0x0008L;<br />
private const long DESKTOP_READOBJECTS = 0x0001L;<br />
private const long DESKTOP_JOURNALRECORD = 0x0010L;<br />
private const long DESKTOP_JOURNALPLAYBACK = 0x0020L;<br />
private const long AccessRights = DESKTOP_JOURNALRECORD | DESKTOP_JOURNALPLAYBACK | DESKTOP_CREATEWINDOW | DESKTOP_ENUMERATE | DESKTOP_WRITEOBJECTS | DESKTOP_SWITCHDESKTOP | DESKTOP_CREATEMENU | DESKTOP_HOOKCONTROL | DESKTOP_READOBJECTS;<br />
#endregion<br />
<br />
<br />
static void Main(string[] args)<br />
{<br />
int ret = 0;<br />
TcpListener tcpListener;<br />
Socket socketForClient;<br />
NetworkStream networkStream;<br />
StreamReader streamReader;<br />
StreamWriter streamWriter;<br />
<br />
<br />
SECURITY_ATTRIBUTES sa;<br />
sa.Length = 12;<br />
sa.lpSecurityDescriptor = IntPtr.Zero;<br />
sa.bInheritHandle = true;<br />
<br />
IntPtr hReadPipe1=IntPtr.Zero, hWritePipe1=IntPtr.Zero, <br />
hReadPipe2=IntPtr.Zero, hWritePipe2=IntPtr.Zero;
int nPipe1 = CreatePipe(ref hReadPipe1, ref hWritePipe1, ref sa, 0);<br />
int nPipe2 = CreatePipe(ref hReadPipe2, ref hWritePipe2, ref sa, 0);<br />
<br />
STARTUPINFO si = new STARTUPINFO();<br />
si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;<br />
si.wShowWindow = SW_HIDE;<br />
si.hStdInput = hReadPipe2;<br />
si.hStdOutput = si.hStdError = hWritePipe1;<br />
string cmdLine= "cmd.exe";<br />
PROCESS_INFORMATION ProcessInformation = new PROCESS_INFORMATION();<br />
bool result = CreateProcess(null, cmdLine, IntPtr.Zero, IntPtr.Zero, true, 0, IntPtr.Zero, null, ref si, ref ProcessInformation);<br />
<br />
int lBytesRead=0;
StringBuilder Buff = new StringBuilder(1024);<br />
int inta = 0, intb = 0; bool gotread = false,gotwrite=false;<br />
<br />
tcpListener = new TcpListener(System.Net.IPAddress.Any, 4444);<br />
tcpListener.Start();<br />
socketForClient = tcpListener.AcceptSocket();<br />
networkStream = new NetworkStream(socketForClient);<br />
streamReader = new StreamReader(networkStream);<br />
streamWriter = new StreamWriter(networkStream);<br />
<br />
string strRead = "";<br />
<br />
while (true)<br />
{<br />
Buff.Remove(0, Buff.Length);<br />
ret = PeekNamedPipe(hReadPipe1, Buff, 1024, ref lBytesRead, ref inta, ref intb);<br />
if (lBytesRead > 0)<br />
{<br />
gotread = ReadFile(hReadPipe1, Buff, lBytesRead, ref lBytesRead, IntPtr.Zero);<br />
if (!gotread) break;<br />
streamWriter.Write(Buff);<br />
streamWriter.Flush();<br />
}<br />
else<br />
{<br />
Buff.Remove(0, Buff.Length);<br />
Buff.Append(streamReader.ReadLine());<br />
int nBytesRead=Buff.Length;<br />
<br />
gotwrite=WriteFile(hWritePipe2, Buff, nBytesRead, ref nBytesRead, IntPtr.Zero);<br />
if (!gotwrite) break;<br />
}<br />
<br />
}<br />
<br />
}<br />
}<br />
}<br />
<br />
Thanks in advance!
Paul
Just code it
|
|
|
|
|
Dear Coders,
I've found the solution.
The command that is injected into the pipe must be terminated by the CR-LF (\r\n). Only then the shell (cmd.exe) can know when the command is terminated and will execute it immediately. The part of the code that needs to be changed is as follows:
<br />
Buff.Append(streamReader.ReadLine());<br />
Buff.Append("\r\n");<br />
Just append CR-LF to the Buff stringbuilder.
Thanks for reading!
We are disturbed not by events, but the views we take of them - Epictetus
|
|
|
|
|
|
when i use axMSFlexGrid 6.0 in Net it can't display correct unicode font. Can you help me? thanks.
QuynhTD
|
|
|
|
|
Doan Quynh wrote: axMSFlexGrid
That thing is nasty, why are you using it ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|