匹配一個字符串的開頭和結尾_我如何構建一個應用程序來展示精彩小說的開頭和結尾

匹配一個字符串的開頭和結尾

I know sentences. In my decade as a print journalist, I’ve written hundreds of articles for dozens of publications. I’ve dished out more sentences than Judge Judy. But I didn’t study writing or journalism, at least not formally.

我知道句子。 在擔任印刷記者的十年中,我為數十種出版物撰寫了數百篇文章。 我比朱迪法官多了幾句。 但是我沒有學習寫作或新聞學,至少沒有正式學習過。

My degree is in electrical engineering. I learned to write by studying, and imitating, the sentences of professional writers. And writers are at their best, generally, in their first and last sentences.

我的學位是電氣工程。 我通過學習和模仿專業作家的句子來學習寫作。 通常,作家的第一句和最后一句都是最好的。

“The most important sentence in any article is the first one.
“任何一篇文章中最重要的一句話是第一句話。
You should give as much thought to choosing your last sentence as you did your first.”
在選擇最后一句話時,您應該多加考慮。

On Writing Well, William Zinsser

在《寫得好》中 ,威廉·辛塞爾

One way to get a feel for how to construct good sentences is to type out the prose of writers you admire while reading it aloud. Hunter S. Thompson copied entire novels, punching The Great Gatsby and A Farewell to Arms into his typewriter to get Fitzgerald and Hemingway into his fingers.

感受如何構筑好的句子的一種方法是在朗讀時打出您欣賞的作家的散文。 亨特·湯普森(Hunter S. Thompson) 復制了整本小說 ,將《大蓋茨比》《永別了,武器》打入了打字機,以使費茲杰拉德和海明威進入他的手指。

I haven’t done anything that extreme, but I have, for many years, typed out the first and last sentences of every book I read, which has resulted in an ever-growing list and, I hope, improvements to my own writing.

我沒有做過那么極端的事情,但是多年以來,我一直在打字,以閱讀的每本書的開頭和結尾是句子,這導致了清單的不斷增加 ,我希望可以改善自己的寫作。

But I can read only so many books and log only so many sentences in the few hours I have each day between earning $’s and catching Z’s. Kids to raise, rugs to vacuum, Stranger Things to binge — you know, life.

但是在每天賺取$到碰到Z的幾天之間,我每天只能讀那么多書,只記錄那么多句子。 孩子們要養育,地毯要吸塵, 陌生人要暴飲暴食-你知道,生活。

Wouldn’t it be great, I’ve often thought, if there were a place online where anyone could contribute the first and last sentences of the books they were reading. We could, together, build a treasure trove of sentences. It would be a great resource for people who, like me, enjoy learning by imitation.

我經常想,如果有一個在線的地方,任何人都可以貢獻他們正在閱讀的書的開頭和結尾的句子,那不是很好嗎? 我們可以一起建立句子的寶庫。 對于像我一樣喜歡模仿學習的人們來說,這將是一個巨大的資源。

Well, it just so happens that my latest obsession is learning to program in JavaScript. So I have begun, with my limited knowledge, to make that place myself, using the JavaScript frameworks MongoDB, Express, Angular 2, and Node.js — known, collectively, as the MEAN stack. I’ve called this (very simple) web application First and Last.

好吧,碰巧的是,我最近的癡迷是學習用JavaScript編程。 因此,以我有限的知識,我開始使用JavaScript框架MongoDB,Express,Angular 2和Node.js(統稱為MEAN堆棧)將自己放置在該位置。 我把這個(非常簡單的)Web應用程序稱為First和Last 。

“Some appreciate fine art; others appreciate fine wines. I appreciate fine sentences.”
“有些人欣賞美術; 其他人則喜歡上等葡萄酒。 我很欣賞好的句子。”
— How to Write a Sentence and How to Read One, Stanley Fish
—如何寫一句句子,以及如何閱讀一句話,史丹利·菲什(Stanley Fish)

The rest of this post will alternate between sections describing more of my thoughts on how to write better sentences and sections explaining some of what I learned about programming while working on First and Last.

