How to get the path of a URL?

You want something like this: String path = new URL(“http://www.costo.com/test1/test2”).getPath(); Actually that’ll give you /test1/test2. You’ll just have to remove the first / to get what you want: path = path.replaceFirst(“https://stackoverflow.com/”, “”); Now you’ll have test1/test2 in path.

Parse relative URI

Although you can create a Uri without a host portion, most of its properties will then throw an InvalidOperationException (“This operation is not supported for a relative URI”) because those properties rely on an absolute Uri. HttpUtility.ParseQueryString() is indeed not going to help here, because it only operates on the query part of an Uri, … Read more

How to get Uri.EscapeDataString to comply with RFC 3986

Having not been able to get Uri.EscapeDataString to take on RFC 3986 behavior, I wrote my own RFC 3986 compliant escaping method. It leverages Uri.EscapeDataString, and then ‘upgrades’ the escaping to RFC 3986 compliance. /// <summary> /// The set of characters that are unreserved in RFC 2396 but are NOT unreserved in RFC 3986. /// … Read more

How can I change the URI without refreshing the page?

In HTML5 you can change the URL: window.history.pushState(“object or string”, “Title”, “/new-url”); check http://spoiledmilk.com/blog/html5-changing-the-browser-url-without-refreshing-page/ docs: https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history#The_pushState().c2.a0method UPDATE An overview of which browser support the new HTML5 history API: http://caniuse.com/#search=pushState (caniuse.com is worth to bookmark!) there are already frameworks that do the hard work for you and even gracefully fallback to the common hash-tag solution: History.js … Read more

What is the semicolon reserved for in URLs?

There is an explanation at the end of section 3.3. Aside from dot-segments in hierarchical paths, a path segment is considered opaque by the generic syntax. URI producing applications often use the reserved characters allowed in a segment to delimit scheme-specific or dereference-handler-specific subcomponents. For example, the semicolon (“;”) and equals (“=”) reserved characters are … Read more

Changing the port of the System.Uri

Have you considered the UriBuilder class? http://msdn.microsoft.com/en-us/library/system.uribuilder.aspx The UriBuilder class provides a convenient way to modify the contents of a Uri instance without creating a new Uri instance for each modification. The UriBuilder properties provide read/write access to the read-only Uri properties so that they can be modified.

android camera : Failure delivering result ResultInfo{who=null, request=0, result=-1, data=null} to activity

Make sure you have both Camera Permission and READ/WRITE External Storage Permissions. Try this is working like charm with me private String selectedImagePath = “”; final private int PICK_IMAGE = 1; final private int CAPTURE_IMAGE = 2; public Uri setImageUri() { // Store image in dcim File file = new File(Environment.getExternalStorageDirectory() + “/DCIM/”, “image” + … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)