url

1-1 mappings for id obfuscation

I'm using sequential ids as primary keys and there are cases where I don't want those ids to be visible to users, for example I might want to avoid urls like ?invoice_id=1234 that allow users to guess how many invoices the system as a whole is issuing. I could add a database field with a GUID or something conjured up from hash function...

Servlet/JSP URLs when forwarding requests

My web app has a servlet called admin which when navigated to checks if the user is logged in and if the are directs to the the admin section, but if they aren't it directs them to a JSP page with a sign-in form. The name of the JSP doesn't appear in the URL, it stays as /admin. But then when the JSP posts to another servlet to validat...

What is the best way to store a unique URL Slug?

Hi folks, I'm trying to generate some url 'slugs' for my website. It's based upon a single piece of user generated text. Now, i have made my own slug method, so i'm not after some code for that. What i'm wondering is where is the best place to determine if this slug is unique and then insert it because the slug field is a Unique Key I...

How to pass a flexible number of ids into a controller in Rails?

I'd like to display a comparison page so user can compare the properties of several objects in my database. Any number of objects can be compared. I'd also like it to be bookmarkable (so a 'get'). How should I structure my URL / route for the controller? Something like /foo_compare/1_5_22 where I split the ids into 1, 5 and 22 in the ...

FasterCSV: Read Remote CSV Files

I can't seem to get this to work. I want to pull a CSV file from a different webserver to read in my application. This is how I'd like to call it: url = 'http://www.testing.com/test.csv' records = FasterCSV.read(url, :headers => true, :header_converters => :symbol) But that doesn't work. I tried Googling, and all I came up with was...

Custom Rails URL argument separators?

We're building a Facebook application at work using Ruby on Rails. We're currently switching it from a canvas to an iframe application for technical reasons. There is however a problem, Facebook sends you the fb_sig_api_key and others as GET varialbes in the URL (blah.com/?fb_sig_api_key=12345&whatever=hello). However, for some reason,...

add a vanity url to subtext article

So I'm running subtext 1.95 on IIS6 and .net 2.0 framework. What I'd like to do is create a nice vanity URL to a particular article that is published inside the subtext system. The vanity url should look like this: mydomain.com/blog/toc/, but the subtext article that it is pointing to actually has a path like this: mydomain.com/blog/arch...

Regex for url validation with parts capturing

Can a single regex be used to valdate urls and match all the parts, I have been working on one and what I have come up with so far is: (?:(?P<scheme>[a-z]*?)://)?(?:(?P<username>.*?):?(?P<password>.*?)?@)?(?P<hostname>.*?)/(?:(?:(?P<path>.*?)\?)?(?P<file>.*?\.[a-z]{1,6})?(?:(?:(?P<query>.*?)#?)?(?P<fragment>.*?)?)?)? however this does...

Regex to match all valid links

In regards to this: http://stackoverflow.uservoice.com/pages/general/suggestions/103227-parser-does-not-match-all-valid-urls is this regex adequate or will it need to be refined, if it needs to be refined how so? \b(?P<link>(?:.*?://)[\w\-\_\.\@\:\/\?\#\=]*)\b ...

How do I encode URI parameter values?

I want to send a URI as the value of a query/matrix parameter. Before I can append it to an existing URI, I need to encode it according to RFC 2396. For example, given the input: http://google.com/resource?key=value1 & value2 I expect the output: http%3a%2f%2fgoogle.com%2fresource%3fkey%3dvalue1%2520%26%2520value2 Neither java.net.UR...

How do you find the URL to the SWF file using ActionScript 2?

I'm looking for a way to find out the URL of a SWF using ActionScript 2. In ActionScript 3 this is done by using root.loaderInfo.loaderURL, but I haven't found any equivalent in ActionScript 2. Please note that I'm not looking for the URL to the page where the SWF is embedded, but the URL of the actual SWF, and that using ActionScript ...

How can I test a SWF URL before Loading Styles From if (or catching the error)?

I am trying to use the following code to load styles from an external SWF, but I keep getting an ActionScript error when the URL is invalid: Error: Unable to load style(Error #2036: Load Never Completed. URL: http://localhost/css/styles.swf): ../css/styles.swf. at <anonymous>()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\sty...

How can I split a url string up into separate parts in Python?

Hi all. I decided that I'll learn python tonight :) I know C pretty well (wrote an OS in it) so I'm not a noob in programming so everything in python seems pretty easy, but I don't know how to solve this problem : let's say I have this address: http://example.com/random/folder/path.html Now how can I create two strings from this, one c...

What's the best way to "embed" a page number in a URL?

I'm developing a blog application using Django. Currently, the URL /blog/ displays the front page of the blog (the first five posts). Visitors can then browse or "page through" the blog entries. This portion is mapped to /blog/browse/{page}/, where page, of course, is an integer that specifies which "page" of blog entries should be displ...

Is it dangerous to leave your Django admin directory under the default url of admin?

Is it dangerous to have your admin interface in a Django app accessible by using just a plain old admin url? For security should it be hidden under an obfuscated url that is like a 64 bit unique uuid? Also, if you create such an obfuscated link to your admin interface, how can you avoid having anyone find out where it is? Does the goo...

How do I configure extensionless URLs with the Visual Web Development server?

I'm using Visual Studios' built-in ASP.NET Development Server (VWD) to test my web site during development. I would like this ASP.NET web site to use extensionless URLs (pages don't require the aspx extension). Ordinarily I would configure a custom 404 in IIS that directs to an ASPX page. How would I do this with VWD? P.S. This is no...

How To Parse a URL in J2ME

I'm trying to extract the query's name-value pairs from a URL using J2ME, but it doesn't make it easy. J2ME doesn't have the java.net.URL class nor does String have a split method. Is there a way to extract name-value pairs from a URL using J2ME? Any open source implementations would be welcome too. ...

Converting from a Html encoded string to a 'normal' Url

I have a url in an xml documnent which is encoded <Link>http://www.sample.com/test.asp?goto=HOTWIZ%26eapid=857&lt;/Link&gt; I would like to convert that into a Url in the outputed Html. I can output a link ok but i need the %26 to be converted to an & I assume i could use some sort of replace functionality in XSLT but I imagine ther...

Call to Documents.Open(url) ignores user/password

I am trying to open a user/pass protected [Alfresco] webdav document from a Java applet, using Jacob and COM Automation. I pass "http://usu:pwd@srvs/docu.doc" to Documents.Open, but it seems to ignore the auth information. Is there another way to pass this information or somewhere else to authenticate beforehand? Notes: The document ...

Getting an absolute URL from a relative one. (IE6 issue)

I'm currently using the following function to 'convert' a relative URL to an absolute one: function qualifyURL(url) { var a = document.createElement('a'); a.href = url; return a.href; } This works quite well in most browsers but IE6 insists on returning the relative URL still! It does the same if I use getAttribute('href'). The o...