投稿時間:2022-04-11 01:24:19 RSSフィード2022-04-11 01:00 分まとめ(27件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
AWS lambdaタグが付けられた新着投稿 - Qiita 【Python】ビットコイン自動売買BotをAWS Lambdaで動かす https://qiita.com/soh_mitian/items/91ddbb37ec3fc70501df awslambda 2022-04-11 00:28:29
python Pythonタグが付けられた新着投稿 - Qiita OpenBB Terminal~フリーの金融分析プラットフォーム - 基礎編~ https://qiita.com/YuukiMiyoshi/items/77e963898a433aff36a3 openbbterminal 2022-04-11 00:42:17
python Pythonタグが付けられた新着投稿 - Qiita 【Python】ビットコイン自動売買BotをAWS Lambdaで動かす https://qiita.com/soh_mitian/items/91ddbb37ec3fc70501df awslambda 2022-04-11 00:28:29
python Pythonタグが付けられた新着投稿 - Qiita [python] redisでよくコマンド https://qiita.com/mykysyk@github/items/38e60835e225e9790053 importredisconnect 2022-04-11 00:17:47
AWS AWSタグが付けられた新着投稿 - Qiita 【Python】ビットコイン自動売買BotをAWS Lambdaで動かす https://qiita.com/soh_mitian/items/91ddbb37ec3fc70501df awslambda 2022-04-11 00:28:29
Docker dockerタグが付けられた新着投稿 - Qiita PHP5.6でOpenssl1.1.0に対応する https://qiita.com/terandard/items/9926eb6fb7a4d83f619a errorsslroutines 2022-04-11 00:12:37
海外TECH MakeUseOf How to Auto-Delete OTP Messages After 24 Hours on Android https://www.makeuseof.com/auto-delete-otp-messages-android/ How to Auto Delete OTP Messages After Hours on AndroidOne time passwords are important for keeping your online services secure yet they can clog up your Messages inbox Here s how to delete them 2022-04-10 15:45:13
海外TECH MakeUseOf 6 Ways to Selectively Delete Files in Windows 11 https://www.makeuseof.com/windows-11-delete-select-files/ precision 2022-04-10 15:15:15
海外TECH MakeUseOf 5 Quick Ways to Hide a File or Folder in Windows 7, 10, and 11 https://www.makeuseof.com/tag/3-quick-easy-ways-hide-folder-windows-7/ options 2022-04-10 15:15:15
海外TECH DEV Community 0-1 Knapsack Problem https://dev.to/amaan211/0-1-knapsack-problem-100k Knapsack Problem Introduction Knapsack problem is a kind of knapsack problem which is used to understand dynamic programming approach Unlike its brother fractional knapsack greedy does not guarantee an optimal solution for this problem It is solved using dynamic programming Here we can either pick up an object or leave it We are not allowed to pick fractions of an object Problem DescriptionSuppose that we are given n objects having a weight and a value associated with them We are also given a knapsack with capacity maxWeight Our goal is to get maximum profit out of these objects by picking those with most value and least weight while also keeping in mind that we do not overshoot our maxWeight Each object can only be selected once or not selected at all For example Input n maxWeight weights value Output In this case the objects having weights and with values and will have total value Which is the maximum ObservationHere the key observation is that we need to find the subset of weights whose weight sum is less than or equal to the capacity of the knapsack and having maximum value sum Why not Greedy Greedy works for fractional knapsack but not for knapsack Here is an example that disproves greedy approach for knapsack Assume that W and items are Item Value Size Value SizeA B C For knapsack if you apply greedy approach you pickup that item with highest value size ie item A Since A has a size of you only have space of left Now you cannot pick any more items That means that the only thing you have in your bag is Item A which is a total value of On the other hand if you had not been greedy and taken the most valuable item and had instead taken Item B then you would have enough room to take Item C as well This would have resulted in a total value of in the bag which is better than the greedy route Dynamic ApproachWe will use a D array for storing solutions to the smaller sub problems which will help us in calculating the final answer Here we do the same two operations stated in the recursive approach PICK UP THE OBJECTIf we decide to pick up the i th object profit will become value of that object optimized answer for the remaining weight ie value i dp i c weight i LEAVE THE OBJECTIf we decide to leave the object the profit will be the optimized answer for that weight ie dp i c The answer for a particular object will be the maximum of these values MAIN CONDITION dp i c max dp i c profits i dp i c weights i int knapsack int v int w int n int W int T n W for int j j lt W j T j for int i i lt n i for int j j lt W j if w i gt j T i j T i j else T i j max T i j T i j w i v i return T n W Time Complexity  O n W Space Complexity  O n W We used d array T as extra space 2022-04-10 15:48:53
海外TECH DEV Community Flutter GroupButton 5.0.0 release notes https://dev.to/frezyx/flutter-groupbutton-500-release-notes-35fn Flutter GroupButton release notes Hello everybody A lot of people have read my last post about my group button packageAnd I decide to tell you about huge package update to version The main feature of the update go to GenericsChangelog MAIN FEAT GroupButton lt T gt now is generic class Now you can create int DateTime double or YourCustomClass typed buttons List for default GroupButton constructor More here️BREAKING All deprecated by and fields was removed from package More here️BREAKING buttonBuilder from now build buttons by value The buttonIndexedBuilder took over the past functionality of the buttonBuilder️FEAT onSelected method now calling with value argument More hereINFO Updated examples amp README What is the meaning In new version you can set custom buttons value typeIt can be int DateTime double or YourCustomClassButton text will be result of toString model method in common button display caseGroupButton lt DateTime gt buttons DateTime DateTime Also you can use generic button values with custom buttonBuilderIn order to turn values into any widgetGroupButton lt DateTime gt buttons DateTime DateTime buttonBuilder selected date context return Text date year date month date day CustomizationIn order to customize your buttons inside GroupButton you can use GroupButtonOptionsGroupButtonOptions selectedShadow const selectedTextStyle TextStyle fontSize color Colors pink selectedColor Colors pink unselectedShadow const unselectedColor Colors amber unselectedTextStyle TextStyle fontSize color Colors amber selectedBorderColor Colors pink unselectedBorderColor Colors amber borderRadius BorderRadius circular spacing runSpacing groupingType GroupingType wrap direction Axis horizontal buttonHeight buttonWidth mainGroupAlignment MainGroupAlignment start crossGroupAlignment CrossGroupAlignment start groupRunAlignment GroupRunAlignment start textAlign TextAlign center textPadding EdgeInsets zero alignment Alignment center elevation GroupButtonValueBuilder buttonBuilderCustom builder method to createyour own custom buttons by button T valuefinal buttons GroupButton buttons buttons buttonBuilder selected val context return Text val is selected selected And this example equals to next gt GroupButtonIndexedBuilder buttonIndexedBuilderCustom builder method to createyour own custom buttons by button int indexfinal buttons GroupButton buttons buttons buttonIndexedBuilder selected index context return Text buttons index selected selected Remove deprecated and refactor baseAnd last awesome chage is update package apiNow you can create group of buttons by code line GroupButton buttons GroupButton buttons GroupButton buttons GroupButton buttons false true Thank you for reading this small post Connect with me on GitHub and pls put starfor this package 2022-04-10 15:33:56
海外TECH DEV Community Synchronous AWS Lambda & Amazon API Gateway limits and what to do about them https://dev.to/aws-builders/synchronous-aws-lambda-amazon-api-gateway-limits-and-what-to-do-about-them-2oec Synchronous AWS Lambda amp Amazon API Gateway limits and what to do about themIn the era of AWS serverless computing there are two services that one would argue are used together very frequently the AWS Lambda and Amazon API Gateway Combining these two services allows developers to create APIs that serve millions of customers daily scaling elastically depending on the workload It is not all sunshine and rainbows though In your AWS serverless journey you will at some point end up faced with inbound payload size limits most likely when interacting with AWS Lambda and Amazon API Gateway In this article I will lay out different alternatives you might want to consider when you end up in a situation where Amazon API Gateway and AWS Lambda inbound payload size limits constrain your synchronous workflow The typical AWS Lambda Amazon API Gateway synchronous architectureLet us examine what I would argue is the most typical synchronous architecture that combines the AWS Lambda and Amazon API Gateway services There is nothing wrong with it I would argue that the architecture is just fine for the vast majority of use cases especially for creating API routes in a serverless way The payload size difference problemIt is crucial to notice one critical detail the difference in maximum payload size of Amazon API Gateway and AWS Lambda This delta might be frustrating and confusing If you send a payload bigger than MB Amazon API Gateway will happily accept it and fail when invoking the AWS Lambda I m not aware of any other solution to this problem than to restrict the payload size in the user land Amazon API Gateway can validate the request via JSONSchema but to my best knowledge you cannot validate the size of the payload One might also look into AWS WAF where request body validation is possible but only for payloads of size up to bytes I need to process bigger payloads synchronouslyIf you cannot afford or do not want to re architect your solution to be asynchronous which would in theory enable you to process potentially unbound payload sizes there is one quick win type of change you can make that could fit your use case I m referring to compressing the payload before sending it to Amazon API Gateway Notice that the Amazon API Gateway is NOT decompressing the payload While the service in question has this capability it is the opposite of what we want to do If we were to decompress at the Amazon API Gateway level the service would try to send a MB payload to AWS Lambda resulting in an error I need more time to process my synchronous requestBy compressing the payload in the user land you can to some extent get around the MB payload size limit What about the second response timeout If your payload is large you might need more time to process the request synchronously Luckily with some changes to our infrastructure it is possible to bump the response timeout to minutes the AWS Lambda timeout AWS Lambda function URLA very recent addition to the AWS Lambda related family of features the AWS Lambda URL feature might be just what you need We ditch Amazon API Gateway in this architecture since it was the primary response timeout bottleneck Keep in mind that ditching Amazon API Gateway could have enormous consequences depending on the use case Amazon API Gateway is rich in features like validation caching usage keys plans etc By utilizing the AWS Lambda URL feature we gain the longer synchronous request timeout but lose all the niceties of Amazon API Gateway Keep this in mind while reaching out for this feature AWS Lambda fronted with Application Load BalancerInstead of using Amazon API Gateway for fronting the AWS Lambda function we can use the Application Load Balancer Like in the case of the AWS Lambda function URL feature you will lose many of the Amazon API Gateway features but gain a much longer response timeout In some architectures with high enough traffic and small sizes of the requests fronting AWS Lambda with ALB is much more cost effective than using Amazon API Gateway You can read more about it in this article Note about a lot you see for Maximum payload size and Response timeout for ALB I could not find quotas referring to these variables in the AWS documentation If you know the limits for those please let me know The ultimate solutionIf the MB payload size is not enough even with compressed payloads and the minutes of response timeout is too short consider re architecting for asynchronous communication In the end waiting for responses is expensive and reaching out for tools like AWS Lambda function URL or fronting AWS Lambda with ALB to go around the limits might be a sign that asynchronous processing would be the right fit for your use case AWS exposes various services to facilitate such workloads ranging from AWS Step Functions to AWS Batch or AWS Fargate and storing data on Amazon S This article would be too long if I were to describe all the possible asynchronous ways to get around the MB AWS Lambda payload size limit do not worry that article is next on my list Until that I will leave you with this great article written by Yan Cui as a sneak peek of what I will be covering Closing wordsI hope you find the approaches described in this blog post helpful Remember that all limits have a reason be it related to technical or hardware limitations Some might seem off putting like the MB AWS Lambda payload size limit Still I do wholeheartedly believe that some of them most likely by accident push your architecture more towards asynchronous communication which in most cases is a good thing Consider following me on Twitter wm matuszewski so that you do not miss the follow up article and more AWS serverless related content Thank you for your valuable time 2022-04-10 15:27:20
海外TECH DEV Community Day 2: I didn't quit (yay!) https://dev.to/yvad60/day-2-i-didnt-quit-yay-45dd Day I didn x t quit yay Hi or Hi again so I almost quit today but fortunately I didn t here s what happened So yesterday I decided I would be writing my daily random articles early in the morning as it recommended in several motivation videos that you should start your day productively but as always especially weekends I woke up feeling too lazy to do anything and one thing led to another and it was already PM and I was still finding excuses against sitting down and just typing something I realized as good as the result will be I will not be able to make it even to week consistently so I decided I was going to do what I always do gt QUITI logged in just to make yesterday article private so no one will know how I started a challenge and failed the next day and forgot all of this as if nothing happened and that s when I found that yesterday article had got views and comments which is viral to me I don t even know how a first post can be seen by that many peoplemainly I started this thinking there will be no one viewing any post but I really appreciate everyone that took their time to view or comment on yesterday post you really saved and motivated me to take it so seriously from now on to someone out there struggling at any challenge I know for a fact that consistency is the key but it s easier said than done signing off 2022-04-10 15:22:24
海外TECH DEV Community About roles in the front-end development department https://dev.to/starbist/about-roles-in-the-front-end-development-department-1lj5 About roles in the front end development departmentThree years ago Chris Coyier wrote about The Great Divide This article stuck with me for a long time since I always considered CSS my strongest skill Then last year Brad Frost wrote about front of the front end and back of the front end web development This article also stuck with me primarily because of the following definition “A front of the front end developer is a web developer who specializes in writing HTML CSS and presentational JavaScript code That s what I do I recently figured that I would call myself a website developer emphasizing the website part heavily It is because all other terms are somewhat vague Take CSS developers as an example Does a CSS developer need to know presentational JavaScript Take JavaScript engineers as an example Does a JavaScript engineer need to know accessibility basics Take UX engineers as an example Does a UX engineer need to know SEO basics Take web developer full stack and front end developer positions You couldn t possibly tell what these positions imply These terms are just too broad and they assume too many things So I ll call myself a website developer from now on That means I know SEO accessibility DNS basics HTML CSS presentational JavaScript the Open Graph Protocol etc I just build websites I don t know how to make web apps and I don t use any JavaScript frameworks anymore For me it doesn t matter which technology is in the background I know my way around WordPress Hugo Jekyll Eleventy Hexo Shopify HubSpot and whatever but that doesn t matter What matters is that the final code should be the same It should have functional code that could be processed by users browsers screenreaders crawlers and who knows what else As a website developer all I care about is that my sites are performant optimized and easily consumed Although I am not looking for a new position I like to browse available jobs and read the requirements Some companies do a great job explaining the role in detail On the other hand some companies don t even state which team is hiring For example a front end developer part of a product team has an entirely different job than one part of the marketing team I guess what I am trying to say is that we live in and we still don t have a system for making distinctions between these roles No wonder we have so many bad sites no wonder it is hard to find a good developer no wonder we have developers arguing over the usage of frameworks be it CSS or JavaScript ones and no wonder wrong persons do wrong jobs I hope this is just my point of view and that the reality is better But unfortunately I somehow feel like it is the other way around and that the reality is actually worse 2022-04-10 15:15:32
海外TECH DEV Community Deepgram x DEV Hackathon Submission x Deepgram-translator https://dev.to/anshnarula5/deepgram-x-dev-hackathon-submission-x-deepgram-translator-1mk5 Deepgram x DEV Hackathon Submission x Deepgram translatorー Overview of My SubmissionDeepgram translator is a tool for converting a speech which is then converted to text by Deepgram API to specified language Users have a choice to choose any language in which they want to convert their message WorkingUsed react to create this app Added allow microphone functionality Passed the input speech to Deepgram API to get the required text Then took the result obtained and passed it thorugh libretranslate api to get the translated text Submission Category Accessibility Advocates Link to Code on GitHub anshnarula deepgram translator This project was bootstrapped with Create React App Deepgram translatorDeepgram translator is a tool for converting a given text extracted by Deepgram API to specified language Users have a choice to choose any language in which they want to convert their message APP URI Run this app locally Clone Repo git clone Install Packages and run server on port npm installnpm startDemo Images View on GitHubLive Project Additional Resources InfoScreenshotsDemo Video Future UpdatesImprove UI of the app Add more features including speech to text API ー 2022-04-10 15:12:14
海外TECH DEV Community What's Something You Want to Learn How to Do in Your Code Editor? https://dev.to/devteam/whats-something-you-want-to-learn-how-to-do-in-your-code-editor-1egl What x s Something You Want to Learn How to Do in Your Code Editor I ve had quite the tour of text editors in my career And have settled on Emacs Today I sat down and wrote What s Something You Want to Learn How to Do in Your Editor in my personal agenda Then I filled it out I want to learn how to do multi edit within a highlighted regionI want to learn how to do undo within a highlighted region Both of these are possible in Emacs So I sat down and learned it and along the way learned about the amazing M x narrow to regionBut what about you What s something you want to learn how to do 2022-04-10 15:05:59
海外TECH DEV Community Boost your app accessibility with AI Speech Recognition (Deepgram)! https://dev.to/pavelee/boost-your-app-accessibility-with-ai-speech-recognition-deepgram-5fl9 Boost your app accessibility with AI Speech Recognition Deepgram Overview of My SubmissionThe goal is to provide extra way to input value It could be really helpful for people with disabilities anyone that have problems with typing on a keyboard You can fill any input using pointer and voice Cool Submission Category Accessibility Link to Code on GitHub pavelee react deepgram example DEV hackathon project usage of Deepgram AI Speech Recognition boost your app accessibility Boost your react app accessibility with AI Speech Recognition Deepgram What s that Deepgram PurposeWhy How it s working deepgram proxydeepgram reactRun a projectGet your API keySet your API keyRunUsing dockerUsing local envWhat s that It s example of integration with Deepgram using react Deepgram Deepgram is external service to transcript speech from audio using AI crazy stuff Read more here PurposePurpose is to use speech transcription to improve an react app accessibility We provide extra way to input value Help to provide input for people with disabilitiesSpeed up a form fillingShare expierience accross any deviceany device supporting modern browserreact native mobile TV dekstop as well Why Project was made as submission to DEV hackathlon read more hereHow it s working Project is built from two parts deepgram proxy and deepgram reactdeepgram proxyWe need some backend to upload audio file and communicate with… View on GitHub Additional Resources InfoI am using react as a frontend app It s important to remember that react frontend app is not necessary You can integrate proxy with any other type of app It s just REST API The process is pretty simple Display Deepgram componentAsk permission to microphone browser Record your voiceSending audio to proxyProxy ask Deepgram for transcriptionProxy responses with transcription error or warring about no transcription eg user need to repeat louder User receives transcription and apply to input Proxy from technical aspect It s node js express js to handle API requests and communicate with Deepgram using Deepgram SDK endpoint to upload and transcriptapp post audiotranscript upload single file async req res gt let filepath req file path let language req body language let transcript await deepgramTranscript deepgramApiKey filepath language res send transcript transcript Fronted from technical aspect It s simple handler you pass proxy url and setter for your value I prepared two visualizations of usage I am using antd design as component library Using wrapper that creates popover to any React component lt DeepgramHandlerPopover setValue setNotepadValue proxyUploadUrl proxyUploadUrl gt lt Input TextArea rows value value onChange ev gt setValue ev target value gt lt DeepgramHandlerPopover gt Using modal small devices friendly lt DeepgramHandlerModalButton setValue setNotepadValue proxyUploadUrl proxyUploadUrl buttonProps type primary gt If you have other idea you can easy just wrap handler lt MyCoolComponent gt lt DeepgramHandler setValue setValue proxyUploadUrl proxyUploadUrl gt lt MyCoolComponent gt Final thoughtsI really appreciate what Deepgram has created It is really well working even with my unclear English Amazing how tech industry improving our lives lt 2022-04-10 15:05:05
海外TECH DEV Community Understanding chart.js to showcase analytical metrics https://dev.to/oathkeeper/understanding-chartjs-to-showcase-analytical-metrics-589n Understanding chart js to showcase analytical metricsThere is a dire need of including a chart based library to showcase metrics at my workplace ecosystem While building features from scratch we realised a lot feature parity that comes from Looker dashboards It was a joint exercise to explore varius analytics dashboards that uses charts to show different metrics As an engineer developer there should be significant amount of data manipulation transformation processes done in order to understand what metric should be rendered in what format Going through chart js library and the documentation the learning curve is short The support for different set of data with several entities in one chart makes it more flexible This helped align our product requirements to data in a flexible way For the purpose of explaining the base design of code we will directly jump into the code part This can be divided into two major things A wrapper component on top of chart js to support base React js A custom function or React hook to separate business logicCustom wrapper componentimport React useEffect useRef useState from react import Chart from chart js auto import ChartDataLabels from chartjs plugin datalabels import chartjs adapter moment import PropTypes from mobx react returns JSX Element Native Chart accepts three basic props to render a chart with chartjs library type explains the kind of chart mentioned in CHART TYPES data the values and the labels that chart should renders options all the relevant options that should be providing a layout or design the chart export default function NativeChart props const chart setChart useState null const chartRef useRef null useEffect gt let config data props data plugins ChartDataLabels options props options Set and override chart types only if the prop type is provided props type amp amp config type props type let chart new Chart chartRef current config setChart chart return gt chart destroy setChart null props data props options return lt div className native chart gt lt canvas ref chartRef gt lt div gt NativeChart propTypes type PropTypes string data PropTypes object options PropTypes object This is a basic component setup that chart js recommends This includes the key canvas element which is where chart js draws the chart This canvas element draws the chart with the instance of config Config is made up of three major items which are getting as prop passed to this component type type of chart i e bar line area doughnut pie etc data A simple mapping object includes all the data points x axis ticks y axis ticks axes names entities lenged etc const labels Mar April May Utils months count const data labels labels datasets label My First Dataset data fill false borderColor rgb tension options Chart options are the key to modify the look and feel of the chart based on product specs This allows to modify text color aeshtetics truncate long strings interactions with charts like click and hover transformation of data points Function for Business logic custom react hook The wrapper native chart component can be reutilised in the container page of choice This is where it requires the type data and options available readily To separate this part we at Reporting have came up with a function that acts more like a custom react hooks As mentioned it returns us with type data and options In order for it to formulate these three components we can pass in major data and methods to mainly operate functionalities for these charts This separation also helps us in formualting the data before chart renders so we as engineers can make sure our rendering cycle is not dynamic with data changes container page of the Chart wrapper native component let chartType chartData chartOptions generateChart rep value currentTheme reportGroup populateDrills setTileActive executeScroll return lt gt lt NativeChart key rep value id only required when there are list of charts type chartType data chartData options chartOptions gt lt gt In this above snippet generateChart is that function which takes in all the data that comes from Backend e g reporting api Several other functions based on state of the app as well as functionalities to define interactions on top of chartThe internal structure of this function custom hook follows the same methodolgy to traverse through chart data The chart type can come predefined from the backend mentioning the kind of chart to render As we iterate over the chart data there can be several checks based on the type of chart All these checks can transform the chart data in a way that our wrapper component can be hydrated Along with this logic should be specified to modify the default chart options This way chart js has clear instructions to render with set of colors level of details readibility and view changes define default base chart typelet chartType define default chart datalet chartData labels report data labels datasets define default chart optionslet chartOptions animation false maintainAspectRatio false scales x title display report data title amp amp report data title x true false text report data title amp amp report data title x report data title x color currentTheme content color secondary font Inter padding top bottom ticks display true color currentTheme content color tertiary padding grid drawOnChartArea false drawTicks false borderColor currentTheme grey color currentTheme grey z offset true y title display report data title amp amp report data title y true false text report data title amp amp report data title y report data title y color currentTheme content color secondary font Inter padding bottom grid drawOnChartArea false drawTicks false borderColor currentTheme grey color currentTheme grey ticks display true padding crossAlign near color currentTheme content color tertiary autoSkipPadding beginAtZero true plugins legend display true position bottom labels usePointStyle true color currentTheme content color primary boxWidth generateLabels gt onHover e gt e chart canvas style cursor pointer onLeave e gt e chart canvas style cursor default onClick function e legendItem legend datalabels display auto anchor center clamp true font weight size lineHeight While this file can also hold other wrapper functions and conditionals for the different functionalities the basic logic is to iterate over the provieded chart data from backend and extract information and feed to this fundamental elements to returns i e chart type chart data chart options Here we check the data and for each dataset we indentify several options and actual data paremeters to render This setup provides strong ability to include several type of charts in one canavas to draw e g we have chart Used slots over time chart on this report page includes two sets of bar charts along with a line chart chartData datasets map report data dataset set index gt if set type DOUGHNUT transform chart data to feed transform chart options according to product specs and requirements e g also modify the CSS here for better look and feel set chartOptions scales x display false set chartOptions scales y display false we hide away ticks from showing up on any axis Provide the defined colour set to this chart options e g newSet backgroundColor DATASETS COLOURS slice newSet data length newSet borderColor DATASETS COLOURS slice newSet data length set or unset onClick onHover behaviours on chart chart data points etc set chartOptions onClick gt if set type BAR same as above if set type AREA same as above if set type LINE same as above On top of all this logic chart js provides a specific functionality where it understands the incremental values that can be computed automatically This is really beneficial to automatically render x axis y axis ticks At Reporting we have taken advantage of this and send the data from backend api in a format that supports a bucket of range as well as the type We call this as timeseries charts They can span through any range of dates time with a start and end point A format should be provided based on spec Example as follows continue in the previous code snippetif report data suggests that it is a timeseries chart setup the values based on bucket and other things set chartOptions scales x chartOptions scales x type time min report data startLabel max report data endLabel time unit report data bucket displayFormats report data bucket report data labelFormat Once all this is setup this custom functions makes a complete dish of chart type chart data amp chart options that can be fed to wrapper native component to render This document is a comprehensive walkthrough of code design I ve aimed at solving the need of data transformation such that different teams can modulate their data to achieve the best possible viewing results References We have used this to modify the view and interactions of data labelsHelper libraries like Lodash moment js classnames Alas 2022-04-10 15:01:19
海外TECH DEV Community The case for TS+ https://dev.to/matechs/the-case-for-ts-18b3 The case for TS Hi So what s this gonna be about well with the Effect community we ve been hard working in the last months on something new that I am now truly proud to introduce in details for the first time Let s begin with a little bit of a back story during the last years yeah already that long we have been working hard on the development of Effect it started as a small project inspired by some of the ideas of ZIO in Scala and it progressively evolved to a full blown port of all the core modules of ZIO together with a very rich set of extension modules that bridges the gap between the data structures available in Scala land and in TypeScript During all this work we have grown to love much of the TypeScript language and we were very surprised since the very first days how much we could do and how safe and nice to use the system would come up We have also learned a good amount of limitations not really limitations on what we could do in the language but rather what we could do efficiently in the language in terms of verbosity and in terms of tree shakability of the produced code Let s start with one example The development of fluent APIs A fluent API in TypeScript would look something like export class IO lt A gt static succeed lt A gt a A gt new IO gt a static succeedWith lt A gt a gt A gt new IO a private constructor readonly io gt A map lt A B gt this IO lt A gt f a A gt B IO lt B gt return new IO gt f this io flatMap lt A B gt this IO lt A gt f a A gt IO lt B gt IO lt B gt return new IO gt f this io io zip lt A B gt this IO lt A gt b IO lt B gt IO lt A B gt return new IO gt this io b io run lt A gt this IO lt A gt return this io Used like export const program IO succeed map n gt n flatMap r gt IO succeedWith gt console log result r program run In this approach we have a data type IO lt A gt together with a companion object IO and we put constructors like succeed and succeedWith in the companion object as static members and we put methods in the class instance as members of the type IO lt A gt This approach is very common in object oriented languages and its advantages lie in the ease of use in fact for the user of such a module the editor experience is beautiful if you want to construct an IO you type IO and get a full list of suggestions on ways you can construct when you want to do something with a value of type IO lt A gt you do value and you are again prompted with a nice list of options This type of API is a dream but also has a few drawbacks that have led the biggest part of the FP community away from it The limitations are staggering all the methods have to be inside the class or inside a common abstract class for ADTs once a class is defined adding methods to it from the outside requires module augmentation and unsafe mutation of object prototypes and worst of all none of it can be optimized in tree shaking so you end up with huge bundle sized that get to prohibitive points The current solution that the community adopted is pipeable APIs Pipeable APIsin a pipeable API we would rewrite the prior example to file IO tsexport class IO lt A gt constructor readonly io gt A export const succeed lt A gt a A gt new IO gt a export const succeedWith lt A gt a gt A gt new IO a export function map lt A B gt f a A gt B self IO lt A gt gt IO lt B gt return self IO lt A gt gt new IO gt f self io export function flatMap lt A B gt f a A gt IO lt B gt self IO lt A gt gt IO lt B gt return self gt new IO gt f self io io export function zip lt A B gt b IO lt B gt self IO lt A gt gt IO lt A B gt return self gt new IO gt self io b io export function run lt A gt self IO lt A gt return self io file Function ts omitted definition of pipe long file USE tsimport as IO from IO import pipe from Function export const program pipe IO succeed IO map n gt n IO flatMap r gt IO succeedWith gt console log result r IO run program What we have done is basically extract all the constructors and methods to be outside of the class and moved the this in a curried function as a normal parameter that the pipe function carries through The end API is still nice looking but it has a few problems auto imports don t work well with namespace imports recently folks at Unsplash have been working on language service plugins for this Even if auto import work you end up with tons of imports and we have lost the meaning categorization of IO namely we no longer have a data type IO lt A gt and a companion object IO we only have a data type IO lt A gt and a module of functions that include both constructors IO succeed and aspects another name for pipeable functions IO flatMap so when programming a user needs to know what module to import precisely what functions are what and how to use them Additionally from the experience of teaching those concepts it seems fairly common that folks have issues reading pipeable function signatures Introducing TS TS is a new language developed as a super set of TypeScript and maintained as a daily rebased fork of the original TypeScript compiler In order to guarantee full support with the TypeScript ecosystem we limit what can be extended namely TS emits standard declaration files consumable from plain TypeScript it consumes plain normal definition files and does not add any new syntax Differently from TypeScript with TS we don t limit ourselves to not emit code based on type information instead we leverage the type information as much as possible to produce both very optimized code and to improve the developer experience With those decisions comes the set of trade offs TS can be compiled only with the TS compiler a fork of tsc and cannot be compiled by tools like babel that simply remove the types we suggest using a pipeline where tsc emits es modules and another tool like esbuild swc babel takes over from there leveraging the powerful infrastructure of project references to optimize compilation Installing TS Add the dev dependency with yarn add D tsplus installer and a postinstall script like tsplus install this will replace the typescript that is installed in your node modules Note this install process is temporary until we reach a better mechanism Be sure that your IDE uses the language service from the workspace and not the default ones If you want to start with all configured fork and you can play with it in gitpod in a minute Using TS Fluent Methods We will start with our initial example but extracting all methods outside of the main class tsplus type article IO export class IO lt A gt static succeed lt A gt a A gt new IO gt a static succeedWith lt A gt a gt A gt new IO a constructor readonly io gt A tsplus fluent article IO map export function map lt A B gt self IO lt A gt f a A gt B IO lt B gt return new IO gt f self io tsplus fluent article IO flatMap export function flatMap lt A B gt self IO lt A gt f a A gt IO lt B gt IO lt B gt return new IO gt f self io io tsplus fluent article IO zip export function zip lt A B gt self IO lt A gt b IO lt B gt IO lt A B gt return new IO gt self io b io tsplus fluent article IO run export function run lt A gt self IO lt A gt return self io We have added an annotation to our class identifying it in TS with tsplus type article IO this annotation that will be called type tag should be globally unique and non prefixed tags should be reserved for standard library prefixing with your package name is common After adding the type tag we extracted each method from inside the class to the outside renaming this to self that could be whatever except this We further added an annotation above each function like tsplus fluent article IO flatMap this basically says to the compiler put this fluent method in any type that matches with the tag article IO and call it flatMap Having done that we can already use IO exactly as before export const program IO succeed map n gt n flatMap r gt IO succeedWith gt console log result r program run But we can already note from the IDE the following We see that this is a fluent extension and not a classical method That s about it for fluent extensions they are declared as normal functions that you can even call directly like map a f and they can be declared anywhere you want In order to support well a world where not everybody uses TS we also have a macro to derive a pipeable function from a data first one to be used like const mapPipeable Pipeable map Note this is a compiler extension that will deal with the generics of the signature in a correct way it doesn t use conditional types Additionally fluent methods can be defined directly using pipeable functions like tsplus pipeable article IO flatMap export function flatMap lt A B gt f a A gt IO lt B gt self IO lt A gt gt IO lt B gt return self gt new IO gt f self io io This solves half of the problem though we did manage to extract methods but constructors are still static members of the companion object non extensible and non tree shakable Let s solve that next tsplus type article IO tsplus companion article IO Ops export class IO lt A gt constructor readonly io gt A tsplus static article IO Ops succeed export const succeed lt A gt a A gt new IO gt a tsplus static article IO Ops succeedWith export const succeedWith lt A gt a gt A gt new IO a Here we identified the companion of IO with article IO Ops and we used tsplus static article IO Ops succeed to say put this value as a static member of any type tagged as article IO Ops Note there is no difference between a type tag and one defined with companion but a class has types the instance type and the constructor type so we need a way of distinguishing which tag links to what One alternative pattern without using a class that we find common to use is the following tsplus type article IO export interface IO lt A gt readonly io gt A tsplus type article IO Ops export interface IOOps lt A gt io gt A IO lt A gt export const IO IOOps io gt io tsplus static article IO Ops succeed export const succeed lt A gt a A gt IO gt a tsplus static article IO Ops succeedWith export const succeedWith lt A gt a gt A gt IO a tsplus fluent article IO map export function map lt A B gt self IO lt A gt f a A gt B IO lt B gt return IO gt f self io tsplus pipeable article IO flatMap export function flatMap lt A B gt f a A gt IO lt B gt self IO lt A gt gt IO lt B gt return self gt IO gt f self io io tsplus fluent article IO zip export function zip lt A B gt self IO lt A gt b IO lt B gt IO lt A B gt return IO gt self io b io tsplus fluent article IO run export function run lt A gt self IO lt A gt return self io Usage export const program IO succeed map n gt n flatMap r gt IO succeedWith gt console log result r program run Another thing we usually do is to put related types to IO like for example a type like ExtractResult in a namespace named IO like tsplus type article IO export interface IO lt A gt readonly io gt A export declare namespace IO export type ExtractResult lt I extends IO lt any gt gt I extends IO lt infer A gt A never tsplus type article IO Ops export interface IOOps lt A gt io gt A IO lt A gt export const IO IOOps io gt io Basically giving IO meanings as a namespace as an interface type and as a term value All of this together provides an easily extensible way of developing easy to use and easy to discover APIs that are fully tree shakable and optimized in fact the very first program we wrote here is a valid program with the new IO module that we just implemented Using TS Call Extension There are cases where we would like to add a call signature to something that isn t a function for example we could reactor the above constructor like tsplus type article IO Ops export interface IOOps export const IO IOOps tsplus static article IO Ops call export function make lt A gt io gt A IO lt A gt return io The name call is a special name that basically says use the function as the call signature of a type In some extreme cases you may want access to the this and for that you can use a fluent extension called call instead of a static one Like tsplus fluent article IO Ops call export function make lt A gt self IOOps io gt A IO lt A gt return io You may think this can be enough We have just started Using TS Binary Operators Yeah we can do that too there are many nice binary operators in JS such a shame there isn t a way of extending those and the proposal to do so is inefficient in terms of tree shaking limited an potentially never gonna come to fruition Looking at the IO we defined above there is a combinator called zip that look very much like a binary operator given that doesn t make any sense when used between two IO we can take over tsplus fluent article IO zip tsplus operator article IO export function zip lt A B gt self IO lt A gt b IO lt B gt IO lt A B gt return IO gt self io b io and just like that we can do const zipped IO succeed IO succeed And looking at the quickinfo from VSCode Furthermore you can define multiple operators and multiple fluent extensions with the same target and specify a priority that enables neat dsl s like the ones we have for tsplus stdlib collections oh and BTW if you are here you should also probably install tsplus stdlib For reference List test ts and the other tests Oh an btw you can click an operator and anything else and use goToDefinition Using TS Lazy Arguments Many times especially when using effect systems and lazy programming in general you find yourself writing a lot of arrow functions like T succeed gt console log A this for example is because we don t want the console log to happen eagerly but we want succeed to be in control of calling when such cases are in effect we can use lazy parameters A lazy parameter is a parameter defined as tsplus type LazyArgument interface LazyArg lt A gt A function succeed lt A gt f LazyArg lt A gt f when calling succeed x if x is not already lazy the compiler will transform it to succeed gt x making it possible to cut the boilerplate of things like Effect succeed console log hello Note that the behaviour is only added to function arguments of a type that has a type tag of value LazyArgument and not generally to any function arguments Using TS Type Unification Ever ended up with something like Left lt gt Left lt gt Right lt string gt in something that should have been Either lt number string gt That s because TypeScript assumes the right type to return is always the strictest which is a good assumption if you manually type it it compiles We can be explicit in TS though we can do things like tsplus type Option export type Option lt A gt None Some lt A gt tsplus unify Option tsplus unify Option Some tsplus unify Option None export function unifyOption lt X extends Option lt any gt gt self X Option lt X extends Option lt infer A gt A never gt return self or tsplus type Eval export interface Eval lt A gt readonly A gt A readonly TypeId unique symbol tsplus unify Eval export function unifyEval lt X extends Eval lt any gt gt self X Eval lt X extends Eval lt infer AX gt AX never gt return self and TS will use the result of the unify function to unify any time a union is generated So that for example Using TS Global Imports As mentioned before having a lot of imports maybe painful and what we realized is that in fact many users defines their own prelude files that re export modules very often leading to edge cases in tree shaking algorithms that only recently are improving in shaking deeply nested dependency trees With TS we solve this problem by using the concept of global imports a global import is an import defined in a declaration file d ts like the following tsplus global import Chunk from tsplus stdlib collections Chunk definition When something like that is encountered the imported symbol Chunk in this case is made available globally in the project It is a common practice to define a prelude d ts in your root and add it to the files portion of the tsconfig json having there all the set of imports that you would otherwise manually import pretty much everywhere Also you can share your preludes across your projects like we do with tsplus stdlib global that if you import in your prelude file it will give you access to the full blown standard library everywhere in your project Note that imports are only added to your files when used Using TS Runtime Types and Derivation Thought it couldn t get any better close One of the biggest pain points we ve ever experienced in app development is the definition of types that are safe at runtime many solutions have been attempted so far including but not limited to io ts morphic ts zod effect ts schema effect ts morphic etc All of the mentioned libraries are lovely in the fact that they solve a huge problem that is encoding decoding guarding and potentially generating arbitraties for types They all use the same trick instead of defining a type you define some sort of value from which the type is derived the details of how that sort of value is modelled is where the difference between the libraries are What this leads is to a set of trade offs where the libraries can end up emitting not optimized types end up being verbose hard to extend and quite painful to use To be clear they are still better than the alternative which would require manual implementation of everything After months of work we think we finally have a solution to limited structural custom typeclass derivation so that you can forget the problem Let s dig into it export interface Person name string age Option lt number gt friends Chunk lt Person gt export const PersonEncoder Encoder lt Person gt Derive export const PersonDecoder Decoder lt Person gt Derive export const PersonGuard Guard lt Person gt Derive That s it you can now do const encoded PersonEncoder encodeJSON name Mike age Option some friends Chunk const decoded PersonDecoder decodeJSON encoded if decoded isRight const maybePerson if PersonGuard is maybePerson maybePerson age You may ask how well the compiler can tell you add a explain parameter to a call to Derive like And the best thing is that there is nothing special to the instances above in fact all the rules are custom and extensible Guard tsEncoder tsDecoder tsEach derivable type is defined as an interface with a tag like A Guard lt A gt is a type representing the ability to identify when a value is of type A at runtime tsplus type Guard export interface Guard lt A gt readonly is u unknown gt u is A Then implicit instances are defined as Guard for a number tsplus implicit export const number Guard lt number gt Guard u u is number gt typeof u number And rules as tsplus derive Guard lazy export function deriveLazy lt A gt fn Guard lt A gt gt Guard lt A gt Guard lt A gt let cached Guard lt A gt undefined const guard Guard lt A gt Guard u u is A gt if cached cached fn guard return cached is u return guard tsplus derive Guard lt gt export function deriveLiteral lt A extends string number gt value Check lt Check IsLiteral lt A gt amp Check Not lt Check IsUnion lt A gt gt gt extends Check True value A never Guard lt A gt return Guard u u is A gt u value tsplus derive Guard Option lt gt export function deriveOption lt A extends Option lt any gt gt element A extends Option lt infer A gt element Guard lt A gt never Guard lt A gt return Guard u u is A gt if u instanceof None return true if u instanceof Some return element is u value return false The only special rule here is the one called lazy which is used when the compiler encounters a recursive derivation the remaining are all custom A rule is a function with a rule tag a rule tag has the following format tsplus derive Guard Option lt gt Where Guard is the tag of the typeclass we want to derive Option lets you if not omitted further scope when the rule is applied in this case to types like Show lt Option lt A gt gt lt gt tells the compiler how to call the function arguments and has to be specified per each generic of the typeclass we are deriving for example Refinement lt gt this can be calls it with the type this case Option match a union and calls with a tuple of the members amp match an intersection and calls with a tuple of the members match a tuple and calls with a tuple of the members is a priority that defines how early this rule is applied Using TS Module Structure and Config We ve been going trough a list of example and by now you probably noticed we tend to use fully qualified imports like tsplus stdlib collections Chunk definition even for local references You are not forced to do the same BUT for global imports and extensions in general your files must also be importable via a fully qualified name the mapping between file gt fully qualified import together with a map of file gt tracing name is defined in a dedicated config like the following tsplus config jsonThe trace map is needed because in TS you can support compile time tracing of your function calls for example if you have a function like function hello message string tsPlusTrace string when a call expression like hello world is found if a trace is not passed explicitly the compiler fill it up with hello world file trace as per in map line col While this is not something that can be relied upon as always present because clearly a non TS user will not have a compiler that fill up the trace when present can be a powerful tool to build easily debuggable systems like effect does in rendering full stack traces even with async operations Using TS Compiled Output So how does it compile in practice when an exported value has a tag like static fluent implicit derivation etc when we emit definition files d ts per each function we add a further jsdoc annotation called location like tsplus fluent Decoder decode tsplus location tsplus stdlib runtime Decoder export declare function decode lt A gt decoder Decoder lt A gt value unknown import data Either Either lt string A gt This is how we know how to import things and from where in a JS file when something like that is used an import is introduced accordingly This design ensures modules are always imported as close to the declaration as possible and it helps preventing circular references it may lead to a big number of imports in the compiled js files but tree shaking can inline very well What s next for TS We think we are pretty much feature ready for the first decent release we have to write tons of tests and finish extracting out the standard library from the effect codebase before this is considered usable at a decent level externally internally effect is already written in TS but we feel very confident and the TS folks have been amazing in offering valuable advise 2022-04-10 15:00:51
海外TECH Engadget 'Kingdom Hearts IV' features a new look for series protagonist Sora https://www.engadget.com/square-enix-kingdom-hearts-4-announced-151636161.html?src=rss x Kingdom Hearts IV x features a new look for series protagonist SoraSquare Enix is developing a new mainline Kingdom Hearts game the publisher announced on Sunday during an event in Tokyo celebrating the franchise s th anniversary Kingdom HeartsIV sees series protagonist Sora return after s Kingdom Hearts III nbsp concluded the story arc that began with the original game in The trailer Square Enix shared over the weekend opens with Sora waking up in a city called Quadratum It s a Tokyo like metropolis rendered in a realistic graphical style that s a significant departure for the series After a new character named Strelitzia introduces herself to Sora the city is attacked by a towering monster As Sora runs off to face the threat the trailer appears to seamlessly transition to gameplay We see Sora complete an impressive parkour sequence that involves a collapsing building After the title card the trailer reintroduces Donald Duck and Goofy who are searching for their lost friend There s no word on a release date for Kingdom Hearts IV But nbsp at the same event Square Enix announced Kingdom Hearts Missing Link a new mobile title that fans in select markets will be available to beta test on Android and iOS this August 2022-04-10 15:16:36
金融 ◇◇ 保険デイリーニュース ◇◇(損保担当者必携!) 保険デイリーニュース(04/11) http://www.yanaharu.com/ins/?p=4880 finatext 2022-04-10 15:26:28
ニュース BBC News - Home Norwich City 2-0 Burnley: Pierre Lees-Melou and Teemu Pukki keep Canaries' hope alive https://www.bbc.co.uk/sport/football/60970969?at_medium=RSS&at_campaign=KARANGA Norwich City Burnley Pierre Lees Melou and Teemu Pukki keep Canaries x hope aliveBottom club Norwich City keep alive their slim hopes of avoiding a return to the Championship with a crucial win over fellow strugglers Burnley at Carrow Road 2022-04-10 15:26:54
ニュース BBC News - Home Brentford 2-0 West Ham United: Hosts deliver huge blow to Hammers' top-four hopes https://www.bbc.co.uk/sport/football/60970968?at_medium=RSS&at_campaign=KARANGA Brentford West Ham United Hosts deliver huge blow to Hammers x top four hopesBrentford deliver a huge blow to West Ham s top four hopes as victory moves the Bees further clear of the relegation places 2022-04-10 15:13:05
ニュース BBC News - Home Leicester City 2-1 Crystal Palace: Kiernan Dewsbury-Hall stars in hard-earned win https://www.bbc.co.uk/sport/football/60970974?at_medium=RSS&at_campaign=KARANGA crystal 2022-04-10 15:21:48
ビジネス 不景気.com 「徳島グランドホテル偕楽園」運営元に破産決定、負債23億円 - 不景気.com https://www.fukeiki.com/2022/04/tokushima-grand-hotel-kairakuen.html 徳島県徳島市 2022-04-10 15:10:29
サブカルネタ ラーブロ Ramen FeeL@日向和田 「FeeL つけ麺(塩)」 http://ra-blog.net/modules/rssc/single_feed.php?fid=198042 ramenfeel 2022-04-10 16:01:41
北海道 北海道新聞 ブルージェイズ加藤マイナー降格 前日に大リーグ初出場、3Aへ https://www.hokkaido-np.co.jp/article/667940/ 加藤豪将 2022-04-11 00:23:00

コメント

このブログの人気の投稿

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

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

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)