「message」を含む日記 RSS

はてなキーワード: messageとは

2019-09-24

グレタ・トゥーンベリ氏 スピーチ全訳 How dare you!

グレタ・トゥーンベリ氏のU.N. Climate Action Summit 2019におけるスピーチ話題になってるわね。

ブコメかに言いたいこともあるけれど、それよりNHKの全訳(https://www3.nhk.or.jp/news/html/20190924/k10012095931000.html)がなんかしっくりこないので、自分で訳してみたわ。

ごめん嘘。バズると思って訳し始めたらNHKの方がずっと早かったの(よくもそんなことができますね!)。せっかくだから書き上げたわ。でもしっくりこないのは本当よ。

私のメッセージ(※1)はこうです。”私たちあなた方を見ています

My message is that we'll be watching you.

これは何もかも間違っています。私はここにいるべきではありません。私は海の向こうの学校に帰るべきです。しかし、あなた方はみんな、私たち若者希望を求めてやってきます。よくもそんなことができますね!

This is all wrong. I shouldn't be up here. I should be back in school on the other side of the ocean. Yet you all come to us young people for hope. How dare you!

あなた方は私の夢を、私の子時代を、その空虚言葉によって奪い去りました。それでも私は幸運な方です。人々は傷ついています。人々は死んでいます生態系完膚なきまでに崩壊しつつあります。我々は大量絶滅の始まりにいるのです。なのにあなた方が話すことと言えばお金のことや永遠に続く経済成長というおとぎ話ばかり。よくもそんなことが言えますね!

You have stolen my dreams and my childhood with your empty words. And yet I'm one of the lucky ones. People are suffering. People are dying. Entire ecosystems are collapsing. We are in the beginning of a mass extinction. And all you can talk about is money and fairy tales of eternal economic growth. How dare you!

過去30年以上、科学事実はずっと明確なままでした。よくも目をそらし続けられたものですね。よくもここに来て、”私は十分にやった”などと言えたものですね。必要政策解決策もいまだに見えてこないというのに。

For more than 30 years, the science has been crystal clear. How dare you continue to look away and come here saying that you're doing enough, when the politics and solutions needed are still nowhere in sight.

あなた方は言います私たち言葉を聞いていると。緊急性は理解していると。しかし、どれだけ私が悲しみ、怒っていたとしても、私はその言葉を信じたくはありません。なぜならば、もしもあなた方が本当に状況を理解しており、それにもかかわらず行動を起こしていないとすれば、あなた方は邪悪な人々ということになってしまうからです。だからこそ、私はそう信じることを拒絶します。

You say you hear us and that you understand the urgency. But no matter how sad and angry I am, I do not want to believe that. Because if you really understood the situation and still kept on failing to act, then you would be evil. And that I refuse to believe.

一般的な考えとして、世界の(二酸化炭素)排出量を10年間で半分にするというものがあります。これによって気温上昇を1.5℃に抑えられる確率わずか50%に過ぎず、人類の手に負えない不可逆的な連鎖反応が始まるリスクは依然としてあります

The popular idea of cutting our emissions in half in 10 years only gives us a 50% chance of staying below 1.5 degrees [Celsius], and the risk of setting off irreversible chain reactions beyond human control.

50%という数字あなた方にとっては許容できるものかもしれません。しかし、この数字は転換点(※2)の存在や、多くのフィードバックループ大気汚染に隠れたさらなる温暖化公平性気候正義(※3)の観点を含んでいません。それらはまた私たち世代が、あなた方の出した数千億トンの二酸化炭素を、ほとんど実現すらしていない技術で以て大気から取り除くことをあてにしているのです。

Fifty percent may be acceptable to you. But those numbers do not include tipping points, most feedback loops, additional warming hidden by toxic air pollution or the aspects of equity and climate justice. They also rely on my generation sucking hundreds of billions of tons of your CO2 out of the air with technologies that barely exist.

50%のリスク私たちにとって到底受け入れられるものではないのです。私たちはその結果と共に生きていかなければならないのですから

So a 50% risk is simply not acceptable to us — we who have to live with the consequences.

[気候変動に関する政府間パネル]による最も分のよい試算では、67%の確率で気温上昇を1.5℃以下にするために、世界全体で許される二酸化炭素排出量は2018年1月1日以降で420ギガトンまでです。今日(2019年9月24日)、既にその数字は350ギガトンを割っています

To have a 67% chance of staying below a 1.5 degrees global temperature rise – the best odds given by the [Intergovernmental Panel on Climate Change] – the world had 420 gigatons of CO2 left to emit back on Jan. 1st, 2018. Today that figure is already down to less than 350 gigatons.

よくも”今まで通りのやり方”や何かしらの技術解決できるなどと嘯けますね。今の排出レベルでは、残りの350ギガトン猶予も8年半以内で使い切ることになります

How dare you pretend that this can be solved with just 'business as usual' and some technical solutions? With today's emissions levels, that remaining CO2 budget will be entirely gone within less than 8 1/2 years.

今日ここにいたるまで、これらのデータに沿った解決法も計画もまったくありません。なぜなら、これらの数字は非常に不愉快であり、あなた方はそのことをありのままに伝えられるほど成熟していないからです。

There will not be any solutions or plans presented in line with these figures here today, because these numbers are too uncomfortable. And you are still not mature enough to tell it like it is.

あなた方は私たち裏切り続けています。そして若者たちはあなた方の裏切りに気付き始めています未来世代の目はすべて、あなた方に注がれています。そして、もしあなた方が私たちを裏切ることを選ぶのなら、私は言います。”私たちあなた方を許さないでしょう”

You are failing us. But the young people are starting to understand your betrayal. The eyes of all future generations are upon you. And if you choose to fail us, I say: We will never forgive you.

私たちあなた方を逃がしません。今この場所、今この時から私たちは線を引きます世界は目覚めつつあります。そして、あなた方の好むと好まざるとにかかわらず、変化もまた訪れるのです。

We will not let you get away with this. Right here, right now is where we draw the line. The world is waking up. And change is coming, whether you like it or not.

ありがとうございました。

Thank you.

※1 これは「世界指導者たちへ向けてのメッセージはありますか?」という司会から質問を受けて始まるスピーチなので、話の相手方大人たち全般ではないことに注意が必要よ。

※2 Tipping pointNHKの方にも注釈があるけれど、気候変動が急転するポイントのことよ。具体的には正のフィードバックループが止められなくなったりする気温だったりするわね。例えば、気温が上がれば水蒸気が増える、水蒸気が増えれば温室効果がアップ、そしてさらに……、といった具合。演説中で触れられていた1.5℃の温度上昇もtipping pointの一つよ。

※3 Climate justice:「先進国が出した二酸化炭素のせいで温暖化してるのに、途上国しわ寄せが来すぎるのはおかしいだろう。」的な話。先進国(や富裕層)は途上国(や貧困層)に対して温暖化被害の点で責任があるし、対策はそれを踏まえて両者に公平な形で進められるべきであるという考え方よ。多少人権周りの話も絡んでくるので詳細はもっと複雑ね。こっちにも注釈付けた方が良かったんでないのNHKさん。

おまけ

NHK訳の感想

私の訳よりすっきりしてるわよね。私のはちょっとくどいわ。でも邪悪云々の下りは私の方が良く訳せてると思うの。どう?

2019-09-19

"REVOLUTION WILL NOT BE TELEVISED" by Gil Scott-Heron, 1970


You will not be able to stay home, brother

You will not be able to plug in, turn on and cop out

You will not be able to lose yourself on skag and skip out for beer during commercials

Because the revolution will not be televised.

The revolution will not be televised.

The revolution will not be brought to you by Xerox in 4 parts without commercial interruptions

The revolution will not show you pictures of Nixon blowing a bugle and leading a charge by John Mitchell, General Abrams and Mendel Rivers to eat hog maws confiscated from a Harlem sanctuary

The revolution will not be televised.

The revolution will not be brought to you by the Schaefer Award Theatre and will not star Natalie Woods and Steve McQueen or Bullwinkle and Julia

The revolution will not give your mouth sex appeal

The revolution will not get rid of the nubs

The revolution will not make you look five pounds thinner

Because the revolution will not be televised, brother.

There will be no pictures of you and Willie Mae pushing that shopping cart down the block on the dead run

Or trying to slide that color TV into a stolen ambulance

NBC will not be able predict the winner at 8:32 on reports from 29 districts

The revolution will not be televised.

There will be no pictures of pigs shooting down brothers in the instant replay

There will be no pictures of Whitney Young being run out of Harlem on a rail with brand new process

There will be no slow motion or still life of Roy Wilkens strolling through Watts in a Red, Black and Green liberation jumpsuit that he had been saving for just the proper occasion.

The revolution will not be televised.

Green Acres, The Beverly Hillbillies and Hooterville Junction will no longer be so goddamned relevant

And women will not care if Dick finally screwed Jane on Search for Tomorrow

Because Black people will be in the street looking for a brighter day

The revolution will not be televised.

There will be no highlights on the eleven o'clock news

And no pictures of hairy armed women liberationists and Jackie Onassis blowing her nose

The theme song will not be written by Jim Webb or Francis Scott Keys, nor sung by Glen Campbell, Tom Jones, Johnny Cash or Englebert Humperdink

The revolution will not be televised.

The revolution will not be right back after a message about a white tornado, white lightning, or white people

You will not have to worry about a dove in your bedroom, a tiger in your tank, or the giant in your toilet bowl

The revolution will not go better with Coke

The revolution will not fight the germs that may cause bad breath

The revolution will put you in the driver's seat.

The revolution will not be televised

Will not be televised

Will not be televised

Will not be televised

The revolution will be no re-run, brothers

The revolution will be live.

2019-09-04

これをやるだけで上位1%になれるRプログラミングTIPS

Rはプログラミング苦手な人にも覚えやす

が、そのためか、プログラミングの得意な人からしたら「ええ・・・」となるような行動を初学者が取りがちに思える

そこで、とりあえずこれだけ守ってほしいというアドバイスを書きました。

エラーが起きたとき

あれこれするより先にエラーメッセージを読め。ぶっちゃけエラーメッセージを読むだけで上位10%だ

あと、エラーメッセージとWarning messageは違うものからな。行間を読む前に行を読め

エラーメッセージの内容がわからなかったらエラーメッセージをコピペしてググれ

日本語サイト微妙だったとき英語でググれ

Stack Overflowにだいたい同じエラーで困ってる人が既に投稿してる

エラーは生じてないが思い通りの挙動になっていないとき

定義した変数の中身を逐一確認して予定してる内容になってるか確認しろ

試行錯誤しすぎてわけがからなくなったら変数を全部削除して一番上から実行し直せ

変数の全削除は rm(list=ls()) でできる

実行し直してるときに、一行ずつ予定通りの挙動になってるか確認しろ

変数の型を逐一str()関数確認しろ

予定通りの型になっているか特に、因子型と数値型、因子型と文字型の混同で生じるミス多い

原因と思しき箇所の関数の使い方が正しいか確認しろ

ヘルプを見て使い方が合ってるのか確認

関数名 R 」でググれ

いきなりやりたいことを全部書くんじゃなくてデータを縮小 (例えば、一部の日にちのデータ) したり、処理を簡略化して小さいプログラムを作って徐々に拡張しろ

作図が思い通りにできないとき

関数名でググれ

日本語ダメなら英語でググれ

画像検索を使え (google検索の「画像」タブ)

自分が描きたい図に近い画像からそのウェブサイトに飛んでいけ

知らなきゃ検索できないから、よく使う用語は覚えておけ

例えば・・・

group (変数グループ化、例えば「条件毎に折れ線を引く」)

facet (「●●ごとに図を描く」)

alpha (透過度)

tick (目盛り線)

axis (軸)

background (背景)

legend (凡例)

例えば「●●条件毎に線を引きたいけど、geom_line()でどうしたらいいのか?」と思ったら「geom_line group」で検索したら、だいたいやりたいことをやってる画像が出てくるので、それを参考したらいい

検索がうまく引っかからない

日本語ダメだったら英語検索しろ (再掲)

“how to” と入れるとだいたいヒットする

例えば「how to change colors gradient ggplot2」でググると色をグラデーション様に変える方法が出てくる

人に質問するときのコツ

「○○でうまくいきますか?」「〇〇だとダメですか?」と質問してくる人、本当に多いけど、その質問は、以下の2つの理由で良くない

そもそもプログラムなんて同じ目的を達成するのに何通りも答えがあるので、「○○でうまくいきますか?」という質問には「それは書き方次第だなぁ」としか言いようがない

・試せばわかるのだから、人に聞くより実行してみたらいい。エラーの数だけお前は強くなる。エラーを受け取るのを恐れるな

答えやす質問は以下のような形だ

「○○を実行したら、こういうエラーが生じるんですけど、エラーの内容が理解できません」

「○○という形のデータを作りたいんですけど、この処理だとこの形にならないのはどこが原因ですか?」

「○○という処理を行ってくれる関数が探しても見つからないんですけど、ありますか?」

2019-07-10

Privacy Policy

This APP is provided by us at no cost and is intended for use as is.

This page is used to inform app visitors regarding our policies with the collection, use, and disclosure of Personal Information if anyone decided to use our App.

If you choose to use our App, then you agree to the collection and use of information in relation to this policy.

Information Collection and Use

When using the APP, it only collects anonymous usage information to operate, improve and personalize the products. The APP does not collect any Personally Identifiable Information (PII) about you, nor does it match collected anonymous usage data with any 3rd party PII information.

Log Data

We want to inform you that whenever you use our App, in a case of an error in the app we collect data and information (through third party products) on your phone called Log Data. This Log Data may include information such as your device Internet Protocol (“IP”) address, device name, operating system version, the configuration of the app when utilizing our App, the time and date of your use of the App, and other statistics. If you use our app to read or post information on our app, we don't collect any information about your identity. If you identify yourself by sending us an e-mail containing personal information, then the information collected will be solely used to respond to your message. In addition to other information described in this policy, we may collect and share precise location information including the presence of connected devices via bluetooth, through methods such as partner mobile “SDKs”. This information may be used by itself, aggregated, or combined with mobile identifiers (such as IDFAs and Android IDs), and shared with other parties, for purposes related to advertising, attribution (e.g., measuring ad performance), analytics and research. You can remove your consent to having your location data collected by changing the settings on your device (but certain services may lose functionality as a result). You can also control options through your device’s opt-out settings which will: (i) tell advertisers to not use your in-app information from that device to gather information about your interests to target interest-based ads and (ii) inform some partners to halt further data collection and sharing from that device.

Service Providers

We may employ third-party companies and individuals due to the following reasons:

To facilitate our App;

To provide the App on our behalf;

To perform App-related services; or

To assist us in analyzing how our App is used.

We want to inform users of this App that these third parties have access to your Personal Information. The reason is to perform the tasks assigned to them on our behalf. However, they are obligated not to disclose or use the information for any other purpose.

Security

We value your trust in providing us your Personal Information, thus we are striving to use commercially acceptable means of protecting it. But remember that no method of transmission over the internet, or method of electronic storage is 100% secure and reliable, and we cannot guarantee its absolute security.

Links to Other Apps or Websites

This App may contain links to other Apps or Websites. If you click on a third-party link, you will be directed to that app or website. Note that these external apps or sites are not operated by us. Therefore, we strongly advise you to review the Privacy Policy of these apps or websites. We have no control over and assume no responsibility for the content, privacy policies, or practices of any third-party apps or websites or services.

Changes to This Privacy Policy

We may update our Privacy Policy from time to time. Thus, you are advised to review this page periodically for any changes. We will notify you of any changes by posting the new Privacy Policy on this page. These changes are effective immediately after they are posted on this page.

Contact Us

If you have any questions or suggestions about our Privacy Policy, do not hesitate to contact us

This app has no affiliation with Craigslist. Craigslist is a registered trademark of Craigslist, Inc. Please visit Craigslist's privacy policy to better understand their data collection practices and controls that they make available to you.

2019-05-31

"REVOLUTION WILL NOT BE TELEVISED" by Gil Scott-Heron, 1970

You will not be able to stay home, brother

You will not be able to plug in, turn on and cop out

You will not be able to lose yourself on skag and skip out for beer during commercials

Because the revolution will not be televised.

The revolution will not be televised.

The revolution will not be brought to you by Xerox in 4 parts without commercial interruptions

The revolution will not show you pictures of Nixon blowing a bugle and leading a charge by John Mitchell, General Abrams and Mendel Rivers to eat hog maws confiscated from a Harlem sanctuary

The revolution will not be televised.

The revolution will not be brought to you by the Schaefer Award Theatre and will not star Natalie Woods and Steve McQueen or Bullwinkle and Julia

The revolution will not give your mouth sex appeal

The revolution will not get rid of the nubs

The revolution will not make you look five pounds thinner

Because the revolution will not be televised, brother.

There will be no pictures of you and Willie Mae pushing that shopping cart down the block on the dead run

Or trying to slide that color TV into a stolen ambulance

NBC will not be able predict the winner at 8:32 on reports from 29 districts

The revolution will not be televised.

There will be no pictures of pigs shooting down brothers in the instant replay

There will be no pictures of Whitney Young being run out of Harlem on a rail with brand new process

There will be no slow motion or still life of Roy Wilkens strolling through Watts in a Red, Black and Green liberation jumpsuit that he had been saving for just the proper occasion.

The revolution will not be televised.

Green Acres, The Beverly Hillbillies and Hooterville Junction will no longer be so goddamned relevant

And women will not care if Dick finally screwed Jane on Search for Tomorrow

Because Black people will be in the street looking for a brighter day

The revolution will not be televised.

There will be no highlights on the eleven o'clock news

And no pictures of hairy armed women liberationists and Jackie Onassis blowing her nose

The theme song will not be written by Jim Webb or Francis Scott Keys, nor sung by Glen Campbell, Tom Jones, Johnny Cash or Englebert Humperdink

The revolution will not be televised.

The revolution will not be right back after a message about a white tornado, white lightning, or white people

You will not have to worry about a dove in your bedroom, a tiger in your tank, or the giant in your toilet bowl

The revolution will not go better with Coke

The revolution will not fight the germs that may cause bad breath

The revolution will put you in the driver's seat.

The revolution will not be televised

Will not be televised

Will not be televised

Will not be televised

The revolution will be no re-run, brothers

The revolution will be live.

2019-04-18

Privacy Policy

ABW Coin built the MathX for Math Learner app as a Free app. This APP is provided by ABW Coin at no cost and is intended for use as is.

This page is used to inform app visitors regarding our policies with the collection, use, and disclosure of Personal Information if anyone decided to use our App.

If you choose to use our App, then you agree to the collection and use of information in relation to this policy.

Information Collection and Use

When using the APP, it only collects anonymous usage information to operate, improve and personalize the products. The APP does not collect any Personally Identifiable Information (PII) about you, nor does it match collected anonymous usage data with any 3rd party PII information.

Log Data

We want to inform you that whenever you use our App, in a case of an error in the app we collect data and information (through third party products) on your phone called Log Data. This Log Data may include information such as your device Internet Protocol (“IP”) address, device name, operating system version, the configuration of the app when utilizing our App, the time and date of your use of the App, and other statistics. If you use our app to read or post information on our app, we don't collect any information about your identity. If you identify yourself by sending us an e-mail containing personal information, then the information collected will be solely used to respond to your message. In addition to other information described in this policy, we may collect and share precise location information including the presence of connected devices via bluetooth, through methods such as partner mobile “SDKs”. This information may be used by itself, aggregated, or combined with mobile identifiers (such as IDFAs and Android IDs), and shared with other parties, for purposes related to advertising, attribution (e.g., measuring ad performance), analytics and research. You can remove your consent to having your location data collected by changing the settings on your device (but certain services may lose functionality as a result). You can also control options through your device’s opt-out settings which will: (i) tell advertisers to not use your in-app information from that device to gather information about your interests to target interest-based ads and (ii) inform some partners to halt further data collection and sharing from that device.

Service Providers

We may employ third-party companies and individuals due to the following reasons:

To facilitate our App;

To provide the App on our behalf;

To perform App-related services; or

To assist us in analyzing how our App is used.

We want to inform users of this App that these third parties have access to your Personal Information. The reason is to perform the tasks assigned to them on our behalf. However, they are obligated not to disclose or use the information for any other purpose.

Security

We value your trust in providing us your Personal Information, thus we are striving to use commercially acceptable means of protecting it. But remember that no method of transmission over the internet, or method of electronic storage is 100% secure and reliable, and we cannot guarantee its absolute security.

Links to Other Apps or Websites

This App may contain links to other Apps or Websites. If you click on a third-party link, you will be directed to that app or website. Note that these external apps or sites are not operated by us. Therefore, we strongly advise you to review the Privacy Policy of these apps or websites. We have no control over and assume no responsibility for the content, privacy policies, or practices of any third-party apps or websites or services.

Changes to This Privacy Policy

We may update our Privacy Policy from time to time. Thus, you are advised to review this page periodically for any changes. We will notify you of any changes by posting the new Privacy Policy on this page. These changes are effective immediately after they are posted on this page.

Contact Us

If you have any questions or suggestions about our Privacy Policy, do not hesitate to contact us

2019-03-09

GearBestでPCを買った顛末

あらすじ:

GearBestで品物を買った場合高く買った順に発送されるので運良く(悪く?)安く買ういつまでたっても発送されない事態に陥ります

現状3ヶ月経っていますが品物は届いていません。

GearBestは1日以内での質問返答を標榜していまして、以下はそんな私のGearBestの面白い文通の記録です。

----

息子の誕生日にそろそろPCでも買い与えようかと、安いPCを物色しているとGearBestで良さげなPCがあったので

ポチりました。息子の誕生日の2週ほど前です。

所が誕生日を過ぎ推定デリバリータイムになってもぜんぜん送付されませんので問い合わせをしました。

Subject:it's not shiped yet

Message:when I saw the website, it will ship at least 1/7. but it's not ship out yet.

when is it ship out?

返答:

Dear ***,

Thank you for placing your order on GearBest. Please check your order information below.

Remaining items(Not available currently):

Chuwi Lapbook Air CWI529 Notebook 28-Feb-19 Wait or Exchange

Tips for Suggested Options:

※. If you choose to Exchange, please send us the item link with the color and size or product model.

Due to the holidays season coming, it might slow down the outgoing process and the delivery of your order.We kindly ask for your patience regarding this.

2018年に注文したのに、2/28出荷で文句があるなら返金しろだって

そんなに急いでないので待つことにしました。

----

2/28過ぎても出荷されないので再度問い合わせしました。

Subject:注文が出荷されていない

Message:T*****で2019 2/28に出荷されると回答を得たのにまだ出荷されていない。

この注文は2018年に出荷される予定だった。

早く出荷してほしい。

Dear ***,

Thank you for contacting Gearbest.com. We are sorry for the inconvenience we may caused.

Below is your order information.

Remaining items(Not available currently):

Sku*quantity Product Name Estimated Dispatch Time Suggested Options*

* 1

Chuwi Lapbook Air CWI529 Notebook 7-15 business days Wait or Exchange

ええ・・・、2/28に出荷されるっつたのにまたの延期、もう信じられません。

でもまだ信じて受け入れます

-----

一週間後にメッセージを残します。

At 03/08/2019 08:39:14 CST Hey, Please tell me *true* dispatch time.

YOU CAN DISPATCH WITHIN 1 WEEK RIGHT?

返事がきました。

XXX様

ご連絡いただきありがとうございます。ご迷惑をおかけして申し訳ございません。

お客様の注文を今処理していますしかし、下記の商品現在在庫切れとなりましたのでご注意ください。

****1,Chuwi Lapbook Air CWI529 Notebook

この場合、2つの提案があります

案1:商品が利用可能になるまで少しお待ちください。

我々は20-30日間後に入荷予定です。出荷すると、納品の詳細をメールします。これはおおよその日付であり、率直に保証することはできません。

案2:選択した別の商品を交換します。

弊社は多くの素晴らしい製品を選び、お客様が交換品を見つけることができると確信しています選択したい製品リンクをお送りください。注文が更新されます

元の商品との価格差がある場合は、店舗クレジットとしてウォレットで払い戻しするか、差額をカバーする請求書をお送りします。

できるだけ早く商品を受け取るために、本日出荷される商品選択することをお勧めします。

この商品需要が高く、非常に競争力のある価格で、お客様がそれを楽しむことができると確信しているので、それを保つことをお勧めします。

注文を維持するために、出荷後に我々はお客様に次の注文のために使用することができる600ポイント報酬を与えますポイントについてさらに知りたい場合は、以下を参照してください。

http://www.gearbest.com/about/about-points.html

20日~30日遅延!?

あなた達は、今同じ製品を売っています

https://www.gearbest.com/laptops/pp_827413.html?wid=1433363

そのshippingは「Ship between: Mar 18 - Mar 20, Estimated Shipping Time: 5-9 business days

となっています

なぜ先に買った私より今のセールが先に出荷されますか?

その理由を教えて下さい。

私は2018年に注文しています

追記

xxx様

Gearbestにお問い合わせいただきありがとうございます

弊社のサイト掲載されている在庫在庫状況は、参照用です。

最も正確でタイムリーな情報提供するよう努めていますが、カート商品を追加した時点から注文を受け取った時点までに在庫状況が変わることがあります

少しお待ちいただけることを願っております

待たずに変更したくない場合は、払い戻しをすることができます

迷惑をかけて、诚に申し訳ございません。

参照用だそうです。

回答になっていません。

なぜ先に買った私より今のセールが先に出荷されますか?

その理由を教えて下さい。

と聞いています

と書いたけど、これ以上やり取りしても粘着になるだけだと思ったから返金した。

GearBestの高く売れた順に出荷ってのは、短期的には利潤を生むが

これを食らった消費者は安くともシップされないリスクのあるGearBestで購買する意欲は無くなるだろう。

この戦略は長期的に見れば悪手である

2019-01-31

Privacy Policy

FY Creation LLC. built the CLX for Craigslist app as a Free app. This APP is provided by FY Creation LLC at no cost and is intended for use as is.

This page is used to inform app visitors regarding our policies with the collection, use, and disclosure of Personal Information if anyone decided to use our App.

If you choose to use our App, then you agree to the collection and use of information in relation to this policy.

Information Collection and Use

When using the APP, it only collects anonymous usage information to operate, improve and personalize the products. The APP does not collect any Personally Identifiable Information (PII) about you, nor does it match collected anonymous usage data with any 3rd party PII information.

Log Data

We want to inform you that whenever you use our App, in a case of an error in the app we collect data and information (through third party products) on your phone called Log Data. This Log Data may include information such as your device Internet Protocol (“IP”) address, device name, operating system version, the configuration of the app when utilizing our App, the time and date of your use of the App, and other statistics. If you use our app to read or post information on our app, we don't collect any information about your identity. If you identify yourself by sending us an e-mail containing personal information, then the information collected will be solely used to respond to your message. In addition to other information described in this policy, we may collect and share precise location information including the presence of connected devices via bluetooth, through methods such as partner mobile “SDKs”. This information may be used by itself, aggregated, or combined with mobile identifiers (such as IDFAs and Android IDs), and shared with other parties, for purposes related to advertising, attribution (e.g., measuring ad performance), analytics and research. You can remove your consent to having your location data collected by changing the settings on your device (but certain services may lose functionality as a result). You can also control options through your device’s opt-out settings which will: (i) tell advertisers to not use your in-app information from that device to gather information about your interests to target interest-based ads and (ii) inform some partners to halt further data collection and sharing from that device.

Service Providers

We may employ third-party companies and individuals due to the following reasons:

To facilitate our App;

To provide the App on our behalf;

To perform App-related services; or

To assist us in analyzing how our App is used.

We want to inform users of this App that these third parties have access to your Personal Information. The reason is to perform the tasks assigned to them on our behalf. However, they are obligated not to disclose or use the information for any other purpose.

Security

We value your trust in providing us your Personal Information, thus we are striving to use commercially acceptable means of protecting it. But remember that no method of transmission over the internet, or method of electronic storage is 100% secure and reliable, and we cannot guarantee its absolute security.

Links to Other Apps or Websites

This App may contain links to other Apps or Websites. If you click on a third-party link, you will be directed to that app or website. Note that these external apps or sites are not operated by us. Therefore, we strongly advise you to review the Privacy Policy of these apps or websites. We have no control over and assume no responsibility for the content, privacy policies, or practices of any third-party apps or websites or services.

Changes to This Privacy Policy

We may update our Privacy Policy from time to time. Thus, you are advised to review this page periodically for any changes. We will notify you of any changes by posting the new Privacy Policy on this page. These changes are effective immediately after they are posted on this page.

Contact Us

If you have any questions or suggestions about our Privacy Policy, do not hesitate to contact us

This app has no affiliation with Craigslist. Craigslist is a registered trademark of Craigslist, Inc. Please visit Craigslist's privacy policy to better understand their data collection practices and controls that they make available to you.

2019-01-03

anond:20190103184241

// WindowsProject7.cpp: アプリケーションエントリ ポイント定義します。
//

#include "stdafx.h"
#include "WindowsProject7.h"

#define MAX_LOADSTRING 100

// グローバル変数:
HINSTANCE hInst;                                // 現在インターフェイス
WCHAR szTitle[MAX_LOADSTRING];                  // タイトル バーテキスト
WCHAR szWindowClass[MAX_LOADSTRING];            // メイン ウィンドウ クラス名

// このコード モジュールに含まれ関数宣言転送します:
//ATOM                MyRegisterClass(HINSTANCE hInstance);
BOOL                InitInstance(HINSTANCE, int);
LRESULT CALLBACK    WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK    About(HWND, UINT, WPARAM, LPARAM);

#include <list>

class MyWindow;
	
std::list< MyWindow *> windows;

class MyWindow
{
public:

	HWND hWnd;



	MyWindow()
		:hWnd(NULL)
	{
		windows.push_back(this);
	}

	virtual ~MyWindow()
	{
		std::list< MyWindow *>::iterator it;
		for (it = windows.begin(); it != windows.end(); it++)
		{
			if (*it == this)
			{
				windows.erase(it);
				break;
			}
		}
	}

	static MyWindow * find(HWND key)
	{
		std::list< MyWindow *>::iterator it;
		for (it = windows.begin(); it != windows.end(); it++)
		{
			MyWindow *target = *it;

			if (target->hWnd == key)
			{
				return target;
			}

		}

		return NULL;
	}



	//
	//  関数: MyRegisterClass()
	//
	//  目的: ウィンドウ クラス登録します。
	//
	ATOM MyRegisterClass(HINSTANCE hInstance)
	{
		WNDCLASSEXW wcex;

		wcex.cbSize = sizeof(WNDCLASSEX);

		wcex.style = CS_HREDRAW | CS_VREDRAW;
		wcex.lpfnWndProc = WndProc;
		wcex.cbClsExtra = 0;
		wcex.cbWndExtra = 0;
		wcex.hInstance = hInstance;
		wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_WINDOWSPROJECT7));
		wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
		wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
		wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_WINDOWSPROJECT7);
		wcex.lpszClassName = szWindowClass;
		wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));

		return RegisterClassExW(&wcex);
	}

	//
	//   関数: InitInstance(HINSTANCE, int)
	//
	//   目的: インスタンス ハンドルを保存して、メイン ウィンドウ作成します。
	//
	//   コメント:
	//
	//        この関数で、グローバル変数インスタンス ハンドルを保存し、
	//        メイン プログラム ウィンドウ作成および表示します。
	//

	int blocks[100][100];

	BOOL InitInstance()
	{
		hInst = hInstance; // グローバル変数インスタンス処理を格納します。

		ATOM c = MyRegisterClass(hInstance);
		x = 0;
		y = 0;
		boxType = 0;

		hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
			CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);

		for(int x = 0 ; x < 100 ; x++)
		{
			for (int y = 0; y < 100; y++)
			{
				blocks[y][x] = 0;
			}
		}

		if (!hWnd)
		{
			return FALSE;
		}

		return TRUE;
	}

	BOOL ShowWindow()
	{
		BOOL ret;
		ret = ::ShowWindow(hWnd, SW_SHOW);
		::UpdateWindow(hWnd);

		return ret;
	}


	HINSTANCE hInstance;
	MSG msg;
	BOOL run;
	int x;
	int y;
	BOOL Main()
	{

		HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_WINDOWSPROJECT7));
		run = true;
		int rc;
		// メイン メッセージ ループ:
		while (run)
		{
			DWORD obj = MsgWaitForMultipleObjectsEx(0, NULL,  100 , QS_PAINT| QS_ALLEVENTS,0);
			if (obj <= WAIT_OBJECT_0)
			{
				while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
				{
					if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
					{
						TranslateMessage(&msg);
						DispatchMessage(&msg);
					}
					if (msg.message == WM_QUIT) {
						run = FALSE;
					}
					if (msg.message == WM_CLOSE) {
						run = FALSE;
					}

				}
			}
			else if (obj == WAIT_TIMEOUT)
			{
				y++;
				PAINTSTRUCT ps;
				HDC hdc = BeginPaint(hWnd, &ps);
				this->OnPaint(ps);
				EndPaint(hWnd, &ps);
				::UpdateWindow(hWnd);
				RECT Rect2 = { 0,0,48*9,48 * 100 };
				InvalidateRect(hWnd, &Rect2, TRUE);
			}
			else if (obj == WAIT_FAILED)
			{
				rc = GetLastError();
			}
			else {

			}
		}


		return TRUE;

	}

	int boxType;

	BOOL WriteBoxOLDBox()
	{
		int width = 24;

		HDC hdc = GetDC(hWnd);
		HBRUSH hBrush = CreateSolidBrush(RGB(48, 48, 48));
		for (int y = 0; y < 30; y++)
		{
			for (int x = 0; x < 8; x++)
			{
				if (blocks[y][x] == 0)
				{
					continue;
				}

				RECT Rect = { 0,0,48,48 };
				BOOL ret;

				Rect.left = width * x + 1;
				Rect.right = width * (x + 1) - 1;
				Rect.top = width * y + 1;
				Rect.bottom = width * (y + 1) - 1;

				ret = FillRect(hdc, &Rect, hBrush);


			}
		}

		DeleteObject(hBrush);

		return FALSE;
	}


	BOOL WriteBox()
	{
		WriteBoxOLDBox();

		switch (boxType)
		{
		case 0:
			return WriteBoxI();
		case 1:
			return WriteBoxL();
		case 2:
			return WriteBoxZ();

		}

		return TRUE;
	}

	BOOL WriteBoxZ()
	{
		HDC hdc = GetDC(hWnd);
		HBRUSH hBrush = CreateSolidBrush(RGB(48, 48, 246));

		int width = 24;

		RECT Rect = { 0,0,48,48 };
		BOOL ret;

		Rect.left = width * x + 1;
		Rect.right = width * (x + 1) - 1;
		Rect.top = width * y + 1;
		Rect.bottom = width * (y + 1) - 1;

		ret = FillRect(hdc, &Rect, hBrush);


		Rect.top += width;
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);

		Rect.left += width;
		Rect.right += width;
		ret = FillRect(hdc, &Rect, hBrush);

		Rect.top += width;
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);


		DeleteObject(hBrush);

		return TRUE;
	}


	BOOL WriteBoxL()
	{
		HDC hdc = GetDC(hWnd);
		HBRUSH hBrush = CreateSolidBrush(RGB(48, 246 , 48));

		int width = 24;

		RECT Rect = { 0,0,48,48 };
		BOOL ret;

		Rect.left = width * x + 1;
		Rect.right = width * (x + 1) -1 ;
		Rect.top = width * y + 1;
		Rect.bottom = width * (y + 1) -1;

		ret = FillRect(hdc, &Rect, hBrush);


		Rect.top    += width; 
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);

		Rect.top += width;
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);

		Rect.left   += width;
		Rect.right  += width;
		ret = FillRect(hdc, &Rect, hBrush);

		DeleteObject(hBrush);

		return TRUE;
	}

	BOOL WriteBoxI()
	{
		HDC hdc = GetDC(hWnd);
		HBRUSH hBrush = CreateSolidBrush(RGB( 246 , 48 , 48));

		int width = 24;

		RECT Rect = { 0,0,48,48 };
		BOOL ret;

		Rect.left = width * x + 1;
		Rect.right = width * (x + 1) - 1;
		Rect.top = width * y + 1;
		Rect.bottom = width * (y + 1) - 1;

		ret = FillRect(hdc, &Rect, hBrush);


		//Rect.left   += width;
		//Rect.right  += width;
		Rect.top += width;
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);

		Rect.top += width;
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);

		Rect.top += width;
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);

		DeleteObject(hBrush);

		return TRUE;
	}

	BOOL SaveBoxI()
	{
		blocks[y  ][x] = 1;
		blocks[y+1][x] = 1;
		blocks[y+2][x] = 1;
		blocks[y+3][x] = 1;
		return TRUE;
	}


	BOOL OnPaint(PAINTSTRUCT &ps)
	{
		if (x > 8) {
			x = 0;
		}
		if (x <0) {
			x = 8;
		}
		if (y > 20) {
			switch (boxType)
			{
			case 0:
				SaveBoxI();
				break;
			case 1:
				break;
			case 2:
				break;
			}

			y = 0;
			boxType++;
			if (boxType > 2)
			{
				boxType = 0;
			}
		}

		this->WriteBox();

		return TRUE;
	}



	BOOL OnKey(WPARAM wParam)
	{
		if (wParam == VK_LEFT)
		{
			x++;
		}
		if (wParam == VK_RIGHT)
		{
			x--;
		}
		return TRUE;
	}


};


