Here is my function (updated):
Public Shared Function shortenUrl(ByVal URL As String) As String
Return shortenUrl(URL, 32)
End Function
Public Shared Function shortenUrl(ByVal URL As String, ByVal maxLength As Integer) As String
If URL.Length > maxLength Then
String.Format("{0}...{1}", URL.Substring(0, (maxLength / 2)), ...
I am using Python to extract the filename from a link using rfind like below:
url = "http://www.google.com/test.php"
print url[url.rfind("/") +1 : ]
This works ok with links without a / at the end of them and returns "test.php". I have encountered links with / at the end like so "http://www.google.com/test.php/". I am have trouble ...
What's the best way to handle a visitor constructing their own URL and replacing what we expect to be an ID with anything they like?
For example:
http://stackoverflow.com/questions/236349
But the user could just as easily replace the URL with:
http://stackoverflow.com/questions/foo
I've thought of making every Controller Function pa...
Is there any function that converts an escaped Url string to its unescaped form? System.Web.HttpUtility.UrlDecode() can do that job but I don't want to add a reference to System.Web.dll. Since my app is not a web application, I don't want to add a dependency for only using a function in an assembly.
UPDATE: Check Rick Strahl's blog post...
Say I want to get the HTML of
http://www.google.com
as a String using some built-in classes of the Cocoa Touch framework.
What is the least amount of code I need to write?
I've gotten this far, but can't figure out how to progress. There must be an easier way.
CFHTTPMessageRef req;
NSURL *url = [NSURL URLWithString:@"http://www.goog...
I want this page to return 200 whilst still sending the redirect...
<script>
sub page_load
'Get the parameters
dim content As String
content = request.querystring("text")
response.redirect ("http://100.200.100.10/test1/Default.aspx?CommandParm=" + content)
end sub
</script>
<html>
<head>
...
I have a long URL with tons of parameters that I want to open in the default browser from Java on a Windows system using
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler "+url)
For short URLs like "http://www.google.com" this works fine. But for long URLs (say, 2000 characters), this simply does absolutely nothing at al...
Given a list of urls, I would like to check that each url:
Returns a 200 OK status code
Returns a response within X amount of time
The end goal is a system that is capable of flagging urls as potentially broken so that an administrator can review them.
The script will be written in PHP and will most likely run on a daily basis via c...
We are re-platforming for a client, and they are concerned about SEO. Their current site supports SEO friendly URLs, and so does the new platform. So for those, we are just going to create the same URL mapping. However, they have a large number of other URLs that are not SEO friendly that they want to permanently redirect. These do not f...
I am looking to parse a URL to obtain a collection of the querystring parameters in Java. To be clear, I need to parse a given URL(or string value of a URL object), not the URL from a servlet request.
It looks as if the javax.servlet.http.HttpUtils.parseQueryString method would be the obvious choice, but it has been deprecated.
Is the...
Hi,
I am writing a Jython script to sort a list of URLs.
I have a list that looks like this:
http://www.domain.com/folder1/folder2/|,1
http://www.domain.com/folder1/|,1
http://www.domain.com/folder1/folder2/folder3/|,1
http://www.domain.com/folder1/|,1
http://www.domain.com/folder1/folder2/|,1
http://www.domain.com/folder1/folder2/|,1...
I created a new SharePoint portal for testing purposes using a manually added HOSTS record. I have it all tested and want to expose it to the outside world using a URL from our DNS.
I can't seem to find a straight forward way to change the URL of a SharePoint portal. Does anyone know where this setting is?
Thanks.
...
I previously asked how to do this in Groovy. However, now I'm rewriting my app in Perl because of all the CPAN libraries.
If the page contained these links:
<a href="http://www.google.com">Google</a>
<a href="http://www.apple.com">Apple</a>
The output would be:
Google, http://www.google.com
Apple, http://www.ap...
How do I embed a tag within a url templatetag in a django template?
Django 1.0 , Python 2.5.2
In views.py
def home_page_view(request):
NUP={"HOMEPAGE": "named-url-pattern-string-for-my-home-page-view"}
variables = RequestContext(request, {'NUP':NUP})
return render_to_response('home_page.html', variables)
In home_page...
Is there a way of getting the websites absolute URL (http://www.domain.com/) using Java? because I've googled a bit but I only come across with having to make 2 or 3 classes to create that function =/
Thanks
...
Hi.
I have a text file of URLs, about 14000. Below is a couple of examples:
http://www.domainname.com/pagename?CONTENT_ITEM_ID=100&param2=123
http://www.domainname.com/images?IMAGE_ID=10
http://www.domainname.com/pagename?CONTENT_ITEM_ID=101&param2=123
http://www.domainname.com/images?IMAGE_ID=11
http://www.domainname.com/page...
Hi.
I am working with a huge list of URL's, you guys have already helped me :)
Just a quick question I have trying to slice a part of the URL out, see below:
http://www.domainname.com/page?CONTENT_ITEM_ID=1234&param2&param3
How could I slice out:
http://www.domainname.com/page?CONTENT_ITEM_ID=1234
Sometimes there is more ...
I'm writing a simple C++ class in which I would like cache picture thumbnails versions of images downloaded from the web. As such, I would like to use a hash function which takes in URL strings and outputs a unique string suitable as a filename.
Is there a simple way to do this without re-writing the function myself? I searched around...
How do I get the complete request URL (including query string) in my controller?
Is it a matter of concatenating my URL and form parameters or is there a better way.
I checked this question, but it seems not to be applicable to MVC.
Correct me if I'm wrong.
--Edit (extended problem description)--
My call to my SearchController.Advan...
Our application defines a URL scheme whose resolution is context-sensitive: The content of the URL depends on the state of an in-progress database transaction. As such, to retrieve the content I cannot, for example, open a new database connection. However, I can't see a way to get at external context from the URLStreamHandler instance...