# HackerEarth

Blog about engineering and technology at HackerEarth.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Computing accurate skill percentile with DDSketch

DevFeed: [Computing accurate skill percentile with DDSketch](<https://devfeed.tech/articles/computing-accurate-skill-percentile-with-ddsketch-20019.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2023/09/17/building-a-relaible-global-benchmarking-platform/>)

Published: 2023-09-17T00:00:00Z

Content type: article

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [Algorithms](<https://devfeed.tech/topics/algorithms.md>), [Analytics Pipeline](<https://devfeed.tech/topics/analytics-pipeline.md>), [computational complexity](<https://devfeed.tech/topics/computational-complexity.md>), [Benchmark](<https://devfeed.tech/topics/benchmark.md>), [streaming data analytics](<https://devfeed.tech/topics/streaming-data-analytics.md>), [Data serialization](<https://devfeed.tech/topics/data-serialization.md>)

Tags: [algorithm](<https://devfeed.tech/tags/algorithm.md>), [algorithms](<https://devfeed.tech/tags/algorithms.md>), [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [background](<https://devfeed.tech/tags/background.md>), [batch](<https://devfeed.tech/tags/batch.md>), [benchmark](<https://devfeed.tech/tags/benchmark.md>), [benchmarking](<https://devfeed.tech/tags/benchmarking.md>), [data-ingestion](<https://devfeed.tech/tags/data-ingestion.md>), [data-pipeline](<https://devfeed.tech/tags/data-pipeline.md>), [data-structures](<https://devfeed.tech/tags/data-structures.md>), [ddsketch](<https://devfeed.tech/tags/ddsketch.md>), [probabilistic](<https://devfeed.tech/tags/probabilistic.md>), [quantile](<https://devfeed.tech/tags/quantile.md>), [real-time](<https://devfeed.tech/tags/real-time.md>), [sketch](<https://devfeed.tech/tags/sketch.md>), [skills](<https://devfeed.tech/tags/skills.md>), [t-digest](<https://devfeed.tech/tags/t-digest.md>), [time](<https://devfeed.tech/tags/time.md>)

### AI overview

HackerEarth moved candidate skill percentile benchmarking to an asynchronous pipeline using DDSketch to summarize large score sets and update thresholds near real time. Its POC found T-Digest more accurate (deviation under 0.2% versus DDSketch under about 0.6%), but much slower and larger: at 100,000 samples, sketch creation took 298.89 ms for DDSketch versus 7.243 seconds for T-Digest, and serialized sizes were 6,224 versus 22,049 bytes. Given the stated tolerance for deviation near 1% and the importance of speed and memory, HackerEarth chose DDSketch. The pipeline batches skill scores, builds and merges sketches, calculates thresholds, and stores results. The reported benchmarks used random POC samples; the article says the system supports asynchronous benchmarking for 1 million or more candidates.

### Source excerpt

Introduction HackerEarth has lots of candidates getting evaluated on a daily basis. We have a feature that benchmarks candidates across the platform. Benchmarking is the process of creating the profile of the ideal candidate for a position, and then measuring all candidates against that profile. To benchmark candidate skills against our millions of candidates, we decided to move away from our regular cron solution to build a more reliable and accurate data pipeline. To support this, we created a new data ingestion flow and data read flow. We moved away from our deterministic algorithms to probabilistic algorithms with DDSketch. Problem Our old benchmarking solution was trying to compute the global benchmarking of a candidate on the fly by calculating the solve percentage of the individual skills and returning the geometric mean of all the skill benchmarks. We handle huge volumes of data every day. Analyzing this data itself--for example, calculating a quantile was optimal in terms of resources. Solution We came up with a solution that computes an approximate quantile from a compressed representation of that data. We first need to appropriately summarize that data without incurring an excessive loss of fidelity. We do this by creating a sketch. Sketch algorithms generate sketches: smaller, more manageable data structures, from which we can calculate some properties of the original data. We considered various algorithms to accurately compute percentiles on noisy, large-scale, real-time data that we were receiving from candidates' skill scores. We considered using Tdigest and DDSketch. For our use case, DDSketch served the purpose.We did a POC and compared the accuracy of both the algorithms as shown below to come up with a finalized algorithm. POC results and observations We compared the actual percentile ranges in comparison to the two probabilistic approaches we mentioned(DDSketch and T-DIgest), and these were the results. Note: we have run these tests on the random

## Logging millions of requests reliably with our new data ingestion pipeline

DevFeed: [Logging millions of requests reliably with our new data ingestion pipeline](<https://devfeed.tech/articles/logging-millions-of-requests-reliably-with-our-new-data-ingestion-pipeline-20018.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2022/07/01/logging-millions-of-requests-reliably-with-our-new-data-ingestion-pipeline/>)

Published: 2022-07-01T00:00:00Z

Content type: article

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [Analytics Pipeline](<https://devfeed.tech/topics/analytics-pipeline.md>), [data-engineering](<https://devfeed.tech/topics/data-engineering.md>), [streaming data analytics](<https://devfeed.tech/topics/streaming-data-analytics.md>), [Web app](<https://devfeed.tech/topics/webapp.md>), [Amazon S3](<https://devfeed.tech/topics/amazon-s3.md>), [software-architecture](<https://devfeed.tech/topics/software-architecture.md>), [API Logging](<https://devfeed.tech/topics/api-logging.md>)

Tags: [amazon-kinesis](<https://devfeed.tech/tags/amazon-kinesis.md>), [analytics-pipeline](<https://devfeed.tech/tags/analytics-pipeline.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [compress](<https://devfeed.tech/tags/compress.md>), [cost](<https://devfeed.tech/tags/cost.md>), [data](<https://devfeed.tech/tags/data.md>), [data-ingestion](<https://devfeed.tech/tags/data-ingestion.md>), [data-ingestion-pipeline](<https://devfeed.tech/tags/data-ingestion-pipeline.md>), [database](<https://devfeed.tech/tags/database.md>), [flow](<https://devfeed.tech/tags/flow.md>), [http](<https://devfeed.tech/tags/http.md>), [https](<https://devfeed.tech/tags/https.md>), [kinesis](<https://devfeed.tech/tags/kinesis.md>), [logging](<https://devfeed.tech/tags/logging.md>), [managed](<https://devfeed.tech/tags/managed.md>), [minutes](<https://devfeed.tech/tags/minutes.md>), [operational](<https://devfeed.tech/tags/operational.md>), [overhead](<https://devfeed.tech/tags/overhead.md>), [pipeline](<https://devfeed.tech/tags/pipeline.md>), [query](<https://devfeed.tech/tags/query.md>)

### AI overview

HackerEarth replaced a complex, self-hosted request logging system with Amazon Kinesis Firehose delivery to Redshift, using retries to protect against intermittent component failures and reporting data availability within 10-15 minutes. As request volume grew, Redshift costs led the team to retain only 12 months there, reducing analyst access to historical logs. The article describes querying compressed hourly log files in S3 with serverless Athena instead. Athena's partition projection uses the S3 date-hour path, and queries must filter on the projected datehour column to limit scanned data and improve speed and cost. Athena workgroups can cancel queries that exceed scan limits; Athena also retains query results in S3 for 45 days, allowing eligible reruns to return stored results. The account presents these as ways to manage storage and query costs while accessing longer-term logs, but gives no quantified savings.

### Source excerpt

Introduction HackerEarth handles millions of requests every day. To understand the user access patterns, get the usage of any particular feature or a page, figure out the daily active users or users who have been active for the past 6 months, etc in near real time, it is important to stream that data from across different services and ingest it to the analytics pipeline reliably. Problem Our old request logging architecture was complex and has many moving components. There were a lot of operational overheads involved in maintaining and scaling each of those components independently to ensure that all the self-hosted components were up and running all the time. Architecture Solution Last year, we revamped the way we log our web requests. It was done mainly to increase the reliability in logging the HTTP/HTTPS request data from across web services and also to reduce the operational overheads and the infrastructure cost associated with it. The new flow is making use of Kinesis Firehose data streams to deliver the request data from our web servers to Redshift (the database that we use to log and query request data) reliably with much lower cost. Amazon Kinesis Firehose is a fully managed service that automatically scales to match the throughput of our incoming request log data and requires no ongoing administration. It also allows us to compress and encrypt the data before loading it, minimizing the amount of storage used at the destination with increased security and we only need to pay for the amount of data we transmit through the service. The new flow is a fully managed solution with almost no operational overhead. We tried to keep the flow simple and straightforward with less number of moving components. The request data is now guaranteed to appear in the Redshift table within 10-15 minutes from the point we received a request at our web server's end. There are retries configured between consecutive infra components in the new flow to make sure there are no message

## Building a reliable asynchronous job pipeline

DevFeed: [Building a reliable asynchronous job pipeline](<https://devfeed.tech/articles/building-a-reliable-asynchronous-job-pipeline-20017.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2022/06/17/building-a-reliable-asynchronous-job-pipeline/>)

Published: 2022-06-17T00:00:00Z

Content type: article

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [Amazon Simple Queue Service (SQS)](<https://devfeed.tech/topics/amazon-simple-queue-service-sqs.md>), [Publish-subscribe pattern](<https://devfeed.tech/topics/pubsub.md>), [Serverless](<https://devfeed.tech/topics/serverless.md>), [aws-sns](<https://devfeed.tech/topics/aws-sns.md>), [Web app](<https://devfeed.tech/topics/webapp.md>), [software-architecture](<https://devfeed.tech/topics/software-architecture.md>), [Apache Kafka](<https://devfeed.tech/topics/apache-kafka.md>), [RabbitMQ](<https://devfeed.tech/topics/rabbitmq.md>)

Tags: [architecture](<https://devfeed.tech/tags/architecture.md>), [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [aws](<https://devfeed.tech/tags/aws.md>), [aws-managed-services](<https://devfeed.tech/tags/aws-managed-services.md>), [guarantees](<https://devfeed.tech/tags/guarantees.md>), [infrastructure](<https://devfeed.tech/tags/infrastructure.md>), [job](<https://devfeed.tech/tags/job.md>), [kafka](<https://devfeed.tech/tags/kafka.md>), [library](<https://devfeed.tech/tags/library.md>), [performance](<https://devfeed.tech/tags/performance.md>), [pipeline](<https://devfeed.tech/tags/pipeline.md>), [queuing](<https://devfeed.tech/tags/queuing.md>), [s3](<https://devfeed.tech/tags/s3.md>), [scalability](<https://devfeed.tech/tags/scalability.md>), [security](<https://devfeed.tech/tags/security.md>), [self-hosted](<https://devfeed.tech/tags/self-hosted.md>), [serverless](<https://devfeed.tech/tags/serverless.md>)

### AI overview

HackerEarth built he-messenger to move background jobs from self-hosted RabbitMQ and Kafka to a serverless pipeline using AWS SQS, SNS, and S3, reducing infrastructure operations while adding reliability and security controls. Producers send messages directly to SQS for one-to-one delivery or through SNS to subscribed SQS queues for one-to-many delivery; large payloads are stored in S3. The library supports ordered delivery with five-minute duplicate rejection, routing-key filters, producer retries with exponential backoff, consumer processing timeouts, and dead-letter queues. Consumers use lifecycle hooks, health checks, and graceful shutdown; message retention is up to 14 days, with encryption at rest and in transit. Local development uses Localstack. The text notes a cost-driven choice to let producer configuration determine whether messages go to SNS or SQS, and that delay tolerance was not yet actively used.

### Source excerpt

Asynchronous background jobs can dramatically improve the performance and scalability of web applications by offloading resource-intensive and time consuming processing from the request-response cycle of an application. Last year, in an effort to make our asynchronous flows more reliable, secure, and scalable, we decided to move away from our self-hosted solution that was based on RabbitMQ and Kafka, to a fully-managed one. This was done mainly to reduce the operational overheads in managing and scaling the underlying infrastructure and also to improve our overall security posture. To support this flow, we created a new library called he-messenger that implements an end-to-end queuing solution for allowing different services or different components of the same service to communicate with each other asynchronously. This library is built on top of the SQS, SNS, and S3 - managed services provided by AWS. It is a fully serverless solution that ingests events from different services, buffers them, and then delivers those events to the subscribed services in a reliable way. It simplifies the otherwise laborious process of provisioning and scaling self-hosted infrastructure. Since its introduction, this library has become one of the critical pieces of our architecture powering a lot of different use-cases with a very high number of transactions There are many open-source libraries available in the market that use AWS managed services to support asynchronous background jobs. However, none of them offered an end-to-end solution and the kind of guarantees we needed. Therefore, we decided to implement our own custom library to support this flow. The purpose of this blog is to give you an overview of the internal and the code level details of the he-messenger library along with a sample reference architecture, supported flows, features,and benefits of this solution. Terminology Channel: An abstract communication layer responsible for passing messages between producers and consu

## How to set a React Component or dom element as a background image

DevFeed: [How to set a React Component or dom element as a background image](<https://devfeed.tech/articles/how-to-set-a-react-component-or-dom-element-as-a-background-image-20016.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2021/08/12/how-to-set-a-react-component-as-a-background-image/>)

Published: 2021-08-12T00:00:00Z

Content type: tutorial

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [React](<https://devfeed.tech/topics/react.md>)

Tags: [background](<https://devfeed.tech/tags/background.md>), [background-image](<https://devfeed.tech/tags/background-image.md>), [component](<https://devfeed.tech/tags/component.md>), [element](<https://devfeed.tech/tags/element.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [image](<https://devfeed.tech/tags/image.md>), [react](<https://devfeed.tech/tags/react.md>), [react-component](<https://devfeed.tech/tags/react-component.md>), [set](<https://devfeed.tech/tags/set.md>)

### AI overview

The excerpt describes placing a React component behind a textarea to make it appear as the textarea's background. Wrap both in a relatively positioned div, position the component absolutely at the top left, and place it behind the textarea with a negative z-index. Make the textarea background transparent so the component shows through. Because the overlay can interfere with editing, the excerpt says to set pointer-events: none; centering the component is optional. The excerpt ends during the CSS example, so it does not provide complete implementation details.

### Source excerpt

During my internship at HackerEarth, I faced an interesting problem. This blog is about that and how I solved it. Problem: To set a background image to the textarea element. My initial impression on seeing the design was that it would be easy. I thought it's a image but after exploring the code I came to know that it's not an image that we have to show as background instead, it's a React Component. So now what? To solve this problem we need to think from scratch. Solution: First, we will think about how to do it and then will implement it step by step. 1. Think From Scratch In this example, as you can see the content in the body element overlap the background-image. To solve this problem we just need to overlap the React Component with the textarea. 2. Implementation Create a textarea and React Component which we are going to use. The text area is to the left and to the right is the React Component which we are going to set as a background image in the textarea element. Steps: 1.Create a div which wrap textarea and React Component. Set the div position: relative and React Component position: absolute, top: 0 & left: 0. <div className="editor-container"> // position: relative <textarea className="editor"/> <BackGround /> // position: absolute; top: 0; left: 0; </div> 2.To overlap textarea on React component we need to set React Component z-index: -1. .bg-img { position: absolute; top: 0; left: 0; width: 250px; font-family: monospace; text-align: center; color: rgba(0, 0, 0, 0.29); z-index: -1; } As you can see we have a problem now. React Component is below the textarea and we are not able to see. 3.To solve the problem we need to make the textarea background transparent. But then if you click on the React Component you won't be able to edit the textarea. To solve this set pointer-events: none. .editor { height: 400px; width: 400px; background: rgba(0, 0, 0, 0); // background transparent } .bg-img { position: absolute; top: 0; left: 0; width: 250px; font-family: mono

## Zero to One and Beyond: HackerEarth's journey to Continuous Delivery

DevFeed: [Zero to One and Beyond: HackerEarth's journey to Continuous Delivery](<https://devfeed.tech/articles/zero-to-one-and-beyond-hackerearth-s-journey-to-continuous-delivery-20015.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2021/08/01/CI-CD-Journey/>)

Published: 2021-08-01T00:00:00Z

Content type: article

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [CI/CD](<https://devfeed.tech/topics/cicd.md>), [Continuous Delivery (CD)](<https://devfeed.tech/topics/continuous-delivery.md>), [Continuous Deployment (CD)](<https://devfeed.tech/topics/continuous-deployment.md>), [Continuous integration](<https://devfeed.tech/topics/continuous-integration.md>), [CI/CD Pipeline](<https://devfeed.tech/topics/ci-cd-pipeline.md>), [Jenkins](<https://devfeed.tech/topics/jenkins.md>), [dora metrics](<https://devfeed.tech/topics/dora-metrics.md>), [Pull Request](<https://devfeed.tech/topics/pull-request.md>)

Tags: [2019](<https://devfeed.tech/tags/2019.md>), [agile](<https://devfeed.tech/tags/agile.md>), [automated](<https://devfeed.tech/tags/automated.md>), [cadence](<https://devfeed.tech/tags/cadence.md>), [cd](<https://devfeed.tech/tags/cd.md>), [ci](<https://devfeed.tech/tags/ci.md>), [ci-cd](<https://devfeed.tech/tags/ci-cd.md>), [code](<https://devfeed.tech/tags/code.md>), [continuous-delivery](<https://devfeed.tech/tags/continuous-delivery.md>), [continuous-deployment](<https://devfeed.tech/tags/continuous-deployment.md>), [deployment](<https://devfeed.tech/tags/deployment.md>), [deployments](<https://devfeed.tech/tags/deployments.md>), [environment](<https://devfeed.tech/tags/environment.md>), [feedback](<https://devfeed.tech/tags/feedback.md>), [integration](<https://devfeed.tech/tags/integration.md>), [merge](<https://devfeed.tech/tags/merge.md>), [production](<https://devfeed.tech/tags/production.md>), [release](<https://devfeed.tech/tags/release.md>)

### AI overview

HackerEarth describes moving from frequent but failure-prone releases toward continuous delivery after finding its feedback arrived too late in the process. It assessed maturity across build, deploy, test and database practices, then adopted Jenkins pipelines for logical commit sets, pull request checks and repeatable builds; decoupled deployments with production-like lower environments and audit trails; and JIRA-linked releases, initially targeting one deployment per day. Candidate builds received automated unit and acceptance tests plus QA approval and performance benchmarking. The company reports deployment timelines fell about 70% and successful deployments reached 98%. It also expanded test coverage, tested database migrations in lower environments with approval checks, and versioned configuration and deployment assets, using Poetry, Docker and infrastructure-as-code practices. The authors frame further progress as a team and culture shift, with feature flags and ongoing measurement; they report reaching maturity level 2 and plan to track lead time, deployment frequency, recovery time and change failure percentage.

### Source excerpt

"Hey the deployment is broken again. Can you push this change again" "Hey, I merged my changes were merged in the morning. I still don't see them in production yet" "Argh, the static files are not updated. We have to run deployment again" These voices hollared across the hallway and this was followed by a huddle to sort things out. These voices soon grew louder and then we realised: Our Deployment is broken. Epilogue At HackerEarth, we have always been good at embracing bleeding edge technologies. We have always taken pride at doing what is right and acknowledge when something needs a fix. A faster delivery cadence and a quicker release cycle are very important for a startup of our scale. Our deployment related problems threatened our fundament need - "Pace" This prompted us to not just fix what was broken but to introduce a new paradigm to deployment - Continuous Deployment. The key tenets of following agile to push consistent smaller pieces of software frequently to customers and get Feedback. As any growing team, we were at one point struggling with - higher deployment failures or critical issues leaking to production. What followed was our path to redemption Circa 2019, HackerEarth was already doing frequent deployments. We had a process to collect, merge, tag and release code into production. But, this was not enough. As it must be obvious now, our feedback cycle was not close to the point of failure. The Integration happened closer to production and any failure is now expensive to fix. This is where our journey up the CI-CD ladder begun. You're doing continuous delivery when: Your software is deployable throughout its lifecycle Your team prioritises keeping the software deployable over working on new features Anybody can get fast, automated feedback on the production readiness of their systems any time somebody makes a change to them You can perform push-button deployments of any version of the software to any environment on demand" -- Martin Fowler When it all

## How I built my first search component in React

DevFeed: [How I built my first search component in React](<https://devfeed.tech/articles/how-i-built-my-first-search-component-in-react-20014.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2020/07/17/how-i-built-my-first-search-component/>)

Published: 2020-07-17T00:00:00Z

Content type: tutorial

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [React](<https://devfeed.tech/topics/react.md>), [software-development](<https://devfeed.tech/topics/software-development.md>), [Functional programming](<https://devfeed.tech/topics/functional-programming.md>), [User interface design](<https://devfeed.tech/topics/ui-design.md>)

Tags: [2016](<https://devfeed.tech/tags/2016.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [component](<https://devfeed.tech/tags/component.md>), [react](<https://devfeed.tech/tags/react.md>), [redux](<https://devfeed.tech/tags/redux.md>), [search](<https://devfeed.tech/tags/search.md>)

### AI overview

The 2016 React search component showed results as users typed, displaying NGOs, live projects and campaigns in a modal beneath the header; a cross icon cleared the input and hid the results. Its Redux flow sent the query through an action creator to fetch server results, with a service layer handling caching and server errors. The reducer updated the store with response data and a flag controlling the results modal, prompting subscribed views to rerender. The author notes that the code reflects older React patterns and invites readers to modernize it.

### Source excerpt

In 2016, I was working to build a platform to help NGOs raise donations. The platform was supposed to be built using React. The beautiful designs were in place. I was excited to build some new features as well as to try out the new architecture using Redux on a larger scale. Yes, this was the time when Redux was fairly new. React still had PropTypes package attached to its core. The lifecycle method componentWillReceiveProps used to dominate the scene. Out of the many design components that I worked while building that platform, I am going to discuss my first search component in React here. Elements of a search bar The search bar was a simple input field placed at the middle of the main header. The design idea was to have a search component which displays results as soon as the user inputs something in it. Then, to provide a simple cross icon at the right end of the input field to clear the inputs and hide the search results. The search results were supposed to appear inside a modal starting below the main header of the site. Below are the designs to help you visualise things better: If you typed on the search bar, a search results component appeared and showed NGOs, Live Projects and Campaigns. Development Redux Architecture While building apps using Redux architecture, one should be cognizant of its three principles (Single source of truth, State is read-only and Changes are made with pure functions). In computer programming, a pure function is a function that has the following properties: Its return value is the same for the same arguments Its evaluation has no side effects In our case, a single module (file) was created to include action types, reducers and action creators. The flow was - when the user inputs something in the search field, we will take that value and pass it through an action creator which will fetch the results from the server for the queried string and return an action type along with the result. There was also a service layer in the middle, w

## Hassle-free automated assessments

DevFeed: [Hassle-free automated assessments](<https://devfeed.tech/articles/hassle-free-automated-assessments-20013.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2020/02/02/hassle-free-automated-assessments/>)

Published: 2020-02-02T00:00:00Z

Content type: article

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [User interface design](<https://devfeed.tech/topics/ui-design.md>), [User Interfaces](<https://devfeed.tech/topics/user-interfaces.md>), [human centric design](<https://devfeed.tech/topics/human-centric-design.md>), [React](<https://devfeed.tech/topics/react.md>), [Front end](<https://devfeed.tech/topics/frontend.md>)

Tags: [algorithm](<https://devfeed.tech/tags/algorithm.md>), [automated](<https://devfeed.tech/tags/automated.md>), [complex](<https://devfeed.tech/tags/complex.md>), [css](<https://devfeed.tech/tags/css.md>), [customer](<https://devfeed.tech/tags/customer.md>), [enterprise](<https://devfeed.tech/tags/enterprise.md>), [front-end](<https://devfeed.tech/tags/front-end.md>), [generate](<https://devfeed.tech/tags/generate.md>), [java](<https://devfeed.tech/tags/java.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [react](<https://devfeed.tech/tags/react.md>), [recruiters](<https://devfeed.tech/tags/recruiters.md>), [skills](<https://devfeed.tech/tags/skills.md>), [sql](<https://devfeed.tech/tags/sql.md>), [talent-acquisition](<https://devfeed.tech/tags/talent-acquisition.md>), [test](<https://devfeed.tech/tags/test.md>), [time](<https://devfeed.tech/tags/time.md>), [types](<https://devfeed.tech/tags/types.md>)

### AI overview

The redesigned HackerEarth Assessments flow replaces role-based test generation with a stepwise, skill-based process aimed at enterprise recruiters with limited technical knowledge. Recruiters choose one or more skills and an experience range, then review a generated question summary and can edit or add question sets by skill, question type, difficulty, and count. The algorithm targets a 90-minute test, falling back to 75, 60, or 45 minutes when the question pool is insufficient; it does not generate tests under 45 minutes, and adding many skills can push duration beyond 90 minutes. The test name defaults to the first selected skill plus "Test" and is editable; experience cannot be changed on the summary screen. The redesign was intended to make test creation more flexible and support additional question types, addressing limits in the older profile-driven flow.

### Source excerpt

Our older test creation flow had several inherent problems associated with it: 1. Profile driven Earlier to this, we had test creation based on job profiles (role-based), which was restrictive as the skills were tightly coupled to the roles and were not customizable by the recruiters. For example, I could select a profile say front-end engineer and the questions generated will only be from HTML, CSS and Javascript. So, if a recruiter wanted to generate questions for a front-end engineer profile to test React skill, they had to add them manually from our questions library or theirs. 2. Complex UI The older interface was filled with unwanted form elements and had almost no provision to support newer question types. We somehow missed to provide a scalable and an intuitive step-by-step test creation flow that catered to the needs of our non-technical recruiters. 3. Rigid algorithm The algorithm we used for selecting the test questions was relatively rigid, so there was a limited scope in picking questions from a mix of skills and of varied difficulties, either from the HackerEarth's questions library or from the company's library or both. 4. Restricted question types Though there was a demand from our customers to include additional question types such as SQL, front-end project and Java project questions to the test creation flow, we could not accommodate them as the interface was already bloated. Your browser does not support the video tag. Design Based on the customer feedback and research data, it was important for us to improve the old flow in accord to the correct persona of our users. More focus was put on enterprise talent acquisition teams. We found out that in general scenario, such teams are bound by the following: Want - To hire good people with minimum effort and time Capabilities - Familiar with the technical terms and the skills needed for a role Limitations - Have low technical knowledge The new design was implemented keeping in mind all the requirements

## Profiling Django views with Scooby profiler

DevFeed: [Profiling Django views with Scooby profiler](<https://devfeed.tech/articles/profiling-django-views-with-scooby-profiler-20012.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2018/09/20/profiling-django-views-with-scooby/>)

Published: 2018-09-20T00:00:00Z

Content type: article

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [Django](<https://devfeed.tech/topics/django.md>), [Chrome extension](<https://devfeed.tech/topics/chrome-extension.md>), [debugging](<https://devfeed.tech/topics/debugging.md>), [Front end](<https://devfeed.tech/topics/frontend.md>), [Back end](<https://devfeed.tech/topics/backend.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [npm](<https://devfeed.tech/topics/npm.md>)

Tags: [ajax](<https://devfeed.tech/tags/ajax.md>), [ast](<https://devfeed.tech/tags/ast.md>), [backend](<https://devfeed.tech/tags/backend.md>), [chrome-extension](<https://devfeed.tech/tags/chrome-extension.md>), [django](<https://devfeed.tech/tags/django.md>), [framework](<https://devfeed.tech/tags/framework.md>), [front-end](<https://devfeed.tech/tags/front-end.md>), [hackathon](<https://devfeed.tech/tags/hackathon.md>), [header](<https://devfeed.tech/tags/header.md>), [html](<https://devfeed.tech/tags/html.md>), [http](<https://devfeed.tech/tags/http.md>), [idea](<https://devfeed.tech/tags/idea.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [memcache](<https://devfeed.tech/tags/memcache.md>), [middleware](<https://devfeed.tech/tags/middleware.md>), [npm](<https://devfeed.tech/tags/npm.md>), [package](<https://devfeed.tech/tags/package.md>), [profiling](<https://devfeed.tech/tags/profiling.md>), [python](<https://devfeed.tech/tags/python.md>), [queries](<https://devfeed.tech/tags/queries.md>)

### AI overview

Scooby was built to profile Django AJAX requests and avoid the development slowdown the author experienced when django-debug-toolbar rendered profiling data into HTML. Middleware gathers data through plugins, stores it temporarily in Redis under a UUID, and sends that UUID in an X-Scooby response header; a Chrome extension detects the header and fetches the data. The article describes plugins for SQL, Memcache, Thriftpy, and cProfiler, plus browser-side activation to avoid backend profiling overhead when the extension is unused. SQL results include query stack traces and grouping of similar queries to reveal counts and total time, which can help analyze N+1 problems. The author also describes a browser-visible logging helper and says the backend and extension were open-sourced.

### Source excerpt

Earlier in 2016, I came up with the idea of creating a Python module which could provide functionality of profiling functions w.r.t. SQL queries and tell exactly at what lines of function, the queries were happening. I called that package Goofy and created it with the engineering of Python AST manipulation. You can read the post on it here later. It helped us profiling views serving AJAX requests but it had some limitations too. E.g. we couldn't see the whole callstack trace of the queries and couldn't analyze the queries. In an internal hackathon @HackerEarth which happened in Nov 2017, I revisited this problem and tried to come up with a profiler, through which we could see the stats on front-end and which should be much lightweight and would work with AJAX requests. I named this package Scooby. Idea We have been using the package django-debug-toolbar, but it wasn't enough because it didn't have the functionality of profiling AJAX requests. And because of the size of our codebase, it had made serving web pages slower in develop mode because it injects the stats in HTML by rendering and rendering takes time. So we needed an alternative. The idea while creating the Scooby package was to have a similar type of package as of django-debug-toolbar but instead of rendering the stats to HTML, we can dump the stats data to some backend store e.g. Redis where it will reside temporarily. And show the stats on front-end using a chrome extension. Implementation We had to create a Python/Django package for backend and a npm package for front-end which would build the chrome-extension. We took the decision of using ReactJS as rendering framework for the chrome-extension. In backend, we just had to create and put a new middleware which will do the job of collecting profiled stats for different plugins (E.g. SQL, Memcache etc.) and put the stats to Redis against some UUID as key. We would put that key as value of a custom header (X-Scooby) in HTTP response, so that chrome-extensio

## What you see is what you get!

DevFeed: [What you see is what you get!](<https://devfeed.tech/articles/what-you-see-is-what-you-get-20011.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2018/07/19/what-you-see-is-what-you-get/>)

Published: 2018-07-19T00:00:00Z

Content type: tutorial

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [Tool](<https://devfeed.tech/topics/tool.md>), [Internationalization (i18n)](<https://devfeed.tech/topics/i18n.md>), [Open Source](<https://devfeed.tech/topics/open-source.md>)

Tags: [allows](<https://devfeed.tech/tags/allows.md>), [alternatives](<https://devfeed.tech/tags/alternatives.md>), [assessment](<https://devfeed.tech/tags/assessment.md>), [best](<https://devfeed.tech/tags/best.md>), [better](<https://devfeed.tech/tags/better.md>), [can](<https://devfeed.tech/tags/can.md>), [community](<https://devfeed.tech/tags/community.md>), [compare](<https://devfeed.tech/tags/compare.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [content](<https://devfeed.tech/tags/content.md>), [customers](<https://devfeed.tech/tags/customers.md>), [dashboard](<https://devfeed.tech/tags/dashboard.md>), [developer](<https://devfeed.tech/tags/developer.md>), [developers](<https://devfeed.tech/tags/developers.md>), [django](<https://devfeed.tech/tags/django.md>), [doing](<https://devfeed.tech/tags/doing.md>), [easy](<https://devfeed.tech/tags/easy.md>), [editor](<https://devfeed.tech/tags/editor.md>), [file](<https://devfeed.tech/tags/file.md>), [free](<https://devfeed.tech/tags/free.md>)

### AI overview

HackerEarth replaced Markdown editing in its Django recruiter dashboard with CKEditor 4 to make rich text authoring easier. The excerpt says CKEditor was chosen over TinyMCE for its developer community, modularity, and stronger support for languages, source editing, tables, and image and media handling. Integration used django-ckeditor with a selected toolbar and plugins, including MathJax, code snippets, image handling, media embeds, and table resizing; CKEditorUploadingWidget enabled file uploads. The team also added a language mapping for the editor UI and a custom S3 storage backend because query string authentication interfered with storing image URLs. To support existing content, a RegEx script converted LaTeX expressions in roughly 250,000 problems from `$$...$$` to the span and delimiters expected by the MathJax plugin; the post reports this took 15 minutes. The excerpt outlines these implementation steps but does not include the complete article.

### Source excerpt

Introduction HackerEarth has grown into a platform that serves a huge number of customers for technical assessment. To make this possible, we try our best to make the platform as easy-to-use as it can get. At several places in our Recruiter Dashboard, we used to have a Markdown editor to allow users to edit free text. There have been multiple times when many of our recruiters have struggled to create content using the Markdown editor. They need not to worry anymore. After many such requests to improve this, we came up with a fix. Say hello to CKEditor (version 4)--The well-known WYSIWYG, Rich Text editor. Why CKEditor? In the battle of the titans (of WYSIWYG editing) between CKEditor and TinyMCE, we decided to go with CKEditor because of the following reasons: It has a huge community of active developers. The strength of the community around an open source project is strongly related to the project's success. As compared to TinyMCE, it provides better support for the following: Multiple languages Source editing Tables Image and media handling etc. It was designed with modularity in mind which allows you to go much deeper if you're a developer. It is doing much better as compared to TinyMCE. One of the easy tricks while surveying software is to compare how alternatives are doing on Google and Stack Overflow trends. Google search comparison (past 5 years) Number of Stack Overflow questions asked Integration The integration of WYSIWYG editor across HackerEarth's Recruit platform is broadly divided into three steps: Adding the Django CKEditor package As the Recruiter dashboard is written entirely in Django, we decided to integrate CKEditor using the django-ckeditor package. CKEditor provides a huge list of out-of-the-box functionalities. Thinking from the perspective of recruiters and problem setters, we decided to opt for a few of them only. The Django CKEditor package reads the configuration from the settings.py file. Here is the snapshot of what the CKEditor configura

## Introducing Nuskha

DevFeed: [Introducing Nuskha](<https://devfeed.tech/articles/introducing-nuskha-20010.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2018/07/07/introducing-nuskha/>)

Published: 2018-07-07T00:00:00Z

Content type: article

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [Front end](<https://devfeed.tech/topics/frontend.md>), [React](<https://devfeed.tech/topics/react.md>), [CSS Framework](<https://devfeed.tech/topics/css-framework.md>), [Single-page application (SPA)](<https://devfeed.tech/topics/spa.md>), [Maintainability](<https://devfeed.tech/topics/maintainability.md>), [Web Development](<https://devfeed.tech/topics/web-development.md>), [designer developer handoff](<https://devfeed.tech/topics/designer-developer-handoff.md>), [User interface design](<https://devfeed.tech/topics/ui-design.md>), [Bootstrap](<https://devfeed.tech/topics/bootstrap.md>)

Tags: [2017](<https://devfeed.tech/tags/2017.md>), [better](<https://devfeed.tech/tags/better.md>), [bootstrap](<https://devfeed.tech/tags/bootstrap.md>), [buttons](<https://devfeed.tech/tags/buttons.md>), [code](<https://devfeed.tech/tags/code.md>), [consistency](<https://devfeed.tech/tags/consistency.md>), [css](<https://devfeed.tech/tags/css.md>), [development](<https://devfeed.tech/tags/development.md>), [dry](<https://devfeed.tech/tags/dry.md>), [fast](<https://devfeed.tech/tags/fast.md>), [faster](<https://devfeed.tech/tags/faster.md>), [framework](<https://devfeed.tech/tags/framework.md>), [hackathon](<https://devfeed.tech/tags/hackathon.md>), [history](<https://devfeed.tech/tags/history.md>), [important](<https://devfeed.tech/tags/important.md>), [interfaces](<https://devfeed.tech/tags/interfaces.md>), [layouts](<https://devfeed.tech/tags/layouts.md>), [project](<https://devfeed.tech/tags/project.md>), [react](<https://devfeed.tech/tags/react.md>), [software](<https://devfeed.tech/tags/software.md>)

### AI overview

Nuskha grew from HackerEarth's 2017 CSS pattern sheet into a React component reference app, built during an internal hackathon to reduce duplicated components and make design changes easier to maintain. The app documented shared components with usage examples, HTML and React code, and prop tables; it also provided a searchable catalog of 576 icons, matching icon names, characters, and synonym tags. The team used create-react-app, then ejected its configuration to enable Babel decorators and Stylus handling, and made the code editors read-only because time was limited and editable examples risked confusion. The article says Nuskha later gained a React search bar and JavaScript helper functions, with more components, utilities, and possible open sourcing listed as future scope.

### Source excerpt

History We at HackerEarth created a single-page document with common and special CSS classes to make layouts, grids, buttons, inputs, tables, tooltips, and form elements in late 2017. That was our first attempt to develop on our own front-end framework. Old Nuskha screens: Framework is a platform, foundation on which ready software solutions are built, in this particular case - web interfaces. For this purpose front-end framework consists of ready components, which are used by a developer when working on a project. What is more, aforementioned components, if necessary, can be modified or adjusted to current needs. - Merix Studio Our development was inspired from Bootstrap. But, we still had miles to go before calling it a framework. To be a part of something that will impact the whole organization was exciting for the bunch of us. After rejecting Kriya Kalaap, Kalakari, Retro, Tattva, Lipstick, and many more, we named our nascent framework Nuskha. "The name 'Nuskha' is inspired by one of the art deities "Nuska" from the Mesopotamian mythology. The word 'Nuskha' is a Hindi word which translates to 'formula' in English - a formula to create or build something." Old Nuskha helped but was still inefficient. We did not have any React components. We had started developing one of our products in React (version 16+) while the other product was in the transitioning phase. With strict deadlines for other important tasks, we were unable to contribute much to Nuskha and inevitably the implementation of the same components in different projects was duplicated. We needed a better framework to unify the components. We needed it for consistency, ease of use, and faster development. Yes, we also wanted to DRY up our code base. Fast forward to few months, as the tradition at HackerEarth goes, we had our internal hackathon scheduled. The timing was perfect. I paired up with Akanksha, another Frontend Engineer at HackerEarth, this time to build Nuskha 2.0 which will eventually be known

## Streaming Android applications via the browser

DevFeed: [Streaming Android applications via the browser](<https://devfeed.tech/articles/streaming-android-applications-via-the-browser-20009.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2017/04/03/streaming-android-apps-via-the-browser/>)

Published: 2017-04-03T00:00:00Z

Content type: article

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [virtual machines](<https://devfeed.tech/topics/virtual-machines.md>), [WebSocket](<https://devfeed.tech/topics/websocket.md>), [adb](<https://devfeed.tech/topics/adb.md>), [APK](<https://devfeed.tech/topics/apk.md>), [Android Studio](<https://devfeed.tech/topics/android-studio.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [apk](<https://devfeed.tech/tags/apk.md>), [applications](<https://devfeed.tech/tags/applications.md>), [browser](<https://devfeed.tech/tags/browser.md>), [emulator](<https://devfeed.tech/tags/emulator.md>), [streaming](<https://devfeed.tech/tags/streaming.md>)

### AI overview

Android submission reviews were manual because APKs need human assessment for requirement compliance, bugs, performance, appearance, and user experience. The proposed browser workflow provisions emulators and streams their displays through noVNC: Xvfb supplies a virtual display on headless Linux, x11vnc exports it, and websockify bridges VNC TCP traffic to WebSockets. Android emulators use custom AVDs, KVM acceleration on bare-metal hosts, and SwiftShader software rendering; ADB enables installs, launches, state checks, and instrumented tests. A Thrift service provisions emulator endpoints, while ZooKeeper supports routing across services. The described capacity is up to six emulators per server, with 16 GiB RAM, 8 CPUs, 256 GiB disk, and exposed hypervisor; software rendering adds CPU overhead. The excerpt presents this as an infrastructure approach to reduce local setup and manual handling, while retaining human scoring.

### Source excerpt

HackerEarth prides itself in its scalable & automated evaluation system. What was initially designed keeping standard programming problems in mind (check this post out), gradually evolved to accommodate a plethora of problem types across various tech domains. Currently supported Problem Types Programming Frontend Objective Android Subjective File based Multiplayer Approximate Golf Machine Learning SQL Regex File eval Map Reduce Note: Not all of the problem types are accessible by end users publicly. Some are reserved for HackerEarth's Recruit product. While most of them have their own evaluation stack and are automated in the complete sense of the word, evaluating submissions for some of these problem types requires partial manual intervention. Evaluation of Android submissions for instance, is not automated. Why though? An android submission is basically an apk. Given a requirement, the user has the freedom of designing and implementing an app in whatever way he/she deems fit. Given the nature of such submissions, it would be ill conceived to design an evaluation system in a one-size-fits-all manner. Hence the need for manual intervention. Evaluating Android Submissions Each submission is rated based on the following parameters: Requirement compliance Bugs Performance benchmarks Look and feel of the application User experience For a given hiring challenge, a dashboard containing all the submissions along with the candidate details is provided to the recruiter. The recruiter then follows each of these steps: Download a candidate's apk onto his/her local machine Install the apk onto a connected android device or emulator Test and interact with the app on a device or emulator Update score for the candidate in the dashboard Straight off, you can identify serious cons to this approach. Android Studio should be set up on your local machine(for a non-technical guy, this can be a daunting task in itself) Manually install & uninstall apps from an emulator/device Error-prone

## Monitoring and alert system using Graphite and Cabot

DevFeed: [Monitoring and alert system using Graphite and Cabot](<https://devfeed.tech/articles/monitoring-and-alert-system-using-graphite-and-cabot-20008.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2017/03/21/monitoring-and-alert-system-using-graphite-and-cabot/>)

Published: 2017-03-21T00:00:00Z

Content type: article

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [infrastructure monitoring](<https://devfeed.tech/topics/infrastructure-monitoring.md>), [Monitoring](<https://devfeed.tech/topics/monitoring.md>), [Grafana](<https://devfeed.tech/topics/grafana.md>), [Back end](<https://devfeed.tech/topics/backend.md>), [Amazon CloudWatch](<https://devfeed.tech/topics/amazon-cloudwatch.md>), [health check](<https://devfeed.tech/topics/health-check.md>)

Tags: [alert](<https://devfeed.tech/tags/alert.md>), [graphite](<https://devfeed.tech/tags/graphite.md>), [infrastructure](<https://devfeed.tech/tags/infrastructure.md>), [metrics](<https://devfeed.tech/tags/metrics.md>), [monitoring](<https://devfeed.tech/tags/monitoring.md>), [on-call](<https://devfeed.tech/tags/on-call.md>), [phone](<https://devfeed.tech/tags/phone.md>)

### AI overview

HackerEarth replaced cron email alerts and CloudWatch notifications with a metrics and alerting stack built around Graphite APIs and Cabot. Collectd gathers host and service metrics; carbon-relay-ng routes them to InfluxDB, a time-series store with Graphite ingestion; Grafana supplies dashboards, while graphite-api with InfluxGraph lets Cabot query metrics for periodic checks and alerts. The article says the traditional Carbon and SQL database setup could drop metrics under high load and render graphs slowly, motivating the Go-based relay and InfluxDB. It also notes that collectd's Graphite prefix must match a configured relay route or metrics are dropped, and Cabot uses Celery with Redis. After two months, the authors report stable operation collecting hundreds of metrics per minute and improved visibility into infrastructure load.

### Source excerpt

Introduction The infrastructure that powers a product and all of the services that it provides can be huge and complex because the product is scaled to serve millions of users. In most cases, each service might depend on various components for seamless functioning. With a product that houses a variety of features with critical infrastructure components and services powering these features, it becomes vital to monitor these components and services and keep them running at any cost. This monitoring system has to handle the following: Gathering data from all the components and services Storing the data efficiently and in an easily accessible manner Visualizing the data for faster comprehension Making sense of this data and relaying alerts to the respective owners of the services and components Managing the on call team and alerting them immediately At HackerEarth... Initially when we began facing problems because of some of our machines and services going down, we wrote ad hoc monitoring scripts that ran as crons to send email alerts. We also set up AWS Cloudwatch alarms to send notifications via email. There came a time when we had a very high number of components to be monitored and we realised that we were not getting enough insight into the load and usage of our machines. This is when we decided to put a system in place to collect data from these monitors and services. We also added a monitoring component to send alerts in more reliable ways (through phone calls) to the product owners and our on-call team, in case of any downtime. Components of this system This system consists of the following components that work together, Collection: Tool for collecting metrics from all the infrastructure components Forwarding: Tool for aggregating the metrics that are recieved from various machines and services and routing it to different storage backends Visualization: Tool for generating graphs and visualizing metrics APIs: Backend that provides APIs to query the metrics data fo

## Leveraging ReactJS in HackerEarth Assessment Environment

DevFeed: [Leveraging ReactJS in HackerEarth Assessment Environment](<https://devfeed.tech/articles/leveraging-reactjs-in-hackerearth-assessment-environment-20007.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2017/03/07/leveraging-reactjs-in-hackerearth-assessment-environment/>)

Published: 2017-03-07T00:00:00Z

Content type: article

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [User Interfaces](<https://devfeed.tech/topics/user-interfaces.md>), [performance-optimization](<https://devfeed.tech/topics/performance-optimization.md>), [User interface design](<https://devfeed.tech/topics/ui-design.md>), [Web Development](<https://devfeed.tech/topics/web-development.md>), [implementation](<https://devfeed.tech/topics/implementation.md>)

Tags: [ajax](<https://devfeed.tech/tags/ajax.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [assessment](<https://devfeed.tech/tags/assessment.md>), [editor](<https://devfeed.tech/tags/editor.md>), [environment](<https://devfeed.tech/tags/environment.md>), [reactjs](<https://devfeed.tech/tags/reactjs.md>)

### AI overview

HackerEarth used ReactJS to render question data from JSON on the client, allowing candidates to switch among questions without a fresh request for each one. The JSON for 30 questions was under 100 KB, while returning all question HTML would have exceeded 5 MB for just 10. Timed multiple-choice questions remained a special case: their descriptions were fetched on demand to avoid exposing them early, with each request returning JSON and updating a child component in under 200 ms. For the code editor, the team wrapped react-ace and kept a separate AceEditor instance per question, preserving code across switches and temporary Internet interruptions; editor render time fell from 4-5 seconds to about 300 ms. The approach increased DOM weight and still required an initial load of React and Ace vendor files. The article suggests vendor chunks by test type as a possible way to improve initial loading.

### Source excerpt

ReactJS, as the name suggests, helps create reactive (read interactive) UIs. If we have a UI with many interactive elements and on each interaction a bunch of elements change, ReactJS efficiently updates and renders the required elements. At HackerEarth, one such UI is the programming assessment environment. Programming assessment environment is one of the most critical products of HackerEarth. The mockup below is a broad idea of what it is composed of. The system in place Let's briefly understand the components in the mockup above. There are three major components: The left pane This is the primary navigational part of the interface. This controls which question is visible in the right pane. It enables candidates to switch between questions as per their convenience. The upper right pane This contains the detailed description of the question which is selected in the left pane. The lower right pane This is a medium for the candidate to submit answer to the question above. As of now, we are assuming that we have a programming question. So let's have a Code Editor here. Now, let's take a look at how things work in the current architecture. In the first HTTP response, we render all the questions in the left pane. There's no html in right pane. On selecting a question in left pane, an ajax call is made to fetch the data. The call returns a pre-rendered html of the entire question description, and it provides the candidate with a way to make further ajax calls to load the code editor. We won't get into the details of each part of the question description, however, for now, let's assume that it is composed of many smaller components. When the candidate is ready to attempt the question, another ajax call is made to render the code editor. We have extended ace editor and written a wrapper over it to fit in our requirements. One such requirement is to record every keystroke and create a frame for it. Later, we can play all those frames and see the entire code editing session

## WTF is MVP ?

DevFeed: [WTF is MVP ?](<https://devfeed.tech/articles/wtf-is-mvp-20006.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2016/11/17/wtf-is-mvp/>)

Published: 2016-11-17T00:00:00Z

Content type: tutorial

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [architecture-components](<https://devfeed.tech/topics/architecture-components.md>), [User Interfaces](<https://devfeed.tech/topics/user-interfaces.md>), [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [Maintainability](<https://devfeed.tech/topics/maintainability.md>), [Test-driven development](<https://devfeed.tech/topics/tdd.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [business-logic](<https://devfeed.tech/tags/business-logic.md>), [challenges](<https://devfeed.tech/tags/challenges.md>), [contracts](<https://devfeed.tech/tags/contracts.md>), [data](<https://devfeed.tech/tags/data.md>), [database](<https://devfeed.tech/tags/database.md>), [fragment](<https://devfeed.tech/tags/fragment.md>), [java](<https://devfeed.tech/tags/java.md>), [libraries](<https://devfeed.tech/tags/libraries.md>), [logic](<https://devfeed.tech/tags/logic.md>), [maintainability](<https://devfeed.tech/tags/maintainability.md>), [model](<https://devfeed.tech/tags/model.md>), [models](<https://devfeed.tech/tags/models.md>), [mvp](<https://devfeed.tech/tags/mvp.md>), [next](<https://devfeed.tech/tags/next.md>), [next-billion](<https://devfeed.tech/tags/next-billion.md>), [product](<https://devfeed.tech/tags/product.md>), [readability](<https://devfeed.tech/tags/readability.md>), [remote](<https://devfeed.tech/tags/remote.md>)

### AI overview

The article presents Android MVP as a way to separate UI, business logic, and data access for maintainability and testing. In its HackerEarth challenges example, a Fragment implements the View contract, while a Presenter handles user actions and requests data through a Repository. The Repository coordinates local and remote stores, persistence, and ContentProvider notifications, allowing the data source to change and supporting offline use. The article favors custom SQLite and data-access components over greenDAO or other DAO libraries to reduce APK size and dependencies. It also describes immutable table models and using onStart() to begin loading challenges.

### Source excerpt

If you are here searching for answers about Minimum Viable Product or you are here as a result of watching the first episode of the first season of Silicon Valley, this might not be the blog you are looking for. If you are a software engineer and you develop apps (especially on Android), this is a must read. Either way, you can share this blog among other software developers you know! :) Model-View-Presenter MVP stands for Model, View, Presenter. MVP is a way to abstract or decouple different components to make them independent of each other. This makes the codebase cleaner, improves readability, improves maintainability and also helps in rigorous testing. Model : Data access layer such as database API or remote server API. View : Layer that shows/displays data and reacts to user actions. This could be an Activity, Fragment, View or Dialog. This contains almost no logic. Converts presenters commands to UI actions and listens to user actions which are passed to the presenter. Presenter : Layer that provides View with the data from Model. Presenters essentially sits in between Models and Views. Why do we need MVP ? KISS : Stands for Keep It Simple, Stupid or Keep It Stupid Simple. Don't fight with the Views. Fight with business logic. Decouple : Helps in concentrating on the problem. Helps solving issues like configuration changes, background tasks, etc Most problems will be handled by the architecture itself and the app wouldn't need external libraries to handle specific issues. Rigorous testing : Helps in building testable apps by writing automation tests. How do we develop apps for the next billion users ? We start defining contracts for each layer. A contract is a class or an agreement. We define contracts for all the layers in the architecture - Model, View and Presenter. Let's take an example of showing the latest challenges on HackerEarth to users. ChallengesContract.java class defines two interfaces, one each for the View and the Presenter. The view specific f

## Sending emails to our half million and growing user community

DevFeed: [Sending emails to our half million and growing user community](<https://devfeed.tech/articles/sending-emails-to-our-half-million-and-growing-user-community-20005.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2016/02/11/sending-emails-to-our-half-million-and-growing-user-community/>)

Published: 2016-02-11T00:00:00Z

Content type: article

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [API](<https://devfeed.tech/topics/api.md>), [MongoDB](<https://devfeed.tech/topics/mongodb.md>), [MySQL](<https://devfeed.tech/topics/mysql.md>), [Django](<https://devfeed.tech/topics/django.md>), [HTML](<https://devfeed.tech/topics/html.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [asynchronous-architecture](<https://devfeed.tech/tags/asynchronous-architecture.md>), [database](<https://devfeed.tech/tags/database.md>), [infrastructure-monitoring](<https://devfeed.tech/tags/infrastructure-monitoring.md>), [mongodb](<https://devfeed.tech/tags/mongodb.md>), [mysql](<https://devfeed.tech/tags/mysql.md>), [queue](<https://devfeed.tech/tags/queue.md>), [rabbitmq](<https://devfeed.tech/tags/rabbitmq.md>), [sendgrid](<https://devfeed.tech/tags/sendgrid.md>)

### AI overview

HackerEarth describes an asynchronous email delivery architecture for sending large volumes of user notifications. Emails are serialized and stored, metadata is placed in RabbitMQ queues, and workers reconstruct and deliver messages through SendGrid, with priority queues used to reduce waiting time.

### Source excerpt

At hackerearth we send emails to keep our users updated on upcoming challenges and their activities, for example, when a user successfully solves a problem, receives test-invitation, updates on user comments. Basically whenever it is appropriate. Architecture It takes lot of computational power to send emails in such large quantities synchronously. So we have implemented an asynchronous architecture to send emails. Here is brief overview of the architecture: Step 1: Construct an email and save the serialized email object in database. Step 2: Queue the metadata for later consumption. Step 3: Consume the metadata, recreate the email object and deliver. The diagram below shows high level architecture of emailing system. The solid line represents the data flow between different components. The dotted line represents the communications. Hackerearth email infrastructure consists of MySQL database, MongoDB database, RabbitMQ queues. Journey Of Email Step 1 - Construct email: There are two different type of emails. Text - Plain text emails Html - Emails with rich interface using html elements. These emails are made using django templates API used by hackerearth developers for sending email - send_email(ctx, template, subject, from_email, html=False, async=True, **kwargs) The above API creates Sendgrid Mail object, serializes and saves it in the db with some additional data. A piece of code similar to the bit shown below is used to create sendgrid Mail object import sendgrid sg = sendgrid.SendGridClient('YOUR_SENDGRID_API_KEY') message = sendgrid.Mail() message.add_to('John Doe <john@email.com>') message.set_subject('Example') message.set_html('Body') message.set_text('Body') message.set_from('Doe John <doe@email.com>') status, msg = sg.send(message) Model below is used for storing the serialized mail object and additional data. class Message(): # The actual data - a pickled sendgrid.Mail object message_data = models.TextField() when_added = models.DateTimeField(default=date

## Analyzing submissions in real time for social media updates

DevFeed: [Analyzing submissions in real time for social media updates](<https://devfeed.tech/articles/analyzing-submissions-in-real-time-for-social-media-updates-20003.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2016/02/02/analyzing-submissions-realtime-for-social-media-updates/>)

Published: 2016-02-02T00:00:00Z

Content type: article

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [X (Twitter)](<https://devfeed.tech/topics/twitter.md>), [Apache Kafka](<https://devfeed.tech/topics/apache-kafka.md>), [Event-Streaming](<https://devfeed.tech/topics/event-streaming.md>), [Stateful](<https://devfeed.tech/topics/stateful.md>), [valkey](<https://devfeed.tech/topics/valkey.md>), [Programming](<https://devfeed.tech/topics/programming.md>)

Tags: [2015](<https://devfeed.tech/tags/2015.md>), [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [automate](<https://devfeed.tech/tags/automate.md>), [kafka](<https://devfeed.tech/tags/kafka.md>), [leaderboard](<https://devfeed.tech/tags/leaderboard.md>), [marketing](<https://devfeed.tech/tags/marketing.md>), [memcached](<https://devfeed.tech/tags/memcached.md>), [real-time](<https://devfeed.tech/tags/real-time.md>), [redis](<https://devfeed.tech/tags/redis.md>), [social-media](<https://devfeed.tech/tags/social-media.md>)

### AI overview

HackerEarth automated Twitter updates while avoiding extra peak-hour reads against its large submissions table. An asynchronous worker receives submission and event IDs through Kafka, counts submissions in Redis, and queries the database to post updates at selected counts (1, 100, 500, and each 1,000). The article chose Redis over Memcached for persistence after node failure, which helps prevent duplicate first-accepted-submission tweets; expiring keys and limiting keys per event were used to reduce Redis load. A cron job handles event reminders, and queued tweet payloads are delayed and spaced out when many challenges overlap. The supplied text does not specify how the delayed queue is implemented.

### Source excerpt

Objective In Jan 2015, HackerEarth conducted nearly 10-12 hiring challenges, 5-6 coding challenges and numerous college challenges. HackerEarth has a decent social media presence and we wanted to inform our followers about the events at HackerEarth. One of the main objectives of this project was to provide flexibility to the marketing team to automate simple jobs and to focus on sophisticated campaigns. Design Goals As a first step, we decided to post about our events and their highlights on twitter. We covered event reminders, start/end of contests, who scored first AC and leaderboard updates at the end of a contest. We chose to do it by reading from the biggest and the meanest table of our database of Submissions. Challenges The submissions table is a very large table. An additional query on the submissions table during peak hours was not favourable. Hence, we did not count the submissions in-place and instead queued them to be processed later. Preventing duplicate tweets while maintaining state is also a challenge. Solution The application made a high volume of reads, few writes/updates. So any key/value stored would do the job. We chose Redis in lieu of Memcached. Redis offers data persistence in the event of node failure. This is very useful to avoid duplicate tweets. For instance, Two different users being credited for first AC submission in an event. By setting key expiry time and less number of keys for a single event, we prevented our Redis server from being overloaded. We maintained a key in Redis to keep count of submissions for an event. Reading from the database was not recommended because it would make a read call per submission during peak time and Redis performed faster reads. The application is an asynchronous worker and payload containing submission_id and event_id are passed to it using Kafka. So when the Redis key counter hit the magic numbers (1, 100, 500, multiples of 1000), The worker makes a DB query and posts a tweet. Worker subscribes to a

## Beautiful Math Symbols

DevFeed: [Beautiful Math Symbols](<https://devfeed.tech/articles/beautiful-math-symbols-20004.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2016/02/02/latex-support-using-MathJax/>)

Published: 2016-02-02T00:00:00Z

Content type: article

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [Mathematics](<https://devfeed.tech/topics/mathematics.md>), [LaTeX](<https://devfeed.tech/topics/latex.md>), [Ajax](<https://devfeed.tech/topics/ajax.md>), [hooks](<https://devfeed.tech/topics/hooks.md>)

Tags: [ajax](<https://devfeed.tech/tags/ajax.md>), [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [browser](<https://devfeed.tech/tags/browser.md>), [editor](<https://devfeed.tech/tags/editor.md>), [hooks](<https://devfeed.tech/tags/hooks.md>), [latex](<https://devfeed.tech/tags/latex.md>), [math](<https://devfeed.tech/tags/math.md>), [mathjax](<https://devfeed.tech/tags/mathjax.md>), [rendering](<https://devfeed.tech/tags/rendering.md>), [symbols](<https://devfeed.tech/tags/symbols.md>)

### AI overview

HackerEarth made Latex rendering broadly reusable by handling MathJax according to three browser rendering paths. For Pagedown editor previews, a hook runs after Markdown processing and queues the processed content for MathJax typesetting, which works asynchronously. For static page content, the article says to typeset after the page loads. For Ajax updates, it queues only the modified divs after they receive new content, avoiding repeated whole-page typesetting that the article describes as inefficient and sometimes error-prone. The supplied text does not include the full implementation details or code for the static and Ajax cases.

### Source excerpt

Introduction: By nature HackerEarth has so many programming puzzles. These puzzles bound to have mathematical equations, statements and symbols. Problem Setters often requested us to add support for Latex. Implementation: The obvious and easy solution for this is to implement Latex support for individual pages. But that's not scalable and maintainable. Then we came with up with a solution where we didn't have to write custom code for every page. We examined the site and figured out three type of rendering that happens in the browser. Before going to solutions case by case, let's first understand how MathJax, the library we use for typesetting Latex, works. Everything in MathJax works asynchronously. After initializing MathJax, it executes a set of tasks and then typesets the queued content. Everything in MathJax works asynchronously using queues. Mathjax docs explains it in detail. Types of rendering: Rendering of preview section in editor Static content rendering (synchronous) Rendering of dynamic content via Ajax (Asynchronous) Read through rest of the article for this categorization to make sense. Editor: We use pagedown editor throughout our site. It has a preview section which displays the converted markdown content. Now this should also display typesetted Latex content. Pagedown editor has feature called hooks. This is a mechanism for plugging external text processors in between various steps of markdown processing. We have written a hook for typesetting Latex macros. This is chained to the hooks at the end, after all the markdown processing is completed. This hook takes markdown processed content as input and spits out Latex typesetted content. function renderLatex(text) { var invisible_div = document.createElement("div"); invisible_div.style.cssText = "display:hidden"; attr = document.createAttribute("id"); attr.value = "mathjax_text"; invisible_div.setAttributeNode(attr); invisible_div.innerHTML = text; document.body.appendChild(invisible_div); elem = docum

## Profiling django views for SQL queries

DevFeed: [Profiling django views for SQL queries](<https://devfeed.tech/articles/profiling-django-views-for-sql-queries-20002.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2016/02/01/profiling-django-views/>)

Published: 2016-02-01T00:00:00Z

Content type: article

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [Django](<https://devfeed.tech/topics/django.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [Tool](<https://devfeed.tech/topics/tool.md>)

Tags: [2015](<https://devfeed.tech/tags/2015.md>), [ast](<https://devfeed.tech/tags/ast.md>), [django](<https://devfeed.tech/tags/django.md>), [hackathon](<https://devfeed.tech/tags/hackathon.md>), [profiling](<https://devfeed.tech/tags/profiling.md>), [queries](<https://devfeed.tech/tags/queries.md>), [sql](<https://devfeed.tech/tags/sql.md>)

### AI overview

The article describes a Django profiler that uses Python AST transformation to identify which expressions inside a view trigger SQL queries. It wraps function calls, attribute access and other constructs with handlers, then patches Django's SQL execution method to record queries and timings. Its output associates query counts and time with source locations, including calls and attribute accesses. The author contrasts this with django-toolbar, which displays raw queries and tracebacks but leaves developers to determine the responsible expression. The excerpt also notes that the approach was extended to profile memcached queries; it does not provide enough detail to assess that implementation or the profiler's limitations.

### Source excerpt

We at HackerEarth regularly conduct 24-hours internal hackathons usually once a month to boost ourselves to get familiar with new technologies and to come up with great ideas and hacks to increase our productivity. A hackathon project can be anything from creating a new product to creating some tools which helps our own devlopment. In the hakathon in Dec 2015, I came up with the idea to create a profiler which could tell which code inside django views causes SQL queries so that we can optimize them easily. Initial thoughts There are already many good django packages to profile views for SQL queries. One of them is django-toolbar which we already use. Django-toolbar is great but it shows all raw SQL queries which are happening inside a view and you have to analyze each query, see the whole traceback and figure out which line of code inside the view is triggering the query. This way, you can only figure out the line number of the code in a file, not the exact function or expression or attribute access which is causing the query. What I wanted was that a profiler should tell about the exact expressions which trigger the SQL queries. There were some solutions which came up in my mind to get it done like using tracebacks or by manipulating AST of the python function. Praveen had just told me about the python's ast module which can parse and modify code during runtime and I was fascinated about using it in future. I chose to use AST manipulation to implement the profiler and the trick here is to patch every function call, attribute access and other constructs. Here is what I thought: Suppose there is a function f which internally calls get_user triggering a SQL query @profile def f(request): ... user = get_user(request) ... and decorating the function f with profile decorator will manipulate its AST code. It will find all locations of function calls inside function body and will encapsulate it in our special function call_handler. So the function f's definition will becom

## Smart suggestions with Django, Elasticsearch and Haystack

DevFeed: [Smart suggestions with Django, Elasticsearch and Haystack](<https://devfeed.tech/articles/smart-suggestions-with-django-elasticsearch-and-haystack-20001.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2016/01/29/smart-sugesstions-with-elasticsearch/>)

Published: 2016-01-29T00:00:00Z

Content type: tutorial

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [elasticsearch](<https://devfeed.tech/topics/elasticsearch.md>), [Django](<https://devfeed.tech/topics/django.md>), [data](<https://devfeed.tech/topics/data.md>), [Latency](<https://devfeed.tech/topics/latency.md>), [tokenizers](<https://devfeed.tech/topics/tokenizers.md>), [Server](<https://devfeed.tech/topics/server.md>)

Tags: [data](<https://devfeed.tech/tags/data.md>), [django](<https://devfeed.tech/tags/django.md>), [elasticsearch](<https://devfeed.tech/tags/elasticsearch.md>), [latency](<https://devfeed.tech/tags/latency.md>), [mapping](<https://devfeed.tech/tags/mapping.md>), [search](<https://devfeed.tech/tags/search.md>), [tokenizers](<https://devfeed.tech/tags/tokenizers.md>)

### AI overview

This tutorial explains how HackerEarth uses Django, Elasticsearch, and Haystack to provide smart suggestions over large collections of user data. It introduces inverted indexes, discusses the trade-off between search relevance and latency, and describes how Elasticsearch analyzers, tokenizers, token filters, character filters, and field mappings can be configured for effective search.

### Source excerpt

Introduction One of the primary issues when gathering information from users is suggesting the right options that they are looking for. At HackerEarth, we gather information from all our developers which help us provide them a better experience. So there came a time when we had to suggest very smartly to our users! :D When humongous amounts of data has to be indexed and suggested intelligently, one of the efficient ways to do it is by using an inverted index. An inverted index basically is a map of words that appear in documents to a list of documents the word is found in. Popular Lucene based search servers like Elasticsearch and Solr are tools to maintain large inverted indexes and provide an efficient means to look up documents. Here is an example from the profiles page on HackerEarth. We use Elasticsearch to index millions of documents with various fields. Two hurdles to be crossed while solving this problem are latency and relevance. Relevent documents have to be suggested to the user while keeping the time taken to retrieve them (ie. latency) as low as possible. Elasticsearch uses analyzers that help in achieving good relevence, but only if used in a witty manner. It also allows us to build our own custom analyzers. So by assaying the user input, astute analyzers can be built to increase relevance. A simple example for a document can be something like, { '_id' : 'AVJUN6QaLYvICHZxvYEq', 'username': 'ksrvtsa', 'location': 'Bangalore', 'hobbies': ['music', 'reading', 'hiking'], } So what are analyzers? An analyzer converts the text to be indexed and creates lookups for finding the text when needed using appropriate search terms. An analyzer is composed of a tokenizer that splits your text into multiple tokens which is followed by many token filters which modify, delete or add new tokens. The tokenizer can be preceded by character filters which modify the text before passing it to the tokenizer. Every field in a document has an index analyzer and a search analyzer

## A/B testing using Django

DevFeed: [A/B testing using Django](<https://devfeed.tech/articles/a-b-testing-using-django-19998.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2016/01/29/ab-testing-using-django/>)

Published: 2016-01-29T00:00:00Z

Content type: tutorial

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [A/B Testing](<https://devfeed.tech/topics/a-b-testing.md>), [Django](<https://devfeed.tech/topics/django.md>), [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [product analytics](<https://devfeed.tech/topics/product-analytics.md>)

Tags: [a-b-testing](<https://devfeed.tech/tags/a-b-testing.md>), [account](<https://devfeed.tech/tags/account.md>), [actions](<https://devfeed.tech/tags/actions.md>), [all](<https://devfeed.tech/tags/all.md>), [analytics](<https://devfeed.tech/tags/analytics.md>), [basics](<https://devfeed.tech/tags/basics.md>), [beer](<https://devfeed.tech/tags/beer.md>), [better](<https://devfeed.tech/tags/better.md>), [can](<https://devfeed.tech/tags/can.md>), [code](<https://devfeed.tech/tags/code.md>), [critical](<https://devfeed.tech/tags/critical.md>), [data](<https://devfeed.tech/tags/data.md>), [django](<https://devfeed.tech/tags/django.md>), [effectiveness](<https://devfeed.tech/tags/effectiveness.md>), [fallback](<https://devfeed.tech/tags/fallback.md>), [first](<https://devfeed.tech/tags/first.md>), [framework](<https://devfeed.tech/tags/framework.md>), [getting](<https://devfeed.tech/tags/getting.md>), [testing](<https://devfeed.tech/tags/testing.md>), [using](<https://devfeed.tech/tags/using.md>)

### AI overview

HackerEarth's Django framework assigns logged-in users to numbered buckets and routes each bucket to a configured view; a fallback view is used when anonymous visitors are excluded. To keep anonymous visitors on the same variant, the approach uses a unique cookie and Redis to retrieve or store a randomly selected view. A view decorator handles routing, while a similar decorator can select templates for a shared view. The configuration can be extended to A/A/B or other multi-variant tests, and the post uses Mixpanel JavaScript tracking for user behavior, while noting other analytics tools could be used. The excerpt describes the routing and analytics approach but does not provide the full template decorator or analytics implementation.

### Source excerpt

Whenever we roll out an improvement on our platform, we at HackerEarth love to conduct A/B tests on the improvement to understand which iteration helps our users more in using the platform in a better way. Since the available third party libraries did not quite meet our needs, we wrote our own A/B testing framework in Django. In this post we will share a few insights as to how we accomplished this. The basics A lot of products, especially on web, use a method called A/B testing or split testing to quantify how well a new page or layout performs as compared to the old one. The crux of the method is to show layout 'A' to a certain set or bucket of users and layout 'B' to another set of users. The next step is to track user actions leading to certain milestones, which would provide critical data regarding the 'effectiveness' of both the pages or layouts. Before we began writing code for the framework, we made a list of all the things that we wanted the framework to do - Route users to multiple views (with different templates) Route users to a single view with different templates Make the views/templates stick for users A/B test visitors who do not have an account on HackerEarth (anonymous users) Sticky views/templates for anonymous users as well Support for A/A/B or A/B/C/D..../n/ testing (just for the heck of it!) Analytics We went out to grab some pizza and beer, and when we got back we came up with this wire-frame - A/B for Views A/B for Templates Getting the logic right To begin with, we had to categorize our users into buckets. So all our users were assigned a bucket number ranging from 1 to 120. This numbering is not strict and the range can be arbitrary or as per your needs. Next, we defined two constants - the first one specifies which view a user is routed to, and the second one specifies the fallback or primary view. The tuples in the first constant are the bucket numbers assigned to users. The primary view in the second constant will be used when we do not wan

## Managing roles and access control in a web application

DevFeed: [Managing roles and access control in a web application](<https://devfeed.tech/articles/managing-roles-and-access-control-in-a-web-application-20000.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2016/01/29/managing-roles-and-access-control/>)

Published: 2016-01-29T00:00:00Z

Content type: tutorial

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [rbac](<https://devfeed.tech/topics/rbac.md>), [Access Control](<https://devfeed.tech/topics/access-control.md>), [Authorization](<https://devfeed.tech/topics/authorization.md>), [Web app](<https://devfeed.tech/topics/webapp.md>), [Security](<https://devfeed.tech/topics/security.md>), [Network](<https://devfeed.tech/topics/network.md>), [Back end](<https://devfeed.tech/topics/backend.md>)

Tags: [access-control](<https://devfeed.tech/tags/access-control.md>), [django](<https://devfeed.tech/tags/django.md>), [python](<https://devfeed.tech/tags/python.md>), [recruitment](<https://devfeed.tech/tags/recruitment.md>), [roles](<https://devfeed.tech/tags/roles.md>)

### AI overview

HackerEarth Recruit's excerpt describes role-based access control for company admins, using an ACL to map named roles to features. A SuperAdmin receives all roles; other admins receive their assigned roles. A view decorator checks permissions before processing a request and raises 404 when access is denied. A Django context processor exposes role flags to templates so menus and page content can be customized without repeating that setup in each view. The excerpt notes that access should be evaluated against feature sensitivity, but does not provide the template example or discuss testing and other limitations.

### Source excerpt

HackerEarth Recruit, is a platform for technical recruitment. Many companies use this platform for candidate assessments and interviewing. There can be multiple admins for a company account. As teams grow in size, access control is a special concern for applications that deal with financial and privacy data. Access control is concerned with determining the allowed activities of legitimate users, but we required more sophisticated and complex control mediating every attempt by a user to access a resource in the application based on the sensitivity level of various features. A state of access control is said to be safe if no permission can be leaked to an unauthorized or uninvited principal. We figured that the simpliest solution to restrict access was to use ACL. What is ACL ? An access control list (ACL), with respect to a computer file system, is a list of permissions attached to an object. An ACL specifies which users or system processes are granted access to objects, as well as what operations are allowed on given objects. Many kinds of systems implement ACL, or have a historical implementation like Filesystem ACLs and Networking ACLs. A filesystem ACL is a data structure (usually a table) containing entries that specify individual user or group rights to specific system objects such as programs, processes, or files. In Networking ACL refers to rules that are applied to port numbers or IP addresses that are available on a host or other layer 3, each with a list of hosts and/or networks permitted to use the service. For Recruit, the approach had to be role based access restriction to authorized admins. This implementation of access control mechanism is defined around roles and privileges. Implementation (Python/Django) Access control Lists can be configured to map roles to features. In this ACL implementation, roles are named after existing features which require access control. Each access right should have a unique name, and also assign a unique value to each. T

## Logging Javascript errors in production

DevFeed: [Logging Javascript errors in production](<https://devfeed.tech/articles/logging-javascript-errors-in-production-19999.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2016/01/29/hackerearth-logging-javascript-errors-production/>)

Published: 2016-01-29T00:00:00Z

Content type: tutorial

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [Frontend observability](<https://devfeed.tech/topics/frontend-observability.md>), [Cross-origin resource sharing (CORS)](<https://devfeed.tech/topics/cors.md>), [Logging](<https://devfeed.tech/topics/logging.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [browser](<https://devfeed.tech/topics/browser.md>)

Tags: [aws](<https://devfeed.tech/tags/aws.md>), [aws-s3](<https://devfeed.tech/tags/aws-s3.md>), [cors](<https://devfeed.tech/tags/cors.md>), [errors](<https://devfeed.tech/tags/errors.md>), [fastly](<https://devfeed.tech/tags/fastly.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [logging](<https://devfeed.tech/tags/logging.md>), [production](<https://devfeed.tech/tags/production.md>)

### AI overview

The article reports that Errorception could not capture useful stack traces for JavaScript served from S3 through Fastly because the cross-origin scripts lacked CORS headers. The authors enabled CORS on the S3 bucket with a GET rule and on Fastly with an Access-Control-Allow-Origin header, added crossorigin="anonymous" to script tags, and changed JavaScript asset versions to clear caches. They describe checking the resulting headers with curl. The supplied text presents this as their implementation experience; it does not establish whether the configuration is suitable for other setups.

### Source excerpt

We had implemented a javascript logger to capture the pesky issues our users faced and had problems when using the site. When we came up with the idea, we thought it would be just a five minute job where we would just have to add a snippet and would be done, but as it is well know, nothing is simple when it comes to real world production issues. After analyzing a lot of loggers, we decided to use errorception as our javascript logger. It was simple in its approach and it provided the data we needed. This was the easy part, next came the part of integration, and yes there was a snippet which we just had to paste in our base javascript file, but one thing we had forgotten, CORS. We host our static files on S3 and they are served via fastly, because of which they are delivered through another domain. The error tracking snippet could not log the errors because 'window.onerror' would not return the necessary stack trace and information. Many of you may have heard about CORS, it is a mechanism that allows restricted resources (e.g. fonts) on a web page to be requested from another domain outside the domain from which the resource originated. For security reasons, browsers restrict cross-origin HTTP requests initiated from within scripts. The only way to solve this and get errors to be posted to errorception was to allow CORS in the header of the static files. After some research (errorception also has a good blog on it), we finally managed to have the error logging implemented. Below are the steps we had to go through: Configuring S3 S3 has this unnecessarily complicated "CORS configuration" that you need to create. Here's the steps to get that right: Log into your AWS S3 console, select your bucket, and select "Properties". S3 CORS configurations seem to apply at the level of the bucket, and not the file. I have no clue why. Expand the "Permissions" pane, and click on "Add CORS configuration" or "Edit CORS configuration" depending on what you see. You should already be p

## HackerEarth Question Library: Stats, Usage Analysis and Health

DevFeed: [HackerEarth Question Library: Stats, Usage Analysis and Health](<https://devfeed.tech/articles/hackerearth-question-library-stats-usage-analysis-and-health-19997.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2015/10/31/hackerearth-question-library-data-analysis-and-health/>)

Published: 2015-10-31T00:00:00Z

Content type: article

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [Data analysis](<https://devfeed.tech/topics/data-analysis.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [User interface design](<https://devfeed.tech/topics/ui-design.md>), [Data pipelines](<https://devfeed.tech/topics/data-pipelines.md>)

Tags: [analytics](<https://devfeed.tech/tags/analytics.md>), [assessment](<https://devfeed.tech/tags/assessment.md>), [data-structure](<https://devfeed.tech/tags/data-structure.md>), [health](<https://devfeed.tech/tags/health.md>), [health-data](<https://devfeed.tech/tags/health-data.md>), [library](<https://devfeed.tech/tags/library.md>), [stats](<https://devfeed.tech/tags/stats.md>)

### AI overview

HackerEarth's Question Library "Health" feature estimates question usability from accuracy, frequency of use, and recency, rather than difficulty alone. The developers considered other signals--including ratings, tags, and question age--but selected those three for a simpler initial version. A question-specific ProblemUsageData helper model is updated when questions are used in tests; a generic Health model stores calculated results so a list of questions can be fetched in one query instead of recalculating usage across tests each time. The score combines the three factors with weights of 0.65, 0.15, and 0.20, and caps factors at 100. The usage multiplier is selected by accuracy range and differs by question type; its graph and the complete formula are not present in the supplied excerpt.

### Source excerpt

We, at HackerEarth, cater a huge number of questions in Assessment tool. Recruiters can choose from wide varieties of Multiple Choice and Programming/Coding questions to assess candidates. Every week or two, new questions are added to the Questions Library. As the time passed, thousands of questions got stacked up and recruiters started to have a hard time figuring out what questions to choose from such a huge library. We, developers, work closely with our sales team to understand recruiters' needs. Sometimes we directly get in touch with recruiters to provide on call technical support and understand how they use the product and what improvements can be made to the product in order to make it more easier to use. That's how we figured it was about time we helped recruiters figure the best questions out of our library and hence we released a feature called "Health". What it means? Health, in context of any library question, indicates how usable the question is. It is not only about question's difficulty level. We consider various factors such as number of users attempted the question, users solved, times the question has been used and when was the question last used while determining Health of any question. Simple and short, higher the health, more usable the question. How we calculate the Health value? The whole process was split into 3 parts: Data Segregation and Analysis Data Structure to store Health data Mathematical formula to calculate Health value 1. Data Segregation and Analysis We tried to gather as much data as possible for any question. Then, filter out the ones that could help us in finding the health value. Number of tests in which the question was used When was the question last used in any test Question accuracy (Number of users who solved it correctly / Number of users attempted) Problem ratings (Ratings submitted by user for any question) Problem tags When was the question added How frequently the question is used When was the question last used We f

## Logging millions of requests everyday and what it takes

DevFeed: [Logging millions of requests everyday and what it takes](<https://devfeed.tech/articles/logging-millions-of-requests-everyday-and-what-it-takes-19996.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2015/02/26/logging-millions-requests-what-it-takes/>)

Published: 2015-02-26T00:00:00Z

Content type: article

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [API Logging](<https://devfeed.tech/topics/api-logging.md>), [Publish-subscribe pattern](<https://devfeed.tech/topics/pubsub.md>), [software-architecture](<https://devfeed.tech/topics/software-architecture.md>), [etl](<https://devfeed.tech/topics/etl.md>), [middleware](<https://devfeed.tech/topics/middleware.md>), [Apache Kafka](<https://devfeed.tech/topics/apache-kafka.md>), [Latency](<https://devfeed.tech/topics/latency.md>)

Tags: [architecture](<https://devfeed.tech/tags/architecture.md>), [django](<https://devfeed.tech/tags/django.md>), [logging](<https://devfeed.tech/tags/logging.md>), [logs](<https://devfeed.tech/tags/logs.md>), [metrics](<https://devfeed.tech/tags/metrics.md>), [middleware](<https://devfeed.tech/tags/middleware.md>), [offline](<https://devfeed.tech/tags/offline.md>), [overhead](<https://devfeed.tech/tags/overhead.md>), [performance](<https://devfeed.tech/tags/performance.md>), [scalability](<https://devfeed.tech/tags/scalability.md>), [scale](<https://devfeed.tech/tags/scale.md>), [servers](<https://devfeed.tech/tags/servers.md>), [stateless](<https://devfeed.tech/tags/stateless.md>), [system](<https://devfeed.tech/tags/system.md>), [thread](<https://devfeed.tech/tags/thread.md>), [traffic](<https://devfeed.tech/tags/traffic.md>), [user](<https://devfeed.tech/tags/user.md>), [uses](<https://devfeed.tech/tags/uses.md>), [web-development](<https://devfeed.tech/tags/web-development.md>), [web-servers](<https://devfeed.tech/tags/web-servers.md>)

### AI overview

HackerEarth describes a stateless, message-based pipeline for collecting request logs while limiting web-server overhead. Django middleware asynchronously sends request data to nonblocking Thrift transporter servers; this adds about 2 ms to the request/response cycle, and one-way delivery reduces acknowledgement time at the cost of potentially losing some logs. Transporter-to-web-server communication averages 1-2 ms and can scale horizontally. Logs go to Kafka, which retains 15 days for replay by new consumers. A pipeline manager stages consumed data in MongoDB, moves it hourly to Amazon S3, then loads S3 files into Amazon Redshift for analysis. RabbitMQ coordinates task completion and initiation; the Redshift loading script removes duplicates before inserting data. The design targets peak traffic of 500 requests per second, compared with reported normal averages of 80-90 and contest-related surges of 200-250.

### Source excerpt

HackerEarth's web servers handle millions of requests every day. These request logs can be analyzed to mine some highly useful insights as well as metrics critical for the business, for example, no. of views per day, no. of views per sub product, most popular user navigation flow etc. Initial Thoughts HackerEarth uses Django as its primary web development framework and a host of other components which have been customized for performance and scalability. During normal operations, our servers handle 80-90 requests/sec on an average and this surges to 200-250 requests/sec when multiple contests overlap in a time delta. We needed a system which could easily scale to a peak traffic 500 requests/sec. Also, this system should add minimum processing overhead to the webservers and the data collected should be stored for crunching and offline processing. Architecture The diagram above shows a high level architecture of our request log collection system. The solid connection lines represent the data flow between different components and the dotted lines represent the communications. The whole architecture is message based and stateless and so individual components can easily be removed/replaced without any downtime. Below is a more detailed explanation about each component in the order of data flow. Web Servers On the web servers, we employ a Django Middleware that asynchronously retrieves required data for a given request and then forwards it to the Transporter Cluster servers. This is done using a thread and the middleware adds an overhead of 2 milli seconds to the Django request/response cycle. class RequestLoggerMiddleware(object): """ Logs data from requests """ def process_request(self, request): if settings.LOCAL or settings.DEBUG: return None if request.is_ajax(): is_ajax = True request.META['IS_AJAX'] = is_ajax before = datetime.datetime.now() DISALLOWED_USER_AGENTS = ["ELB-HealthChecker/1.0"] http_user_agent = request.environ.get('HTTP_USER_AGENT','') if http_user_a

[Next page](<https://devfeed.tech/sources/hackerearth.md?cursor=WyIyMDE1LTAyLTI2VDAwOjAwOjAwKzAwOjAwIiwgIjcwNTczOGZiLWU4M2MtNDdhNS04Y2Y1LTZiOWJlNmIwOTk0NyJd>)