投稿時間:2021-09-02 01:37:20 RSSフィード2021-09-02 01:00 分まとめ(36件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) vscodeでcanvasの補完を効かせたい https://teratail.com/questions/357299?rss=all vscodeでcanvasの補完を効かせたいvscodeでHTMLCanvasElementを指定すれば補完が効くと情報があったので、指定したのですが補完が効きませんvscodeでcanvasの補完が効く方法を教えてほしいです。 2021-09-02 00:16:03
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) mvコマンドで、コピーが完了したものから削除したい https://teratail.com/questions/357298?rss=all mvコマンドで、コピーが完了したものから削除したい前提・実現したいことTBほどのデータが入っているディレクトリを移動させたいのですが、普通にmvすると、一旦cpを行うため、ストレージが足りなくなってしまいます。 2021-09-02 00:13:39
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Conoha Wing コマンド入力について https://teratail.com/questions/357297?rss=all ConohaWingコマンド入力について前提・実現したいことConohanbspWingレンタルサーバでpythonを実行するために、サーバの環境を整備したいのですが、どこからコマンドを入力するか分からず困っています。 2021-09-02 00:06:11
Ruby Rubyタグが付けられた新着投稿 - Qiita [Rails]フォローしたユーザーの直近1週間の投稿のみ表示させる https://qiita.com/mkato1013/items/44b8a865d6c51ee61fb9 whereメソッドとは、テーブル内の条件に一致したレコードを配列の形で取得することができるメソッドです。 2021-09-02 00:34:51
Azure Azureタグが付けられた新着投稿 - Qiita Azure Web App + GitHub Actionsセルフホストランナー(Proxy越え)でCI/CDを試す https://qiita.com/shingo_kawahara/items/0f839bb3ed4d6da8c2b6 公式マニュアル通りにやると、Azurewebappsdeployvアクションを使うことで簡単にデプロイできますが、proxy指定をすることができなかったためAzureCLIを使ってデプロイしています。 2021-09-02 00:53:16
Ruby Railsタグが付けられた新着投稿 - Qiita [Rails]フォローしたユーザーの直近1週間の投稿のみ表示させる https://qiita.com/mkato1013/items/44b8a865d6c51ee61fb9 whereメソッドとは、テーブル内の条件に一致したレコードを配列の形で取得することができるメソッドです。 2021-09-02 00:34:51
海外TECH DEV Community cURL Tips for Performance Engineers https://dev.to/qainsights/curl-tips-for-performance-engineers-1j0f cURL Tips for Performance EngineersIn this blog post we are going to see about CURL tips for performance engineers I have already published a YouTube video about cURL for Performance Engineers We are going to see a few more tips about cURL Headers to cURLIf you want to convert the headers to cURL command there are a couple of ways you can do it Clone this repository Launch WSL for Windows terminal Store your headers in a file e g example comGET HTTP Host example comThen issue the command hc lt example com Here is the output you will get curl http header Accept header User Agent If you prefer the online version you can check this URL The online version will send your crunched data and converted on the curl server If you want to see more options for hc issue hc h command hc pl options lt file a Allow curl s default headers d Output man page HTML links after command line h Show short help H Output HTTP generated URLs instead i Ignore HTTP version libcurl Output libcurl code instead n Output notes after command line s Use short command line options v Add a verbose option to the command lineWhere do you get the valid headers You can copy and paste the request headers from the browser Open your favorite browser and launch the Developer Tools and go to Network tab Select the request and navigate to the Request Headers section to copy the source format of the headers as shown below and then save it as a file cURL Tips for Performance Engineers Copy the request headersIf you would like to copy the cURL command directly from the browser you can right click on the request where you can see the cURL options as shown below Copy options for cURLClick on copy as cURL cmd If you would like to create a JMeter test plan launch JMeter go to Tool gt Import from cURL and enter the command as shown below Create Test Plan from cURL in JMeterClick on Create Test Plan which will create an HTTP Request Sampler and the HTTP Header Manager element ConclusioncURL is a great utility for a quick smoke test and for automating stuffs In performance testing you can create cURL commands directly from the browser or from the request headers In JMeter you can createa test plan directly from the cURL command 2021-09-01 15:46:36
海外TECH DEV Community Relational Data Services in Azure https://dev.to/geetcloud/relational-data-services-in-azure-151f Relational Data Services in AzureIn this article we are going to see all of the Relational Data Services that are available in AzureInfrastructure as a service IaaS SQL Server on VMsPlatform as a Service PaaS Azure SQL Database Azure SQL ManagedInstance Azure Database for MySQL PostgreSQL amp MariaDB For Hybrid On Premise extension SQL Stretch DatabaseFor IoT Azure SQL Edge SQL Server on Azure VMWith SQL Server on Azure VM on premise SQL workloads can be easily shifted to Azure while maintaining complete SQL Server compatibility and operating system level access Key Features Infrastructure as Service IaaS with a complete set of features Requires no code changes except the connection string Full control over the server in the cloud as similar to on premise server Leverage existing expertise in SQL Server and continue working the same way as on the on premise server Azure SQL DatabaseAzure SQL Database is the most preferred solution for normal relational and transactional databases Azure provides the option to create a database server and deploy our databases to the cloud A SQL Database server is a logical construct that acts as a central administrative point for multiple single or pooled databases logins firewall rules auditing rules threat detection policies and failover groups Azure SQL Database is available with several options Single Database Elastic Pool and Managed Instance Azure SQL Managed InstanceAzure SQL Database restricts some of the administrative features available in SQL Server Within Azure SQL Managed Instance we have full control over the instance as much as you would for an on premises server We can deploy as many as databases we want in the server With the support of other Azure Services managed instance automates backups software updates monitoring etc it is always up to date Key FeaturesEasy lift and shift Fully fledged SQL instance with compatibility with on premise instance Fully Managed PaaS service with a complete set of features Enhanced Security and isolation with VNet and a private IP address Azure Database for MySQLMySQL is the leading open source relational database for Linux Apache MySQL and PHP LAMP stack apps Azure Database for MySQL based on the MySQL free community edition offers high availability and elastic scaling to open source mobile and web apps or migrate MySQL workloads to the cloud Key Features Built in high availability features Enhanced security with compliance Automatic backups and point in time restore for up to days Easy scaling option Pay as you go pricing only pay for what you use Offers integration with Azure App Services and Azure Kubernete Services for simplified development Azure Database for PostgreSQLAzure PostgreSQL helps in building scalable secure and fully managed enterprise ready apps on open source PostgreSQL scale out single node PostgreSQL with high performance or migrate PostgreSQL and Oracle workloads to the cloud Key Features Offers extensions which MySQL does not have PostgreSQL Extensions provides additional custom data types functions JSONB full text search index types language types caching geospatial support etc Supports geometric data such as lines circles and polygons Supports both relational and non relational data Provides high performance horizontal scaling using Hyperscale Citus Similarities with MySQL Both are Open Source and support relational database and fully managed services Makes it easier to lift and shift your applications to Azure No need to convert your datastore to SQL Server or SQL Database Use the same tools as SQL Database for scaling and monitoring Intelligent Performance Recommendations Enhanced Security Capabilities Azure Maria DBMariaDB is a newer database management system created by the original developers of MySQL Key Features Built in support for temporal data A table can hold several versions of data enabling an application to query the data as it appeared at some point in the past Offers compatibility with Oracle DatabaseAzure MariaDB based on free community edition offers high availability and elastic scaling to open source mobile and web apps with a managed community MariaDB database serviceKey Features of Azure MariaDB Relational Database as a fully managed service High Availability Scaling as needed within seconds Automatic backups and point in time restore for up to days Support for many languages and frameworks Enhanced Security Capabilities with Azure IP Advantage Hybrid Database using SQL Server Stretch DBScenarios where we choose to go for the hybrid option When you have an existing database that is running out of space When you have an on premise server with large database running lot of applications To retain existing Traditional Architecture of Legacy system The hardest option out of the rest For these scenarios upgrading to a new server might be difficult and painful One option would be to extend cool data to the cloud so we can extend the life of the on premise server Using Stretch Database data can be split between on premises storage and cloud storage We can push the cold historical data to the cloud which will be accessed rarely and warm active data can be retained on premises to boost the performance Azure SQL EdgeAzure SQL Edge is an optimized relational database engine that is specially designed for IoT and IoT Edge deployments Key Features Able to create excellent data storage and processing layer for different IoT applications Since it is built on top of the SQL Server database engine we can use the same T SQL programming in SQL Server Provides the most demanding machine learning and artificial intelligence capabilities Its built in streaming capability helps you with complex event processing and realtime analytics ConclusionThis time we covered the Relational data store related services that are available in Azure Stay tuned to learn more about other types of data stores in Azure as this is just the beginning References Thanks for reading this post I hope this article is informative and helpful in some way If it is please like and share this article Follow me on Twitter LinkedIn for more related tips and posts Happy learning 2021-09-01 15:26:43
海外TECH DEV Community Developing for the web with Flask; creating a web application. https://dev.to/billyndirangu/developing-for-the-web-with-flask-creating-a-web-application-2257 Developing for the web with Flask creating a web application Hey there In this tutorial i will be showing you how to develop your first fullstack web app project with flask python In this tutorial or rather a documentation of how i did it buckle up dev and may the ride begin PrerequisitesBasic python language skills Basic command line commands linux PIP a package manager for python Installationallows you to install required libraries for a specific project i e FlaskIDE vscode atom sublime Python installed ContentsLaunchInstallationTemplatingConditionalsLoopingWeb FormsConfigurationsTemplating formsDatabaseDatabase migrationsDatabase modelsMigrating Data to the DBAdding data to the databaseViewing PostsSummary Launch Now setup up your project structure launch your code editor and create a directory in it mkdir blogger amp amp cd bloggerNow create your starting files mkdir app amp amp cd apptouch app py routes py models pyWhile in the app directory create two directoriesmkdir templates staticNavigate to the root directory blogger and create the following filestouch blog py config pyall is set and your project structure should be looking like this blogger app templates html files directory static css amp images directory init py routes py site navigation capability models py db logic goes here blog py main apprunning module config py tip identation shows file location eg templates is in app dirWhen working with external libraries it is good to run your project in a virtual environment go ahead and install virtualenv via the terminalpip install virtualenv create a virtual environment virtualenv bloggerenv you can name your env any name activating windowscd bloggerenv Scripts activate linuxsource bloggerenv bin activate deactivating the envdeactivate Installing libraries We use the PIP to install the required libraries bloggerenv pip install Flask this are the underlying packages to start a projectopen the init py in app directory type this init pyfrom flask import Flaskapp Flask name flask object instancefrom app import routesfirst we import the Flask class from the flask module next we create the app object as an instance of the Flask class then import the routes module to be created laterOpen the routes py file and we create the first route and test if everything is working from app import app app route app route index def index return Hello World The first line imports the application instance This is a view function what it does it returns the string Hello World to the browser when the app is run The two first lines app route are called decorators they create urls for the web app Head over to the blog py file and create the app running logic blog pyfrom app import appif name main app run With this our app is done and can be previewed in the browser But before running Flask needs to be told how to import it through the FLASK APP environment bloggerenv export FLASK APP blog pyIf you are using a windows OS use the keyword set instead of export You can run your app in the terminal now bloggerenv flask run Serving Flask app blog py lazy loading Environment production WARNING This is a development server Do not use it in a production deployment Use a production WSGI server instead Debug mode off Running on http Press CTRL C to quit Copy the url in the browser Voila app running and good Templating In this section i ll show how to work with templates to generate more elaborate web pages with more complex structures We are going to use Jinja it is a templating engine for flask We are going to store the template html files in the templates folder Create an index html file and open it app templates index htmlI want the homepage to display a custom welcome message to the userIn the routes file create a python dictionary that holds our mock user from flask import render templatefrom app import app app route app route index def index user username Developer return render template index html title Home user user Here we import the render template function from the flask module It handles html rendering in pythonThen we create mock data as a python dictionary for a user this will change henceforth as we include a database Let s code the index html file lt doctype html gt lt html gt lt head gt lt title gt title blogger lt title gt lt head gt lt body gt lt h gt Hello user username lt h gt lt body gt lt html gt When we run this version of the app we get a nice preview with the username printed out substitutes blocks with corresponding values given by the arguments provided in the render template call Conditional statements in jinja Jinja supports control statements given inside Add a conditional statement to the index html that will print the documents title when provided in the render template call and prints out a default title if None is provided Put this block in the lt head gt section if title lt title gt title lt title gt else lt title gt App blogger lt title gt endif Loops And yes jinja also supports looping what did you expect lets add a mock data in our routes py file for postsfrom flask import render templatefrom app import app app route app route index def index user username Developer posts author username Guido body I designed python language author username Jack body Blue is a cool color return render template index html title Homer user user posts posts I create a list posts with nested dictionaries where each element is a dictionary that has author amp body fields Now head on to index html and handle the rendering of posts in the browser posts can be of any number and we need to tell the temlate how to render them all for that case we use a for loop lt DOCTYPE html gt lt html lang en gt lt head gt lt meta charset UTF gt lt meta http equiv X UA Compatible content IE edge gt lt meta name viewport content width device width initial scale gt lt title gt title blogger lt title gt lt head gt lt body gt if user username lt p gt Hello user username lt p gt else lt p gt Hello World lt p gt endif lt h gt My posts lt h gt for post in posts lt b gt post author username lt b gt lt p gt post body lt p gt endfor lt body gt lt html gt Give this new version a try and voila When the structure of the app gets bigger and bigger we need to separate some preferences for example when linking css files or having a navbar in our website its needed anyway we ought to do it in a separate template file We call this template inheritance Go ahead and create base html in the templates directory lt base html gt lt DOCTYPE html gt lt html lang en gt lt head gt lt meta charset UTF gt lt meta http equiv X UA Compatible content IE edge gt lt meta name viewport content width device width initial scale gt lt link rel stylesheet href url for static filename style css gt block title lt title gt Document lt title gt endblock lt head gt lt body gt block content endblock lt body gt lt html gt With this we can now simplify our index html file to inherit a template file we use the extends tag at the top of the child template extends base html block title if user username lt title gt title blogger lt title gt else lt p gt Blogger lt p gt endif endblock block content lt h gt My posts lt h gt for post in posts lt b gt post author username lt b gt lt p gt post body lt p gt endfor endblock Template inheritance allows us to have the same look in every page without duplication Hence enabling us to be DRY If you go and run this the results will be the same as above As the application growsn it will require more functionality and features like web forms etc Web forms In this chapter I ll show you how to create web forms to take user input via the browser We use an extension called Flask WTF it is a wrapper found in the package WTForms that integrates well with Flask bloggerenv pip install flask wtf Configurations For tutorial purposes I am going to create just a simple form But before that I am going to set some configuration variables for separation of concerns i am going to define my app configs in the config py module in the top most directory I ll use a class to store any config variables and new configuration variables can be added here config pyimport osclass Config object SECRET KEY os environ get SECRET KEY or you will never guess the SECRET KEY configuration variable is an important config in most flask apps it is used by the Flask WTF to protect web forms against the Cross Site Request Forgery CSRF attack The value of the secret key is set as an expression with two terms joined by the or operator The first term looks for the value of an environment variable also called SECRET KEY The second term is just a hardcoded string For now the app is small and doesn t require much security i ll just use the hardcoded string but when deploying it needs to be replaced with a unique key can be generated in the python shell using the urandom module gt gt gt from os import urandom gt gt gt urandom b xd x x xb xd xae xe Now that i have the config set up i have to tell Flask to read and apply it This can be done right after the flask app instance in the init py using the app config from object method from flask import Flaskfrom config import Configapp Flask name app config from object Config from app import routesCreating the first form once again having the separation of concerns in mind in the app directory create a file forms pyThe Flask WTF extension uses Python classes to represent web forms A form class simply defines the fields of the form as class variables app forms pyfrom flask wtf import FlaskFormfrom wtforms import StringField TextAreaField SubmitFieldfrom wtforms validators import DataRequiredclass PostForm FlaskForm username StringField User name validators DataRequired post TextAreaField Post validators DataRequired submit SubmitField Submit Import the FlaskForm base class For each form you will need you create a separate class variable each field is given a label as the first argument The validators field is used to attach validation behaviors to form fields The DataRequired validator checks that a field is not submitted empty Form Templates Next is to add the form to a HTML template so it gets rendered to the web page The LoginForm class knows how to render itself as HTML this makes the next part fairly simple create a file new post html in app template new post htmlN B For uniformity inherit the base html template inside the new template extends base html block title if title lt title gt title blogger lt title gt else lt p gt Blogger lt p gt endif endblock block content lt form action method POST novalidate gt form hidden tag lt p gt form username label lt br gt form username size lt p gt lt p gt form post label lt br gt form post size lt p gt lt p gt form submit lt p gt lt form gt endblock This template expects a form object be instantiated in the PostForm class to be given as an argument Which is referenced as form the argument will be sent by the post view function the html lt form gt element is used as the container for the web form the action attribute tells the browser the url to use when the form data is submitted when set to an empty string the form is submitted to the current URL in the browser The method attribute specifies the HTTP request method to be used when submitting the form to the server novalidate tells the browser not to validate the forms as that is the work of Flask application running in the server The form hidden tag template argument generates a hidden field that includes a token that is used to protect the form against CSRF attacks The form lt field name gt label replaces the label element and the form lt field name gt goes where the form field is needed Read more on the jinja documentation Form view function In order to render the Form to the web page a route functionality is needed In the routes py module add the following view function at the end route to the post form app route post def post form PostForm return render template new post html title Add post form form Here i imported the PostForm class from forms py instantiated an object form PostForm from it and sent the object down to the template form form The form form parses the form object to the template form it is what s required to render the form fields When you run the app and navigate to post a html form is displayed But when you try to submit it a method not allowed is thrown I ll fix that in a minute Next I m going to create the navigation links inside the base html file lt gt lt body gt lt div gt lt b gt Blogger lt b gt lt a href url for index gt Home lt a gt lt a href url for post gt Add Post lt a gt lt div gt lt hr gt lt gt Add the above block just below the body tag when the app is run we get a simple navbar at the top That actually works As you noticed when i created the navbar links i used a different method the url for function from Flask which generates URLs using iternal mapping of urls to view functions Read ahead and practice working with forms Remember when you tried running the app and an error came shouting that was because the post view function didn t understand what to do To fix it we add the methods POST GET in the route decorator The new updated route should look like this route to the post formfrom flask import Flask redirect flash app route post methods POST GET def post form PostForm if form validate on submit print f Hey form username data Your post form post data was successfully submitted return redirect index return render template new post html title Add post form form Here we use an if statement to validate the form data in the view function The validated on submit runs validation of a form Call validate only if the form is submitted This is a shortcut for form is submitted and form validate Here I use the print function to print a custom message in the terminal later I will be using the Flask flash function to flash messages in the web page redirect this function redirects to a specified url flash it flashes a message to the web page after an action has been carried Database Flask doesn t support databases natively it isn t opinionated in this field so it gives you the freedom to choose across a variety of database options that best fits your application Databases can be separated into two those that follow relational models and those that do not referred as NoSQL dbs We are going to use Flask sqlalchemy an extension that provides a Flask friendly wrapper to the popular SQLAlchemy package SQLAlchemy is an ORMObject Relational Mapper An ORM allows applications to manage databases using high level entities such as classes objects amp methods instead of tables and SQL The work of an ORM is to convert high level operations into database commands Installing flask sqlalchemy run this in the terminal blogger pip install flask sqlalchemy Database Migrations As the application continues to grow it might need changes or updates also the database needs be updated This is done through migrations and the flask extension that handles this is Flask migrate This extension is a Flask wrapper for Alembic a flask database migration framework for SQLAlchemy Install the extension blogger pip install flask migrate Flask SQLalchemy configurationIn the development phase I will be using SQLite database It saves each database file on disk When the app reaches production I will use a database server PostgreSQL or MySQL Two configurations are required in the config py module import osbasedir os path abspath os path dirname file class Config object SECRET KEY os environ get SECRET KEY or you will never guess SQLALCHEMY DATABASE URI os environ get DATABASE URL or sqlite os path join basedir app db SQLALCHEMY TRACK MODIFICATIONS FalseThe Flask extension gets the location of the apps database from the SQLALCHEMY DATABASE URI configuration variable As I did with the SECRET KEY variable fallback I also provide a fallback value if the config variable doesn t define the database url The SQLALCHEMY TRACK MODIFICATIONS configuration if set to False disables a Flask SQLAlchemy feature that sends a signal to the application every time a change is about to be made to the database The database is represented in the application by a database instance This is done in the app init py file from flask import Flaskfrom config import Configfrom flask sqlalchemy import SQLAlchemyfrom flask migrate import Migrateapp Flask name app config from object Config configuration db SQLAlchemy app database instancemigrate Migrate app db from app import routes modelsIn this change of the init file I imported two new extensions SQLAlchemy amp flask migrate I have added a db object it represents the database The migrate variable handles the migration engine At the bottom I ve imported a new module models This module defines the structure of the database Database models Data stored in the database will be represented by a collection of classes usually known as database models The ORM layer will handle the translastions required for mapping objects created from this classes to the correct rows in the database tables Let s create a database model create a new file app models pyfrom app import dbclass Post db Model id db Column db Integer primary key True username db Column db String index True unique True post db Column db String index True def repr self return f lt User gt self username lt Post gt self post The id field is usually in all models and is used as the primary key Each user is assigned a new id and is stored in this field The username amp post field are defined as strings in database is known as VARCHAR and their maximum lengths specified The Post class created above inherits from db Model a base class for all models from Flask SQLAlchemy Fields are created as instances of the db Column class whih takes field type as arguments The repr tells python how to print objects of this class It is useful for debugging Open python in a terminal try to assign some data to our class objects blogger python gt gt gt from app import db gt gt gt from app models import Post gt gt gt p Post username John post Hello World gt gt gt p lt User gt John lt Post gt Hello World gt gt gt The model created above defines the initial database structure or schema of this application Create a migration repository When the app continues to grow we need to handle the changes such as adding new things modifying or removing items The Alembic extension takes care of this schema changes It maintains the migration repository a directory in which it stores the migration scripts Each a change is made to the database schema a migration script is added to the repository with the details of the change To apply the migrations to a database these migration scripts are executed in the sequence they were created The flask db sub command is added by flask migrate to manage everything related to database migrations To create a migration repository blogger flask db initCreating directory E code projects blogger migrations doneCreating directory E code projects blogger migrations versions doneGenerating E code projects blogger migrations alembic ini doneGenerating E code projects blogger migrations env py doneGenerating E code projects blogger migrations README doneGenerating E code projects blogger migrations script py mako donePlease edit configuration connection logging settings in E code projects blogger migrations alembic ini before proceeding The flask command relies on the FLASK APP environment variable after a successful run a new migrations directory is added Now we need to create our fist database migration blogger flask db migrate m posts table INFO alembic runtime migration Context impl SQLiteImpl INFO alembic runtime migration Will assume non transactional DDL INFO alembic autogenerate compare Detected added table post INFO alembic autogenerate compare Detected added index ix post post on post INFO alembic autogenerate compare Detected added index ix post username on username Generating E code projects blogger migrations versions bfe posts table py doneAfter running this no change has been made to the database it just generates a migration script Now we need to make changes to the database To do that we use a flask sub command flask db upgrade in the python shell context flask db upgradeINFO alembic runtime migration Context impl SQLiteImpl INFO alembic runtime migration Will assume non transactional DDL INFO alembic runtime migration Running upgrade gt bfe posts tableAt this point you can play with the database a little Let s try to add the previous post to the database The db changes are done in a database session context To add data to the db we use db session add p p is the object created for the corresponding database table To write the changes use db session commit blogger python gt gt gt from app import db gt gt gt from app models import Post gt gt gt p Post username John post Hello World gt gt gt p lt User gt John lt Post gt Hello World gt gt gt db session add p gt gt gt db session commit gt gt gt Post query all lt User gt Ariana lt Post gt Testing lt User gt John lt Post gt Hello World gt gt gt first import the database object from the app moduleImport the Post class from the models module Create a Post object name it p use the db session context to add and push the change to the db The last command Post query all answers queries and returns all posts in the database Adding data to the database When a user types their data in the forms and hits submit button the form data needs to be written in the database To do that I shall add the db session commands in the view function post Your new changed app routes py should look like this route to the post form app route post methods POST GET def post form PostForm if form validate on submit add Post username form username data post form post data db session add add db session commit flash f Hey form username data Your post form post data was successfully submitted return redirect index return render template new post html title Add post form form Now when a user enters data in the web forms and hits submit the data gets written to the database we can view the data in a browser Viewing Posts in the Web page This part is rather simple I just need to create a template that renders the posts in the database I will just use a for loop to loop through the available posts in the database Head over to the IDE and create a new template file name it whatever you prefer app templates all posts html extends base html block title if title lt title gt title blogger lt title gt else lt p gt Blogger lt p gt endif endblock block content lt h gt Published Posts lt h gt for post in posts lt b gt post username lt b gt lt p gt post post lt p gt endfor endblock When you run the application and navigate to view all our posts are displayed in the web page Now we can head and add a nav link for viewing all our posts this is will be added in the base html file lt a href url for view gt Posts lt a gt Add this line of code in the div inside the base template file Preview the app in the browser and a new a navbar link has been added Summary In this article I took you through working with flask to create a minimal web application that takes user input via a web form and saves it in a database and retrieves it and displays it in a web page I worked you on using the Flask SQLAlchemy and integrating a flask app with a database Creating a database and managing the database modifications Templating and rendering web pages Go ahead and play with the UI by changing the style css inside the app static directorybody background color fffd When I add a the background color property the web page color changed I shall write more on this in another article Thank you for taking your time to go through this article Any feedback advice or help is appreciated Drop me a comment for any issue with running the code or improvement suggestions In the next article i ll cover on deploying this flask app to heroku References The whole code is available on Github go ahead and star the repo or clone it for your practice Thank you grayhat and Lux Tech Academy Be cool and Keep coding mic drop dev out 2021-09-01 15:09:17
海外TECH DEV Community Tips For Aspiring Artists - 3 Must Know Tips for Aspiring Artists https://dev.to/awsarchitektur/tips-for-aspiring-artists-3-must-know-tips-for-aspiring-artists-2nde Tips For Aspiring Artists Must Know Tips for Aspiring ArtistsAs a budding artist I d like to share with you a few tips and advice that I hope can be helpful in your artistic journey Whether you are a painter or a budding artist these tips would help you learn how to paint better and earn more money in your art form So please indulge me as I show you what you need to know If you are a beginner I would suggest investing in a good paint program This would give you step by step instructions on the whole painting process And best of all you would get step by step visual guidance on the product second by step instruction on how you will apply the paint Tips For Aspiring Artists OverviewIt s like having a professional painter with you all the time explaining to you each and every step of the process And since you will follow the instructions and the visual cues right on your computer screen this wouldn t just save you money buying materials and having someone else do all the laborious work for you this would also save you time in terms of workload and preparation Another thing to consider is purchasing art supplies This step is important and should be your first priority if you are serious about being a successful painter Buying art supplies early on will save you from spending more money later on For example you should always invest in oil paints canvases and brushes This is because when you see other painters working on their paintings you can easily tell that those who invested in good art supplies and tools have spent more time and effort making that masterpiece One very effective way to become better at your daily painting and earn more money from it is by joining a painting group Painting groups are usually a weekly meeting that you can join wherein you meet other artists with similar interests artist Through this you will be able to learn more strategies in painting and apply those tips in your own paintings These tips will help you bring out your best works and build on your confidence in painting abstractly Painting groups also offer classes where you can learn from professionals and other painters how to bring out your best works This is a great way of enhancing your skills as an artist and practicing your painting techniques every day Another benefit that you can get from joining these groups is that they offer art supplies and you can buy them from them So instead of buying from a local artist or store you can buy your art supplies from them This will cost you less and will be a more convenient way of starting your own art supplies business Here s another tip for aspiring artists Don t stop painting Most artists say that there is a need to keep practicing so don t think that once you start painting it s all over for you Continue making your paintings in days challenge or follow up with other painting activities This will be your constant creative practice and it will help sharpen your painting skills Another benefit of continuing your daily painting activities is that it will help you make more money So it s not just a matter of how much you paint but how much you earn from it The last tip for aspiring artists is to not let the process of painting overwhelm you Painting should be something fun and interesting If you get caught up in the creative process you may tend to paint the same thing day after day So instead of doing this it s better to do different colors every day or try your hand at creating different textures and effects Final WordsSo there you have it I hope these tips for painting would help you become more excited about painting Painting is not as difficult as you might have thought It s actually quite easy if you just remember to stay focus and just have fun while painting 2021-09-01 15:00:52
Apple AppleInsider - Frontpage News Microsoft to hold Surface Pro announcement event on Sept. 22 https://appleinsider.com/articles/21/09/01/microsoft-to-hold-surface-pro-announcement-event-on-sept-22?utm_medium=rss Microsoft to hold Surface Pro announcement event on Sept Microsoft says that it will hold an event on September and although the announcement features few details the keynote will likely focus on new Surface products Microsoft event announced for September A tweet announcing the event shows what appears to be a new Surface tablet product There is very little information about the event and Microsoft s invite link takes you to a save the date webpage with an animated version of the Surface image Read more 2021-09-01 15:40:20
海外TECH Engadget Microsoft will hold a Surface event on September 22nd https://www.engadget.com/microsoft-surface-event-september-154411605.html?src=rss Microsoft will hold a Surface event on September ndMicrosoft will hold its next event on September nd where it will show off the latest Surface hardware The event starts at AM ET The company didn t explicitly say this is about Surface but the signs are clear A teaser image shows a side on look at what appears to be a Surface Pro Microsoft usually holds a hardware centric event in the fall On top of that the event takes place two weeks before Microsoft releases Windows and what better way to showcase the latest OS than on shiny new hardware You re invited Learn more about the MicrosoftEvent ーMicrosoft Microsoft September As for what to expect we might see a refreshed Surface Duo Recent leaks suggest the Surface Duo will have an upgraded camera system and it may be available in black The Surface Book lineup is due for an upgrade and given the teaser image it won t be surprising if we learn what s next on the Surface Pro front In any case Engadget will cover all the big news out of the event 2021-09-01 15:44:11
海外TECH Engadget 'Seinfeld' will stream on Netflix starting October 1st https://www.engadget.com/seinfeld-netflix-release-date-152222495.html?src=rss x Seinfeld x will stream on Netflix starting October stIt took two years but Netflix is finally ready to stream Seinfeld Varietyreports that Netflix will make the show about nothing available on October st All nine seasons and episodes will be available so you can start from the beginning or jump to memorable moments like Elaine s questionable dancing or Jerry s quest to remember a woman s name Netflix bought the rights to stream Seinfeld albeit only for five years in wresting the show away from Hulu with promises of access sometime in However the eventual timing wasn t great ーthe series vanished from Hulu this June leaving Festivus fans in limbo for all of the summer It s still not clear what prompted that gap although contract terms might have played a role Either way the deal could be important for Netflix The service has lost multiple quot comfort food quot shows to rivals in recent years including Friends and The Office Seinfeld might not drive many new subscriptions but it could keep people from jumping ship as they look for a show to stream in the background while they wash dishes or finish their homework 2021-09-01 15:22:22
海外TECH Engadget No Man's Sky gets alien settlements you can take charge of https://www.engadget.com/no-mans-sky-frontiers-update-alien-settlements-nebulas-150813549.html?src=rss No Man x s Sky gets alien settlements you can take charge ofNo Man s Sky just celebrated its fifth anniversary and to underscore just how far the game has come since its rocky debut Hello Games has released the th major update for the space exploration and survival sim The headline attraction of the Frontiers update is the addition of alien settlements which you can take charge of and rule however you like You ll be able to name towns expand them defend them against Sentinels welcome visitors resolve disputes between residents and even commission festivals As with the rest of the game interiors will be procedurally generated You ll be able to see the population s overall happiness level earn income from the town and gain insight into the intentions and thoughts of residents all of which add Sims esque layers to the game Hello GamesBase building has been revamped with a grid based menu system and automatic contextual placement of features like windows and arches There are more than new base parts including timber stone alloy and decorative pieces You can even place parts inside of each other You now have save slots instead of five and you can save more discoveries on locally Hello Games says it has upgraded some visual effects too the previous big patch brought in more substantial visual improvements For one thing you ll start to see pretty multi colored nebulas in space Players can choose quot monstrous companions quot as pets as well Hello GamesA new Twitch campaign is on the way through which you can earn in game rewards by watching others play No Man s Sky Meanwhile the next expedition season will commence soon The Frontiers update is now live on all platforms 2021-09-01 15:08:13
Cisco Cisco Blog Cisco vAnalytics: enabling an optimal user experience with Microsoft 365 https://blogs.cisco.com/networking/cisco-vanalytics-enabling-an-optimal-user-experience-with-microsoft-365 microsoft 2021-09-01 15:06:55
海外TECH WIRED Fleeing Disaster Is Hard. Climate Change Is Making It Harder https://www.wired.com/story/fleeing-disaster-is-hard-climate-change-is-making-it-harder Fleeing Disaster Is Hard Climate Change Is Making It HarderHurricane Ida and California wildfires are two sides of the same coin On a warmer planet it s getting harder to evacuate from extreme events 2021-09-01 15:45:21
金融 ◇◇ 保険デイリーニュース ◇◇(損保担当者必携!) 保険デイリーニュース(09/02) http://www.yanaharu.com/ins/?p=4691 mulesoft 2021-09-01 15:20:21
金融 RSS FILE - 日本証券業協会 証券投資の税制 https://www.jsda.or.jp/anshin/oshirase/index.html 証券 2021-09-01 17:00:00
金融 RSS FILE - 日本証券業協会 株主コミュニティの統計情報・取扱状況 https://www.jsda.or.jp/shiryoshitsu/toukei/kabucommunity/index.html 株主コミュニティ 2021-09-01 15:30:00
金融 金融庁ホームページ 「資金移動業者に関する内閣府令第二十一条の五第一項の規定に基づき金融庁長官の指定する規則を定める件(案)」について公表しました。 https://www.fsa.go.jp/news/r3/sonota/20210901.html 内閣府令 2021-09-01 17:00:00
金融 金融庁ホームページ 外国損害保険業の免許について公表しました。 https://www.fsa.go.jp/news/r3/hoken/20210901.html 損害保険 2021-09-01 17:00:00
金融 金融庁ホームページ 「主要行等向けの総合的な監督指針」、「金融商品取引業者等向けの総合的な監督指針」の一部改正(案)に対するパブリックコメントの結果等について公表しました。 https://www.fsa.go.jp/news/r3/ginkou/20210901-2/20210901-2.html 金融商品取引業者 2021-09-01 17:00:00
ニュース ジェトロ ビジネスニュース(通商弘報) 需要高まるデジタル人材育成の補助金プログラム開始 https://www.jetro.go.jp/biznews/2021/09/7a3819a603e432fc.html 人材育成 2021-09-01 15:40:00
ニュース ジェトロ ビジネスニュース(通商弘報) 広州市、清掃作業員のゼロ感染にみる新型コロナ防疫策 https://www.jetro.go.jp/biznews/2021/09/7f685eb89d80a75f.html 防疫 2021-09-01 15:30:00
ニュース ジェトロ ビジネスニュース(通商弘報) サムスン電子、総額22兆8,000億円の投資計画発表 https://www.jetro.go.jp/biznews/2021/09/1153dcb1738ec673.html 計画 2021-09-01 15:20:00
ニュース ジェトロ ビジネスニュース(通商弘報) ブラジル全国工業連盟、日本含む主要貿易相手国・地域との関係性分析 https://www.jetro.go.jp/biznews/2021/09/1d2d12f63dea82ae.html 関係性 2021-09-01 15:10:00
ニュース BBC News - Home Afghanistan: Unknown number of people left behind in Afghanistan, says Dominic Raab https://www.bbc.co.uk/news/uk-politics-58411322?at_medium=RSS&at_campaign=KARANGA foreign 2021-09-01 15:36:13
ニュース BBC News - Home Scots to need vaccine passports for large events https://www.bbc.co.uk/news/uk-scotland-58412832?at_medium=RSS&at_campaign=KARANGA scotland 2021-09-01 15:01:05
ニュース BBC News - Home Wetherspoon runs low on beer amid driver shortage https://www.bbc.co.uk/news/business-58395401?at_medium=RSS&at_campaign=KARANGA drivers 2021-09-01 15:43:26
ニュース BBC News - Home Smith retains individual Paralympic boccia title https://www.bbc.co.uk/sport/disability-sport/58405624?at_medium=RSS&at_campaign=KARANGA individual 2021-09-01 15:29:17
ニュース BBC News - Home Creamfields: Tiesto fan's ashes fired from confetti cannon in headline set https://www.bbc.co.uk/news/uk-england-merseyside-58409876?at_medium=RSS&at_campaign=KARANGA tiesto 2021-09-01 15:28:10
ビジネス ダイヤモンド・オンライン - 新着記事 米軍撤退のアフガン、衝突続く タリバンと地元勢力 - WSJ発 https://diamond.jp/articles/-/281123 米軍撤退 2021-09-02 00:05:00
北海道 北海道新聞 日本ハム今季初4連勝 石井の一打 猛攻呼ぶ https://www.hokkaido-np.co.jp/article/584778/ 日本ハム 2021-09-02 00:13:00
北海道 北海道新聞 特殊詐欺に関与か 少年ら2人を逮捕 札幌東署 https://www.hokkaido-np.co.jp/article/584777/ 札幌市東区 2021-09-02 00:07:00
Azure Azure の更新情報 Azure AD Graph is retiring on 30 June 2022 https://azure.microsoft.com/ja-jp/updates/update-your-apps-to-use-microsoft-graph-before-30-june-2022/ azure 2021-09-01 15:30:42
GCP Cloud Blog Deploying a Cloud Spanner-based Node.js application https://cloud.google.com/blog/topics/developers-practitioners/deploying-cloud-spanner-based-nodejs-application/ Deploying a Cloud Spanner based Node js applicationCloud Spanner is Google s fully managed horizontally scalable relational database service Customers in financial services gaming retail and many other industries trust it to run their most demanding workloads where consistency and availability at scale are critical In this blog post we illustrate how to build and deploy a Node js application on Cloud Spanner using a sample stock chart visualization tool called OmegaTrade This application stores the stock prices in Cloud Spanner and renders visualizations using Google Charts You will learn how to set up a Cloud Spanner instance and how to deploy a Node js application to Cloud Run along with a few important Cloud Spanner concepts We begin by describing the steps to deploy the application on Cloud Run and end with a discussion of best practices around tuning sessions connection pooling amp timeouts for applications using Cloud Spanner in general which were adopted in OmegaTrade as well Deployment stepsWe re going to deploy the application completely serverless with the frontend and backend services deployed on Cloud Run and Cloud Spanner as the data store We chose Cloud Run because it abstracts away infrastructure management and scales up or down automatically almost instantaneously depending on traffic The backend service uses the Node js Express framework and connects to Cloud Spanner with default connection pooling session and timeout capabilities  As prerequisites please ensure that you have Access to a new or existing GCP project with one of the sets of permissions below OwnerEditor Cloud Run Admin Storage Admin Cloud Run Admin Service Usage Admin Cloud Spanner Admin Storage AdminEnabled billing on the above GCP projectInstalled and initialized the Google Cloud SDKInstalled and configured Docker on your machine Git installed and set up on your machineNote Please ensure that your permissions are not restricted by any organizational policies or you may run into an issue at the Deployment stage later on Let s begin First let s set up our gcloud configuration as default and set a GCP project to this configuration gcloud is the command line interface for GCP services Output Choose your Google account with access to the required GCP project and enter the Project ID when prompted  Next  we need to ensure the default gcloud configuration is set correctly Below we are enabling authentication unsetting any API endpoint URL set previously and setting the GCP project we intend to use in the default gcloud configuration Now let s enable Google Cloud APIs for Cloud Spanner Container Registry and Cloud Run Provision Cloud Spanner Instance database amp tablesLet s create a Spanner instance and a database using gcloud commands We will also create tables that are required by the OmegaTrade application UsersCompaniesCompanyStocks tracks the stock values Simulations tracks the state of each simulation Verify if these tables were successfully created by querying INFORMATION SCHEMA in the Cloud Spanner instance The INFORMATION SCHEMA as defined in the SQL spec is the standard way to query metdata about database objects Now that the Cloud Spanner instance database and tables are created from the above step let s build and deploy OmegaTrade Deploy app backend to Cloud RunWe will now walk through the steps to deploy the omegatrade frontend and omegatrade backend services to Cloud Run We will first deploy the backend and then use the backend service URL to deploy the frontend  First we ll clone the repository Let s edit some env variables we need for the app to work Add your project ID in the placeholder Your Project ID Now let s build the image from the dockerfile and push it to GCR As above we will need to change the command to reflect our GCP project ID Note In case you face issues with authentication follow the steps mentioned in the Google Cloud documentation suggested at runtime and retry the below commands Next let s deploy the backend to Cloud Run We will create a Cloud Run service and deploy the image we have built with some environment variables for Cloud Spanner configuration This may take a few minutes Now we have OmegaTrade backend up and running The Service URL for the backend is printed to the console Note down this URL as we will use it to build the frontend  Import sample stock data to the databaseTo import sample company and stock data run the below command in the backend folder The above command will migrate sample data into the connected database Once this is successful you will get a Data Loaded successfully message Note You may run this migration only on an empty database to avoid duplication Now let s deploy the frontend Deploy the app frontend to Cloud RunBefore we build the front end service we need to update the following file from the repo with the back end URL from the back end deployment step i e the Service URL  Note If you d like to enable Sign In With Google for the application now would be a good time to set up OAuth To do so please follow the steps in part of the readme Change the base URL to the Service URL append the api v as it is If you enabled OAuth make sure the clientId matches the value that you got from the OAuth console flow  If you skipped creating any OAuth credentials set clientId to an empty string All other fields remain the same Go back to the frontend folder Build frontend service and push the image to GCR This process may take a few minutes Now Let s deploy the frontend to Cloud RunNow we have the front end deployed You can go to this Service URL in your browser to access the application Optionally we can add the frontend URL in the OAuth web application to enable sign in using a Google account Under OAuth Client IDs open the application you have created OmegaTrade Test Add the frontend URL under Authorised JavaScript origins and save Note Please ensure that cookies are enabled in your browser to avoid being blocked from running the app A few screenshotsCongratulations If you ve been following along the app should now be up and running in Cloud Run You should be able to go to the frontend URL and play around with the application Try adding your favorite company tickers and generating simulations All data writes and reads are being taken care of by Cloud Spanner Here are a few screenshots from the app Login and Registration View The user can register and authenticate using a Google account via OAuth if you enabled it or using an email address On successful login the user is redirected to the Dashboard Dashboard View The app is pre configured with simulated stock values for a few fictitious sample companies The dashboard view renders the simulated stock prices in a graph   Manage Company View Users can also add a new company and its ticker symbol using this view Simulate Data View This view allows the user to simulate data for any existing or newly added company The backend service simulates data based on a couple of parameters the interval chosen and the number of rows The user can also pause resume and delete the running simulations Now that we ve got the application deployed let s cover a few important Spanner concepts that you re likely to come across both as you explore the application s code and in your own applications SessionsA Session represents a communication channel with the Cloud Spanner database service It is used to perform transactions that read write or modify data in a Cloud Spanner database A session is associated with a single database Best Practice It is very unlikely you will need to interact with sessions directly Sessions are created and maintained by client libraries internally and they are optimized by these libraries for best performance Connection session poolingIn Cloud Spanner a long lived connection communication channel with the database is modeled by a session and not a DatabaseClient object The DatabaseClient object implements connection session pooling internally in a SessionPool object which can be configured via SessionPoolOptions The default Session Pool options areBest Practice  It is recommended to use the default session pool options as it is already configured for maximum performance NOTE You can set min max if you want the pool to be its maximum size by default This helps to avoid the case where your application has already used up min sessions and then it blocks waiting for the next block of sessions to be created Timeouts and retriesBest Practice  It is recommended to use the default timeout and retry configurations because setting more aggressive timeouts and retries could cause the backend to start throttling your requests In the following example a custom timeout of seconds is set explicitly see the totalTimeoutMillis setting for the given operation If the operation takes longer than this timeout a DEADLINE EXCEEDED error is returned ConclusionCongratulations If you ve been following along you should now have a functional OAuth enabled Node js application based on Spanner deployed to Cloud Run In addition you should have a better understanding of the various parameters related to sessions connection pooling timeouts and retries that Cloud Spanner exposes Feel free to play with the application and explore the codebase at your leisure  To learn more about the building blocks for implementing Node js applications on Cloud Spanner visit Cloud Spanner Node js Client API ReferenceCloud Spanner DocumentationCloud Spanner Node js Client LibraryRelated ArticleMeasuring Cloud Spanner performance for your workloadIn this post we will explore a middle ground to performance testing using JMeter Performance test Cloud Spanner for a custom workload b Read Article 2021-09-01 15:30:00

コメント

このブログの人気の投稿

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

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

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