js |
JavaScriptタグが付けられた新着投稿 - Qiita |
TS, JS: fetchをミスなく快適に書く方法(fetcha!) |
https://qiita.com/_tt/items/281a3d5d34449f3426d0
|
heade |
2023-07-05 03:36:55 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
Redisをオンライン移行した話 |
https://qiita.com/count3/items/c58f8be90ef9078f7bba
|
redis |
2023-07-05 03:12:54 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
Redisをオンライン移行した話 |
https://qiita.com/count3/items/c58f8be90ef9078f7bba
|
redis |
2023-07-05 03:12:54 |
技術ブログ |
Developers.IO |
AWS Backup으로 PITR(Point in time recovery)를 이용해서 RDS를 특정 시점으로 복원해 보기 |
https://dev.classmethod.jp/articles/jw-aws-backup-uses-pitr-to-restore-rds-to-a-point-in-time/
|
AWS Backup으로PITR Point in time recovery 를이용해서RDS를특정시점으로복원해보기안녕하세요클래스메소드김재욱 Kim Jaewook 입니다 이번에는AWS Backup으로PITR Point in time recovery 를이용해서RDS를특정시점으로복원해보는과정 |
2023-07-04 18:46:55 |
海外TECH |
MakeUseOf |
How to Safely Uninstall Docker Desktop From a Mac |
https://www.makeuseof.com/how-to-uninstall-docker-desktop-mac/
|
files |
2023-07-04 18:45:20 |
海外TECH |
MakeUseOf |
How and When to Use the Compression Plugins in Logic Pro |
https://www.makeuseof.com/logic-pro-how-when-to-use-compression-plugins/
|
logic |
2023-07-04 18:30:18 |
海外TECH |
MakeUseOf |
The Best Amazon Kindle Devices You Can Buy |
https://www.makeuseof.com/best-kindle-devices/
|
amazon |
2023-07-04 18:20:19 |
海外TECH |
MakeUseOf |
How to Stop Windows Update Asking to Update and Restart |
https://www.makeuseof.com/windows-stop-update-and-restart-options/
|
restartis |
2023-07-04 18:16:19 |
海外TECH |
DEV Community |
Zuckerberg Unveils New Threads App, Dorsey and Musk Express Privacy Concerns!! |
https://dev.to/soumyadeepdey/zuckerberg-unveils-new-threads-app-dorsey-and-musk-express-privacy-concerns-1d83
|
Zuckerberg Unveils New Threads App Dorsey and Musk Express Privacy Concerns Threads app will allow users to follow the accounts they follow on Instagram The release is expected on Thursday Meta the parent company of Facebook and Instagram has announced the forthcoming release of Threads a microblogging app designed to compete directly with Twitter Scheduled for launch on Thursday Threads aims to capture the attention of users who are seeking an alternative to Twitter s platform This development comes at a time when Elon Musk the new owner of Twitter has been making significant changes and generating controversy with his experimentation of the platform s functionalities What is Meta s Threads app Jack Dorsey and Elon Musk took swipe on Mark Zuckerberg s new app According to a listing on Apple s App Store Threads an app centered around text based conversations will offer users the ability to follow the same accounts they already follow on Instagram while maintaining their existing usernames This integration between Threads and Instagram accounts aims to provide a seamless experience for users transitioning to the new app Jack Dorsey and Elon Musk team up to take a swipe at Meta s new appJack Dorsey and Elon Musk Collaborate to Critique Meta s Latest AppTech moguls Jack Dorsey and Elon Musk have joined forces to express their reservations and criticisms regarding Meta s recently unveiled app The collaboration between the Twitter co founder and the Tesla and SpaceX CEO signals their shared concerns and intentions to challenge the impact and functionality of Meta s new offering Twitter co founder and former chief executive Jack Dorsey raised concerns about the permissions and data access required by Meta s new app Sharing a screenshot of the App Store listing which displayed the app s data requirements Dorsey tweeted All your Threads are belong to us Elon Musk too joined him and commented on the post “Yeah In another tweet Twitter new boss took on Meta and sarcastically remarked Thank s goodness they are so sanely run This comment was in reference to a Meta executive s reported statement about aiming to establish a sanely run social media platform through the Threads app Threads App Permissions Now Lets Take A Look At Twitter s Permissions Twitter under experiment Twitter Implements Verification Requirement for TweetDeck Users Amidst Recent ChangesTwitter has made an announcement that users will soon be required to undergo a verification process in order to continue using TweetDeck a widely used tool for managing Twitter accounts The company has set a timeline of days for the implementation of this change In addition to the verification requirement Twitter has recently made the decision to impose limits on the number of daily posts that users can read further adding to the evolving landscape of the platform These frequent changes to Twitter s features have resulted in a sense of uncertainty among users prompting many netizens to express their inclination to abandon the platform in favor of rival alternatives The discussions surrounding a potential mass exodus have gained traction with hashtags like Instagram and MySpace trending on Twitter as users contemplate exploring other options The ongoing discourse reflects the growing dissatisfaction and concerns among users in response to these recent developments Twitter vs Meta this battle is already full fledged Elon Musk the visionary entrepreneur behind SpaceX and Tesla has unveiled his ambitious plans for Twitter revealing that the platform will soon enable users to make voice and video calls without the need for sharing their phone numbers This move positions Twitter in direct competition with Mark Zuckerberg s WhatsApp and Instagram intensifying the competition between the two tech giants As each platform closely observes the other s developments Meta the company that owns Facebook and Instagram recently introduced a paid verification service for its users This offering was a response to Twitter s introduction of paid verification through its subscription service Twitter Blue which grants users access to exclusive features including the highly sought after Blue verification badge Interestingly the rivalry between these industry titans extends beyond the digital realm with rumors circulating about the possibility of a high profile cage fight This adds an intriguing dimension to their ongoing battle for dominance in the technology industry capturing the attention of both tech enthusiasts and the wider public Conclusion In conclusion the tech industry is witnessing an intense rivalry between major players such as Twitter owned by Elon Musk and Meta the company behind Facebook and Instagram led by Mark Zuckerberg As Musk announces plans for Twitter s expansion into voice and video calls directly competing with Zuckerberg s WhatsApp and Instagram the battle for dominance in the social media landscape is heating up Both platforms are closely monitoring each other s moves with Meta introducing a paid verification service in response to Twitter s Twitter Blue subscription offering The rivalry extends beyond the digital realm with talks of a potential high profile cage fight between the two industry giants This ongoing competition highlights the dynamic nature of the tech industry and the continuous drive for innovation and market dominance |
2023-07-04 18:50:08 |
海外TECH |
DEV Community |
💪🏿Let's flex . . . |
https://dev.to/dagimgdot/lets-flex--49fg
|
Let x s flex Have you ever wondered about the difference between the display values block flex inline flex and inline block block and inline block are used to create block level and inline level elements respectively block elements take up the full width available and create a new line while inline block elements only take up as much width as needed and allow other elements to sit next to them on the same line flex and inline flex are used to create flexible containers that can adjust the size and position of their child elements flex containers are block level elements while inline flex containers are inline level elements that can be placed inline with other elements The main difference between flex and inline flex is the direction in which the items are laid out By default flex lays items out in a row while inline flex lays items out in a line along the inline axis What do all the above sentences mean I don t know NotionAi said that Now let me tell you mine Let s see what their difference is with an example to make it more clear So here is what we start the example with lt div class wrap gt lt div class child gt lt div gt lt div class child gt lt div gt lt div class child gt lt div gt lt div gt lt div class wrap gt lt div class child gt lt div gt lt div class child gt lt div gt lt div class child gt lt div gt lt div gt Let s add some css to spice it up wrap display flex display inline flex display inline block border px solid blue padding px margin px child border px solid green margin px px padding px text align center As you can see from the above html and csswe have two sets of three child div elements wrapped in parent div elements with the class wrap Now let s apply different display values to the parent div elements and see how it affects the layout of the child div elements block The wrap elements will take up the full available width and the child elements will be displayed in a block layout with each child element taking up the full width of the parent element and appearing on a new line Remember block is the default value for div taginline block The wrap elements will only take up as much width as necessary and also will be displayed in inline layout but the child elements will be displayed in an block layout with each child element taking up only as much width as necessary flex The wrap elements will become flexible containers that can adjust the size and position of their child elements By default the child elements will be laid out in a row but the wrap element is still in block layout inline flex The wrap elements will become flexible containers that can adjust the size and position of their child elements and they will be displayed inline with other elements By default and also the child elements will be displayed in inline layout too This is the basic difference between them feel free to comment what you think And here is a codepen link for you to play with if you are curious |
2023-07-04 18:48:24 |
海外TECH |
DEV Community |
GETTING STARTED WITH CACHING: USING REDIS AND TYPESCRIPT |
https://dev.to/realsteveig/getting-started-with-caching-using-redis-and-typescript-2c4n
|
GETTING STARTED WITH CACHING USING REDIS AND TYPESCRIPTINTRODUCTION In this Tutorial We are going to learn the fundamentals of caching and how to implement them using Redis and Typescript Nodejs But before we begin let s start with the basics What is Caching Caching is a technique used in computer systems and software applications to store and retrieve data quickly It involves storing a copy of frequently accessed or expensive to compute data in a temporary storage location called a cache so that future requests for the same data can be served faster The purpose of caching is to improve the performance and efficiency of a system by reducing the time and resources required to fetch data from its original source Instead of retrieving the data from the original location which may involve time consuming operations like disk access or network communication the data is retrieved from the cache which is typically located closer to the requester and provides faster access PREREQUISITES To follow along with this tutorial you will need to have a basic understanding of NodeJS and Typescript I will try my best to explain every required step and I am confident that I can provide thorough explanations to assist you throughout the process Why Redis When it comes to caching Redis stands out as an exceptional choice for several reasons Its features and capabilities make it an ideal solution for optimizing performance and improving overall system efficiency Redis is renowned for its incredible speed and performance By storing data in memory Redis enables lightning fast data access and retrieval making it suitable for applications that require real time data processing and high throughput With the ability to handle millions of requests per second and provide low latency response times Redis excels in scenarios where speed is of utmost importance By leveraging Redis as a cache applications can store frequently accessed data in memory eliminating the need for repetitive and resource intensive operations This results in improved performance reduced response times and a more seamless user experience In this tutorial we will employ Redis for caching data retrieved from an external API with a noticeably slow response time We will store this data in our cache and utilize it for subsequent requests made to the API However we will also address the scenario when the data from the original API undergoes changes We will implement a mechanism to ensure that our cache consistently provides up to date data from the API ensuring that our system remains synchronized with the latest information Let s get started First let s initialize our Nodejs project and install the required dependencies npm init ynpm i express axios cors dotenv redisNow install the type definitions npm i types express types axios types cors types dotenv types redisHaving a tsconfig json file ensures consistency in the compilation process across different environments and allows for easy project configuration and maintenance So go ahead and create one using tsc initThen configure your outDir and rootDir options to match the following structure Don t forget to watch for changes in your Typescript code by using tsc w in a dedicated terminal Next let us connect to Redis To do this you have two options Connect to Redis Local Server using localhost Connect to the Redis cloud console by creating an instance via Redis cloudIn this tutorial we will go with option If you don t have an account already Kindly create one and create a database instance Now let s connect to our database Our src config ts file should now have the following lines of code import createClient from redis import dotenv from dotenv dotenv config export const client createClient password process env REDIS PASSWORD socket host process env REDIS HOST port parseInt process env REDIS PORT The code above sets up a Redis client using the redis package loads environment variables from a env file using dotenv and exports the Redis client for use in other parts of the codebase The environment variables are used to configure the Redis connection including the host port and password These variables are available on your database instance once you create an account here Redis cloud Next Let s import the client variable in our app ts file and connect to the database Configure your app ts file to look like this import dotenv from dotenv import express Request Response from express import axios from axios import client from config connect import cors from cors dotenv config const app express Application express const PORT process env PORT app use cors app use express json const start async gt try await client connect app listen PORT gt console log Server is connected to redis and is listening on port PORT catch error console log error start The code above imports all the installed dependencies we will need for this project sets up an Express server configures it to handle JSON requests enables CORS connects to the Redis client and starts the server to listen for incoming requests if the connection is successful Now for this tutorial I have created and deployed an API whose response is intentionally delayed by secs to demonstrate how caching can be useful in a real world scenario So in our app ts file we will create two functions that make API calls like this async function isDataModified const response await axios get return response data modified async function getAllUsers const response await axios get return response data Now let s examine each of these functions separately The first function sends a request to an endpoint that interacts with its database It retrieves a boolean result which evaluates to true if there have been any recent changes These changes encompass scenarios such as the addition of a new item POST modification of an existing item PUT or deletion of an item DELETE In the absence of any changes the result will be false The second function on the other hand straightforwardly retrieves a list of all items in this case users stored in the database of that particular API Now let s understand the rationale behind this approach Why are we making two requests to an API Remember when we mentioned the need to cache only recent information Exactly So what happens when a user decides to update specific details on their profile In such cases we also need to update the cache right Absolutely correct That s precisely what the first function accomplishes Before serving our response we verify if any changes have been made in the API s database to ensure that our cache is up to date Now let s create an endpoint in this API to store and retrieve information from our cache Update the app ts file with this endpoint app use get users async req Request res Response gt let result let isCahed try const data await isDataModified if data true result await getAllUsers isCahed false await client set all users JSON stringify result else const isCahedInRedis await client get all users if isCahedInRedis isCahed true result JSON parse isCahedInRedis else result await getAllUsers isCahed false await client set all users JSON stringify result return res status json isCahed result result catch error console log error return res status json error Now let s explain what is happening here step by step Inside the route handler function a Two variables result and isCached are created to store the API request result and caching status b The isDataModified function is called to check if there have been any modifications in the database The result is stored in the data variable c If modifications are detected when data is true it means the cache needs to be updated The getAllUsers function is called to retrieve all user data from the API The result is assigned to the result variable and the isCached variable is set to false The retrieved data is then stored in the Redis cache using the client set method d If no modifications are detected it means the cached data is still valid The code checks if the data is already cached in Redis using the client get method If cached data exists it is assigned to the result variable and the isCached variable is set to true e If no cached data exists the getAllUsers function is called to retrieve the user data from the API The result is assigned to the result variable and the isCached variable is set to false The retrieved data is then stored in the Redis cache using the client set method f Finally the code sends a JSON response with a status of The response includes the isCached status and the result data If any errors occur during the process they are caught in the catch block A JSON response with a status of and the error message is returned To summarize this code sets up an endpoint that fetches user data from an API It checks if the data has been modified updates the cache if needed and returns the cached data or retrieves fresh data from the API And that pretty much does the job Our app ts file should now look like this import dotenv from dotenv import express Request Response from express import axios from axios import client from config connect import cors from cors dotenv config const app express Application express const PORT process env PORT app use cors app use express json async function isDataModified const response await axios get return response data modified async function getAllUsers const response await axios get return response data app use get users async req Request res Response gt let result let isCached try const data await isDataModified if data true result await getAllUsers isCached false await client set all users JSON stringify result else const isCachedInRedis await client get all users if isCachedInRedis isCached true result JSON parse isCachedInRedis else result await getAllUsers isCached false await client set all users JSON stringify result return res status json isCached result result catch error console log error return res status json error const start async gt try await client connect app listen PORT gt console log Server is connected to redis and is listening on port PORT catch error console log error start Now run the server and let us test our endpoints The first thing you will notice when you hit this endpoint http localhost get users is how long it took to get a response As I mentioned before that is intentional it is meant to simulate how real world applications that are CPU intensive behave when caching is not implemented Next you will notice that the first property from the response which is isCached reads false This means that this data does not exist in our cache but has been added immediately How can we confirm that well lets make the same request again by simply refreshing our browser This is what we get Notice how the response time is reduced as you keep refreshing the page also Notice that the isCachedproperty now reads true To test what will happen when we alter the database I invite you to modify the response by creating editing or deleting users using any of the endpoints below Create user POST Update user PUT Delete user DELETE idFor every time you makes these requests successfully POST PUT and DELETE the isCached value becomes false prompting a delayed response to fetch current data and update the cache Remember you can always refresh your endpoint at http localhost get users to visualize the changes happening live Here is an example of how to make these requests on Postman CREATE NEW USERUPDATE USERDELETE USERNow if for some reason the API ceases to exist in the future you can also try out this similar public API Here is how it works The response time of the API is contingent on the query parameter delay That means if you set the delay it will take three seconds before the API returns a response This means that you can practice the caching mechanism with this API But wait how do we actually visualize the data in our cache Well you can download a tool like RedisInsight connect your database instance and voila you can now visualize and query your cache Here is a link to the complete code on GitHub Thank you for sticking around till the end FINAL NOTES Congratulations if you got this far By now you should have a solid understanding of how Redis can be leveraged as a powerful caching solution However caching with Redis extends beyond just speeding up data retrieval In this final note let s explore some additional use cases and discuss the remarkable usefulness of caching Session Caching Redis is an excellent choice for storing session data By caching session information you can achieve high performance session management improve user experience and reduce database load Redis s ability to set expiration times on keys makes it perfect for managing session timeouts and automatically cleaning up expired sessions Full page Caching Redis can be used to cache entire HTML pages eliminating the need to regenerate them on each request By serving cached pages directly from Redis you can dramatically reduce the response time and alleviate the load on your application servers Result Caching Redis enables you to cache the results of complex or time consuming computations For example if your application involves heavy calculations or data processing you can store the computed results in the Redis cache and retrieve them when needed avoiding redundant computations Leaderboards and Counters Redis s sorted sets and atomic increment operations make it an excellent choice for implementing leaderboards vote counters or popularity rankings By caching these frequently changing metrics you can efficiently update and display them in real time Pub Sub Messaging Redis supports Publish Subscribe Pub Sub messaging allowing you to build real time communication channels notifications and event driven architectures By caching messages or maintaining subscription lists Redis facilitates the implementation of scalable high performance messaging systems The usefulness of caching with Redis cannot be overstated By intelligently caching data you can achieve significant performance improvements reduce latency and enhance the overall scalability of your applications However it s crucial to consider cache invalidation and maintain data consistency when working with caching systems |
2023-07-04 18:18:34 |
海外TECH |
DEV Community |
I'm a lazy Dev |
https://dev.to/kenystev/im-a-lazy-dev-c7l
|
I x m a lazy DevOriginally publish at Jobsity BlogYes I m a lazy dev and I like it Don t misunderstand me I haven t said I m not productive it is the opposite let me explain myself I hate doing that kind of repetitive task on a daily basis I m always looking for challenges something that really puts my brain to work and then gets the best of it by figuring out creative solutions That s why I pushed myself through the way of automating repetitive tasks with scripts Scripts have helped me a lot to perform repetitive tasks and even to increase my productivity since I don t have to worry on spending a lot of time doing the same and focus on what s worth It might be tough to start but if you want to become a lazy dev too just let me give you some advices on tips you should keep in mind whenever you re writing a new script TipsUse a common scripting language known by the teamKeep it short clean and understandableFollow the same pattern in your scriptsDocument your scriptsOnce you identify a task where you could create a script for please don t hesitate to automate it your team and even you re going to love it What language should I use Well I prefer writing my scripts using bash it s simpler easy to learn and it comes with all the Unix based systems Javascript could be an option as well if your team is used to javascript Personally I ve written most of my scripts in bash and some others with python One script to rule them all Please don t try to write a script to make everything it s better to have several short and maintainable scripts well documented than a big bunch of code trying to control the world If that s what you want you might consider to write a complete CLI program instead Though I wouldn t recommend Patterns would make it easyAs a rule of thumb try to keep patterns on your scripts that d make it easy not only for you to start creating a new script but also for your teammates to understand how the script works The pattern I like to follow is flag s parameters where you pass them to the script as flags for instance if you want to pass an external file path you add a flag like f or file if you prefer the full flag Document your scriptsBest way to document your scripts is a self explained code but we usually just need a quick documentation of how to use it without need to checkout the code that s why I d recommend you to always add a help h help command Templates For those who reach the end I ll give you some templates you could use to start creating your scripts and believe me this has helped me so much improving my performance and accelerating several tasks in the projects I ve worked on And for sure it makes my clients happier when I build tools to increase the development pace of those stressful repetitive tasks we ve gone through Bash Template usr bin env bash ePARAMS COMMANDS FLAGS Help In order to pass arguments use after the command like npm run script name f f file Pass file path o output file Sets the output file s name h help Lists help options VARSFILE while do case in f file FILE shift h help echo COMMANDS FLAGS exit unsupported flags echo Error Unsupported flag gt amp exit preserve positional arguments PARAMS PARAMS shift esacdone set positional arguments in their proper placeeval set PARAMS execute your scriptecho Running script if FILE then echo File not found else cat FILEfiAlright let s split the code first we will need a variable to store the positional parameters PARAMS those are the ones its order is importantCOMMANDS FLAGS is basically our documentation we re going to display when the help flag is passed or if the passed params does not supply the minimum requirement Always supply short and full flags to your scripts believe me users are going to love it Then you d want to define all the default values for the vars you re using because next is where most of the magic happens Here we re parsing our flags and storing the right values in our variables depending on what needs to be done you can add as many flags as you wish Just add a new case like f flag FILE shift Remember the flag s value for non boolean flags is going to be stored in var And don t forget the last two conditions is meant to throw an error when a flag is not valid is meant to concat the positional paramswhile do case in f file FILE shift h help echo COMMANDS FLAGS exit unsupported flags echo Error Unsupported flag gt amp exit preserve positional arguments PARAMS PARAMS shift esacdoneAlso after parsing the your flags remember to put back the positional params on its place with eval set PARAMS And that s it Now you can start running your script based on the conditions set by the flags the user passes or throw an error if the user passes each other exclusive flags it depends on how you define your script after that Bonus Sometimes you d like to add more live to your scripts like showing an error message in red or an advice in yellow in those cases I d suggest you to define you colorsred e m green e m yellow e m blue e m magenta e m cyan e m purple e m s e m end e m The end var is to define where to stop painting your text and it s used like printf s n red Error There s nothing to be updated end Well and if that s not enough for you you can also create helper functions to help you better build your script or even better to add some enhancements to your script like the power of logging the batch of commands to be run in case your script performs a sequence of commands That way the user will be able to see before running the script what is about to be executed I ve made that abstraction for you so don t worry just use it run command if TEST OUTPUT true then echo else printf s n blue running gt end eval fi This function as you can read the code requires a variable called TEST OUTPUT you can define the flag whatever you wish I ve done it with capital letter T T testAnd what it does basically is if true then echo the command about to be run otherwise print the command and also execute it A simple use example would be if your script wants to run git status to check out if there s any change then you d run it with the helper function run command git status NoteWith python you could use argparse to actually parse your flags in a fancy way than bash does it if you re more a python enthusiastHope this could help you somehow to improve your productivity and guide you to the way of being a lazy developer see you soon |
2023-07-04 18:17:22 |
海外TECH |
DEV Community |
Garanta a Eficiência: Escolhendo Sabiamente o Tipo de Dado Integer no MySQL |
https://dev.to/z4nder/garanta-a-eficiencia-escolhendo-sabiamente-o-tipo-de-dado-integer-no-mysql-16pc
|
Garanta a Eficiência Escolhendo Sabiamente o Tipo de Dado Integer no MySQLJápensou no motivo de um banco de dados ter tantos tipos de valores inteiros SMALLINT BIGINT Éde comer ConteúdoPrólogoEscolhendo tipos em modelos de dadosTomando uma decisão conscienteO que posso fazer um Byte Agora vamos colocar em práticaConsiderações finais PrólogoNessa vida de desenvolvedor de software aprendi a valorizar os fundamentos das tecnologias com as quais trabalho Neste artigo vamos explorar todos os tipos INTEGER existentes quais suas características e como podemos usar isso para tomar decisões mais assertivas ao modelar um esquema com MySQL Escolhendo tipos em modelos de dadosUm princípio fundamental para modelar dados éavaliar se os tipos escolhidos são os melhores para os valores que serão recebidos Nesse artigo vamos tentar entender quais tipos de inteiros existem e quais suas diferenças para podermos tomar essa melhor decisão no momento de criar nossas tabelas Tomando uma decisão conscientePara conseguirmos tomar a decisão mais consciente precisamos saber quais o tipos de inteiro existentes e qual o espaço ocupado em Bytes por cada tipo pois independente de vocêinserir o número inteiro em um registro ele ocupa um espaço diferente de acordo com o tipo de dado do schema Por exemplo o tipo TINYINT ocupa byte enquanto o tipo BIGINT ocupa bytes Portanto mesmo que vocêinsira o número inteiro em um registro ele ocuparáum espaço diferente dependendo do tipo de dado especificado no esquema schema Podemos considerar que cada tipo de inteiros nos permitem armazenar um certo range de valores e cada range reserva uma quantidade de Bytes Vamos observar todos os tipos e seus custos de Bytes TypeStorage Bytes TINYINTSMALLINTMEDIUMINTINT O que posso fazer um Byte Com Byte podemos usar Bits ou seja com o TINYINT podemos armazenar números no seguinte range E caso precisarmos ter um sinal Nesse caso vamos precisas separar um bit para isso reduzindo nosso range assim negative bit positive bit Com isso temos a seguinte tabela TypeStorage Bytes Min SignedMax SignedMin UnsignedMax UnsignedTINYINT SMALLINT MEDIUMINT INT BIGINT Agora vamos colocar em práticaCREATE TABLE books id bigint NOT NULL AUTO INCREMENT title varchar NOT NULL num pages SMALLINT UNSIGNED PRIMARY KEY id Nesse trecho de SQL tomamos a decisão de escolher o tipo de inteiro mais adequado com base no contexto do nosso caso de uso Ao analisar a coluna num pages que representa o total de páginas de um livro optamos por utilizar o tipo SMALLINT Essa escolha foi feita levando em consideração os seguintes fatores Valor máximo adequado O tipo TINYINT possui um valor máximo de o qual poderia ser facilmente ultrapassado por livros com um número significativo de páginas No entanto o tipo SMALLINT oferece um tamanho maior permitindo um valor máximo de Essa faixa émais adequada para a representação do número de páginas de um livro na vida real a não ser que vocêesteja lendo Game of Thrones ai jáseria preciso de um BIGINIT Modificador UNSIGNED Utilizamos o modificador UNSIGNED para indicar que não hánecessidade de armazenar valores negativos para o número de páginas de um livro Isso nos permite aproveitar um limite positivo maior dentro do mesmo tipo de dado jáque não precisamos reservar espaço para o sinal Portanto ao escolher o tipo SMALLINT UNSIGNED para a coluna num pages levamos em consideração o valor máximo adequado a economia de espaço e a exclusão da possibilidade de valores negativos garantindo uma representação eficiente e precisa do número de páginas dos livros em nosso sistema Considerações finaisApós compreendermos as diferenças entre os tipos de inteiro percebi o quanto éimportante escolher o tipo de dado adequado para cada situação Refletindo sobre minha própria experiência lembro me das vezes em que utilizei o tipo INTEGER desnecessariamente Após aprofundar me nesse assunto e compartilhar essas informações acredito que não vou mais cometer esse erro Espero que este artigo tenha sido esclarecedor para vocês também auxiliando na escolha consciente do tipo de inteiro mais adequado para cada contexto Venha fazer parte de um ambiente de aprendizado |
2023-07-04 18:16:05 |
海外TECH |
Engadget |
The best 2-in-1 laptops for 2023 |
https://www.engadget.com/the-best-2-in-1-laptops-for-2023-155052641.html?src=rss
|
The best in laptops for The perfect hybrid machine that s just as good a tablet as it is a traditional laptop still doesn t exist But throughout last year companies like Microsoft Apple and Google continued to improve their operating systems for machines that do double duty Windows has features that make it friendlier for multi screen devices while Android has been better optimized for larger displays Plus with the rise of ARM based chips for laptops especially Apple s impressive M series prospects for a powerful in with a vast touch friendly app ecosystem is at an all time high Even the best in laptops still have their limits of course Since they re smaller than proper laptops they tend to have less powerful processors Keyboards are often less sturdy with condensed layouts and shallower travel Plus they re almost always tablets first leaving you to buy a keyboard case separately And those ain t cheap So you can t always assume the advertised price is what you ll actually spend on the in you want Sometimes getting a third party keyboard might be just as good and they re often cheaper than first party offerings If you re looking to save some money Logitech s Slim Folio is an affordable option and if you don t need your keyboard to attach to your tablet Logitech s K Multi Device wireless keyboard is also a good pick While we ve typically made sure to include a budget in laptop in previous years this time there isn t a great choice to include in our top picks We would usually highlight a device like the Surface Go but the latest model is still too expensive Other alternatives like cheaper Android tablets are underpowered and don t offer a great multitasking interface If you want something around that s thin lightweight and long lasting you re better off this year looking at a conventional PC like those on our best budget laptops list Chris Velazco Engadget When you re shopping for a in there are some basic criteria to keep in mind First look at the spec sheet to see how heavy the tablet is alone and with the keyboard Most modern hybrids weigh less than pounds with the pound Surface Pro being one of the heaviest around The iPad Pro and Samsung s Galaxy Tab S are both slightly lighter If the overall weight of the tablet and its keyboard come close to pounds you ll be better off just getting an ultraportable laptop See Also Best Laptops for Best Gaming LaptopsBest Cheap Windows Laptops for Best ChromebooksBest Laptops for College StudentsYou ll also want to opt for an inch or inch screen instead of a smaller inch model The bigger displays will make multitasking easier plus their companion keyboards will be much better spaced Also try to get GB of RAM if you can for better performance ーyou ll find this in the base model of the Galaxy Tab S while this year s iPad Pro and the Surface Pro start with GB of RAM Finally while some convertible laptops offer built in LTE or G connectivity not everyone will want to pay the premium for it An integrated cellular radio makes checking emails or replying to messages on the go far more convenient But it also often costs more and that s not counting what you ll pay for data And as for G ーyou can hold off on it unless you live within range of a mmWave beacon Coverage is still spotty and existing nationwide networks use the slower sub technology that s barely faster than LTE Best overall Surface Pro Intel There s no beating the great performance of the Surface series when it comes to in s They re powerful sleek tablets running an OS that s actually designed for productivity The Surface Pro is Microsoft s latest and great tablet and it builds upon the already excellent Pro It features speedy th gen Intel CPUs and all of the major upgrades from last year including a Hz display and a more modern design It s the best implementation of Microsoft s tablet PC vision yet Don t confuse this with the similarly named Surface Pro with G though which has a slower ARM processor and inferior software compatibility Built in cellular is nice and all but the Intel Pro is a far better PC Like most of the other convertible laptops on this list the Pro doesn t come with a keyboard cover ーyou ll have to pay extra for that That s a shame considering it starts at Microsoft offers a variety of Type Covers for its Surface Pros ranging from to depending on whether you want a slot for a stylus But at least they re comfortable and well spaced You can also get the Surface Slim Pen for sketching out your diagrams or artwork which features haptic feedback for a more responsive experience Read our full review of the Microsoft Surface Pro Best for Apple users inch iPad ProIf you re already in the Apple ecosystem the best option for you is obviously an iPad The inch Pro is our pick Like older models this iPad Pro has a stunning inch screen with a speedy Hz refresh rate as well as mini LED backlighting This year it includes Apple s incredibly fast M chip for excellent performance and more battery life than ever before Apple s Magic Keyboard provides a satisfying typing experience and its touchpad means you won t have to reach for the screen to launch apps But it ll also cost you an extra making it the most expensive case on this list by a lot The iPad also lacks a headphone jack and its webcam is awkwardly positioned along the left bezel when you prop it up horizontally so be aware that it s still far from a perfect laptop replacement Still with its sleek design and respectable battery life the iPad Pro makes it a good in choice for Apple users Read our full review of the Apple iPad ProBest for Android users Samsung Galaxy Tab S While Windows is better than iPadOS and Android for productivity it lags the other two when it comes to apps specifically designed for touchscreens If you want a tablet that has all the apps you want and only need it to occasionally double as a laptop the Galaxy Tab S is a solid option You ll enjoy watching movies and playing games on its gorgeous inch Hz AMOLED screen and Samsung includes the S Pen which is great for sketching and taking notes The Snapdragon Gen chip and GB of RAM keep things running smoothly too Last year Samsung dramatically improved its detachable keyboard case making the Tab an even better convertible laptop You could type for hours on this thing and not hate yourself or Samsung The battery life is also excellent so you won t need to worry about staying close to an outlet The main caveat is that Android isn t great as a desktop OS even with the benefits of Android L And while Samsung s DeX mode offers a somewhat workable solution it has plenty of quirks Read our Full Review of Samsung Galaxy Tab S in LaptopHonorable mention Lenovo Yoga iAdaptability is the biggest strength of a in with devices like the Yoga i capable of transforming into a number of different modes at a moment s notice Even though it s got a relatively portable inch OLED display Lenovo still found room on the Yoga i for three USB C ports a fingerprint scanner and a clever rotating soundbar to ensure audio sounds good in any position Lenovo also includes a free stylus in the box but unlike previous models there isn t a dedicated storage slot for it on the machine anymore It s also worth noting that while its general design hasn t changed much for Lenovo has improved the Yoga i s performance with updated th gen Intel processors Read our full review of the Lenovo Yoga iThis article originally appeared on Engadget at |
2023-07-04 18:48:03 |
海外TECH |
Engadget |
Twitter says it couldn't tell people about rate limiting in advance |
https://www.engadget.com/twitter-says-it-couldnt-tell-people-about-rate-limiting-in-advance-183928265.html?src=rss
|
Twitter says it couldn x t tell people about rate limiting in advanceTwitter has been even more of a mess than usual over the last few days in part because it limited the number of tweets users could read each day The decision came as a surprise to many but the company said it was unable to give folks a heads up quot We temporarily limited usage so we could detect and eliminate bots and other bad actors that are harming the platform quot a Twitter Business blog post reads quot Any advance notice on these actions would have allowed bad actors to alter their behavior to evade detection quot While some have been skeptical of Twitter s reasoning for the move the company says it limited the rate limit to stop bad actors from scraping public data to feed into artificial intelligence models and to prevent them from quot manipulating people and conversation on the platform in various ways quot It says that the rate limits currently impact a small percentage of users and it will provide an update when these efforts are complete It seemed strange that Twitter posted this update on its business blog until the company mentioned that rate limiting has had a quot minimal quot effect on advertising Many pointed out that limiting the number of tweets users could read per day would make it harder for advertisers to reach users and for Twitter to make money Rate limiting broke Twitter s website and apps for the most part including TweetDeck an app that many power users rely on To help remedy that the company released quot a new improved version of TweetDeck quot The company is moving all users over to the latest version but there was another twist in store Twitter is making the app exclusive to verified accounts effectively putting a paywall on TweetDeck for the vast majority of users This article originally appeared on Engadget at |
2023-07-04 18:39:28 |
海外科学 |
NYT > Science |
Lewis Branscomb, Champion of Science Across Fields, Dies at 96 |
https://www.nytimes.com/2023/07/04/technology/lewis-branscomb-dead.html
|
Lewis Branscomb Champion of Science Across Fields Dies at He led scientific advances at I B M and within the federal government during a career that spanned the space race and the dawn of the internet |
2023-07-04 18:10:32 |
海外科学 |
BBC News - Science & Environment |
Climate change: World's hottest day since records began |
https://www.bbc.co.uk/news/science-environment-66104822?at_medium=RSS&at_campaign=KARANGA
|
warmest |
2023-07-04 18:28:46 |
ニュース |
BBC News - Home |
Climate change: World's hottest day since records began |
https://www.bbc.co.uk/news/science-environment-66104822?at_medium=RSS&at_campaign=KARANGA
|
warmest |
2023-07-04 18:28:46 |
ニュース |
BBC News - Home |
Ukraine war: At least 43 injured in daylight strike in Kharkiv region |
https://www.bbc.co.uk/news/world-europe-66102096?at_medium=RSS&at_campaign=KARANGA
|
kharkiv |
2023-07-04 18:32:53 |
ニュース |
BBC News - Home |
Chechnya Milashina attack: Armed thugs beat up Russian journalist and lawyer |
https://www.bbc.co.uk/news/world-europe-66096607?at_medium=RSS&at_campaign=KARANGA
|
court |
2023-07-04 18:27:58 |
ニュース |
BBC News - Home |
Wimbledon 2023 results: Andy Murray & Cameron Norrie win at All England Club |
https://www.bbc.co.uk/sport/tennis/66093655?at_medium=RSS&at_campaign=KARANGA
|
Wimbledon results Andy Murray amp Cameron Norrie win at All England ClubUnder roofs at Wimbledon Andy Murray outclasses fellow Briton Ryan Peniston and Cameron Norrie beats Czech qualifier Tomas Machac |
2023-07-04 18:50:45 |
ニュース |
BBC News - Home |
Wimbledon 2023 highlights: Andy Murray beats Ryan Peniston in first round |
https://www.bbc.co.uk/sport/av/tennis/66104281?at_medium=RSS&at_campaign=KARANGA
|
wimbledon |
2023-07-04 18:04:36 |
ニュース |
BBC News - Home |
Wimbledon 2023 results: Elena Rybakina avoids upset against Shelby Rogers |
https://www.bbc.co.uk/sport/tennis/66098410?at_medium=RSS&at_campaign=KARANGA
|
Wimbledon results Elena Rybakina avoids upset against Shelby RogersDefending champion Elena Rybakina recovers from a nervous start to avoid a Wimbledon first round exit against American Shelby Rogers |
2023-07-04 18:46:46 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【一粒万倍日より超開運!】神様が七夕に見る、運がいい人、お金持ちの人の過ごし方 - 旬のカレンダー |
https://diamond.jp/articles/-/325394
|
【一粒万倍日より超開運】神様が七夕に見る、運がいい人、お金持ちの人の過ごし方旬のカレンダー「今日、何する」「どこ行く」「何食べる」と思ったとき、開くと必ず答えが見つかる書籍、『旬のカレンダー』。 |
2023-07-05 03:52:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【税務署は見ている】「マイホームの頭金」を親に援助してもらった人を襲う悲劇とは? - ぶっちゃけ相続【増補改訂版】 |
https://diamond.jp/articles/-/325603
|
頭金 |
2023-07-05 03:49:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
自分から勉強する子になる「牧場型子育て」のメリットと注意点 - 勉強しない子に勉強しなさいと言っても、ぜんぜん勉強しないんですけどの処方箋 |
https://diamond.jp/articles/-/325582
|
自分から勉強する子になる「牧場型子育て」のメリットと注意点勉強しない子に勉強しなさいと言っても、ぜんぜん勉強しないんですけどの処方箋万件を超える「幼児から高校生までの保護者の悩み相談」を受け、人以上の小中高校生に勉強を教えてきた教育者・石田勝紀が、子どもを勉強嫌いにしないための『勉強しない子に勉強しなさいと言っても、ぜんぜん勉強しないんですけどの処方箋』を刊行。 |
2023-07-05 03:46:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
大きく値上がりする成長株に共通する「3つの条件」 - 株トレ |
https://diamond.jp/articles/-/325568
|
topix |
2023-07-05 03:43:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【売れば売るほどマイナス】東京ガスがそれでも新ビジネスを成立させた深い理由 - カニバリゼーション |
https://diamond.jp/articles/-/325548
|
そこにつ目の事業を立ち上げて、それがもし、既存の事業の売り上げや利益を減らすことがあらかじめ見えていたとしたらどうだろうそんな新事業に価値を感じられるだろうかカニバリゼーション以下、カニバリと略すー日本語では「事業の共食い」と呼ばれる現象が、特に伝統的な企業を悩ませている。 |
2023-07-05 03:40:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【ビジネスで使える英語表現】「成し遂げる、達成する」を英語で言うと? - 5分間英単語 |
https://diamond.jp/articles/-/325209
|
【ビジネスで使える英語表現】「成し遂げる、達成する」を英語で言うと分間英単語「たくさん勉強したのに英語を話せない……」。 |
2023-07-05 03:37:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
痩せたい人が意識するべき「2つの体重の壁」 - 医者が教えるダイエット 最強の教科書 |
https://diamond.jp/articles/-/325153
|
思い込み |
2023-07-05 03:34:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
エジプト、アルジェリア、モロッコ…アフリカ北部ってどんな地域?【2分で学ぶ国際社会】 - 読むだけで世界地図が頭に入る本 |
https://diamond.jp/articles/-/323602
|
|
2023-07-05 03:31:00 |
コメント
コメントを投稿