「Value」を含む日記 RSS

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

2024-03-29

anond:20240329174529

Puberulic acid (1)7, stipitatic acid (2)8 and viticolins A and B (3, 4) as novel natural products have been isolated from a culture broth of Penicillium viticola 9 FKI-4410 through our screening system and found to have promising antimalarial activity (Fig. 1)10, 11. In these highly-oxygenated 7-membered aromatic compounds, 1 shows the most potent antimalarial activity in vitro against the Plasmodium falciparum K1 (chloroquine-resistant) parasite strain (IC50 = 0.050 µM), as well as in vivo efficacy with 69% inhibition for a dose of 2 mg/kg × 4 through subcutaneous (s.c.) administration in 4-day suppressive test using a P. berghei-infected mouse model12. However, 1 exhibits toxicity in vivo, four out of five mice dying by day 3, after a s.c. dose of 5 mg/kg × 2 (day 0 and 1). While structually simple compounds such as tropone (5), tropolone (6) and hinokitiol (8), and natural 2 and 3 showed weaker activity than that of 1, 7-hydroxytropolone (7)13 was much more potent, exhibiting a >18-fold stronger IC50 value of 6.44 µM than that of 5. This observation suggested that the presence of more than three contiguous oxygen atoms in a compound might significantly affect antimalarial activity. These results stimulated us to undertake a structure-activity relationship (SAR) study based on the establishment of a total synthetic route, aiming to create new antimalarial candidates which retained potency but which were non-toxic. Furthermore, we expected that these compounds’ properties, especially low molecular weight and simple planar structures, could be invaluable for antimalarial drug leads with respect to ease of supply14, enabled by efficient and practical synthesis. Herein, we report the divergent synthesis of several related troponoids, including natural products, via utilization of the established total synthetic route of 1 15, and biological evaluation of their in vitro antimalarial activity and cytotoxicity.

要約:

Puberulic acid (1)は、Penicillium viticola FKI-4410培養から単離された新規天然物質であり、in vitroおよびin vivoで優れた抗マラリア活性を示した。しかし、マウスを用いたin vivo試験において、5 mg/kg を2回皮下投与したところ、5匹中4匹が3日目までに死亡するという毒性が観察された。この毒性が問題となるため、構造活性相関研究を行い、毒性が低く活性の高い新規マラリア薬の開発を目指すこととした。

