Tutorial by Examples: di

2 is STDERR. $ echo_to_stderr 2>/dev/null # echos nothing Definitions: echo_to_stderr is a command that writes "stderr" to STDERR echo_to_stderr () { echo stderr >&2 } $ echo_to_stderr stderr
It's possible to extent native elements, but their descendants don't get to have their own tag names. Instead, the is attribute is used to specify which subclass an element is supposed to use. For example, here's an extension of the <img> element which logs a message to the console when it's l...
Browse to File > New > Solution to bring you up the new project dialog Select Single View App and press Next Configure your app by setting your app name and organization ID, and press Next: Set your Project name and Solution name, or leave as the default name. Click Create to create...
This downloads a file from the Dropbox API at the remote path /Homework/math/Prime_Numbers.txt to the local path Prime_Numbers.txt in the current folder: curl -X POST https://content.dropboxapi.com/2/files/download \ --header "Authorization: Bearer <ACCESS_TOKEN>" \ --head...
Adapted from the tutorial, this uses the SwiftyDropbox library to download a file, with a progress callback on the download method to get progress information: // Download a file let destination : (NSURL, NSHTTPURLResponse) -> NSURL = { temporaryURL, response in let fileManager = NSFileMan...
This uses the Dropbox Python SDK to download a file from the Dropbox API at the remote path /Homework/math/Prime_Numbers.txt to the local file Prime_Numbers.txt: import dropbox dbx = dropbox.Dropbox("<ACCESS_TOKEN>") with open("Prime_Numbers.txt", "wb") as f:...
Dropbox.authorizedClient!.files.download(path: path, destination: destination).response { response, error in if let (metadata, url) = response { print("*** Download file ***") print("Downloaded file name: \(metadata.name)") print("Downloaded f...
#include <stdio.h> #include <curl/curl.h> int main (int argc, char *argv[]) { CURL *curl; CURLcode res; /* In windows, this will init the winsock stuff */ curl_global_init(CURL_GLOBAL_ALL); /* get a curl handle */ curl = curl_easy_init()...
This downloads just a piece of a file, using Range Retrieval Requests, from the Dropbox API at the remote path /Homework/math/Prime_Numbers.txt to the local path Prime_Numbers.txt.partial in the current folder: curl -X GET https://content.dropboxapi.com/2/files/download \ --header "Auth...
<?php $path = 'test_php_upload.txt'; $fp = fopen($path, 'rb'); $size = filesize($path); $cheaders = array('Authorization: Bearer <ACCESS_TOKEN>', 'Content-Type: application/octet-stream', 'Dropbox-API-Arg: {"path":"/test/'.$path.'...
#include <stdio.h> #include <curl/curl.h> int main (int argc, char *argv[]) { CURL *curl; CURLcode res; /* In windows, this will init the winsock stuff */ curl_global_init(CURL_GLOBAL_ALL); /* get a curl handle */ curl = curl_easy_init()...
This uploads a file from the local path matrices.txt in the current folder to /Homework/math/Matrices.txt in the Dropbox account, and returns the metadata for the uploaded file: echo "some content here" > matrices.txt curl -X POST https://content.dropboxapi.com/2/files/upload \ ...
This uses the SwiftyDropbox library to upload a file from a NSData to the Dropbox account, using upload sessions for larger files, handling every error case: import UIKit import SwiftyDropbox class ViewController: UIViewController { // replace this made up data with the real data le...
This example uses the Dropbox .NET library to upload a file to a Dropbox account, using upload sessions for larger files: private async Task Upload(string localPath, string remotePath) { const int ChunkSize = 4096 * 1024; using (var fileStream = File.Open(localPath, FileMode.Open)) ...
// ... file selected from a file <input> file = event.target.files[0]; $.ajax({ url: 'https://content.dropboxapi.com/2/files/upload', type: 'post', data: file, processData: false, contentType: 'application/octet-stream', headers: { "Authorization&q...
var data = new TextEncoder("utf-8").encode("Test"); $.ajax({ url: 'https://content.dropboxapi.com/2/files/upload', type: 'post', data: data, processData: false, contentType: 'application/octet-stream', headers: { "Authorization": ...
Dropbox.authorizedClient!.files.listFolder(path: "").response { response, error in print("*** List folder ***") if let result = response { print("Folder contents:") for entry in result.entries { print(entry.name) if ...
Dropbox.authorizedClient!.files.getMetadata(path: "/test.jpg", includeMediaInfo: true).response { response, error in if let result = response as? Files.FileMetadata { print(result.name) if result.mediaInfo != nil { switch result.mediaInfo! as Files.Med...
curl -X POST https://api.dropboxapi.com/2/files/get_metadata \ --header "Authorization: Bearer <ACCESS_TOKEN>" \ --header "Content-Type: application/json" \ --data "{\"path\": \"/test.jpg\",\"include_media_info\": true}&quot...
5.1 When you take a reference to a method (a property which is a function) in JavaScript, it usually doesn't remember the object it was originally attached to. If the method needs to refer to that object as this it won't be able to, and calling it will probably cause a crash. You can use the .bind...

Page 8 of 164