python |
Pythonタグが付けられた新着投稿 - Qiita |
公開level botを改変して見やすくしていく |
https://qiita.com/gin_python/items/ae5153a3457247f8e0a5
|
|
2022-01-17 03:05:57 |
海外TECH |
MakeUseOf |
3 Ways to Set an Alarm on Your Mac: It's Not as Easy as You'd Expect |
https://www.makeuseof.com/how-to-set-an-alarm-mac/
|
alarm |
2022-01-16 19:00:12 |
海外TECH |
MakeUseOf |
How to Set Up Custom Volume Control Hotkeys in Windows 11 |
https://www.makeuseof.com/windows-11-custom-volume-control-hotkeys/
|
windows |
2022-01-16 18:45:11 |
海外TECH |
MakeUseOf |
How to Use Wakelet to Collaborate With Your Team Effectively |
https://www.makeuseof.com/how-to-use-wakelet-collaborate-team/
|
wakelet |
2022-01-16 18:30:02 |
海外TECH |
DEV Community |
REST API Design |
https://dev.to/blindkai/rest-api-design-27j9
|
REST API Design MotivationThis article is written primarily for backend developers that are looking for some practical examples of how to design their REST APIs so they would be strain forward for other developers as well as for API consumers The anatomy of the end point path HTTP methodEvery endpoint belongs to the HTTP method Those methods give developers and users a basic understanding of what action is performed on resources on that path It s required to use the proper HTTP method for each endpoint The details about each of the listed below methods can be found in RFC GET should be used if the endpoint returns information about the given resource list items get the item with ID get all subitems of the item with ID and so on POST should be used if the endpoint creates a resource during request or should somehow change the state of the resources create new item perform authentication PUT is used when there is a need to completely replace a resource with an updated version It s mostly used for update operations update item PATCH is similar to PUT but mostly is usable when you want to indicate that the resource can be partly updated change user status to active grant user a permission access DELETE as the name says it indicates that the endpoint performs deletion of resource delete item delete all items Other HTTPS methods are less common to use and you probably will know if you need to use them Endpoint pathAs we already know the HTTP method is a verb so to describe the endpoint path we need to use nouns in other words domain names For example to create a user we write POST users GOODPOST create user BADWe ve already specified POST as a method so we know it s going to create a user Another example to update user status PATCH users status GOODPATCH users set status BAD do not use verbs in pathsPUT users status BAD use proper HTTP methodMost of the time you will face CRUD routes with some additional end points to work with sub entities GET users Get list of usersGET users userID Get single user detailsPOST users Create a new userPUT users userID Update userDELETE users userID Delete userPATCH users access Partly update userGET users userID photos Get sub entityPOST users userID photos Create sub entityDELETE users userID photos photoID Delete sub entity Query parametersOften you need to specify additional parameters for pagination or some kind of filtering that is provided by your server PaginationIf you re not using pagination on end points that return lists of items you probably should because the growth of the database request would last a long time and suddenly block your server or database from running The user also won t be happy to wait seconds for items he doesn t want to see in numbers Example of query string with pagination GET users page amp pageSize Classic paginationGET users fromId Cursor pagination FilteringIn case you need to specify some additional search parameters or return only specific entity fields you will also add them into query string and parse on the server side GET users search John Search for user with name JohnGET users status active banned amp age Return only active or banned users within the specified age groups If you want to specify few filters you separate them by GET users online Fetch users that were online in range of dates SortingUsers usually want to see recent items or updates but sometimes they want to apply other sorting options GET users sort last online Sort by last online ASCGET users sort last online status Sort by fieldsGET users sort name amp desc true Sort by name in descending orderGET users sort name status Multisort with specifying as ASC DESC Response HTTP status codesDepending on the result of the request the server should return a proper status code to indicate if the request was successfully finished or there were errors and it can t be finished It s also a good practice to use the defined set of codes for all end points and provide additional messages within a response or in the documentation Those status codes are described at RFC RFC RFC and others Most of the time you would be using those status codes xx OK Simply means that the request was successfully performed and resource is available in response Created Mostly used in POST requests as an indication that resource was successfully created and stored in the server No Content Mostly used in DELETE requests to indicate that resource doesn t exist anymore xx Bad Request the request doesn t satisfy validation rules and the server denies processing it Addition details about errors can be specified in the response body Unautorized user is not authorized to use this end point Most of the time this is a status code to use if the user session is timed out or access token session token was not provided in the Authorization header or within a cookie Forbidden if it s a response to a sing in end point request it simply means that there is no user with such username amp password combination or that user has no right to perform the request Not Found the resource doesn t exist or there is no end point on this address The additional message about the error should be provided in the response body Conflict mostly used when performing the request is impossible due to a constraint on the server for example user with the specified nickname already exists or if the given entity was already modified before the user sent a request Unprocessable Entity means that the request schema is correct and it passes validation rules but the server can t process the request or work with that query Too Many Requests simply means that the user sent too many requests to the server for example if the user tries to log in too many times in minute xx Internal Server Error your server should have a handler for unexpected errors and send a response to the user if there is something wrong before shutting the server down ConclusionsIt s important to use things as they were designed to be used and to provide an interface that would be intuitive and easy to work with Also don t forget to document your APIs using popular instruments like Swagger It s helpful when you want to provide some explanations over what does this status code mean or how to use filters in this end point You will get some experience only by doing things With all the basic rules you should be fine until you will come to some specific cases |
2022-01-16 18:41:12 |
海外TECH |
DEV Community |
I've read... The Pragmatic Programmer |
https://dev.to/puritanic/ive-read-the-pragmatic-programmer-2bn9
|
I x ve read The Pragmatic ProgrammerTruly a classic It s definitely a must read book for programmers and even people managing programmers Initially released in The Pragmatic Programmer is a book about becoming a Pragmatic Programmer programmer that s a true professional in their craft And even though it was published twenty years ago it s fascinating to see the struggles we still face day in and day out discussed even then When I first started reading this book I ve expected a lot of technical details and lessons which is probably one of the reasons why I ve been avoiding this book so far I mean it s twenty years old and in today s pace of technology technical details do not stay up to date very long But instead this book concerns the most challenging parts of the programmer s career writing scalable and maintainable software and scaling themselves as professionals There are code snippets but the authors are aware of the code and techniques getting out of date in a matter of years so the book is not focusing on them too much In general there are not many surprises in what the book s authors are trying to deliver Any programmer who cares about their craft has no fear of change and already has a few years of experience will already know many themes explored in this book In my opinion most programmers are aware of the guidelines this book is preaching but they are also quick on finding excuses to ignore them The Pragmatic Programmer centers on how to use software to solve problems effectively and how to grow as the developer pragmatically not just how to be a good programmer but also how to solve the complex issues that surround coding such as Writing clean code through DRY Don t repeat yourself and YAGNI You aren t gonna need it How to estimate the software delivery How to institute change when others are hesitant How to combat stagnancy as a developer How to make the software processes resilient and efficient through automation and testing The examples and explanations are not abstract or far fetched but are somewhat real world applications of things you could see in the industry though some stuff is outdated Some of the significant points of the book that I m going to go through are We should take responsibility for our code and decisions Do not leave broken windows unrepaired Think critically Know your tools Program and refactor deliberately Use Version Control Test your code Automate all the thingsHunt and Thomas are stating that the last three things from the list above are the essence of the Pragmatic Starter Kit and that they should be the three legs that support every project ResponsibilityWhen you have responsibility for something you should prepare yourself to be held accountable If you make mistakes and cannot fulfil those responsibilities you have to make up for them and find a solution Don t give excuses and play the finger pointing game When you make a mistake to err is human or an error in judgment admit it honestly and try to offer alternatives Don t blame all the problems on a vendor a programming language management or your coworkers Any of these may play a role but it is up to you to provide solutions not excuses Don t approach anyone to tell them that something couldn t be done before you are entirely sure that that s correct Additionally don t just say you can t do it like it s the end of the story Instead provide options and explain what can be done to salvage the situation As the authors of the book say Try to flush out the lame excuses before voicing them aloud Does your excuse sound reasonable or stupid How s it going to sound to your boss Try to flush out the lame excuses before voicing them aloud If you must tell your cat first Broken windowsThere is a story in the book about research studying the effect of broken windows on urban areas One broken window left unrepaired for any substantial length of time instills in the inhabitants of the building a sense of abandonmentーa sense that the powers that be don t care about the building So another window gets broken People start littering Graffiti appears Serious structural damage begins In a relatively short span of time the building becomes damaged beyond the owner s desire to fix it and the sense of abandonment becomes a reality We programmers have probably seen this in some codebases We see some broken code and think it s okay to leave it We ll just come back when there is not enough work and fix it But unfortunately this is just the first step to degradation of code quality and serious tech debt After one broken window the others will start appearing more frequently and this is usually the time when developers start looking for a new job leaving a dumpster fire behind So please don t leave broken windows bad designs wrong decisions or poor code unrepaired Fix each one as soon as it is discovered If there is insufficient time to fix it properly create a ticket fix the most offending issue if possible comment out the code or leave a screaming comment Ultimately you should take action to prevent further damage and show that you re on top of the situation Do not fall to the Bystander effect hoping that other developers will fix the problems Instead take the initiative and be a catalyst for change Think criticallyYou should think critically about what you read and hear You need to ensure that your knowledge and opinions are unswayed by either vendor or media hype Beware of the salesman who insists that their solution provides the only answer it may or may not apply to you and your project or they might be just trying to sell you the snake oil Try to ask and think with the following questions when you want to get to the bottom of something Ask the Five Whys Ask a question and get an answer Then dig deeper by asking another why Then repeat the question as long as it s reasonable to do You might be able to get closer to a root cause this way Who does this benefit It may sound cynical but following the money can be a helpful path to analyze What s the context Everything occurs in its context which is why one size fits all solutions often don t work Good questions to consider are best for who What are the prerequisites what are the consequences short and long term When or Where would this work Under what circumstances Don t stop with first order thinking what will happen next but use second order thinking what will happen after that Why is this a problem Is there an underlying model How does the underlying model work Do you even have the same problem Know your toolsThis could seem like simple advice but we are surrounded by a wide range of tools in our daily jobs I don t know the ins and outs for each one I m using for sure For example a few days ago I ve learned about git add patch functionality that allows us to stage only parts of the changed files While I m not sure that it would be advisable to learn everything possible about tools we re using for development learning about stuff that can make you productive is definitely something we should strive for For example pay attention to your daily flow and see what manual actions you are performing most often Then look if those can be automated or improved somehow The book teaches us that it s essential to find the proper tools before starting the development By essential tools it s not just the IDE but also the programming language and services The more you are versed with different technologies the wider the picture you ll have So before blindly jumping into coding take a step back Understand why the problem or the feature at hand needs to be built in the first place Next find the right tools for the job and start coding Some of the authors recommendations Use plain text for everything Avoid using binary formats to keep knowledge such as MS Word Learn some scripting language well to use it for text manipulation Js Ruby Python Learn shell awk grep etc Have your dotfiles configured and backup them regularly Program and refactor deliberatelyIn the face of ambiguity refuse the temptation to guess Be wary of premature optimization It s always a good idea to make sure an algorithm is a bottleneck before investing your precious time trying to improve it The less code is there the fewer chances for bugs to happen Always be aware of what you are doing if you don t understand the background of the feature you re implementing you may fall victim to false assumptions Don t blindly copy paste code you don t understand and don t do shotgun programming or programming by coincidence as the book s authors call it For example suppose you don t know why or how your program works In that case you ll probably end up in a situation where you don t understand why the code is failing which would usually result in spending a significant amount of time chasing the piece of code until you if know how it was working in the first place A litmus test for the above can you explain your code to a more junior programmer If not perhaps you are relying on coincidences As mentioned in the previous section don t jump to coding right away Instead create a plan even if it s just a to do list written as comments in your editor or on a napkin After that prioritize your efforts by spending time first on the complex parts of the problem Don t be a slave to history meaning that you should not let existing code dictate future code All code can be replaced if it is no longer appropriate Even within one program don t let what you ve already done constrain what you do next be ready to refactor but keep in mind that this decision may impact the project schedule The assumption here is that the impact of doing refactor will be less than the cost of not making the change Martin Fowler defines refactoring as a Disciplined technique for restructuring an existing body of code altering its internal structure without changing its external behavior The critical parts of this definition are that The activity is disciplined not a free for allExternal behavior does not change this is not the time to add featuresTo guarantee that the external behavior hasn t changed you need good preferably automated unit testing that validates the code s behavior Use Version ControlThis advice sounds a bit outdated but it s worth a mention Today s software development landscape is very different from twenty years ago at least when version control is considered git is deeply entrenched in the development flow and I myself can t imagine working on a project without version control Additionally the book suggests using version control for everything we deem important notes and documentation as an example My take on this is that besides the version control you should also strive to keep your git history clean and searchable by using semantic commits for example and utilize the VCS for automation whenever possible Test your codeYet another common sense advice And still one that s not utilized as much as it should be in most cases Testing was important twenty years ago but today it s even more critical when we account for a growing number of programs that can quickly kill people in case of malfunction Book authors even suggest that the test code should be larger than the program source code and that we should treat the test code with the same care as any production code Keep it decoupled clean and robust Don t rely on unreliable things like the absolute position of pages in a GUI system exact timestamps in a server log or the exact wording of error messages Testing for these sorts of things will result in fragile flaky tests The pragmatic programmer is ruthlessly testing their code The time it takes to write test code is worth the effort as it ends up being much cheaper in the long run with a chance of producing a product with close to zero defects Automate all the thingsAutomation is the core principle of being a pragmatic programmer You should find whatever manual task you ve or someone on your team has been doing and automate them Automation leaves less space for human error and drastically improves the processes Automation also plays nicely with the other two legs of the pragmatic starter kit version control and tests You should automate your processes to run tests on VSC changes and if stable enough even deploy the code to production on demand The more stuff you automate the more time you ll have to dedicate to the real problems But don t fall into the trap of automating something that s not really worth the effort Pragmatic Teams Great things in business are never done by one person They re done by a team of people Steve JobsTeams as a whole should not tolerate broken windowsーthose slight imperfections that no one fixes Instead the team must take responsibility for the quality of the product As a final note the book says that we as individuals should take pride in our work and leave our mark on it However we still need to balance this out when working in teams to not become prejudiced in favor of our code and against our coworkers You shouldn t jealously defend your code against intruders and you should treat other people s code with respect The Golden Rule Do unto others as you would have them do unto you and a foundation of mutual respect among the developers are critical to make this work Anonymity can provide a breeding ground for sloppiness mistakes sloth and bad code especially on large projects It becomes too easy to see yourself as just a cog in the wheel producing lame excuses in endless status reports instead of good code While code must be owned it doesn t have to be owned by an individual In fact Kent Beck s eXtreme Programming recommends collective ownership of code but this also requires additional practices such as pair programming to guard against the dangers of anonymity In the end what you want of your career as a pragmatic programmer is for other people to recognize your signature They see the feature or program built by you and expect it to be solid well written tested and documented ConclusionI suggest this book to everyone it s an easy and interesting read even though senior developers are less likely to learn something new from it Also this is just a quick and short ish overview of the book s content I haven t covered everything I ve learned from it and there is a lot of stuff that s also worth reading about such as Orthogonality Design by Contract debugging Tracer Bullets technique and more |
2022-01-16 18:24:51 |
海外TECH |
DEV Community |
I created Quiz-app a quiz game ecosystem |
https://dev.to/johnbabu021/i-created-quiz-app-a-quiz-game-ecosystem-2kn2
|
I created Quiz app a quiz game ecosystemI have created a quiz app with Html and Javascript months ago which i used to learn javascript intermediately it uses basic javascript queries This Application is best for beginners and Intermediate Javascript LearnersStory so farwhen i was thinking to create a Quiz app for students who can take excerises from an application i didn t found a free Application that s why i created this projectfeatures Open sourcedRuns onlineHave Multi platform supportHave Multi device supportAccesibility from anywhereDark and Light Themes Contributorsfeel free to contribute on Github Light mode Dark mode Running Live DemoFeel Free to Contribute on Github |
2022-01-16 18:14:19 |
海外TECH |
DEV Community |
I created Sweetgradients a Color gradient Ecosystem 🧠 🧠 |
https://dev.to/johnbabu021/i-created-sweetgradients-a-color-gradient-ecosystem-4jh9
|
I created Sweetgradients a Color gradient Ecosystem SweetGradients A Platform where you can find out color graidents easilyStory behind SweetGradients When i was looking for gradients to be used in a project i didn t find anything but finally i findout a web app called Uigradients built with Vue js So i created a React js version of thatGithubdemoFeel Free to contribute on this project GithubMade with |
2022-01-16 18:13:17 |
海外TECH |
DEV Community |
(function(){....})() Did you Know what is this |
https://dev.to/johnbabu021/function-did-you-know-what-is-this-6n3
|
function Did you Know what is thisthis function is called Immediately Invoked Function Expression IIFE what s the use of this functionwell this function get invoked itself at the time of load and we can do any ui process at that time let s say if i want to get data from localstorge at the time of load to find the theme used by the user let s take this eg function const value localStorage getItem theme if value Dark Mode darkMode darkMode is outside IIFE else if value Light Mode return null else localStorage setItem theme Light Mode this code initially check theme and if it is dark calls another function in the script if it is light it returns null and if value is not present then create a theme useful in next load |
2022-01-16 18:04:17 |
海外TECH |
DEV Community |
How to create user IAM role for AWS console |
https://dev.to/deeppatel0311/how-to-create-user-iam-role-for-aws-console-43j8
|
How to create user IAM role for AWS consoleSign in to the AWS Management Console and open the IAM console at In the navigation pane choose Users and then choose Add users Type the user name for the new user This is the sign in name for AWS If you want to add multiple users choose to Add another user for each additional user and type their user names You can add up to users at one time Select the type of access this set of users will have You can select programmatic access access to the AWS Management Console or both •For Console password choose Autogenerated password or Custom password On the Set permissions page specify how you want to assign permissions to this set of new users Choose one of the following three options •Add user to the group •Copy permissions from an existing user •Attach existing policies directly Optional Add metadata to the user by attaching tags as key value pairs Next Review to see all of the choices you made up to this point When you are ready to proceed click on Create user Now your login details is already to use Login using your credentials Login PageFor more IAM user details check out AWS guide Link |
2022-01-16 18:00:29 |
Apple |
AppleInsider - Frontpage News |
Only the 'iPhone 14' Pro models will have ProMotion displays |
https://appleinsider.com/articles/22/01/16/non-pro-iphone-14-models-wont-have-promotion-displays?utm_medium=rss
|
Only the x iPhone x Pro models will have ProMotion displaysThe iPhone may not use ProMotion in its non Pro models with a new report claiming that consumers will have to wait until the iPhone in for the feature The capabilities of upcoming iPhone displays are persistently rumored about between launches However while the iPhone Pro range saw the addition of Hz ProMotion to its display it may not spread to all iPhone models In a tweet thread about the camera hole design for the iPhone Pro models analyst Ross Young of Display Supply Chain Consultants responded to a query about the non Pro models and whether there was any expectation of ProMotion s addition in Young said it wasn t going to happen Read more |
2022-01-16 18:33:26 |
Apple |
AppleInsider - Frontpage News |
Best deals Jan. 16: $447 Panasonic Lumix FZ300, $50 Kindle, Razer discounts, more! |
https://appleinsider.com/articles/22/01/16/best-deals-jan-16-447-panasonic-lumix-fz300-50-kindle-razer-discounts-more?utm_medium=rss
|
Best deals Jan Panasonic Lumix FZ Kindle Razer discounts more Sunday s best deals include hefty discounts on Razer gear off the Panasonic Lumix FZ and off the Amazon Kindle Best Deals for January Following the chaos of the January sales we ve collected some of the best deals we could find on Apple products tech accessories and other items for the AppleInsider audience Read more |
2022-01-16 18:29:01 |
ニュース |
BBC News - Home |
Texas synagogue hostage-taker was British |
https://www.bbc.co.uk/news/world-us-canada-60014006?at_medium=RSS&at_campaign=KARANGA
|
akram |
2022-01-16 18:29:41 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
SUBARU WRX S4、新開発2.4Lボクサーターボ搭載の革新4WDスポーツ【試乗記】 - CAR and DRIVER 注目カー・ファイル |
https://diamond.jp/articles/-/293286
|
SUBARUWRXS、新開発Lボクサーターボ搭載の革新WDスポーツ【試乗記】CARandDRIVER注目カー・ファイル人気リアルスポーツセダンが第世代に進化した。 |
2022-01-17 03:50:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
TikTokスターの収入、米大企業CEOの報酬上回る - WSJ PickUp |
https://diamond.jp/articles/-/293332
|
tiktok |
2022-01-17 03:45:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
ひろゆきが教える「迷える就活生へのアドバイス」ベスト1 - 1%の努力 |
https://diamond.jp/articles/-/292857
|
youtube |
2022-01-17 03:40:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
政府が推進するマイナンバーカード普及、鍵を握るのはシニア女性層 - 数字は語る |
https://diamond.jp/articles/-/292993
|
健康保険証 |
2022-01-17 03:35:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
第一生命グループのネオファーストが「歯数割」を導入したワケ - ダイヤモンド保険ラボ |
https://diamond.jp/articles/-/293336
|
生命保険 |
2022-01-17 03:30:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
オミクロンは意外に早く収束? 英国で見えてきた希望の光 - WSJ PickUp |
https://diamond.jp/articles/-/293194
|
wsjpickup |
2022-01-17 03:25:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
中国経済のゆがみ、「男余り」が影響か - WSJ PickUp |
https://diamond.jp/articles/-/293065
|
wsjpickup |
2022-01-17 03:20:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
精神科医が教える 「何気ない冗談」に潜む落とし穴 - 精神科医Tomyが教える 心の荷物の手放し方 |
https://diamond.jp/articles/-/292203
|
voicy |
2022-01-17 03:15:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
大野耐一が作り上げたトヨタ生産方式には、2人の先人の叡智が生かされていた【後編】 - 経営トップの仕事 |
https://diamond.jp/articles/-/292260
|
大野耐一が作り上げたトヨタ生産方式には、人の先人の叡智が生かされていた【後編】経営トップの仕事時代や環境変化の荒波を乗り越え、永続する強い会社を築くためには、どうすればいいのか会社を良くするのも、ダメにするのも、それは経営トップのあり方にかかっているー。 |
2022-01-17 03:10:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
阪神大震災が医学にもたらした知見「クラッシュ・シンドローム」とは? - すばらしい人体 |
https://diamond.jp/articles/-/293157
|
阪神大震災が医学にもたらした知見「クラッシュ・シンドローム」とはすばらしい人体累計万部突破唾液はどこから出ているのか、目の動きをコントロールする不思議な力、人が死ぬ最大の要因、おならはなにでできているか、「深部感覚」はすごい…。 |
2022-01-17 03:05:00 |
コメント
コメントを投稿