[Antimalarial troponoids, puberulic acid and viticolins; divergent synthesis and structure-activity relationship studies | Scientific Reports](https://www.nature.com/articles/s41598-017-07718-3)

そら死ぬ

2024-02-04

Xi farm is just the farmer Guo money circle tool

Guo Wengui has always defined his people as "saving China from fire and water" and "letting his comrades live a decent life" through Xi Farm, who knows there is a big conspiracy behind it. When it comes to farms, to borrow Mark Twain's phrase "The fragrance of earth, the pale colors of wildflowers, and the crackling of pecans and walnuts raining down on my head" is what most of us yearn for in a good life on a farm. However, the Himalayan farm in Guo Wengui's mouth, from the beginning to describe the scene as a general farm, to later say that "it is not to make money, the key is that comrades go to each country, have a safe platform that can be trusted for 24 hours and can be taken care of." After several years of Guo Wengui's mouth, a living farm was completely reduced to a "complete business organization." To complete the farm's series transformation to pave the way, Wengui only moved his lips, and his ultimate purpose is "to Himalayan farms around the country to start earning money from comrades." From September 2020, Guo Wengui said, "GDOLLAR is pegged to the US dollar, which is cash, and we have POS machines." Send to the global farm POS machine, local farm personnel responsible for promotion. Promotion success, excellent performance, will get a certain percentage and reward "began, Guo Wengui just put" circle money ants help, extract the last bit of surplus value "these words on the face. Indeed, on March 24, Wengui said again that there were 140 million US dollars in the money, it can be seen that under Guo Wengui's money grab mode, the ants muddily joined in, expecting to live the happy life described by Wengui, but they did not know that they had become the main course of Wengui's scam.

2024-01-25

anond:20240125151103

試してみたけどいけないんよ。

ローカルウインドウでnの中身見れるじゃん?

そこで正しくValueが#REF!の名前を拾えてるのにDeleteするとなぜかいアクティブなシートのエラー参照じゃないプリントエリアが消されてる

増田エクセルマクロ詳しい人いる?

エクセルマクロで膨大な量の名前定義を一括で削除させたくて、こんな風に書いたんだけど

'「Print_Area」以外の名前定義を全部消す

For Each n In ActiveWorkbook.Names

If InStr(1, n.Name, "Print_Area") = 0 Then

n.Delete

ElseIf n.Value Like "*[#]REF!*" Then

n.Delete 'プリントエリアでもエラーだったら消す

End If

next

なぜか参照エラーになってるプリントエリアを消すべきところでエラー起こしてないプリントエリアが消される。

「Print_Area」だけど参照エラーになってるものが一個だけあるからそれを消してほしいだけなんだけど、アクティブシートのプリントエリアが消されて参照エラーの方は生き残ってしまう。

なんで…?

 

【やりたいこと】 

名前管理目視確認すると同じ「Print_Area」名で

1.シート1を正しく参照しているもの

2.シート2を正しく参照しているもの

3.#REF!を参照しているもの

の3つがある。

この3つ目だけを消したい。

 

【なぜか起きること】

For Eachで上から順に1と2を素通りして、3つめのときローカルウインドウName.Valueが#REF!なのを確認しているのに、

3つ目をDelete すると1つ目が消える

2024-01-05

anond:20240105165226

このコードはいくつかの問題点があります

1. **条件式の曖昧さ**:JavaScriptでは、`if (value)` は `value` が「truthy」(真と評価される値)である場合にのみ実行されますしかし、このコードは明確ではありません。`value` が何を意味するのか、どのような値が期待されるのかがコードからは読み取れません。`null` でも `undefined` でもないことを確認するには、より明確な条件式(例:`value !== null && value !== undefined`)を使用する方が良いでしょう。

2. **ログメッセージ不明瞭さ**:ログメッセージ `'null でも undefined でもねーわ'` は、`value` が `null` または `undefined` でないことを示しているようですが、これはコードの実際の動作と一致していません。`value` が 0、空文字列(`''`)、または `false` の場合でも、この条件は偽(false)と評価されますが、これらは `null` または `undefined` ではありません。

3. **コードの可読性**:コメントやより記述的な変数名を使用することで、コード意図動作を明確にすることができます現在状態では、このコード意図理解するのが難しいかもしれません。

これらの点を考慮して、コード改善することをお勧めします。

JavaScript でさあ

変数 value が null でも undefined でもない事を確認するのに

   if (value) {
      console.log('null でも undefined でもねーわ');
   }

これほんとやめろって。

おかげで value に 0 とかが入ってる時に、このコンディションが false になるわけだ。

色んな会社さんのコード見てきたけど、このタイプバグ本当に多い。

今まさに、まーたこバグを見つけて増田を書いてるわけで。

昨年は、世界的にも有名な会社さんのフレームワークがこれでバグってた。

ももう既にシステムの一部は本番稼働しててフレームワークはいじれない。

仕方ないので value には一旦文字列の '0' を渡しておいて if (value) {~} の中の重要ロジックを動かして

(めっちゃ幸運な事に、数値 0 のかわりに文字列 '0' でも正しく動くような、型について緩いロジックだったから)

その後で改めて value に数値 0 を入れなおすという、きったないハックで誤魔化した事もある。

自分お客様だったら怒るね。「いやいや、全部理想的コードにしてちょうだいよ。お金払ってんだよ?」って。

もし建築世界でこんな誤魔化しが起こってたら、人の命が消えちゃうよ。。。

2023-12-17

プログラミング初心者です。以下のコードの誤りはなんですか

僕はプログラミング歴2週間の初心者です。キーと値を入力できるデータベースを作っています

以下のコードを実行してデータを追加し続けると、一定サイズを超えるとエラーが出てしまうみたいです。

理想は、データが追加された後にサイズが足りなくなったら動的に自動拡大されることです。

もし詳しい人がいたらご教示お願い致します。

import sys
import os
import mmap
import hashlib

def h(x):
    return int(hashlib.sha512(x.encode()).hexdigest(), 16)

def create_db(filename):
    with open(filename, 'wb') as f:
        f.write(b'\0' * 1024 * 1024)  # 1MBの空ファイル作成

def set_key(filename, key, value):
    with open(filename, 'r+b') as f:
        mm = mmap.mmap(f.fileno(), 0)
        pos = h(key) % mm.size()
        while mm[pos:pos+1] != b'\0':
            pos = (pos + 1) % mm.size()
            if pos == h(key) % mm.size():
                f.seek(0, os.SEEK_END)
                f.write(b'\0' * mm.size())  # ファイルサイズを2倍にする
                mm = mmap.mmap(f.fileno(), f.tell())  # ファイルサイズを反映させる
                pos = h(key) % mm.size()  # ハッシュ値を再計算する
        data = key + '\0' + value + '\0'
        data = data.encode()
        mm[pos:pos+len(data)] = data
        mm.close()  # mmapオブジェクトを閉じる

def get_key(filename, key):
    with open(filename, 'r+b') as f:
        mm = mmap.mmap(f.fileno(), 0)
        pos = h(key) % mm.size()
        while mm[pos:pos+1] != b'\0':
            end = mm.find(b'\0', pos, mm.size())  # 第2引数と第3引数指定する
            if end == -1:
                end = mm.size()
            if mm[pos:end].decode() == key:
                pos = end + 1
                end = mm.find(b'\0', pos, mm.size())  # 第2引数と第3引数指定する
                if end == -1:
                    end = mm.size()
                value = mm[pos:end].decode()
                mm.close()  # mmapオブジェクトを閉じる
                return value
            pos = (pos + 1) % mm.size()
            if pos == h(key) % mm.size():
                break
        mm.close()  # mmapオブジェクトを閉じる
        return None

def main():
    cmd = sys.argv[1]
    if cmd == 'create':
        create_db(sys.argv[2])
    elif cmd == 'set':
        set_key(sys.argv[2], sys.argv[3], sys.argv[4])
    elif cmd == 'get':
        print(get_key(sys.argv[2], sys.argv[3]))

if __name__ == '__main__':
    main()
 

2023-11-19

Notice

■ Regarding the free release of the new species previewed and the reason for making the support site the main platform for releasing new species:

While the free release on the Kurobinega website is at my discretion, I'm considering doing so roughly once every three or two paid releases.

The following might not be particularly relevant to English-speaking fans, or in other words, to everyone. The reason I'm focusing on early releases is that I want to limit the exposure of MGE and continue creating content on a smaller scale. First of all, I don't want MGE to be a hugely popular restaurant that anyone can enter, nor do I wish to become an internet celebrity. For me, MGE is akin to a reasonably popular local restaurant where like-minded individuals who share my interests gather. By scaling down, my production speed has increased. The period from Dragonewt to Tai Sui was shorter, and the next species should be released sooner. What matters most to me is creating the MGE I want to craft, drawing pictures, and developing games in the world of MGE. I'm delighted when people who value MGE's themes as I do get to see it. Receiving money on support sites like these, allowing me to spend more time on production, is truly appreciated.

Using the stuffed animal analogy again, it truly makes me happy when someone who genuinely loves and cherishes stuffed animals sees the ones I've created. Yet, I can't see those who say they adore stuffed animals but also tolerate and respect those who take pleasure in mutilating them as people who share the same love for stuffed animals as I do. I don't have the inclination to actively show them the stuffed animals I've made.

I believe English-speaking individuals, when witnessing a stuffed animal's head being torn off or the pleasure derived from it, would straightforwardly label it as "crazy." However, it's different in Japan, especially on social media. Even if they dislike watching the stuffed animals being hurt, they'll say, "Let's respect those who enjoy tearing them." This, despite seeing me, someone desperately protecting my stuffed animals, getting attacked by such individuals. There's a prevailing notion in the otaku community, especially on Japanese SNS (Social Media), that "All fetishes must be respected." Speaking out against this, even as a victim, can result in backlash. Not everyone thinks this way, but it's the dominant mindset. Disheartened by this, I didn't want to show them MGE anymore. When you grow to dislike a place, it's only natural to distance yourself, and that's what I've done.

However, this is a problem in Japan. In English-speaking regions, fans typically call out what they dislike, labeling it as "crazy." I have many English-speaking friends who've genuinely helped me in trying times. The MGEwiki admin is also a dear friend. Depending on the English-speaking fan community's dynamics, I might consider releasing content on MGEwiki a month after the early release.

2023-11-17

anond:20231117011008

こういう糞コードって「なんで・・・どうしてこんな有様になってんだよ・・・・?」が解けたときアハ体験ちょっと面白かったりする

ちなみにこのvalueはなんとDBTEXTとして格納されているJSON

anond:20231117003630

caseがすでに20個くらいあるんだわ

claa Unko:
  function hoge(value):
    switch(value.a, value.b)
    case 1, ‘a’
      return methodA(value)
    case 1, ‘b’
      return methodB(value)
    case 2, ‘a’
      return methodC(value)
    case 2, ‘b’
      return methodD(value)
....................

  private

  function methodA(value):
....................

  function methodB(value):
....................

  function methodC(value):
....................

  function methodD(value):
....................

そうじゃなくて

value.hoge()

にしてほしかったのさ

あーそうかオブジェクト指向継承差分プログラミングするものだと理解してるから、異常なswitch文ができるのか

多態性って概念がないのね

function hoge(value):
  switch(value.a, value.b)
  case 1, ‘a’
    return methodA(value)
  case 1, ‘b’
    return methodB(value)
  case 2, ‘c’
    return methodC(value)
………

これでキャリア15年超えってマジかよ

死のうかな

2023-11-15

Dehradun Call Girls | skokkacallgirl

Are you tired of searching all around Dehradun for attractive and alluring call girls? If so, you've come to the correct place. We provide the best hotel Dehradun Call Girls. Our housewives are attractive and beautiful. They'll enhance your day with even more unique touches. Therefore, if you'd like to spend time with someone who is so beautiful, you should employ our services. You can reserve our Dehradun call women whenever you want, from anywhere. Utilising our services is quite easy. To submit the form, simply fill it out and email it to the address provided. After submitting the form, an SMS containing a confirmation link will be sent to you.

Once you've clicked this link, complete the payment. Your booking info will be sent to your mobile device in a matter of minutes. Greetings from Skokka Call Girls, from Dehradun call girls. Strong bonds between couples are forged during meaningful and enjoyable sex encounters, which also help people transition smoothly through life. However, we want to eliminate stressful marriages, arguments about not having enough time for one another, pressure from the workplace or authority, and relationships that are under duress in this new setting. Relationship stress is causing men's personal lives to deteriorate daily. These days, finding a partner that fits your needs, tastes, and personality is challenging.

Very few people nowadays are lucky enough to have a thoughtful, kind, and compatible companion. People who are unhappy and don't value relationships are the ones looking for independent Dehradun call girls. Everyone is capable of and has an innate yearning for happy, fulfilling sexual experiences; they are not entitled to a life filled with tension, hopelessness, and a lack of love and pleasure.

Call Girls Chandigarh

Call Girls Amritsar

Call Girls Agra

Call Girls Ahmedabad

Call Girls Ajmer

Call Girls Ambala

Call Girls Aerocity

Call Girls Bangalore

Call Girls Chennai

Call Girls Coimbatore

Call Girls Delhi

Call Girls Dwarka

Call Girls Dehradun

Call Girls Goa

Call Girls Guwahati

Call Girls Gurgaon

Call Girls Ghaziabad

Call Girls Haridwar

Call Girls Hyderabad

Call Girls Faridabad

Call Girls Indore

Call Girls Jalandhar

Call Girls Jaipur

Call Girls Jaisalmer

Call Girls Jodhpur

Call Girls Kolkata

Call Girls Kharar

Call Girls Ludhiana

Call Girls Lucknow

Call Girls Mumbai

Call Girls Manali

Call Girls Mussoorie

Call Girls Mahipalpur

Call Girls Mohali

Call Girls Mysore

Call Girls Noida

Call Girls Nagpur

Call Girls Panchkula

Call Girls Patiala

Call Girls Patna

Call Girls Pune

Call Girls Rishikesh

Call Girls Rohini

Call Girls Surat

Call Girls Udaipur

Call Girls Varanasi

Call Girls Vadodara

Call Girls Zirakpur

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

backlink

2023-11-08

anond:20231107172950

先週悩まされた Undefined Value Error変数の値が未定義です)のトラウマが未だ抜けてないんじゃないの?

