Errors With Faulty Code On Number Guessing Game

I am currently using HTML and Javascript to create a number guessing game. The issue with my current code is that any number the user inputs is a number that is ruled as the correct number. The problem is that the random number generator is not being recognized for some reason. The game is simply supposed to pick a number from 1-100 and the user has to keep guessing a number to match the randomly generated number. And it should be able to reset once you click the new game button. I am just wondering how to resolve the issues with my code and how to get my desired output. Here's my code: https://jsfiddle.net/qg0froam/

  <!DOCTYPE html>
   <html lang="en">
       <head>
           <meta charset="utf-8">
           <meta name="viewport" content="width=device-width,initial-scale=1">
           <title>Homework 6</title>
          <script src="hw06.js"></script>
          <link rel="stylesheet" href="hw06.css">
      </head>
    <body onload="newgame()">
          <h1>High-low guessing game</h1>
          <div id="controls">
          <button onclick="newgame()">New game</button>
          <form onsubmit="guess(); return false;"><input id="guess_input" type="number">
          <input type="submit" value="Guess"></form>
          </div>
          <br><br>
          <div id="output"></div>
      </body>
  </html>

================================================================================================================================

var output;     // Global variable to reference the div element with id "output"
  var answer;     // This is the answer
  var guessCount = 1; // This variable counts the number of guesses
  var x = document.getElementById("guess_input"); // This is the number guessed by the user

   // Function that returns a random number in [minVal, maxVal].
   function randomNumber(minVal, maxVal) {
       return minVal + Math.floor(Math.random() * (maxVal - minVal + 1));
   }

 // Function that writes a message to the output div
  function writeOutput(message) {
      if (!output) {
          output = document.getElementById("output");
      }
      output.innerHTML = message + "<br>" + output.innerHTML;
  }

  // Function that starts a new game
      function newgame() {
      writeOutput("I'm thinking of a number between 1   and 100...");

      var answer = Math.floor(Math.random() * 100 + 1);

      var guessCount = 0;

      // TODO: use the randomNumber function to pick an answer for this game.
  }

  // Function that checks the player's guess against the answer

  function guess() {


  if(x == answer)
   {    
       writeOutput("Congratulations! You guessed the number correctly! "
               + guessCount + " Guesses ");
   }
   else if(x > answer) /* if guessed number is greater
                   than actual number*/ 
   {    
       guessCount++;
       writeOutput("The guess is incorrect! Try a lower number");
   }
   else
   {
       guessCount++;
       writeOutput("The guess is incorrect!! Try a higher number")
   }

      // TODO: look at the value of guess_input, compare it with the answer, and
      // tell the player whether the guess is too low, too high, or correct.
  }

WordPress.org Profiles Now Show Activity for Contributions Made on GitHub

WordPress.org profiles got an update over the weekend that will make them a better reflection of contributors’ efforts on GitHub. Users can now authorize GitHub to detect their activity on the WordPress GitHub organization and display it on their profiles.


“Currently we’re tracking New Issues submitted (by you), Closed Issues (by you), Pull requests submitted (by you), Pull requests merged (by you, and additionally the PR submitter gets a ‘PR Merged’ event), and finally Pushes to default branches,” WordPress lead developer Dion Hulse said.

There are a few reasons why one’s contributions might not be visible after linking accounts. The meta team has not built an importer for all previous issues and pull requests, so WordPress.org only has data from last Friday and onwards. Early adopters who linked their accounts when the feature was first being tested may need to re-authenticate since the earlier version had expired connections.

Linking accounts will help make it easier for the WordPress project to track contributions across multiple locations.

“In recent releases, the process of collecting props for non-WordPress.org contributions (namely Gutenberg) has been highly manual and error prone, occasionally resulting in contributors not receiving proper credit,” Jonathan Desrosiers said when rolling out the first version of the app in March 2020. “Connecting your WordPress.org and GitHub accounts will allow automatic tooling to be built which reduces the burden on release teams to maintain a credit list.”

Users who want to have their profiles include GitHub activity can navigate to the Edit Profile page on WordPress.org, launch the app, and authorize their accounts with one click.

