python |
Pythonタグが付けられた新着投稿 - Qiita |
等分散性(分散の同一性)の検定を流れで見ていく |
https://qiita.com/Qwertyutr/items/8e9f2c01cd51a72d95c0
|
hatmfracmsumimfracxiμσhatnfracnsuminfracxiμσFfrachatmhatnここで、そもそもの帰無仮説を思い出すと、「分散は等しい」ということでしたので、「σσ」となるので、Ffracfracmsumimxiμfracnsuminxiμちなみに、常に分子分母になるようにしますこれ、単に最終的に不偏分散の比をとっているだけなんですよねwつまり、それぞれの不偏分散をssとするとFfracssですwここで算出した値があらかじめ用意されているF分布の表であったり、プログラミングで検出してくれたりして、棄却できるか判断します。 |
2021-10-24 00:04:34 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
【基礎】discord.js v13 でボットを作る ~コマンド発展~ |
https://qiita.com/hitori_yuu/items/72edadc4b9e11e559b38
|
先ほど作成したcommandsフォルダに新しくserverinfojsというファイルを作成しましょうファイル名は任意serverinfojsconstSlashCommandBuilderrequirediscordjsbuildersスラッシュコマンドを作成する際のおまじないmoduleexportsdatanewSlashCommandBuildersetNameserverinfosetDescriptionサーバーの情報を表示します。 |
2021-10-24 00:58:08 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
Multi Step Formを作っているのですが、必須項目が未選択や未入力であればエラーメッセージとsubmitをキャンセルさせたいのですがうまくいきません |
https://teratail.com/questions/365910?rss=all
|
|
2021-10-24 00:55:08 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
メニューバーが表示されない |
https://teratail.com/questions/365909?rss=all
|
macos |
2021-10-24 00:40:19 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
Discord.jsでコマンドごとにファイルを分ける |
https://teratail.com/questions/365908?rss=all
|
Discordjsでコマンドごとにファイルを分ける実現したいことDiscordBotのコマンド処理をカテゴリ別にファイル分けしたい。 |
2021-10-24 00:39:52 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
heroku環境でpyautoguiをデプロイ時のエラー |
https://teratail.com/questions/365907?rss=all
|
heroku環境でpyautoguiをデプロイ時のエラー前提・実現したいことheroku環境でpyautoguiをデプロイしたい。 |
2021-10-24 00:34:26 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
C++20 concept の書き方 |
https://teratail.com/questions/365906?rss=all
|
Cconceptの書き方以下のような書き方をしているのですが、Scalarnbspみたいなものを宣言せずに書く書き方があれば、ご教授くださると大変ありがたいです。 |
2021-10-24 00:20:52 |
海外TECH |
MakeUseOf |
How to Use Nearby Share to Share Installed Apps on Android |
https://www.makeuseof.com/how-to-use-nearby-share-to-share-installed-apps/
|
android |
2021-10-23 15:30:11 |
海外TECH |
DEV Community |
Calculate Your Code Performance |
https://dev.to/aboss123/calculate-your-code-performance-1hai
|
Calculate Your Code PerformanceBenchmarking your code is a very important step to maintaining good code It does not particularly matter whether the language is fast or slow as each language has its target platform where it needs to do well JavaScript Benchmarking CodeIn JavaScript there is a really simple way to measure the performance of your code and can be rally useful to test easily on the client side of your web browser Let s look at an example function reallyExpensiveFunction for let i i lt i console log Hi n console time reallyExpensiveFunction console timeEnd reallyExpensiveFunction We can bench our functions by using the function console time to start and console timeEnd to end our bench Here is an output you might getYou can try this example on repl it C Benchmarking CodeBelieve it or not the same code in C is very similar to the JavaScript example Let s look at this example include lt stdio h gt include lt time h gt void really expensive function for int i i lt i printf Hi n int main clock t start clock really expensive function clock t end clock printf Took f seconds n float end start CLOCKS PER SEC return clock t is a typedef for long on my machine and is likely the same for yours Despite that you should still use clock t as it may be different on different machines We get the system time before and after the really expensive function and are able to get the amount of time in seconds You can try this example on repl it Here is an output you might get Complex BenchmarkingProfilingWhat does a profiler actually do A program profile gives the developer the ability to be able to measure both space and time complexity of their functions in their program This is particularly important if your program has a major bottleneck causing slowdowns which is especially disastrous if it is a system where many requests are made An example of such a tool is orbit which can visualize the performance points in your program Benchmarking IO OperationsIO operations are ones that take in user input or read or write to system files mainly requiring operations from the operating system kernel These operations are usually the most expensive operations in your program However since time spent in system calls is not manageable by the programmer it is best to reduce the amount of system calls that are made to improve performance Distributed SystemsThese systems are complicated and so it is necessary to make sure that the performance of the system is in check In general this is because each computer is not entirely the same and so it becomes difficult in order to assess performance accurately Different computers have different CPUs network sockets and configurations and these computers interact with routers and other network systems that communicate with each other that impact the way performance is calculated It is best to determine the performance of such systems in a way that gives relative benchmark or a benchmark that is good enough for a team working on it to be able to assess the program ResourcesJavaScript For JavaScript there are already some good tools for benchmarking most notable being Benchmark js and Bench Rest Using these tools will allow you to be able to properly test the performance of your code It is generally given that you want to use software already tested for acceptable benchmarking as the demos shown today are often trivial and may not give all the results you want C C has quite a number of benchmarking libraries some of the recent ones involving C s flexibility The most notable being Google Bench and UT C does not have many specific benchmarking libraries but you can easily integrate C code with C benchmarking libraries in order to test the performance of your C code ConclusionIn the end it s up to you how you choose to benchmark your code Generally you want to code your project before you benchmark it and if performance is really a concern then you can opt to use these benchmarking libraries or use a performance profile to find bottlenecks I hope you learned something today |
2021-10-23 15:40:36 |
海外TECH |
DEV Community |
C++ Programming: Operator Overloading |
https://dev.to/aboss123/c-programming-operator-overloading-2858
|
C Programming Operator OverloadingOperator overloading is one of the special features in C programming The advantages of this feature is that it allows us to apply operators that logically make sense on our custom data structures Let s how they can be used in real world applications Looking at the first use of operator overloading we can see it in std cout using the operator lt lt that is overloaded to print values to our terminal It is used as the following int main std cout lt lt Hello World n lt This is the overloaded operator This is trivial right Most of us use it without giving it much thought but it is important enough that overloading this operator for your own class allows std cout to print user defined classes A real world exampleclass CustomVector float x float y public explicit CustomVector float x float y x x y y bool operator const CustomVector amp vec const return this gt x vec x amp amp this gt y vec y CustomVector operator const CustomVector amp vec const return CustomVector this gt x vec x this gt y vec y So let s breakdown what is actually going on here We have a class called CustomVector and we give it the values of x and y now what do we do with this We don t want to continuously compare the their x values all the time so what we do instead is create on operator overload for the operator to do this for us Writing operator functions is as simple as writing a normal function with the difference in the function name being operator followed by a valid operator to overload In fact C will allow you to overload the new and delete keywords too although this is not generally recommended Applying operators and using std coutAfter our implementation of the operator we can add this line friend std ostream amp operator lt lt std ostream amp s const CustomVector amp vec If you don t know what friend functions or classes are they allow functions and classes to access private variables of a given class Finally we can add our implementation std ostream amp operator lt lt std ostream amp s const CustomVector amp vec s lt lt x lt lt vec x lt lt lt lt y lt lt vec y lt lt return s Brief overview of the parameters shows that we take in an instant of the output stream and an instance of our custom class Not so bad right Checking our resultsNow let s test our code to see it work in action int main CustomVector vec CustomVector f f CustomVector vec CustomVector f f if vec vec std cout lt lt They are equal n else std cout lt lt They are not equal n std cout lt lt Vec lt lt vec lt lt n std cout lt lt Vec lt lt vec lt lt n std cout lt lt Vec lt lt vec vec lt lt n return This is what you should see when you run your code You can play around with this to get a better fell of it here ConclusionOperator overloading can be confusing at times so it is best to take it slow when using this concept Be sure to use this appropriately as to not write confusing code and make sure that you allow flexibility in the classes you write As with many things in C it is easy to shoot yourself in the foot when programming so be careful I hope you learned something today from this overview |
2021-10-23 15:32:39 |
海外TECH |
DEV Community |
You can use your database as a simple calculator |
https://dev.to/wangonya/you-can-use-your-database-as-a-simple-calculator-3fdi
|
You can use your database as a simple calculatorSaw this in the MySQL docs I m assuming this only works for relational databases I don t know if it s very useful but definitely interesting MariaDB gt SELECT SIN PI SIN PI row in set sec postgres SELECT SIN PI sin column row |
2021-10-23 15:29:20 |
海外TECH |
DEV Community |
Understanding array.reduce by creating its polyfill |
https://dev.to/0shuvo0/understanding-arrayreduce-by-creating-its-polyfill-4c23
|
Understanding array reduce by creating its polyfillOne of the most complex array method is array reduce So in this article we will learn about the reduce function while making its polyfill A polyfill is a piece of code used to provide modern functionality on older browsers that do not natively support it Okay let s start from the beginning The reduce function takes a callback function So the way we would use it is let arr arr reduce function console log hello Now if we run this you will seehello was printed on console time But notice that our array has elements So the reduce function will be called array length times So we can easily mimic this behaviour by using a simple for loop function myReduce arr cb for let i i lt arr length i cb let arr myReduce arr function console log hello If you run this code you will see the output is the same But this is not that useful So lets move on When the reduce function calls the callback function it also passes some arguments to it Lets console log the first two arguments it receive let arr arr reduce function a b console log a b The output looks really weird At first the value of a was the first element in array and value of b was the second element of our array After that in next function calls the value of a was undefined and the value of b was the next elements in our array What s happening Let s try to return something in our callback function let arr arr reduce function a b console log a b return hello Okay it looks like initially the value of a is the first element of our array after that what ever we return from our callback function the value of a will become that So lets do that in our custom function function myReduce arr cb let a arr for let i i lt arr length i setting the value of a to what ever the call back returns a cb a arr i let arr myReduce arr function a b console log a b return hello Seems like our output is a little different To fix that instead of saying for let i i lt arr length i we can say for let i i lt arr length i function myReduce arr cb let a arr for let i i lt arr length i setting the value of a to what ever the call back returns a cb a arr i let arr myReduce function a b console log a b return hello And now our outputs are the same The reduce function can also take a second argument So let s see what happens if we pass a second argument let arr arr reduce function a b console log a b return hello Hi passing hi as second argumentSo it looks like if we pass a second value to out reduce function the initial value of a will be what we pass after that it will be what we return from the callback function And the value of b will starts from the first element of our array Well then lets add this logic to our custom JS function as well function myReduce arr cb initialVal let a arr let startIdx if initialVal a initialVal startIdx for let i startIdx i lt arr length i setting the value of a to what ever the call back returns a cb a arr i let arr myReduce arr function a b console log a b return hello Hi Okay we are doing progress Now our array reduce function also returns something lets console log it let arr let res arr reduce function a b console log a b return hello console log res res it looks like it also returns hello Okay let s try to return something new from the callback function We can return a b So each time the callback function is called the value of b will be added to alet arr let res arr reduce function a b console log a b return a b console log res res Here we can see after the last callback function call value of a was and b was so the callback function returned which means the final value of a will be or and our reduce function is also returning So the reduce function will return the final value of a Now lets make our custom function do that as wellfunction myReduce arr cb initialVal let a arr let startIdx if initialVal a initialVal startIdx for let i startIdx i lt arr length i setting the value of a to what ever the call back returns a cb a arr i return a returning the final value of a let arr let res myReduce arr function a b console log a b return a b console log res res Almost there Now instead of having to say let res myReduce arr I should be able to say arr myReduce To do so we need to add myReduce to arrays prototype Array prototype myReduce function cb initialVal let arr this this is the array on which this function was called let a arr let startIdx if initialVal a initialVal startIdx for let i startIdx i lt arr length i setting the value of a to what ever the call back returns a cb a arr i return a returning the final value of a let arr let res arr myReduce function a b console log a b return a b console log res res And there you go Now you not only know how the reduce function works you have created your own reduce function from scratch Now to polish your skills you can check this link and these examplesGetting the sum of arraylet arr let sum arr reduce function a b return a b or using arrow functionlet sum arr reduce a b gt a b console log sum output Remove duplicates from arraylet arr let newArr arr reduce a b gt if a indexOf b a push b return a console log newArr output Find the largest number in arraylet arr let max arr reduce a b gt if b gt a a b return a console log max output That s all for now Make sure to out check out my other articles ltag user id follow action button background color important color ffffff important border color important ShuvoFollow Frontend Developer and YouTuber Channel link |
2021-10-23 15:16:53 |
Apple |
AppleInsider - Frontpage News |
New MacBook Air renders show possible thin enclosure, notch in display |
https://appleinsider.com/articles/21/10/23/new-macbook-air-renders-show-possible-thin-enclosure-notch-in-display?utm_medium=rss
|
New MacBook Air renders show possible thin enclosure notch in displayRenders showing what could be the MacBook Air have been updated to include details from recent rumors including the loss of the wedge design and the inclusion of the display notch MacBook Air renders via FrontPageTech Apple is expected to refresh the MacBook Air lineup with new chips and a redesign sometime in following after the MacBook Pro updates Following an influx of rumors about the proposed notebook new renders of what the model could look like have been published Read more |
2021-10-23 15:59:13 |
Apple |
AppleInsider - Frontpage News |
Google and Facebook worked to beat Safari's privacy tools |
https://appleinsider.com/articles/21/10/23/google-and-facebook-worked-to-beat-safaris-privacy-tools?utm_medium=rss
|
Google and Facebook worked to beat Safari x s privacy toolsGoogle worked with Facebook to work around Apple s privacy tools in Safari to continue tracking end users an update to an antitrust lawsuit claims with the search company also doing what it could to slow down other regulatory initiatives surrounding privacy A lawsuit was filed against Google in December by a group of attorneys general accusing the search company of engaging in market collusion to rig auctions While the lawsuit largely focuses on a deal between Google and Facebook to cooperate in the online advertising business instead of competing an update accuses the two tech giants of trying to work against initiatives by Apple to help protect the privacy of its users The amended complaint filed on October and first reported by The Register expands on the original claim in a number of directions revealing more ways that Google may have tried to subvert user privacy Read more |
2021-10-23 15:22:50 |
海外TECH |
Engadget |
Hitting the Books: The genetic fluke that enabled us to drink milk |
https://www.engadget.com/hitting-the-books-life-as-we-made-it-beth-shapiro-hachette-book-group-153038211.html?src=rss
|
Hitting the Books The genetic fluke that enabled us to drink milkIt may not contain our recommended daily allowance of Vitamin R but milk ーor quot cow juice quot as it s known on the streets ーis among the oldest known animal products repurposed for human consumption Milk has been a staple of our diets since the th century BC but it wasn t until a fortuitous mutation to the human genome that we were able to properly digest that delicious bovine based beverage In her latest book Life as We Made It How Years of Human Innovation Refined ーand Redefined ーNature author Beth Shapiro takes readers on a journey of scientific discovery explaining how symbiotic relationships between humans and the environment around us have changed ーbut not always for the better Basic BooksExcerpted from Life as We Made It How Years of Human Innovation Refinedーand RedefinedーNature nbsp by Beth Shapiro Copyright Available from Basic Books an imprint of Hachette Book Group Inc The first archaeological evidence that people were dairying dates to around years ago ー years after cattle domestication In Anatolia present day eastern Turkey which is pretty far from the original center of cattle domestication archaeologists recovered milk fat residues from ceramic pots indicating that people were processing milk by heating it up Similar analyses of milk fat proteins in ceramics record the spread of dairying into Europe which appears to have happened simultaneously with the spread of domestic cattle It s not surprising that people began dairying soon after cattle domestication Milk is the primary source of sugar fat vitamins and protein for newborn mammals and as such is evolved expressly to be nutritious It would not have taken much imagination for a cattle herder to deduce that a cow s milk would be just as good for him and his family as it was for her calf The only challenge would have been digesting itーwithout the lactase persistence mutation that is Because lactase persistence allows people to take advantage of calories from lactose it also makes sense that the spread of the lactase persistence mutation and the spread of dairying would be tightly linked If the mutation arose near the start of dairying or was already present in a population that acquired dairying technology the mutation would have given those who had it an advantage over those who did not Those with the mutation would with access to additional resources from milk more efficiently convert animal protein into more people and the mutation would increase in frequency Curiously though ancient DNA has not found the lactase persistence mutation in the genomes of early dairy farmers and the mutation is at its lowest European frequency today in the precise part of the world where dairying began The first dairy farmers were not it seems drinking milk Instead they were processing milk by cooking or fermenting it making cheeses and sour yogurts to remove the offending indigestible sugars If people can consume dairy products without the lactase persistence mutation there must be some other explanation as to why the mutation is so prevalent today And lactase persistence is remarkably prevalent Nearly a third of us have lactase persistence and at least five different mutations have evolvedーall on the same stretch of intron of the MCM geneーthat make people lactase persistent In each case these mutations have gone to high frequency in the populations in which they evolved indicating that they provide an enormous evolutionary advantage Is being able to drink milk in addition to eating cheese and yogurt sufficient to explain why these mutations have been so important The most straightforward hypothesis is that yes the benefit of lactase persistence is tied to lactose the sugar that represents about percent of the calories in milk Only those who can digest lactose have access to these calories which may have been crucial calories during famines droughts and disease Milk may also have provided an important source of clean water which also may have been limited during periods of hardship Another hypothesis is that milk drinking provided access to calcium and vitamin D in addition to lactose the complement of which aids calcium absorption This might benefit particular populations with limited access to sunlight as ultraviolet radiation from sun exposure is necessary to stimulate the body s production of vitamin D However while this might explain the high frequency of lactase persistence in places like northern Europe it cannot explain why populations in relatively sunny climates such as parts of Africa and the Middle East also have high frequencies of lactase persistence Neither this hypothesis nor the more straightforward hypothesis linked to lactase can explain why lactase persistence is at such low frequency in parts of Central Asia and Mongolia where herding pastoralism and dairying have been practiced for millennia For now the jury is still out as to why lactase persistence has reached such high frequencies in so many different parts of the world and why it remains at low frequencies in some regions where dairying is economically and culturally important Ancient DNA has shed some light on when and where the lactase persistence mutation arose and spread in Europe None of the remains from pre Neolithic archaeological sitesーeconomies that relied on hunting and gatheringーhave the lactase persistence mutation None of the ancient Europeans from early farming populations in southern and central Europe people believed to be descended from farmers spreading into Europe from Anatolia had the lactase persistence mutation Instead the oldest evidence of the lactase persistence mutation in Europe is from a year old individual from central Europe Around that same time the mutation is found in a single individual from what is now Sweden and at two sites in northern Spain While these data are sparse the timing is coincident with another major cultural upheaval in Europe the arrival of Asian pastoralists of the Yamnaya culture Perhaps the Yamnaya brought with them not only horses wheels and a new language but an improved ability to digest milk The mystery of lactase persistence in humans highlights the complicated interaction among genes environment and culture The initial increase in frequency of a lactase persistence mutation regardless of in whom it first arose may have happened by chance When the Yamnaya arrived in Europe for example they brought diseaseーspecifically plagueーthat devastated native European populations When populations are small genes can drift quickly to higher frequency regardless of what benefit they might provide If the lactase persistence mutation was already present when plague appeared and populations crashed the mutation s initial increase may have happened surreptitiously When populations recovered dairying was already widespread and the benefit to those with the mutation would have been immediate By domesticating cattle and developing dairying technologies our ancestors created an environment that changed the course of our own evolution We continue to live and evolve in this human constructed niche In our global community produced million metric tons more than billion US gallons of milk percent of which was from cattle The rest comes from a long list of other species that people domesticated within the last years Sheep and goats which together make up around percent of global milk production were first farmed for their milk in Europe around the same time as cattle dairying began Buffaloes were domesticated in the Indus Valley years ago and are today the second largest producer of milk next to cattle producing around percent of the global supply Camels which were domesticated in Central Asia years ago produce around percent of the world s milk supply People also consume milk from horses which were first milked by people of the Botai culture years ago yaks which were domesticated in Tibet years ago donkeys which were domesticated in Arabia or East Africa years ago and reindeer which are still in the process of being domesticated But those are just the most common dairy products Dairy products from more exotic speciesーmoose elk red deer alpacas llamasーcan be purchased and consumed today and rumor has it that Top Chef s Edward Lee is working out how to make pig milk ricotta should one want to try such a thing |
2021-10-23 15:30:38 |
海外TECH |
Engadget |
T-Mobile postpones Sprint 3G shutdown to March 31st, 2022 |
https://www.engadget.com/t-mobile-sprint-3g-cdma-shutdown-delay-151546831.html?src=rss
|
T Mobile postpones Sprint G shutdown to March st T Mobile will wait a while longer to shut down Sprint s G network The Vergereports T Mobile has delayed the CDMA network shutdown from January st to March st of that year The carrier pinned the delay on quot partners quot who hadn t quot followed through quot on helping their customers transition to newer network technology This would supposedly give partners quot every opportunity quot to fulfill their obligations quot There should be no more room for excuses quot T Mobile said The explanation appears to be a not so subtle attempt to pin the blame on Dish The satellite TV provider bought Boost Mobile from T Mobile in July and planned to use Sprint s legacy network until it could move Boost customers to its G service Dish argued this didn t give it enough time to migrate its customers and accused T Mobile of anti competitive behavior meant to push Boost exiles to T Mobile This may be a response to both Dish s original accusation and the ensuing fallout The Justice Department told Dish and T Mobile in July that it had serious concerns about the Sprint network shutdown asking the two companies to do whatever was necessary to lessen the blow The delay might address those worries and reduce the chances of more serious government scrutiny A delayed shutdown still isn t ideal T Mobile expects to shutter Sprint s LTE network on June th This leaves a three month window where Boost customers might have LTE access but nothing else While you ll probably have made a decision by the March cutoff if you re a customer this won t be a very gradual shift for some users ーthey ll have just a short period of limited Boost service before they have to embrace G |
2021-10-23 15:15:46 |
海外TECH |
CodeProject Latest Articles |
The Software Rewrite |
https://www.codeproject.com/Articles/5283862/The-Software-Rewrite
|
heart |
2021-10-23 15:25:00 |
北海道 |
北海道新聞 |
日本ハム「令和の怪物」崩せず ロッテ佐々木朗に11三振喫す |
https://www.hokkaido-np.co.jp/article/603478/
|
日本ハム |
2021-10-24 00:03:58 |
コメント
コメントを投稿