int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPWSTR    lpCmdLine,
                     _In_ int       nCmdShow)
{
    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);

    // TODO: ここにコードを挿入してください。

    // グローバル文字列初期化しています。
    LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
    LoadStringW(hInstance, IDC_WINDOWSPROJECT7, szWindowClass, MAX_LOADSTRING);
    //MyRegisterClass(hInstance);



	MyWindow win;



	win.hInstance = hInstance;

	// アプリケーション初期化を実行します:
	if (!win.InitInstance())
	{
		return FALSE;
	}

	BOOL ret;

	win.ShowWindow();

	ret = win.Main();

	if (ret)
	{
		return 0;
	}else {
		return (int)win.msg.wParam;
	}



}






//
//  関数: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  目的:    メイン ウィンドウメッセージを処理します。
//
//  WM_COMMAND  - アプリケーション メニューの処理
//  WM_PAINT    - メイン ウィンドウの描画
//  WM_DESTROY  - 中止メッセージを表示して戻る
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
    case WM_COMMAND:
        {
            int wmId = LOWORD(wParam);
            // 選択されたメニューの解析:
            switch (wmId)
            {
            case IDM_ABOUT:
                DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
                break;
            case IDM_EXIT:
                DestroyWindow(hWnd);
                break;
            default:
                return DefWindowProc(hWnd, message, wParam, lParam);
            }
        }
		break;
	case WM_KEYDOWN:
		{
			MyWindow *target = MyWindow::find(hWnd);
			target->OnKey(wParam);
		}
	break;
    case WM_PAINT:
        {
            PAINTSTRUCT ps;
            HDC hdc = BeginPaint(hWnd, &ps);

			MyWindow *target = MyWindow::find(hWnd);
			target->OnPaint(ps);


            // TODO: HDC を使用する描画コードをここに追加してください...
            EndPaint(hWnd, &ps);
        }
        break;
    case WM_DESTROY:
        PostQuitMessage(0);
        break;
    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}

