投稿時間:2021-04-20 06:23:28 RSSフィード2021-04-20 06:00 分まとめ(29件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
TECH Engadget Japanese 2018年4月20日、ダンボール工作が前提の異色ゲーム「Nintendo Labo」が発売されました:今日は何の日? https://japanese.engadget.com/today-203040463.html nintendo 2021-04-19 20:30:40
TECH Engadget Japanese ソニー、PS3 / PS Vitaのストア終了を撤回。今後もデジタル版ゲーム販売を継続 https://japanese.engadget.com/ps3-ps-vita-ps-store-continue-203219046.html pspsvita 2021-04-19 20:32:19
AWS AWS Compute Blog Optimizing serverless development with samconfig https://aws.amazon.com/blogs/compute/optimizing-serverless-development-with-samconfig/ Optimizing serverless development with samconfigThe AWS Serverless Application Model AWS SAM is an open source framework for building serverless applications using infrastructure as code IaC Using shorthand syntax developers declare AWS CloudFormation resources or specialized serverless resources that are transformed to infrastructure during deployment AWS SAM commands list AWS SAM s companion the AWS SAM Command Line Interface CLI provides a … 2021-04-19 20:11:19
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Electron(Node.js・javascript) ファイル分割時に変数を共有したい https://teratail.com/questions/334137?rss=all ElectronNodejs・javascriptファイル分割時に変数を共有したいElectronでファイルが膨大なため分割をしたいが変数を共有したいElectronで開発を行っている際に、ファイルの中身が膨大になった。 2021-04-20 05:24:33
海外TECH Ars Technica Millions of web surfers are being targeted by a single malvertising group https://arstechnica.com/?p=1758113 jugular 2021-04-19 20:08:14
海外TECH DEV Community Mantener activo tu bot de Discord.js en Replit https://dev.to/alexanderg/mantener-activo-tu-bot-de-discord-js-en-replit-1mgi Mantener activo tu bot de Discord js en ReplitHace un tiempo hice un post sobre Como mantener activo tu bot de discord py en replit hoy toca uno pero para discord js¿Que fue lo que hice Este método es muy parecido al de flask de hecho el método de flask me dio esta idea solo que como sabrán flask simplemente no esta en JavaScritp pero como sabemos existe Express que en este caso claro tiene mas funcionalidades haría lo mismo que flak crear un servidor luego con una página llamada UpTimeRobot configurar la dirección creada por Express para que UptimeRobot vea constantemente la página y asíeste activo tu bot las hrs ImportanteCabe destacar que debes tener una cuenta en replit y tener tu código del bot en un repls en este post no te enseñaréa crear un bot solo a mantenerlo activo pero a futuro espero hacer un post sobre crear bot en discord py usar replit instalar paquetes y demás Sin más rodeos comencemosCabe destacar que domino más python por lo tanto lo que hice en este caso fue en el mismo archivo principal de tu bot comunmente main js importamos express no lo instalamos porque el replit lo instala por si solo y iniciamos Expressconst express require express const app express Luego Creamos la función como tal para crear nuestro servidor y que UptimeRobot haga lo suyo en cualquier parte de nuestro archivo principal ponemos EXPRESSapp get req res gt res end My bot is online function live app listen function console log bot is online live END EXPRESSLuego en nuestro archivo principal en la parte final de nuestro código justo antes del TOKEN colocamos live Si ejecutamos nuestro bot encontraremos con que ahora hay una ventana en el replit que contiene una página o algo así simplemente con el texto Bot is online si buscamos encontramos un dirección un enlace ese enlace lo usaremos en UptimerRobot Imagen unoVamos ahora vamos a UpTimeRobot si no tienes una cuenta crearte una es simple luego de tener una cuenta nos vamos a la parte de monitores Aquítengo uno porque ya he usado el servicio a ustedes no les debe salir nadaLuego le damos a Add new Monitor y seleccionamos las siguientes opciones En Monitor Type HTTP s En Friendly Name El nombre de tu bot o el que quierasEn URL or IP Aquídeben poner la URL que les da replit Imagen La constancia la dejamos igual en minutos y si gustan activan las notificaciones Obviando el Friendly Name y la URL La url es importante que pongas la que te da replit correctamente les debería quedar así Luego de darle Create Monitor nuestro monitor ya debe estar listo ahora la próxima vez que ejecutemos nuestro bot el monitor estarárealizando peticiones GET y lo mantendrán activo Como dije en el post de discord py existe heroku y otros servicios hechos específicamente para esta ocasión pero no esta de más que sepas estos métodos Espero que el post se les haga fácil de seguir si tienen una duda si no les funciona o alguna cosa puedes decírmelo por los comentarios 2021-04-19 20:26:34
海外TECH DEV Community Implementing image uploading with Type-GraphQL, Apollo and TypeORM https://dev.to/lastnameswayne/implementing-image-uploading-with-type-graphql-apollo-and-typeorm-1c63 Implementing image uploading with Type GraphQL Apollo and TypeORMThis week I had the unfortunate experience of trying to implement image uploading I quickly realized that most tutorials are outdated as Apollo Client stopped supporting image uploading with the release of Apollo Client Adding to that there wasn t much documentation for methods using TypeScript I hope to add to thatYou should be able to either intialize the repo with Ben Awads command npx create graphql api graphql example or you can also just clone this starter GitHub Repo I made They are nearly the same the GitHub repo doesn t have postgres though My main problem was also that I wanted to integrate the image uploading with my PostgresSQL database This hopefully won t be a problem anymore Let s implement the backend first BackendFirst you have to create a Bucket on Google Cloud Platform I just chose the default settings after giving it a name You might have to create a project first if you don t already have one You can get worth of credits too Next create a service account You need a service account to get service keys which you in turn need to add into your app Click on your service account navigate to keys press Add key and select JSON You now have an API key Insert this into your project SetupFor this app I want to create a blog post with an image So in your post ts postresolver or wherever your resolver to upload the image is specify where the API key is located const storage new Storage keyFilename path join dirname images filenamehere json const bucketName bucketnamehere Also make a const for your bucket name You can see the name on Google Cloud Platform if you forgot To upload images with GraphQL make sure to add graphql upload yarn add graphql uploadNavigate to index ts First disable uploads from Apollo client since we are using graphql upload which conflicts with Apollo s own upload property const apolloServer new ApolloServer uploads false disable apollo upload property schema await createSchema context req res gt req res redis userLoader createUserLoader Next also in index ts we need to use graphqlUploadExpress graphqlUploadExpress is a middleware which allows us to upload files const app express app use graphqlUploadExpress maxFileSize maxFiles apolloServer applyMiddleware app We can now write our resolver First let s upload a single file import FileUpload GraphQLUpload from graphql upload Mutation gt Boolean async singleUpload Arg file gt GraphQLUpload createReadStream filename FileUpload await new Promise async resolve reject gt createReadStream pipe storage bucket bucketName file filename createWriteStream resumable false gzip true on finish gt storage bucket bucketName file filename makePublic then e gt console log e object console log bucketName e object on error gt reject false The arguments are a little different The Type GraphQL type is GraphQLUpload which is from graphql upload The TypeScript type is declared as createReadStream filename FileUpload with FileUpload also being a type from graphql upload We await a new promise and using a createReadStream we pipe to our bucket Remember that we defined storage and bucketName earlier to our own bucket values We can then create a writeStream on our bucket When we are done uploading we make the files public on our buckets and print the file uploaded The public link to view the image uploaded is bucketName e object bucketName e object so you would want to display this link on the front end if needed You can also just view the contents of your bucket on the GCP website Unfortunately we can t verify that this works with the graphQL playground since it doesn t support file uploads This is a job for Postman which you can download here First you need a suitable CURL request for your resolver Write this query into the GraphQL playground mutation UploadImage file Upload singleUpload file file In the top right corner you should press the Copy CURL button You should get something like this curl http localhost graphql H Accept Encoding gzip deflate br H Content Type application json H Accept application json H Connection keep alive H DNT H Origin http localhost data binary query mutation UploadImage file Upload n singleUpload file file n compressedYou only want to keep the highlighted part This leaves me with query mutation UploadImage file Upload n singleUpload file file n n Which is the operation I want Now back to Postman Create a new POST request and use the Form data configuration under Body Fill in this data keyvalueoperations query mutation UploadImage file Upload n singleUpload file file n n map variables file GraphQL Logo svg pngpress the file configuration under the last row This will allow you to upload files Upload your desired file and send the request The response should return true You can now view the image on Google Cloud I will now show how to create a front end for your application If you want to save the image to a database there is a section at the end on this Front endSetting up the front end is a little more complicated First you have to setup your apollo client other unrelated imports up hereimport createUploadLink from apollo upload client new ApolloClient ts ignore link createUploadLink uri process env NEXT PUBLIC API URL as string headers cookie typeof window undefined ctx req headers cookie undefined fetch fetchOptions credentials include credentials include headers cookie typeof window undefined ctx req headers cookie undefined cache My apollo client is a little overcomplicated because I needed to make sure that cookies workedBut the most important part is that you create an upload link with apollo rather than a normal http link Next you have to implement the actual input field where users can drop their file My favorite fileinput library is react dropzone All react dropzone needs is a div and an input lt div getRootProps gt lt input accept image getInputProps gt lt InputDrop gt lt InputDrop gt lt div gt You can control what happens when a user drops a file chooses one with their useDropzone hook const onDrop useCallback file gt onFileChange file onFileChange const getRootProps getInputProps isDragActive useDropzone onDrop When the user drops a file I call onFileChange with the file that was just dropped in Instead of onFileChange you could also have an updater function called setFileToUpload using useState Since I have also implemented cropping of my images I need to process the image through some other functions before it s ready to be uploaded But before this feature I just uploaded the file directly I actually used Apollos useMutation hook to implement uploading the image First I define the mutation const uploadFileMutation gql mutation UploadImage file Upload singleUpload file file We now need the before mentioned hook from Apolloconst uploadFile useUploadImageMutation Now to actually upload the file you can call this function I am using this in the context of a form with Formik so in my case it would be when the user submits the form await uploadFile fileToUpload This should be enough to upload the image to your bucket Let me know if you want the code to cropping and I will write a little on that For now I deem it out of scope for this tutorial I promised to show how to store the image in a database so here it is Integrating with a database and TypeORM on the backendFirst you need to update your in my case Post ts entity Field Column img stringI added a new Field where I save the image as a string This is possible since we are actually just saving the link to our image stored in our Google Bucket Remember to run any migrations you might need I am telling you since I forgot to at firstWe then need to update our resolver on the backend Mutation gt Boolean UseMiddleware isAuth async createPost Arg file gt GraphQLUpload createReadStream filename FileUpload Arg input input PostInput Ctx req MyContext Promise lt Boolean gt console log starts let imgURL const post new Promise reject gt createReadStream pipe storage bucket bucketName file filename createWriteStream resumable false gzip true on error reject on finish gt storage bucket bucketName file filename makePublic then e gt imgURL e object Post create input creatorId req session userId img imgURL save return true A lot of the code is the same as uploading a single file I call Post create from TypeORM which let s me save the new imgURL which I get after uploading the image I also save the current user s userId as well as the input from the form they just filled in I get this from my PostInput class InputType class PostInput Field title string Field text string This is just title and text strings that is passed to our resolver The last step is to actually call the resolver This time I will use graphQL code gen which I also have a tutorial about In short it generates fully typed hooks corresponding to our GraphQL mutation Here is the mutation to create a post mutation CreatePost input PostInput file Upload createPost input input file file Takes the input of the post title and text aswell as a file GraphQL codegen generates this hook for the above mutation const createPost useCreatePostMutation Simple as that Remember to pass in the file and any other fields you might want to save await createPost variables input title values title text values text file fileToUpload Now we are using our resolver to save the file and the other data from the form inputThat s all done If you want to know how to display the image you can check out my other tutorial ConclusionGreat Our users are now allowed to upload images to our application using Google Cloud Storage and GraphQLI don t have a repo with this code isolated but you can check it out on my side project FoodFinder in posts ts in the backend and create post tsx for the frnot end As always let me know if you have any questions 2021-04-19 20:04:10
海外TECH Engadget Toyota's first electric vehicle will hit the road in 2022 https://www.engadget.com/toyota-bz4x-suv-concept-202644349.html Toyota x s first electric vehicle will hit the road in Toyota announced today it plans to sell around different electric cars globally by the end of including new fully electric models 2021-04-19 20:26:44
海外科学 NYT > Science NASA Mars Helicopter Achieves First Flight on Red Planet https://www.nytimes.com/2021/04/19/science/nasa-mars-helicopter.html planet 2021-04-19 20:22:00
海外科学 BBC News - Science & Environment Nasa successfully flies small helicopter on Mars https://www.bbc.co.uk/news/science-environment-56799755 ingenuity 2021-04-19 20:55:12
海外ニュース Japan Times latest articles Japanese journalist held in Myanmar moved to prison, embassy says https://www.japantimes.co.jp/news/2021/04/19/national/journalist-detained-myanmar/ Japanese journalist held in Myanmar moved to prison embassy saysYuki Kitazumi a former reporter for the Tokyo based Nikkei business daily who now lives in Yangon was detained by security forces in Yangon on Sunday 2021-04-20 05:15:19
海外ニュース Japan Times latest articles Premier League fans and former players slam plans for Super League https://www.japantimes.co.jp/sports/2021/04/19/soccer/fans-former-players-super-league/ Premier League fans and former players slam plans for Super LeagueFormer players and fans groups across the globe have slammed plans for a breakaway competition by some of Europe s top clubs calling the move a 2021-04-20 07:00:38
ニュース BBC News - Home Nasa successfully flies small helicopter on Mars https://www.bbc.co.uk/news/science-environment-56799755 ingenuity 2021-04-19 20:55:12
ニュース BBC News - Home Government to speed up UK climate change target https://www.bbc.co.uk/news/uk-politics-56807520 carbon 2021-04-19 20:20:11
ニュース BBC News - Home Parler set to return to Apple's App Store https://www.bbc.co.uk/news/technology-56809217 capitol 2021-04-19 20:06:45
ビジネス ダイヤモンド・オンライン - 新着記事 コロナ下で貸せる銀行、貸せない銀行ランキング!貸せる2位秋田銀、貸せない2位東邦銀、1位は? - 戦慄のK字決算 https://diamond.jp/articles/-/268481 金融危機 2021-04-20 05:25:00
ビジネス ダイヤモンド・オンライン - 新着記事 関西電力が水素バブルを機にもくろむ、「原発・起死回生シナリオ」の勝算 - 1100兆円の水素バブル https://diamond.jp/articles/-/268311 原子力発電所 2021-04-20 05:20:00
ビジネス ダイヤモンド・オンライン - 新着記事 キヤノン、ニコンが半導体バブルで「蚊帳の外」の深刻、微細化技術で落伍の末路 - 戦慄のK字決算 https://diamond.jp/articles/-/268480 蚊帳の外 2021-04-20 05:15:00
ビジネス ダイヤモンド・オンライン - 新着記事 第一三共の新中計に透ける「大衆薬」と「ジェネリック」の見切り時 - Diamond Premium News https://diamond.jp/articles/-/268929 diamondpremiumnews 2021-04-20 05:12:00
ビジネス ダイヤモンド・オンライン - 新着記事 「中国が全て」だった日米首脳会談、裏で共産党が演じた米国への歩み寄りの意図 - 加藤嘉一「中国民主化研究」揺れる巨人は何処へ https://diamond.jp/articles/-/268919 共同声明 2021-04-20 05:10:00
ビジネス ダイヤモンド・オンライン - 新着記事 コロナ後も続く「経済長期停滞」の真犯人は、少子高齢化 - 政策・マーケットラボ https://diamond.jp/articles/-/268913 世界経済 2021-04-20 05:05:00
ビジネス 電通報 | 広告業界動向とマーケティングのコラム・ニュース 生活時間とメディア利用のその後-“巣ごもり”やや解消もコロナの影響は色濃く https://dentsu-ho.com/articles/7738 mcrex 2021-04-20 06:00:00
ビジネス 電通報 | 広告業界動向とマーケティングのコラム・ニュース 今、ラグジュアリーブランドに求められているもの https://dentsu-ho.com/articles/7737 顧客 2021-04-20 06:00:00
ビジネス 不景気.com ライフフーズの21年2月期は16億円の最終赤字、コロナで減収 - 不景気.com https://www.fukeiki.com/2021/04/lifefoods-2021-loss.html 最終赤字 2021-04-19 20:07:09
ビジネス 不景気.com 茨城・水戸の洋菓子製造「備前堀LAB」に破産開始決定 - 不景気.com https://www.fukeiki.com/2021/04/bizenbori-lab.html 株式会社 2021-04-19 20:01:43
LifeHuck ライフハッカー[日本版] 繰り返し使えるグリルシートで、ストレスフリーなバーベキューを楽しもう【今日のライフハックツール】 https://www.lifehacker.jp/2021/04/lht_grillseat-camp-barbecue.html 後片付け 2021-04-20 06:00:00
北海道 北海道新聞 菅政権と五輪 思惑排し冷静に判断を https://www.hokkaido-np.co.jp/article/535020/ 感染拡大 2021-04-20 05:05:00
ビジネス 東洋経済オンライン アメリカが台湾の最大野党に報復した理由 「中国」の看板を外さない国民党に覚悟を迫る | 中国・台湾 | 東洋経済オンライン https://toyokeizai.net/articles/-/423827?utm_source=rss&utm_medium=http&utm_campaign=link_back 共同声明 2021-04-20 05:50:00
ビジネス 東洋経済オンライン 分断する世界で日本に求められる役割とは何か 大きく変動した日米中めぐる国際秩序の本質 | ポストコロナのメガ地経学ーパワー・バランス/世界秩序/文明 | 東洋経済オンライン https://toyokeizai.net/articles/-/423831?utm_source=rss&utm_medium=http&utm_campaign=link_back 世界秩序 2021-04-20 05:20:00

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)