海外TECH |
DEV Community |
Listening to payments (real-time) on your Stellar wallet |
https://dev.to/clickpesa/listening-to-payments-real-time-on-your-stellar-wallet-1p0n
|
Listening to payments real time on your Stellar wallet Listening to payments real time on your Stellar walletStellar is an open source decentralized protocol for digital currency to fiat money low cost transfers which allows cross border payments between any pair of currencies A Stellar wallet is a digital wallet used to hold lumens amp other assets as a digital currency It consits of a public key and a secret key which in combination can work as an address to recieve and send funds from Why do we want to get notified of the latest payments incoming to our walletLets say you have a service whereby you are utilizing stellar as one of your payment options Inorder to confirm the status of a transfer you need to continously check the whether you have recieved your funds via Horizon We need to find a way to get notified of incoming payments Solution Periodically retrieve an account s payments using an API request By using the following GET request a user is able to retrieve payments related to the account id public key Using a curl request curl account id gt payments limit The above curl request gets the latest payments on specified account id An example response is links self href ulimit uorder desc next href ulimit uorder desc prev href ulimit uorder asc embedded records links self href transaction href effects href succeeds href ucursor precedes href ucursor id paging token transaction successful true source account GCNLIJTHHXHLNIGYDJIQLTBAQLSVPNZAPXKNAVHUWOTE type payment type i created at T Z transaction hash bdcbfaabffefdedbfcbdececff asset type credit alphanum asset code USD asset issuer GDUKMGUGDZQKYHYAZAYGXDSZPSZSWUNARVMOQSRDWPYLEX from GCNLIJTHHXHLNIGYDJIQLTBAQLSVPNZAPXKNAVHUWOTE to GASWJWFRYEKCMGANZMMRBKNPXTHMPDQSEXZNZPWYXVVYBFRTE amount links self href transaction href effects href succeeds href ucursor precedes href ucursor id paging token transaction successful true source account GDVKECLSZLKRVHZTWVASIWLPAPVADFFUZKGIVOTKGMKGJT type payment type i created at T Z transaction hash cddeeeacdcefefdffbab asset type native from GDVKECLSZLKRVHZTWVASIWLPAPVADFFUZKGIVOTKGMKGJT to GCNLIJTHHXHLNIGYDJIQLTBAQLSVPNZAPXKNAVHUWOTE amount links self href transaction href effects href succeeds href ucursor precedes href ucursor id paging token transaction successful true source account GDVKECLSZLKRVHZTWVASIWLPAPVADFFUZKGIVOTKGMKGJT type payment type i created at T Z transaction hash cdceeddcfabfbdbfdbeb asset type native from GDVKECLSZLKRVHZTWVASIWLPAPVADFFUZKGIVOTKGMKGJT to GCNLIJTHHXHLNIGYDJIQLTBAQLSVPNZAPXKNAVHUWOTE amount Disadvantages of this approach are The load on servers will increase exponentially as the number of users and transactions increase in the system This means for each user in your system there must be a job to fetch the latest transactions after every defined duration of time You also run a risk of overloading the stellar netowrk with multiple requests Solution As the heading of the article suggests the second solution involves listening to transactions as they happen To make this happen we utilize the Stellar SDK which provides an event stream that can be subscribed to inorder to recieve latest payment information regarding the users account The following is how this solution can be imoplemented First we install the required stellar sdk dependency into our project by using the follwoing command yarn add stellar sdkSecondly we import the stellar sdk using the require keyword Thereafter we initialize the server sdk using the horizon url before using it var StellarSdk require stellar sdk var server new StellarSdk Server server payments forAccount lt account id gt call then function resp console log resp catch function err console error err Example result s coming from the event stream are as follows links self href transaction href effects href succeeds href ucursor precedes href ucursor id paging token transaction successful true source account GDVKECLSZLKRVHZTWVASIWLPAPVADFFUZKGIVOTKGMKGJT type payment type i created at T Z transaction hash cdceeddcfabfbdbfdbeb asset type native from GDVKECLSZLKRVHZTWVASIWLPAPVADFFUZKGIVOTKGMKGJT to GCNLIJTHHXHLNIGYDJIQLTBAQLSVPNZAPXKNAVHUWOTE amount Advantages of this approach Scalable amp Robust It does not require additional resources if when your transaction activity grows over time Get status of payments as they happen in real time using the memo supplied in conjuction with the business process implemented Additional resourcesStellar Documentation |
2022-05-05 09:30:44 |
海外TECH |
DEV Community |
Why You Should Ditch Create-React-App for Vite |
https://dev.to/israelmitolu/why-you-should-ditch-create-react-app-for-vite-57kj
|
Why You Should Ditch Create React App for ViteCreate React App CRA has long been the go to tool for many developers of all skill levels when it comes to constructing a React app beginners intermediate and even experts It does however have some significant drawbacks which are speed and performance It is well known that CRA can be somewhat slow while building a project and setting up a development server requiring around minutes depending on factors like hard disks and internet connectivity issues Time typically adds up which is why I m going to introduce you to a tool called Vite Vite is a build tool similar to Webpack CRA uses Webpack beneath the hood More information is available here In this article I ll walk you through the process of building a React App with Vite You will learn the differences between CRA and Vite as well as some of its features and benefits and also how to create a React App with Vite What is Vite Vite pronounced vit like veet is the next generation in frontend tooling It focuses on speed and performance by improving the development experience for modern web projects Vite is created by Evan You who is the creator of Vue js but it s not a Vue only tool It can be used for React Preact Svelte Vue Vanilla JS and LitElements It consists of two major parts A dev server which provides support for Hot Module Replacement HMR for updating modules during the execution of the application When changes are made to the source code of an application only the changes are updated rather than the entire application This feature helps speed up development time A build command that bundles your code with Rollup pre configured to output highly optimised static assets for production How does Vite work At its core Vite does thingsServe your code locally during development Bundle your Javascript CSS and other assets together for production There are other tools bundlers that do the same thing such as webpack Parcel and Rollup so what makes Vite different The problem with the tools mentioned above is that they have to build everything on every save and if you have a very large application that could take several minutes every time you save even with Hot reloading in some frameworks the update speed gets significantly slower as you add more code and dependencies to the app Vite has taken a different approach to this kind of a reverse approach Vite starts the server right away takes the dependencies that don t change often and pre bundles them using esbuild Esbuild is a Javascript build tool written in Go which pre bundles dependencies times faster than Javascript based bundlers Let s take a look at the illustrations below to get a better understanding of how it works The above diagram represents a traditional bundle based development server where we have an entry point the possible routes and all the modules which are then bundled together and then the development server is ready Vite on the other hand uses route based code splitting to figure out what parts of the code actually need to be loaded and doesn t have to pre bundle everything Vite serves the source code using native ES Module support in modern browsers This lets the browser take the job of bundling in development which consequently makes your code to load instantly no matter how large the app is It also supports Hot Module Replacement for an extremely fast feedback loop during development When building for production Vite uses Rollup under the hood so you don t have to worry about configuring it Why use Vite over CRA You may be asking why you should use Vite now that we ve covered what it is and how it works We ve gone through a few benefits in the previous section so I will just highlight them here PerformancePre bundling with ESbuild makes it to times faster than using any other JS bundler This is because it helps improve page speed and convert CommonJS UMD modules to ESM Hot Module Replacement HMR Vite uses HMR capabilities to keep track of changes in your application without reloading the full page With the HMR API the browser will only load the modified section of the page and still retain the application s state You don t need to manually set these up when you create an app via create vite the selected templates would have these pre configured for you already Native ECMAscript module supportVite supports ES modules natively It allows you to develop for the browser with bare imports like Typescript and it converts them into properly versioned imports on build Rich FeaturesOut of the box support for TypeScript JSX CSS and more Check out other Features here PrerequisitesBefore using Vite you ll need a couple of prerequisites Node js version or higherPackage manager Npm or YarnCompatible browser for developmentThe third requirement is a browser that supports dynamic imports You can check to see if your browser is supported by visiting Most modern browsers are supported with the exceptions being Internet Explorer Opera Mini and the Baidu browsers But if you re on a somewhat recent version of Chrome Edge Safari or Firefox you should be all set Creating a Project with ViteTo create a Vite application open your terminal and navigate to the folder where you want to save the Vite program Then run this command npm init vite latest my react app template reactNote my vite app is the name of the Vite application that we want to create You can change it to whatever name you preferYou ll be prompted to select a framework and a variant template In our case we ll be using React so select React Next run the following commands in the terminalcd my react appnpm installnpm run devMoving on Running the above command will start the development server Then open your browser and enter http localhost You should see a React logo with a counter and a button as shown below ConclusionThere we go We ve looked at what Vite is how it works and some of its features We also learned how to set up applications using Vite For this project the create vite app command was set up in seconds After which I ran npm install to install dependencies which took seconds So all in all the project was set up in seconds Which I m sure you ll agree is way faster than CRA I would love to hear your thoughts in the comments section and if you enjoyed this post or found it insightful kindly share it with your friends and colleagues Also consider subscribing to my blog Till next time thanks for reading and happy coding Before you go here are some community maintained templates to check out |
2022-05-05 09:22:48 |
海外TECH |
DEV Community |
Navigation in PURE React Native |
https://dev.to/silvenleaf/navigation-in-pure-react-native-2ilf
|
Navigation in PURE React NativeLet s learn Navigation in PURE React Native System CHAPTER I Root set upLet s set up our core configurations for react native navigation Step Install react navigation native First of all install the core package of react navigationnpm install react navigation nativeNow what Step Install core utility packagesWe will now install the core two utility packages for react native navigation These are react native screens and react native safe area context If expo install them using expo if not install them using npm npm install react native screens react native safe area contextNow for pure react native apps react native screens package requires one additional configuration step to properly work on Android devices This change is required to avoid crashes related to View state being not persisted consistently across Activity restarts What and How For PURE React Native Edit MainActivity java file which is located in android app src main java Your package name MainActivity java Add the following code to the body of the MainActivity class Override protected void onCreate Bundle savedInstanceState super onCreate null And make sure to add an import statement at the top of this fileimport android os Bundle Step Wrapping our App in NavigationContainerFinally let s wrap our app in NavigationContainerimport React from react import NavigationContainer from react navigation native import HomeScreen from NeiXin screens HomeScreen const App gt return lt NavigationContainer gt lt HomeScreen gt lt NavigationContainer gt export default App CHAPTER II Utility set upLet s learn how to set up drawer and or stack navigator Step Install utility packagesYou need to install react native gesture handler and react native reanimated utility packages It s same for all drawer stack and tab navigators Let s install them If expo install them using expo if not install them using npm npm install react native gesture handler react native reanimatedNow for PURE React Native Apps we need to put this following line at the extreme top of our entry file for me it is App tsx file We have to make sure it s at the top and there s nothing else before itimport react native gesture handler Great we finished the utility set up Let s now install the core packages depending on our Navigators Step Reanimated configurationFor PURE React Native app you might get an error related to Reanimated For this we need to configure it properly How Let s tag along for more info check this one out reanimated configuration Part In babel config js add this NOTE Reanimated plugin has to be listed last module exports presets plugins react native reanimated plugin make sure this is always the last line Part Turn on Hermes engineTurn on Hermes engine by editing android app build gradle project ext react enableHermes true lt here clean and rebuild if changing Part Update MainApplication javaUpdate the android app main java Your package name MainApplication java import com facebook react bridge JSIModulePackage lt add import com swmansion reanimated ReanimatedJSIModulePackage lt add private final ReactNativeHost mReactNativeHost new ReactNativeHost this Override find these four lines these already exist we need to add the next lines after these four lines protected String getJSMainModuleName return index Override add these four lines after the above four lines protected JSIModulePackage getJSIModulePackage return new ReanimatedJSIModulePackage You can refer to this diff that presents the set of the above changes made to a fresh React Native project Part Try runningTry running your app if still get the error remove the cache using this commandnpx react native start reset cacheIt ll restart your app removing the cache Now optionally you can stop it and restart your app with this commandnpm run androidHope it helps CHAPTER III Specific NavigatorsLet s learn how to use Drawer Stack and Tab navigators We ll install our specific navigators with this command If Drawer Navigation npm install react navigation drawer If Stack Navigation I prefer this because it is said to be significantly more customizablenpm install react navigation stack OR I don t prefer it much because it is said to be inpractible to impossible to customize a lot of thingsnpm install react navigation native stack If Bottom Tab Navigation npm install react navigation bottom tabs Drawer Navigationconst Drawer createDrawerNavigator function RootDrawer return lt Drawer Navigator gt lt Drawer Screen name Home Page component HomeScreen gt lt Drawer Screen name About Page component AboutScreen gt lt Drawer Navigator gt Stack Navigationconst Stack createStackNavigator function RootStack return lt Stack Navigator gt lt Stack Screen name Home Page component HomeScreen gt lt Stack Screen name About Page component AboutScreen gt lt Stack Navigator gt Bottom Tabs Navigationconst Tab createBottomTabNavigator function RootBottomTab return lt Tab Navigator gt lt Tab Screen name Home Page component HomeScreen gt lt Tab Screen name About Page component AboutScreen gt lt Tab Navigator gt NEXT blog is coming by May th What s NEXT Async Storage with Pure React Native Project with Pure React Native More on App Development How to generate apk with pure React Native How to deploy to playstore Insane stuff with JavaScript TypeScript Writing Automated Tests for any Server How to create an Android APP with NO XP with Expo including apk generating Got any doubt Drop a comment or Feel free to reach out to me SilveLEAF on Twitter or LinkedinWanna know more about me Come here SilvenLEAF github io |
2022-05-05 09:15:31 |
海外TECH |
DEV Community |
operators__c++ |
https://dev.to/narmuratova/operatorsc-2ccd
|
operators c Binaryoperator deb ta obyekt qabul qiluvchi operatorlarga aytiladi Masalan operatori ikkita obyekt ustida ishlatiladi a b Unaryoperator deb ta obyekt qabul qiluvchi operatorlarga aytiladi Masalan operatori ta obyekt ustida ishlatiladi trueModulusA B is to calculate the remainder of A B Only integer type Relational operatorrelationship between left and right sidesresult is always either True or False operators lt lt gt gt Arifmetik operatorlar amalini bajarayotganda ma lumotni turi muhim bo lib kasr son kasr songa butun son butun songa bo linayotganini bilish kerak yo qsa misolni javobida o zgarish bo ladi modulus faqat butun sonlar ustida amallarni bajaradi amallar matematika bn bir xildek ketma ketlikda bajariladi |
2022-05-05 09:02:25 |
海外TECH |
Engadget |
Intuit owes customers $141 million after it 'cheated' them out of free tax services |
https://www.engadget.com/intuit-owes-consumers-141-million-after-it-cheated-them-out-of-free-tax-services-090115518.html?src=rss
|
Intuit owes customers million after it x cheated x them out of free tax servicesTurboTax maker Intuit will pay million quot for deceiving millions of low income Americans into paying for tax services that should have been free quot the NY Attorney General s office wrote in a press release It must also suspend its quot free free free quot ad campaign for TurboTax that baited customers with the promise of free tax preparation then switched them into a paying service The company agreed to a settlement with all US states and the District of Columbia Ars Technica reported The company must refund nearly million consumers who used TurboTax s Free Edition between and then discovered they had to pay to file Many didn t realize they had the option of of filing for free using the IRS Free File program available via a separate product nbsp quot Intuit cheated millions of low income Americans out of free tax filing services they were entitled to quot said Attorney General Letitia James quot For years Intuit misled the most vulnerable among us to make a profit Today every state in the nation is holding Intuit accountable for scamming millions of taxpayers quot For years Intuit misled the most vulnerable among us to make a profit Today every state in the nation is holding Intuit accountable for scamming millions of taxpayers A multistate investigation found that quot Intuit engaged in several deceptive and unfair trade practices that limited consumers participation in the IRS Free File Program quot the New York AG wrote Specifically Intuit used similar names for both its IRS Free File product and commercial freemium TurboTax product and used search engine ads to steer customers looking for the former to the latter It also quot purposefully blocked its IRS Free File landing page from search engine results during the tax filing season quot the NY AG wrote nbsp The AG office said that it marketed the freemium product through ad campaigns quot where free is the most prominent or sometimes the only selling point however the TurboTax freemium product is only free for approximately one third of US taxpayers quot nbsp Intuit released a statement expressing no regret and said the required ad changes would have little impact on its business quot As part of the agreement Intuit admitted no wrongdoing agreed to pay million to put this matter behind it and made certain commitments regarding its advertising practices quot the company wrote on its blog As part of the agreement Intuit admitted no wrongdoing agreed to pay million to put this matter behind it and made certain commitments regarding its advertising practices Intuit dropped out of the the IRS s Free File Alliance last year saying an exit would help it focus on quot further innovating quot without being encumbered by Free File program rules Eighteen months prior the IRS introduced new Free File rules that prohibit members from quot engaging in any practice quot that would prevent their free software from showing up on Google or any other search engine They were also required to call their apps quot IRS Free File program delivered by product name quot Senator Elizabeth Warren once called the Free File Alliance quot a front for tax prep companies who use it as a gateway to sell expensive products no one would even need if we d just made it easier for people to pay their taxes quot Other countries including the UK and Japan allow return free filing for many citizens but Intuit H amp R Block and other companies have lobbied against such a move in the US nbsp The payouts amounting to about per person for each tax year are supposed to take place within days of the signing of the agreement After that the Attorneys General of each state will quot have sole discretion concerning the administration and distribution of the Settlement Fund quot nbsp |
2022-05-05 09:01:15 |
海外ニュース |
Japan Times latest articles |
Japan says it needs nuclear power. Can host towns ever trust it again? |
https://www.japantimes.co.jp/news/2022/05/05/national/nuclear-power-plant-restart-distrust/
|
Japan says it needs nuclear power Can host towns ever trust it again The decision to restart plants is fraught with emotions not to mention the gargantuan technical task of fortifying the stations against future disasters in an |
2022-05-05 18:30:32 |
ニュース |
BBC News - Home |
Virgin Atlantic flight returns to Heathrow after pilot roster error |
https://www.bbc.co.uk/news/uk-england-london-61332456?at_medium=RSS&at_campaign=KARANGA
|
atlantic |
2022-05-05 09:31:02 |
ニュース |
BBC News - Home |
Sports Direct: New boss Michael Murray warns of price rises |
https://www.bbc.co.uk/news/business-61319871?at_medium=RSS&at_campaign=KARANGA
|
retailer |
2022-05-05 09:54:52 |
ニュース |
BBC News - Home |
Boba Fett actor's Star Wars gear sells for £155,000 |
https://www.bbc.co.uk/news/uk-england-wiltshire-61325723?at_medium=RSS&at_campaign=KARANGA
|
reels |
2022-05-05 09:08:16 |
ニュース |
BBC News - Home |
Ruth Dodsworth not letting coercive control 'define life' |
https://www.bbc.co.uk/news/uk-wales-61332031?at_medium=RSS&at_campaign=KARANGA
|
programme |
2022-05-05 09:35:32 |
ニュース |
BBC News - Home |
Andy Murray withdraws from match against Novak Djokovic because of illness |
https://www.bbc.co.uk/sport/tennis/61333021?at_medium=RSS&at_campaign=KARANGA
|
djokovic |
2022-05-05 09:35:00 |
ニュース |
BBC News - Home |
Ukraine war in maps: Tracking the Russian invasion |
https://www.bbc.co.uk/news/world-europe-60506682?at_medium=RSS&at_campaign=KARANGA
|
ukrainian |
2022-05-05 09:32:59 |
北海道 |
北海道新聞 |
マリウポリ製鉄所で激戦 ロシア、3日間停戦と発表 |
https://www.hokkaido-np.co.jp/article/677351/
|
製鉄所 |
2022-05-05 18:17:02 |
北海道 |
北海道新聞 |
GW終盤、上りピーク 新幹線で一部混雑、渋滞も |
https://www.hokkaido-np.co.jp/article/677356/
|
新型コロナウイルス |
2022-05-05 18:20:02 |
北海道 |
北海道新聞 |
神3―2ヤ(5日) 阪神が今季初サヨナラ勝利 |
https://www.hokkaido-np.co.jp/article/677357/
|
阻止 |
2022-05-05 18:17:00 |
北海道 |
北海道新聞 |
東京で2320人感染 新型コロナ、4人死亡 |
https://www.hokkaido-np.co.jp/article/677353/
|
新型コロナウイルス |
2022-05-05 18:01:39 |
北海道 |
北海道新聞 |
JR苗穂駅構内、架線にビニール 普通列車6本運休 |
https://www.hokkaido-np.co.jp/article/677295/
|
普通列車 |
2022-05-05 18:03:15 |
ビジネス |
東洋経済オンライン |
プロに聞いた「お父さん」の受験への関わり方 品川女子学院の理事長が語る「今の子育て」 | Domani | 東洋経済オンライン |
https://toyokeizai.net/articles/-/584952?utm_source=rss&utm_medium=http&utm_campaign=link_back
|
domani |
2022-05-05 18:30:00 |
海外TECH |
reddit |
Mask wearing in Japan |
https://www.reddit.com/r/japan/comments/uitgo2/mask_wearing_in_japan/
|
Mask wearing in JapanSo I get that masks can held prevent the spread of COVID but now it s getting ridiculous I see people walking on their own in the middle of nowhere wearing a mask or on the beach or any place where social distance is possible I agree that wearing a mask in a shop or in a place where there are lots of people around is a good idea but now it s become like you can t leave the house without wearing a mask My worry is that wearing masks will become the norm in Japan for the foreseeable future mainly because of the social pressure to wear one Even though in some cases they are not necessary submitted by u Competitive Stress to r japan link comments |
2022-05-05 09:16:28 |
コメント
コメントを投稿