IT |
ITmedia 総合記事一覧 |
[ITmedia ビジネスオンライン] 経団連、韓国全経連とパートナーシップ DX対応などに共同で基金設立 |
https://www.itmedia.co.jp/business/articles/2303/16/news191.html
|
itmedia |
2023-03-16 21:22:00 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
Greengrass V2で発生するMqttException: Time limit between request and response has been exceededへの対応方法 |
https://qiita.com/yomon8/items/f004d41bd96ba91f453d
|
between |
2023-03-16 21:32:42 |
Docker |
dockerタグが付けられた新着投稿 - Qiita |
VSCode + Rust + Devcontainerでrust-analyzerを使おうとしたら動いてくれなかった。 |
https://qiita.com/kogarasi217/items/d6afecbf6bf2c28bc2ee
|
devcontainer |
2023-03-16 21:17:37 |
技術ブログ |
Developers.IO |
Amazon ECS のタスク定義リビジョンが 削除をサポートして、興奮が止まらなかったためLTしてきた #AWSEngineerMeetsup2023 |
https://dev.classmethod.jp/articles/aws-engineer-meets-up-2023-lt-ecs/
|
amazonecs |
2023-03-16 12:53:33 |
技術ブログ |
Developers.IO |
OpenAI APIで、問題のある発言を検出するmoderationモデルを試してみた |
https://dev.classmethod.jp/articles/openai-api-moderation-model/
|
dmodelthatcandetectwheth |
2023-03-16 12:28:23 |
技術ブログ |
Developers.IO |
AWS SAM CLIで「Docker is unreachable. Docker needs to be running to build inside a container.」のエラーが発生したので対処した |
https://dev.classmethod.jp/articles/aws-sam-cli-resolve-docker-error/
|
AWSSAMCLIで「DockerisunreachableDockerneedstoberunningtobuildinsideacontainer」のエラーが発生したので対処したある日突然、AWSSAMCLIのbuildコマンドを実行すると、失敗するようになりました。 |
2023-03-16 12:16:46 |
海外TECH |
MakeUseOf |
How Tech Can Improve Your Circadian Rhythm for Better Sleep |
https://www.makeuseof.com/how-tech-improve-circadian-rhythm-better-sleep/
|
healthy |
2023-03-16 12:15:16 |
海外TECH |
MakeUseOf |
GPT-4 vs. GPT-3.5: 5 Key Differences Explained |
https://www.makeuseof.com/gpt-4-vs-gpt-35-differences-explained/
|
differences |
2023-03-16 12:10:15 |
海外TECH |
DEV Community |
Parsing Parquet stored in S3 with Go |
https://dev.to/aws-builders/parsing-parquet-stored-in-s3-with-go-2k7p
|
Parsing Parquet stored in S with GoI know it s but you can t get away from processing files In a world of Events APIs and Sockets files still exist as a medium for moving data around And a very common one at that In recent years I ve found myself dealing with Apache Parquet format files And more specifically I often end up dealing with them coming out of AWS S If you are a consumer at all of the AWS DMS product when replicating you will find out that parquet format is a great way to deal with your data as its designed for efficient storage and retrieval There aren t too many options for parsing a parquet file with Golang but I ve find a library I really enjoy and the article below will describe how to make the best use of it As always here is the link to the Github Repository if you want to skip ahead What is Apache ParquetApache Parquet is an open source column oriented data file format designed for efficient data storage and retrieval It provides efficient data compression and encoding schemes with enhanced performance to handle complex data in bulk Parquet is available in multiple languages including Java C Python etc… Downloading the Parquet FileFor working with S I really like the Golang library called smanager Here is the SDK documentation What I like about it is that is a higher level abstraction on top of the normal S library For instance to download a file from a bucket you simply do something like thisdownloader smanager NewDownloader sess err downloader DownloadWithContext ctx file amp s GetObjectInput Bucket aws String bucket Key aws String key The downloader will put the file in the path you specify in the DownloadWithContext method in the “file parameter It s just a string Parsing File with GolangParsing an Apache parquet file with Golang will seem super family to other interface based unmarshalling like DyanamoDB as well as JSON For similarities with DDB you can see how to do this in the referenced articleThe parse function looks like thisfunc ParseFile fileName string ParquetUser error fr err floor NewFileReader fileName var fileContent ParquetUser if err nil return nil err for fr Next rec amp ParquetUser if err fr Scan rec err nil continue along is it s just a malformed row if errors Is err ErrIllegalRow continue return nil err fileContent append fileContent rec return fileContent nil First off notice that I open a FileReader from the parquet go library From there I create a slice for holding the output of what s being unmarshalled Then we loop and scan And for each call to Scan the unmarshall method that implements the parquet go interface is called That method looks like thisfunc r ParquetUser UnmarshalParquet obj interfaces UnmarshalObject error id err obj GetField id Int if err nil return errors New fmt Sprintf error unmarshalling row on field id firstName err obj GetField firstName ByteArray if err nil return errors New fmt Sprintf error unmarshalling row on field firstName lastName err obj GetField lastName ByteArray if err nil return errors New fmt Sprintf error unmarshalling row on field lastName role err obj GetField role ByteArray if err nil return errors New fmt Sprintf error unmarshalling row on field role note this is a time Time but comes across as an Int lastUpdated err obj GetField lastUpdated Int if err nil return errors New fmt Sprintf error unmarshalling row on field lastUpdated parsed time UnixMicro lastUpdated if err nil log WithFields log Fields err err Error error parsing time return errors New fmt Sprintf lastUpdated is not in the right format r Id int id r FirstName string firstName r LastName string lastName r Role string role r LastUpdated parsed return nil Really not too much going on up there outside of fetching fields and then putting them into the structs fields The one main thing to point out that is a “gotcha is that the LastUpdated field is a time Time The parquet go library treats time as an Int Note this line for converting what comes out of the library into a time Timeparsed time UnixMicro lastUpdated Running the ProgramFrom there it s just a matter of putting it all together Here s the body of mainfunc main file err DownloadFile context TODO sess bucket key if err nil log WithFields log Fields err err Error error downloading the file contents err ParseFile file if err nil log WithFields log Fields err err Error error parsing the file err DeleteFile file if err nil log WithFields log Fields err err Error error deleting the file for c range contents log WithFields log Fields record c Debug printing the record In a nutshell … Download the file Parse the file Delete the file Loop and print output Helpful TipsI m using VSCode a lot more these days and I m sort of weaning myself off of Goland So you ll find a launch json file in the vscode directory There you can set the environment variables you need to run the programViewing parquet files is really a pain I ve found There are few tools that I ve liked Online viewers get in the way of my workflow BUT I found this VSCode plugin to be FANTASTIC Here is the link to the marketplace Wrapping UpHopefully you found this helpful Like I mentioned in the beginning files aren t going away as a data medium And Apache s Parquet is an excellent one when you deal with larger datasets and it ll be one of the options you can choose when replicating with DMS as the output I continue to just love Golang s simplicity and performance as well as the development experience The parquet go library has a few quirks but overall star rating for me |
2023-03-16 12:39:04 |
海外TECH |
DEV Community |
Responsive Website using CSS and JS | Full of Animations |
https://dev.to/themodernweb/responsive-website-using-css-and-js-full-of-animations-3ico
|
Responsive Website using CSS and JS Full of AnimationsIn this article you will learn to create this awesome fully responsive travel website using only HTML CSS and Javascript It is fully responsive and has animation on scroll smooth scrolling tile animated background images slider and a lot of stuff You can download the code So without wasting time let s see how to code this Video TutorialVideo tutorial if you like to watch a video and follow along Let s goSo to start coding or following this article First you need to setup the folder For this project we will use Google Fonts AOS library for animations and Fontawesome for icons So you can either add CDNs manually or you can download the start files from this repoRepo also includes all the imagesSo I hope you have the starting files now Let s start with our navbar first NavbarTo create navbar we need to make a header and that header will contain the navbar as well as the main section index html lt header gt lt nav class navbar gt lt ul class links container gt lt li class link item gt lt a href travel gt Travel lt a gt lt li gt lt li class link item gt lt a href explore section gt Explore lt a gt lt li gt lt li class link item gt lt a href hero section gt lt img src img logo png class logo alt gt lt a gt lt li gt lt li class link item gt lt a href services gt Services lt a gt lt li gt lt li class link item gt lt a href booknow gt Book Now lt a gt lt li gt lt ul gt lt nav gt lt header gt The value of href of links are id of the sections that we will create next Giving ids as a link will take you to that section after clicking on the link But to add a smooth scrolling effect to the navbar links Make sure you give scroll behaviour to the html style csshtml scroll behavior smooth body font family Poppins sans serif background overflow x hidden navbar position fixed top left z index width height px padding px vw navbar bg background links container display flex align items center justify content center list style none logo height px margin top px link item margin px transition s link item a color fff text decoration none padding px link item hover transform scale Output Hero SectionNow to create hero section we will use main tag inside header after nav index html lt main class hero section id hero section gt lt div class hero section content data aos fade up gt lt h class hero section title gt wonderful experience lt h gt lt p class hero section sub heading gt Lorem ipsum dolor sit amet consectetur adipiscing elit lt p gt lt div gt lt scroll down img gt lt img src img down arrow png class scroll down icon alt scroll down indicator gt lt main gt If you notice i used data aos attribute in code This attribute is custom provided by AOS library to add sroll animations In this case I am adding fade up effect To make it work though you have to put AOS init in app js along with the CDNs provided in the github repo Make sure you download the repo to start style css hero section width height vh position relative display flex justify content center align items center color fff hero section title font family Roboto Slab serif font weight font size px text align center text transform capitalize hero section sub heading text align center text transform capitalize margin px font size px scroll down icon position absolute bottom left transform translateX width px animation down ease s infinite keyframes down from bottom to bottom OutputNow the best part of this whole website the background image slider Image SliderTo create Image Slider first we will create a img below the content and then above img we will create divs of background black in a grid Those divs will cover whole image when needed So basically we will show those divs and hide them and in between we will change the background image using JS For this make background div inside main before hero section content index html lt div class background gt lt img src img img png class background image alt hero section image gt lt grid gt lt div class grid slider gt lt div class grid item hide gt lt div gt lt div class grid item hide gt lt div gt lt div class grid item hide gt lt div gt lt div class grid item hide gt lt div gt lt div class grid item hide gt lt div gt lt div class grid item hide gt lt div gt lt div gt lt div gt And give some styles background position absolute top left width height z index background image position absolute top left width height object fit cover z index background before background after content position absolute left width height background before top left background var gradient top background after bottom background var gradient bottom grid slider width height display grid grid template columns repeat fr grid template rows repeat fr grid item width height background opacity transition s grid item hide opacity If you see above code I used before and after to create some linear gradients over the image to create the depth The variables I used are in the CSS file of repo OutputNow to make this slider working Just add this simple JS code inside app js file header slider images arrayconst sliderImgs img png img png img png img png img png img png let sliderImage document querySelector background image let sliderGrids document querySelectorAll grid item let currentImage setInterval gt changeSliderImage const changeSliderImage gt sliderGrids map gridItem index gt setTimeout gt gridItem classList remove hide setTimeout gt if index sliderGrids length if currentImage gt sliderImgs length currentImage else currentImage sliderImage src img sliderImgs currentImage sliderGrids map item i gt setTimeout gt item classList add hide i index After adding this the slider will work In above code we are basically using timeout to hide and show the divs and in between changing the src of the image Output Explore SectionTo create next section which is explore section Its actually simple Just add this in index html file index html lt section class explore section id explore section gt lt h class section title data aos fade up gt Explore the world lt h gt lt p class section para data aos fade up gt Lorem ipsum dolor sit amet consectetur adipiscing elit Ut rutrum sem augue vitae bibendum nibh tempor nec Aenean quis commodo lectus in rhoncus lorem lt p gt lt grid gt lt div class tours container gt lt div class tour card data aos fade up gt lt img src img australia png class tour img alt tour image gt lt div class tour body gt lt h class tour name gt Australia lt h gt lt p class tour action gt View city lt p gt lt div gt lt div gt lt div class tour card data aos fade up gt lt img src img maldives png class tour img alt tour image gt lt div class tour body gt lt h class tour name gt Maldives lt h gt lt p class tour action gt View city lt p gt lt div gt lt div gt lt div class tour card data aos fade up gt lt img src img paris png class tour img alt tour image gt lt div class tour body gt lt h class tour name gt Paris lt h gt lt p class tour action gt View city lt p gt lt div gt lt div gt lt div class tour card data aos fade up gt lt img src img dubai png class tour img alt tour image gt lt div class tour body gt lt h class tour name gt Dubai lt h gt lt p class tour action gt View city lt p gt lt div gt lt div gt lt div class tour card data aos fade up gt lt img src img india png class tour img alt tour image gt lt div class tour body gt lt h class tour name gt India lt h gt lt p class tour action gt View city lt p gt lt div gt lt div gt lt div class tour card data aos fade up gt lt img src img italy png class tour img alt tour image gt lt div class tour body gt lt h class tour name gt Italy lt h gt lt p class tour action gt View city lt p gt lt div gt lt div gt lt div gt lt section gt style css explore section explore section position relative width padding px vw color fff section title font size px font weight text align center text transform capitalize section para width min width px display block margin px auto text align center line height px opacity tours container position relative width height px display grid grid template columns repeat fr grid template rows repeat fr grid gap px margin top px tour card width height position relative border radius px box shadow overflow hidden padding px display flex align items end tour card nth child grid row span tour card last child grid column span tour img position absolute top left width height object fit cover transition s z index tour card hover tour img opacity transform scale tour name font weight tour action margin left px font size px position relative tour action before content position absolute left px top px background url img pin png width px height px background size contain OutputIf you see your output you ll notice that the navbar and explore sections are overlapping and navbar is not fully readable To fix that we need to add background to the navbar after a certain amount of scroll using JS app js navconst navbar document querySelector navbar window addEventListener scroll gt if scrollY gt navbar classList add bg else navbar classList remove bg and after adding this you ll see after of scrollY navbar changing its background color Service SectionIn this section for icons I am using fontawesome so make sure you have its CDN to be able to see the icons in your code index html lt section class services section id services gt lt h class section title data aos fade up gt Why Us lt h gt lt p class section para data aos fade up gt Lorem ipsum dolor sit amet consectetur adipiscing elit lt p gt lt services grid gt lt div class serives grid gt lt div class service card data aos fade up gt lt div class circle gt lt div gt lt i class fa solid fa earth americas card icon gt lt i gt lt p class service text gt We are based all over the world lt p gt lt div gt lt div class service card data aos fade up gt lt div class circle gt lt div gt lt i class fa solid fa coins card icon gt lt i gt lt p class service text gt Travel the World Without thinking lt p gt lt div gt lt div class service card data aos fade up gt lt div class circle gt lt div gt lt i class fa solid fa book open card icon gt lt i gt lt p class service text gt Get to know about local cultures lt p gt lt div gt lt div class service card data aos fade up gt lt div class circle gt lt div gt lt i class fa solid fa person snowboarding card icon gt lt i gt lt p class service text gt Have you best experience lt p gt lt div gt lt div gt lt div class bg circle gt lt div gt lt div class travel grid id travel gt lt img src img img png data aos fade up alt gt lt img src img img png data aos fade up alt gt lt img src img img png data aos fade up alt gt lt img src img img png data aos fade up alt gt lt img src img img png data aos fade up alt gt lt img src img img png data aos fade up alt gt lt img src img australia png data aos fade up alt gt lt img src img dubai png data aos fade up alt gt lt img src img maldives png data aos fade up alt gt lt img src img paris png data aos fade up alt gt lt img src img india png data aos fade up alt gt lt img src img italy png data aos fade up alt gt lt div gt lt section gt style css services section services section color fff padding px vw serives grid width display grid grid template columns repeat fr grid gap px service card margin top px width height px border radius px border px solid DDD background padding px display flex flex direction column align items center justify content center gap px overflow hidden position relative card icon text align center font size px z index service text text align center padding px z index circle position absolute top left width height clip path circle at transition s service card nth child circle background url img img png background size cover service card nth child circle background url img img png background size cover service card nth child circle background url img img png background size cover service card nth child circle background url img img png background size cover service card hover circle clip path circle at travel grid width columns column gap px margin top px travel grid img width height auto object fit cover margin bottom px border radius px bg circle z index position absolute width px height px border radius background var sphere gradient one right px Output Book Section and footerAnd the last but not least book now and footer index html lt contact section gt lt section class book section id booknow gt lt div class book content data aos fade up gt lt h class book now title gt Book your travel today lt h gt lt p class book now text gt Give yourself and your family a peacfull and wonderful vacation this holiday lt p gt lt button class book now gt book now lt button gt lt div gt lt div class bg circle gt lt div gt lt img src img book png data aos fade up class book now img alt gt lt section gt lt footer gt lt footer class footer gt lt img src img logo png class footer logo alt gt lt div class footer text gt lt p gt Travel the world on this holiday lt p gt lt p gt Email support travel com lt p gt lt p gt Phone lt p gt lt div gt lt p class copyright line gt This design is a concept design Made by Modern Web ️ lt p gt lt footer gt style css book now section book section position relative display flex padding vw align items center width height vh gap px book now img position absolute width right book content width color fff book now title font size px font weight width px book now text width px opacity line height px margin px book now position relative padding px px outline none border none background text transform capitalize color fff border radius px border top left radius border bottom left radius font size px cursor pointer overflow hidden book now before content position absolute top px left px width px height background fff opacity transform rotate deg transition s book now hover before left bg circle z index position absolute width px height px border radius background var sphere gradient two left px bottom px footer width padding px vw background display flex justify content space evenly flex wrap wrap align items center position relative footer logo width px opacity footer text color fff opacity font size px footer text p margin px copyright line width background color fff text transform capitalize text align center position absolute bottom left padding px OutputSo we are done now to make this website responsive Just use media query of CSS like this style css tab view media screen and max width px link item margin px hero section title font size px tours container height px grid template columns repeat fr grid template rows repeat fr tour card last child grid column span tour card nth child grid row span serives grid grid template columns repeat fr service card nth child service card nth child margin top travel grid columns book now img width footer logo width px footer text font size px much smaller device media screen and max width px navbar height auto link item margin top px text align center link item nth child margin px px px link item a padding px margin auto display block section title font size px grid slider grid template rows repeat fr grid template columns repeat fr hero section sub heading font size px section para width tours container height px grid template columns repeat fr grid template rows repeat fr tour card nth child grid row auto tour card last child grid column span tour card nth child grid row span serives grid grid template columns repeat fr service card nth child margin top travel grid columns book section height auto padding px vw bg circle display none bg circle z index book now img width opacity important book content width z index text align center book now title book now text width And the website is done Its fully responsive now too So we are done we made this awesome responsive travel website If you stuck anywhere or run into some error feel free to leave a comment or DM me on instagram I hope you like this article you like the website design and the tutorial If this helped you in someway make sure you follow me on my instagram and youtube You can checkout my youtube channel I create lots of content like this including fullstack ecommerce website and fullstack blogging website You can download the code Thanks for reading |
2023-03-16 12:23:53 |
海外TECH |
DEV Community |
refine vs Blitz.js |
https://dev.to/refine/refine-vs-blitzjs-18h2
|
refine vs Blitz jsAuthor Madars BišsReact is a popular library for creating dynamic and interactive user interfaces Many frameworks have emerged from React to avoid the repetitive process of creating CRUD operations and other features for full stack applications In this article we will review two common solutions refine and Blitz By providing an advanced set of tools and features both aim to speed up and simplify the process of developing React apps We will take a closer look at how to set both up what are their internal builds how they handle the data sources how to implement the CRUD functionality add authentication and how to deploy them to production About frameworks refinerefine is a React based framework that is specifically designed to speed up the creation of data intensive applications It is an open source project meaning everyone can access and contribute the code By its core nature it is a headless framework that is based on a collection of hooks components and providers The core is fully decoupled from the UI and business logic meaning users have a fully flexible environment The refine framework was created in and has witnessed rapid growth and attracted an active community around it since then As of the time of the writing the framework has already reached around K GitHub stars BlitzBlitz is is a full stack web framework built on top of NextJS which means it preserves many of the core features like server side rendering static site generation and automatic code splitting Furthermore it is the NextJS toolkit that provides the necessary pieces to create feature rich applications adding features like authentication a type safe API layer and many more Blitz is also an open source project that allows users to access the code and allows to contribute Their community has generated a lot of impact as well and has grown rapidly over time since the creation in Installation guide refinerefine comes with the project starter tool which allows users to set up a fully working environment in minutes Run the command npm create refine app latest crud refine That will start the CLI wizard that will ask you to configure the project For the purpose of this tutorial pick the values as shown below The installation process should not take more than a minute Once it s done change the working directory to the newly created project by cd crud refine and run npm run dev to start up the developer server That should automatically open up a new browser window If it s not navigate to localhost manually and you will be presented with the refine welcome screen BlitzTo set up the Blitz app the user must first install the Blitz CLI You can do this by executing the command npm install g blitz or yarn global add blitz in your terminal Next run the command blitz new crud blitz This will start the terminal CLI wizard asking you to configure the project For the purpose of this tutorial pick the values as shown below After that change the working directory to the newly created project by running cd crud blitz and start the development server by running blitz dev Finally open your browser and navigate to localhost This should present you with a Blitz welcome screen Internal structure refinerefine file structure is as simple as it gets and they provide users with all the flexibility they would want to build upon The main building block for the whole app is the src folder It comes with the App tsx file with the following code import Refine from refinedev core import notificationProvider from refinedev antd import refinedev antd dist reset css import useAuth from auth auth react import routerBindings UnsavedChangesNotifier from refinedev react router v import dataProvider from refinedev simple rest import axios from axios import BrowserRouter from react router dom function App const isLoading user logout getIdTokenClaims useAuth if isLoading return lt span gt loading lt span gt const authProvider AuthBindings login async gt return success true logout async gt logout returnTo window location origin return success true onError async error gt console error error return error check async gt try const token await getIdTokenClaims if token axios defaults headers common Authorization Bearer token raw return authenticated true else return authenticated false error new Error Token not found redirectTo login logout true catch error any return authenticated false error new Error error redirectTo login logout true getPermissions async gt null getIdentity async gt if user return user avatar user picture return null return lt Refine dataProvider dataProvider notificationProvider notificationProvider Layout Layout ReadyPage ReadyPage catchAll lt ErrorComponent gt routerProvider routerProvider authProvider authProvider LoginPage Login gt export default App First the main Refine component and the necessary helper components like Layout ReadyPage and ErrorComponent are imported Then the style sheet file providers for data and router and auth components are imported In the App function first the auth logic is handled and then in the render block all of the imported helper components and providers are passed to the main Refine component as props To display the result on the screen all of the exported content from App tsx is imported and rendered to the DOM in the index tsx file import React from react import createRoot from react dom client import AuthProvider from auth auth react import reportWebVitals from reportWebVitals import App from App const container document getElementById root as HTMLElement const root createRoot container root render lt React StrictMode gt lt AuthProvider domain your auth domain address clientId your auth clientId redirectUri window location origin gt lt App gt lt AuthProvider gt lt React StrictMode gt Notice that the App component is wrapped into AuthProvider so that the authentication could be accessed throughout the whole app BlitzBlitz offers a more complicated framework like file structure where there are already pre defined ways how to handle and separate common concepts related to full stack applications The file structure looks as follows ├ーsrc │├ーauth ││├ーcomponents │││├ーLoginForm tsx│││└ーSignupForm tsx││├ーmutations │││├ーchangePassword ts│││├ーforgotPassword test ts│││├ーforgotPassword ts│││├ーlogin ts│││├ーlogout ts│││├ーresetPassword test ts│││├ーresetPassword ts│││└ーsignup ts││└ーvalidations ts│├ーcore ││├ーcomponents │││├ーForm tsx│││└ーLabeledTextField tsx││└ーlayouts ││└ーLayout tsx│├ーusers ││├ーhooks │││└ーuseCurrentUser ts││└ーqueries ││└ーgetCurrentUser ts│├ーpages ││├ーapi │││└ーrpc │││└ー blitz ts││├ーauth │││├ーforgot password tsx│││├ーlogin tsx│││└ーsignup tsx││├ー app tsx││├ー document tsx││├ー tsx││└ーindex tsx│├ーblitz client ts│└ーblitz server ts├ーdb │├ーmigrations │├ーindex ts│├ーschema prisma│└ーseeds ts├ーintegrations ├ーpublic │├ーfavicon ico │└ーlogo png├ーtest └ーsetup ts └ーutils tsxThe project structure is divided into multiple main blocks src db integrations public and test The core app code is featured in src which is further divided in auth consisting of the components and mutations for authentication core for form and layout components users for hooks and queries to handle the users and pages where all the new API and routes would be created The db folder includes all the necessary configuration schema and migration files for the database of your project If you use some third party libraries or code it s a great practice to separate them from the rest of the code Blitz has reserved the integrations folder for that purpose The public folder is for all the media assets and files that are served statically from the app s root URL There is also a dedicated test folder for tests that comes with setup and utility files to help you get started Data providers refinerefine comes with a fake data provider that is perfect for testing or creating some pages where you would need some placeholder data It is a simple REST API endpoint that contains sample data about users posts products categories etc and can be accessed via api fake rest refine dev If we click on any of the routes in the user interface we can see that each of them contains JSON data For example the products endpoint holds samples in the following format In order to use the data provider in the refine project the user needs to pass it to the Refine component in App tsx like this lt Refine dataProvider dataProvider gt If you followed the instructions for the installation wizard it should already be set up by refine automatically BlitzBlitz framework does not come with its own data provider but the great thing is that during the installation it configures the SQLite database which is more than enough for testing and experimentation The database configuration is available in the schema prisma file You will find it in the db folder in the app root It includes the database configuration and models used in the app datasource db provider sqlite url env DATABASE URL generator client provider prisma client js model User id Int id default autoincrement createdAt DateTime default now name String email String unique Another great thing is that with Blitz you can run blitz prisma studio to open the web interface in the browser and see all the data in your database If the UI does not open automatically navigate to localhost Authentication refineCreate a new free Auth account and log in Create a new web application It will give you domain client ID and secret ID information Scroll down and add localhost to the allowed URLs list Next switch back to your code editor and create a new file env in your project root add the variables REACT APP AUTH DOMAIN and REACT APP AUTH CLIENT ID and assign the values from the Auth dashboard Next edit the index tsx file in the src folder so it now looks like this import React from react import createRoot from react dom client import AuthProvider from auth auth react import App from App const container document getElementById root as HTMLElement const root createRoot container root render lt React StrictMode gt lt AuthProvider domain process env REACT APP AUTH DOMAIN as string clientId process env REACT APP AUTH CLIENT ID as string redirectUri window location origin gt lt App gt lt AuthProvider gt lt React StrictMode gt Now reset the developer server by pressing Ctrl C on your keyboard and run the command npm run dev to start it again This way the new environment values will take effect Now open your browser and navigate to localhost and you should be presented with the login screen BlitzThe great thing about Blitz is it already has the authentication views for signup and login It has also configured the database for it so you don t have to worry about creating separate models and running migrations for that The signup page should be available at localhost auth signup The login page should be available at localhost auth login Create a new account and sign up so we have a user record in the SQLite database and you can log in to access the pages we will build further Creating pages refineCreating new pages in refine is really simple thanks to its built in command create resource Since it s targeted at CRUD apps the user is allowed to choose what type of pages to generate via flags list create edit and show To get an overall insight into how the new pages are created in refine we will first create a page that lists the content Run the command npm run refine create resource products actions list in your terminal Navigate back to your project file tree and you will notice that a new folder pages was created Inside it there is a route specific folder products that includes files index ts and list tsx Open up the list tsx file and you will notice refine has even designed the Inferencer component that will automatically help you to design the views for resources based on the data structure import IResourceComponentsProps GetListResponse from pankod refine core import AntdInferencer from pankod refine inferencer antd export const ProductsList React FC lt IResourceComponentsProps lt GetListResponse lt gt gt gt gt return lt AntdInferencer gt Also notice the newly created list page was automatically imported and passed in as resource prop in the Refine component in App tsx lt Refine dataProvider dataProvider notificationProvider notificationProvider Layout Layout ReadyPage ReadyPage catchAll lt ErrorComponent gt routerProvider routerProvider authProvider authProvider LoginPage Login resources name products list ProductsList gt Now open your browser and navigate to localhost products You should be presented with the page that lists data from the products route from the refine s built in data provider BlitzBlitz does not come with the Inferencer component that would create a default view to display the data so we will create a custom page If you have previously worked with NextJS you will notice that the page system is the same For a new page you need to create a new tsx file inside the pages folder and it will become a new route To test it out create a new file greet tsx and include the following code const Greet gt return lt div gt lt h gt Hello from Blitz lt h gt lt p gt This is a custom Greetings page lt p gt lt div gt export default Greet Now open your browser and navigate to localhost greet and you should be presented with the rendered content of the newly created page CRUD functionality refinerefine has thought out how to make the CRUD operations as easy as possible Run the command npm run refine create resource posts This will create a new page for the posts route from the data provider but since we did not provide any flags of what specific operations to support all of the CRUD operations will be available This means that after running the command refine created a new folder inside pages called posts and populated it with files index ts list tsx create tsx edit tsx and show tsx Now open up your browser and navigate to localhost posts You should be able to see all of the data coming from the posts route but this time you will notice there are action buttons to create read update and delete the records BlitzTo demonstrate the CRUD functionality and how simple it is to implement one in the Blitz we will be building a to do application that will allow us to create read update and delete daily tasks Run the command blitz generate all todo name string That will create the necessary model query mutations and page routes We also passed in the string type for the to do task values Similarly to the refine scaffold Blitz took care of creating separate files for the create read update and delete operations for the to do tasks To test it out restart your developer server by pressing Ctrl C on your keyboard and then run blitz dev Then open your browser and navigate to localhost todos This will display the landing of the crud page asking you to create the first task since we currently do not have any data in our database Testing CRUD refineTo create a record click on the Create button in the top right corner This will open up a form with empty fields allowing you to enter the values and save a new record To read an already existing record click on the eye icon on the right of each record It will open up the record with all the values in read only mode In order to update an existing record click on the pencil icon next to the eye icon This will open up the form with all the values editable To delete the post click on the bin icon next to the eye icon It will also display a confirmation popup to make sure you are not deleting the record by mistake BlitzTo create a new task click on Create Todo It will open up an empty form where you can give the name of the task To read the created record navigate to the tasks list and click on the specific task This will open up the selected record in read only mode In order to edit the existing record open it and click on the Edit button That will allow you to change the title of the created to do task To delete the task open it and click on the Delete button Deployment refineFirst make sure you have a GitHub account If you do not have one make sure to create one for free Next sign in and create a new repository Now switch back to your code editor and run the following commands to push the code to the newly created repository git remote add origin git branch M maingit push u origin mainAfter the code is pushed switch back to the GitHub repository and you should see all the code being pushed To make sure your app is deployed in production and accessible online you will also have to deploy it to some hosting provider like Vercel First create a new free account if you already do not have one and log in Then create a new project by selecting the option Import from Git Find your GitHub project in the list and click Import Vercel will automatically configure everything for you all you have to do is manually add the environmental keys and values from the env file Once that s done click on Deploy and after the deployment process is done you will be given a live access link to your project The last thing for you to do is to switch back to Auth and change the allowed URLs to the deployment URL given by the Vercel previously those values were set to localhost BlitzWe will use Render which will allow us to deploy the app and the database First change the database provider to PostgreSQL To do that open schema prisma file and change the data source as shown below datasource db provider postgres url env DATABASE URL Then delete the db migrations folder so there is no previous migration history and no lock file for the database type Then create a new file render yaml in your project root and include the following configuration settings services type web name crud blitz env node plan free buildCommand npm i prod false amp amp blitz prisma generate amp amp blitz build amp amp blitz prisma migrate deploy startCommand blitz start p PORT envVars key NODE ENV value production key DATABASE URL fromDatabase name crud blitz db property connectionString key SESSION SECRET KEY generateValue truedatabases name crud blitz db plan freeNow push the code to GitHub Create a free account if you already do not have one and log in Next create a new repository Switch back to your code editor and run the following commands in your terminal git remote add origin git branch M maingit push u origin mainThen switch back to GitHub and you will find everything synced up Next create a free account on Render and log in Click on New and select the Blueprint option Next connect your Github account and find your project in the list Next give the Blueprint a name and click on Apply so Render sets everything up using your yaml configuration The setup might take a few minutes It will give you the live access link to your project once it s done ConclusionIn this article we compared two React frameworks refine and Blitz Both have TypeScript support by default are easy to set up come with CLI commands and do not require to use specific UI frameworks refine has a built in data provider This is great for testing and experimenting Blitz in comparison comes with SQLite and Prisma studio that offers UI to work with data For data tables refine comes with Inferencer which has already structured the data in the easy to perceive UI For Blitz you will have to build tables action buttons and other components yourself Blitz apps are already set with signup login and forgot password views with the models already create to store users and sessions in the database For refine you will have to create those from the ground up From the project tree standpoint Blitz looks more like a framework For those looking for a high flexibility on how to structure the project you will have to deal with the fact that most of the flow already follows a certain pattern refine is virtually a collection of hooks components and providers therefore users can fully design the app based on their individual needs and follow specific logic patterns based on their business schema |
2023-03-16 12:18:55 |
Apple |
AppleInsider - Frontpage News |
BenQ PD2725U review: Not even close to a Studio Display substitute |
https://appleinsider.com/articles/23/03/16/benq-pd2725u-review-not-even-close-to-a-studio-display-substitute?utm_medium=rss
|
BenQ PDU review Not even close to a Studio Display substituteThe inch K BenQ PDU monitor is advertised as a Mac compatible display and it worked with our MacBook Air with M ーbut it s clear this display wasn t designed for Mac users BenQ PDUThe obvious thing worth pointing out is that this is a inch monitor with a K resolution Apple s macOS looks the best when there s a certain number of pixels per inch and this monitor with ppi falls short ーit s not in the retina range Read more |
2023-03-16 12:44:54 |
Apple |
AppleInsider - Frontpage News |
Foxconn wins first AirPods order & will make them in India |
https://appleinsider.com/articles/23/03/16/foxconn-wins-first-airpods-order-plans-new-factory?utm_medium=rss
|
Foxconn wins first AirPods order amp will make them in IndiaSix years and six months since AirPods were launched Apple s biggest supplier Foxconn will expand into India to make them According to Reuters Foxconn plans to build a million factory in India specifically to make AirPods Apple has already had some AirPod components made in India as part of its move to reduce reliance on China but so far Foxconn has not been involved Neither Apple nor Foxconn have confirmed the story but Reuters cites two unnamed sources reportedly with direct knowledge of the deal One of the sources said that Foxconn s investment in India will be with a new factory in southern Indian state of Telangana Read more |
2023-03-16 12:07:22 |
Cisco |
Cisco Blog |
Everything you ever wanted to know about Cisco ISE, but were afraid to ask |
https://feedpress.me/link/23532/16026066/everything-you-ever-wanted-to-know-about-cisco-ise-but-were-afraid-to-ask
|
cisco |
2023-03-16 12:00:28 |
海外TECH |
CodeProject Latest Articles |
Making It Easier to Replace Null with DBNull.Value |
https://www.codeproject.com/Tips/5355559/Making-It-Easier-to-Replace-Null-with-DBNull-Value
|
value |
2023-03-16 12:08:00 |
金融 |
金融庁ホームページ |
国際金融センター特設ページをリニューアルしました。 |
https://www.fsa.go.jp/policy/financialcenter/index.html
|
金融センター |
2023-03-16 14:00:00 |
ニュース |
BBC News - Home |
People urged to take gonorrhoea tests as cases rise |
https://www.bbc.co.uk/news/health-64976183?at_medium=RSS&at_campaign=KARANGA
|
england |
2023-03-16 12:02:36 |
ニュース |
BBC News - Home |
John Lewis axes staff bonus and plans to cut jobs |
https://www.bbc.co.uk/news/business-64945767?at_medium=RSS&at_campaign=KARANGA
|
tough |
2023-03-16 12:27:03 |
ニュース |
BBC News - Home |
Watch the harrowing rescue of a man stuck in a flooded river |
https://www.bbc.co.uk/news/world-64977487?at_medium=RSS&at_campaign=KARANGA
|
angeles |
2023-03-16 12:14:34 |
ニュース |
BBC News - Home |
South Korea and Japan: A milestone meeting of frenemies |
https://www.bbc.co.uk/news/world-asia-64962733?at_medium=RSS&at_campaign=KARANGA
|
historic |
2023-03-16 12:09:33 |
ニュース |
BBC News - Home |
Everything we know about the US drone that crashed in the Black Sea |
https://www.bbc.co.uk/news/world-us-canada-64972002?at_medium=RSS&at_campaign=KARANGA
|
black |
2023-03-16 12:04:09 |
ニュース |
BBC News - Home |
Warning pension tax boost may lead workers to retire early |
https://www.bbc.co.uk/news/business-your-money-64975682?at_medium=RSS&at_campaign=KARANGA
|
value |
2023-03-16 12:15:26 |
コメント
コメントを投稿