不正なアクセス (404) そんなページは存在しないです。 ごめんなさい。
Wednesday April 22, 2009 I’ve been keeping busy writing all sorts of fun stuff lately, but a few weeks ago I was really fighting with Android’s logcat debugging stream. It dumps out tons of useful information, but it’s easy to get lost in the flood of text. So I whipped up a quick Python script that reformats the logcat output into a colorful stream that is much easier to visually follow. One feat
はてなブログに移行して最初の記事はやはりPythonネタにしました。 はてなブログいいですね。デザインの編集がやりやすくなったのと、Markdownで書けるのが素晴らしいです。 PyCon 2013の動画を見ていたら、素晴らしい"Transforming Code into Beautiful, Idiomatic Python"という発表を見つけたのでそのまとめです。 今どきのPythonコードのベターな書き方を紹介しています。 Transforming Code into Beautiful, Idiomatic Python ... スライドはこちらにありました 結構長くなってしまったので、知ってる項目は読み飛ばしてもらえばと思います。 ループの基本 整数のループ まずは基本のループ。 Cのfor int i=0; i<6; i++をPythonで単純に書くとこうなります。 for
「〜」の文字コードはShift_JISで'\x81\x60'で、CP932でも同じコードです。 が、Unicodeには、「波型」と「全角ティルダ」という二つの異なる「〜」が存在します。一般的には「波型」であるu'\u301c'が使われます。Shift_JISの「〜」'\x81\x60'はUnicodeの「波型」にマップされています。 '\x81\x60'.decode('SJIS') == u'\u301c' 「全角ティルダ」のu'\uff5e'は使われない文字なのかと思いきや、 '\x81\x60'.decode('CP932') == u'\uff5e' Windowsのネイティブ文字コードセットであるCP932(Shift_JISをベースとした独自拡張)では、「〜」'\x81\x60'はUnicodeでいうと「全角ティルダ」u'\uff5e'にあたるそうです。この点において、CP93
Johnny Cache¶ Johnny Cache is a caching framework for django applications. It works with the django caching abstraction, but was developed specifically with the use of memcached in mind. Its main feature is a patch on Django’s ORM that automatically caches all reads in a consistent manner. It works with Django 1.1 thru 1.4 and python 2.4 thru 2.7. You can install johnny with pip:
DjangoのUserモデルを拡張したいのでやってみた。 使用したDjangoのバージョンは1.3 継承用のアプリの作成ここではaccountsというアプリ名に。 python manage.py startapp accounts auth.models.Userを継承したモデルの作成マネージャーも変更できるようにauth.models.UserManagerを継承したクラスに変更。 継承したUserモデルには電話番号のfieldを追加してみた。 from django.db import models from django.contrib.auth.models import UserManager as AuthUserManger, User as AuthUser class UserManager(AuthUserManger): pass class User(AuthUs
Django Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. Thanks for checking it out. All documentation is in the "docs" directory and online at https://docs.djangoproject.com/en/stable/. If you're just getting started, here's how we recommend you read the docs: First, read docs/intro/install.txt for instructions on installing Django. Next, w
この前書いたAmazonの商品個別ページのURLからASINを取得するというエントリに載せた、ウノウのアレを移植した関数で色々試してみてたところ、なんか思ったよりもASINを抽出出来る割合が少ないというか取りこぼしが多いんじゃないかという気がしたため、真面目に自力で作ってみました。(正直汚ねぇコードだなーとも思ってたし。) 処理内容は、amazonのurlかチェックして、もしそうならasinを含むかどうかチェックするという感じです。 def get_asin_from_url(url): '''urlからasinを抽出''' url = url.lower() amazon_r = re.compile(r'^https?://(?:[^.]+\.)?(?:images-)?amazon\.(?:com|ca|co\.uk|de|co\.jp|jp|fr|cn)(/.+)$') amazo
Djangoでテーブル名やカラム名の変更( マイグレーション, South ) | 世界的日曜WEBプログラマー日記 Table name, Column nameのリネームなどの方法(Django South) こんにちわ。宅配弁当専門のWebページを作っているDyanticoの等々力です。 マイ食でもそうだけど、Webサイトを運用しているとデータベースの変更が生じることがよくある。food_itemのテーブルに価格等追加したいなど。 DBの骨格の変更、例えばテーブル名の変更、カラム名の変更や追加、削除。こうした操作をMigration(マイグレーション)とよぶ。(要はDBやテーブルに対する操作) DjnagoではこのMigration作業をコマンドベースで行う方法が用意されている。 恐らくほとんどのDjangoユーザーはカラム追加のような作業をDBに直接アクセスしておこなっているか、M
このドメインは お名前.com から取得されました。 お名前.com は GMOインターネットグループ(株) が運営する国内シェアNo.1のドメイン登録サービスです。 ※表示価格は、全て税込です。 ※サービス品質維持のため、一時的に対象となる料金へ一定割合の「サービス維持調整費」を加算させていただきます。
2011年7月24日から、アナログテレビ放送は終了し、デジタル放送に移行するそうです。 twitterも、いつからかは知らないけどBasic認証を終了し、OAuth認証に移行するそうですよ! 大変ですね!! 現在私が作ったtwitter-bot@Korokですが、twitterと話はpython-twitterでつけています。python-twitterはどうやらBasic認証らしいし、なんか更新かかってないみたいだし、id:tohaeちゃんがOAuth対応はやくした方がいいよって云うからちゃっちゃとやっちゃいましょう。 使用するライブラリはtweepy。 公式 : GitHub Pages · File Not Found · GitHub ドキュメント : GitHub Pages · File Not Found · GitHub 参考にしたエントリ : TwitterのbotをOA
Shopify just laid off approximately 20% of its staff. A lot of fantastic people were let go. (If you're hiring, let me know, I can put you in touch with some amazing engineers, managers, and designers!) For those of us left behind, there's a bit of a sense of "what now?", "why wasn't I laid off too?", or "why did X get laid off instead of me (or Y)?"" One of Shopify's values is: "Thrive on Change"
Kivy has been built to be easy to use, cross-platform and fast. With a single codebase, you will be able to deploy apps on Windows, Linux, macOS, iOS and Android. Business Friendly Kivy is released under the MIT License, is 100% free to use, and is professionally developed, backed and maintained. Companies and individuals are using Kivy for their projects every day.
トリビアルな例だが、元の関数(func)をデコレート・ラップするmydecoratorというデコレータを書いた時、下のように単純にinnerを返すと、 def mydecorator(func): def inner(*args, **kwds): print "Hi, I'm inner!" return func(*args, **kwds) return inner @mydecorator def hello(to): """ Say hello to somebody """ print "Hello, %s!" % to if __name__ == '__main__': print repr(hello) print hello.__doc__ 結果として、 None のように、デコレートされた元の関数(hello)の関数名やドキュメント文字列が失われてしまう。デコレータを
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く