投稿時間:2022-02-15 18:42:14 RSSフィード2022-02-15 18:00 分まとめ(38件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
TECH Engadget Japanese 人の心筋細胞で泳ぐロボット魚、ハーバード大ウィス研究所が製作 https://japanese.engadget.com/swimming-robot-cardiac-muscle-cells-083230833.html 製作 2022-02-15 08:32:30
ROBOT ロボスタ 新作アンドロイド・オペラ『MIRROR』世界初演がドバイ万博で実現へ 予告編PVを公開 AIが作った歌詞をオルタ3が即興で歌う https://robotstart.info/2022/02/15/android-opera-mirror-dubai-2022.html 新作アンドロイド・オペラ『MIRROR』世界初演がドバイ万博で実現へ予告編PVを公開AIが作った歌詞をオルタが即興で歌うシェアツイートはてブ公演見合わせとなっていた新作アンドロイド・オペラ『MIRROR』の振替公演が決定した。 2022-02-15 08:46:41
IT 情報システムリーダーのためのIT情報専門サイト IT Leaders システム監視ソフトウェア新版「LogStare Collector 2.2」、M365のログ収集/分析が可能に | IT Leaders https://it.impress.co.jp/articles/-/22717 システム監視ソフトウェア新版「LogStareCollector」、Mのログ収集分析が可能にITLeadersセキュアヴェイル子会社のLogStareは年月日、システム監視ソフトウェア「LogStareCollector」の新版「」を提供開始した。 2022-02-15 17:14:00
python Pythonタグが付けられた新着投稿 - Qiita 「新・明解Pythonで学ぶアルゴリズムとデータ構造」で勉強日記#9 https://qiita.com/kato_squalldeka/items/20afd3e4c047d4161c85 本来のデータの末尾に探索するデータを追加し、発見されなかった場合の条件付けをする必要がなくなるというものです。 2022-02-15 17:55:06
Ruby Railsタグが付けられた新着投稿 - Qiita herokuにpushできなくてお困りのあなた。こちらをご覧ください。 https://qiita.com/kotetsu09/items/bd8a1130ed5ec336b3e0 herokuにpushできなくてお困りのあなた。 2022-02-15 17:40:24
Ruby Railsタグが付けられた新着投稿 - Qiita haml導入から基本的な使い方 https://qiita.com/yoshi-sho-0606/items/2f3b967f8277fcf1b514 例えば、ltpgtこれはHTMLですltpgtと記述するところをpこれはhamlですと記述します。 2022-02-15 17:25:23
技術ブログ Developers.IO Amazon Connect の電話番号をリリース/削除できない時の対処方法 https://dev.classmethod.jp/articles/tsnote-amazon-connect-delete-phone-number/ amazon 2022-02-15 08:25:17
海外TECH DEV Community React component as prop: the right way™️ https://dev.to/adevnadia/react-component-as-prop-the-right-way-ane React component as prop the right way️As always in React there is one million way to do exactly the same thing If for example I need to pass a component as a prop to another component how should I do this If I search the popular open source libraries for an answer I will find that I can pass them as Elements like Material UI library does in Buttons with the startIcon propI can pass them as components themselves like for example react select library does for its components propI can pass them as functions like Material UI Data Grid component does with its renderCell propNot confusing at all So which way is the best way and which one should be avoided Which one should be included in some “React best practices list and why Let s figure it out together Or if you like spoilers just scroll to the summary part of the article There is a definitive answer to those questions Why would we want to pass components as props Before jumping into coding let s first understand why we would want to pass components as props to begin with Short answer for flexibility and to simplify sharing data between those components Imagine for example we re implementing a button with an icon We could of course implement it like this const Button children children ReactNode gt return lt button gt lt SomeIcon size small color red gt children lt button gt But what if we need to give people the ability to change that icon We could introduce iconName prop for that type Icons cross warning all the supported iconsconst getIconFromName iconName Icons gt switch iconName case cross return lt CrossIcon size small color red gt all other supported icons const Button children iconName children ReactNode iconName Icons gt const icon getIconFromName name return lt button gt icon children lt button gt What about the ability for people to change the appearance of that icon Change its size and color for example We d have to introduce some props for that as well type Icons cross warning all the supported iconstype IconProps size small medium large color string const getIconFromName iconName Icons iconProps IconProps gt switch iconName case cross return lt CrossIcon iconProps gt all other supported icons const Button children iconName iconProps children ReactNode iconName Icons iconProps IconProps gt const icon getIconFromName name iconProps return lt button gt icon children lt button gt What about giving people the ability to change the icon when something in the button changes If a button is hovered for example and I want to change icon s color to something different I m not even going to implement it here it d be way too complicated we d have to expose onHover callback introduce state management in every single parent component set state when the button is hovered etc etc It s not only a very limited and complicated API We also forced our Button component to know about every icon it can render which means the bundled js of this Button will not only include its own code but also every single icon on the list That is going to be one heavy button This is where passing components in props come in handy Instead of passing to the Button the detailed limited description of the Icon in form of its name and its props our Button can just say gimme an Icon I don t care which one your choice and I ll render it in the right place Let s see how it can be done with the three patterns we identified at the beginning passing as an Elementpassing as a Componentpassing as a Function Building a button with an iconOr to be precise let s build three buttons with different APIs for passing the icon and then compare them Hopefully it will be obvious which one is better in the end For the icon we re going to use one of the icons from material ui components library Lets start with the basics and just build the API first First icon as React ElementWe just need to pass an element to the icon prop of the button and then render that icon near the children like any other element type ButtonProps children ReactNode icon ReactElement lt IconProps gt export const ButtonWithIconElement children icon ButtonProps gt return lt button gt our icon same as children is just React element which we can add directly to the render function icon children lt button gt And then can use it like this lt ButtonWithIconElement icon lt AccessAlarmIconGoogle gt gt button here lt ButtonWithIconElement gt Second icon as a ComponentWe need to create a prop that starts with a capital letter to signal it s a component and then render that component from props like any other component type ButtonProps children ReactNode Icon ComponentType lt IconProps gt export const ButtonWithIconComponent children Icon ButtonProps gt return lt button gt our button is a component its name starts with a capital letter to signal that so we can just render it here as any other component lt Icon gt children lt button gt And then can use it like this import AccessAlarmIconGoogle from mui icons material AccessAlarm lt ButtonWithIconComponent Icon AccessAlarmIconGoogle gt button here lt ButtonWithIconComponent gt Third icon as a functionWe need to create a prop that starts with render to indicate it s a render function i e a function that returns an element call the function inside the button and add the result to component s render function as any other element type ButtonProps children ReactNode renderIcon gt ReactElement lt IconProps gt export const ButtonWithIconRenderFunc children renderIcon ButtonProps gt getting the Element from the function const icon renderIcon return lt button gt adding element like any other element here icon children lt button gt And then use it like this lt ButtonWithIconRenderFunc renderIcon gt lt AccessAlarmIconGoogle gt gt button here lt ButtonWithIconRenderFunc gt That was easy Now our buttons can render any icon in that special icon slot without even knowing what s there See the working example in the codesandbox Time to put those APIs to a test Modifying the size and color of the iconLet s first see whether we can adjust our icon according to our needs without disturbing the button After all that was the major promise of those patterns isn t it First icon as React ElementCouldn t have been easier all we need is just pass some props to the icon We are using material UI icons they give us fontSize and color for that lt ButtonWithIconElement icon lt AccessAlarmIconGoogle fontSize small color warning gt gt button here lt ButtonWithIconElement gt Second icon as a ComponentAlso simple we need to extract our icon into a component and pass the props there in the return element const AccessAlarmIcon gt lt AccessAlarmIconGoogle fontSize small color error gt const Page gt return lt ButtonWithIconComponent Icon AccessAlarmIcon gt button here lt ButtonWithIconComponent gt Important the AccessAlarmIcon component should always be defined outside of the Page component otherwise it will re create this component on every Page re render and that is really bad for performance and prone to bugs If you re not familiar with how quickly it can turn ugly this is the article for you How to write performant React code rules patterns do s and don ts Third icon as a FunctionAlmost the same as the first one just pass the props to the element lt ButtonWithIconRenderFunc renderIcon gt lt AccessAlarmIconGoogle fontSize small color success gt gt Easily done for all three of them we have infinite flexibility to modify the Icon and didn t need to touch the button for a single thing Compare it with iconName and iconProps from the very first example Default values for the icon size in the buttonYou might have noticed that I used the same icon size for all three examples And when implementing a generic button component more likely than not you ll have some prop that control button s size as well Infinity flexibility is good but for something as design systems you d want some pre defined types of buttons And for different buttons sizes you d want the button to control the size of the icon not leave it to the consumer so you won t end up with tiny icons in huge buttons or vice versa by accident Now it s getting interesting is it possible for the button to control one aspect of an icon while leaving the flexibility intact First icon as React ElementFor this one it gets a little bit ugly We receive our icon as a pre defined element already so the only thing we can do is to clone that element by using React cloneElement api and override some of its props in the button componentconst clonedIcon React cloneElement icon fontSize small return lt button gt clonedIcon children lt button gt And at the consumer side we can just remove the fontSize property lt ButtonWithIconElement icon lt AccessAlarmIconGoogle color warning gt gt But what about default value not overriding What if I want consumers to be able to change the size of the icon if they need to Still possible although even uglier just nee to extract the passed props from the element and put them as default value const clonedIcon React cloneElement icon fontSize icon props fontSize small From the consumer side everything stays as it was before lt ButtonWithIconElement icon lt AccessAlarmIconGoogle color warning fontSize large gt gt Second icon as a ComponentEven more interesting here First we need to give the icon the default value on button side export const ButtonWithIconComponent children Icon ButtonProps gt return lt button gt lt Icon fontSize small gt children lt button gt And this is going to work perfectly when we pass the directly imported icon import AccessAlarmIconGoogle from mui icons material AccessAlarm lt ButtonWithIconComponent Icon AccessAlarmIconGoogle gt button here lt ButtonWithIconComponent gt Icon prop is nothing more than just a reference to material UI icon component here and that one knows how to deal with those props But we extracted this icon to a component when we had to pass to it some color remember const AccessAlarmIcon gt lt AccessAlarmIconGoogle fontSize small color error gt Now the props Icon is a reference to that wrapper component and it just assumes that it doesn t have any props So our fontSize value from lt Icon fontSize small gt from the button will be just swallowed This whole pattern if you ve never worked with it before can be confusing since it creates this a bit weird mental circle that you need to navigate in order to understand what goes where In order to fix the icon we just need to pass through the props that AccessAlarmIcon receives to the actual icon Usually it s done via spread const AccessAlarmIcon props gt lt AccessAlarmIconGoogle props color error gt Or can be just hand picked as well const AccessAlarmIcon props gt lt AccessAlarmIconGoogle fontSize props fontSize color error gt While this pattern seems complicated it actually gives us perfect flexibility the button can easily set its own props and the consumer can choose whether they want to follow the direction buttons gives and how much of it they want or whether they want to do their own thing If for example I want to override button s value and set my own icon size all I need to do is to ignore the prop that comes from the button const AccessAlarmIcon props gt just ignore all the props coming from the button here and override with our own values lt AccessAlarmIconGoogle fontSize large color error gt Third icon as a FunctionThis is going to be pretty much the same as with icon as a Component only with the function First adjust the button to pass settings to the renderIcon function const icon renderIcon fontSize small And then on the consumer side similar to props in Component step pass that setting to the rendered component lt ButtonWithIconRenderFunc renderIcon settings gt lt AccessAlarmIconGoogle fontSize settings fontSize color success gt gt button here lt ButtonWithIconRenderFunc gt And again if we want to override the size all we need to do is to ignore the setting and pass our own value lt ButtonWithIconRenderFunc ignore the setting here and write our own fontSize renderIcon settings gt lt AccessAlarmIconGoogle fontSize large color success gt gt button here lt ButtonWithIconRenderFunc gt See the codesandbox with all three examples Changing the icon when the button is hoveredAnd now the final test that should decide everything I want to give the ability for the users to modify the icon when the button is hovered First let s teach the button to notice the hover Just some state and callbacks to set that state should do it export const ButtonWithIcon gt const isHovered setIsHovered useState false return lt button onMouseOver gt setIsHovered true onMouseOut gt setIsHovered false gt lt button gt And then the icons First icon as React ElementThat one is the most interesting of the bunch First we need to pass that isHover prop to the icon from the button const clonedIcon React cloneElement icon fontSize icon props fontSize small isHovered isHovered And now interestingly enough we created exactly the same mental circle that we had when we implemented “icon as Component We passed isHover property to the icon component now we need to go to the consumer wrap that original icon component into another component that component will have isHover prop from the button and it should return the icon we want to render in the button If you managed to understand that explanation from just words I ll send you some chocolate Here s some code to make it easier Instead of the original simple direct render of the icon lt ButtonWithIconElement icon lt AccessAlarmIconGoogle color warning gt gt button here lt ButtonWithIconElement gt we should create a wrapper component that has isHovered in its props and renders that icons as a result const AlarmIconWithHoverForElement props gt return lt AccessAlarmIconGoogle don t forget to spread all the props otherwise you ll lose all the defaults the button is setting props and just override the color based on the value of isHover color props isHovered primary warning gt And then render that new component in the button itself lt ButtonWithIconElement icon lt AlarmIconWithHoverForElement gt gt button here lt ButtonWithIconElement gt Looks a little bit weird but it works perfectly ‍ ️ Second icon as a ComponentFirst pass the isHover to the icon in the button lt Icon fontSize small isHovered isHovered gt And then back to the consumer And now the funniest thing ever In the previous step we created exactly the same mental circle that we need to remember when we re dealing with components passed as Components And it s not just the mental picture of data flow I can literally re use exactly the same component from the previous step here They are just components with some props after all lt ButtonWithIconComponent Icon AlarmIconWithHoverForElement gt button here lt ButtonWithIconComponent gt works perfectly Third icon as a FunctionSame story just pass the isHovered value to the function as the arguments const icon renderIcon fontSize small isHovered isHovered And then use it on the consumer side lt ButtonWithIconRenderFunc renderIcon settings gt lt AccessAlarmIconGoogle fontSize settings fontSize color settings isHovered primary warning gt gt again works perfectly Take a look at the sandbox with the working solution Summary and the answer which way is The Right Way️ If you read the full article you re probably saying right now Nadia aren t they are basically the same thing What s the difference You promised a clear answer but I don t see it And you re right And if you just scrolled here right away because you love spoilers I m sorry I lied a bit for the sake of the story There is no right answer here All of them are more or less the same and you probably can implement of the needed use cases if not with just one pattern everywhere The only difference here is semantics which area has the most complexity and personal preferences and religious beliefs If I had to extract some general rules of which pattern should be used where I d probably go with something like this I d use “component as an Element pattern lt Button icon lt Icon gt gt for cases where I just need to render the component in a pre defined place without modifying its props in the “receiving component I d use “component as a Component pattern lt Button Icon Icon gt when I need to heavily modify and customise this component on the “receiving side through its props while at the same time allowing users full flexibility to override those props themselves pretty much as react select does for components prop I d use “component as a Function pattern lt Button renderIcon gt lt Icon gt gt when I need the consumer to modify the result of this function depending on some values coming from the “host component itself pretty much what Material UI Data Grid component does with renderCell prop Hope this article made those patterns easier to understand and now you can use all of them when the use case needs it Or you can now just totally ban any of them in your repo just for fun or consistency sake since now you can implement whatever you want with just one pattern See ya next time Originally published at Check out the website for more articles like this Subscribe to the newsletter to get notified as soon as the next article comes out 2022-02-15 08:50:13
海外TECH DEV Community Leetcoe Daily Challenge - Single Number https://dev.to/alimalim77/leetcoe-daily-challenge-single-number-51h0 Leetcoe Daily Challenge Single NumberLeetcode Challenges are extremely helpful to build and revise your concepts of Problem Solving Presenting you the Daily Challenge of th February Approach Brute ForceIt asks you to find which number has a sole occurrence in the list Very wise of Leetcode of to put up the question the very next day after Valentine s Day maybe the lonely number in the list is a coder too Jokes aside the simplest approach we can have is to pick a number and check if it is present twice or more and continue checking until we we get the one which has no doppelganger This would cost us a time complexity of O n as we will compare each number to the whole list with a space complexity of O for i in range len nums if nums count nums i return nums i Approach Hash tableUsing a hash table can save you from TLE as it reduce the time complexity and make the solution more readable with better code How we approach is we will store the occurrences of each numbers in the list which will transform into keys of the hash table Once we are done creating a hash table either you can sort the dictionary and the return the first first key which will be having a single occurrence or traverse through the list to check the number having one occurrence I prefer the lateral one having O n complexity because no sorting algorithm in the world assures a time complexity below O n logn Since we created a hashtable the space complexity would be O n ht for i in nums if i not in ht ht i else ht i for k v in ht items if v return kht for i in nums if i not in ht ht i else ht i ht sorted ht items key lambda x x a ht return a Hope you understood how I handled this problem See you with some other problem Happy Leetcoding To learn the fundamentals of python do checkout my YouTube Channel 2022-02-15 08:46:19
海外TECH DEV Community React Apollo: useQuery pollInterval with cache-and-network doesn't stop to make requests after unmounting a component https://dev.to/lico/usequery-pollinterval-with-cache-and-network-doesnt-stop-to-make-requests-after-unmounting-a-component-4hp8 React Apollo useQuery pollInterval with cache and network doesn x t stop to make requests after unmounting a componentI ve made the issue here in apollo client repository It works well with other fetchPolicy options but it doens t work correctly with cache and network Before resolving the issue here is one of the alternatives alternativeStarting polling manuallyconst data todosData error startPolling stopPolling useQuery GET TODOS fetchPolicy cache and network useEffect gt startPolling poll interval return gt stopPolling 2022-02-15 08:45:09
海外TECH DEV Community XUnit vs NUnit What to Choose to Write Clean Code Part 1. https://dev.to/akyltech/xunit-vs-nunit-what-to-choose-to-write-clean-code-part-1-1if0 XUnit vs NUnit What to Choose to Write Clean Code Part The question of which test framework to choose can appear for a new project or when the team decided to make an experiment trying to improve some internal problem It s well known for net developers that there are three main frameworks MSTest NUnit and XUnit MSTest is out of scope for this article I didn t meet any project which uses it as a primary test framework I certainly sure such projects exist and it could be that developers from these projects have written a comprehensive guide щтwhy to choose MSTest We ll focus on two frameworks NUnit and XUnit and they are both quite good and provide common functionally to write tests Firstly we ll look at each separately and then compare both functionalities NUnitNUnit is a unit testing framework for all Net languages Initially ported from JUnitAs it states on the landing page of NUnit We ll cover the latest version of NUnit At the moment when the article was written it was Execute the following commands to add NUnit for your test project dotnet add package NUnit version dotnet add package NUnitTestAdapter version With these packages you get an amazing variety of tools provided by NUnit as attributes Let s take a look at some of them which definitely you need to know namedescriptionTestFixturemarks that class contains tests and allows to pass arguments into constructorOneTimeSetUpallows to execute code once before all tests startedOneTimeTearDownit s a pair to OneTimeTearDown gives us ability to clean resource when all tests finishedSetUpexecutes before each testTearDownit s a pair method to SetUp place where we can clean resources after test executionTestallows to mark method as test which should be executedTestCasegives ability to pass params to test and make it configurableIgnoreI hope you will not use it a lot It skips test case during tests executionCategorydefine a category for test quite usefull when you need to run only specify category and not run all testsAuthorthis one as you can guess defines who wrote a testMaxTimeprovides a way to setup max execution time for testDescriptionallows to add readable description to testIt contains much more tools for developers and allows to configure tests for many scenarios Let s check how it looks in code with all these attributes Author Andrew andrewkulta akyltech com TestFixture public class TestExample OneTimeSetUp public void OneTimeSetup Console WriteLine Setup just once OneTimeTearDown public void OneTimeTearDown Console WriteLine Teardown just once SetUp public void Setup Console WriteLine Setup before each test case TearDown public void TearDown Console WriteLine TearDOwn after each test Test Description Author AnotherAuthor public void Should DoNothing Console WriteLine Sync test Test Category Async MaxTime public async Task Should DoNothingAsync Console WriteLine ASync test await Task Delay TestCase TestCase public void Should BeCase int param Console WriteLine param is param Ignore example public void Should BeIgnored Console WriteLine Never invoked XUnit is also known as xUnit netxUnit net is a free open source community focused unit testing tool for the NET FrameworkIt was created with an idea to replace nUnit and xUnit provides a set of tools to write clean and more independent tests List most used attributes from xUnit namedescriptionFactmarks method as test and allows to configure custom name for method as well as timeout and skip reason Theorymarks method as special type of test theory it means that this test is valid only with certain list of paramsInlineDateallows to provide params for theory testsTraitgives ability to setup custom metadata for test such as category or author etc Let s take a look at some examples for listed attributes cspublic class xUnitExample IDisposable public xUnitExample Console WriteLine Executes before each test as setup Fact DisplayName Test description Trait Category CustomCategory public void Should BeATest Console WriteLine I m a test Fact Timeout public async Task Should BeAsyncTest Console WriteLine I m async test Theory InlineData public void Should BeTheory int param Console WriteLine param is param Fact Skip Ignore public void Should BeSkipped Console WriteLine Should never be invoked public void Dispose Console WriteLine Executes after each test as teardown As you can see xUnit uses constructor and IDisposable pattern to implement setup and teardown I faced developers who thought that xUnit requires implementing Destructor if you want to clear resources I think NUnit allows us to write more descriptive unit tests with various attributes for different purposes But if you choose xUnit for your project you get a cleaner code without all this mess with attributes The final decision depends on your preferences or maybe the team gets used to one of these frameworks ConclusionTo be honest it doesn t matter which framework you will choose They both provide a set of tools to write tests and it s more important to concentrate on tests themselves Any questions or comments Ping me on LinkedIn or comment below And if you liked this post please give it a clap and share it with all of your friends Twitter Linkedin More articles you can find at 2022-02-15 08:33:45
海外TECH DEV Community Tại sao uống nước trước khi đánh răng https://dev.to/trongranggia04/tai-sao-uong-nuoc-truoc-khi-danh-rang-1k5i Tại sao uống nước trước khi đánh răngNước không chỉgiúp giải tỏa cơn khát màcòn lànhân tốquyết định đểduy trìsựsống Thực tế cơthểcon người cótới lànước Vàđểduy trìmột cơthểkhỏe mạnh ngoài việc cóthói quen ăn uống sinh hoạt vàtập luyện khoa học lành mạnh thìviệc luôn đảm bảo đủlượng nước cũng làmột yêu cầu rất quan trọng 2022-02-15 08:32:18
海外TECH DEV Community 3 posts on FreeCodeCamp that you must go through https://dev.to/iwanttoachievesomething/3-posts-on-freecodecamp-that-you-must-go-through-4ci1 posts on FreeCodeCamp that you must go throughFreeCodeCamp is a nonprofit community that helps people learn as well as share Click here to visit their website Here amazing articles posted on FreeCodeCamp are mentioned Top JavaScript concepts to know before learning React by Joel Olawanle Before planning to learn any of the JavaScript frameworks make sure you go through this post Click here to go to this post Learn ReactJS Complete Roadmap by TAPAS ADHIKARYIf you are completely new to React this post will help you understand many details about the same Click here to go to this post Python project How to build Tony Stark s JARVIS with python by Ashutosh KrishnaCreate a realistic assistant using Python similar to that of Iron man Click here to go to this post 2022-02-15 08:30:59
海外TECH DEV Community How to use FastAPI with Materialize for real-time data processing https://dev.to/bobbyiliev/how-to-use-fastapi-with-materialize-for-real-time-data-processing-3fj1 How to use FastAPI with Materialize for real time data processing IntroductionThis is a self contained demo of FastAPI and Materialize This demo project contains the following components FastAPI A fast modern and feature rich framework for building APIs with Python Redpanda Kafkacompatible event streaming platform written in C Materialize A streaming database for real time analytics A mock service written in BASH for producing records to a Redpanda topic The mock service simulates data of air quality readings of IoT devices Diagram Running the demoClone the repository git clone Access the FastAPI demo project directory cd mz fastapi demoPull all Docker images docker compose pullBuild the project docker compose buildFinally run all containers docker compose up Create the Materialize sources and viewsOnce the demo is running you can create the Materialize sources and views Let s start by creating a Redpanda Kafka source CREATE SOURCE sensorsFROM KAFKA BROKER redpanda TOPIC sensors FORMAT BYTES Then create a non materialized view which you can think of essentially an alias that we will use to create our materialized views The non materialized views do not store the results of the query CREATE VIEW sensors data AS SELECT FROM SELECT data gt gt id int AS id data gt gt pm double AS pm data gt gt pm double AS pm data gt gt geo lat double AS geo lat data gt gt geo lon double AS geo lon data gt gt timestamp double AS timestamp FROM SELECT CAST data AS jsonb AS data FROM SELECT convert from data utf AS data FROM sensors After that create a materialized view that will hold all records in the last minutes CREATE MATERIALIZED VIEW sensors view AS SELECT FROM sensors data WHERE mz logical timestamp lt timestamp numeric Note that we are using the mz logical timestamp function rather than the now function This is because in Materialize now doesn t represent the system time as it does in most systems it represents the time with timezone when the query was executed It cannot be used when creating views For more information see the documentation here Next let s create materialized view that will only include data from the last second so we can see the dataflow and use it for our Server Sent Events SSE demo later on CREATE MATERIALIZED VIEW sensors view s AS SELECT FROM sensors data WHERE mz logical timestamp lt timestamp numeric With that our materialized views are ready and we can visit the FastAPI demo project in the browser FastAPI DemoFinally visit the FastAPI demo app via your browser Endpoint for all records in the last minutes http localhost sensorsSSE Endpoint streaming the latest records as they are generated using TAIL http localhost streamExample response Materialize CloudIf you want to run the demo on the cloud you would need the following A publicly accessible Redpanda Kafka instance so that you can connect to it A Materialize Cloud account You can sign up for a free Materialize Cloud account to get started with Materialize Cloud If you already have that setup you would need to make the following changes to the demo project When creating the source change the redpanda to your Redpanda Kafka instance CREATE SOURCE sensorsFROM KAFKA BROKER your redpanda instance TOPIC sensors FORMAT BYTES Change the DATABASE URL environment variable to your Materialize Cloud database URL and uncomment the certificate specific environment variables in the docker compose yml file in the docker compose yml file Download the Materialize instance certificate files from your Materialize Cloud dashboard Stop the demoTo stop the demo run the following command docker compose down vYou can also stop only the data generation container docker compose stop datagen Helpful LinksMaterializeMaterialize CloudRedpandaCREATE SOURCECREATE VIEWCREATE MATERIALIZED VIEW 2022-02-15 08:27:07
海外TECH DEV Community Beginner’s CI/CD Guide: Deploy Laravel8 to Google Cloud Run and Cloud SQL via GitHub Actions https://dev.to/xxxuutaxxx/beginners-cicd-guide-deploy-laravel8-to-google-cloud-run-and-cloud-sql-via-github-actions-40oj 2022-02-15 08:26:35
海外TECH DEV Community How I improved my confidence, code quality and became a better developer https://dev.to/chriswitko/how-i-improved-my-confidence-code-quality-and-became-a-better-developer-2hn4 How I improved my confidence code quality and became a better developerManual testing was always an underrated part of my development I worked under pressure to deliver fast stable and predictable code Usually there was no time for writing valid test cases and test plans Instead any excuse was a good reason to skip it Lack of testing caused stress and anxiety Every time I tried to deploy my code I used to ask myself numerous repeatable questions e g did I miss some regression in the code Didn t I forget to update environment variables update config files remove unnecessary comments from the code and I could produce a list of many more serious questions Many companies need to iterate fast Manual testing is often left behind Popular combo Google Doc Excel bring mess confusion and lack of control during the whole process It does not help teams keep peace of mind during the development and release process We built ManualTesting dev a simple and powerful tool to help my team and people like me write code test it and deliver on time with confidence So if you have a list of test cases to review every time you deploy your code or you have a checklist to review before a release or you need a place to store user cases new feature requirements and create test scenarios based on them then this tool is for you And as a developer if you are looking for ways to deliver better code control what to test and deploy have peace of mind reduce stress and anxiety then this tool is for you as well PS Any new application must be manually tested before its testing can be automated ーfound it on the Internet 2022-02-15 08:25:08
海外TECH DEV Community Day 2 https://dev.to/nilesh_aggarwal/day-2-4io8 Day Let s have some Image Processing today So I have this course COMP which covers the fundamental of Image Processing and today I learnt a few concepts of Image Transformation and Image Filtering Image Transformation OperationsImage Transformation can be done in following two major ways Spatial Image TransformationHistogram Image TransformationIn the previous lecture I covered basic concepts of Image Transformations like image rotation scaling translation flip affine transformation wrap swirl What s a Spatial Image Transformation A spatial transformation of an image is a geometric transformation of the image coordinate system There are certain ways we can perform Spatial Image Transformation to list some of these Linear Point Transformation Log TransformationGamma Transformation Piece Wise Linear Transformation Log transformations are mainly used in the MRI and Gamma transformation uses a Gamma function to convert the image to dark or light depending on the Input Intensity Levels What is Histogram Transformation A histogram transformation is a pixel by pixel intensity transformation defined by five parameters in PixInsight Clipping points Now we can define the transformation using the Bars also Ex Consider an image of x pixel values then each pixel will have different pixel value from Here value of pixel means gt darkestand value of pixel means gt brightestNow let s say we have pixels who has value of then we will make a bar in the graph where x axis pixel value Ex x axis gt y axis frequency of that pixel Ex y axis gt And hence simply plot the graph now We call each of these bars created as BINS These bins not necessarily have to store only the fixed value rather it can store the range of the pixel values Example pixel values in the range can be in Bin b and pixel values in the range of can be in bin b and so and so forth What is a Contrast Contrast is the difference in luminance or color that makes an object distinguishable from other objects in the same field of view A low contrast image has the objects which are hard to identify in the image and hence we sometimes do an auto contrast function to fix the image contrast and make the objects in the image clearly distinct able Now Contrast Enhancement can be done by two ways Linear methodContrast StretchingNon Linear methodHistogram EqualizationTo enhance the image s contrast it spreads out the most frequent pixel intensity values or stretches out the intensity range of the image Gaussian Stretch Image FilteringWhen we talk about Image Filtering then we are talking about images in the spatial domain and hence we will deal with pixels here So to filter an image we filter every pixel of the input image and to do so we use filters which are known as Kernel Filters or we also call them as Spatial Filters This filter has to be unique across rows and columns and it looks like following It is usually an odd dimension m x n where m n n Example Input image gt x image m nk mk n m Kernel gt x matrix And to calculate the output image just multiply the Kernel with the input image pixels over that dimension with a stride of What s stride Stride is basically how many pixel values you will be jumping traversing in each calculation So basically we have image kernels which determine the output of the image and depending on the kernel we are using we will get a certain output And there are certain set of kernel values already defined using which we can generate the Convolved Image Major operations in Image Filtering are Image Smoothing using Low Pass FiltersBox FilterGaussian FilterImage Sharpening using High Pass FiltersLaplacian Filter to be continued to day What s next I will be completing this lecture along with the code examples And we will solve few coding problems as well Arrays Strings HashMaps Thank you Happy hacking 2022-02-15 08:22:07
海外TECH DEV Community Understanding Arrays https://dev.to/killallnano/understand-arrays-2gci Understanding Arrays ArraysArray is a linear data structure that stores several elements of the same data type It can also be defined as a collection of data of the same data types Syntaxdata type array name SIZE e g int data The location that is created is contiguous i e they are next to one another as shown below Its size is usually constant i e it can t be adjusted once declared One must specify the size of the array before use Methods of Declaring Array define SIZE int data SIZE ORconst int SIZE int data SIZE An array can also be initialized statically or dynamically In static initialization the array is assigned values when it is declared i e at the compilation time while in dynamic initialization they are assigned values when the program is running i e at the runtime An array can also be of one dimension two dimension e t c e g int data int data int data etc Single Dimention Array Initialization of arrayint a or int a orint a a a a a a Printing of array elements include lt stdio h gt int main int i a for i i lt i printf Value at d is d n i a i output User input into an array include lt stdio h gt int main int i a for i i lt i printf Enter value at position d gt gt gt i scanf d amp a i printf n OUTPUT n for i i lt i printf Value at d is d n i a i output Operations Associated with ArrayTraverseDeleteInsertSearchSortisEmptyisFull etcTraverse Operations Enables one to go through the entire array either outputting counting the elements etc The maximum amount of time that a traverse operation can take is in the order of O Deletion Operations This is an expensive operation in an array because elements must be shifted backward The maximum amount of time taken is in the order of n O n and the minimum in the order of O Insertion Operations Just like deletion it is also expensive because elements are to be shifted while inserting elements except when the elements are not in a given order Search Operation Enables one to search for an element in an array and begins at the first location The maximum time taken is in order of n and the minimum in the order of Searching can either be linear or binary Sorting Operation This enables one to arrange elements in either ascending or descending orders There are various ways of sorting out elements in an array e g merge sort quick sort bubble sort shell sort selection sort and insertion sort isEmpty Operation returns true when the array is empty and false otherwise isFull Operation returns true when the array is full and return falls otherwise Order of O n Means time taken is constant irrespective of the size of the array or any other type of data structure Order of n O n Mean time taken is dependent of the size of the array i e the larger the size the longer the time taken and verse verse Format of Operations implementation OPEN DOCUMENTATIONAuthor Description Date Version Contact include lt stdio h gt include lt stdlib h gt include lt stdbool h gt define SIZE int data SIZE void traverse void delete begin void delete at point int void delete end void insert begin int void insert at point int int void insert end int void search int void sort asc void sort dec bool isFull bool isEmpty int main menu int option item pos printf n n MENU n printf n Traverse Operations printf n Delete Operations printf n Insert Operations printf n Search Operations printf n Sort Operations printf n IsFull Operation printf n IsEmpty Operation printf n n printf Select an option gt gt gt scanf d amp option if option printf n Traverse Operation n traverse else if option printf n Delete Operation n printf n Delete st Element printf n Delete Element at a point printf n Delete last Element printf n n Select an option gt gt gt scanf d amp option if option delete begin else if option printf n Enter position gt gt gt scanf d amp pos delete at point pos else if option delete end else printf Invalid Choice try options to else if option printf n insert Operation n printf n Insert st Element printf n Insert Element at a point printf n Insert last Element printf n n Select an option gt gt gt scanf d amp option if option printf Enter value to insert gt gt gt scanf d amp item insert begin item else if option printf Enter value to insert gt gt gt scanf d amp item printf n Enter position gt gt gt scanf d amp pos insert at point item pos else if option printf Enter value to insert gt gt gt scanf d amp item insert end item else printf Invalid Choice try options to else if option printf n Search Operation n printf Enter element to search for gt gt gt scanf d amp item search item else if option printf n Sort Operation n printf n Sort in Ascending Order printf n Sort in Descending order printf n n Enter Option gt gt gt scanf d amp option if option sort asc else if option sort dec else printf n nInvalid Option Try with option or n n else if option printf n isFull Operation n isFull else if option printf n isEmpty Operation n isEmpty else printf n nInvalid Options Try a number between and n n printf BY PROFF JEFF n return void traverse body void delete begin body void delete at point int body void delete end body void insert begin int body void insert at point int int body void insert end int body void search int body void sort asc body void sort dec body bool isFull body bool isEmpty body Double or Two Dimension ArrayA two dimensional array is similar to a one dimensional array but it can be visualised as a grid or table with rows and columns Syntax include lt stdio h gt int main int a Here a is the name of the arrayint is the data type of the arraysize of the array is meaning we can store a maximum of items or values in the array Initialization of arrayint a Displaying the values include lt stdio h gt int main int i j a for i i lt i for j j lt j printf d a i j printf n Output Taking input from User include lt stdio h gt int main int i j a for i i lt i for j j lt j printf Enter value at d d gt gt gt i j scanf d amp a i j printf n for i i lt i for j j lt j printf d a i j printf n OutputAfter Array we will also check on other linear data structures such as the stack queue linked list and there implementation 2022-02-15 08:15:55
海外TECH DEV Community Day 22/100 Java https://dev.to/devlg_/day-22100-java-240o Day JavaComplexety continues growing Day Language JAVATime Period Spent hrsCourse Taken Udemy Java Programming Masterclass Tim BuchalkaTodays Learning Code Challange Array ListAdditional Notes Getting further into the arraylist challenge Got a bit lost into the task All methods and delcarations were fine I implemented the user input differently to the tutor but it worked Realised that the use of arraylist is quite useful as you can implement the classes to store data dependent on a classes requirements Help needed with the implementation but getting a better understanding on how the whole thing works Once this is done I will create my own project referencing this section All of this maken sense as we are implementing all that we have learning in the prior sections into one bit project 2022-02-15 08:08:31
医療系 医療介護 CBnews 【感染症情報】手足口病が11週連続で減少-感染性胃腸炎、RSウイルスは2週連続減 https://www.cbnews.jp/news/entry/20220215170404 医療機関 2022-02-15 17:30:00
海外ニュース Japan Times latest articles COVID deaths a concern in Japan even as new cases appear to be peaking https://www.japantimes.co.jp/news/2022/02/15/national/national-cases-decline-deaths-rise/ COVID deaths a concern in Japan even as new cases appear to be peakingInfections are beginning to decline nationally but experts say it is still too early for people to let their guard down ーand that other 2022-02-15 17:35:19
海外ニュース Japan Times latest articles What does the Ukraine crisis mean for Taiwan? That’s up for debate. https://www.japantimes.co.jp/news/2022/02/15/asia-pacific/ukraine-taiwan-invasion-china/ What does the Ukraine crisis mean for Taiwan That s up for debate On the surface the similarities between the situations in Ukraine and Taiwan seem obvious but the U S s role in a conflict over either place would 2022-02-15 17:10:08
海外ニュース Japan Times latest articles A succession drama, Chinese style, starring Xi Jinping https://www.japantimes.co.jp/news/2022/02/15/asia-pacific/politics-diplomacy-asia-pacific/xi-jinping-succession-drama/ chinese 2022-02-15 17:09:48
ニュース BBC News - Home Met Police: Some officers are racist, professional standards chief admits https://www.bbc.co.uk/news/uk-60379131?at_medium=RSS&at_campaign=KARANGA black 2022-02-15 08:04:59
ニュース BBC News - Home UK wage growth continues to trail cost of living https://www.bbc.co.uk/news/business-60373405?at_medium=RSS&at_campaign=KARANGA figures 2022-02-15 08:20:39
ニュース BBC News - Home Winter Olympics: GB women's curlers beat Japan to retrieve play-off hopes https://www.bbc.co.uk/sport/winter-olympics/60385424?at_medium=RSS&at_campaign=KARANGA Winter Olympics GB women x s curlers beat Japan to retrieve play off hopesA dominant win against Japan gives Great Britain s women s curlers a chance of reaching the play offs at the Winter Olympics 2022-02-15 08:42:49
ニュース BBC News - Home Eurofiles: Real Madrid's Vinicius Junior - 'He's a nightmare for defenders' - Is Vinicius Jr already one of world's best players? https://www.bbc.co.uk/sport/av/football/60313611?at_medium=RSS&at_campaign=KARANGA Eurofiles Real Madrid x s Vinicius Junior x He x s a nightmare for defenders x Is Vinicius Jr already one of world x s best players BBC Sport profiles Brazilian forward Vinicius Junior who has become one of Real Madrid s most dangerous attacking threats in a breakthrough season in La Liga 2022-02-15 08:20:25
ビジネス ダイヤモンド・オンライン - 新着記事 日本株は「3月中旬」に“アク抜け”して上昇に転じる可能 性も! 3/11のメジャーSQ、3/15~16のFOMCまで に現れる“相場反転の兆し”を見逃さないよう準備を! - 成り上がり投資術 https://diamond.jp/articles/-/296422 2022-02-15 17:30:00
ビジネス ダイヤモンド・オンライン - 新着記事 JACリクルートメント(2124)、「増配」を発表して、 配当利回り3.8%に! 年間配当額は1年で2.7%増加、 2022年12月期は前期比2円増の「1株あたり75円」に - 配当【増配・減配】最新ニュース! https://diamond.jp/articles/-/296443 2022-02-15 17:15:00
ビジネス ダイヤモンド・オンライン - 新着記事 TOYO TIRE(5105)、QUOカードの株主優待を廃止! 100株以上を保有する「自社のタイヤを購入した株主」 にQUOカードを贈呈していたが、2021年12月で廃止 - 株主優待【新設・変更・廃止】最新ニュース https://diamond.jp/articles/-/296406 2022-02-15 17:05:00
北海道 北海道新聞 ワカメ産地偽装疑い逮捕、静岡 加工会社社長ら、鳴門産と表示 https://www.hokkaido-np.co.jp/article/645953/ 産地偽装 2022-02-15 17:15:00
北海道 北海道新聞 東京で新たに1万5525人感染 新型コロナ、13人死亡 https://www.hokkaido-np.co.jp/article/645949/ 新型コロナウイルス 2022-02-15 17:12:00
北海道 北海道新聞 NY市、接種拒否1430人解雇 全米最大規模か https://www.hokkaido-np.co.jp/article/645948/ 最大規模 2022-02-15 17:04:00
北海道 北海道新聞 ワリエワ巡り高まる愛国ムード ロシア、悲劇のヒロイン扱い https://www.hokkaido-np.co.jp/article/645947/ 北京冬季五輪 2022-02-15 17:04:00
マーケティング MarkeZine 2022年のCXトレンドと顧客の変化を読み解く「CX Trends 2022 Japan」開催! http://markezine.jp/article/detail/38362 cxtrendsjapan 2022-02-15 17:15:00
IT 週刊アスキー 本日2月15日18時30分から!自在合体STG『ソルクレスタ』ゲーセンミカドとのコラボ生配信を実施 https://weekly.ascii.jp/elem/000/004/083/4083545/ nintendo 2022-02-15 17:45:00
IT 週刊アスキー IPトランシーバーアプリ「Buddycom」、現場の声に応えてスムーズなログイン機能を搭載 https://weekly.ascii.jp/elem/000/004/083/4083540/ buddy 2022-02-15 17:30:00
マーケティング AdverTimes 進化する「アニバーサリー・プロジェクト」(周年事業)の企画書を書きたい! https://www.advertimes.com/20220215/article376757/ 片岡英彦 2022-02-15 08:02:53

コメント

このブログの人気の投稿

投稿時間: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件)