AWS |
AWS |
Marathon Oil: Automating Drone Image Processing to Monitor Equipment Health |
https://www.youtube.com/watch?v=ww5fiygF6eg
|
Marathon Oil Automating Drone Image Processing to Monitor Equipment HealthMarathon Oil is an independent energy company engaged in hydrocarbon exploration and performs regular drone flights of well pads as part of its program for emissions monitoring and plant maintenance To automate the processing of their drone flight imagery Marathon Oil leverages a serverless architecture on AWS Marathon Oil runs CloudWatch events on a scheduled basis to trigger a state machine in AWS Step Functions The event driven architecture then calls a series of AWS Lambda functions to determine when new images are available for processing store the images on Amazon S and further optimize the images in Amazon S With the images in Amazon S AWS Storage Gateway allows the team to access image files from their on prem mapping applications to Amazon S without re writing their existing applications With this architecture Marathon Oil s maintenance and operations teams are able to automate the entire workflow process to detect anomalies in their well pads for health checks and preventative maintenance Check out more resources for architecting in the AWScloud AWS AmazonWebServices CloudComputing ThisIsMyArchitecture |
2022-03-16 17:38:50 |
Google |
Official Google Blog |
Introducing Related search for content pages |
https://blog.google/products/adsense/introducing-related-search-content-pages/
|
Introducing Related search for content pagesWe re always looking for ways to help publishers make more money through high quality ads AdSense for search already plays an important role by allowing publishers to monetize search results on their own website or mobile app And today we re introducing Related search for content in AdSense for search a new feature for publishers to create even more useful search experiences on their sites Related search for content is a contextual navigation unit that shows users search terms related to the page they re viewing on a publisher s website When they click a search term they re taken to a search results page on the publisher s site where they can explore other relevant topics including search ads As a result Related search for content can help publishers increase site engagement ーincluding site traffic pageviews and ad impressions ーand drive incremental revenue As a contextual unit Related search for content is a privacy preserving solution It uses page content instead of user data to deliver relevant search terms Meanwhile ads on the search page target the search term the user clicked on rather than actual user data If you re interested in using Related search for content please contact your account manager to activate AdSense for search for your AdSense account For more information and future updates check out our help page |
2022-03-16 17:30:00 |
海外TECH |
Ars Technica |
Tesla fires employee who posted YouTube videos of Full Self-Driving accident |
https://arstechnica.com/?p=1841482
|
collision |
2022-03-16 17:26:54 |
海外TECH |
Ars Technica |
NASA releases first image from an in-focus Webb telescope |
https://arstechnica.com/?p=1841522
|
galaxies |
2022-03-16 17:09:03 |
海外TECH |
MakeUseOf |
6 Tips for Using Microsoft OneNote as Your To-Do List |
https://www.makeuseof.com/tag/x-ways-super-charge-list-onenote/
|
microsoft |
2022-03-16 17:46:16 |
海外TECH |
MakeUseOf |
A Beginner's Guide to Tailwind CSS in React |
https://www.makeuseof.com/tailwind-css-in-react/
|
tailwind |
2022-03-16 17:30:16 |
海外TECH |
DEV Community |
Combining dbt Metrics with API, Caching, and Access Control |
https://dev.to/cubejs/combining-dbt-metrics-with-api-caching-and-access-control-2li8
|
Combining dbt Metrics with API Caching and Access ControlIf you re using dbt to transform data in your data warehouse and you re excited about dbt Metrics feature here s how you can add caching access control and a variety of APIs such as REST GraphQL or SQL on top dbt quickly became the major part of the modern data stack and the favorite tool of data practitioners As Cube community grows especially among data engineers we more often see dbt being used upstack from Cube to define transformations and data model After a community driven feature proposal for dbt Metrics and an insightful discussion that followed our community requested an integration with dbt that would allow keeping metrics definitions in dbt as the single source of truth while leveraging the rest of Cube dbt Metrics meet Cube the headless BI platformAt Cube we are building headless business intelligence and want to make data accessible and consistent across every application ranging from embedded analytics to internal dashboarding and reporting tools It s an amazing opportunity for us to integrate with dbt Metrics enhance it with Cube s caching and access control and deliver to every application via our SQL REST and GraphQL APIs Today we are happy to announce an integration with dbt Metrics Cube can now read metrics from dbt merge them into Cube s data model provide caching and access control and expose metrics via our APIs to downstream applications In the tutorial below we ll use dbt to define metrics Cube to apply caching and get a x performance boost provide access control and expose data to Apache Superset via Cube s SQL API and to other tools and applications via our REST API or GraphQL API Building a metrics layer with dbt MetricsEverything starts with a great dataset so I ve taken GitHub Activity Data a snapshot of more than million open source repositories on GitHub publicly available on Google Cloud Platform As of March it contains information about million unique commits their authors messages files etc Let s say we re interested in learning all about productivity of individuals and teams expressed in the number of commits and commit message lengths We would start with defining a dbt model like this in commits sql SELECT TIMESTAMP SECONDS author time sec AS timestamp author email AS author id author name AS author name REGEXP EXTRACT author email r AS author domain LENGTH subject AS subject length LENGTH message AS message lengthFROM bigquery public data github repos commits The next step would be to add the dbt metrics definitions into schema yml version metrics name commits count label Commits Count model ref commits description A count metric for commits type count timestamp timestamp time grains day week month year dimensions author domain author name name users count label Users Count model ref commits description A count metric for users type count distinct sql author id timestamp timestamp time grains day week month year dimensions author domainDefined metrics will be available for programmatic introspection via Metadata API and manual exploration in GraphiQL IDE Exposing dbt Metrics via an APIAs a headless BI platform Cube consists of four logical layers metrics acceleration access control and API Our metrics layer is able to read metrics definitions from dbt via the Metadata API and translate them into equivalent Cube data model You can get started with Cube within minutes in Cube Cloud or set up Cube locally with Docker You ll need to provide the credentials for your data warehouse there are plenty of data sources supported by Cube Next connecting Cube to dbt is as trivial as adding this code snippet to your data model import dbt from cubejs backend dbt schema extension import dbtJobId dbtApiKey from config asyncModule async gt await dbt loadMetricCubesFromDbtCloud dbtJobId dbtApiKey In an instant you ll be able to explore the data in Cube Playground Cube will take care of SQL generation and querying the data in your data warehouse that was previously transformed with dbt SELECT github commit stats commits author domain author domain github commit stats commits author name author name COUNT commits count FROM cube devrel team dbt prod commits AS github commit stats commits WHERE github commit stats commits author domain IN GROUP BY ORDER BY DESCLIMIT This gives you the luxury of using a plenty of API flavors provided by Cube SQL API ーto expose the metrics to popular BI tools e g Apache Superset check this tutorial to see it in action REST API ーto expose the metrics to even more BI tools e g Appsmith Bubble or Retool or integrate Cube into your report generation or machine learning pipelineGraphQL API and integrations with popular front end frameworks such as React Angular and Vue ーfor embedded analytics in custom built applications check one of many tutorials that we have Fetching data via the REST API is as simple as sending a JSON encoded query and parsing the JSON encoded result set Cube provides convenient JavaScript client libraries for that purpose but even a curl or wget call will work just great Bringing the same data into Apache Superset or another data visualization tool via Cube s SQL API requires just a few clicks in the UI that will yield an equivalent SQL query and result set Take a closer look Superset generates a fairly straightforward SQL query shown on the screenshot above and sends it to Cube Actually you can write your custom SQL queries like the one below where you can reference measures and dimensions from your data model Curious what MEASURE commitsCount is Well we see a lot of value in valid SQL that why you can list your dimensions in the GROUP BY statement and enclose your measures using the MEASURE aggregate function if your BI tool of choice would generate something like COUNT instead of MEASURE Cube will readily accept that too SELECT authorDomain MEASURE commitsCount FROM db GithubCommitStatsCommits WHERE authorDomain IS NOT NULLGROUP BY authorDomainNow we ve learned how dbt Metrics can be exposed to other tools via various APIs provided by Cube Next let s explore how dbt users can leverage Cube s acceleration and access control layers Accelerating dbt Metrics with pre aggregationsCube s acceleration layer serves as a smart cache on top of the metrics layer Based on the configuration provided Cube will pre emptively fetch data from the data warehouse pre aggregate it into analytical rollups and store them in Cube Store a custom built distributed data store in a columnar format In most cases Cube Store enables Cube to fulfill API requests within ms and allows for concurrencies up to QPS You can see on the Apache Superset screenshot above that an unaccelerated request took more than seconds Of course if we run the same request once again we ll get the result mush faster because it will be cached by Superset Let s see what can be done so any request would yield a sub second response at all times The Cube way to achieve this is to use pre aggregations We ll extend the data model with a new cube think “a namespace for metrics containing the same metrics and a single pre aggregation cube GithubCommitStatsCommitsCached extends GithubCommitStatsCommits preAggregations main measures commitsCount dimensions authorDomain authorName timeDimension timestamp granularity day partitionGranularity year This caching configuration instructs Cube to use the main pre aggregation for all queries that match it i e contain a subset of listed measures and dimensions It also says that day is the minimum time grain we re interested in using On top of that it advises Cube to split the pre aggregated data into partitions one per year and distribute these partitions across all Cube Store nodes so they all can be used in parallel to fulfil queries That s basically it Cube will seamlessly build the pre aggregation store it in Cube Store and transparently dispatch queries that match it against Cube Store rather that the original data source e g BigQuery Here s a side by side comparison of the query hitting BigQuery s ️ and the same query fulfilled by a pre aggregation in Cube Store ms Also note that depending on your usage patterns not hitting your cloud data warehouse for every client side query might not only improve the performance of your data application but allow for a substantial total cost reduction That s how Cube s acceleration layers works What about access contol Securing dbt Metrics and implementing multitenancyCube s access control layer lets you manage who is able to access data and which data it is Subsequently Cube has built in mechanisms for row level security and multitenancy You can mandate that every query need to be accompanied by a security context think “securely signed set of credentials and meta data that identifies a user or an application running a query Cube allows you to validate the security context and the query possibly amending the contents of the query to enforce access control rules We ll use the queryRewrite extension point to require certain meta data to be provided with every query and used in a mandatory filter With this configuration no query can be run “unfiltered module exports queryRewrite query securityContext gt if securityContext domain throw new Error Please specify the domain query filters push member GithubCommitStatsCommitsCached authorDomain operator equals values securityContext domain return query If anyone tries they ll get an error message However with a security context provided see its JSON representation below the query will yield the properly filtered results according to access control rules And that s the shortest demo of how Cube s access control layers works Next steps for dbt usersPlease feel free to check out the full source code of dbt models and the Cube project shown above on GitHub Also don t hesitate to give Cube a star on GitHub as well as to follow us on Twitter or LinkedIn If you re a dbt user and you haven t tried dbt Metrics please do You ll be able to abstract your metrics definitions from the presentation layer and keep them in the single source of truth Note that as of March dbt Metrics are still an experimental feature so if things doesn t work as expected please provide your feedback and find the time to file issues in dbt s GitHub repository That is much appreciated Also if you see the value in integrations with BI tools and custom built applications as well as query acceleration and access control that are built into Cube please follow the steps outlined in this tutorial and share your success or ask questions in Cube s Slack community |
2022-03-16 17:32:43 |
海外TECH |
DEV Community |
If you’re interested in WebAssembly, and don’t get enough depth here on DEV, read this… |
https://dev.to/devteam/if-youre-interested-in-webassembly-and-dont-get-enough-depth-here-on-dev-read-this-pfl
|
If you re interested in WebAssembly and don t get enough depth here on DEV read this…WASM Builders is the new Forem in town If you click that link you ll find the new WebAssembly Forem run by a consortium of deeply engaged companies looking to expand the impact of WebAssembly It will always be our goal to help people keep up with software trends and level up here on DEV but it s not always conducive to going deep on the topics you care about That s why we are encouraging other developer focused Forems to get up and running with this form factor If you re in to this space you re probably keeping up with it in a variety of places but we expect this to ultimately be a really important async first community driven knowledge base for the world of WebAssembly We believe a healthy web is a distributed one The software world is community driven and curation and community leadership needs to be pushed closer to the edge If you are interested in going deeper with WebAssembly and keeping up with the bleeding edge in the space we highly encourage you to join WASM Builders DEV has a lot to offer on WASM but we feel that we ll be the most helpful by letting technologystakeholders own their own outcomes via a dedicated own Forems For a great intro to WebAssembly… WebAssembly is easy ーa hello world example Dorin・Jan ・ min read webassembly tutorial webdev javascript Congrats to WASM Builders and happy coding A lot of work has gone into generalizing the Forem ecosystem and we re starting to get rolling with our support of partner Forems There s still a limited number of Forems that we re able to hostt but progress is beginning to speed up We would love to host more specific developer ecosystem Forems that allow people to go deeper on a subject than we re able to offer with DEV For example Zig news is a self hosted Forem that offers this for the Zig programming language If you are part of an open source project or developer platform that wants to empower the broader community to co blog and share in discussions alongside the official maintainers or DevRel get in touch with us on forem com ーwe d love to partner on this work to make the internet a smaller and more helpful place for software communities in particular One last thing You ll notice “Sign up with Forem as an option alongside GitHub and email This is a service we now offer to most seamlessly navigate the ecosystem and manage your identity We want you to be able to bring your full self without having to bring your full data so making this distributed ecosystem as straightforward as possible in the long run is really important Create a Forem Account and connect it with your DEV account via settings Happy coding |
2022-03-16 17:20:43 |
海外TECH |
DEV Community |
AWS Play Game |
https://dev.to/murleedas/aws-play-game-45k5
|
AWS Play GameI am really excited to share a news that made me awestruck I still remember the fun and excitement I had while playing GTA Vice city during my childhood days What if I say you will gonna have the same fun and excitement while learning cloud Off course I am not kidding AWS has started first of such free initiatives a 𝐧𝐞𝐰𝐠𝐚𝐦𝐞 𝐛𝐚𝐬𝐞𝐝𝐫𝐨𝐥𝐞 𝐩𝐥𝐚𝐲𝐢𝐧𝐠𝐞𝐱𝐩𝐞𝐫𝐢𝐞𝐧𝐜𝐞 𝐜𝐚𝐥𝐥𝐞𝐝𝐀𝐖𝐒𝐂𝐥𝐨𝐮𝐝𝐐𝐮𝐞𝐬𝐭 𝐂𝐥𝐨𝐮𝐝𝐏𝐫𝐚𝐜𝐭𝐢𝐭𝐢𝐨𝐧𝐞𝐫 This is going to be an absolute treat for the new cloud learners With AWS Cloud Quest you can learn the fundamentals of cloud computing concepts like you play a game Expecting more such initiatives in all level which makes the learning very simple and engaging AWS also introduced yet another free initiative an 𝐞𝐧𝐡𝐚𝐧𝐜𝐞𝐝𝐀𝐖𝐒𝐄𝐝𝐮𝐜𝐚𝐭𝐞𝐩𝐫𝐨𝐠𝐫𝐚𝐦𝐨𝐟𝐟𝐞𝐫𝐟𝐫𝐞𝐞𝐡𝐚𝐧𝐝𝐬 𝐨𝐧𝐥𝐞𝐚𝐫𝐧𝐢𝐧𝐠 More details on I would like to request all the new and upcoming cloud learners to enrol and explore this cool game on |
2022-03-16 17:11:21 |
海外TECH |
DEV Community |
Drawing Basic Shapes with HTML Canvas |
https://dev.to/smpnjn/drawing-basic-shapes-with-html-canvas-pb3
|
Drawing Basic Shapes with HTML CanvasSince HTML canvas is a graphic tool it goes without saying that it allows us to draw shapes We can draw new shapes using a number of different functions available to use via the the context we set If you re brand new to HTML canvas start with my introduction article In this guide we ll cover how to make some of the most basic shapes with HTML canvas squares rectangles circles and triangles Creating Rectangles and Squares with HTML CanvasSquares and rectangles are easy to make in HTML Canvas There are a number of different rect functions we can use to makerect x y width height outlines where a rectangle or square should be but does not fill it fillRect x y width height creates a rectangle and immediately fills it strokeRect x y width height creates a rectangle and immediately outlines it with a stroke As you can see all of these functions follow the same format they have an x and y coordinate for where they start and a width and height within the canvas Let s look at some examples in code Clear Rectangle FunctionIf you want to learn about clearRect read my tutorial on that here Using rect to create a rectangleIf we want to use rect to create a rectangle and then fill and stroke it we need to define the fillStyle and strokeStyle For example the below code will create a rectangle starting at of dimensions x with a bff background and px wide white stroke Outcome let canvas document getElementById canvas let ctx canvas getContext d ctx rect ctx fillStyle bff ctx strokeStyle white ctx lineWidth ctx fill ctx stroke Using fillRect to create a rectanglefillRect lets us create a rectangle and automatically fill it with a specific color That means we don t have to use fill separately For example the following will fill a rectangle of the same size as before with a bff background let canvas document getElementById canvas let ctx canvas getContext d ctx fillStyle bff ctx fillRect Outcome Using strokeRect to create a rectanglestrokeRect follows a similar format only it will create a rectangle which is stroked automatically For example the below code will make a rectangle of the same dimensions and position as before with a px wide bff border stroke let canvas document getElementById canvas let ctx canvas getContext d ctx strokeStyle bff ctx lineWidth ctx strokeRect Outcome Creating Circles in HTML CanvasThe easiest way to create a circle in HTML Canvas is to use the arc function An arc doesn t have to draw a full circle though it can draw only part of a circle by changing the start and end angles Let s look at the syntax of ctx arc and how to make a circle ctx arc x y radius startAngle endAngle counterClockwise x refers to the x coordinate of the center of the circle y refers to the y coordinate of the center of the circle radius the radius of the arc we are drawing startAngle the angle at which the arc starts in radians endAngle the angle at which the arc ends in radians counterClockwise whether the angle goes counter clockwise default is false can be set to true If we set our startAngle to Radians it will start at the center right side of the circle A circle is πradians in diameter If we want to draw a full circle our startAngle is and our endAngle is π We can represent this in code using Math PI Here is our code to draw a circle with a px wide stroke in bff with a radius of px where its center point is let canvas document getElementById canvas let ctx canvas getContext d ctx arc Math PI false ctx strokeStyle bff ctx lineWidth ctx stroke Outcome Creating Semi Circles with HTML CanvasSince we can use arc to draw circles and adjust our endAngle we can also use it to draw a semi circle As a full circle is πin diameter a semi circle is only πradians The only extra step we have to do here is draw a line from the end of our semi circle back to the beginning again Since we are going to end at as our radius is px we draw a line with the lineTo function back to our starting point which is let canvas document getElementById canvas let ctx canvas getContext d ctx arc Math PI false ctx lineTo ctx fillStyle bff ctx fill Outcome We can flip our semi circle by changing the counter clockwise option to true ctx arc Math PI true Outcome Creating Ovals with HTML CanvasWe can draw an oval in HTML canvas by using the ellipse function It works in a very similar way to arc except we have two radius options ctx ellipse x y radiusX radiusY rotation startAngle endAngle counterClockwise x refers to the x coordinate of the center of the circle y refers to the y coordinate of the center of the circle radiusX the radius along the X axis of the arc we are drawing radiusY the radius along the Y axis of the arc we are drawing rotation how much we wish to rotate our ellipse shape in radians startAngle the angle at which the arc starts in radians endAngle the angle at which the arc ends in radians counterClockwise whether the angle goes counter clockwise default is false can be set to true Here is an example using the same concepts as we did before with arc let canvas document getElementById canvas let ctx canvas getContext d ctx ellipse Math PI false ctx fillStyle bff ctx fill Outcome Creating Triangle Shapes with HTML CanvasThere is no built in triangle function in Javascript so we have to use the lineTo and moveTo function instead All these functions do are draw lines on the context to specific points We use moveTo to determine the starting position of our triangle and then draw lines as appropriate to draw the shape of the triangle we want Here is an example where we draw a triangle and fill it with bff let canvas document getElementById canvas let ctx canvas getContext d ctx moveTo ctx lineTo ctx lineTo ctx lineTo ctx fillStyle bff ctx fill Outcome We start by using moveTo to determine the starting point of our triangle Then we draw a line from to i e px to the right and px down from our starting point Since this triangle will be symmetrical we draw a px to the left and px down i e Finally we join our shape up by drawing a line back to our starting point which was Then we fill it and we have a triangle The lineTo function can be used to draw many more complicated shapes in HTML Canvas which are not built in by default Any custom polygons will use lineTo such as Hexagons Octagons or even Parallelograms ConclusionIn this guide we ve covered how to make some simple shapes in HTML canvas squares rectangles circles and triangles We ve also touched upon the fact that lineTo can be used to draw a line anywhere on our canvas allowing us to make more complicated shapes like hexagons and octagons I hope you ve enjoyed this article |
2022-03-16 17:04:56 |
海外TECH |
DEV Community |
How to make a desktop app with html,css,js |
https://dev.to/dumboprogrammer/how-to-make-a-desktop-app-with-htmlcssjs-4a2n
|
How to make a desktop app with html css jsDid you know that you can make a desktop app with javascript There s a js framework for this named electron js I was thinking of making a tutorial about this Let s get into it Before starting I want you to have basic knowledge of HTML CSS JS node js installed in your system basic knowledge of node jsTable Of Contents Explaination Build Paybacks of using Electron Chapter Structure of an Electron js App Chromium This is the component in the Electron js structure that is responsible for creating and displaying web pages Web content is displayed in Electron js s Renderer process more on this later and due to the Chromium environment you have access to all browser APIs and development tools just like operating in a typical Google Chrome browser Node js This is the component in the Electron js structure that gives you access to system capabilities Electron js runs Node js in its Main process more on this later giving you access to all that Node js offers like interacting with the filesystem operating system etc and more Custom APIs To enable developers to create common desktop experiences and work easily with native functionalities Electron js has an API of easy to use libraries that help you perform tasks like creating and showing a context menu displaying desktop notifications working with keyboard shortcuts etc A running Electron js app maintains two types of processes the Main process and one or more Renderer processes The entry point is teh Main process The Main process is responsible for creating web pages It does this by creating a new instance of the Electron js BrowserWindow object This creates a new web page that runs in its own Renderer process The Main process can create more than one web page each running in its own Renderer process Typically Electron js applications boot up with a default web page which is the app s startup screen You can then create more screens if your application requires it Each Renderer process manages its own web page and is completely isolated from other Renderer processes and the Main process itself Thus if one Renderer process terminates it does not affect another Renderer process A Renderer process can also be terminated from the Main process by destroying its BrowserWindow instance Out of the box the Renderer process only has access to browser APIs like the window and document objects etc This is because the Renderer process is simply a running Chromium browser instance It can however be configured to have access to Node js APIs such as process and require Chapter Build a Simple Electron js ProjectNow it s time to get hands on Electron js experience In this tutorial you will be creating a simple desktop application a task list The goal is to create a desktop application from scratch and run it successfully To begin run the following commands from your preferred parent directory to create a folder for the project and then change directory into the new folder mkdir my electron appcd my electron appBecause an Electron js app is at heart a Node js application running web pages you ll need initialize the app and create a package json file by running the following command npm init yNext create the application home page by creating an index html file at the root of the project folder and add the following code lt DOCTYPE html gt lt html lang en gt lt head gt lt meta charset UTF gt lt meta name viewport content width device width initial scale gt lt title gt My Electron App lt title gt lt head gt lt body gt lt h gt Welcome to My Electron App lt h gt lt body gt lt html gt The HTML code above creates a simple webpage with a title that reads “My Electron App and an h tag in the body with the text “Welcome to My Electron App At this point you have a basic Node js application The next step is to convert your app into a desktop application using Electron js Start by installing the Electron js library Back in your command prompt still in your project s root directory run the following command npm install save dev electronOnce the installation is complete create a new file called main js This will be the entry point into the application it s the Main process script This script will do the following Create a web page for the application home screenLoad the application home screen when the Electron js app is booted upLoad the home screen when the app s icon is clicked if the app s windows are closed but the app is still runningIn your new file main js begin by importing the necessary packages and then creating a function whose job is to create a new web page for the application home screen import from electron const app BrowserWindow require electron const path require path load the main windowconst loadMainWindow gt const mainWindow new BrowserWindow width width of window height height of window webPreferences nodeIntegration true load the index html file mainWindow loadFile path join dirname index html In the code block above app the Electron js application object and BrowserWindow the Electron js module for creating and loading web pages are imported from the Electron js package The path module is also imported enabling you to work with the project directory After the imports you create the loadMainWindow function This function uses the BrowserWindow object to create a new px by px browser window that loads the index html file from the project s root Next beneath the existing code add a call to the loadMainWindow function so that the function is invoked immediately after the app boots up app on ready loadMainWindow The loadMainWindow only gets called when the ready event is emitted on the app The web page needs to wait for this event because some APIs can only be used after this event occurs The next step is to take care of an issue on some operating systems where the application still remains active even after all windows have been closed This often occurs on non MacOS platforms To fix this add the following below the existing code in main js app on window all closed gt if process platform darwin app quit This code instructs the app to listen for the window all closed event which is fired when all windows created by the Main process have been closed It then checks if the platform is MacOS and if not it explicitly quits the application ending the Main process and thus terminating the application The final step in this file is to ensure that the application boots up when its icon is clicked in the operating system s application dock when there are no windows open To achieve this add the following code at the end of the file app on activate gt if BrowserWindow getAllWindows length loadMainWindow This code listens for the activate event on the app When the event is emitted this code checks if there are any windows currently open that belong to the application If not the home screen is loaded by calling loadMainWindow That s it for the main js file Configure the ApplicationYou ll need to make some changes to your package json file to ensure that it s configured correctly to work with Electrion js Open your package json file Change the value of the main key to main js as shown below main main js Next add a start script to the scripts section like below scripts start electron test echo Error no test specified amp amp exit Save and close the file At this time you can run your new Electron js application with the following command npm startThis will boot up the application and load the home screen window Create a Simple Task List SystemIn order to learn some other features of Electrion js you will be creating a bare bones task list system To begin you ll add some basic content to your app s home screen Open the index html file and add the Bootstrap library just below the meta tags in the head section as shown below lt head gt lt meta charset UTF gt lt meta name viewport content width device width initial scale gt lt link rel stylesheet href dist css bootstrap min css integrity sha TXtEcREe ihUzmQxVncDAyuIKzrEkgIXeMedMjlfIDPvguqKIxXr crossorigin anonymous gt lt title gt My Electron App lt title gt lt head gt Next inside the body element below the h tag add the highlighted lines to create a two column layout The first column will contain the task list lt body gt lt h gt Welcome to My Electron App lt h gt lt div class container gt lt div class row gt lt div class col md gt lt ul id list class list group gt lt li class list group item gt Buy Groceries lt li gt lt li class list group item gt Cook Meal lt li gt lt ul gt lt div gt lt div class col md gt lt div gt lt div gt lt div gt lt body gt If the app is currently running close it by pressing Ctrl Cin your command prompt and restart it by running npm start Add a New Item to the Task ListIn your index html file add a form input and button element The user will interact with these elements to add new items to the task list To add these elements copy and paste the highlighted lines into the second column of the two column grid lt body gt lt h gt Welcome to My Electron App lt h gt lt div class container gt lt div class row gt lt div class col md gt lt ul id list class list group gt lt li class list group item gt Buy Groceries lt li gt lt li class list group item gt Cook Meal lt li gt lt ul gt lt div gt lt div class col md gt lt input class form control id newTask placeholder Enter New Task gt lt br gt lt button type button class btn btn primary id addTask gt Add Task lt button gt lt div gt lt div gt lt div gt lt body gt Now create a new JavaScript file called script js at the root of the project and import it into the index html file as shown below lt head gt lt meta charset UTF gt lt meta name viewport content width device width initial scale gt lt link rel stylesheet href dist css bootstrap min css integrity sha TXtEcREe ihUzmQxVncDAyuIKzrEkgIXeMedMjlfIDPvguqKIxXr crossorigin anonymous gt lt script src script js gt lt script gt lt title gt My Electron App lt title gt lt head gt Inside the script js file add the following code let list document getElementById list let newTask document getElementById newTask document getElementById addTask addEventListener click gt list insertAdjacentHTML beforeend lt li class list group item gt newTask value lt li gt newTask value In the code above a click event handler is added to the button element you added in index html When the button is clicked the value of the input field is inserted into a new lt li gt element which is appended to the task list Now quit the application and restart Try adding a few new items by typing in the input field and clicking the Add Task button It works right THE POWERR OF FEELIN ConclusionElectron js is a game changer in the world of application development as it gives web developers the ability to enter the native application development space with their existing set of skills Chapter lt a name chapter gt lt a gt Paybacks High RAM consumption Electron apps tend to use a minimum of MB of RAM with lightweight apps in the MB range and monsters like Slack sometimes reaching multi GB values Large storage footprint Shipping with a full Chromium runtime you can expect most Electron apps to consume at least MB of storage Slow Some Electron apps are definitely slow but that can depend on many factors Overuse of animations for example can substantially increase the CPU usage and thus make the app feel slower Did you notice that most desktop apps that feel snappy don t include any animation Just because you can with Electron doesn t mean you should Lack of native UI UX Electron renders webpages and not native controls On one hand that gives complete freedom to designers but on the other the app looks different from the “native ones Unsurprisingly this complaint usually comes from macOS users where a single “native framework exists Cocoa Due to the fragmentation of GUI frameworks on other platforms especially Windows non macOS users are usually more tolerant of apps not sharing the same look and feel Worse security Compared to the average website running on your web browser Electron apps are incredibly more powerful and dangerous thanks to the NodeJS integration If not properly configured web pages running inside Electron can gain access to the entire system which is particularly dangerous when displaying third party websites Luckily it doesn t have to be that way as Electron provides Context Isolation to shield the renderer from NodeJS APIs Moreover some believe that the NPM ecosystem is less secure than other counterparts |
2022-03-16 17:03:21 |
海外ニュース |
Japan Times latest articles |
Japan assesses damage after 7.3 magnitude quake strikes off east coast |
https://www.japantimes.co.jp/news/2022/03/17/national/japan-earthquake-tohoku-march-16/
|
Japan assesses damage after magnitude quake strikes off east coastA magnitude earthquake struck the northeastern prefectures of Miyagi and Fukushima on Wednesday night registering an upper on Japan s intensity scale |
2022-03-17 02:22:36 |
ニュース |
BBC News - Home |
Nazanin Zaghari-Ratcliffe and Anoosheh Ashoori on way home to UK |
https://www.bbc.co.uk/news/uk-60756870?at_medium=RSS&at_campaign=KARANGA
|
anoosheh |
2022-03-16 17:18:52 |
ニュース |
BBC News - Home |
Zouma brothers to be prosecuted by RSPCA over cat video |
https://www.bbc.co.uk/sport/football/60771710?at_medium=RSS&at_campaign=KARANGA
|
Zouma brothers to be prosecuted by RSPCA over cat videoThe RSPCA says it has started the process of bringing a prosecution against West Ham s Kurt Zouma and brother Yoan for their roles in filming Kurt kicking a cat |
2022-03-16 17:16:16 |
ニュース |
BBC News - Home |
Family of Anoosheh Ashoori delighted at his release |
https://www.bbc.co.uk/news/uk-60765615?at_medium=RSS&at_campaign=KARANGA
|
anoosheh |
2022-03-16 17:39:45 |
ニュース |
BBC News - Home |
Nazanin Zaghari-Ratcliffe: Husband looks forward to 'new life' |
https://www.bbc.co.uk/news/uk-60769658?at_medium=RSS&at_campaign=KARANGA
|
husband |
2022-03-16 17:29:58 |
ニュース |
BBC News - Home |
MP's message to Nazanin's daughter: 'Mummy really is coming home' |
https://www.bbc.co.uk/news/uk-60772311?at_medium=RSS&at_campaign=KARANGA
|
daughter |
2022-03-16 17:25:03 |
ニュース |
BBC News - Home |
Tiger Roll denied fairytale farewell at Cheltenham after defeat by stablemate Delta Work |
https://www.bbc.co.uk/sport/horse-racing/60763047?at_medium=RSS&at_campaign=KARANGA
|
Tiger Roll denied fairytale farewell at Cheltenham after defeat by stablemate Delta WorkTiger Roll is denied a fairytale farewell Cheltenham Festival victory as he finishes second to stablemate Delta Work in the Cross Country Chase |
2022-03-16 17:43:52 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
「厳しくても尊敬される上司」と「部下のメンタルを壊す上司」の差は「この言葉」に表れる - だから、この本。 |
https://diamond.jp/articles/-/299116
|
「厳しくても尊敬される上司」と「部下のメンタルを壊す上司」の差は「この言葉」に表れるだから、この本。 |
2022-03-17 02:58:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
「予定調和がいやな人」がするべき、仕事のやり方とは? - 起業家の思考法 |
https://diamond.jp/articles/-/299132
|
予定調和 |
2022-03-17 02:56:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【東大生が投資のプロに教わる】謙虚な人は機会損失し、自信過剰な人がチャンスをつかむ理由 - 東大金融研究会のお金超講義 |
https://diamond.jp/articles/-/299177
|
【東大生が投資のプロに教わる】謙虚な人は機会損失し、自信過剰な人がチャンスをつかむ理由東大金融研究会のお金超講義年月に発足した東大金融研究会。 |
2022-03-17 02:54:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
ごはんも揚げ物も食べて大丈夫! 3か月で自然に痩せていくための 1週間のメニュー例【コンビニ・外食編】 - 3か月で自然に痩せていく仕組み |
https://diamond.jp/articles/-/299276
|
会食三昧なのに、このメソッドでキロも痩せた精神科医の樺沢紫苑先生が、「ストレスフリー我慢不要アウトプットレコーディングで痩せられる、脳科学的にも正しいメソッドです」と推薦する話題の書、「か月で自然に痩せていく仕組み意志力ゼロで体が変わる勤休ダイエットプログラム」野上浩一郎著から、そのコツや実践法を紹介していきます。 |
2022-03-17 02:52:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
アメリカの中学生が学ぶ「データ表現」の授業【全世界700万人が感動した「数学」ノート】 - アメリカの中学生が学んでいる14歳からの数学 |
https://diamond.jp/articles/-/299013
|
アメリカの中学生が学ぶ「データ表現」の授業【全世界万人が感動した「数学」ノート】アメリカの中学生が学んでいる歳からの数学年の発売直後から大きな話題を呼び、中国・ドイツ・韓国・ブラジル・ロシア・ベトナム・ロシアなど世界各国にも広がった「学び直し本」の圧倒的ロングセラーシリーズ「BigFatNotebook」の日本版が刊行される。 |
2022-03-17 02:50:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
がんばりすぎて疲れた人は、「距離感」を見直そう。人気星読みヒーラーが語る、風の時代の生き方とは? - 大丈夫じゃないのに大丈夫なふりをした |
https://diamond.jp/articles/-/298910
|
風の時代 |
2022-03-17 02:48:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
「大学の授業がつまらない」悩みへの目からウロコの回答 - 独学大全 |
https://diamond.jp/articles/-/297616
|
目からウロコ |
2022-03-17 02:46:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【カンタンなのに料亭風! レンチンレシピ】 ふっくらむね肉に甘酸っぱさが合う! さっぱりテイストのレモン蒸し鶏 - 銀座料亭の若女将が教える 料亭レベルのレンチンレシピ |
https://diamond.jp/articles/-/298371
|
【カンタンなのに料亭風レンチンレシピ】ふっくらむね肉に甘酸っぱさが合うさっぱりテイストのレモン蒸し鶏銀座料亭の若女将が教える料亭レベルのレンチンレシピ『銀座料亭の若女将が教える料亭レベルのレンチンレシピ』から、煮ない・焼かない・炒めない【つの具材】と【つのステップ】で、すぐ美味しいレシピを紹介。 |
2022-03-17 02:44:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【精神科医が教える】 もっとも残念な問題解決法とは? - 精神科医Tomyが教える 心の荷物の手放し方 |
https://diamond.jp/articles/-/299119
|
voicy |
2022-03-17 02:42:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【700万人が感動したノートで学ぶ】意外と知らないコンピュータの歴史 - アメリカの中学生が学んでいる14歳からのプログラミング |
https://diamond.jp/articles/-/299251
|
【万人が感動したノートで学ぶ】意外と知らないコンピュータの歴史アメリカの中学生が学んでいる歳からのプログラミング年の発売直後から大きな話題を呼び、中国・ドイツ・韓国・ブラジル・ロシア・ベトナムなど世界各国にも広がった「学び直し本」の圧倒的ロングセラーシリーズ「BigFatNotebook」の日本版が刊行された。 |
2022-03-17 02:40:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
「魅力的な企画を生み出し、提案上手にもなれる」4段階企画書術とは? - 商品はつくるな 市場をつくれ |
https://diamond.jp/articles/-/299310
|
魅力 |
2022-03-17 02:38:00 |
北海道 |
北海道新聞 |
首相「原発の異常確認なし」 帰宅困難者対応、交通機関に要請 |
https://www.hokkaido-np.co.jp/article/657818/
|
交通機関 |
2022-03-17 02:37:00 |
北海道 |
北海道新聞 |
東北新幹線、福島―白石蔵王間で脱線 乗客100人、けが人なし |
https://www.hokkaido-np.co.jp/article/657815/
|
東北新幹線 |
2022-03-17 02:34:09 |
北海道 |
北海道新聞 |
福島第2原発でプール冷却停止 女川も、福島第1は火災警報 |
https://www.hokkaido-np.co.jp/article/657817/
|
原子力規制庁 |
2022-03-17 02:31:47 |
北海道 |
北海道新聞 |
宮城と福島で震度6強 各地の主な震度 |
https://www.hokkaido-np.co.jp/article/657811/
|
震度 |
2022-03-17 02:24:18 |
コメント
コメントを投稿