MIT surveyed nearly 20,000 professionals from around the world - 50% from North America, 21% from Europe, 19% from Asia, and the rest from Australia, South America, and Africa. Takeaways are …

1. Sort tasks by importance and act with a clear goal.

  • Before writing anything of any length, prepare an outline in a logical order to help you stay on track.
  • Revise your daily calendar the night before to emphasize your priorities. Next to each agenda on your schedule, write down your goals.
  • Send a detailed agenda to all participants before any meeting.
  • When embarking on a large project, sketch out preliminary conclusions as soon as possible.
  • Before reading any lengthy material, determine your specific purpose for it.

2. Dealing with information & task overload.

  • Skip most messages by looking at the subject and sender.
  • Make daily processes, like getting dressed or eating breakfast, a routine so you don’t spend time thinking about them.
  • Check your device’s screen every hour, rather than every few minutes.
  • Break large projects into sections and reward yourself when you complete each section.
  • Delegate tasks that don’t interfere with your top priorities, when feasible.
  • Set aside time in your daily schedule to deal with emergencies and unexpected events.

3. Your colleagues need short meetings, responsive communication, and clear direction.

  • Respond immediately to messages from those who are important to you.
  • To capture the audience’s attention, speak from some notes rather than reading a prepared text.
  • Limit any meeting to 90 minutes or less, but preferably less. At the end of each session, delineate the next steps and responsibilities for those steps.
  • To improve your team’s performance, establish procedures to prevent future mistakes instead of playing the blame game.
  • Establish clear goals and success metrics for any team effort.

Requirements

An online judge is primarily a place where you can execute code remotely for educational or recruitment purposes. In this design, we focus on designing an OJ for interview preparation like Leetcode, with the following requirements:

  • It should have core OJ functionalities like fetching a problem, submitting the solution, compiling if needed, and executing it.
  • It should be highly available with an async design, since running code may take time.
  • It should be horizontal scalable or, saying, easy to scale-out.
  • It should be robust and secure to execute untrusted source code.

Architecture

The architecture below is featured on queueing for async execution and sandboxing for secure execution. And each component is separately deployable and scalable.

designing online judge system

Components

Presentation Layer

The user agent is usually a web or mobile app like coderoma.com. It displays the problem description and provides the user with a code editor to write and submit code.

When the user submits the code, the client will get a token since it is an async call. Then the client polls the server for the submission status.

API

Please see Public API Choices for the protocols we can choose from. And let’s design the interface itself here and GraphQL for example:

type Query {
  problems(id: String): [Problem]
  languageSetup(id: String!, languageId: LanguageId!): LanguageSetup
  submission(token: String!) Submission
}

type Mutation {
  createSubmission(
    problemId: String!
    code: String!
    languageId: LanguageId!
  ): CreatedSubmission!
}

enum LanguageId {
  JAVA
  JS
  ELIXIR
  # ...
}


type Problem {
  id: String!
  title: String!
  description: String!
  supportedLanguages: [Float!]!
}

type LanguageSetup {
  languageId: LanguageId!
  template: String!
  solutions: [String!]!
}

type Status {
  id: Float!
  description: String!
}

type Submission {
  compileOutput: String
  memory: Float
  message: String
  status: Status
  stderr: String
  stdout: String
  time: String
  token: String
}

type CreatedSubmission {
  token: String!
}

The API layer records the submission in the database, publishes it into the queue, and returns a token for the client’s future reference.

Code Execution Engine

Code execution engine (CEE) polls the queue for the code, uses a sandbox to compile and run the code and parses the metadata from the compilation and execution.

The sandbox could be LXC containers, Docker, virtual machines, etc. We can choose Docker for its ease of deployment.

Coderoma.com

I am recently learning Elixir and creating an online judge coderoma.com for my daily practice. It now supports Elixir and JavaScript. And I am adding more languages (like Java) and problems to it.