Hulse is collecting feedback regarding adding more events (i.e. commenting on issues/PRs), combining events (i.e. Submitted & Merged), and anything else that might improve the quality of activity tracked. Riad Benguella suggested adding a selector to filter the timeline by activity type. Hulse responded that the way profiles are currently set up, querying specific activities cannot currently be done in a performant way but that there are meta trac tickets (#479 and #518) where they are discussing a broader overhaul for profiles.

With a great deal more activity coming in from GitHub, the ability to filter these activities might make WordPress.org a more comprehensive tool for assessing job candidates or verifying Five for the Future contributions. If you have more ideas for the feature, you can leave feedback on the announcement.

Ping Identity Announces New API Security Features

Ping Identity, an enterprise identity solutions provider, has added new API security features and fraud detection capabilities to its PingOne Cloud Platform. These additions are intended to bolster the platform's security capabilities while also improving the overall user experience.

Those “Get The App” Banners

Why would a company promote a native app over their perfectly usable website?

We’d have to ask them, I suppose. But it’s hard not to see this push to native as a matter of priorities: that these companies consider native applications worthy of their limited time, resources, and money. They’re a worthy investment, to hear these banners tell it.

—Ethan Marcotte, “Locus.”

Ethan shows off that the web is absolutely covered in amazingly obtrusive “get the app” banners, often covering up perfectly usable websites.

What I always think of when I see banners like this is a comment I remember Tim Holman making one time that was something like, What would it feel like to work on the web team at a company like this? There are a bunch of people in the world that work on websites that only exist behind big stupid banners telling people not to use the thing they work on all day.

Sure would be nice to get to a point where companies didn’t really care which method you used, because it’s probably all built with one technology anyway and is fully capable of anything the device can do.


The post Those “Get The App” Banners appeared first on CSS-Tricks. You can support CSS-Tricks by being an MVP Supporter.

Send PDF Files as Binary Strings

Introduction

In this article, I am going to explain to you how we can use the power of MuleSoft to send PDF files from Experience API to Process/System API, using the multipart/form-data type, and to covert it back to PDF file in the second API.

Use Case

We are going to read the PDF file from the local disk using Mule’s out-of-the-box (OOTB) File connector to read in Experience API. Then we will be sending this PDF as binary with some other fields to another API (this can be named as Process API) which accepts data as multipart/form-data. Next, we will extract this PDF binary from the received payload and convert it back to PDF and save the file to the local disk using Mule’s OOTB File connector to write.

Solution vs. Software Architecture

In my tenure as a solution architect in financial services working for a global consulting firm, I have often questioned the best way to practice enterprise architecture.  A common challenge that many architecture consultants face is that most client firms insist on using their proprietary enterprise architecture content. I have observed that frequently such architecture content does not always distinguish between the solution and software architecture.

This article is not an academic paper. In this article, I  present my experiences and ideas to help my colleagues better understand the vague differences between two similar but distinct architecture disciplines. At the very least, this article may trigger a conversation via the comments section that may persuade me that I am wrong.

Cash (Tiny jQuery Alternative)

The README for Cash is straightforward:

Cash is an absurdly small jQuery alternative for modern browsers (IE11+) that provides jQuery-style syntax for manipulating the DOM. Utilizing modern browser features to minimize the codebase, developers can use the familiar chainable methods at a fraction of the file size. 100% feature parity with jQuery isn’t a goal, but Cash comes helpfully close, covering most day to day use cases.

6 KB minified and gzipped, which is even smaller than Zepto. Zepto’s whole point was a smaller jQuery, but it hasn’t been touched in a bunch of years, so there is that too.

I wonder how much smaller Cash would be if it dropped IE 11 support.

jQuery is still used on an absolute ton of sites, only just recently having peaked in usage and showing signs of decline. That must be because it comes on most WordPress sites, right?! That’s like 42% of all sites right there.

Anyway, if you tend to reach for jQuery just for some convenient APIs, Cash looks like a nice alternative. I don’t blame you either. Typing $ instead of document.querySelectorAll still feels good to me, not to mention all the other fanciness tucked behind that dollar sign function.


Also worth mentioning: if you’re looking to straight-up remove jQuery from a project, replace-jquery might be worth a look:

Automatically find jQuery methods from existing projects and generate vanilla js alternatives.


The post Cash (Tiny jQuery Alternative) appeared first on CSS-Tricks. You can support CSS-Tricks by being an MVP Supporter.

Pros and Cons of Native vs Cross-Platform App Development

As technology advances, cross-platform and native app development domains evolve to come up with more robust and feature-rich app solutions for modern businesses.

As per the Statista prediction, mobile apps will generate more than 935 billion USD in the year 2023. Globally, enterprises tend to build dedicated apps for improving customer services, simplifying complexities, increasing productivity, and bringing automation into processes. However, as an entrepreneur, you may find it challenging to opt for cross-platform or native app development. Therefore, we are going to dig deep into the pros and cons of both these types. But before moving ahead, let’s go through some interesting facts. 

Pros and Cons of the Service Provider Model

One of the more common coordination models is the Service Provider model. When a team is a Service Provider, they:

  • Have valuable skills they offer other teams.
  • Are a dependency for those other teams. They do work for those teams. 
  • Do their work per ticket, per project, or per initiative. When their work is over, they either do work for someone else or work on their own priorities. 

The Service Provider model is one of the least effective coordination models in software engineering teams. There are some legitimate reasons to use this model, but you should avoid it unless you’re aware of the tradeoffs. 

10 Coding Challenge Websites For Developer

The purpose of the following websites is to help you test to what extent your programming prowess is able to solve problems low to high. Not only that, but there you also have to compete with other developers to achieve higher rankings. Just like playing games, we have to go from low rankings like copper, silver to gold, platinum. Here are some websites to help increase your interest in programming.

Exercism

The Exercism website is home to thousands of exercises that you can practice in over 50 supported programming languages. Its exercises are also varied for beginners or those with a lot of programming experience. It is open-source and based on donations from developers around the world so you can rest assured that it won't be charged. In addition, if you feel you are capable, you can also contribute helpful exercises to the community that will improve your programming skills and others.

The Machines Are Biased: Fixing the Fatal Flaws That Plague Modern Algorithms

"We've arranged a society based on science and technology, in which nobody understands anything about science technology. And this combustible mixture of ignorance and power, sooner or later, is going to blow up in our faces." -Carl Sagan

While applicable to most of our technology, Sagan's quote hits the hardest when thinking about algorithms. We live in a digitally automated world, yet most of us lack a working understanding of how digital automation works. 

MVP, Prototyping, and Outsourcing: Effective Solutions for Startups

When building apps, most startups face constraints corresponding to budget and resources. On the other hand, they need to compete with the big brands for delivering a sophisticated user experience. They need to take highly measured steps to prevent resource drainage and course correction while creating a product. This is why most startups rely on incremental development following the MVP approach and meticulous prototyping for app projects. 

Besides relying on an MVP development approach and well-articulated design prototypes, startup app projects also look for expert development at a competitive rate. Their search for expertise and competitive development rates encourage them to outsource app development projects. 

11 Best No-Code/Low-Code Backends of 2021

No-code and low-code development platforms let people worldwide build their businesses and applications without writing code. According to Forrester, the no-code/low-code category will grow to $21.2 billion by 2021.

Before these platforms, building an application for a business would require hiring experienced software developers. But that’s not the case anymore. Today, many no-code/low-code platforms make it possible for independent creators, artists, and entrepreneurs alike to build applications on their own.

How to Avoid the Ice Cream Cone of Test Automation

The testing process is key to delivering quality software. But as the demand for faster delivery increases, it becomes harder for human teams to keep up. Luckily, test automation can help cover tasks.

And DevOps can further help position testing efforts within the software development cycle. But when dealing with larger software products that have constantly evolving functionality, test automation gets trickier.

Understanding How CALMS Extends To Observability

As our observability and DevOps practices continue to join, similar alignment happens with our frameworks and goals. In fact, when one considers that observability is about increased and deeper data about our environments, it is evident that the frameworks aren’t changing so much as adapting to faster insights.

Let’s take a look at CALMS. CALMS (Culture, Automation, Lean, Measurement, Sharing) was created by Jez Humble and is meant as a method of assessing how an organization is adapting to DevOps practices. However, as we add observability, CALMS can extend to our observability practice as well.

10 Best Practices for Ajax Implementations

Ajax technology implementation optimizes efficiency and aids in building better as well as more interactive web applications.

Ajax technology implementation is a collection of web development methods that creates asynchronous web applications by combining several professional web services. This technology allows the use of web applications to transmit and receive data dynamically without disturbing the display of the whole page. Its benefits are similar to that of WordPress.

How to Parse and Standardize Street/Postal Addresses

For any apps or websites that work with addresses, it's necessary for these addresses to be validated and parsed, as well as standardized and verified. There are various mechanisms that are best suited to different projects, so figuring out what you need exactly isn’t always that easy.

What Problems Appear Around Parsing and Standardization?

There are three primary issues that often occur in the parsing and standardization process.

Useful Decorators and Functions in Python’s Functools

The Functools module of Python is a collection of Higher-Order Functions. A Higher-Order Function is one that:

  • Takes function as a parameter.
  • Return a function as its return value from another function.

Here are the three most important functions or decorators from the Functools module of Python and why each is so important.