軟考 中級職稱哪些最熱門_我如何利用有史以來最熱門的中級故事來建立排行榜。 以及它幾乎是怎么死的。...

軟考 中級職稱哪些最熱門

by Michael Deng

鄧小平

我如何利用有史以來最熱門的中級故事來建立排行榜。 以及它幾乎是怎么死的。 (How I built a leaderboard with the top Medium stories of all time. And how it almost died.)

Last year I built Top Medium Stories — a website that showcases the Medium’s top stories of all time. This is the tale of how a lone developer scraped thousands of stories and hitting seemingly fatal roadblocks.

去年,我建立了“頂級中級故事”(Top Medium Stories)-一個展示“中型”歷史上最熱門故事的網站。 這是一個孤獨的開發人員如何抓取數千個故事并擊中看似致命的障礙的故事。

Spoiler alert: Life finds a way. You can check out the leaderboard — updated daily — at TopMediumStories.com.

劇透警報:生活找到了路。 您可以在TopMediumStories.com上查看排行榜(每天更新)。

我為什么做這個? (Why did I make this?)

As a long-time reader on Medium, I’ve always been curious what the most popular stories were. While the personalized feed and topic pages surface many great stories, just as many slip through the cracks.

作為《 Medium》的長期讀者,我一直很好奇最受歡迎的故事是什么。 盡管個性化的提要和主題頁面顯示了許多精彩的故事,但也有很多人從裂縫中溜走。

Driven to unearth the gems buried in Medium’s annals, I set a new goal in early 2017: I was going to find the most popular stories of all time on Medium and share them with the rest of the world.

為了發掘埋在Medium紀事中的寶石,我在2017年初設定了一個新目標:我將在Medium上尋找有史以來最受歡迎的故事,并與世界其他地方分享。

My goal culminated in me publishing my list of the Top Medium Stories By Year.

我的目標達到了頂峰,即我發布了“ 年度最佳中型故事”列表。

I compiled the stories manually, which was a grueling task. Over the period of a week, I visited every top stories page since September 10, 2014 (when the top stories feature debuted). To find even earlier stories, I dug through publication archives using the Wayback Machine to fetch ancient copies of Medium pages.

我手動編寫了故事,這是一項艱巨的任務。 自2014年9月10日以來(當熱門新聞功能首次亮相時),我在一周內訪問了每個熱門新聞頁面。 為了找到更早的故事,我使用Wayback Machine翻閱了出版物檔案,以獲取Medium頁面的古代副本。

I built a massive spreadsheet of every story I found. It was a ton of mind-numbing work, but I was proud of the result.

我為發現的每個故事構建了一個龐大的電子表格。 這是一項令人費解的工作,但我為結果感到驕傲。

But my feeling of pride was short-lived, as the list became quickly outdated. I wanted to keep it up-to-date, but doing so manually was impossible.

但是,隨著這份名單很快過時,我的自豪感變得短暫。 我想使其保持最新狀態,但是手動進行操作是不可能的。

Then, something dawned on me. I had already determined the manual steps to collect data the first time. There was was no reason why I couldn’t just automate those steps with code. Thus, I decided to turn the list into a dynamic website.

然后,我身上發生了一些事情。 我已經確定了第一次手動收集數據的步驟。 我沒有理由不能僅僅使用代碼來自動化這些步驟。 因此,我決定將列表變成一個動態網站。

自動化數據收集 (Automating data collection)

To automate the manual steps described above, I wrote a web scraper using Python Scrapy.

為了使上述手動步驟自動化,我使用Python Scrapy編寫了一個Web 爬蟲 。

The scraper crawls through every top stories page since September 10, 2014 and tosses any story it sees into a Python dictionary. The dictionary is then sorted by the number of claps each story received and written to a JSON file. (Claps are Medium’s equivalent of a “like” or an “upvote” and readers can give a story up to 50 claps.)

自2014年9月10日以來,該抓取工具會在所有熱門故事頁面中進行抓取,并將看到的所有故事都放入Python字典中。 然后,根據收到的每個故事并寫入JSON文件的拍手次數對字典進行排序。 (鼓掌相當于“贊”或“贊”的中型,讀者最多可以給一個鼓掌50個故事。)

