TECH |
Techable(テッカブル) |
限定グッズが抽選で当たる!オンラインくじ「プレギフ」が人気VTuber渋谷ハルとコラボ |
https://techable.jp/archives/200492
|
apexlegends |
2023-03-18 09:00:31 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
人工知能ChatGPTが作る永遠の会話。Gistを使った会話の記憶方法とその可能性 |
https://qiita.com/u1and0/items/e439597ff67c3ad2560b
|
chatgpt |
2023-03-18 18:41:29 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
WhisperとGPT-3のAPIを用いて会議音声とアジェンダから議事録を自動生成する |
https://qiita.com/5enxia/items/ee1e9536a87b46ed61c5
|
openai |
2023-03-18 18:25:20 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
クレジットカードの解約予測(Predict_CreditCard_Churn)_kaggle DataSet |
https://qiita.com/fuki9216/items/12917440c2f4e71ede0a
|
itcardchurnkaggledataset |
2023-03-18 18:13:21 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
Concernのアンチパターン |
https://qiita.com/hayura-k/items/e5cc8ad10a9f61c04a37
|
appcontrollersconcern |
2023-03-18 18:00:33 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
RDS インスタンスのメジャーバージョンのアップグレード |
https://qiita.com/leomaro7/items/68251f78d5cfd9f0f10b
|
適用 |
2023-03-18 18:30:25 |
Docker |
dockerタグが付けられた新着投稿 - Qiita |
Kaggle GPU用Win11(HOME)+WSL2+nvidia-dockerの構築(2023.03.18版) |
https://qiita.com/yukiZ/items/387e4b99c1f8c3db17ca
|
dockerimage |
2023-03-18 18:56:20 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
Concernのアンチパターン |
https://qiita.com/hayura-k/items/e5cc8ad10a9f61c04a37
|
appcontrollersconcern |
2023-03-18 18:00:33 |
海外TECH |
DEV Community |
Redux-like state container in SwiftUI: Connectors. |
https://dev.to/sergeyleschev/redux-like-state-container-in-swiftui-connectors-b31
|
Redux like state container in SwiftUI Connectors In the past month I gained a deep appreciation for the benefits of having a single source of truth and a state container to manage the entire application s state in a single place I ve already implemented this strategy in a few of my previous apps and intend to continue employing it in all future projects BasicsReducer and ActionsUnidirectional flowSide effectsUsageState normalizationState compositionReducer compositionDerived storesContainer Viewsimport Foundationstruct AppState Equatable var showsById Ids Show var seasons Ids Season var episodes Ids Episode var showImages Ids FanartImages var watchedHistory Ids enum AppAction Equatable case markAsWatched episode Ids watched Bool import SwiftUIimport KingfisherSwiftUIstruct HistoryView View ObservedObject var store Store lt AppState AppAction gt var body some View LazyVGrid columns init init ForEach store state watchedHistory id self id in posterView for id private func posterView for id Ids gt some View let image store state showImages id tvPosters first url let episode store state episodes id let title episode title let date episode firstAired Date return VStack image map KFImage Text title Text verbatim DateFormatter shortDate string for date foregroundColor secondary font subheadline The main issue here is the formatting logic that lives inside the view We can t verify it using unit tests Another problem is SwiftUI previews We have to provide the entire store with the whole app state to render a single screen And we can t keep the view in a separated Swift Package because it depends on the whole app state We can improve the case a little bit by using derived stores that provide only the app state s needed part But we still need to keep the formatting logic somewhere outside of the view Let me introduce another component that lives in between the whole app store and the dedicated view The primary responsibility of this component is the transformation of the app state to the view state I call it Connector and it is Redux inspired component protocol Connector associatedtype State associatedtype Action associatedtype ViewState Equatable associatedtype ViewAction Equatable func connect state State gt ViewState func connect action ViewAction gt Action extension Store func connect lt C Connector gt using connector C gt Store lt C ViewState C ViewAction gt where C State State C Action Action derived deriveState connector connect state embedAction connector connect action Connector is a simple protocol that defines two functions The first one transforms the whole app state into the view state and the second one converts view actions into app actions Let s refactor our view by introducing view state and view actions extension HistoryView struct State Equatable let posters Poster struct Poster Hashable let ids Ids let imageURL URL let title String let subtitle String enum Action Equatable case markAsWatched episode Ids typealias ViewModel Store lt State Action gt We create an entirely different model for our view that holds the only needed data The view state here is a direct mapping of the view representation and its model The view action enum is the only action that available for this particular view You eliminate the accidents where you call unrelated actions Finally your view is fully independent which allows you to extract it into a separated Swift Package import KingfisherSwiftUIimport SwiftUIstruct HistoryView View ObservedObject var viewModel ViewModel var body some View LazyVGrid columns init init ForEach viewModel state posters id title poster in VStack poster imageURL map KFImage Text poster title Text poster subtitle onTapGesture viewModel send markAsWatched episode poster ids Another benefit here is the simple view It doesn t do anything The view displays the formatted data and sends actions You can quickly write as many SwiftUI previews as you need to cover all the different cases like loading empty etc extension Store static func stub with state State gt Store Store initialState state reducer init in Empty eraseToAnyPublisher environment struct HistoryView Previews PreviewProvider static var previews some View HistoryView viewModel stub with init posters init ids Ids trakt imageURL URL staticString title Film subtitle Science It s time to create the particular connector type which we will use to bind the app state to the view state enum Connectors extension Connectors struct WatchedHistoryConnector Connector func connect state AppState gt HistoryView State init posters state watchedHistory compactMap ids in let episode state episodes ids return HistoryView State Poster ids ids imageURL state showImages ids tvPosters first url title episode title subtitle DateFormatter shortDate string for episode firstAired func connect action HistoryView Action gt AppAction switch action case let markAsWatched episode return AppAction markAsWatched episode episode watched true As you can see in the example above WatchedHistoryConnector is a simple value type that we can quickly test using unit testing Now we should take a look at how we can use our connector types Usually I have container or flow views that connect views to the store import SwiftUIstruct RootContainerView View EnvironmentObject var store Store lt AppState AppAction gt var body some View HistoryView viewModel store connect using Connectors WatchedHistoryConnector ContactsI have a clear focus on time to market and don t prioritize technical debt And I took part in the Pre Sale RFX activity as a System Architect assessment efforts for Mobile iOS Swift Android Kotlin Frontend React TypeScript and Backend NodeJS NET PHP Kafka SQL NoSQL And I also formed the work of Pre Sale as a CTO from Opportunity to Proposal via knowledge transfer to Successful Delivery ️ startups management cto swift typescript databaseEmail sergey leschev gmail comLinkedIn LeetCode Twitter Github Website |
2023-03-18 09:36:39 |
海外TECH |
DEV Community |
Unexpected Moments of JavaScript That Will Challenge Your Understanding of the Language |
https://dev.to/codeofrelevancy/unexpected-moments-of-javascript-that-will-challenge-your-understanding-of-the-language-4834
|
Unexpected Moments of JavaScript That Will Challenge Your Understanding of the LanguageAs one of the most popular programming languages in the world JavaScript is widely used for building dynamic and interactive websites web applications and even desktop and mobile applications JavaScript is a gateway to other web technologies because of its widespread use and compatibility with various platforms It has become a foundational language in modern web development It is also a complex language with many unexpected moments that can leave even the most experienced developers scratching their heads In this article we ll see various unexpected JavaScript moments that can confuse test your limits and frustrate you It will also help you to change the way you code Are you ready to make your brain explode If so let s enter the jungle ️⃣ true operator in JS performs type coercion which means it tries to convert the values being compared to a common data type before making the comparison In this instance the number is converted to a string and the array is converted to a string as well Resulting in both values being That s why the comparison evaluates to true It s generally recommended to use the strict equality operator instead of to avoid unexpected results due to type coercion Explore more true foo NaN falseundefined null true NaN NaN falseNaN NaN false null false️⃣ trueComparing an empty array with a boolean value created by negating using the operator a non empty array The result of this comparison is true which might seem unexpected at first glance In JS every value can be either true or false in a boolean context An empty array is a truthy value which means it s considered true in a boolean context When we apply the operator to it it s converted to false On the other side the boolean value created by negating a non empty array is false When we compare an empty array truthy with a false value falsy using the operator JS performs type constraint which means it tries to convert the values to a common type before comparing them So the empty array is converted to false which results in both sides being false At the end the comparison returns true Explore more a b a b true a b a b false ️⃣null undefined trueThe double equals operator is used to compare two values for equality while ignoring their data type When comparing the values null and undefined using the double equals operator they are considered equal and the result of the comparison will be true This is because both null and undefined represent a lack of a value and are so equivalent to each other in this context With strict equality operator null undefined false️⃣typeof NaN numbertypeof null objectIn JS typeof is an operator used to determine the type of a value or variable NaN stands for Not a Number and is a special value in JS that represents an undefined or unrepresentable numerical value When you use typeof with NaN it will return number This might seem strange but it s because NaN is technically a numeric data type in JS even though it represents something that isn t actually a number When typeof is applied to null it returns the string object This is because null is considered to be a special value that represents an empty object reference null is not an object itself but rather a primitive value This is considered to be a quirk or oddity in the language design of JS Explore more typeof function function null instanceof Object false️⃣true truefalse trueJS converts the string to the boolean value true and string to false because any non empty string is considered truthy and on other side falsy So the comparison becomes true true which is true and false false which is true Explore more true true false true false truetrue false ️⃣ When you use the operator with a string and a number the number is converted to a string and concatenated to the string If the string can be parsed as a number it will subtract the number from the string So becomes the string becomes the string becomes the number Explore more true true false false null undefined NaN Infinity Infinity abc NaNtrue gt false true undefined NaNundefined NaNundefined undefined NaNundefined undefined NaNnull null null null null null Infinity InfinityInfinity InfinityInfinity Infinity NaNInfinity Infinity InfinityInfinity Infinity NaN️⃣ b a a a baNaNa It concatenates the string b the string a the string resulting from the expression a and the string a a force the string a into a number which evaluates to NaN Not a Number because a is not a valid number When we concatenate b a NaN represented as an empty string and a we get the string baNaNa ️⃣ false false falseWhen we are comparing an empty object to a negated empty object The exclamation mark is a logical operator that negates the value of the object so returns false since an object is considered truthy in JS We are actually comparing to false which results in a false value since they are not equal in value or data type In the last expression we are comparing two empty objects Despite the fact that they may appear to be identical they are two separate objects with distinct references in memory so they are not equal in value or data type In the end the comparison also results in a false value When you use the plus operator between two objects wrapped in curly braces it tries to concatenate the objects as strings Explore more false true true object Object object Object object Object object Object false true false false null false undefined false ️⃣ gt gt falseFirst gt evaluates to true because is greater than Next true gt is evaluated In JS true is force into the number and false is force into So gt is false since is not greater than So at the end gt gt is equivalent to true gt which is false Explore more lt lt true gt null false️⃣️⃣Math max InfinityMath min InfinityMath max amp Math min are functions that can be used to find the largest and smallest values in a set of numbers respectively When called without any arguments Math max returns Infinity which represents the smallest possible number in JS on other side Math min returns Infinity which represents the largest possible number in JS This behavior makes sense because if there are no numbers provided there is no largest number to return for Math max and following same way there is no smallest number to return for Math min ️⃣️⃣parseInt parseInt parseInt x parseInt converts the string into the integer number If you were to write parseInt the function will still return The reason behind this is because the second parameter of parseInt function is the radix which specifies the numbering system to be used Let s say binary octal decimal hexadecimal etc If the radix is not specified parseInt will try to detect the radix based on the string format In above case is considered an octal number because it starts with so it gets converted into as a decimal number parseInt x converts the hexadecimal string x into the integer number The radix is not specified either but the prefix x indicates that the number should be treated as a hexadecimal number so it gets converted into as a decimal number Explore more parseFloat parseFloat ️⃣️⃣ function x delete x return x An anonymous function that takes an argument x Inside the function it tries to delete the x variable which is not possible because x is a function argument and cannot be deleted The function then returns the value of x When this function is called with the argument the value of x inside the function is set to In this case the delete operation has no effect the function simply returns the value of x which is Great job exploring and understanding these JavaScript concepts This knowledge will definitely help you in interviews and enable you to assess the skills of potential candidates as an interviewer Keep up the good work and continue learning something Ctrl N Motivation SupportPlease consider following and supporting us by subscribing to our channel Your support is greatly appreciated and will help us continue creating content for you to enjoy Thank you in advance for your support YouTubeGitHubTwitter |
2023-03-18 09:32:37 |
海外TECH |
DEV Community |
how to disable and Customize Whitelabel Error Page in Spring boot |
https://dev.to/realnamehidden1_61/how-to-disable-and-customize-whitelabel-error-page-in-spring-boot-2g25
|
spring |
2023-03-18 09:11:51 |
海外TECH |
DEV Community |
My VS Code extensions that I absolutely love and use all the time |
https://dev.to/raielly/my-vs-code-extensions-that-i-absolutely-love-and-use-all-the-time-2he1
|
My VS Code extensions that I absolutely love and use all the timeIn this article I d like to share with you some of the Visual Studio Code extensions that I find incredibly useful and use on a daily basis So if you re interested in enhancing your coding experience with some great tools keep reading and let s explore together Github ThemeI personally love to use the GitHub theme as my theme for VS Code It s not really an extension but it changes the look and feel of my editor It s easy on the eyes and makes reading code a breeze Material Icon ThemeWant to spice up your Visual Studio Code editor This extension has got you covered with a collection of icons to choose from PrettierSay goodbye to messy code with this extension It automatically formats your JavaScript CSS and HTML code making it look clean and organized PolacodeThis extension that lets you create shareable screenshots of your code complete with your preferred theme and font GitLensI love using these extensions to improve my Git workflow in VS Code They have been incredibly helpful BookmarksBookmark your code easily with this extension Just use the shortcut ctrl alt k to add or toggle a bookmark and ctrl alt l or ctrl alt j to navigate between bookmarks Error LensMake your code errors and warnings easier to spot with this extension that enhances the highlighting of errors warnings and other language diagnostics Project ManagerIf you work on multiple projects in Visual Studio Code and need to switch between them frequently the Project Manager extension can simplify the process and make managing easy ESLintThis amazing tool for coding JavaScript highlights common errors as I write code helping me detect and fix mistakes quickly Plus it provides real time validation to keep my code error free Live ServerCreate a local development server with ease using this extension It even includes a live reload feature that works for both static and dynamic web pages REST ClientWant to test your APIs without leaving Visual Studio Code The REST Client extension has got you covered It lets you send HTTP requests and view responses right inside VS Code Say goodbye to switching between applications Output ColorizerMake your log files easy on the eyes with this extension It adds syntax highlighting to your logs for a colorful and organized display JavaScript ES code snippetsThis extension is essential for web development as it offers code snippets for JavaScript Vue React and HTML Auto Rename TagThis extension helps you save time by automatically updating the name of the corresponding close tag when you modify the name of an open tag No need to manually update them anymore Auto Close TagSave time and maintain your HTML files easily with these two VS Code plugins They automatically rename and close your tags even in React s JSX syntax Auto ImportWith this extension you ll never have to manually search for imports again It automatically detects and suggests code completion and actions for all available imports in your code saving you time and effort Import CostImagine being able to see how much space a third party library takes up in your code That s exactly what the Import Cost extension does It even uses colors to show you which ones are heavy imports and highlights them in red so you can easily spot them npm IntellisenseThis awesome plugin for Visual Studio Code helps you quickly autocomplete your npm modules when writing import statements No more typos or manual searching for module names Path IntellisenseMeet the sibling of NPM Intellisense This awesome VS Code plugin now autocompletes your filesystem paths It s from the same maintainer as NPM Intellisense and it s become a must have tool for me Give it a try and simplify your coding workflow And there you have our selection of extensions thank you for reading this article that can enhance your productivity and coding experience I hope that these extensions from code completion to debugging to project file management will be helpful for you Let me know in the comments which ones you find the most useful Thanks again for reading |
2023-03-18 09:10:40 |
海外ニュース |
Japan Times latest articles |
Germany and Japan vow to deepen ties on defense and raw materials |
https://www.japantimes.co.jp/news/2023/03/18/world/politics-diplomacy-world/olaf-scholz-germany-japan-visit/
|
Germany and Japan vow to deepen ties on defense and raw materialsAmid global supply chain tensions Chancellor Olaf Scholz and Prime Minister Fumio Kishida kicked off a government consultation involving Cabinet members from both countries |
2023-03-18 18:44:37 |
ニュース |
BBC News - Home |
Abortion pills banned in Wyoming as Texas judge considers nationwide decision |
https://www.bbc.co.uk/news/world-us-canada-64998920?at_medium=RSS&at_campaign=KARANGA
|
common |
2023-03-18 09:09:17 |
海外TECH |
reddit |
Tuxedo kitten still looking for her forever home. |
https://www.reddit.com/r/japanlife/comments/11uj7gl/tuxedo_kitten_still_looking_for_her_forever_home/
|
|
2023-03-18 09:18:42 |
コメント
コメントを投稿