|
I need to access the log files and IIS log
Thanks
|
|
|
|
|
use the code list:
p1.X = 10;
p1.Y = 15;
p2.X = 68;
p2.Y = 100;
path.AddLine(p1, p2);
g = this.panel1.CreateGraphics();
g.DrawPath(Pens.Black, path);
Then,I draw a line on the graphic.In the event of Mouse_Move,I catch any point and want to know whether the point in the path of the line.
So I use the funcation of GraphicsPath.IsVisible(),but whenever the funcation always return false.
Can you help me? Thanks!
|
|
|
|
|
I'm learning C#, and hit this wall while trying to extract attrib info from an XML file. The method I'm using is
void Button4Click(object sender, System.EventArgs e)
{
string fileName = "..\\..\\books.xml";
XmlTextReader tr = new XmlTextReader(fileName);
listBox1.Items.Clear();
int countAttribute = 0;
while(tr.Read())
{
if(tr.NodeType == XmlNodeType.Attribute)
{
countAttribute++;
string displayString = tr.Name;
displayString += tr.Value;
listBox1.Items.Add(displayString);
}
}
tr.Close();
MessageBox.Show("Encountered " + countAttribute + " attribute(s)");
}
The XML file indeed contains attribs, and here's a part of it:
<book genre="humor" publicationdate="1897" ISBN="0-863411-58-1">
<title>Three men in a boat</title>
<author>
<first-name>Jerome</first-name>
<last-name>Jerome</last-name>
</author>
<price>4.99</price>
</book>
However, the list is not getting populated and the message box tells me it encountered no attributes at all. Am I doing something wrong? Can somebody please tell me how to get the attribute names and values?
Thanks in advance!
Cheers,
Vikram.
http://www.geocities.com/vpunathambekar
Google talk: binarybandit After all is said and done, much is said and little is done.
-- modified at 2:41 Monday 19th September, 2005
|
|
|
|
|
Hi Vikram,
You can try this :
string fileName = "..\\..\\books.xml";<br />
XmlDocument xmlDocument = new XmlDocument();<br />
<br />
xmlDocument.Load(fileName);<br />
<br />
foreach (XmlNode xmlNode in xmlDocument.SelectNodes("//@*"))
{<br />
}<br />
Hope that helps,
Bruno
|
|
|
|
|
Hi, Bruno! Thanks for the reply. It works like a charm and I'm able to extract the info I need.
Is there some way to do it using XmlTextReader, since I might want to do something else with the other elements?
Cheers,
Vikram.
http://www.geocities.com/vpunathambekar
Google talk: binarybandit After all is said and done, much is said and little is done.
|
|
|
|
|
Hi again,
You can eventually pass an XmlReader to xmlDocument.Load method instead of a filename !
Bruno
|
|
|
|
|
I'm looking for a code to flip a window, like in the Tiger - Apple OS.
I though of the following algorithm but I can get it implemented right:
1. Capture the window who is about to be flipped.
2. Hide it and display the image.
This is the part which I don't know how to implement:
3. Start changing the image size so it looks like its being flipped.
4. Display a new window which is the "back side" of the original
window.
If anyone thinks that there is a better algorithm, or how to implement
the algorithm suggested, please...
Amir Harel
|
|
|
|
|
Hi!!
I want to store some information in text files but it should not be visible in that!!How do i do that?Is there any section or header -footer like exe files,Plz reply!!
|
|
|
|
|
hi there,
akshayswaroop wrote:
Is there any section or header -footer like exe files
=> no structure like this for plain text file
akshayswaroop wrote:
I want to store some information in text files but it should not be visible in that!!How do i do that?
=> yep, u can do that. because u can store what u want into a text file
<< >>
|
|
|
|
|
Can u be more clear,Icould not get u,That info should not be visible in file!!
|
|
|
|
|
As others have stated before: It is not possible.
Besides the whole approach of trying to use text files to store information you want not to be visible seems to be rather braindead.
The whole point of plain text files _is_ that the contents are readable with an arbitrary text editor.
If you want information to be unreadable for your users then use binary files!
mav
|
|
|
|
|
Stor it in a seperate stream. It will only work with NTFS though. If the file is copied to a non-NTFS file systems the extra streams are lost. The data will also be lost if the file is copied using a "homemade" copy function reading the binary stream and writing it to the new file. And no, I can't remember how to open a separate stream, I just know it can be done.
|
|
|
|
|
I am working with c#.net
Is there is any way By which i can find all the Hyperlinks in any site
Amit Grover
CDAC R&D
Gist Group
pune
|
|
|
|
|
hi there,
u can download a webpage from a site by using HttpWebrequest/HttpwebResponse (these are supported in .net, sorry I do not remember exactly the class name)
after downloading the content of a web page, just simply do parsing from the content to find out all hyperlinks in the page
Hope that helps
<< >>
|
|
|
|
|
Access the web page through code and get it as web response. Use REGEX to extract all the available hrefs.
- ashish
|
|
|
|
|
In the Style definitions for a DataGrid I defined a DataGridBoolColumn to show Boxes for
the true/false-values in the DataView of the Grid.
To set/toggle Buttons I have to check out, if the Box in a [Row,Column] is set to Enable or Disable by the click-event / space-key (if cell selected).
I have included an eventhandler (DataChanged) for the DataTable which is bound to the Grid.
But only if the SelectedCell is changed, the event for DataChanged will be fired. So, how can I receive an event for the changed Value in the Box if the user do not change the Cell (only 1 Click in the Box to mark it) and won't leave the DataGrid (events validating/valdated therefore will not be fired) ?
Any Idea ?
- If Data is changed, you can see the shown pencil at the row-marker-column. May I fetch this event inside the Grid in any way? May this be a workaround?
|
|
|
|
|
JuergenLissmann wrote:
So, how can I receive an event for the changed Value in the Box
try TextChanged event for that particular columnStyle..
|
|
|
|
|
Hello!
I use dlPortio.dll for Communication With parallel ports in visual C++ 0.6
But I cann't used this Dll in the visual studio .NET (C# or vc++) .
please help me.
|
|
|
|
|
|
|
I've been trying to write data to my database, but it seems like the last change I attempt won't work. The database is an Access 2003 file, and uses Jet 4.0 for the provider.
I'm currently only developing an application to write data to one table of the database, "Employees."
Employees Table
-Primary Key: EmployeeID (Employee's SSN, unformatted)
-FirstName
-MiddleInitial
-LastName
-PayRate
-FICA
-SSI
-Tax
-SalesPersonID
It's rudimentary, I know, but I'll work on expanding the database later.
The application I currently use consists of nine textBoxes (textBox1 ... textBox9), two buttons -- a Clear button (button1), and an Update button (button2) -- a dataConnection control (dcFusion), a DataAdapter(daEmployees), and a dataSet(dsEmployees). The form name is Form1.
The textBoxes are data bound to each column in the database, in the order that I've listed them. (i.e. textBox1 is bound to Employees.EmployeeID).
Here's my Update method:
private void button2_Click(object sender, System.EventArgs e)<br />
{<br />
dsEmployees.Employees[comboBox1.SelectedIndex].EmployeeID = Convert.ToInt32(textBox1.Text);<br />
dsEmployees.Employees[comboBox1.SelectedIndex].FirstName = textBox2.Text;<br />
dsEmployees.Employees[comboBox1.SelectedIndex].MiddleInitial = textBox3.Text;<br />
dsEmployees.Employees[comboBox1.SelectedIndex].LastName = textBox4.Text;<br />
dsEmployees.Employees[comboBox1.SelectedIndex].PayRate = Convert.ToDecimal(textBox5.Text);<br />
dsEmployees.Employees[comboBox1.SelectedIndex].FICA = Convert.ToDecimal(textBox6.Text);<br />
dsEmployees.Employees[comboBox1.SelectedIndex].SSI = Convert.ToDecimal(textBox7.Text);<br />
dsEmployees.Employees[comboBox1.SelectedIndex].Tax = Convert.ToDecimal(textBox8.Text);<br />
dsEmployees.Employees[comboBox1.SelectedIndex].SalesPersonID = textBox9.Text;<br />
dcFusion.Open();<br />
daEmployees.Update(dsEmployees, "Employees");<br />
daEmployees.Fill(dsEmployees, "Employees");<br />
dcFusion.Close();<br />
}
When the dataSet refreshes, the change I enter reverts back to what is already in the database, and no change is made, even after calling the Update method of my dataAdapter. What am I doing wrong here?
-- modified at 23:00 Sunday 18th September, 2005
|
|
|
|
|
To push changes you make in the dataset object to the database, you must first reconnect, then use the same data adapter object that you used to retreive the data to update the database.
//modify
dsEmployees.Tables["tablename"].Rows[0]["EmployeeID"] = Convert.ToInt32(textBox1.Text);
//Check the row
//you can also check the RowState value to see if it's been set to modified.
if(dsEmployees.Tables["tablename"].Rows[0].RowState == System.Data.DataRowState.Modified)
{
//update
objConnection.Open();
adapter.Update(dataset, "tablename");
objConnection.Close();
}
else
{throw new Exception("RowState not modified");}
|
|
|
|
|
To push changes you make in the dataset object to the database, you must first reconnect, then use the same data adapter object that you used to retreive the data to update the database.
//modify
dsEmployees.Tables["tablename"].Rows[0]["EmployeeID"] = Convert.ToInt32(textBox1.Text);
//Check the row
//you can also check the RowState value to see if it's been set to modified.
if(dsEmployees.Tables["tablename"].Rows[0].RowState == System.Data.DataRowState.Modified)
{
//update
objConnection.Open();
adapter.Update(dsEmployees, "tablename");
objConnection.Close();
}
else
{throw new Exception("RowState not modified");}
|
|
|
|
|
Hmm... Turns out, the issue was with the dataBound textBoxes. Somehow when a change was made to them, it wasn't modifying the RowState property. I removed the dataBinding and populated the textBoxes programattically. Works now. Would anyone know why the dataBound textBoxes weren't allowing the Update to filter through?
|
|
|
|
|
hi to all,
i am trying to get the bytes size of a file so i can display in statusbar, also updated as typed.
i first tried getting the encoding of the file and using getbytes() of the encoder, but it didnt come up the same as Windowx Explorer, then i tried just to get the char count and multiply * 2 but it still not work.
how is this acheived ?
this is my encoder attempt
<br />
string byteSuffix = "B";<br />
<br />
string text = this.context.Text;<br />
if(text == null) text = "";<br />
<br />
byte[] bytes = this.encoder.GetBytes(text);<br />
<br />
double size = bytes.LongLength;<br />
<br />
string adjustedSize = "0.0";<br />
string byteSize = "0.0"; <br />
<br />
if(size >= 1000000000)<br />
{<br />
byteSuffix = "GB";<br />
byteSize = size + ""; <br />
size = size / Math.Pow(2, 30); <br />
adjustedSize = size.ToString("N2"); <br />
}<br />
else if(size >= 1000000)<br />
{<br />
byteSuffix = "MB"; <br />
byteSize = size + ""; <br />
size = size / Math.Pow(2, 20); <br />
adjustedSize = size.ToString("N2");<br />
}<br />
else if(size >= 1000)<br />
{<br />
byteSuffix = "KB"; <br />
<br />
byteSize = size + ""; <br />
size = size / Math.Pow(2, 10); <br />
adjustedSize = size.ToString("N2");<br />
}<br />
<br />
this.statusFileSize.Text = adjustedSize + " " + byteSuffix;<br />
this.statusFileSize.ToolTipText = adjustedSize + " " + byteSuffix + " (" + byteSize + " bytes)"<br />
this is how i get encoder
<br />
StreamReader reader = null;<br />
<br />
try<br />
{<br />
reader = new StreamReader(this.path, true);<br />
<br />
this.Content = reader.ReadToEnd();<br />
this.encoder = reader.CurrentEncoding; <br />
this.Encoding = encoder.EncodingName;<br />
<br />
reader.Close();<br />
<br />
if(this.encoder == null)<br />
{<br />
this.encoder = ASCIIEncoding.Unicode;<br />
this.Encoding = encoder.EncodingName;<br />
}<br />
}<br />
catch (Exception e)<br />
{<br />
Debug.WriteLine("Error: " + e.Message);<br />
}<br />
finally<br />
{<br />
if(reader != null) reader.Close();<br />
} <br />
kind regards,
g00fy
|
|
|
|