|
Use the Write[^] method of the HtmlDocument class taking care to follow the recommendations to use OpenNew first.
|
|
|
|
|
I have a project about the media player(wav file),which must show the play progress.
Now i can get the total play time(264s).
my method is using "timer".
The progressbar.value+1 per second.when the file play end,the progressbar's value=time.
Because of the timer control is imprecise,so the file play end and the progressbar is not come to the end .
so ,how can i get a precise prgressbar.
thank you very much!
|
|
|
|
|
Do it by percentage of time.
ie 264 seconds is 100%, so 1 second is 0.38%, so just increment by that value each second.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
|
maybe you can store your start time, and in each timer event you can calculate the EXACT timespan, and then set the according value of the progressbar
I cannot remember: What did I before google?
|
|
|
|
|
|
songguohui wrote: the timer control is imprecise
for one Hertz events, the timer classes are more than adequate, however maybe your code is not; as Thomas said, you should not accumulate errors, better is to recalculate the current situation every time without accumulation.
if you want to know more about timers, you may be interested in Timer surprises, and how to avoid them[^].
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
|
you're welcome.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
The progress bar is as precise as you make it, the trick is to start with the following:
progressBar.Minimum = 0;
progressBar.Maximum = mediaPlayer.PlayTime;
progressBar.Value = 0;
If the wave player measures in milliseconds, all the better, you will get a more accurate bar.Update the progress bar more often if you want better resolution (say every 100ms), this won't effect performance unduly with the timer. You should be able to do the following on each tick:
progressBar.Value = mediaPlayer.CurrentTime;
If such a property does not exist on the class you are using to play the wav file, you will have to increment by the tick amount. The media player class probably has and event for the player finishing, if so you should call progressBar.Value = mediaPlayer.CurrentTime; when this event is fired, or just set it to the "PlayTime" property, this will fix you initial problem.
Finally, if the player is paused, you should stop the timer and set the current time again. One suggestion is to use a slider instead so the user can move through the file, obivously you will need to be able to set the current time to do this.
|
|
|
|
|
|
|
Hi
How can I change Excel setting after exporting table from C# into it from C# running Asp Program
|
|
|
|
|
If you're saving the table into a .xslx file, you could directly manipulate it (it's just XML that matches the Excel schema) and change the setting directly.
|
|
|
|
|
below string is saved in database.
<people>
<user>
<id>1</id>
<name>홍</name>
</user>
<user>
<id>2</id>
<name>김</name>
</user>
</people>
I want to read xml's contents by using XmlTextReader.
but There is no xml file just saved into database.
How can i read?
hi
My english is a little.
anyway, nice to meet you~~
and give me your advice anytime~
|
|
|
|
|
Finally figured it out!
Suppose you get the above string, lets name it as xmlBody.
Next step will be to create a proper xml.
String CompleteXml="<xml version=\"1.0\"?>" + xmlBody;
Now to read using XmlTextReader, StringReader is the solution that i found.
Here is how it goes :
XmlTextReader reader=new XmlTextReader(new System.IO.StringReader(CompleteXml));
Now you can read it.
By the way, using XmlTextReader is a good choice of yours as it is fast and suitable for Large Xml files.
People with high attitude deserve the standing ovation of our highest finger!
My Technical Blog![ ^]
modified on Monday, March 14, 2011 5:48 AM
|
|
|
|
|
Hi,
I tried with below code and i'm getting only root directories not sub directories , i need to get sub directories
please suggest me better way.
string ftpServerIP = "75.125.2.193";
FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://" + ftpServerIP + "/");
request.Method = WebRequestMethods.Ftp.ListDirectoryDetails;
request.Credentials = new NetworkCredential("barikgr2", "barik122");
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
Stream responseStream = response.GetResponseStream();
StreamReader reader = new StreamReader(responseStream);
string line;
while ((line = reader.ReadLine()) != null)
{
TreeNode node = new TreeNode();
string[] _arv = line.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
node.Text = _arv[3];
treeView1.Nodes.Add(node);
}
reader.Close();
response.Close();
Regards,
Vishnu.
|
|
|
|
|
|
Hi,
I'm trying to make a program for booking rooms in my school library automatically. I need a way to check if a certain ID/password is valid on the domain because library uses network credentials. My laptop is on school's domain and it doesn't have admin rights. I tried googling this problem, many people suggested using DirectoryServices, but for some reason when I include this namespace then I get error message saying "Namespace is not valid". Any help will be appreciated.
Shivam
|
|
|
|
|
I suggest you try this:
1.
in the solution pane, add a reference to your project, use .NET tab, locate "System.DirectoryServices"
2.
in your source file(s), add a line using System.DirectoryServices;
And you may have to repeat the same for System.DirectoryServices.AccountManagement (which exists since .NET 3.5)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Ya I figured that out before your replied.
I tried using method find on internet to authenticate. This is exception I'm getting
System.DirectoryServices.AccountManagement.PrincipalServerDownException was unhandled
Message=The server could not be contacted.
Source=System.DirectoryServices.AccountManagement
I used following code.
PrincipalContext adContext = new PrincipalContext(ContextType.Domain);
bool valid;
using (adContext)
{
valid = adContext.ValidateCredentials("studentID", "password");
}
Console.Write(valid);
What I'm doing wrong here. And is it even possible to validate, because I'm not an admin of domain.
|
|
|
|
|
I don't really know.
I read your question once more, and now I strongly doubt Windows would allow a non-admin to query the user/password list like that. It would support a brute force attack and hence constitute a security risk.
You may have to rethink your authentication approach; maybe the user being logged on and running your app is sufficient; or your app should rely on its own authentication (i.e. your own user list in the database).
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Luc Pattyn wrote: You may have to rethink your authentication approach; maybe the user being
logged on and running your app is sufficient; or your app should rely on its own
authentication (i.e. your own user list in the database).
Indeed. Why query anything?
If the machines require a domain account to log onto them, and they are logged on, the username and password were valid.
|
|
|
|
|
Thank you for replying.
So basically, right now my program as 15 IDs and password in its data base. I've added a button "contribute" where other students could donate their ID and passwords, these ID and passwords are their credentials on school's domain, also it is used to authenticate the library booking. I need some way to validate this, I first tried to validate using HTTPrequest and directly validating it through logging into library, if error occurs then credentials are not valid. This approach is kind of hard, I found that there is some __ISVALID post parameter that keeps changing, so first I've to parse source to find this parameter then and logging then check its validity. Therefore, I switched to this approach, of checking credential within active directory. Now, this seems not to work either..I wonder, in my laptop I could logging with my friend's network ID and password, so there should to be some way of just VALIDATING the credentials, not tampering it. Or could think of some other way???
Shivam
|
|
|
|
|
VERY bad practice, storing passwords. Maybe store a hash of a password to compare with the original, but the password itself? The network people would have a hissy fit.
Also, what are you going to do in 90 or 180 days when everyone changes their network password and it no longer matches what you have in the database?
I think you missed the point. If the computers you are concerned about are on in the domain the network, and they require a user to log in to use them, then the authentication has already taken place and you don't really need to do anything else.
|
|
|
|