本文的其余部分將在各節之間交替進行介紹,這些節描述了我對如何編寫更好的句子的更多想法,而各節則解釋了我在進行“第一”和“最后”時所學到的編程知識。

If you are interested only in writing, feel free to skip the sections on programming. If are interest only in programming, you can scroll past the parts on writing. If you are interested only in ironing your underpants while skydiving or mountain climbing, please go here instead.

如果您只對寫作感興趣,請隨時跳過編程部分。 如果僅對編程感興趣,則可以滾動書寫。 如果您只想在跳傘或爬山時熨燙內褲,請改在這里 。

閱讀一切 (Read everything)

If you aspire to be a literary star — the next Jonathan Franzen or Zadie Smith — then stick to reading highbrow literature. Learn from the masters. But most people who want to improve their writing have more modest goals.

如果您渴望成為文學明星-下一個喬納森·弗朗岑(Jonathan Franzen)或扎迪·史密斯(Zadie Smith),那么請堅持閱讀高調的文學作品。 向大師學習。 但是大多數想提高自己的寫作水平的人的目標都比較低。

“Every book you pick up has its own lesson or lessons, and quite often the bad books have more to teach than the good ones.”
“您拿起的每一本書都有自己的一堂課,而且壞書常常比好書教書多。”
— On Writing, Stephen King
—關于寫作,斯蒂芬·金(Stephen King)

Perhaps you want to start a blog or write a Medium post for Free Code Camp. Maybe you want to impress your boss by writing better reports.

也許您想為Free Code Camp創建博客或撰寫中型帖子 。 也許您想通過撰寫更好的報告來打動您的老板。

In my city — Ottawa, Ontario — about 150,000 people work for the Canadian federal government. Thousands more are employed by the city. The most frequently produced pieces of writing here, I reckon, are government documents: memos, briefing notes, regulations, media releases, policies, public advisories, guidelines, and so on.

在我的城市(安大略省渥太華),約有15萬人為加拿大聯邦政府工作。 這個城市雇用了成千上萬的人。 我認為,這里最常用的文字是政府文件:備忘錄,簡報,法規,媒體發布,政策,公共咨詢,指南等。

Are most of these documents written well? Ah, let’s just say there’s room for improvement. Lots of room. Canada-size room.

這些文件大部分寫得好嗎? 啊,我們只能說還有改進的余地 。 很多房間。 加拿大大小的房間。

People who simply want to write more clearly and concisely may find greater benefit in studying sentences outside the realm of literary fiction. Read popular nonfiction. Read children’s books. Heck, read cereal boxes.

那些只想寫得更清楚簡潔的人可能會發現在文學小說領域之外學習句子會獲得更大的好處。 閱讀流行的非小說。 閱讀兒童讀物。 哎呀,看谷物盒。

A good place to find sturdy, workmanlike sentences is in the work of genre novelists, the authors who deal in hardscrabble detectives, spurned lovers, clever lawyers, and dreamy vampires.

體裁小說家,從事頑強偵探的作家,棄的戀人,聰明的律師和夢幻般的吸血鬼,是尋找堅固,熟練的句子的好地方。

Yes, these books are often rife with cliches. But they are never confusing. Authors like James Patterson, Linwood Barclay, and Harlan Coben are experts in making sentences go down easy. I’ve learned plenty from studying their writing — I’m no book snob — and you’ll find some of their sentences in First and Last.

是的,這些書常常充斥著陳詞濫調。 但是他們從不混淆。 詹姆斯·帕特森(James Patterson),林伍德·巴克萊(Linwood Barclay)和哈倫·科本(Harlan Coben)之類的專家都是使句子變得容易的專家。 通過研究他們的寫作,我學到了很多東西-我不是書本勢利的人-您會在First和Last中找到他們的一些句子。

“If it sounds like writing, I rewrite it.”
“如果聽起來像是寫作,我會重寫它。”
— 10 rules of writing, Elmore Leonard
— 10條寫作規則,艾爾莫·倫納德

The sentences in commercial fiction are spare and straightforward. They contain few flourishes, no hooptedoodle. People bring these books on beach vacations for a reason. You can read them while half-drunk and not miss anything.

