|
Hi,
I want to make a search with xQuery but while I am a beginner I got an "invalid token" with my query and cannot figure it out why it occurs.
Here is my xml part :
<archive><br />
<image name="" path=""><br />
<olay><br />
</olay><br />
<yer><br />
</yer><br />
<zaman><br />
<gecegunduz><br />
</gecegunduz><br />
<saat><br />
</saat><br />
<gun><br />
</gun><br />
<ay><br />
</ay><br />
<yil><br />
</yil><br />
</zaman><br />
<anahtar><br />
<item><br />
</item><br />
</anahtar><br />
</image><br />
</archive>
and this is my query :
query = "for $x in /archive/image return if ((contains($x/@name," + c + ") or (contains($x/@path," + c + ") or (contains($x/olay," + c + ") or (contains($x/yer," + c + ") or (contains($x/zaman/saat," + c + ") or (contains($x/zaman/gun," + c + ") or (contains($x/zaman/ay," + c + ") or (contains($x/zaman/yil," + c + ") or (contains($x/anahtar/item," + c + ")) then return $x";
I simply follow the pattern of msdn :
XPathDocument xPathDoc = new XPathDocument(@"C:\test.xml");<br />
XPathNavigator xPathNav = xPathDoc.CreateNavigator();<br />
XPathExpression xPathExpr = xPathNav.Compile(query);<br />
XPathNodeIterator xPathIter = xPathNav.Select(xPathExpr);
so what is wrong with this ? Please help..
p.s. : the exact thing I try to do is making a complete search inside my xml document. when the user writes something in the textbox and click search, using this query, I try to get every node containing the keyword anywhere inside..
best regards..!
-- modified at 6:34 Monday 14th August, 2006
.:: Something is Wrong ::.
|
|
|
|
|
Hi.
Im working on a MDI-application in C#.
For this i want to realize modal dialogs, which are only valid for the calling mdi-child.
that means, if i activate/click on another mdi-child, it will be activated, despite of the modal dialog in the other child.
in my current approache i show a modal dialog as a normal form. by handling the activate/deactivate-events i tried to simulate the behaviour of a modal dialog by calling the Activate()-method on the form that should be modal. but that doesn't work.
i tried to call Activate() on the modal form in the Deactivate-handler of itself and in the Activate-handler of the owner. both doesn't work.
is there perhaps any possibility to cancel the deactivation of a form?
here is the relevant code in the main-form:
//method in the MainForm, that is called when an MDI-child wants to show a dialog
public void ShowAsModalForm(MdiForm modal, MdiForm owner)
{
owner.Tag = modal; //save current displayed dialog for the child in a member-variable
modal.Deactivate += new EventHandler(Modal_Deactivate);
owner.Activated += new EventHandler(ModalOwner_Activated);
modal.Show();
}
//the owner of a modal dialog was activated
void ModalOwner_Activated(object sender, EventArgs e)
{
Form owner = sender as Form;
if (owner != null)
{
Form modal = owner.Tag as Form; //getting the current modal-form form the member an activate it
if (modal != null)
modal.Activate();
}
}
//the modal dialog was deactivated
private void Modal_Deactivate(object sender, EventArgs e)
{
Form modal = sender as Form;
if (modal != null) //activate it
modal.Activate();
}
the ModalOwner_Activated-Method seems never called, though registered in Activated-event.
the other possibility is Modal_Deactivate, which is called on deactivation but modal.Activate() has no effect, not thinking about thats the wrong way, because by handling the deactivate-event i can't decide if the modal dialog should be shown or not (because the user clicked on a other mdi-child).
Can anyone help me?
thx
|
|
|
|
|
Hi All,
I have an EXE program which runs as a Windows Service on my Windows 2000 professional system. The programs runs fine while running as a service. The problem is that if I log off the current user, the my service stops. But if we refer to the SQL Server service manager, it continues to run if we log off or shutdown or restart the system . Even the actions are reflected in every login. Like if in any login we stop the SQL Server Agent, then in other login(on the same system) also the SQL Server Agent is in stopped status.
So howcome i implement this kind of functionality in my windows service.
Any help will be greatly appreciated
Thanks in advance
Deepz
|
|
|
|
|
Why not you check which user account it is using to run.
The sql service could be using some account like "service account" or "local system account". you might need to use something like that to keep your exe running.
Hope this helps
- ashish
|
|
|
|
|
Hi,
I am currently working on a project named "motion detection to control pc". It is a project which can assist paralysed patient to access the pc using facial movement.
I have a webcam capturing movement of head and translate it to mouse(cursor) movement.
I can move the mouse(cursor) by using the Cursor.property function, however, i am still unable to double click/right click the mouse using codes.
Any can help?
*****************************************************************************
Cursor.Position = new Point(Cursor.Position.X - 0, Cursor.Position.Y - 80);
*****************************************************************************
Thanks~
|
|
|
|
|
One way would be to interop out to the Windows SDK, and use SendMessage to send a mouse click windows message to the control. A VB version of something 'similar' is here.[^]
Regards
Malc
*********************************************
|
|
|
|
|
How do we send a file in batch mode to a computer in the same network?
Luck is Opportunity with hardwork
|
|
|
|
|
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
string targetComputerPath = "//myServer/myShare/";
string sourceComputerPath = "c:/test/";
ArrayList myFiles = new ArrayList();
myFiles.Add("file1.txt");
myFiles.Add("file2.txt");
myFiles.Add("file3.txt");
foreach (string fileName in myFiles)
{
string target = targetComputerPath + fileName;
string source = sourceComputerPath + fileName;
System.IO.File.Copy(source , target);
}
}
}
}
and then there's error handling to think of...
Regards
Malc
*********************************************
|
|
|
|
|
Thank you..
Luck is Opportunity with hardwork
|
|
|
|
|
Hi All!
I have a problem!
I just got the VS8 which has the SplitContainer, and i do not know how to work with it, the problem is that i have a form,without panels for now, that contains 2 list box and 2 tree views, that are arrange like this:
TreeView1 ListBox1
TreeView2 ListBox2
they all cover the form exectlly the same size, so the form looks like 4 white squares, so now i want to save this resize, i mean i want them to grow or to get small when i resize the form, how can i keep the precentage of the controls with the SplitContainer.
Thank you for your help .
|
|
|
|
|
control_name.Dock = Dock.Fill;
|
|
|
|
|
I only add the Spliter Container and give to all the controlls Dock property the Dock.Fill value?
|
|
|
|
|
spliter container in form. set it to Dock.Fill.
treegird or others in split container. set it to Dock.Fill too.
|
|
|
|
|
Hi all,
I have some basic questions about threading.
1. Is my windows application a single threaded or multithreaded?
2. If i create some thread objects or windows/thread/system timer would my windows application is a multithreaded one??
3. Suppose if my windows application registerd an event with COM exe. then if the event occurs will it run in a separate thread or in the GUI thread?
4. What does it mean STA AND MTA? what is significance of thest Thread apartment model?
5. is it possible to a share a class library by two application running in separate appdomain? if so how?
i googled for the above questions, but understand a little.. if anybodys knows plz share..also give some tips/links on this.
Thanks and Regards,
Srini
|
|
|
|
|
Here are some of the answers:
2. The timer control uses the message pump to handle events, so it doesn't use threading. The other timers start separate threads to handle events.
5. You can use the same library from different applications, but they are separate instances of the library, so you can't share data between applications that way.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks for reply!
This is with respect to my 5th question.
So how to share the dlls accross different applications? is there anykind of shared dll? or if i put my dll in GAC will it be a shared one accross the applications?
Thanks
Srini
|
|
|
|
|
.NET Remoting allows to share object instances between tow app domains, whereever they are: on the same machine or somewhere on the Internet.
|
|
|
|
|
1.
engsrini wrote: 1. Is my windows application a single threaded or multithreaded?
find the Main in your app. if use [STAThread], that means single threaded.
if you use [MTAThread], that means multi-thread.
<br />
[STAThread]<br />
static void Main()<br />
{<br />
Application.Run(new demo());<br />
}<br />
4. different between STA and MTA
|
|
|
|
|
hi all i have an application that can call up records in a set of database. i can do the navigate, delete update and insert functions.. however i wish to include sort and filter functions for my application.. how do i go abt doing this? any links or articles will be greatly appreciated thanks
|
|
|
|
|
I think you use the DataView for that
|
|
|
|
|
Hi,
Consider a class that I need to serialize and send over the wire. On
the receiving end, the serialization bytes have to be re-constructed to
form the object. The mentioned class has got some member variables and
one or more constructors.
[WebMethod()]<br />
public void Test(MyClass c) {}
The question is that is there anyway to control the proxy-generation
for the MyClass class? i.e, how am I supposed to force the
proxy-generator to generate the constuctors? Or should I add the
required constructors on the client side using the partial keyword?
What's the best thing to do when you want to pass a one-way informative
parameter (ie., no functionality embedded except for the constructors)
to a web method?
I would like the client side to create the object normally as follows:
MyWebService.MyClass c = new MyWebService.MyClass(param1, param2);<br />
MyWebService.Test(c);
Is there anyway to achieve such functionality?
TIA,
Mehdi
|
|
|
|
|
After the code has been generated, you can add them. As long as you stick to serialization standards (mark your public properties/fields as XmlIgnore, and dont delete their fields!).
If using .NET 2.0, partial classes gets generated, and hence u can define them in another file without worrying that regeneration will erase your changes.
|
|
|
|
|
Is there any keyword and/or pragma (like the one used in IDL (C++)) to force the compiler to put some code in the generated class? something like:
#include_this_in_generated_code "public void WhateverMethod() {}"
This way, I could alter the proxy code on service-side.
Thanks,
Mehdi
|
|
|
|
|
Okay, I've tinkered with this code and have not been able to get an image to display:
http://www.codeguru.com/Csharp/Csharp/cs_controls/datagrid/article.php/c4783/#more[^]
Basically, I am designing a drag and drop where I create a thumbnail for each image dragged and put that image into a table. I want everything in one row so I create a column for each image dragged. Then I create a new GridTableStyle for each new column. Then I set the DataSource. I'd like to do this with the use of a dataset, but I not picky just so long as I can get it to work.
So far all I get is a big white box with a giant Red "X" through it. Anyone have any ideas? Thanks in advance!
Here is my code:
public void ImageLoader()
{
//Create Thumbnails
foreach(string fn in files)
{
try
{
ImageConverter(fn);
}
catch(Exception)
{
}
}
//ids is Image-DataSet
ids.Tables.Add(dt);
getGridTableStyle();
image_Datagrid.TableStyles.Add(DGStyle);
image_Datagrid.DataSource = ids;
image_Datagrid.DataMember = dt.TableName;
}
private void ImageConverter(string filename)
{
string imageFile = Path.GetFileNameWithoutExtension(lastFilename).ToLower();
//Create and Save the Thumbnail and return the image
Image img = CreateThumbnail(filename);
//Put the image in the DataTable and name the column the image name without
//extension or directory info i.e. 'c:\\test.bmp' uses 'test' as the column name
AddThumbnailToDataTable(img, imageFile);
}
private void AddThumbnailToDataTable(Image img2, string columnName)
{
dt.BeginLoadData();
this.dt.Columns.Add(columnName);
this.dt.Rows[0][columnName] = (Bitmap)img2;
dt.EndLoadData();
}
private void getGridTableStyle()
{
try
{
DataGridColumnStyle GridTextColumn, GridBmpColumn;
DGStyle = new DataGridTableStyle();
// select table
DGStyle.MappingName = "Images";
// Use a PropertyDescriptor to create a formatted column. First get the PropertyDescriptorCollection
// for the data source and data member.
PropertyDescriptorCollection pcol = form1.BindingContext[ids, dt.TableName].GetItemProperties();
// create the first column style for a text column
GridTextColumn = new DataGridTextBoxColumn(pcol["ImageInfo"]);
GridTextColumn.MappingName = "ImageInfo";
GridTextColumn.HeaderText = "Image-Name";
GridTextColumn.Width = 50;
DGStyle.GridColumnStyles.Add(GridTextColumn);
//Create an ImageColumn for each image in the table
for(int i = 1; i < dt.Columns.Count; i++)
{
// create column style for an image column
GridBmpColumn = new DataGridImageColumn(pcol[dt.Columns[i].ColumnName]);
GridBmpColumn.MappingName = dt.Columns[i].ColumnName;
GridBmpColumn.HeaderText = "Bitmap";
GridBmpColumn.Width = 80;
DGStyle.GridColumnStyles.Add(GridBmpColumn);
}
DGStyle.RowHeadersVisible = false;
}
catch(Exception e)
{
MessageBox.Show(e.Message, "Adding Images to Grid TableStyle");
}
}
Thanks!
RABB17
|
|
|
|
|
Figured it out. If anyone ever wants to do this:
Don't pass an image to the datatable, instead pass the location of the new file.
Then in the DataGridImageColumn class make the following adjustment:
string ImageFile = (string)GetColumnValueAtRow(Source, RowNum);
Image img = Image.FromFile(ImageFile);
Bitmap ImagePic = (Bitmap)img;
Problem is that when you put the image file in the table, it can only hold a limited number of bytes for it (8kb) and you lose much of the image's data.
Hope this helps someone one day,
RABB17
|
|
|
|