Upgrading Tastypie from v0.9.11 to v0.9.12 and above

Here are my notes on how to upgrade Tastypie from version 0.9.11 to 0.9.12, as there’re no release notes for v0.9.12. Release notes for 0.9.13 and above are available here: http://django-tastypie.readthedocs.org/en/latest/release_notes/index.html.

1. override_urls() becomes prepend_urls(), the new name makes more sense since what the function does is to insert customized urls instead of replacing the default urls with your customized urls.

2. obj_* methods accepts different parameters. Before:

Now obj_get, obj_create, etc. accepts bundle as the parameter apart from keyword arguments. You can get request object from the bundle:

3. apply_authorization_limits is no longer in use and it’s replace with a finer grained authorization mechanism. For example:

Please note that *_list methods should return a list or raise exceptions; whereas *_detail methods should return boolean values or raise exceptions. For more information, see: http://django-tastypie.readthedocs.org/en/v0.9.12/authorization.html

Hi, the company I’m working for (yabroad.com) is hiring Website Backend and Frontend Developers to our platform team. We are building an open platform for youngsters to travel beyond boarders and we offer youngsters internship, language study, travel and volunteer opportunities. Please contact me if you are interested.

i386-jos-elf toolchain on OS X Lion

Yesterday friend and I decided to follow the MIT Operating System Engineering course together in order to get a deep understanding of OS’s. And today I started setting up the cross compling environment for the labs. At first I wanted to get the toolchain from macports, but unluckily it didn’t successfully build binutils on my Mac. As a result, I started building the toolchain from the source code, following the instructions at http://pdos.csail.mit.edu/6.828/2011/tools.html.

The programs you need for the toolchain include binutils, gcc, and gdb. For compiling gcc you also need GMP, MPFR, and MPC. The source codes are available at:

Unzip them in a directory and build binutils, gcc, and gdb one by one.

In order to build gcc, GMP, MPFR and MPC needs to be built first.

Note that it’s essential to build gcc in a directory different from the source code directory to avoid compiling errors.

Then make gdb:

QEMU is available in macports:

UML Review

Input and output of different stages in software development:

Stage Inputs Outputs
Requirement Analysis Stackeholders, goals, existing bussiness processes Business models, use case models, prototypes
Systems
Analysis
 Business models, use case models, prototypes  Use case definitions, object model, prototypes
Design  Use case definitions, object model, prototypes  Object model, data model, component model, architectural view, interface specifications
Implementation  Object model, data model, component model, architectural view, interface
specifications
Source code, complied code, database, interfaces, deployment plan
Testing  Business models, use case models, use case definitions Fault report, acceptance

Activity diagrams are used to describe flows in a variety of situations, they are flow diagrams and can be used in business modelling, requirements modelling, systems analysis and design.

Use case diagrams are used to show the presentation of functionality of a system and its interaction with the outside world. The diagrams show the boundaries of software systems but do not specify functionalities. They can be used in business modelling and requirements modelling.

Class diagrams show the static structure of a system, with classes and relationships between classes. They are used in business modelling, requirements modelling, systems analysis and design.

Statechart diagrams are used for modelling the internal state changes of and object and are a variant of activity diagrams with largely the same notation. They are used in business modelling, requirements modelling, systems analysis and design.

Sequence diagrams provide a time-ordered mapping of steps in the execution of a scenario into interactions between objects. They are one of the primary tools ofr elaborating use cases in analysis and design. They are used in systems analysis and design.

Collaboration diagrams provide a mapping of steps in the execution of a scenario into interactions between objects, drawn in two dimension in a similar way to class diagrams. They are used for similar purposes to sequence diagrams, but present the information in a different way.

Component diagrams show the implementation structure of the application and are used by the designer to indicate where the objects are implemented and how the components interact.

Reference: Ken Lunn, Software Development with UML, Palgrave Macmillan, New York, 2003, pp362-376

Session Establishment and Tearing Down

Each session has a ‘status’, it can be ‘new’, ‘establishing’, ‘cancelling’, ‘established’, ‘tearingdown’ and ‘destroyed’.

When a new session is created, its status is ‘new’.

When an ‘INVITE’ is received, it sends out an ‘OK’ message and change its status to ‘establishing’.

After receiving an ‘ACK’ message the status will be changed to ‘established’.

Then begins the transferring of voice data using RTP.

When the sending finishes the status will become ‘tearingdown’.

A ‘BYE’ message is also sent to the client.