We may host future events to improve your coding skills. Join us at https://t.me/hackers_at_coderoma for the English community or use your WeChat to scan the following QR onetptp and reply 刷题 for the Chinese community.

onetptp

What is PWA?

21655 2020-06-26 13:27

When Google came up with the PWA, it didn’t have a precise definition. It is not a specific technology, but a combination of techniques to improve the user experience. Those technologies are Web App Manifest, Service Worker, Web Push, etc.

The main features of PWA are as follows.

  • Reliability - instant loading, even in unstable or disconnected network environments.
  • User experience - rapid response, with smooth transition animations and feedback on user actions
  • Stickiness - like the Native App, can be added to the home screen and receive offline notifications.

PWA itself emphasizes Progressive (Progressive) in two perspectives.

  1. PWA is still evolving;
  2. PWA is downward-compatible and non-intrusive. It costs developers little to use the new features - developers can add it to the existing site progressively.

Google’s “Progressive Web App Checklist” defines those minimum requirements for PWA.

  • served over HTTPS.
  • Pages should be responsive on desktop, tablet, and mobile devices
  • All URLs have content to show in case of disconnection, not the default browser page
  • requires Web App Manifest to be added to the desktop
  • Faster page loading and shorter delay, even on 3G networks
  • It displays correctly in all major browsers
  • Smooth animation with immediate feedback
  • Each page has its own URL

Features of PWA

A PWA combines the benefits of both the Web App and Native App and gives us the following features.

  • Progressive - for all browsers, as it is developed with progressive enhancements in mind
  • Connectivity agnostic - Ability to leverage Service Worker for offline or low network connectivity.
  • Native experiences - on the App Shell model, they should have Native App interactions.
  • Continued updates – always up-to-date, no version or update issues.
  • Security - Served over HTTPS
  • Indexable - manifest files and Service Workers can be recognized and indexed by the search engine.
  • Stickiness - By pushing offline notifications, etc., you can get users back to your app.
  • Installable - users can easily add web apps to the home or desktop without going to an app store.
  • Linkable - share contents through links without downloading and installing them.

More specifically, what is the advantage of PWA over the native app? Openness and index-ability. Users can hardly install a native app instantly and search across native apps seamlessly.

The table below shows the comparison between t raditional Web App, Native App, and PWA for each feature.

Installable Linkable User experience User stickiness
Traditional Web
Native App 😐 ✅️
PWA

Why PWA?

21602 2020-06-26 13:27

PWA means Progressive Web Apps. Back in 2014, the W3C published a draft of Service Worker, and then in 2015, Chrome supported it in the production environment. If we take the emergence of Service Worker, one of PWA’s core technologies, as the start point of PWA, PWA’s birth year is 2015. Before focusing on what a PWA is, let’s first understand why we need it.

  1. User experience. Back to 2015, frontend developers spend a lot of time optimizing the web by speeding up the rendering of the initial page, making the animation smoother, etc. However, the native app still wins regarding the user experience.

  2. User retention. Native apps can be pinned onto the mobile phone’s home screen and bring the users back into the app by notifications, while the web apps cannot.

  3. Leveraging device APIs. Android and iOS provide abundant device APIs that native apps can easily use with the user’s permission. However, back then, the browser does not fully support them.

Google’s tutorial of Why Build Progressive Web Apps summarizes the problem as “Broad Reach, Low Engagement”.

UV and user duration comparison between web sites and native apps

To tackle the disadvantages of web apps in the mobile age, PWA comes into being.

How not to die?

42283 2020-05-06 16:19

Eating in the right way can significantly influence your health. Heard various advice from different sources, you may have difficulties to tell which one is the most helpful. The book “How Not to Die” provided eight practical suggestions backed up by scientific researches to help you establish a healthy diet.

Adopting a plant-based diet

The plant-based diet has been proven to have a much positive result on health than other foods we have in the US society. A China-Cornell-Oxford research project studied the menu of Chinese people in the 1980s. They found the Guizhou Province has the lowest mortality rate of coronary disease among men under 65, where people consumed the least animal-based food.

