2014-01-01から1年間の記事一覧

リスト内包表記

http://www.lifewithpython.com/2014/09/python-list-comprehension-and-generator-expression-and-dict-comprehension.html

リストの重複を削除

http://d.hatena.ne.jp/aroma_black/20110203/1296746826

チェックボックスのチェック切り替え

http://qiita.com/i47_rozary/items/db77352cc0af8d05d39a

重複をカラム指定して削除してオブジェクト取得

http://stackoverflow.com/questions/3852104/select-distinct-individual-columns-in-django

apache再起動

sudo service apache2 reload

Linux仮想マシン上で公開鍵作成してgithubに登録

http://design1.chu.jp/setucocms-pjt/?p=580

loading画像が表示されない

$(function() { $("#loading").css("display", "block"); $.getJSON(url, function() { }); $("#loading").css("display", "none"); }); getJSONしている間loading画像を表示させようと上記のようにしたら、loading画像は表示されずdisplayはnoneのままだっ…

編集した内容を過去のコミットに付け加えたい時

git

git stash git rebase -i [HASH] 編集したいコミットをpick -> editにする 編集したら git commit --amend git rebase --continue

svgグラフのツールチップ内で改行をしたい

ツールチップ内で改行がシンプルにできない。ツールチップ内でブロック要素のtextタグを複数用意して1行ごとに1つのtextタグを使用。 http://ordinary-programming.blogspot.jp/2014/03/d3js.html http://hnakamur.github.io/blog/2013/03/02/multi-series-l…

文字化け

vim

ファイルを開くと日本語が文字化けして表示される。現在のencodingは以下 :set enc? -> encoding=cp932 以下で解決 :e ++enc=utf-8 https://sites.google.com/site/fudist/Home/vim-nihongo-ban/mojibake

Azure SQL Serverではtruncate的なことはできない?

https://social.msdn.microsoft.com/Forums/azure/en-US/ceeae474-fb19-4282-a56b-c0718f06e9ab/sql-azure-identity-reseed?forum=ssdsgetstarted http://dba.stackexchange.com/questions/10594/dbcc-checkident-doesnt-work-for-reseeding-tables http://w…

AppRegistryNotReady: Models aren't loaded yet.

objects.all().delete()でエラー C:\Users\shohaya\tf-manager\tfmanager\db>python initteam.py Traceback (most recent call last): File "initteam.py", line 60, in init_team() File "initteam.py", line 49, in init_team obj.delete() File "C:\Anaco…

ファイル情報取得

http://d.hatena.ne.jp/nakamura001/20090203/1233652705 http://enajet.air-nifty.com/blog/2010/05/dos-299a.html http://blog.livedoor.jp/moya_pro/archives/32153417.html http://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q1326820783

settings読み込みエラー

django.core.exceptions.ImproperlyConfigured: Requested setting CACHES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings. 環境変数…

pythonからodbcでSQL Serverに接続

http://bluestick.jp/tech/index.php/archives/215

django1.7新機能migrations

http://a-records.info/2014/09/29/18/

django.db.utils.Error: ('00000', '[00000] [iODBC][Driver Manager]dlopen({SQL Server Native Client 10.0}, 6): image not found (0) (SQLDriverConnect)')

~/TFManager/tfmanager $ python manage.py migrate --list Traceback (most recent call last): File "manage.py", line 10, in execute_from_command_line(sys.argv) File "/Users/shohayakawa/anaconda/lib/python2.7/site-packages/django/core/manageme…

macにSQL Server Expressはインストールできない?

macではできないっぽい http://dba.stackexchange.com/questions/62513/sql-server-on-mac linuxではできる? http://msdn.microsoft.com/en-us/library/hh568451%28v=sql.110%29.aspx

Error creating new content types. Please make sure contenttypes is migrated before trying to migrate apps individually

Error creating new content types. Please make sure contenttypes is migrated before trying to migrate apps individually djangoでmigrationのラベルを指定してmigrateしようとした時のエラー。このときはDB移行した時の最初のmigrateだったのでcontent…

Windows Azure SQL Database 管理ポータルから接続文字列をコピーしてきて使う場合

Windows Azure SQL Database 管理ポータルから接続文字列をコピーしてきて使う場合は、SQL Server Native Client 11 の場合、ODBC 接続において Driver 指定を、{SQL Server Native Client 10.0} → {SQL Server Native Client 11.0} に書き換える必要あり ht…

ERROR IM002 Microsoft ODBC Driver Manager

ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified in SSRS odbcのエラー settings.pyで指定しているODBCの名前が違うことによるエラーだった。 あとSQL Server Expressをインストールしていない…

git cloneでエラー

git

fatal: The remote end hung up unexpectedly fatal: index-pack failed リポジトリが大きい場合と少しずつcloneしないといけない git clone --depth 10 [url] git fetch --unshallow ちなみにdepth10でクローンしてからもう一回depth10でfetchしようとした…

UnicodeDecodeError: 'utf8' codec can't decode byte 0x97 in position 3

pipでインストール時にUnicodeDecodeError C:\> pip install django-pyodbc-azure Downloading/unpacking django-pyodbc-azure Cleaning up... Exception: Traceback (most recent call last): File "C:\Anaconda\lib\site-packages\pip\basecommand.py", li…

django-pyodbc-azureをインストール

$ sudo pip install django-pyodbc-azure Password: Requirement already satisfied (use --upgrade to upgrade): django-pyodbc-azure in /Users/shohayakawa/anaconda/lib/python2.7/site-packages Downloading/unpacking Django>=1.7.1 (from django-pyod…

pipでpyodbcをインストール

pip install pyodbc これだと Could not find any downloads that satisfy the requirement pyodbc と言われる sudo pip install --allow-external pyodbc --allow-unverified pyodbc pyodbc とするとインストールできた。 http://stackoverflow.com/questio…

pipでpyodbcインストール時にエラー

n file included from /private/tmp/pip_build_root/pyodbc/src/buffer.cpp:12: /private/tmp/pip_build_root/pyodbc/src/pyodbc.h:52:10: fatal error: 'sql.h' file not found #include sql.h ^ 1 error generated. error: command 'gcc' failed with exit…

Debug Assertion Failed

fopenするところでNULLになっていた

PythonでMySQLに接続

http://www.python-izm.com/contents/external/mysql.shtml

MULとは

MUL -> 重複可能な外部制約キーPRI -> 重複不可な外部制約キー 外部制約キー -> テーブルの指定したカラムに格納できる値を他のテーブルに格納されている値だけに限定するもの http://hrt0kmt.hatenablog.com/entry/2014/07/09/000000 http://www.dbonline.j…

Djangoで既存テーブルの構造変更

調べてみるとmodelを変更した後にalter tableしないといけないとあったが、しなくてもできたっぽい。 ①model変更②makemigrations③migrate python manage.py makemigrations python manage.py migrate http://i2bskn.hateblo.jp/entry/20120616/1339852257 ht…