// バージョン情報ボックスメッセージ ハンドラーです。
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
    UNREFERENCED_PARAMETER(lParam);
    switch (message)
    {
    case WM_INITDIALOG:
        return (INT_PTR)TRUE;

    case WM_COMMAND:
        if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
        {
            EndDialog(hDlg, LOWORD(wParam));
            return (INT_PTR)TRUE;
        }
        break;
    }
    return (INT_PTR)FALSE;
}

anond:20190103170543

テトリス

落ちてくるブロックの描き方

わかりやす関数化してみた

まずはブロックの種類は3種類

 

WriteBoxLとWriteBoxIとWriteBoxZ

の違いをよく見比べて

自力で違いがわかれば

プログラマーにはなれるとおもう

とはいえ、コレを自力でわかるならもっと儲かる仕事あるとはおもうけどな

 

	BOOL WriteBox()
	{
		switch (boxType)
		{
		case 0:
			return WriteBoxI();
		case 1:
			return WriteBoxL();
		case 2:
			return WriteBoxZ();

		}
	}
// WindowsProject7.cpp: アプリケーションエントリ ポイント定義します。
//

#include "stdafx.h"
#include "WindowsProject7.h"

#define MAX_LOADSTRING 100

// グローバル変数:
HINSTANCE hInst;                                // 現在インターフェイス
WCHAR szTitle[MAX_LOADSTRING];                  // タイトル バーテキスト
WCHAR szWindowClass[MAX_LOADSTRING];            // メイン ウィンドウ クラス名

