|
Hey guys I'm new here! So here's my problem: I have to do a project for the university. I have to use a crawler, download some pages to my hard drive (number doesn't matter atm) and then for each page of these (for each URL to be exact) I need to populate a database with each page's URL and all the links that this page contains.
I found this crawler on the site http://www.codeproject.com/KB/IP/Crawler.aspx[^].
But since I'm a newbie I can't seem to find a way to do what I need. Do I need to html-parse each page after it is downloaded? Or can I simply tweak the crawler's code and do what I need?
Thanks in advance
George
All you have to decide is what to do with the time that is given to you.-
|
|
|
|
|
Hi i have to develop an application which supports globalization feature. I am storing the data into a ms access database, so i want to know whether ms access do provide any features for globalization or not..
|
|
|
|
|
No, it's a database. You need to design tables that contain your globalised strings.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Dear All,
Any one know free xml web service,to send sms messages(include amlost all countires) using C#,
Yes. CreatiVity withOuT limiTs
|
|
|
|
|
If it exists, google knows. There are also articles here on CP, but all the gateways I know of, in articles or otherwise, are not international.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
My program uses a lot of pictures (from screendumps) and I need to compress those so that my program uses less memory. Any idea how to do that in C#?
_____________________________
...and justice for all
APe
|
|
|
|
|
If you have an image as something other than a JPEG, load it into a Bitmap and save it as a JPEG.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi, i have a form which is size 500 * 300
I have groupbox, textboxes, and buttons inside that form. When the form is loading into my main mdi parent form, its size is 500*300, when i maximize the childform, my controls all are at the position top left. How do i make it center( when the window is maximize) depending on the screen size?
|
|
|
|
|
If you want to center the groupbox, not the controls in it,
personally I would recalc the Location from the groupbox on the maximize event.
The controls in the groupbox will change their location automatically.
For the other controls outside the groupbox, use a panel and calc its location as you do for the groupbox.
Hope this helps
Tiefe Brunnen muss man graben wenn man klares Wasser will,
tiefe Wasser sind nicht still.
|
|
|
|
|
how to i recalculate the location? do i have to so some division or multiplication or somthing./
|
|
|
|
|
You do not need to any calculations if you do proper anchoring. It will solve the purpose. Use TableLayoutPanel in case you find it difficult to anchor controls as such.
|
|
|
|
|
anchoring changes the size of the control to center i thought? imho if you want to center the control without changing its size, you have to recalc.
Tiefe Brunnen muss man graben wenn man klares Wasser will,
tiefe Wasser sind nicht still.
|
|
|
|
|
<blockquote class="FQ"><div class="FQA">sunspeed wrote:</div>imho</blockquote>
What does this mean?
If used smartly, anchoring can help you postion the control to centre the control with or without resizing.
I have created a sample form in which control will be at centre(and of same size) regardless of how you resize the form.
|
|
|
|
|
Could you send me the code? Thats interesting.
I have not found this possibility.
imho means "in my humble opinion"
Tiefe Brunnen muss man graben wenn man klares Wasser will,
tiefe Wasser sind nicht still.
|
|
|
|
|
Here it is:
using System;<br />
using System.Collections.Generic;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
<br />
namespace CPProj {<br />
public partial class Anchoring : Form {<br />
<br />
#region Constructors<br />
public Anchoring() {<br />
InitializeComponent();<br />
}
#endregion<br />
<br />
#region Code from Designer File<br />
<br />
private System.ComponentModel.IContainer components = null;<br />
<br />
protected override void Dispose(bool disposing) {<br />
if(disposing && (components != null)) {<br />
components.Dispose();<br />
}<br />
base.Dispose(disposing);<br />
}<br />
<br />
private void InitializeComponent() {<br />
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();<br />
this.grpSample = new System.Windows.Forms.GroupBox();<br />
this.btnSample = new System.Windows.Forms.Button();<br />
this.tableLayoutPanel1.SuspendLayout();<br />
this.grpSample.SuspendLayout();<br />
this.SuspendLayout();<br />
this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)<br />
| System.Windows.Forms.AnchorStyles.Left)<br />
| System.Windows.Forms.AnchorStyles.Right)));<br />
this.tableLayoutPanel1.ColumnCount = 3;<br />
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));<br />
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 110F));<br />
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));<br />
this.tableLayoutPanel1.Controls.Add(this.grpSample, 1, 1);<br />
this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 12);<br />
this.tableLayoutPanel1.Name = "tableLayoutPanel1";<br />
this.tableLayoutPanel1.RowCount = 3;<br />
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));<br />
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 110F));<br />
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));<br />
this.tableLayoutPanel1.Size = new System.Drawing.Size(277, 242);<br />
this.tableLayoutPanel1.TabIndex = 0;<br />
this.grpSample.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)<br />
| System.Windows.Forms.AnchorStyles.Left)<br />
| System.Windows.Forms.AnchorStyles.Right)));<br />
this.grpSample.BackColor = System.Drawing.SystemColors.ControlText;<br />
this.grpSample.Controls.Add(this.btnSample);<br />
this.grpSample.Location = new System.Drawing.Point(86, 69);<br />
this.grpSample.Name = "groupBox1";<br />
this.grpSample.Size = new System.Drawing.Size(104, 104);<br />
this.grpSample.TabIndex = 0;<br />
this.grpSample.TabStop = false;<br />
this.grpSample.Text = "groupBox1";<br />
this.btnSample.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)<br />
| System.Windows.Forms.AnchorStyles.Left)<br />
| System.Windows.Forms.AnchorStyles.Right)));<br />
this.btnSample.Location = new System.Drawing.Point(6, 31);<br />
this.btnSample.Name = "button1";<br />
this.btnSample.Size = new System.Drawing.Size(75, 23);<br />
this.btnSample.TabIndex = 0;<br />
this.btnSample.Text = "button1";<br />
this.btnSample.UseVisualStyleBackColor = true;<br />
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);<br />
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;<br />
this.ClientSize = new System.Drawing.Size(292, 266);<br />
this.Controls.Add(this.tableLayoutPanel1);<br />
this.MinimumSize = new System.Drawing.Size(200, 200);<br />
this.Name = "Anchoring";<br />
this.Text = "Anchoring";<br />
this.tableLayoutPanel1.ResumeLayout(false);<br />
this.grpSample.ResumeLayout(false);<br />
this.ResumeLayout(false);<br />
<br />
}<br />
<br />
<br />
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;<br />
private System.Windows.Forms.GroupBox grpSample;<br />
private System.Windows.Forms.Button btnSample;<br />
#endregion<br />
}
}
|
|
|
|
|
ah, ok you use the TableLayoutPanel thats one possiblity.
Thanks for that example!
cheers
Tiefe Brunnen muss man graben wenn man klares Wasser will,
tiefe Wasser sind nicht still.
|
|
|
|
|
youp, heres a example.
<br />
Point newLocation = new Point();<br />
newLocation.X = (int)(this.Width - groupBox1.Width) / 2;<br />
newLocation.Y = (int)(this.Height - groupBox1.Height) / 2;<br />
groupBox1.Location = newLocation;<br />
Tiefe Brunnen muss man graben wenn man klares Wasser will,
tiefe Wasser sind nicht still.
|
|
|
|
|
Hi Guys. I need a little help with calculating a list of numbers. I'm importing a list of numbers and I would like to calculate the sum of these.
an example of this list of numbers is as follows.
<br />
300145639<br />
2240154504<br />
53370705579<br />
1984209469<br />
540191077<br />
1322660604<br />
I have this small bit of code which I know is wrong. Could somebody please guide me on how to do this corretly? I don't seem to get the correct total when running this. Any help would be greatly appreciated.
foreach (imphash hsh in res)
{
CalculateNum(hsh.Field1.ToString());
}
}
void CalculateNum(string list)
{
int sum = 0;
for (int i = 0; i < list.Length; i++)
{
sum += Convert.ToInt32(list);
txtboxdsptxt.Text =(sum.ToString() + Environment.NewLine);
}
}
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
This would be my solution... I don't know how large the file is, so you may end up with an overflow exception
<br />
foreach (line in file)<br />
{<br />
Sum += String2Long(line);<br />
}<br />
<br />
private long String2Long(string Input)<br />
{<br />
long Value = 0;<br />
if (Input == null)<br />
throw new Exception("Input is empty");<br />
<br />
if (!long.TryParse(Input, out Value))<br />
throw new Exception("Conversion failed");<br />
<br />
return Value;<br />
}<br />
|
|
|
|
|
Your code is right, except that because you have so many large numbers, your number will overflow and thus come out with too small a result. Try using long instead of int, if it still happens, then you need to look into libraries that support super large numbers.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks Christian. I did this and for some strange reason I only get the last number in the list returned instead of the sum of all the numbers.
foreach (imphash hsh in res)
{
txtboxdisplay.Text += hsh.Field1 + Environment.NewLine;
CalculateNum(hsh.Field1.ToString());
}
}
void CalculateNum(string list)
{
long sum = 0;
for (long i = 0; i < list.Length; i++)
{
sum += Convert.ToInt32(list);
txtboxdsptxt.Text =(sum.ToString() + Environment.NewLine);
}
}
I have also noticed that it seems to itterate throught the CalculateNum function a number of times before returning to foreach(imphash hsh in res) .
These are the values in the file that I'm importing. (Just a few numbers for testing)
300145639
1984209469
540191077
1322660604
The sum returned is 13226606040. I'm expecting it to return 4147206789.
Anything else I might be missing?
Thanks for helping.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Your code is summing up 10 times the last string passed (i.e. 1322660604).
(10 is the number of characters the string has). Probably you need something similar to
long sum = 0;
foreach (imphash hsh in res)
{
txtboxdisplay.Text += hsh.Field1 + Environment.NewLine;
sum += Convert.ToInt32( hsh.Field1.ToString());
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
HI mate. I am doing that in the calculation functions. I pass the hsh.Field1.ToString() to the CalculateNum function.
void CalculateNum(string list)
{
long sum = 0;
for (long i = 0; i < list.Length; i++)
{
sum += Convert.ToInt32(list);
txtboxdsptxt.Text =(sum.ToString() + Environment.NewLine);
}
}
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
That's wrong, I already pointed out why.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Cool. I have ammended and now I get an OverflowException was unhandled error. Value was either too large or too small for an Int32. Is there something else I can cast the value to?
I used Int64 and that worked but I still get the result 10* the actual answer? Any ideas?
Excellence is doing ordinary things extraordinarily well.
|
|
|
|