TECH |
Engadget Japanese |
レトロでキュートなUSBマイク・レコーダー「Tula Mic」 |
https://japanese.engadget.com/tula-mic-093009600.html
|
tulamic |
2022-02-07 09:30:09 |
TECH |
Engadget Japanese |
「マスク付きでFace ID」のiOS 15.4は本当にiPhoneユーザーを解放するのか?ベータ版を試す(本田雅一) |
https://japanese.engadget.com/iphone-mask-15-4-092618800.html
|
faceid |
2022-02-07 09:26:18 |
TECH |
Engadget Japanese |
FCCのHuaweiやZTEの機器交換プログラム、想定を上回る56億ドルの申請 |
https://japanese.engadget.com/fcc-huawei-zte-rip-replace-090017956.html
|
chainreimbursementprogram |
2022-02-07 09:00:17 |
ROBOT |
ロボスタ |
地方自治体のドローン等活用事例とその未来像について EDAC活動報告シンポジウム第三回 2月17日、20日にオンライン開催 |
https://robotstart.info/2022/02/07/edac-symposium-drone-3rd.html
|
一般社団法人 |
2022-02-07 09:16:15 |
IT |
ITmedia 総合記事一覧 |
[ITmedia News] Illustratorで起動不可の不具合、他社セキュリティソフトが影響 アドビが回避法を案内 |
https://www.itmedia.co.jp/news/articles/2202/07/news138.html
|
illustrator |
2022-02-07 18:17:00 |
IT |
ITmedia 総合記事一覧 |
[ITmedia News] 四字熟語版Wordle「漢字ル」 はてなCTOが作成 部首のヒントがあっても激ムズ? |
https://www.itmedia.co.jp/news/articles/2202/07/news134.html
|
itmedia |
2022-02-07 18:03:00 |
IT |
情報システムリーダーのためのIT情報専門サイト IT Leaders |
ソニー銀行、住宅ローン審査のオペレーションをSalesforceと連携した文書管理システムで改善 | IT Leaders |
https://it.impress.co.jp/articles/-/22682
|
ソニー銀行、住宅ローン審査のオペレーションをSalesforceと連携した文書管理システムで改善ITLeadersソニー銀行は、住宅ローン審査のオペレーションを改善し、文書管理基盤とともに年月に稼働させた。 |
2022-02-07 18:23:00 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
pythonのpyenvでBUILD FAILD |
https://qiita.com/_NNN_/items/6ed66f4f4eb0389c2d54
|
pythonのpyenvでBUILDFAILD環境windowsHLinuxDevian該当エラーユーザー名XXXpyenvinstallDownloadingPythontarxzgtInstallingPythonERRORThePythonsslextensionwasnotcompiledMissingtheOpenSSLlibPleaseconsulttotheWikipagetofixtheproblemBUILDFAILEDDebianGNULinuxusingpythonbuildgeaInspectorcleanuptheworkingtreeattmppythonbuildResultsloggedtotmppythonbuildlog以下略試行錯誤とりあえずまずは普通にインストールしてみたら、上記のようなBUILDFAILEDエラーが出る。 |
2022-02-07 18:51:24 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
リスト型に対応していないSQLAlchemy(sqlite3)で取り扱う方法 |
https://qiita.com/yutamugiruru/items/76aeee8337de6edfada3
|
データベース変えようかなとも思いましたが、requestformgetlistというコードが存在していた為方法を模索した結果、、、、getlistのみだと文字列型のリストとなり、HTML上でfor文を使用して回した際一文字づつの表示となってしまう。 |
2022-02-07 18:22:09 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
Pythonの「クロージャ」って知ってる? |
https://qiita.com/cardene/items/f8ec0433b5b2c7a57c9d
|
機械学習 |
2022-02-07 18:17:01 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
Promiseのループ処理と終わってから何かする |
https://qiita.com/uedatakeshi/items/2e0a6d8eece0ff511fa9
|
Promiseのループ処理と終わってから何かする調べてみたらこういう書き方もあるようだ。 |
2022-02-07 18:43:18 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
【WEB】lottie.jsをローカルで動かす |
https://qiita.com/kg_nuts_kg/items/4e194cabece15634dd35
|
CDNでももちろんOKですが、今回はローカルで完結させたいのでjQuery本体とlottiejsはダウンロードしてきたものを読み込むとします。 |
2022-02-07 18:12:49 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
深呼吸アプリを作ってみたので振り返ります |
https://qiita.com/han-aru/items/98dbc62356d3d927a8bf
|
これから直してみたい所深呼吸をあと回しますねという表記が不自然なので、言葉でなんとかできたらしたいところです。 |
2022-02-07 18:12:35 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
【RSpec】インスタンス変数よりletを使う理由 |
https://qiita.com/kat0/items/629781005e868dde31e1
|
インスタンス変数の場合nilと評価されるため、インスタンス変数をtypoしたことにすぐには気づけない可能性がある。 |
2022-02-07 18:32:37 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
Amazon SESを使うことで通常のGmailで独自ドメインを利用する -受信編- |
https://qiita.com/Sand-River/items/4b22f3d0369ab68cfb3f
|
確認今回セットアップしたドメインあてにメールを送信するとメッセージIDをオブジェクト名としたオブジェクトがSバケットに作成されていることが確認できる。 |
2022-02-07 18:58:56 |
Azure |
Azureタグが付けられた新着投稿 - Qiita |
Azure Resource Manager テンプレートスペックに Bicep ファイルを格納してデプロイする |
https://qiita.com/07JP27/items/d76711102858501ce157
|
ARMテンプレートスペックというサービスの名前からARMテンプレートしか格納できないのかなと思われるかもしれませんがBicepファイルもそのまま格納できます。 |
2022-02-07 18:47:48 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
【RSpec】インスタンス変数よりletを使う理由 |
https://qiita.com/kat0/items/629781005e868dde31e1
|
インスタンス変数の場合nilと評価されるため、インスタンス変数をtypoしたことにすぐには気づけない可能性がある。 |
2022-02-07 18:32:37 |
技術ブログ |
Mercari Engineering Blog |
Kubernetes Casual Talk 〜Ubie、CA、メルペイ各社のCI/CD事情〜 を開催しました! #kubernetes_casualtalk |
https://engineering.mercari.com/blog/entry/20220129-368d0842e6/
|
yhellip |
2022-02-07 10:00:38 |
技術ブログ |
Developers.IO |
スイッチ用のIAMロール作成手順 |
https://dev.classmethod.jp/articles/configure-switch-role/
|
配下 |
2022-02-07 09:47:48 |
技術ブログ |
Developers.IO |
Amplify、Cognitoを使ったサーバレスウェブアプリ構築ハンズオンをやってみた |
https://dev.classmethod.jp/articles/serverless-web-app-hands-on/
|
amplify |
2022-02-07 09:15:23 |
海外TECH |
DEV Community |
Fastest Symfony authentication - AWS Cognito integration |
https://dev.to/bornfightcompany/fastest-symfony-authentication-aws-cognito-integration-583i
|
Fastest Symfony authentication AWS Cognito integrationIf you either love AWS services already or are looking for a good option to use with your multiplatform products AWS Cognito seems to be a good candidate to adopt into your technical stack For me it was unknown but once I started digging into it I find it to solve some problems I was bored with solving Setup Cognito on AWSFor starters we should prepare our Cognito user pool We can do this via AWS UI On the Cognito page we select Create new user pool There are no really special settings you need to configure upon creation so choose either default settings or settings that fit your needs Only thing we need from user pool is to setup APP client Configure the APP client as you need For the callback URL we will target symfony route security cognito check ie http localhost security cognito check If using local Symfony be careful about using http or https domains Spent some time to figure that one out because I was reckless D SymfonyAt the time of writing this article Symfony was the newest version and used to test this code Symfony installationTo be able to follow this post you should either have an existing Symfony project or create a new one For ease of example I will provide quick intro how to set up a new clean Symfony project We start with the new symfony project symfony new webapp Please see Documentation on installation and setup of Symfony project To verify we installed successfully we can run server using symfony server start Install and configure packages for Cognito integrationNow that we have Symfony and Cognito ready we can begin integration into our Symfony application We will use knpuniversity bundle that provides variety of built in connectors but it is missing Cognito one For that we will install Cognito agent provided by another package composer require knpuniversity oauth client bundle cakedc oauth cognitoOnce installation is complete we begin to configure the bundle Update config packages knpu oauth client yaml knpu oauth client clients configure your clients as described here configuration cognito name of our client type generic type provider class CakeDC OAuth Client Provider Cognito class provided by agent package client id lt AWS CLIENT ID gt Cognito app id client secret lt AWS CLIENT SECRET gt Cognito app secret redirect route connect cognito check name of the route where we wanna redirect callback it mush be same as configued in the Cognito app provider options region lt AWS REGION gt cognitoDomain lt AWS COGNITO DOMAIN gt Cognito domain just the domain without region and aws suffix scope email scopes configured in cognitoWe also need some Symfony User If you do not already have this we can create it now If you already have user and user providers you can skip this part and go to creation of connection controller Create user using maker bundle bin console make user with settings store user in the database NO this is for demo purpose In the real world you would probably wanna store it into a databaseunique property Email this can be whatever you needHash check password NO again if you need it otherwise you can use itThis will generate src Security User php Our User classsrc Security UserProvider php User provider class used by Symfony security It will also update the security configuration config packages security yaml with information about our new user provider If you are not familiar with these terms I would urge you to read basics of Symfony security in Symfony Security documentation Next we need to create connection controller that will provide routes and calls to oauth client bundle ie lt phpnamespace App Controller use KnpU OAuthClientBundle Client ClientRegistry use Symfony Bundle FrameworkBundle Controller AbstractController use Symfony Component HttpFoundation Request use Symfony Component Routing Annotation Route class SecurityCognitoController extends AbstractController Link to this controller to start the connect process Route login name connect cognito start public function connectAction ClientRegistry clientRegistry will redirect to AWS Cognito return clientRegistry gt getClient cognito key used in config packages knpu oauth client yaml gt redirect After going to Cognito you re redirected back here because this is the callback URL you configured in AWS Cognito APP settings Route security cognito check name connect cognito check public function connectCheckAction Request request ClientRegistry clientRegistry if you want to authenticate the user then leave this method blank and create a Guard authenticator Route logout name security logout public function logout Logout is currently not configured and you can customize this to your needs later Last code class we need to create is custom Authenticator by following KNP docs and guidelines lt phpnamespace App Security use CakeDC OAuth Client Provider CognitoUser use KnpU OAuthClientBundle Client ClientRegistry use KnpU OAuthClientBundle Security Authenticator OAuthAuthenticator use Symfony Component HttpFoundation RedirectResponse use Symfony Component HttpFoundation Request use Symfony Component HttpFoundation Response use Symfony Component Routing RouterInterface use Symfony Component Security Core Authentication Token TokenInterface use Symfony Component Security Core Exception AuthenticationException use Symfony Component Security Http Authenticator Passport Badge UserBadge use Symfony Component Security Http Authenticator Passport Passport use Symfony Component Security Http Authenticator Passport SelfValidatingPassport class CognitoAuthenticator extends OAuthAuthenticator private clientRegistry private router public function construct ClientRegistry clientRegistry RouterInterface router this gt clientRegistry clientRegistry this gt router router public function supports Request request bool continue ONLY if the current ROUTE matches the check ROUTE return request gt attributes gt get route connect cognito check public function authenticate Request request Passport client this gt clientRegistry gt getClient cognito accessToken this gt fetchAccessToken client NOTE Here you can store token into session if you are using stateful authentication return new SelfValidatingPassport new UserBadge accessToken gt getToken function use accessToken client var CognitoUser user cognitoUser client gt fetchUserFromToken accessToken NOTE here you can load save user from storage such as database user new User user gt setEmail cognitoUser gt getEmail return user public function onAuthenticationSuccess Request request TokenInterface token string firewallName Response change app homepage to some route in your app targetUrl this gt router gt generate app homepage return new RedirectResponse targetUrl or on success let the request continue to be handled by the controller return null public function onAuthenticationFailure Request request AuthenticationException exception Response message strtr exception gt getMessageKey exception gt getMessageData return new Response message Response HTTP FORBIDDEN Please note the targetUrl in the onAuthenticationSuccess method Customize this to your needs I will also provide simple controller at the end of the article for convenience of testing Last thing is to update our security yaml configuration to use our custom provider firewalls main custom authenticator App Security CognitoAuthenticatorThis is the main subsection not the entire contents of the file For our configuration we only needed to add custom authenticator setting that is our authenticator class Once done and you try it by opening http localhost login you should be redirected to AWS hosted login page After you login you will be redirected back to your symfony site with error exception from UserProvider refreshUser If you just wish to try it out you can return user in this method Important This is for testing only and it is not good practice You should fit this to your implementation If you wish to see try it out here is a simple test controller lt phpnamespace App Controller use Sensio Bundle FrameworkExtraBundle Configuration IsGranted use Symfony Component Routing Annotation Route use Symfony Component HttpFoundation Response use Symfony Component Security Core Security final class DefaultController Route name app homepage IsGranted ROLE USER public function invoke Security security Response we return with html head and body tags as this is needed by Symfony profiler to attach to the page return new Response sprintf lt html gt lt head gt lt head gt lt body gt Welcome s lt body gt lt html gt security gt getUser gt getUserIdentifier and you also need to update services yml and add section load new controller controllers are imported separately to make sure services can be injected as action arguments even if you don t extend any base controller class App Controller resource src Controller tags controller service arguments And there you have it You can login into your Symfony application using AWS Cognito Feel free to clean up the code improve the security of it and make it ready for the real world Security is important and sometimes hard topic I would urge you to read Symfony Security documentation to better understand how it works what are good practices and how to avoid pitfalls Have fun coding creating and learning |
2022-02-07 09:35:26 |
海外TECH |
DEV Community |
The Ultimate Smart Contract Developer Roadmap |
https://dev.to/oliverjumpertz/the-ultimate-smart-contract-developer-roadmap-hij
|
The Ultimate Smart Contract Developer Roadmap could be the year you get into smart contract development The market has a high demand for developers knowing their way around Solidity for Ethereum and this is why the following roadmap could potentially help you get your foot in the door Furthermore with average salaries of around k for remote positions Solidity developers can earn pretty well even working from home And even better by learning Solidity and this development stack you become proficient on multiple blockchains at once From Ethereum to Polygon Binance Smart Chain Avalanche and more Solidity covers them all This roadmap is a long term investment It s nothing you finish in one day and are then good to go But by following the path presented here you will learn all the basics including advanced concepts and become ready for a job after a while Without further ado let s get into it This article was originally posted on my personal blog CS Introduction to Computer ScienceDepending on where you currently stand in terms of your skills it might be that you first need an introduction to CS overall Harvard offers its CS for free and it ll take you a while but it s worth it Fundamentals are crucial especially as many of the advanced concepts you will learn later build on top of them freeCodeCampJavaScript is the basis of many tools in the Ethereum ecosystem You should know JavaScript relatively well before you get into Solidity later Do at least the JavaScript courses here including quality assurance This will also take you quite some time but knowing JavaScript well also helps you learn Solidity later Public Key CryptographyAt the heart of a blockchain lies public key cryptography You should understand what it is how it works and why what you ll do later makes sense This video is a great introduction Go through it a few times if you need to Don t forget to take a few notes Cryptography Digital signaturesWith cryptography you can begin to sign messages and verify identities Blockchains use it a lot Without signing messages there would be no secure transactions This article will give you a better idea of how transactions are initiated for example and why that is secure What is Hashing on the Blockchain Hashing is a core concept that blockchains use And as a smart contract developer you will probably also use it a lot This video is an excellent introduction to hashing and its use in blockchains Like before take notes At some point you will be thankful for having them ready Blockchain Definition What You Need To KnowNow that you know what cryptography is actually about it s time to learn more about blockchains in general The blockchain will be your place of work so you better know well what you ll work with How does Ethereum work anyway Knowing Ethereum is pretty essential primarily as you work toward being able to code with Ethereum like blockchains in the future When you re done with this article you ll have a general understanding of Ethereum This is the last theory material for now When you are done with this you ll be able to get into the code again And this time it s Solidity you will work with The Hitchhiker s Guide to Smart Contracts in EthereumTime to finally dip your toes into the waters of Solidity While already a little older this guide is a great way to finally implement your first Smart Contract Take your time to go through this guide Solidity is probably new for you and so it s way better to really digest the learning material until it sticks Crypto ZombiesCryptoZombies is a game but one that teaches you Solidity In this tutorial you ll write more advanced logic and get comfortable with the language You can also take your time with Crypto Zombies Do a few lectures here and there and don t try to rush through it You ll learn many basic and advanced concepts throughout this course Time locked Wallets An Introduction to Ethereum Smart ContractsTime for even more practice This tutorial walks you through creating a full dApp including your own ERC token Take this course as an opportunity to learn Solidity even more profoundly and apply what you previously learned Practice is everything so all chances for you to code in Solidity are valuable Ultimate Introduction to Ethereum Ðapp DevelopmentThis one is a great video series on dApp development Concentrate on the Smart Contract videos and you ll get even more valuable practice with Solidity Once again it s all about applying Solidity You might begin to notice that you already know a few of the concepts but don t let this hold you back The more often you do something the higher the chance that this knowledge doesn t vanish again EthernautEthernaut is another game that teaches you Solidity This one primarily focuses a little more on security a topic that will be very important to you as a smart contract developer Security is actually one of the biggest issues in smart contract development these days and this is why you should pay very close attention to the matter and take many notes The industry loves developers who know what they are doing and they will highly value candidates with experience in smart contract security ethgasEvery line of code you write has an impact on your users They pay gas to call functions of your smart contracts Time to learn about the what why and how of gas You are back at some theory now but a pretty important one to be honest Understanding the concept of gas and why it is both good and bad helps you to value good code design higher and it will hopefully trigger different thought processes in you when writing Solidity Blockchain Oracles ExplainedYou won t be able to do everything on the blockchain Time to learn about oracles a way for Smart Contracts to communicate with the outside world Oracles are an advanced concept but one that every Solidity developer should understand Knowing about Oracles is a considerable advantage Depending on what projects you work on later you will have more or less contact with them But as soon as you understand that you already need an Oracle when you want a random number you will see that learning a lot about them helps you a lot Contract ABI SpecificationEvery smart contract has an ABI When someone wants to use your contracts they need to know their ABIs and you should also know what you actually create there After you have already built quite a few contracts by now it s time to learn what you actually create ABIs are at the core of blockchain client usage Without an ABI no clients would be able to call your contracts on chain KeccakKeccak is the important hash algorithm for Solidity developers You ll work with it a lot so you better know what you are using there HardhatThe time has come to choose the stack you will use from now on My recommendation for your development environment Hardhat Go through the documentation and learn more about this Ethereum development environment You will probably understand by now why you had to learn JavaScript in the beginning Hardhat is like many other Solidity tools implemented in JavaScript WaffleTests are crucial especially for Smart Contracts My recommendation Waffle Waffle is the engine that drives your tests It enables you to write JavaScript and test your smart contracts as a client ethers jsNext to Waffle you will also need a client library to invoke your contracts My recommendation ethers js ethers is the library that slowly completes your stack You will use ethers in your tests a lot OpenZeppelinSmart contract development is like traditional development and you should not try to reinvent the wheel every time OpenZeppelin provides many useful standards already implemented See what the library has to offer and learn to use it Many professional projects use OpenZeppelin a lot so why shouldn t you later Ethereum Improvement Proposals img alt Ethereum Improvement Proposals lt br gt height src cdn hashnode com res hashnode image upload v cJcvyNba png width Ethereum has defined many standards especially for tokens Standardized A B P Is are crucial to making the ecosystem work Go through them all and learn the most important ones like ERC ERC etc Solidity PatternsNow that you can freely build things without a browser it s time to build and learn important Solidity patterns along the way Patterns can be applied in certain places and help you to achieve specific things in a recognizable and maintainable way You will see many of them regularly when reading code and you will hopefully also apply them a lot This is the last thing you should learn really well before you branch out to build your own projects and use your own imagination What s Next You should be a pretty competent Solidity developer by now Your skills however are still pretty general From here on build a lot of stuff experiment even more and see what fields you might like You can definitely specialize from here on Look into NFTsCurrencies fungible tokensDeFiDAOsLearn more about all of them and see whether you like a field specifically Another topic you can now begin to research is decentralized computing You won t always be able to do everything within your smart contracts remember learning about Oracles Look into Chainlink as a beginning After that you can also try to become comfortable with Functions as a Service in JavaScript and such because sometimes you will have to write code outside of the blockchain The more you research the more interesting platforms and applications you will find Before You LeaveDo you like written content like this If so you will probably love my newsletter Iteration Three is the Web newsletter I would love to get into my inbox each week From the latest news in the industry opportunities analyses and development tips to showcases of interesting new projects this newsletter tries to give you everything you might have missed or did not even know existed |
2022-02-07 09:10:03 |
海外TECH |
DEV Community |
All you need to know to deal with user avatars 👤 in React |
https://dev.to/jancizmar/all-you-need-to-know-to-deal-with-user-avatars-in-react-664
|
All you need to know to deal with user avatars in ReactMost of the information systems using user authentication also work with some kind of avatars images enabling other users to see who commented posted or made anything else in the system When we want to be able to show user avatars we need to enable users to upload their avatar or generate some default In this article I am going to show you how to generate user avatar by their unique ID using jdenticonselect avatar from filecrop selected avatar using cropper js and react cropper libraries Generating default avatarWhen the user hasn t selected their own avatar we have few options what to show instead of it We can show nothing use some placeholder image or generate some pretty cool image There are multiple avatar generators in npm I chose jdenticon because I like the images it produces You can also find this nice icon designer in their docs so you can customize the output But I am going to stick with defaults So let s see how to use the library to generate the image import ComponentProps FC useState from react export const AutoAvatar FC lt ComponentProps lt img gt amp userId number size number gt userId size imgProps gt const base setBase useState undefined as string undefined using dynamic import to save some loading import jdenticon then toSvg gt const svgString toSvg userId size const base Buffer from svgString toString base setBase base return base lt div style backgroundColor rgb display flex gt lt img imgProps src data image svg xml base base alt User Avatar gt lt div gt lt div style width size height size display inline block gt Loading lt div gt What I am doing here is loading the jdenticon library using dynamic import The library has approx kb so it is good idea to let webpack download it dynamically just when it s needed When it s loaded I let the library produce svg by user ID The library works similarly as good hash function so for near values it produces completely different results If you don t trust me you can play with that here When it s generated I am converting the result to base to use it in img src attribute That s it Avatar generated Letting user select an avatarTo let user select an avatar we can simply use input element with file type attribute lt input type file accept image png image jpeg image gif gt But this input is pretty ugly So I am going to hide it and provide my own cool button instead of this Then I can triggerclick on this input to open the system file selection dialog import React createRef from react export const ImageSelect gt const fileRef createRef lt HTMLInputElement gt const onFileInputChange React ChangeEventHandler lt HTMLInputElement gt e gt console log e target files return lt gt lt input type file style display none ref fileRef onChange onFileInputChange accept image png image jpeg image gif gt lt button onClick gt fileRef current click gt Cool Button lt button gt lt gt Like this we can use any event to open the file selection When the user selects some file it is printed to the console Now we would be prepared to upload the file to backend But that would be lame Let s also crop the image Cropping the imageTo provide a bit more comfort to our users it would be nice to enable them to crop the image before they actually upload it This can be done using cropper js and its React wrapper react cropper import React createRef from react import Cropper ReactCropperElement from react cropper import cropperjs dist cropper css export const ImageCrop gt const cropperRef createRef lt ReactCropperElement gt return lt Cropper src lt the iamge src gt style height width autoCropArea aspectRatio viewMode guides false ref cropperRef gt What does the configuration do autoCropArea selects whole image by defaultaspectRatio makes it so it is squareviewMode makes the image to cover cropper size and disables selecting empty areas by moving out from canvasguides false removes tiny lines which I found unnecessary for croping avatarsSo now it would be nice to get the actual cropped image We can do it this way import React createRef useState from react import Cropper ReactCropperElement from react cropper import cropperjs dist cropper css export const ImageCrop gt const cropperRef createRef lt ReactCropperElement gt const cropped setCropped useState null as string null const onSaveClick gt const imageElement any cropperRef current const cropper any imageElement cropper setCropped cropper getCroppedCanvas toDataURL return lt gt lt Cropper src style height width autoCropArea aspectRatio viewMode guides false ref cropperRef gt lt button onClick onSaveClick gt Crop lt button gt cropped amp amp lt img src cropped alt It s cropped gt lt gt If we would like to get the image for uploading it would be better to usecropper getCroppedCanvas toBlog Which provides a blob which we can use to create a file to upload Depends for what we like to use the result If we would like to upload it blob is what we are looking for To just show the image dataUrl is our choice Cool So now we can also crop the image Now let s combine it all together import React createRef useState from react import App css import Cropper ReactCropperElement from react cropper import cropperjs dist cropper css import roundedCropper css this transforms file to baseconst fileBase file File Promise lt string gt gt return new Promise lt string gt resolve reject gt const reader new FileReader reader readAsDataURL file reader onload gt resolve reader result toString reader onerror error gt reject error const App gt ref of the file input const fileRef createRef lt HTMLInputElement gt the selected image const uploaded setUploaded useState null as string null the resulting cropped image const cropped setCropped useState null as string null the reference of cropper element const cropperRef createRef lt ReactCropperElement gt const onFileInputChange React ChangeEventHandler lt HTMLInputElement gt e gt const file e target files if file fileBase file then base gt setUploaded base const onCrop gt const imageElement any cropperRef current const cropper any imageElement cropper setCropped cropper getCroppedCanvas toDataURL return lt gt lt div className App gt uploaded lt div gt lt Cropper src uploaded style height width autoCropArea aspectRatio viewMode guides false ref cropperRef gt lt button onClick onCrop gt Crop lt button gt cropped amp amp lt img src cropped alt Cropped gt lt div gt lt gt lt input type file style display none ref fileRef onChange onFileInputChange accept image png image jpeg image gif gt lt button onClick gt fileRef current click gt Upload something lt button gt lt gt lt div gt lt gt export default App When user selects an image the cropper component is rendered When user hits the crop button the resulting cropped image is shown That s all Easy peasy Making the selection roundedIf you would like to use the avatars rounded you would probably like to make also the selection rounded To do so we have to style the cropper elements cropper crop box cropper view box border radius TL DRIn this article I explained how to generate default avatar using jdenticon library and how to select an image file and also how to enable user to crop it using react croper library Tolgee is an open source solution for software localization in Translate your applications and save up to of time needed for localization Tolgee io |
2022-02-07 09:02:24 |
海外TECH |
Engadget |
Google hit with $2.4 billion lawsuit in Europe for favoring its own shopping service |
https://www.engadget.com/google-hit-with-2-4-billion-lawsuit-in-europe-for-favoring-its-own-shopping-service-092136746.html?src=rss
|
Google hit with billion lawsuit in Europe for favoring its own shopping serviceSweden based price comparison service PriceRunner has announced that it s suing Google for € billion billion after a European court ruled that Google breached EU antitrust laws Last November the European Union s General Court upheld a decision to fine Google a record € billion US billion for favoring its own comparison shopping services over rivals nbsp quot We are seeking compensation for the damage Google has caused us during many years but are also seeing this lawsuit as a fight for consumers who have suffered tremendously from Google s infringement of the competition law for the past fourteen years and still today quot said PriceRunner CEO Mikael Lindahl nbsp PriceRunner claimed that Google has a quot monopoly like position quot in Europe adding that it believes it has still not complied with the EU Commission s decision and is quot abusing it s dominant position quot As such it claimed that traffic and profits are diverted from itself and other shopping services and that its offers are higher than other services harming consumers quot Since the violation is still ongoing the amount of damages increases every day we expect the final damages amount of the lawsuit to be significantly higher quot it wrote Google lost its first appeal against the EU fine but it launched another one last month saying quot we feel there are areas that require legal clarification from the European Court of Justice quot Engadget has reached out to Google for comment on the PriceRunner lawsuit nbsp |
2022-02-07 09:21:36 |
医療系 |
医療介護 CBnews |
パルスオキシメーターの一般向け広告解禁-販売業者への監視指導強化も、厚労省 |
https://www.cbnews.jp/news/entry/20220207172705
|
医薬品医療機器等法 |
2022-02-07 18:30:00 |
金融 |
金融庁ホームページ |
入札公告等を更新しました。 |
https://www.fsa.go.jp/choutatu/choutatu_j/nyusatu_menu.html
|
公告 |
2022-02-07 10:00:00 |
金融 |
金融庁ホームページ |
鈴木財務大臣兼内閣府特命担当大臣閣議後記者会見の概要(令和4年1月28日)を公表しました。 |
https://www.fsa.go.jp/common/conference/minister/2022a/20220128-1.html
|
内閣府特命担当大臣 |
2022-02-07 10:00:00 |
金融 |
ニッセイ基礎研究所 |
インドネシア経済:21年10-12月期の成長率は前年同期比+5.02%~成長率は3期連続のプラス成長、内外需ともに拡大 |
https://www.nli-research.co.jp/topics_detail1/id=70158?site=nli
|
インドネシア経済年月期の成長率は前年同期比成長率は期連続のプラス成長、内外需ともに拡大インドネシアの年月期の実質GDP成長率は前年同期比原系列増前期同増と上昇し、市場予想同を小幅に上回る結果となった。 |
2022-02-07 18:33:44 |
ニュース |
BBC News - Home |
Covid: Plan to tackle England's NHS backlog delayed |
https://www.bbc.co.uk/news/uk-60283636?at_medium=RSS&at_campaign=KARANGA
|
backlog |
2022-02-07 09:04:45 |
ニュース |
BBC News - Home |
No 10 set for more changes as PM seeks to calm MPs |
https://www.bbc.co.uk/news/uk-politics-60283635?at_medium=RSS&at_campaign=KARANGA
|
initial |
2022-02-07 09:03:54 |
ニュース |
BBC News - Home |
Attacks on Boris Johnson's wife are sexist, says Sajid Javid |
https://www.bbc.co.uk/news/uk-politics-60286215?at_medium=RSS&at_campaign=KARANGA
|
argues |
2022-02-07 09:25:39 |
ニュース |
BBC News - Home |
Peng Shuai: Weibo post sparked 'huge misunderstanding' |
https://www.bbc.co.uk/news/world-asia-china-60284261?at_medium=RSS&at_campaign=KARANGA
|
media |
2022-02-07 09:49:31 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
アルテ サロン ホールディングス、株主優待を廃止! MBO成立後は上場廃止になる見通しで、プレミアム優 待倶楽部の株主優待は2021年12月末の実施で終了に - 株主優待【新設・変更・廃止】最新ニュース |
https://diamond.jp/articles/-/295617
|
|
2022-02-07 18:15:00 |
北海道 |
北海道新聞 |
廃棄予定の酒かす、ハンドクリームに 倶知安農高生、商品化に挑戦 |
https://www.hokkaido-np.co.jp/article/642921/
|
倶知安町 |
2022-02-07 18:11:00 |
北海道 |
北海道新聞 |
静岡県、盛り土業者に復旧命令 刑事告発も視野 |
https://www.hokkaido-np.co.jp/article/642920/
|
刑事告発 |
2022-02-07 18:05:00 |
北海道 |
北海道新聞 |
道産日本酒、仏品評会で初受賞 中仏10数社が商談に関心 輸出拡大で成果 |
https://www.hokkaido-np.co.jp/article/642919/
|
関心 |
2022-02-07 18:02:00 |
仮想通貨 |
BITPRESS(ビットプレス) |
[日経] 北朝鮮、仮想通貨50億円以上盗む 安保理パネル指摘 |
https://bitpress.jp/count2/3_9_13048
|
日経 |
2022-02-07 18:39:27 |
IT |
週刊アスキー |
2月アップデートと新登場武将などの情報を公開!“『三國志 覇道』公式生放送 #ハドウへの道! 第12回”が放送決定 |
https://weekly.ascii.jp/elem/000/004/082/4082785/
|
戦略シミュレーションゲーム |
2022-02-07 18:50:00 |
IT |
週刊アスキー |
日本の魅力が詰まった動画を募集、「クールジャパン動画コンテスト2021」 |
https://weekly.ascii.jp/elem/000/004/082/4082775/
|
取り組み |
2022-02-07 18:30:00 |
IT |
週刊アスキー |
ウイングアーク1stの文書活用ソリューション「SPA Cloud」がソニー銀行に導入 |
https://weekly.ascii.jp/elem/000/004/082/4082776/
|
spacloud |
2022-02-07 18:30:00 |
IT |
週刊アスキー |
オープンワールドRPG『原神』にて、新★5「八重神子(やえみこ)」(CV:佐倉綾音さん)などの新情報を公開! |
https://weekly.ascii.jp/elem/000/004/082/4082780/
|
mihoyo |
2022-02-07 18:25:00 |
マーケティング |
AdverTimes |
今注目の「リスキリング」!浸透にはロードマップの見える化が肝 |
https://www.advertimes.com/20220207/article376316/
|
人材戦略 |
2022-02-07 09:23:25 |
コメント
コメントを投稿