The status becomes ‘destroyed’ after getting ‘OK’ from the client.

When a ‘CANCEL’ message is received, the status becomes ‘cancelling’.

Then it sends back ‘OK’ and ‘Request Terminated’ messages.

After received an ‘ACK’, the status becomes ‘destroyed’.

The thread is as follows:

Test plan

1.Introduction

In this project we implemented an Olympic medal tracking system; its basic requirements are included in Functional Requirements and Project Plan. For more details, please refer to the two documentations mentioned above.

Testing for this system is relatively easy for the following reasons:

  1. The functions required by the customer are simple and basic.
  2. The customer does not place scalability at an important position.

However, testing is still important because we can not guarantee the system to function well according to the requirements. Furthermore, even if the customer does not place performance of the system at first place, it is still essential that our system will respond within the time one user could bare.

2. Testing Staff

Staff Responsibilities
Song Shaoyi Make test plan, Functional test
Mei Xiaowei User interface test
Li Boqiang Performance test

3. Test Cases

Case #

Module

Pre-condition

Action

Expected result

1

Login

On login page. User is not logged in.

Type in an invalid username/password and press “Login”

An error message of “Invalid username or password” is displayed in red on login page.

2

Login

On login page. User is not logged in.

Type in an correct username/password and press “Login”

Display admin functions on the top of the page, including login out link.

3

Login

On login page. User is logged in.

Whether require user login again

No further requirement for relogin.

4

Log off

On any page. User is logged in.

Click on link “logoff”.

Admin functions on top of the page disappear and display “login” function link.

5

Search

On search main page. User logged in.

Click on link “Search by date(s)”.

Go to search by date page.

6

Search

On search main page. User not logged in.

Click on link “Search by date(s)”.

Go to search by date page.

7

Search

On search main page.

Click on link “Search by event(s)”.

Go to search by event
page.

8

Search

On search main page.

Click on link “Search by
country(s)”.

Go to search by country page.

9

Search

On search main
page.

Click on link “Search by athlete(s)”.

Go to search by athlete page.

10

Search

On index page.

Click on link “Search by date(s)”.

Go to search by date page.

11

Search

On index page.

Click on link “Search by event(s)”.

Go to search by event page.

12

Search

On index page.

Click on link “Search by country(s)”.

Go to search by country page.

13

Search

On index page.

Click on link “Search by athlete(s)”.

Go to search by athlete
page.

14

Search

On index page.

Click on link “country name”.

Go to search results of medals the country won.

15

Search

On index page.

Click on link “athlete name”.

Go to search results of medals the athlete won.

16

Search

On index page.

Enter a valid country name in “country field”, Click on link “search”.

Go to search results of medals the country won.

17

Search

On index page.

Enter an invalid country name in “country field”, Click on link “search”.

Show no such country error message.

18

Search

On index page.

Enter a valid country name in “athlete field”, and enter athlete name in “athlete field”, Click on link “search”.

Go to search results of medals the country won.

19

Search

On index page.

Enter an invalid country name in “athlete field”, and enter athlete name in “athlete field”, Click on link “search”.

Show no such country error message.

20

Search

On index page.

Enter a valid country name in “athlete field”, and enter athlete name in “athlete field”, Click on link “search”.

Go to search results of medals the country won.

21

Search

On index page.

Enter a valid athlete name in “athlete field”, Click on link “search”.

Go to search results of medals the athlete won.

22

Search

On index page.

Enter an invalid athlete name in “athlete field”, Click on link “search”.

Show no such athlete error message.

23

Search

On search result page.

Click on link “athlete name”.

Go to search results of medals the athlete won.

24

Search

On search result page.

Click on link “country name”.

Go to search results of medals the country won.

25

Search

On search result page.

Click on link “rank by date”.

Rank search results by
date.

26

Search

On search result page.

Click on link “rank by
event”.

Rank search results by event.

27

Ranking

On index
page.

Click on link “gold”

Rank countries by number of gold medals.

28

Ranking

On index page.

Click on link “total”

Rank countries by number of total medals.

29

Ranking

On search result page.

Click on link “Search by date(s)”.

Rank the results by date.

30

Ranking

On search result page.

Click on link “Search by event(s)”.

Rank the results by event.

31

Admin

On management page. User is logged in.

Click on link “add”

Jump to add medal page.

32

Admin

On management page. User is logged in.

Click on link “correct”

Jump to correct medal confirm page.