2023-11-04

「優勝確率」に意味はない

全国のスポーツ紙野球誌面担当記者よ、刮目せよ(そんな大した話ではない笑)

この時期のプロ野球日本シリーズ関連記事を見ると、優勝確率、と言う数字毎日踊るのである

11/3現在「【阪神日本シリーズで2勝2敗から王手のチームはV確率75%」

https://news.yahoo.co.jp/articles/4f54c052feb332637de4cbbda7fe1c7ac3dc8a80

ふむふむなるほど。(2勝2敗(引き分け含む)から王手をかけたケースは、過去28度。そのうち優勝21度のV確率75%。)

11/1「阪神追いつき29度目の2勝2敗、優勝確率は46%」

https://www.nikkansports.com/baseball/news/202311010001529.html

おお、前日には全く低かったんですね。

10/31オリックス確率は79% 1勝1敗から先に2勝目を挙げたチームが27度優勝」

https://www.nikkansports.com/baseball/news/202310310001318.html

ホウホウ、この時点ではオリックス日本一になりそうだ、という話だったね、そういえば。

10/28日本シリーズ第1戦勝利阪神日本一確率」は62%」

https://www.sponichi.co.jp/baseball/news/2023/10/28/kiji/20231028s00001173607000c.html

ほほー、阪神の優勝確率は62%→(情報なし)→21%→46%→75%、と変化したわけですね。。。っていうか、それぞれの時点で勝ち星見ればいい話で、「優勝確率」なんていう大層なものでは全然ないような???

