問題タブ [convention]
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.
django - Locations of templates and static files in Django
I am planning a new Django project and want to get everything right and stuff. I stumbled over the question of how to organize the project directory layout. Luckily, there are quite a few examples of good project templates out there in the web. Still, there is one thing I struggle to get in my head:
It is the recommended way to put template files into a separate directory under the project root that is divided into subdirectories by apps. So, templates are not located within the app directories. That seems logical to me since we want to separate application logic from representation logic. But what about static files? Here, the common practice seems to be to locate the static files within the app dirs and load them into a 'static' directory under the project root at development time (collectstatic). And this logic I do not understand. Since static files (i.e. js, css, images) are usually accessed within templates, not within application code, I would count them to presentation logic. Then why aren't they stored just like templates are - a directory under the project root, with subdirectories for the single apps?
I know I can store these files wherever I want but I guess there might be a good reason why folks are doing it this way. What could this reason be?
upload - struts2 コンベンション プラグインで FileUploadInterceptor を使用する方法
注釈によってアクションに FileUploadInterceptor を設定しようとしています:
私の問題は、アクションクラスにインターセプターを設定しない場合にのみ機能することです。上記のように FileUploadInterceptor であっても、インターセプターを設定するとすぐに、属性は入力されません。
基本的に、これは機能します:
しかし、これは機能しません:
また
見つけた!解決策は次のとおりです。
java - UML から Java コードへの変換規則
最後に 1..1 またはそのようなものが書かれている単一の単純な矢印を除いて、他の矢印は無視してください。
私は、UML 2.0 を紹介する多くの Web サイトや多くの本を参照してきましたが、使用されている 2 つの規則に出くわしました。
2 つのクラスが矢印なしの 1 行で接続され、行末に 1..1、1..* などのいずれかが書かれている場合、
purchasePlan と User を結合する行の終わりで、用語が 0..* ではなく 1..* であると仮定します。
1) 1 つの規則に従って、図に従って User クラスに PurchasePlan オブジェクトの配列を作成し、PurchasePlan に User の 1 つのオブジェクトを作成します。
2) 2 番目の規則に従って、購入計画のオブジェクトの配列のみをユーザーに作成しますが、購入計画にはユーザーのオブジェクトは作成しません。
では、最も広く使用されている、または標準的な規則はどれですか?
database - テーブル名の数字
データベースのテーブル名に数字を使用しても大丈夫ですか
例えば
それは良い命名規則ですか?
javascript - 変数が関数と等しいとはどういう意味ですか?
重複の可能性:
JavaScript: var functionName = function() {} vs function functionName() {}
JavaScript で、変数を関数として定義する目的は何ですか? この規則は以前に見たことがありますが、完全には理解していません。
たとえば、スクリプトのある時点で、関数は次のように呼び出されます。
whatever();
しかし、次のように、という名前の関数が表示されると予想される場所whatever
:
代わりにwhatever
、次のように、関数として定義されているという変数が表示されます。
これの目的は何ですか?関数に名前を付けるだけでなく、なぜこれを行うのですか?
objective-c - 客観的なcコーディング標準と命名規則を分析するためのツール?
Objective C のコーディング標準と命名規則を分析するためのツールはありますか?
coding-style - TODOコンベンションはどこから来たのですか?
この質問は以前に尋ねられたと思いますが、Googleにとっては簡単ではありません。
私はかなり新しいコーダーであり、「TODO」で始まるコメントが付いた、さまざまな言語のコードがたくさんあります。
質問:
- 人々がこれらすべての異なる言語でTODOを書く実際的な理由はありますか、それとも単なる慣習ですか?
- 後者の場合、コンベンションはどこから来たのですか?
TODOをgrepできることがなぜ便利なのかがわかりますが、その背後にある歴史に興味があります。
struts2 - Struts2 の規則とリダイレクト パラメータ
Struts2 Convention プラグインを使用してアクションをマップします。次の問題を解決するのを手伝ってください。ここにアクションマッピングがあります
たとえば、指定された artikelgroep の artGroup がない場合、link _http://site/categorie/hoofdgroep/artikelgroep/
URL_http://site/categorie/hoofdgroep/
にリダイレクトする必要がありますが、これは完全に行われます。ここでの唯一の問題は、望ましくない追加のパラメーターも先頭に追加されることです。したがって、 link _http://site/categorie/hoofdgroep/artikelgroep/
はにリダイレクトされます_http://site/categorie/hoofdgroep/?categorie=categorie&hoofdgroep=hoofdgroep&artikelgroep=artikelgroep.
私の質問は、これらのパラメーターを取り除く方法ですか?
これが私のstruts.propertiesファイルからのいくつかの設定パラメータです
基本的にこれはバグですか、それともこのように動作するはずですか?
おそらくそれはそれほどエレガントな解決策ではありませんが、ここで私がやったことです。私はオーバーライドしましたorg.apache.struts2.dispatcher.ServletRedirectResult#getProhibitedResultParams
python - Python TDD ディレクトリ構造
Python で TDD に使用される特定のディレクトリ構造はありますか?
チュートリアルではテストの内容について説明しますが、テストを配置する場所については説明しません
Python Koans を調べてみると、次のようなものだと思われます。
私はこれを正しく行っていますか?TDD のディレクトリ階層を教えてくれる良いガイドはありますか? コードとテストのファイルを混在させるのはよくないと聞きました。
参考文献:
- テストに慣れていない経験豊富なプログラマー向けの、TDD に関する優れたオンライン チュートリアルはありますか? #コーディング道場?うーん…コーディング道場のサイトを立ち上げようかな…
- http://onlamp.com/pub/a/python/2004/12/02/tdd_pyunit.html #混合ファイルを表示
- http://www.youtube.com/watch?v=sD6qzJNQEpE #pyTDDmon の見た目と同じくらい素晴らしいので、まず基本を理解したいと思います =) これも混合ファイルです
- http://www.slideshare.net/Skud/test-driven-development-tutorial #説明は「設計・テスト・実装・テストの繰り返し」のみ..
- http://blog.cerris.com/category/django-tdd/ #それでも仕方ない…
- http://docs.python.org/library/unittest.html
python - Django 1.4の静的フォルダー構造?
これは新しいプロジェクト構造です(Django 1.4リリースノートから)。
よくわからないのは、STATIC_ROOTをポイントする必要があるかどうかです。
myproject/myproject/static/
(settings.py、urls.pyと一緒に...)
また
トップレベルディレクトリmyproject/static
(myproject、myapp1、myapp2の隣)?