2012-01-01から1年間の記事一覧
Flaskで別のページのデータをXHRで読もうとしたら、エラー。 Cross origin requests are only supported for HTTP ご覧の通り、Google Chromeは、エラーだしてきます。なので、routeのところに、pathを追加してやって解決!
aspellを使う // mac sudo port install aspell aspell-dict-en // linux sudo aptitude install aspell aspell-dict-en echo "lang en_US" >> ~/.aspell.conf 後は、~/.emacsに下記を書いて、簡単呼び出し (global-set-key "\M-j" 'ispell)
Terminal > Preferences... > Settings > AdvancedSet local environment variables on startup
boost::threadでmutexロックを使うsync.hpp #include <boost/thread.hpp> #include <boost/thread/condition.hpp> class Sync { private: static boost::mutex _thread_mutex; static boost::condition _thread_cond; public: static int do(); }; sync.cpp #include "sync.hpp" boost::mutex Sync::_thread</boost/thread/condition.hpp></boost/thread.hpp>…
boost::conditionは #include <boost/thread.hpp> // <-- こっちじゃない #include <boost/thread/condition.hpp> // <-- こっちをincludeしないとダメ</boost/thread/condition.hpp></boost/thread.hpp>
port selectってコマンドでできるみたい。 インストールされてるpythonリスト port select --list python 現在のpythonのバージョン port select --show python pythonのバージョン変更(python3.2に変更の例) sudo port select --set python python32
has_key()は、文字通り廃止予定みたいなので、inを使う。has_keyとの違いは、順序ぐらい? a = {'a': 1} if a.has_key('a'): print 'True' if 'a' in a: print 'True'
インストール sudo pip install web2py アプリケーション作成 w2p_apps このまま、起動すると、tkがないっていわれるので、インストールしてない場合は、tkをインストールする。 sudo aptitude install python-tk 起動 w2p_run
emacs-for-pythonを設定すると、\C-oがopen-next-lineという関数のデフォルトのキーバインドに設定されてしまう。これは、elscreenのprefixを\C-oに割り当てている人にとっては困る。。。特に、open-next-lineの関数を使わないのなら、epy-editing.elの中の…
EmacsのPythonの設定は、いろいろあってどれがいいのが、どの組み合わせがちゃんと動くのかが、複雑なので、それをお手軽に済ませるかつ、使いやすい環境を構築するには、emacs-for-pythonを使うhttp://gabrielelanaro.github.com/emacs-for-python/ (load-f…
ac-clear-variable-every-10-minutes ERROR このエラーがemacs --debug-initででたら、auto-completeのファイルを削除してみる。
デバッグプリント用にdefineでpを宣言してたら、unordered_mapの#includeのところでエラーがでた。 /usr/include/boost/unordered/detail/allocator_helpers.hpp: In member function ‘boost::unordered_detail::allocator_array_constructor<Allocator>::pointer boost</allocator>…
1プロセス中の最大オープンファイル数 #include <sys/resource.h> int main() { Print::p(sysconf(_SC_OPEN_MAX)); }</sys/resource.h>
Cのソースにある、structをクラスへ書き換える。 関数ポインタ使ってると、下記のようにすればいい。 typedef int (*handler_t)(int fd, void* arg); typedef int (*destructor_t)(void* arg); typedef struct context { void* arg; handler_t handler; dest…
libeventを使ったコードをコンパイルするときに下記のエラーがでました。 error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory ただ単にリンクがたりてないだけ。/usr/local/libにファイ…
要は、関数ポインタね♪ #include <boost/function.hpp> int add(int a, int b) { return a + b; } int sub(int a, int b) { return a - b; } int main() { boost::function<int (int, int)> f = add; Print::p(f(1, 2)); f = sub; Print::p(f(1, 2)); }</int></boost/function.hpp>
tepmlateを書くときは、ヘッダに実装も書かないといけない。けど、宣言が書いてあるヘッダに、実装が書いてあるヘッダを別ファイルとしてincludeすれば、実装と宣言を分けることができる。inc_header.hpp #include "imp_header.hpp" template <typename T> void(T m); te</typename>…