投稿時間:2022-09-06 05:24:15 RSSフィード2022-09-06 05:00 分まとめ(27件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
Ruby Rubyタグが付けられた新着投稿 - Qiita Rails6で通知機能を実装(ポリモーフィック) https://qiita.com/ttymryo/items/79dcf9fd83d0c09e8775 Railsで通知機能を実装ポリモーフィックRailsで通知機能を実装した際にポリモーフィックの存在を初めて知ったのとあまり記事がなかったので参考になればと思い書いていきます理解が間違っているかもしれません。 2022-09-06 04:44:10
Ruby Railsタグが付けられた新着投稿 - Qiita Rails6で通知機能を実装(ポリモーフィック) https://qiita.com/ttymryo/items/79dcf9fd83d0c09e8775 Railsで通知機能を実装ポリモーフィックRailsで通知機能を実装した際にポリモーフィックの存在を初めて知ったのとあまり記事がなかったので参考になればと思い書いていきます理解が間違っているかもしれません。 2022-09-06 04:44:10
海外TECH MakeUseOf How to See Your Wi-Fi Password in iOS 16 https://www.makeuseof.com/how-to-see-wi-fi-password-in-ios/ forgot 2022-09-05 19:27:38
海外TECH MakeUseOf 6 Ways to Increase Productivity and Do More in Less Time https://www.makeuseof.com/ways-to-increase-productivity-do-more/ effective 2022-09-05 19:15:14
海外TECH DEV Community Build a Next.js App with Appwrite and Multiple Databases https://dev.to/hackmamba/build-a-nextjs-app-with-appwrite-and-multiple-databases-5bgf Build a Next js App with Appwrite and Multiple DatabasesThe primary purpose of a database is to store and retrieve data In computing and application development databases are used to efficiently organize and manage data collection and make that data accessible to users in various ways Databases can be categorized into Flat Files Databases Relational Databases and NoSQL Databases In this post we will learn how to build a file storage application using Appwrite s Storage service to save files and multiple databases PostgreSQL and SQLite to save the metadata Our project s GitHub repository can be found here PrerequisitesTo fully grasp the concepts presented in this tutorial the following requirements apply Basic understanding of JavaScript and ReactDocker installationAn Appwrite instance check out this article on how to set up an instancePostgreSQL installationDBeaver installation or any Database GUI viewer supported by PostgreSQL Getting startedWe need to create a Next js starter project by navigating to the desired directory and running the command below in our terminal npx create next app next appwrite dbs amp amp cd next appwrite dbsThe command creates a Next js project called next appwrite dbs and navigates into the project directory We proceed to install the required dependencies by running the command below npm install appwrite prismaappwrite is a development platform that provides a powerful API and management console for building backend servers for web and mobile applications prisma is an Object Relational Mapper that reduces the friction of working with a database by providing required features and functionality With that done we can leverage Next js CSS Module support to style our page by replacing the content in Home module css in the styles folder with the code snippet below container padding rem main min height vh padding rem flex display flex flex direction column justify content center align items center fieldset border none margin bottom rem padding label display block margin bottom rem font size rem inputText border px solid ccc display inline block padding px px margin bottom rem width fileUpload border px solid ccc display inline block padding px px margin bottom rem description text align center description margin rem line height font size rem button display block border none padding rem rem margin top rem background color blue color white cursor pointer Creating a new Appwrite ProjectTo create a new project start the Appwrite instance and navigate to the specified hostname and port http localhost Next we need to log in to our account or create an account if we don t have one On the console click on the Create Project button input appwrite dbs as the name and click Create The project dashboard will appear on the console Next click on the Settings tab and copy the Project ID and API Endpoint Next we ll navigate to our project root directory and create a helper folder here create an utils js file and add the snippet below import Storage Client Account from appwrite const client new Client client setEndpoint http localhost v setProject ADD YOUR PROJECTID HERE export const appwriteSDK gt const storage new Storage client return storage export const accountSDK gt const account new Account client return account The snippet above does the following Imports the required dependenciesConfigures Appwrite client by setting up the endpoint and project IDCreates an appwriteSDK and accountSDK to access Appwrite Storage and Authentication services respectivelyCreate StorageTo create a storage navigate to the Storage tab click on Add Bucket input uploadDB as the name and click Create Click on the Settings tab on the storage page and copy the Bucket ID as this will come in handy when building the file upload functionality Creating File Storage App with Appwrite and PostgreSQL DatabaseTo get started we need to open DBeaver or any other database GUI right click on the Database menu click on Create New Database input uploadDB as the database name and click OK Setting up PrismaWith that done we need to set up Prisma by running the command below npx prisma initThe command creates a prisma folder and a env file in the project directory Next we navigate into the prisma folder and modify the schema prisma file as shown below generator client provider prisma client js datasource db provider postgresql url env DATABASE URL add below model Upload id Int id default autoincrement name String uploadID String The snippet above specifies PostgreSQL default as the database and creates an Upload model with required properties The model created represents entities of our application and will map as a table in our database Next we need to navigate to the generated env file and modify the DATABASE URL The structure is as shown below DATABASE URL postgresql lt YOUR USERNAME gt lt YOUR PASSWORD gt localhost lt DATABASE NAME gt Sample of properly filled connection url below DATABASE URL postgresql demolamalomo malomz localhost uploadDB PS When installing PostgreSQL for the first time we will be required to provide a Username and a Password It s the exact details we need to include in our connection string Next we need to establish a connection between our application and the PostgreSQL database by running the command below npx prisma migrate devThe command will ask us some questions on how to establish our connection We can answer the questions as shown below Do you want to continue All data will be lost N Y lt PRESS y gt Enter a name for the new migration lt first migration gt Creating the File Storage Application With that done we now need to navigate to the api folder inside the pages folder create an upload js file and add the snippet below import PrismaClient from prisma client export default function upload req res const name upload req body const prisma new PrismaClient prisma upload create data name uploadID upload then result gt res status json result catch err gt console log err res json err The snippet above does the following Imports the required dependencyCreates an upload API that gets the request body instantiates Prisma and uses create method attached to upload the model we created earlier to create a new File upload metadata name and uploadID Finally we modify the index js file in the pages folder to the following import Head from next head import useEffect useState from react import appwriteSDK accountSDK from helper utils import styles from styles Home module css export default function Home const file setFile useState null const name setName useState const checkSession gt const validSession accountSDK get if validSession accountSDK createAnonymousSession then resp gt console log resp catch err gt console log err return useEffect gt checkSession const handleSubmit async e gt e preventDefault const sdk appwriteSDK createFile YOUR BUCKET ID COMES HERE unique file sdk then url gt const data name upload url id fetch api upload method POST headers Content Type application json body JSON stringify data then res gt console log res alert File Upload successful catch err gt console log err catch err gt console log err return lt div className styles container gt lt Head gt lt title gt Appwrite DBs lt title gt lt meta name description content Generated by create next app gt lt link rel icon href favicon ico gt lt Head gt lt main className styles main gt lt p className styles description gt Appwrite Multiple DBs lt p gt lt form method post onSubmit handleSubmit gt lt fieldset className styles fieldset gt lt label htmlFor name className styles label gt Name lt label gt lt input type text name name value name required className styles inputText onChange e gt setName e target value gt lt fieldset gt lt fieldset className styles fieldset gt lt label htmlFor file className styles label gt Select image lt label gt lt input type file name file required className styles fileUpload onChange e gt setFile e target files gt lt fieldset gt lt button className styles button gt Submit lt button gt lt form gt lt main gt lt div gt The snippet above does the following Imports the required dependenciesCreates state to manage the uploaded metadata file and name Creates a checkSession function that checks if the current session is valid or creates an anonymous session if it isn t and calls the function upon page load using the useEffect hookCreates an handleSubmit function for uploading the selected file and also does the following Uses the appwriteSDK function to access the Appwrite Storage by passing in the Bucket ID we copied earlier unique flag as the documentId which tells Appwrite to auto generate a unique ID and the file to be uploadedChecks if the file upload is successful and if it is calls the api upload API we created earlier to upload the file metadata to the PostgreSQL databaseMarkup to show the upload formWith that done we can start a development server using the command below npm run devWe can also validate the upload by checking Appwrite Storage and DBeaver Creating File Storage App with Appwrite and SQLite DatabaseTo change the database first we need to delete the prisma folder generated earlier Secondly we need to set up Prisma again by running the command below npx prisma initThe command creates another prisma folder in the project directory Next we need to navigate into the prisma folder and modify the schema prisma file as shown below generator client provider prisma client js modify below datasource db provider sqlite url file dev db add below model Upload id Int id default autoincrement name String uploadID String The snippet above specifies SQLite as the database and creates an Upload model with required properties Lastly we need to establish a connection between our application and the SQLite database by running the command below npx prisma migrate devThe command will ask us some questions on how to establish our connection We can answer the questions as shown below Do you want to continue All data will be lost N Y lt PRESS y gt Enter a name for the new migration lt first migration gt The command creates a dev db SQLite database a migration folder and establishes a database connection With that done we can restart the development server using the command below npm run devWe can also test and validate the upload by checking the generated SQLite database ConclusionThis post discussed how to build a file storage application using Appwrite s Storage service to save files and multiple databases PostgreSQL and SQLite to save metadata The Appwrite platform ships with a robust SDK and database for building applications It also offers flexible features like Storage Authentication Functions Webhooks etc that can be integrated with the existing tech stack These resources might be helpful Set up Appwrite instance locallyAppwrite official documentationAppwrite web SDKPrisma ORM 2022-09-05 19:58:37
海外TECH DEV Community Analyzing AST in Go with JSON tools https://dev.to/evgenus/analyzing-ast-in-go-with-json-tools-36dg Analyzing AST in Go with JSON toolsThere are many specific tasks that could significantly improve and automate your ongoing maintenance of big project Some of them require building tools that can analyze or change source code created by developers For example such tools could be gathering metadata from comments gathering strings that need to be translated understanding the structure of the code to calculate some complexity metrics or build explanatory diagrams or even apply some automatic code optimization and refactoring patternsSolving such tasks seems to lead us to complicated topics of compilers and parsers But in every modern programming language comes with batteries included The structure of code in form of AST that is ready to be searched and manipulated is presented as a built in library Basically parsing files with code and searching for specific things is not much harder as do the same for JSON or XML In this article we will cover AST analysis in Go Existing approachesIn golang there is a standard package ast that provides structs of AST nodes and functions for parsing source files It is quite easy and straightforward for experienced go developers to write code for the tool Also there is printer package that can convert AST back into source code Here is a list of articles describing how to manipulate AST in golang Basic AST Traversal in GoCool Stuff With Go s AST PackageInstrumenting Go Code via ASTRewriting Go source code with AST toolingOne small aspect you need to know the structure of golang AST For me when I first dive into the topic the problem was to understand how nodes are combined together and figure out what exactly I need to search in terms of node structure Of course you can print AST using built in capabilities You will get output in some strange format ast File Package Name ast Ident NamePos Name main Decls ast Decl len ast GenDecl TokPos Tok import Lparen Also since the format is very specific you can t use any tools to navigate it except text search Tools like goast viewer can help with this but capabilities are limited Proposed solutionI started thinking of the library that would allow us to convert AST into some very conventional format like JSON JSON is easy to manipulate and many tools like jq and approaches exist to search and modify JSON So what I end up with is astyAsty is a small library written in go that allows parsing source code and presenting it in JSON structure But moreover it allows also to do the reverse conversion It means that now you can manipulate go code with a tool or algorithm developed with any programming language You can use it as go package as a standalone executable or even as a docker container Try this page to experiment with asty in web assembly Example go code package mainimport fmt func main fmt Println hello world Example JSON output NodeType File Name NodeType Ident Name main Decls NodeType GenDecl Tok import Specs NodeType ImportSpec Name null Path NodeType BasicLit Kind STRING Value fmt NodeType FuncDecl Recv null Name NodeType Ident Name main Type NodeType FuncType TypeParams null Params NodeType FieldList List null Results null Body NodeType BlockStmt List NodeType ExprStmt X NodeType CallExpr Fun NodeType SelectorExpr X NodeType Ident Name fmt Sel NodeType Ident Name Println Args NodeType BasicLit Kind STRING Value hello world asty is also capable to output comments positions of tokens in original source and reference ids In some places AST of go is not actually a tree but rather a DAG So nodes may have the same ids specified in JSON Development principles and constraintsIn the development of asty I tried to follow some rules Make JSON output as close to real golang structures as possible There is no additional logic introduced No normalization No reinterpretation The only things that were introduced are the names of some enum values Even names of fields are preserved in the same way they exist in go ast package Make it very explicit No reflection No listing of fields This is done to facilitate future maintenance If something will be changed in future versions of golang this code will probably break compile time Literally asty contains copies for each AST node struct to define marshaling and unmarshaling of JSON Keep polymorphism in JSON structure If some field references an expression then a particular type will be discriminated from the object type name stored in a separate field NodeType It is tricky to achieve so if you want something like this for other tasks I would recommend checking out this example Other solutionsI looked hard for existing implementations of this approach Unfortunately not much to be found One project goblin which I tried to use for a while is quite good and mature but it misses support of backward conversion from JSON to AST It tries to reinterpret some structures in AST to I guess simplify and make them more human readable My personal opinion it is not good But the main issue with it is lack of maintenance It was developed a long time ago for version and was not updated since then However you can find a fork of it relatively up to date Another project gojson generates JSON from go code Also missing the backward conversion and poorly maintained And it is implemented as a standalone parser with javascript I think in this way it is very hard to maintain and keep it up with new features in golang Further workI am looking for cooperation with other developers interested in language tools development Meanwhile you can check another repository with examples where I experiment with AST JSON in python 2022-09-05 19:10:35
Apple AppleInsider - Frontpage News What to expect from Apple's iPhone 14 event on September 7 https://appleinsider.com/articles/22/08/13/what-to-expect-from-apples-september-iphone-14-event?utm_medium=rss What to expect from Apple x s iPhone event on September Apple s Far Out event is on September Beyond the new iPhone here s what to expect from September s Apple event ーand beyond Regular as clockwork Apple takes time in the fall to launch a swathe of new products intended for consumers to buy during the following holiday shopping period As a very lucrative time of year for the company Apple puts a lot of effort into its fall events showing off as many new items as possible While primarily centered on its iPhone product line Apple does take time to look at other complementary products and services Read more 2022-09-05 19:40:32
海外科学 NYT > Science Frank Drake, Who Led Search for Life on Other Planets, Dies at 92 https://www.nytimes.com/2022/09/05/science/space/frank-drake-dead.html beings 2022-09-05 19:04:59
金融 金融庁ホームページ 鈴木財務大臣兼内閣府特命担当大臣閣議後記者会見の概要(令和4年9月2日)を掲載しました。 https://www.fsa.go.jp/common/conference/minister/2022b/20220902-1.html 内閣府特命担当大臣 2022-09-05 19:05:00
ニュース BBC News - Home Government closes in on energy rescue plan https://www.bbc.co.uk/news/business-62801913?at_medium=RSS&at_campaign=KARANGA bills 2022-09-05 19:30:23
ニュース BBC News - Home US Open: Jessica Pegula beats Petra Kvitova to make last eight https://www.bbc.co.uk/sport/tennis/62790763?at_medium=RSS&at_campaign=KARANGA kvitova 2022-09-05 19:03:16
ビジネス ダイヤモンド・オンライン - 新着記事 中国共産党大会の10月開催決定、日程巡る裏読みと「人事5大注目点」を解説 - 加藤嘉一「中国民主化研究」揺れる巨人は何処へ https://diamond.jp/articles/-/309193 中国共産党 2022-09-06 04:55:00
ビジネス ダイヤモンド・オンライン - 新着記事 大和ハウス、積水ハウス、積水化学…そろって「5四半期連続増収」で躍進続く - ダイヤモンド 決算報 https://diamond.jp/articles/-/309246 大和ハウス、積水ハウス、積水化学…そろって「四半期連続増収」で躍進続くダイヤモンド決算報コロナ禍だけでなく、円安や資材高の影響も相まって、多くの業界や企業のビジネスは混乱状態にある。 2022-09-06 04:50:00
ビジネス ダイヤモンド・オンライン - 新着記事 令和臨調はなぜ必要になった?茂木共同代表が語る「日本企業は新陳代謝不足」 - 政策・マーケットラボ https://diamond.jp/articles/-/309192 名誉会長 2022-09-06 04:45:00
ビジネス ダイヤモンド・オンライン - 新着記事 【追悼】稲盛和夫氏がバブル期に警告「日本よ、もう一度ものづくりに目覚めよ!」 - 週刊ダイヤモンド特集セレクション https://diamond.jp/articles/-/309234 日本航空 2022-09-06 04:40:00
ビジネス ダイヤモンド・オンライン - 新着記事 【日川高校】華麗なる卒業生人脈!作家の林真理子、『ど根性ガエル』作者、プロレスラーのジャンボ鶴田… - 日本を動かす名門高校人脈 https://diamond.jp/articles/-/308797 日川高校 2022-09-06 04:35:00
ビジネス ダイヤモンド・オンライン - 新着記事 韓国サムスンに引き抜かれた日本人研究者の証言、給料1.7倍で「天国のような環境」 - News&Analysis https://diamond.jp/articles/-/308940 韓国サムスンに引き抜かれた日本人研究者の証言、給料倍で「天国のような環境」NewsampampAnalysis技術者の「日本離れ」が進んでいる。 2022-09-06 04:30:00
ビジネス ダイヤモンド・オンライン - 新着記事 韓国サムスンで10年働いた研究者は見た、すぐクビになる日本人と生き残る日本人の差 - News&Analysis https://diamond.jp/articles/-/308941 韓国サムスンで年働いた研究者は見た、すぐクビになる日本人と生き残る日本人の差NewsampampAnalysis日本の大手材料系メーカーに約年勤めていたが、研究者としてもっと活躍したいという気持ちから、サムスンのヘッドハンティングに応じた筆者。 2022-09-06 04:29:00
ビジネス ダイヤモンド・オンライン - 新着記事 韓国経済に黄信号、中国が「お得意さま」からライバルに急変した理由 - 今週のキーワード 真壁昭夫 https://diamond.jp/articles/-/309190 2022-09-06 04:26:00
ビジネス ダイヤモンド・オンライン - 新着記事 「銀行預金の良さ」を見直す、投資も大事だが家計防衛で取り入れたい理由 - News&Analysis https://diamond.jp/articles/-/309191 「銀行預金の良さ」を見直す、投資も大事だが家計防衛で取り入れたい理由NewsampampAnalysis岸田内閣が掲げる「資産所得倍増プラン」がしずしずと動き出した。 2022-09-06 04:25:00
ビジネス ダイヤモンド・オンライン - 新着記事 貯蓄好き日本の家計が被った機会損失、過去20年間で1222兆円という現実 - 政策・マーケットラボ https://diamond.jp/articles/-/309161 機会損失 2022-09-06 04:20:00
ビジネス ダイヤモンド・オンライン - 新着記事 韓国・尹大統領を苦しめる日韓関係の「負の遺産」とは、元駐韓大使が解説 - 元駐韓大使・武藤正敏の「韓国ウォッチ」 https://diamond.jp/articles/-/309195 安全保障 2022-09-06 04:17:00
ビジネス ダイヤモンド・オンライン - 新着記事 中国BYDが乗用EVで日本市場に挑戦、攻略の鍵を握る「独自の強み」とは - エコカー大戦争! https://diamond.jp/articles/-/309189 日本市場 2022-09-06 04:10:00
ビジネス ダイヤモンド・オンライン - 新着記事 岸田政権が支持率急落でも「野党復権」は望み薄、光が見える唯一の政党は? - 上久保誠人のクリティカル・アナリティクス https://diamond.jp/articles/-/309188 岸田政権が支持率急落でも「野党復権」は望み薄、光が見える唯一の政党は上久保誠人のクリティカル・アナリティクス安倍元首相の殺害事件をきっかけに、旧統一教会と自民党の関係が問題視されていることなどから、岸田内閣の支持率が急落している。 2022-09-06 04:05:00
ビジネス 東洋経済オンライン インドネシア「中国製高速列車」上陸と今後の行方 東南アジア各国、高速鉄道計画再開の動きも | 海外 | 東洋経済オンライン https://toyokeizai.net/articles/-/616015?utm_source=rss&utm_medium=http&utm_campaign=link_back 東南アジア 2022-09-06 04:30:00
海外TECH reddit A girl is new here and in need of karma 🙏🏾 https://www.reddit.com/r/FreeKarma4You/comments/x6obnq/a_girl_is_new_here_and_in_need_of_karma/ A girl is new here and in need of karma submitted by u giftebella to r FreeKarmaYou link comments 2022-09-05 19:05:22
海外TECH reddit +1000 FREE KARMA FOR EVERYONE WHO UPVOTES THIS POST https://www.reddit.com/r/FreeKarma4You/comments/x6oeoi/1000_free_karma_for_everyone_who_upvotes_this_post/ FREE KARMA FOR EVERYONE WHO UPVOTES THIS POST submitted by u nocturnall to r FreeKarmaYou link comments 2022-09-05 19:08:40

コメント

このブログの人気の投稿

投稿時間:2021-06-17 22:08:45 RSSフィード2021-06-17 22:00 分まとめ(2089件)

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

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