As mentioned in previous blog,  I’m trying to set goals  for this year.

However,  this is a more urgent issue  since I have to go to Australia in the next two weeks.

1. Listen to Australian podcast  30 mins/day

2. Repeat what it said  in podcast  30 mins/day

3. Exercise  at least 20 mins/day

นี่คือสิ่งที่ผมอยากทำเมื่อก่อนต้นปีที่แล้วครับ

http://ijemmy.wordpress.com/2007/12/07/%E0%B8%AB%E0%B8%A5%E0%B8%B2%E0%B8%A2%E0%B9%83%E0%B8%88/

มาดูกันดีกว่า ว่าทำได้กี่อย่าง

  • ลองเขียน Jython  >> กลายเป็นได้เขียน Python แทน
  • อ่านหนังสือ business >> อ่านแต่ technical text จบไปหลายเล่ม
  • ไปว่ายน้ำ >> ออกกำลังกายยังไม่ต่อเนื่องเลย
  • ฝึกพิมพ์สัมผัสมือเดียว >> ฝันไปเถอะ
  • นั่งหลังตรง >> ก็ยังค่อมอยู่
  • กินข้าวไม่มูมมาม >> มูมมามเหมือนเดิม
  • ตั้งใจทำ IBM Mainframe แบบถึงพริกถึงขิง >> โอเคนะ
  • มีสติอยู่กับตัววันละสามสิบนาที >> ลืมไปแล้วด้วยซ้ำว่าจะมีสติ
  • อ่าน CMMI 1.2 ให้จบ >> อ่านได้แค่ PP กับ PMC
  • อ่าน Agile อีกสองเล่ม (น่าอ่านมาก) >> อ่านได้แค่เล่มเดียว
  • ฝึกใช้ XPCOM >> ใช้ไปทำอีหยัง – -”
  • ฝึก programming excel >> สำเร็จ !!
  • ฝึกใช้tool ใน SA ให้คล่องๆ >> โปรแกรมเมอร์ไม่ควรยึดติดกับทูล
  • วิ่งให้ได้ > 45 นาทีโดยไม่หยุด >> ตั้งแต่นั้นมาก็ไม่ได้วิ่ง
  • เลี้ยงหมาพันธุ์ไซบีเรียนฮัสกี >> เอิ่ม…
  • ไปทำ part time กับ Software house >> ได้รับจ๊อบจากอ.แทน
  • ไปฝึกงานหลายๆที่พร้อมกัน??? >> สำเร็จ !!
  • อ่าน textbook ที่เรียนปีนี้ให้หมด >> ไม่ได้อ่านครบแฮะ
  • เป็นผู้ใหญ่ให้มากกว่านี้ >> เป็นเด็กก็ดีอยู่แล้ว
  • ทำกิจกรรม??? (อีกแล้วรึ?) เสกล 1000คน+ >> ปีที่แล้วไมไ่ด้ทำกิจกรรมไรเลย
  • ไปเรียนภาษาอังกฤษ >> ได้ไปเรียนมาสองคอร์ส
  • ไปเรียนภาษาจีน >> ได้ไปเรียนมาวันนึง
  • สอบเซอร์อีกหลายๆใบ >> สอบไปทำไม
  • เล่น Android >> เลิกเขียนโปรแกรมบนมือถือถาวรแล้ว
  • ฝึกใช้ .NET Framework โดยเฉพาะ WPF >> ได้ใช้ Django Framework แทน คนละเรื่องกันเล้ยยยย
  • แข่ง Imagine Cup >> ช่างมันเถอะ
  • ใช้คอมให้น้อยกว่า 2 ช.ม. ต่อวัน !!! >> ฝันกลางวัน
  • ไปกินข้าวเที่ยงกับแฟนบ่อยๆ >> กลายเป็นแฟนไม่มีเวลากินข้าว
  • อ่านหนังสือเกี่ยวกับจิตวิทยาและการบริหาร >> เล่มเก่ายังอ่านไม่จบเลย

อืม…. เป็นปีที่น่าภูมิใจทีเดียว เหมือนจะทำไปได้สักสามอย่าง – -”

