uri

Android custom URI scheme incorrectly encoded when type in browser

房东的猫 提交于 2019-12-24 00:57:10
问题 I am writing my android application, which I want to define a custom URI scheme, so that user can go to my app by typing a URI in browser, like: myapps://cate=1&id=3 I successfully implemented this in my apps, but I discover that for some device, the browser treat the link differently. In my HTC Flyer, it opens my app correctly, but in Samsung Galaxy Ace, the browser translates the link to myapps%3A%2F%2Fcate=1%26id=3, which is encoded, and it just google the "myapps://cate=1&id=3" for me

Android: write PNG ByteArray to file

独自空忆成欢 提交于 2019-12-24 00:56:30
问题 I have read an image file into ByteArray, but how can I write it back. I mean save ByteArray to image file in the file system. PNG format preferred. My code from PNG file to ByteArray: ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), mUri); bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); byte[] byteArray = stream.toByteArray(); I know there are some similar questions, but I didn't find the exact

Is there an empty URI?

房东的猫 提交于 2019-12-24 00:53:00
问题 I working on a routine that parses a URI. Among obvious cases there is an empty string case. Is the empty string a valid input? What would be an outcome URI of an empty string? 回答1: An empty string can’t possibly be a URI. The general URI syntax specifies that at least the scheme component followed by a : followed by the hier-part component (which may be empty) must be present. But a relative URI reference can be empty. The syntax of relative references specifies that at least the relative

Ruby Http Post Parameters

拜拜、爱过 提交于 2019-12-24 00:47:27
问题 How can I add post parameters to what I have right now: @toSend = { "nonce" => Time.now.to_i, "command" => "returnCompleteBalances" }.to_json uri = URI.parse("https://poloniex.com/tradingApi") https = Net::HTTP.new(uri.host,uri.port) https.use_ssl = true https.verify_mode = OpenSSL::SSL::VERIFY_NONE req = Net::HTTP::Post.new(uri.path, initheader = {'Content-Type' =>'application/json'}) req.set_form_data({"nonce" => Time.now.to_i, "command" => "returnCompleteBalances"}) req['Key'] = '******

URI to file in Zip incorrect if path contains spaces

给你一囗甜甜゛ 提交于 2019-12-24 00:40:01
问题 I want to get the URIs to the entries of a zip file in order to keep references to it's contents without having to keep the zip file open. Therefore I open the zip file using the zip filesystem and export the Path of the entries as URI. Path zipfile = ... URI uriOfFileInZip; try(FileSystem fs = FileSystems.newFileSystem(zipfile, null)){ Path fileInZip = fs.getPath("fileInZip.txt"); uriOfFileInZip = fileInZip.toUri(); } Now I want to read the file again, so I try to open a stream to the file.

Build URLS from JSON

一曲冷凌霜 提交于 2019-12-24 00:33:22
问题 I've created a function that can build nested urls like so. I was wondering if there existed a more mainstream library to build urls / uris like this. I'd rather use a standard. utility.urlConstruct({ "scheme": "https://", "domain": "domain.com", "path": "/login", "query":{ "user":"thomasreggi", "from":utility.urlConstruct({ "scheme": "https://", "domain": "redirect.com", "path": "/funstuff", }), } }); Spits out https://domain.com/login?user=thomasreggi&from=https%3A%2F%2Fredirect.com

C# question - how do I convert a PageURI & Href to an absolute URL/URI?

断了今生、忘了曾经 提交于 2019-12-24 00:29:32
问题 How do I convert a PageURI & Href to an absolute URL/URI in C#? i.e. I am scanning a web page at a given PageURI and in the HTML have link/node with a HREF, and want to translate this HREF into a valid absolute URI. Background - note the trouble I was having here 回答1: new URI(uri, string) does it 来源: https://stackoverflow.com/questions/2144150/c-sharp-question-how-do-i-convert-a-pageuri-href-to-an-absolute-url-uri

File:// link doing nothing in all browsers

▼魔方 西西 提交于 2019-12-23 21:48:56
问题 I have a link being generated that looks like so: <a target="_blank" title="Test" href="file:///c:/test.xls">Test</a> This link is inside an iframe. When I click on it (in any major browser), nothing happens. Fiddler records no traffic. Pasting the URL into the nav bar works fine - the file download box comes up, and I can download the file no problem. I've tried every variant of the URL structure (correct and incorrect, colons, slashes, backslashes, etc.) that I can think of. I'm certain

MongoDB HostName/URI Configuration

拥有回忆 提交于 2019-12-23 20:54:09
问题 Note this looks long, but provides context and lists my main questions at the bottom. I researched all parts and included references. I used the Google Cloud Launcher to create a Mongo database. This created a replica set of two Mongo servers (primary and secondary) and an arbiter on three separate VMs. I have not changed any VM configurations (other than opening the firewall). I have SSH'd into both of the servers and verified Mongo is working with replication as expected. I'm changing the

Get file path from Uri from Video Chooser

邮差的信 提交于 2019-12-23 19:01:34
问题 In my app I start an Intent to pick a video file like this Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("video/*"); startActivityForResult(intent, kVideoPickerRequestCode); When it comes back i get the Uri like this: if(resultCode == RESULT_OK) { if (requestCode == kVideoPickerRequestCode) { Uri selectedVideoURI = data.getData(); } } This Uri seems to be fine for my VideoView. It plays back the picked video perfectly. But now I'd like to upload the video to a server