問題タブ [inclusion]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
1 に答える
2159 参照

c++ - C++ での「未解決のインクルード」エラー

私は Eclipse を使用する新しい C++ プログラマーです。Eclipse は C++ を認識しているようです: 新しい C++ プロジェクトを作成し、構文を理解することができました。ただし、何かを#includeしようとすると、「未解決のインクルード」エラーが発生します。

CDTをインストールしました。また、MinGW と MySys をインストールし、パス変数を正しく設定しました。

プロジェクトを右クリックして「プロパティ -> C/C++ ビルド -> 設定」に移動すると、「バイナリ パーサー」タブと「エラー パーサー」タブしかアクセスできません。ウィンドウは次のようになります...

設定ウィンドウ

...しかし、ツール設定、ビルド手順、またはビルド アーティファクト タブが表示されません。

これまでの私の調査結果は以上です。次に何をすべきですか?

0 投票する
2 に答える
22544 参照

ruby-on-rails - Rails インクルージョンの検証

次の包含検証に苦労しています。

これをコンソールで実行すると、

次にTypeError: can't convert nil into String、のinclude?メソッドでa を取得しactive_model/validations/inclusion.rbます。

ただし、検証行を次のように変更すると、

その後、検証は期待どおりに機能します。language が nil であるか、予想どおりリスト内のエントリの 1 つでない場合は無効であり、クラッシュはありません。

コードをステップ実行して、包含リストが正常に生成されていることを確認しました。では、なぜクラッシュするのでしょうか。プレゼンスの検証で問題が検出され、それ以上の検証が妨げられるべきではありませんか? また、値をハードコーディングするのではなく、リストを生成するとクラッシュするのはなぜですか?

proc 形式を使用して、:in違いが生じるかどうかを確認してみましたが、違いはありませんでした。しかし、アプリの実行中に I18n.available_locales が変更されることはないため、アプリが読み込まれたときに一度だけリストを生成したいので、それが必要になるとは本当に思っていませんでした。

更新: アイデアがあり、次のコードをテストしました。

このコードも同じエラーを生成するため、問題は I18n などにはありません。と の違いに関係してい%(en fr es)ます['en','fr','es'].join(' ')

0 投票する
4 に答える
129 参照

javascript - Javascript のインクルードによる奇妙な動作

こんにちは、html プロジェクトの JavaScript ファイルを含むいくつかの問題が発生しています。body タグの直前にこのように含めると、サイトが正しく機能しません。

ただし、最後のタグを削除して、このようにする場合

すべて正常に動作します。

そして、頭の中に含めると、構文に関係なく機能します。なぜこのように振る舞うのですか?

0 投票する
2 に答える
1142 参照

apache - Dynamic inclusion of piwik code by means of server side filtering inside apache server

After a few hours of fruitless attempts I would like to ask you all for a little assistance with a simple setup:

For a bunch of web applications and sites I run using the apache2 http server I use Piwik for a simple statistical overview. That works fine. What annoys me is that with every additional app/page and every update/upgrade I have to take care to manually maintain the javascript code required by piwik to be included into the html markup.

To simplify that maintainance I want have that code added by apache: I want to use some apache modules: mod_filter, mod_env, mod_substitute and mod_include. The idea is to have all html files delivered injected with the piwik code by means of a filter. That filter uses substitution to prepend the </body> tag with a placeholder. That placeholder again is a sgml tag processed by server side inclusion. That inclusion finally replaces the placeholder with the piwik code which is given the required numerical site id in a dynamic way.

So all that is left when configuring a new virtual host will be to specify two lines inside the apache configuration:

  1. include the filter setup stored in a small file
  2. specify the numerical piwik site id by setting an environment variable

No more fiddling around with template files inside the apps!


I am very close to a solution, one step is missing...

Maybe some of you gurus here spot what I am missing !


The (much simplyfied) configuration of the virtual host:

The (shortened) configuration file included above:


Last file /srv/www/internal/piwik.php referenced in the Alias above: This is the file providing the piwik code. It is like those computed by piwik itself, except for one thing: The numerical site index is dynamically replaced with a value from the environment variable

What I got working so far:

  • The php based dynamic piwik scniplet is working, I can call it with a browser and see the code in the html markup source complete with a numerical id taken from an environment variable defined in the configuration for testing purposes. Also, when I specify a nin-numerical id that way I get the expected placeholder <!-- invalid piwik site id: ... -->
  • The filter works (is applied) in general: the </body> tag is replaced by the placeholder . I can check this by commenting out the FilterProvider adding the INCLUDES directive at the beginning. In that case I see the placeholder in the generated html markup.
  • That FilterProvider is actually recognized and executed by apache: before I had errors about a missing Options +Includes in the configuratioon and the like, that is sorted out, apache does not complain any more. Also the placeholder is removed again, when the FilterProvider mentioned above is not commented out. So I assume the include process is working.
  • Aparently the problem is not that the server side inclusion refers a php script. I get no error messages and tests with a static file instead showed no difference.

It appears as if the setup works fine, no errors thrown, nothing strange in the rewrite log. However although the include filter aparently works the content I would expect to be included is empty. The placeholder inserted by the first SUBSTITUTE step is replaced again by the second INCLUDE step. but unfortunately by empty content, so it is removed. I have no idea why.

0 投票する
1 に答える
4371 参照

c++ - 未解決の包含エラーEclipse

そこで私は、3Dゲームプログラミングのためのデジタルメディアアカデミーと呼ばれるものに行きました。3Dゲームを作成するために、MacbookProを使用してPanda3Dと一緒にEclipseを使用しました。私はそこで美しく走る素晴らしいゲームを作りました。ただし、すべてをUSBに入れて、自宅の個人用Macbook Proにすべてをインストールすると、これらのコード行の横に「未解決の包含」という疑問符が表示されます。

//Panda3Dのもの。

//C++のもの

Eclipseの問題セクションで私はこれを取得します:

0 投票する
3 に答える
2278 参照

python - リスト要素を別のリストに含めることに基づいてバイナリ リストを作成する方法

単語の 2 つのリスト と が与えられた場合、辞書の i 番目の単語が文に現れることを 1 が示すよう に、の単語を含めることに基づいてバイナリ表現を作成しようとしていますdictionarysentencedictionarysentence[1,0,0,0,0,0,1,...,0]

これを行う最速の方法は何ですか?

サンプルデータ:

サイズが約 56'000 要素の非常に大きなリストで作業していることを考えると、次よりも速いものはありますか?