33

Admin

On correct medal confirm page. User is logged
in.

Click on link “confirm”

Jump to delete medal information page.

34

Admin

On correct medal confirm page. User is logged in.

Click on link “cancel”

Jump to admin default page.

35

Admin

On management page. User is logged in.

Click on link “delete”

Jump to delete medal confirm page.

36

Admin

On delete medal confirm page. User is logged in.

Click on link “confirm”

Jump to delete medal information page.

37

Admin

On delete medal confirm page. User is logged in.

Click on link “cancel”

Jump to admin default page.

4. Performance and UI tes

It is essential that our system will respond within the time one user could bare, and the user interface should be nice as well. So testing of performance should be measured by the testers’ comparison between our system and existing systems.

Functional requirements

1. Features

1) For general users

a) Simulation of a simple Olympic medal tracking system.
b) The system should allow general users to access the medal tracker pages without requiring them to login. They should be able to see the number of medals (broken down to gold, silver, bronze, and total) won by each country in a sorted list. Users should be able to sort by gold medals and total medals.
c) The system should also enable general users to go to any particular country and check the number of medals the country has collected in each event.
d) Finally a user can go to any athlete and find out the number of medal(s) won by this athlete, broken down by events.
2) For the administrator

a) The system should have admin login functionality for the administrator to input and correct the data.
b) Once an administrator logs into the admin account, the system should provide the capabilities of assigning and removing a medal from any country for any event by any athlete.
c) The system needs to give admin user an option to logoff.
d) Without requiring them to login, the system should also allow general users to access the medal tracker pages. They should be able to see the number of medals (broken down to gold, silver, bronze, and total) won by each country in a sorted list. Users should be able to sort by gold medals and total medals.
e) The system should also enable general users to go to any particular country and check the number of medals the country has collected in each event.
f) Finally a user can go to any athlete and find out the number of medal(s) won by this athlete, broken down by events.
2. Performance

1. The default page for general users should be a rank by gold medals.
2. Web pages should display well in IE version 6.0 or above.
3. Login link for the administrator should be obvious on page.
4. Languages displayed on pages can be decided by the team, English and Chinese are both OK.
5. Scalability is not an important issue.
6. Search function should be obvious and user-friendly.
7. The web page should be free of advertisements.
3. Speed

There are no speed requirements; but the system should respond within the time a regular user could stand.

4. Use cases

 

使用Oracle Job实现定时向管理员发送信息

1.构造实现功能(发送消息)的存储过程:

2.创建JOB

3. 运行JOB

CrazyBus Overview

CrazyBus public transport management system is a system used to help public transport companies manage their daily affairs. The system contains several modules including employee management, department management, bus management, line and bus stop management and lookup, business achievement management, accident management, user management, ticket management, IC card management, and so on.

It contains a Client/Server (C/S) system written in Java, and a Browser/Server (B/S) system written in JSP. The C/S module handles all the management tasks, while the B/S system handles users’ lookup requests and feedbacks and so on. The system uses Oracle 9i as database management system.

C++ STL Notes: String Replacement

Macro

You are asked to do some replacements on a string. Can you work it out?

Input and Output

 

Each test case will begin with a string in a single line, and followed by an integer N which means the number of replacements. The next N lines will give you two strings s1, s2, you should replace all the s1 into s2. For more details, see the
sample below.

Sample Input

 

abc
3
a b
bb a
c d
aaabaaaa
1
aa a

Sample Output

 

ad
aabaa

Note:
For the first sample:
After the first replacement, the string will be bbc.
After the second replacement, the string will be ac.
At last, the string will be ad.

My Code:

Experience of Geany — A lightweighted IDE

Geany’s homepage: http://geany.uvena.de/Main/HomePage

Well, since it’s lightweighted, it’s small and, above all, FAST. For personal user, I think it’s much faster than eclipse, and much easier to use than emacs.

It’s basic features:

syntax highlighting
code folding
code completion
auto completion of often used constructs like if, for and while
auto completion of XML and HTML tags
call tips
many supported filetypes like C, Java, PHP, HTML, Python, Perl, Pascal
symbol lists

It’s code completion function is of great help, and will help us a lot!

But there are problems. I’ve used this IDE for only a day, but the auto
indentation function can’t work correctly. For example:

for(i=0;i<10;i++) [press enter here]
[it should be indented like this]
[but not this]

or maybe it’s my problem.

If anyone works this problem out, please email me! Thanks.