python |
Pythonタグが付けられた新着投稿 - Qiita |
【Terraform de Azure】 Azure Database for MySQL を Single構成で作成してみました |
https://qiita.com/turupon/items/0ce9dfaf3df3c39e5111
|
【TerraformdeAzure】AzureDatabaseforMySQLをSingle構成で作成してみました概要「InfrastructureasCode」ということで、Terraformを用いてAzureDatabaseforMySQLをシングル構成で作成し、mysqlコマンドでDatabaseに接続してみます。 |
2022-03-31 02:14:39 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
等価演算子のあれこれ == === |
https://qiita.com/tajima_haru/items/45858bf21ce0b543c3dc
|
等価演算子のあれこれはじめにtypescriptでデータ比較したいときにやらかしたので等価演算子についてアウトプットします。 |
2022-03-31 02:59:25 |
Azure |
Azureタグが付けられた新着投稿 - Qiita |
【Terraform de Azure】 Azure Database for MySQL を Single構成で作成してみました |
https://qiita.com/turupon/items/0ce9dfaf3df3c39e5111
|
【TerraformdeAzure】AzureDatabaseforMySQLをSingle構成で作成してみました概要「InfrastructureasCode」ということで、Terraformを用いてAzureDatabaseforMySQLをシングル構成で作成し、mysqlコマンドでDatabaseに接続してみます。 |
2022-03-31 02:14:39 |
技術ブログ |
Developers.IO |
Invoking lambda Function when File is Uploaded into S3 |
https://dev.classmethod.jp/articles/invoking-lambda-function-when-file-is-uploaded-into-s3/
|
Invoking lambda Function when File is Uploaded into SS Simple and popular AWS Service for storage Replicates data by default across multiple facilities It charg |
2022-03-30 17:50:05 |
海外TECH |
MakeUseOf |
How to Add an Account to Your Favorites List on Instagram |
https://www.makeuseof.com/add-account-favorites-list-instagram/
|
instagram |
2022-03-30 17:51:04 |
海外TECH |
MakeUseOf |
How to Solve the "Windows Could Not Automatically Detect Network Proxy Settings" Error |
https://www.makeuseof.com/tag/windows-could-not-automatically-detect-this-networks-proxy-settings/
|
How to Solve the amp quot Windows Could Not Automatically Detect Network Proxy Settings amp quot ErrorSeeing the amp quot Windows could not automatically detect this network s proxy settings amp quot error on your PC Here are the steps to fix it |
2022-03-30 17:31:15 |
海外TECH |
MakeUseOf |
How to Add & Remove Words From Your Google Docs Dictionary |
https://www.makeuseof.com/add-remove-words-google-docs-dictionary/
|
dictionary |
2022-03-30 17:31:15 |
海外TECH |
MakeUseOf |
Excel Keeps Crashing in Windows 10? Try These Fixes |
https://www.makeuseof.com/windows-10-excel-keeps-crashing/
|
windows |
2022-03-30 17:15:14 |
海外TECH |
DEV Community |
Tv + Calculator!..You can congratulate me for that... |
https://dev.to/metak47/tv-calculator-3doe
|
calculator |
2022-03-30 17:39:17 |
海外TECH |
DEV Community |
Win a Custom FutureStack LEGO® Kit! |
https://dev.to/newrelic/win-a-custom-futurestack-legor-kit-j6n
|
Win a Custom FutureStack LEGOKit Howdy y all New Relic is giving away this exclusive custom made LEGOkit to lucky people Want a chance to win one It only takes two steps Register for FutureStack happening in Las Vegas here Download the Cvent Events app from the App Store search for FutureStack and log in Yes it s really that simple We hope to see you all at FutureStack Terms and Conditions |
2022-03-30 17:34:25 |
海外TECH |
DEV Community |
How does LSTM work? |
https://dev.to/deepeshaburse/how-does-lstm-work-475
|
How does LSTM work One of the most popular models in the time series domain is LSTM Long Short Term Memory model It is a type of recurrent neural network and is heavily used in sequence prediction In this blog we will go through why LSTM is preferred and how it works Before jumping into LSTM let us dive a little deeper into what these terms mean Time Series Analysis In this data points are analyzed over specific intervals of time It is used to understand the pattern over a period of time could be monthly yearly or even daily This kind of analysis can be seen in stock price predictions or in businesses Neural Network A neural network consists of multiple algorithms that is majorly used to analyze the underlying relationship between various data points It is inspired by the biological neural network Recurrent Neural Network RNN If we have data points which are related then we use RNNs RNNs use the concept of memory where they store certain data points The problem with traditional RNNs is that as the number of data points increases they are unable to remember data Say we want to process a paragraph of text to do predictions RNN s may leave out important information from the beginning LSTM is a special type of RNN where it stores data long term It overcomes two technical problems vanishing gradients and exploding gradients An LSTM module consists of a cell state and gates The cell state is like a conveyer belt it allows information to flow linearly with minor changes The model does have the ability to remove or add information this is done using the gates The gates help in regulating the information But as the flow of information is linear it makes the flow easier Architecture of LSTM In LSTM there are three main steps We either forget input or output An analogy for this would be how news channels work Say there is a murder case that they are broadcasting and initially it is suspected that the cause of death is poisoning but once the post mortem report comes through the cause of death turns out to be an injury on the head the information about the poisoning is “forgotten Similarly if there were suspects and then another suspected This person is added or “inputted Finally after the investigation of the police there is a prime suspect this information will be “outputted To carry out these three steps we have gates Let us look at each one of them in detail Forget gate A forget gate is responsible for removing information It removes information that is no longer needed for analysis and vacates space for the next information This helps the model to become more efficient This gate takes in inputs ht Hidden state from previous cellx t Input at the particular stepThese inputs are multiplied by the weight matrices and then a bias is added Following this the sigmoid function is applied to the calculated value The sigmoid function gives an output between and This helps the model decide which information to “forget If the output is the information of that cell is forgotten completely Similarly if the output is the information of that entire cell is to be remembered This vector output from the sigmoid function is multiplied with the cell state Input gate This gate as the name suggests is used to add information to the cell state Here is its structure First the values that need to be added are regulated using the sigmoid function The inputs are still h t and x t Next a vector is created which contains all the possible values to be added to the cell state This is done using the tan h function Tan outputs a value between to The value of the regulatory function sigmoid function is multiplied with the created vector The useful information is then added to the cell state using the addition operation This allows us to make sure we have only filtered and important information Output gate This gate is used to use the information currently available and show the most relevant output It looks like this A vector is created after applying the tan h function to the cell state The output ranges between and The sigmoid function is again used to regulate the values that need to be outputted from the vector using h t and x t The value of the regulatory function is multiplied with the vector and sent as the output It is also sent to the hidden state of the next cell LSTMs have proven to give state of the art results in sequence predictions It is used in complex problem domains like machine translation speech recognition text generation etc I hope this gave you a basic idea on how LSTM models work References Essentials of Deep Learning Introduction to Long Short Term MemoryUnderstanding LSTM NetworksIllustrated Guide to LSTM s and GRU s A step by step explanation |
2022-03-30 17:29:24 |
海外TECH |
DEV Community |
The React CLI you always wanted but didn’t know about |
https://dev.to/nx/the-react-cli-you-always-wanted-but-didnt-know-about-5b4j
|
The React CLI you always wanted but didn t know aboutIn this article I d like to specifically talk about developer tooling why it is so massively important and how you might have missed out on Nx as your main React CLI for kickstarting new awesome projects It is awesome to be a JavaScript developer nowadays The JavaScript ecosystem has evolved a lot in recent years For the better Speed has become a major focus both from the framework perspective of running the app in production as well as the speed of developing testing and building JavaScript TypeScript from a developer tooling point of view Frameworks and libraries such as Next js Astro Qwik and Remix just to name a few have brought some great innovations to push the web even further While speed is of major importance developer ergonomics shouldn t be left behind Both of them greatly contribute to the overall productivity and also developer happiness Let s see how Nx can help with that Why use a devtool CLI Regardless of whether you re a seasoned developer or someone new just getting started with React the last thing you want to have to deal with is to manually set up all the tooling to actually get started and be productive You want to be able to focus on the actual task like learning React or kicking off that new shiny project Still we definitely want to have good defaults set up for us Things like the latest build tooling tooling for writing unit tests as well as ee tests code quality tools like linters and we definitely also don t want to argue about tabs vs spaces or spend time formatting our code Prettier can help with that Taking the time to set up a starter kit or template would work But it is time consuming requires a lot of knowledge and especially needs maintenance to update the tools over time That rarely works out well in the long run unless this is your job Nx from a bird s eye viewWhat you usually want is a CLI a command line interface that helps you develop and deal with the underlying build infrastructure something that sets you up with modern up to date tooling and also keeps those updated Nx comes with such a CLI it is widely adopted by the Angular React and Node community currently being downloaded more than million times a week Nx is fully open source MIT licensed baked by Nrwl and the community From a bird s eye view Nx comes withCode generators to generate new projects configuration but also components Redux setup routes Out of the box support for modern tools such as TypeScript Webpack Babel SWC Jest Cypress ESLint Prettier Storybook and moreIt keeps tooling up to date via dedicated migration commandsSpeed Nx uses local computation caching that can be extended with Nx Cloud which is basically free to remote caching and DTE Distributed Task Execution But let s have a deeper look at how Nx works exactly Using NxLet me give you an overview of the most used functionality that Nx gives you such that you get a good understanding of whether it might suit your needs Creating a new Nx React projectOpen your favorite terminal window and type npx create nx workspace latest myorgNote I m using npx to not have to install the Nx CLI globally If you want to you totally can npm i nx gmyorg is the scope of your Nx workspace Think of it as your NPM scope in case you d publish an npm package In the case you create libraries in this new Nx workspace more about that later it would be used to import those likeimport someFunc from myorg somelib What you ll get is a setup wizard that guides you through creating your application We would most likely choose “React in this case As part of this process you ll be asked to pick an “Application name This is simply the application Nx is going to generate for us to get started happynrwl would be a nice name You should end up with a new Nx workspace and our happynrwl React app in the apps folder Serving our React appTo serve our React app runnpx nx serve happynrwlNote I prefix the commands with npx which is just a way to use the local nx binary from the node modules folder of our workspace Also this way we don t have to install Nx globally If you prefer doing that run npm install g nx Going to http localhost should show the running React app located in apps happynrwl Build our React appSimilarly to build our React application runnpx nx build happynrwlThis should build the app into dist apps happynrwl which we can then take and deploy to wherever we want to deploy it Nx has another nice feature that basically comes for free computation caching For every command Nx runs it computes a unique hash that contains information about the involved source code environment variables and the command itself Next time the same conditions are met the command is not executed again but rather pulled out of a cache As you can imagine this drammatically speeds up things If you re curious and want to learn more check out the docs page on computation caching and how to leverage Nx Cloud to store the cache remotely for sharing it with your team members Also Nx Cloud pricing recently changed which makes it basically free for everyone Code Generators One of the core parts of Nx is code generators As the name already suggests code generators generate source code and configuration That can range from a single React component file to an entire project with all that is needed You basically already saw them in action when you created the initial project setup But there s more to explore Every Nx plugin e g nrwl react nrwl next come with their own set of generators All of them are invoked with the npx nx generate or short npx nx g command Let s for instance generate a new component for our React application npx nx generate nrwl react component HelloWorldThis generates a new component in our happynrwl applicationNote you can also use nx g nrwl react as a shorthand for generate Also if you attach dry run to the end of the command it will just simulate the run without touching the file system Many of these generators come with a rich set of flags For example passing routing to our component generator from before generates a component with routes already set up adds react router dom to the package json and executes a npm install How do we find all these generators though There are different options Nx documentation use the search function there or just navigate the docs All the reference pages are structured like nx dev packages lt packagename gt As an example for React that would look like npx nx list lists a set of installed plugins as well as other available plugins that can be installed To get a list of generators for a specific plugin say for the nrwl react plugin run npx nx list nrwl react Similarly you can then run npx nx g nrwl react lib help to get help for a particular generatorHowever the absolute easiest way to explore the potential and even use Nx if you are not the “terminal type of person is Nx Console I ll go a bit deeper into that in a later section State of the Art Tooling PreconfiguredWhen setting up a new React project that also holds for Angular Node Next js you do not only get the React project but also a set of tools preconfigured that help you stay productive and produce higher quality code These areTypeScriptESLintJestCypressPrettierThe Nx core team closely collaborates with these open source projects to not only make sure they integrate seamlessly with the React setup but also to keep them updated over time as those tools evolve In fact by using automated code migrations updating your Nx workspace will automatically also update those tools and the corresponding config files for you Let s have a closer look TypeScript as a first class citizen The Nx core team strongly believes in the benefits of TypeScript in fact check out the new Nx and TypeScript setup As such by default every project is automatically set up and configured to use TypeScript making sure builds as well as IDEs are able to properly pick up TypeScript definitions All without you having to worry about it Now if you really want to use pure JavaScript you totally can Just pass the js when running a generator Read more on the docs ESLint preconfigured Every new Nx workspace comes with ESLint already preconfigured Having proper linting in place is a great way to help contribute to overall better code quality by statically analyzing your source code and finding potential issues early in the process Every project generated by Nx comes with a eslintrc json file That configuration extends from an ESLint plugin nrwl nx react containing a set of best practices rules and at the same time allows you to add further rules that are specific to your needs Linting can be run similarly to the other commands npx nx lint happynrwl Jest preconfigured Similar to the linting setup every project in an Nx workspace has a test runner preconfigured already By default Nx comes with Jest At the root of every project there s a jest config js which already comes with proper transformers to support TypeScript and TSX JSX If you need to further customize how Jest should behave for this project this is the place to do that Running Jest tests is as easy asnpx nx test happynrwlObviously you can pass parameters to customize the Jest run like watch for interactive mode t to execute tests that match a given pattern testFile apps happynrwl src app hello world hello world spec tsx to run a specific file If you happen to use VSCode the easiest way however is to install Jest Runner and leverage its code lens feature to run and debug Jest tests Cypress preconfigured Cypress has revolutionized ee testing by making it more developer friendly Who likes to write tests after all That just gets even worse if the DX sucks Cypress successfully tackled that by listening and addressing the pain of existing ee testing solutions Whenever you generate a new project in an Nx workspace you have the option to automatically also create a Cypress based ee project alongside it In our case it is called happynrwl ee The awesome part of this is that you don t have to configure anything at all No need tomake sure TypeScript runs smoothly with Cypressset up linting for our ee project yes writing good quality test code is just as important spinning up our development server manually first that serves our React app such that we are able to load it in our Cypress tests environmentJust executenpx ee happynrwl eeYou can also pass watch to run it interactively with the Cypress test runner such that the tests get re executed whenever we change our source Don t argue over code formatting use Prettier Are you a tabs or spaces person Use semicolons or not What about trailing commas We all know that we devs can have some strong opinions on this But honestly there are probably more important things to focus on Luckily Prettier can help a ton with these issues It is opinionated with just very few configuration options and just takes away the burden of formatting the code When you set up a new Nx workspace it has Prettier already preconfigured The best way is to integrate it with your code editor such that formatting is run on every save of a file Alternatively you can also runnpx nx format Nx Console A dedicated VSCode extension for NxNx really is an advanced CLI based development tool But regardless of whether you are a command line person or not if you happen to use VSCode make sure you install the Nx Console extension from the marketplace For Webstorm there are two community extensions that can be used nx webstorm and Nx Console Idea Once you have the extension installed you can click it s icon in the VSCode Activity Bar which reveals the Nx Console UI A couple of things is the panel where you see a fixed command “Generate to invoke the Nx generator for creating new projects libraries etc as we mentioned before In addition you see a list of available commands to run shows additional commands that are commonly used in an Nx workspace Feel free to click and explore them shows a list of projects in your workspace We really just have our React app and Cypress ee application but potentially you could add more See Nx applications and libraries for more Let s take the example of generating a new React component just as we did before but this time using Nx Console This is how you d do that Once you click the entry in the dropdown list the Nx Console generate form opens showing all the options the Nx generator supports Whenever you change something in the form you ll automatically see a dry run in the console that opens below That shows what would happen if you run the command and is equivalent of adding the dry run flag whenever you d run the command on the terminal Once you re ready hit the “Run button or click the copy symbol to copy the full command into your clipboard s t you can then paste it into your terminal As you can see this approach is also really powerful for exploring different commands and their corresponding options Besides running generators Nx Console also adds VSCode Code Lens abilities to the configuration files that help you navigate more quickly across the workspace This is particularly useful if you happen to add more apps and libraries to the workspace at some point Evergreen Workspace SetupOne of the advantages of using Nx over say CRA or a custom starter template is that your Nx workspace is evergreen What do I mean by that by now we all know how fast the frontend space is moving and so are the corresponding devtools Today you might be using Rollup to build your libraries tomorrow you use swc vite or esbuild Same with Webpack Webpack has been around for a while already and still a lot of projects are stuck at v Just to mention an example when upgrading Nx to v all Nx users automatically got migrated to Webpack This is possible with Nx s migrate command that allows you to keep up to date with your framework in a mostly automated fashion Whenever you upgrade Nx you runnpx nx migrate latestRunning this command Nxanalyzes the current packagesfetches the latest Nx packages and plugins or whatever version was specified in the migration command creates a migrations json file containing all migration scripts that need to be executedupdates the package json to the new package versionsThe migrations json file can be inspected and potentially modified Once it is ready running the following command executes the migration npx nx migrate run migrations migrations jsonThese migrations not only update the package json version They also update corresponding configuration files and even source code by leveraging ASTs to query and manipulate files It is not even only about upgrading the frameworks such as React or Angular themselves though A common pain point is their integration with other tools such as Jest Storybook ESLint etc The Nx core team closely collaborates with these communities to make sure that a particular combination of versions works and is tested before migrating your workspace You can see it in action in this Egghead lesson Common QuestionsHere are some common questions developers have Have some more Feel free to ping me on Twitter juristr the official Nx account NxDevtools or in the Nx community Slack Q How can I customize how my project is built and served Every Nx project comes with a project json which contains the basic setup of targets example build serve test lint that can be run against the project Here s the project json for our happynrwl React application I clipped out the non relevant parts here targets build executor nrwl web webpack options compiler babel outputPath dist apps happynrwl index apps happynrwl src index html baseHref main apps happynrwl src main tsx polyfills apps happynrwl src polyfills ts tsConfig apps happynrwl tsconfig app json assets apps happynrwl src favicon ico apps happynrwl src assets styles apps happynrwl src styles css scripts webpackConfig nrwl react plugins webpack configurations production serve tags As you can see all these “targets build serve have a so called options property that allows you to configure how the target behaves The actual configuration is abstracted behind the “Nx Executor in our case nrwl web webpack You can find the details of how to configure that on the Nx docs in the CLI reference for the nrwl web package To read more about how the project json its executors and configuration options are structured check out the official docs Note Nx is also able to just pick up NPM scripts registered in the package json of your project root This scenario is most useful if you re adding Nx to an existing monorepo see add nx to monorepo Read more here Nx s extensibility and customizability have really no limits allowing it to really adapt to your needs Here are some resources to learn more if you need some advanced features Custom workspace executorsCustom workspace generatorsCreate Nx pluginsControl the entire workspace setup with custom presets Q Can I customize my Webpack config used to build my React app As mentioned previously the underlying build machinery is usually hidden by a so called Nx Executor As we have seen you can customize its behavior via the corresponding options property By abstracting the underlying build tool Nx is able to fulfill its evergreen promise as mentioned previously and allows to seamlessly upgrade workspaces to the latest versions of the build tooling that is being used If the available options are not enough you can further customize the Webpack configuration using the webpackConfig property targets build executor nrwl web webpack options webpackConfig nrwl react plugins webpack tags By default it links to nrwl react plugins webpack but you can point to your own custom file in the Nx workspace The file needs to look like the following apps my app webpack config jsconst fromNrwlReact require nrwl react plugins webpack function getWebpackConfig config invoke the Nrwl specific config to preserve the original behavior config fromNrwlReact config add your own customizations HERE return config module exports getWebpackConfig Notice how the default Nrwl provided Webpack configuration is invoked first to not lose the default behavior followed by your own customizations Q Why is there an “apps folder Can I change it Sure Nx allows to host multiple applications and libraries in a single workspace a monorepo scenario basically In fact even in our simple setup we have two applications happynrwl and the corresponding ee application happynrwl ee In a default setup Nx generates an apps folder for hosting applications and libs folder for hosting libraries Read more about “Apps and Libs on the Nx docs You can change this setup in nx json by adjustijng the workspaceLayout property which has an appsDir and libsDir configuration workspaceLayout appsDir apps libsDir libs Q Is there a way to migrate from CRA Absolutely Check out this guide on the Nx docs that has all the details including a video walkthrough Q This looks like a lot Do I really need it from the get go Agreed Luckily Nx is plugin based so you can start with the bare minimum see using Nx without plugins and then slowly add them as you need them Similarly you can add Nx to an existing workspace say a Yarn workspace by using the add nx to monorepo package From my own experience what usually happens is that teams start light and then over time end up with a similar stack but hand woven and therefore loosing out on a lot of the benefits Nx comes with Q Isn t Nx just for monorepos Nx has been designed to support monorepo scenarios and it really shines at scale However a lot of the features I ve been mentioning in this article such as generators out of the box setup of best practices development tools automated migrations and more make it an excellent choice even if your intention is not to create a monorepo From my experience I ve often seen teams start with a single application which then over time gets company by other apps in the form of React applications also Node based backends or even a React Native application Mainly because adding new applications is easy and the possibility to share functionality even across platforms is appealing If you re interested in monorepos or want to learn more about it check out Q Isn t Nx just for Angular projects This is a common but understandable misconception Although Nx was heavily inspired by the Angular CLI initially it is now a completely independent build system and CLI with first class support for Angular React Node Next js TypeScript and more And with tons of community plugins that extend Nx beyond that ConclusionCongrats you made it to the end of this article By now you should have gotten a pretty good overview of what Nx is about its strengths and how it can be useful in your next React project If you still got questions or are hesitant to adopt Nx reach out to me on Twitter Where to go from here join the community Slackfollow me on Twitterfollow Nx on Twitterlearn more about Nx on subscribe on the Nx Youtube channeljoin more than developers and take the free Egghead course on how to scale React development with Nx |
2022-03-30 17:23:41 |
海外TECH |
DEV Community |
How to test solidity smart contracts with ruby with RSpec and Etherium.rb |
https://dev.to/thesmartnik/how-to-test-solidity-smart-contracts-with-ruby-with-rspec-and-etheriumrb-156
|
How to test solidity smart contracts with ruby with RSpec and Etherium rbI recently tried testing solidity contracts with rspec and wanted to share results since I haven t really found anyone documenting the process Why Initially I just wanted to test whether it s possible because I like ruby and try to stick it anywhere I can Result turned out to be pretty good though I haven t found any big differences with truffle suite Without further ado Naive implementation PrerequisitesInstall ganache with npm g ganache cliInstall solidity compiler If you re on mac you can just use brew install solidity If not here is a link to documentation Our smart contractFor this tutorial We ll use a simple hello world contract located in contracts greeter solpragma solidity gt contract Greeter string private greeting Hello World address public owner constructor owner msg sender function greet external view returns string memory return greeting function setSuperGreeting string calldata greeting external require msg sender owner Only owner greeting greeting As you can see it allows to read from block and write from a blockchain Simple but good enough for our tests Our test Spec setupFirst we d need to start ganache with just gt ganache cliThen following etherium rb documentation all we need to do isCreate local clientclient Ethereum HttpClient new http localhost Create instance of our contract by providing path to a file and instance of a clientEthereum Contract create file greeter sol client client Deploy contractcontract deploy and waitOur initial setup will look like thisrequire spec helper rb RSpec describe Greeter do let client Ethereum HttpClient new http localhost let contract Ethereum Contract create file contracts greeter sol client client before contract deploy and wait AssertsFirst let s test our greet method To read from a blockchain with etherium rb we ll need to use call like so contract call method name Our test case will look like thisit reads greeting do expect contract call greet to eq Hello World endTo change state of the blockchain we need to use transaction like so contract transact and wait method name Here is an example of our next assertionit changes message do contract transact and wait set super greeting Yo expect contract call greet to eq Yo endOur whole spec will look like thisrequire spec helper RSpec describe Greeter do let client Ethereum HttpClient new http localhost let contract Ethereum Contract create file contracts greeter sol client client before contract deploy and wait it sets greeting do expect contract call greet to eq Hello World end it changes message do contract transact and wait set super greeting Yo expect contract call greet to eq Yo endendRunning gt bundle exec rspec examples failuresAs you can see it s super easy only a couple drawbacks Need to start ganache by handNo easy access to accounts Next IterationTo overcome the above drawbacks I ve created a simple gem It ll start ganache before the tests and provide access to accounts Require gemLet s add our gem to a Gemfilegem rspec eth and require it in spec helper rb withrequire rspec eth Change specAll you need to do now to make code work is add type smart contract RSpec Eth provides a few methods that ll make our specs even simple We now can remove client and contract As the gem will guess contract location by spec location Updated versionrequire spec helper RSpec describe Greeter type smart contract do before contract deploy and wait it sets greeting do expect contract call greet to eq Hello World end it changes message do contract transact and wait set super greeting Yo expect contract call greet to eq Yo endendNow stop ganache if it s still running and try running specs again gt bundle exec rspec examples failures ConclusionIt s still a work in progress and the process can be improved by adding extra configuration options and contract specific matchers However if you like me love using ruby whenever you can I believe truffle isn t the only toolset you can use for testing smart contracts |
2022-03-30 17:15:36 |
海外TECH |
DEV Community |
how i |
https://dev.to/rishub/how-i-21p8
|
Detail Nothing |
2022-03-30 17:12:52 |
海外TECH |
DEV Community |
Ideas for simple apps |
https://dev.to/awesomemg/ideas-for-simple-apps-9bp
|
Ideas for simple appsHey everyone I need some ideas on a quick app I can program with my extra time This app I would perfer be something easy and managable but simple and very needed to developers or just every day people Thanks |
2022-03-30 17:12:33 |
海外TECH |
DEV Community |
Day-54 Training At Ryaz |
https://dev.to/mahin651/day-54-training-at-ryaz-2p9j
|
Day Training At RyazDate Day WednesdayToday I started at about am as I was struggling with working of jwt tokens so as yesterday due to some error in the index js file so the post request was also not sent successfully so today I started with solving the problem and finding the root cause of it so after having various attempts I was unable to do this but in the last half of day I got the solution about this so I was done with the working of index js file and after solving this problem with several testing I was succsfull to send jwt tokens with the or along with the post request so now the work left over is the testing of authorisation part from the postman itself so as this problem is solved now it would be done in little amount of time so this way my day ended up and the authorization part would be completed by tomorrow |
2022-03-30 17:09:39 |
海外TECH |
DEV Community |
Survey Form |
https://dev.to/collinsruto/survey-form-5d90
|
survey |
2022-03-30 17:06:33 |
海外TECH |
DEV Community |
.forEach vs .map: A Short Summary |
https://dev.to/benjaminkane03/foreach-vs-map-a-short-summary-e8h
|
forEach vs map A Short SummaryTwo very important array iteration methods that you will be seeing when using java are forEach and map both going through an array and enacting a function on each element But how do they differ in usage and purpose In this post I will be explaining key differences and elements that differ these two methods First is forEach an iteration method that will call a function for each element in an array One important thing to note is that forEach will go through every single element in the array it is used on without mutating it There are three five parameters to use in forEach with two of them being required to run the function these two being the function that is going to be run onto the array and currentValue the value array that the function is being run on The three optional parameters here are the index of the current element index the array of the current element if you are working on something that is nested arr and thisValue which will pass the parameter entered as its this value Moving onto map map will just like forEach call a function onto an array but the real question is which array To which I answer a copy of course map creates a copy of the original array and calls a function onto every element in said copy One difference that stands out from forEach is that forEach creates a copy of the array which is useful for preventing accidental mutations or changes in the array And while I said earlier that forEach doesn t change the array that was a bit of a lie Any callback function provided in forEach s parameter may cause a mutation depending on what you want the function to do map takes the same parameters as forEach which at first fooled me when I was in the process of learning iteration methods for arrays Understand that when you use map the array that you iterate over is a copy of the original preventing the data modified from being applied to the original array and returning that modified copy whereas forEach iterates the function over that exact array |
2022-03-30 17:05:22 |
海外TECH |
DEV Community |
How to add Images to HTML Canvas |
https://dev.to/smpnjn/how-to-add-images-to-html-canvas-1gm
|
How to add Images to HTML CanvasWhen working with HTML Canvas sometimes it s desirable to add images In this article let s look at how you can easily add images like jpeg and png to your HTML canvas If you re brand new to HTML Canvas start with our Getting Started with HTML Canvas guide How to add Images to HTML CanvasAdding images to HTML canvas depends upon the Image constructor which lets us interact with images in Javascript For this guide I ll be using an image from Pexels by figenkokol To start create your HTML canvas element as you normally would lt canvas id canvas width height gt lt canvas gt Now let s look at the HTML We first create a new Image and then set its url i e src to the image we want to show let canvas document getElementById canvas let ctx canvas getContext d Create our imagelet newImage new Image newImage src When it loadsnewImage onload gt Draw the image onto the context ctx drawImage newImage When the image loads newImage onload then we draw the image onto our canvas To do that we use ctx drawImage The syntax is shown below ctx drawImage image x y width height If declared like this ctx drawImage only has arguments image the image we want to use generated from our new Image constructor x the x position on the canvas for the top left corner of the image y the y position on the canvas for the top left corner of the image width the width of the image If left blank the original image width is used height the height of the image If left blank the original image height is used The above code will produce the following canvas Now we ve successfully drawn an image onto an HTML canvas element using just Javascript Cropping Images in HTML CanvasUsing ctx drawImage function we can also crop images This version of the function accepts a slightly different syntax but lets us crop an image as we see fit ctx drawImage image cx cy sw sh x y width height If declared like this ctx drawImage has arguments image the image we want to use generated from our new Image constructor cx this is how far from the top left we want to crop the image by So if it is the image will be cropped pixels from the left hand side cy this is how far from the top we want to crop the image by So if it is the image will be cropped pixels from the top side sw this is how big we want the image to be from the point of cx So if the image will continue for px from cx and then be cropped at that point sh this is how big we want the image to be from the point of ch So if the image will continue for px from ch and then be cropped at that point x the x position on the canvas for the top left corner of the image y the y position on the canvas for the top left corner of the image width the width of the image If left blank the original image width is used height the height of the image If left blank the original image height is used If you prefer the visual here is how cropping works with this method How cropping works with HTML CanvasLet s look at an example Nothing really changes except for the syntax of ctx drawImage let canvas document getElementById canvas let ctx canvas getContext d Create our imagelet newImage new Image newImage src When it loadsnewImage onload gt Draw the image onto the context with cropping ctx drawImage newImage Note the cropping effect will use the original image size so if your image is px wide as this one is we have to crop it according to those dimensions We can then use x y width height to draw the image onto any size we like The above will produce the following canvas |
2022-03-30 17:03:27 |
Apple |
AppleInsider - Frontpage News |
Some Apple Health code may have been stolen by hacking group |
https://appleinsider.com/articles/22/03/30/some-apple-health-code-may-have-been-stolen-by-hacking-group?utm_medium=rss
|
Some Apple Health code may have been stolen by hacking groupApple Health code used to develop the Globant Earn Your Apple Watch program may have been stolen in the latest Lapsus hack Lapsus claims to have stolen data from GlobantLapsus made the claim via its Telegram channel on Wednesday with links out to torrents of the data Screenshots of the files revealed folders with names like Facebook and apple health app Read more |
2022-03-30 17:55:03 |
Apple |
AppleInsider - Frontpage News |
Studio Display teardown shows iMac-like dual-fan cooling, dense electronics |
https://appleinsider.com/articles/22/03/30/studio-display-teardown-shows-imac-like-dual-fan-cooling-dense-electronics?utm_medium=rss
|
Studio Display teardown shows iMac like dual fan cooling dense electronicsThe Studio Display features a lot of electronics behind its screen a teardown of the new Apple monitor reveals complete with a dual fan cooling system to thermally manage the dense screen Apple Studio DisplayFollowing the release of new Apple products a teardown of the hardware usually ensues showing all of the company s design choices for inside the devices For the new Studio Display it has gone through the same customary treatment via repair outfit iFixit Read more |
2022-03-30 17:34:56 |
Apple |
AppleInsider - Frontpage News |
Rumor roundup: What to expect from the iPhone 14 Pro & iPhone 14 Pro Max |
https://appleinsider.com/articles/22/03/30/rumor-roundup-what-to-expect-from-the-iphone-14-pro-iphone-14-pro-max?utm_medium=rss
|
Rumor roundup What to expect from the iPhone Pro amp iPhone Pro MaxThe iPhone Pro lineup may set itself apart with no notch the A processor and a MP camera Here s what the rumor mill suggests the phones will look like The iPhone Pro lineup will have pill and hole cutouts in place of the notchRumors about the iPhone Pro have shifted from a radical redesign to a more iterative update However if rumors prove true Apple may be widening the gap between the standard and pro models with different designs and chipsets Read more |
2022-03-30 17:16:43 |
Apple |
AppleInsider - Frontpage News |
Apple showcases artist Belinda Kou's reliance on the iPad Air |
https://appleinsider.com/articles/22/03/30/apple-showcases-artist-belinda-kous-reliance-on-the-ipad-air?utm_medium=rss
|
Apple showcases artist Belinda Kou x s reliance on the iPad AirLettering artist and businesswoman Belinda Kou tells Apple that it is the iPad Air that took her from studying biopsychology and into an art career In the latest of its long running series on professionals and artists using its devices Apple has interviewed Chicago based Kou about her work Now both an artist herself and training others in the arts Kou says it took the iPad Air to make her depart from the career her family expected While I can t speak on behalf of every Asian American community she told Apple I personally grew up in one where the engineers doctors and other people with STEM careers were among the most celebrated Read more |
2022-03-30 17:28:04 |
海外TECH |
Engadget |
Microsoft's online-only Build 2022 event kicks off May 24 |
https://www.engadget.com/microsofts-online-only-build-2022-event-kicks-off-may-24-172221777.html?src=rss
|
Microsoft x s online only Build event kicks off May Since the start of the COVID outbreak in March Microsoft s annual Build conference for developers engineers and IT professionals has been held online But after two years of lockdowns and nearly months since the release of effective vaccines Build will once again be hosted online from May th through th While the conference is largely geared towards professionals plenty of consumer facing tech has emerged from previous years events from advances to Microsoft Teams to the quot next generation quot of Windows This year attendees will quot experience market specific content and connection opportunities for France Germany Japan Latin America and the UK in Regional Spotlights quot according to the conference s launch site in addition to the standard slate of keynotes workshops and networking opportunities Registration for the conference opens in late April and will be free You can check out the event agenda at the Build homepage nbsp nbsp |
2022-03-30 17:22:21 |
海外TECH |
Engadget |
Former DeepMind employee acuses company of mishandling sexual abuse complaint |
https://www.engadget.com/deepmind-employee-accuses-company-mishandling-sexual-abuse-complaint-171643326.html?src=rss
|
Former DeepMind employee acuses company of mishandling sexual abuse complaintA former DeepMind employee has accused the company of mishandling a series of serious sexual harassment allegations In a report published Wednesday The nbsp Financial Times nbsp recounts the experience of a former female staff member who alleges she was sexually assaulted twice by a senior researcher at the Google subsidiary She says her harasser also sent her multiple traumatic documents including one where he made allusions to raping unconscious women DeepMind eventually dismissed the researcher but not before it subjected his victim to a disciplinary process she argues showed major flaws in how the company handles such incidents All told it reportedly took DeepMind seven months to address the complaint and only did so after the former employee filed an appeal It then allegedly took another two months before the company finally dismissed her harasser in September During that period the former employee was told she would face “disciplinary action if she talked about her complaint with colleagues She was advised not to visit the office where her harasser worked but her manager not knowing the full scope of the complaint repeatedly pushed her to attend meetings at that same building According to The Times DeepMind did not place any restrictions on the alleged perpetrator a claim the company disputes nbsp A spokesperson for DeepMind said the firm told the researcher not to contact the staff member in September The company also disputes a claim the researcher received an award for their work during the time they were being investigated by the company DeepMind says the award was one meant for the team the alleged perpetrator worked for and was related to a historic research paper “According to your own findings I was subjected to sexual harassment assault and abuse…I will never be the same person I have spent almost the entire last year fearing for my safety There is absolutely…no reason why the investigation was so dysfunctional the former employee said in an August email to DeepMind s senior leadership “Any incident of sexual assault or harassment is abhorrent DeepMind takes all allegations of workplace misconduct extremely seriously and we place our employees safety at the core of any actions we take DeepMind told Engadget “The allegations were investigated thoroughly and the individual who was investigated for misconduct was dismissed without any severance payments Following the incident DeepMind told Engadget nbsp it implemented a series of policies to change how it investigates such matters Among other changes the company says it now communicates more clearly how employees should go about raising concerns and that it has a better system in place to support workers who complain of harassment and discrimination It also told The Times it “regrets the former staff member was provided with “incorrect guidance around breaking confidentiality |
2022-03-30 17:16:43 |
Cisco |
Cisco Blog |
Contactless Retail |
https://blogs.cisco.com/retail/contactless-retail
|
Contactless RetailContactless payment fulfillment and transaction options give consumers safe and convenient ways to shop and receive products while providing retailers new ways to develop brand loyalty increase share of their customers wallets and reduce costs |
2022-03-30 17:33:22 |
海外TECH |
CodeProject Latest Articles |
Complex Math Parser and Evaluator in VB.NET |
https://www.codeproject.com/Articles/5328357/Complex-Math-Parser-and-Evaluator-in-VB-NET
|
expression |
2022-03-30 17:49:00 |
金融 |
金融庁ホームページ |
IOSCOによる「分散型金融(DeFi)についての報告書」について掲載しました。 |
https://www.fsa.go.jp/inter/ios/20220330/20220330.html
|
iosco |
2022-03-30 18:00:00 |
金融 |
金融庁ホームページ |
IOSCOによる市中協議文書「リテール投資家の最近の動向とコンダクト上の影響に関する報告書」について掲載しました。 |
https://www.fsa.go.jp/inter/ios/20220330-2.html
|
iosco |
2022-03-30 18:00:00 |
金融 |
金融庁ホームページ |
金融庁職員の新型コロナウイルス感染について公表しました。 |
https://www.fsa.go.jp/news/r3/sonota/20220330.html
|
新型コロナウイルス |
2022-03-30 18:00:00 |
ニュース |
BBC News - Home |
Shrewsbury maternity scandal: Sajid Javid promises 'swift' changes |
https://www.bbc.co.uk/news/uk-england-shropshire-60933936?at_medium=RSS&at_campaign=KARANGA
|
harrowing |
2022-03-30 17:42:38 |
ニュース |
BBC News - Home |
War in Ukraine: Russia launches new attacks after peace promise |
https://www.bbc.co.uk/news/world-europe-60925713?at_medium=RSS&at_campaign=KARANGA
|
russia |
2022-03-30 17:27:27 |
ニュース |
BBC News - Home |
Tom Parker: The Wanted singer dies aged 33 |
https://www.bbc.co.uk/news/entertainment-arts-60934411?at_medium=RSS&at_campaign=KARANGA
|
brain |
2022-03-30 17:11:41 |
ニュース |
BBC News - Home |
Bruce Willis gives up acting due to brain disorder aphasia |
https://www.bbc.co.uk/news/world-us-canada-60934576?at_medium=RSS&at_campaign=KARANGA
|
abilities |
2022-03-30 17:19:10 |
ニュース |
BBC News - Home |
Brexit delayed pandemic plans says disaster expert |
https://www.bbc.co.uk/news/uk-60926196?at_medium=RSS&at_campaign=KARANGA
|
covid |
2022-03-30 17:24:58 |
ニュース |
BBC News - Home |
P&O Ferries: New ferry pay rules won’t work, warn ports |
https://www.bbc.co.uk/news/business-60929670?at_medium=RSS&at_campaign=KARANGA
|
bodies |
2022-03-30 17:29:44 |
ニュース |
BBC News - Home |
Paris St-Germain president Nasser Al-Khelaifi on European Super League & FFP |
https://www.bbc.co.uk/sport/football/60929239?at_medium=RSS&at_campaign=KARANGA
|
Paris St Germain president Nasser Al Khelaifi on European Super League amp FFPAlmost a year on from the European Super League proposal Paris St Germain president Nasser Al Khelaifi discusses the key issues affecting European football |
2022-03-30 17:35:45 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
銀行の業界研究、激動の時代を生き抜く採用戦略と求められる人材とは【再編マップ付き】 - 親と子のための業界・企業研究 |
https://diamond.jp/articles/-/300491
|
企業研究 |
2022-03-31 02:55:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
「ダイエットのためには野菜をたくさん食べたほうがいい」、は正解か? - やせたい人はカロリー制限をやめなさい |
https://diamond.jp/articles/-/298788
|
野菜 |
2022-03-31 02:50:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
思い込みがあなたの現実をつくっている - 「自分」の生き方――運命を変える東洋哲理の教え |
https://diamond.jp/articles/-/300131
|
|
2022-03-31 02:45:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
ひろゆきが呆れる「ショートスリーパーに憧れる人の特徴」とは? - 1%の努力 |
https://diamond.jp/articles/-/299696
|
youtube |
2022-03-31 02:30:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
「同調圧力が溜め込まれた社会」を生き抜くための考え方 - 起業家の思考法 |
https://diamond.jp/articles/-/299137
|
同調圧力 |
2022-03-31 02:28:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
日本では継続的インフレが起こらないといえる理由【東大生が投資のプロに学ぶお金の教養】 - 東大金融研究会のお金超講義 |
https://diamond.jp/articles/-/299760
|
日本では継続的インフレが起こらないといえる理由【東大生が投資のプロに学ぶお金の教養】東大金融研究会のお金超講義年月に発足した東大金融研究会。 |
2022-03-31 02:26:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
アメリカの中学生が学ぶ「チップ」入門【全世界700万人が感動した「数学」ノート】 - アメリカの中学生が学んでいる14歳からの数学 |
https://diamond.jp/articles/-/299887
|
アメリカの中学生が学ぶ「チップ」入門【全世界万人が感動した「数学」ノート】アメリカの中学生が学んでいる歳からの数学年の発売直後から大きな話題を呼び、中国・ドイツ・韓国・ブラジル・ロシア・ベトナム・ロシアなど世界各国にも広がった「学び直し本」の圧倒的ロングセラーシリーズ「BigFatNotebook」の日本版が刊行される。 |
2022-03-31 02:24:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【アメリカの中学生が学ぶプログラミングノート】情報とコンピュータ - アメリカの中学生が学んでいる14歳からのプログラミング |
https://diamond.jp/articles/-/300564
|
【アメリカの中学生が学ぶプログラミングノート】情報とコンピュータアメリカの中学生が学んでいる歳からのプログラミング年の発売直後から大きな話題を呼び、中国・ドイツ・韓国・ブラジル・ロシア・ベトナムなど世界各国にも広がった「学び直し本」の圧倒的ロングセラーシリーズ「BigFatNotebook」の日本版が刊行された。 |
2022-03-31 02:22:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
どうして、教養がない人ほど悩み込んでしまうのか - だから、この本。 |
https://diamond.jp/articles/-/300383
|
選択肢 |
2022-03-31 02:20:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
部下の才能を「つぶす上司」「のばす上司」の決定的な差 - マンガ転職の思考法 |
https://diamond.jp/articles/-/299688
|
|
2022-03-31 02:18:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【どう働く?】会社一筋で働く時代の終焉 - 40代からは「稼ぎ口」を2つにしなさい |
https://diamond.jp/articles/-/300518
|
【どう働く】会社一筋で働く時代の終焉代からは「稼ぎ口」をつにしなさい「このまま」今の仕事を続けても大丈夫なのかあるいは「副業」をしたほうがいいのかそれとも「起業」か、「転職」をすべきなのかこのように感じたとしたら、それは皆さんの考えが正しい。 |
2022-03-31 02:16:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
起業家が直面する究極のジレンマ【ハーバード大教授の4つの選択肢】 - 起業の失敗大全 |
https://diamond.jp/articles/-/300450
|
選択肢 |
2022-03-31 02:14:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【精神科医が教える】 孤独を癒やすたった1つの方法 - 精神科医Tomyが教える 心の荷物の手放し方 |
https://diamond.jp/articles/-/300410
|
voicy |
2022-03-31 02:12:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
法廷バトルに意欲燃やすマスク氏、SECに徹底抗戦 - WSJ発 |
https://diamond.jp/articles/-/300628
|
徹底抗戦 |
2022-03-31 02:09:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
“説得力のある人”が深く理解している 「人間心理」のメカニズムとは? - 完全版 社内プレゼンの資料作成術 |
https://diamond.jp/articles/-/300393
|
|
2022-03-31 02:08:00 |
コメント
コメントを投稿