อย่างไรก็ตาม คนเราไม่ควรเสียใจกับสิ่งที่ไม่ได้ทำ แต่ควรจะภูมิใจกับสิ่งที่ได้ทำลงไป ใช่ไหมครับ? มาดูกันว่าทำอะไรไปได้บ้าง

  • ฝึกงานที่ NECTEC (CMMI)
  • ฝึกงานที่ Proteus-Technology (Subversion, webservice)
  • ผ่านเข้ารอบสุดท้าย NSC 2008
  • ชนะเลิศ Accenture Experience 2008 ได้ไปออสเตรเลีย
  • จะได้ไปต่างประเทศครั้งแรกในชีวิต ด้วยลำแข้งของตนเอง
  • เขียน Python/Django ได้คล่องในระดับหนึ่ง
  • Adopt TDD มาใช้เกือบตัว
  • รับโปรเจคจากอาจารย์มาสองงาน
  • ใช้ drupal เป็น
  • ช่วยอรุชทำ Barcamp Bangkok2
  • เข้าร่วม Google Dev Fest (แม้จะโดดออกมาเยอะก็ตาม)
  • ภาษาอังกฤษ (ด้านการพูด) พัฒนาขึ้นมาก

งืม ก็ไม่เลวเลยนะ หวังว่าปีหน้าคงจะทำได้ดีกว่านี้ ไว้บล็อคหน้ามานั่งวางแผนดีกว่า

Django URL syntax

January 13, 2009

Summarized from : http://docs.djangoproject.com/en/dev/topics/http/urls/?from=olddocs

1. non-named regular-expression groups


from django.conf.urls.defaults import * #Don't forget this

urlpatterns = patterns('',
    (r'^articles/2003/$', 'news.views.special_case_2003'), #r = raw, ^ = start with, $ = end with, leading '/' isn't neccessary
    (r'^articles/(\d{4})/$', 'news.views.year_archive'), #ex. /articles/2008
    (r'^articles/(\d{4})/(\d{2})/$', 'news.views.month_archive'), #ex /articles/2008/07
    (r'^articles/(\d{4})/(\d{2})/(\d+)/$', 'news.views.article_detail'), #ex /articles/2008/07/5555555 (any no. of digits)

)

(parenthesis) = capture string as a paremeter and pass into the view function

2. named regular-expression groups

urlpatterns = patterns('',
    (r'^articles/2003/$', 'news.views.special_case_2003'),
    (r'^articles/(?P<year>\d{4})/$', 'news.views.year_archive'),
    (r'^articles/(?P<year>\d{4})/(?P<month>\d{2})/$', 'news.views.month_archive'),
    (r'^articles/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d+)/$', 'news.views.article_detail'),
)

(?P<name>pattern) = capture a string and pass the paremeter as  name="xxx"

Note : * slightly more explicit and less prone to argument-order bugs — and you can reorder the arguments in your views’ function definitions*

3. URL with GET parameters

For example, in a request to http://www.example.com/myapp/, the URLconf will look for myapp/.

In a request to http://www.example.com/myapp/?page=3, the URLconf will look for myapp/.

The URLconf doesn’t look at the request method

4…..

  • Always use patterns() to create the urlpatterns variable.
  • In Django 1.0 You can use the url() function, instead of a tuple, as an argument to patterns(). This is convenient if you want to specify a name

5. handler404

if none of the URL patterns match, use 'django.views.defaults.page_not_found'.

6. handler500

in any case of server errors, use 'django.views.defaults.server_error'.

7. handle more than 1 url with the same view (but different argument)

# URLconf
urlpatterns = patterns('',
    (r'^blog/$', 'blog.views.page'),
    (r'^blog/page(?P<num>\d+)/$', 'blog.views.page'),
)

# View (in blog/views.py)
def page(request, num=”1″):
# Output the appropriate page of blog entries, according to num.

8.view prefix… make it shorter

urlpatterns = patterns(‘mysite.news.views’,
(r’^articles/(\d{4})/$’, ‘year_archive’),
(r’^articles/(\d{4})/(\d{2})/$’, ‘month_archive’),
(r’^articles/(\d{4})/(\d{2})/(\d+)/$’, ‘article_detail’),
)

9. multiple prefix

from django.conf.urls.defaults import *

urlpatterns = patterns('django.views.generic.date_based',
    (r'^$', 'archive_index'),
    (r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/$','archive_month'),
)

urlpatterns += patterns('weblog.views',
    (r'^tag/(?P<tag>\w+)/$', 'tag'),
)

10.  include other url

from django.conf.urls.defaults import *

urlpatterns = patterns('',
    (r'^weblog/',        include('django_website.apps.blog.urls.blog')),
    (r'^documentation/', include('django_website.apps.docs.urls.docs')),
    (r'^comments/',      include('django.contrib.comments.urls')),
)

11. passing extra param

urlpatterns = patterns('blog.views',
    (r'^blog/(?P<year>\d{4})/$', 'year_archive', {'foo': 'bar'}), #year = "2008", foo = "bar"
)

12. to be continued….

Follow

Get every new post delivered to your Inbox.