ROBOT |
ロボスタ |
執刀医に「触覚(力覚)をフィードバック」する手術支援ロボットシステム「Saroaサージカルシステム」慈恵医大柏病院での初症例に成功 |
https://robotstart.info/2023/08/18/riverfield-saroa.html
|
|
2023-08-18 08:42:06 |
IT |
情報システムリーダーのためのIT情報専門サイト IT Leaders |
アプリケーション開発の新潮流「プラットフォームエンジニアリング」とは? | IT Leaders |
https://it.impress.co.jp/articles/-/25244
|
顧客にデジタルサービスを迅速・頻繁に届けるためのアプローチとして米国を中心に注目が高まっており、ガートナーも「年の戦略的テクノロジのトップ・トレンド」のつに挙げています。 |
2023-08-18 17:30:00 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
三角柱 「2009 熊本県立大学前期【1】」をsympyとFreeCADでやってみたい。 |
https://qiita.com/mrrclb48z/items/c37034a9b75c6ebcf173
|
freecad |
2023-08-18 17:40:49 |
Linux |
Ubuntuタグが付けられた新着投稿 - Qiita |
UFWを活用して特定の通信のみ許可する |
https://qiita.com/teyama3/items/6bfe1db6328d3678fcf4
|
ubuntu |
2023-08-18 17:39:50 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
条件付きでS3オブジェクトを一括削除するLambda関数 |
https://qiita.com/Stellarium/items/fb44b54bfc5be108b12d
|
mportosbucketnametestsbuc |
2023-08-18 17:08:43 |
Docker |
dockerタグが付けられた新着投稿 - Qiita |
(Docker x Rails7 x MySQL8)のミニマム構成のリポジトリを作成しました。 |
https://qiita.com/emacs_hhkb/items/c30ac8ad76b994825272
|
dockerrailsquickly |
2023-08-18 17:10:52 |
Azure |
Azureタグが付けられた新着投稿 - Qiita |
Azure ネットワーク 通信ログのまとめ |
https://qiita.com/Isato-Hiyama/items/7014580cb565f7f636dc
|
azure |
2023-08-18 17:20:13 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
(Docker x Rails7 x MySQL8)のミニマム構成のリポジトリを作成しました。 |
https://qiita.com/emacs_hhkb/items/c30ac8ad76b994825272
|
dockerrailsquickly |
2023-08-18 17:10:52 |
技術ブログ |
Developers.IO |
Amazon RDS Performance Insights のオンデマンド分析機能の開始方法 |
https://dev.classmethod.jp/articles/tsnote-aurora-performanceinsights-01/
|
amazon |
2023-08-18 08:33:01 |
技術ブログ |
Developers.IO |
Zendeskでエージェントのスキルを使ったチケット自動割り当て |
https://dev.classmethod.jp/articles/subaru-zendesk38/
|
zendesk |
2023-08-18 08:14:47 |
海外TECH |
DEV Community |
Learn how to install Qwik with Tailwind CSS and Flowbite |
https://dev.to/themesberg/learn-how-to-install-qwik-with-tailwind-css-and-flowbite-4b54
|
Learn how to install Qwik with Tailwind CSS and FlowbiteIn this tutorial I want to show you how to create a new Qwik project configure Tailwind CSS and install the UI component library called Flowbite so you can use a modern and instant loading front end stack to build web apps Introducing QwikQwik is a free and open source front end framework built by the team behind Builder that allows you to build instant loading scalable and interactive web apps by leveraging the precision lazy loading feature by asynchronously loading component rendering tasks listeners and styles The framework was first released on July th by Adam Bradley and Miško Hevery and has a large community of active developers with a popular GitHub repository with over k stars and has a showcase of websites such as Builder io Reflact app Soundy cloud and more that rely on Qwik for building websites By following this guide you will learn how to create a new Qwik project install and configure Tailwind CSS and proceed by installing Flowbite to start leveraging the open source UI components to build interactive and instant loading websites faster RequirementsBefore getting started make sure that you have Node js v or higher available on your local machine and we also recommend to install the Qwik VS Code Extension to enable Qwik snippets Create a Qwik projectCreate a new project by running the following command in your terminal npm create qwik latestThe custom CLI command line interface from Qwik will prompt you with some questions on how you want your project to be configured follow the steps until you have a fully working directory Start a local development server by running npm run startYou should now be able to access a boilerplate Qwik project on http localhost from your local browser and start developing with the framework Install Tailwind CSSTailwind CSS is a popular utility first CSS framework that allows you to quickly build website user interfaces by directly writing the CSS and styles in your HTML templates via the rich collection of utility classes The easiest way to set up Tailwind CSS within your Qwik project is to run a starter script command npm run qwik add tailwindThis command will automatically set up the following install Tailwind CSS and its dependenciescreate a boilerplate tailwind config js and postcss config js filemodify the src global css file to import the Tailwind modulesBy restarting the sever you will now be able to use the utility first classes from Tailwind CSS Install FlowbiteFlowbite is a popular open source UI component library that is built on top of the Tailwind CSS framework leveraging the utility first class approach with custom interactive JavaScript that allows you to use and customize a collection of components like dropdowns navbars modals and more Follow the next steps to install and set up Flowbite in your Qwik project Install Flowbite via NPM inside your terminal npm install flowbiteRequire the Flowbite Plugin inside your tailwind config js configuration file module exports content src js ts jsx tsx mdx theme extend plugins require flowbite plugin add this line Set up the template paths for the dynamic classes file inside the configuration file module exports content src js ts jsx tsx mdx node modules flowbite js add this line theme extend plugins require flowbite plugin Finally in the src root tsx file import the Flowbite JavaScript file inside your Qwik project to start using interactive components that require JavaScript such as the navbars dropdowns drawers and more import component useVisibleTask from builder io qwik import QwikCityProvider RouterOutlet ServiceWorkerRegister from builder io qwik city import RouterHead from components router head router head import the Flowbite moduleimport initFlowbite from flowbite import global css export default component gt initialise the event listeners for the data attributes on render useVisibleTask gt initFlowbite return lt QwikCityProvider gt lt head gt lt meta charSet utf gt lt link rel manifest href manifest json gt lt RouterHead gt lt ServiceWorkerRegister gt lt head gt lt body lang en gt lt RouterOutlet gt lt body gt lt QwikCityProvider gt Congratulations Now you can start using all of the UI components from the Flowbite Library inside your Qwik project together with Tailwind CSS and build websites and user interfaces even faster UI componentsBy installing and configuring Flowbite in your Qwik project you can now directly copy and paste any UI component from the library and the blocks collection into your view files Check out one of the navbar components from Flowbite and add it inside your Qwik project for navigation export default header gt return lt nav class bg white border gray dark bg gray gt lt div class max w screen xl flex flex wrap items center justify between mx auto p gt lt a href class flex items center gt lt img src class h mr alt Flowbite Logo gt lt span class self center text xl font semibold whitespace nowrap dark text white gt Flowbite lt span gt lt a gt lt button data collapse toggle navbar default type button class inline flex items center p w h justify center text sm text gray rounded lg md hidden hover bg gray focus outline none focus ring focus ring gray dark text gray dark hover bg gray dark focus ring gray aria controls navbar default aria expanded false gt lt span class sr only gt Open main menu lt span gt lt svg class w h aria hidden true xmlns fill none viewBox gt lt path stroke currentColor stroke linecap round stroke linejoin round stroke width d M hM hM h gt lt svg gt lt button gt lt div class hidden w full md block md w auto id navbar default gt lt ul class font medium flex flex col p md p mt border border gray rounded lg bg gray md flex row md space x md mt md border md bg white dark bg gray md dark bg gray dark border gray gt lt li gt lt a href class block py pl pr text white bg blue rounded md bg transparent md text blue md p dark text white md dark text blue aria current page gt Home lt a gt lt li gt lt li gt lt a href class block py pl pr text gray rounded hover bg gray md hover bg transparent md border md hover text blue md p dark text white md dark hover text blue dark hover bg gray dark hover text white md dark hover bg transparent gt About lt a gt lt li gt lt li gt lt a href class block py pl pr text gray rounded hover bg gray md hover bg transparent md border md hover text blue md p dark text white md dark hover text blue dark hover bg gray dark hover text white md dark hover bg transparent gt Services lt a gt lt li gt lt li gt lt a href class block py pl pr text gray rounded hover bg gray md hover bg transparent md border md hover text blue md p dark text white md dark hover text blue dark hover bg gray dark hover text white md dark hover bg transparent gt Pricing lt a gt lt li gt lt li gt lt a href class block py pl pr text gray rounded hover bg gray md hover bg transparent md border md hover text blue md p dark text white md dark hover text blue dark hover bg gray dark hover text white md dark hover bg transparent gt Contact lt a gt lt li gt lt ul gt lt div gt lt div gt lt nav gt Another example is the modal component which you could use for a seamless authentication experience export default modal gt return lt div gt lt button data modal target authentication modal data modal toggle authentication modal class block text white bg blue hover bg blue focus ring focus outline none focus ring blue font medium rounded lg text sm px py text center dark bg blue dark hover bg blue dark focus ring blue type button gt Toggle modal lt button gt lt div id authentication modal tabindex aria hidden true class fixed top left right z hidden w full p overflow x hidden overflow y auto md inset h calc rem max h full gt lt div class relative w full max w md max h full gt lt div class relative bg white rounded lg shadow dark bg gray gt lt button type button class absolute top right text gray bg transparent hover bg gray hover text gray rounded lg text sm w h ml auto inline flex justify center items center dark hover bg gray dark hover text white data modal hide authentication modal gt lt svg class w h aria hidden true xmlns fill none viewBox gt lt path stroke currentColor stroke linecap round stroke linejoin round stroke width d m m M l M l gt lt svg gt lt span class sr only gt Close modal lt span gt lt button gt lt div class px py lg px gt lt h class mb text xl font medium text gray dark text white gt Sign in to our platform lt h gt lt form class space y action gt lt div gt lt label for email class block mb text sm font medium text gray dark text white gt Your email lt label gt lt input type email name email id email class bg gray border border gray text gray text sm rounded lg focus ring blue focus border blue block w full p dark bg gray dark border gray dark placeholder gray dark text white placeholder name company com required gt lt div gt lt div gt lt label for password class block mb text sm font medium text gray dark text white gt Your password lt label gt lt input type password name password id password placeholder •••••••• class bg gray border border gray text gray text sm rounded lg focus ring blue focus border blue block w full p dark bg gray dark border gray dark placeholder gray dark text white required gt lt div gt lt div class flex justify between gt lt div class flex items start gt lt div class flex items center h gt lt input id remember type checkbox value class w h border border gray rounded bg gray focus ring focus ring blue dark bg gray dark border gray dark focus ring blue dark ring offset gray dark focus ring offset gray required gt lt div gt lt label for remember class ml text sm font medium text gray dark text gray gt Remember me lt label gt lt div gt lt a href class text sm text blue hover underline dark text blue gt Lost Password lt a gt lt div gt lt button type submit class w full text white bg blue hover bg blue focus ring focus outline none focus ring blue font medium rounded lg text sm px py text center dark bg blue dark hover bg blue dark focus ring blue gt Login to your account lt button gt lt div class text sm font medium text gray dark text gray gt Not registered lt a href class text blue hover underline dark text blue gt Create account lt a gt lt div gt lt form gt lt div gt lt div gt lt div gt lt div gt lt div gt Lastly you can also copy paste whole blocks of code such as hero footer header and feature sections export default hero gt return lt section class bg white dark bg gray gt lt div class py px mx auto max w screen xl text center lg py lg px gt lt a href class inline flex justify between items center py px pr mb text sm text gray bg gray rounded full dark bg gray dark text white hover bg gray dark hover bg gray role alert gt lt span class text xs bg blue rounded full text white px py mr gt New lt span gt lt span class text sm font medium gt Flowbite is out See what s new lt span gt lt svg class ml w h fill currentColor viewBox xmlns gt lt path fill rule evenodd d M a L a l a l a z clip rule evenodd gt lt path gt lt svg gt lt a gt lt h class mb text xl font extrabold tracking tight leading none text gray md text xl lg text xl dark text white gt We invest in the world s potential lt h gt lt p class mb text lg font normal text gray lg text xl sm px xl px dark text gray gt Here at Flowbite we focus on markets where technology innovation and capital can unlock long term value and drive economic growth lt p gt lt div class flex flex col mb lg mb space y sm flex row sm justify center sm space y sm space x gt lt a href class inline flex justify center items center py px text base font medium text center text white rounded lg bg blue hover bg blue focus ring focus ring blue dark focus ring blue gt Learn more lt svg class ml mr w h fill currentColor viewBox xmlns gt lt path fill rule evenodd d M a l a l a L Ha hl a z clip rule evenodd gt lt path gt lt svg gt lt a gt lt a href class inline flex justify center items center py px text base font medium text center text gray rounded lg border border gray hover bg gray focus ring focus ring gray dark text white dark border gray dark hover bg gray dark focus ring gray gt lt svg class mr ml w h fill currentColor viewBox xmlns gt lt path d M a ha va Ha VzM A va l A Va l z gt lt path gt lt svg gt Watch video lt a gt lt div gt lt div class px mx auto text center md max w screen md lg max w screen lg lg px gt lt span class font semibold text gray uppercase gt FEATURED IN lt span gt lt div class flex flex wrap justify center items center mt text gray sm justify between gt lt a href class mr mb lg mb hover text gray dark hover text gray gt lt svg class h viewBox fill none xmlns gt lt path d M C C C C C C C C C C C C Z fill currentColor gt lt path d M VL L Z fill white gt lt path d M C C VC C C C C C VC C C C ZM C VC C C C VC C C Z fill currentColor gt lt path d M VC C C C C L C C C C C VC C C C C VHVZM C C VHVC C C C Z fill currentColor gt lt path d M L HL C HC L HL VHVHZ fill currentColor gt lt path d M VHL HC C C VHVC C C C VHZ fill currentColor gt lt path d M VHL HC C C VHVC C C C VHZ fill currentColor gt lt path d M HVHVHVHVZ fill currentColor gt lt path d M C C C C HVHVHL HC C C C VC ZM C C C C C VC C C C C VHZ fill currentColor gt lt svg gt lt a gt lt a href class mr mb lg mb hover text gray dark hover text gray gt lt svg class h viewBox fill none xmlns gt lt path d M C C C C Z fill currentColor gt lt path d M HVHC C C C C C C C ZM HVHVHC C Z fill white gt lt path d M C HVHC HZM VHC C HVHHZM VHVC VC C VHHZM C C C C HZM C C C C ZM VC C C C VZM VC C C C VHVHZM VC C VHVC C VHVHZM C C L C C C C L C C ZM VHVHVHVHVHVC C L C C ZM VHVHVHVHVHVHZM VC C VHVC C VHVHZM VC C VHVHVC C VHHZM VHVHVHVHVHVC C L C C fill currentColor gt lt svg gt lt a gt lt a href class mr mb lg mb hover text gray dark hover text gray gt lt svg class h viewBox fill none xmlns gt lt path d M C C C C Z fill currentColor gt lt path d M C C C L L C C C C L C C L C C C C C C C C C ZM C C C C ZM C C C C C C C C ZM C C C C Z fill white gt lt path d M C C C C Z fill currentColor gt lt path d M C C C C C C C C C C HVZM C HC ZM C C VC C VC C VC HC ZM C C VC C VZM C C VC C C C C C VZM C C C C ZM C C VC C C C C C VZM C C C C ZM VHC C HVC C VHC C HVC C Z fill currentColor gt lt svg gt lt a gt lt div gt lt div gt lt div gt lt section gt Here s a full list of UI components sections and templates resources you can leverage from Flowbite Flowbite LibraryFlowbite BlocksFlowbite DashboardFlowbite Pro Qwik starter projectThe open source community from Flowbite has created a Qwik starter project that has Tailwind CSS and Flowbite already installed and includes a showcase of some of the UI components already configured CreditsThis guide was originally published on the Qwik integration guide from the Flowbite Documentation |
2023-08-18 08:36:26 |
海外TECH |
DEV Community |
Appwrite + Rust: Build APIs without technical overhead |
https://dev.to/hackmamba/appwrite-rust-build-apis-without-technical-overhead-3a73
|
Appwrite Rust Build APIs without technical overheadIn every stage of the Sofware Development Lifecycle SDLC developers must make strategic decisions around databases authorization deployment mechanisms server sizes storage management etc These decisions must be thoroughly assessed as they can significantly impact the application s development process One paradigm developers constantly embrace is Backend as a Service BaaS Baas abstracts the development overhead associated with SDLC and focuses only on the business logic It provides developers with server side capabilities like user authentication database management cloud storage etc In this post we will explore leveraging Appwrite as a BaaS by building a project management API in Rust The API will provide functionalities to create read update and delete a project The project repository can be found here What is Appwrite Appwrite is an open source backend as a service platform that provides sets of APIs and SDKs for building web mobile and backend services The following are some of the benefits of using Appwrite in any application Provides a scalable and robust database Realtime functionalities Support for serverless functions Security certificates and encryption Authentication and authorization mechanism PrerequisitesTo follow along with this tutorial the following are needed Basic understanding of Rust Appwrite account Signup is free Getting startedTo get started we need to navigate to the desired directory and run the command below cargo new rust appwrite amp amp cd rust appwriteThis command creates a Rust project called rust appwrite and navigates into the project directory Next we proceed to install the required dependencies by modifying the dependencies section of the Cargo toml file as shown below dependencies actix web serde version features derive serde json dotenv reqwest version features json actix web is a Rust based framework for building web applications serde version features derive is a framework for serializing and deserializing Rust data structures serde json is a crate that uses the serde crate to manipulate JSON and vice versa reqwest version features json is a HTTP request crate We need to run the command below to install the dependencies cargo buildStructuring the applicationIt is essential to have a good project structure as it makes the codebase maintainable and seamless for anyone to read or manage To do this we need to navigate to the src directory and in this folder create an api folder In the api folder we also need to create a mod rs models rs services rs and handlers rs files mod rs is a file for managing application visibility models rs is for structuring our application data services rs is for abstracting our application logic handlers rs is for structuring our APIs Next we need to declare these files as a module by importing them into the mod rs filepub mod handlers pub mod models pub mod services Finally we need to register api folder as a parent module by importing it into the main rs file as shown below mod api fn main println Hello world Setting up AppwriteTo get started we need to log into our Appwrite console click the Create project button input api rust as the name and then Create Create a Database Collection and Add AttributesAppwrite ships a scalable and robust database that we can use in building our project management API To do this first navigate to the Database tab click the Create database button input project as the name and Create Secondly we need to create a collection for storing our projects To do this click the Create collection button input project collection as the name and then click Create Lastly we need to create attributes to represent our database fields To do this we need to navigate to the Attributes tab and create attributes for each of the values shown below Attribute keyAttribute typeSizeRequirednameStringYESdescriptionStringYESAfter creating the attributes we see them as shown below Create an API keyTo securely connect to Appwrite we need to create an API key To do this we need to navigate to the Overview tab scroll to the Integrate With Your Server section and click the API Key button Next input api rust as the name click the Next button select Database as the required scope and Create Leveraging Appwrite to build the project management APIs in RustWith our project fully set up on Appwrite we can now use the database without manually creating a server Set up Environment VariableTo securely connect to our Appwrite provisioned server Appwrite provides an endpoint and sets of unique IDs to perform all the required actions To set up the required environment variables we need to create a env file in the root directory and add the snippet below API KEY lt REPLACE WITH API KEY gt PROJECT ID lt REPLACE WITH PROJECT ID gt DATABASE ID lt REPLACE WITH DATABASE ID gt COLLECTION ID lt REPLACE WITH COLLECTION ID gt We can get the required API key and IDs from our Appwrite console as shown below Create the API modelsNext we need to create models to represent our application data To do this we need to modify the models rs file as shown below use serde Deserialize Serialize derive Deserialize Serialize Debug Clone pub struct Project serde rename id pub id Option lt String gt pub name String pub description String derive Deserialize Serialize Debug Clone pub struct ProjectRequest pub name String pub description String derive Deserialize Serialize Debug Clone pub struct ProjectResponse serde rename id pub id String serde rename collectionId pub collection id String derive Deserialize Serialize Debug Clone pub struct JsonAPIBody pub documentId Option lt String gt pub data ProjectRequest derive Serialize Debug Clone pub struct APIResponse lt T gt pub status u pub message String pub data Option lt T gt derive Serialize Debug Clone pub struct APIErrorResponse pub status u pub message String pub data Option lt String gt The snippet above does the following Imports the required dependency Creates a Project ProjectRequest ProjectResponse and JsonAPIBody structs with required properties to describe request and response body accordingly Creates an APIResponse and APIErrorResponse structs with the required properties needed for the API responsePS The serde rename FieldName macro renames the corresponding field to a specified name and the derive macro adds implementation support for serialization deserialization debugging and cloning Create the API servicesWith our application models fully set up we can now use them to create our application logic To do this we need to update the service rs file by doing the following First we need to import the required dependencies create helper functions and a method for creating a project use dotenv dotenv use reqwest header Client Error use std env use super model JsonAPIBody Project ProjectRequest ProjectResponse pub struct AppwriteService impl AppwriteService fn env loader key amp str gt String dotenv ok match env var key Ok v gt v to string Err gt format Error loading env variable fn init gt Client Client new pub async fn create project new project ProjectRequest gt Result lt ProjectResponse Error gt get details from environment variable let project id AppwriteService env loader PROJECT ID let database id AppwriteService env loader DATABASE ID let collection id AppwriteService env loader COLLECTION ID let api key AppwriteService env loader API KEY let url format database id collections collection id documents create header let mut headers header HeaderMap new headers insert X Appwrite Key api key parse unwrap headers insert X Appwrite Project project id parse unwrap let client AppwriteService init post url headers headers json amp JsonAPIBody documentId Some unique to string data new project send await match client Ok response gt let json response text await let created project ProjectResponse serde json from str json as str unwrap Ok created project Err error gt Err error The snippet above does the following Imports the required dependencies Creates an AppwriteService struct Creates an implementation block that adds env loader and init helper methods to load environment variables and creates a connection pool for making asynchronous requests Creates a create project method that uses the helper methods to get the required environment variable configure the Appwrite s provisioned server URL make a request and return appropriate responses PS The unique tag specified when creating a project tells Appwrite to autogenerate the project ID Secondly we need to add a get project method that uses similar logic as the create project function to get the details of a project imports goes herepub struct AppwriteService impl AppwriteService helper method goes here pub async fn create project new project ProjectRequest gt Result lt ProjectResponse Error gt create project code goes here pub async fn get project document id String gt Result lt Project Error gt get details from environment variable let project id AppwriteService env loader PROJECT ID let database id AppwriteService env loader DATABASE ID let collection id AppwriteService env loader COLLECTION ID let api key AppwriteService env loader API KEY let url format database id collections collection id documents document id create header let mut headers header HeaderMap new headers insert X Appwrite Key api key parse unwrap headers insert X Appwrite Project project id parse unwrap let client AppwriteService init get url headers headers send await match client Ok response gt let json response text await let project detail Project serde json from str json as str unwrap Ok project detail Err error gt Err error Thirdly we need to add a update project method that uses similar logic as the create project function to update the details of a project imports go herepub struct AppwriteService impl AppwriteService helper method goes here pub async fn create project new project ProjectRequest gt Result lt ProjectResponse Error gt create project code goes here pub async fn get project document id String gt Result lt Project Error gt get project goes here pub async fn update project updated project ProjectRequest document id String gt Result lt ProjectResponse Error gt get details from environment variable let project id AppwriteService env loader PROJECT ID let database id AppwriteService env loader DATABASE ID let collection id AppwriteService env loader COLLECTION ID let api key AppwriteService env loader API KEY let url format database id collections collection id documents document id create header let mut headers header HeaderMap new headers insert X Appwrite Key api key parse unwrap headers insert X Appwrite Project project id parse unwrap let client AppwriteService init patch url headers headers json amp JsonAPIBody documentId None data updated project send await match client Ok response gt let json response text await let updates ProjectResponse serde json from str json as str unwrap Ok updates Err error gt Err error Lastly we need to add a delete project method that uses similar logic as the create project function to delete the details of a project import goes herepub struct AppwriteService impl AppwriteService helper method goes here pub async fn create project new project ProjectRequest gt Result lt ProjectResponse Error gt create project code goes here pub async fn get project document id String gt Result lt Project Error gt get project goes here pub async fn update project updated project ProjectRequest document id String gt Result lt ProjectResponse Error gt update project code goes here pub async fn delete project document id String gt Result lt String Error gt get details from environment variable let project id AppwriteService env loader PROJECT ID let database id AppwriteService env loader DATABASE ID let collection id AppwriteService env loader COLLECTION ID let api key AppwriteService env loader API KEY let url format database id collections collection id documents document id create header let mut headers header HeaderMap new headers insert X Appwrite Key api key parse unwrap headers insert X Appwrite Project project id parse unwrap let client AppwriteService init delete url headers headers send await match client Ok gt let json format Project with ID document id deleted successfully Ok json Err error gt Err error Create the API handlersWith that done we can use the services to create our API handlers To do this first we need to add the snippet below to the handlers rs file use super model APIErrorResponse APIResponse Project ProjectRequest ProjectResponse services AppwriteService use actix web delete get patch post web Json Path HttpResponse use reqwest StatusCode post project pub async fn create project handler data Json lt ProjectRequest gt gt HttpResponse let new project ProjectRequest name data name clone description data description clone let project details AppwriteService create project new project await match project details Ok data gt HttpResponse Accepted json APIResponse lt ProjectResponse gt status StatusCode CREATED as u message success to string data Some data Err error gt HttpResponse InternalServerError json APIErrorResponse status StatusCode INTERNAL SERVER ERROR as u message failure to string data Some error to string get project id pub async fn get project handler path Path lt String gt gt HttpResponse let id path into inner if id is empty return HttpResponse BadRequest json APIErrorResponse status StatusCode BAD REQUEST as u message failure to string data Some invalid ID to string let project details AppwriteService get project id await match project details Ok data gt HttpResponse Accepted json APIResponse lt Project gt status StatusCode OK as u message success to string data Some data Err error gt HttpResponse InternalServerError json APIErrorResponse status StatusCode INTERNAL SERVER ERROR as u message failure to string data Some error to string The snippet above does the following Imports the required dependencies Creates a create project handler and get project handler handler with corresponding API routes that use the services to perform the corresponding actions and return the appropriate response using the APIResponse and APIErrorResponseLastly we need to add update project handler and delete project handler handler that uses similar logic as the handlers above to update and delete a project import goes here post project pub async fn create project handler data Json lt ProjectRequest gt gt HttpResponse create project handler code goes here get project id pub async fn get project handler path Path lt String gt gt HttpResponse get project handler code goes here patch project id pub async fn update project handler updated project Json lt ProjectRequest gt path Path lt String gt gt HttpResponse let id path into inner if id is empty return HttpResponse BadRequest json APIErrorResponse status StatusCode BAD REQUEST as u message failure to string data Some invalid ID to string let data ProjectRequest name updated project name clone description updated project description clone let project details AppwriteService update project data id await match project details Ok data gt HttpResponse Accepted json APIResponse lt ProjectResponse gt status StatusCode OK as u message success to string data Some data Err error gt HttpResponse InternalServerError json APIErrorResponse status StatusCode INTERNAL SERVER ERROR as u message failure to string data Some error to string delete project id pub async fn delete project handler path Path lt String gt gt HttpResponse let id path into inner if id is empty return HttpResponse BadRequest json APIErrorResponse status StatusCode BAD REQUEST as u message failure to string data Some invalid ID to string let project details AppwriteService delete project id await match project details Ok data gt HttpResponse Accepted json APIResponse lt String gt status StatusCode ACCEPTED as u message success to string data Some data Err error gt HttpResponse InternalServerError json APIErrorResponse status StatusCode INTERNAL SERVER ERROR as u message failure to string data Some error to string Putting it all togetherWith that done we must update the main rs file to include our application entry point and use the handlers use actix web App HttpServer use api handlers create project handler delete project handler get project handler update project handler mod api actix web main async fn main gt std io Result lt gt HttpServer new move App new service create project handler service get project handler service update project handler service delete project handler bind localhost run await The snippet above does the following Imports the required dependencies Creates a new server that adds the handlers and runs on localhost With that done we can start a development server using the command below cargo run mainWe can also confirm the project management data by checking the collection on Appwrite ConclusionThis post discussed what Appwrite is and provided a detailed step by step guide to use it to build a project management API in Rust These resources may also be helpful Appwrite official documentation Appwrite database API Actix web framework Time saving with Appwrite |
2023-08-18 08:21:48 |
海外TECH |
DEV Community |
Appwrite + Go: Build APIs without technical overhead |
https://dev.to/hackmamba/appwrite-go-build-apis-without-technical-overhead-3nhj
|
Appwrite Go Build APIs without technical overheadIn every stage of the Sofware Development Lifecycle SDLC developers must make strategic decisions around databases authorization deployment mechanisms server sizes storage management etc These decisions must be thoroughly assessed as they can significantly impact the development processes involved in building applications One paradigm developers constantly embrace is Backend as a Service BaaS Baas abstracts the development overhead associated with SDLC and focuses only on the business logic It provides developers with server side capabilities like user authentication database management cloud storage etc In this post we will explore leveraging Appwrite as a BaaS by building a project management API in Go The API will provide functionalities to create read update and delete a project The project repository can be found here What is Appwrite Appwrite is an open source backend as a service platform that provides sets of APIs and SDKs for building web mobile and backend services The following are some of the benefits of using Appwrite in any application Provides a scalable and robust database Realtime functionalities Support for serverless functions Security certificates and encryption Authentication and authorization mechanism PrerequisitesTo follow along with this tutorial the following are needed Basic understanding of Go Appwrite account Signup is free Getting startedTo get started we need to navigate to the desired directory and run the command below cargo new go appwrite amp amp cd go appwriteThis command creates a Go project called go appwrite and navigates into the project directory Next we need to initialize a Go module to manage project dependencies by running the command below go mod init go appwriteThis command will create a go mod file for tracking the project dependencies Finally we proceed to install the required dependencies with go get github com gin gonic gin github com go playground validator v github com joho godotenvgithub com gin gonic gin is a framework for building web applications github com go playground validator v is a library for validating structs and fields github com joho godotenv is a library for loading environment variableStructuring our applicationIt is essential to have a good project structure as it makes the codebase maintainable and seamless for anyone to read or manage To do this we must create an api cmd and data folder in our project directory api is for structuring our API related filescmd is for structuring our application entry pointdata is for structuring our application data Setting up AppwriteTo get started we need to log into our Appwrite console click the Create project button input go appwrite as the name and then Create Create a Database Collection and Add AttributesAppwrite ships a scalable and robust database that we can use in building our project management API To do this first navigate to the Database tab click the Create database button input project as the name and Create Secondly we need to create a collection for storing our projects To do this click the Create collection button input project collection as the name and then click Create Lastly we need to create attributes to represent our database fields To do this we need to navigate to the Attributes tab and create attributes for each of the values shown below Attribute keyAttribute typeSizeRequirednameStringYESdescriptionStringYESAfter creating the attributes we see them as shown below Create an API keyTo securely connect to Appwrite we need to create an API key To do this we need to navigate to the Overview tab scroll to the Integrate With Your Server section and click the API Key button Next input api go as the name click the Next button select Database as the required scope and Create Leveraging Appwrite to build the project management APIs in GoWith our project fully set up on Appwrite we can now use the database without spinning up any server or managing any other technical overhead Set up Environment VariableTo securely connect to our Appwrite provisioned server Appwrite provides an endpoint and sets of unique IDs that we can use to perform all the required actions To set up the required environment varaibles we need to create a env file in the root directory and add the snippet below API KEY lt REPLACE WITH API KEY gt PROJECT ID lt REPLACE WITH PROJECT ID gt DATABASE ID lt REPLACE WITH DATABASE ID gt COLLECTION ID lt REPLACE WITH COLLECTION ID gt We can get the required API key and IDs from our Appwrite console as shown below Create the API modelsNext we need to create models to represent our application data To do this we need to create a model go file inside the data folder and add the snippet below package datatype Project struct Id string json id omitempty Name string json name omitempty Description string json description omitempty type ProjectRequest struct Name string json name omitempty Description string json description omitempty type ProjectResponse struct Id string json id omitempty CollectionId string json collectionId omitempty type JsonAPIBody struct DocumentId string json documentId omitempty Data ProjectRequest json data omitempty The snippet above creates a Project ProjectRequest ProjectResponse and JsonAPIBody struct with the required properties to describe requests and response types Create the API routesWith the models fully set up we need to navigate to the api folder and create a route go file for configuring the API routes and add the snippet below package apiimport github com gin gonic gin type Config struct Router gin Engine func app Config Routes routes will come here The snippet above does the following Imports the required dependency Creates a Config struct with a Router property to configure the application methods Creates a Routes function that takes in the Config struct as a pointerCreate the API helpersWith our application models fully set up we now use them to create our application logic To do this we need to create a helper go file inside the API folder and add the snippet below package apiimport log net http os github com gin gonic gin github com go playground validator v github com joho godotenv type jsonResponse struct Status int json status Message string json message Data any json data func GetEnvVariable key string string err godotenv Load if err nil log Fatal Error loading env file return os Getenv key func app Config validateJsonBody c gin Context data any error var validate validator New validate the request body if err c BindJSON amp data err nil return err validate with the validator library if err validate Struct amp data err nil return err return nil func app Config writeJSON c gin Context status int data any c JSON status jsonResponse Status status Message success Data data func app Config errorJSON c gin Context err error status int statusCode http StatusBadRequest if len status gt statusCode status c JSON statusCode jsonResponse Status statusCode Message err Error The snippet above does the following Imports the required dependencies Creates a jsonResponse struct to describe the API response Creates a GetEnvVariable function that uses godotenv package to load and get environment variable Creates a validateBody function that takes in the Config struct as a pointer and returns an error Inside the function we validate that request data are in the correct format and also use the validator library to validate and check for the required fields Creates a writeJSON function that takes in the Config struct as a pointer and uses the jsonResponse struct to construct API response when there s no error Creates a errorJSON function that takes in the Config struct as a pointer and uses the jsonResponse struct to construct API response when there s an errorCreate the API servicesWith our application models fully set up we now use them to create our application logic To do this we need to create a service go file and update it by doing the following First we need to import the required dependencies create environment variables and create a function for creating a project package apiimport bytes encoding json fmt go appwrite data io ioutil net http get details from environment variablevar projectId GetEnvVariable PROJECT ID var databaseId GetEnvVariable DATABASE ID var collectionId GetEnvVariable COLLECTION ID var apiKey GetEnvVariable PROJECT ID func app Config createProject newProject data ProjectRequest data ProjectResponse error url fmt Sprintf databaseId collectionId createdProject data ProjectResponse jsonData data JsonAPIBody DocumentId unique Data newProject postBody json Marshal jsonData bodyData bytes NewBuffer postBody making the request client amp http Client req http NewRequest POST url bodyData req Header Add Content Type application json req Header Add X Appwrite Key apiKey req Header Add X Appwrite Project projectId resp err client Do req if err nil return nil err body err ioutil ReadAll resp Body if err nil return nil err err json Unmarshal byte body amp createdProject if err nil return nil err return amp createdProject nil The snippet above does the following Imports the required dependencies Creates required environment variables Creates a createProject function that takes in the Config struct as a pointer and returns either the created project details or an error The functions also configure the Appwrite s provisioned server URL by including the required environment variables adds required headers and makes a request PS The unique tag specified when creating a project tells Appwrite to autogenerate the project ID Secondly we need to add a getProject function that uses similar logic as the createProject function to get the details of a project import goes herefunc app Config createProject newProject data ProjectRequest data ProjectResponse error createProject code goes here func app Config getProject documentId string data Project error url fmt Sprintf databaseId collectionId documentId projectDetail data Project making the request client amp http Client req http NewRequest GET url nil req Header Add Content Type application json req Header Add X Appwrite Key apiKey req Header Add X Appwrite Project projectId resp err client Do req if err nil return nil err body err ioutil ReadAll resp Body if err nil return nil err err json Unmarshal byte body amp projectDetail if err nil return nil err return amp projectDetail nil Thirdly we need to add a updateProject function that uses similar logic as the createProject function to update the details of a project import goes herefunc app Config createProject newProject data ProjectRequest data ProjectResponse error createProject code goes here func app Config getProject documentId string data Project error getProject code goes here func app Config updateProject updatedProject data ProjectRequest documentId string data ProjectResponse error url fmt Sprintf databaseId collectionId documentId updates data ProjectResponse jsonData data JsonAPIBody Data updatedProject postBody json Marshal jsonData bodyData bytes NewBuffer postBody making the request client amp http Client req http NewRequest PATCH url bodyData req Header Add Content Type application json req Header Add X Appwrite Key apiKey req Header Add X Appwrite Project projectId resp err client Do req if err nil return nil err body err ioutil ReadAll resp Body if err nil return nil err err json Unmarshal byte body amp updates if err nil return nil err return amp updates nil Lastly we need to add a deleteProject function that uses similar logic as the createProject function to delete the details of a project import goes herefunc app Config createProject newProject data ProjectRequest data ProjectResponse error createProject code goes here func app Config getProject documentId string data Project error getProject code goes here func app Config updateProject updatedProject data ProjectRequest documentId string data ProjectResponse error updateProject code goes here func app Config deleteProject documentId string string error url fmt Sprintf databaseId collectionId documentId making the request client amp http Client req http NewRequest DELETE url nil req Header Add Content Type application json req Header Add X Appwrite Key apiKey req Header Add X Appwrite Project projectId resp err client Do req if err nil return err err ioutil ReadAll resp Body if err nil return err return documentId nil Create the API handlersWith that done we can use the services to create our API handlers To do this we need to create a handler go file inside api folder and add the snippet below package apiimport context fmt go appwrite data net http time github com gin gonic gin const appTimeout time Second func app Config createdProjectHandler gin HandlerFunc return func ctx gin Context cancel context WithTimeout context Background appTimeout var payload data ProjectRequest defer cancel app validateJsonBody ctx amp payload newProject data ProjectRequest Name payload Name Description payload Description data err app createProject amp newProject if err nil app errorJSON ctx err return app writeJSON ctx http StatusCreated data func app Config getProjectHandler gin HandlerFunc return func ctx gin Context cancel context WithTimeout context Background appTimeout projectId ctx Param projectId defer cancel data err app getProject projectId if err nil app errorJSON ctx err return app writeJSON ctx http StatusOK data func app Config updateProjectHandler gin HandlerFunc return func ctx gin Context cancel context WithTimeout context Background appTimeout projectId ctx Param projectId var payload data ProjectRequest defer cancel app validateJsonBody ctx amp payload newProject data ProjectRequest Name payload Name Description payload Description data err app updateProject amp newProject projectId if err nil app errorJSON ctx err return app writeJSON ctx http StatusOK data func app Config deleteProjectHandler gin HandlerFunc return func ctx gin Context cancel context WithTimeout context Background appTimeout projectId ctx Param projectId defer cancel data err app deleteProject projectId if err nil app errorJSON ctx err return app writeJSON ctx http StatusAccepted fmt Sprintf Project with ID s deleted successfully data The snippet above does the following Imports the required dependencies Creates a createdProjectHandler getProjectHandler updateProjectHandler and deleteProjectHandler functions that returns a Gin gonic handler and takes in the Config struct as a pointer Inside the returned handler we defined the API timeout used the helper functions and the service created earlier to perform the corresponding action Update the API routes to use handlersWith that done we can now update the routes go file with the handlers as shown below package apiimport github com gin gonic gin type Config struct Router gin Engine func app Config Routes app Router POST project app createdProjectHandler app Router GET project projectId app getProjectHandler app Router PATCH project projectId app updateProjectHandler app Router DELETE project projectId app deleteProjectHandler Putting it all togetherWith our API fully set up we need to create the application entry point To do this we need to create a main go file inside the cmd folder and add the snippet below package mainimport go appwrite api github com gin gonic gin func main router gin Default initialize config app api Config Router router routes app Routes router Run The snippet above does the following Imports the required dependencies Creates a Gin router using the Default configuration Initialize the Config struct by passing in the Router Adds the route and run the application on port With that done we can start a development server using the command below go run cmd main goWe can also confirm the project management data by checking the collection on Appwrite ConclusionThis post discussed what Appwrite is and provided a detailed step by step guide to use it to build a project management API in Go These resources may also be helpful Appwrite official documentation Appwrite database API Gin gonic web framework Go HTTP Library Time saving with Appwrite |
2023-08-18 08:21:34 |
海外TECH |
DEV Community |
A Comprehensive Guide For Creating Silky Smooth Animations Using Flutter. |
https://dev.to/yatendra2001/a-comprehensive-guide-for-creating-silky-smooth-animations-using-flutter-1fmj
|
A Comprehensive Guide For Creating Silky Smooth Animations Using Flutter When it comes to mobile development the user experience is paramount One of the most crucial aspects of this experience is the fluidity of animations Flutter Google s UI toolkit has taken the app development world by storm partly because of its ability to deliver smooth jank free animations at fps This means your animations remain fluid and appealing even on older devices Ready to elevate your Flutter app with engaging animations Let s dive in Why fps Before diving into the how let s address the why The human eye perceives motion smoothly at around frames per second fps By running animations at this rate Flutter ensures that transitions transforms and other effects look lifelike and smooth enhancing the user s overall experience Getting Started with Flutter AnimationsBasic Understanding Flutter s animation system is built on AnimationController an object that generates a new value at each frame It s used in conjunction with Tween objects that define the start and end values Animation Widgets For those who prefer a more straightforward approach Flutter provides a range of widgets like AnimatedContainer AnimatedOpacity and AnimatedPositioned that hide the complexities of animations but deliver fantastic results Custom Animations For developers who desire more control there s the CustomPainter class which allows you to create animations from scratch Crafting Your First Animation Setup dartAnimationController controller Animation lt double gt animation overridevoid initState super initState controller AnimationController duration const Duration seconds vsync this animation Tween lt double gt begin end animate controller Play it dartcontroller forward Visualise Use the FadeTransition widget to see your animation in action dartFadeTransition opacity animation child FlutterLogo size Tips for Stunning AnimationsEasing Curves Not all movements are linear Use Flutter s Curves class to apply easing functions making your animations feel more natural Combine Multiple Animations Use the AnimationGroup or sequence multiple Tweens to create complex choreographed animations Hero Transitions A personal favorite Flutter s Hero widget enables the creation of seamless transitions between screens Listening to Animations You can add listeners to your animation to perform actions at different stages or values Infinite Loops amp Reversed Animations Make animations loop indefinitely or play in reverse with simple commands like controller repeat or controller reverse Performance ConsiderationsAvoid Offscreen Rendering Only animate what s visible Offscreen animations can unnecessarily use up resources Use the shouldRepaint method wisely If using CustomPainter make sure to properly override the shouldRepaint method to avoid unnecessary repaints Profile your animations Utilise Flutter s built in performance profiling tools to ensure your animations remain smooth across all devices ConclusionFlutter s commitment to fps animations isn t just a technical specificationーit s a dedication to superior user experience By making it easy for developers to create and integrate smooth animations Flutter enables the creation of apps that are not only functional but also visually delightful As you embark on your Flutter animation journey always remember the key to a great animation is subtlety It s not always about the most complex or the longest animation but rather the most fitting one for the user s experience Now go ahead and bring your Flutter app to life with some mesmerising animations Before We Go Hey thanks for sticking around If this post was your jam imagine what s coming up next I m launching a YouTube channel and trust me you don t want to miss out Give it a look and maybe even hit that subscribe button Videos will start dropping soon About me I am a coder with a keen interest in fixing real world problems through shipping tech products I love to read books I have read multiple books on start ups and productivity Some of my favourite reads are Zero to One Steve Jobs The Almanack of Ravikant and Hooked Nothing excites me more than exchanging opinions through productive conversations youtube com Until we meet again code on and stay curious Got any doubt or wanna chat React out to me on twitter or linkedin |
2023-08-18 08:11:25 |
金融 |
ニッセイ基礎研究所 |
マレーシア経済:23年4-6月期の成長率は前年同期比+2.9%~内需は底堅いが、外需の悪化により低成長に |
https://www.nli-research.co.jp/topics_detail1/id=75867?site=nli
|
マレーシア経済年月期の成長率は前年同期比内需は底堅いが、外需の悪化により低成長に年月期の実質GDP成長率は前年同期比増前期同増と低下し、市場予想同増を下回る結果となった図表。 |
2023-08-18 17:39:28 |
金融 |
ニッセイ基礎研究所 |
負の数について(その2)-負の数は日常生活の中等でどのように使用されているのか- |
https://www.nli-research.co.jp/topics_detail1/id=75877?site=nli
|
負の数やマイナスについては、これまで紹介してきた例に見られたように、負やマイナスそのものが一定程度、我々の感覚にフィットするような形で意味を有している場合だけでなく、あくまでも「均衡点」からの乖離の方向性を示すために、正の数やプラスの逆として、負の数やマイナスを使用している場合もある。 |
2023-08-18 17:22:07 |
ニュース |
BBC News - Home |
Energy bills predicted to drop in autumn |
https://www.bbc.co.uk/news/business-66542340?at_medium=RSS&at_campaign=KARANGA
|
consultancy |
2023-08-18 08:28:28 |
ニュース |
BBC News - Home |
Retail sales drop in July as rain dampens demand |
https://www.bbc.co.uk/news/business-66536000?at_medium=RSS&at_campaign=KARANGA
|
clothing |
2023-08-18 08:02:04 |
ニュース |
BBC News - Home |
Delia Smith remembers photo with five-year-old Lioness |
https://www.bbc.co.uk/news/uk-england-norfolk-66539538?at_medium=RSS&at_campaign=KARANGA
|
excellence |
2023-08-18 08:06:33 |
ニュース |
Newsweek |
米人気バンド、ライブ中のファンサービスが裏目に出て「大ブーイング」浴びる...大荒れの会場から無言で退場 |
https://www.newsweekjapan.jp/stories/culture/2023/08/post-102448.php
|
「ジョージアの皆さん、私たちには決して誰かを不快にさせる意図はありませんでした私たちには、ファンをステージに招いてドラムを叩いてもらう長年の伝統があり、客席からの最初の反応を見て、今夜の観客の一人がステージに上がっても問題ないと受け取りました」「ザ・キラーズの観客とファン全員が『兄弟姉妹』であることを示唆するコメントが誤解を招きかねないものであったことは認識しています。 |
2023-08-18 17:28:00 |
ニュース |
Newsweek |
【ランキング】過去10年、最も読まれた「ビジネス書」は? 3200冊の頂点は「アウトプット」の名著! |
https://www.newsweekjapan.jp/stories/business/2023/08/10-3200.php
|
位完訳つの習慣『完訳つの習慣』著者スティーブン・R・コヴィー翻訳フランクリンコヴィージャパン出版社キングベアー出版要約を読む※画像をクリックするとアマゾンに飛びます年の年間ランキングで位を獲得した『完訳つの習慣』が、年間ランキングでも位年間ランキングにはその年に公開した本が選ばれることが多い中、本書の公開はなんと年月。 |
2023-08-18 17:22:00 |
IT |
週刊アスキー |
“飲むモンブラン”など期間限定のスイーツドリンク3種が登場 |
https://weekly.ascii.jp/elem/000/004/150/4150538/
|
期間限定 |
2023-08-18 17:50:00 |
IT |
週刊アスキー |
ASUS、メッシュ機能に対応するWi-Fi 6対応ルーター「RT-AX57」「RT-AX5400」を8月25日に発売 |
https://weekly.ascii.jp/elem/000/004/150/4150560/
|
機能 |
2023-08-18 17:40:00 |
IT |
週刊アスキー |
ASUS、AiMesh対応のWi-Fi 6ルーター「RT-AX59U」 |
https://weekly.ascii.jp/elem/000/004/150/4150546/
|
aimesh |
2023-08-18 17:30:00 |
海外TECH |
reddit |
What should be added? |
https://www.reddit.com/r/Eldenring/comments/15ue44d/what_should_be_added/
|
What should be added Is there something that you think if they add this in the next update it will be complete Mine s a gameplay mechanic mid air parry I would love to have the ability to parry enemies those that can be normally while they are jumping I would love to see the look on an invaders face as they jump in with two vykes spears just to get a dagger through the chest submitted by u Pro Moriarty to r Eldenring link comments |
2023-08-18 08:03:06 |
コメント
コメントを投稿