// このコード モジュールに含まれ関数宣言転送します:
//ATOM                MyRegisterClass(HINSTANCE hInstance);
BOOL                InitInstance(HINSTANCE, int);
LRESULT CALLBACK    WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK    About(HWND, UINT, WPARAM, LPARAM);

#include <list>

class MyWindow;
	
std::list< MyWindow *> windows;

class MyWindow
{
public:

	HWND hWnd;



	MyWindow()
		:hWnd(NULL)
	{
		windows.push_back(this);
	}

	virtual ~MyWindow()
	{
		std::list< MyWindow *>::iterator it;
		for (it = windows.begin(); it != windows.end(); it++)
		{
			if (*it == this)
			{
				windows.erase(it);
				break;
			}
		}
	}

	static MyWindow * find(HWND key)
	{
		std::list< MyWindow *>::iterator it;
		for (it = windows.begin(); it != windows.end(); it++)
		{
			MyWindow *target = *it;

			if (target->hWnd == key)
			{
				return target;
			}

		}

		return NULL;
	}



	//
	//  関数: MyRegisterClass()
	//
	//  目的: ウィンドウ クラス登録します。
	//
	ATOM MyRegisterClass(HINSTANCE hInstance)
	{
		WNDCLASSEXW wcex;

		wcex.cbSize = sizeof(WNDCLASSEX);

		wcex.style = CS_HREDRAW | CS_VREDRAW;
		wcex.lpfnWndProc = WndProc;
		wcex.cbClsExtra = 0;
		wcex.cbWndExtra = 0;
		wcex.hInstance = hInstance;
		wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_WINDOWSPROJECT7));
		wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
		wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
		wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_WINDOWSPROJECT7);
		wcex.lpszClassName = szWindowClass;
		wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));

		return RegisterClassExW(&wcex);
	}

	//
	//   関数: InitInstance(HINSTANCE, int)
	//
	//   目的: インスタンス ハンドルを保存して、メイン ウィンドウ作成します。
	//
	//   コメント:
	//
	//        この関数で、グローバル変数インスタンス ハンドルを保存し、
	//        メイン プログラム ウィンドウ作成および表示します。
	//
	BOOL InitInstance()
	{
		hInst = hInstance; // グローバル変数インスタンス処理を格納します。

		ATOM c = MyRegisterClass(hInstance);
		x = 0;
		y = 0;
		boxType = 0;

		hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
			CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);

		if (!hWnd)
		{
			return FALSE;
		}

		return TRUE;
	}

	BOOL ShowWindow()
	{
		BOOL ret;
		ret = ::ShowWindow(hWnd, SW_SHOW);
		::UpdateWindow(hWnd);

		return ret;
	}


	HINSTANCE hInstance;
	MSG msg;
	BOOL run;
	int x;
	int y;
	BOOL Main()
	{

		HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_WINDOWSPROJECT7));
		run = true;
		int rc;
		// メイン メッセージ ループ:
		while (run)
		{
			DWORD obj = MsgWaitForMultipleObjectsEx(0, NULL,  100 , QS_PAINT| QS_ALLEVENTS,0);
			if (obj <= WAIT_OBJECT_0)
			{
				while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
				{
					if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
					{
						TranslateMessage(&msg);
						DispatchMessage(&msg);
					}
					if (msg.message == WM_QUIT) {
						run = FALSE;
					}
					if (msg.message == WM_CLOSE) {
						run = FALSE;
					}

				}
			}
			else if (obj == WAIT_TIMEOUT)
			{
				y++;
				PAINTSTRUCT ps;
				HDC hdc = BeginPaint(hWnd, &ps);
				this->OnPaint(ps);
				EndPaint(hWnd, &ps);
				::UpdateWindow(hWnd);
				RECT Rect2 = { 0,0,48*9,48 * 8 };
				InvalidateRect(hWnd, &Rect2, TRUE);
			}
			else if (obj == WAIT_FAILED)
			{
				rc = GetLastError();
			}
			else {

			}
		}


		return TRUE;

	}

	int boxType;

	BOOL WriteBox()
	{
		switch (boxType)
		{
		case 0:
			return WriteBoxI();
		case 1:
			return WriteBoxL();
		case 2:
			return WriteBoxZ();

		}
	}

	BOOL WriteBoxZ()
	{
		HDC hdc = GetDC(hWnd);
		HBRUSH hBrush = CreateSolidBrush(RGB(48, 48, 246));

		int width = 24;

		RECT Rect = { 0,0,48,48 };
		BOOL ret;

		Rect.left = width * x + 1;
		Rect.right = width * (x + 1) - 1;
		Rect.top = width * y + 1;
		Rect.bottom = width * (y + 1) - 1;

		ret = FillRect(hdc, &Rect, hBrush);


		Rect.top += width;
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);

		Rect.left += width;
		Rect.right += width;
		ret = FillRect(hdc, &Rect, hBrush);

		Rect.top += width;
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);


		DeleteObject(hBrush);

		return TRUE;
	}


	BOOL WriteBoxL()
	{
		HDC hdc = GetDC(hWnd);
		HBRUSH hBrush = CreateSolidBrush(RGB(48, 48, 246));

		int width = 24;

		RECT Rect = { 0,0,48,48 };
		BOOL ret;

		Rect.left = width * x + 1;
		Rect.right = width * (x + 1) -1 ;
		Rect.top = width * y + 1;
		Rect.bottom = width * (y + 1) -1;

		ret = FillRect(hdc, &Rect, hBrush);


		Rect.top    += width; 
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);

		Rect.top += width;
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);

		Rect.left   += width;
		Rect.right  += width;
		ret = FillRect(hdc, &Rect, hBrush);

		DeleteObject(hBrush);

		return TRUE;
	}

	BOOL WriteBoxI()
	{
		HDC hdc = GetDC(hWnd);
		HBRUSH hBrush = CreateSolidBrush(RGB(48, 48, 246));

		int width = 24;

		RECT Rect = { 0,0,48,48 };
		BOOL ret;

		Rect.left = width * x + 1;
		Rect.right = width * (x + 1) - 1;
		Rect.top = width * y + 1;
		Rect.bottom = width * (y + 1) - 1;

		ret = FillRect(hdc, &Rect, hBrush);


		//Rect.left   += width;
		//Rect.right  += width;
		Rect.top += width;
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);

		Rect.top += width;
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);

		Rect.top += width;
		Rect.bottom += width;
		ret = FillRect(hdc, &Rect, hBrush);

		DeleteObject(hBrush);

		return TRUE;
	}


	BOOL OnPaint(PAINTSTRUCT &ps)
	{
		if (x > 8) {
			x = 0;
		}
		if (x <0) {
			x = 8;
		}
		if (y > 8) {
			y = 0;
			boxType++;
			if (boxType > 2)
			{
				boxType = 0;
			}
		}

		this->WriteBox();

		return TRUE;
	}



	BOOL OnKey()
	{
		x++;
		return TRUE;
	}


};


