投稿時間:2022-06-11 20:15:40 RSSフィード2022-06-11 20:00 分まとめ(17件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
AWS AWS Japan Blog 教育機関の授業でAWSアカウントを学生に使わせる場合のFAQ https://aws.amazon.com/jp/blogs/news/faq-of-cloud-in-your-class/ 教育機関 2022-06-11 10:22:25
python Pythonタグが付けられた新着投稿 - Qiita PythonでGmailを自動送信する方法 https://qiita.com/curry__30/items/2e487168693b8248189a gmail 2022-06-11 19:41:31
python Pythonタグが付けられた新着投稿 - Qiita Bカーブの可変抵抗の入力値を使って擬似的にAカーブのようなデータを取り出す https://qiita.com/d_yan/items/1c3c6851441aa18dccfe 種類 2022-06-11 19:37:14
Docker dockerタグが付けられた新着投稿 - Qiita Dockerで構築したLaravelアプリでStorageをホスト上の外付けHDDに紐付けした話 https://qiita.com/yknb-php/items/847580587c00e05a91d6 docker 2022-06-11 19:38:04
海外TECH MakeUseOf 6 Clone Apps You Can Make When Learning C# Windows Forms https://www.makeuseof.com/windows-forms-create-clone-apps/ clone 2022-06-11 10:30:14
海外TECH MakeUseOf 7 Fixes For When Apple CarPlay Won't Work https://www.makeuseof.com/fixes-for-when-apple-carplay-wont-work/ quick 2022-06-11 10:15:14
海外TECH MakeUseOf Is Your USB Wi-Fi Dongle Lagging? 3 Ways to Fix It https://www.makeuseof.com/tag/usb-wi-fi-dongle-lagging-3-ways-fix/ Is Your USB Wi Fi Dongle Lagging Ways to Fix ItGot a wireless dongle that s misbehaving Three different methods can solve the majority of dongle problems USB extenders changing router channels and dual band routers 2022-06-11 10:06:13
海外TECH DEV Community What is Blockchain? How does it work? Why do we need it? https://dev.to/itsrakesh/what-is-blockchain-how-does-it-work-why-do-we-need-it-16ma What is Blockchain How does it work Why do we need it In the past few years the term blockchain has gotten a lot of attention from major media outlets and the public It s a fairly new technology that has proven to benefit many companies in different industries It is relatively easy to understand although it can seem difficult for beginners This article will explain how it works and why it s so revolutionary What is Blockchain Blockchain is a decentralized and public information database It s the technology that powers cryptocurrencies like Bitcoin Ethereum and Litecoin Simply put a blockchain is a database with additional functionalities It is not really a database but rather a ledger A ledger is a record that contains transaction details such as who sent who how much and when the transaction occurred Unlike a traditional database data added to the blockchain ledger cannot be changed or removed Why do we need Blockchain Assume Alice owes Joe and has agreed to pay him in three days They can both agree by recording it on a ledger a pinky promise A lot can happen in three days Alice has the possibility of reducing the payment from to Alice can change Joe s name to something different Alice can easily remove the record The ledger can be hacked This is terrible What should we do now The ledger must be encrypted You may now ask Why do we need such a complex technology like Blockchain for this Aren t powerful encryption techniques used in modern systems No there will always be a way to bypass current encryption algorithms or an administrator may become corrupt and leak or alter all data Once data is added into a blockchain ledger it cannot be changed or erased It will remain in place permanently But wait There s another problem Assume that Alice and Joe are best friends Alice is a trustworthy individual who will honor her obligations Now Alice does not always keep her money in her pockets or at her house No one else of course She deposits her funds into a bank account A lot of things can happen to the bank The bank may declare bankruptcy Some money heist shit can happen This is just another disaster Because your account is managed by a centralized bank they have access to your funds Don t we have legislation security and whatnot to protect our money you may ask again They cannot secure your money completely and you must waste years chasing after courts What do we do now Blockchain technology has the potential to fix this problem Blockchain is Distributed Ledger Technology DLT which means your data is distributed Your data is not controlled by a single company person or authority This is accomplished by replicating the datastore over a number of internet peers So blockchain s two key features Immutability and Distributed ledger made it a revolutionary technology How does Blockchain work Let s see how these two key features Immutability and Distributed ledger works To encrypt data Blockchain implements SHA hashing Unlike basic encryption methods such as the Caesar Cipher SHA is a one way function which means you can calculate the hash with your data but not decrypt it the hash How does SHA work You enter data gt the SHA algorithm computes the hash and generates a character hash It will always generate a fixed size ch hash regardless of the size of the data Try out SHA hereSHA algorithm implementation in JavaScriptLet s understand how the Bitcoin blockchain works Bitcoin blockchain data structureEvery block in Bitcoin blockchain contains Block number The block number in the chain Nonce A number used to validate a block Adjusted by miners to meet conditions that make a block valid Data The block s actual data Previous Hash The previous block s hash Hash The hash of the current block Calculated by appending all the above elements and hash them So we put our data in the block and hash it with a nonce To validate a block we must change the nonce value until the number of initial zeroes in the hash matches the difficulty level of the block Miners are responsible for this More on nonce here If you try to change anything in the block the block goes into an invalid state because the hash will change This is all about how a block works How do we add blocks to the chain To add a block to the chain we compute the preceding block s hash and store it in the newly added block This is how all of the blocks are connected If you modify anything in any block all subsequent blocks will become invalid since all blocks are linked and any change in the hash in one block impacts the hash in all subsequent blocks This is how a blockchain achieves immutability Now Alice can t cheat You can see how this works visually hereNow let s understand how distributed ledger works We saw how blockchain achieves immutability but what if data is changed and the hash is recalculated All of the blocks are now valid again This is precisely the issue with the current centralized approach However blockchain has another feature distributed ledger This means that the ledger is shared across a number of peers you can also say computers or hosts The hashes of all blocks will be the same for all peers If any peer attempts to modify the data and re validate the blocks the ledger will no longer match the other ledgers As a result we can conclude that the peer is guilty For example in a room of students assuming everyone has the same copy of the question paper A single person cannot simply change and claim that he received a different paper But there is a risk with distributed ledger technology what if out of students altered the question paper Who s guilty now Blockchain is constructed on the idea that honest peers are in the majority and the above situation is unlikely to happen All of this has resulted in the creation of cryptocurrencies such as Bitcoin where there will be no banks no intermediaries and no third party individual controlling your money However the major breakthrough occurred following the introduction of Etherium There will be more on this in future articles I tried to explain blockchain in a simple manner I hope you enjoyed it Follow for more Also please join my DaysOfWeb challenge 2022-06-11 10:39:35
海外TECH DEV Community InDepth Guide for Customizing Angular Material Button https://dev.to/shhdharmen/indepth-guide-for-customizing-angular-material-button-58do InDepth Guide for Customizing Angular Material Button IntroductionIt is a very common need in almost all applications to modify the components provided by rd party libraries Those modifications are generally done for Changing the stylesAdding a missing featureAnd it is very crucial for such libraries to provide ways to achieve those modifications easily In the first part of this tutorial we will learn how to modify styles so that our changes do not conflict with future updates of Angular Material library As a bonus I will provide a list of thumb rules which you should follow while making any style changes In the second part of this tutorial we will learn all the ways to customize angular material buttons and decide which is better By end of this article you will have idea about below topics How to create attribute directiveHow to create dynamic componentWhen to create component and when to create directiveHow to effectively modify any rd party library s components for both to add a feature and to change the styles Angular Material ButtonAngular Material s buttons are already enhanced with Material design and ink ripples and they also have a range of presentation options You can change the look and feel of buttons by using different attribute directives for different situations and needs For instance mat button is a rectangular button with text content mat raised button is the same as mat button but with elevation and mat icon button is circular and it s meant to contain an icon You can check all variants on the official site And there are theme colors provided with all variants primary accent and warn Now even with these many variants and options we may need to modify the default Angular Material button to achieve a feature or change of style Let s look and learn how to make both the changes effectively How to change stylesBefore moving into how to change styles let s first understand some rules to avoid any conflicting changes These rules are consolidated from customizing component styles guidelines Thumb rulesKeep below rules in mind whenever you want to change styles of any Angular Material component Define custom styles for a component s host elementChange styles which affect either position or layout of that componentmargin position top left transform z index etc Apply above styles modifications by defining a custom CSS class and applying it to component s host elementDo not change the styles which affect size or internal layout of the componentpadding height width or overflowDo not change or override the styles of internal elements of Angular Material components like in Angular Material button there are some internal components which produce ripple effect we should avoid modifying styles of such componentsProvide custom styles to overlay components like MatDialog MatMenu etc through panelClass property Add that class to your global stylesheet after including theme mixins By following above rules not just for Angular Material components but any component library we can safely achieve needed modifications and avoid causing breaking styles Now keeping the above rules in mind we will try to change styles of Angular Material buttons For this tutorial we will focus on below styles changes ColorShapeAnd at the end of the section we will also have a brief look for size and typography ColorThe very basic change we may need to font color and background color of buttons And that too with different states like hover focus and active Some time back I wrote an article about “Angular Material Theming System Complete Guide and in that I wrote a section titled “Customizing Angular Material Component Styles In that section I have explained how to modify the Angular Material button s colors But that approach was complex difficult to read hard to debug and not future safe The reason behind that was I re created many SASS functions and mixins which are supposed to be used by only internal elements of buttons and used them to achieve desired changes Now if the Angular Material team plans to change any internal styles those modifications will break So let s look at a more easy and recommended way to achieve color modifications Let s assume that you have added Angular Material in your project and selected a pre built theme to use At this time your style scss looks like below styles scsshtml body height body margin font family Roboto Helvetica Neue sans serif We will create a custom theme which should get applied only when it s inside custom theme class use angular material as mat custom primary mat define palette mat pink palette custom accent mat define palette mat blue grey palette A A A custom theme mat define dark theme color primary custom primary accent custom accent custom theme include mat button theme custom theme include mat progress spinner theme custom theme Note that we have only included button theme and progress spinner theme because in our demo we only use those components You can also use all component theme mixin to add all components themes but it will increase the size of the final output style For a more detailed understanding please refer to the article “Angular Material Theming System Complete Guide So now with the above code if in the HTML code we simply wrap the main container with custom theme class it will apply custom theme to components inside it Let s look at the output ShapeNext let s change the shape We want to add a shape variant such that buttons have a rounded borders Now according to thumb rules discussed earlier we can change the styles of host element which affect the layout of the component itself So to achieve the shape change we can simply add a class with needed changes and apply it safely to Angular Material buttons button rounded border radius Now if you apply the class button rounded you won t see the change The reason behind that is all variants of Angular Material buttons have their own border radius already applied like below mat raised button rest border radius px So considering selector specificity we will have to modify our code like below button rounded amp mat button amp mat raised button amp mat flat button border radius Now it will look perfect in the output Other styles changesApart from color and size there can be more changes needed Let s briefly look at some and how to modify them SizeModifications of size are not recommended because it violates our thumb rules Size customizations can lead to breaking changes with future updates And the Angular Material team has already followed material guidelines for the size which we should not change TypographyThis can be easily changed by using standard Angular Material theme mixins custom theme mat define light theme color primary custom primary accent custom accent typography custom typography For more details see Modify typography Next we will look into how to add a spinner in the button How to add MatProgressSpinnerAs mentioned in the heading we will show a MatProgressSpinner when loading is set with Angular Material s button Now there are ways to achieve that Let s look at them below and what are the pros and cons of each Template InterpolationWrapper ComponentDirective Template InterpolationFor template interpolation your code may look like this lt button mat button disabled isLoading gt lt mat spinner ngIf isLoading gt lt mat spinner gt Action lt button gt ProsThe main advantage of above code is quick readable and easy to customize as and when needed ConsRepetition Above code is fine but you will have to repeat the same lines and conditions at all places wherever you want to show MatProgressSpinner in buttons Changes at all places If you want to change something for example size of MatProgressSpinner you will have to find out all such instances and do the change Wrapper ComponentAnother approach and to overcome challenges faced with template interpolation we can think of proceeding with creating a wrapper component with needed inputs like below Component selector app button template lt button mat button gt lt mat spinner ngIf loading gt lt mat spinner gt lt ng content gt lt ng content gt lt button gt export class AppButtonComponent Input loading boolean ProsChanges at all places With the above now you can use app button everywhere to get the same button with mat spinner Reusability And if you want to change anything you just need to change in this component and it will reflect at all places Customizations As we are using component we can make template customizations easily ConsNative component properties Let s assume that at different places we want to use different variants of the Angular Material button Now for color you can simply add one more input and get all the variants of color But if you want to use different presentations like mat flat button or mat icon button things will start becoming more complex Events Apart from variants you will also have to handle events like click You will have to propagate the click event using Output up to its parent component Other directives support Angular Material button supports it s own MatTooltip and MatBadge directives out of the box To achieve support of all of the above in a wrapper component is not only difficult but complex and hard to maintain DirectiveWith directive we will first start with an input of loading state which will show hide MatProgressSpinner and also disable enable the MatButton Let s start with basic code Directive selector button export class ButtonDirective implements OnChanges Input loading false constructor ngOnChanges changes SimpleChanges void if changes loading return Create destroy spinner private createSpinner void private destroySpinner void In the above code we are creating a directive with tag selector so that it works with all amp lt button gt s We have added an Input called loading which will show hide the spinner inside button Now to show the spinner we are going to create the MatProgressSpinnercomponent dynamically and will place it inside thebuttonwhenloading is set to true typescript Directive selector button export class ButtonDirective implements OnChanges private spinner ComponentRef null ngOnChanges changes SimpleChanges void if changes loading return if changes loading currentValue disable the MatButton this createSpinner else if changes loading firstChange enable the MatButton this destroySpinner Above code is simple we are creating and destroying spinner based on loading s current value typescript Directive selector button export class ButtonDirective implements OnChanges Input color ThemePalette constructor private matButton MatButton private viewContainerRef ViewContainerRef private renderer Renderer private createSpinner void if this spinner this spinner this viewContainerRef createComponent MatProgressSpinner this spinner instance color this color this spinner instance diameter this spinner instance mode indeterminate this renderer appendChild this matButton elementRef nativeElement this spinner instance elementRef nativeElement private destroySpinner void if this spinner this spinner destroy this spinner null In the above code first we added an Input to read the current color We will use this property to set the color of the spinner Then we provided MatButton ViewContainerRef and Renderer classes in the constructor In the createSpinner method we are simply creating the MatProgressSpinner dynamically and storing its reference in spinner so that we can destroy it later on Notice how we created it dynamically typescriptthis spinner this viewContainerRef createComponent MatProgressSpinner And after creating we are appending it to the HTML element of MatButton with help of Renderer typescript this renderer appendChild this matButton elementRef nativeElement this spinner instance elementRef nativeElement And at last in the destroySpinner method we are destroying the spinner component and cleaning it up by assigning null value typescript Directive selector button export class ButtonDirective implements OnChanges Input disabled false ngOnChanges changes SimpleChanges void if changes loading currentValue this matButton elementRef nativeElement classList add button loading this matButton disabled true this createSpinner else if changes loading firstChange this matButton elementRef nativeElement classList remove button loading this matButton disabled this disabled this destroySpinner The last part is to make the MatButtton disabled when loading is true Apart from disabling we are also toggling a class button loading with it to achieve the desired styles Below is the styles code for button loading class scss button loading mat button wrapper visibility hidden mat progress spinner position absolute top calc px left calc px And the final code for directive looks like below typescript Directive selector button export class ButtonDirective implements OnChanges private spinner ComponentRef null Input loading false Input disabled false Input color ThemePalette constructor private matButton MatButton private viewContainerRef ViewContainerRef private renderer Renderer ngOnChanges changes SimpleChanges void if changes loading return if changes loading currentValue this matButton elementRef nativeElement classList add button loading this matButton disabled true this createSpinner else if changes loading firstChange this matButton elementRef nativeElement classList remove button loading this matButton disabled this disabled this destroySpinner private createSpinner void if this spinner this spinner this viewContainerRef createComponent MatProgressSpinner this spinner instance color this color this spinner instance diameter this spinner instance mode indeterminate this renderer appendChild this matButton elementRef nativeElement this spinner instance elementRef nativeElement private destroySpinner void if this spinner this spinner destroy this spinner null Above code is referenced from Button Angular Material Extensions ng matero github io Now with Angular Material buttons you just need to set loading to show a spinner inside of it Let s take a look at output Let s look at the above approach s pros and cons ProsNative component properties As you can see in the output the directive works with all variants of MatButtonEvents Also there is no need to write extra code handle eventOther directives support As we used directive other library directives support like MatBadge MatTooltip still exists ConsNo template control We do not have template control with this approach compared to wrapper component and inline template interpolationMore DOM manipulation As we do not have template control we have to do every template change through DOM manipulationSo compared with template interpolation and wrapper components the reusability without losing default features is the main and biggest advantage of this approach And that s why one should try to achieve such customizations with usage of directive ConclusionWe started with understanding why and which customizations can be needed when using any rd party UI components library Then we understood what Angular Material components library provides especially for buttons Next we compared all the approaches mentioned below to add a spinner in Angular Material buttons Template interpolation quick and easy to understand but reusability is missingWrapper component reusability is achieved but more complex code and setup required to keep support of default functionalitiesDirective support for default functionalities and reusability both achieved with less control over templateThen we understood some thumb rules to prevent our custom styling from breaking with major updates Next we learned how to effectively modify color size and typography And why we shouldn t modify the size of the Angular Material button I have uploaded the code at GitHub you can also take a look at it on stackblitz 2022-06-11 10:31:37
海外TECH DEV Community free Instagram post today https://dev.to/technocraft27/free-instagram-post-today-21ip free Instagram post todayhey world me technocraft I am a graphic designerand I have taken the challenge to create a professional post for Instagram or any other platform for free today anyone interested in this connects Instagram name is technocraft www instagram com technocraft 2022-06-11 10:06:35
ニュース BBC News - Home East Midlands Airport closes runway in new drone alert https://www.bbc.co.uk/news/uk-england-leicestershire-61769489?at_medium=RSS&at_campaign=KARANGA midlands 2022-06-11 10:24:17
北海道 北海道新聞 問題グマ、体毛採取し行動把握へ 標茶町、15カ所に「ヘアトラップ」設置 「オソ18」捕獲に期待 https://www.hokkaido-np.co.jp/article/692049/ 頻発 2022-06-11 19:37:39
北海道 北海道新聞 東京で1526人感染 コロナ、2人死亡 https://www.hokkaido-np.co.jp/article/692372/ 新型コロナウイルス 2022-06-11 19:20:05
北海道 北海道新聞 日本代表、チュニジア戦へ調整 キリンカップ、14日に決勝 https://www.hokkaido-np.co.jp/article/692405/ 日本代表 2022-06-11 19:28:00
北海道 北海道新聞 韓国とは「敵対闘争」 北朝鮮報道、緊張激化か https://www.hokkaido-np.co.jp/article/692404/ 北朝鮮メディア 2022-06-11 19:27:00
北海道 北海道新聞 上武大、亜大が決勝進出 全日本大学野球第5日 https://www.hokkaido-np.co.jp/article/692402/ 大学野球 2022-06-11 19:05:36
北海道 北海道新聞 札幌の80代女性、110万円だまし取られる https://www.hokkaido-np.co.jp/article/692403/ 札幌市東区 2022-06-11 19:18:00

コメント

このブログの人気の投稿

投稿時間:2021-06-17 22:08:45 RSSフィード2021-06-17 22:00 分まとめ(2089件)

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

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