投稿時間:2023-07-28 05:25:15 RSSフィード2023-07-28 05:00 分まとめ(34件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
AWS AWS Partner Network (APN) Blog Getting Started with AWS Backups for VMware Cloud on AWS https://aws.amazon.com/blogs/apn/getting-started-with-aws-backups-for-vmware-cloud-on-aws/ Getting Started with AWS Backups for VMware Cloud on AWSThe advent of automated infrastructure provisioning and cloud based remote backup and recovery solutions has empowered organizations to embrace advanced data protection and backup strategies tailored for cloud native workloads Explore the architectural design and considerations customers should consider before adopting AWS Backup using private interface VPC endpoints powered by AWS PrivateLink to protect workloads running on VMware Cloud on AWS 2023-07-27 19:37:08
AWS AWS Compute Blog Python 3.11 runtime now available in AWS Lambda https://aws.amazon.com/blogs/compute/python-3-11-runtime-now-available-in-aws-lambda/ Python runtime now available in AWS LambdaYou can build and deploy functions using Python using the AWS Management Console AWS CLI AWS SDK AWS SAM AWS CDK or your choice of Infrastructure as Code IaC You can also use the Python container base image if you prefer to build and deploy your functions using container images 2023-07-27 19:57:00
海外TECH Ars Technica Android phones can now tell you if there’s an AirTag following you https://arstechnica.com/?p=1957104 ecosystem 2023-07-27 19:10:43
海外TECH MakeUseOf How to Lock Your Notes on a Mac https://www.makeuseof.com/how-to-lock-notes-on-mac/ extra 2023-07-27 19:46:23
海外TECH MakeUseOf What Is the #SPILL! Error in Microsoft Excel? How to Fix It https://www.makeuseof.com/what-is-the-spill-error-in-microsoft-excel/ right 2023-07-27 19:30:24
海外TECH MakeUseOf 7 Ways to Fix the "Application Made Too Many Requests" Error (0x80860010) on Windows https://www.makeuseof.com/application-too-many-requests-error-0x80860010-windows/ message 2023-07-27 19:16:23
海外TECH MakeUseOf The Top 9 Ways to Use ChatGPT for Your Health https://www.makeuseof.com/top-ways-use-chatgpt-health/ health 2023-07-27 19:00:23
海外TECH DEV Community How to Write Impeccably Clean Code That Will Save Your Sanity https://dev.to/atkumar/how-to-write-impeccably-clean-code-that-will-save-your-sanity-4np9 How to Write Impeccably Clean Code That Will Save Your SanityArticle published on GitConnected Writing code is a skill that anyone can acquire but attaining the highest standards of clean code requires discipline and dedication In this article we will explore practical strategies and tools to help you elevate your Python code to impeccable levels By gradually incorporating these best practices into your development lifecycle you can ensure clean bug free code that stands the test of time Adhering to best practices not only maintains code cleanliness but also minimizes the risk of introducing bugs While it may require an initial investment of time following these practices ultimately reduces development effort in the long run As a seasoned full stack software engineer I have consistently received accolades for upholding coding standards in the companies I have worked with To illustrate these best practices we ll consider a hypothetical project called Stack Scraper This project consists of a single page website scraper that extracts questions and answers from hypothetical Stack Overflow Please note that Stack Scraper is not a functional project but serves as an example to demonstrate the ideas discussed here The source code for this example can be found on GitHub I personally use VS Code as my go to IDE and so some of the tools and plugins mentioned here are for the same Let s dive into the best practices and tools I employ to ensure my Python code adheres to the highest standards Repository StructureA thoughtfully designed repository structure serves as the foundation for clean code development If the structure fails to meet the project s requirements developers may scatter code across different locations resulting in a messy structure and decreased code re usability A carefully crafted repository structure plays a vital role in maintaining code organization and facilitating collaboration among developers It s important to note that there s no one size fits all solution for repository structure Each project may have unique requirements that warrant a specific organization scheme However examining a practical example can provide valuable insights Let s consider the repository structure of the Stack Scraper project Here are some key points to note The Stack Scraper repository employs clearly demarcated folders for different components such as APIs src apis database models src db wrappers domain level constants src constants pydantic models src domain models and scrapers src external sources scrappers etc This segregation ensures a logical separation of code enabling developers to locate and modify specific functionalities easily The test files in the Stack Scraper repository follow the same hierarchy as the main repository This practice ensures that tests remain organized and aligned with the corresponding code Consistent test organization simplifies test management and improves code testability pre commitpre commit is a framework that enables the execution of configurable checks or tasks on code changes prior to committing providing a way to enforce code quality formatting and other project specific requirements thereby reducing potential issues and maintaining code consistency All you need to do is create a pre commit config yaml file in your repository You can install pre commit by running following commands pip install pre commitpre commit installLet s examine the pre commit config yaml of Stack Scraper repos repo rev hooks id black args config pyproject toml language version python repo rev hooks id flake args config tox ini language version python repo rev hooks id isort args profile black filter files language version python repo rev v hooks id requirements txt fixer language version python id debug statements id detect aws credentials id detect private keyHere we have configured hooks You can add more hooks if you need but above setup is more than enough to help you keep your code clean Type hintsPython s dynamic typing allows variables to be assigned without explicit type definitions which can lead to convenience However this flexibility can pose challenges in maintaining code quality especially in larger projects where type errors and inconsistencies may occur Consider following example from file src apis question no py in Stack Scraper Can you identify if ques no is an integer or a string stackoverflow blueprint route stackoverflow lt ques no gt methods GET def get question answer ques no code to do stuffCheckout the same example now with type hints It clearly highlights that ques no is expected to be an integer and get question answer returns a Response object stackoverflow blueprint route stackoverflow lt ques no gt methods GET def get question answer ques no int gt Response code to do stuff Doc stringsDoc strings are documentation strings added for each function to improve code readability They provide additional information about the function s purpose parameters and return values making it easier for developers to understand and utilize the code effectively You can also use doc strings to generate automated documentation for your code using a library like pdoc Consider the following example from Stack Scraper and the corresponding documentation generated using pdoc library stackoverflow blueprint route stackoverflow lt ques no gt methods GET def get question answer ques no int gt Response Function to fetch data for given question number Args ques no int Question number Returns Response Returns response object code to do stuff SonarLintSonarLint is a code analysis tool that integrates with various IDEs as a free plugin and helps identify and fix code quality issues security vulnerabilities and bugs during the development process enabling developers to write cleaner and more reliable code This has been a must install plugin for me over years now PydanticPydantic is a Python library that provides runtime type checking and validation for data models We don t aim to make Python behave as C C but there are certain use cases where it s paramount to enforce type checking Examples API inputs methods in database wrapper to provide consistent in and out of data from database etc Stack Scraper demonstrates an implementation for the same By leveraging the pydantic model StackOverflowQuestionAnswer as the output of the get question answer by ques no method within the InMemoryDatabaseWrapper class we establish a reliable means of retrieving questions from the database based on their unique identifiers This design choice ensures that future changes to the database including modifications to its schema will not disrupt the application s functionality as long as the method s output adheres to the consistent model defined by pydantic Another demonstration is validating the inputs to the method upsert question answer in the same class as above to ensure that only allowed values go into the database Spell CheckerWhile it may initially appear counterintuitive incorporating a spell checker into your code is a valuable practice that aligns with the other advice provided The inclusion of a spell checker ensures code quality and readability reinforcing the importance of attention to detail in maintaining clean and error free code Firstly it will help to avoid naming methods like upsert qusetion answer due to its unintuitive spelling as it can lead to errors and confusion during usage Notice the spelling mistake in qusetion Secondly if you utilize an automatic documentation generator it becomes essential to minimize spelling mistakes Maintaining accurate and error free documentation not only improves code understand ability but also enhances the overall professionalism and credibility of the project TestsComprehensive testing is crucial for maintaining error free and robust code ensuring its adaptability to future changes and different developers While aiming for coverage is desirable the focus should be on thoroughly testing the code rather than just the coverage number When writing test cases it is important to consider all possible scenarios and edge cases that the code might encounter This includes positive and negative testing boundary testing and error handling An example test case for the get question answer function in the test src apis test question no py file can provide insights into designing effective test cases That s all for this article on maintaining clean code practices and enhancing code quality I hope you found the insights and strategies shared here valuable Remember implementing these best practices and incorporating them into your development habits one step at a time can make a significant difference in your code s reliability and maintainability By prioritizing code cleanliness and adhering to these practices you ll witness your code soar to new heights Enjoy the journey of writing impeccable code and reap the rewards of robust error free software development Happy coding Additional TipsHere I am listing a few more generic tips comments that you can incorporate into your coding habits Add comments wherever warranted in your code If you make an assumption in the code it s better to highlight the same in comments Example Line in file src external sources scrappers stack overflow py  Try not to define constants inside functions classes because overtime you could end up having bunch of these constants scattered across the code Either define them in their respective constants file or in the respective module Example src constants api constants py  Define your own Exceptions rather than using the generic one This helps in differentiating exceptions in code to respective segregation Example StackOverflowException in file src external sources scrappers stack overflow py represents exception raised by the Stack Overflow Scrapper Follow OOPs for coding Example Inheritance by defining base class ExternalSource in file src external sources external source base py  Follow REST principles for API development Do not add secrets into your repository Instead use an environment file or a Secrets Management Service like AWS Secrets Manager Make your code environment agnostic So that it s easy to maintain separate development testing staging and or production environments Example src config py  Peg versions of the libraries that you install in requirements txt file It helps in avoiding application failure because of breaking upgrades to libraries 2023-07-27 19:53:03
海外TECH DEV Community Using Protobuf with TypeScript for data serialization https://dev.to/logrocket/using-protobuf-with-typescript-for-data-serialization-mf3 Using Protobuf with TypeScript for data serializationWritten by Ibiyemi Adewakun️A key part of a distributed system s architecture is how data is transmitted between its different parts Data transmission can be done using various methods including HTTP requests WebSockets event emitters and other protocols In this article we will explore a crucial aspect of how data is transferred within distributed systems ーthe serialization of data We will focus on a specific protocol for serialization called Protobuf and also focus on serializing TypeScript objects using Protobuf messages Jump ahead What is data serialization Common use cases of data serialization What is Protobuf Serializing data using Protobuf and TypeScript Creating our TypeScript project Defining our TypeScript data structure Defining Protobuf messages for our data Compiling the TypeScript objects from our Protobuf definitions Improving the TypeScript object structure in our Protobuf messages Improving our TypeScript generation build Building and serializing a Protobuf message from TypeScript objectsThe full code for our demo project can be found in this GitHub repo You can check it out as we get started to help you follow along with this tutorial What is data serialization Data serialization is a process that involves transforming a data object into a stream of bytes facilitating easier storage and transmission Data deserialization is the opposite operation It involves reconstructing the data object from the stream of bytes into a native structure This allows the application receiving or retrieving the data object to understand it for read and write operations There are several serialization data formats for storing serialized data including XML JSON YAML and Protobufs ーour main focus in this article Common use cases of data serialization Data serialization plays an essential role in storing and transferring data within distributed systems Some common use cases include Making requests to and receiving responses from REST APIs Storing in memory data on disks or in databases Transporting data through messaging protocols like AMQP Putting items in a queue Sending event messages to a topic in a system like KafkaNow that we understand data serialization and some of its common use cases let s introduce Protobuf What is Protobuf Protobuf is short for Protocol Buffers a language and platform neutral mechanism developed by Google for serializing structured data It allows for a structured way to define data schemas making it easy to build and update your serialized data Unlike JSON and XML Protobufs are not intended to be easily read by humans as they use a binary format for data serialization However Protobuf encoding is smaller faster and simpler than JSON and XML Some pros of Protobufs include Faster and smaller than most serialization encodings like JSON or XML Handle breaking changes better than any other serialization mechanism by enforcing deprecation rather than completely removing a field Language and platform neutral making them a good mechanism for transferring data between systems with different language implementations Support a wider range of data types than JSON such as enumsSome cons of Protobufs include Lack human readability Have limited support for complex data types such as maps and nested objects Place restrictions on changing structured data making collaboration between multiple authors or teams somewhat challengingNow let s take a look at using Protobufs and TypeScript for data serialization Serializing data using Protobuf and TypeScript In this section we will explore how to serialize and deserialize structured data in TypeScript using Protobufs TypeScript is a great option for Protobuf serialization because it s strongly typed This strict typing is a good match for Protobuf s message structures and allows us to work with clearly defined data models and easier to maintain code that is less prone to runtime errors To follow along with this tutorial you ll need to install Node js v or newer A JavaScript package manager ーI ll use Yarn An IDE or text editor of your choiceLet s jump right in Creating our TypeScript project To understand how Protobuf serializes and deserializes to TypeScript we will create a TypeScript project and model the data for serialization based on a phone book with contacts First let s create our project directory by typing the following into our terminal mkdir phonebook cd phonebookInside the new phonebook project directory we will run npm init to initialize the Node js project with a package json file npm initFollow the prompts to fill in the metadata Next we will add TypeScript to our project using our package installer ーin this case Yarn yarn add D typescript ts node types nodeNote that we ve added a flag D to our installation command This flag tells Yarn to add these libraries as dev dependencies meaning these libraries are only needed when the project is in development Now let s configure TypeScript and create our ts config configuration file by running the following command npx tsc initOur project should be all set up now Let s move on to defining our data in TypeScript Defining our TypeScript data structure For Protobuf to correctly serialize and deserialize our data objects we must define the message shapes in a proto format for Protobuf to use For us to correctly build our proto files we will create a sample data object In this object we can decide what attributes to include and how they are defined This will guide what attributes and possible values we would like to support in our Protobuf messages To start we ll create a src directory where all our code will reside mkdir srcAs discussed earlier we want to our app to be able to serialize data for a phone book containing multiple contacts Let s say each contact has some required basic information such as first name and last name as well as some optional information like email and phone number We can also decide to support some optional more complex attributes describing the contact s relationship to the phone book owner With these attributes in mind we ll create a file to hold our data object src phoneBook tsexport const myPhoneBook contacts firstName Jane lastName Doe email jane d mymail com phoneNumber address addressLine Cherry Blossom Rd city Plateau state Philadelphia country US postCode socialPlatForms platform WHATSAPP profile profileUrl emergencyContact relationship FRIEND isBlocked false isFavorite true createdAt updatedAt firstName Hannah lastName Buree email hburee nomail com phoneNumber socialPlatForms platform INSTAGRAM profile h buree isBlocked false isFavorite false createdAt updatedAt Now that we have a real world object to reference we can move on to defining the Protobuf messages Defining Protobuf messages for our data In this section we will define the proto files containing the message structures for our data serialization and deserialization These files define a data structure that is language independent and statically typed To start let s create a directory to contain our Protobuf messages in our src directory mkdir proto Next we ll create our Protobuf message definitions src proto phonebook v phonebook protosyntax proto package phonebook v import google protobuf timestamp proto message PhoneBook repeated Contact contact message Contact string first name string last name optional string email optional string phone number repeated SocialPlatform social platforms optional EmergencyContactDetails emergency contact optional Address address bool is blocked bool is favorite google protobuf Timestamp created at google protobuf Timestamp updated at optional google protobuf Timestamp deleted at message SocialPlatform SocialPlatformOptions platform string profile optional string profile url message EmergencyContactDetails Relationships relationship optional string custom label message Address string address line optional string address line optional string postal code optional string city optional string state optional string country enum Relationships BROTHER MOTHER SISTER FATHER FRIEND COUSIN enum SocialPlatformOptions WHATSAPP FACEBOOK INSTAGRAM In our above Protobuf message definition we ve created a representation of the phone book data we want to handle Let s highlight a few important keywords and definitions in our Protobuf messages optional ーUsed to specify that the message attribute is not required and can be used to serialize null or undefined attributes in our TypeScript object repeated ーUsed to define that an attribute contains a list or an array such as Lists of primitive data types like strings More complex embedded messages such as our Phonebook message that has repeated contacts indicating a list of contacts google protobuf Timestamp ーA message type provided by Protobuf for serializing date and time data enum ーDefines a set of predefined constants that can be selected for an attributeSo far we have defined our Protobuf messages and reviewed the keywords we re using to define those messages Next let s put these messages to work serializing and deserializing our data Compiling the TypeScript objects from our Protobuf definitions In this section we will turn our Protobuf messages into TypeScript interfaces we can use in our code First we need to install protoc the gRPC Protobuf compiler This process depends on what OS you re using You can find all the available options listed in the gRPC protoc installation docs In this article I ll focus on the Mac OS installation process using Homebrew brew install protobuf protoc version Ensure compiler version is At the time this article was written Protobuf v x ーthe latest version available via Homebrew ーhad an issue when trying to generate JavaScript objects As a workaround I installed the slightly older v by running the following commands brew install protobuf brew link overwrite protobuf Protobuf does not support TypeScript out of the box though it does support JavaScript For TypeScript support we ll need to install a plugin There are various plugins available that support TypeScript generation from Protobuf messages In this article we ll be using the ts protoc gen npm package which generates TypeScript declaration files to provide typings for the corresponding JavaScript objects To install this package we ll run the following command yarn add ts protoc genThen to compile our proto message into TypeScript code we need to run the Protobuf compiler with the path to our Protobuf definitions We ll also need to specify some options as follows plugin ーPath to the TypeScript Protobuf compiler plugin ts opt ーTypeScript configuration options js out ーPath to the directory to write the generated JavaScript code ts out ーPath to the directory to write the generated TypeScript code TypeScript declarations After filling all of these in our command should look like so protoc plugin protoc gen ts node modules bin protoc gen ts ts opt esModuleInterop true js out src generated ts out src generated src proto phonebook v phonebook protoWhen we run the above command we will get a TypeScript declaration file containing our messages as objects along with class functions for retrieving attributes and deserializing objects from a stream of bytes We also get a JavaScript file but this TypeScript declaration file gives us the type restrictions we love about TypeScript Here is a sample of our generated TypeScript Contact class and object src generated src proto phonebook v phonebook pb d tsimport as jspb from google protobuf import as google protobuf timestamp pb from google protobuf google protobuf timestamp pb export class PhoneBook extends jspb Message clearContactList void getContactList Array lt Contact gt setContactList value Array lt Contact gt void addContact value Contact index number Contact serializeBinary UintArray toObject includeInstance boolean PhoneBook AsObject static toObject includeInstance boolean msg PhoneBook PhoneBook AsObject static extensions key number jspb ExtensionFieldInfo lt jspb Message gt static extensionsBinary key number jspb ExtensionFieldBinaryInfo lt jspb Message gt static serializeBinaryToWriter message PhoneBook writer jspb BinaryWriter void static deserializeBinary bytes UintArray PhoneBook static deserializeBinaryFromReader message PhoneBook reader jspb BinaryReader PhoneBook export namespace PhoneBook export type AsObject contactList Array lt Contact AsObject gt export class Contact extends jspb Message getFirstName string setFirstName value string void getLastName string setLastName value string void hasEmail boolean clearEmail void getEmail string setEmail value string void export namespace Contact export type AsObject firstName string lastName string email string phoneNumber string socialPlatformsList Array lt Contact SocialPlatform AsObject gt emergencyContact Contact EmergencyContactDetails AsObject address Contact Address AsObject isBlocked boolean isFavorite boolean createdAt google protobuf timestamp pb Timestamp AsObject updatedAt google protobuf timestamp pb Timestamp AsObject deletedAt google protobuf timestamp pb Timestamp AsObject export class SocialPlatform extends jspb Message getPlatform Contact SocialPlatformOptionsMap keyof Contact SocialPlatformOptionsMap setPlatform value Contact SocialPlatformOptionsMap keyof Contact SocialPlatformOptionsMap void getProfile string setProfile value string void As we can see from our generated file above our objects and classes are nested within each other This isn t an ideal structure for our objects because it makes them difficult to reuse throughout our project Let s see how to improve this in the next section Improving the TypeScript object structure in our Protobuf messages We can improve our Protobuf messages by building the messages into separate files This way we generate classes in individual files that can be referenced by import Here s how we can split our Protobuf messages into multiple proto files src proto phonebook v phonebook protosyntax proto package phonebook v import google protobuf timestamp proto import phonebook v contact proto message PhoneBook repeated Contact contact src proto phonebook v contact protosyntax proto package phonebook v import google protobuf timestamp proto import phonebook v socialplatform proto import phonebook v emergencycontactdetails proto import phonebook v address proto message Contact string first name string last name optional string email optional string phone number repeated SocialPlatform social platforms optional EmergencyContactDetails emergency contact optional Address address bool is blocked bool is favorite google protobuf Timestamp created at google protobuf Timestamp updated at optional google protobuf Timestamp deleted at src proto phonebook v socialplatform protosyntax proto package phonebook v message SocialPlatform SocialPlatformOptions platform string profile optional string profile url enum SocialPlatformOptions WHATSAPP FACEBOOK INSTAGRAM src proto phonebook v emergencycontactdetails protosyntax proto package phonebook v message EmergencyContactDetails Relationships relationship optional string custom label enum Relationships BROTHER MOTHER SISTER FATHER FRIEND COUSIN src proto phonebook v address protosyntax proto package phonebook v message Address string address line optional string address line optional string postal code optional string city optional string state optional string country Now to build our TypeScript files we pass all the proto files into our protoc command along with an additional argument proto path protoc plugin protoc gen ts node modules bin protoc gen ts ts opt esModuleInterop true js out src generated ts out src generated proto path src proto src proto phonebook v phonebook proto src proto phonebook v contact proto src proto phonebook v socialplatform proto src proto phonebook v emergencycontactdetails proto src proto phonebook v address protoThe proto path argument specifies the directory where the compiler should check for imports as we are compiling multiple files that reference each other Improving our TypeScript generation build As explained earlier the protoc command takes our defined Protobuf schema and compiles them into TypeScript object interfaces and provides builder classes and functions for the objects to be created To run this command we have to provide a few arguments We also want to make sure that our plugin does not have issues creating the necessary files whenever we run the command We can ensure this by cleaning out our output directory To simplify running the protoc command with the needed arguments as well as the cleanup tasks necessary to assure a smooth build we can move them into a Bash script We can then run this Bash script as an npm script scripts protoc generate sh usr bin env bash Root directory of appROOT DIR git rev parse show toplevel Path to Protoc PluginPROTOC GEN TS PATH ROOT DIR node modules bin protoc gen ts Directory holding all proto filesSRC DIR ROOT DIR src proto Directory to write generated code d ts files OUT DIR ROOT DIR src generated Clean all existing generated filesrm r OUT DIR mkdir OUT DIR Generate all messagesprotoc plugin protoc gen ts PROTOC GEN TS PATH ts opt esModuleInterop true js out import style commonjs binary OUT DIR ts out OUT DIR proto path SRC DIR find SRC DIR iname proto Now we can add a script to our package json to run the protoc command and other cleanup tasks package json name myaddressbook version description Data serialization with Protobuf and TypeScript scripts build proto scripts protoc generate sh Building and serializing a Protobuf message from TypeScript objects Our ts protoc gen plugin provides these setter and getter functions set functions to add an attribute get functions to retrieve an attribute clear functions to clear the value of a specific attribute add functions to add entries to list objects ーi e arrays of objectsUsing our generated TypeScript Message classes and their setter methods we can create and set our Phonebook message serialize it into bytes and deserialize it back into an object that we then log src index tsimport myPhoneBook from phoneBook import PhoneBook from generated phonebook v phonebook pb import Contact from generated phonebook v contact pb import SocialPlatform from generated phonebook v socialplatform pb import EmergencyContactDetails from generated phonebook v emergencycontactdetails pb const phoneBookContactOne myPhoneBook contactsconst socialPlatForm new SocialPlatform socialPlatForm setPlatform SocialPlatform SocialPlatformOptions WHATSAPP socialPlatForm setProfile phoneBookContactOne socialPlatForms profile if phoneBookContactOne socialPlatForms profileUrl socialPlatForm setProfileUrl phoneBookContactOne socialPlatForms profileUrl const emergencyContact new EmergencyContactDetails emergencyContact setRelationship EmergencyContactDetails Relationships FRIEND const contactOne new Contact contactOne setFirstName phoneBookContactOne firstName contactOne setLastName phoneBookContactOne lastName contactOne setEmail phoneBookContactOne email contactOne setPhoneNumber phoneBookContactOne phoneNumber contactOne setIsBlocked phoneBookContactOne isBlocked contactOne setIsFavorite phoneBookContactOne isFavorite contactOne addSocialPlatforms socialPlatForm contactOne setEmergencyContact emergencyContact const phoneBook new PhoneBook phoneBook addContact contactOne const serializedPhoneBook phoneBook serializeBinary const deserializedPhoneBook PhoneBook deserializeBinary serializedPhoneBook console log n Serialized Bytes of object serializedPhoneBook console log n Deserialized object JSON stringify deserializedPhoneBook toObject Note that you can add the following script to your package json file to run our serialization and deserialization process dev npx ts node src index ts Here s our result The deserialized object matches our phone book contact object defined earlier in this article src phoneBook ts firstName Jane lastName Doe email jane d mymail com phoneNumber socialPlatForms platform WHATSAPP profile profileUrl emergencyContact relationship FRIEND isBlocked false isFavorite true createdAt updatedAt With that we re all done We can now serialize and deserialize data with Protobuf and TypeScript ConclusionIn this article we explored the powerful Protobuf data serialization protocol Protobuf is language independent and can be used to build objects in several supported languages We used Protobuf with TypeScript to serialize and deserialize data using the example of phone book contact information While Protobuf supports building into JavaScript objects out of the box for typing via TypeScript we had to use ts protoc gen ーone of several Protobuf plugins You can view the full code for this implementation of serializing and deserializing TypeScript objects using Protobuf in this GitHub repo Let me know in the comments if you have any questions LogRocket Full visibility into your web and mobile appsLogRocket is a frontend application monitoring solution that lets you replay problems as if they happened in your own browser Instead of guessing why errors happen or asking users for screenshots and log dumps LogRocket lets you replay the session to quickly understand what went wrong It works perfectly with any app regardless of framework and has plugins to log additional context from Redux Vuex and ngrx store In addition to logging Redux actions and state LogRocket records console logs JavaScript errors stacktraces network requests responses with headers bodies browser metadata and custom logs It also instruments the DOM to record the HTML and CSS on the page recreating pixel perfect videos of even the most complex single page and mobile apps Try it for free 2023-07-27 19:08:52
Apple AppleInsider - Frontpage News Developers need to measure their heads before they can receive an Apple Vision Pro dev kit https://appleinsider.com/articles/23/07/27/developers-need-to-measure-their-heads-before-they-can-receive-an-apple-vision-pro-dev-kit?utm_medium=rss Developers need to measure their heads before they can receive an Apple Vision Pro dev kitAs Apple marches towards a public launch of its first AR VR headset Apple Vision Pro developers are filling out necessary documentation to secure themselves test kits which includes head measurements Apple Vision ProApple Vision Pro is expected to launch sometime in the early stages of and Apple is taking the months ahead of that release window to test out its first AR VR headset beyond the company headquarters walls This is where developers come in who will need to build the apps that will either make or break the upcoming headset experience for most people Read more 2023-07-27 19:56:15
海外TECH Engadget Google rolls out anti-stalking measures for AirTag and other Bluetooth trackers https://www.engadget.com/google-rolls-out-anti-stalking-measures-for-airtag-and-other-bluetooth-trackers-194936293.html?src=rss Google rolls out anti stalking measures for AirTag and other Bluetooth trackersGoogle s anti stalking measures are rolling out The company s unknown tracker alerts and other safety measures announced at Google I O in May should start appearing on Android devices beginning today The initiative aims to reduce the unfortunate rise in digital stalking that materialized soon after Apple s AirTag launch in Android s unknown tracker alerts tell you if an unknown Bluetooth tracker is traveling with you but not its owner If your Android phone notifies you about a discovered tracking accessory you can tap on the alert to learn more about it including a map of where it traveled with you and in some cases a serial number and info about the device s owner You can also tap a “Play sound option to make the accessory chirp to help you locate it If it turns out to be something suspicious it will provide instructions on deactivating it so its owner will no longer receive updates In the case of AirTag that means twisting its top off and removing its battery The Android rollout also allows you to manually scan for nearby trackers rather than waiting for an alert Once your phone receives the update navigate to Settings gt Safety amp Emergency gt Unknown Tracker Alerts and select the “Scan now button Google says the manual search only takes about ten seconds and if it finds one you ll see the same options as if you received an automatic alert The new feature is the fruit of Google and Apple partnering to address concerns about unwanted tracker stalking In addition Google announced today that its Find My Device network equivalent to Apple s Find My also announced at Google I O is delayed Google decided to wait for Apple to implement its full unknown tracking protections into iOS before rolling out the new feature Note that Google s anti stalking measures may reduce the effectiveness of following tracked stolen items on a map nbsp since enterprising thieves can soon quickly discover hidden trackers no matter which phone they use However it s understandable that reducing stalking would override that concern in Google and Apple s security balancing act This article originally appeared on Engadget at 2023-07-27 19:49:36
Cisco Cisco Blog Celebrating Early in Career Talent on National Intern Day – Securing a Great Career https://feedpress.me/link/23532/16263540/celebrating-early-in-career-talent-on-national-intern-day-securing-a-great-career Celebrating Early in Career Talent on National Intern Day Securing a Great CareerTo celebrate National Intern Day we talked to some people who went through Cisco s internship program and are on the path to very bright futures Here s Gia s story 2023-07-27 19:37:21
海外TECH CodeProject Latest Articles io_uring Based Implementation of b3sum https://www.codeproject.com/Articles/5365605/io-uring-Based-Implementation-of-b3sum bsuman 2023-07-27 19:52:00
ニュース BBC News - Home Trump lawyers meet federal prosecutors in election probe https://www.bbc.co.uk/news/world-us-canada-66329430?at_medium=RSS&at_campaign=KARANGA election 2023-07-27 19:16:31
ニュース BBC News - Home Moises Caicedo: Brighton reject Chelsea's £80m bid for midfielder https://www.bbc.co.uk/sport/football/66330292?at_medium=RSS&at_campaign=KARANGA chelsea 2023-07-27 19:11:01
ビジネス ダイヤモンド・オンライン - 新着記事 鳥貴族が19カ月連続増収、四国と東北に初出店!餃子の王将、いきステと月次動向を比べると... - 【月次版】業界天気図 https://diamond.jp/articles/-/326557 鳥貴族がカ月連続増収、四国と東北に初出店餃子の王将、いきステと月次動向を比べると【月次版】業界天気図新型コロナウイルスの感染症法上の位置付けが類に移行したことで、コロナ禍によって大打撃を受けた業界・企業の業績の完全復活に対する期待が高まってきた。 2023-07-28 05:00:00
ビジネス ダイヤモンド・オンライン - 新着記事 PayPayは大改悪で「触る価値なし」、断言できてしまう理由を徹底解説 - 「得する“ポイ活”」最新版!99%の人が知らない裏事情 https://diamond.jp/articles/-/325501 paypay 2023-07-28 04:55:00
ビジネス ダイヤモンド・オンライン - 新着記事 警察の「やりすぎ職務質問」6時間半ぶっ続け、勝手にガサゴソ…「違法」認定も - 弁護士ドットコム発 https://diamond.jp/articles/-/326748 警察の「やりすぎ職務質問」時間半ぶっ続け、勝手にガサゴソ…「違法」認定も弁護士ドットコム発「職務質問」は警察官にとって最大の武器といわれる。 2023-07-28 04:50:00
ビジネス ダイヤモンド・オンライン - 新着記事 地銀のコンプラ重視経営は「従業員エンゲージメント」に関係なし!?重要なのは「長期の人材育成」 - 橋本卓典の銀行革命 https://diamond.jp/articles/-/326608 人事評価 2023-07-28 04:45:00
ビジネス ダイヤモンド・オンライン - 新着記事 日本の貿易収支「円安・資源高」の影響抜いても悪化傾向、大幅な円高は期待薄 - 政策・マーケットラボ https://diamond.jp/articles/-/326777 貿易収支 2023-07-28 04:35:00
ビジネス ダイヤモンド・オンライン - 新着記事 「他人を見下している人」に共通する“ざんねんな特徴”とは? - 「静かな人」の戦略書 https://diamond.jp/articles/-/326016 静か 2023-07-28 04:30:00
ビジネス ダイヤモンド・オンライン - 新着記事 「有休をきちんと取る人」「あまり取らない人」。心臓病のリスクに表れる恐ろしい違い - 健康になる技術 大全 https://diamond.jp/articles/-/326294 違い 2023-07-28 04:27:00
ビジネス ダイヤモンド・オンライン - 新着記事 優秀なライバルに勝つためのシンプルな戦略とは? エッセンシャル思考で人的資本の活用法を考える - シンプルで合理的な人生設計 https://diamond.jp/articles/-/326722 優秀なライバルに勝つためのシンプルな戦略とはエッセンシャル思考で人的資本の活用法を考えるシンプルで合理的な人生設計「幸福」をつの資本をもとに定義した前著『幸福の「資本」論』からパワーアップ。 2023-07-28 04:24:00
ビジネス ダイヤモンド・オンライン - 新着記事 【新NISAを100%活かす投資術 第1回】新NISAでは超成長株を買おう! - 株の投資大全 https://diamond.jp/articles/-/326725 2023-07-28 04:21:00
ビジネス ダイヤモンド・オンライン - 新着記事 MARCHに迫る人気大学・成蹊大学の学生にリアルな就活状況は? - 大学図鑑!2024 有名大学82校のすべてがわかる! https://diamond.jp/articles/-/326776 2023-07-28 04:18:00
ビジネス ダイヤモンド・オンライン - 新着記事 職場にいる「仕事ができる上司」と「仕事ができない上司」の決定的な差とは - 1秒で答えをつくる力 お笑い芸人が学ぶ「切り返し」のプロになる48の技術 https://diamond.jp/articles/-/326756 2023-07-28 04:15:00
ビジネス ダイヤモンド・オンライン - 新着記事 【精神科医が教える】 人を見る目を高めるたった1つの判断基準 - 精神科医Tomyが教える 40代を後悔せず生きる言葉 https://diamond.jp/articles/-/326147 【精神科医が教える】人を見る目を高めるたったつの判断基準精神科医Tomyが教える代を後悔せず生きる言葉【大好評シリーズ万部突破】誰しも悩みや不安は尽きない。 2023-07-28 04:12:00
ビジネス ダイヤモンド・オンライン - 新着記事 【新築時の2.5倍?】中古マンションの価値を一気に高めた「魔法の言葉」とは? - コンセプトの教科書 https://diamond.jp/articles/-/325954 中古マンション 2023-07-28 04:06:00
ビジネス ダイヤモンド・オンライン - 新着記事 【コンサルが教える】「落ち込みやすい部下」を持つ上司が持つべき“たった1つ”のスタンス - だから、この本。 https://diamond.jp/articles/-/321321 【コンサルが教える】「落ち込みやすい部下」を持つ上司が持つべき“たったつのスタンスだから、この本。 2023-07-28 04:03:00
ビジネス 東洋経済オンライン アップル「Vision Pro」が日本の建設業界を救う日 開発者が考える「ゴーグル型デバイス」の未来 | スマホ・ガジェット | 東洋経済オンライン https://toyokeizai.net/articles/-/689787?utm_source=rss&utm_medium=http&utm_campaign=link_back apple 2023-07-28 04:50:00
ビジネス 東洋経済オンライン 「訪日客を受け入れできない」地方空港を襲う危機 「やりがい搾取」で空港スタッフ不足の超深刻 | エアライン・航空機 | 東洋経済オンライン https://toyokeizai.net/articles/-/689561?utm_source=rss&utm_medium=http&utm_campaign=link_back 外国人観光客 2023-07-28 04:40:00
ビジネス 東洋経済オンライン 優等列車・各停「同じ時間で行ける駅」距離の差は? 首都圏の私鉄・JR各線調査、大差のつく路線も | 通勤電車 | 東洋経済オンライン https://toyokeizai.net/articles/-/690004?utm_source=rss&utm_medium=http&utm_campaign=link_back 優等列車 2023-07-28 04:30:00
海外TECH reddit Shohei Ohtani has thrown his first complete game shut out. Final line vs Tigers: 9.0 IP | 1 H | 0 R | 0 ER | 3 BB | 8 K https://www.reddit.com/r/baseball/comments/15bawnd/shohei_ohtani_has_thrown_his_first_complete_game/ Shohei Ohtani has thrown his first complete game shut out Final line vs Tigers IP H R ER BB KOn pitches It s his first complete game as well as his first complete game shutout At the plate for submitted by u theaussiesamurai to r baseball link comments 2023-07-27 19:26:17
海外TECH reddit Shohei Ohtani gets Riley Greene to Fly Out to finish his First Career Complete Game and Shutout https://www.reddit.com/r/baseball/comments/15baxjt/shohei_ohtani_gets_riley_greene_to_fly_out_to/ Shohei Ohtani gets Riley Greene to Fly Out to finish his First Career Complete Game and Shutout submitted by u AlexanderWun to r baseball link comments 2023-07-27 19:27:16

コメント

このブログの人気の投稿

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

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

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