int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPWSTR    lpCmdLine,
                     _In_ int       nCmdShow)
{
    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);

    // TODO: ここにコードを挿入してください。

    // グローバル文字列初期化しています。
    LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
    LoadStringW(hInstance, IDC_WINDOWSPROJECT7, szWindowClass, MAX_LOADSTRING);
    //MyRegisterClass(hInstance);



	MyWindow win;



	win.hInstance = hInstance;

	// アプリケーション初期化を実行します:
	if (!win.InitInstance())
	{
		return FALSE;
	}

	BOOL ret;

	win.ShowWindow();

	ret = win.Main();

	if (ret)
	{
		return 0;
	}else {
		return (int)win.msg.wParam;
	}



}






//
//  関数: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  目的:    メイン ウィンドウメッセージを処理します。
//
//  WM_COMMAND  - アプリケーション メニューの処理
//  WM_PAINT    - メイン ウィンドウの描画
//  WM_DESTROY  - 中止メッセージを表示して戻る
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
    case WM_COMMAND:
        {
            int wmId = LOWORD(wParam);
            // 選択されたメニューの解析:
            switch (wmId)
            {
            case IDM_ABOUT:
                DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
                break;
            case IDM_EXIT:
                DestroyWindow(hWnd);
                break;
            default:
                return DefWindowProc(hWnd, message, wParam, lParam);
            }
        }
		break;
	case WM_KEYDOWN:
		{
			MyWindow *target = MyWindow::find(hWnd);
			target->OnKey();
		}
	break;
    case WM_PAINT:
        {
            PAINTSTRUCT ps;
            HDC hdc = BeginPaint(hWnd, &ps);

			MyWindow *target = MyWindow::find(hWnd);
			target->OnPaint(ps);


            // TODO: HDC を使用する描画コードをここに追加してください...
            EndPaint(hWnd, &ps);
        }
        break;
    case WM_DESTROY:
        PostQuitMessage(0);
        break;
    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}

// バージョン情報ボックスメッセージ ハンドラーです。
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
    UNREFERENCED_PARAMETER(lParam);
    switch (message)
    {
    case WM_INITDIALOG:
        return (INT_PTR)TRUE;

    case WM_COMMAND:
        if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
        {
            EndDialog(hDlg, LOWORD(wParam));
            return (INT_PTR)TRUE;
        }
        break;
    }
    return (INT_PTR)FALSE;
}

anond:20190101175055

テトリス風?プログラムに向けて

第何回だろうな

キー入力を追加した

まだ、何を押してもブロックが右に移動するだけ(右端にいくと左にワープ

タイマー自動落下

 

でもまぁ ここまでサンプルがあるとほぼテトリスは見えてきた

// WindowsProject7.cpp: アプリケーションエントリ ポイント定義します。
//

#include "stdafx.h"
#include "WindowsProject7.h"

#define MAX_LOADSTRING 100

// グローバル変数:
HINSTANCE hInst;                                // 現在インターフェイス
WCHAR szTitle[MAX_LOADSTRING];                  // タイトル バーテキスト
WCHAR szWindowClass[MAX_LOADSTRING];            // メイン ウィンドウ クラス名

// このコード モジュールに含まれ関数宣言転送します:
//ATOM                MyRegisterClass(HINSTANCE hInstance);
BOOL                InitInstance(HINSTANCE, int);
LRESULT CALLBACK    WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK    About(HWND, UINT, WPARAM, LPARAM);

#include <list>

class MyWindow;
	
std::list< MyWindow *> windows;

class MyWindow
{
public:

	HWND hWnd;



	MyWindow()
		:hWnd(NULL)
	{
		windows.push_back(this);
	}

	virtual ~MyWindow()
	{
		std::list< MyWindow *>::iterator it;
		for (it = windows.begin(); it != windows.end(); it++)
		{
			if (*it == this)
			{
				windows.erase(it);
				break;
			}
		}
	}

	static MyWindow * find(HWND key)
	{
		std::list< MyWindow *>::iterator it;
		for (it = windows.begin(); it != windows.end(); it++)
		{
			MyWindow *target = *it;

			if (target->hWnd == key)
			{
				return target;
			}

		}

		return NULL;
	}



	//
	//  関数: MyRegisterClass()
	//
	//  目的: ウィンドウ クラス登録します。
	//
	ATOM MyRegisterClass(HINSTANCE hInstance)
	{
		WNDCLASSEXW wcex;

		wcex.cbSize = sizeof(WNDCLASSEX);

		wcex.style = CS_HREDRAW | CS_VREDRAW;
		wcex.lpfnWndProc = WndProc;
		wcex.cbClsExtra = 0;
		wcex.cbWndExtra = 0;
		wcex.hInstance = hInstance;
		wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_WINDOWSPROJECT7));
		wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
		wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
		wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_WINDOWSPROJECT7);
		wcex.lpszClassName = szWindowClass;
		wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));

		return RegisterClassExW(&wcex);
	}

	//
	//   関数: InitInstance(HINSTANCE, int)
	//
	//   目的: インスタンス ハンドルを保存して、メイン ウィンドウ作成します。
	//
	//   コメント:
	//
	//        この関数で、グローバル変数インスタンス ハンドルを保存し、
	//        メイン プログラム ウィンドウ作成および表示します。
	//
	BOOL InitInstance()
	{
		hInst = hInstance; // グローバル変数インスタンス処理を格納します。

		ATOM c = MyRegisterClass(hInstance);
		x = 0;
		y = 0;

		hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
			CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);

		if (!hWnd)
		{
			return FALSE;
		}

		return TRUE;
	}

	BOOL ShowWindow()
	{
		BOOL ret;
		ret = ::ShowWindow(hWnd, SW_SHOW);
		::UpdateWindow(hWnd);

		return ret;
	}


	HINSTANCE hInstance;
	MSG msg;
	BOOL run;
	int x;
	int y;
	BOOL Main()
	{

		HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_WINDOWSPROJECT7));
		run = true;
		int rc;
		// メイン メッセージ ループ:
		while (run)
		{
			DWORD obj = MsgWaitForMultipleObjectsEx(0, NULL,  100 , QS_PAINT| QS_ALLEVENTS,0);
			if (obj <= WAIT_OBJECT_0)
			{
				while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
				{
					if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
					{
						TranslateMessage(&msg);
						DispatchMessage(&msg);
					}
					if (msg.message == WM_QUIT) {
						run = FALSE;
					}
					if (msg.message == WM_CLOSE) {
						run = FALSE;
					}

				}
			}
			else if (obj == WAIT_TIMEOUT)
			{
				y++;
				PAINTSTRUCT ps;
				HDC hdc = BeginPaint(hWnd, &ps);
				this->OnPaint(ps);
				EndPaint(hWnd, &ps);
				::UpdateWindow(hWnd);
				RECT Rect2 = { 0,0,48*9,48 * 8 };
				InvalidateRect(hWnd, &Rect2, TRUE);
			}
			else if (obj == WAIT_FAILED)
			{
				rc = GetLastError();
			}
			else {

			}
		}


		return TRUE;

	}

	BOOL OnPaint(PAINTSTRUCT &ps)
	{
		HDC hdc = GetDC(hWnd);
		HBRUSH hBrush = CreateSolidBrush(RGB(48, 48, 246));
		RECT Rect = { 0,0,48,48 };
		Rect.left = 48 * x;
		Rect.right = 48 * (x+1);
		Rect.top = 48 * y;
		Rect.bottom = 48 * (y+1);
		if (x > 8) {
			x = 0;
		}
		if (x <0) {
			x = 8;
		}
		if (y > 8) {
			y = 0;
		}
		BOOL ret = FillRect(ps.hdc, &Rect, hBrush);
		DeleteObject(hBrush);

		return TRUE;
	}

	BOOL OnKey()
	{
		x++;
		return TRUE;
	}


};


int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPWSTR    lpCmdLine,
                     _In_ int       nCmdShow)
{
    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);

    // TODO: ここにコードを挿入してください。

    // グローバル文字列初期化しています。
    LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
    LoadStringW(hInstance, IDC_WINDOWSPROJECT7, szWindowClass, MAX_LOADSTRING);
    //MyRegisterClass(hInstance);



	MyWindow win;



	win.hInstance = hInstance;

	// アプリケーション初期化を実行します:
	if (!win.InitInstance())
	{
		return FALSE;
	}

	BOOL ret;

	win.ShowWindow();

	ret = win.Main();

	if (ret)
	{
		return 0;
	}else {
		return (int)win.msg.wParam;
	}



}






//
//  関数: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  目的:    メイン ウィンドウメッセージを処理します。
//
//  WM_COMMAND  - アプリケーション メニューの処理
//  WM_PAINT    - メイン ウィンドウの描画
//  WM_DESTROY  - 中止メッセージを表示して戻る
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
    case WM_COMMAND:
        {
            int wmId = LOWORD(wParam);
            // 選択されたメニューの解析:
            switch (wmId)
            {
            case IDM_ABOUT:
                DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
                break;
            case IDM_EXIT:
                DestroyWindow(hWnd);
                break;
            default:
                return DefWindowProc(hWnd, message, wParam, lParam);
            }
        }
		break;
	case WM_KEYDOWN:
		{
			MyWindow *target = MyWindow::find(hWnd);
			target->OnKey();
		}
	break;
    case WM_PAINT:
        {
            PAINTSTRUCT ps;
            HDC hdc = BeginPaint(hWnd, &ps);

			MyWindow *target = MyWindow::find(hWnd);
			target->OnPaint(ps);


            // TODO: HDC を使用する描画コードをここに追加してください...
            EndPaint(hWnd, &ps);
        }
        break;
    case WM_DESTROY:
        PostQuitMessage(0);
        break;
    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}

// バージョン情報ボックスメッセージ ハンドラーです。
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
    UNREFERENCED_PARAMETER(lParam);
    switch (message)
    {
    case WM_INITDIALOG:
        return (INT_PTR)TRUE;

    case WM_COMMAND:
        if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
        {
            EndDialog(hDlg, LOWORD(wParam));
            return (INT_PTR)TRUE;
        }
        break;
    }
    return (INT_PTR)FALSE;
}

2019-01-01

anond:20190101174626

こんな感じ

GetMessageの上にタイマーも扱える

MsgWaitForMultipleObjectsExを追加

GetMessageだとタイマーを処理できないのでPeekMessageに変更

>なぜかは ちょっと考えると面白い

Getとき必要なかった 終了処理を追加

msg.message == WM_QUIT

この部分 QUITメッセージが来たら終了する

obj == WAIT_TIMEOUT

タイマーを追加

y++で高さを変更してから

作画を呼ぶ

こんだけ

<が<

>が&GT

&が&

にかわっちゃってるので各自で置換してね

	HINSTANCE hInstance;
	MSG msg;
	BOOL run;
	int y;
	BOOL Main()
	{

		HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_WINDOWSPROJECT7));
		run = true;
		int rc;
		// メイン メッセージ ループ:
		while (run)
		{
			DWORD obj = MsgWaitForMultipleObjectsEx(0, NULL,  100 , QS_PAINT| QS_ALLEVENTS,0);
			if (obj <= WAIT_OBJECT_0)
			{
				while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
				{
					if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
					{
						TranslateMessage(&msg);
						DispatchMessage(&msg);
					}
					if (msg.message == WM_QUIT) {
						run = FALSE;
					}
					if (msg.message == WM_CLOSE) {
						run = FALSE;
					}

				}
			}
			else if (obj == WAIT_TIMEOUT)
			{
				y++;
				PAINTSTRUCT ps;
				HDC hdc = BeginPaint(hWnd, &ps);
				this->OnPaint(ps);
				EndPaint(hWnd, &ps);
				::UpdateWindow(hWnd);
				RECT Rect2 = { 0,0,48,48 * 8 };
				InvalidateRect(hWnd, &Rect2, TRUE);
			}
			else if (obj == WAIT_FAILED)
			{
				rc = GetLastError();
			}
			else {

			}
		}

anond:20190101172100

タイマーを使ったアニメーションを付けた

// WindowsProject7.cpp: アプリケーションエントリ ポイント定義します。
//

#include "stdafx.h"
#include "WindowsProject7.h"

#define MAX_LOADSTRING 100

// グローバル変数:
HINSTANCE hInst;                                // 現在インターフェイス
WCHAR szTitle[MAX_LOADSTRING];                  // タイトル バーテキスト
WCHAR szWindowClass[MAX_LOADSTRING];            // メイン ウィンドウ クラス名

