python |
Pythonタグが付けられた新着投稿 - Qiita |
Discord.pyで新規スレッドを作成する方法 |
https://qiita.com/Shichimii/items/dc45c5246f6e9791121e
|
pipshowdiscordversion |
2023-02-19 21:03:16 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
RDSイベントサブスクリプション |
https://qiita.com/nontan-tylf/items/24f65e8e264863ea5b27
|
関係 |
2023-02-19 21:53:15 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
【AWS】aws help でCould not find executable named "groff" エラー |
https://qiita.com/kotaaaa/items/27b1332e2439e45af89a
|
sudolnsusrbinmandocusrlo |
2023-02-19 21:14:13 |
golang |
Goタグが付けられた新着投稿 - Qiita |
【Golang】x/crypto/ssh vulnerable to panic via SSH server 【Go 1.16】 |
https://qiita.com/KEINOS/items/c36dcd8b86b74f65689e
|
githubdependabot |
2023-02-19 21:40:20 |
Azure |
Azureタグが付けられた新着投稿 - Qiita |
GASでgmailの添付ファイルをAzureStorageに送信 |
https://qiita.com/DiveMasakazu/items/115a73d32ea9f8e59fe1
|
azurestorage |
2023-02-19 21:35:22 |
技術ブログ |
Developers.IO |
【レポート】Snowflakeで挑むPOSデータ統合の世界 #SnowdayJapan |
https://dev.classmethod.jp/articles/snowday-japan-pos-data-integration/
|
snowdayjapan |
2023-02-19 12:32:07 |
海外TECH |
DEV Community |
INTRODUCTION TO SQL FOR DATA SCIENCE |
https://dev.to/kemboijebby/introduction-to-sql-for-data-science-6a
|
INTRODUCTION TO SQL FOR DATA SCIENCESQL Structured Query Language is a programming language used to manage and manipulate relational databases It is commonly used for managing and manipulating data in a variety of applications from small scale desktop applications to large enterprise systems SQL is an essential tool for anyone who works with data as it provides a way to retrieve update and manipulate data in a relational database SQL can be used to perform a variety of operations on a database including Creating new databases and tablesAdding modifying and deleting data from existing tablesRetrieving data from tables based on specific criteria or conditionsModifying the structure of tables such as adding or deleting columnsEnforcing data integrity and constraints such as enforcing unique values for a specific column or setting relationships between tables SQL uses a variety of commands and syntax to perform these operations including SELECT INSERT UPDATE DELETE CREATE ALTER and DROP These commands can be combined with various operators such as AND OR and NOT to create more complex queries and statements SQL COMMANDSBelow are few examples of sql queries used to manipulate sql database SELECT statement to retrieve data SELECT column column columnFROM table nameWHERE condition INSERT statement to insert data INSERT INTO table name column column column VALUES value value value UPDATE statement to modify existing data UPDATE table name SET column value column value WHERE condition CREATE statement to create CREATE TABLE table name column datatype column datatype column datatype THESIS OF STATEMENT SQL is a powerful tool for data analysis that enables efficient querying filtering aggregating and joining of large datasets from multiple sources allowing analysts to derive valuable insights and make data driven decisions This thesis statement highlights the key features and benefits of SQL for data analysis emphasizing its ability to handle big data perform complex operations and integrate data from different tables or databases It also suggests that SQL can help analysts uncover patterns trends and correlations in the data leading to better business outcomes ARGUMENTSSQL is widely used in industry SQL is a standard language for managing and querying data and it is used by many organizations and companies worldwide By introducing SQL to students or analysts who are interested in data analysis they will be learning a skill that is highly valued in the job market and can be applied in many different domains SQL is efficient for large datasets As datasets continue to grow in size it becomes more challenging to process and analyze them using traditional spreadsheet tools SQL offers an efficient way to work with large datasets by allowing analysts to filter and aggregate data based on specific criteria This makes SQL an essential tool for data analysis and a valuable skill for anyone working with data SQL can integrate data from multiple sources Often data is stored in multiple tables or databases and analysts need to combine and integrate the data to perform analysis SQL can join tables based on common keys allowing analysts to merge data from different sources and perform more comprehensive analysis SQL offers a high level of control and precision SQL is a declarative language that enables users to specify precisely the operations they want to perform on the data This level of control and precision can help analysts avoid errors and reduce the time needed for analysis allowing them to focus on deriving insights from the data SQL is scalable and flexible SQL can be used on a wide range of database systems including both open source and commercial databases This flexibility allows analysts to work with different data sources and choose the system that best meets their needs SUMMARY In summary introducing SQL for data analysis offers many benefits including high efficiency data integration control scalability and flexibility It s a powerful tool for data analysis that can help analysts derive valuable insights and make data driven decisions |
2023-02-19 12:39:52 |
海外TECH |
DEV Community |
DevEmbed: Embed your dev.to profile anywhere using widgets - Linode Hacakathon |
https://dev.to/asheeshh/devembed-embed-your-devto-profile-anywhere-using-widgets-linode-hacakathon-4659
|
DevEmbed Embed your dev to profile anywhere using widgets Linode Hacakathon What I builtI built a dev to profile widget generator so that people can showcase their dev profiles on their personal sites or any other site without having to go through all the API stuff themselves You just need to head over to the site enter your dev username and then just copy the script code and put it inside your HTML file That s it The embed includes your profile basic information along with your social links and your some of your latest blog posts as well Category Submission SaaS SuperstarsWacky Wildcard App LinkApp API hosted on Linode Screenshots DescriptionThe project utilizes Linode VPS for backend API which provides the details needed for creating the widget using the dev to API The frontend made using Next js creates the page and provides a simple script that embeds the page on your site using Iframes Link to Source CodeMain Repo Link Backend Repo Link Permissive LicenseThe app is licensed under the MIT License BackgroundI have seen a lot of people adding their blog posts from dev to to their own personal sites using the API and it s a time consuming process I wanted to make the process easy as well as adding more details to it so that people can use the widget to share most of the stuff from their dev to profile How I built itFor the backend I used a simple python web server made using Flask and used Linode to host the Flask server While doing so I learnt a lot about linux commands and using a VPS connecting with VPS and adding files to it and running your own web server using nginx and gunicorn For the frontend I used Next js and Tailwind CSS I learnt a lot about utilizing Iframes to create embeddable widgets and also about creating scripts for widgets |
2023-02-19 12:17:50 |
海外TECH |
DEV Community |
#refineweek: Implementing Role Based Access Control |
https://dev.to/refine/refineweek-implementing-role-based-access-control-4gc4
|
refineweek Implementing Role Based Access ControlIn this post we implement Role Based Access Control RBAC on our Pixels Admin app Pixels Admin serves as the admin dashboard of our Pixels client app that we built previously in the refineWeek series This is Day and refineWeek is a seven part tutorial that aims to help developers learn the ins and outs of refine s powerful capabilities and get going with refine within a week OverviewOn Day we implemented CRUD functionalities on our dashboard resources users and canvases Taking it farther today we add authorization for actions related to canvases resource at canvases route We have have two roles that seek authorization editor and admin An editor is allowed to only promote and unpromote a canvas whereas an admin is free to promote unpromote a canvas as well as delete it Here s a short description of the specs editor can promote and unpromote a canvas editor cannot perform any other action admin can promote and unpromote a canvas admin can delete a canvas admin cannot perform any other action We manage RBAC and authorization using Casbin models and policies We then make use of refine s accessControlProvider and associated hooks to enforce policies for these roles For the backend we set and store user roles with the help of Supabase Custom Claims Supabase Custom Claims are a handy mechanism to store user roles information on the auth users table We also dig into some low level code in the lt DeleteButton gt component that refine s Ant Design package gives us to see how authorization comes baked into some of the related components Let s start with Casbin Casbin with refineIn this app we are implementing Role Based Access Control model with Casbin so we assume you are at least familiar with the RBAC related models and policies If you are not familiar with Casbin please feel free to go through how it works For a complete beginner I recommend understanding the following sections in the Casbin docs Get StartedHow It WorksSupported ModelsSyntax for ModelsModel StoragePolicy StorageEnforcersAdaptersRole ManagersRBACIf when you are familiar lovely yay Be with me go ahead and install Casbin yarn add casbin Casbin Model and PoliciesWe are using the following model and policy adapter for our RBAC implementation src casbin accessControl tsimport newModel StringAdapter from casbin export const model newModel request definition r sub obj act policy definition p sub obj act role definition g policy effect e some where p eft allow matchers m g r sub p sub amp amp keyMatch r obj p obj amp amp regexMatch r act p act export const adapter new StringAdapter p admin users list p admin canvases list edit delete p editor users list p editor canvases list edit A quick run down of the model is with the request definition in r sub obj act Casbin scans the request for the subject editor or admin object the resource and the action get create edit etc with the same parameters in p sub obj act it compares the request parameters with those in the policy instances declared in the policy adapterwith the two level grouping in g we are declaring user role inheritance can go two levels deep i e an admin is an user The adapter holds our instances of policies produced from p The policies above basically allows an admin to list users an admin to list edit and delete canvases an editor to list users an editor to list and edit canvases Browser Fallbacks for CasbinWe need to configure polyfills for casbin to work in a browser environment We are using react app rewired to override some of the configurations of our app So let s first add the following to package json yarn add react app rewiredAnd update the scripts package json scripts start react app rewired start build react app rewired build eject react scripts eject refine refine After that add the following packages yarn add assert buffer crypto browserify stream browserifyyarn add D https browserify os browserify path stream httpAnd then include this config overrides js file to the root of the app folder Without these overrides casbin versions gt is known to throw errors With this out of the way and the Casbin model policies ready it s time for us to define the accessControlProvider lt Refine gt s accessControlProvider lt Refine gt s accessControlProvider is responsible for enforcing authorization on every request sent from the app If we look at the lt App gt component we can see that it comes passed to the lt Refine gt component with the boilerplate code src App tsx lt Refine accessControlProvider accessControlProvider gt refine can MethodThe accessControlProvider implements only one method named can It has the following type signature type CanParams resource string action string params resource IResourceItem id BaseKey key string any Let s now work on the can method We can see from the type definition that resource and action are compulsory Initially we define our can method like this providers accessControlProvider tsimport newEnforcer from casbin import CanParams CanReturnType from pankod refine core import adapter model from casbin accessControl import supabaseClient from utility export const accessControlProvider can async resource action CanParams Promise lt CanReturnType gt gt const enforcer await newEnforcer model adapter const can await enforcer enforce admin resource action return Promise resolve can We will modify this gradually to witness the functionality facilitated out of the box by refine for each role defined in the policies We will finalize it after we update the getPermissions method in Supabase authProvider But for now notice in the above definition that we are passing the compulsory resource and action parameters to can We expect the useCan access control hook to take these two arguments For more use cases and implementations of can feel free to go through the elaborate examples in this definitive and guiding post In the above code we are initializing a Casbin Enforcer with the model and adapter We want this enforcer to enforce the policies with its accepted arguments At the end we get the Boolean decision based on the model s policy effect From inside a component the accessControlProvider can method will be invoked via the useCan hook With this code now there should be no change in our UI That is we should be able to view the contents of both our users and canvases resources like they were before When we visit the canvases route we should have all the buttons displayed We expect this behavior to change when we change the role In the can method above let s set the first argument of enforcer enforce to editor const can await enforcer enforce editor resource action And if we refresh at canvases we can see that the Delete button on each row gets disabled This is because now our policy for editor has taken effect The Delete button gets disabled because pankod refine antd s special buttons like the lt DeleteButton gt are enabled or disabled based on the result of access control enforcement Our editor policies do not allow a delete action on canvases resource so the Delete button is disabled Visit this section of the accessControlProvider API reference for the complete list of buttons that check for and depend on user authorization state in refine At this point we have manipulated the role with changes in our code This should however come from the authProvider s getPermissions method So let s look how to get the roles from our Supabase database next User Permissions with Supabase in RefineIn refine user roles are fetched by authProvider s getPermissions method It is already defined for us by pankod refine supabase Right now it looks like this src providers authProvider tsgetPermissions async gt const user supabaseClient auth user if user return Promise resolve user role However Supabase in itself does not support setting user roles to users in the auth users table So it is not possible to set editor and admin roles we need for our designated users And only two role options are available to the front end app authenticated and anon So before we can use the getPermissions method we have to set up custom user roles One way to implement this is with Supabase Custom Claims Setting Up User Roles with Supabase Custom ClaimsSupabase Custom Claims is a community contribution that enables setting additional data to the access token that a user receives from Supabase These claims are stored in the auth users raw app meta data field and is sent to the client with the access token We are going to use these custom claims to set and retrieve user roles for our app Supabase does not support custom claims on its own Due credits to burggraf they are enabled by installing a number of functions on our database These functions allow us to set and get custom claims for a particular user in the auth users table Here are two crucial particulars on how they work Only a user with a claims admin true claim can set claims data on others So we need to bootstrap a claims admin role for a first user using the Supabase SQL Editor Our app can access the getter and setter functions via Supabase Remote Procedure Calls RPCs with the supabaseClient rpc method With these in mind let s go ahead and set up Supabase Custom Claims on our database Installing Custom Claims FunctionsLet s start with installing the custom claims SQL functions Copy paste and run the install sql script in your Supabase SQL Editor Take a note of the function named get my claims https github com supabase community supabase custom claims blob main install sqlCREATE OR REPLACE FUNCTION get my claims RETURNS jsonb LANGUAGE sql STABLE AS select coalesce nullif current setting request jwt claims true jsonb gt app metadata jsonb jsonbThis SQL function will help us to remotely get user roles for our app And we are going to call it from our getPermissions method To understand the details please read through the Supabhase Custom Claims page Bootstrapping Claims Admin RoleWe then have to bootstrap a claims admin role because only users with claims admin true can set claims data for other users This is necessary for security of the claims admin feature and not for our app code So in the Supabase SQL Editor run the following query select set claim designated user uuid claims admin true This will allow the user with id designated user uuid to set roles for other users from inside our app We can also set other data from the SQL Editor such as the role itself Let s use the following SQL query to set roles for some of our designated users Doing so will help us in the coming sections select set claim designated user uuid role editor select set claim another designated user uuid role admin We need to take special care about using the correct quotations More on this in this section With these done we are ready to update our getPermissions and can methods refine getPermissions with Supabase Custom ClaimsHere s the adjusted getPermissions method providers dataProvider tsgetPermissions async gt const user supabaseClient auth user if user return Promise reject const data await supabaseClient rpc get my claim claim role return Promise resolve data Here we are basically using the supabaseClient rpc method to call the get my claims SQL function remotely refine can Method for Supabase Custom RolesAnd now we can finalize our can method with role received from authProvider getPermissions providers accessControlProvider tsexport const accessControlProvider can async resource action CanParams Promise lt CanReturnType gt gt const role await authProvider getPermissions const enforcer await newEnforcer model adapter const can await enforcer enforce role resource action return Promise resolve can Earlier on we have set admin and editor roles for a few designated users using the Supabase SQL Editor Now logging into their respective accounts will display the dashboard with Casbin policies applied In the canvases route an editor account should have the Delete buttons disabled because we don t have it in our policies In contrast it is enabled for an admin role But wait We haven t used the useCan hook or the lt CanAccess gt component anywhere yet How does refine get the value of role to decide whether to enable or disable the button Let s find out next Low Level InspectionIf we dig into the pankod refine antd package for the lt DeleteButton gt component we can see that useCan hook is used to decide the authorization status node modules pankod refine antd src components buttons delete index tsexport const DeleteButton React FC lt DeleteButtonProps gt gt const data useCan resource resourceName action delete params id resource queryOptions enabled accessControlEnabled if accessControlEnabled amp amp hideIfUnauthorized amp amp data can return null Since authorization comes baked in with lt DeleteButton gt we didn t have to worry about it in our case SummaryIn this post we implemented Role Based Access Control on users and canvases resources using refine s accessControlProvider in our Pixels Admin app We used Casbin model and policies to enforce authorization for editor and admin roles We saw how the accessControlProvider can method is used to enforce Casbin policies based on roles fetched from the backend using the authProvider getPermissions method We also learned how refine antd buttons like the lt DeleteButton gt implements access control via the useCan access hook In the next episode we will explore the auditLogProvider prop and add audit logging for pixels activities to both our Pixels and Pixels Admin apps |
2023-02-19 12:02:16 |
海外TECH |
CodeProject Latest Articles |
curry-console |
https://www.codeproject.com/Articles/5354858/curry-console
|
extra |
2023-02-19 12:06:00 |
海外ニュース |
Japan Times latest articles |
North Korea says surprise ICBM drill is ‘proof’ of ‘nuclear counterattack’ capabilities |
https://www.japantimes.co.jp/news/2023/02/19/asia-pacific/north-korea-icbm-suprise-launch/
|
North Korea says surprise ICBM drill is proof of nuclear counterattack capabilitiesPyongyang emphasized Saturday s launch of a Hwasong missile had been suddenly organized without previous notice in the first such drill involving a long range weapon |
2023-02-19 21:14:19 |
ニュース |
BBC News - Home |
Boris Johnson NI intervention not entirely unhelpful, says Mordaunt |
https://www.bbc.co.uk/news/uk-politics-64695633?at_medium=RSS&at_campaign=KARANGA
|
ireland |
2023-02-19 12:23:55 |
ニュース |
BBC News - Home |
Nicola Bulley search: Mordaunt says health revelations sexist and shocking |
https://www.bbc.co.uk/news/uk-england-lancashire-64696164?at_medium=RSS&at_campaign=KARANGA
|
health |
2023-02-19 12:16:17 |
ニュース |
BBC News - Home |
Aberhosan: Farmer dies and son seriously injured in accident |
https://www.bbc.co.uk/news/uk-wales-64695508?at_medium=RSS&at_campaign=KARANGA
|
aberhosan |
2023-02-19 12:24:32 |
コメント
コメントを投稿