IT |
気になる、記になる… |
Microsoft、米国と英国で「Xbox Series X」の認定整備済品の販売を開始 |
https://taisy0.com/2022/03/28/155227.html
|
xboxs |
2022-03-28 12:59:40 |
AWS |
AWS Government, Education, and Nonprofits Blog |
How UK public sector customers can implement NCSC security principles to protect data transfers to AWS |
https://aws.amazon.com/blogs/publicsector/how-uk-public-sector-customers-can-implement-ncsc-security-principles-to-protect-data-transfers-to-aws/
|
How UK public sector customers can implement NCSC security principles to protect data transfers to AWSTo drive innovation and optimise operations in the Amazon Web Services AWS Cloud UK public sector organizations need to transfer data quickly and safely in accordance with the National Cyber Security Centre NCSC s guidance on how to configure deploy and use cloud services securely The NCSC provides security guidance for protecting government systems planning for cyber incidents and more In this post we cover how you can configure AWS servicesーlike AWS DataSync AWS Storage Gateway and AWS Transfer Familyーto align your data transfer solution with the NCSC s cloud security principles as understanding these configurations is important to protect data and meet requirements for local force accreditation |
2022-03-28 12:04:10 |
Linux |
Ubuntuタグが付けられた新着投稿 - Qiita |
自宅サーバー構築譚:NTPクライアント |
https://qiita.com/katz_engineer/items/fa46454a85d93e6e671b
|
テスト用には時刻をわざとずらせるようにした方が都合が良い事も多いんですが、それはまた別の話。 |
2022-03-28 21:21:49 |
技術ブログ |
Developers.IO |
EventBridgeで受け取ったGuardDutyのイベントをKinesis Firehose経由でS3に保存してみた |
https://dev.classmethod.jp/articles/put-guardduty-event-to-s3-with-eventbridge-and-kinesis-firehose/
|
eventbridge |
2022-03-28 12:25:56 |
技術ブログ |
Developers.IO |
StepFunctionsからLambdaを呼び出した際のエラー「null (Service: Lambda, Status Code: 504, Request ID: null)」について教えてください |
https://dev.classmethod.jp/articles/tsnote-stepfunctions-error-with-lambda-function/
|
StepFunctionsからLambdaを呼び出した際のエラー「nullServiceLambdaStatusCodeRequestIDnull」について教えてください困っていた内容StepFunctionsからLambdaを呼び出す処理で、が発生しました。 |
2022-03-28 12:23:03 |
海外TECH |
MakeUseOf |
The 7 Best MagSafe Battery Packs for iPhone |
https://www.makeuseof.com/best-magsafe-battery-packs/
|
extra |
2022-03-28 12:40:13 |
海外TECH |
DEV Community |
Creating a simple but intelligent ChatBot with Open-AI |
https://dev.to/sunflowertoadtheorbiter/creating-a-simple-but-intelligent-chatbot-with-open-ai-3kph
|
Creating a simple but intelligent ChatBot with Open AISo I have been using GitHub copilot for a while now GitHub Copilot is a Plugin for VSCode JB IDEs NVIM that provides you with intelligent code completion suggestions and in my opinion the next big thing in Software Development in general I was always really interested in how the whole AI Suggestion works and how it could be used in my own projects While looking into it I came across the Open AI Playground a playground for Open AI s text davinci model What is Open AI s text davinci API text davinci is a model that can be trained to generate text from a given input It also provides an API to interact with the model which is actually quite easy to use const Configuration OpenAIApi require openai const configuration new Configuration apiKey process env OPENAI API KEY const openai new OpenAIApi configuration const response await openai createCompletion text davinci prompt Hey how are you n question for the ai goes here temperature means no randomness and usually the best result max tokens top p frequency penalty presence penalty stop n Creating the ChatBotSo I decided to create a ChatBot that can be used to interact with the AI Developing with GitHubs Copilot I already noticed that Context is always very important and helps the AI to understand what kind of response he should give So first thing I do is configure the AI How do you ask WITH CLEAR TEXT function conversationContext aiName attributes return n The following is a conversation with an AI The AI is attributes n Human Hello n aiName Hi I am an AI Whats your question n Now we will feed this context to the AI which with more context will give us a better response const promt gt return conversationContext aiName attributes Human question n aiName Here we just want want the AI has to say like Human Hello who are you AI responseFromTheAI The Final BotWrapping that all up into a nice React Application and the Bot is ready to go Below I have some examples The Chatbot is hosted on Netlify and the source code is available on GithubChatbot on NetlifyHave fun and I hope will find it useful in maybe finding your next Project Idea |
2022-03-28 12:38:24 |
海外TECH |
DEV Community |
The right way to use LocalStorage in JavaScript |
https://dev.to/anshuman_bhardwaj/the-right-way-to-use-localstorage-in-javascript-41a0
|
The right way to use LocalStorage in JavaScriptBeing a web developer we all have been in to a situation where we want to persist a piece of information like user data theme preference or the selected filters to give our users a consistent experience across browser sessions Well that s exactly where the LocalStorage API comes into the picture Hold on Hold on Let s start from the basics What is LocalStorage The LocalStorage API of web browsers that allows to store and then read the stored data across browser sessions Let s break it down It allows us to store data into a persistent memory so that the data is still available when we restart the browser or even the computer It stores the data local to the origin meaning you can only read write the data to LocalStorage for the current origin i e the following combination protocol domain port It is to be noted that the LocalStorage starts empty and the items added during a private session get cleared as soon as the last private tab is closed Internals of LocalStorageThe LocalStorage is a key value store meaning it stores the given value against the provided key just like a JavaScript object but persistent Key Value store provides fast lookup and writes because of it s structure finding the right element will always take constant time apart from the time to do I O This means having hundreds of keys in your LocalStorage wouldn t slowdown the lookup Not sure why you would be doing that With it s speed comes one limitation the key and value both has to be a string to be stored into the LocalStorage Well this isn t so hard to get around Currently the Web Storage specification allows you to store up to MB per app per browser How to use LocalStorage Thankfully the LocalStorage API is fairly simple to interface with Let s go ahead and see how we can do the basic operations like Create Read Update Delete on LocalStorage Writing dataThe localStorage setItem accepts a string as key and the value is also accepted as string localStorage setItem lt key gt lt value gt The above line of code will write the value against the given key if the already exists the existing value will be over written Reading dataTo read the stored information we need to provide the key const value localStorage getItem lt key gt value will be null or stringnull is returned if no data is found with the given key Storing Objects in LocalStorageYou might be wondering Strings Jeez what am I going to do about a object Don t worry We are still allowed to store a serialised version of the object storing an object in LocalStorage const user name anshuman bhardwaj localStorage setItem user JSON stringify user reading the object from LocalStorage const strinifiedUser localStorage getItem user if strinifiedUser const retrivedUser JSON parse strinifiedUser Deleting dataThere are two methods for removing stored data from LocalStorage programatically removeItemIf you already know which item to delete removeItem is the way to go localStorage removeItem lt key gt clearIf you want to remove all keys from the storage then clear is the clear choice you see what I did there localStorage clear As exciting as it may sound the clear method shouldn t be used all that much because it clears everything and not just the items that you added Which means if you are interacting with services that use LocalStorage e g authentication modules like Firebase Auth or Okta clearing the LocalStorage will also delete the data those services had put in and it ll break their behaviour Yeah don t worry I got you In computer science we should always focus on encapsulation meaning we should hide the information or encapsulate it so to say Well that s exactly how we are going to solve our little problem here The following pattern was suggested to me by my friend amp colleague Ryan Creating and using Namespace in LocalStorage We can apply the principle of encapsulation here by putting all of our data under a predefined amp unique key or namespace This will allow us to hide our from other parts of the application which we don t control and also save us from mistakenly updating the data which we shouldn t Sounds good but how do we do that you might be wondering Well it s simpler than it sounds and works by enclosing the whole application state under one single key rather than using a new key for each information Step Create a key predictable yet unique A good example would be your app name some unique token i e DEV Step While storing information we read the namespace value from the LocalStorage desearialize it update the value against the key inside the object and then serialize it again before writing to LocalStorage Step While read information we read the namespace value from the LocalStorage desearialize it and return the value of the key from the object This way we treat the namespace like it s own little LocalStorage Below is a code implementation of the aboveconst NAMESPACE DEV function writeToStorage key value const serializedData localStorage getItem NAMESPACE const data serializedData JSON parse serializedData data key value localStorage setItem NAMESPACE JSON stringify data function readFromStorage key const serializedData localStorage getItem NAMESPACE const data JSON parse serializedData return data data key undefined function clear localStorage setItem NAMESPACE JSON stringify function removeItem key const serializedData localStorage getItem NAMESPACE const data serializedData JSON parse serializedData delete data key localStorage setItem NAMESPACE JSON stringify data The above implementation of clear and removeItem is safe to use and solves our issue Don t worry you will not have to write your own implementation because there exists a npm package store that solves the above problem and provides a smarter localstorage That s all for today Should you have any questions or suggestions please feel free to drop in comments below For more such content please follow me on TwitterUntil next time |
2022-03-28 12:26:05 |
海外TECH |
DEV Community |
8- What is Git? Why should I use it? What is Github, Gitlab, Bitbucket used for? |
https://dev.to/hamitseyrek/8-what-is-git-why-should-i-use-it-what-is-github-gitlab-bitbucket-used-for-5hdm
|
What is Git Why should I use it What is Github Gitlab Bitbucket used for We have finally come to the Git version control system which allows you to keep your codes more organized which we talked about throughout the Advanced Software Development article series If you ve come this far by reading the series it s fine If you came directly to this article I suggest you read the Advanced Software Development article Everyone gets errors while writing code While trying to fix that error we sometimes try more than one solution that we found on the internet And there are times when we crash other parties In such a case we may want to restore our project to the state after than applying those trials solutions While dealing with all this it can sometimes be too late when we realize that we are making our project worse Of course these are all memories of when we were unaware of the Git version control system Fortunately these problems are now a thing of the past thanks to Git Git is very useful for anyone who writes code or who sometimes wants to revert to previous versions Of course this is not the only benefit Projects rotting on hard drives are now gone from our lives We can find the pure version of a module we have written among the versions and use it in our new projects In this way we are now able to develop projects faster Each version of each project we do is kept in the Git system on a regular basis While there are version control systems such as Git Mercurial BitKeeper CVS and SVN Git is the most used version control system Nearly of professional software developers prefer Git Git s contributions to teams are another feature In cases where more than one person works on the same project a record is kept of who made what changes and what they did The desired change can be undone instantly In short using Git for all your projects that you develop alone or with your team will make you a more organized and more practical developer Because the changes made by any of the team members can be seen by the other members You can pull the changes made by other developers to your own computer with a single command Git is software that works locally After Git is installed it is easier to follow the versions thanks to such a Client interface program Thanks to GitHub Desktop Sourcetree Fork etc desktop applications you can follow the version controls of the projects you have developed on your own local computer Why should I use it There are more advantages to using Git online In this way you can access your projects from anywhere as well as share them with other members of the team very easily While all members of the team are working on the same project Git helps you a lot in merging all commits Online storage systems such as Github Gitlab and Bitbucket use the Git version control system On these platforms you can keep your projects either public or private All the systems we mentioned in other articles Devops Agile SOLID etc actually require the use of git Or we can say that Git makes it possible for such systems to work Because growing projects as a single module does not comply with any software development principle Git both encourages modularization and makes it more feasible Projects developed by large teams are shared among team members in modules Thanks to Git multiple modules of the project interface registration form api basket part payment modules etc can be developed by different people in parallel When changes made in teams where Git version control is not used are added to the main project things do not always go as desired For example when your customer says they don t want module X anymore it will be very difficult to find all the other modules that that module affects Thanks to the Git branching system modules can be removed from the system much more easily One of my favorite features of Git is that it gives me the chance to experiment without limit I can do all the ideas that come to my mind with the comfort of knowing that I will not break the project Even though I don t use most of my ideas afterwards I can sometimes come across something creative We can say that this comfort has increased my creativity This comfort can accelerate the development of newcomers less experienced fellows as it gives them the opportunity to try things out without breaking them Because you can undo your mistakes whenever you want And without a single line damaging the project With Git version control you can write the commits you have made in an explanatory way Which change why was made can be easily seen by all team members When you commit the Git system not only takes a snapshot of the current state of your project but also shows you comparatively what has been done down to the smallest detail Not only does it keep file changes or lines added removed it even saves a single space character that has changed in the file In this way your progress will be much stronger The important point here is that when you commit you should pay attention to a single subject if possible When you undo multi subject commits you may be deprived of more than one change But a commit with a single feature is more useful for undoing transactions related to only that feature Many companies work offline for security reasons But in the offline working model which can be realized thanks to Git even when a problem occurs on the main server since each developer has a sub version the work can continue without stopping ConclusionWithout a doubt what a developer fears most is data loss Sometimes we think that we have taken a backup but we had not get it completely Sometimes the backup files we receive can be infected with viruses and corrupt our backups Data loss is actually the worst thing that can happen to a project But luckily Git got us out of this trouble as well In fact it saved the companies Because versions of a project are kept on each developer s computer A user who uses Git has a full fledged copy on his computer as well as a record of all changes made to the project There is a difference between someone who has actively written code or a project that can be referenced in their CV and someone who does not have any work In the article I touched on why we should use Git I ll leave it up to you to research how to use it Don t wait start now There is no doubt that using Git will make you a better developer In the Advanced Software Development series Previous article What makes SOLID principles special Are there any other software development principles What are they Don t forget to like if you think it s useful Always get better |
2022-03-28 12:25:50 |
海外TECH |
DEV Community |
Build a rest service from the command line, as simple as “every request has a response.” |
https://dev.to/to_code/build-a-rest-service-from-the-command-line-as-simple-as-every-request-has-a-response-40j5
|
Build a rest service from the command line as simple as “every request has a response Following with Handmade Series with Java this is the rd chapter I ll make a rest service as always step by step without IDEs I ll use the Spark library to getting a “pong to every “ping request I declare a simple class called PingPongGame with main method inside public class PingPongGame public static void main String args nothing inside yet Inside of the main method call a static method named get provided by Spark library that contains A url path ping GET verb http Receiving a req and res object from request Which finally return a response a simple string “pong I add the current import from Spark library spark Spark get getting the code above import static spark Spark get public class PingPongGame public static void main String args get ping req res gt pong Before executing it download the spark library from the maven repository After downloading it place it inside PingPongGame class folder it runs the next instruction through the command linejava cp spark core jar PingPongGame java it printsException in thread main java lang NoClassDefFoundError org slfj LoggerFactory at spark Service lt clinit gt Service java at spark Spark SingletonHolder lt clinit gt Spark java at spark Spark getInstance Spark java at spark Spark lt clinit gt Spark java at HelloWorld main HelloWorld java Caused by java lang ClassNotFoundException org slfj LoggerFactory at java base jdk internal loader BuiltinClassLoader loadClass BuiltinClassLoader java at java base jdk internal loader ClassLoaders AppClassLoader loadClass ClassLoaders java at java base java lang ClassLoader loadClass ClassLoader java at spark Service lt clinit gt Service java at spark Spark SingletonHolder lt clinit gt Spark java at spark Spark getInstance Spark java at spark Spark lt clinit gt Spark java at HelloWorld main HelloWorld java at java base jdk internal reflect NativeMethodAccessorImpl invoke Native Method at java base jdk internal reflect NativeMethodAccessorImpl invoke NativeMethodAccessorImpl java at java base jdk internal reflect DelegatingMethodAccessorImpl invoke DelegatingMethodAccessorImpl java at java base java lang reflect Method invoke Method java at jdk compiler com sun tools javac launcher Main execute Main java at jdk compiler com sun tools javac launcher Main run Main java at jdk compiler com sun tools javac launcher Main main Main java Cause Spark library by itself can t run this instance it depends on others libraries The required jar libraries list slfj apispark corejavax servlet apijetty serverjetty utiljetty httpjetty iologj slfj impllogj apilogj coreAfter downloading them run the long command line above java cp spark core jar slfj api jar javax servlet api jar jetty server v jar jetty util v jar jetty http v jar jetty io v jar logj slfj impl jar logj api jar logj core jar PingPongGame java It prints nothing because the process has started to run leaving the terminal in a waiting state So at this point I need to verify if the rest service is “up amp running by executing this command curl http localhost ping it should printspong Again simple and effective perhaps not too simple cause of the amount of added libraries but still isn t to worry taking in count it made without IDEs That s all Pong to my ping needed Creating a standar rest services Using a method of a knowing library Add it and test it Problem happened missing libraries Adding missing libraries Problem fixed I got my pong trought rest service Command and options dictionary java run class and java files cpindicate compiled folders directory classpath curl command to execute transfer to or from a server Tech stackJava Windows Spark java RepoBonus trackSpark java is a “microframework as springboot but only based on functional programming with a simple implementation I invited you to take in count in your read list the next article to a deeper understanding Web microservices development in Java that will Spark joy |
2022-03-28 12:20:48 |
海外TECH |
DEV Community |
How IBM C1000-124 PDF Dumps Can Strengthen your ... |
https://dev.to/equir1934/how-ibm-c1000-124-pdf-dumps-can-strengthen-your--526k
|
How IBM C PDF Dumps Can Strengthen your A Pathway to Success in C Practice Test Once you establish your grip on Dumpsleader s IBM IBM Certified Advocate Cloud v C exam dumps PDF the real exam questions will be a piece of cake for you Each important section of the syllabus has been given due place in the C dumps Hence you never feel frustrated on any aspect of preparation staying with Dumpsleader Every C braindump included in the PDF is verified updated and approved by the C Dumps experts With these outstanding features of its product Dumpsleader is confident to offer money back guarantee on your success Free C Exam Braindumps PDF Demo Dumpsleader s offer of downloading free IBM Cloud Advocate v exam dumps demo from its webpage gives you the opportunity to go through the specimen of its content The prospective clients can examine the format and quality of IBM Certified Advocate Cloud v C Exam Braindumps PDF content before placing order for the product Online Help For C Study Guide You can contact our professionals any time Click Here More Info gt gt gt gt gt |
2022-03-28 12:11:11 |
海外TECH |
DEV Community |
Learning Rust: My 6 Key Moments |
https://dev.to/apollolabsbin/learning-rust-my-6-key-moments-3ngh
|
Learning Rust My Key MomentsIf you ve tried learning Rust or looked into it at least you might have read somewhere how it has a steep learning curve For me personally coming from a background of writing code in several other languages mainly C I found that to be somewhat true Actually I also think that some of my background in computer systems at a low level helped me grasp Rust faster Regardless of all that it was still an amazing journey I found myself quite often thinking how much Rust makes sense Especially regarding how the language handles matters from a system perspective You can read more about what I liked in my last blog post Things I Loved About Learning Rust It s worth pointing out that my personal goal in learning Rust was for using it in Embedded development For my purposes probably going up to chapter or in “The Book would have been sufficient Still for me I really wanted to go further given how much I found myself attracted to the language and curious in understanding its depth With that being said below is my list of things that throughout my Rust learning journey I felt I had a key moment once understanding Mind that these concepts are probably not the toughest to understand in Rust moreover most were probably mentioned at some point in the resources I leveraged However I felt these concepts had a key impact on my understanding because they often were subtly explained though commonly used It s all about the References Almost any Rust learner and probably developer can tell you about their struggles dealing with the borrow checker Ownership and borrowing are really powerful concepts in Rust yet they take some effort and focus to understand properly I would add that its probably even one of the things that when you consistently nail you feel like you have become some sort of invincible programmer Well thanks to a series of videos about Rust by Doug Milford I found on YouTube I got much needed clarification In Doug s video Rust Ownership and Borrowing he demonstrates quite a few examples about borrowing My initial understanding was that all values can be owned by one variable and cannot be passed around unless they are cloned or borrowed If not borrowed they would be dropped at the end of the scope they are used It turned out that it s not always true the exception being fixed size variables that are created in the stack i e non pointer local variables In Rust terminology fixed size variables ones that are created in the stack implement a copy Trait that allows them to behave in such a manner This made a lot of sense at that point because when passing non pointer local variables that reside on the stack they are passed by value copied cloned to the called function via the activation record and are erased when the function ends anyway so why worry about borrowing To demonstrate a simple example let s say we have something as follows fn main let some string String from hello let other string some string println some string This is something that you learn you cannot do in Rust You get a compile error because there can be only one owner to the String If Rust had allowed this it would mean that we would have two variables some string and other string pointing at the same String a big NO NO You might ask why because if it s allowed it means that potentially two different variables can change the same location a disaster waiting to happen in parallel programming So based on that now you would think that the following code would also generate a compile error fn main let a let b a println a Interestingly enough it does not But why It turns out because there are no pointers involved and both variables are on the stack we are simply creating a copy of the value of a in b We don t have multiple pointers pointing at one location that can change one value and thus no potential crisis Well this makes a lot of sense In a way while it made sense the latter is the type of code a non Rust programmer would be used to When I went back to check if I missed anything it turns out that this exception is mentioned at some point in Chapter of “The Book I felt it wasn t emphasized enough The thing is that at the onset of the chapter the ownership rules are mentioned from the get go and somehow my thinking got consumed about applying the rules to everything going forward However as explained more or less while ownership still applies there is a wrinkle when it comes to fixed size variables in the stack I guess this might be one of the steep learning curve contributors IMO The part that most coders are used to as the norm comes as an exception A better approach could probably starting by showing the things that are the same and then bringing in the Rust dealings Operator vs OperatorWhile navigating through the concepts and writing new code I often encountered the and operators in a way that felt they were used interchangeably I couldn t really figure out right away the pattern of when I should use which I would say that the operator was easier to grasp as it was used in a similar way to traditional programming languages I was used to essentially to call methods and access struct members The operator was more confusing though From my not so vivid memory about C I recall that a similar operator was used in namespaces for scope resolution not that I ever was fond of C namespaces to start with Though the main question I had is that sometimes was used in a manner where I would instead expect a to be used It turns out that there are two types of methods methods that belonged to an instance of a type and methods that belonged to the type itself So for example if the type is instantiated then we would use the operator for all the instance methods Though if the type is not instantiated there are methods that we would call using the operator Examples of usage can be seen commonly in strings as follows let h String from Hello world so here from is a method that belongs to the String type itself thus using the operator Following that after we have instantiated h we can now call instance methods using the operator For example println is letters long h h len In this case len is an instance method Interestingly enough this is still not where things stopped for the operator is also used to reference module paths when importing libraries with the use keyword For example we can import the PI identifier by referencing its module paths with the use keyword as follows use std f consts PI fn main println Pi PI Was this the end of it for the operator You might have guessed it the answer is still no Check point number about turbofish for one more use Though in that case it combines with another operator to form something new The Exclamation Mark Early on in learning Rust I encountered the often starting with println followed by panic and later vec Although the resources referred to println panic and vec as macros I did not realize until later that all identifiers that end with an are by definition macros It turns out that the is part of the invocation syntax required to distinguish a macro from an ordinary function Macro names if you aren t familiar are replaced by code that is generated statically at compile time rather than called dynamically during runtime like a regular function Makes for faster execution The Turbofish OperatorGenerics are quite an interesting and powerful concept in Rust In short generics allow you to declare a general type for an enum or struct that can then be inferred by the compiler at compile time They look something like this struct MyStruct lt T gt item T Here in the definition of MyStruct we are not defining a type We are saying that it is a generic type T After that at compile time the Rust compiler would figure out on its own from a declaration of MyStruct what the type is and fill it in My issue was that in some cases I saw odd looking declaration examples that looked something like this let var MyStruct lt i gt item It made me wonder where the lt T gt operator business is coming from adding more confusion to point number with the It turns out that this is called a turbofish operator It is used when the compiler isn t sure about the type you want to infer and needs your help as a programmer to help inform about the type The OperatorRegarding points and these are actually some of the things I think contribute to a steep learning curve in any language The part where shorthand notation is brought into the picture early on in the learning process I truly believe that in beginner learning resources shorthand shouldn t be used frequently or at least used alongside non shorthand notation with constant reminders of how it works Better yet I would go as far as to say that shorthand is better left till much later as a tip to enhance coding style Now that I m done with my short rant this brings us to the operator In certain instances I would encounter code that looked like this let x function call It turns out that this is directly related to the Result enum I m not going to get into too much detail but in learning Rust you ll know that Result is a built in generic enum that allows a programmer to return a value that has the possibility of failing It is the way the programming language does error handling So after some searching what the operator turned out to be is shorthand for pattern matching a Result and is the equivalent of doing this let x match function call Ok x gt x Err e gt return Err e So as a result after deconstruction x would either contain the Ok value from the Result of the function call or the value from the Err variant is returned and x is never assigned if let and while letWhile if let was introduced in section of The Book it took a while for me to digest Somehow it felt like it got lost in the grand scheme of things already done with my shorthand rant What it turned out to be in simple terms is a more concise way for pattern matching an Option enum Similar to the Result enum idea and errors Rust represents nullable values without using null but rather the generic enum Option Typically in deconstructing an Option we would do something like this match res Some x gt println value is x None gt With if let we can instead do this if let Some x res println value is x The way this reads is that if res is equal to or matches Some x then execute the println otherwise do nothing Note here that when going for if let we are doing nothing if res is equal to None On the other hand while let follows a similar approach though the difference is introducing a condition that you want to loop as long as a value matches a certain pattern ConclusionLearning Rust is not the easiest feat though I personally found it to be most satisfying and really enjoyable Especially when you try to understand what happens at the low level you start having a lot of these Well that makes a lot of sense moments Still sometimes I found things to be a bit overwhelming and not clarified in a way I expected It could be that I m always trying to relate in my mind to other languages I learned in the past Though the key moments I mentioned were probably the most transforming in my journey What was your experience like What were your key moments with Rust Share your thoughts in the comments If you found this useful make sure you subscribe to the newsletter here to stay informed about new blog posts Also make sure to check out our social channels here |
2022-03-28 12:07:40 |
海外TECH |
DEV Community |
Why You Should Be Worried About the Future of C/C++ in Embedded |
https://dev.to/apollolabsbin/why-you-should-be-worried-about-the-future-of-cc-in-embedded-cm
|
Why You Should Be Worried About the Future of C C in Embedded The Grim ViewSoftware failures are nothing new in embedded though with the continuing prevalence of fields like the internet of things IoT and cyber physical systems CPS they ought to become more concerning We re talking autonomous cars and robots drones and more all connected to the cloud hello security What can possibly go wrong Not worried yet it might be an eye opener to check out case studies about well known historical software accidents and errors You can find a good list here Is there hope to reduce the worry Read on to find out My Firsthand Industry ExperienceI come from an industry background mostly in the field of automotive embedded electronics Additionally later in my career and also through my education I got involved with what is called functional safety If you are not familiar with functional safety then in simple terms it s about a system being able to deliver predictable or correct output based on the provided inputs it is fed This is all to reduce the risk of mishaps leading to injury or damage to the health of humans During my time in the automotive industry I served as a technical lead on several projects where part of the responsibilities involved dealing with customer returns Returns would be electronic units modules that experienced field issues where our team had to determine the root cause for the issue If the source of the issue turned out to be a mistake in the module a fix would be proposed and planned to integrate into a future update release Through that experience I and the teams I worked with encountered a fair share of module returns that we had to deal with At times we spent days if not weeks to figure out what had gone wrong to eventually report back to customers what happened and propose a fix I recall my first experience when I was still an intern doing module testing We had several returned modules that were experiencing inconsistent behavior in the field Some were working correctly others weren t After some significant time working with the software team to help debug we figured out the source of the issue it turned out to be a single uninitialized variable At the time I was surprised that this type of thing can go unchecked As I grew in the industry further experiences were only more complex and daunting in nature At times we would get a single module among thousands that were shipped that experienced strange behavior Typically the first step would be to try to replicate the behavior so that the source of the issue can be traced with special debug tools That by itself would be a nightmare at times It took days if not weeks to replicate certain behavior and sometimes even longer because there would be a very specific combination of events that needs to happen to replicate the issue In most cases the combination of events was a trigger to some sort of unchecked race condition The majority of the issues in returns were software oriented in nature Interestingly enough this happened even in companies where quality was of paramount importance many process checks and balances and where most software engineers were really experienced Essentially thorough testing code reviews code standard implementations Ex MISRA C would have been already been done on these same modules that experience the field issues Getting into Functional SafetyWhat I found even more interesting is my experience when moving into functional safety In functional safety standards like the industrial IEC and the automotive ISO started gaining momentum at a certain point in the automotive industry The purpose of following the standards was to more or less minimize the risk of failure of a product depending on how or where it was used In the standards more checks and balances in the development process were introduced such that a product can be qualified to a certain level of safety Looking at the ISO as an example the standard provided a categorization for the types of failures that can occur in both software and hardware Failures in hardware were categorized into two types random hardware failures and systematic failures On the software end there is only one type which is systematic failures Per ISO a random hardware failure is defined as Failure that can occur unpredictably during the lifetime of a hardware element and that follows a probability distribution The standard also adds that Random hardware failure rates can be predicted with reasonable accuracy Whereas a systematic failure is defined as Failure related in a deterministic way to a certain cause that can only be eliminated by a change of the design or of the manufacturing process operational procedures documentation or other relevant factors This essentially means that systematic failures more or less stem from human error which implies that they aren t really predictable As such if we look at fixing software issues it means more added checks and balances processes are needed Certainly there are also approaches in application software that can be added to have it check itself Ex N version programming though these approaches are added to dynamic application code which leads to overhead that consumes more memory space From a static perspective there were several measures as well Though it did not mean changing the programming language itself One would think that given what I had mentioned earlier many would welcome such changes On the contrary it was the opposite most engineers were opposed to integrating functional safety processes As a matter of fact many of the individuals managing safety development faced the challenge of getting engineers and teams buy in The push typically had to come from the top of the chain by establishing a safety culture I personally think that one part was due to the somewhat significant change in processes and additional documentation deliverables that were introduced not necessarily because individuals opposed the idea of safety itself I guess if there is something an engineer dislikes then it s writing documentation Another challenge was that often teams had to be convinced that products needed to be created designed with safety in mind from the start Meaning you typically are not supposed to take the path of grabbing an existing product and start applying features to it to make it meet safety requirements In other words patching up existing products to meet safety requirements This was mainly stressed for hardware and application software Though what was puzzling to me at times is why the same case was not stressed as much from a compiler programming language perspective Meaning that the languages used along with their compilers were not designed with safety in mind from the start Instead they are modified according to standard guidelines for usage in functional safety applications This included approaches like creating subsets of the language where what were considered unsafe parts were removed That meant excluding certain programming language constructs that can be problematic Which in a way felt like patching up the language and its compiler to qualify it for safety usage opposing the safety in mind from start approach The Pressing QuestionFor those not familiar the programming language most prevalent in automotive is C From what I experienced firsthand and I m sure many might disagree I personally don t see C C as languages that can carry us through upcoming application trends In fact sticking with C C in the long run really worries me No matter how many standards are introduced There is no question that C and C are powerful languages though that power might be at the expense of more systematic failures Current applications are going to be considered excessively simple compared to what is coming Additionally as the industry grows there will be many software engineers that aren t all at the same level of experience Thus there will be an increasing possibility for systematic error regardless of how rigid the processes are At this point it begs the question that with all of the years of experience and best practices and patches incorporated in languages like C C if similar types of issues are still occurring due to systematic failures isn t it time to at least consider the possibility of switching to a different language that was designed with safety in mind Or even a more modern language for that matter Again as indicated by the definition of a systematic failure can only be eliminated by a change of the design A Possible Path ForwardI personally found a possible path in Rust for embedded It seems to fit the missing part of the puzzle that I experienced in my years in the industry Rust was designed at heart in a way to be a safe language Sure switching an industry over to a new programming language is almost never convenient Obviously one of the deterrents is the well established expansive ecosystem of toolchains and libraries with C C in embedded environments like automotive However plans can be put in place to switch over gracefully In non embedded environments Rust has gained quite some popularity and investment from companies including Amazon Discord Dropbox Facebook Google and Microsoft In fact Microsoft and Google already vouch for Rust helping eliminate up to of their security issues in certain areas Read here and here more about it Regarding embedded thus far there has been some interesting movement from certain entities There is the Rust embedded working group that is working within the community to bridge the gap with the Rust teams and also grow the embedded ecosystem It is quite impressive how fast the group has been growing the ecosystem Highlights of the working group achievements can be found here Another entity is Ferrous Systems which has been also doing great work in supporting the Rust ecosystem Ferrous led significant efforts in creating different tools and extensions for Rust and also are working on qualifying a Rust compiler toolchain for ISO under the ferrocene project Interestingly enough at the time of my writing this post AUTOSAR AUTomotive Open System ARchitecture also announced a new working group for Rust in the automotive context More details are found here Side note I am not affiliated nor have I been involved with any of the aforementioned entities ConclusionMarket direction shows that we re probably nearing the time to initiate a shift from C C to a safer more modern compiled programming language Maybe not for all applications but for ones where C C can present themselves as problematic The Rust programming language although fairly young seems to be the most primed to fit the bill It probably would be a good strategic decision to jump on the Rust programming wagon for companies and individuals alike to give themselves an edge in the future For individuals even if a language like Rust is never adopted although I m doubtful that is the case it will at least give the individual a whole new perspective of how to become a better C C developer Do you agree disagree with my views Share your thoughts in the comments If you found this useful make sure you subscribe to the newsletter here to stay informed about new blog posts Also make sure to check out our social channels here |
2022-03-28 12:05:47 |
海外TECH |
DEV Community |
How to send an image from Unsplash to IPFS? |
https://dev.to/raufsamestone/how-to-send-an-image-from-unsplash-to-ipfs-2e7a
|
How to send an image from Unsplash to IPFS I suggest you include the web environment in your growth strategy Therefore you should use technical implementations decentralized networks like subgraph or IPFS In this guide you ll learn how to send image files to IPFS using ipfs http client and NextjsYou can see the demo here or jump to directly GitHub Pre requestsNode gt Getting startedCreate a simple next js app npx create next app ipfsAdd IPFS HTTP client library using yarn yarn add ipfs http clientCreate a new constant for IPFS gateway In this case we will use Infura API const client create api v Get a random image URL from Unsplash You can see more detail in here async function getImage fetch https source unsplash com x beach then response gt let imageURL response url setImageURL imageURL Or you can use your own fetching solution like custom form data Cloudinary etc Then upload your file to IPFS The critical thing is you should fetch the image URL as a blob object const blobFile await fetch imageURL then r gt r blob Create a new function as uploadFileasync function uploadFile const blobFile await fetch imageURL then r gt r blob try const added await client add blobFile const url https ipfs infura io ipfs added path updateIPFSURL url catch error console log Error uploading file error Finally you are ready to fetch and image image object from URL and send to IPFS Clone the full repository here and run yarn devYou can see the more detailed cases about Web from Nader Dabit s posts here Thanks for reading Don t forget to subscribe me on Medium or Dev to |
2022-03-28 12:05:36 |
Apple |
AppleInsider - Frontpage News |
Ukrainians using Telegram chatbot to track Russian troop movements & target attacks |
https://appleinsider.com/articles/22/03/28/ukrainians-using-telegram-chatbot-to-track-russian-troop-movements-target-attacks?utm_medium=rss
|
Ukrainians using Telegram chatbot to track Russian troop movements amp target attacksThe Ukraine government has created a chatbot in the Telegram app for users to use their iPhones to report precise sightings of invading Russian troops to the country s defenders The start of the Russian invasion of Ukraine was spotted practically inadvertently on Google Maps and Apple Maps but now the conflict is seeing personal technology deployed intentionally A chatbot various known as eVororog or eBopor which translates to e Enemy has been created by the Ukraine s Ministry of Digital Transformation It s not a separate app so Russia can t as readily demand that it be removed from the App Store as it has with previous politically sensitive apps Read more |
2022-03-28 12:39:45 |
Apple |
AppleInsider - Frontpage News |
Top 5 Amazon deals for the week of March 28: AirPods, Mac mini, TurboTax & more on sale |
https://appleinsider.com/articles/22/03/28/top-5-amazon-deals-for-the-week-of-march-28-airpods-mac-mini-turbotax-more-on-sale?utm_medium=rss
|
Top Amazon deals for the week of March AirPods Mac mini TurboTax amp more on saleWeekly deals on Apple products high end audio equipment gaming gear and even tax software are going on now at Amazon with cash discounts of up to off We ve rounded up our favorites on March Save on Apple AirPods TurboTax software for Mac and audio equipmentBargain hunters can check out Amazon s daily deals on this dedicated sale page but we re highlighting our own top picks below Read more |
2022-03-28 12:08:36 |
Apple |
AppleInsider - Frontpage News |
Apple rumored to be cutting iPhone SE orders following weak demand |
https://appleinsider.com/articles/22/03/28/apple-cuts-iphone-se-orders-following-weak-demand?utm_medium=rss
|
Apple rumored to be cutting iPhone SE orders following weak demandAnalyst Ming Chi Kuo says that Apple s latest iPhone SE is selling less than expected and other sources say orders are being scaled back as a result Starlight iPhone SEWith the exception of adding G support the iPhone SE has been seen as a minor update Now it appears that its similarity to the previous model plus perhaps the global situation with coronavirus lockdowns and Ukraine war is causing demand to be less than Apple expected Read more |
2022-03-28 12:31:05 |
Apple |
AppleInsider - Frontpage News |
Apple TV+ original film 'CODA' wins Best Picture at the 2022 Oscars |
https://appleinsider.com/articles/22/03/28/apple-tv-original-film-coda-wins-best-picture-at-the-2022-oscars?utm_medium=rss
|
Apple TV original film x CODA x wins Best Picture at the OscarsApple has scored at the Oscars for its original film CODA which won Best Picture ーmaking Apple TV the first streaming service to be honored with the award The cast of CODA at the Oscars as posted to Twitter by Tim CookDuring Sunday s th Academy Awards Apple TV was represented by a pair of films that were nominated for a total of six awards with CODA alongside The Tragedy of Macbeth for three categories apiece Read more |
2022-03-28 12:16:45 |
海外TECH |
Engadget |
Amazon Games chief Mike Frazzini is leaving the company |
https://www.engadget.com/amazon-game-studios-chief-mike-frazzini-is-stepping-down-120054965.html?src=rss
|
Amazon Games chief Mike Frazzini is leaving the companyAmazon Game Studio head and longtime employee Mike Frazzini is stepping down he announced in a LinkedIn post Frazzini cited the desire to spend more time with family and the fact that the studio is finally having some success quot While there s never really a perfect time to step away from a great role now is a good time quot he wrote quot We ve launched two top games in the past six months and have a growing portfolio of promising new games in the pipeline quot Amazon Games has struggled over the past few years notably with the cancellation of its Lord of the Rings MMO and fiasco with its first AAA game Crucible The company was also criticized for its policy of claiming ownership of employees personal games that one engineer called quot draconian quot One former Game Studios manager said some of Amazon s issues may have come about because Frazzini had no previous experience in gaming according to the same Bloomberg report nbsp However the company has had hits of late with New World one of s biggest money makers on Steam It has also had ongoing success as the publisher of Lost Ark made by South Korean developer Smilegate RPG Frazzini didn t say what he planned to do next nbsp |
2022-03-28 12:00:54 |
金融 |
金融庁ホームページ |
「ASEAN諸国のサステナブルファイナンスに関する委託調査」報告書を公表しました。 |
https://www.fsa.go.jp/common/about/research/20220328/20220328.html
|
asean |
2022-03-28 14:00:00 |
ニュース |
@日本経済新聞 電子版 |
「グローバル型の成長モデルは行き詰まり」「法律や税制も含め国としてのリスクレベルも見極めていかなければならない」。高まる地政学リスクへの対応など社長100人アンケートから主なコメントを紹介します。
https://t.co/q7fvzWYKLZ |
https://twitter.com/nikkei/statuses/1508428821808259084
|
「グローバル型の成長モデルは行き詰まり」「法律や税制も含め国としてのリスクレベルも見極めていかなければならない」。 |
2022-03-28 13:00:31 |
ニュース |
@日本経済新聞 電子版 |
「有事の核使用、日米で事前に詰め」「『持ち込ませず』は議論尽くすべき」。ロシア侵攻を巡り、日本で核抑止を巡る議論が活発になってきました。与野党に日本政府が取るべき対応などを聞きました。
https://t.co/RtfDwnRUVo |
https://twitter.com/nikkei/statuses/1508423676223528963
|
「有事の核使用、日米で事前に詰め」「『持ち込ませず』は議論尽くすべき」。 |
2022-03-28 12:40:04 |
ニュース |
@日本経済新聞 電子版 |
「地球最後のフロンティア」とされる海底。その未開の地形を明らかにする大規模プロジェクトが世界を舞台に進んでいる。世界中の研究者に加え、国内のスタートアップも技術開発に参画し始めた。
#日経STORY
Google Mapの空白地帯… https://t.co/CeBoyujBrC |
https://twitter.com/nikkei/statuses/1508419609698963456
|
「地球最後のフロンティア」とされる海底。 |
2022-03-28 12:23:54 |
ニュース |
@日本経済新聞 電子版 |
ウクライナ侵攻の傍ら、ロシアと西側諸国による冷戦がにわかに復活――。その中でアメリカ主導の戦後秩序を崩し、世界を多極化することこそが「善」だと信じる中国の習近平国家主席の秩序観を考えます。
https://t.co/gyCXktobpt |
https://twitter.com/nikkei/statuses/1508418642949586953
|
ウクライナ侵攻の傍ら、ロシアと西側諸国による冷戦がにわかに復活ー。 |
2022-03-28 12:20:04 |
ニュース |
@日本経済新聞 電子版 |
トヨタ、中古車サブスク全国で 納期待ちの需要開拓
https://t.co/WEFf8qwniZ |
https://twitter.com/nikkei/statuses/1508417530636881924
|
需要 |
2022-03-28 12:15:39 |
ニュース |
@日本経済新聞 電子版 |
ロシアでロゴ模倣相次ぐ ブランド撤退、受け皿狙う
https://t.co/QitZZQQBaV |
https://twitter.com/nikkei/statuses/1508415787395997701
|
模倣 |
2022-03-28 12:08:43 |
ニュース |
BBC News - Home |
Will Smith hits Chris Rock on Oscars stage |
https://www.bbc.co.uk/news/entertainment-arts-60897004?at_medium=RSS&at_campaign=KARANGA
|
actor |
2022-03-28 12:20:36 |
ニュース |
BBC News - Home |
P&O Ferries P&O given deadline to reemploy sacked workers |
https://www.bbc.co.uk/news/business-60895833?at_medium=RSS&at_campaign=KARANGA
|
previous |
2022-03-28 12:00:55 |
ニュース |
BBC News - Home |
Laura Kuenssberg to replace Andrew Marr full-time |
https://www.bbc.co.uk/news/entertainment-arts-60903865?at_medium=RSS&at_campaign=KARANGA
|
morning |
2022-03-28 12:48:20 |
ニュース |
BBC News - Home |
Aljaž Škorjanec is leaving Strictly Come Dancing |
https://www.bbc.co.uk/news/entertainment-arts-60899783?at_medium=RSS&at_campaign=KARANGA
|
instagram |
2022-03-28 12:20:25 |
ニュース |
BBC News - Home |
'The longest trip I have ever been on' - Ukraine's Mahuchikh on escaping war and winning gold |
https://www.bbc.co.uk/sport/athletics/60898354?at_medium=RSS&at_campaign=KARANGA
|
x The longest trip I have ever been on x Ukraine x s Mahuchikh on escaping war and winning goldUkraine s Yaroslava Mahuchikh says winning gold in the high jump at the World Indoor Championships shows the strength of her country as it continues to fight a war against Russia |
2022-03-28 12:19:12 |
北海道 |
北海道新聞 |
胆振85人感染 新型コロナ |
https://www.hokkaido-np.co.jp/article/662332/
|
新型コロナウイルス |
2022-03-28 21:33:00 |
北海道 |
北海道新聞 |
ワクチン相は松野官房長官が兼務 閣僚枠1減、堀内五輪相は退任 |
https://www.hokkaido-np.co.jp/article/662331/
|
堀内詔子 |
2022-03-28 21:33:00 |
北海道 |
北海道新聞 |
根室市スポーツ奨励賞に4児童 近代三種、バドミントンで活躍 |
https://www.hokkaido-np.co.jp/article/662330/
|
近代 |
2022-03-28 21:30:00 |
北海道 |
北海道新聞 |
共和薬品に業務停止命令 大阪、未承認の添加剤使用 |
https://www.hokkaido-np.co.jp/article/662325/
|
業務停止命令 |
2022-03-28 21:21:00 |
北海道 |
北海道新聞 |
日米韓制服組トップが会談へ 北朝鮮情勢で意見交換か |
https://www.hokkaido-np.co.jp/article/662324/
|
北朝鮮情勢 |
2022-03-28 21:21:00 |
北海道 |
北海道新聞 |
前週(3月20~26日)感染者20人増386人 西胆振 室蘭高止まり、登別倍増 |
https://www.hokkaido-np.co.jp/article/662323/
|
新型コロナウイルス |
2022-03-28 21:20:00 |
北海道 |
北海道新聞 |
現職20人、新人6人当選 北見市議選 市役所で証書付与式 |
https://www.hokkaido-np.co.jp/article/662322/
|
選定 |
2022-03-28 21:16:00 |
北海道 |
北海道新聞 |
住んで見る知る士幌のいま 北大生が商店紹介本 短期移住した佐藤さん |
https://www.hokkaido-np.co.jp/article/662321/
|
近く |
2022-03-28 21:13:00 |
北海道 |
北海道新聞 |
旭川凍死中2の母親を中傷 愛知の女性、略式起訴 |
https://www.hokkaido-np.co.jp/article/662310/
|
略式起訴 |
2022-03-28 21:11:45 |
北海道 |
北海道新聞 |
選挙の大切さ、漫画で訴え 道コンクールで特選 中札内高等養護2年の久保さん |
https://www.hokkaido-np.co.jp/article/662320/
|
高等 |
2022-03-28 21:09:00 |
コメント
コメントを投稿