// このコード モジュールに含まれ関数宣言転送します:
//ATOM                MyRegisterClass(HINSTANCE hInstance);
BOOL                InitInstance(HINSTANCE, int);
LRESULT CALLBACK    WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK    About(HWND, UINT, WPARAM, LPARAM);

#include <list>

class MyWindow;
	
std::list< MyWindow *> windows;

class MyWindow
{
public:

	HWND hWnd;



	MyWindow()
		:hWnd(NULL)
	{
		windows.push_back(this);
	}

	virtual ~MyWindow()
	{
		std::list< MyWindow *>::iterator it;
		for (it = windows.begin(); it != windows.end(); it++)
		{
			if (*it == this)
			{
				windows.erase(it);
				break;
			}
		}
	}

	static MyWindow * find(HWND key)
	{
		std::list< MyWindow *>::iterator it;
		for (it = windows.begin(); it != windows.end(); it++)
		{
			MyWindow *target = *it;

			if (target->hWnd == key)
			{
				return target;
			}

		}

		return NULL;
	}



	//
	//  関数: MyRegisterClass()
	//
	//  目的: ウィンドウ クラス登録します。
	//
	ATOM MyRegisterClass(HINSTANCE hInstance)
	{
		WNDCLASSEXW wcex;

		wcex.cbSize = sizeof(WNDCLASSEX);

		wcex.style = CS_HREDRAW | CS_VREDRAW;
		wcex.lpfnWndProc = WndProc;
		wcex.cbClsExtra = 0;
		wcex.cbWndExtra = 0;
		wcex.hInstance = hInstance;
		wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_WINDOWSPROJECT7));
		wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
		wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
		wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_WINDOWSPROJECT7);
		wcex.lpszClassName = szWindowClass;
		wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));

		return RegisterClassExW(&wcex);
	}

	//
	//   関数: InitInstance(HINSTANCE, int)
	//
	//   目的: インスタンス ハンドルを保存して、メイン ウィンドウ作成します。
	//
	//   コメント:
	//
	//        この関数で、グローバル変数インスタンス ハンドルを保存し、
	//        メイン プログラム ウィンドウ作成および表示します。
	//
	BOOL InitInstance()
	{
		hInst = hInstance; // グローバル変数インスタンス処理を格納します。

		ATOM c = MyRegisterClass(hInstance);
		y = 0;

		hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
			CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);

		if (!hWnd)
		{
			return FALSE;
		}

		return TRUE;
	}

	BOOL ShowWindow()
	{
		BOOL ret;
		ret = ::ShowWindow(hWnd, SW_SHOW);
		::UpdateWindow(hWnd);

		return ret;
	}


	HINSTANCE hInstance;
	MSG msg;
	BOOL run;
	int y;
	BOOL Main()
	{

		HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_WINDOWSPROJECT7));
		run = true;
		int rc;
		// メイン メッセージ ループ:
		while (run)
		{
			DWORD obj = MsgWaitForMultipleObjectsEx(0, NULL,  100 , QS_PAINT| QS_ALLEVENTS,0);
			if (obj <= WAIT_OBJECT_0)
			{
				while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
				{
					if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
					{
						TranslateMessage(&msg);
						DispatchMessage(&msg);
					}
					if (msg.message == WM_QUIT) {
						run = FALSE;
					}
					if (msg.message == WM_CLOSE) {
						run = FALSE;
					}

				}
			}
			else if (obj == WAIT_TIMEOUT)
			{
				y++;
				PAINTSTRUCT ps;
				HDC hdc = BeginPaint(hWnd, &ps);
				this->OnPaint(ps);
				EndPaint(hWnd, &ps);
				::UpdateWindow(hWnd);
				RECT Rect2 = { 0,0,48,48 * 8 };
				InvalidateRect(hWnd, &Rect2, TRUE);
			}
			else if (obj == WAIT_FAILED)
			{
				rc = GetLastError();
			}
			else {

			}
		}


		return TRUE;

	}

	BOOL OnPaint(PAINTSTRUCT &ps)
	{
		HDC hdc = GetDC(hWnd);
		HBRUSH hBrush = CreateSolidBrush(RGB(48, 48, 246));
		RECT Rect = { 0,0,48,48 };
		Rect.top = 48 * y;
		Rect.bottom = 48 * (y+1);
		if (y > 8) {
			y = 0;
		}
		BOOL ret = FillRect(ps.hdc, &Rect, hBrush);
		DeleteObject(hBrush);

		return TRUE;
	}


};


int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPWSTR    lpCmdLine,
                     _In_ int       nCmdShow)
{
    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);

    // TODO: ここにコードを挿入してください。

    // グローバル文字列初期化しています。
    LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
    LoadStringW(hInstance, IDC_WINDOWSPROJECT7, szWindowClass, MAX_LOADSTRING);
    //MyRegisterClass(hInstance);



	MyWindow win;



	win.hInstance = hInstance;

	// アプリケーション初期化を実行します:
	if (!win.InitInstance())
	{
		return FALSE;
	}

	BOOL ret;

	win.ShowWindow();

	ret = win.Main();

	if (ret)
	{
		return 0;
	}else {
		return (int)win.msg.wParam;
	}



}






//
//  関数: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  目的:    メイン ウィンドウメッセージを処理します。
//
//  WM_COMMAND  - アプリケーション メニューの処理
//  WM_PAINT    - メイン ウィンドウの描画
//  WM_DESTROY  - 中止メッセージを表示して戻る
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
    case WM_COMMAND:
        {
            int wmId = LOWORD(wParam);
            // 選択されたメニューの解析:
            switch (wmId)
            {
            case IDM_ABOUT:
                DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
                break;
            case IDM_EXIT:
                DestroyWindow(hWnd);
                break;
            default:
                return DefWindowProc(hWnd, message, wParam, lParam);
            }
        }
        break;
    case WM_PAINT:
        {
            PAINTSTRUCT ps;
            HDC hdc = BeginPaint(hWnd, &ps);

			MyWindow *target = MyWindow::find(hWnd);
			target->OnPaint(ps);


            // TODO: HDC を使用する描画コードをここに追加してください...
            EndPaint(hWnd, &ps);
        }
        break;
    case WM_DESTROY:
        PostQuitMessage(0);
        break;
    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}

// バージョン情報ボックスメッセージ ハンドラーです。
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
    UNREFERENCED_PARAMETER(lParam);
    switch (message)
    {
    case WM_INITDIALOG:
        return (INT_PTR)TRUE;

    case WM_COMMAND:
        if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
        {
            EndDialog(hDlg, LOWORD(wParam));
            return (INT_PTR)TRUE;
        }
        break;
    }
    return (INT_PTR)FALSE;
}

anond:20190101162210

やすいように フルソー

青い■を表示するだけ

// WindowsProject7.cpp: アプリケーションエントリ ポイント定義します。
//

#include "stdafx.h"
#include "WindowsProject7.h"

#define MAX_LOADSTRING 100

// グローバル変数:
HINSTANCE hInst;                                // 現在インターフェイス
WCHAR szTitle[MAX_LOADSTRING];                  // タイトル バーテキスト
WCHAR szWindowClass[MAX_LOADSTRING];            // メイン ウィンドウ クラス名

// このコード モジュールに含まれ関数宣言転送します:
//ATOM                MyRegisterClass(HINSTANCE hInstance);
BOOL                InitInstance(HINSTANCE, int);
LRESULT CALLBACK    WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK    About(HWND, UINT, WPARAM, LPARAM);

#include <list>

class MyWindow;
	
std::list< MyWindow *> windows;

class MyWindow
{
public:

	HWND hWnd;



	MyWindow()
		:hWnd(NULL)
	{
		windows.push_back(this);
	}

	virtual ~MyWindow()
	{
		std::list< MyWindow *>::iterator it;
		for (it = windows.begin(); it != windows.end(); it++)
		{
			if (*it == this)
			{
				windows.erase(it);
				break;
			}
		}
	}

	static MyWindow * find(HWND key)
	{
		std::list< MyWindow *>::iterator it;
		for (it = windows.begin(); it != windows.end(); it++)
		{
			MyWindow *target = *it;

			if (target->hWnd == key)
			{
				return target;
			}

		}

		return NULL;
	}



	//
	//  関数: MyRegisterClass()
	//
	//  目的: ウィンドウ クラス登録します。
	//
	ATOM MyRegisterClass(HINSTANCE hInstance)
	{
		WNDCLASSEXW wcex;

		wcex.cbSize = sizeof(WNDCLASSEX);

		wcex.style = CS_HREDRAW | CS_VREDRAW;
		wcex.lpfnWndProc = WndProc;
		wcex.cbClsExtra = 0;
		wcex.cbWndExtra = 0;
		wcex.hInstance = hInstance;
		wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_WINDOWSPROJECT7));
		wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
		wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
		wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_WINDOWSPROJECT7);
		wcex.lpszClassName = szWindowClass;
		wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));

		return RegisterClassExW(&wcex);
	}

	//
	//   関数: InitInstance(HINSTANCE, int)
	//
	//   目的: インスタンス ハンドルを保存して、メイン ウィンドウ作成します。
	//
	//   コメント:
	//
	//        この関数で、グローバル変数インスタンス ハンドルを保存し、
	//        メイン プログラム ウィンドウ作成および表示します。
	//
	BOOL InitInstance()
	{
		hInst = hInstance; // グローバル変数インスタンス処理を格納します。

		ATOM c = MyRegisterClass(hInstance);


		hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
			CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);

		if (!hWnd)
		{
			return FALSE;
		}

		return TRUE;
	}

	BOOL ShowWindow()
	{
		BOOL ret;
		ret = ::ShowWindow(hWnd, SW_SHOW);
		::UpdateWindow(hWnd);

		return ret;
	}


	HINSTANCE hInstance;
	MSG msg;

	BOOL Main()
	{

		HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_WINDOWSPROJECT7));

		// メイン メッセージ ループ:
		while (GetMessage(&msg, nullptr, 0, 0))
		{
			if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
			{
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
		}


		return TRUE;

	}

	BOOL OnPaint(PAINTSTRUCT &ps)
	{
		HBRUSH hBrush = CreateSolidBrush(RGB(48, 48, 246));
		RECT Rect = { 0,0,48,48 };
		BOOL ret = FillRect(ps.hdc, &Rect, hBrush);
		DeleteObject(hBrush);

		return TRUE;
	}


};


int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPWSTR    lpCmdLine,
                     _In_ int       nCmdShow)
{
    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);

    // TODO: ここにコードを挿入してください。

    // グローバル文字列初期化しています。
    LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
    LoadStringW(hInstance, IDC_WINDOWSPROJECT7, szWindowClass, MAX_LOADSTRING);
    //MyRegisterClass(hInstance);



	MyWindow win;



	win.hInstance = hInstance;

	// アプリケーション初期化を実行します:
	if (!win.InitInstance())
	{
		return FALSE;
	}

	BOOL ret;

	win.ShowWindow();

	ret = win.Main();

	if (ret)
	{
		return 0;
	}else {
		return (int)win.msg.wParam;
	}



}






//
//  関数: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  目的:    メイン ウィンドウメッセージを処理します。
//
//  WM_COMMAND  - アプリケーション メニューの処理
//  WM_PAINT    - メイン ウィンドウの描画
//  WM_DESTROY  - 中止メッセージを表示して戻る
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
    case WM_COMMAND:
        {
            int wmId = LOWORD(wParam);
            // 選択されたメニューの解析:
            switch (wmId)
            {
            case IDM_ABOUT:
                DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
                break;
            case IDM_EXIT:
                DestroyWindow(hWnd);
                break;
            default:
                return DefWindowProc(hWnd, message, wParam, lParam);
            }
        }
        break;
    case WM_PAINT:
        {
            PAINTSTRUCT ps;
            HDC hdc = BeginPaint(hWnd, &ps);

			MyWindow *target = MyWindow::find(hWnd);
			target->OnPaint(ps);


            // TODO: HDC を使用する描画コードをここに追加してください...
            EndPaint(hWnd, &ps);
        }
        break;
    case WM_DESTROY:
        PostQuitMessage(0);
        break;
    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}

