IT |
MOONGIFT |
Birthday.report - シンプルな誕生日カレンダー |
http://feedproxy.google.com/~r/moongift/~3/1--2IViaepo/
|
Birthdayreportの使い方名前と誕生日を登録しておいて、カレンダーで一覧するだけのシンプルなUIです。 |
2021-04-30 21:00:00 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
株価分析(RSI) |
https://qiita.com/mahoutsukaino-deshi/items/ebe897c06e8f71851a24
|
このときのRSI計算期間は日、RSI上限値が、RSI下限値がとなっています。 |
2021-04-30 20:16:56 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
html+javascriptだけで実装されたシンプルなQRコードリーダー |
https://qiita.com/murasuke/items/c16e4f15ac4436ed2744
|
QRコード認識で必要なイメージを、videoから作成するために利用します。 |
2021-04-30 20:30:25 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
セルの横幅を可変にして縦が固定されたテーブル |
https://teratail.com/questions/335982?rss=all
|
セルの横幅を可変にして縦が固定されたテーブルこんな感じのテーブルを作ったのですが自分のCSS周りの知識が乏しいせいかいまいち思う様な形のテーブルになりません。 |
2021-04-30 20:52:55 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
複数のサーバーにリクエストを送る際のproxyの設定について |
https://teratail.com/questions/335981?rss=all
|
複数のサーバーにリクエストを送る際のproxyの設定についてNuxtjsで個人的にアプリの開発をしています。 |
2021-04-30 20:48:30 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
gradleのpluginとdependenciesの関係性が分からない |
https://teratail.com/questions/335980?rss=all
|
gradleのpluginとdependenciesの関係性が分からない以下の通り記述でpluginsにspringを指定しないとCouldnbspnotnbspfindnbsporgspringframeworkbootspringbootstarterこのようにエラーとなり、依存関係を解決することができません。 |
2021-04-30 20:46:12 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
for文でヒートマップを繰り返し生成したいが、結果が重なってしまう |
https://teratail.com/questions/335979?rss=all
|
for文でヒートマップを繰り返し生成したいが、結果が重なってしまう前提・実現したいこと特定のディレクトリにある複数ファイルをヒートマップにし、画像として出力したいディレクトリには、ファイルほどあるため、ヒートマップ⇒出力まで自動化したい発生している問題・エラーメッセージディレクトリにあるファイル数分、結果が出力されているものの・・・ヒートマップ上の数値が被っていて見えないx軸の番号も二重になっている該当のソースコード使用言語はPython※for文の中に全ての処理を入れています。 |
2021-04-30 20:32:39 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
VScodeでhtmlのタグ補完機能が動作しない。 |
https://teratail.com/questions/335978?rss=all
|
VScodeでhtmlのタグ補完機能が動作しない。 |
2021-04-30 20:32:27 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
Pythonのtkinterのspinboxやcomboboxの表示と値に関して |
https://teratail.com/questions/335977?rss=all
|
Pythonのtkinterのspinboxやcomboboxの表示と値に関して現在、Pythonでtikinterを用いてGUI開発に挑戦しています。 |
2021-04-30 20:22:01 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
jQuery 親要素をもう一度表示したいのですが、 |
https://teratail.com/questions/335976?rss=all
|
jQuery親要素をもう一度表示したいのですが、前提・実現したいこと子要素をクリックすると、親要素を複製したいのですが、この方法だと非効率のため、何かいい方法があれば、ご教示お願い致します。 |
2021-04-30 20:16:28 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
一年ぶりにVScodeでjavaを実行しようとしたら実行できない |
https://teratail.com/questions/335975?rss=all
|
|
2021-04-30 20:15:56 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
初の質問です.javaの課題で、大学で少し前からjavaを始めたばかりの初心者です。 |
https://teratail.com/questions/335974?rss=all
|
初の質問ですjavaの課題で、大学で少し前からjavaを始めたばかりの初心者です。 |
2021-04-30 20:09:39 |
Git |
Gitタグが付けられた新着投稿 - Qiita |
絵で分かる git push --force-with-lease |
https://qiita.com/culage/items/026032cde7966e2fa9d1
|
gitpushforcewithleaseは絶対安全ではない。 |
2021-04-30 20:50:33 |
技術ブログ |
Developers.IO |
AWSの監視系サービスが一気に学べる公式ワークショップに新コンテンツが追加されたのでやってみた |
https://dev.classmethod.jp/articles/observability-workshop-new-contents-prometheus-grafana-and-opentelemetry/
|
awsoneo |
2021-04-30 11:41:47 |
海外TECH |
DEV Community |
Concurrency in modern programming languages: Java |
https://dev.to/deepu105/concurrency-in-modern-programming-languages-java-3l2c
|
Concurrency in modern programming languages JavaOriginally published at deepu tech Please follow me on Twitter for updates and let me know what can be improved in the post This is a multi part series where I ll be talking about concurrency in modern programming languages and will be building and benchmarking a concurrent web server inspired by the example from the Rust book in popular languages like Rust Go JavaScript NodeJS TypeScript Deno Kotlin and Java to compare concurrency and its performance between these languages platforms The chapters of this series are as below IntroductionConcurrent web server in RustConcurrent web server in GolangConcurrent web server in JavaScript with NodeJSConcurrent web server in TypeScript with DenoConcurrent web server in Java with JVMConcurrent web server in Kotlin with JVMComparison and conclusion of benchmarks Concurrency in JavaThe Java programming language and the Java virtual machine JVM have been designed to support concurrent programming and all execution takes place in the context of threadsWikipediaJava had support for concurrent programming from its early days Prior to Java it even had support for green threads virtual threads Spoiler Alert It s coming back again with Project Loom Concurrent programming has always been at the core of Java as it was aimed at multi threaded and multi core CPUs While not as simple as goroutines to use it was powerful and flexible for almost any use case While powerful it s also quite complex especially when you have to access data between threads since the default mechanism in Java due to its OOP roots is to use shared state concurrency by synchronizing the threads Threads are at the core of concurrent amp asynchronous programming in Java From JDK onwards these threads would map to OS threads Due to its early inception the ecosystem has really mature libraries as well from HTTP servers to concurrent message processors and so on Asynchronous programming caught up a bit late in Java the building blocks were there but it was practically useable only from Java but it has matured as well and now has a great ecosystem with support for reactive programming and asynchronous concurrency Java bought a lot of improvements and simplifications to make it easier to do concurrency For example standard Java APIs like the Stream API even provides a way to do parallel processing easily by just invoking a method call on complex and CPU intensive pipelines With Java it s possible to do multi threaded concurrency or parallel programming as well as asynchronous programming This means as we saw in the first chapter we can mix and match these models to get the best possible performance for any use case Multi threadingJava provides building blocks to create and manage OS threads as part of the standard library and it also provides implementations required for shared state concurrency using locks and synchronization Message passing concurrency is not provided by default but can be done using external libraries like Akka or using an Actor model implementation However due to the memory model it s up to the developer to ensure there are no data races or memory leaks in the concurrent program In order to make multi threading even more efficient Java provides ways to create thread pools and reuse those threads to increase throughput This will become even better once Project loom is released hopefully with Java or Technically Java has one of the most mature ecosystems when it comes to multi threading and most Java frameworks that you would end up using will be making use of it internally for performance improvements Asynchronous processingTechnically asynchronous programming is not part of concurrency but in practice it goes hand in hand for many use cases and improves performance and makes resource usage more efficient In Java asynchronous programming is achieved using the same building blocks as concurrent parallel programming a k a Threads This wasn t very popular in Java before Java due to complexity and let s be honest the lack of things like lambdas functional programming support CompletableFuture and so on The latest versions of Java provide the building blocks required for asynchronous programming with standard interfaces and implementations But do keep in mind that using an asynchronous programming model increases the overall complexity and the ecosystem is still evolving There are also many popular libraries and frameworks like Spring and RxJava that support asynchronous reactive programming Java still doesn t have any syntax sugar for async await though but there are alternatives like the EA Async library that s close enough BenchmarkingNow that we have some basic understanding of concurrency features in Java let us build a simple concurrent web server in Java Since Java offers multiple ways to achieve this we ll be building two sample applications and comparing them The Java version used is the latest at the time of writing Multi threaded concurrent webserverThis example is closer to the Rust multi threaded example we built in the rust chapter I have omitted import statements for brevity You can find the full example on GitHub here We use java net ServerSocket for this We are not using any external dependency in this case public class JavaHTTPServer public static void main String args var count count used to introduce delays bind listener try var serverSocket new ServerSocket System out println Server is listening on port while true count listen to all incoming requests and spawn each connection in a new thread new ServerThread serverSocket accept count start catch IOException ex System out println Server exception ex getMessage class ServerThread extends Thread private final Socket socket private final int count public ServerThread Socket socket int count this socket socket this count count Override public void run var file new File hello html try get the input stream var in new BufferedReader new InputStreamReader socket getInputStream get character output stream to client for headers var out new PrintWriter socket getOutputStream get binary output stream to client for requested data var dataOut new BufferedOutputStream socket getOutputStream var fileIn new FileInputStream file add second delay to every th request if count System out println Adding delay Count count Thread sleep read the request first to avoid connection reset errors while true String requestLine in readLine if requestLine null requestLine length break read the HTML file var fileLength int file length var fileData new byte fileLength fileIn read fileData var contentMimeType text html send HTTP Headers out println HTTP OK out println Content type contentMimeType out println Content length fileLength out println Connection keep alive out println blank line between headers and content very important out flush flush character output stream buffer dataOut write fileData fileLength write the file data to output stream dataOut flush catch Exception ex System err println Error with exception ex As you can see we bind a TCP listener using ServerSocket to port and listen to all incoming requests Each request is processed in a new thread Let us run a benchmark using ApacheBench We will make requests with concurrent requests ❯ab c n This is ApacheBench Version lt Revision gt Document Path Document Length bytesConcurrency Level Time taken for tests secondsComplete requests Failed requests Total transferred bytesHTML transferred bytesRequests per second sec mean Time per request ms mean Time per request ms mean across all concurrent requests Transfer rate Kbytes sec receivedConnection Times ms min mean sd median maxConnect Processing Waiting Total Percentage of the requests served within a certain time ms longest request As you can see the request handler thread sleeps for seconds for every th request In a real world scenario the thread pool itself could become the bottleneck and you may not be able to set so many threads as the OS may not be able to provide so many thus creating increased resource usage and bottleneck In this simple use case since each thread spawns and processes the request really fast we won t encounter an issue So let s see if we can have another solution without such a bottleneck Asynchronous concurrent webserverThis example is closer to the asynchronous example from the rust chapter I have omitted import statements for brevity You can find the full example on GitHub here Notice that we are using java nio channels AsynchronousServerSocketChannelhere and no external dependencies public class JavaAsyncHTTPServer public static void main String args throws Exception new JavaAsyncHTTPServer start Thread currentThread join Wait forever private void start throws IOException we shouldn t use try with resource here as it will kill the stream var server AsynchronousServerSocketChannel open server bind new InetSocketAddress bind listener server setOption StandardSocketOptions SO REUSEADDR true System out println Server is listening on port final int count count used to introduce delays listen to all incoming requests server accept null new CompletionHandler lt gt Override public void completed final AsynchronousSocketChannel result final Object attachment if server isOpen server accept null this count handleAcceptConnection result count Override public void failed final Throwable exc final Object attachment if server isOpen server accept null this System out println Connection handler error exc private void handleAcceptConnection final AsynchronousSocketChannel ch final int count var file new File hello html try var fileIn new FileInputStream file add second delay to every th request if count System out println Adding delay Count count Thread sleep if ch null amp amp ch isOpen Read the first bytes of data from the stream final ByteBuffer buffer ByteBuffer allocate read the request fully to avoid connection reset errors ch read buffer get read the HTML file var fileLength int file length var fileData new byte fileLength fileIn read fileData send HTTP Headers var message HTTP OK n Connection keep alive n Content length fileLength n Content Type text html charset utf r n r n new String fileData StandardCharsets UTF getBytes write the to output stream ch write ByteBuffer wrap message get buffer clear ch close catch IOException InterruptedException ExecutionException e System out println Connection handler error e As you can see we bind an asynchronous listener to port and listen to all incoming requests Each request is processed in a new task provided by AsynchronousServerSocketChannel We are not using any thread pools here and all the incoming requests are processed asynchronously and hence we don t have a bottleneck for maximum connections But one thing you may immediately notice is that the code is much more complex now Let us run a benchmark using ApacheBench We will make requests with concurrent requests ab c n This is ApacheBench Version lt Revision gt Document Path Document Length bytesConcurrency Level Time taken for tests secondsComplete requests Failed requests Total transferred bytesHTML transferred bytesRequests per second sec mean Time per request ms mean Time per request ms mean across all concurrent requests Transfer rate Kbytes sec receivedConnection Times ms min mean sd median maxConnect Processing Waiting Total Percentage of the requests served within a certain time ms longest request We got almost identical results here this one is even faster by ms Hence this version seems much more efficient than the multi threaded version for this particular use case However at the cost of added complexity ConclusionAs I explained in the first part of this serious this simple benchmarking is not an accurate representation for all concurrency use cases It s a simple test for a very particular use case a simple concurrent web server that just serves a file The idea is to see the differences in solutions and to understand how concurrency works in Java And for this particular use case asynchronous solutions do seem to be the best choice So stay tuned for the next post where we will look at concurrency in Kotlin and build the same use case in Kotlin Referencesblogs oracle comdzone comwww vogella comdzone comwww baeldung comdzone comwww baeldung comIf you like this article please leave a like or a comment You can follow me on Twitter and LinkedIn Cover image credit Photo by Evgeniya Litovchenko on Unsplash |
2021-04-30 11:42:20 |
海外TECH |
DEV Community |
What is Stored Procedure in SQL |
https://dev.to/abdurrehmaan/what-is-stored-procedure-in-sql-4g9b
|
What is Stored Procedure in SQLThe new capabilities provided by stored procedures require new disciplines for MySQL developers only some of whom will have prior experience in stored program development using other relational databases what is store procedure Stored Procedures are pre compiled code which compiled for first time and its compiled format is saved we call the compiled saved format whenever we want How to create store procedure in sql Stored Procedure Syntax CREATE PROCEDURE procedure nameASsql statementGO Execute a Stored Procedure EXEC procedure name |
2021-04-30 11:37:21 |
Apple |
AppleInsider - Frontpage News |
European Commission says Apple is in breach of EU competition law |
https://appleinsider.com/articles/21/04/30/european-commission-says-apple-is-in-breach-of-eu-competition-law?utm_medium=rss
|
European Commission says Apple is in breach of EU competition law April The European Commission has announced its preliminary conclusion that Apple is in breach of EU competition laws over the App Store As previously predicted the European Commission has concluded that the App Store is in breach of European Union laws Read more |
2021-04-30 11:37:44 |
海外TECH |
Engadget |
YouTube is testing SoundCloud-like timestamped comments |
https://www.engadget.com/youtube-testing-timed-comments-114419554.html
|
exact |
2021-04-30 11:44:19 |
海外TECH |
Engadget |
The Morning After: New WiFi 6E routers are starting to go on sale |
https://www.engadget.com/linksys-netgear-wifi-6e-tma-113524451.html
|
morning |
2021-04-30 11:35:24 |
金融 |
金融庁ホームページ |
「政府機関・地方公共団体等における業務でのLINE利用状況調査を踏まえた今後のLINEサービス等の利用の際の考え方(ガイドライン)」について公表しました。 |
https://www.fsa.go.jp/news/r2/sonota/20210430-3/20210430-3.html
|
地方公共団体 |
2021-04-30 13:00:00 |
海外ニュース |
Japan Times latest articles |
‘Where are the female managers?’ Japan’s newest foreign CEO asks |
https://www.japantimes.co.jp/news/2021/04/30/business/mitsubishi-chemical-ceo-female-managers/
|
Where are the female managers Japan s newest foreign CEO asksMitsubishi Chemical chief Jean Marc Gilson says in the absence of government intervention he ll push internally and actively promote women when faced with candidates of equal |
2021-04-30 21:14:06 |
海外ニュース |
Japan Times latest articles |
Alexei Navalny’s network crumbling under Kremlin pressure |
https://www.japantimes.co.jp/news/2021/04/30/world/navalny-network-kremlin-pressure/
|
Alexei Navalny s network crumbling under Kremlin pressureThe move seems likely to push resistance to Putin further underground as the Kremlin s yearslong effort to suppress dissent enters a more aggressive phase |
2021-04-30 20:56:20 |
ニュース |
BBC News - Home |
Covid: More than 20 million living in areas with zero deaths |
https://www.bbc.co.uk/news/health-56923757
|
phase |
2021-04-30 11:20:43 |
ニュース |
BBC News - Home |
Julia James: Police community officer died from head injuries |
https://www.bbc.co.uk/news/uk-england-kent-56940075
|
dover |
2021-04-30 11:35:48 |
ニュース |
BBC News - Home |
Benjamin Hannam: Met PC who was neo-Nazi group member is jailed |
https://www.bbc.co.uk/news/uk-england-london-56941544
|
offence |
2021-04-30 11:53:07 |
ニュース |
BBC News - Home |
Noel Clarke: Sky halts work with actor after harassment allegations |
https://www.bbc.co.uk/news/entertainment-arts-56940444
|
future |
2021-04-30 11:24:07 |
ニュース |
BBC News - Home |
Boris Johnson's personal mobile phone number available online for 15 years |
https://www.bbc.co.uk/news/uk-politics-56937889
|
press |
2021-04-30 11:35:55 |
ニュース |
BBC News - Home |
Covid: UK clubbers set to return to Liverpool for trial night |
https://www.bbc.co.uk/news/newsbeat-56943652
|
event |
2021-04-30 11:50:15 |
ニュース |
BBC News - Home |
Brexit: Anger over government's failure to get Norway fishing deal |
https://www.bbc.co.uk/news/uk-politics-56940914
|
shops |
2021-04-30 11:08:55 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
「韓国コスメ」を使う中年女性が、コロナ禍で増えた理由 - News&Analysis |
https://diamond.jp/articles/-/268542
|
newsampampanalysis |
2021-04-30 20:30:00 |
GCP |
Google Cloud Platform Japan 公式ブログ |
インデックスのバックフィル オペレーションの進捗状況を Cloud Spanner で追跡 |
https://cloud.google.com/blog/ja/topics/developers-practitioners/tracking-index-backfill-operation-progress-cloud-spanner/
|
この例では、わかりやすくするためにつのインデックス作成ステートメントのみを示していますが、スキーマ更新オペレーションごとに複数のスキーマ変更ステートメントが存在することもあります。 |
2021-04-30 13:00:00 |
GCP |
Google Cloud Platform Japan 公式ブログ |
Terraform で予測可能なサーバーレス デプロイを実現 |
https://cloud.google.com/blog/ja/topics/developers-practitioners/predictable-serverless-deployments-terraform/
|
たとえば、CloudStorageバケットに依存するCloudRunサービスがある場合、最初にそのバケットが存在する必要がありますが、Terraformがこれを解決します。 |
2021-04-30 12:00:00 |
北海道 |
北海道新聞 |
施設離れた若者、2割が困窮 社会的養護の退所後調査、厚労省 |
https://www.hokkaido-np.co.jp/article/539407/
|
社会的養護 |
2021-04-30 20:11:00 |
北海道 |
北海道新聞 |
ガガさん愛犬強奪、5人を逮捕 殺人未遂容疑、2匹届けた女も |
https://www.hokkaido-np.co.jp/article/539405/
|
殺人未遂 |
2021-04-30 20:09:00 |
北海道 |
北海道新聞 |
佳子さま、非常勤嘱託で就職へ 全日本ろうあ連盟 |
https://www.hokkaido-np.co.jp/article/539404/
|
佳子さま |
2021-04-30 20:05:00 |
北海道 |
北海道新聞 |
道内3月の有効求人倍率0・96倍 15カ月連続減 |
https://www.hokkaido-np.co.jp/article/539403/
|
北海道労働局 |
2021-04-30 20:03:00 |
IT |
週刊アスキー |
ソニーによる次世代クリエイターとのアイデア共創プログラム「U24 CO-CHALLENGE」若者のアイデアを”体験”してみた |
https://weekly.ascii.jp/elem/000/004/053/4053541/
|
ucochallenge |
2021-04-30 20:15:00 |
GCP |
Cloud Blog JA |
インデックスのバックフィル オペレーションの進捗状況を Cloud Spanner で追跡 |
https://cloud.google.com/blog/ja/topics/developers-practitioners/tracking-index-backfill-operation-progress-cloud-spanner/
|
この例では、わかりやすくするためにつのインデックス作成ステートメントのみを示していますが、スキーマ更新オペレーションごとに複数のスキーマ変更ステートメントが存在することもあります。 |
2021-04-30 13:00:00 |
GCP |
Cloud Blog JA |
Terraform で予測可能なサーバーレス デプロイを実現 |
https://cloud.google.com/blog/ja/topics/developers-practitioners/predictable-serverless-deployments-terraform/
|
たとえば、CloudStorageバケットに依存するCloudRunサービスがある場合、最初にそのバケットが存在する必要がありますが、Terraformがこれを解決します。 |
2021-04-30 12:00:00 |
コメント
コメントを投稿