とはいえ検討余地はあると思った。

例えば3勝2敗の時点から勝敗場合

●◯

●●

の3通りしかなく、そのうち阪神が優勝するのが2通りなので、お互いの勝利確率50%だとすると、66%の確率阪神が優勝する。しかし、データから見ると75%優勝なので、それよりも高い。どれくらい高いかというと、オッズ1.1倍くらい高い。と言うようなものである。確かに3勝2敗に先に到達したチームの方が優勝する確率が高くなるが、その程度はわずかであろう。1勝すれば優勝するが相手は2勝しなければならない、と言う事実から普通に想像できる確率と大差はない。さてこの高いと言うのは有意なのだろうか。統計によると

今年のように2勝2敗(引き分け含む)から王手をかけたケースは、過去28度。そのうち優勝21度のV確率75%。

とのことである。二項検定すると

> binom.test(21,28,p=2/3)

Exact binomial test

data: 21 and 28

number of successes = 21, number of trials = 28, p-value = 0.4258

alternative hypothesis: true probability of success is not equal to 0.6666667

95 percent confidence interval:

0.5512845 0.8930920

sample estimates:

probability of success

0.75

であるので、危険度5%において有意ではない。つまり、2勝2敗から先に王手をかけた方が日本一になる確率統計的に高いと言うことはない。単に3勝したので日本一まで1勝で済むから日本一になりそうだ、と言うだけのことで、過去統計を引き合いに出す必要もない。

