投稿時間:2023-05-10 17:35:24 RSSフィード2023-05-10 17:00 分まとめ(37件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
IT 気になる、記になる… Microsoft、「Surface Duo」向けに2023年5月のアップデートを配信開始 https://taisy0.com/2023/05/10/171637.html android 2023-05-10 07:44:56
IT 気になる、記になる… Microsoft、「Surface Duo 2」向けに2023年5月のアップデートを配信開始 https://taisy0.com/2023/05/10/171635.html androi 2023-05-10 07:44:09
IT 気になる、記になる… Microsoft、2023年5月のセキュリティ更新プログラムをリリース https://taisy0.com/2023/05/10/171633.html sharepoi 2023-05-10 07:39:35
IT ITmedia 総合記事一覧 [ITmedia News] Twitterに音声・ビデオチャット機能、まもなく導入か マスク氏ツイートで「通話機能」トレンド入り https://www.itmedia.co.jp/news/articles/2305/10/news163.html itmedianewstwitter 2023-05-10 16:48:00
IT ITmedia 総合記事一覧 [ITmedia ビジネスオンライン] 中学校の偏差値と幼少期の習いごとの数に、関連はあるの? https://www.itmedia.co.jp/business/articles/2305/10/news159.html itmedia 2023-05-10 16:43:00
IT ITmedia 総合記事一覧 [ITmedia News] スマートロック「Qrio」初代モデル、サービス終了へ ユーザーに利用停止呼び掛け https://www.itmedia.co.jp/news/articles/2305/10/news156.html itmedia 2023-05-10 16:18:00
IT ITmedia 総合記事一覧 [ITmedia PC USER] サンワ、コートの上からも肩掛けできるショルダーポーチ https://www.itmedia.co.jp/pcuser/articles/2305/10/news154.html itmediapcuser 2023-05-10 16:05:00
TECH Techable(テッカブル) ポケットサイン、宮城県とDX推進を目的とした連携協定を締結。県民サービスの向上など目指す https://techable.jp/archives/205480 領域 2023-05-10 07:00:30
IT 情報システムリーダーのためのIT情報専門サイト IT Leaders SaaS型のソフトウェアテストツール「mabl」、機能テストに加えて負荷テストが可能に | IT Leaders https://it.impress.co.jp/articles/-/24801 SaaS型のソフトウェアテストツール「mabl」、機能テストに加えて負荷テストが可能にITLeaders米メイブルmablの日本法人、mabl本社東京都中央区は年月日、SaaS型のソフトウェアテストツール「mabl」を強化し、新たに負荷テスト機能性能テスト機能を追加したと発表した。 2023-05-10 16:40:00
python Pythonタグが付けられた新着投稿 - Qiita アニメ・特撮もOK!プログラミング超初心者のバイクタイプ識別AIアプリ作成記 https://qiita.com/micaloca/items/dcc36156c4fa6f8912a8 aidemy 2023-05-10 16:56:07
python Pythonタグが付けられた新着投稿 - Qiita 【Colab】人工言語をAI翻訳するモデルを作る https://qiita.com/Isner/items/08077a50c2c9e95ac2d9 colab 2023-05-10 16:10:24
js JavaScriptタグが付けられた新着投稿 - Qiita [GoogleAppsScript] タイムズカーシェアの予約をGメールからGoogleカレンダーに自動インポートする https://qiita.com/Nick_utuiuc/items/887eaa0add14d5e0e043 googleapps 2023-05-10 16:59:21
AWS AWSタグが付けられた新着投稿 - Qiita AWS Cloud9からGitlabに接続してリポジトリをクローンするまで https://qiita.com/rm0063vpedc15/items/e4c71f1c9df1f7d972c2 awscloud 2023-05-10 16:18:29
AWS AWSタグが付けられた新着投稿 - Qiita Serverless Framework v3 ComposeのuseDotenv注意点 https://qiita.com/yamatok/items/bc063eff1b0b383c2f9b rootdir 2023-05-10 16:07:55
海外TECH DEV Community Mastering Async and Await in C#: In-Deph Guide https://dev.to/bytehide/mastering-async-and-await-in-c-in-deph-guide-1589 Mastering Async and Await in C In Deph Guide Introduction to Async and Await in C The Evolution of Asynchronous Programming in C Asynchronous programming has come a long way in C Prior to the introduction of async and await developers had to rely on callbacks events and other techniques like the BeginXXX EndXXX pattern or BackgroundWorker These methods often led to complex and difficult to maintain code With the release of C async and await keywords were introduced simplifying asynchronous programming and making it more accessible to developers The Importance of Async and Await in Modern ApplicationsAsync and await are essential for creating responsive and scalable applications Modern applications often handle multiple tasks simultaneously such as fetching data from the internet processing files or performing complex calculations By using async and await developers can offload these tasks to a separate thread allowing the main thread to remain responsive and handle user interactions Understanding the Async and Await KeywordsThe async and await keywords are fundamental to asynchronous programming in C They work together to simplify the process of writing non blocking code making it easier to read and maintain Let s take a closer look at its explanation Async KeywordThe async keyword is used to mark a method as asynchronous It indicates that the method can perform a non blocking operation and return a Task or Task lt TResult gt object Here are some features of the async keyword It can be applied to methods lambda expressions and anonymous methods It cannot be used with properties or constructors An async method should contain at least one await expression An async method can have multiple await expressions allowing for multiple non blocking operations Async methods can be chained together allowing for complex asynchronous workflows Await KeywordThe await keyword is used within an async method to temporarily suspend its execution and yield control back to the calling method until the awaited task is completed This allows other tasks to continue executing in the meantime ensuring that the application remains responsive Some features of the await keyword include It can only be used within an async method It can be applied to any expression that returns a Task or Task lt TResult gt object It unwraps the result of the Task lt TResult gt object allowing you to work with the result directly It automatically handles exceptions thrown by the awaited task allowing you to catch and handle them in the calling async method It can be used with using foreach and lock statements in C and later Pros and Cons of Async and AwaitUsing async and await in C offers several benefits including Simplified asynchronous code Async and await make writing asynchronous code much simpler and more readable resembling synchronous code while still providing the benefits of asynchronous execution Improved application responsiveness By offloading time consuming tasks to separate threads async and await can help make your application more responsive and user friendly Efficient resource utilization Asynchronous programming allows your application to make better use of system resources such as CPU memory and I O Easier exception handling The await keyword automatically handles exceptions thrown by awaited tasks simplifying exception handling in asynchronous code However there are also some potential drawbacks to consider Overhead Using async and await can introduce a small performance overhead compared to synchronous code as it involves creating and managing tasks However this overhead is usually negligible compared to the benefits of improved responsiveness and resource utilization Potential for deadlocks Incorrect use of async and await can lead to deadlocks especially when mixing synchronous and asynchronous code It is essential to follow best practices and avoid common pitfalls to prevent deadlocks Learning curve Asynchronous programming can be challenging to learn and understand especially for developers who are new to the concept It requires a solid understanding of tasks threading and other related concepts Key Differences Between Async and Await The async keyword is used to mark a method as asynchronous while the await keyword is used to temporarily suspend the execution of an async method and yield control back to the calling method until the awaited task is completed The async keyword is applied to methods lambda expressions and anonymous methods whereas the await keyword is used within an async method and can be applied to any expression returning a Task or Task lt TResult gt object The async keyword indicates that a method can perform non blocking operations whereas the await keyword enables other tasks to continue executing while the async method s execution is temporarily suspended Getting Started with Async and Await in C Writing Your First Async Method in C To create an async method you need to declare the method with the async keyword and return a Task or Task lt TResult gt object Here s a simple example of an async method Declare an async method that returns a Task lt string gt public async Task lt string gt FetchDataAsync Create a new instance of HttpClient using var httpClient new HttpClient Use the await keyword to perform a non blocking GET request string result await httpClient GetStringAsync Return the result when the request is completed return result Incorporating Await in Async MethodsThe await keyword is used to temporarily suspend the execution of an async method and yield control back to the calling method until the awaited task is completed In the example below the await keyword is used with the GetStringAsync method which returns a Task lt string gt object The execution of the FetchDataAsync method is temporarily suspended until the GetStringAsync method is completed allowing other tasks to continue executing in the meantime To demonstrate how to incorporate await in async methods let s extend the FetchDataAsync example by adding a continuation public async Task lt string gt FetchAndProcessDataAsync Call the FetchDataAsync method and await its completion string rawData await FetchDataAsync Process the raw data e g parsing JSON XML or other transformations string processedData ProcessData rawData Return the processed data return processedData private string ProcessData string rawData Implement your data processing logic here return rawData ToUpper Exploring Real World Async and Await C ExamplesAsync and await can be used in various real world scenarios such as fetching data from an API reading or writing files or performing CPU bound operations Here are some examples to demonstrate their flexibility and usefulness Reading a file asynchronouslypublic async Task lt string gt ReadFileAsync string filePath Create a new instance of StreamReader with the specified file path using var reader new StreamReader filePath Use the await keyword to read the file content asynchronously string content await reader ReadToEndAsync Return the content of the file when the read operation is completed return content Making multiple API calls concurrentlypublic async Task lt IEnumerable lt string gt gt FetchMultipleDataAsync IEnumerable lt string gt urls Create a new instance of HttpClient using var httpClient new HttpClient Initiate multiple GetStringAsync tasks concurrently var tasks urls Select url gt httpClient GetStringAsync url Await the completion of all tasks using Task WhenAll string results await Task WhenAll tasks Return the fetched data as an IEnumerable lt string gt return results Performing a CPU bound operation asynchronouslypublic async Task lt int gt CalculateResultAsync int input Offload the CPU bound operation to a separate thread using Task Run int result await Task Run gt PerformComplexCalculation input Return the result when the calculation is completed return result private int PerformComplexCalculation int input Implement your complex calculation logic here return input These examples showcase how async and await can be used in different real world situations improving application responsiveness and efficiently utilizing system resources Remember to follow best practices and handle exceptions properly to ensure robust and maintainable asynchronous code Advanced Concepts in Async and Await C The Task Class and Its Role in Asynchronous ProgrammingThe Task class represents an asynchronous operation that can be awaited using the await keyword It provides several methods to create and manipulate tasks such as Task Run Task FromResult and Task WhenAll The Task lt TResult gt class a subclass of Task represents an asynchronous operation that returns a value of type TResult Task ContinuationsTask continuations allow you to specify additional work to be executed when a task has completed You can use the ContinueWith method to attach a continuation to a task This can be useful for chaining multiple asynchronous operations or handling the result of an asynchronous operation in a specific way public async Task lt string gt FetchDataAndSaveToFileAsync string url string filePath var dataTask FetchDataAsync url Attach a continuation to save the fetched data to a file var saveDataTask dataTask ContinueWith async t gt var data t Result using var writer new StreamWriter filePath await writer WriteAsync data Await the completion of the saveDataTask await saveDataTask Keep in mind that the ContinueWith method doesn t automatically unwrap the result of the antecedent task Therefore you must access the Result property of the antecedent task to retrieve its result Task CombinatorsTasks can be combined using static methods provided by the Task class such as Task WhenAll and Task WhenAny These methods allow you to perform parallel operations wait for multiple tasks to complete or continue execution when the first task is completed Task WhenAll Awaits the completion of all tasks in a given collection and returns a single task containing the results of each completed task This is useful for performing multiple asynchronous operations concurrently and processing their results when all are completed Task WhenAny Awaits the completion of any task in a given collection and returns the first completed task This is useful when you have multiple tasks that perform similar operations and you only need the result of the first one to complete Understanding ConfigureAwait and Its Usage in C ConfigureAwait is a method provided by the Task and Task lt TResult gt classes It allows developers to configure how the context is captured and restored when the awaited task is completed By default the await keyword captures the current synchronization context and resumes the execution on the same context However in certain scenarios such as in libraries or when optimizing performance it is beneficial to avoid capturing the context This can be achieved by using ConfigureAwait false string result await httpClient GetStringAsync ConfigureAwait false Tips for Using ConfigureAwait In general use ConfigureAwait false in library code to avoid potential deadlocks and improve performance In UI applications avoid using ConfigureAwait false when you need to update UI elements after an awaited operation as this requires the original UI context to be captured Be aware of the potential for deadlocks when mixing synchronous and asynchronous code Using ConfigureAwait false can help prevent deadlocks in some scenarios but it s not a universal solution The Difference Between Synchronous and Asynchronous Programming in C Synchronous programming executes tasks sequentially blocking the execution of the calling thread until the current task is completed In contrast asynchronous programming allows tasks to be executed concurrently without blocking the calling thread Async and await enable developers to write asynchronous code that is easier to read and maintain resembling synchronous code while still providing the benefits of asynchronous execution Curious Features of Async and Await in C As a C developer you might be interested in exploring lesser known features and nuances of async and await Custom awaiters It s possible to create custom awaiters by implementing the INotifyCompletion or ICriticalNotifyCompletion interfaces and providing a GetAwaiter method for a specific type This allows you to use the await keyword with custom types enabling advanced scenarios and optimizations Async streams In C you can use the IAsyncEnumerable lt T gt interface and await foreach to work with asynchronous streams This allows you to asynchronously enumerate and process collections of items that are produced or fetched asynchronously Asynchronous disposal C also introduced the IAsyncDisposable interface which provides an async version of the Dispose method called DisposeAsync This enables you to perform asynchronous cleanup operations when disposing of resources Async and Await Best Practices Use the async keyword on methods that contain at least one await expression ensuring that the method signature clearly indicates its asynchronous nature Return Task or Task lt TResult gt instead of void in async methods as this enables better error handling and allows the caller to await the result Avoid using async void methods as they can t be awaited and can lead to unhandled exceptions Instead use async Task methods for event handlers which provide proper exception handling Use ConfigureAwait false when possible to avoid capturing the context especially in library code or when optimizing performance This reduces the risk of deadlocks and improves efficiency Use Task Run for CPU bound operations that can benefit from parallelism effectively offloading the work to a separate thread and preventing the main thread from being blocked Limit the number of concurrent tasks when using async methods in loops using techniques such as SemaphoreSlim or Task WhenAll with a limited number of tasks to avoid excessive resource usage Error Handling and Exception Handling in Async MethodsWhen using async and await it is essential to handle exceptions correctly Exceptions in async methods can be caught using a try catch block similar to synchronous code public async Task lt string gt FetchDataAsync try using var httpClient new HttpClient string result await httpClient GetStringAsync return result catch HttpRequestException ex Handle the exception return null It s important to note that when an exception is thrown in an awaited task the exception is propagated to the calling async method allowing you to catch and handle it Moreover when using Task WhenAll you can catch multiple exceptions by accessing the Task Exception property public async Task ExecuteMultipleTasksAsync var tasks new List lt Task gt FetchDataAsync FetchDataAsync FetchDataAsync try await Task WhenAll tasks catch AggregateException ex foreach var innerEx in ex InnerExceptions Handle each inner exception C Async Programming Tips and Tricks Use the ValueTask lt TResult gt struct for high performance scenarios where the result is often available synchronously This can help reduce memory allocations and improve performance public async ValueTask lt int gt CalculateResultAsync int input if input lt return int result await Task Run gt PerformComplexCalculation input return result Combine multiple tasks using Task WhenAll or Task WhenAny to perform parallel operations improving the overall efficiency of your application public async Task ProcessDataAsync Task lt string gt fetchDataTask FetchDataAsync Task lt string gt readDataTask ReadDataAsync await Task WhenAll fetchDataTask readDataTask string fetchedData fetchDataTask Result string readData readDataTask Result Process the data Use CancellationToken to cancel long running tasks gracefully enabling better resource management and preventing unnecessary work public async Task lt string gt FetchDataAsync CancellationToken cancellationToken using var httpClient new HttpClient cancellationToken ThrowIfCancellationRequested string result await httpClient GetStringAsync ConfigureAwait false return result public async Task ProcessDataAsync var cancellationTokenSource new CancellationTokenSource try string data await FetchDataAsync cancellationTokenSource Token Process the data catch OperationCanceledException Handle the cancellation cancellationTokenSource Dispose When dealing with loops and async methods limit the number of concurrent tasks to avoid excessive resource usage This can be achieved using techniques such as SemaphoreSlim public async Task ProcessMultipleFilesAsync IEnumerable lt string gt filePaths var semaphore new SemaphoreSlim Limit to concurrent tasks var tasks filePaths Select async filePath gt await semaphore WaitAsync try await ProcessFileAsync filePath finally semaphore Release await Task WhenAll tasks Implementing Async and Await in Real World Scenarios Async and Await in Web ApplicationsAsync and await can significantly improve the responsiveness and scalability of web applications by allowing the server to handle more incoming requests concurrently Using async and await in web applications typically involves the following scenarios Fetching data from a database When querying a database leverage async and await to avoid blocking the main thread Most database libraries such as Entity Framework Core support async methods for querying and saving data public async Task lt List lt Customer gt gt GetCustomersAsync using var context new MyDbContext return await context Customers ToListAsync Calling external APIs Use async and await when making HTTP requests to external APIs to keep the application responsive during network latency public async Task lt HttpResponseMessage gt GetWeatherDataAsync string city using var httpClient new HttpClient var response await httpClient GetAsync city return response Uploading and processing files When handling file uploads use async and await to read and process the uploaded files without blocking the main thread public async Task lt string gt SaveUploadedFileAsync IFormFile file var targetPath Path Combine uploads file FileName using var fileStream new FileStream targetPath FileMode Create await file CopyToAsync fileStream return targetPath Asynchronous File I O Operations in C File I O operations such as reading or writing files can benefit from async and await as they often involve waiting for the file system or network resources The System IO namespace provides several asynchronous methods for file operations Reading a file asynchronously Use StreamReader ReadToEndAsync to read a file without blocking the main thread public async Task lt string gt ReadFileAsync string filePath using var reader new StreamReader filePath string content await reader ReadToEndAsync return content Writing to a file asynchronously Use StreamWriter WriteAsync or FileStream WriteAsync to write data to a file without blocking the main thread public async Task WriteToFileAsync string filePath string content using var writer new StreamWriter filePath await writer WriteAsync content Asynchronous file copy Use Stream CopyToAsync to copy the content of one stream to another asynchronously which can be useful when working with files or network streams public async Task CopyFileAsync string sourcePath string destinationPath using var sourceStream File OpenRead sourcePath using var destinationStream File Create destinationPath await sourceStream CopyToAsync destinationStream Implementing Async and Await in APIs and MicroservicesAPIs and microservices can greatly benefit from async and await as they often involve calling other services handling multiple requests concurrently or performing time consuming operations Here are some scenarios where async and await can be helpful in APIs and microservices Asynchronous API endpoints Use async and await in your API controller methods to keep your API responsive and handle more incoming requests concurrently HttpGet id public async Task lt ActionResult lt Product gt gt GetProductAsync int id var product await productService GetProductByIdAsync id if product null return NotFound return product Calling other services or APIs When your microservices communicate with other services or APIs use async and await to perform these calls concurrently and improve performance public async Task lt User gt GetUserAsync int userId var userTask userRepository GetUserByIdAsync userId var userOrdersTask orderRepository GetOrdersByUserIdAsync userId await Task WhenAll userTask userOrdersTask var user userTask Result user Orders userOrdersTask Result return user Concurrent processing of messages When processing messages from a queue or event stream use async and await to process multiple messages concurrently improving throughput public async Task ProcessMessagesAsync IEnumerable lt Message gt messages var processingTasks messages Select message gt ProcessMessageAsync message await Task WhenAll processingTasks Performance Optimization with Async and Await in C Async and await can help improve the performance of your applications by efficiently utilizing system resources and reducing the number of blocked threads Some techniques for optimizing performance with async and await include Using ConfigureAwait false To avoid capturing the context and resuming execution on the same context use ConfigureAwait false when possible public async Task lt List lt Product gt gt GetProductsAsync using var context new MyDbContext return await context Products ToListAsync ConfigureAwait false Using Task Run for CPU bound operations Offload CPU bound operations that can benefit from parallelism to a separate thread using Task Run public async Task lt int gt CalculateResultAsync int input int result await Task Run gt PerformComplexCalculation input return result Batching and parallelism When executing multiple independent tasks use Task WhenAll to run them concurrently and await their completion public async Task ProcessTasksAsync IEnumerable lt Task gt tasks await Task WhenAll tasks Caching For time consuming operations that produce the same result when called with the same input consider caching the result to avoid performing the operation multiple times private readonly ConcurrentDictionary lt int string gt cache new ConcurrentDictionary lt int string gt public async Task lt string gt GetCachedDataAsync int key return await cache GetOrAddAsync key async k gt await FetchDataAsync k Exploring Other Aspects of Asynchronous Programming in C Understanding Task Run and Its Usage PatternsTask Run is a method provided by the Task class that allows you to offload a synchronous or asynchronous operation to a separate thread returning a Task or Task lt TResult gt object that represents the operation This can be useful when performing CPU bound operations that can benefit from parallelism or when running long running tasks that shouldn t block the main thread Here are some common usage patterns of Task Run Offloading CPU bound operations Use Task Run to parallelize compute bound operations such as processing large datasets or performing complex calculations public async Task lt List lt int gt gt ProcessDataAsync List lt int gt data var results await Task Run gt data Select x gt PerformComplexCalculation x ToList return results Running long running tasks When you need to run a long running task that shouldn t block the main thread use Task Run to offload it to the thread pool public async Task MonitorSystemAsync CancellationToken cancellationToken await Task Run gt while cancellationToken IsCancellationRequested PerformSystemMonitoring Thread Sleep TimeSpan FromSeconds cancellationToken Combining synchronous and asynchronous code If you need to call a synchronous method within an async method you can use Task Run to offload the synchronous operation to a separate thread public async Task lt string gt ReadFileSyncWrapperAsync string filePath Offload the synchronous ReadFileSync method to a separate thread string content await Task Run gt ReadFileSync filePath return content The Relationship Between Task Async and Await in C The Task class represents an asynchronous operation that can be awaited using the await keyword The async keyword is used to mark a method as asynchronous indicating that it can perform a non blocking operation and return a Task or Task lt TResult gt object The await keyword is then used within an async method to temporarily suspend its execution and yield control back to the calling method until the awaited task is completed Here s an example illustrating the relationship between Task async and await The Task class represents the asynchronous operationpublic Task lt int gt PerformAsyncOperation return Task Run gt PerformComplexCalculation The async keyword marks the method as asynchronouspublic async Task lt int gt ProcessDataAsync The await keyword is used to temporarily suspend the execution until the awaited task is completed int result await PerformAsyncOperation return result C Asynchronous Programming Advanced Topics and ResourcesAs you dive deeper into asynchronous programming in C you may come across advanced topics such as Parallel and PLINQ for data parallelism These libraries provide support for data parallelism allowing you to efficiently process large datasets by dividing the work across multiple cores or processors SemaphoreSlim and Mutex for synchronization and concurrency control These synchronization primitives help you coordinate and control access to shared resources in concurrent scenarios Channel lt T gt and BlockingCollection lt T gt for producer consumer scenarios These collections enable you to implement producer consumer patterns where one or more threads produce data while other threads consume it Custom TaskScheduler and SynchronizationContext implementations For advanced scenarios you might need to create custom task schedulers or synchronization contexts to control how tasks are scheduled and executed Some additional resources for learning about these advanced topics include Microsoft Docs Data Parallelism Task Parallel Library Microsoft Docs SemaphoreSlim Class Microsoft Docs Channel Class Essentialcsharp Blog TaskSchedulers and SynchronizationContext ConclusionTo resume the topic Async and await simplify asynchronous programming in C making it more accessible and maintainable Async and await enable developers to create responsive and scalable applications that efficiently utilize system resources Properly handling exceptions and following best practices are crucial for successful async programming Async and await can be used in various scenarios such as web applications file I O operations APIs and microservices Advanced concepts such as ConfigureAwait Task Run and CancellationToken can further enhance the performance and flexibility of async programming 2023-05-10 07:51:31
海外TECH DEV Community Secure Coding 101: How to Use Random Function https://dev.to/smartscanner/secure-coding-101-how-to-use-random-function-50hp Secure Coding How to Use Random FunctionRandom numbers are everywhere on the web and your security depends on them Let s see if you re using them right Random numbers play a critical role in web application security They are used in session identifiers passwords cryptographic keys and more However if not implemented securely they can lead to vulnerabilities that attackers can exploit to gain unauthorized access to sensitive information TLDRMost random generators are not really random They use math that looks randomDo not use Math random in JavaScript or random in PythonUse Web Crypto API in JavaScript crypto module in NodeJs and secrets in pythonDo not try to implement your own random generation algorithmIncorrect usage of secure random numbers can make your application vulnerable How Random Functions workThere are two main types of Random Number Generators RNGs pseudo random number generators PRNGs and true random number generators TRNGs Pseudo random Number Generators PRNGs PRNGs are the most commonly used type of RNGs They work by using an algorithm to generate a sequence of numbers that appear to be random The algorithm takes an initial value as input and produces a series of numbers based on it The common algorithms used in PRNGs are the Mersenne Twister and linear congruential generator LCG These algorithms get an initial number called seed They change it by adding previous random number shifting and doing XOR operators to generate the output The output looks like a random number though it s just an output of a formula If you keep executing any PRNG it will eventually generate the same numbers over and over Any PRNG has a fixed length of numbers that can generate before starting over True Random Number Generators TRNGs TRNGs generate truly random numbers based on physical processes that are inherently random These processes include atmospheric noise radioactive decay and thermal noise TRNGs measure the physical process and convert it into a random number Random Function VulnerabilitiesThe seed and random number generation algorithm both can have weaknesses PredictionYou can say predictability is the main vulnerability of weak random number generators PRNGs are inherently predictable as they are based on a mathematical formula So if you know the seed and last random number you can predict the next random number This can lead to severe vulnerabilities For example consider a forget password functionality that words based on a random token If the token can be predicted an attacker can reset the password of any user CollisionBesides the predictability Some random generators that have low quality produce duplicate values very often This can increase the risk of collision Consider an application that generates random session tokens for its users The chances of producing duplicate session tokens are related to two factors Size of random space length of session token Quality of the random selectionShort length tokens will have a higher chance of collisions And bad random generator does not generate all possible values This can lead to vulnerabilities where a user can see another user s data Seed Leakage or ManipulationAnother vulnerability related to random number generators is choosing a weak seed PRNG always generates the same sequence of numbers with the same initial seed value If an attacker can find the used seed or manipulate it he can easily generate same random numbers In pratice hackers use different methods to predict the next random number Some methods may involve statistical analysis while others may involve reverse engineering the generator s algorithm How to Use Secure Random NumbersUsing cryptographically secure random number generation algorithms is the key to securely producing random numbers These algorithms generate random numbers that are unpredictable and cannot be easily guessed by attackers The output of these algorithms is resistant to brute force attacks and it s statistically robust You should not try to implement your own one unless you know what you are doing Instead always use known to be secure random libraries Let s see a few examples of using secure random libraries in different programming languages JavascriptThe Math random function is not suitable for cryptographic purposes as it is not truly random and can be predicted or manipulated by an attacker To generate a secure random number in JavaScript you can use the Web Crypto API The Crypto getRandomValues method lets you get cryptographically strong random values Here is an example code that generates a secure random number function generateRandomNumber    const array new UintArray Create a bit unsigned integer array    window crypto getRandomValues array Fill the array with random values    return array Return the first element of the array as the random number     console log generateRandomNumber Output a random number between and NodeJSIn NodeJS the crypto module can be used to generate cryptographically secure random numbers The following code sample illustrates the use of crypto module in generating a random number const crypto require crypto   function generateRandomNumber    const randomBytes crypto randomBytes Generate random bytes    const hexValue randomBytes toString hex Convert the bytes to a hex string    const intValue parseInt hexValue Convert the hex string to an integer    return intValue     console log generateRandomNumber Output a random number between and PythonIn Python the random module can be used to generate random numbers However it is not cryptographically secure Instead you can use the secrets module to generate cryptographically secure random numbers The following code sample illustrates the use of secrets module in generating a random number import secrets   def generate random number      random number secrets randbits Generate a bit random number      return random number   print generate random number Output a random number between and ConclusionRandom numbers in computers are mathematical formulas and predictable Not every random number generator is suitable for cryptography and security usage Random numbers are just one element in security system design and implementation There are many other things like seed generation key management and overall security system design that are extremely important and hard to get right The Crypto is a great place to start learning more about cryptography Read more on SmartScanner Security Blog 2023-05-10 07:50:30
海外TECH DEV Community 10 reasons why you have to exceed at documenting https://dev.to/postman/10-reasons-why-you-have-to-exceed-at-documenting-4b7m reasons why you have to exceed at documentingI m leading Postman s Open Technologies Program Office ーour open source program office OSPO My team consists mainly of open source contributors and our parent org Postman Open Technologies is an incubator for API tech and a strategy think tank There s a bunch of high profile industry experts that I work with and for and I m constantly switching between impostor syndrome and delusions of grandeur to change the world At a recent Postman Open Technologies team meeting I gave a very general direction in saying that we have to be the team that is known for documentation and that we need to document everything individually as well as in a team effort While there was more context like our collaboration with the product teams it is also a general recommendation that I give to myself as well as others in our industry ーespecially in these fields of work engineering OSPOs and developer relations But first let s define the term “documentation In the context of this blog post documentation includes external as well as internal technical documentation blogging sharing knowledge on social networks demos how to articles instructions conference sessions webinars podcasts wikis infographics flow charts and the like I understand how easy it is to get lost in responsibilities in today s fast paced world But while you won t be immediately rewarded for writing documentation like you are for writing code setting up a process or resolving an issue creating good documentation is about showing compassion to those around you as well as your future self Its impact is mid and long term but needs prioritization now My top reasons why being great at documentation is key to successYou should be known as the person who exceeds at documenting because Documenting makes you a better coworker and collaborator Creating good documentation reduces frustration lowers the level of collaboration anxiety and makes previous decisions more understandable Documenting increases your value It increases your value as a professional and makes you less expendable Letting go of a person or a team that built a good part of the internal knowledge hurts Hiring someone who is known for building persisting knowledge is easier to justify Documenting helps build your personal brand Coming across the same author name over and over again when doing research makes you a subject expert Add on top a few more measures ーlike community engagement mentoring public speaking whatever you chooseーwill greatly help your brand Documenting builds internal visibility Being able to refer to something that you ve written is easier than vaguely repeating what you have said or commented on a team meeting Colleagues are more likely to give credit if it s easy to do You can slice and dice into content creation Once you ve started documenting things you can slice and dice it for content creation Producing a video writing a podcast narrative preparing a talk or inviting people with similar or differing opinions to a panel is way easier than starting from scratch It also helps you find a red thread for your storytelling which is another item on this list Documenting helps internalize your knowledge And identify caveats Repetition that s how the human brain works Writing something down is exactly this When your fingers are slower at typing than your brain is at processing information you re forcing it to repeat the same thing over and over again That helps you either internalize findings or helps you find catches and bugs in your thinking Documenting makes your knowledge persist The most obvious one but also the most ignored point on my list Have you ever come across a written piece and thought Hey that s good knowledge I m glad someone else wrote it down only to realize it was you two years ago We forget and that s even part of our learning process Storing information is not only something you do for others but also for yourself And even if you don t regularly update your content it will be useful for a certain amount of time and maybe even beyond Disclaimer This is not a good excuse for not keeping your documentation up to date Documenting saves time Were you assuming the opposite that writing documentation eats up a lot of time Have you ever felt like repeating yourself That s probably because you did When you write documentation it saves you from the tedious work of repeatedly explaining to others When you re spending the third time explaining something your time would have been better spent writing it down You could still have that discussion with your peer but you d have it on a different level Documenting helps avoid the awkwardness of having to ask It s not only you feeling bored about explaining the same old thing a third time this week It s also them feeling bad about wasting your time Coworkers might hold back from asking you because they feel your time is too precious This hinders collaboration Documenting makes you better at storytelling The bigger picture is something that you will be asked for Being able to not only provide facts and figures but also develop a narrative and make the numbers stick to someone s mind is priceless It s important to note that while I say “good documentation I don t ask for “excellent or “outstanding That s not because I think that nothing will ever be perfect it s because documentation doesn t always have to be pristine Often enough “average documentation does the job and is a legit compromise between effort and benefit Whenever you consider prioritizing documentation which includes internal as well as external content creation you definitely should always answer “Yes I will The post reasons why you have to exceed at documenting appeared first on Postman Blog 2023-05-10 07:18:32
海外TECH Engadget Uber starts offering flight bookings in the UK https://www.engadget.com/uber-starts-offering-flight-bookings-in-the-uk-074558236.html?src=rss Uber starts offering flight bookings in the UKUber has started offering domestic and international flight bookings in the UK and will continue rolling it out across the whole region over the coming weeks according to the Financial Times The company s general manager for the UK Andrew Brem told the publication that this is the latest and most ambitious step it has taken to achieve its goal to become a wider travel booking platform nbsp Uber first revealed its plans to add train bus and flight bookings to its UK app in April last year and launched the first two options a few months later Brem said train bookings have been incredibly popular so far and have grown percent every month since they became available though he didn t give the Times concrete ticket sales numbers nbsp For its flights the company has teamed up with travel booking agency Hopper The Times says Uber will take a small commission from each sale and could add a booking fee on top of its offerings in the future It s unclear how much the company s cut actually is but it charges its partner drivers percent on all fares As the Times notes offering flight bookings could also help grow Uber s main ride hailing business even further since users are likely to book rides to and from the airport through the service as well nbsp Although flight bookings are only available in the UK at the moment the region ーone of its biggest markets outside North America ーonly serves as a testing ground for Uber s plans Brem told the publication that the company is hoping to expand flight offerings to more countries in the future but it has no solid plans yet Uber did offer chopper rides in the US back in but that service was discontinued in the midst of pandemic related lockdowns nbsp This article originally appeared on Engadget at 2023-05-10 07:45:58
医療系 医療介護 CBnews DPCになじまない病院、「退出勧告検討を」-中医協・小委員会で支払側委員 https://www.cbnews.jp/news/entry/20230510161446 中央社会保険医療協議会 2023-05-10 16:40:00
金融 ニッセイ基礎研究所 大手銀行に対する気候関連リスクの試験的演習の実施(米国)-FRBによる調査が実施される件 https://www.nli-research.co.jp/topics_detail1/id=74757?site=nli 大手銀行に対する気候関連リスクの試験的演習の実施米国ーFRBによる調査が実施される件要旨米国FRBは、気候関連の金融リスクを特定、測定、監視、管理する能力を強化すべく、大手銀行が参加する試験的気候シナリオ分析演習を企画し、定性的・定量的両方の情報を収集し、気候変動リスク管理の実態につき、理解を深めていこうとしている。 2023-05-10 16:57:44
金融 ニッセイ基礎研究所 2022年度自社株買い動向~自己株式の取得を行う理由と株価の関係~ https://www.nli-research.co.jp/topics_detail1/id=74749?site=nli nbsp特に自己株式取得の主な理由が株主還元である企業の株価上昇が顕著であった。 2023-05-10 16:00:53
金融 日本銀行:RSS 日本銀行当座預金のマクロ加算残高にかかる基準比率の見直しについて http://www.boj.or.jp/mopo/mpmdeci/mpr_2023/mpr230510b.pdf 当座預金 2023-05-10 17:00:00
海外ニュース Japan Times latest articles Teens held after Ginza heist claim not to know each other https://www.japantimes.co.jp/news/2023/05/10/national/crime-legal/ginza-robbery-suspects-investigation/ analyze 2023-05-10 16:25:42
海外ニュース Japan Times latest articles Banking crisis concerns loom over G7 finance ministers meeting https://www.japantimes.co.jp/news/2023/05/10/business/g7-finance-ministers-meeting-bank-worries/ Banking crisis concerns loom over G finance ministers meetingAs well as tackling the issue of crypto regulation the ministers and central bank governors will be looking to strengthen the global financial system 2023-05-10 16:13:18
海外ニュース Japan Times latest articles Suspect arrested after junior high school boy stabbed in Tokyo’s Ota Ward https://www.japantimes.co.jp/news/2023/05/10/national/crime-legal/ota-ward-boy-stabbed/ junior 2023-05-10 16:12:35
海外ニュース Japan Times latest articles Toyota beats profit forecast in fiscal ’22, upbeat on sales for year ahead https://www.japantimes.co.jp/news/2023/05/10/business/corporate-business/toyota-profit-sales-fiscal-2022/ Toyota beats profit forecast in fiscal upbeat on sales for year aheadThe world s top selling automaker said it also expects profit to increase in the year ahead on improvements in semiconductor supply and the efforts of production 2023-05-10 16:02:12
ニュース BBC News - Home Flash flooding: Major incident declared after heavy rain in south https://www.bbc.co.uk/news/uk-england-somerset-65542510?at_medium=RSS&at_campaign=KARANGA torrential 2023-05-10 07:48:23
ニュース BBC News - Home Finance worker found dead in Spanish holiday villa https://www.bbc.co.uk/news/uk-scotland-edinburgh-east-fife-65538788?at_medium=RSS&at_campaign=KARANGA spain 2023-05-10 07:42:32
ニュース BBC News - Home Eurovision: Which parts of the UK have performed best? https://www.bbc.co.uk/news/uk-65525862?at_medium=RSS&at_campaign=KARANGA country 2023-05-10 07:24:08
ニュース BBC News - Home Imran Khan: Tense mood grips Pakistan ahead of former PM's hearing https://www.bbc.co.uk/news/world-asia-65541215?at_medium=RSS&at_campaign=KARANGA arrest 2023-05-10 07:03:46
ニュース BBC News - Home Antonio Carbajal: Mexican who became first footballer to play at five World Cups dies aged 93 https://www.bbc.co.uk/sport/football/65542473?at_medium=RSS&at_campaign=KARANGA Antonio Carbajal Mexican who became first footballer to play at five World Cups dies aged Mexican football legend Antonio Carbajal who became the first footballer to play at five World Cups in dies at the age of 2023-05-10 07:40:48
IT 週刊アスキー スパチュン新作のSwitch『なつもん! 20世紀の夏休み』が7月28日発売決定! https://weekly.ascii.jp/elem/000/004/136/4136070/ nintendo 2023-05-10 16:15:00
IT 週刊アスキー 個性的な山下清の世界を堪能! SOMPO美術館「生誕100年 山下清展―百年目の大回想」を開催 https://weekly.ascii.jp/elem/000/004/136/4136073/ sompo 2023-05-10 16:15:00
IT 週刊アスキー ハウステンボス、無数のランタンが舞い上がる「スペクタクルランタンナイトショー」など「光と運河のサマーフェスティバル」7月7日~9月10日開催 https://weekly.ascii.jp/elem/000/004/136/4136077/ 夏季限定 2023-05-10 16:10:00
IT 週刊アスキー 米が減ると自動発注、パナソニックが実証実験 https://weekly.ascii.jp/elem/000/004/136/4136074/ 実証実験 2023-05-10 16:45:00
IT 週刊アスキー エプソン、デザインを一新したA4ドキュメントスキャナー「DS-C480W」「DS-C420W」を発表 https://weekly.ascii.jp/elem/000/004/136/4136072/ 発表 2023-05-10 16:30:00
マーケティング AdverTimes 丸亀製麺、振って楽しい「シェイクうどん」で新たなテイクアウトの形を発表 https://www.advertimes.com/20230510/article418687/ 丸亀製麺 2023-05-10 07:16:10

コメント

このブログの人気の投稿

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