Java crawler reads the URL of a specified picture, please answer
Java crawler reads the url of a specified picture, please answer Use jsoup to parse the url. The dom structure is as follows: There is only one look-inside-cover class, so directly find the img element and get the src attribute to get the image path. java accesses url to get pictures pri How to crawl pictures from web pages in Java Crawl website content through httpclient To analyze the image ‘rules’ in the current content page, crawling generally simulates a browser accessing the target web page, and analyzes the data search rules you need through the returned page HTML code. For example, when you crawl a web page and see the current page display The image format is as followsBy parsing the source code (html) of the crawled web page, you can perform string operations. Now There are corresponding third-party jar packages that can help you complete this part of the work faster, such as htmlpaser, get the corresponding address, and then save or download it. You can search, java crawler (httpclient) and htmlpaser to learn more. How does JAVA convert a local image into a network URL and then pass the URL to the front desk? Using the js…
Branch and bound method, Java, to implement circuit board arrangement problem, the program always sorts by default, please answer
Please let me know if there is any problem in running the code. After the program is written, the running result is always the default 1, 2, 3, 4, 5, 6, 7, 8. Unable to sort, urgent,,, Problem description: Let x represent an arrangement of n circuit boards, that is, insert circuit board x[i] into the i-th slot of the chassis The circuit board arrangement density density(x) determined by x is defined as the maximum number of connections spanning adjacent circuit board slots When designing the chassis, the wiring gap on one side of the slot is determined by the density of the circuit board arrangement. Therefore, the circuit board arrangement problem requires that for a given circuit board connection condition (connection block), determine the optimal arrangement of the circuit board so that It has the smallest density. Here is the code //Test class public class BbBoardTest { public static void main(String[] args) { BbBoard bbboard=new BbBoard(); bbboard.bb(); bbboard.display(); } } //Node class public class HeapNode { int []now; int []x; int td;// int s;//Arrange the levels in the tree public HeapNode(int []noww,int []xx,int tempd,int ss){ now=noww; x=xx; td=tempd; s=ss; } } //A queue or heap class written by…
php writes XML file encoding error, please answer
The encoding of XML file written by php is wrong, please answerI have a video table, the data structure is as follows: I use the following program to read the files in the table and generate XML files: include(“conn.php”); include(“crop.php”); $xmlFile = “123.xml”; $dom = new DomDocument(‘1.0′,’utf-8’); $dom->formatOutput=true; $thumbnails = $dom->createElement(“thumbnails”); mysql_select_db(‘hdm0910283_db’, $lnk) or die (‘Can\’t use hdm0910283_db : ‘ . mysql_error()); mysql_query(“SET NAMES utf-8″); $sql=”select * from video”; $query=mysql_query($sql); while ($row = mysql_fetch_array($query)) { //Cut youku screenshot $imageurl=”../workshow/images/”.$row[imgname]; cutphoto(“$imageurl”,”$imageurl”,200,113); $dom -> appendChild($thumbnails); $thumbnail = $dom->createElement(“thumbnail”); $thumbnail->setAttribute(‘filename’, $row[imgname]); $thumbnail->setAttribute(‘label’, $row[title]); $thumbnail->setAttribute(‘url’, $row[url]); $thumbnails -> appendChild($thumbnail); } $dom->save($xmlFile); When running, the following error is prompted: arning: DOMElement::setAttribute() [domelement.setattribute]: string is not in UTF-8 in D:\AppServ\www\rj\control\xml_do.php on line 20 Warning: DOMDocument::save() [domdocument.save]: output conversion failed due to conv error, bytes 0xCA 0xD3 0xC6 0xB5 in D:\AppServ\www\rj\control\xml_do.php on line 24 I have tested the insertion and reading of data in the table and there is no problem. Please help me solve it. XML ——Solution——————–mysql_query(” SET NAMES utf8″); utf-8 is invalid