投稿時間:2022-03-22 03:29:38 RSSフィード2022-03-22 03:00 分まとめ(30件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
js JavaScriptタグが付けられた新着投稿 - Qiita 【React hooks】 useReducer って何? https://qiita.com/pure-adachi/items/7a872dab62dee845c409 loadingをtrueに更新todosに件追加とloadingをfalseに更新今回は、stateがつなので、それほど複雑ではありませんが、useReducerを使って、ReduxのStoreのようにつのオブジェクトのように管理してみます。 2022-03-22 02:19:25
golang Goタグが付けられた新着投稿 - Qiita GoでGitHubへpushする前にmakeコマンドでprecommitする方法 https://qiita.com/hirac/items/2dc93f96ce7462382b99 precommitの内容makeコマンドでprecommit一括実行実行結果PR時のprecommitcheckリストprecommitの内容precommit時のそれぞれの整形linterチェックについて以下記します。 2022-03-22 02:12:46
技術ブログ Developers.IO Amazon IVSのコントロールプレーン対応リージョンが増えました![東京🗼リージョンも追加] https://dev.classmethod.jp/articles/amazon-interactive-video-service-available-new-control-plane-regions/ amazon 2022-03-21 17:48:28
海外TECH Ars Technica Big-battery F-150 Lighting exceeds range estimates in official EPA testing https://arstechnica.com/?p=1842481 lightning 2022-03-21 17:21:01
海外TECH MakeUseOf What Is Memory Compression in Windows and How Do You Enable or Disable It? https://www.makeuseof.com/windows-memory-compression-guide/ What Is Memory Compression in Windows and How Do You Enable or Disable It Window s Memory Compression feature helps keep your computer working as quickly as it can and it s very easy to enable or disable it 2022-03-21 17:15:14
海外TECH DEV Community A Brand NEW Kind of DEBUGGER for JavaScript (Dbux: Why? What?) https://dev.to/domiii/a-brand-new-kind-of-debugger-for-javascript-dbux-why-what-1dj7 A Brand NEW Kind of DEBUGGER for JavaScript Dbux Why What Intro VideoDbux is an integrated debugging environment IDbE and omniscient debugger for JavaScript runtime analysis The following video explains why we need better Debuggers demonstrates all of Dbux s tools with plenty of examples is fully timestamped if you are impatient we recommend taking a quick glimpse by skipping around a bunch On a Personal NoteI have been programming for some years in all kinds of languages And until recently I could not quite figure out why sometimes even some of the easiest bugs take some minutes to find It was that frustration that moved me to start this project on years ago The project has been driven by the wish to better and more intuitively understand what is going on under the hood not only in the applications that I build myself but also in all that third party code that I am making such heavy use of At this point I feel this project has started providing some very good answers to those mind boggling questions I had before I start to feel a greater sense of clarity when confronting that dark matter of debugging even when Dbux is not available Call to ActionIf you are so inclined please check it out and just bombard me with any questions complaints any kind of feedback I would greatly appreciate it ReferencesGitHub Documentation Discord The video briefly mentions Henry Lieberman s informal The Debugging Scandal and What to Do About It I strongly recommend the avid reader to check that out as well Also shout out to CreditLastly thanks go out to Michael who has been with me from the beginning and everyone else who for a brief period of time contributed whatever they could 2022-03-21 17:48:59
海外TECH DEV Community The basics of IoT devices Management https://dev.to/yongchanghe/the-basics-of-iot-devices-management-4np3 The basics of IoT devices Management ProvisioningDevice provisioning is the first step in IoT management This step is for first time setup in order to create an account set up the network connection and so on Provisioning is similar to configuration as we will discuss Both of these processes involve customizing your device Provisioning modifies the device from its original off the shelf settings to those required for the device to be integrated into your network Configuration can be performed anytime AuthenticationAuthentication is the process of confirming a device s identity as it is enrolled into the IoT system and authenticating users at login Proper IoT device identity management and authentication assure that only authorized devices are enrolled to prevent intrusions and keep proprietary information confidential To enable authentication administrators establish device and network security settings so that access attempts can be authorized or blocked ConfigurationIoT configuration management as we discussed in the provisioning section is a method of customizing the functionality of your IoT device For example you can add additional sophistication and intelligence to a device optimize its features with additional code or revise its settings for new requirements Because devices and networks are like living organisms they often need further configuration beyond that initial provisioning phase It is important to be able to configure one or more devices efficiently securely and remotely anytime the need arises ControlOnce devices are authenticated configured installed and connected to the network you need to be able to control them remotely In most cases the behavior of devices will be established in the provisioning and authentication phases to automate the device s processes For example you can launch processes such as turning on frost fans for crop management establishing edge computing functionality wake up and reporting behaviors and sensor and gateway communications However administrators also need IoT device control capabilities in order to access devices across the network in multiple ways over time Examples include Overriding automated processes for short term application requirementsMaking adjustments to settingsRemotely rebooting devicesEnsuring each device is up and running and optimized to perform as needed for the application MonitoringRemote monitoring of your IoT devices is one of the key objectives of IoT device management supporting a range of application objectives System metrics View device uptime and other events occurring across the network from a dashboard Data reporting Gain critical insights on user defined data points These data points can include measurements such as tank levels the temperature of concrete pours and other sensor data Notifications Establish user defined notifications for events to support critical decisions and predictive maintenance To prevent critical system failures loss of data or performance degradation administrators need to be notified of changes across the network that can affect performance Security the ability to both detect and remediate security breaches such as attempted device configuration changes and to provide notifications to system administrators of these events DiagnosticsWith the IoT device management processes in place that we have discussed so far administrators have the ability to perform diagnostics on the health of the entire device network as well as that of any individual device These processes enable administrators to perform diagnostics from a management platform in order to troubleshoot and remediate issues quickly and efficiently There are multiple benefits of the ability to perform diagnostics remotely Identify system issues rapidly to prevent costly downtimeRemediate issues remotely including the ability to access devices that are offline “out of band Avoid costly “truck rolls  to troubleshoot and fix issues MaintenanceThe ability to maintain visibility across the device deployment get alerts and troubleshoot issues is one of the most important aspects of IoT device management Device maintenance is the ongoing effort to keep devices tuned to the needs of the business application and goes hand in hand with monitoring diagnostics and software updates Without a strategy for performing these ongoing maintenance tasks teams are forced to find a way to perform these updates manually In many cases the result is that device deployments lapse in security and fall out of compliance  References 2022-03-21 17:34:07
海外TECH DEV Community How to deploy Drupal on cloud with Docker https://dev.to/scaledynamics/how-to-deploy-drupal-on-cloud-with-docker-j09 How to deploy Drupal on cloud with DockerDrupal is an open source content management platform powering millions of websites and applications We will see how you can easily deploy a simple Drupal website on Docker to the cloud with ScaleDynamics IntroductionDrupal is one of the most popular CMS Content Management Software Build with PHP It is a versatile open source platform for building amazing digital experiences Drupal is used to make many of the websites and applications you use every day see the official showcases Drupal has great standard features like easy content authoring reliable performance and excellent security But what sets it apart is its flexibility modularity is one of its core principles PrerequisitesTo follow this tutorial we will need Node js lt we recommend to install the latest LTS versionBasic knowledge of Docker and more specifically about Dockerfile Init your Drupal applicationFrom your terminal start by creating a new folder named drupal app and change directory into it mkdir drupal appcd drupal appThen create a new file named Dockerfile and paste the following code into it in order to build you container from an official image of Drupal downloaded from Docker Hub drupal app DockerfileFROM drupal latestEXPOSE In this configuration we have chosen the official Drupal image with the latest tag For a production use case we recommend setting a stable version with a specified number like drupal for example Configure your cloud deploymentThe application is ready now let s look at the deployment part Account creation and resource selectionTo deploy this application on ScaleDynamics s cloud you need an account and create an environment with a resource for it The cloud resource provides virtual CPU and storage capacities used to execute the app In this tutorial we will use a free shared resource available on ScaleDynamics s cloud These are the best one for testing In this tutorial we will see later how you can upgrade to a dedicated production resource on the public cloud provider and region of your choice If you don t have an account feel free to create one here it s free and no credit card are required Once your account is created sign in Let s create a project and an environment on the ScaleDynamics s Console Select your organization create a new project then create a new environment Now you need to choose what kind of service is required for your deployment There are four types Managed HTTP DockerManaged Node js serverManaged Node js moduleStatic assets hostingFor this Drupal project we need a Docker container to run the PHP server Let s pick the managed HTTP Docker You can learn more on the other types in the ScaleDynamics documentation Configuration fileNow let s add a configuration to tell the SDK what type of application we want to deploy At the root of the project create a new file named warp config js with the following content drupal app warp config jsmodule exports docker drupal app Deploy your Drupal containerNext to deploy your container on the ScaleDynamics platform you have to use the CLI from SDK Install SDKFirst install once our public SDK called warp and available on the official npm registry Install the library as development dependency in your project npm init ynpm install save dev warpOr install it as an npm global dependency on your system npm install g warpFor the next steps we will use the npx command to run each warp command The npx command allows you to run an arbitrary command from an npm package either one installed locally or fetched remotely in a similar context as running it via npm run If you need help on the warp CLI just run the help command as below npx warp helpSee more about SDK installation and its use in the ScaleDynamics documentation Login to ScaleDynamicsFor the first time you must login to the ScaleDynamics platform So run once the warp login command to enter your account credentials npx warp loginNote that the prompt will ask you to select an organization only if you have more than one Run deploymentNow it s time to deploy your awesome Drupal project on your managed cloud resource To achieve that step you just need to run the warp deploy simple command line npx warp deployThe deploy command will detect that your application needs to be deployed as Docker resource The interactive mode will ask you to pick a project and an environnement in order to deploy your Drupal container on cloud Then you will have to choose a domain name as public URL Leave blank if you want a generate random one Your Drupal container is now deployed and ready to use from the returned public URL On the next step you will have to configure your Drupal website In addition you can automate your deployment and avoid interactive mode with the following options It can be useful to run that operation from your CI CD pipeline by example npx warp deploy project lt project name gt env lt env name gt See more about warp deploy command in the SDK documentation Setup your Drupal websiteOpen your browser go the URL of your managed Docker resource that now serves your Drupal container and start the setup set by step of your website The first load will show you the Drupal interactive initial setup First pick your language on form and continue Then select the Demo Umami Food Magazine as current installation profile This option will generate a ready to use website sample built from the Drupal CMS that show off some of its most common capabilities If you are already familiar with the Drupal platform choose a Standard or Minimal profile according to your needs Next step select the SQLite database for this sample and set your admin password For production usage we recommend using an external database like MySQL or PostgreSQL You can easily find a DBaaS Database as a Service provider to host your data Finally step just wait for the complete installation Well done Your new Drupal website is now live on the cloud provider of your choice You can go in the Log in section of your published website enter your admin credentials and try the awesome features offered by the Drupal platform Note that you can easily import export and synchronize your Drupal configuration from the administration page See details on the Drupal documentation Go further with dedicated resourcesIf you need a powerful resource with more vCPU RAM or storage to host your production server you can upgrade dynamically to a dedicated resource from your ScaleDynamics Console As shown below it s as simple as a few clicks What s nextAt this stage you have an awesome Drupal website published on cloud with Docker You can learn more on the ScaleDynamics documentation like how to get the logs of your server use a custom domain implement a CI CD pipeline etc Enjoy 2022-03-21 17:23:07
海外TECH DEV Community The Curious Case of Celery Work-flows https://dev.to/akarshan96/the-curious-case-of-celery-work-flows-39f7 The Curious Case of Celery Work flowsHello Community While most humans would take a break I decided to skip rest and spend the next few hours on a Saturday discussing various use case that can be implemented of Celery Work flows I find documentation little hard to understand hence decided to write this blog When Celery work flow If celery tasks have some kind of dependency on one another based on order of execution The order of execution can be decided based on A task need to be run before another A task need to return some data critical for the execution another Tasks need to be executed in parallel to optimize performance Celery is a powerful task queue that enables more complex workflow rather executing just a task Work flow enable us orchestrate various tasks Back to Basics ️Let s take a refresher course on Celery The first thing we are going to discuss about terms relevant in the context to this blog Task vs Subtask vs SharedtaskTask vs SubtaskTask vs Sharedtask SignatureLet us consider an example Suppose we have to create a Celery Work flow where we want to tasks say Task A and Task B executed one after another Task A returns a result to be consumed or required by Task B We won t be having result from task a which is result return value of the prior task Task A while defining the workflow So here we will use signature which allows us to provide a placeholder for the argument Signatures can be written astask signature arg arg ortask s arg arg Cases of Celery Work flow Creation Tasks execution in Series Chain This is a simple case where we want to execute one task after completion of another For this we use chain The chain function takes in a list of signatures Suppose we have to create a work flow similar to above diagram and result from Task A needs to be returned to Task B The work flow will be as follows from celery import chainfrom task import task a task b task cwork flow chain task a arg arg task b result arg arg task c arg arg another way to express a chain using pipeswork flow task a arg arg task b result arg task c arg arg Notice the first argument of task b is the result of task a Tasks execution in Parallel Group There can be a case where we require to execute tasks in parallel We may execute different tasks or same task with different arguments in parallel We use Group to execute tasks in parallel The group function takes in a list of signatures Group can be used in scenarios where we are waiting for responses from I bound task like reading from DB or calling external API or downloading file from external storage running heavy computations on different nodes from celery import groupfrom task import task a task b task cwork flow group task a arg arg task b arg arg task c arg arg execute same task with different arguments in groupwork flow group task a arg task a arg task a arg Tasks execution both in Series and Group Combination of Chain Group and Cord Now let s talk about a case where we have combination of tasks that need to be executed in both in series and parallel Taking example of the work flow diagram given above we can further discuss below sub scenarios Task execution before Group TasksIf we want to execute group tasks after execution of a task we can use both group and chain Observing the work flow diagram we have to execute Task and after it s execution we need to run Task A Task B and Task C The work flow can be written as from celery import group chainfrom task import task zero task a task b task cwork flow chain task zero group task a result arg task b result arg task c result arg if we want to express a chain using pipeswork flow task zero group task a result arg task b result arg task c result arg You can notice how result of task zero is passed to tasks in group Task execution after Group TasksThe task executed after group task which generally aggregates results returned by tasks in group is called as callback or callback task We use chord to define both group and callback tasks A chord has parts header and callback The header is a group of tasks the callback is executed once the group task completes its execution The results from group tasks are aggregated and passed to callback task in first argument as list The work flow diagram wants us to run Callback Task after Task A Task B and Task C Complete work flow can be written as from celery import group chain chordfrom task import task zero task a task b task cheader group task a result arg task b result arg task c result arg callback callback result argz work flow chain task zero cord header callback Generating Group tasks from Chain task Map Here is a very interesting case where we want to create a group from a list returned by a task such that for each item in the task result set one task will be added to the group Let me explain with help of an example Suppose we need to iterate through files in S bucket at the point of task execution and download them to the server For this we define tasks The first task get files from bucket will generate a list of file paths in S as result s foo bucket path to file s foo bucket path to file s foo bucket path to file Now for every path in the list we will add a task download file from s another task responsible to download file from S to the server in a group These group tasks can then run in parallel and download files to the server This is different from since there we have clarity on tasks to be executed in group while planning or defining the workflow But here the group tasks to be executed is decided by the prior task In this case we will use a Map Map unlike chord chain and group is a task itself Map task is provided with result and task to which a list of arguments retrieved from result are applied from celery import subtask group shared task shared taskdef dmap result some task Map a task over an result and return as a group subtask is a task with parameters passed but not yet started some task subtask some task iterating over result and cloning task group task group some task clone arg for arg in it return group task from task import get files from bucket download file from s dmapwork flow dmap s get files from bucket s download file from s s Conditional Tasks execution Map Suppose we need examine result to decide which task to execute next or to plan the future tasks to be executed in the workflow In the above example where we are only downloading file from S we need to expand to other storages as well We have type of tasks Task get paths from db which will fetch file paths from database This task will return a list of paths Task download file from xxxx which download file from given path to the server from respective storage This task will return path of the file where it is downloaded to the server Task write paths to file which will aggregate and print the paths of downloaded file in txt file This task in turn acts like a chord from celery import subtask group shared task shared taskdef dmap result end task task list for arg in result storage get storage from path arg if storage s task sub task download file from s s arg elif storage gcp task sub task download file from gcp s arg elif storage azure task sub task download file from azure s arg else pass task list append task group task group task list pipeline group task end task return pipeline from task import dmap get paths from db callbackwork flow dmap s get paths from db s write paths to file s Thank you for reading I am happy to take up suggestions in the comment section Cheers 2022-03-21 17:14:55
海外TECH DEV Community Python scripting basics - Tic-tac-toe game. https://dev.to/soumyajyotibiswas/python-scripting-basics-tic-tac-toe-game-12hk Python scripting basics Tic tac toe game ContentsSummaryCodeLet s talk logicBuilding the score board and displaying itInputs from playersValidating player provided nameValidating player provided symbolSetting the symbol for the computerChecking which cells are available to add input toValidating if a player is providing correct input for cell valueAuto populating the last cellChecking who wonBonusAdding a time delayAscii artPutting it all together Summary Okay who hasn t played tic tac toe Okay try noughts and crosses Still no This is one of the classic games out there quick short and fun Take a look at the wikipedia page Today we are going to build the game from scratch to be played on a terminal and yes we are going to use python So let s begin shall we LINK TO GITHUB VIDEO Code Let s talk logic Tic tac toe is played between two players on a x grid One playes chooses X and the other player chooses O Anyone can play first but for our game let us consider whoever chooses X gets to play first Any player who gets three X or O in a row or column or diagonally wins the game If at the end of the game no player is able to achieve that the game ends in a draw The following table demostrates how a x grid would look like Each row and its associated column number is displayed as the cell value For row column it is RC row column it is RC etc RCRCRCRCRCRCRCRCRCFor a player to win they have to get their chosen symbol of X or O in one of the following series It doesn t matter the order which they went for one first Winning CombinationsRC RC RCRC RC RCRC RC RCRC RC RCRC RC RCRC RC RCRC RC RCRC RC RCWe will do the following in orderDisplay the set of rules to the player Ask the player to enter their name and if they don t we will assign one say Bob How does Bob sound Ask the player if they want X as their playing symbol or O and assign the other one to the computer Let our computer side player green our human Design a pretty looking score board to keep track of their scores While the game is being played we willDisplay the cell locations which are not yet occupied by X or O Let the computer decide randomly which cell value to pick as its choice I am keeping this basic At a later point of time will add difficulty levels to the game and will let the computer play offensive After both the player and computer has provided their input check if anyone has won Building the score board and displaying it We will use two modules here pandas and tabulate Pandas will give as the dataframe to store data into and we will tabulate to make it pretty You can install both into your environment using the following command python m pip install pandaspython m pip install tabulate This is how our dataframe will look like gt gt gt import pandas gt gt gt pandas DataFrame columns C C C index R R R C C CR R R gt gt gt This is how our final scoreboard will look like on display gt gt gt import tabulate gt gt gt d pandas DataFrame columns C C C index R R R gt gt gt print tabulate tabulate d tablefmt fancy grid showindex False ╒════╤════╤════╕│ │ │ │├ー┼ー┼ー┤│ │ │ │├ー┼ー┼ー┤│ │ │ │╘════╧════╧════╛ Inputs from players Validating player provided name Store the user provided name in a global variable If the name is empty assign a default name Bob gt gt gt validate user input name Enter your name SB gt gt gt print user input name Sb gt gt gt validate user input name Enter your name gt gt gt print user input name Bob Validating player provided symbol Ask the player if they want to choose X as their symbol or O and assign the opposite to the computer to play with Any invalid attempts a total of three will end the game gt gt gt validate user input name Enter your name sb gt gt gt user input name SB gt gt gt validate user input symbol Player SB enter either X O without the quotes x gt gt gt user input symbol X gt gt gt validate user input symbol Player SB enter either X O without the quotes zPlayer SB enter either X O without the quotes aPlayer SB enter either X O without the quotes bTraceback most recent call last File lt stdin gt line in lt module gt File lt stdin gt line in validate user input symbolValueError Maximum invalid symbol choice attempts reached Thank you for playing gt gt gt cpu input symbol O gt gt gt validate user input symbol Player SB enter either X O without the quotes O gt gt gt user input symbol O gt gt gt cpu input symbol X gt gt gt Setting the symbol for the computer In the above section you see that the computer player symbol is automatically set the moment the player chooses a correct symbol We use a simple if else statement for that if user input symbol X cpu input symbol O else cpu input symbol X Checking which cells are available to add input to By using list comprehensions we can quickly find out which cells does not have a X or O value in it score board is our dataframe symbol choices is a list of X O score board iloc a b for a in range for b in range if score board iloc a b not in symbol choices Validating if a player is providing correct input for cell value Display the cells available for input using the previous method then ask for user input If the input provided by the user is incorrect three times exit empty slots get empty slots invalid input count while invalid input count lt user input cell choice input f nEnter either empty slots without the quotes if user input cell choice not in empty slots invalid input count else return user input cell choiceif invalid input count raise ValueError f Maximum invalid input count invalid input choice attempts reached Thank you for playing Auto populating the last cell The game will be played for rounds if no one has won before that and at the start of round only one cell will be left we can assign it the value of X We are using X since we are assuming that player using the X symbol starts the game X O X O X O X O X ←this will always be X Checking who won As described previously in our code logic section the winning combinations are as follows Winning CombinationsRC RC RCRC RC RCRC RC RCRC RC RCRC RC RCRC RC RCRC RC RCRC RC RCA simple iteration of X and O and comparing it with the dataframe values will show us if any of the players have already won or now symbol choices X O for symbol choice in symbol choices for i in range if symbol choice score board iloc i score board iloc i score board iloc i or symbol choice score board iloc i score board iloc i score board iloc i return True symbol choice player choices symbol choice if symbol choice score board iloc score board iloc score board iloc or symbol choice score board iloc score board iloc score board iloc return True symbol choice player choices symbol choice return False symbol choice player choices symbol choice Bonus Adding a time delay The time module has the sleep command which can be used to introduce a time delay making it look like the computer player is actually thinking about a choice gt gt gt import time gt gt gt time sleep this is in seconds Ascii art If you do not know this or this website already do pay them a visit Its fun to add some ascii graphics to terminal code Our friend The Machinee is from here it self Putting it all together Visit my GitHub page to check out the complete code to create a tic tac toe game that can be played on the terminal 2022-03-21 17:13:43
海外TECH DEV Community Static and Dynamic typing? Strong and weak typing? https://dev.to/leolas95/static-and-dynamic-typing-strong-and-weak-typing-5b0m Static and Dynamic typing Strong and weak typing Table of contents TOCIntroStatic vs DynamicStatic typingDynamic typingBut what about type inference Strong vs WeakCommon usesPros and cons TLDRUseful readings Intro When talking about typing in programming languages we tend to confuse the meaning of some terms We all have some notions of static vs dynamic typing and may even give some examples of strong vs weak typing based on languages we know But can we really explain these concepts to someone who is hearing them for the first time Could we write a blog post about them In this post I ll try to explain these concepts in simple terms so you can finally have that aha moment where you can talk about them with more confidence Static vs Dynamic To talk about static vs dynamic typing and strong vs weak typing is to talk about opposite poles of different axis Let s go with static typing first Static typing In static typing the type is bound to the variable Types are checked at compile time That means that in a statically typed language once the variable has been declared with a type you can t change that type later you can of course assign it new values but they must be of the same types Remember the type is bound to the variable not the values Let s see some code snippets in Java String s “hello System out Println s hello s “good System out Println s good s world System out Println s world This code is completely valid s is of String type and so are the values given to it But if we tried to do this String s “hello System out Println s hello s System out Println s The program wouldn t compile and we d see an incompatible types error we can t assign an int to a variable of type String The key take away of all this is that in static typing the type associated to the declaration of a variable is permanently bound to it and you can t change it with later assignments You can assign new values of the same type though Dynamic typing On the other hand On dynamic typing the type is bound to the value The checks are made at runtime As the type of the variable is bound to the values it can change along with the type of the values assigned The following snippet in Python x print type x lt class int gt x “hello print type x lt class str gt x print type x lt class float gt Is perfectly valid and run without issues because the type of x depends just on the values assigned int str and float respectively But if we now try it in Golang a statically typed language it would not even compile var x int fmt Println x x “hello fmt Println x because we already told the compiler that x is of type int But what about type inference Yes in Golang and many other languages we ve got type inference but that doesn t mean that the language is not statically typed In short type inference means that the compiler interpreter can infer the type of the variable without you explicitly pointing it out Let s change the Golang snippet var x int long declaration explicitly indicate the typex short declaration uses type inferencefmt Println x x “hello fmt Println x This is still invalid Go code not because you have type inference means that the language is dynamically typed Type inference serves as a good convenience for the programmer but it s not exclusive to dynamically typed languages Strong vs weak typing The problem with the terms strong and weak typing is that there simply isn t a single canonical definition we all can sort of agree and say more or less the same things but there is not a formal definition to adhere to In any case strong typing usually means that the compiler forces a sort of type discipline at compile time there should be more strict typing rules at said time generally this has todo with variable assignments function arguments and return values On the other hand weak typing supposedly has more lax type verification rules Common uses Generally dynamically typed languages tend to be associated with interpreted languages like Python Ruby Perl or Javascript while statically typed languages tend to be compiled like Golang Java or C However this doesn t imply that the typing discipline of the language is bound to the way it s translated a language can perfectly be statically typed and interpreted at the same time as can be dynamically typed and compiled Also there is also room for middle ground between static dynamic and strong weak C despite being statically typed is also considered to be weakly typed because with casts you can change a value of one type to be of other type mainly when using pointers This has pros and cons but C assumes that the programmer knows what the heck he s doing haha and gives him the liberty to do so Python is dynamically typed but it s also considered strongly typed Java is actually a particular case because it has an hybrid translation model both compiled and interpreted at the same time Pros and cons Usually dynamically typed interpreted languages are useful for prototyping and iterating quickly over ideas testing them without too much hassle It s common to use Python or Ruby for this checking if the algorithm works as expected their dynamic nature allow us to concentrate more on the idea rather than on the implementation details of the language like exactly knowing the types of the variables eliminating boilerplate code However these kind of interpreted languages tend be slower than compiled languages in terms of run time efficiency This is something well known and although this efficiency gap has been reducing it s still a good thing to have in mind Finally dynamically typed languages tend to defer type errors to runtime so a rigorous testing strategy is vital to catch all code flows at development time On the other side statically typed languages tend to catch and show type errors at compile time like passing a string to a function that expects an integer which really help us to be more confident of the code that we deploy TLDR Static Dynamic are poles of the same axis and it s where we have more consensus on definitions The theory is more clear developed and explicit On static typing the type is bound to the variable object On dynamic typing the type is bound to the value assigned to the variable object at a given moment and can change as the type of the value assigned changes Strong Weak are poles of another axis and although there some general ideas about each one the differences and characteristics are not so clearly defined And that s it thanks for reading Hope you liked this post If you want you can subscribe so you know when I publish more content D Useful readings What is the difference between a strongly typed language and a statically typed language What is the difference between statically typed and dynamically typed languages 2022-03-21 17:12:25
海外TECH DEV Community Gutenberg cheatsheet – Block's `supports` property https://dev.to/crs1138/gutenberg-cheatsheet-blocks-supports-property-23gk Gutenberg cheatsheet Block x s supports propertyGutenberg s documentation has come a long way and it s getting better and better However now and then I find myself missing a quick overview of the properties Thus the idea of a cheatsheet…Here s a short overview of the individual properties of the supports object for details refer to developer s documentation anchor boolean false It doesn t work with dynamic blocks yet align boolean array falseNo default alignment is assigned If you need to set a default value declare the align attribute with its default alignWide boolean falseDisable wide alignment for a single block className boolean trueBy default the class wp block your block name is added to the root element of your saved markup color Object nullThis value signals that a block supports some of the properties related to colour When it does the block editor will show UI controls for the user to set their values customClassName boolean trueControls whether the field for custom class name is displayed in the panel inspector defaultStylePicker boolean trueWhen the style picker is shown the user can set a default style for a block type based on the block s currently active style html boolean trueBy default a block s markup can be edited individually inserter boolean trueTo hide a block so it can only be inserted programmatically set the inserter false multiple boolean trueIf you want a block to be inserted into each post only once reusable boolean trueYou can prevent a block from being converted into a reusable block spacing Object nullYou can enable some of the CSS style properties related to spacing Good for margin and padding overrides if the theme declares support Subproperties margin boolean array falsepadding boolean array falsetypography Object nullWhen enabled the block editor will show a typography UI Subproperties fontSize boolean falselineHeight boolean falseThe values of the attributes added by the supports object will be added to the object returned from the useBlockProps hook Within the Edit function function Edit const blockProps useBlockProps return lt div blockProps gt Lorem ipsum lt div gt Save function function Save const blockProps useBlockProps save return lt div blockProps gt Lorem ipsum lt div gt For dynamic and server side rendered blocks these extra attributes can get rendered in the render callback in PHP using the function get block wrapper attributes It returns a string containing all the generated properties and needs to get output in the opening tag of the wrapping block element function render block wrapper attributes get block wrapper attributes return sprintf lt div s gt s lt div gt wrapper attributes Lorem ipsum Cover image by Emma Plunkett The Missing Peace 2022-03-21 17:12:23
海外TECH DEV Community Testing an application with a network delay https://dev.to/yugabyte/testing-an-application-with-a-network-delay-13eh Testing an application with a network delayThis blogpost is about a linux feature to introduce delays in sending packets on the network A first question obviously is why would you want this Well for several reasons actually If you deploy anything in the cloud in multiple availability zones there will be a delay between nodes in these zone s because the physical distance will enforce a delay because a packet has to travel that distance and that takes time which is ultimately limited by the speed of light On top of that comes the logical distance which is how the network between the two is shaped which can introduce more latency Another reason is to test how something behaves when a certain network latency is introduced to a networked application YugabyteDB is a distributed database and uses the network to communicate between the nodes in the YugabyteDB cluster I am using Alma Linux version It actually looks very simple a simple search on google shows how to add a delay in this case of milliseconds tc qdisc add dev eth root netem delay msThis means you must have the tc utility installed If it s not installed you should install the iproute tc package However this throws the following error on my linux box tc qdisc add dev eth root netem delay msError Specified qdisc not found Checking for the tc traffic control settings show no indication of any delay set tc qdisc show dev ethqdisc fq codel root refcnt limit p flows quantum target ms interval ms memory limit Mb ecn drop batch Lot s of details but no delay Performing network delays as well as other features such as simulating packet loss or duplicate packets are part of a qdisc queueing discipline called netem network emulator It turns out the netem qdisc is a part of the tc utility it is named in the manpage of tc but it actually is a kernel module that makes this feature available which is not installed by default In order to make this available the package kernel modules extra must be installed which installs the sch netem kernel module among others which provides the tc netem functionality Once the kernel module is available it will allow the tc command to succeed tc qdisc add dev eth root netem delay ms it silently succeeds Checking with tc qdisc show dev eth shows netem is set tc qdisc show dev ethqdisc netem root refcnt limit delay msAny network traffic sent to the machine that has the netem network emulator qdisc set will have the packet sent with a delay of ms Without netem ping c PING bytes of data bytes from icmp seq ttl time ms bytes from icmp seq ttl time ms bytes from icmp seq ttl time msWith netem ping c PING bytes of data bytes from icmp seq ttl time ms bytes from icmp seq ttl time ms bytes from icmp seq ttl time msRemove tc qdisc del dev eth rootHowever this is now a rather brute force delay everything that is sent from the device eth on the host that has traffic control setup is impacted If you want to have the host to only apply the delay for a limited number of hosts ip addresses you can split normal and delayed output and match the to be delayed output with a filter In my case I want to only apply the delay for anything that is sent to hosts and from node In this way I can mimic node being far away and thus having higher latency tc qdisc add dev eth root handle prio tc qdisc add dev eth parent handle netem delay ms tc filter add dev eth protocol ip parent priority u match ip dst flowid tc filter add dev eth protocol ip parent priority u match ip dst flowid On the first line I create a queueing discipline attached to the root of the device and on the second line a parent with flowid The third and fourth lines add filters which binds outgoing traffic on device eth to the ip addresses and to be going through flowid Remove tc qdisc del dev eth rootIf you really like this and think the examples even with the filtering to specific ip addresses is still rather simple there is a whole world of traffic shaping possibilities such as variable latencies fixed or variable packet loss and generating identical packets to simulate network issues See the manpage of the tc utility ConclusionTraffic shaping is a valuable tool for testing network influence for any application that includes and is dependent on network traffic such as the Yugabyte database but also sharded databases and databases with replication setup which would otherwise only be possible by implementing it physically over the world The linux tc utility allows you to test this on your own laptop If you want to take this further and more closely simulate high latencies for a node in a local cluster of nodes you should set a delay on sending from the local nodes to one or more nodes deemed far away and vice versa sending from the remote nodes to the local ones 2022-03-21 17:06:07
海外TECH DEV Community Intro To Elixir 🧪 https://dev.to/codecast/intro-to-elixir-2a5n Intro To Elixir Elixir is a functional programming language that is gaining popularity Here at CodeCast we have built our server using Elixir and Phoenix and our founder Tam is very passionate about the programming language Being as new as it is it s hard to find Elixir courses online that are up to date and include everything we hope to see So with that in mind he created the Intro to Elixir course on CodeCast with over hours of content and has listed it for free You just need a CodeCast account He describes the Series as follows In this series I introduce the basic building blocks of Elixir The series is designed for programmers who know some other programming language For instance in this series I won t be explaining what are variables functions or conditionals I will assume that you know them and then show you how these and many other things are done in the Elixir language We will learn the basics of Elixir and we will learn how to create projects and how to integrate with APIs using HTTP We will integrate with which is a fun open API that returns Star Wars character and movie data My hope is that by the end of the series you will be excited about Elixir as I am to pursue it further I follow classroom style teaching where I dig deep into the concepts and I intentionally repeat certain things for memory You can see the code for the series on Github here The link to the course can be found here Good luck and happy coding 2022-03-21 17:03:58
海外TECH DEV Community CRUD Blog App (with comments) developed with MERN https://dev.to/tashynw/crud-blog-app-with-comments-developed-with-mern-5733 CRUD Blog App with comments developed with MERNCode frontend VIDEO PREVIEW A full stack CRUD Blog app with commenting logic made with the MERN stack Users must sign in by creating an account to access the website Users can create posts read other users posts edit their posts delete their posts and even add and remove their comments to posts The site obviously encrypts passwords etc and was designed using stock CSSCheck it out 2022-03-21 17:02:30
Apple AppleInsider - Frontpage News Myriad iCloud services down globally, cause unknown https://appleinsider.com/articles/22/03/21/myriad-icloud-services-down-globally-cause-unknown?utm_medium=rss Myriad iCloud services down globally cause unknownApple s iCloud appears to be experiencing issues with unexpected downtime impacting some of Apple s online services for a number of users Starting from p m eastern on Monday AppleInsider staff encountered problems with various Apple services This included iCloud going down which is a key element that impacts other services and apps with online components This included Mail which became unreliable in fetching messages for multiple staff Some found Apple News wasn t loading stories while Apple Music on Mac fails to bring up any pages at all Read more 2022-03-21 17:53:15
海外TECH Engadget Apple service outages affect App Store, Maps and more https://www.engadget.com/apple-app-store-music-tv-plus-outage-175546742.html?src=rss Apple service outages affect App Store Maps and moreNotice Apple that several Apple services are unavailable You re not alone As Mark Gurman notes Apple s system status page indicates outages across several major services including the App Store Apple Arcade Apple TV Find My the iTunes Store Maps and radio The alerts note that some users are affected and that problems may be quot intermittent quot the App Store or lead to slowdowns We ve asked Apple for comment Developing 2022-03-21 17:55:46
海外TECH Engadget CD Projekt Red is developing a new Witcher game that will run on Unreal Engine 5 https://www.engadget.com/cd-project-red-the-witcher-game-unreal-engine-5-174928261.html?src=rss CD Projekt Red is developing a new Witcher game that will run on Unreal Engine CD Projekt Red is developing a new Witcher game The studio announced the project today with a teaser it shared on Twitter quot A new saga begins quot the teaser states with an image of what looks like a lynx like Witcher medallion in the center nbsp pic twitter com eKZIbfLRaーThe Witcher witchergame March That might not seem like much to go on but it actually represents a substantial clue about what we can expect from the new game Geralt of Rivia the protagonist of Andrezej Sapkowski s dark fantasy novels and all the adaptations that have followed was a student of the School of the Wolf and subsequently wore a Wolf medallion on his adventures The teaser suggests this new game will star a Witcher from the School of the Cat They go about the business of monster hunting a bit differently from their Wolf School counterparts Most notably they don t have a policy that stops them from involving themselves in the politics of the Continent The new game does not have a release date yet but as part of today s announcement CD Projekt Red shared it s moving to Unreal Engine for all of its future projects as part of a multi year partnership with Epic Games The Witcher Wild Hunt nbsp and nbsp Cyberpunk ran on the studio s proprietary REDengine After the mess of Cyberpunk the move to UE may give some players confidence we could see the CD Projekt of old return nbsp 2022-03-21 17:49:28
海外TECH Engadget VW will invest $7.1 billion in its North American production capacity https://www.engadget.com/vw-will-invest-71-billion-in-its-north-american-production-capacity-171951916.html?src=rss VW will invest billion in its North American production capacityVolkswagen s electrification efforts in North America will receive an additional billion investment over the next five years the company announced on Monday nbsp VW intends to spend that money on quot boosting its product portfolio regional R amp D and manufacturing capabilities quot per a release in hopes that doing so will help drive percent of its US sales to be EVs by The company intends to ramp down its internal combustion production capacity over the same time frame transitioning American assembly plants to produce the ID in the ID Buzz in and a yet to be released SUV starting in The company estimates that percent of the vehicles it sells in North America are already assembled in North America Its production facilities in Chattanooga TN have already begun the electrification process with its factories at Pueblo and Silao Mexico coming online by the middle of the decade VW is also betting big on batteries having already invested more than billion in North American supplier partnerships ahead of the ID s launch The company also plans to officially open its Battery Engineering Lab BEL in Chattanooga this May and is considering constructing a battery production plant stateside as well though that s still in its most initial planning stages nbsp nbsp nbsp nbsp These investments are already paying dividends to drivers During a press event Monday morning Scott Keogh President and CEO Volkswagen Group of America noted that VW intends to bring OTA updates and new software features like plug and charge which automates the transaction portion of recharging on a public station allowing drivers to simply plug in without having to swipe a debit card or fiddle with NFC readers later this year nbsp 2022-03-21 17:19:51
海外科学 NYT > Science U.N. Chief Warns of ‘Catastrophe’ With Continued Use of Fossil Fuels https://www.nytimes.com/2022/03/21/climate/united-nations-climate-crisis.html U N Chief Warns of Catastrophe With Continued Use of Fossil FuelsAntónio Guterres the United Nations secretary general said instead of replacing Russian oil gas and coal nations must pivot to clean energy 2022-03-21 17:56:44
ニュース BBC News - Home Nazanin Zaghari-Ratcliffe: I should have been freed six years ago https://www.bbc.co.uk/news/uk-60819018?at_medium=RSS&at_campaign=KARANGA agothe 2022-03-21 17:21:21
ニュース BBC News - Home Police send over 100 questionnaires on No 10 parties https://www.bbc.co.uk/news/uk-politics-60827451?at_medium=RSS&at_campaign=KARANGA downing 2022-03-21 17:41:21
ニュース BBC News - Home New P&O crew on less than £2 an hour, union claims https://www.bbc.co.uk/news/business-60821266?at_medium=RSS&at_campaign=KARANGA bottom 2022-03-21 17:50:14
ニュース BBC News - Home Logan Mwangi: Boy, five, could have survived for hours https://www.bbc.co.uk/news/uk-wales-60821471?at_medium=RSS&at_campaign=KARANGA mwangi 2022-03-21 17:27:36
ニュース BBC News - Home Mitchell & Walker-Peters earn England call-ups https://www.bbc.co.uk/sport/football/60827799?at_medium=RSS&at_campaign=KARANGA senior 2022-03-21 17:36:53
ビジネス ダイヤモンド・オンライン - 新着記事 「英語を独学で学び直したいけど全く時間がない」人におすすめの一冊 - 独学大全 https://diamond.jp/articles/-/297601 読書 2022-03-22 02:55:00
ビジネス ダイヤモンド・オンライン - 新着記事 【お金から最速で自由になる!FIRE2.0】 「お金の自由」に近づくお金の使い方 - 投資をしながら自由に生きる https://diamond.jp/articles/-/298451 2022-03-22 02:50:00
ビジネス ダイヤモンド・オンライン - 新着記事 【精神科医が教える】 人づきあいに大切なたった1つのコツ - 精神科医Tomyが教える 1秒で元気が湧き出る言葉 https://diamond.jp/articles/-/299464 【精神科医が教える】人づきあいに大切なたったつのコツ精神科医Tomyが教える秒で元気が湧き出る言葉人気シリーズ『精神科医Tomyが教える秒で元気が湧き出る言葉』から、きょうのひと言誰しも「幸せになりたい」と思っているのではないでしょうか少なくとも「不幸になりたい」とは思わないはずですよね。 2022-03-22 02:45:00
北海道 北海道新聞 ロシアでフェイスブック禁止 裁判所「過激組織」と認定 https://www.hokkaido-np.co.jp/article/659521/ 過激 2022-03-22 02:28:02
北海道 北海道新聞 ドーピングでロンドン五輪金剥奪 女子競歩、ロシアのラシュマノワ https://www.hokkaido-np.co.jp/article/659510/ 陸連 2022-03-22 02:26:05

コメント

このブログの人気の投稿

投稿時間:2021-06-17 22:08:45 RSSフィード2021-06-17 22:00 分まとめ(2089件)

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

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