IT |
気になる、記になる… |
Appleが英プレミアリーグの放映権の獲得を検討との噂が再び |
https://taisy0.com/2023/03/23/169905.html
|
apple |
2023-03-23 12:20:37 |
IT |
ITmedia 総合記事一覧 |
[ITmedia News] “FULL”なVLOGCAM? ソニーが29日発表か シルエットだけ公開中 |
https://www.itmedia.co.jp/news/articles/2303/23/news199.html
|
itmedia |
2023-03-23 21:40:00 |
IT |
ITmedia 総合記事一覧 |
[ITmedia ビジネスオンライン] 2月に最も聴かれたアーティスト 2位「Official髭男dism」、1位は? |
https://www.itmedia.co.jp/business/articles/2303/23/news191.html
|
itmedia |
2023-03-23 21:38:00 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
【Julia】 基礎: 標準出力 |
https://qiita.com/Krypf/items/0c5c744e054f1b3e6004
|
julia |
2023-03-23 21:20:55 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
「良いコード悪いコードで学ぶ設計入門」を読んだので不変な値オブジェクトをPythonで実装してみる |
https://qiita.com/sobacha/items/2b6c02d0ed5a767f2a55
|
駆動 |
2023-03-23 21:08:58 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
JavaScriptでのAjaxの使い方基礎 |
https://qiita.com/M_O_106/items/1be1e0ebaa6f4ae84cb1
|
ajaxasynch |
2023-03-23 21:32:06 |
Linux |
Ubuntuタグが付けられた新着投稿 - Qiita |
.NET SDK を Ubuntu にインストールして Hello World する |
https://qiita.com/fsdg-adachi_h/items/d68031c91462f6808dff
|
ubuntu |
2023-03-23 21:35:04 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
中規模AWSシステムのTerraformディレクトリ構造 |
https://qiita.com/hiyanger/items/76e182d2bf34eed378a4
|
terraform |
2023-03-23 21:54:53 |
golang |
Goタグが付けられた新着投稿 - Qiita |
Go1.20の新機能を少し触ってみる |
https://qiita.com/pae26/items/848cc4dd96ee4f67891d
|
comparablestringscutprefi |
2023-03-23 21:54:02 |
技術ブログ |
Developers.IO |
API GatewayのオーソライザーにCognitoを使用してみた |
https://dev.classmethod.jp/articles/tried-using-cognito-as-api-gateway-authorizer/
|
apigateway |
2023-03-23 12:42:05 |
海外TECH |
MakeUseOf |
How to Access Your Visio Files After Microsoft Visio Viewer for iOS Ends |
https://www.makeuseof.com/access-visio-files-microsoft-visio-viewer-ios-ends/
|
microsoft |
2023-03-23 12:30:16 |
海外TECH |
MakeUseOf |
Are All Social Media Platforms Becoming the Same? |
https://www.makeuseof.com/social-media-sites-becoming-the-same/
|
features |
2023-03-23 12:05:15 |
海外TECH |
DEV Community |
Mastering Blazor - Part 2: Hot Reloading |
https://dev.to/florianrappl/mastering-blazor-part-2-hot-reloading-2b87
|
Mastering Blazor Part Hot ReloadingPhoto by Mike van den Bos on UnsplashIn the recent three years I did quite a bit of web development also using Microsoft s new web framework called Blazor Blazor adds component first support to ASP NET by introducing Razor components With Razor components Blazor is capable of providing a full single page application framework One of the things that make Blazor attractive since NET is the introduction of hot reloading What is hot reloading and how can we use it Where are its limitations In this article we will explore the hot reload feature in Blazor how it works and how it can make the development process faster and more efficient Hot Reload BasicsHot reload is a feature that allows developers to modify code while an application is running without having to restart it manually In other words developers can make changes to their code and immediately see the impact of those changes in the running application without any downtime This feature is a massive time saver for developers since it eliminates the need to stop and start the application manually every time they make changes Blazor s hot reload feature allows developers to modify their code in real time making it easier to debug and test applications With hot reload developers can tweak their code and see the changes instantly without having to waste time waiting for the application to restart There are some constraints and requirements that developers should be aware of when using the hot reload feature in Blazor Blazor hot reload requires a supported browser To use the hot reload feature in Blazor you need to use a browser that supports WebSockets which is the communication protocol used by Blazor for hot reload Currently most modern browsers including Chrome Firefox Edge and Safari support WebSockets Hot reload is not enabled by default To use the hot reload feature in Blazor you need to explicitly enable it in your project This can be done by adding the Microsoft AspNetCore Components WebAssembly DevServer NuGet package to your project and modifying your project s launch settings to enable hot reload There are some performance implications While hot reload is a valuable tool it can have some performance implications particularly when dealing with large applications In some cases the hot reload process can cause the application to slow down or become unresponsive By keeping these constraints and requirements in mind developers can use the hot reload feature in Blazor more effectively and avoid any potential issues or performance problems Another thing to know about are the limitations of hot reload Limitations of Hot ReloadAlthough Blazor s hot reload feature is a significant time saver and an efficient tool for developers it does come with some limitations First it has limited support for changing the structure of the code While Blazor s hot reload feature is excellent for modifying the content of the code it has limited support for making changes to the structure of the code This means that any changes that affect the underlying structure of the code such as renaming a class or adding a new property may require a manual application restart Another limitation is the lack of support for changing the dependencies Another limitation of Blazor s hot reload feature is that it does not support changes to the application s dependencies If the developer adds or removes a dependency the application needs to be restarted manually Keep in mind that by hot reloading you might be inable to preserve the application state Blazor s hot reload feature may cause the application to lose its state when the code is reloaded This means that the developer may have to re enter data or re run certain processes every time they make changes to the code Finally it has limited support for debugging Although hot reload is an efficient tool for developers to debug their code it may not work in all scenarios For instance it may not be effective when debugging complex code or when the changes made to the code have a significant impact on the application s behavior Overall while Blazor s hot reload feature is an essential tool it s important to keep in mind its limitations and understand when a manual application restart may be necessary If anything is fishy just stop and restart as you d have done it beforehand Internals of Hot ReloadBlazor s hot reload feature works by dynamically updating the application s code while it s running When a developer makes changes to the code the dotnet runtime monitors those changes and applies them to the running Blazor application in real time The hot reload feature works by using a combination of client side and server side technologies The client side component of the hot reload feature is responsible for monitoring changes to the code while the server side component is responsible for applying those changes to the running application When a developer makes changes to the code the client side component of the hot reload feature detects those changes and sends them to the server The server then applies the changes to the running application without interrupting its execution The server also compiles the modified code in the background to ensure that the changes are applied seamlessly to the running application Blazor s hot reload feature uses a technique called IL Intermediate Language swapping to apply changes to the running application IL swapping is a technique that replaces the existing IL code of a method with a new one This technique allows the application to continue running without interruption even when the code is being updated In order to find out if hot reloading should be enabled a set of headers is necessary in the initial response of the boot config json If the ASPNETCORE BROWSER TOOLS header is found then Blazor will activate a set of abilities In general we find the following three custom headers attached to pretty much all static resources but as mentioned for hot reload only the boot config json request is relevant DOTNET MODIFIABLE ASSEMBLIES debugASPNETCORE BROWSER TOOLS trueBlazor Environment DevelopmentHow are these headers entering the process Via the Blazor JavaScript They are attached to the created bootConfig which is based mainly on the contents from the boot config json Now having the ASPNETCORE BROWSER TOOLS header will actually set the aspnetCoreBrowserTools property In turn if this is truthy then the ASPNETCORE BROWSER TOOLS environment variable will be set to its value Finally inside the NET code running in WebAssembly this will be picked up and handled How specifically is this handled Well we have two different parts for this A WebSocket connection to e g ws localhost YourProjectName which is established in the beginning This one is used to monitor if changes have been made Here our running application will receive updates for instance type BlazorHotReloadDeltav sharedSecret deltas sequenceId moduleId ceaed b e b da metadataDelta ilDelta updatedTypes pdbDelta Interestingly the type is already versioned this should ensure to support specifications of future NET versions Presumably the capabilities as well as the format might change While the receiving part has modelled as a WebSocket connection there is also a sending part The sending part is a POST request to https localhost framework blazor hotreload Like beforehand the blazor hotreload does not resolve to an existing or real resource Instead it needs to be provided by the debug runtime The format is similar to the messages received from the WebSocket sequenceId moduleId ceaed b e b da metadataDelta ilDelta updatedTypes pdbDelta Indeed this one is just sending back to the received applied deltas This helps the NET counter part to know what has been applied already and what might be still missing The following diagram tries to place all these resources in an architecture So let s recap what URLs appeared here and what their roles have been framework blazor hotreload This URL is used to establish a connection between the Visual Studio side client and dev server side of the hot reload feature When a developer makes changes to the code the client sends a request to this URL to notify the server of the changes YourProjectName This URL is used to establish a WebSocket connection between the client side and server side components of the hot reload feature The WebSocket connection is used to facilitate real time communication between the two components allowing the server to send updated code to the client as soon as it s available This all results in the following sequence diagram In addition to these URLs there may be other magic URLs and connections that are part of the Blazor hot reload mechanism These URLs and connections may be specific to the version of Blazor you re using or to the tooling you re using to develop your Blazor application Bonus Browser LinkThere are some other URLs that appear from time to time in a discussion about Blazor hot reload The browserLink and framework aspnetcore browser refresh js URLs While they are loosely related to the hot reload feature they serve a different purpose than the URLs from the previous section However for instance the aspnetcore browser refresh js is responsible for establishing the WebSocket connection mentioned in the previous section Here s a brief explanation of each of these URLs and their role in the development process browserLink This URL is used to enable the Browser Link feature in Visual Studio which allows developers to interactively debug and modify their code in the browser Browser Link can be used to perform tasks such as refreshing the browser inspecting the DOM and debugging JavaScript framework aspnetcore browser refresh js This URL is used to enable browser refresh in Visual Studio which allows developers to automatically refresh the browser when changes are made to the code The aspnetcore browser refresh js script is responsible for monitoring the server for changes and triggering a browser refresh when changes are detected It also establishes the WebSocket connection to the hot reload server which is necessary to make this work in the first place While these URLs and features are not directly related to the hot reload feature in Blazor they can be used in conjunction with hot reload to speed up the development process For example developers can use Browser Link to interactively debug and modify their code in the browser while using hot reload to apply changes to the running application These URLs are entering our application by intercepting requests Visual Studio will modify the response of a request if the accept header is set to text html In such scenarios the middleware injects the following piece of JavaScript code into the response const s document createElement script s type text javascript s src http localhost ff browserLink s async true s id browserLink initializationData s dataset requestid eb s dataset requestmappingfromserver false s dataset connecturl http localhost ff browserLink document body appendChild s const s document createElement script s type text javascript s src http localhost framework aspnetcore browser refresh js s onload gt if typeof wasmmodulecallback undefined window wasmmodulecallback delete window wasmmodulecallback document body appendChild s Importantly neither the browserLink endpoint handled by the Visual Studio instance nor the aspnetcore browser refresh js file has to be provided by us as beforehand The browserLink and browser refresh js give the IDE e g Visual Studio the ability to communicate with the browser For instance the console messages are then seen in Visual Studio too Additionally breakpoints are synced and communicated such that the browser stops where it should ConclusionBlazor s hot reload feature is a useful tool that allows developers to make changes to their code and see those changes applied to the running application in real time This feature uses a combination of client side and server side technologies to monitor code changes and apply them on the fly without interrupting the running application s execution Blazor hot reload uses a technique called IL swapping to apply changes to the running application replacing the existing IL code of a method with a new one During the hot reload process you may encounter URLs such as framework blazor hotreload and a WebSocket connection These URLs and connections are part of the hot reload mechanism and facilitate communication between the client side and server side components Blazor also offers other development tools such as Browser Link and browser refresh which can be used in conjunction with hot reload to speed up the development process While hot reload has its limitations such as not being able to handle all types of changes to the code it is a valuable tool that can help developers save time and effort when building Blazor applications Overall hot reload is a useful feature that demonstrates Blazor s commitment to delivering a smooth and efficient development experience RelatedTelerik Instant Feedback is HereJetBrains How Rider Hot Reload Works Under the Hood |
2023-03-23 12:47:28 |
海外TECH |
DEV Community |
Exposed RSQL Search Implementation |
https://dev.to/brightdevs/exposed-rsql-search-implementation-11nb
|
Exposed RSQL Search Implementation OverviewIn this tutorial we are going to implement search functionality into the Exposed using jirutka s RSQL parser RSQL is a query language for parametrized filtering of entries in RESTful APIs JetBrains Exposed is a lightweight SQL library on top of the JDBC driver for Kotlin language Setting up a test applicationNOTE You can skip this part and go directly to RSQL search functionality implementation part if you have any web framework exposed setup ready For the sake of the test we use Ktor the easiest way to do so is to use initializer Once we go through the form the application frame is ready to work with Now we need to add serialization functionality because we want to return a JSON object as the response build gradle tsplugins kotlin plugin serialization version depenendencies implementation io ktor ktor server content negotiation implementation io ktor ktor serialization kotlinx json We may need H database build gradle tsdependencies implementation com hdatabase h hVersion plus we need jirutka rsql parserbuild gradle tsdependencies implementation cz jirutka rsql rsql parser Adding the ExposedNow we can add our persistence layer Exposed ORM build gradle tsdependencies implementation org jetbrains exposed exposed core implementation org jetbrains exposed exposed dao implementation org jetbrains exposed exposed jdbc In order to create a database connection and perform the initial db insert I created Ktor s plugin Data ktimport pl brightinventions dto CreatePersonDtoimport pl brightinventions exposed Databaseimport pl brightinventions persistance PersonDaoImplimport pl brightinventions persistance table PersonTableimport io ktor server application import org jetbrains exposed sql SchemaUtilsimport org jetbrains exposed sql transactions transactionfun Application configureData Database register TODO more logic incoming and register it on the application startup Application ktimport pl pl brightinventionsugins configureDataimport pl pl brightinventionsugins configureRoutingimport io ktor serialization kotlinx json import io ktor server application import io ktor server engine import io ktor server netty import io ktor server plugins contentnegotiation fun main embeddedServer Netty port host install ContentNegotiation json configureData start wait true Persistence layer logicOnce we added Exposed into our environment it s time to introduce the table s model and some DTOs In Exposed the table s representation is an object PersonTable ktimport org jetbrains exposed sql Tableobject PersonTable Table person val id uuid id autoGenerate val name text name val surname text surname val age integer age Your object table needs to extend from the Exposed Table The content of it is a group of defined columns Let s create our DAOs PersonDaoImpl kt I skip the DAO interface part you can check it on the Github repo page import pl brightinventions dto CreatePersonDtoimport pl brightinventions dto FoundPersonDtoimport pl brightinventions exposed SearchPropertySpecificationimport pl brightinventions exposed SearchSpecificationimport pl brightinventions exposed searchimport pl brightinventions persistance table PersonTableimport org jetbrains exposed sql ResultRowimport org jetbrains exposed sql insertimport org jetbrains exposed sql selectAllimport org jetbrains exposed sql transactions transactionclass PersonDaoImpl PersonDao override fun findAll List lt FoundPersonDto gt transaction PersonTable selectAll map mapToFoundPerson override fun findByQuery query String List lt FoundPersonDto gt transaction TODO will be implemented soon private fun mapToFoundPerson it ResultRow FoundPersonDto it PersonTable id it PersonTable name it PersonTable surname it PersonTable age override fun create person CreatePersonDto transaction PersonTable insert it name person name it surname person surname it age person age As you can see we defined three public methods findAll will return all the records from the dbfindByQuery String will return a filtered set of the recordscreate our util function we will use for initial inserts Initial insertOnce we have Table and Dao ready we can go with implementing further our Data class Data ktfun Application configureData Database register transaction SchemaUtils create PersonTable PersonDaoImpl create CreatePersonDto John Doe PersonDaoImpl create CreatePersonDto George Smith PersonDaoImpl create CreatePersonDto Megan Miller What we did here In transaction block Every database access using Exposed is started by obtaining a connection and creating a transaction We created the table in the database SchemaUtils create call and filled up the DB with initial records REST endpointsRight we have the database filled up we can use our DAO to create a REST endpoint Routing ktimport pl brightinventions persistance PersonDaoImplimport io ktor server application import io ktor server response import io ktor server routing fun Application configureRouting val dao PersonDaoImpl routing get call respond dao findAll What did we do here We once again created Ktor s plugin for registering the routing here On the endpoint we are going to respond with ALL of the objects in the Person table But we need to register it in the application Application kt fun main embeddedServer Netty port host install ContentNegotiation json configureRouting configureData start wait true Run it baby GET http localhost should respond with a list of three persons John George and Megan Alright but when we will implement the searching functionality Now RSQL search functionality implementationFinally For now we have the ktor exposed stack set up everything works fine and we can add and list the objects from the database It s time to create the search method for the Query class import cz jirutka rsql parser RSQLParserimport cz jirutka rsql parser ast Nodeimport org jetbrains exposed sql Queryimport org jetbrains exposed sql andWhereimport org jetbrains exposed sql transactions transactionfun Query search query String specification SearchSpecification Query transaction val rootNode Node RSQLParser parse query val queryExpression rootNode accept ExposedRSQLVisitor specification andWhere queryExpression What we did here We declared the extension function Query search which parse query String into the tokens and calls our ExposedRSQLVisitor to interpret the query it returns the Query object itself so we will be able to perform as it would be standard Exposed functionality What is the ExposedRSQLVisitor It s our custom implementation jirutka rsql parser is the only parser for a perform the logic in order to change age in into the node tree It is how it looks like this ExposedRSQLVisitor ktimport cz jirutka rsql parser ast import org jetbrains exposed sql Columnimport org jetbrains exposed sql Opimport org jetbrains exposed sql SqlExpressionBuilder eqimport org jetbrains exposed sql SqlExpressionBuilder greaterimport org jetbrains exposed sql SqlExpressionBuilder greaterEqimport org jetbrains exposed sql SqlExpressionBuilder inListimport org jetbrains exposed sql SqlExpressionBuilder lessimport org jetbrains exposed sql SqlExpressionBuilder lessEqimport org jetbrains exposed sql SqlExpressionBuilder neqimport org jetbrains exposed sql SqlExpressionBuilder notInListimport java time Instantimport java time format DateTimeParseExceptionclass ExposedRSQLVisitor private val searchSpecification SearchSpecification NoArgRSQLVisitorAdapter lt Op lt Boolean gt gt override fun visit node AndNode Op lt Boolean gt TODO Not yet implemented override fun visit node OrNode Op lt Boolean gt TODO Not yet implemented Suppress UNCHECKED CAST override fun visit node ComparisonNode Op lt Boolean gt val arguments node arguments map it toLongOrNull it toBooleanStrictOrNull it toDateOrNull it toDoubleOrNull it val argument arguments first val property searchSpecification properties first it name node selector val column property column as Column lt Any gt return when val operator node operator RSQLOperators EQUAL gt column eq argument RSQLOperators NOT EQUAL gt column neq argument RSQLOperators GREATER THAN gt column greater argument as Comparable lt Any gt RSQLOperators GREATER THAN OR EQUAL gt column greaterEq argument as Comparable lt Any gt RSQLOperators LESS THAN gt column less argument as Comparable lt Any gt RSQLOperators LESS THAN OR EQUAL gt column lessEq argument as Comparable lt Any gt RSQLOperators IN gt column inList arguments RSQLOperators NOT IN gt column notInList arguments else gt throw Exception Filter operator operator not supported private fun String toDateOrNull Instant try Instant parse this catch e DateTimeParseException null What we did here In essence we implemented NoArgRSQLVisitorAdapter which is going to visit the node in order to determine what logic operation exposed should we perform to the given column argument So if we will have a query string like age in our Visitor will producecolumn lt PersonTable age gt inList listOf so our SQL query will be SELECT PERSON ID PERSON NAME PERSON SURNAME PERSON AGE FROM PERSON WHERE PERSON AGE IN It s time to use the search method in our DAO and call it in the controller PersonDaoImpl ktIt s time to use the search method in our DAO and call it in the controller PersonDaoImpl ktPlease note the SearchSpecifictation structure it s a way to tell the Visitor what kind of fields can be used in filtering and how they should be mapped to PersonTable columnsSearchSpecification ktdata class SearchSpecification val properties List lt SearchPropertySpecification gt data class SearchPropertySpecification val name String val column Column lt gt and a controllers call Routing kt get filtered call respond dao findByQuery call request queryParameters query GET http localhost filtered query age in will return us two records for John Doe and Megan Miller ConclusionIn this article we ve learned how to add generic search functionality to our Exposed stack Ktor added just a flavor of something other than Spring Boot I did it on purpose maybe you will find it interesting enough to dig deeper about this framework You can find the complete code over GitHub By Patryk Szlagowski Senior Backend Developer bright inventions |
2023-03-23 12:39:14 |
海外TECH |
DEV Community |
How to ship faster to production? |
https://dev.to/woovi/how-to-ship-faster-to-production-2e1f
|
How to ship faster to production Speed is underrated I know we need the right direction but after you know where do you want to go you need to accelerate and speed up Startups and companies in general should move fast This is how we accelerate innovations in our world We can always optimize and go a bit faster I will list many things that can help you to ship faster to production with confidence all these are used in Woovi and are being improved in a daily basis Git Branching modelThere are many ways to manage your source code and how your team will work on it Git Flow is slow and it will block your team unnecessary Move to thunk based development where you prefer to hide WIP features behind feature flags instead of waiting for a QA Every pull request should go against main branch and each commit at main branch should update the staging environment You can control production release via special pull request workflow or git tag CI CDLint Tests Deployments Everything that needs to be automated should be automated Add conditional build to make sure your CI CD is fast and provide a fast feedback loop for developers Automate your dependencies updates using dependabot and automerge Automated TestsAutomated tests make sure new code won t cause regressions You can use automated tests to guide your development like TDD to make sure your implementation is correct I bet that you are going to reach the solution faster iterating against an automated test Automated tests let you release a new version to production any time If you don t know how to test you probably don t know what your coding is doing Staging environmentThe staging environment should be as close to production as possible Staging is your last chance to catch bugs before they reach your users The staging environment makes it easy for non developers to validate if the UX and business logic is correct Link previews on pull request can help a lot for hard changes on design system or landing page that can affect the whole product DocumentationWritten documentation is the only way to scale knowledge in an asynchronous and remote workplace Without documentation every developer needs to relearn everything every time and learning is very slow You can also add Request for Comments RFC for your documentation to review plan and discuss new features and proposal before coding This reduces uncertainty and makes sure you are building the right thing MonitoringYou need real time monitoring to be able to release many times in the same day Real time monitoring and alerts let you track regressions in performance and new bugs when a release happens When a regression goes to production you have two choices land a hotfix or rollback If the regression is not critical just land a hotfix Otherwise just land a rollback and work in a fix with more time You can also reduce the risk of deployment having a rollout approach for your release or using feature flags Decoupling servicesBreaking your monolith in services can help you reduce the risk of a new release When you have separated and isolated services you can release only the ones that changed since the last release reducing the risk of the release All in allEvery item listed above is about reducing the development cycle making the feedback loop as fast as possible reducing the diff what new code will be pushed to production and reducing the risk If we don t do a release in a given day at Woovi we are going to release to production at least commits with a lot of new code so we prefer to do many releases per day to reduce the risk and burden of having to retest everything again What items of this list your company does not have set up yet If you are struggling to set up this in your company give me a ping and I can help you out ReferencesBranching PatternsWooviWoovi is a Startup that enables shoppers to pay as they like To make this possible Woovi provides instant payment solutions for merchants to accept orders If you want to work with us we are hiring Photo by Isaac Jenks on Unsplash |
2023-03-23 12:37:06 |
海外TECH |
DEV Community |
JavaScript Closure |
https://dev.to/makstyle119/javascript-closure-2nb5
|
JavaScript ClosureJavaScript closures are an essential concept that every developer should understand In simple terms closures allow developers to access and manipulate variables outside of their current scope They are powerful tools for creating modular and efficient code but can also be a source of confusion and unexpected behavior What is a closure in JavaScript A closure is a function that has access to its parent function s variables even after the parent function has returned This is because the child function maintains a reference to the parent function s variables in memory The concept of closure can be a bit abstract but it becomes clearer with a simple example In this example outerFunction creates a variable called outerVariable and then defines an inner function called innerFunction innerFunction has access to outerVariable even though it is defined outside of its own scope When we call outerFunction it returns innerFunction which we assign to the variable closure When we call closure it logs the value of outerVariable to the console Why use closures Closures can be incredibly useful in JavaScript programming One common use case is to create private variables and functions By using a closure we can define a variable or function within a function s scope that is not accessible from outside the function This can help us create more secure and modular code In this example counter creates a variable called count and two inner functions called increment and decrement increment and decrement have access to count even though it is not defined within their own scope counter returns an object that exposes the increment and decrement functions This allows us to create multiple independent counters each with their own private count variable Closures can also help us create more efficient code by reducing the number of global variables Global variables can lead to naming conflicts and make it difficult to reason about the code s behavior By using closures to create private variables and functions we can reduce our reliance on global variables and make our code more modular Potential pitfalls of closuresWhile closures can be incredibly useful they can also be a source of confusion and unexpected behavior One potential pitfall of closures is the issue of variable scope Closures can cause variables to persist in memory even when they are no longer needed leading to memory leaks and decreased performance Another potential issue with closures is that they can create unexpected interactions between variables in different scopes This can lead to hard to debug errors and make it difficult to reason about the code s behavior Conclusion JavaScript closures are a powerful tool for creating more efficient and modular code They allow developers to access and manipulate variables outside of their current scope which can help create more secure and efficient code However closures can also be a source of confusion and unexpected behavior so it is important to use them with care and consideration By understanding closures and their potential pitfalls developers can write better more maintainable code |
2023-03-23 12:24:35 |
Apple |
AppleInsider - Frontpage News |
Apple TV+ to spend $1 billion annually on movie theatrical releases |
https://appleinsider.com/articles/23/03/23/apple-tv-to-spend-1-billion-annually-on-movie-theatrical-releases?utm_medium=rss
|
Apple TV to spend billion annually on movie theatrical releasesApple TV is reportedly looking to make more original films and also partner with other studios to distribute them with extended theatrical runs Killers of the Flower Moon publicity stillNot only did Apple first release its CODA movie in theaters it later re released it to celebrate its winning an Oscar for best picture No Apple TV film has had more than a limited run in theaters or been screened in more than a few hundred sites though and now that may be about to change Read more |
2023-03-23 12:47:04 |
Apple |
AppleInsider - Frontpage News |
Aqara Video Doorbell G4 is battery powered with HomeKit Secure Video |
https://appleinsider.com/articles/23/03/23/aqara-video-doorbell-g4-is-battery-powered-with-homekit-secure-video?utm_medium=rss
|
Aqara Video Doorbell G is battery powered with HomeKit Secure VideoAqara s previously announced Video Doorbell G is now available delivering HomeKit Secure Video in a battery powered device with a separate chime speaker First seen at CES Aqara s new Video Doorbell G is a p camera that features on device facial recognition This technology is already in Aqara s Camera Hub G and it is meant to allow for automation So a user could create an automation where the camera triggers a HomeKit scene on their return Aqara also says that if a regular postman or woman is spotted the camera could play a prerecorded message Read more |
2023-03-23 12:13:39 |
海外TECH |
Engadget |
Samsung SSDs and memory cards are up to 54 percent off at Amazon |
https://www.engadget.com/samsung-ssds-and-memory-cards-are-up-to-54-percent-off-at-amazon-122019880.html?src=rss
|
Samsung SSDs and memory cards are up to percent off at AmazonYou can grab Samsung SSDs and microSDs at a discount right now from Amazon if you re looking to expand the storage space of your computers consoles or mobile devices To start with Samsung s TB T Shield portable SSD is down to At percent off retail it s now available for the lowest price we ve seen it sell for on the e commerce website We named the non rugged or non Shield T as one of our best SSDs for and this has similar specs and features Take note that the beige blue and black color choices are all on sale and the TB T Shield is also listed for a discounted price of Buy Samsung SSDs and memory cards at Amazon up to percent offThe T Shield was designed to be durable to be dust and water resistant and to have the ability to endure being dropped for up to feet It has a read write speed of MB s and is compatible with PC Mac Android devices and consoles nbsp If what you need is an internal SSD though Samsung s PRO TB SSD is also on sale for Like the T that s the lowest price we ve seen for the component which retails for You can also get its TB version for in case you want a drive with a bigger capacity The model was specifically designed for gamers and tech enthusiasts and offers high performance bandwidth that can help make heavy duty applications run smoothly nbsp The Amazon sale has other SSDs to choose from but if you re looking to buy a memory card there s Samsung s EVO Plus GB Micro SDXC It s currently listed for which is an all time low for the microSD card that retails for Need even more space The GB version of the model is also on sale for or percent lower than its usual price Follow EngadgetDeals on Twitter and subscribe to the Engadget Deals newsletter for the latest tech deals and buying advice This article originally appeared on Engadget at |
2023-03-23 12:20:19 |
ラズパイ |
Raspberry Pi |
Launching Ada Computer Science, the new platform for learning about computer science |
https://www.raspberrypi.org/blog/ada-computer-science/
|
Launching Ada Computer Science the new platform for learning about computer scienceWe are excited to launch Ada Computer Science the new online learning platform for teachers students and anyone interested in learning about computer science With the rapid advances being made in AI systems and chatbots built on large language models such as ChatGPT it s more important than ever that all young people understand the fundamentals The post Launching Ada Computer Science the new platform for learning about computer science appeared first on Raspberry Pi Foundation |
2023-03-23 12:56:28 |
海外TECH |
CodeProject Latest Articles |
LogViewer Control for WinForms, WPF, and Avalonia in C# & VB |
https://www.codeproject.com/Articles/5357417/LogViewer-Control-for-WinForms-WPF-and-Avalonia-in
|
LogViewer Control for WinForms WPF and Avalonia in C amp VBDot Net Core LogViewer Control for WinForms WPF and Avalonia using the ILogger Framework with Microsoft Logger Serilog in C VB on Windows Mac OS and Linux |
2023-03-23 12:49:00 |
医療系 |
医療介護 CBnews |
医療費の地域差縮小、がん化学療法など俎上に-同時改定見据え具体化、政府方針 |
https://www.cbnews.jp/news/entry/20230323210739
|
人当たり |
2023-03-23 21:17:00 |
ニュース |
@日本経済新聞 電子版 |
パパやママが声をふき込むと、AIがそっくりの声を合成。読み聞かせをするのはスピーカー「coemo」です。SNSの発達で発声の機会が少なくなる中、聴覚を刺激する消費は注目を集めそうです。
#ヒットのクスリ
https://t.co/BMrVP5OYai |
https://twitter.com/nikkei/statuses/1638883320108056578
|
パパやママが声をふき込むと、AIがそっくりの声を合成。 |
2023-03-23 12:40:07 |
ニュース |
@日本経済新聞 電子版 |
定年後のやりがい探し 50代以降を3つに分けて考える
https://t.co/jGzm7DEDUJ |
https://twitter.com/nikkei/statuses/1638882759769980928
|
定年 |
2023-03-23 12:37:53 |
ニュース |
@日本経済新聞 電子版 |
英中銀、11会合連続の利上げ 幅は0.25%に縮小
https://t.co/ylj8475yKT |
https://twitter.com/nikkei/statuses/1638880269016129537
|
連続 |
2023-03-23 12:27:59 |
ニュース |
@日本経済新聞 電子版 |
アメリカで相次ぐ銀行破綻。万が一、金融不安が強まっても慌てないように、普段から実践できる「資産形成を進めるうえでの3つのポイント」をタレントREINAさんとポッドキャストで学びます。(無料記事です)
https://t.co/85HFVqBpWa |
https://twitter.com/nikkei/statuses/1638878271764041731
|
|
2023-03-23 12:20:03 |
ニュース |
@日本経済新聞 電子版 |
三菱商事、米国でスマートマンション 新興と連携
https://t.co/RzP4pY3L4O |
https://twitter.com/nikkei/statuses/1638877484094746624
|
三菱商事 |
2023-03-23 12:16:55 |
海外ニュース |
Japan Times latest articles |
Shoma Uno leads after short program with Ilia Malinin in hot pursuit |
https://www.japantimes.co.jp/sports/2023/03/23/figure-skating/isu-worlds-2023-men-short/
|
Shoma Uno leads after short program with Ilia Malinin in hot pursuitThe reigning world champion delighted on the first night of the men s singles competition at the ISU World Figure Skating Championships |
2023-03-23 21:46:16 |
海外ニュース |
Japan Times latest articles |
Samurai Japan return home to heroes’ welcome after WBC win |
https://www.japantimes.co.jp/sports/2023/03/23/baseball/wbc-team-returns/
|
american |
2023-03-23 21:02:19 |
ニュース |
BBC News - Home |
Ike Ekweremadu: Organ-trafficking plot politician and wife guilty |
https://www.bbc.co.uk/news/uk-england-london-65013545?at_medium=RSS&at_campaign=KARANGA
|
ekweremadu |
2023-03-23 12:55:44 |
ニュース |
BBC News - Home |
Cost of living: Food banks used by 3% of UK families |
https://www.bbc.co.uk/news/uk-65050920?at_medium=RSS&at_campaign=KARANGA
|
england |
2023-03-23 12:54:00 |
ニュース |
BBC News - Home |
Four-day junior doctor strike set for April |
https://www.bbc.co.uk/news/health-65052816?at_medium=RSS&at_campaign=KARANGA
|
england |
2023-03-23 12:17:05 |
ニュース |
BBC News - Home |
Splitting couples face fine for refusing mediation |
https://www.bbc.co.uk/news/uk-65049700?at_medium=RSS&at_campaign=KARANGA
|
coercive |
2023-03-23 12:26:36 |
ニュース |
BBC News - Home |
Head teachers call for Ofsted to be replaced |
https://www.bbc.co.uk/news/education-65050192?at_medium=RSS&at_campaign=KARANGA
|
death |
2023-03-23 12:03:54 |
ニュース |
BBC News - Home |
Man in court charged with mosque fire attacks in Birmingham and London |
https://www.bbc.co.uk/news/uk-england-birmingham-65049307?at_medium=RSS&at_campaign=KARANGA
|
london |
2023-03-23 12:39:08 |
ニュース |
BBC News - Home |
UK interest rates: What the rise means for you |
https://www.bbc.co.uk/news/business-57764601?at_medium=RSS&at_campaign=KARANGA
|
costs |
2023-03-23 12:20:08 |
ニュース |
BBC News - Home |
What is the Bank of England and why does it change interest rates? |
https://www.bbc.co.uk/news/business-50837114?at_medium=RSS&at_campaign=KARANGA
|
interest |
2023-03-23 12:29:47 |
ニュース |
BBC News - Home |
Watch the moment jets create enormous heart in sky |
https://www.bbc.co.uk/news/uk-england-nottinghamshire-65052282?at_medium=RSS&at_campaign=KARANGA
|
arrows |
2023-03-23 12:40:48 |
ニュース |
Newsweek |
巨大ワニ、高級住宅街でマイペースに道路を横切る フロリダ |
https://www.newsweekjapan.jp/stories/world/2023/03/post-101176.php
|
|
2023-03-23 21:45:00 |
コメント
コメントを投稿