// バージョン情報ボックスメッセージ ハンドラーです。
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
    UNREFERENCED_PARAMETER(lParam);
    switch (message)
    {
    case WM_INITDIALOG:
        return (INT_PTR)TRUE;

    case WM_COMMAND:
        if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
        {
            EndDialog(hDlg, LOWORD(wParam));
            return (INT_PTR)TRUE;
        }
        break;
    }
    return (INT_PTR)FALSE;
}

anond:20181231104029

// WindowsProject7.cpp: アプリケーションエントリ ポイント定義します。
//

#include "stdafx.h"
#include "WindowsProject7.h"

#define MAX_LOADSTRING 100

// グローバル変数:
HINSTANCE hInst;                                // 現在インターフェイス
WCHAR szTitle[MAX_LOADSTRING];                  // タイトル バーテキスト
WCHAR szWindowClass[MAX_LOADSTRING];            // メイン ウィンドウ クラス名

// このコード モジュールに含まれ関数宣言転送します:
//ATOM                MyRegisterClass(HINSTANCE hInstance);
BOOL                InitInstance(HINSTANCE, int);
LRESULT CALLBACK    WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK    About(HWND, UINT, WPARAM, LPARAM);

#include <list>

class MyWindow;
	
std::list< MyWindow *> windows;

class MyWindow
{
public:

	HWND hWnd;



	MyWindow()
		:hWnd(NULL)
	{
		windows.push_back(this);
	}

	virtual ~MyWindow()
	{
		std::list< MyWindow *>::iterator it;
		for (it = windows.begin(); it != windows.end(); it++)
		{
			if (*it == this)
			{
				windows.erase(it);
				break;
			}
		}
	}

	static MyWindow * find(HWND key)
	{
		std::list< MyWindow *>::iterator it;
		for (it = windows.begin(); it != windows.end(); it++)
		{
			MyWindow *target = *it;

			if (target->hWnd == key)
			{
				return target;
			}

		}

		return NULL;
	}



	//
	//  関数: MyRegisterClass()
	//
	//  目的: ウィンドウ クラス登録します。
	//
	ATOM MyRegisterClass(HINSTANCE hInstance)
	{
		WNDCLASSEXW wcex;

		wcex.cbSize = sizeof(WNDCLASSEX);

		wcex.style = CS_HREDRAW | CS_VREDRAW;
		wcex.lpfnWndProc = WndProc;
		wcex.cbClsExtra = 0;
		wcex.cbWndExtra = 0;
		wcex.hInstance = hInstance;
		wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_WINDOWSPROJECT7));
		wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
		wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
		wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_WINDOWSPROJECT7);
		wcex.lpszClassName = szWindowClass;
		wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));

		return RegisterClassExW(&wcex);
	}

	//
	//   関数: InitInstance(HINSTANCE, int)
	//
	//   目的: インスタンス ハンドルを保存して、メイン ウィンドウ作成します。
	//
	//   コメント:
	//
	//        この関数で、グローバル変数インスタンス ハンドルを保存し、
	//        メイン プログラム ウィンドウ作成および表示します。
	//
	BOOL InitInstance()
	{
		hInst = hInstance; // グローバル変数インスタンス処理を格納します。

		ATOM c = MyRegisterClass(hInstance);


		hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
			CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);

		if (!hWnd)
		{
			return FALSE;
		}

		return TRUE;
	}

	BOOL ShowWindow()
	{
		BOOL ret;
		ret = ::ShowWindow(hWnd, SW_SHOW);
		::UpdateWindow(hWnd);

		return ret;
	}


	HINSTANCE hInstance;
	MSG msg;

	BOOL Main()
	{

		HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_WINDOWSPROJECT7));

		// メイン メッセージ ループ:
		while (GetMessage(&msg, nullptr, 0, 0))
		{
			if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
			{
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
		}


		return TRUE;

	}

	BOOL OnPaint()
	{
		return TRUE;
	}


};


int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPWSTR    lpCmdLine,
                     _In_ int       nCmdShow)
{
    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);

    // TODO: ここにコードを挿入してください。

    // グローバル文字列初期化しています。
    LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
    LoadStringW(hInstance, IDC_WINDOWSPROJECT7, szWindowClass, MAX_LOADSTRING);
    //MyRegisterClass(hInstance);



	MyWindow win;



	win.hInstance = hInstance;

	// アプリケーション初期化を実行します:
	if (!win.InitInstance())
	{
		return FALSE;
	}

	BOOL ret;

	win.ShowWindow();

	ret = win.Main();

	if (ret)
	{
		return 0;
	}else {
		return (int)win.msg.wParam;
	}



}






//
//  関数: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  目的:    メイン ウィンドウメッセージを処理します。
//
//  WM_COMMAND  - アプリケーション メニューの処理
//  WM_PAINT    - メイン ウィンドウの描画
//  WM_DESTROY  - 中止メッセージを表示して戻る
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
    case WM_COMMAND:
        {
            int wmId = LOWORD(wParam);
            // 選択されたメニューの解析:
            switch (wmId)
            {
            case IDM_ABOUT:
                DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
                break;
            case IDM_EXIT:
                DestroyWindow(hWnd);
                break;
            default:
                return DefWindowProc(hWnd, message, wParam, lParam);
            }
        }
        break;
    case WM_PAINT:
        {
            PAINTSTRUCT ps;
            HDC hdc = BeginPaint(hWnd, &ps);

			MyWindow *target = MyWindow::find(hWnd);
			target->OnPaint();


            // TODO: HDC を使用する描画コードをここに追加してください...
            EndPaint(hWnd, &ps);
        }
        break;
    case WM_DESTROY:
        PostQuitMessage(0);
        break;
    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}

// バージョン情報ボックスメッセージ ハンドラーです。
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
    UNREFERENCED_PARAMETER(lParam);
    switch (message)
    {
    case WM_INITDIALOG:
        return (INT_PTR)TRUE;

    case WM_COMMAND:
        if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
        {
            EndDialog(hDlg, LOWORD(wParam));
            return (INT_PTR)TRUE;
        }
        break;
    }
    return (INT_PTR)FALSE;
}


Windowsシステムは基本 グローバル関数なので

グローバル関数<>クラス化されたメソッド

ブリッジ関数を書いた

2018-12-31

anond:20181228211250

// WindowsProject7.cpp: アプリケーションエントリ ポイント定義します。
//

#include "stdafx.h"
#include "WindowsProject7.h"

#define MAX_LOADSTRING 100

// グローバル変数:
HINSTANCE hInst;                                // 現在インターフェイス
WCHAR szTitle[MAX_LOADSTRING];                  // タイトル バーテキスト
WCHAR szWindowClass[MAX_LOADSTRING];            // メイン ウィンドウ クラス名

// このコード モジュールに含まれ関数宣言転送します:
//ATOM                MyRegisterClass(HINSTANCE hInstance);
BOOL                InitInstance(HINSTANCE, int);
LRESULT CALLBACK    WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK    About(HWND, UINT, WPARAM, LPARAM);


class MyWindow
{
public:

	HWND hWnd;

	MyWindow()
		:hWnd(NULL)
	{

	}


	//
	//  関数: MyRegisterClass()
	//
	//  目的: ウィンドウ クラス登録します。
	//
	ATOM MyRegisterClass(HINSTANCE hInstance)
	{
		WNDCLASSEXW wcex;

		wcex.cbSize = sizeof(WNDCLASSEX);

		wcex.style = CS_HREDRAW | CS_VREDRAW;
		wcex.lpfnWndProc = WndProc;
		wcex.cbClsExtra = 0;
		wcex.cbWndExtra = 0;
		wcex.hInstance = hInstance;
		wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_WINDOWSPROJECT7));
		wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
		wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
		wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_WINDOWSPROJECT7);
		wcex.lpszClassName = szWindowClass;
		wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));

		return RegisterClassExW(&wcex);
	}

	//
	//   関数: InitInstance(HINSTANCE, int)
	//
	//   目的: インスタンス ハンドルを保存して、メイン ウィンドウ作成します。
	//
	//   コメント:
	//
	//        この関数で、グローバル変数インスタンス ハンドルを保存し、
	//        メイン プログラム ウィンドウ作成および表示します。
	//
	BOOL InitInstance()
	{
		hInst = hInstance; // グローバル変数インスタンス処理を格納します。

		ATOM c = MyRegisterClass(hInstance);


		hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
			CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr);

		if (!hWnd)
		{
			return FALSE;
		}

		return TRUE;
	}

	BOOL ShowWindow()
	{
		BOOL ret;
		ret = ::ShowWindow(hWnd, SW_SHOW);
		::UpdateWindow(hWnd);

		return ret;
	}


	HINSTANCE hInstance;
	MSG msg;

	BOOL Main()
	{

		HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_WINDOWSPROJECT7));

		// メイン メッセージ ループ:
		while (GetMessage(&msg, nullptr, 0, 0))
		{
			if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
			{
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
		}


		return TRUE;

	}



};


int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPWSTR    lpCmdLine,
                     _In_ int       nCmdShow)
{
    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);

    // TODO: ここにコードを挿入してください。

    // グローバル文字列初期化しています。
    LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
    LoadStringW(hInstance, IDC_WINDOWSPROJECT7, szWindowClass, MAX_LOADSTRING);
    //MyRegisterClass(hInstance);



	MyWindow win;



	win.hInstance = hInstance;

	// アプリケーション初期化を実行します:
	if (!win.InitInstance())
	{
		return FALSE;
	}

	BOOL ret;

	win.ShowWindow();

	ret = win.Main();

	if (ret)
	{
		return 0;
	}else {
		return (int)win.msg.wParam;
	}



}






//
//  関数: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  目的:    メイン ウィンドウメッセージを処理します。
//
//  WM_COMMAND  - アプリケーション メニューの処理
//  WM_PAINT    - メイン ウィンドウの描画
//  WM_DESTROY  - 中止メッセージを表示して戻る
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
    case WM_COMMAND:
        {
            int wmId = LOWORD(wParam);
            // 選択されたメニューの解析:
            switch (wmId)
            {
            case IDM_ABOUT:
                DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
                break;
            case IDM_EXIT:
                DestroyWindow(hWnd);
                break;
            default:
                return DefWindowProc(hWnd, message, wParam, lParam);
            }
        }
        break;
    case WM_PAINT:
        {
            PAINTSTRUCT ps;
            HDC hdc = BeginPaint(hWnd, &ps);
            // TODO: HDC を使用する描画コードをここに追加してください...
            EndPaint(hWnd, &ps);
        }
        break;
    case WM_DESTROY:
        PostQuitMessage(0);
        break;
    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}

// バージョン情報ボックスメッセージ ハンドラーです。
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
    UNREFERENCED_PARAMETER(lParam);
    switch (message)
    {
    case WM_INITDIALOG:
        return (INT_PTR)TRUE;

    case WM_COMMAND:
        if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
        {
            EndDialog(hDlg, LOWORD(wParam));
            return (INT_PTR)TRUE;
        }
        break;
    }
    return (INT_PTR)FALSE;
}

こんなかんじ。クラス化した

2018-12-23

anond:20181223152531

技としてはナイスだけど応用は厳しいよね

	const char *message = "        Hello world\n";

	for (int i = 0; i < 8; i++) {
		printf("%s", message + 8 - i);
	}

サンプルとしては、使いにくい書き方

ハローワールドループだけでも

結構遊べる

あなたは どんな 書き方が好き?

2018-08-24

anond:20180824112752

消せれば、綺麗なデザインのもあるし、面白いと思う。(ヘナとかは消せますよね)

身内の名前を彫るのは、「いつも一緒」みたいな固い意志表示なのかなーと思う。

https://www.elle.com/jp/culture/g244798/cfe-celebrity-tattoo-meanings15-0109/

単なるファッションじゃない! セレブタトゥーに込められたメッセージ

CULTURE SPECIAL

Message座右の銘?)を刻んでいる人が、多いんだなぁ。あるいはお守りみたいな?

2018-06-24

anond:20180624193421

「おまえだってー」って言ってる増田さんへの言及で書かないと全然わけわかんないですよ?

しろお知り合いならlineMessage喧嘩なさればよいのでは。