初戦を勝ったチームの日本一確率62%、についても考えてみよう。この場合は、初戦を勝ったチームをもとに、2戦目以降が

3勝0敗 → 1通り

3勝1敗 → 3通り (最後勝利が固定していて、3_C_1)

3勝2敗 → 6通り (4_C_2)

3勝3敗 → 10通り (5_C_2)

2勝4敗 → 10通り (最後に敗北が固定していて、5_C_2)

1勝4敗 → 4通り (4_C_1)

0勝4敗 → 1通り

なので、阪神が優勝する確率は(1+3+6+10)/(1+3+6+10+10+4+1)=0.5714286

データによると、

過去73度の日本シリーズで、第1戦で先勝したチームは45度日本一に。

とのことなので、有意性を二項検定で見てみると

> binom.test(45,73,p=20/35)

Exact binomial test

data: 45 and 73

number of successes = 45, number of trials = 73, p-value = 0.4791

alternative hypothesis: true probability of success is not equal to 0.5714286

95 percent confidence interval:

0.4952062 0.7279136

sample estimates:

probability of success

0.6164384

となって、やはり特に有意差はありません。

この簡単統計解析によれば、日本シリーズは「4勝した方が日本一になる」と言う以上の意味特になく、勝ち方(第一戦で先勝する、とか、2勝2敗から勝ち越す、とか)によって日本一になる確率が左右されることはなさそう。もっといえば、「勝ち星が多い方が日本一になる確率が高い」って、当然のことなだけ。

と、統計初心者が考えてみましたが、統計猛者のコメントがあればお願いします。例えばマルコフ過程としてモデル化することができるのかな。何かパラメータを入れて(例えばホーム球場での勝率確率は高いとかなんとか)、優勝確率が、何も考えず出す確率よりも高くなることに寄与するような因子を探す、とかだとセイバーメトリクス的になるのかも。

2023-09-27

オブジェクト指向で学ぶ人生

Microsoft本社入り口に貼ってあるらしいコード

