|
Yep, there sure is. Set the UserAgent property of your HttpWebRequest object to simulate IE's User Agent. Here's a list[^].
Then, to parse that stuff out, use a regular expression on a tags. If you want to get it out of the JavaScript, the only sure fire way to do that is to evaluate the JS. I have no real help for you on that. Sorry.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Parsing out the links from html isn't the problem. I have tried setting UserAgent property of httpwebrequest to 20 different useragent-strings i have found on the net - everytime the same, wrong result.
The mystical on the thing is this:
When I open a site with IE (for example http://derstandard.at) and click right mouse, source-text I see what I want to see, many links, less javascript. So I tried using fiddler2 to see what header information the http-request has. The mystical is: in fiddler2 i see the same wrong thing as in firefox as html-context for the requested page. Only right click - source-text in IE results the right html i need popped up in notepad.
I don't understand it...
Any suggestions ... anyone?
|
|
|
|
|
I don't know if this is true, but does IE show the "source" of the page that includes DOM manipulations by the JavaScript? If so, maybe you should create a WebBrowser control, point it to the correct URL, and then read the DocumentText[^] property to see if it has what you want.
This definitely won't work on Mono.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Hi,
In my windows application, one column of the datagridview is checkbox column.
Please let me know how can I enable/disable the checkbox controls.
Thanks in advance..
|
|
|
|
|
dataGridView[colIndex, rowIndex].Value = 1;
dataGridView[colIndex, rowIndex].Value = 0;
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hello everyone,
If I have a client application which needs to call a web service. I want to know the pros/cons and impact if I set default proxy property to true or false in app.config file?
Thanks!
Here is the property I am talking about.
http://msdn.microsoft.com/en-us/library/kd3cf2ex.aspx
regards,
George
|
|
|
|
|
Hi
I have changed the code.When i debug this code im getting "Object reference not set to an instance of an object"..But then the output form window opens with the controls.The required output is not obtained..Im trying to list all the files in a folder in the ListView control..Please help me with this
using System;
using System.Windows.Forms;
using System.Drawing;
using System.IO;
using System.Text;
using System.Xml;
namespace Windows21
{
public class ListView1 : Form
{
XmlTextReader reader;
XmlDocument doc = new XmlDocument();
ListView listView = new ListView();
Button button1 = new Button();
ListBox listBox1 = new ListBox();
public ListView1()
{
listView.Location = new Point(250, 250);
listView.Width = 250;
listView.Height = 100;
button1.Visible = true;
listBox1.Visible = true;
button1.Text = "button1";
button1.Location = new Point(100, 100);
listBox1.Location = new Point(100, 150);
PopulateListView();
this.Controls.Add(listView);
this.Controls.Add(button1);
this.Controls.Add(listBox1);
this.ClientSize = new Size(400, 200);
button1.Click += new EventHandler(button1_Click);
}
private void PopulateListView()
{
try
{
listView.View = View.Details;
listView.Columns.Add("FileName", -2, HorizontalAlignment.Center);
listView.Columns.Add("Status", -2, HorizontalAlignment.Left);
reader = new XmlTextReader("path.xml");
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Text:
String s1 = reader.Value;
String ss = listBox1.SelectedItem.ToString();
String sss = ss + s1;
object o3 = (object)sss;
DirectoryInfo dire = new DirectoryInfo(sss);
if (dire.Exists)
{
String[] folder = Directory.GetDirectories(sss);
foreach (string foldername in folder)
{
DirectoryInfo di = new DirectoryInfo(foldername);
if (di.Exists)
{
String[] files = Directory.GetFiles(foldername);
foreach (String filename in files)
{
FileInfo fil2 = new FileInfo(filename);
ListViewItem item1 = new ListViewItem();
item1.Text = fil2.Name;
item1.ImageIndex = 1;
item1.Tag = fil2.FullName;
item1.SubItems.Add("Programming .NET");
listView.Items.Add(item1);
}}}}
break;
}}}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}
private void InitializeComponent()
{
this.SuspendLayout();
this.ClientSize = new System.Drawing.Size(756, 485);
this.Name = "ListView1";
this.ResumeLayout(false);
}
private void button1_Click(object sender, EventArgs e)
{
string[] drives = Environment.GetLogicalDrives();
foreach (string strDrive in drives)
{
listBox1.Items.Add(strDrive.ToString());
}}}}
|
|
|
|
|
Thanks for the complete code dump - I really need to know what your internal logic is. Anyway - this problem occurs because you have an object somewhere that you haven't instantiated or which has returned a null on an evaluation. The way to fix this is to first of all read the exception text which will tell you which line this error occurs at. Then, put a breakpoint just before this line and debug your code - finally, hover over variables to see what value they have - check for null in the tooltip.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys
|
|
|
|
|
Won't it be much better to use Recursion? As well as A LOT simpler?
Recursion using C#[^]
Or maybe I'm missing something?
|
|
|
|
|
As you said it gives you error message and then it shows you an output (which is different). means error is in try-catch block, faster way to find out exact location is just remove try-catch block for a while, and run your code it will jumps to debug mode when exception occurs, and you can see the line of code, which is causing problem. I think something is going wrong with the string assignment.
|
|
|
|
|
Hi,
I tried debugging with Step Into option it shows error in the Program.cs file
static void Main()
{
Application.Run(new ListView1());
}
//code for Program.cs
//Here ListView is the namespace of ListView1() so i have used using ListView.
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.IO;
using ListView;
namespace WindowsApplication19
{
static class Program
{
[STAThread]
static void Main()
{
Application.Run(new ListView1());
}
}
}
|
|
|
|
|
Whats in the path.xml ? just dump it here (if it is not very large).
I think the following code is causing error. somthing wrong with the string assignments.
String ss = listBox1.SelectedItem.ToString();
I think, this is causing problem. what if listbox1 is not selected ? and at the first time when form is loading its not selected. so that is causing problem.
try this one instead,
String ss;
if(listBox1.SelectedIndex >= 0)
ss = listBox1.SelectedItem.ToString();
else
ss = listBox1.Items[0].ToString();
|
|
|
|
|
Hello mrithula8,
in a few time ago .. i have a same problem with u... and I have resolved the problem... may be you have problem with an declared variable in listbox or another object with another user (your) variable.
Just make i same because it will make your listbox or object will be get a null value.. that's it
|
|
|
|
|
Hi
Im building a parser for betting websites as a hobby project mainly for educational reasons. I have finished the underling design and database structure and can now parse a couple of websites that are easily parsable (such as Pinnaclesports which uses XML and Expekt where you can get all the odds on a single page).
For a page like Expekt I load the page with the WebAii testing framework, which makes life a lot easier when it comes to getting the data from the webpage.
But when it comes to websites which have nested tree stuctures and require a lot of clicks and no apparent way of showing lots of odds on a single page I am stuck, or really, I dont know where to begin. Example of such sites are Ladbrokes.com and Nordicbet.com (this one should be a lot easier)
Because of the structure (of Ladbrokes), at any given time there will be maybee 2000+ different pages so it seems its not the best way to go to every page individually and parse them. This approach would also be incredibly slow, and I know that there are odds comparision sites out there that parses 80+ bookmakers serveral times every miunte. Thus there must be a better way, I just don´t know what it is and I haven´t found any information about how to do it.
Is C# even a good language for this?
Any pointers toward where I can begin to look after how to solve my problem or tips of good resources would be greatly appreciated.
|
|
|
|
|
Hello,
How we can stop using of my picture on another process??, i makje this :
<br />
<br />
DirectoryInfo di3 = new DirectoryInfo(jpeg_path);<br />
<br />
foreach (FileInfo file3 in di3.GetFiles())<br />
{<br />
string name3 = file3.Name;
string fullName3 = file3.FullName;
<br />
File.Delete(fullName3);<br />
}
but in line : File.Delete(fullName3); i hav e an exception : in use by another process
Thank you verry mutch.
|
|
|
|
|
Kill the process and retry.
|
|
|
|
|
Hi,
is this folder full of images some or all of which you just used e.g. as in Image.FromFile?
Image.FromFile locks the file, making it impossible to delete until you do Image.Dispose().
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Sunday, June 12, 2011 9:20 AM
|
|
|
|
|
or use this instead
FileStream fs = new FileStream("FilePath", FileMode.Open);
Image.FromStream(fs);
fs.Close();
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
How we declare Image ?? thank you verry mutch
|
|
|
|
|
Image img = Image.FromStream(fs);
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
I work with pdfsharp to create pdf file, usually i set the path of my picture like DrawImage (picture_path, position);
bu with filestream how we can set the path? thank you verry mutch.
|
|
|
|
|
Quick one - is there anything wrong with throwing an exception in a constructor? I don't see anything wrong with it in principle, but it doesn't feel quite right (probably a throw back from my C++ days).
Had a quick trawl around the net and opionion seems divided, but I haven't found anything concrete wrong with it.
Regards,
Rob Philpott.
|
|
|
|
|
Quick answer; It might leave you with a partially constructed object, since the construction (and memory-allocation and stuff) is interupted.
I are troll
|
|
|
|
|
Quick continuation: In the event of an exception being thrown presumably the new statement would fail and .NET would GC the knackered object next cycle?
Regards,
Rob Philpott.
|
|
|
|
|