IT |
気になる、記になる… |
Apple、「macOS Catalina」ユーザーに「macOS 12.3 Beta」をインストールするとブートループが発生する可能性があることを警告 |
https://taisy0.com/2022/01/30/151401.html
|
macosbigs |
2022-01-30 01:28:23 |
IT |
気になる、記になる… |
Apple、「Apple Watch」のチャレンジ企画「旧正月 チャレンジ2022」を2月1日〜15日に開催へ |
https://taisy0.com/2022/01/30/151393.html
|
apple |
2022-01-30 01:03:49 |
IT |
ITmedia 総合記事一覧 |
[ITmedia News] 「プリキュア」見放題へ Amazonプライム、Netflixなどで見逃し配信 |
https://www.itmedia.co.jp/news/articles/2201/30/news030.html
|
itmedia |
2022-01-30 10:02:00 |
AWS |
lambdaタグが付けられた新着投稿 - Qiita |
Lambda Layersで自作モジュールを共通ライブラリ化する [Python,Node.js] |
https://qiita.com/holdout0521/items/58a968cc940051bd2fbd
|
そのため、指定されたディレクトリ下記の表参照にPythonモジュールを格納してアップロードすることでLambdaを実行した際にモジュールとして自動的に読み込むことができます。 |
2022-01-30 10:58:30 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
Lambda Layersで自作モジュールを共通ライブラリ化する [Python,Node.js] |
https://qiita.com/holdout0521/items/58a968cc940051bd2fbd
|
そのため、指定されたディレクトリ下記の表参照にPythonモジュールを格納してアップロードすることでLambdaを実行した際にモジュールとして自動的に読み込むことができます。 |
2022-01-30 10:58:30 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
【手順】MacにPythonインストール(pyenv経由) |
https://qiita.com/yuthi01020104/items/74806cb4ee7116061132
|
ターミナルpyenvversions使用するPythonのバージョンを指定ターミナルpyenvglobalXXX下記コマンドでPythonのバージョンを確認してインストールしたバージョンと一致しているか突合して、問題なければPythonのインストール完了です。 |
2022-01-30 10:54:31 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
Go のような日時フォーマットを Ruby で使えるようにする gem「GoTime」 |
https://qiita.com/nodai2h_ITC/items/a2e9c031ec44ee8617d2
|
Goのような日時フォーマットをRubyで使えるようにするgem「GoTime」Rubyistの皆さま、日々Timestrftime使ってますかRailsプログラマの場合直接Timestrftimeを使う機会は少ないと思いますが、設定ファイル上などでstrftime用のフォーマット文字列を書いたことがあるのではないかと思います。 |
2022-01-30 10:50:54 |
Linux |
Ubuntuタグが付けられた新着投稿 - Qiita |
Splunk本出版のお知らせ - 「本気でUnix/Linuxマシンを監視する方法: Splunk + Splunk Unix and Linux Add-on編」 |
https://qiita.com/ChrisForrest/items/48d9835c62645469fa15
|
AmazonKindleUnlimited未契約の方は、誠に恐れ入りますが、「SplunkEnterpriseの始め方、SplunkCloudへの引っ越しLinux編」を先にご購入amp学習の上、本書のご購入を強くオススメいたします。 |
2022-01-30 10:21:26 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
Lambda Layersで自作モジュールを共通ライブラリ化する [Python,Node.js] |
https://qiita.com/holdout0521/items/58a968cc940051bd2fbd
|
そのため、指定されたディレクトリ下記の表参照にPythonモジュールを格納してアップロードすることでLambdaを実行した際にモジュールとして自動的に読み込むことができます。 |
2022-01-30 10:58:30 |
golang |
Goタグが付けられた新着投稿 - Qiita |
Go のような日時フォーマットを Ruby で使えるようにする gem「GoTime」 |
https://qiita.com/nodai2h_ITC/items/a2e9c031ec44ee8617d2
|
Goのような日時フォーマットをRubyで使えるようにするgem「GoTime」Rubyistの皆さま、日々Timestrftime使ってますかRailsプログラマの場合直接Timestrftimeを使う機会は少ないと思いますが、設定ファイル上などでstrftime用のフォーマット文字列を書いたことがあるのではないかと思います。 |
2022-01-30 10:50:54 |
海外TECH |
DEV Community |
Please don't use Bootstrap! |
https://dev.to/manuthecoder/please-dont-use-bootstrap-3k4i
|
Please don x t use Bootstrap In case you don t know what bootstrap is bootstrap is a CSS framework Here s why you should not use Bootstrap All sites look alike When you start to see the same layout over and over and over again users begin to tune out You ve lost me Your design looks like one of other sites out there And not just the same general layout but the Exact Same Components Let s be honest a great many of us are tired of seeing the same old Twitter Bootstrap theme again and again Black header giant hero rounded blue buttons Helvetica Neue Yes you can customize the header to be a different color maybe re color some of the buttons use a different font Ultimately however that doesn t change anythingーit still looks like Bootstrap The files are h u g e Bootstrap will help you to build an attractive responsive website but some mobile users could be turned away by the slow loading time and battery drain issues Bootstrap comes with a lot of lines of CSS and JS which is a good thing but also a bad thing because of the bad internet connection And there s also the problem with the server that will take all the heat for using such a heavy framework Even when bootstrap is minified it takes a lot of space Alternatives TailwindCSS is much better There is no faster framework than Tailwind when it comes to styling HTML As a result you can easily create good looking layouts by styling elements directly This is possible because Tailwind offers thousands of built in classes that do not require you to create designs from scratch |
2022-01-30 01:32:23 |
海外TECH |
DEV Community |
How to use Web3-react to develop DApp |
https://dev.to/yakult/how-to-use-web3-react-to-develop-dapp-1cgn
|
How to use Web react to develop DAppWeb react is a popular library used in blockchain DApp and web development It has more than stars and has been used by more than repo s on Github Note If you have known web react you can go directly to section for how to guides Last Updated What is web react Before starting the journey I will give an overview of the stack and technology we use Front end React Next js Chakra UI TypeScriptBlockchain API Ethers jsDevelopment Environment Hardat MetaMask Ethereum testnetweb react is a react ethers js framework for building modern Ethereum DApp developed by Uniswap Engineering Lead Noah Zinsmeister It works between Front end and blockchain API At a high level web react is a state machine which ensures that certain key pieces of data the user s current account for example relevant to your dApp are kept up to date To this end web react uses Context to efficiently store this data and inject it wherever you need it in your application via web react v docs It is a react library and the underlying blockchain API is ethers js The stable version is v and currently v is in beta You can find web react repo at As it is widely used I am surprised to find that there are very few documents So far I can only refer to documents source code of web react v and v beta example in the package v and v beta documents for web react v a tutorial on consensys blog by Lorenzo SiciliaThere are some main changes from v to Widely used hooks useWebReact is tagged with comment for backwards compatibility only I can forsee that Version of web react will be widely used as it can meet the increasing demand of web I wrote down this tutorial to help developers to use it both for v and v beta Useful links Source code and documents for web react v source code documents Lorenzo s Web React Tutorial is a great help for this how to guide and I copied the sample code from it Great thanks The tutorial is great as it illustrates the strategy to sync data between blockchain and DApp SWR and Ether js are two nice libraries to work with if you want to streamline your data fetching strategy with Ethereum dapp Set up playground create a Next js projectFirst we start a Next js project to write DAPP using web react Then we add dependencies Follow these steps Create a project yarn create next app playeth typescriptcd playeth Use src as our source code directory mkdir srcmv pages src pagesmv styles src stylesEdit tsconfig json add baseUrl src Clear index tsx Make index tsx simple import type NextPage from next import styles from styles Home module css const Home NextPage gt return lt div gt lt main className styles main gt lt h gt Welcome to playground lt h gt lt main gt lt div gt export default Home Run project and view it at http localhost yarn dev Add dependenciesWe will use ethers js web react and etc here yarn add ethersyarn add web react core web react injected connectorweb react installed is stable version x x If you would like to add only ethers js component used you can replace the first command to yarn add ethersproject providers Connect to blockchain using Web react ethers and MetaMaskThe main difference between DApp web app and traditional web app is that DApp connects to blockchain instead of a centralized server for user login and authorization data about data and functionality such as DeFi NFT Game DAO governance When DApps are used in desktop browsers they are made possible with three things MaskMask wallet on the user sideEthers js between browser server and blockchain endpointReact and Web react on the server browserLet s start to make a DApp with web react We will use its two parts WebReactProvider contextuseWebReact hooksPlease note that there is a big upgrade from v to v useWebReact is tagged with comment for backwards compatibility only Provider in app tsxAdd context provider lt WebReactProvider gt in app tsx import styles globals css import type AppProps from next app import WebReactProvider from web react core import WebProvider from ethersproject providers function getLibrary provider any WebProvider const library new WebProvider provider library pollingInterval return library function MyApp Component pageProps AppProps return lt WebReactProvider getLibrary getLibrary gt lt Component pageProps gt lt WebReactProvider gt export default MyApp Edit index tsxUse useWebReact to connect to blockchain using an injected provider by MetaMask You can call it directly through windows ethereum MetaMask Ethereum Provider API docs is here You need to have MetaMask extension installed in your Chrome browser Edit index tsx to provide a button to connect blockchain using MetaMask wallet and its blockchain provider injected to browser import type NextPage from next import styles from styles Home module css import useEffect from react import useWebReact from web react core import WebProvider from ethersproject providers import InjectedConnector from web react injected connector const ConnectWallet gt const injectedConnector new InjectedConnector supportedChainIds const chainId account activate active library useWebReact lt WebProvider gt const onClick gt activate injectedConnector useEffect gt console log chainId account active return lt div gt lt div gt ChainId chainId lt div gt lt div gt Account account lt div gt active lt div gt lt div gt lt button type button onClick onClick gt Connect Connect lt button gt lt div gt const Home NextPage gt return lt div gt lt main className styles main gt lt h gt Welcome to playground lt h gt lt ConnectWallet gt lt main gt lt div gt export default HomeWhat do we do We add a ConnectWallet Component for display account and connect to wallet Click connect Wallet button activate injectedConnector of useWebReact hook is called When connected display chainId and account Run yarn dev we can play with this simple DApp at http localhost Note If you want to truly disconnect your wallet from this page disconnect from MetaMask Get data from Ethereum Mainnet Read BlockchainIn Section we have established an environment to interact with blockchain In this section we will try to get data from Ethereum Mainnet Query data and display using useState and useEffectMake some changes in index tsx please note this is a quick and dirty code snippet just for illustration const balance setBalance useState useEffect gt library getBalance account then result gt setBalance result e lt div gt Balance balance lt div gt Query data using SWRSWR means Stale While Revalidate Lorenzo s Web React Tutorial suggests using this strategy A quote about SWR SWR first returns the data from cache stale then sends the fetch request revalidate and finally comes with the up to date data again After insatll swr edit index tsximport useSWR from swr const fetcher library gt args gt const method params args console log fetcher method params const result library method params return library method params const BalanceSWR gt const account library useWebReact lt WebProvider gt const data balance useSWR getBalance account latest fetcher fetcher library console log balance if balance return lt div gt lt div gt return lt div gt Balance Ξ balance e lt div gt active amp amp lt BalanceSWR gt Lorenzo s Web React Tutorial explains As you can see it is a partially applied function In that way I can inject the library my WebProvider when I configure the fetcher Later every time a key changes the function can be resolved by returning the required promise Update data in real timeThe pro of using SWR is that it can update data in real time We will follow Lorenzo s Web React tutorial to do this The feature used is SWR s mutate function Listen to Etheruem block number change ethers provider on Use SWR mutate to trigger refreshEdit BalanceSWR component in index tsx const account library useWebReact lt WebProvider gt const data balance mutate useSWR getBalance account latest fetcher fetcher library useEffect gt listen for changes on an Ethereum address console log listening for blocks library on block gt console log update balance mutate undefined true remove listener when the component is unmounted return gt library removeAllListeners block trigger the effect only on component mount Lorenzo s tutorial has more on interacting with smart contract and listening to smart contract events You can continue to read it and do experiments We will go to Web react version to see what has been changed Dive into Web react Version There is an example to demostate how to use it We will take some code snippets from it directly You can find the example at packages example STEP Create an example projectCreate a next js project just like we did in section Edit package json to add dependencies ethersproject bignumber ethersproject experimental ethersproject providers ethersproject units walletconnect ethereum provider web react core beta web react eip beta web react empty beta web react metamask beta web react network beta web react types beta web react url beta web react walletconnect beta web react walletlink beta Run command to install dependencies yarn install STEP AccountsComponentCreate components AccountsComponent tsx based on import type BigNumber from ethersproject bignumber import formatEther from ethersproject units import type WebReactHooks from web react core import useEffect useState from react function useBalances provider ReturnType lt WebReactHooks useProvider gt accounts string BigNumber undefined const balances setBalances useState lt BigNumber undefined gt useEffect gt if provider amp amp accounts length let stale false void Promise all accounts map account gt provider getBalance account then balances gt if stale setBalances balances return gt stale true setBalances undefined provider accounts return balances export function AccountsComponent accounts provider ENSNames accounts ReturnType lt WebReactHooks useAccounts gt provider ReturnType lt WebReactHooks useProvider gt ENSNames ReturnType lt WebReactHooks useENSNames gt const balances useBalances provider accounts if accounts undefined return null return lt div gt Accounts lt b gt accounts length None accounts map account i gt lt ul key account style margin overflow hidden textOverflow ellipsis gt lt li gt ENSNames i account lt li gt lt li gt balances i Ξ formatEther balances i null lt li gt lt ul gt lt b gt lt div gt Some explanations A component to display ENS Address and ether balance of the accountUsing getBalance function of web provider to query ether balance STEP MetaMaskCardCreate components MetaMaskCard tsx MetaMaskCard is based on MetaMaskCard Connect Status component in import type WebReactHooks from web react core import AccountsComponent from AccountsComponent import initializeConnector from web react core import MetaMask from web react metamask const metaMask hooks initializeConnector lt MetaMask gt actions gt new MetaMask actions const useChainId useAccounts useError useIsActivating useIsActive useProvider useENSNames hooksfunction Connect isActivating error isActive chainId ReturnType lt WebReactHooks useChainId gt isActivating ReturnType lt WebReactHooks useIsActivating gt error ReturnType lt WebReactHooks useError gt isActive ReturnType lt WebReactHooks useIsActive gt if error return lt div style display flex flexDirection column gt lt button onClick gt metaMask activate gt Try Again lt button gt lt div gt else if isActive return lt div style display flex flexDirection column gt lt button onClick gt metaMask deactivate gt Disconnect lt button gt lt div gt else return lt div style display flex flexDirection column gt lt button onClick isActivating undefined gt metaMask activate disabled isActivating gt Connect lt button gt lt div gt function Status isActivating error isActive isActivating ReturnType lt WebReactHooks useIsActivating gt error ReturnType lt WebReactHooks useError gt isActive ReturnType lt WebReactHooks useIsActive gt return lt div gt error lt gt error name Error error message error message null lt gt isActivating lt gt Connecting lt gt isActive lt gt Connected lt gt lt gt ️ Disconnected lt gt lt div gt export default function MetaMaskCard const chainId useChainId const accounts useAccounts const error useError const isActivating useIsActivating const isActive useIsActive const provider useProvider const ENSNames useENSNames provider return lt div style border px solid gt lt b gt MetaMask lt b gt lt Status isActivating isActivating error error isActive isActive gt lt AccountsComponent accounts accounts provider provider ENSNames ENSNames gt lt Connect chainId chainId isActivating isActivating error error isActive isActive gt lt div gt Some explanations Three components MetaMaskCard Connect StatusConnect component provide a button user can click to connect MetaMask wallet by calling metaMask activate Status Component display status according to isActivating and isActiveWe get all the needed hooks here const metaMask hooks initializeConnector lt MetaMask gt actions gt new MetaMask actions const useChainId useAccounts useError useIsActivating useIsActive useProvider useENSNames hooks STEP index tsxUsing next js dynamic import to import MetaMaskCard import type NextPage from next import styles from styles Home module css import dynamic from next dynamic const MetaMaskCard dynamic gt import components MetaMaskCard ssr false const Home NextPage gt return lt div gt lt main className styles main gt lt h gt Welcome to playground lt h gt lt MetaMaskCard gt lt main gt lt div gt export default HomeRun command yarn dev and visit the sample app at localhost In sum web react provides a handy tool with context and hooks between react and ethers Enjoy it |
2022-01-30 01:32:12 |
海外ニュース |
Japan Times latest articles |
North Korea ups ante with apparent longer-range missile test |
https://www.japantimes.co.jp/news/2022/01/30/asia-pacific/north-korea-missile-launch-seventh/
|
North Korea ups ante with apparent longer range missile testSunday s launch appeared similar to a May test of a Hwasong intermediate range missile and hit a maximum altitude of around km flying |
2022-01-30 10:46:45 |
海外ニュース |
Japan Times latest articles |
‘Rip It Up’: Enter the kaleidoscopic world of Ko Machida |
https://www.japantimes.co.jp/culture/2022/01/30/books/rip-it-up-ko-machida/
|
Rip It Up Enter the kaleidoscopic world of Ko MachidaDaniel Joseph s translation of the punk rock artist turned author s novella Rip It Up opens the door to a more avant garde experimental kind of Japanese |
2022-01-30 10:00:51 |
ニュース |
BBC News - Home |
Ukraine crisis: What’s at stake for the UK? |
https://www.bbc.co.uk/news/uk-60159622?at_medium=RSS&at_campaign=KARANGA
|
broader |
2022-01-30 01:05:33 |
ニュース |
BBC News - Home |
US East Coast blanketed by 'bombogenesis' snowstorm |
https://www.bbc.co.uk/news/world-us-canada-60177979?at_medium=RSS&at_campaign=KARANGA
|
blizzard |
2022-01-30 01:41:52 |
ニュース |
BBC News - Home |
‘I feel like me again’ - troubled Army vets are helping fix driver shortage |
https://www.bbc.co.uk/news/stories-60140431?at_medium=RSS&at_campaign=KARANGA
|
I feel like me again troubled Army vets are helping fix driver shortageSome UK veterans can face difficulties finding work after returning to civilian life but one ex soldier wants to help them get back in the driving seat |
2022-01-30 01:24:51 |
ニュース |
BBC News - Home |
What happened to the British children born to black GIs? |
https://www.bbc.co.uk/news/uk-england-suffolk-59967242?at_medium=RSS&at_campaign=KARANGA
|
world |
2022-01-30 01:29:36 |
ニュース |
BBC News - Home |
Newcastle's Covid response documented through photography |
https://www.bbc.co.uk/news/uk-england-tyne-60131496?at_medium=RSS&at_campaign=KARANGA
|
response |
2022-01-30 01:27:18 |
LifeHuck |
ライフハッカー[日本版] |
【Amazonタイムセール中!】アルインコの折りたたみサイクルマシンが23%オフ、アイリスのエッグパンが29%オフなど |
https://www.lifehacker.jp/article/amazon-timesale-0130-1/
|
amazon |
2022-01-30 01:30:00 |
北海道 |
北海道新聞 |
札幌の新規感染者1700人前後 2日連続で最多更新 新型コロナ |
https://www.hokkaido-np.co.jp/article/639453/
|
新型コロナウイルス |
2022-01-30 10:11:00 |
北海道 |
北海道新聞 |
JR北海道、快速エアポート25本含む98本運休 降雪や低温で |
https://www.hokkaido-np.co.jp/article/639438/
|
快速エアポート |
2022-01-30 10:14:06 |
北海道 |
北海道新聞 |
【道スポ】コンサ青木、シャビエルと共闘だ! 名古屋時代にあうんの呼吸 |
https://www.hokkaido-np.co.jp/article/639452/
|
北海道コンサドーレ札幌 |
2022-01-30 10:02:00 |
コメント
コメントを投稿