|
hi all,
is it possible to search (parsing source of site) jpgs in a web-site and save them in a folder on my computer ?
let's say website is : www.blablabla.com i want to give this address as the url and get all the images in that site ?
any suggestions ? or a document explaning this source code searching methods ?
thanks in advance,
bye.
|
|
|
|
|
|
Hello Mehmet
You could write a program that access the folders of the site directly, enumerate its content and choosing jpg files to download. The problem is that you'll get an "unauthorized access" thrown at your program, and to get around it this will be hacking, and you may get busted for this.
Another more complicated and less effecient way -which is used by almost all site downloader programs-, is to parse the source code of the page as html text. search for jpg files in the text, and extract the link and download it. the algorithm may look like this:
1- IndexOf("jpg")
2- GoBackToIndexOF("<ahref>") -or whaterver is the begining of the image link-
3- Read what's between as ImgLink
4- Download ImgLink
If you want to download images in subpages do the same algorithm to access these pages and parse them.
|
|
|
|
|
Hi,
You can use this web crawler:
Web Crawler
And when the NewPage event is fired, check out the contenType, and if it is a jpeg then save it.
The buffer of the image can be found in the WebPage object.
Eran Aharonovich (eran.aharonovich@gmail.com )
Noviway
|
|
|
|
|
Hello CP,
I have following code to test if a textbox (by a clicking event) has only number-values:
<br />
double parsed;<br />
if (double.TryParse(textBoxPrijs2.Text, out parsed))<br />
prijs = parsed;<br />
Now,
when I enter 50 and click the button it works fine.
when I enter 50.5 and click the button it works fine (it parses 505).
when I enter 50,5 and click the button it doesn't work the way I want (it parses 50.5)
but I want it to add the exact value (containing the comma) to "prijs".
Can somebody help?
Tnx!
|
|
|
|
|
The meaning of , and . in a number depends on the culture of the current thread (default is set with regional settings). If you want to force it, use a specific IFormatProvider (or whatever it is called, writing from memory and due to IntelliSense the memory is quite bad), for example:
new CultureInfo("en-US", false);
It is quite common people forget adding the "false" parameter - and the program still works great.... until it run into changed regional settings.
|
|
|
|
|
TNX!
See reply, second post
Again tnx!
|
|
|
|
|
I do not know how you count posts so I can't really see what you mean with this. But if the question is where to place the code, take a look at TryParse - there is an overloaded version of it.
|
|
|
|
|
You might need another parameter NumberFormatInfo.CurrencyDecimalSeparator set to ","
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
TNX!
But where can i copy this code to?
Again: Tnx!
|
|
|
|
|
MessageBox.Show(System.Globalization.NumberFormatInfo.CurrentInfo.CurrencyDecimalSeparator.ToString());
This code returns a "," in the messagebox ..
|
|
|
|
|
Hello JelleM.
Why don't you implement the following loop to test your text char by char?
string temp = "";
foreach(char c in textBoxPrijs2.Text.ToCharArray())
{
if(char.IsDigit(c))
temp += c;
}
Prijs = temp;
|
|
|
|
|
Hi,
I am having great difficult trying to set properties from C# using late-binding to a Delphi COM application.
I am using the following code from c#:
private static void SetProperty(object objectToUse, string property, object oValue)
{
object[] oParam = new object[1];
oParam[0] = "TES";
objectToUse.GetType().InvokeMember(property, BindingFlags.SetProperty, null, objectToUse, oParam);
}
However whenever I call this method I get System.Reflection.TargetInvocationException exception.
I can use the following happily (for the same method):
private static object GetProperty(object objectToUse, string property)
{
return objectToUse.GetType().InvokeMember(property, BindingFlags.GetProperty, null, objectToUse, null);
}
The delphi code for the declaration is as follows:
property QuoteNumSuff: widestring read GetQuoteNumSuff write SetQuoteNumSuff;
Does anyone have any ideas or suggestions at all? (BTW - I need to use late binding).
I am completely stuck
Cheers in advance.
|
|
|
|
|
As seems to always be the way - as soon as I ask for help I find the answer.
If I use "BindingFlags.PutDispProperty" instead of "BindingFlags.SetProperty" it works.
Any idea what the difference between them is? I cannot figure it out from the MSDN...
|
|
|
|
|
Andrew_Thomas wrote: Any idea what the difference between them is?
Not really sure, sounds like COM stuff
|
|
|
|
|
I have a C# application I am working on which contains a TabControl with several TabPages. Before I continue with implementation, I have thought it best to create individual classes for each TabPage. I think this is a better design than having one big form with loads of code.
I am wondering if I can use the Designer to design each TabPage. It seems only a class derived solely from Form can use the Designer. For my TabPage, I can drag items from the Toolbox into the Designer, but I have no window/dialog control to place them in, so there is no way to place an item in a particular location within a window. I need to specifically set the locations in code.
Is there some easier way to do this?
Thanks again for the help.
Note, I am using C# Express.
|
|
|
|
|
Actually you can use the designer for anything derived from Control, Forms and custom controls included. Try creating custom controls for each page, and set the tab page's content to that control.
|
|
|
|
|
Thanks. That is very helpful and should get me going on to the next step.
|
|
|
|
|
Im doing this project, in Visual C#
and ive run into a small problem.
I have the main form (wich will start when the program is executed)
Now on that form i have a button and if i press this button the first form Hides and a second form shows.. now what i need the second form to do is to show on exactly the same spot that the previous form did (to give the illusion that the form just changed apperance)
Is that possible ??? and if so, how do i do that???
Or is it just more simple to use MDI forms??? with Childs and such.. one thing that anoy's me with MDI forms is that if i use the code to maximize the Child form it will show a control button in the upper left corner wich i do not want it to do..
the code i used to get it maximized is rather simple its
newFrm.WindowState = System.Windows.Forms.FormWindowState.Maximized;
Brothers what we do in life, echoes in eternity!!!
|
|
|
|
|
Point firstFormLocation = firstForm.Location;
Size firstFormSize = firstForm.Size;
firstForm.Hide();
secondForm.StartPosition = FormStartPosition.Manual;
secondForm.Location = firstFormLocation;
secondForm.Size = firstFormSize;
secondForm.Show();
I don't recommend this at all though... it'd be much better to use container controls in one form and just swap those.
-- modified at 15:53 Tuesday 30th May, 2006
p.s. I like how people vote down posts without even giving their own input... not being helpful to anyone. Nothing but rude.
|
|
|
|
|
If treelist have open node, and i add new node to treelist - new node not can have focus.
treelist.AllNodesCount = all nodes in treelist - 1 ???
But if all node is close, and i add new node - !!! my new node can have focus!!!
treelist.AllNodesCount = all nodes in treelist !
My code:
using DevExpress.XtraTreeList;
using DevExpress.XtraTreeList.Nodes;
namespace video
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void simpleButton1_Click(object sender, EventArgs e)
{
TLNode tln1 = new TLNode(1, treeList1.Nodes, "dfhdfhgdf", "234523");
treeList1.Nodes.Add(tln1);
treeList1.FocusedNode = tln1;
}
private void simpleButton2_Click(object sender, EventArgs e)
{
TLNode tln1 = new TLNode(1, treeList1.Nodes, "4567rtyu4567", "ertye3456ertye");
tln1.HasChildren = true;
TLNode tln_children = new TLNode(2, tln1.Nodes, "trtr3636yryr", "6868cncn2525");
tln1.Nodes.Add(tln_children);
treeList1.Nodes.Add(tln1);
}
}
public class TLNode: TreeListNode
{
string name;
string url;
public TLNode(int id, TreeListNodes owner, string name_, string url_) : base(id, owner)
{
name = name_;
url = url_;
}
public override void SetValue(object columnID, object val)
{
}
public override object GetValue(object columnID)
{
return "text";
}
}
}
How to do this problem?
Help me please.
|
|
|
|
|
Dima Filipiuk wrote: using DevExpress.XtraTreeList
You should be asking the DevExpress ppl, first at least...
|
|
|
|
|
Format : INSERT INTO Tablename(Var1,Var2,...) VALUES(Value1,Value2,...)
If there is one variable (Var1 as Date/Time variable),what is the format of Value1(#5/29/2006#,"5/9/2006",#29/5/2006#,"29/5/2006"). I've tested all of Value1's format.But it's still Systax Error.
Thanks
Surasak
|
|
|
|
|
Hi, Surasaku.
I'm not sure why you're having a problem with the syntax. I just got through with some stuff using the "#5/30/2006#" format in the sql strings. Could it be that the syntax error is caused by something other than your date field?
Author of
The Career Programmer and Unite the Tribes
Know someone who desperately needs to get a clue?
Visit www.DownloadAClue.com and send them one!
|
|
|
|
|
What database are you using?
Access uses # around a date, MS SQL and MySQL uses apostrophes (').
Try using ISO 8601 format: 2006-05-29
---
b { font-weight: normal; }
|
|
|
|