AWS |
AWS Mobile Blog |
Introducing Lambda authorization for AWS AppSync GraphQL APIs |
https://aws.amazon.com/blogs/mobile/appsync-lambda-auth/
|
Introducing Lambda authorization for AWS AppSync GraphQL APIsThis article was written by Brice Pell eacute Principal Specialist Solutions Architect AWS nbsp AWS AppSync is a fully managed service which allows developers to deploy and interact with serverless scalable GraphQL backends on AWS As an application data service AppSync makes it easy to connect applications to multiple data sources using a single API AppSync … |
2021-07-30 18:43:35 |
golang |
Goタグが付けられた新着投稿 - Qiita |
gomockで同一メソッドを複数回呼び出す際のレスポンスを変える |
https://qiita.com/ttksm/items/f8aa41e580c9a544c99d
|
RUNTestRunRuffruffWoofwoofPASSTestRun回目レスポンスを変えるその引数ありアプリケーションコードそのの改修版として鳴き声を外から渡してあげる形式のBarkerBarksoundstringを考えてみます。 |
2021-07-31 03:19:46 |
海外TECH |
Ars Technica |
Evolutionary chaos as butterflies, wasps, and viruses have a three-way war |
https://arstechnica.com/?p=1784237
|
interactions |
2021-07-30 18:39:16 |
海外TECH |
Ars Technica |
Scarlett Johansson sues Disney, says Disney+ release of Black Widow broke contract |
https://arstechnica.com/?p=1784224
|
sales |
2021-07-30 18:20:53 |
海外TECH |
DEV Community |
Streaming Fauna Documents with Python |
https://dev.to/lordghostx/streaming-fauna-documents-with-python-18c3
|
Streaming Fauna Documents with PythonWith Fauna s document streaming feature you can get real time updates about changes made to your database In this tutorial you will learn how to use Fauna s document streaming feature in a Python application Here for the code alone Head over to the implementation section of this article Introduction What is Streaming Streaming refers to when a program continuously reads and fetches data from a given source in real time For example while watching a YouTube video or downloading a file from the internet you stream the data from the origin and process it on your client s device instantaneously Streaming in some ways can arguably be a better alternative to polling Polling refers to when a client periodically makes queries to a data source to get updates It is more expensive than streaming as the client sends many requests only to get a single update or none at all Polling is only aware of changes when the query results return What is Fauna Fauna is a flexible database delivered as a secure data API providing two interfaces GraphQL and the Fauna Query Language FQL It offers functionality to store collections indexes and other databases To learn more about Fauna visit the official documentation NOTE The rest of this article assumes you have a fair understanding of Fauna and Python Check out my introductory tutorial first if you don t Setting up our Fauna database Creating the Fauna databaseWe need to first create the database to use in Fauna s dashboard If you have not created an account on Fauna before now do so here In the dashboard click on the NEW DATABASE button provide a name for the database then press SAVE We will also be ticking the Pre populate option to get demo data that will be used in this article Generate the database security keyThen we need to create a security key to connect the database to the application Go to the Security tab on the Fauna sidebar located on the left side of the screen click the NEW KEY button provide the necessary information and press SAVE Fauna will then present you with your Secret Key Copy the key immediately and store it somewhere easily retrievable because it will only be displayed once Implementing document streaming with PythonFauna features built in support for document streaming Whenever changes in a particular document are streamed all the clients subscribed to it will be notified in real time Initializing our Fauna clientLet s write some code to implement this functionality First we will install the Fauna Python driver importing the required libraries and creating a database client In the terminal type pip install faunadbAfter that create a Python script and save the code below in it from faunadb import query as q from faunadb objects import Ref from faunadb client import FaunaClient client FaunaClient secret FAUNA SECRET KEY Selecting a document to streamNext we will fetch the document from the Fauna database collections that we want to stream doc client query q get q ref q collection customers Creating an OnStart functionWe will start by defining an on start function which will be triggered when a document stream starts def on start event print f started stream at event txn data firstName John lastName Smith telephone client query q update doc ref data data In our on start function we printed out the current timestamp of the transaction emitting the event in microseconds provided by event txn Then the streamed document so Fauna notifies our application in real time Creating an OnVersion functionNext we will define an on version function It will be triggered when there is a change in the streamed document and Fauna has sent a notification to the subscribing application def on version event print f on version event at event txn print f Event action event event action print f Changes made event event diff get data In our on version function we printed out the current timestamp again in microseconds then printed out the event action provided by event event action We then printed out the changes made to the document Creating an OnError functionAfter that we will define an on error function It will be triggered when an error occurs while processing the data in the on version def on error event print f Received error event event In our on error function we printed out the event that triggered the issue along with its error message Starting the document streamingWe will now begin document streaming options fields document diff action stream client stream doc ref options on start on error on version stream start In the code above we defined the fields we want in every event update Then we passed the on start on error and on version functions to the stream object and triggered it with the start method You should get an image like the one below when the entire script executes NOTE You can stop active streams using the stream close method A few things to noteAt the time of writing Fauna s document streaming is still an Early Access feature Hence there are some limitations to using it such as You cannot have more than active stream connections to Fauna from a single client device Document streaming is currently not supported in Node js clients due to an HTTP implementation issue You can only stream Fauna documents It is not possible to stream collections or any schema document Streams can only report events to the fields and values within a document s data field There is currently no support for GraphQL subscriptions ConclusionIn this article we learned about Fauna s document streaming capabilities and how easy it is to integrate Fauna s document streaming into a Python application You can learn more about Fauna document streaming from the official documentation If you have any questions don t hesitate to contact me on Twitter LordGhostX |
2021-07-30 18:44:53 |
海外TECH |
DEV Community |
How create ⚛️ React Swiper Slider - easy tutorial 👨🏫 |
https://dev.to/kerthin/how-create-react-swiper-slider-easy-tutorial-51il
|
How create ️React Swiper Slider easy tutorial IntroductionIn fact today s article is devoted not only to how to make a specific slider which you could see on the preview of this post but also in general how to implement various simple sliders on React without putting much effort The slider that I will give you today as an example is part of my separate project The slider itself is made in the form of many columns each of which is a structure that is divided into countries and inside each column there is information about the artists of these countries Swiper SliderLet s Get Started Swiper jsFirst we need to connect the Swiper js You can follow the link and download it or connect it via npm using the line in the npm i swiper console You can read all the documentation on the official page in the React section Since I was creating a slider in CodePen I connected the link through the settings in the JS section To get the links click on the Settings button then select the JS section We also need to connect Swiper css for the correct rendering of slides You can always change the styles as you like To get the link click on the Settings button then select the CSS section FunctionalityFirst of all we need to create a Slider Class inside which we will specify the characteristics of the slider and also render a container for slides class Slider extends React Component componentDidMount new Swiper this refs slider slidesPerView this props slidePerView slidesPerGroup this props slidesPerGroup loop this props loop freeMode true render return lt div className containerSlider gt lt div className swiper container ref slider gt lt div className swiper wrapper gt this props children lt div gt lt div gt lt div gt componentDidMount slidesPerView Number of slides per view slides visible at the same time on slider s container Personally I specified auto because I wanted the slider to look more natural but if you don t want to bother with the size of the slides you can just specify the number of slides that should fit on the screen at a time slidesPerGroup Set numbers of slides to define and enable group sliding Useful to use with slidesPerView gt The property is necessary so that when you finish turning the slider to the end you would be thrown to the very beginning of the slider so that you do not have to turn back It is necessary for long sliders loop Set to true to enable continuous loop mode freeMode If enabled then slides will not have fixed positions You can stop the slider at any convenient scrolling point render containerSlider You can name this class as you like it is needed in order to set the dimensions of the entire slider swiper container amp swiper wrapper these classes should be left in the form in which they are written They are needed for the slider to work correctly You can find most of the other properties on the official website in the API section Creating SlidesAfter we have created a container for the slider and specified its properties it is necessary to work out the appearance of the slides As I mentioned earlier the slider consists of sections each of which is a country and inside each section there is a brief information about the artists of these countries I decided to make all the slides px in size but you can set a different size for each slide using the pseudo class nth child artists will be represented inside each slide To do this we need to create a function inside which we will work out the DOM structure of the slide You can call it whatever you want I personally called it Сountries function Сountries props return lt div className swiper slide gt lt div className countryTitle gt lt h className countryTitle name gt props countryTitle lt h gt lt div gt lt div className painter gt lt div className painter info gt lt div className painter textWrap gt lt div className painter text gt lt h className painter name gt props name lt h gt lt p className painter years gt props born lt p gt lt div gt lt div gt lt div className painter imgWrap gt lt div className painter img gt lt div className painter imgBg bg props class gt lt div gt lt div gt lt div gt lt div gt lt div gt lt div className painter gt lt div className painter info gt lt div className painter textWrap gt lt div className painter text gt lt h className painter name gt props name lt h gt lt p className painter years gt props born lt p gt lt div gt lt div gt lt div className painter imgWrap gt lt div className painter img gt lt div className painter imgBg bg props class gt lt div gt lt div gt lt div gt lt div gt lt div gt lt div gt Inside the function we have specified special properties with which we can fill in information about our artists ContentNow we just need to fill the slider with content inside which we will add the information we need To do this we need to create a class inside which we need to specify the Slider class using the lt Slider slidePerView auto slidesPerGroup gt lt Slider gt tags class App extends React Component render return lt Slider slidePerView auto slidesPerGroup gt lt Slider gt And inside the Slider tag we must individually insert as many slides as we need We will do this using the Countries class in which we prescribed the DOM structure of the slides Example lt Сountries countryTitle Italy name Titian Vecellio born class titian name Leonardo da Vinci born class vinci gt Here s what it looks like in general class App extends React Component render return lt Slider slidePerView auto slidesPerGroup gt lt Сountries countryTitle Italy name Titian Vecellio born class titian name Leonardo da Vinci born class vinci gt lt Сountries countryTitle France name Louis Michel van Loo born class vanLoo name Eugene Delacroix born class delacroix gt lt Сountries countryTitle Spain name Bartholomew Murillo born class murillo name El Greco born class greco gt lt Сountries countryTitle Belgium name Jan van Eyck born class eyck name Anthony van Dyck born class dyck gt lt Сountries countryTitle Germany name Rafael Mengs born class mengs name Franz Xaver Winterhalter born class winterhalter gt lt Сountries countryTitle Russia name Karl Pavlovich Brullov born class brullov name Viktor Mikhailovich Vasnetsov born class vasnetsov gt lt Сountries countryTitle Netherlands name Pieter Bruegel The Elder born class bruegel name Peter Paul Rubens born class rubens gt lt Slider gt RenderIt remains only to render the App class and everything is ready ReactDOM render lt App gt document getElementById root ResponsiveThe site is adapted for screen resolutions such as media screen and orientation landscape and max height px media screen and orientation landscape and max height px media screen and orientation landscape and max height px media screen and orientation landscape and max height px media screen and max width px media screen and max width px media screen and max width px media screen and max width px media screen and max width px media screen and max width px media screen and max width px media screen and max width px media screen and max width px media screen and max width px and max height px The EndFinally it is worth saying that this is not the most ideal way to create a slider and I agree with you If I were making a similar slider in a real project I would output it through an object and would create significantly more components But I wrote this post in order to just give a simple understanding for beginners how to make such sliders Thank you for giving your precious time to my post See you soon I can advise you to subscribe to my Twitter I also post my work there Goodbye Have a good slide |
2021-07-30 18:43:49 |
海外TECH |
DEV Community |
Is Github Copilot a friend or a foe ?! |
https://dev.to/byteslash/is-github-copilot-a-friend-or-a-foe-255i
|
Is Github Copilot a friend or a foe Hi guys Today I wanted to share with you his experience on the Github Copilot assistant that helps developers We hope you ll like it Let s start I IntroductionOn June Github announced on its blog and on Twitter the release of a revolutionary assistant able to help developers to code faster discover APIs and solve problems Its name Github Copilot Immediately this assistant made a lot of noise in the programming field That s why we decided to create this article to summarize what happened last month and the opinions about this AI II What is GPT and OpenAI CodexGithub Copilot has been developed in collaboration with OpenAI the company founded by Sam Altman and Elon Musk and managed by Ilya Sutskever GPT is an AI developed by this company but it is especially the big brother of GPT another similar AI developed a few years before This AI is based on the technology of the Transformers which uses a mechanism of attention Attention Layer It is composed of billions of parameters which makes it one of the biggest AIs ever created To take advantage of all the capabilities of GPT OpenAI has created alternative versions DALL E GPT F and OpenAI Codex Here the AI has been trained on billions of lines of code from projects available on the internet Github led by Microsoft which has the exclusivity of GPT decided to make OpenAI Codex available via VS Code thus creating one of the most attractive private betas III The positive points of Github CopilotGithub Copilot has many advantages You can write code faster Indeed OpenAI s AI runs on very powerful hardware technologies which allows to predict results quickly Moreover many results are generated just as quickly which allows me to introduce the following point We have access to many results If the first result generated by Copilot is not suitable it is easy to choose another one that may be more relevant The number of results generated can even be changed in the AI settings The AI takes into account the context It can be given feedback to help it find relevant results Moreover it takes into account the previously written code which allows it to adapt to our code It constantly tries to understand our project A funny example the AI even adds its own comments It s magical It allows to discover APIs more easily EZCopilot allows you to generate functions to call APIs it s great if you want to save time but personally I don t recommend to do that if you are still a beginner Don t forget that it s Github Copilot not Github Pilot Copilot is improving day by day As announced by Github when you accept the proposed code it may be sent to Microsoft services for the AI to continue training The results will be more and more relevant IV The negative pointsHowever all is not rosy with this AI There is a legal blur ️The AI is trained on code available on the Internet but the owners may not necessarily agree to this use However the answers of the AI are based on these codes you understand that on some points it s a bit vague The AI can repeat itself Although the AI has a system to avoid repetition it happens that the AI creates two similar functions which can quickly become ugly The AI does not use the latest conventions Indeed Copilot tends to use old practices that nobody uses anymore and that make the code ugly It can even become annoying when using some APIs databases etc Unfortunately Copilot can give the impression to beginners to know how to use it Copilot helps developers to code but beginners shouldn t use it too much indeed they will learn bad manners and will think they know how to code when in reality it s not the case So Copilot is great for senior developers but probably not for beginners V My opinion about Github CopilotAfter using Github Copilot I quickly realized that the AI was great to help the developer but that it was not going to take our work Indeed it needs to be oriented redirected to the solution However I was able to do some repetitive tasks like coding a function to read data and show it quite easily which I liked So you don t have to be afraid of Github Copilot If I had to summarize in one line what Github Copilot is now I would say that it is a form of intelligent StackOverflow a little bit like a little brain that would know all the languages algorithms and that would try to help us by all means VI Some screensI let Copilot code a basic NN here is the NN by Copilot The good point is he even managed to create some functions that he coded separately for me right after I just asked him to code me a class to create Polynomes in addition to defining them I can do elementary operations with them it s rather successful But hey not everything is perfect and sometimes he makes a few little mistakes He didn t respect the order here If you liked my article do not hesitate to share it but also to give me your feedback Adrien |
2021-07-30 18:37:05 |
海外TECH |
DEV Community |
Top Interview Questions for Frontend Developers |
https://dev.to/abhishekraj272/top-interview-questions-for-frontend-developers-3d5j
|
Top Interview Questions for Frontend DevelopersIn the past few days I appeared for many frontend devs interview So in this post I have compiled some of the most common question I was asked Q How would you optimise a slow React website My View We can open the network tab and check if the issue is in frontend or backend If the problem is with frontend we can use a profiler to see where is the issue I think almost every frontend dev has heard about Lighthouse or GTMatrix So the issue with these profiler is that they mostly give information about First Paint Time to Interative etc but suppose there is a table which gets rendered on each state change or a component is taking too long to compute how d you find Here comes React Profiler for our rescue We can see which component took how much time to render then further we can memoize the component functions taking forever to render Read More Q How would you design a loosely coupled React App My Views Don t repeat yourself Whenever you see you have repeated a piece of code try to create another component function and break it into small pieces Try to move API calls on the top components Try to reduce number of props being passed Try to use Higher Order Components whenever possible Divide features in dedicated reducers Last but not least Use side effects manager like Redux Saga to handle side effects The more loosely coupled your application is more scalable it will be Q When to use Redux Thunk amp Redux Saga Note Redux Thunk is only lines of code including function name amp curly braces bytes Redux Saga is around kb My View If you are creating some small scale website then Redux Thunk is you child Redux Saga is like having an extra thread in your web app which can easily handle any side effect all thanks to generator functions Read More Q Two Way Data Binding in React My View React has one way data binding which means data flow is from owner to child only the child can t update the data directly It will need to dispatch some actions call the function required to update the data But in some cases two way data binding might be required So how d you apply way data binding React provides some function to do that too Read More Q Synthetic Events in ReactMy View Many of us have used Synthetic Events in React but very few of us knows about it Quoting React Docs hereYour event handlers will be passed instances of SyntheticEvent a cross browser wrapper around the browser s native event It has the same interface as the browser s native event including stopPropagation and preventDefault except the events work identically across all browsers Read MoreAll the given answers are my own views if you think I might be wrong do comment it down below I am open for discussions Connect Me Linkedin Github Twitter Youtube |
2021-07-30 18:18:40 |
海外TECH |
DEV Community |
Google and Facebook Login on Android with Coroutines |
https://dev.to/brady_aiello/google-and-facebook-login-on-android-with-coroutines-5095
|
Google and Facebook Login on Android with Coroutines IntroI recently started using Google One Tap and Facebook login for some auth work for one of our clients at Touchlab and wanted to make sure I was using the recommended best practices using coroutines and the new Activity Result API This was trickier than I realized because the docs for Google One Tap are out of date and the API for Facebook login is out of date So after figuring it out I wanted to share some code snippets for my future self and I hope you get something useful from it as well Additionally I ve found a use case that Google One Tap does not support and a solution for getting around it so to assure your users have an optimal sign up and sign in experience Let s dive in Google One TapOne Tap is a cool way to sign up or sign in a user to your app pretty seamlessly On sign up you authorize the app to continue and if you ve already authorized the app you can just just choose an account and continue on Sign Up Sign In Google s Sean McQuillan writes a great overview of the benefits of One Tap over the normal Google sign in API here The One Tap docs are pretty complete but they start getting out of date here The demo code oneTapClient beginSignIn signInRequest addOnSuccessListener this result gt try startIntentSenderForResult result pendingIntent intentSender REQ ONE TAP null null catch e IntentSender SendIntentException Log e TAG Couldn t start One Tap UI e localizedMessage addOnFailureListener this e gt No saved credentials found Launch the One Tap sign up flow or do nothing and continue presenting the signed out UI Log d TAG e localizedMessage There are a couple issues here We want to use coroutines so we ll need to wrap the beginSignIn call with suspendCancellableCoroutine That s pretty straightforward The second thing we notice is that the parameter startIntentSenderForResult method is deprecated Instead the new way is to call launch on an instance of ActivityResultLauncher lt IntentSenderRequest gt passing an instance of IntentSenderRequest as a parameter It sounds complicated but it s not bad And the nice part is that by tying the callback to the intent sender itself we don t need to add unique result integers to determine who sent the intent That part will look something like val intentSender ActivityResultLauncher lt IntentSenderRequest gt registerForActivityResult StartIntentSenderForResult activityResult gt val data activityResult data val credential SignInCredential oneTapClient getSignInCredentialFromIntent data Log d Credential credential googleIdToken toString activity lifecycleScope launchWhenStarted loginViewModel loginToOurServerWithGoogle credential googleIdToken toString NOTE It s crucial that you call registerForActivityResult when the Fragment or Activity is created The app will crash if you register your callback any other time We ve registered for the Activity Result so now we need to actually launch the Intent We ll start by calling beginSignIn and adding a success and failure callback oneTapClient beginSignIn signInRequest addOnSuccessListener fragmentActivity result gt try intentSender launch IntentSenderRequest Builder result pendingIntent intentSender build catch e IntentSender SendIntentException Log e SignUp UI Couldn t start One Tap UI e localizedMessage addOnFailureListener fragmentActivity e gt Maybe no Google Accounts found Log d SignUp UI e localizedMessage And to coroutines ify it we ll wrap those callbacks in suspendCancellableCoroutine Also instead of executing our callback right here we ll just resume with the result which we ll use later ExperimentalCoroutinesApisuspend fun beginSignInGoogleOneTap fragmentActivity FragmentActivity oneTapClient SignInClient signInRequest BeginSignInRequest onCancel gt Unit BeginSignInResult suspendCancellableCoroutine continuation gt oneTapClient beginSignIn signInRequest addOnSuccessListener fragmentActivity result gt continuation resume result throwable gt Log e SignUp UI beginSignInGoogleOneTap throwable addOnFailureListener fragmentActivity e gt No Google Accounts found Just continue presenting the signed out UI continuation resumeWithException e addOnCanceledListener Log d SignUp UI beginSignInGoogleOneTap cancelled onCancel continuation cancel The full code isn t much more than that Full gist Classic Google Sign InAs awesome as Google One Tap is there are a few uncovered use cases If the user is not logged in to any account on the Android device it will fail If the user wants to sign up or sign in using an account that is currently not signed in on the Android device it will fail If the user has cancelled the One Tap auth too many times the user will be unable to start the One Tap auth flow for hours To cover these common use cases we can use the classic Google Sign in API as a backup This makes the auth flow more complex but gives the user the most flexibility To get here we ll do the same as before Call registerForActivityResult Launch an IntentAnd then we ll integrate the legacy auth flow as a fallback if any of the use cases listed Call registerForActivityResult fun getLegacyGoogleActivitySignInResultLauncher fragment Fragment fragmentActivity FragmentActivity onIdToken String gt Unit ActivityResultLauncher lt IntentSenderRequest gt fragment registerForActivityResult ActivityResultContracts StartIntentSenderForResult activityResult gt try val token String Identity getSignInClient fragmentActivity getSignInCredentialFromIntent activityResult data googleIdToken if token null onIdToken token Log d TAG getLegacyGoogleActivitySignInResultLauncher token catch e Exception Log e fragment class java toString e toString e Launch an Intent Like One Tap the classic Google Sign In API returns a Task to which we attach callbacks Like before we ll wrap the callbacks with suspendCancellableCoroutine ExperimentalCoroutinesApisuspend fun beginSignInGoogleLegacy fragmentActivity FragmentActivity clientId String PendingIntent suspendCancellableCoroutine continuation gt val request GetSignInIntentRequest GetSignInIntentRequest builder setServerClientId clientId build Identity getSignInClient fragmentActivity getSignInIntent request addOnSuccessListener pendingIntent gt continuation resume pendingIntent throwable gt Log e TAG beginSignInGoogleLegacy throwable addOnFailureListener exception gt Log e TAG beginSignInGoogleLegacy exception continuation resumeWithException exception addOnCanceledListener Log d TAG beginSignInGoogleLegacy cancelled continuation cancel When you receive the PendingIntent you can then use it to launch the Legacy Auth flow fragmentActivity lifecycleScope launchWhenStarted val pendingIntent beginSignInGoogleLegacy fragmentActivity clientId val intentSenderRequest IntentSenderRequest Builder pendingIntent intentSender build googleLegacyResultLauncher launch intentSenderRequest Using the Legacy Google Auth as Backup for One TapSo we can exit the One Tap flow in the following ways Case The user isn t logged in to any account on the deviceIf this is the case One Tap will throw an ApiException in a failureListener if you have one attached with cause Cannot find a matching credential We can also confirm this at any time by grabbing the last token used and checking if it s null GoogleSignIn getLastSignedInAccount activity idToken In this case we ll need to use the Legacy Google Auth API Case One Tap has been cancelled too many times If this happens we won t be able to use One Tap for hours and get an ApiException with cause Caller has been temporarily blacklisted due to too many canceled sign in prompts We can wrap this in a try catch block and seamlessly transition to the legacy Google auth API When developing I ve found it helpful to get around the One Tap ban by wiping the emulator data and cold booting it Case The user cancels One Tap manually This can be done by clicking the Cancel button when it starts loading or by navigating back This can be either because they don t wish to authenticate at all or because they want to authenticate with an account that isn t listed We don t know for sure so we ll fall back to the Legacy Google Auth API in the case they want to authenticate with an account that hasn t been added to their Android device If they don t want to authenticate at all they can cancel this auth flow as well The full example Facebook LoginFacebook auth still uses a callback style approach so we ll need to wrap the calls in suspendCancellableCoroutine as well Unlike Google Auth however the Facebook Auth library has not updated to use registerForActivityResult Instead we ll need to use the deprecated way overriding onActivityResult in our Activity You can follow the ticket here override fun onActivityResult requestCode Int resultCode Int data Intent loginViewModel callbackManager onActivityResult requestCode resultCode data onActivityResult is deprecated but Facebook hasn t added support for the new Activity Contracts API yet super onActivityResult requestCode resultCode data We re keeping the CallbackManager in a shared ViewModel so we can reuse the same one regardless of being in the LoginFragment or the CreateAccountFragment Creating one is straightforward val callbackManager CallbackManager CallbackManager Factory create This all just passes along the result of launching Facebook s auth Activity so we can do something with the result Let s make a coroutines friendly way of getting the LoginResult ExperimentalCoroutinesApisuspend fun getFacebookToken callbackManager CallbackManager LoginResult suspendCancellableCoroutine continuation gt LoginManager getInstance registerCallback callbackManager object FacebookCallback lt LoginResult gt override fun onSuccess loginResult LoginResult continuation resume loginResult override fun onCancel handling cancelled flow probably don t need anything here continuation cancel override fun onError exception FacebookException Facebook authorization error continuation resumeWithException exception And then we can pass the result along ExperimentalCoroutinesApifun FragmentActivity finishFacebookLoginToThirdParty onCredential suspend LoginResult gt Unit this lifecycleScope launchWhenStarted try val loginResult LoginResult getFacebookToken loginViewModel callbackManager onCredential loginResult catch e FacebookException Log e Facebook Error e toString And we can tie it all together with the UI ExperimentalCoroutinesApiprivate fun setupFacebookContinueButton fragmentLoginBinding buttonContinueFacebook setOnClickListener activity let fragmentActivity gt LoginManager getInstance logInWithReadPermissions fragmentActivity listOf email fragmentActivity finishFacebookLoginToThirdParty loginResult gt loginViewModel loginFacebook loginResult accessToken token Full Facebook auth ConclusionTo recap The Legacy Google API covers all use cases but is a bit more obtrusive Google One Tap doesn t cover all use cases but is less obtrusive Use the Legacy Google Auth API as a backup either when the user wants to log in with a different account or when the user isn t signed in to any Google account on the device That s all folks How are you handling auth Are you sticking with Google s Legacy Auth to keep things simple Just having Firebase handle it for you Let us know in the comments This is Brady signing off and signing out |
2021-07-30 18:07:57 |
海外TECH |
Engadget |
US watchdog rejects Blue Origin’s protest of NASA lunar lander contract |
https://www.engadget.com/gao-denies-blue-origin-dynetics-protest-nasa-human-landing-system-181019362.html?src=rss
|
US watchdog rejects Blue Origin s protest of NASA lunar lander contractThe US Government Accountability Office GAO has dismissed protests from Blue Origin and defense contractor Dynetics over NASA s decision to hand out a single billion contract to SpaceX as part of its Human Landing System program On Friday the watchdog said NASA s “evaluation of all three proposals was reasonable and consistent with applicable procurement law regulation and the announcement s terms When Blue Origin first challenged the lunar lander contract in April the company claimed the selection process was “fundamentally unfair because it didn t get a chance to revise its bid To that point NASA could afford to give SpaceX the contract because the company agreed to modify its payment schedule Blue Origin also took issue with the fact that the space agency selected a single contractor for the project when the initial announcement had called for two manufacturers to be involved In reviewing NASA s decision the GAO says the space agency “did not violate procurement law or regulation when it decided to make only one award It notes NASA gave itself the flexibility to hand out a single contract multiple awards or none at all when it first announced the Human Landing System program nbsp What s more the GAO concluded there “was no requirement for NASA to engage in discussions amend or cancel the announcement due to the amount of funding it had available for the project Notably the GAO also points in its press release that its role is not to judge the relative merits of a contract decision Both Blue Origin and Dynetics had argued that NASA chose the most “high risk option available since SpaceX s bid involved its Starship rocket which at that point in the procurement process had yet to land in one piece quot We stand firm in our belief that there were fundamental issues with NASA s decision but the GAO wasn t able to address them due to their limited jurisdiction We ll continue to advocate for two immediate providers as we believe it is the right solution quot a spokesperson for Blue Origin said following the decision quot We ve been encouraged by actions in Congress to add a second provider and appropriate additional resources to NASA s pursuit to return Americans to the Moon We re also very encouraged by Administrator Nelson s comments over the past week that reaffirm NASA s original intent to provide simultaneous competition The Human Landing System program needs to have competition now instead of later ーthat s the best solution for NASA and the best solution for our country The decision comes mere days after Blue Origin founder and former Amazon CEO Jeff Bezos offered to waive billion in payments from NASA in return for a lunar lander contract Following Blue Origin s protest NASA told SpaceX to stop work on the Human Landing System while the GAO sorted out the challenge Today s decision allows the project and the Artemis program more broadly to move forward unless Blue Origin asks the US Court of Federal Claims to examine the case nbsp Update PM ET Added comment from Blue Origin nbsp |
2021-07-30 18:10:19 |
海外科学 |
NYT > Science |
Vaccinated People May Spread the Virus, Though Rarely, C.D.C. Reports |
https://www.nytimes.com/2021/07/30/health/cdc-vaccinated-delta.html
|
Vaccinated People May Spread the Virus Though Rarely C D C ReportsThe agency cited an outbreak in Provincetown Mass in which most of the infected were immunized Unpublished internal documents paint an even more harrowing picture |
2021-07-30 18:08:32 |
金融 |
金融庁ホームページ |
資金決済法に基づく払戻手続実施中の商品券の発行者等一覧を更新しました。 |
https://www.fsa.go.jp/policy/prepaid/index.html
|
資金決済法 |
2021-07-30 18:30:00 |
ニュース |
BBC News - Home |
Barca, Real & Juve 'to carry on with Super League plans' |
https://www.bbc.co.uk/sport/football/58032324
|
juventus |
2021-07-30 18:51:25 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
医者が教える「ダイエットを継続させる簡単なコツ」 - 医者が教えるダイエット 最強の教科書 |
https://diamond.jp/articles/-/278025
|
思い込み |
2021-07-31 03:58:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
「論理的に話すのが苦手」という人が完全に見落としている最強の教材 - 独学大全 |
https://diamond.jp/articles/-/273907
|
論理的 |
2021-07-31 03:54:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
なんだかFIREできそうな気が…! マネする人続出!話題の“早期リタイア術”の要点はコレ! - だから、この本。 |
https://diamond.jp/articles/-/277633
|
|
2021-07-31 03:52:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
落下実験、ここまでやるか! 「利益率29%」の会社でやっている 「生活者の観点での品質」を評価する750項目! - 売上最小化、利益最大化の法則 |
https://diamond.jp/articles/-/275546
|
|
2021-07-31 03:50:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
悩みごとに 「ソンタック」と 少し笑える 妖怪の名をつけた理由 - 組織が変わる |
https://diamond.jp/articles/-/275429
|
慢性疾患ってうちの会社のことすべて見抜かれている」「『他者と働く』が慢性疾患の現状認識ツールなら、『組織が変わる』は慢性疾患の寛解ツールだ」「言語化できないモヤモヤの正体が形になって現れる体験は衝撃でした」職場に活気がない、会議で発言が出てこない、職場がギスギスしている、仕事のミスが多い、忙しいのに数字が上がらない、病欠が増えている、離職者が多い……これらを「組織の慢性疾患」と呼び、セルフケアの方法を初めて紹介した宇田川氏。 |
2021-07-31 03:46:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
当期純利益ではなく、 営業利益・経常利益の黒字転換が重要 - 黒字転換2倍株で勝つ投資術 |
https://diamond.jp/articles/-/278113
|
|
2021-07-31 03:44:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
他人の言動のほとんどに、 深い意味ってないのよ。 - 精神科医Tomyが教える 1秒で幸せを呼び込む言葉 |
https://diamond.jp/articles/-/274532
|
他人の言動のほとんどに、深い意味ってないのよ。 |
2021-07-31 03:42:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
米国株投資で1億円! 51歳でFIREした元金融マンが答える 「資金が少ないのですが、米国株投資は信用取引もできますか?」 - 英語力・知識ゼロから始める!【エル式】 米国株投資で1億円 |
https://diamond.jp/articles/-/275835
|
|
2021-07-31 03:40:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【科学的証明】瞑想トレーニングで「共感脳」は成長する - スタンフォード大学の共感の授業 |
https://diamond.jp/articles/-/277957
|
心理学者 |
2021-07-31 03:38:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【テレビ朝日系『羽鳥慎一 モーニングショー』でも活躍!】 能率をあげるための「3要素」を最適化していますか? - 私がハーバードで学んだ世界最高の「考える力」 |
https://diamond.jp/articles/-/276783
|
【テレビ朝日系『羽鳥慎一モーニングショー』でも活躍】能率をあげるための「要素」を最適化していますか私がハーバードで学んだ世界最高の「考える力」大分県で生まれ育ち、小・中・高と地元の公立校、塾通いも海外留学経験もないまま、ハーバード大学に現役合格した『私がハーバードで学んだ世界最高の「考える力」』の著者・廣津留すみれさん。 |
2021-07-31 03:36:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【放っておくと怖い目の症状】 「ものもらい」には 原因が2種類ある - ハーバード × スタンフォードの眼科医が教える 放っておくと怖い目の症状25 |
https://diamond.jp/articles/-/276612
|
【放っておくと怖い目の症状】「ものもらい」には原因が種類あるハーバード×スタンフォードの眼科医が教える放っておくと怖い目の症状【万人を救ったスーパードクターが教える歳まで視力を失わない方法】著者はハーバード大学とスタンフォード大学に計年在籍し、世界的権威の大科学誌『ネイチャー』『サイエンス』に論文が掲載されたスーパードクター。 |
2021-07-31 03:34:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
「ひとりぼっちの就活、しんどい…。」この夏は「ぼっち就活」から脱出するチャンス - 絶対内定 |
https://diamond.jp/articles/-/278274
|
館長 |
2021-07-31 03:32:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
「9割の世帯が3世代で無一文に!」子や孫が遺産を食いつぶす理由とその対策 - お金持ちがしている100の習慣 |
https://diamond.jp/articles/-/278236
|
行動パターン |
2021-07-31 03:30:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
育毛のプロが断言!「髪を育てるシャンプー、避けるべきシャンプー」 - 髪が増える術 |
https://diamond.jp/articles/-/277873
|
育毛のプロが断言「髪を育てるシャンプー、避けるべきシャンプー」髪が増える術薄毛、白髪、フケ、かゆみ…。 |
2021-07-31 03:28:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
あきらめる人とあきらめずにやり抜く人のたった一つの違い - 突き抜けるまで問い続けろ |
https://diamond.jp/articles/-/278008
|
代表理事 |
2021-07-31 03:26:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
存在感のなかった ワークマンSVが、 なぜ「季節製品管理」の プロになったのか? - ワークマン式「しない経営」 |
https://diamond.jp/articles/-/276493
|
|
2021-07-31 03:24:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
無能な人間が「権力者」になる不可避な理由 - スタンフォードの権力のレッスン |
https://diamond.jp/articles/-/278087
|
人を動かす |
2021-07-31 03:22:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
デルタ株で試練に直面、中国のコロナ戦略 - WSJ発 |
https://diamond.jp/articles/-/278350
|
試練 |
2021-07-31 03:21:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
悪性リンパ腫を克服した笠井信輔アナが病院選びで重視したあるデータ - がん治療選択 |
https://diamond.jp/articles/-/277805
|
悪性リンパ腫 |
2021-07-31 03:20:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
もう日本は「ものづくり大国」ではない!? 貿易統計が示す残酷な現実 - 経済は統計から学べ! |
https://diamond.jp/articles/-/278277
|
加工貿易 |
2021-07-31 03:18:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
プロセスエコノミーは「顧客の自己実現」ができるから受けるんだ - Be Yourself |
https://diamond.jp/articles/-/277930
|
beyourself |
2021-07-31 03:16:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【「自己肯定感が上がる」と話題のエッセイに学ぶ!】自信を持つ方法 - 大丈夫じゃないのに大丈夫なふりをした |
https://diamond.jp/articles/-/278297
|
自己肯定感 |
2021-07-31 03:14:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【全財産90万円から株式投資で2億円】 銘柄選びのシンプルな4つの視点とは? - どん底サラリーマンが株式投資で2億円 いま息子に教えたいお金と投資の話 |
https://diamond.jp/articles/-/277370
|
【全財産万円から株式投資で億円】銘柄選びのシンプルなつの視点とはどん底サラリーマンが株式投資で億円いま息子に教えたいお金と投資の話妻の浮気が原因で離婚。 |
2021-07-31 03:12:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【不動産投資こそFIREへの近道】 物件の築年数の目安とは? - 元証券ウーマンが不動産投資で7億円 |
https://diamond.jp/articles/-/277357
|
|
2021-07-31 03:10:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
「地頭」が良いのに テストで点が取れない子に 欠けているもの - 中学受験必勝ノート術 |
https://diamond.jp/articles/-/278068
|
「地頭」が良いのにテストで点が取れない子に欠けているもの中学受験必勝ノート術大手塾で算数講師の経験を積んだ後、算数専門のプロ家庭教師として約年間、人以上のお子さんを指導してきた中学受験専門のカリスマ家庭教師・安浪京子先生は、その経験から「ノートをひと目見ると、その子の学力がわかる」と言います。 |
2021-07-31 03:08:00 |
コメント
コメントを投稿