Here’s a snippet of the JSON file:

這是JSON文件的代碼段:

[  “We fired our top talent. Best decision we ever made.”,   {    “recommends”: 79000.0,     “pub_url”: “https://medium.freecodecamp.org",     “author”: “Jonathan Sol\u00f3rzano-Hamilton”,     “image”: “https://cdn-media-1.freecodecamp.org/images/1*4hU3Xn7wunA81I3v17JIrg.jpeg",     “year”: “2017”,     “story_url”: “https://medium.freecodecamp.org/we-fired-our-top-talent-best-decision-we-ever-made-4c0a99728fde",     “pub”: “freeCodeCamp”,     “author_url”: “https://medium.freecodecamp.org/@peachpie"  }],...

Before building the scraper, I checked Medium’s robots.txt file to verify that I wasn’t violating any policies. I also set the scraping speed very slow (2 seconds between each request), so the scraper wouldn’t hammer Medium’s servers.

制作刮板之前,我檢查了Medium的robots.txt文件以確認我沒有違反任何政策。 我還將抓取速度設置得非常慢(每個請求之間間隔2秒),因此抓取器不會影響Medium的服務器。

將數據轉換為HTML (Converting the data to HTML)

The next step was transforming the JSON file into HTML to display the stories on a web page.

下一步是將JSON文件轉換為HTML以在網頁上顯示故事。

I installed BeautifulSoup to do this. First, I constructed an HTML template with empty tables and rows. Then, I wrote a script that uses BeautifulSoup to populate the template from the JSON file.

我安裝了BeautifulSoup來做到這一點。 首先,我構造了一個帶有空表和行HTML模板。 然后,我編寫了一個腳本,該腳本使用BeautifulSoup從JSON文件填充模板。

With a basic HTML file containing all the stories I want to display, it was time to create the actual website.

使用包含要顯示的所有故事的基本HTML文件,現在可以創建實際的網站了。

建立一個kickass網站 (Building a kickass website)

When planning the website, I had three goals in mind:

規劃網站時,我想到了三個目標:

1.簡約典雅的設計 (1. Minimal and elegant design)

The design language is centered around plenty of whitespace and high-contrast text. This way, the focal point is on the stories its trying to highlight, not on the aesthetics of the website itself.

設計語言以大量空白和高對比度文本為中心。 這樣,重點就在于它試圖突出的故事,而不是網站本身的美學。

I also added a “Compact” view mode, which hides feature images from the website. This allows readers to skim through the list with ease.

我還添加了“緊湊”查看模式,該模式可隱藏網站中的特征圖像。 這使讀者可以輕松瀏覽清單。

2.快速 (2. Fast)

The first version of the website was quite sluggish. This is because it was trying to load hundreds of feature images at once.

該網站的第一個版本相當緩慢。 這是因為它試圖一次加載數百個特征圖像。

To solve this issue, I used “lazy loading.” When you land on the website, only the first 50 stories under “All” are loaded. If you want to see more stories, you have to click on “Load more.” This design pattern drastically reduces the initial loading time.

為了解決此問題,我使用了“延遲加載”。 當您登陸網站時,僅加載“全部”下的前50個故事。 如果您想查看更多故事,則必須單擊“加載更多”。 這種設計模式大大減少了初始加載時間。

Also, to make navigation feel more responsive, I designed this website as a single-page web app. When you click on a button, you don’t navigate to another HTML page. Instead, jQuery switches the view instantaneously.

另外,為了使導航感覺更靈敏,我將此網站設計為單頁Web應用程序。 當您單擊一個按鈕時,您不會導航到另一個HTML頁面。 相反,jQuery會立即切換視圖。

3.輕巧 (3. Lightweight)

To keep the website light, I chose to forgo most popular frontend libraries. I didn’t use Bootstrap, and I kept JavaScript/jQuery usage to a minimum.

為了使網站保持明亮,我選擇放棄最受歡迎的前端庫。 我沒有使用Bootstrap,并且將JavaScript / jQuery的使用降至最低。

Taking a glance at the project repo reveals a very minimal setup. A few HTML files, a CSS file, a couple scripts, and a handful of data files.

快速瀏覽一下項目回購,就會發現設置非常少。 一些HTML文件,一個CSS文件,一些腳本和一些數據文件。

As a result, the website doesn’t have many moving parts and dependencies. It’s very simple to maintain and debug.

結果,該網站沒有太多的活動部分和依賴性。 維護和調試非常簡單。

測試并啟動 (Testing and launching)

I shared the prototype with a couple of friends and asked them to rip it apart. Using their feedback, I iterated on the design twice. Then, I launched on Product Hunt.

我與幾個朋友分享了原型,并要求他們將其拆開。 利用他們的反饋,我對設計進行了兩次迭代。 然后,我啟動了Product Hunt。

I could barely sleep that night. I still remember constantly refreshing the page checking for new comments until I passed out from exhaustion.

那天晚上我幾乎睡不著。 我仍然記得不斷刷新頁面以檢查新評論,直到我精疲力盡。

The next morning, I scrambled out of bed and clawed open my computer. I couldn’t believe my eyes! Top Medium Stories was at the top of Product Hunt’s homepage. At the end of the day, it was awarded the #2 product of the day.

第二天早上,我爬下床,抓著我的電腦。 我簡直不敢相信我的眼睛! 熱門中級故事位于Product Hunt主頁的頂部。 最終,它被評為當天的第二名產品。

中層故事的突然死亡 (The sudden death of Medium Top Stories)

The Product Hunt launch exceeded my wildest expectations, and I was on cloud nine for a long time. But I knew I wasn’t done until I shared my project on Medium. I started this post half a year ago and I finally finished it a few weeks ago. I was beyond excited to publish it.

“產品搜尋”的發布超出了我的最大期望,而且我在云9上呆了很長時間。 但是我知道直到我在Medium上共享我的項目之前,我還沒有完成。 我半年前開始撰寫此帖子,幾周前終于完成。 我很激動地發表它。

Before submitting, I decided to run the data collection script one more time to update the website.

在提交之前,我決定再運行一次數據收集腳本來更新網站。

The script failed catastrophically.

該腳本災難性地失敗了。

“No big deal. Either Medium has an outage or my internet isn’t working,” I thought. But I was so wrong. When I realized what actually happened, I slumped into my chair and dragged my fingers down my face in frustration.

“沒什么大不了的。 “我的介質中斷了,或者我的互聯網無法正常工作。” 但是我錯了。 當我意識到實際發生的事情時,我跌落在椅子上,沮喪地將手指從臉上拖下。

I kid you not, two days prior Medium had removed the top stories page from their website. They scuttled the very page my scraper depended on to function!

我不騙你,兩天前Medium從他們的網站上刪除了熱門新聞頁面。 他們破壞了我的刮板運行所依賴的頁面!

I emailed Medium promptly, asking them to consider reverting the top stories page. I didn’t get the response I was looking for.

我及時通過電子郵件發送給Medium,要求他們考慮還原熱門新聞頁面。 我沒有得到想要的答復。

But I didn’t blame them. My website wasn’t officially supported — they weren’t obligated to do anything. Even if they didn’t make this particular change, eventually one of their updates would break my website. It was inevitable.

但是我沒有責怪他們。 我的網站不受官方支持-他們沒有義務做任何事情。 即使他們沒有進行此特定更改,最終他們的更新之一也會破壞我的網站。 這是不可避免的。

I felt hopeless. Since the website couldn’t be updated anymore, it was no more than a static list that was soon to be obsolete. In my mind, Top Medium Stories was dead on arrival.

我感到絕望。 由于無法再更新該網站,因此它只是一個很快就會過時的靜態列表。 在我看來,《熱門中等故事》在到達時就死了。

新生命的萌芽 (The sprouts of new life)

For a while, I worked on other stuff and didn’t look at Top Medium Stories at all. But I couldn’t stop thinking about the unfinished story of the website. I wanted to publish a postmortem — even if it didn’t have a happy ending. It felt like a good way close out the project.

有一陣子,我從事其他工作,根本沒有看過“中級故事”。 但是我不能停止思考網站未完成的故事。 我想發布一個驗尸報告-即使結局不理想。 結束項目感覺很不錯。

I closed the article with:

我用以下內容關閉了這篇文章:

“So, I hope you enjoyed reading about Top Medium Stories. It was an amazing experience and I’m proud of what I made — I’m sorry it had to end this way. There will always be things you can’t predict or control, and they can wipe away your work in a heartbeat. That’s life.”
“所以,我希望您喜歡閱讀有關“頂級中等故事”的文章。 這是一次了不起的經歷,我為自己的所作所為感到自豪-很抱歉,我不得不以這種方式結束。 總會有一些您無法預測或控制的事情,它們會使您心跳加速。 那就是生活。”

As I stared at my finished draft, I realized something. I hate sad endings.

當我凝視完稿時,我意識到了一些事情。 我討厭悲傷的結局。

Suddenly, my eyes locked on that same JSON blob I mentioned earlier.

突然,我的目光聚焦在我前面提到的同一JSON Blob上。

[  “We fired our top talent. Best decision we ever made.”,   {    “recommends”: 79000.0,     “pub_url”: “https://medium.freecodecamp.org",     “author”: “Jonathan Sol\u00f3rzano-Hamilton”,     “image”: “https://cdn-media-1.freecodecamp.org/images/1*4hU3Xn7wunA81I3v17JIrg.jpeg",     “year”: “2017”,     “story_url”: “https://medium.freecodecamp.org/we-fired-our-top-talent-best-decision-we-ever-made-4c0a99728fde",     “pub”: “freeCodeCamp”,     “author_url”: “https://medium.freecodecamp.org/@peachpie"  }],...

And I had a revelation. I didn’t need the top stories page to update the website. Instead, I could visit each url in the JSON file and pull the data directly from the story’s webpage.

我有一個啟示。 我不需要熱門新聞頁面來更新網站。 相反,我可以訪問JSON文件中的每個URL,然后直接從故事的網頁中提取數據。

To fetch new stories, I could scrape the new Popular on Medium page, which would give me the top stories published recently.

要獲取新故事,我可以抓取新的“中型熱門”頁面,該頁面將為我提供最近發表的熱門故事。

Having refactored my code, I realized something: it is possible that not every single popular new story will end up being showcased on the Popular on Medium page. So if you happen to read a story that you think should be on Top Medium Stories but isn’t, please let me know. Just send the story’s url to michaeldeng18@gmail.com, and I’ll add it in right away. Together, we can ensure the leaderboards are as comprehensive as possible.

重構代碼后,我意識到了一些事情:可能并非每個流行的新故事都會最終出現在“中型流行”頁面上。 因此,如果您碰巧讀了一個您認為應該放在“最佳中級故事”上的故事,但不是,請告訴我。 只需將故事的URL發送到michaeldeng18@gmail.com ,我將立即添加它。 在一起,我們可以確保排行榜盡可能全面。

There is always the risk that Medium might one day restrict scraping completely, or even release their own ranking of stories. Either of these changes could make Top Medium Stories obsolete.

中總是存在這樣的風險:Medium有一天可能會完全限制抓取,甚至發布自己的故事排名。 這些更改中的任何一個都可能使“中級故事”過時。

But in the meantime, I will continue maintaining Top Medium Stories, the best website for discovering awesome stories.

但與此同時,我將繼續維護“頂級中級故事”,這是發現真棒故事的最佳網站。

If by this point you still have not seen Top Medium Stories, go check it out! It’d make me very happy if the site helps you find extraordinary stories that you would’ve otherwise never stumbled upon.

如果此時您仍未看到“熱門中級故事”, 那就去看看 ! 如果該網站可以幫助您找到本來從未有過的非凡故事,那會讓我感到非常高興。

Thanks for reading! If you liked this, give it some love by pressing on the ? button!

謝謝閱讀! 如果您喜歡這個,請按?來給它一些愛。 按鈕!

翻譯自: https://www.freecodecamp.org/news/how-i-built-top-medium-stories-e07a32cf5255/

軟考 中級職稱哪些最熱門

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/394433.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/394433.shtml
英文地址,請注明出處:http://en.pswp.cn/news/394433.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

面試題一

1.html頁面由標簽組成&#xff0c;請寫出<head>中腳本定義標簽、下拉選擇框標簽  腳本定義標簽&#xff1a;<javascript></javascript>   下拉框選擇標簽&#xff1a;<select><option values""></option></select> 2…

leetcode712. 兩個字符串的最小ASCII刪除和(動態規劃)-Gogo

給定兩個字符串s1, s2&#xff0c;找到使兩個字符串相等所需刪除字符的ASCII值的最小和。 示例 1: 輸入: s1 “sea”, s2 “eat” 輸出: 231 解釋: 在 “sea” 中刪除 “s” 并將 “s” 的值(115)加入總和。 在 “eat” 中刪除 “t” 并將 116 加入總和。 結束時&#xff0…

python中封裝是什么意思_Python中數據封裝是什么?

封裝——“隱藏一切可以隱藏的實現細節&#xff0c;只向外界暴露(提供)簡單的編程接口”。在上節的 Student 類中&#xff0c;每個實例就擁有各自的 name 和 age 這些數據。我們可以通過函數來訪問這些數據&#xff0c;比如打印一個學生的年齡&#xff1a;>>> def pri…

jieba庫的使用

jieba庫的使用: jieba庫是一款優秀的 Python 第三方中文分詞庫&#xff0c;jieba 支持三種分詞模式&#xff1a;精確模式、全模式和搜索引擎模式&#xff0c;下面是三種模式的特點。 精確模式&#xff1a;試圖將語句最精確的切分&#xff0c;不存在冗余數據&#xff0c;適合做文…

Go語言實現HashSet

set.go // set project set.go package settype Set interface {Add(e interface{}) boolRemove(e interface{})Clear()Contains(e interface{}) boolLen() intSame(other Set) boolElements() []interface{}String() string }// 將集合other添加到集合one中 func AddSet(one S…

c#控件彈幕效果_C# Form 實現桌面彈幕

使用C# Form 簡單的實現了彈幕效果1.創建一個Form 設置2.添加一個計時器3. 代碼using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Drawing.Text;using System.Linq;using System.Text;using S…

Makefile中怎么使用Shell if判斷

/********************************************************************** Makefile中怎么使用Shell if判斷* 說明&#xff1a;* 譬如可能會在Makfile中需要判斷文件、文件夾的存在&#xff0c;使用shell語法* 輸出一些信息&#xff0c;等等。** …

我如何使用React和Typescript在freeCodeCamp中構建天氣應用

by Kelvin Mai通過凱文麥 我如何使用React和Typescript在freeCodeCamp中構建天氣應用 (How I built the weather app in freeCodeCamp using React and Typescript) So I finally decided to come back to freeCodeCamp and try to finish out my Front End Development Certi…

mysql結果集相減_MySQL_(Java)使用JDBC向數據庫發起查詢請求

課程相關鏈接&#xff1a;JDBC編程和MySQL數據庫課程源代碼在文章末尾~Java Database Connectivity簡單來說就是使用Java里面提供的一些類和方法&#xff0c;利用程序鏈接數據庫&#xff0c;進行增刪改查操作。這個過程就叫做JDBC編程接下來我們便分五步通過JDBC對MySQL中的數據…

在雙系統(Windows與Ubuntu)下刪除Ubuntu啟動項

問題概述&#xff1a;因為在自己學習Linux的時候&#xff0c;按照網上的教程錯誤的刪除了Ubuntu的一個內核驅動&#xff0c;導致Ubuntu不能啟動。我想到的辦法是重新安裝系統&#xff0c;重裝系統的第一步便是將Ubuntu從電腦中卸載。該筆記是有關如何刪除Ubuntu啟動項的。 使用…

iangularjs 模板_2018-web前端的自我介紹-優秀word范文 (5頁)

本文部分內容來自網絡整理&#xff0c;本司不為其真實性負責&#xff0c;如有異議或侵權請及時聯系&#xff0c;本司將立即刪除&#xff01;本文為word格式&#xff0c;下載后可方便編輯和修改&#xff01;web前端的自我介紹篇一&#xff1a;個人總結的web前端面試題1、自我介紹…

Teradata QueryGrid整合最佳分析技術 拓展客戶選擇空間

ZDNET至頂網CIO與應用頻道 05月11日 北京消息&#xff1a; 為持續幫助企業克服數據散布在不同分析系統的困難&#xff0c;全球領先的大數據分析和營銷應用服務供應商Teradata天睿公司宣布對Teradata QueryGrid 進行重要技術升級。此次升級新增并強化六項QueryGrid技術&#xf…

神舟筆記本bios_海爾雷神(藍天)神舟戰神游戲本風扇狂轉掉電大寫燈狂閃維修實例...

昨天收到一臺網友寄過來的海爾雷神游戲本。說到這個游戲本品牌&#xff0c;其實有幾個品牌的筆記本&#xff0c;它們的主板和模具是一模一樣的&#xff0c;也就是我們看到的品牌log不一樣而已。比如神舟的戰神 &#xff0c;機械師&#xff0c;機械革命&#xff0c;麥本本等等。…

Oracle 學習----:查看當前時間與Sqlserver語句不一樣了

oracle:select sysdate from dual sqlserver: select getdate() ---------------------試試這個---------------------------------------------------------- insert into OracleTab values(sysdate) insert into SqlserverTab values(getdate())轉載于:https://www.cnblogs…

react發送和接收請求_React行為編程簡介:請求,等待和阻止

react發送和接收請求by Luca Matteis盧卡馬蒂斯(Luca Matteis) React行為編程簡介&#xff1a;請求&#xff0c;等待和阻止 (An intro to Behavioral Programming with React: request, wait, and block) Behavioral Programming (BP) is a paradigm coined in the 2012 artic…

leetcode96. 不同的二叉搜索樹(動態規劃)

給定一個整數 n&#xff0c;求以 1 … n 為節點組成的二叉搜索樹有多少種&#xff1f; 解題思路 *數組含義&#xff1a;dp[i] i個節點的不同組成結構 狀態轉移&#xff1a;任取節點為根節點&#xff0c;遍歷左右子樹可能出現的個數,dp[i]dp[left]dp[right] 初始化&#xff1a…

“康園圈--互聯網+校園平臺“項目之成果展示及項目總結

一、總體效果&#xff08;ipad端截圖&#xff09; 網站前臺頁面網站后臺管理臺頁面二、前臺訪問鏈接&#xff08;用pc訪問效果最佳&#xff09;&#xff1a;http://www.liangzhilin.cn:9100/kangyuanquan/ &#xff08;為保證數據安全&#xff0c;后臺管理鏈接不對外公開&#…

ajax jq 圖片上傳請求頭_Jquery ajaxsubmit上傳圖片實現代碼

這是數月前的事情了&#xff0c;場景是這樣的&#xff1a; 在進行圖片上傳的時&#xff0c;我發現開發人員使用的上傳圖片方式是Iframe 傳統的 http post 來處理的。而且未建立統一上傳函數。于是將代碼改造了。心想來個ajax異步上傳圖片吧&#xff0c;這技術應該很老套了。于…

這個免費的交互式課程在一小時內學習JavaScript

JavaScript is the most popular programming language on the web. You can use it to create websites, servers, games and even native apps. So no wonder it’s such a valuable skill in today’s job market.JavaScript是網絡上最流行的編程語言。 您可以使用它來創建網…

java中二進制怎么說_面試:說說Java中的 volatile 關鍵詞?

volatile 這個關鍵字可能很多朋友都聽說過&#xff0c;或許也都用過。在 Java 5 之前&#xff0c;它是一個備受爭議的關鍵字&#xff0c;因為在程序中使用它往往會導致出人意料的結果。在 Java 5之后&#xff0c;volatile 關鍵字才得以重獲生機。volatile 關鍵字雖然從字面上理…