時は金なりという意味か?

    public class Person {
        BasicInfo info;
        float stock;
        float Value;
        public string Name(bool isSpy){
            return isSpy ? info.Name : info.Name.ToSecondName();
        }
        public string Sex(bool isNormal){
            return isNormal == info.isMan ? "Man" : "Woman";
        }
        public float Earn(bool isExtra = false){
            float sexPad = info.isMan ? 1f : 0.5f;
            float racePad = info.isWhite ? 1f : 0.5f;
            var delta = DateTime.Now - info.Birth;
            int age = (int)(delta.TotalDays / 365);
            float result = Value * sexPad * racePad * age;
            if(isExtra){
                Value += result;
            }
            return result;
        }
        enum Race{
            White, Black, Yellow
        };
        class BasicInfo{
            public string Name;
            public int NationalId;
            public bool isWhite;
            public bool isMan;
            public DateTime Birth;
            public BasicInfo(string Name, int NationalId, Race race, bool isMan){
                this.Name = Name;
                this.NationalId = NationalId;
                this.isWhite = race == Race.White;
                this.isMan = isMan;
                Birth = DateTime.Now;
            }
        }

2023-09-19

入力と欲しい出力を言語化する能力があればマクロ書く能力不要

anond:20230919002911

ChatGPT日本語命令したら秒で作ってくれるのでVBAGAS書く能力不要になったんだが。「A1からI9に数独の初期値入れてあるシートの残りのマス埋めるVBAマクロ作って」の一言数独解くの作ってくれるぞ

ChatGPTが補足している通りロジックは基本しか使っていないので初期値から最終形までに仮定して入れる局面があるものは解けないし非効率ではあるものの初級は解けるし遅いPCでも一瞬で終わる。必要なのは入力の形と欲しい出力を日本語にする能力Hello World実行できるレベル知識コード読んでデバッグできる能力があればなおよいがGPTに教えてもらえばいいし、今業務やってる派遣の人に動作確認してもらって不満なところをAI修正させればよいので業務をよく分かっている社員やらせたほうが会社としてはい戦略

プロンプト

A1からI9に数独の初期値入れてあるシートの残りのマス埋めるVBAマクロ作って

ChatGPT(4.0)の答

数独を解くためのVBAマクロ作成するのは複雑ですが、以下は一つの例です。このマクロはシートのA1からI9の範囲数独を解きます

Function IsPossible(y, x, n, grid) As Boolean
    Dim i As Integer
    Dim j As Integer
    ' 同じ行や列にnが既にあるか確認
    For i = 1 To 9
        If grid(y, i) = n Or grid(i, x) = n Then
            IsPossible = False
            Exit Function
        End If
    Next i
    
    ' 3x3ボックス内にnが既にあるか確認
    Dim x0 As Integer: x0 = ((x - 1) ¥ 3) * 3
    Dim y0 As Integer: y0 = ((y - 1) ¥ 3) * 3
    For i = 0 To 2
        For j = 0 To 2
            If grid(y0 + i + 1, x0 + j + 1) = n Then
                IsPossible = False
                Exit Function
            End If
        Next j
    Next i
    
    IsPossible = True
End Function

Sub SolveSudoku()
    Dim grid(1 To 9, 1 To 9) As Integer
    Dim i As Integer
    Dim j As Integer
    
    ' グリッドをシートから読み込む
    For i = 1 To 9
        For j = 1 To 9
            grid(i, j) = Cells(i, j).Value
        Next j
    Next i

    If Solve(grid) Then
        ' 解をシートに書き出す
        For i = 1 To 9
            For j = 1 To 9
                Cells(i, j).Value = grid(i, j)
            Next j
        Next i
    Else
        MsgBox "解けませんでした"
    End If
End Sub

Function Solve(ByRef grid) As Boolean
    Dim i As Integer
    Dim j As Integer
    Dim n As Integer

    For i = 1 To 9
        For j = 1 To 9
            If grid(i, j) = 0 Then
                For n = 1 To 9
                    If IsPossible(i, j, n, grid) Then
                        grid(i, j) = n
                        If Solve(grid) Then
                            Solve = True
                            Exit Function
                        End If
                        grid(i, j) = 0
                    End If
                Next n
                Solve = False
                Exit Function
            End If
        Next j
    Next i
    Solve = True
End Function

このコードVBAモジュールに追加して、シートに数独の初期値を入力してからSolveSudokuマクロを実行すると、マスを埋めることができます

ただし、このコード基本的バックトラック法を使用しており、非常に複雑な数独には効率的ではない場合があります。より高速な解法や最適化を求める場合は、追加の手法アプローチ必要です。

初期値

https://si-coding.net/sudoku4.html

   2 3 5   7
  8     3 
3     4 5 1 6
  6  1 2 4  
  4  9 8  2 
  2 5   1  3
 9       4
   6     1
   4  1 2 6 
実行結果
1 6 9 2 3 5 8 4 7
4 5 8 1 6 7 9 3 2
3 2 7 9 8 4 5 1 6
5 3 6 7 1 2 4 9 8
7 1 4 3 9 8 6 2 5
9 8 2 5 4 6 1 7 3
6 9 1 8 2 3 7 5 4
2 4 5 6 7 9 3 8 1
8 7 3 4 5 1 2 6 9

2023-09-11

anond:20230911065242

do until activecell.value = ""

やりたいこと

activecell.offset(1,0).select

loop

これだけでだいたいいける

2023-09-09

anond:20230909133454

Pitching Run Value-15下位7%
Fastball Run Value-5下位22%
Breaking Run Value-6下位10%
Offspeed Run Value-4下位11%


申し訳ないがゴミやで

2023-08-25

test

https://chat.openai.com/share/c80d83ea-752b-4561-a162-7ea0bd116d56

CSVVBAエクセル

Option Explicit

Dim objExcel, objWorkbook, objWorksheet

Dim strFolderPath, strSourceFile, strTargetFile, strSearchString, strReplaceString

Dim intLastRow, intRow, intColumn

' Excelオブジェクト作成

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

' フォルダパスファイル名の設定

strFolderPath = ".\" ' スクリプトと同じフォルダにあることを仮定

strSourceFile = "変更一覧.xlsx"

strTargetFile = "変更一覧.xlsx"

' Excelファイルを開く

Set objWorkbook = objExcel.Workbooks.Open(strFolderPath & strSourceFile)

' シートのコピー名前の変更

objWorkbook.Sheets("1月").Copy , objWorkbook.Sheets("1月").Index

objWorkbook.Sheets("1月 (2)").Name = "2月"

' セルの値の置換

Set objWorksheet = objWorkbook.Sheets("2月")

objWorksheet.Cells(1, 1).Value = Replace(objWorksheet.Cells(1, 1).Value, "1月", "2月")

objWorksheet.Cells(2, 7).Value = Replace(objWorksheet.Cells(2, 7).Value, "2023/2/14", "2023/3/14")

' 最終行の取得

intLastRow = objWorksheet.Cells(objWorksheet.Rows.Count, 1).End(-4162).Row ' xlUp

' 値のクリア

For intRow = 8 To intLastRow

For intColumn = 1 To 6

objWorksheet.Cells(intRow, intColumn).ClearContents

Next

Next

' テキストファイルの読み込み

Dim objFSO, objTextFile, strContents, arrLines, arrFields, strNewContents

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objTextFile = objFSO.OpenTextFile(strFolderPath & "変更一覧.txt", 1)

strContents = objTextFile.ReadAll

objTextFile.Close

' フィールド区切り文字カンマに設定してデータを分割

arrLines = Split(strContents, vbNewLine)

For Each strContents In arrLines

arrFields = Split(strContents, ",")

For Each strContents In arrFields

If IsNumeric(strContents) Then

strNewContents = strNewContents & "'" & strContents & ","

Else

strNewContents = strNewContents & strContents & ","

End If

Next

strNewContents = Left(strNewContents, Len(strNewContents) - 1) & vbNewLine

Next

' データをシートに貼り付け

Set objWorksheet = objWorkbook.Sheets("2月")

objWorksheet.Cells(1, 8).Value = strNewContents

' セルの値の置換

objWorksheet.Cells(123, 1).Value = Replace(objWorksheet.Cells(123, 1).Value, "F", "FH")

' Excelファイルを保存して閉じる

objWorkbook.Save

objWorkbook.Close

objExcel.Quit

' オブジェクト解放

Set objWorksheet = Nothing

Set objWorkbook = Nothing

Set objExcel = Nothing

Set objFSO = Nothing

Set objTextFile = Nothing

WScript.Echo "スクリプトの実行が完了しました。"

2023-07-19

エンジニアセイバーメトリクス

代表的セイバーメトリクス指標は以下の通りです

これらの公開された指標を元に、企業が期待するエンジニアを選ぶ

しかし、批判的/懐疑的意見も多く、改善必要と言われている

2023-06-30

西日本ITシステムは総じてヒドイ

東京から大阪引っ越して感じたけど

ICOCA周りのWeb系にしても他のいろんなところでITシステムがひどい

実装バグが多いとかじゃ無くてそもそもの考え方がダメ

過去に一番酷かったのは某大手企業の社内システムだけど

会計とか資産管理ITシステムDBを直接編集するようなUIになってた

資産登録しようとしたらカラムを全部手打ちで埋めないとダメ、みたいな感じ

INSERT文のVALUE手書きしてる気分

おまけにDBの制約条件をチェックしてくれない上にバッチ処理なので

実際に投入してみて次の日に「エラー登録できませんでした」って返ってくるとか

資産1つ登録するのに1週間ぐらい格闘したことがある

まぁこれは極端な例だけど似たようなシステム無茶苦茶多いし

ユーザー提供してるようなシステムでも使いにくいの多いよね スシローとかまさにそれ

たまに良く出来てる奴があるんだけど大体が東日本、というか東京側の会社プロダクト

西日本側の開発でもコンサルが入ってるものはそれなりにちゃんとしてるんだけど

自社開発とか子会社開発のプロダクトは、「学生卒業研究か?」っていうぐらいヒドイ

いや学生に失礼なレベルでヒドイ

スマホアプリで出来が悪いアプリあったら会社調べて見ると大体が西日本だよ(というか大阪近辺)

JRとかNTTとかITシステムに苦手な会社西日本側の支社になると輪をかけて酷くなる

もともとモバイルSUICAアプリもヒドイ出来だったよね(最近はそうでもないが)

西に拠点があるPanasonicとかSHARPとかITシステム最悪でしょ

東芝とか日立はそうでもないじゃん

なんか企業理念というか企業文化がそういう感じなんだと思うな

2023-05-20

LaTeXで、縦書き人文書のように全角括弧()級数下げをするマクロ

LaTeXで、縦書き人文書のように全角括弧()級数下げをするマクロを書いた。

テスト環境は、LuaLaTeX+jlreq

・「(」が来ると級数下げる

・「)」が来ると級数上る

・「()」のなかに入れ子の「()」が来た場合は、変更しない(本づくりのお作法

脚注内では「()」内も級数下げしない(本づくりのお作法

※ 「(」と「)」が対応してないと級数下げたまま、になってしま可能性があるので、ちゃんと合わせておくこと

\usepackage{relsize}\usepackage{newunicodechar}\newif\iffoot\footfalse\newcounter{parnest}\setcounter{parnest}{0}%()内の級数下げマクロ変数の準備(級数下げしたくない箇所は、()前後を\foottrue~\footfalseで括ること)

\let\origfootnotetext\footnotetext\renewcommand{\footnotetext}[2][]{\ifx\relax#1\relax \origfootnotetext{\foottrue #2 \footfalse}\else\origfootnotetext[#1]{\foottrue #2 \footfalse}\fi}\let\origfootnote\footnote\renewcommand{\footnote}[1]{\ifnum\ltjgetparameter{direction}=3\origfootnote{\foottrue #1 \footfalse}\else\origfootnote{\foottrue #1 \footfalse}\fi}%脚注コマンドを変更

\let\origendnotetext\endnotetext\renewcommand{\endnotetext}[2][]{\ifx\relax#1\relax \origendnotetext{\foottrue #2 \footfalse}\else\origendnotetext[#1]{\foottrue #2 \footfalse}\fi}\let\origendnote\endnote\renewcommand{\endnote}[1]{\ifnum\ltjgetparameter{direction}=3\origendnote{\foottrue #1 \footfalse}\else\origendnote{\foottrue #1 \footfalse}\fi}%文末脚注コマンドを変更

\makeatletter\chardef\my@J@kakkostart="FF08\newunicodechar{(}{\iffoot\my@J@kakkostart\else\addtocounter{parnest}{1}\ifnum\value{parnest}=1 \relsize{-0.5}\my@J@kakkostart\else\my@J@kakkostart\fi\fi}\makeatother%開くカッコは脚注外では級数下げ

\makeatletter\chardef\my@J@kakkoend="FF09\newunicodechar{)}{\iffoot\my@J@kakkoend\else\addtocounter{parnest}{-1}\ifnum\value{parnest}=0 \my@J@kakkoend\relsize{0.5}\else\my@J@kakkoend\fi\fi}\makeatother%閉じるカッコは脚注外では級数上げ(元に戻す)

2023-04-26

メモ

Sub CheckForGarbledCharacters()

Dim ws As Worksheet

Dim rng As Range

Dim cell As Range

Dim char As String

Dim i As Integer

Dim garbledFound As Boolean

Dim unicodeVal As Long

garbledFound = False

' すべてのワークシートをチェックします。

For Each ws In ThisWorkbook.Worksheets

Set rng = ws.UsedRange

' 各セルスキャンして文字化けがないかチェックします。

For Each cell In rng

For i = 1 To Len(cell.Value)

char = Mid(cell.Value, i, 1)

unicodeVal = AscW(char)

' ASCII範囲日本語範囲を除外

If Not ((32 <= unicodeVal And unicodeVal <= 126) Or (12353 <= unicodeVal And unicodeVal <= 12447) Or (12448 <= unicodeVal And unicodeVal <= 12543) Or (65382 <= unicodeVal And unicodeVal <= 65439) Or (19968 <= unicodeVal And unicodeVal <= 40959)) Then

MsgBox "文字化けが見つかりました: " & vbCrLf & _

"ワークシート: " & ws.Name & vbCrLf & _

"セル: " & cell.Address & vbCrLf & _

"セルの値: " & cell.Value & vbCrLf & _

"文字化けしている文字: " & char, vbExclamation

garbledFound = True

Exit For

End If

Next i

' 文字化けが見つかった場合、次のワークシートへ移動します。

If garbledFound Then Exit For

Next cell

If garbledFound Then Exit For

Next ws

If Not garbledFound Then

MsgBox "文字化けが見つかりませんでした。", vbInformation

End If

End Sub

2023-04-25

メモ

Sub ImportTextFileWithoutDelimiter()

Dim fileName As String

Dim targetSheet As Worksheet

Dim fileNo As Integer

Dim content As String

Dim lines As Variant

Dim i As Long

' テキストファイルパス指定します。

fileName = "C:\path\to\your\file.txt"

' インポート先のワークシートを指定します。

Set targetSheet = ThisWorkbook.Worksheets("Sheet1")

' ファイルを開き、内容を読み込みます

fileNo = FreeFile()

Open fileName For Input As fileNo

content = Input(LOF(fileNo), fileNo)

Close fileNo

' 改行で分割し、配列に格納します。

lines = Split(content, vbCrLf)

' 各行をワークシートに貼り付けます

For i = LBound(lines) To UBound(lines)

targetSheet.Cells(i + 1, 1).Value = lines(i)

Next i

End Sub

Option Explicit

Sub ListFilesInFolder()

Dim folderPath As String

Dim targetSheet As Worksheet

Dim fso As Object, folder As Object, file As Object

Dim nextRow As Long

' フォルダパス指定します。

folderPath = "C:\path\to\your\folder"

' インポート先のワークシートを指定します。

Set targetSheet = ThisWorkbook.Worksheets("Sheet1")

' FileSystemObject作成します。

Set fso = CreateObject("Scripting.FileSystemObject")

Set folder = fso.GetFolder(folderPath)

' ヘッダーを書き込みます

With targetSheet

.Cells(1, 1).Value = "File Name"

.Cells(1, 2).Value = "File Size"

.Cells(1, 3).Value = "Timestamp"

End With

' 次の行番号を取得します。

nextRow = 2

' フォルダ内のファイル情報を取得し、ワークシートに書き込みます

For Each file In folder.Files

With targetSheet

.Cells(nextRow, 1).Value = file.Name

.Cells(nextRow, 2).Value = file.Size

.Cells(nextRow, 3).Value = file.DateLastModified

End With

nextRow = nextRow + 1

Next file

' オブジェクト解放します。

Set fso = Nothing

Set folder = Nothing

Set file = Nothing

End Sub

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