商業小說中的句子是多余而直接的。 他們幾乎沒有興盛,沒有胡鬧 。 人們將這些書帶到海灘度假是有原因的。 您可以半醉時閱讀它們,不會錯過任何東西。

It is ill-advised, on the other hand, to tackle Ulysses after your fifth Bahama Mama.

另一方面,在您的第五任巴哈馬媽媽之后對付尤利西斯是不明智的。

信息不足 (Not enough info)

My main technical goal in making First and Last was simple: grab data from the browser, stick it in a database, then get it back to the browser to display. That’s pretty much it. I wanted to learn how information moves between the front end (Angular) and the back end (Node and MongoDB).

我制作First和Last的主要技術目標很簡單:從瀏覽器中獲取數據,將其粘貼到數據庫中,然后再將其返回給瀏覽器進行顯示。 就是這樣。 我想學習信息如何在前端(角度)和后端(Node和MongoDB)之間移動。

In other words, I wanted to make an app that performed the four basic database operations — create, read, update and delete (CRUD). I’m no fan of acronyms, but I must admit, I like CRUD and MEAN. Them’s sweet words to this surly pessimist.

換句話說,我想開發一個執行四種基本數據庫操作的應用程序-創建,讀取,更新和刪除(CRUD)。 我不喜歡首字母縮寫詞,但我必須承認,我喜歡CRUD和MEAN。 他們對這位謙卑的悲觀主義者的話很甜美。

第1步:獲取用戶輸入 (Step 1: Get user input)

第2步:存儲在MongoDB中 (Step 2: Store in MongoDB)

第3步:從數據庫中獲取并顯示在瀏覽器中 (Step 3: Fetch from database and display in browser)

Like I said, simple. No fancy algorithms. No data visualization. Just moving information, mostly text, back and forth. Still, I made one silly assumption that caused me some trouble.

就像我說的那樣,很簡單。 沒有花哨的算法。 沒有數據可視化。 只是來回移動信息,主要是文本。 盡管如此,我還是做出了一個愚蠢的假設,給我帶來了一些麻煩。

To display my stored sentences in the browser, I first had to fetch them from the database. When I asked MongoDB for three random entries, it returned an array with three objects. In Angular, I assigned the fetched data to a local array called “sentences,” which I declared as containing objects.

為了在瀏覽器中顯示我存儲的句子,我首先必須從數據庫中獲取它們。 當我向MongoDB請求三個隨機條目時,它返回了一個包含三個對象的數組。 在Angular中,我將獲取的數據分配給稱為“句子”的本地數組,該數組聲明為包含對象。

