Search the Community
Showing results for tags 'javascript'.
-
Authors/Presenters: *Abdullah AlHamdan, Cristian-Alexandru Staicu Many thanks to USENIX for publishing their outstanding USENIX Security ’23 Presenter’s content, and the organizations strong commitment to Open Access. Originating from the conference’s events situated at the Anaheim Marriott; and via the organizations YouTube channel. Permalink The post USENIX Security ’23 – SandDriller: A Fully-Automated Approach for Testing Language-Based JavaScript Sandboxes appeared first on Security Boulevard. View the full article
-
- usenix
- javascript
-
(and 1 more)
Tagged with:
-
As application development evolves and programming languages advance, choosing the programming language to learn can be difficult. Two of the most widely used languages today are Python and JavaScript. Both languages offer unique features, advantages, and application areas. In this blog post, we'll discuss their characteristics, applications, and benefits to help you decide which language best fits your needs. Introduction to Python and JavaScriptPython is an interpreted, high-level, and general-purpose programming language that was released publicly in 1991. It has quickly become popular as an excellent option for beginners due to its shallow learning curve. It emphasizes code readability while being user-friendly, making it perfect for novice programmers! On the other hand, JavaScript is a dynamically interpreted programming language created by Brendan Eich in 1995 for front-end web application development. Over time, JavaScript has also found use in server-side web development through Node.js. It is now a full-stack language capable of powering client-side and server-side processes for web apps. Advantages of Learning PythonBelow are the advantages of learning Python: Simplicity and Readability: Python's clean and readable syntax makes it a preferred choice for beginners who want to learn how to write, debug, and maintain code fast. Versatility: Python's wide collections of libraries and frameworks make it an excellent fit for different use cases. Additionally, learning Python offers a wide range of career prospects in many sectors. Community and Resources: Python boasts a lively and active developer community, contributing to its continued evolution and advancement. There is ample online documentation, tutorials, forums, and open-source projects available that make learning the language easy. High Demand in the Job Market: Python developers are in demand in the job market due to its wide adoption. From web development to data science or artificial intelligence, proficiency in Python increases your career opportunities significantly. To get started with Python, check out our Python Basics course. Advantages of Learning JavaScriptBelow are the advantages of learning JavaScript: Full-Stack Development: With the introduction of Node.js, JavaScript has expanded to cover server-side development capabilities, making it possible for developers to create full-stack applications using only one language. It helps streamline development processes by eliminating multiple languages and frameworks from their learning process. Rich Ecosystem of Libraries and Frameworks: JavaScript offers a diverse ecosystem of libraries and frameworks. It has an expansive ecosystem of libraries and frameworks such as React, Angular, and Vue.js that make web application development faster and simpler. These frameworks provide tools for building modern user interfaces with responsive design features. High Demand and Attractive Salaries: JavaScript developers are in high demand, and companies are willing to pay top salaries for experienced professionals. Proficiency in JavaScript could open doors to lucrative career opportunities across front-end, back-end, or full-stack development roles. Python vs. JavaScript: Key DifferencesBelow are the main differences between Python and JavaScript: Syntax and Language FeaturesPython emphasizes code readability through indentation to specify code blocks, making it intuitive and straightforward for beginner programmers to learn. It supports procedural and object-oriented programming paradigms and includes powerful features like dynamic typing, automatic memory management, and an extensive standard library. JavaScript's syntax can be more complex for novice programmers than Python, especially at the beginning. It follows C-style syntax with curly braces and semicolons, denoting code blocks and statements. JavaScript supports procedural and object-oriented programming paradigms and offers features like dynamic typing, first-class functions, and closures, which can be difficult for beginners to learn. Performance and Execution EnvironmentPython is an interpreted language, meaning an interpreter executes code line by line without compilation. While Python's interpreted nature can lead to slower execution than compiled languages like C or C++, its simplicity and ease of use make it a preferred choice for many developers. Additionally, it’s performance can be optimized using techniques such as code optimization, built-in data structures, and leveraging third-party libraries written in C or C++. JavaScript is also an interpreted language, but its execution environment varies depending on whether it's running on the client side (in a web browser) or the server side (using Node.js). In a web browser, JavaScript code is executed by the browser's JavaScript engine, such as V8 in Chrome or SpiderMonkey in Firefox. On the server side, JavaScript code is executed by the Node.js runtime environment, which allows developers to write server-side applications using JavaScript. Its performance varies depending on the execution environment and the efficiency of the underlying JavaScript engine. Learning Curve and ResourcesWith its easy learning curve and extensive documentation, Python is an excellent option for newcomers to programming. Its clean syntax, comprehensive documentation, and extensive developer community contribute to its accessibility and ease of learning. Additionally, numerous online resources, such as tutorials, courses, books, and interactive coding platforms, are available. Compared to Python, JavaScript offers an intense learning curve for beginners. Its complex syntax, asynchronous nature, and peculiarities like type coercion and hoisting may make learning it daunting. However, with dedication and practice, you can overcome these challenges and become a proficient developer. Luckily, many resources such as tutorials, courses, books, and coding boot camps exist for learning JavaScript. Moreover, its community is active and welcoming, providing forums, meetups, and online communities where developers can collaborate while learning from one another. Ecosystem and Community SupportPython boasts an extensive ecosystem featuring libraries, frameworks, and tools that enable development across many domains. The Python Package Index (PyPI) hosts over 300K packages to meet nearly any programming need imaginable. Popular frameworks like Django, Flask, and Pyramid facilitate web development, while libraries like NumPy, SciPy, and Matplotlib support data science. Furthermore, its active community fosters collaboration through conferences, meetups, Stack Overflow, Reddit, etc. JavaScript's ecosystem has libraries, frameworks, and tools for front-end, back-end, and full-stack development. npm has grown into the largest open-source library ecosystem worldwide, housing over 1.5 million packages in its registry. Frameworks like React, Angular, and Vue.js have transformed front-end development by enabling developers to create powerful interactive user interfaces. Additionally, frameworks like Express.js and NestJS provide efficient server solutions. JavaScript's large community of developers, designers, and enthusiasts thrive through collaboration and innovation, driving the language's evolution while shaping its ecosystem. Job Market and Career OpportunitiesDue to Python's versatility and wide adoption, its developers are in high demand across various industries, including tech giants, startups, academia, finance, healthcare, and government. There are multiple job roles for Python developers, ranging from web developers and software developers to data analysts and machine learning engineers. A Python certification can boost your career. Check out this article on How to Get Python Certification: The Step-By-Step Guide. JavaScript's rise as the go-to web development language and server-side programming technology has increased the need for JavaScript developers. Front-end specialists and back-end developers are in high demand at the moment. Full-stack developers with expertise in both front-end and back-end JavaScript development are in even greater demand in today's tech economy! Future Trends and Industry OutlookPython continues its rise as a top programming language, experiencing steady adoption across industries and domains. As the artificial intelligence, machine learning, and data science industries grow, Python’s popularity and adoption will continue to grow. It’s simple programming model, versatility features, and community support make it ideal for addressing emerging challenges like cybersecurity development, cloud computing deployment, and Internet of Things development (IoT development). JavaScript's evolution from a client-side scripting language to a full-stack powerhouse has cemented it as one of the cornerstones of modern web development. As web technologies advance and consolidate, their influence will extend beyond traditional web apps to emerging paradigms such as Progressive Web Apps (PWAs), serverless architecture, and real-time collaboration. JavaScript’s versatility and cross-platform compatibility make it an excellent choice for building next-generation applications on the web, mobile desktop computers, or IoT devices, which ensures its relevance within the ever-expanding tech landscape, securing its place within the ever-expanding tech landscape. When to Learn Python Here are some scenarios in which learning Python can be particularly advantageous: Beginners in ProgrammingData Science and Analytics enthusiastsIndividuals who want to pursue web developmentIndividuals who want to pursue automation and scripting projectsMachine learning and artificial intelligence enthusiastsWhen to Learn JavascriptLearning JavaScript can be advantageous in various scenarios, given its versatility and widespread adoption across different domains. Here are some situations in which learning JavaScript can be particularly beneficial: Individuals who want to pursue web developmentIndividuals who want to become full-stack web developersIndividuals who want to become mobile app developersWhen you want to learn APIs and Browser AutomationGame Development enthusiastsConclusionPython and JavaScript are powerful programming languages with distinct advantages and applications. Ultimately, you should select which one to learn depending on your interests, career goals, and projects you wish to undertake. No matter which language you decide to learn, proficiency in Python or JavaScript will undoubtedly advance your skills as a programmer and open up exciting career prospects in today’s fast-moving technology sector. More Python articles: Create A Simple Python Web Application That Interacts With Your Kubernetes ClusterTop 7 Skills Required for DevOps Engineers (with Roadmap)Top 10 Programming LanguagesView the full article
-
While coding in JavaScript, sometimes, developers need to terminate the code at any place for specific reasons, such as “when a particular condition is met”, “for testing purposes”, or “when the script encounters an error” that it cannot handle, you may want to terminate it so that it does not continue executing and potentially cause further issues. This article will describe the process for terminating the script in JavaScript. How to Terminate the Script in JavaScript? To terminate the script in JavaScript, use the following ways: Using a return statement Using debugger command Throwing error Method 1: Terminate the Script Using “return” Statement You can use a “return” statement when a condition is met and also handle an unexpected condition where the code will return specified output and stop the script. Example First, define a function called “division” with two parameters, “x” and “y”. Check if the “y” is equal to 0, and print the message “Can’t divide by zero (Terminated)”. Because, in the division, the denominator should always be greater than 0. If the operands “x” and “y” are non-zero, then divide both and return the resultant value to the function: function division(x, y){ if(y==0){ return "Can't divide by zero (Terminated)"; } else return x / y; } Now, call the function by passing values “9” as “x” and “5” is “y”: console.log(division(9,5)); Invoke the function again by passing “x” and “y” as “11” and “0”, respectively: console.log(division(11,0)); Output Method 2: Terminate the Script Using the “debugger” Command During testing or debugging, you can use the “debugger” command to stop the script at any point. It stops the program execution process and implements the debug function. It is just like breakpoints in manual debugging. Example In the given an example, first, we will create a form that contains two text fields with a submit button that invokes the function on the click event: <form action="#" name="form"> Enter your Name <input type="text" id="name" autocomplete="off"><br><br> Enter your Hobby <input type="text" id="hobby" autocomplete="off"> <p id="error"></p> <input type="submit" value="submit" onclick="myFunc()"> </form> In JavaScript file or the <script> tag, use the following code: function myFunc() { var name = document.getElementById("name").value; var hobby = document.getElementById("hobby").value; debugger; if (name == ""){ document.getElementById("error").innerHTML ="Enter name"; return false; } if (hobby == ""){ document.getElementById("error").innerHTML ="Enter hobby"; return false; } } According to the given code: First, define a function “myFunc()” that will trigger on the click event of the submit button. Get the values of the text fields using the “getElementById()” method with the “value” attribute. Call the “debugger” command to stop the execution of a script. Check if the fields are empty, and print the error message. It can be observed from the output that only one field is filled, and the debugger is called that stops the script by clicking on the “submit” button. If you process further, click on the “Continue” button of the debugger: Method 3: Terminate the Script Throwing an Error Last but not least, you can also stop or terminate your script by “throwing an error” on the occurrence of any exception. Example Here, in the provided example, if any text field is empty, we will throw an exception error and terminate/stop the script: function myFunc() { var name = document.getElementById("name").value; var hobby = document.getElementById("hobby").value; if (name == "" || hobby == ""){ throw new Error("Program Terminated due to empty fields"); } } The output indicates that the script is stopped when the one or both text fields are empty: Note: For Node.js, you can use the “abort()” or “exit()” methods to terminate the script. Conclusion To terminate the script in JavaScript, use the “return” statement, “debugger” command, or “throw an error”. You can use any approach according to preference. However, the “debugger” command is mostly used to test the code. This article described the process for terminating the script in JavaScript. View the full article
-
There are multiple ways of checking the existing keys in a JavaScript object. Most of the ways include using methods from other packages. To do that, one generally has to first install that package and then work with the methods written inside it. But in this article, we will be working with the methods that come as default in JavaScript. So, let’s start with the first method. Method 1: Using the “in” Operator to Find the Existence of a Key We can use the “in” operator to check for a particular key in an object, just like we can use it to find the existence of a particular character in a string. To demonstrate this, we are going to need an object there create an object with the following lines of code: var personObject = { firstName: "John", lastName: "Doe", age: 18, salary: 2200 } As you can see, this object is about a person and includes details like the first name, last name, age, and salary. Suppose that we want to check whether or not the key “age” is present in our personObject. In that case, search for age in personObject and set the return value in a new variable: existence = "age" in personObject; After that, we can simply print the value inside the existence variable on the terminal using the console log function like: console.log(existence); After that, simply execute the program and observe the following result on the terminal: The true value in the terminal means that the key age does exist in the object personObject. After that, we also want to check for a key that is not present in the personObject. For this, we are going to use the in operator to find the key “martialStatus” in the personObject like: existence = "martialStatus" in personObject; And then again, we can simply pass this existence variable to the console log function to print the result on the terminal like: console.log(existence); Execute the program and observe the following result from the terminal: As you can see, the result was false meaning that there is no such key as martialStatus inside our personObject. Method 2: Using the “hasOwnProperty()” Method With the Object In JavaScript, every object has some of the methods from its prototype. One such method is known as the hasOwnProperty(). This method takes in the key you want to search for in its argument and returns true or false depending upon the presence of the key in that object. To demonstrate hasOwnProperty(), create an object using the following lines of code: var car = { model: "2015", make: "Porsche", price: 328000, reviews: 4.8, }; As you can already tell, the above lines are to create an object of a car. What we want to find is the presence of the key “make” in the object “car”. For this, apply the hasOwnProperty() method on the car object with the help of a dot operator and pass in the key “make” in its argument like: existence = car.hasOwnProperty("make"); After that, simply pass the existence variable in the console log function to display the result on the terminal like: console.log(existence); Execute the program for the following outcome: The output on the terminal is true, which means the car object contains the key make. After that, let’s check for the existence of the key “mileage” in our car object. For this, simply pass the key as mileage in the hasOwnProperty() method’s argument: existence = car.hasOwnProperty("mileage"); To show the result on the terminal, simply pass the variable “existence” in the console log function: console.log(existence); Execute the program and observe the following output: The output shows that there is no such key as mileage in the object car. Conclusion In JavaScript, we can quickly check the existence of a specific key inside an object with two different methods. The first methods include the use of the in operator, and it returns true if the existence is found otherwise, it returns false. The second method includes the use of a method of the JavaScript Object, which is the hasOwnProperty(). In its argument, you simply pass in the key you want to search for, and it returns true if the key is found in the object. Otherwise, it returns false. View the full article
-
In JavaScript, the console object gives access to the browser to allow for debugging. It is used for different objectives, including displaying messages, alerts, and errors on the browser console. Therefore, it is very useful for debugging purposes. Most popular web browsers, including Firefox, Google Chrome, Safari, etc., provide a set of developer tools that consists of a debugger, console, inspect element, and network activity analyzer. Through these tools, it has become easier to perform any tasks according to the requirements. In this post, the console in JavaScript is briefly explained with the following learning outcomes: How to use the console object in JavaScript How various console methods work in JavaScript How to use the console object in JavaScript? In JavaScript, a console is an object combined with different methods to perform various functions and get the output on the browser. Some of the console methods in JavaScript are as follows: console.log() method: Output the message to the web console. console.Info(): output an informational message to the web console console.error(): Displays an error message on the console. console.Clear(): Removes everything from the console. console.warn(): Displays a warning message. console.assert(): Return an error message if the assertion fails. console.count(): Return the number of counts called. console.table(): Returns data in a tabular format. console.Group(): Creates a group inline in the console. console.GroupEnd(): End the current group in the console. console.Time(): Starts a timer for the console view. console.timeEnd(): End the timer and return the result to the console. In order to provide a better understanding, a few examples are provided. How does the console.log() method work in JavaScript? The console.log() method displays the output to the console. Users can input any type inside the log(), such as strings, booleans, arrays, objects, etc. The example code of the console.log() method is given below. Code: // console.log() method console.log("welcome to JavaScript") // string console.log(1); // boolean console.log([1, 2, 3]); // array inside log console.log(true); // boolean console.log(null); In the above code, the console.log() method is used to print the string, a boolean and an array on the console. Output: It is observed that the string, boolean, and array values are printed on the console. How does the console.info() work in JavaScript? The console.info() method displays the key information regarding the user in accordance with the needs. Most of the developers used this method for displaying permanent information. Code: // console.info() method console.info("This is an information message"); In the above code, a string is passed using the console.info() method. Output: In the console window, string output is displayed by using console.info() method. How does the console.error() method work in JavaScript? To display the error message, the console.error() method is used. Most of the developers used it for troubleshooting purposes. The example code of the console.error() method is given as follows. Code: // console.error() method console.error('This is a simple error'); The console.error() method executed in the console browser is marked as a string input in the below figure. Output: By passing a single argument of string type, the error message is displayed on the console. How does the console.clear() method work in JavaScript? The console.clear() method is used for removing all the information from the console browser. Most of the time, it is used at the start of the code to remove all previous information or to display a clean output. Code: // console.clear() method console.clear(); The console.clear() method is used as input in the console browser. Output: Let’s look at the state of the console before applying the console.clear() method. Now, observe the console after applying the clear() method. The output figure shows a clear display in the console window using the console.clear() method. How does the console.warn() method work in JavaScript? The console.warn() method is used to show the warning message to the console browser. It requires only one argument to display the message. The JavaScript code is as below: Code: // console.warn() method console.warn('This is a warning.'); A simple warning message is being printed using the warn() method. Output: The output shows a warning symbol and the message you entered in the console.warn() method. How does the console.count() method work in JavaScript? The console.count() method shows how many times a method has been called. Below is the code for the console.count() method. Code: // console.count() method for(let i=1;i<6;i++){ console.count(i); } In the above code, the console.count() method is used to count the methods within a loop. Output: The figure shows that five counts are called in a for loop using the console.count() method. How does the console.table() method work in JavaScript? The console.table() method is used to display objects in the form of a table on the browser console. We made use of the following code to show the usage of the console.table() method. Code: console.table({'a':1, 'b':2,'c':3,'d':4}); The console.table() method is used to represent the data in a tabular form. Output: The below figure shows a table in which values are stored by assigning indexes. How does the console.time() and console.timeEnd() methods work in JavaScript? The console.time() method is used to start calculating the execution time of a specific portion of code. Moreover, at the end of the code, you can use console.timeend() to get the execution time. The following example code implements the console.time() and console.timeend() methods. Code: // console.time() and console.timeEnd() method console.time('Welcome to JavaScript'); let fun_sit = function(){ console.log('fun_sit is running'); } let fun_stand = function(){ console.log('fun_stand is running..'); } fun_sit(); // calling fun_sit(); fun_stand(); // calling fun_stand(); console.timeEnd('Welcome to JavaScript'); In the above code, The console.time() method is used at the After that, two functions are created. Later, these functions are Lastly, we used the console.timeend() method to return the total execution time of the code (that is placed in between the console.time() and console.timeEnd() methods). Output: It is observed from the output that the code written between the console.time() and console.timeEnd() methods took 8.96 ms to execute. How does the console.group() method work in JavaScript? The console.group() method is used to make a group of messages on the console. Additionally, the console.groupEnd() method is used to terminate that group. The example code that exercises console.group() and console.groupEnd() methods is written below. Code: // console.group() and console.groupEnd() method console.group('simple'); console.warn('alert!'); console.error('error notification'); console.log('Welcome to JavaScript'); console.groupEnd('simple'); console.log('new section'); In above code, console.group() method is used. After that, the warn(), error(), and log() methods are used for displaying messages in the group. At the end, console.groupEnd() is used to end the messages of the group. Output: The output illustrates the group of messages in which errors and warning notifications are displayed. whereas the statement ‘new section’ is displayed outside of the group. Here it is! You have learned to understand and apply console objects and their methods in JavaScript. Conclusion In JavaScript, the console object comprises various methods that can be used to get the output on the browser’s console. This post demonstrates the functionality of the console in JavaScript. You have learned to access the console of various browsers. Additionally, we have provided an overview of all the methods supported by the console object in JavaScript. View the full article
-
Today we are announcing the general availability of Geofences for Amplify Geo. Amplify Geo enables frontend developers to add location-aware features to their web applications. Developers looking to display geometric boundaries or Geofences on a map, can now implement a complete Geofence management solution in minutes using the cloud-connected UI widget and APIs from Amplify Geo, powered by Amazon Location Service. Geofences are geometric boundaries that can be drawn around places of interest or areas on a map. View the full article
-
JavaScript is a high-level scripting language used by programmers worldwide to perform dynamic and interactive operations on websites. So, every high-level language needs to be converted into a computer understandable language before execution and for that purpose, compilers and interpreters are used. In this article, we are excited to tell you about our list of best 5 JavaScript IDEs ... View the full article
-
- javascript
- compilers
-
(and 2 more)
Tagged with:
-
Array reversing is a very well-known programming challenge that a developer can encounter at any time. Therefore JavaScript provides multiple ways to deal with it such as using for-loop, reverse(), unshift() method, swapping technique etc. Some of them modify the original array while some approaches don’t affect the original array. This post will explain the below-mentioned approaches to reverse an array in JavaScript: How to use Array.reverse() Method in JavaScript How to use Traditional for-loop in JavaScript How to use Array.unshift() method in JavaScript So, let’s begin! … View the full article
-
Application developers building real-time audio, video, and screen sharing applications can now collect client metrics from meetings events available from the Amazon Chime SDK for JavaScript. Developers can help end users troubleshoot their application without requiring them to send in client logs. And by streaming metrics to Amazon CloudWatch, developers can analyze meeting health trends or deep dive on problematic meetings or devices. View the full article
-
Jason Perlow, Editorial Director of the Linux Foundation, chats with Jory Burson, Community Director at the OpenJS Foundation about open standardization efforts and why it is important for open source projects. JP: Jory, first of all, thanks for doing this interview. Many of us know you from your work at the OpenJS Foundation, the C2PA, and on open standards, and you’re also involved in many other open community collaborations. Can you tell us a bit about yourself and how you got into working on Open Standards at the LF? JB: While I’m a relatively new addition to the Linux Foundation, I have been working with the OpenJS foundation for probably three years now — which is hosted by the Linux Foundation. As some of your readers may know, OpenJS is home to several very active JavaScript open source projects, and many of those maintainers are really passionate about web standards. Inside that community, we’ve got a core group of about 20 people participating actively at Ecma International on the JavaScript TCs, the W3C, the Unicode Consortium, the IETF, and some other spaces, too. What we wanted to do was create this space where those experts can get together, discuss things in a cross-project sort of way, and then also help onboard new people into this world of web standards — because it can be a very intimidating thing to try and get involved in from the outside. The Joint Development Foundation is something I’m new to, but as part of that, I’m very excited to get to support the C2PA, which stands for Coalition for Content Provenance and Authenticity; it’s a new effort as well. They’re going to be working on standards related to media provenance and authenticity — to battle fakes and establish trustworthiness in media formats, so I’m very excited to get to support that project as it grows. JP: When you were at Bocoup, which was a web engineering firm, you worked a lot with international standards organizations such as Ecma and W3C, and you were in a leadership role at the TC53 group, which is JavaScript for embedded systems. What are the challenges that you faced when working with organizations like that? JB: There are the usual challenges that I think face any international or global team, such as coordination of meeting times and balancing the tension between asynchronously conducting business via email lists, GitHub, and that kind of thing. And then more synchronous forms of communication or work, like Slack and actual in-person meetings. Today, we don’t really worry as much about the in-person meetings, but still, there’s like, this considerable overhead of, you know, “human herding” problems that you have to overcome. Another challenge is understanding the pace at which the organization you’re operating in really moves. This is a complaint we hear from many people new to standardization and are used to developing projects within their product team at a company. Even within an open source project, people are used to things moving perhaps a bit faster and don’t necessarily understand that there are actually built-in checks in the process — in some cases, to ensure that everybody has a chance to review, everybody has an opportunity to comment fairly, and that kind of thing. Sometimes, because that process is something that’s institutional knowledge, it can be surprising to newcomers in the committees — so they have to learn that there’s this other system that operates at an intentionally different pace. And how does that intersect with your work product? What does that mean for the back timing of your deliverables? That’s another category of things that is “fun” to learn. It makes sense once you’ve experienced it, but maybe running into it for the first time isn’t quite as enjoyable. JP: Why is it difficult to turn something like a programming language into an internationally accepted standard? In the past, we’ve seen countless flavors of C and Pascal and things like that. JB: That’s a really good question. I would posit that programming languages are some of the easier types of standards to move forward today because the landscape of what that is and the use cases are fairly clear. Everybody is generally aware of the concept that languages are ideally standardized, and we all agree that this is how this language should work. We’re all going to benefit, and none of us are necessarily, outside of a few cases, trying to build a market in which we’re the dominant player based solely on a language. In my estimation, that tends to be an easier case to bring lots of different stakeholders to the table and get them to agree on how a language should proceed. In some of the cases you mentioned, as with C, and Pascal, those are older languages. And I think that there’s been a shift in how we think about some of those things, where in the past it was much more challenging to put a new language out there and encourage adoption of that language, as well as a much higher bar and much more difficult sort of task in getting people information out about how that language worked. Today with the internet, we have a very easy distribution system for how people can read, participate, and weigh in on a language. So I don’t think we’re going to see quite as many variations in standardized languages, except in some cases where, for example, with JavaScript, TC53 is carving out a subset library of JavaScript, which is optimized for sensors and lower-powered devices. So long story short, it’s a bit easier, in my estimation, to do the language work. Where I think it gets more interesting and difficult is actually in some of the W3C communities where we have standardization activities around specific web API’s you have to make a case for, like, why this feature should actually become part of the platform versus something experimental… JP: … such as for Augmented Reality APIs or some highly specialized 3D rendering thing. So what are the open standardization efforts you are actively working on at the LF now, at this moment? JB: At this exact moment, I am working with the OpenJS Foundation standards working group, and we’ve got a couple of fun projects that we’re trying to get off the ground. One is creating a Learning Resource Center for people who want to learn more about what standardization activities really look like, what they mean, some of the terminologies, etc. For example, many people say that getting involved in open source is overwhelming — it’s daunting because there’s a whole glossary of things you might not understand. Well, it’s the same for standardization work, which has its own entire new glossary of things. So we want to create a learning space for people who think they want to get involved. We’re also building out a feedback system for users, open source maintainers, and content authors. This will help them say, “here’s a piece of feedback I have about this specific proposal that may be in front of a committee right now.” So those are two things. But as I mentioned earlier, I’m still very new to the Linux Foundation. And I’m excited to see what other awesome standardization activities come into the LF. JP: Why do you feel that the Linux Foundation now needs to double down its open standards efforts? JB: One of the things that I’ve learned over the last several years working with different international standards organizations is that they have a very firm command of their process. They understand the benefits of why and how a standard is made, why it should get made, those sorts of things. However, they don’t often have as strong a grasp as they ought to around how the software sausage is really made. And I think the Linux Foundation, with all of its amazing open source projects, is way closer to the average developer and the average software engineer and what their reality is like than some of these international standards developing boards because the SDOs are serving different purposes in this grander vision of ICT interoperability. On the ground, we have, you know, the person who’s got to build the product to make sure it’s fit for purpose, make sure it’s conformant, and they’ve got to make it work for their customers. In the policy realm, we have these standardization folks who are really good at making sure that the policy fits within a regulatory framework, is fair and equitable and that everybody’s had a chance to bring concerns to the table — which the average developer may not have time to be thinking about privacy or security or whatever it might be. So the Linux Foundation and other open source organizations need to fit more of the role of a bridge-builder between these populations because they need to work together to make useful and interoperable technologies for the long term. That’s not something that one group can do by themselves. Both groups want to make that happen. And I think it’s really important that the LF demonstrate some leadership here. JP: Is it not enough to make open software projects and get organizations to use them? Or are open standards something distinctly different and separate from open source software? JB: I think I’ll start by saying there are some pretty big philosophical differences in how we approach a standard versus an open source project. And I think the average developer is pretty comfortable with the idea that version 1.0 of an open source project may not look anything like version 2.0. There are often going to be cases and examples where there are breaking changes; there’s stuff that they shouldn’t necessarily rely on in perpetuity, and that there’s some sort of flex that they should plan for in that kind of thing. The average developer has a much stronger sense with a standardization activity that those things should not change. And should not change dramatically in a short period. JavaScript is a good example of a language that changes every year; new features are added. But there aren’t breaking changes; it’s backward compatible. There are some guarantees in terms of a standard platform’s stability versus an open source platform, for example. And further, we’re developing more of a sense of what’s a higher bar, if you will, for open standards activities, including the inclusion of things like test suites, documentation, and the required number of reference implementations examples. Those are all concepts that are kind of getting baked into the idea of what makes a good standard. There’s plenty of standards out there that nobody has ever even implemented — people got together and agreed how something should work and then never did anything with it. And that’s not the kind of standard we want to make or the kind of thing we want to promote. But if we point to examples like JavaScript — here’s this community we have created, here’s the standard, it’s got this great big group of people who all worked on it together openly and equitably. It’s got great documentation, it’s got a test suite that accompanies it — so you can run your implementation against that test suite and see where the dragons lie. And it’s got some references and open source reference implementations that you can view. Those sorts of things really foster a sense of trustworthiness in a standard — it gives you a sense that it’s something that’s going to stick around for a while, perhaps longer than an open source project, which may be sort of the beginnings of a standardization activity. It may be a reference to implementing a standard, or some folks just sort of throwing spaghetti at a wall and trying to solve a problem together. And I think these are activities that are very complementary with each other. It’s another great reason why other open source projects and organizations should be getting involved and supporting standardization activities. JP: Do open standardization efforts make a case for open source software even stronger? I think so — I just see them as so mutually beneficial, right? Because in the case of an open standards activity, you may be working with some folks and saying, well, here’s what I’m trying to express what this would look like — if we take the prose — and most of the time, the standard is written in prose and a pseudocode sort of style. It’s not something you can feed into the machine and have it work. So the open source projects, and polyfills, and things of that sort can really help a community of folks working on a problem say, “Aha, I understand what you mean!” “This is how we interpreted this, but it’s producing some unintended behaviors”, or “we see that this will be hard to test, or we see that this creates a security issue.” It’s a way of putting your ideas down on paper, understanding them together, and having a tool through which everybody can pull and say, Okay, let’s, let’s play with it and see if this is really working for what we need it for.” Yes, I think they’re very compatible. JP: Like peanut butter and jelly. JB: Peanut butter and jelly. Yeah. JP: I get why large organizations might want things like programming languages, APIs, and communications protocols to be open standards, but what are the practical benefits that average citizens get from establishing open standards? JB: Open standards really help promote innovation and market activity for all players regardless of size. Now, granted, for the most part, a lot of the activities we’ve been talking about are funded by some bigger players. You know, when you look at the member lists of some of the standards bodies, it’s larger companies like the IBMs, Googles, and Microsofts of the world, the companies that provide a good deal more of the funding. Still, hundreds of small and midsize businesses are also benefiting from standards development. You mentioned my work at Bocoup earlier — that’s another great example. We were a consulting firm, who heavily benefited from participating in and leveraging open standards to help build tools and software for our customers. So it is a system that I think helps create an equitable market playing field for all the parties. It’s one of those actual examples of rising tides, which lift all boats if we’re doing it in a genuinely open and pro-competitive way. Now, sometimes, that’s not always the case. In other types of standardization areas, that’s not always true. But certainly, in our web platform standards, that’s been the case. And it means that other companies and other content authors can build web applications, websites, services, digital products, that kind of thing. Everybody benefits — whether those people are also Microsoft customers, Google customers, and all that. So it’s an ecosystem. JP: I think it’s great that we’ve seen companies like Microsoft that used to have much more closed systems embrace open standards over the last ten years or so. If you look at the first Internet Explorer they ever had out — there once were websites that only worked on that browser. Today, the very idea of a website that only works on one company’s web browser correctly is ridiculous, right? We now have open source engines that these browsers use that embrace open standards have become much more standardized. So I think that open standards have helped some of these big companies that were more closed become more open. We even see it happen at companies like Apple. They use the Bluetooth protocol to connect to their audio hardware and have adopted technologies such as the USB-C connector when previously, they were using weird proprietary connectors before. So they, too, understand that open standards are a good thing. So that helps the consumer, right? I can go out and buy a wireless headset, and I know it’ll work because it uses the Bluetooth protocol. Could you imagine if we had nine different types of wireless networking instead of WiFi? You wouldn’t be able to walk into a store and buy something and know that it would work on your network. It would be nuts. Right? JB: Absolutely. You’re pointing to hardware and the standards for physical products and goods versus digital products and goods in your example. So in using that example, do you want to have seven different adapters for something? No, it causes confusion and frustration in the marketplace. And the market winner is the one who’s going to be able to provide a solution that simplifies things. That’s kind of the same thing with the web. We want to simplify the solutions for web developers so they’re not having to say, “Okay, what am I going to target? Am I going to target Edge? Am I going to target Safari?” JP: Or is my web app going to work correctly in six years or even six months from now? JB: Right! JP: Besides web standards, are there other types of standardization you are passionate about, either inside the LF or in your spare time? JB: It’s interesting because I think in my career, I’ve followed this journey of first getting involved because it was intellectually interesting to me. Then it was about getting involved because it was about making my job easier. Like, how does this help me do business more effectively? How does this help me make my immediate life, life as a developer, and my life as an internet consumer a little bit nicer? Beyond that, you start to think of the order of magnitude: our standardization activities’ social impact. I often think about the role that standards have played in improving the lives of everyday people. For the last 100 years, we have had building standards, fire standards, and safety standards, all of these things. And because they developed, adopted, and implemented in global policy, they have saved people’s lives. Apply that to tech — of course, it makes sense that you would have safety standards to prevent the building from burning down — so what is the version of that for technology? What’s the fire safety standard for the web? And how do we actually think about the standards that we make, impacting people and protecting them the way that those other standards did? One of the things that have changed in the last few years is that the Technical Advisory Group group or “TAG” at the W3C are considering more of the social impact questions in their work. TAG is a group of architects elected by the W3C membership to take a horizontal/global view of the technologies that the W3C standardizes. These folks say, “okay, great; you’re proposing that we standardize this API, have you considered it from an accessibility standpoint? Have you considered it from, you know, ease of use, security?” and that sort of thing. In the last few years, they started looking at it from an ethical standpoint, such as, “what are the questions of privacy?” How might this technology be used for the benefit of the average person? And also, perhaps, how could it potentially be used for evil? And can we prevent that reality? So one of the thingsI think is most exciting, is the types of technologies that are advancing today that are less about can we make X and Y interoperable, but can we make X and Y interoperable in a safe, ethical, economical, and ecological fashion — the space around NFT’s right now as a case in point. And can we make technology beneficial in a way that goes above and beyond “okay, great, we made the website, quick click here.” So C2PA, I think, is an excellent example of a standardization activity that the LF supports could benefit people. One of the big issues of the last several years is the authenticity of media that we consume things from — whether it was altered, or synthesized in some fashion, such as what we see with deepfakes. Now, the C2PA is not going to be able to and would not say if a media file is fake. Rather, it would allow an organization to ensure that the media they capture or publish can be analyzed for tampering between steps in the edit process or the time an end user consumes it. This would allow organizations and people to have more trust in the media they consume. JP: If there was one thing you could change about open source and open standards communities, what would it be? JB: So my M.O. is to try and make these spaces more human interoperable. With an open source project or open standards project, we’re talking about some kind of technical interoperability problem that we want to solve. But it’s not usually the technical issues that cause delays or serious issues — nine times out of ten; it comes down to some human interoperability problem. Maybe it’s language differences, cultural differences, or expectations — it’s process-oriented. There’s some other thing that may cause that activity to fail to launch. So if there were something that I could do to change communities, I would love to make sure that everybody has resources for running great and effective meetings. One big problem with some of these activities is that their meetings could be run more effectively and more humanely. I would want humane meetings for everyone. JP: Humane meetings for everyone! I’m pretty sure you could be elected to public office on that platform. <laughs>. What else do you like to do with your spare time, if you have any? JB: I love to read; we’ve got a book club at OpenJS that we’re doing, and that’s fun. So, in my spare time, I like to take time to read or do a crossword puzzle or something on paper! I’m so sorry, but I still prefer paper books, paper magazines, and paper newspapers. JP: Somebody just told me recently that they liked the smell of paper when reading a real book. JB: I think I think they’re right; I think it feels better. I think it has a distinctive smell, but there’s also something very therapeutic and analog about it because I like to disconnect from my digital devices. So you know, doing something soothing like that. I also enjoy painting outdoors and going outside, spending time with my four-year-old, and that kind of thing. JP: I think we all need to disconnect from the tech sometimes. Jory, thanks for the talk; it’s been great having you here. The post Interview with Jory Burson, Community Director, OpenJS Foundation on Open Source Standards appeared first on Linux Foundation. The post Interview with Jory Burson, Community Director, OpenJS Foundation on Open Source Standards appeared first on Linux.com. View the full article
-
- interviews
- javascript
-
(and 3 more)
Tagged with:
-
javascript Applying JavaScript’s setTimeout Method
Linux Hint posted a topic in Development & Programming
With the evolution of the internet, JavaScript has grown in popularity as a programming language due to its many useful methods. For example, many websites use JavaScript’s built-in setTimeout method to delay tasks. The setTimeout method has many use cases, and it can be used for animations, notifications, and functional execution delays.Because JavaScript is a single-threaded, translative language, we can perform only one task at a time. However, by using call stacks, we can delay the execution of code using the setTimeout method. In this article, we are going to introduce the setTimeout method and discuss how we can use it to improve our code. The setTimeout method is a built-in method that takes a callback function as an argument and executes it after a given amount of time. The syntax for the setTimeout method is as follows: setTimeout(callbackFunction, delay, arguments...) The callbackFunction is the function we want to execute after a given amount of time; the delay is the time in milliseconds after which we want to execute the callback function; and the arguments are other parameters we want to pass to the callback function. Now, we will apply the setTimeout method. First, we define a function called linuxhintFunc that prints the string “Hello from Linuxhint.” function linuxhintFunc() { console.log("Hello from Linuxhint."); } Next, we call linuxhintFunc in setTimeout and provide a time delay of 2000 ms (2 s). setTimeout(linuxhintFunc, 2000) Once the web page is loaded, there is a delay of 2 s before the function is called. We can perform the same task using the arrow function or an anonymous function. setTimeout(() => { console.log("Hello from the Linuxhint"); }, 2000) Again, there is a delay of 2 s. Note: The setTimeout method is an asynchronous method, which means that, although JavaScript is a single-threaded language, this function runs on a different thread. The setTimeout method places the function in the queue of the call stack and waits until the call stack is free. If we try to print a message or run a function in setTimeout without a delay, then this action would be jump to the front of the queue first and run when the setTimeout method is executed. console.log("Hello from the Linuxhint-1") setTimeout(() => { console.log("Hello from the Linuxhint-2") }, 0) console.log("Hello from the Linuxhint-3") Looking at the output, the order of the output is not the same as that of the input. Therefore, the setTimeout function can delay the execution of code. Conclusion This article introduces JavaScript’s built-in setTimeout method and discussed how we can use it. We hope that you learned something from this article and that you continue learning about JavaScript with linuxhint.com. View the full article -
Javascript is the language of freedom yet is a function-oriented language at the same time. Unlike other languages, javascript does not provide a built-in sleep() function. You can either build a custom sleep() function using the built-in setTimeout() function, or the latest ECMAScript promises an async-await function. This article shows you how to stop or pause the execution of the sleep function for a desired amount of time using promises or async-await functions... View the full article
-
Do you love JavaScript? Did you write a new framework or library? Do you want to showcase your emulator able to run Windows 98 in Chrome? Or finally got that retro game to run in the browser? THIS IS THE CONFERENCE FOR YOU! Join us for the online conference Conf42.com: JavaScript, that’s all about JavaScript and the crazy things you can do with it! We’re looking for presenters on topics such as: new frameworks and libraries for JavaScript languages that compile into JavaScript Node.js new, innovative uses of JS anything that makes it easier to build frontends JavaScript games https://www.papercall.io/conf42-javascript-2021
-
- event
- javascript
-
(and 1 more)
Tagged with:
-
Javascript is a web-oriented programming language. When using the web, you will often need to navigate through pages. When you click on any button, submit a form, or log in to any website, you get redirected to a different new page. Page redirection is an essential part of any website, but it is not only restricted to page navigation on a website. There can be multiple reasons to redirect the page, for example: The old domain name is changed to a new domain Submission and Authorization of a form On the base of the browser or language of the user Redirect from HTTP to HTTPS This article explains a few different ways to redirect a page. Syntax The syntax for navigating to a page using javascript is as follows: window.location.href = "url" In this method, you simply provide the URL to which you want to redirect the user. The syntax for another method of redirecting a user to a new URL is as follows: window.location.replace("url") // or window.location.assign("url") In this functional syntax, you provide the URL to which you want to redirect, and whenever this function is called, you will be redirected to that specific URL. Here, “replace” and “assign” do the same task but with a subtle difference. They both redirect to a new URL, but “replace” does not take the record of history and the user cannot go back to the old URL or previous page. Meanwhile, “assign” keeps the history record and allows the user to go back to the previous page. We will now look at some examples of both syntaxes. Examples First, we will create an on-click function on a button. <button onclick="redirectFunction()">Linuxhint</button> This function will redirect the user to the website “https://www.linuxhint.com.” function redirectFunction() { window.location.href = "https://www.linuxhint.com" } Now, if the user clicks on the button, they will be redirected to linuxhint.com In this next example, say, you want to redirect the user from an old domain to the new domain. For testing purposes, suppose the current address is the localhost, but whenever the user enters the URL of the localhost, the user gets redirected from the localhost to the new URL, which is linuxhint.com in this example. This is easier to do than you may think. To do this, simply use the syntax of the second redirect method: window.location.replace("https://www.linuxhint.com") Now, if the user enters the localhost URL, they will be redirected to linuxhint.com. But, if you look at the top-left button of the browser for going back to the previous page: the button is dulled and the browser is not allowing us to go back to the previous page. However, if you want to keep this option for the user, you can use “assign” instead of “replace.” window.location.assign("https://www.linuxhint.com") And now, if you look at the top-left button of the browser for going back to the previous page: The button is not dulled. You can go back to the previous page. It is recommended to use “replace” instead of “assign,” here, because the purpose of redirecting to a new URL is that the old URL is not working or not available anymore. Conclusion This article explained a few different methods of redirection in javascript, along with real-life examples using these methods. In this article, you have learned how to navigate to a new page and how to redirect from the old URL to a new URL. You can learn more about javascript at linuxhint.com. View the full article
-
Forum Statistics
67.7k
Total Topics65.6k
Total Posts