Teebone Ding Technical Blog

Django, Python, Javascript, Pig, and Hadoop.

Generate a YouTube-Video-ID-like Hash Function in Python

A youtube video URL is like https://www.youtube.com/watch?v=Qx-ezesM3nA. The video ID consists of 11 characters with ASCII uppercase and lowercase alphabets, digits ,and some other characters. In some cases we would like to generate a hash function that outputs a Youtube-video-ID-like hash value. For example: A URL shortener that generate a shorter URL from the original long URL. Here is my implementation:

中文補完計劃

Chinese Translation Project

English version

這個部落格紀錄我在學習程式上的心得或筆記,為了讓可以看的懂的人不分國家,大部分都以英文撰寫為主。 我是一個以中文為母語的人,對於寫作的掌握自然比英文強很多,為了讓廣大的中文使用者也能分享資訊, 我開始考慮有時間的話每一篇文章都有中英兩種語言的版本。對於可以同時掌握兩種最多人使用的語言的我感到開心與興奮, 也期許自己能成為一個有教導能力的人。

希望不是淪為嘴炮,這一篇開始就來個雙語版文章好了…(倒)

Selecting Objects in Django Model

When we talk about database, the dumb way to select objects in Django is using raw SQL scripts. We don’t use SQL directly in Django due to security issues and cross-platform achievement. Using Django database API can avoid most SQL secure holes and you don’t have to learn much about database selecting languages which might be slightly different between several Django supported databases. I am going to talk about a little (my notes) in selecting objects in Django model.

Filtering Objects

Fetch URL Query String With a jQuery Plugin

Useful plugin for fetching URL parameters

Download the plugin here:

Include jQuery and this plugin in your HTML page:

1
2
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.url.min.js"></script>

在Mac系統上撰寫台大碩士論文(XeLaTex樣板) Write Your NTU Master Thesis With a XeLaTex Template on Mac

簡介 Introduction

這篇教學文是針對黃子桓 [1] [2] 在Mac寫作台大碩士論文的教學補充文,我使用的樣板為XeLaTex的版本,在處理中文的時候比LaTex+CJK方便很多,強烈推薦使用。另外編輯器我採用個人最喜歡的Sublime Text 2 [7] 作為編寫工具,其作為其它程式碼編輯器也相當實用,推薦!

I assume that the reader of this post wants to write a master thesis in National Taiwan University that is a Chinese native speaker. I wrote this teaching article in Chinese. If you are a reader that is interested in writing LaTex/XeLaTex with Sublime Text 2 on Mac, I suggest you to read reference [4], [5], [6], and [8]. If you are a student in NTU but not a Chinese speaker, email me to teebone [at] teeboneding dot com and I will try to translate this post in English if I have plenty of time after I finish my master thesis this year, good luck!

A Survey of Job Completion Time Prediction Methodologies

Introduction

Job completion time prediction is not a new story recently. How to schedule a job before it arrives it's deadline is always a hot topic in systems research. In order to allocate sufficient resources to meet a job's service-level objectives (SLOs) on latency, we need to predict job completion time accurately when given resource allocation information.