Just came home from GNIT SF monthly gathering and I was deeply grateful for the community life. This Christmas has some special meaning to me and very likely I will always remember it.
Just came home from GNIT SF monthly gathering and I was deeply grateful for the community life. This Christmas has some special meaning to me and very likely I will always remember it.
Yeah, I just finished week 1 assignment of Algorithms, Part I about percolation, but why the hack this post trying to talk about Predestination and Freewill, a religious topic that would be super boring? OK. Calm down, calm down and watch this video first, my friend. It’s a silent film lasts only 20 seconds.
Algorithms, Part I at Coursera by Princeton University would be the best online Algorithms course I’ve ever enrolled in. I highly recommend you to take a look, though there are 5 things I don’t want to - or at least hesitate to tell you about it.
We have done things right, now it’s time to do things faster. We would keep Donald Knuth‘s warning in mind, “We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil”.
Most of the time, you are just consuming the Document Jsoup built for you, like document.select(${selector}). It would be helpful to go through W3C CSS Selector Specification to understand Jsoup’s roadmap. We have talked about Node Traverse before, what Selector will actually do is just filtering and collecting while traversing, and the key point here will be parsing and evaluating given queries.
Ready? The challenging task finally came. We will build a tree this time so that you don’t have to traverse before it was built.😅TreeBuilder has two implementations, XmlTreeBuilder is relatively easy while HtmlTreeBuilder is much more complex. And we will go through them today.
Here we go! We’ve got a HTML or XML snippet, it would be clean or dirty, small or large, safe or dangerous, but our task won’t change. We need to extract and manipulate data supporting the best of DOM, CSS, and jquery-like methods. The basic idea would be crystal clear, you need to build a DOM tree and traverse it with or without filtering. That’s it. Sounds easy, right?😅Then Just Do It…and you would probably…cry.
Jsoup would probably be the most popular “working with real-world HTML” library in the Java community. I’ve been using it for web crawler stuff since 1.7.3(latest release is 1.11.3), but a little bit surprised to see that there is little introduction or analysis regarding its source code and implementations.
How many times have you googled “jdk download windows”, then download, click, click, and click? You don’t have to be like this even if you are using Windows. Chocolatey and Boxstarter are gospel for Windows users. Below is just an example: One Command To Install Them All!
1 | cinst jdk8 jdk11 git intellijidea-community vscode nodejs everything f.lux -y |
Bing Ads is just AWESOME! It will give you a coupon code for $100 in search advertising once you registered. So why not use it? I created my first campaign for this little website and got a surprise joy immediately. It was disapproved. The reason is…Bing Ads said my blogger violate its Adult Content Policy. Yes, ADULT CONTENT POLICY.