2018-04-08

読んだページを全部自動ブクマする

数日前に puppeteer で自動PDF にする試みを書いたブログホッテントリに入ってるのを見た

それに影響されて自動ブクマするもの作ってみた

bg.js

const username = ""
const api_key = ""

chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
	if(message.bookmark){
		bookmark(message.bookmark)
	}
})

async function bookmark(url){
	fetch("http://b.hatena.ne.jp/atom/post", {
		method: "POST",
		referrer: "no-referrer",
		headers: {
			Accept: "application/x.atom+xml, application/xml, text/xml, */*",
			"X-WSSE": await createCredential(),
		},
		body: `
			<entry xmlns="http://purl.org/atom/ns#">
				<link rel="related" type="text/html" href="${url}" />
			</entry>
		`.replace(/\t/g, ""),
	}).then(e => {console.log(e)})
}

async function createCredential(){
	const non = Math.random().toString(36).substr(2)
	const now = new Date().toISOString()
	const buf = new TextEncoder().encode(non + now + api_key)
	const u8a = new Uint8Array(await crypto.subtle.digest("SHA-1", buf))
	const str = Array.from(u8a, e => String.fromCharCode(e)).join("")
	const b64 = btoa(str)
	return `UsernameToken Username="${username}", PasswordDigest="${b64}", Nonce="${btoa(non)}", Created="${now}"`
}

username と api_key を埋めてバックグラウンドで動かす

page.js

chrome.runtime.sendMessage({
	bookmark: location.href
})

ページ内で動かすコード

URLバックグラウンドに投げる

今は全部投げるコードになってるが、必要に応じていらないドメインを弾いたりする

2018-03-09

anond:20180309014039

よっぽど仲良しでないとそんなの嫌。

というか、もし自分結婚するなら、依頼主の(結婚する人)呼ぶかな?と思ってみて、

呼びたくないなら、そんな人のお祝いMessageなんてしないですね。

あ、面倒だけど、私がする時この人にも列席してほしい、Message欲しい場合は、無理してでも頑張るけど。

2018-01-11

韓国の求める心から謝罪とは何か

日韓問題

最終的な解決がなされたのに蒸し返すことの契約的な是非はともかく、心情面で日本がどんだけ謝っても韓国納得しないじゃんって話については、2015年戦後70年首相談話の時にパックンが書いたコラムが興味深い。


首相談話についても、アメリカ人なので語りません

以下に一部引用する。

 謝るべきかどうかではなく、何故お詫びを求められ続けるかということだけについて話そう。

 まず挙げられるのは「各国の政府は、内政が厳しいとき反日感情煽り国民の怒りの矛先を外に向けさせる作戦を取る」という説明。これは間違いない。その作戦自体は間違っていると思うけどね。やりすぎてだんだん効果が薄れているみたいだし。

 でもそれだけではないだろう。もう1つの理由として、日本の「反省が伝わっていない可能性」も考えよう。もちろん、これまでに日本政府が謝ってきたのは事実。少なくとも村山首相中曽根首相細川首相小泉首相安倍首相謝罪している。

 しかし、各時代首相が謝っている傍らで、他の政治家たちによる謝罪とは反対の意に捉えられる発言が目立つ。有名な例だと、中曽根内閣時代藤尾正行文部大臣韓国併合についての「韓国側にも責任がある」発言竹下内閣時代奥野誠亮国土庁長官日中戦争についての「侵略意図は無かった」発言最近だと、「慰安婦制度必要だった」という橋本徹大阪府知事(当時)のコメントがある。

 行動も紛らわしく見える。5名の首相がおわびをしている一方で、靖国神社へ参拝している戦後首相は14名。国会議員では数百人に上る。靖国神社は、世界メディアWar Shrine戦争神社)と紹介されている。参拝される人の意図とは関係なく、世界が受ける印象は「お詫び」とは反するものになってしまう。

 今回も謝罪の意をこめた総理談話を発表した翌日に、67名の国会議員が参拝をした。安倍総理は参拝しなかったが玉串料を収めた。こういうことは英語でmixed messageという。その行動により、残念ながら「お詫び」が印象に残らない結果となる。

 その後、おおむね「謝罪した」とみられているドイツとの比較などが行われている。

 つまり日本政府や首脳は、公式声明では確かに何度も謝罪している。だが、公式声明以外の振舞いや、首脳以外の政治家言動に「本当はたいして悪いと思ってません」というホンネが感じられるため、本気で謝っていると思ってもらえないということである

 なので、どうすれば心から謝罪したと納得されるかというと、政治家(たぶん国民も)の大半の意見を「日本が悪かったです」ということで統一し、かつ大々的な声明だけでなくその他の場面でも日本が悪かったという態度を崩さず、あと政治家や元政治家靖国参拝奉納を止めるといったところだろう。

 少なくともパックン見立てではそのような感じだ。


 まあ確かに会社とか友人関係でも、いったんちゃんと頭は下げたものの、その後自分の席に戻って肩をすくめたりする姿が見られたら、本当は反省しておらずしぶしぶ形だけ謝ったのだ、という風に思われるだろうことはわかる。

 靖国は、誰がどの墓や神社に参拝しようが自由なのだがその自由なところから透けて見える気持ち反省のしてなさであるというのはなんか難しい所だ。

 結局のところ、大日本帝国とそれにまつわる物事ナチス第三帝国と同じくらいの扱いにしたら満足してもらえるはずってわけだろうが……。


このコラムへの読者の反応にパックンが返答している記事もあるのでそれも貼っておく。

アメリカ人だからか、語りきれなかったみたい

2017-10-15

bitcointalkの説明

アクティティ説明過去情報コピペです)

ログイン時間書き込み数で上がり、アクテイビティ毎にランクが決まる(Activity = min(time * 14, posts))

  書き込み0:Brand new

  0 Activity: Newbie

  30 Activity: Jr. Member

  60 Activity: Member

  120 Activity: Full Member

  240 Activity: Sr. Member

  480 Activity: Hero Member

・2週間毎に最高14ずつ上がるらしい(でもなんか微妙に違うのかも。僕は14は飛ばし28までは一気に上がりました)

・僕は10月5日登録10月26日Jr.Member昇進になりました。3週間でした)

(詳細⇒ https://bitcointalk.org/index.php?topic=178608.0 誰か訳してください)

.

.

ランク説明

ランクがNewbieだと書き込みが6分に1回など制限があったり、PMを送っても届かなかったり、フリーエアドロップに参加できなかったりする

・だから基本的ランクを上げといた方が良い

しかし、私利のランク上げのために日本語スレスパムみたいに適当投稿するのは単純によくないことだと思う

・結局一番いいのは、単純に、真面目にスレに貢献し、参加することだと思う

(たまに書き込み削除の通知メールが来るが、それはたまによくあることなので、気を落とさなくていい)

(注意点として、以下に示すような投稿をするとBAN対象になると声明がありましたので、「スレ主がそういう投稿を求めている時」以外にこういう投稿をしないようにしたほうがいいです)

「joined」

「looking forward to getting X」

「signed up for X」

「applied」

日本語スレでも自分ツイッター宣伝したり露骨なアフィしたりすると消されます

(詳細: https://bitcointalk.org/index.php?topic=2284373.0

.

.

フリーエアドロップ説明(主に留意点)

情報が貼られる場所を紹介しま

.

1次情報(最新情報

ビットコイントークアルトコインアナウンス板」

https://bitcointalk.org/index.php?board=159.0

ビットコインガーデン:ギブアウェイ板」(ビットコイントークより規制が緩いため色々と留意

https://bitcoingarden.org/forum/index.php?board=2.0

.

2次情報用途は1次情報の取りこぼし用、時間無い人用、などとして)

「airdropalert」(一部アフィだが優秀なので書かざるを得ない)

https://airdropalert.com

ビットコイントーク日本語板」(もはやエアドロップ情報スレになってるため。アフィ目的スパムが多すぎて最近は見るのが心苦しい)

https://bitcointalk.org/index.php?topic=877.new#new

リファラつけた紹介アフィは規約違反なので基本消されます。最悪BANされます

.

・配布時期は気長にみたほうがいい(応募してすぐ配布されるわけではないものも多い。配布時期は各説明を読むしかない)

・scam対策のため、ウォレットダウンロード系は「安心なのだけやる」または「仮想環境作ってそこでやる」または「scamされてもいいマイニング専用PCでやる」

・scam対策のため、メールアドレスパスワード登録系は「パスワードは毎回別のを用意する」、「メールアドレスはできればサブのを使う」(要は「メールアドレスパスワードペア」が他の登録情報かぶらなければいい)

・たまにフリーエアドロップで「PMする」「肯定的ツイートして宣伝する」みたいな条件があるが、それは礼儀分別のあるPMでないと失格になることもあるっぽい(僕はRICHのフリーエアドロップで「Yes I wanna be rich!!」みたいなテンションの文とアドレス書いて送ったら、フリーエアドロップ受けられませんでした。あとSOARCOINの人が「ただRTしてるだけの人にエアドロップ配るか配らないかどうしたらいいかな?」という内容のアンケート取ってたりするので。外人とは言え、分別もった内容で応募しないといけないのかなと思いました)

・また、「send me personal message」「PMする」「PM」とかはパーソナルメッセージツイッターで言うDM)を送るということです。レス左側にある吹き出しマークを押せばPMを書くフォームに飛べますので、そこで書いて送信する、ということです

.

.

フリーエアドロップの際によくフォーム入力をせがまれる項目の説明

・「bitcointalk profile」は、自分プロフィールページの左側カラムにある「Forum Profile Information」に行った時のURLから、語尾の「;sa=forumProfile」を省いたもの

・「bitcointalk ID」は、上記「Forum Profile Information」に行った時のURLの中にある「u=なんたらかんたら」の複数桁の数字のこと

・「Address」は、ものによって違うが、基本的イーサリアムウォレットアドレスか、ウェーブスのウォレットアドレスか、または専用ウォレットアドレス基本的取引所アドレスでなく、どれもウォレットアドレス。例えばイーサリアムならMyEtherWalletなど)

.

.

■bitcointalk書き込み説明

スレに書き込むには、ページの右下や右上にある「reply」ってボタンを押せば書き込みフォームが出る

レスにアンカつけるには、レス右側にある「quote」ってボタン押せばアンカつき書き込みフォームが出る

適当書き込みをしたらたまにけっこう削除される(そして「削除したからな」ってメールが届く)

.

.

VM仮想マシン)の入れ方の例

・まず仮想マシンインストール https://pc-karuma.net/windows8-virtualbox-install/

・次に仮想マシンubuntuLinux一種インストール https://pc-karuma.net/windows-8-virtualbox-ubuntu-install/

(大体HDDの容量を10GBくらい取ります

2017-10-12

1996年以来の株価高値

株価20年ぶりに高値をつけたらしい。

ようやっと20年前の状況にもどったわけだ(少なくとも株価は)


1996年と言えば

ポケモンバイオハザードマリオ64パラッパペルソナクラッシュたまごっち

ドラゴンボールGT、エスカフローネ名探偵コナンナデシコ

Shall We ダンス?、インデペンデンスデイ、ザロックキッズリターン

アムラー援助交際、親父狩り、ジベタリアンプリクラ


1位 名もなき詩 Mr.Children 230.3万

2位 DEPARTURES globe 227.2万

3位 LA・LA・LA LOVE SONG 久保田利伸with NAOMI CAMPBELL 161.3万

4位 チェリー スピッツ 153.9万

5位 花-Memento-Mori- Mr.Children 153.9万

6位 空も飛べるはず スピッツ 143.2万

7位 愛の言霊~Spiritual Message サザンオールスターズ 138.1万

8位 I'm proud 華原朋美 137.2万

9位 Don't wanna cry 安室奈美恵 137.2万

10Chase the Chance 安室奈美恵 136.2万


なんだか楽しそうだなぁ・・・

安室奈美恵引退するし、マリオオデッセイは発売するし。

なんだか時代が変わっていくのを感じる。

ちょっとだけ期待して今日は筆を終えることにする。

バイバイ(´・ω・`)

ログイン ユーザー登録
ようこそ ゲスト さん