export class DisplayallComponent implements OnInit {  sentences: [Object];

That worked fine. Later, I decided to allow users to “like” and comment on sentences. So I had to update, in the back end, the data schema that told MongoDB what type of information to store. I declared a like counter as a number and an array of strings called “likedBy,” where I put the usernames of users who had liked a particular pair of sentences.

很好。 后來,我決定允許用戶“喜歡”并評論句子。 因此,我不得不在后端更新告訴MongoDB可以存儲什么類型信息的數據模式。 我聲明了一個like計數器為一個數字和一個名為“ likedBy”的字符串數組,在其中放置了喜歡特定句子對的用戶的用戶名。

const SentenceSchema = mongoose.Schema({  likes: {  type: Number, default: 0 }, likedBy: {  type: [String] }

Again, no problems. Finally, I added comments. Each comment object would contain a username and the body of the comment. I added an array of objects to my data schema, declaring it the same way I had done for my “sentences” array in Angular.

再次,沒有問題。 最后,我添加了評論。 每個評論對象將包含一個用戶名和評論正文。 我在數據架構中添加了一個對象數組,并以與在Angular中“句子”數組相同的方式聲明了它。

const SentenceSchema = mongoose.Schema({  likes: {  type: Number, default: 0 }, likedBy: {  type: [String] },comments: {type: [Object]}

When I tested commenting, though, it didn’t work. There were no obvious errors on the front end, no red text screaming at me in the console of Chrome DevTools. When I peeked in the database, however, the comments I had submitted in the browser were nowhere to be found.

但是,當我測試評論時,它不起作用。 在Chrome DevTools的控制臺中,前端沒有明顯的錯誤,也沒有紅色文字向我尖叫。 但是,當我瀏覽數據庫時,找不到在瀏覽器中提交的注釋。

After a bit of try-this-try-that and some quiet late-night cursing, I figured out the problem. MongoDB, it turned out, wanted me to be more specific than Angular. I had to tell it the data types of each element in a comment object in my “comments” array. Just stating that the array contained objects wasn’t good enough.

經過一番嘗試,然后進行了一些安靜的深夜詛咒,我發現了問題所在。 事實證明,MongoDB希望我比Angular更具體。 我必須在“ comments”數組中告訴它注釋對象中每個元素的數據類型。 僅說明數組包含對象是不夠的。

comments: [{username: String,body: String}],

Programmers, it would seem, have at least one thing in common with the author of Fifty Shades of Grey. Sometimes it pays to be more explicit.

程序員似乎與《 五十度陰影》的作者至少有一點共同點。 有時需要更加明確。

保持簡短(ish) (Keep it short(ish))

I love a good long sentence, I really do. Garrison Keillor, of A Prairie Home Companion fame, writes beautiful, funny, rambling sentences that end only when the ink runs out. Novelist E.L. Doctorow starts Billy Bathgate with a 131-word sentence and ends with a 277-word whopper. In A Writer’s Life, nonfiction legend Gay Talese has a sentence that is FOUR HUNDRED AND NINETEEN words long.

我真的很喜歡長句子。 擁有“草原家庭之友”聲望的加里森·基洛爾(Garrison Keillor)寫的優美,有趣,漫無目的的句子只有在墨水用完時才結束。 小說家EL Doctorow以比利·巴斯蓋特 ( Billy Bathgate)開頭的131個單詞的句子開始,以277個單詞的whopper結尾。 在《作家的生活》中 ,非小說類傳奇人物蓋爾·塔萊斯(Gay Talese)的句子長四百到九十個單詞。

But make no mistake?—?these writers are showing off. They are good at what they do and want you to know it. And that’s fine by me. Because in the hands of a great writer, any sentence, even one longer than Shaquille O’Neal’s Burger King receipt, will be under control.

但是請不要誤會-這些作家在炫耀。 他們擅長于做什么,并希望您知道。 我也很好。 因為在一個偉大的作家手中,任何句子,甚至比Shaquille O'Neal的Burger King收據更長的句子,都將得到控制。

I’m no Gay Talese. Neither are you. If you go long, you will go wrong. Trust me. I edit the writing of freelance journalists and academics, and when the clauses start to pile up, so do the problems. Dangling modifiers. Mismatched pronouns. Inelegant repetition. Unnecessary words. Funky conjunctions.

我不是Gay Talese。 你也不是。 如果你走多長時間,那你就會出錯。 相信我。 我編輯自由記者和學者的著作,當這些條款開始堆積起來時,問題也隨之而來。 懸空修改器。 代詞不匹配。 不雅的重復。 不必要的話。 時髦的連詞。

In short, blerg.

簡而言之, blerg 。

It is best to vary the length of your sentences — it’s more pleasing to the ear — but keep them in check. A mixture of short and medium-length sentences is your safest bet.

最好更改句子的長度-聽起來更令人耳目一新-但請務必加以控制。 中短句子的混合是最安全的選擇。

信息太多 (Too much info)

I’m about to share more code, and things are going to get ugly. Sorry, I’m new to this. If you would like to mock me in the comments, feel free.

我將分享更多的代碼,事情將變得丑陋。 抱歉,我是新來的。 如果您想在評論中嘲笑我,請放心。

Journalists have thick skin. We need it. Earlier this week, for example, I received the following email?—?from some guy who rents luxury apartments in Budapest?—?about an article on intermittent fasting I wrote in 2013.

記者的皮膚很厚。 我們需要。 例如,本周早些時候,我收到了一封電子郵件,該郵件來自某位在布達佩斯租用豪華公寓的人,該郵件涉及我2013年撰寫的有關間歇性禁食的文章 。

Anyway, this was the function called in Angular when a user clicked on the thumbs-up icon under an entry in First and Last, as I originally wrote it.

無論如何,這是當用戶單擊“我”最初編寫的“第一”和“最后一個”條目下的大拇指圖標時在Angular中調用的函數。

if(this.authService.loggedIn()) {const isInArray = sentence.likedBy.includes(this.username); if(!isInArray) {sentence.likedBy.push(this.username); this.authService.incrementLikes(sentence).subscribe(data => {this.sentences[index] = data;

Users could “like” a pair of sentences only if they were logged in and hadn’t already “liked” that entry. When those conditions were met, a local array of the users who had liked that pair of sentences was updated.

僅當用戶登錄并且尚未“喜歡”該條目時,用戶才能“喜歡”一對句子。 滿足這些條件后,就會更新一個本地數組,其中包括喜歡這對句子的用戶。

Then a call was made to update the like counter and “likedBy” array in the database. The entire sentence object was sent to the back end and, when the updated sentence object was returned, the like counter displayed in the browser increased by one.

然后調用了更新數據庫中的like計數器和“ likedBy”數組。 整個句子對象被發送到后端,當返回更新的句子對象時,瀏覽器中顯示的類似計數器增加了一個。

In my data model in the back end, I had this, sadly.

不幸的是,在后端的數據模型中,我有這個。

module.exports.incrementLikes = function(sentence, callback) {const query = {_id:sentence._id};sentence.likes++;const likesPlus = sentence.likes;const likesUserArray = sentence.likedBy;const newLikeUser = likesUserArray[likesUserArray.length - 1];Sentences.findOneAndUpdate(query, {likes: likesPlus, $push:{likedBy: newLikeUser}}, {new: true}, callback);
}

This function incremented the counter passed in as a parameter and assigned it to a local variable, which replaced the like counter in the database.

此函數遞增作為參數傳入的計數器,并將其分配給局部變量,該局部變量替換數據庫中的類似計數器。

If that weren’t round-a-bout enough, I copied the entire “likedBy” array from the sentence object passed to the function, then made ANOTHER local variable to hold the last username in that array before, finally, pushing that username into the database’s “likedBy” array.

如果還不夠,我從傳遞給函數的句子對象中復制整個“ likedBy”數組,然后使另一個本地變量保存該數組中的最后一個用戶名,最后,將該用戶名壓入數據庫的“ likedBy”數組。

It worked, but still. Ridiculous.

它有效,但仍然有效。 荒謬。

The only information MongoDB needed from Angular was the unique ID of the sentence object to update and the username of the user who clicked the thumbs-up icon. Not the whole sentence object.

MongoDB唯一需要Angular提供的信息是要更新的句子對象的唯一ID,以及單擊大拇指圖標的用戶名。 不是整個句子的對象。

So, instead, I created a new object with only those two elements in Angular to pass to the back-end.

因此,我創建了一個只有Angular中只有這兩個元素才能傳遞到后端的新對象。

onLikeClick(sentence, index) {if(this.authService.loggedIn()) {const isInArray = sentence.likedBy.includes(this.username); if(!isInArray) {const updateLikes = {likeID: sentence._id,likeUsername: this.username}this.authService.incrementLikes(updateLikes).subscribe(data =>this.sentences[index] = data;

Then I simply incremented the like counter inside the database (rather than incrementing outside and overwriting the database value) and pushed the username passed to the function into the database’s “likedBy” array.

然后,我只是簡單地在數據庫內部增加了like計數器(而不是在外部增加并覆蓋了數據庫值),然后將傳遞給函數的用戶名推送到數據庫的“ likedBy”數組中。

module.exports.incrementLikes = function(updateLikes, callback) {const query = {_id:updateLikes.likeID};const newLikeUser = updateLikes.likeUsername;Sentences.findOneAndUpdate(query, {$inc: {likes: 1}, $push: {likedBy: newLikeUser}}, {new: true}, callback);
}

When you’re a newbie to programming, the joy of making something work can cloud judgment. It’s tempting to leave ugly code alone because, after all, it does what I want it to do. But if I value concision when I write prose, why should it be any different when I write code? Clutter is clutter.

當您是編程的新手時,使某項工作正常進行的樂趣可能會影響判斷。 將丑陋的代碼留在外面很誘人,因為畢竟它能滿足我的要求。 但是,如果我在撰寫散文時重視簡潔,那么為什么在編寫代碼時又有什么不同呢? 雜亂無章。

No point in passing around information that isn’t required.

沒有必要傳遞不必要的信息。

When a police officer asks for your driver’s license, you don’t also hand over your library card, birth certificate and Ashley Madison password.

當警察要求您提供駕駛執照時,您也不會交出您的借書證,出生證和阿什利·麥迪遜密碼。

把事情簡單化 (Keep it simple)

I’m a huge fan of readability. I think when you glance at a dense paragraph of long sentences — riddled with acronyms or statistics or symbols or puffy job titles or long, awful words ending in “-ization” — your brain sighs.

我是可讀性的忠實擁護者。 我認為,當您瀏覽一長串密集的長句子時,到處都是首字母縮寫詞,統計數據或符號,浮腫的工作標題或以“-化”結尾的長而可怕的單詞,您的大腦就會嘆息。

“Oh, how wonderful,” it moans with its wee brain-mouth. “This is gonna be hella fun.”

“哦,太好了,”它微弱的腦口抱怨著。 “這會很有趣。”

Many people who write occasionally as part of their jobs, academics and subject experts in particular, are so concerned with content that they often fail to consider presentation. They want to be comprehensive, to make all their points — point A to point Z — and will stuff as much information as possible into every sentence.

許多偶爾寫工作的人,特別是學者,尤其是學科專家,對內容如此關注,以至于他們常常不考慮演講。 他們想要變得全面,將所有觀點(從A到Z的觀點)表達出來,并在每個句子中填充盡可能多的信息。

But if the end result is unreadable and unlikely to be retained, perhaps there’s no point at all. I’d prefer readers to remember a few ideas presented clearly than instantly forget a dozen over-stuffed ideas presented haphazardly.

但是,如果最終結果不可讀并且不太可能保留,那么可能根本沒有意義。 我希望讀者記住清晰呈現的一些想法,而不是立即忘記隨意提出的十二個過度填充的想法。

“Poor Faulkner. Does he really think big emotions come from big words? He thinks I don’t know the ten-dollar words. I know them all right. But there are older and simpler and better words, and those are the ones I use.”
“可憐的福克納。 他真的認為大情緒來自大話嗎? 他認為我不知道十美元的字眼。 我知道他們沒事。 但是有更老,更簡單,更好的單詞,這些都是我使用的。”
— Ernest Hemingway
- 海明威

There will always be unsightly clutter in some forms of writing — it’s unavoidable. Articles on programming and technology will have acronyms. Business writing will have buzzwords. Summaries of medical research may contain adjusted rate ratios of 0.86, 96% CI 0.4–0.56.

在某些形式的寫作中總會有難看的雜物-這是不可避免的。 有關編程和技術的文章將使用縮寫詞。 商業寫作將成為流行語。 醫學研究摘要可包含0.86、96%CI 0.4-0.56的調整比率。

Still, we can try to do better. We can present only the information the reader needs, nothing more. We can resist the urge to impress, to show off our Google-enhanced vocabularies. We can trim decorative adjectives, eschew jargon, avoid “whom” at all costs. We can do more than just dump words on a page.

不過,我們可以嘗試做得更好。 我們只能提供讀者需要的信息,僅此而已。 我們可以抵制留下深刻印象的沖動,以炫耀Google增強的詞匯量。 我們可以修剪裝飾形容詞,避免行話,不惜一切代價避免使用“ whom”。 我們不僅可以在頁面上轉儲單詞,還可以做更多的事情。

Writing well is difficult. But it is the writer who should suffer. Not the reader.

寫好很難。 但是作家應該受苦。 不是讀者。

翻譯自: https://www.freecodecamp.org/news/write-better-sentences-and-do-javascript-crud-with-mean-while-mostly-avoiding-acronyms-fe17905bcec5/

匹配一個字符串的開頭和結尾

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

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

相關文章

python 社區網絡轉化_python-將numpy打開網格轉換為坐標

方法1使用np.meshgrid,然后堆疊-r,c np.meshgrid(*m)out np.column_stack((r.ravel(F), c.ravel(F) ))方法2或者,使用np.array()然后進行轉置,重塑-np.array(np.meshgrid(*m)).T.reshape(-1,len(m))對于np.ix_中使用的通用數組數目的通用情況,這里是需要進行的修改-p np.r_[…

《思科數據中心I/O整合》一2.11 活動-活動連接(Active-Active)

本節書摘來自異步社區《思科數據中心I/O整合》一書中的第2章,第2.11節,作者【美】Silvano Gai , Claudio DeSanti,更多章節內容可以訪問云棲社區“異步社區”公眾號查看 2.11 活動-活動連接(Active-Active) 思科數據中…

spring mvc 返回html 亂碼,解決springmvc使用ResponseBody注解返回json中文亂碼問題

spring版本:4.2.5.RELEASE查看“org.springframework.http.converter.StringHttpMessageConverter”源碼,中有一段說明:By default, this converter supports all media types ({code */*}),and writes with a {code Content-Type} of {code …

JS Ajax異步請求發送列表數據后面多了[]

還在苦逼的寫代碼,這里就不詳細了,直接拋出問題: 如圖所示: 前端ajax請求向后端發送數據的時候,給key添加了[]出現很多找不到原因, 后面在說 解決方法: 暫時先這樣記錄一下,下次方便…

分析堆棧溢出原因_我分析了有關堆棧溢出的所有書籍。 這是最受歡迎的。

分析堆棧溢出原因by Vlad Wetzel通過弗拉德韋澤爾 我分析了有關堆棧溢出的所有書籍。 這是最受歡迎的。 (I analyzed every book ever mentioned on Stack Overflow. Here are the most popular ones.) Finding your next programming book is hard, and it’s risky.尋找下一…

ftp如何預覽圖片 解決方案

下載使用 server-U ,開啟 HTTP 服務,輸入 http://ip:端口 后,登錄ftp賬號密碼,可選使用 基于java的應用 web client 或 FTP Voyager JV,來預覽圖片。 本來想走 windows 文件共享服務預覽圖片,可是 貌似 被防…

《面向對象的思考過程(原書第4版)》一 導讀

本節書摘來自華章出版社《面向對象的思考過程(原書第4版)》一書中的第3章,第3.2節,[美] 馬特魏斯費爾德(Matt Weisfeld) 著黃博文 譯更多章節內容可以訪問云棲社區“華章計算機”…

html文件下的flag,推薦一個SAM文件中flag含義解釋工具

SAM是Sequence Alignment/Map 的縮寫。像bwa等軟件序列比對結果都會輸出這樣的文件。samtools網站上有專門的文檔介紹SAM文件。具體地址:http://samtools.sourceforge.net/SAM1.pdf很多人困惑SAM文件中的第二列FLAG值是什么意思。根據文檔介紹我們可以計算&#xff…

科大訊飛往屆生招聘_我從飛往西雅圖的最后一波設計采訪中學到的東西

科大訊飛往屆生招聘by Tiffany Eaton蒂芙尼伊頓(Tiffany Eaton) 我從飛往西雅圖的最后一波設計采訪中學到的東西 (What I learned from flying to Seattle for Microsoft’s final wave of design interviews) Before I tell you about my onsite interview with Microsoft, I…

{0,1,2.....Fmax} 每個數出現的次數

給定一個非負整數數組&#xff0c;統計里面每一個數的出現次數。我們只統計到數組里最大的數。 假設 Fmax &#xff08;Fmax < 10000&#xff09;是數組里最大的數&#xff0c;那么我們只統計 {0,1,2.....Fmax} 里每個數出現的次數。 輸入第一行n是數組的大小。1 < n <…

mysql死鎖查詢_Mysql 查看死鎖,解除死鎖 方式

解除正在死鎖的狀態有兩種方法&#xff1a;第一種&#xff1a;1.查詢是否鎖表show OPEN TABLES where In_use > 0;2.查詢進程(如果您有SUPER權限&#xff0c;您可以看到所有線程。否則&#xff0c;您只能看到您自己的線程)show processlist3.殺死進程id(就是上面命令的id列)…

TCP/IP WebSocket MQTT

http://www.cnblogs.com/shanyou/p/4085802.html TCP/IP, WebSocket 和 MQTT 轉載于:https://www.cnblogs.com/wujing-hubei/p/5491436.html

《游戲編程模式》一7.8 并發狀態機

本節書摘來異步社區《游戲編程模式》一書中的第7章&#xff0c;第7.8節&#xff0c;作者&#xff1a; 【美】Robert Nystrom &#xff08;尼斯卓姆&#xff09; 譯者&#xff1a; 趙衛兵 , 許新星 , 姜召陽 , 陳侃 , 屈光輝 , 鄭炯彬 責編&#xff1a; 陳冀康&#xff0c;更多章…

洛陽師范學院計算機科學與技術專業怎么樣,2019洛陽師范學院專業排名

洛陽師范學院是一所省屬普通高等本科院校&#xff0c;學校大力實施"人才興校"戰略&#xff0c;形成了一支結構合理、素質優良的師資隊伍。為了讓大家更好的了解這所大學的專業排名&#xff0c;下面是學習啦小編給大家帶來的洛陽師范學院專業排名&#xff0c;供大家參…

MobaXterm 錯行,亂碼

最近使用MobaXterm ssh,發現進入ssh顯示中文沒問題。但如果用VIM編輯文件時如果有中文&#xff0c;修改插入操作有時就會有串行亂碼情況&#xff0c;改vim編碼也不行。都沒有完美解決。最后發現只需要在MobaXterm 的設置中把字體換一個問題就都解決了。 轉載于:https://www.cnb…

一個數據倉庫轉型者眼中的數據挖掘

一個數據倉庫轉型者眼中的數據挖掘 對于大多數非從業者或者初學者來說&#xff0c;數據倉庫&#xff08;Data Warehousing&#xff09;與數據挖掘&#xff08;Data Mining&#xff09;是很容易混淆的兩個概念。有個形象的比喻說&#xff1a;如果把數據倉庫比做一個大型的礦坑&a…

mysql的告警日志_運維日記|MySQL關于aborted告警日志的分析

又是一個季度一次的現場巡檢&#xff0c;期待數據庫能跑的又快又穩&#xff0c;畢竟這是對DBA最大的饋贈了。?結果不遂人意發現在錯誤日志內存在大量的如下報錯&#xff1a;查看當前數據庫的狀態值&#xff1a;查看數據庫關于數據庫會話的關鍵參數&#xff1a;數據庫環境及相關…

2017年Spring發布了30個新的Android庫,值得您關注

by Michal Bialas由Michal Bialas 2017年Spring推出的30個最酷的Android庫 (The 30 Coolest Android Libraries from Spring 2017) These are my 30 favorite new Android libraries that have come out since March 2017. Some of them aren’t production ready yet, but yo…

《異構信息網絡挖掘: 原理和方法(1)》一第2章 基于排名的聚類

本節書摘來自華章出版社《異構信息網絡挖掘&#xff1a; 原理和方法(1)》一書中的第2章&#xff0c;作者&#xff3b;美&#xff3d;孫藝洲&#xff08;Yizhou Sun&#xff09;韓家煒&#xff08;Jiawei Han&#xff09;&#xff0c;更多章節內容可以訪問云棲社區“華章計算機”…

html怎樣將單元格的字豎式,數學豎式計算的標準格式是怎樣的?需要注意哪些問題?...

小學階段數學計算題是重中之重&#xff0c;也是為日后打基礎的時間段&#xff0c;所以在小學的時候&#xff0c;要讓孩子熟練掌握數學計算。數學計算在這段時期一般比較簡單&#xff0c;通常情況下學生可以采用口算、心算的形式&#xff0c;但是有的學生因為這兩個能力不強。于…