python |
Pythonタグが付けられた新着投稿 - Qiita |
grib2のJRA-55をxarrayで読み込む方法と注意 |
https://qiita.com/kasugab3621/items/11feba502eb754abadd9
|
metpymondays |
2023-02-25 23:41:15 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
「ポケモンずかん」自主制作(SV対応1008種1226匹) |
https://qiita.com/mayomayomayo/items/428e1446bee55c507ff7
|
coding |
2023-02-25 23:38:13 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
pydanticからArgumentParserを作るライブラリを作った |
https://qiita.com/elda227/items/1a1c0f2f841a0bf33541
|
importargumentparserfromp |
2023-02-25 23:33:58 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
pandasでデータを結合していく【concat、merge、joinの違い】 |
https://qiita.com/a-hira/items/927dfc8b3f0733bdb483
|
concat |
2023-02-25 23:32:08 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
Javascript(Typescript) Map vs Object(インデックスシグネチャ) |
https://qiita.com/tomoyanp/items/cf8d28aa35c4fedae24c
|
itterable |
2023-02-25 23:59:57 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
tarやmysqldumpでローカルとS3に同時バックアップを実行 & 速度向上の施策 |
https://qiita.com/kh-yoshida/items/6ef740e6a82bbb21d703
|
mysqldump |
2023-02-25 23:12:02 |
Linux |
CentOSタグが付けられた新着投稿 - Qiita |
tf-idfをWikiepdiaダンプファイルからMeCabで計算--EC2(CentOS)で-- |
https://qiita.com/siotaro/items/a7900e8b6335e06e2fcd
|
eccent |
2023-02-25 23:14:48 |
Git |
Gitタグが付けられた新着投稿 - Qiita |
gti pushする時の自分用コピペ |
https://qiita.com/nakanaka444/items/a6a1d78b5f79d006eda5
|
urlgitpushori |
2023-02-25 23:09:58 |
技術ブログ |
Developers.IO |
CloudFormationでVPC IP Address Managerを構築してみた |
https://dev.classmethod.jp/articles/vpc-ip-address-manager-cfn/
|
vpcipadd |
2023-02-25 14:37:47 |
技術ブログ |
Developers.IO |
S3 버킷 액세스를 HTTPS로 제한해 보기 |
https://dev.classmethod.jp/articles/jw-try-restricting-s3-bucket-access-to-https/
|
S 버킷액세스를HTTPS로제한해보기안녕하세요클래스메소드김재욱 Kim Jaewook 입니다 이번에는S 버킷액세스를HTTPS로제한해보는방법을정리해봤습니다 S 버킷액세스테스트S 버킷으로액세스를하기위 |
2023-02-25 14:05:02 |
海外TECH |
MakeUseOf |
Why Is Everyone Using Notion? Is It Worth the Hype? |
https://www.makeuseof.com/why-everyone-using-notion/
|
everyone |
2023-02-25 14:30:17 |
海外TECH |
DEV Community |
Rust: Not Just Zoom Zoom Fast |
https://dev.to/nexxeln/rust-not-just-zoom-zoom-fast-bmb
|
Rust Not Just Zoom Zoom FastWhen it comes to Rust the first thing that usually comes to mind is its impressive performance And while Rust certainly delivers on this front there s so much more to the language than just raw speed From its well designed syntax and powerful abstractions to its robust package manager and vibrant ecosystem Rust is a language that truly has it all In this post we ll take a closer look at some of the key features that make Rust such a versatile and compelling language While the language features discussed in this post may not be exclusive to Rust it is the way in which they are carefully designed and integrated that sets Rust apart Rust is the only language where these features converge seamlessly to create a coherent system which is why it is such a captivating language Practical ImmutabilityIn Rust variables can be declared as either immutable or mutable using the mut keyword Rust embraces immutability as a default by making variables immutable by default This means that we must explicitly declare variables as mutable if we need to change their value later This approach makes it easier to reason about the behavior of programs and helps prevent accidental mutations let x immutablelet mut y mutabley okx error cannot assign twice to immutable variable x In addition to mutable variables Rust supports passing mutable references to functions Functions must declare whether they intend to mutate their arguments or not which further helps prevent accidental mutations This allows us to use mutable variables in a controlled explicit way fn increment num amp mut i num dereference the pointer to mutate the value fn main let mut x x is mutable increment amp mut x pass a mutable reference to x println x x prints x By embracing immutability as a default and using mutable variables only when necessary Rust code becomes more robust and predicatable Algrebraic Data Types ADTs and Pattern MatchingAlgebraic Data Types ADTs are a fundamental concept in functional programming that allow for the creation of complex data types by combining simpler types ADTs can be of two types Sum types and Product types Sum types combine multiple types into a single type that can hold one of the constituent types at any given time Rust provides a powerful implementation of Sum types in the form of enums or enumerated types Structs on the other hand are used to represent Product types You ve probably already used Product types in other languages interfaces in TypeScript classes in Java etc For example consider a program that represents the types of shapes We can use an enum to represent the different types of shapes enum Shape Circle f Rectangle f f Triangle f f f Here we have defined an enum Shape that has three variants Circle that takes a single f argument representing the radius Rectangle that takes two f arguments representing the length and width and Triangle that takes three f arguments representing the lengths of its three sides This allows us to represent any possible shape in a single data type Now we can use pattern matching to easily and safely parse the data of a shape If you don t know what pattern matching is think of it as a switch statement on steroids It allows us to match a value against a pattern and execute code based on the pattern that matches I have a whole blog post on pattern matching btw fn area shape Shape gt f match shape pi radius Shape Circle radius gt std f consts PI radius radius length width Shape Rectangle length width gt length width Heron s formula sqrt s s a s b s c where s a b c Shape Triangle side side side gt let s side side side s s side s side s side sqrt Rust s compiler also ensures that our pattern matching is exhaustive meaning that we must handle all possible cases This prevents us from accidentally forgetting to handle a case and causing a runtime error ADTs along with pattern matching make it trivial to create and handle complex data types in a safe and concise way Built In AbstractionsRust provides powerful built in abstractions that help in writing correct and safe code easily Two of the most important abstractions in Rust are Option and Result These types are essential for working with Rust s null safety and error handling systems which help prevent bugs and improve the reliability of Rust programs In this section we ll explore Option and Result in detail and see how they can be used to write more reliable and error free Rust code No Null No Problem Option Rust replaces the concept of null with the Option type providing a safer alternative that eliminates the risks associated with null values Option is an enum that can be either Some with a value or None to represent absence of a value This type safe approach allows us to handle absence of a value without resorting to null Here s how the Option type is defined in Rust enum Option lt T gt Some T None By using Option we can ensure that our code is free from null related bugs and errors making it easier to reason about program behavior You may be familiar with this pattern from other languages like Haskell s Maybe monad or OCaml s option type Let s look at Option in practice Consider a function that takes a vector of integers and returns the largest integer in the vector If the vector is empty we want to return None Otherwise we want to return Some with the largest integer Here s how we can implement this function in Rust fn largest numbers Vec lt i gt gt Option lt i gt if numbers is empty return None let mut largest numbers for num in numbers if num gt largest largest num Some largest Now we can use this function and use pattern matching to handle the both cases fn main let numbers vec match largest numbers Some num gt println Largest number num None gt println No largest number And this works But we can do better Rust provides an extensive standard library that includes a number of useful functions Here we can create an iterator from our Option and use the max function to get the largest number fn largest numbers Vec lt i gt gt Option lt i gt numbers into iter max This also automatically handles the case where the vector is empty returning None for us Rust s standard library is full of useful functions like this Want to return the double of the largest of the even numbers but only if it s less than No problem fn largest even less than numbers Vec lt i gt gt Option lt i gt numbers into iter create an iterator from the vector filter num num filter out only even numbers max get the largest number returns an Option lt i gt map num num double the Some value inside the Option leaves None unchanged filter num num lt amp only return Some if the value is less than I think you get the point When Things Don t Go As Planned Result Rust s Result type is another built in abstraction that is often used to handle errors in Rust programs It represents the success or failure of an operation Result is an enum with two possible variants Ok and Err Ok represents the successful result of an operation while Err represents an error that occurred during the operation Here s how the Result type is defined in Rust enum Result lt T E gt Ok T Err E You might be familiar with this pattern from other languages like Haskell s Either monad or OCaml s result type Let s look at an example of how Result can be used to handle errors Let s say we have a function that takes two integers as arguments and returns the result of dividing the first integer by the second However division by zero is not allowed and will result in an error We can use the Result type to handle the possible error case fn divide x i y i gt Result lt i amp static str gt if y return Err Cannot divide by zero Ok x y Now we can use this function and handle the success and error cases fn main match divide Ok result gt println Result result Err error gt println Error error Pretty simple right Let s look at some functions Rust provides to make working with Result a breeze Say we wanted to add to the result of a chained division operation We could use nested match statements but that s a bit ugly and verbose Rust has us covered with the and then and map functions fn main let result divide and then x divide x map x x match result Ok result gt println Result result Err error gt println Error error This is a lot more concise than using nested match statements Rust s standard library provides a lot more functions for working with Result and Option so be sure to check them out Vibrant Community and EcosystemRust is more than just a language it has a thriving ecosystem and community This community is supported by a robust ecosystem of libraries tools and resources that make it easy to build test and deploy Rust applications Here are some key aspects of Rust s ecosystem and community Rustup Rustup is the official tool for installing and managing Rust It makes it easy to install and update Rust and its associated tools It also makes it easy to install and manage multiple versions of Rust on the same system Cargo Cargo is Rust s package manager It s used to build test and run Rust applications It also makes it easy to manage dependencies and avoid dependency hell It also allows publishing libraries and binaries to crates io Rust s official package registry It can also do benchmarks and even manage multiple projects in the same repository using workspaces Libraries Rust has a large and growing collection of open source libraries and frameworks that can be easily integrated into your projects This includes everything from low level system libraries to high level web frameworks and game engines Tooling Rust has a strong focus on developer tools Tools like Rustfmt Clippy and Rust Analyzer that help with code formatting linting and analysis Community The Rust community is known for being welcoming and supportive with many resources available to help new users get started with the language This includes online forums chat rooms and meetups as well as a growing collection of Rust books and tutorials I particurlarly love Rust s community discord server It s a great place to get help with Rust and meet other Rustaceans These are some of my favourite features of Rust If I go on this article will be too long so I m linking some resources for Rust coolness below I highly recommend checking them out Some Other Cool ResourcesHow Cargo solved dependency hellRust MacrosRust s insanely helpful compilerRust traits |
2023-02-25 14:28:06 |
Apple |
AppleInsider - Frontpage News |
Daily deals Feb. 25: $549 M2 Mac mini, $219 Apple Watch SE, a Beats Fit Pro offer, and more |
https://appleinsider.com/articles/23/02/25/daily-deals-feb-25-549-m2-mac-mini-219-apple-watch-se-a-beats-fit-pro-offer-and-more?utm_medium=rss
|
Daily deals Feb M Mac mini Apple Watch SE a Beats Fit Pro offer and moreThe best deals for Saturday include Gen AirPods for a Target gift card offer on Lego Microsoft Office Home Business for Mac at and more Get an M Mac mini for today The AppleInsider team scours the internet for excellent deals at online stores to develop a top notch list of discounts on the top tech products including discounts on Apple products TVs accessories and other gadgets We share our top finds in our Daily Deals list to help put more money back in your pocket Read more |
2023-02-25 14:36:48 |
ニュース |
BBC News - Home |
NI Protocol: UK and EU appear to be on brink of new Brexit deal |
https://www.bbc.co.uk/news/uk-politics-64765375?at_medium=RSS&at_campaign=KARANGA
|
brexit |
2023-02-25 14:19:50 |
ニュース |
BBC News - Home |
Omagh police shooting: Support for John Caldwell in Beragh and Omagh |
https://www.bbc.co.uk/news/uk-northern-ireland-64757611?at_medium=RSS&at_campaign=KARANGA
|
sports |
2023-02-25 14:55:28 |
コメント
コメントを投稿