Dropbox Python SDK 2.2.0 bug: commit_chunked_upload ?

Categories: Development NotesPython; Tagged with: ; @ August 2nd, 2015 23:04

Issue:  dropbox keep ignoring the first folder when committing a chunked upload:

After chunked uploading completed, commit the file by:

response = self.dropbox_client.commit_chunked_upload('/backup/docs.zip', upload_id, False)
remote_path = response['path']

My understanding was remote_path in the response should be same as the full_path I passed: ‘/backup/docs.zip’, however, the remote_path is: ‘docs.zip’. form client.py /commit_chunked_upload:

The full path to which the chunks are uploaded, *including the file name*.
If the destination folder does not yet exist, it will be created.

full path with filename, and it’ll be used by:

url, params, headers = self.request("/commit_chunked_upload/%s" % full_path,
                                    params, content_server=True)

a http request to : /commit_chunked_upload//backup/docs.zip will be sent. however, the actual server url is:

https://api-content.dropbox.com/1/commit_chunked_upload/auto/<path>

https://www.dropbox.com/developers/core/docs#commit-chunked-upload

Solution / workaround

1. fix the SDK :
Following CheckedUpload class,  the commit url can be generated by:

path = “/commit_chunked_upload/%s%s” % (self.client.session.root, format_path(path))

2. add ‘auto’ in the front of the remote path:

response = self.dropbox_client.commit_chunked_upload('auto/' + remote_path, upload_id, False)

Apache Cordova: Package/Build iOS/Andorid App from Polymer HTML5 Project

Categories: AndroidDevelopment NotesHTML5; Tagged with: ; @ July 21st, 2015 23:14

Requirement: Build iOS/Android app using existing Polymer project.

Solution:

There’re lots of tools/platforms to build an app from HTML5 project, such as Trigger.io, Intel XDK, PhoneGap, Apache Cordova. I choosed Cordova to build my first html app;

  1. Install Apache Cordova by npm:
    $ sudo npm install -g cordova
  2. Create a Cordova project using cordova CLI;
    $ cordova create hello com.liguoliang.app HelloWorld
  3. Navigate to the project folder, add platform:
    $ cordova platform add ios/android
  4. Build project:
    $ cordova build
  5. Emulate the app:
    $ cordova emulate ios/andorid

Note: It is required to install Xcode or Android SDK/Tools for simulating.  you may follow the Cordova CLI message to installed the required sdk/tool.

> Apache Cordova CLI Document

ios-polymer-app

Polymer helloworld: create web component using dom-module

Categories: Development NotesHTML5; Tagged with: ; @ July 19th, 2015 23:10

Requirement:  creating a component to display user info

Step 1:  Create a web component using dom-module:

user-info.html:

<link rel="import" href="../bower_components/polymer/polymer.html" />

<dom-module id="user-info">
    <template>
        <div id="container">
            Hi, <span>{{user_name}}</span>!
        </div>
    </template>

    <style>
        #container {
            font-size: 11px;
            color: gray;
        }

    </style>

    <script>
        Polymer({
            is: 'user-info',
            properties: {
                user_name: {
                    type:String,
                    value:"Mr.default"
                }
            }
        });
    </script>

</dom-module>

Step 2: Use the newly created component:

<link rel="import" href="components/user-info.html" />
<user-info user_name="Mr.Rabbit"></user-info>

 

七月

Categories: 垃圾山 July 12th, 2015 23:07

来新加坡三年整了。回头看看只能感慨一句光阴似箭。

三年前的春天,吃完午饭散步时,老板认真的说,如果有机会,趁年轻去国外工作一段时间也不错,会让你站在新的角度看问题。 那是个和煦的春天,我似懂非懂的笑了笑。 几个月后大家各奔前程,他回了美国,我来了岛国。每次换工作,他都会在linked上发信息给我, 三年很快就过去了,这是我离开上海后的第三份工作。

脑海里依稀记得有句关于旅游的矫情的话:遇到别处/另一个的自己。相比旅游,我更多的是在工作中看到平时自己没有觉察到的自己。 或是因为语言而寡言,或是因为面子而逞强,或是因为畏惧而退缩,在不断的切换工作中,不断把自己丢向一个陌生的环境,很多时候我觉得自己不够平和,或许并不是因为自己走的路不够多,也许只是因为不够自信。一个人得走过多少路,才能从容淡定的面对一切?我希望我所有的努力都在通向这道路,平凡,朴素,从容。或许不需要努力,只需要变老。

我前所未有的感觉到自己需要做很多事情,需要适应新工作,需要考驾照,需要实现我的很多小想法,还需要跟我喜欢的人享受生活跟庸俗。时间太少,想法太多。

 

Curl – HttpPost Example

Categories: Development Notes June 13th, 2015 0:34

Http Post without Parameter

$ curl -X POST -H ‘Content-Length: 0′ http://127.0.0.1:8080/_qs/listAllInstitutions

Set content-Lenght=0 to avoid HTTP ERROR 411 – ‘Length required’

 

Http Post with Parameters

curl  –data “userId=user-id”  http://127.0.0.1:8080/_qs/getUserInfo

Older Posts


Popular Tags

Archives


AD


// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.