bit.ly

How to integrate http://j.mp into Wordpress blog?

In my Wordpress Blog I'm currently using an integrated http://U.nu url-shortener. For this I've got in functions.php function getunuUrl($url) { $unuurl = file_get_contents("http://u.nu/unu-api-simple?url=".$url); return $unuurl; } and in my post.php <?php $uurl = getunuUrl(get_permalink($post->ID)); echo '<a href="'.$uurl....

Am I Using A Factory To Promote Polymorphism?

Hello! My first question is basically asking for a code-review. Does the code I'm about to provide use a Factory to promote Polymorphism? Its written in PHP. Here are the basic requirements: Pass a long url to a library and return a shortened url. Along with the long url, pass user properties to attempt to locate the users specifi...

fastest code to generate unique base62 hashes

hey guys i want to generate unique base62 hashes - something similar to what tinyurl and bit.ly do using c#. this would be based on an auto increment field ID of type bigint (like most of these sites) min chars would be 1 and max chars would be 6... if you had to write the fastest code (least amount of cpu usage) in c# for this hash how...

htaccess redirect using a plus sign

bit.ly has it such that if you do bit.ly/blah+ it redirects to bit.ly/info/blah How would the htaccess code look for replicating that (using a plus sign to redirect to a related page) ...

How do short URLs services work?

How do services like TinyURL or Metamark work? Do they simply associate the tiny URL key with a [virtual?] web page which merely provide an "HTTP redirect" to the original URL? or is there more "magic" to it ? [original wording] I often use URL shortening services like TinyURL, Metamark, and others, but every time I do, I wonder how th...

How to use jQuery click event to change href value asyncronously, based on a JSON query

I'm using the bit.ly url shortening service to shorten certain url's being sent to a "share on twitter" function. I'd like to load the bit.ly url only when a user actually presses the share button (due to bit.ly's max 5 parallel reqs limitation). Bit.ly's REST API returns a JSON callback with the shortened url, which makes the whole scen...

jQuery on the fly URL shortener

I'm looking for an on the fly URL shortener much like how tweetdeck works. I have found many jQuery and general javascript plugins that take a url and run it through a shortening service such as bit.ly when a button is pressed. However, I have not been able to find one that does it on the fly. My first question is does this already exist...

Sorting arrays numerically

I have a PHP array that I need to sort. I have included the example array below. I need to put the top 10 number of URLS plus their perspective counts in a different array. I know I could run into problem if there aren't 10 top matches ... if that happens then a random matching would be fine. Any suggestions? I have tried sort(myarra...

Rails and JSON: a beginner's question

I'm looking for a simple way to parse JSON, extract a value and write it into a db in Rails. Explicitly what I'm looking for is a way to extract a shortUrl from the JSON returned from the bit.ly API: { "errorCode": 0, "errorMessage": "", "results": { "http://www.foo.com": { "hash": "e5TEd", "shortKeywordUrl": "", "shortUrl": "http://b...

Track a short URL generated for a long URL

I'm writing a URL shortener similar to tinyurl and I'm wondering how to keep track of URL's that are already shortened using my service? For example, tinyurl generates the same tiny URL for the same long URL regardless of who creates it. How can this be achieved that is scalable? Bitly also does this though they generate a new URL per pe...

Difference between these two bit.ly API ActionScript implementations?

I'm new to Flex and wondering what the difference is between these two ActionScript implementations of the bit.ly API: http://github.com/julien/as3_bitly http://code.google.com/p/bitly-as3-api/ One thing I noticed is that one comes in .as files and the other's an .swc file. Is one better than the other for learning Flex? Thanks. ...

URL shortening: redirection to a 'file://' target (file protocol target)

Hi, I am trying out a simple implementation of a URL shortener such as tinyurl.com or bit.ly. Currently I do a response.sendRedirect(targetURL) in my servlet - which works fine for http/ftp target URLs. However, I'm having problems redirecting to targets such as file:///c:/temp (where c:\temp is of course on the local/client system). ...

Finding object in nested NSDictionary when the parent key is unknown?

*I'm using yajl_JSON library to produce an NSDictionary from a JSON response for the bit.ly url shortening service.* The JSON response: { errorCode = 0; errorMessage = ""; results = { "http://www.example.com/" = { hash = 4H5keM; shortKeywordUrl = ""; shortUrl = "http://bit.ly/4BN4qV"; ...

Parsing JSON from XmlHttpRequest.responseJSON

I'm trying to parse bit.ly JSON reply in javscript. I get the JSON vis XmlHttpRequest. var req = new XMLHttpRequest; req.overrideMimeType("application/json"); req.open('GET', BITLY_CREATE_API + encodeURIComponent(url) + BITLY_API_LOGIN, true); var target = this; req.onload = function() {target.parseJSON(req, url)}; req.send(null); pa...

Why can't I call bit.ly API from JavaScript using jQuery's $.get function?

I tried to call bit.ly API using this jQuery script: $.get('http://api.bit.ly/shorten?login=bitlyapidemo&amp;apiKey=R_0da49e0a9118ff35f52f629d2d71bf07&amp;version=2.0.1&amp;longUrl=www.wordpress.com', function(data) { alert(data); }); but firebug said "405 Method Not Allowed". What's wrong? Thanks a lot. ...

URL redirection: Server side redirection to a directory/folder in IE

Hi experts! I'm implementing a URL shortener like bit.ly. For this, I have a Java servlet backend which does a response.redirect(targetURL) for every redirection request. This works fine for HTTP requests, but I'm having a problem with file:// protocols. The problematic case is this: The target is a directory (such as file:///N:/somef...

c# shortening string for url

i want to uniquely shorten strings-file ids to use in urls like the ones on bit.ly etc. I can use ids from a db but i want urls to be random like. what would be the best solution? site will be a mobile site so i want to it to as short as possible ...

bit.ly links in wordpress twitter status updates leads to 404

All the twitter status updates on the wordpress sidebar have bit.ly links. When I click on them, I get the 404 page because instead of going bit.ly/uniquenumber it tries to go www.domain.com/blog/"http://bit.ly/uniquenumber/" with www.domain.com/blog being the homepage for the wordpress blog. Is there an easy way to stop it from adding ...

Parse data returned from j.mp

Hi, I'm currently writing an iPhone application, that posts a long url to j.mp (bit.ly). It is fully working and posts the long url successfully. But when I want to copy the returned data into an UITextView, I just get some JSON Data. Now my question: How can I parse this data, so that I only have the shortened url? Could anyone help m...

firefox: bit.ly links in the sidebar of a customised wordpress blog gives a 404 error

I have twitter status updates showing on the sidebar of the blog which often has the bit.ly or ow.ly links as well. But everytime I click on it in the firefox browser it gives me a 404 error because it tries for the following url: www.domain.com/blog/"http://bit.ly/uniquenumber" instead of bit.ly/uniquenumber. I just checked it and it ...