Additionally, plant-based diets can facilitate the patient’s recovery. Lifestyle-medical pioneers Nathan Pritikin and Dean Ornish put patients with advanced heart disease on plant-based diets, and then they witnessed significant improvements in alleviating their symptoms. For example, the harmful plaque in patients’ arteries dissolved faster than usual.

Having more fruits, especially berries

Four servings of fruit, including one type of berries, per day, is essential in a healthy diet. A single extra serving of fruit each day has proven to result in a 24-percent decline in the possibility of having Chronic Obstructive Pulmonary Disease. Notably, berries are particularly crucial due to their positive influence on liver function, cancer-resistance, and immune system. In 2014, a study taken among 14 patients revealed that their polyp load declined remarkably after nine months of having black raspberries.

Vegetables are indispensable

Vegetables play a vital role in preventing diseases. Known as “queen of greens”, kale can reduce people’s cholesterol levels. In a three-month study taken in 2008, high-cholesterol-level patients were asked to take three to four shots of kale juice every day. The proportion of beneficial cholesterol increased significantly, which was equal to the effect of running for 300 miles. Also, cruciferous vegetables help boost liver and lung functions.

Thus it is advised that two of the five daily servings should be leafy veggies (e.g., kale, arugula, and chard). Another two could be carrots, beets, or mushrooms. And finally, one serving of cruciferous vegetables like broccoli, cabbage, or cauliflower.

Recommending beans and whole grains for every meal

It is recommended by the American Institute for Cancer Research that beans or legumes should be included in every meal since they contain an animal-free protein as well as fibers. Navy and pinto beans can also be a good alternative to decrease bad cholesterol for people who don’t like soy much. They can also function in slowing down sugar absorption and relaxing stomach. Similar to beans, people should also take whole grains three times daily. In 2015, research found that people who involve whole grains in diets live longer.

Taking more nuts and seeds for better nutrition

The Global Burden of Disease Study conducted between 1990 and 2010 found that eating too few seeds and nuts were the third-leading dietary cause for death and disability all over the world. Even a single serving of brazil nuts is equivalent to statins medicine in lowering cholesterol levels. Nuts and seeds facilitate the detoxification of excess iron. They can also build up bone density. Among all the seeds, chia, hemp, pumpkin, sesame, and sunflower seeds are recommended. It is an excellent alternative to sauces and dressings of your daily meals.

Placing herbs and spices in food

Not only can herbs and spices add flavor to a dish, but they are also essential in preventing diseases, especially cancer. Among all the food groups, they have the highest levels of antioxidants. In a study taken in 2010, Alzheimer participants who took saffron received better cognitive function outcomes than those who had a placebo. Additionally, spices like cloves and cinnamon can reduce depression because of an enzyme inhibited in them.

It is worth mentioning that turmeric is proven to be the best in preventing cancers among all the herbs and spices. Due to the fact that turmeric disappears rapidly, having it with black pepper can slow down the process and help absorption. Curry powder is a decent choice since it usually contains both pepper and turmeric. However, turmeric isn’t for everybody. People with gallstones and kidney stones should restrict their intake.

Making water your first choice of beverages

Theoretically, a human should drink five 12-ounce beverages every day, and pure water is always the best choice. It is claimed by many articles that drinking eight glasses of water per day is a must, yet there is barely scientific evidence on that. Our daily intake of water comes from not only beverages but also fruits and vegetables.

In addition to water, coffee and tea can also be a good alternative since they are all good for health to some extent. For instance, research conducted by Tufts University revealed that tea functioned significantly in dropping blood pressure.

Download TianPan.co App

Learn startup engineering anywhere, anytime


Productscoderoma OJTouchBase CRMBeancount.io LedgerOneFx.JS Framework
Subscription RSS Github Email Linkedin Twitter