From 2584de860d38b42bd0ed8843b6ec4c257ee8b3f7 Mon Sep 17 00:00:00 2001 From: Hui Lan Date: Fri, 16 Jul 2021 18:13:07 +0800 Subject: [PATCH 1/2] main.py: article count. --- app/main.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/main.py b/app/main.py index 50b2146..9008101 100644 --- a/app/main.py +++ b/app/main.py @@ -30,6 +30,13 @@ def get_random_ads(): ads = random.choice(['个性化分析精准提升', '你的专有单词本', '智能捕捉阅读弱点,针对性提高你的阅读水平']) return ads + '。 试试吧!' +def total_number_of_essays(): + rq = RecordQuery(path_prefix + 'static/wordfreqapp.db') + rq.instructions("SELECT * FROM article") + rq.do() + result = rq.get_results() + return len(result) + def load_freq_history(path): d = {} if os.path.exists(path): @@ -235,6 +242,7 @@ def mainpage(): page += '

登录 成为会员 使用说明

\n' #page += '

advertisement

' % (get_random_image(path_prefix + 'static/img/')) page += '

%s

' % (get_random_ads()) + page += '

共有文章%d篇' % (total_number_of_essays()) page += '

粘帖1篇文章 (English only)

' page += '
' page += '
' From 317c12e82794194fee4db16d36765b648d6f396d Mon Sep 17 00:00:00 2001 From: Hui Lan Date: Fri, 16 Jul 2021 18:30:32 +0800 Subject: [PATCH 2/2] wordfreqapp.sql: more articles. --- app/static/wordfreqapp.sql | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/app/static/wordfreqapp.sql b/app/static/wordfreqapp.sql index 6966c11..f638266 100644 --- a/app/static/wordfreqapp.sql +++ b/app/static/wordfreqapp.sql @@ -47,6 +47,22 @@ INSERT INTO user VALUES('ValuedCustomer','l0ve1t','20190928','20190928'); INSERT INTO user VALUES('lanhui1025','l0ve1t','20191025','20191025'); INSERT INTO user VALUES('cool','test','20191025','20191025'); INSERT INTO user VALUES('lanhui1025b','l0ve1t','20191025','20191025'); +INSERT INTO user VALUES('lanhui20210428','l0ve1t','20210428','20211230'); +INSERT INTO user VALUES('laijingtao','l0ve1t','20210428','20211230'); +INSERT INTO user VALUES('13173817032','123456','20210510','20211230'); +INSERT INTO user VALUES('984472450','984472450','20210510','20211230'); +INSERT INTO user VALUES('1292164003@qq.com','ljj123','20210510','20211230'); +INSERT INTO user VALUES('0987654321','Ca11MeLW!','20210516','20211230'); +INSERT INTO user VALUES('17858992909','123456','20210517','20211230'); +INSERT INTO user VALUES('98765','98765','20210519','20211230'); +INSERT INTO user VALUES('1359178602@qq.com','123456','20210520','20211230'); +INSERT INTO user VALUES('214660032@qq.com','ZHUWENQI','20210526','20211230'); +INSERT INTO user VALUES('admin@qq.com','‘ or ‘1’=‘1’','20210527','20211230'); +INSERT INTO user VALUES('1021844583','GGMU1234','20210610','20211230'); +INSERT INTO user VALUES('CZY_chenzhiyuan@outlook.com','Ca11MeCZY!','20210622','20211230'); +INSERT INTO user VALUES('chenzhiyuan0920@gmail.com','Ca11MeCZY!','20210622','20211230'); +INSERT INTO user VALUES('zwq','123456','20210622','20211230'); +INSERT INTO user VALUES('lanhui713','l0ve1t','20210713','20211230'); CREATE TABLE IF NOT EXISTS "article" ( "article_id" INTEGER PRIMARY KEY AUTOINCREMENT, "text" TEXT, @@ -101,6 +117,8 @@ INSERT INTO article VALUES(43,replace('How to Learn to Program\n\nOctober 9, 201 INSERT INTO article VALUES(44,replace('McConnell backs Trump legal fight in election results\n\n10 November 2020\n\nSenate Majority Leader Mitch McConnell backed the Trump campaign’s legal challenge of voting results in several battleground states on Monday in his first public comments on the floor since Election Day.\n\nIn his remarks, McConnell, R-Ky., said, “no states have yet certified their election results” and that recounts are already expected to occur in “at least one or two states.” The longtime senator argued that President Trump is “100 percent within his rights to look into allegations of irregularities and weigh his legal options.”\n\nMeanwhile, Attorney General William Barr on Monday gave federal prosecutors the green light to pursue "substantial allegations" of voting irregularities before the 2020 presidential election is certified next month, even though little evidence of fraud has been put forth.','\n',char(10)),'Source: https://www.foxnews.com/politics/live-updates-mcconnell-backs-trump-legal-fight-in-election-results','20 Nov 2020','4',replace('QUESTION\n\nThe election results are official at the time of writing this news. Is this statement true?\n\n\nANSWER\n\nFalse.\n','\n',char(10))); INSERT INTO article VALUES(45,replace('Meet Minimum Requirements: Anything More is Too Much\n\nSeptember 1, 1998\n\nCommit to a project plan that only includes essential function, with a “closet plan” for nonessential function.\n\nby Neal Whitten, PMP, Contributing Editor\n\nDoes this conversation between a project manager and a project outsider sound familiar? It’s a Y2K project, but it could be any project.\n\nOutsider: “Will your project complete on time?”\nPM: “We have no choice.”\nOutsider: “I didn’t ask if you had a choice. I asked will you complete on time?”\nPM: “This is an important project. There’s a lot riding on the success of this project. We must complete on time.”\n\n(Translation: “No, we won’t complete on time. Anybody with any project experience knows this.”)\n\nIs this a Y2K-unique problem? No—it’s common on most projects. The primary reason it’s so common on Y2K projects is that most of the project managers and other project leaders on these projects were trained on pre-Y2K projects. Let me explain.\n\nOne of the most common problems with projects is taking on too much work—attempting to exceed requirements rather than meet minimum requirements. This contributes to a plethora of ill effects, including late deliveries, budget overruns, low morale and poor quality. Attempting to cram the proverbial 10 pounds into a 5-pound sack is a common occurrence.\n\nOne solution is to build products that meet minimum requirements. You may be thinking that such a product would have low appeal to your client or customers, but it’s not what you think.\n\n“Meet minimum requirements” means give the client what he or she needs to be successful; but don’t provide unessential function. Additional function is what future releases and future business opportunities are all about. It is important to earn the reputation for being reliable in meeting customer commitments and then be trusted to continue to upgrade on a routine, predictable basis. This is good business.\n\nYou say you always only provide essential function? For most of us, most times, that’s not true. Have you ever faced slipped delivery dates and chosen to remove some of the function originally planned? When the project began, everyone swore that all the planned function was essential. Yet, as the project progressed—and got further behind schedule—some of that essential function no longer looked so essential.\n\nWe’ll use a Y2K project as an example, because Y2K projects are at a heightened focus these days—and, interestingly enough, the No. 2 problem with Y2K projects is that they are taking on too much work (the No. 1 problem is that too many projects are starting too late). Here’s what should occur.\nLet’s say you’ve identified 100 functions (enhancements or changes) that need to be made in your company’s programs. You know that all 100 functions are desirable, but you recognize that your limited resources won’t allow all the functions to be ready by the hoped-for date. You find that 40 functions fall within the high-priority category, 30 as medium and 30 as low. You build a project plan to implement only the 40 high priorities. Why? Because you don’t want to jeopardize the timely completion of these 40 by building a plan to include the other 60 functions—all of lesser importance and, for purposes of illustration, deemed nonessential.\n\nYou might be thinking that you should build a plan with all 100 functions and later, if (actually, when) the project gets into trouble, you can always back out of lesser-priority function. Don’t go there! This foolish plan requires spending valuable time, dollars and resources working on other-than-the-most-important functions. Moreover, when you back out, it costs again. What needs to be done is to build a plan that significantly reduces rework. This means the original plan must be only essential function.\n\nWhat about the other 60? You carefully look these over and put work-arounds in place that, although not optimal, can get you through until more substantial actions can occur.\n\nBut there is something else you do. You decide on the most important of the 60 functions—maybe it’s all of the 30 medium functions or some subset thereof—and you create multiple, independent small projects with any and all resources you can muster. I call these small projects collectively a “closet plan.” These small projects are managed with the same care and attention to quality as the primary project. If any of these small projects can complete by a predetermined date (e.g., system test) and the risk to the primary project is judged to be acceptable, then the completed small projects are merged in with the primary project. There are many advantages to this technique: from reducing risk to the primary project, to motivating the members of the small projects to complete by a predetermined date, to setting customer expectations that are most likely to be met or exceeded.\n\nMost of us have been conditioned to believe that “meets minimum requirements” is unexciting and noncompetitive. I believe it to be the opposite. Deliberately practicing meeting minimum requirements helps an organization or company to be first-to-market, earn increasing credibility from their client(s), and strongly posture their enterprise for taking on new business opportunities. Adopting the concept of meeting minimum requirements can set your organization up for exceptional performance.','\n',char(10)),'Source: https://nealwhittengroup.com/articles/meet-minimum-requirements-anything-more-is-too-much/','20 Nov 2020','4',replace('QUESTION\n\nMeeting the minimum requirements is not exciting.\nIs this statement true?\n\nANSWER\n\nFalse\n','\n',char(10))); INSERT INTO article VALUES(46,replace('Text of a statement from President Donald Trump on the election result\n\nNov 7, 2020 12:48 PM EST\n\n\n“We all know why Joe Biden is rushing to falsely pose as the winner, and why his media allies are trying so hard to help him: they don’t want the truth to be exposed. The simple fact is this election is far from over. Joe Biden has not been certified as the winner of any states, let alone any of the highly contested states headed for mandatory recounts, or states where our campaign has valid and legitimate legal challenges that could determine the ultimate victor. In Pennsylvania, for example, our legal observers were not permitted meaningful access to watch the counting process. Legal votes decide who is president, not the news media.\n\n“Beginning Monday, our campaign will start prosecuting our case in court to ensure election laws are fully upheld and the rightful winner is seated. The American People are entitled to an honest election: that means counting all legal ballots, and not counting any illegal ballots. This is the only way to ensure the public has full confidence in our election. It remains shocking that the Biden campaign refuses to agree with this basic principle and wants ballots counted even if they are fraudulent, manufactured, or cast by ineligible or deceased voters. Only a party engaged in wrongdoing would unlawfully keep observers out of the count room – and then fight in court to block their access.\n\n“So what is Biden hiding? I will not rest until the American People have the honest vote count they deserve and that Democracy demands.”\n\nThe statement was issued while Trump was golfing at his club in Virginia.','\n',char(10)),'Source: https://www.pbs.org/newshour/politics/read-president-donald-trumps-full-statement-on-the-election-results-vowing-to-head-to-the-courts','20 Nov 2020','4',replace('QUESTION\n\nWho wrote the above text?\n\nANSWER\n\nTrump.\n','\n',char(10))); +INSERT INTO article VALUES(47,replace('My typical day\n\nJanuary 12, 2021\n\nDave Rupert\n\n6:30am — My cat headbutts me awake asking for food. I get up and feed the cat. He has a bad thyroid and meows obnoxiously throughout the whole process, but it gets done. I push a button to start my first cup of coffee on our Jura and start browsing headlines.\n6:50am — Kids wake up, get them watching a Netflix while I make breakfast.\n7:45am — Get son logged onto Zoom School. Occasionally I’ll write or play Barbie with my daughter during this time.\n8:45am — Wife and son take daughter to preschool. I shower and get ready for work.\n9:00am — Begin work. Work is broken up by numerous coffee breaks, bathroom breaks, and meetings throughout the day. I tend to hit a productivity stride starting around 2pm, so mornings are spent catching up on projects, blogs, and emails while reserving the afternoon for more focused deep work.\n??:?? — I regularly forget to eat lunch. This is a bad habit. Whenever I do eat lunch, it’s usually at my desk while watching some YouTubes. Look, I ain’t proud of this, but it’s what we got going on.\n5:15pm — Leave work, walk twelve steps to the kitchen.\n5:30pm — Eat dinner at the dining table with kids. They peel off mid-meal.\n6:00pm — Walk the dog, listen to audiobooks.\n6:40pm — Get kids bath’d and ready for bed.\n8:15pm — Wash dishes, listen to audiobooks, minimal tidying.\n9:30pm — Leisure time. Most nights I’ll hop onto Discord with friends and play video games. Currently it’s a mix of Overwatch and Call of Duty: Warzone. When not playing video games, it’s a mix of reading, writing, DnD, recording Aside Quest, or watching Star Trek with my wife.\n12:00am — Read until I fall asleep.','\n',char(10)),'Source: https://daverupert.com/2021/01/my-typical-day/','28 April 2021','4',replace('QUESTION\n\nWhen does the author get up in his typical day?\n\nANSWER\n\n6:30am.\n','\n',char(10))); +INSERT INTO article VALUES(48,replace('5 A Day: what counts?\n-Eat well\n\n\n\nAlmost all fruit and vegetables count towards your 5 A Day, so it may be easier than you think to get your recommended daily amount.\n\nAt a glance: what counts?\n--------------------------\n \n- 80g of fresh, canned or frozen fruit and vegetables counts as 1 portion of your 5 A Day. Opt for tinned or canned fruit and vegetables in natural juice or water, with no added sugar or salt.\n\n- 30g of dried fruit (this is equivalent to around 80g of fresh fruit) counts as 1 portion of your 5 A Day. Dried fruit should be eaten at mealtimes, not as a between-meal snack, to reduce the risk of tooth decay.\n\nSome portions only count once in a day:\n\n- 150ml of fruit juice, vegetable juice or smoothie. Limit the amount you drink to a combined total of 150ml a day. Crushing fruit and vegetables into juice and smoothies releases the sugars they contain, which can damage teeth. Juices and smoothies should be consumed at mealtimes, not as a between-meal snack, to reduce the risk of tooth decay.\n\n- 80g of beans and pulses. These only count once as part of your 5 A Day, no matter how many you eat. This is because although they''re a good source of fibre, they contain fewer nutrients than other fruits and vegetables.\n\n\nDifferent types of fruit and veg\n--------------------------------\n\nFruit and vegetables don''t have to be fresh to count as a portion. Nor do they have to be eaten on their own: they also count if they''re part of a meal or dish.\n\nThese all also count towards your 5 A Day:\n\nFrozen fruit and vegetables.\n\nTinned or canned fruit and vegetables. Buy ones tinned in natural juice or water, with no added sugar or salt.\nFruit and vegetables cooked in dishes such as soups, stews or pasta.\nA 30g portion of dried fruit, such as currants, dates, sultanas and figs, counts as 1 of your 5 A Day, but should be eaten at mealtimes, not as a between-meal snack, to reduce the impact on teeth.\nFruit and vegetables in convenience foods, such as ready meals and shop-bought pasta sauces, soups and puddings.\nSome ready-made foods are high in salt, sugar and fat, so only have them occasionally or in small amounts.\n\nYou can find the salt, sugar and fat content of ready-made foods on the label.\n\n\nDrinks and 5 A Day\n------------------\n\nKeep an eye on the amount of fruit juice and smoothies you drink. The current advice is to limit consumption of fruit or vegetable juices and smoothies to a combined total of 150ml a day (1 portion). Crushing fruit into juice releases the sugars they contain, which can damage teeth. Even unsweetened fruit juice and smoothies are sugary, so limit these to a combined total of 150ml a day.\nDiluting 150ml of fruit juice with water (still or sparkling) can make it go further.\nRemember to keep fruit juice and smoothies to mealtimes to reduce the impact on teeth.\n\n\nDo potatoes count towards my 5 A Day?\n--------------------------------------\n\nNo. Potatoes are a starchy food and a great source of energy, fibre, B vitamins and potassium. \n\nIn the UK, we get a lot of our vitamin C from potatoes. Although they typically only contain around 11 to 16mg of vitamin C per 100g of potatoes, we generally eat a lot of them.\n\nWhen eaten as part of a meal, potatoes are generally used in place of other sources of starch, such as bread, pasta or rice. Because of this, they don''t count towards your 5 A Day.\n\nOther vegetables that don''t count towards your 5 A Day are yams, cassava and plantain. They''re also usually eaten as starchy foods.\n\nSweet potatoes, parsnips, swedes and turnips do count towards your 5 A Day because they''re usually eaten in addition to the starchy food part of the meal.\n\nPotatoes play an important role in your diet, even if they don''t count towards your 5 A Day. It''s best to eat them without any added salt or fat. \n\nThey''re also a good source of fibre, so leave the skins on where possible to keep in more of the fibre and vitamins.\n\nFor example, if you''re having boiled potatoes or a jacket potato, make sure you eat the skin, too.\n\n\n','\n',char(10)),'Source: https://www.nhs.uk/live-well/eat-well/5-a-day-what-counts/','16 Jul 2021','4',replace('QUESTION\n\nWhen is this article about?\n\nA. Healthy food\nB. Fire safety\n\n\nANSWER\n\nA.','\n',char(10))); DELETE FROM sqlite_sequence; -INSERT INTO sqlite_sequence VALUES('article',46); +INSERT INTO sqlite_sequence VALUES('article',48); COMMIT;