投稿時間:2022-04-12 05:24:58 RSSフィード2022-04-12 05:00 分まとめ(30件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
AWS AWS Compute Blog Building an event-driven application with Amazon EventBridge https://aws.amazon.com/blogs/compute/building-an-event-driven-application-with-amazon-eventbridge/ Building an event driven application with Amazon EventBridgeIn event driven architecture services interact with each other through events An event is something that happened in your application for example an item was put into a cart a new order was placed Events are JSON objects that tell you information about something that happened in your application In event driven architecture each component of the … 2022-04-11 19:23:15
python Pythonタグが付けられた新着投稿 - Qiita PyTorchでCPUよりGPUの方が遅いケース https://qiita.com/sugimochi_1019/items/5c7e2ee4652817d3549f pytorch 2022-04-12 04:21:20
海外TECH MakeUseOf Kindle Case vs. Sleeve: Which Should You Use? https://www.makeuseof.com/kindle-case-vs-sleeve-which-should-you-use/ kindle 2022-04-11 19:15:17
海外TECH DEV Community Those pesky Shadow APIs https://dev.to/noablst/those-pesky-shadow-apis-2g1m Those pesky Shadow APIsIn only a few weeks at BLST Security the team piqued my interest specifically around a buzzword whether it was the Zombie API or the Shadow API heck I had no clue what that was and I ve started to research the term The searching journey led me into the early days Before we venture into the shadows of APIs give our API security GitHub repo a In the early days of the web only a few companies had APIs Those that did did so for internal use only Today APIs are how the internet works They are how companies interact with each other and how developers access data There are now thousands of APIs across all industries and the number is growing every day The growth of APIs has been explosive and it shows no signs of slowing down The reasons for this growth are many First APIs are now seen as an essential part of doing business on the internet Companies that don t have an API are at a competitive disadvantage Second the rise of mobile devices has led to a need for APIs that can be accessed from mobile devices APIs have been growing a lot because companies are trying to make their APIs work better for mobile devices This has been a big reason for this Third the rise of the cloud has made APIs more important than ever Cloud based services need APIs to function and this has led to a boom in cloud based APIs Fourth the growth of the internet of things has created a need for APIs that can control and connect devices This will be a major driver of API growth in the coming years Finally the rise of artificial intelligence and machine learning has created a need for APIs that can provide access to data and services This is a major growth area for APIs and one that is only getting started So what does the future hold for APIs More growth more innovation and more competition The API economy is booming and it shows no signs of slowing down The birth of a shadow APIThe shadow API evolves as the needs of developers change As the needs of the developer community change new features are added or old features are changed There are a few dangers associated with shadow API use in an organization First shadow APIs can be used to bypass security controls and access sensitive data This could lead to data leaks or theft Second shadow APIs can be used to circumvent governance controls leading to uncontrolled data growth and sprawl Finally shadow APIs can be used to make applications depend on things that aren t well managed which can hurt performance and stability Shadow APIs are abused when developers use them to access sensitive data or perform actions that are not intended for the API This can result in data leaks or security vulnerabilities Shadow API Abuse examplesMaking unauthorized calls to another user s dataManipulating or deleting data without proper permissionUsing shadow API calls to distribute viruses or malwareUsing shadow API calls to engage in denial of service attacksYou can go even deeper about Shadow API reading on APImike com who has a good article about the term After you read all about shadow APIs and even Rogue APIs your welcome to test our OAS scanner over at and find all your Shadow APIs zombies etc 2022-04-11 19:43:53
海外TECH DEV Community The difference between Design Patterns and Design Principles https://dev.to/andrewsavetchuk/the-difference-between-design-patterns-and-design-principles-104n The difference between Design Patterns and Design Principles Design PatternsDesign Patterns are techniques for how to design and architect your code They are low level solutions related to the implementation to real world problems that arise again and again so instead of inventing the wheel we follow design patterns that are well proven tested by others and safe to follow Design Patterns offer a specific implementation for a specific object oriented programming problem Each design pattern has a different use case and applies to a different scenario Examples of Design Patterns Active Record Pattern A database table or view is wrapped into a class Singleton Pattern One class can only have one instance at a time Design PrinciplesDesign Principles are the best practices and core abstract high level principles to ensure scalable software architecture and mastery In most cases you need to follow them to have quality code For example the Single Responsibility Principle SRP suggests that a class should have only one reason to change This is a high level statement that we should keep in mind while designing or creating classes for our application SRP does not provide specific implementation steps and it is up to developers how they implement it in their applications Some principles imply some design patterns For example the Open Closed principle closely implies the Strategy pattern Meanwhile the Dependency Injection principle has strong ties to the MVC pattern Examples of Design Principles Single Responsibility PrincipleOpen Closed PrincipleLiskov Substitution PrincipleInterface Segregation PrincipleDependency Inversion Principle TL DRDesign Patterns are applied to specific common problems You should have a very good reason every time you decide to implement a pattern Design Principles are applied to all programming You should have a very good reason every time you decide not to follow principles Sourceruby on rails What s the difference between design patterns and design principles Stack OverflowThe end I hope you found this article helpful Stay tuned for more content If you want to support me you can buy me a coffee 2022-04-11 19:26:45
海外TECH DEV Community Commit early, commit often https://dev.to/elisboa/commit-early-commit-often-2c3g Commit early commit often IntroductionIt has been commonplace that people are kind of afraid of commiting It s not rare to see big heavy changes in one single commit And this is not good since it will not be easy to code review There are many many ways to improve commits and this goes through two simple tips standardize your commits and create more branches Let s talk about them a bit Standardize your commitsIt is very important to have a standard because it makes it easier to read and also to reuse commit messages changing only specific details depending on the changes being made It depends of the chosen flow which generally is previously agreed with other team members There are many options available and lately I have been using gitmoji dev as a support Create more branchesMaybe because of subversion people think that branching maybe creeate some overhead on the project But that is not true I see branching along with git messages part of the documentation They must explain directly what is being done If a feature branch is created and two people are working on that tasks must be defined and each sub branch should be created for each person Then one approves the changes of the other and vice versa ConclusionRegarding the commits along with standardization I also like to commit empty changes using git commit allow empty to mark the beginning of a branch or some intermediate and important point Branching per se may lead to a branch hell problem but only if they are not properly managed A branch must be created and them when it s purpouse is reached the pull request or merge request must be created approved or rejected and them the branch must be deleted And that s it If you have any doubts or suggestions let me know in the comments below Cheers 2022-04-11 19:23:11
海外TECH DEV Community "How to create list from a grid present in a file" https://dev.to/yeskamal/how-to-create-list-from-a-grid-present-in-a-file-2cpm quot How to create list from a grid present in a file quot I have a file containing I just want to read the grid and store into a dynamic array Could anyone please help me this 2022-04-11 19:22:58
海外TECH DEV Community Why Software Development? https://dev.to/atomikjaye/why-software-development-267h Why Software Development I m coming up on my first milestone of being at a bootcamp So far it s been beneficial I love my classmates and the instructors have been very helpful and accommodating We ve just finished up our JavaScript module I ve had experience with JavaScript before but I still learned a lot One of our assignments is to answer the question “Why did you want to pursue Software Development As easy as this question is I still find it hard to answer What exactly is my “why Have I chosen Software Development for the “dolla bills or have I chosen it simply because it s “the in thing to do I ll start to answer this question by going back to my first encounter with code My interests in programming started back in Myspace days Being able to personalize your page and making it an expression of who you are was amazing to me Myspace taught a whole bunch of teenagers and young adults how to code Questions I asked were “How do I hide my top “How do I change my background In order to solve these complex teenage problems HTML and CSS was the answer I managed to use my Myspace skills to build a WordPress website to make and share Myspace graphics Glitters I gotchu div layouts Check I did it all There was something special about making something come to life from a rather mundane page that excited me I spent my summers a̶v̶o̶i̶d̶i̶n̶g̶̶p̶e̶o̶p̶l̶e̶̶a̶n̶d̶̶s̶o̶c̶i̶a̶l̶̶i̶n̶t̶e̶r̶a̶c̶t̶i̶o̶n̶s̶staying in and messing with code img alt dated webpage old myspace profile of Tom creator of myspace lt br gt via Odyssey height src dev to uploads s amazonaws com uploads articles qeqxezgzzpzrcontv png width Eventually the time came for me to pick a major At I was tasked to figure out what I would like to do for the rest of my life as well as decide if it was worth paying loans back for the foreseeable future I eventually settled for graphic design While in college I learned so many different art mediums as well as learning some website building techniques…m̶o̶s̶t̶̶o̶f̶̶w̶h̶i̶c̶h̶̶a̶r̶e̶̶p̶o̶i̶n̶t̶l̶e̶s̶s̶̶n̶o̶w̶ However most of the focus was on the art side of things and I still felt a technical yearning This yearning was very strong I even tried to switch majors to engineering Unfortunately I was faced with the brutal reality of having to stay more years in order to see it come to fruition and I was already a sophomore going into my junior year I decided to stick through with graphic design till graduation After graduation I began working many odd jobs I even landing an internship with a mobile development startup It didn t last too long but I learned so much while I was there and caught a glimpse of what I would like to aim for I also attended more meetup groups revolved around programming I got to learn some topics such as the Internet of Things IoT and big data After my internship ended I had a hard time figuring out how to apply my skills to technical jobs It was back to the drawing board I eventually landed what I felt was a dream job in graphic design I got to create art for a craft store It was a dream come true…until it wasn t It was great for the first few months I got to create so many items that would be enjoyed by many across all ages As fun as it was at the time I found myself craving for some technical tasks I often sat wondering what tools could we create to make the crafting process better Could we integrate an inventory system for our customers to use so they know what they have at all times What digital services could we offer to help our customers should they decided to use us for their crafting businesses Unfortunately this was not in my job description I also didn t have the time to further explore these questions as many of us were laid off However Instead of being upset I was excited I was free to explore what life had to offer I decided it was about time I formally learn how to program and bought an online class by none other than Colt Steele I learned so much and absolutely loved it I even decided to stream on Twitch to show the process of my learning to program in real time I was even accepted into a stream team that focused on live coding Sidenote I also highly recommend live coding while learning I was able to receive real time help from more experience programmers I also learned something new every time I streamed End Sidenote Unfortunately self doubt and imposter syndrome set in I eventually allowed comparison to ruin my joy of programming and let my skills fade slightly To add insult to injury the pandemic made matters worse I eventually started working at a warehouse when things died down Surprisingly it excited me I was able to do different jobs almost everyday there I was constantly learning something new and moving around frequently I eventually landed a task called “Problem Solver We go around fixing inventory issues with our computers Eventually my knack for exploring and fixing technical problems arose again Questions like “How can this process be made easier or “Why are they using toggle menus on this webpage started being asked again I eventually found out about a program called “Career Choice were I was able to find this very program I m in right now I chose to enroll in Software Development because I ve always had a knack for questioning and exploring solutions for technical problems The ability to use my creativity and build something from nothing absolutely excites me I find software development aligns with my yearning for fixing problems and it allows for flexibility in learning new things every step of the way I do not know where software development will lead me however I am excited to explore and find out all the possibilities 2022-04-11 19:22:05
海外TECH DEV Community GraphQL vs. gRPC vs. REST: Choosing the right API https://dev.to/logrocket/graphql-vs-grpc-vs-rest-choosing-the-right-api-5g0k GraphQL vs gRPC vs REST Choosing the right APIWritten by Samson Omojola️The standard for data exchange between frontend and backend has always been a bit contentious With different API technologies available for sharing data between clients and servers and each one having its own set of unique capabilities it can be quite daunting trying to decide which one serves you best The three most popular technologies currently for creating APIs are GraphQL gRPC and REST In this post we ll look at how each one works including their pros and cons GraphQLGraphlQL is a data query language that uniquely allows clients to request any specific data that they need As opposed to REST s HTTP methods GraphQL uses queries mutations and subscriptions for sourcing and manipulating data Queries request data from the server while mutations send data to and modify data gated by the server Subscriptions get live updates when data changes usually through Websockets In all GraphQL supports languages like JavaScript Java Python Ruby PHP and more Representing data with schemasWith GraphQL data is represented through schemas A schema defines an object the fields that the object contains and the type of data the fields can hold Here s an example schema type User name String age Number Here User is the object and inside it we specify the fields or properties the object has including data types What this means is that in any query operating on the User object the only fields that can appear are name and age For both of these fields the only kinds of data that can be written to or read from are strings and numbers respectively In GraphQL when field types are trailed with exclamation marks like what we have above it means that the fields are non nullable They must have data written to them when the object updates and the fields always provide values when queried Defining queries mutations and subscriptions with schemasAs mentioned before there are mainly three actions that can be performed on data objects queries mutations and subscriptions These can also be defined using GraphQL s schema language With a query schema you can request data from your GraphQL server by specifying the object and fields under the object you re interested in query users name age Above we request a list of the users in the database specifically their names and ages The user object could have other fields like gender or job title for example but only the fields we requested will be sent to us This is one advantage that GraphQL has over REST In REST when an endpoint is queried all the data behind that endpoint is sent to you leaving you to sort through the array and select the particular fields you need GraphQL is more flexible because it allows you to customize the structure of your result This saves you the memory and CPU consumption that goes into filtering data And because GraphQL queries generally request less data they are usually processed faster than REST requests With a mutation schema you can make changes to existing data or post new data to your database For example if you wanted to create a new user or update the details of an existing user you d use mutation mutation newUser name name age age name age With a subscription schema you can subscribe to an object and have your server update your client in real time whenever changes are made to that object For example if you want your client app update in real time whenever an existing user is deleted or modified or a new user is created you can subscribe to the User object and your fields of interest subscription User newUser name age GraphQL prosWith GraphQL you can define the exact scope of data required in every instance By preventing excess data from sending from the server to the client your app performs better Since you can select multiple fields from different resources in a single query GraphQL eliminates the need to carry out multiple round trips to the server to fetch data for your client GraphQL consGraphQL has some serious caching problems specifically HTTP caching that have contributed to the prevention of its widespread adoption Due to the way GraphQL queries are written requesting too many nested fields at once can lead to circular queries and crash your server Implementing rate limiting in REST is more seamless GraphQL also doesn t support file upload out of the box and requires a workaround to implement this functionality And finally compared to REST GraphQL has a steeper learning curve RESTThe most popular and most used API format on the list is REST which stands for representational state transfer REST APIs use HTTP methods like GET POST PUT and DELETE to access and manipulate data within uniform resource identifiers URIs GET methods retrieve data from a server POST methods transfer data from the client to the server PUT methods modify data in the server DELETE methods erase data in the server When in use for example a GET request can perform on a URI that typically looks like api users a REST operation typically returns data from the server to the client The REST response data can then come in formats like JSON CSV XML or RSS and the REST response data tends to come in property value pairs users id name Dan age id name Kim age REST prosCaching is easy in REST because it takes advantage of HTTP by eliminating the need for your client and server to constantly interact with each other improving performance and scalability REST s maturity in the tech world is one of its biggest advantages It is ubiquitous as opposed to GraphQL and gRPC which can be considered niche solutions to creating APIs Due to REST s popularity lots of developers are already familiar with it and find it easy to work with And so if you create a commercial API for many third party developers to consume then REST might be the best option for you REST consLarge payloads where you can select specific fields under a resource in GraphQL REST requires you to request all the data under the resource before looping through it to get the data you need which often results in large payloads While with GraphQL we can batch different resource requests and send them to the same endpoint at graphql and executed once in one round trip with REST different requests must be sent to different endpoints resulting in multiple round trips GraphQL makes making changes to a database schema very easy Since queries only involve requesting specific fields new fields can be added to a resource without causing breaking changes and requiring you to version your application gRPC also comes with its own backward compatibility features that make it easy to update your data structure without breaking clients code REST does not come with this flexibility gRPCgRPC is a high performance open source remote procedural call RPC framework created by Google In gRPC protocol buffers make API requests to the server These API requests and responses are protocol buffer messages and each one must have its own type defined using the protocol buffers language Services are defined to pair API requests with their corresponding responses and the protocol buffers compiler generates the server and client code artifacts for your API service Syntax versionsyntax proto service UserService rpc GetUser UserRequest returns UserResponse Message typemessage UserResponse string name string age message UserRequest string name string age In the code block above the message UserRequest is the request the message UserResponse is the response and GetUser is the API endpoint gRPC supports a host of languages and your client app can be written in any of these languages because the client code for any of these languages can be generated with the help of the protoc tool gRPC prosProtocol buffers which gRPC comes out of the box with support more data types than JSON and it s significantly faster thanks to its optimized binary format gRPC supports full duplex streaming out of the box which makes it suitable for features like video and voice calls With REST on the other hand queries are handled one at a time gRPC performs load balancing so that client requests are evenly distributed across servers to avoid overloading a particular server This improves the overall performance of your application The load balancing feature as well as the fact that gRPC uses HTTP by default makes latency in gRPC much lower than in REST APIs Finally gRPC serializes data in binary format protocol buffers which is much faster than REST s JSON giving gRPC a greater performance advantage gRPC consProtocol buffers gRPC s official data format currently only supports a handful of languages It doesn t support languages like R and Swift JSON which REST uses is supported by virtually all languages gRPC doesn t come with browser support out of the box although there are some workarounds for it ConclusionAt the end of the day the best API technology for your specific project will depend on what you are trying to achieve If you need a generic API that will be used by a lot of clients then REST might be your best option If you need a flexible API that different clients will use to make many unique requests then it might be best to let the clients create their own unique queries and get only the specific data they need quickly and you can achieve this with GraphQL If want to create fast seamless communication between internal services then gRPC is your best option As we ve seen all three have their pros and cons and you can get optimal results by combining technologies Monitor failed and slow GraphQL requests in productionWhile GraphQL has some features for debugging requests and responses making sure GraphQL reliably serves resources to your production app is where things get tougher If you re interested in ensuring network requests to the backend or third party services are successful try LogRocket LogRocket is like a DVR for web and mobile apps recording literally everything that happens on your site Instead of guessing why problems happen you can aggregate and report on problematic GraphQL requests to quickly understand the root cause In addition you can track Apollo client state and inspect GraphQL queries key value pairs LogRocket instruments your app to record baseline performance timings such as page load time time to first byte slow network requests and also logs Redux NgRx and Vuex actions state Start monitoring for free 2022-04-11 19:21:11
海外TECH DEV Community Need Help 🙏 unable to delete cookie in Express https://dev.to/paradox098/need-help-unable-to-delete-cookie-in-express-4o93 Need Help unable to delete cookie in ExpressHello everyone I am a newbie working on a full stack web app using node express and mongodb in the backend for my final semester project I am working on an admin portal when users admins sign in a cookie is stored in the browser and a token using json web tokens here is stored in the mongodb but I am unable to delete the cookie during logout My logout code is app get logout auth async req res gt try req user tokens req user tokens filter currentElement gt return currentElement token req token res clearCookie jwt console log Logout Successful await req user save res render catch error res status send error Authorization code const auth async req res next gt try const token req cookies jwt const verifyUser jwt verify token process env SECRET KEY console log verifyUser const user Register findOne id verifyUser id console log user firstname req token token req user user next catch error res status send error Logout only gives this output And it seems like res clearCookie jwt is not working here as the jwt cookie is not getting deleted Please help I am stuck from weeks Unable to figure out how to make it work 2022-04-11 19:15:45
海外TECH DEV Community The Absolute Best JS Dev Tools in 2022 https://dev.to/transitivebullshit/the-absolute-best-js-dev-tools-in-2022-33ij The Absolute Best JS Dev Tools in A breakdown of the most important JS dev tools in including their most relevant tradeoffs and some opinionated advice sprinkled on top In the world of software engineering it s important to have a firm understanding of the tools at your disposal But the landscape of JS tooling is always changing at such a rapid pace And is no different So I decided to break down the most important dev tools that you should be aware of in We ll start with the lowest level tools and work our way up to higher level tools from there Let s get started CompilersCompilers are responsible for transforming your input code into some target output format For our purposes we re focusing on compilers which support transpiling modern JavaScript and TypeScript into specific versions of ECMAscript that are compatible with browsers and recent versions of Node js The most important thing to understand about this space is that it s in the middle of undergoing a massive shift from compilers like tsc and babel which are written in higher level interpreted languages to compilers like swc and esbuild which are written in much faster compiled languages This shift results in x faster compilation times as shown in this esbuild demo If you re updating your devtools stack or starting a new project in then you ll want to consider using one of these next gen compilers under the hood They may not be as mature as the official typescript compiler or babel but the benefits of having x faster builds cannot be understated Note that neither swc nor esbuild perform type checking They simply transpile code into the desired output format as quickly and efficiently as possible For the time being if you re working with TypeScript you ll almost always need to have the official TypeScript compiler as part of your toolchain to guarantee that you re getting the most out of TypeScript s static type checking It s also worth mentioning that the author of swc kdydev is working on porting tsc to Go in order to remove the need for tsc in many cases as it tends to be the bottleneck in most toolchains SWC vs esbuildswc and esbuild are both excellent blazing fast open source JS TS compilers They have comparable performance and are both used regularly in production by some of the world s largest companies It s likely that your choice between the two will be dictated more by the higher level tools built on top of these compilers as opposed to choosing between them directly Notable projects using swc Vercel and Next jsDeno s linter formatter and docsParcelnxNotable projects using esbuild ViteNuxt jsRemixSvelteKittsupIn software engineering convenient statements such as “technology A is better than technology B rarely hold much value Rather you should try to always keep context in mind In this case there are many scenarios where you d be better off using tsc or babel Becoming a better software engineer often boils down to thoroughly understanding the tradeoffs involved with these types of decisions and balancing those tradeoffs against the particular constraints of your project team and business needs BundlersBundlers are responsible for taking all of your input source files and bundling them together into an easy to consume output format The two most common use cases for bundlers are bundling libraries and bundling resources for web applications Bundlers like webpack and rollup are the swiss army knives of modern JS toolchains They are both extremely extensible with well maintained plugins covering major use cases It s relatively straightforward for example to use any of the popular compilers listed above to transpile TS code with either webpack or rollup Parcel on the other hand provides a mostly zero config approach to bundling It focuses on simplicity as opposed to extensibility and uses swc as a compiler under the hood Note that swc and esbuild both provide basic bundling capabilities as well though compared with these alternatives they re not full featured enough to be included on this list For a much more detailed comparison of these bundlers check out tooling report Package ManagersPackage managers are responsible for managing dependencies in the form of NPM packages There s a lot of history here but the TL DR is All of these package managers have similar features and perf nowadays so don t be too worried about which one you re using pnpm seems to be gaining a lot of traction very quickly The way yarn berry was rolled out and the subsequent deprecation of yarn v turned a lot of people off from using yarn though yarn berry has come a long way in the past few years yarn plug n play is an interesting approach but in practice it has only seen adoption in cases with very large monorepos I can t tell you the number of times I ve wanted to inspect or add console log statements to my node modules and not being able to do so is a real disadvantage Adoption by popular projects A breakdown of the package managers chosen by popular projects This image is from Sebastian Weber s excellent package manager deep dive Note that at the time of this writing none of these projects are using Yarn PnP Library DevelopmentThese tools are meant to help library authors bundle and publish modern NPM packages If you re developing a new library in you ll likely want to use one of these higher level tools to simplify your workflow If you have a TS package and want to take advantage of extremely fast build times courtesy of esbuild then tsup is a great option If you have a TS package and need some additional features then tsdx is a great option If you have a TS or JS package then microbundle is also a great option Vite is mainly a tool for building frontend web apps but it also includes support for outputting libraries and is a very solid all around option For monorepos nx looks really promising My personal preference will be to use tsup for TS packages mainly because once you ve experienced x faster builds it s really difficult to consider switching back to anything else More InfoMost of these tools don t currently provide great support for TS monorepos which take advantage of composite project references For the time being my recommendation for this case is to use tsc for type checking and generating d ts typings with emitDeclarationOnly true and tsup for compiling code in each of the sub packages For an example of this approach check out the react notion x monorepo one of my OSS projects Publishing modern NPM packages is a nuanced topic that goes well beyond the scope of this article For more info on ESM commonjs dual package publishing exports and more see What does it take to support Node js ESM Sindresorhus notes on publishing and consuming ESM packages Web App DevelopmentThese higher level tools and frameworks are intended to help developers build modern web applications without worrying about all the details If you re developing a new web app in using React then I would highly recommend using Next js It has the best support the most active community and close integration with Vercel the world s leading deployment platform for modern web apps Remix provides a really compelling alternative to Next js It s from the makers of react router and though it s relatively new they re definitely a framework to keep an eye on If you re developing a new web app using Vue then Nuxt js and Vite are both great options And last but certainly not least if you want something more light weight then give Parcel a try There seems to be a roughly equal number of projects building on top of swc and esbuild The same observation goes for webpack and rollup ConclusionModern web development has evolved significantly over the past years Developers today are lucky to have such a wide range of amazing well maintained tools to choose from This is however by no means a comprehensive list of dev tools If there s something missing that you d like to see added let me know on twitter Hopefully this breakdown has helped you parse the most important aspects of the current JS TS dev tools landscape and hopefully it ll help you to make more informed decisions going forwards If you found this article helpful then consider following me on twitter for more transitive bs 2022-04-11 19:09:14
海外TECH DEV Community Writing a reactive library in Javascript [from scratch] https://dev.to/adea/writing-a-reactive-library-in-javascript-from-scratch-1k1i Writing a reactive library in Javascript from scratch IntroductionThere are a lot of good libraries and frameworks to handle state management and reactivity From simple and short utilities such as S js to heavy solutions like Solid As for any lib framework it is important to choose wisely To help me choose I have decided to only use a library framework if I can understand its source code at least partially Being the newbie that I am I easily get lost even when trying to refactor the code into something I should understand Since I have not found a good lightweight library that Just works for me and to better learn the way such a system could be implemented I have decided to build it myself Re inventing the wheel is cool I wrote it in an afternoon took a week to test it then two weeks to make a Gitlab pipeline and voilà You can use Valup which is short for value update It s a little lightweight easy no magical nonsense project I thought it would be nice to make an article about it to help people like me understand the process So how do we do it Here are the steps Implement an event emitter systemImplement a data wrapperMake the wrapper emit eventsAdd quality of life improvementsAt each step I ll describe the interfaces and what to implement before showing a simplified and commented version of my code You re free to try and implement the interfaces yourself before looking at my version Implementing an Event EmitterWhat is an Event Emitter It is a system that fires a function called Event Listener when a specific Event is fired In the DOM you may already be used to such events onclick onblur etc An event emitter should implement the following interface or a variant interface EventEmitter public events Map lt string Array lt Function gt gt List of events with associated listeners Example myevent f f f public addListener event string listener Function gt void Add an entry in the events map at event key public removeListener event string listener Function gt void Remove the entry from events at event if the exact function exists in that list public emit event string gt void Fires all listeners to event Example for myevent f f f emit myevent will execute gt f f f I took inspiration from the great github gist A very simple EventEmitter in pure Javascript Here s a simplified and commented version of my code class EventEmitter events new Map Custom getter to force the property to be a map and not anything else get events if this events instanceof Map this events new Map return this events Same as addEventListener I just prefer the myObject on myEvent gt syntax on event listener let currentEvent this events get event If the event doesn t exist create it if typeof currentEvent object currentEvent currentEvent push listener this events set event currentEvent removeListener event listener Index of listener in the array if it exists else const index this events get event indexOf listener if index lt return Guard clause exit immediately const currentEvent this events get event currentEvent splice index Remove listener from array this events set event currentEvent emit event args The args is for listeners arguments Example const logger a gt console log a myObject on log logger myObject emit log Hello logs Hello const currentEvent this events get event if typeof currentEvent object return Guard clause Fire all listeners with arguments currentEvent forEach listener gt listener apply this args Implementing a data wrapperSince our reactive system doesn t use magic we have to tell it what data to use what events to listen to and how to update things We can t simply say myObject foo bar and expect it to fire event listeners on myObject because we replaced it with something that doesn t implement an event listener Therefore we have to write a system to read write the data that we can control accessors Here s an example interface interface DataWrapper private data any public get data public set data newData any Or with a generic typeinterface DataWrapper lt T gt private data T public get data public set data newData T Or with functions instead of accessorsinterface DataWrapper lt T gt private data T public getData gt T public setData newData T gt void I chose to apply the first system and call my wrapper R which stands for Reactive This will be the base object called everywhere hence the single letter name class R val undefined get val return this val set val nval this val nval constructor newValue this val newValue Usage const myObject new R foo bar console log myObject val foo bar myObject val foo baz updated Make the wrapper emit eventsOur data accessor should emit and receive events it should apply the log of an EventEmitter One way to do it would be to make the wrapper extend the EventEmitter the way I chose is to encapsulate it as a property of my wrapper We ll have façade methods from the design pattern of the same name that use the EventEmitter Here s an example of an how to extend the previous interface interface DataWrapper private eventEmitter EventEmitter public addListener event string listener Function gt void public removeListener event string listener Function gt void Custom notifier use the emit function with any arguments you d like public notify event string state any gt void Here s how I implemented it class R eventEmitter new EventEmitter addListener on event listener this eventEmitter on event listener removeListener event listener this eventEmitter removeListener event listener notify event state this eventEmitter emit event state I chose to wrap the state in a state property First to ensure that we emit an object but also because I want to make sure I myself won t forget that a listener is used specifically for my library We now have a working system It s not much but we can already use it const username new R ADEA const greeter state gt console log Hello state name username on greet greeter username notify greet name ADEA Hello ADEA Although I admit the reactive side is quite lacking We don t have a way to know when a value changes to automatically fire the listeners But the implementation is actually quite easy thanks to using accessors We simply have to define the events we want to fire for example changing before the value has changed and changed when the update has been done then notify them class R set val newValue const oldState prev this val current this val next newValue const newState oldState current newValue this notify changing oldState this val newValue this notify changed newState Now we can use it in a reactive way const reactiveUsername new R Alice const greeter state gt console log Hello state current const goodbye state gt console log Goodbye state current reactiveUsername on changing goodbye reactiveUsername on changed greeter reactiveUsername val Bob Goodbye Alice Hello Bob You can play with it use custom events associated with changed changing try to change a DOM value reactively etc Here s the final code from what we ve written so far class EventEmitter events new Map get events if this events instanceof Map this events new Map return this events on event listener let currentEvent this events get event if typeof currentEvent object currentEvent currentEvent push listener this events set event currentEvent removeListener event listener const index this events get event indexOf listener if index lt return const currentEvent this events get event currentEvent splice index this events set event currentEvent emit event args const currentEvent this events get event if typeof currentEvent object return currentEvent forEach listener gt listener apply this args class R eventEmitter new EventEmitter val undefined get val return this val set val newValue const oldState prev this val current this val next newValue const newState oldState current newValue this notify changing oldState this val newValue this notify changed newState constructor value this val value on event listener this eventEmitter on event listener removeListener event listener this eventEmitter removeListener event listener notify event state this eventEmitter emit event state We have successfully implemented a reactive system in less than lines of code And the code is not that bad Of course we have to put spaces and comments separate the classes in different files write some quality of life improvements etc But it works is easy and can be understood from the source code Adding quality of life improvementsThis part is for you Now that you ve successfully implemented the skeleton of your library you can change it to your liking I ll just enumerate a few improvements ideas without explaining how to implement them Some of them I ve written in my source code with Typescript Improvement Have a strict value checking and non strict one nonstrict emits at every update strict emits only when differs const strictVal new R false strict true const nonstrictVal new R false strict false strictVal val false doesn t updatestrictVal val true updatesstrictVal val true doesn t updatenonstrictVal val false updatesnonstrictVal val false updates Improvement Use factory methods to create reactive values const r R data const r R strictData Improvement Allow for method chaining const counterChain R data on changing gt console log changing on changed gt console log changed on increment state gt counterChain val state current on decrement state gt counterChain val state current Improvement not in Valup yet Clean an event from all listenerscounterChain clean increment counterChain cleanAll counterChain val nothing happensValup s source code gitlab Valup s NPM entry 2022-04-11 19:03:34
海外TECH DEV Community "Transcriptube" - maintain the habit of reading news, podcast https://dev.to/8bitsouvik/transcriptube-maintain-the-habit-of-reading-news-podcast-705 quot Transcriptube quot maintain the habit of reading news podcast Overview of My SubmissionIn the the era of of fast internet we can listen or watch any news or podcast by a single tap without any hassle But because of this facility we don t need to read any words which is disrupting our reading habits day by day To maintain this good habit we can read any article or podcast instead of listening Here This Transcriptube web application comes to play a major role we can easily transcribe any youtube video by just providing the URL of that videoAfter submitting the URL the backend process will start First it will fetch the youtube video of given link through SocialDownloader API It will take a few seconds After that the API will generate the link of downloadable mp video As soon as the link get fetched the deepgram API will pick it and starts generate the the transcript of the video This process can take upto minutes After generating the whole transcript will fetch the data and comes to the frontend Now I have created it just for Youtube videos but in future I ll enable it for any vocal media link Land on the Home Page Submission Category Accessibility Advocates Link to Code on GitHub bit souvik Transcriptube Transcript any voice or podcast from youtube using Deepgram api TranscriptubeTranscript any voice or podcast from youtube Tools used Node JSExpress JSEJS template engineResources used Deepgram APISocialDownload APISnap demo transcriptube mp View on GitHub Additional Resources Info Tools used Node JSExpress JSEJS Resources used Deepgram RapidApiSocialDownloader API Heroku 2022-04-11 19:01:18
Apple AppleInsider - Frontpage News How to watch MLB 'Friday Night Baseball' on Apple TV+ https://appleinsider.com/articles/22/04/11/how-to-watch-mlb-friday-night-baseball-on-apple-tv?utm_medium=rss How to watch MLB x Friday Night Baseball x on Apple TV Friday Night Baseball is now on Apple TV Here s how you can tune into the weekly MLB based stream using your iPhone iPad or Mac You can watch two baseball games each week via Apple TV Originally announced on March and first broadcast on April Friday Night Baseball is a weekly double header providing viewers with two complete Major League Baseball games to watch Read more 2022-04-11 19:29:40
海外TECH Engadget Activision Blizzard recruits a new chief diversity officer amid harassment scandal https://www.engadget.com/activision-blizzard-chief-diversity-equity-inclusion-officer-195013068.html?src=rss Activision Blizzard recruits a new chief diversity officer amid harassment scandalActivision Blizzard has recruited a new chief diversity equity and inclusion DEI officer Kristen Hines will join the company and its senior leadership team on April th She will report to Julie Hodges the company s chief people officer Hines most recently led the Global DEI practice at Accenture where she helped other organizations bolster their DEI strategies and capabilities One of Hines key responsibilities will be to help Activision Blizzard meet its commitment to increase the percentage of women and non binary people in the workforce by percent over the next five years In its representation data document for the company said women made up percent of its workforce Hines will also work with Activision Blizzard s gaming teams “to ensure diverse and inclusive perspectives are included in game design including storylines character development gameplay and community interaction quot In an industry with historical underrepresentation I m looking forward to leading the company s efforts to further build a workplace that values transparency equity and inclusivity Hines said in a statement “Gaming has amazing potential to connect communities around the world and showcase heroes from all backgrounds I am looking forward to playing a part in expanding the landscape of talent who brings these compelling experiences to a broad base of players Hines will be tasked with helping improve the workplace culture of Activision Blizzard which has been under intense scrutiny since last summer The California Department of Fair Employment and Housing sued the company in July It accused Activision Blizzard of fostering a quot frat boy culture quot and alleged there was discrimination against female employees A wrongful death suit was filed against the publisher last month as was a sexual harassment and discrimination lawsuit from an individual plaintiff Also in March a judge approved a proposal by Activision Blizzard which is the subject of a pending billion takeover from Microsoft to set up an million fund to settle a federal lawsuit The US Equal Employment Opportunity Commission s suit accused the company of enabling a sexist and discriminatory workplace environment 2022-04-11 19:50:13
海外科学 NYT > Science New Drug Slashed Deaths Among Patients With Severe Covid, Maker Claims https://www.nytimes.com/2022/04/11/health/covid-sabizabulin-veru.html New Drug Slashed Deaths Among Patients With Severe Covid Maker ClaimsA late stage trial was halted after strong early results according to the company but outside scientists have not yet seen the data 2022-04-11 19:51:07
海外科学 NYT > Science Psilocybin Helps Alleviate Depression Symptoms, Small Study Says https://www.nytimes.com/2022/04/11/health/psilocybin-depression.html Psilocybin Helps Alleviate Depression Symptoms Small Study SaysThe chemical derived from psychedelic mushrooms helped alleviate symptoms of depression and generated detectable neural responses that lasted weeks 2022-04-11 19:54:55
ビジネス ダイヤモンド・オンライン - 新着記事 漫画『キングダム』作者が生原稿で明かす「累計8700万部」を支える知られざる原動力 - 漫画「キングダム」にビジネスパーソンが夢中になる理由 https://diamond.jp/articles/-/301076 入山章栄 2022-04-12 04:55:00
ビジネス ダイヤモンド・オンライン - 新着記事 マッキンゼー流!なぜDXを「ソリューション導入」から始めると失敗するのか【動画】 - マッキンゼー流!リーダーの新教科書 ―戦略とファイナンス― https://diamond.jp/articles/-/292542 企業価値 2022-04-12 04:50:00
ビジネス ダイヤモンド・オンライン - 新着記事 【立川高校】華麗なる卒業生人脈!2人のノーベル賞候補者、作家の三浦朱門、漫画家の東海林さだお、自民党元副総裁の高村正彦… - 日本を動かす名門高校人脈 https://diamond.jp/articles/-/301252 三浦朱門 2022-04-12 04:45:00
ビジネス ダイヤモンド・オンライン - 新着記事 東京大学「就職先企業・団体」ランキング2021!意外な1位と2位は? - 親と子のための大学研究2022 https://diamond.jp/articles/-/301201 東京大学 2022-04-12 04:40:00
ビジネス ダイヤモンド・オンライン - 新着記事 東京大学「就職先企業・団体」ランキング2021!【全20位・完全版】 - 親と子のための大学研究2022 https://diamond.jp/articles/-/301167 東京大学 2022-04-12 04:40:00
ビジネス ダイヤモンド・オンライン - 新着記事 中国で新築住宅販売が半減!不動産バブル崩壊とゼロコロナ対策の「板挟み」 - 今週のキーワード 真壁昭夫 https://diamond.jp/articles/-/301425 不動産バブル 2022-04-12 04:35:00
ビジネス ダイヤモンド・オンライン - 新着記事 「トヨタグループのホテル」が宿泊客に朝食券を配らなくなったワケ - ニュース3面鏡 https://diamond.jp/articles/-/300392 「トヨタグループのホテル」が宿泊客に朝食券を配らなくなったワケニュース面鏡長野県にある「テラス蓼科リゾートampスパ」は、トヨタグループが経営するホテルだ。 2022-04-12 04:30:00
ビジネス ダイヤモンド・オンライン - 新着記事 ラクな仕事と難しい仕事、社員のモチベーションが上がるのはどっち? - イライラ・モヤモヤ職場の改善法 榎本博明 https://diamond.jp/articles/-/301431 ラクな仕事と難しい仕事、社員のモチベーションが上がるのはどっちイライラ・モヤモヤ職場の改善法榎本博明人事部門の重要な仕事の一つに、モチベーションマネジメントがある。 2022-04-12 04:25:00
ビジネス ダイヤモンド・オンライン - 新着記事 新入社員が知らないと損する、会社の「3つのお得制度」と見極め方 - 自分だけは損したくない人のための投資心理学 https://diamond.jp/articles/-/301424 新入社員 2022-04-12 04:20:00
ビジネス ダイヤモンド・オンライン - 新着記事 ノブコブ徳井、ハライチ岩井、インパルス板倉…「腐り芸人」の芸人論が会社員に刺さる理由 - 河崎環の「余計なことしか考えない」 https://diamond.jp/articles/-/301081 ノブコブ徳井、ハライチ岩井、インパルス板倉…「腐り芸人」の芸人論が会社員に刺さる理由河崎環の「余計なことしか考えない」平成ノブシコブシの徳井健太は、長らく相方の吉村崇に比べ「じゃない方」芸人と呼ばれてきた。 2022-04-12 04:15:00
ビジネス ダイヤモンド・オンライン - 新着記事 まぶたがピクピク動く「眼瞼ミオキミア」、放置すれば生死にかかわるリスクも - ニュース3面鏡 https://diamond.jp/articles/-/300309 眼瞼 2022-04-12 04:10:00
ビジネス ダイヤモンド・オンライン - 新着記事 「見た目」の印象戦略で ドアを開けた瞬間に面接官の心をつかむ方法 - 学校でも会社でも教えてくれない「見た目」の教科書 https://diamond.jp/articles/-/300265 就職活動 2022-04-12 04:05:00
ビジネス 東洋経済オンライン 初期費用は100円、北海道に吹いた「駅メモ!」旋風 熱量高い鉄道ファンが旧美唄鉄道に押しかけた | 旅・趣味 | 東洋経済オンライン https://toyokeizai.net/articles/-/579476?utm_source=rss&utm_medium=http&utm_campaign=link_back 北海道美唄 2022-04-12 04:30:00

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)