uri

Java: Open default mail application and create new mail and populate To and Subject fields

大城市里の小女人 提交于 2019-12-23 08:18:28
问题 Just wondering if anyone can help me with a problem I've come across in Java. Is there functionality within Java to produce a section of code that will open the default email application on a user's PC? (I guess almost like a fancy mailto link...) If there is - is it possible to populate fields such as the To and Subject fields? Thanks, Mike. 回答1: Desktop.mail(URI mailtoURI) is your friend! Javadoc: Launches the mail composing window of the user default mail client, filling the message fields

Is it really important to use pack URIs in WPF apps?

孤街浪徒 提交于 2019-12-23 07:57:55
问题 Why should we use those, rather than ordinary ones? what's the benefits of using this: new Uri("pack://application:,,,/File.xaml"); over that: new Uri("/File.xaml", UriKind.Relative); 回答1: The first one - you can use cross-assembly by adding a assembly-name after the three commas. So, you can create a shared library with common styles and other XAML-goodness that can be shared between several assemblies. Syntax is like this: pack://application:,,,/Common;component/CommonResources.xaml where

How to convert a String to an android.net.Uri

蹲街弑〆低调 提交于 2019-12-23 07:36:56
问题 Question: I have found that java.net.URI has a create(String uri) option but the android.net.uri does not. More specifically: I am trying to grab the output of RingtoneManager's RingtonePicker and set it as the default ringtone with SetActualDefaultRingtoneUri : Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER); intent.putExtra( RingtoneManager.EXTRA_RINGTONE_TYPE ,RingtoneManager.TYPE_RINGTONE); intent.putExtra( RingtoneManager.EXTRA_RINGTONE_TITLE , "Select Tone For Rainy

Appending multiple segments with System.Uri

て烟熏妆下的殇ゞ 提交于 2019-12-23 07:26:42
问题 var baseUri = new Uri("http://localhost/"); var uri1 = new Uri(baseUri, "1"); var uri2 = new Uri(uri1, "2"); Unexpectedly, uri2 is http://localhost/2. How would I append to uri1 so it's http://localhost/1/2 intead? Does Uri do this, or do I need to fallback to strings? Incidentally, I've tried adding leading/trailing slashes almost everywhere. 回答1: "1" and "2" are "file name portion" of a url. If you make "1" to look more like directory path it will work ok "1/": var baseUri = new Uri("http:/

Uri.TryCreate returns true for any string value?

↘锁芯ラ 提交于 2019-12-23 07:26:29
问题 I'm trying to validate a Uri using the Uri.TryCreate method and when I called it with an invalid string, the method returned true. Any ideas why? My code is below: private void button1_Click(object sender, EventArgs e) { Uri tempValue; if (Uri.TryCreate("NotAURL", UriKind.RelativeOrAbsolute, out tempValue)) { MessageBox.Show("?"); } } 回答1: That's a valid relative URL. An example of a invalid URI is: "http://example.com<>" If you want to allow only absolute URIs, use UriKind.Absolute . The

Open stream from uri

对着背影说爱祢 提交于 2019-12-23 06:57:17
问题 I got an uri ( java.net.URI ) such as http://www.example.com. How do I open it as a stream in Java? Do I really have to use the URL class instead? 回答1: You will have to create a new URL object and then open stream on the URL instance. An example is below. try { URL url = uri.toURL(); //get URL from your uri object InputStream stream = url.openStream(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (URISyntaxException e) { e.printStackTrace(); }catch (IOException e) { e

Android kitkat Image Selection From Gallery Issue

≯℡__Kan透↙ 提交于 2019-12-23 05:32:29
问题 I have been trying to pick image from the gallery of Nexus devices..Since the Storage framework has been changed in kitkat 4.4 its been a headache for me to implement this functionality..I have referred to this link retrieve absolute path when select image from gallery kitkat android I am getting the path of the file in the gallery..and also decode the image and set it into the imageView..but as soon I do this..My app closes suddenly and again reconnects to the server and tells me to log in

What is Uri in Android?

依然范特西╮ 提交于 2019-12-23 04:04:51
问题 This question might seem stupid but, I am writing a dissertation about camera API for Android. Right now I'm looking at saving images on a SD Card, but I'm a bit confused about what Uri is and does. Does it parse the image from the camera to the imageView? Is it the path of the image? I found a tutorial, but it doesn't describe what the Uri is. The Uri in the code Uri uri; final static int MEDIA_TYPE_IMAGE = 1; uri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE); public Uri getOutputMediaFileUri

Codeigniter Pagination having page number in the middle of url

走远了吗. 提交于 2019-12-23 03:52:11
问题 I'm trying to use pagination class in codeigniter and my url looks something like this: blah.com/posts/browse/page/1/item_per_page/10 is there anyway to keep the page number in the middle of url? Thanks EDIT: $this->load->library('pagination'); $uri = $this->uri->uri_to_assoc(); $page = null; $item_per_page = null; if (count($uri)) { foreach ($uri as $key => $value) { $$key = $value; } } $config['base_url'] = base_url('posts/browse/page//item_per_page/1'); $config['uri_segment'] = 4; $config[

URI templates in Guzzle 5?

给你一囗甜甜゛ 提交于 2019-12-23 02:42:19
问题 Guzzle 3 had URI templates that allowed for a request definition such as $request = $client->get(array('http://example.com{+path}{/segments*}{?query,data*}', array( 'path' => '/foo/bar', 'segments' => array('one', 'two'), 'query' => 'test', 'data' => array( 'more' => 'value' ) ))); In my case, i am looking to exploit the 'segments' , but Guzzle 5 doesn't seem to define this. Instead the closest ive come across was * $client = new Client([ * 'base_url' => [ * 'http://www.foo.com/{version}/', *