I'm using the goo.gl link shortener API in my app to send urls to twitter along with a link. I've been allowing users to submit 119 characters, appending a space, and then the URL because I was under the impression that they were always 19 characters. This should leave me with one to spare.
Unfortunately I've been getting some "tweet is too long" errors and I can't seem to find any documentation about the possible range of goo.gl url lengths. Does anyone know what the max is or know where some reliable documentation on it is?
Twitter now automatically shortens all links by itself, using t.co. Don't do it by yourself.
Read: https://dev.twitter.com/docs/tco-link-wrapper/faq#How_do_I_calculate_if_a_Tweet_with_a_link_is_going_to_be_over_140_characters_or_not
If you are not using the opt-in features, only links shorter in length
than a t.co URL will be wrapped by t.co. All links t.co-length or
longer should be considered as t.co's maximum length. For example, if
help/configuration reports 20 characters as the maximum length, and a
user posts a link that is 125 characters long, it should be considered
as 20 characters long instead. If they post a link that is 18
characters long, it's still only 18 characters long.
At the moment short_url_length is equal 22 (https://api.twitter.com/1/help/configuration.json)
Related
I have a few paragraphs that needs to be put through the Google TTS API for conversion. Some of these sentences have Dynamic words in them (eg: username). By simply passing the entire text to the API, it's taking around 8-9 secs for the Google API to respond (since some of these sentences are significantly larger in size)
What is the best strategy for converting these sentences?
I was hoping I could first convert the Static part of the sentences and store it somewhere and then convert the Dynamic part, and somehow insert the byte response of the Dynamic word. But I am not sure if this can be done at all.
For eg:
Hi, User how are you?
I was hoping to store the byte responses for "Hi," and then "how are you?" and then insert the byte response for "User" in the appropriate position
I have implemented this http://jacob.jkrall.net/totp/ in vbscript.
My code given the same hex gives the right 6-digit otp, so that part is working.
I've also verified the HMAC-SHA-1. encoding against an online generator, http://www.freeformatter.com/hmac-generator.html#ad-output, same input gives same output.
My time is the same as http://www.currenttimestamp.com/
I've generated a qrcode at http://www.qr-koder.dk/ with the string otpauth://totp/$LABEL?secret=$SECRET and the google authenticator app reads the code and starts outputting the 6 digit code changing every 30 seconds.
BUT THE CODES FROM THE APP DOES NOT MATCH THE 6-DIGIT CODE THE VBSCRIPT GENERATES!
I've even tried trunc(time/30) +/-7500 steps to see if it was a timezone/daylight saving problem, to no avail.
As the other parts of the routine to generate the 6 digits seem to work I've come to the conclusion I don't understand this:
the url on the qr-code is
otpauth://totp/$LABEL?secret=$SECRET
with the explanation
LABEL can be used to describe the key in your app, while SECRET is the
16-character base32-encoded shared secret, which is now known to both
the client and the server.
So when I calculate HMAC-SHA-1(SECRET, time()/30)
should the SECRET be the same string given to both the app and the calculation?
If I select a secret of 1234567890, the base32 is GEZDGNBVGY3TQOJQ according to http://emn178.github.io/online-tools/base32_encode.html.
Should I then take
HMAC-SHA-1("1234567890", time()/30)
or
HMAC-SHA-1("GEZDGNBVGY3TQOJQ", time()/30)
?
I believe I've tried both, and neither works.
The system unix time is correct.
I guess the problem might be with the secret in your HMAC-SHA-1 function. It very much depends on what the HMAC-SHA-1 expects.
Your string "123456790" might be a binary string. Is it an ascii representation or utf8? I.e. is this string 10 bytes or 20 bytes long?
I recommend getting the input string in your VBScript right.
On the other hand, instead of writing your own VBScript, you can also use a ready made solution like the privacyIDEA authentication server, which is open source and also comes with TOTP.
In Solr I have a field dedicated to URLs. The URL field can be anywhere up to 2000 in length. However, I only ever need to search the first 200 characters.
Example URL:
https://www.google.co.uk/search/2014/here/?q=help+me&oq=stackoverflow&aqs=c
I've experimented over the last 2 weeks with Grams and various combinations of Tokenizers to no avail. I always seem to fall short. I would provide examples but they are all standard so no point cluttering this with non-working types.
The main problem seems to be with how Solr deals with punctuation. It treats non-A-z/0-9 characters as separators. How do I disable this for a field?
For example I can search: 'google' and get the correct result, but when I search 'google.co' nothing comes back. Same problem with most of the non-A-z/0-9 characters, it seems to treat them as a separator.
Everything needs to be *wildcard*searchable from 4char strings up to 200 char strings.
So the following search terms would return the above result. '&aqs','ow&aqs=','ps://www.goo','q=help+','2014/he'... etc
How would you define a field type for the URL wildcard use case?
You can use a string field for your url and use a filter that cuts it off to 200 characters.It can be a regex expressions also to keep only 200 characters for that field.
String field will match the exact tokens
I am using Google Chart API in my Application and generating graph using URL "http://chart.apis.google.com"
I am getting error "The requested URL is too large to process", when I provide large set of parameters to this URL.
What I can do in this situation?
The Google Charts API FAQ offers this advice:
Is there a limit on the URL length for the Google Chart API? What is the maximum URL length?
The maximum length of a URL is not determined by the Google Chart API, but rather by web browser and web server considerations. The longest URL that Google accepts in a chart GET request is 2048 characters in length, after URL-encoding (e.g., | becomes %7C). For POST, this limit is 16K.
If URL length is a problem, here are a few suggestions for shortening your URL:
If you are using a text encoding data format, remove leading zeros from numbers, remove trailing zeros after decimal points, and round or truncate the numbers after decimal points.
If that does not shorten the URL enough, use simple (1 character) or extended (2 character) encoding.
Sample data less frequently; i.e., reduce granularity.
Remove accoutrements and decorations, such as colors, labels, and styles, from your chart.
also found this but there doesn't seem to be an answer/solution.
http://groups.google.com/group/google-chart-api/browse_thread/thread/b47c1588b39d98ce
In case it is a browser error - browsers have their maximum URL length limitations (IE 6/7 has 2,083 limit):
What is the maximum length of a URL in different browsers?
I'm getting HTTP 414 but my URL length is not an issue (it is 1881 characters), and I have tried both GET and POST. My guess is that Google will also return this error when the chart you are requesting is too "expensive" to generate.
A method that worked well for me was to divide all values by 10 or 20 and converting the results to int (no commas), but I kept the numbers on the axis. This way, it's a little less accurate but reduces the amount of characters used in the URL.
Code example:
$newSalesrank = $rank/20;
$rankdata .= intval($newSalesrank);
This solved my problem, I got no more "url too long" errors and it still looks good on my charts - because it still looked the same, the numbers just were simply scaled down.
I have a site that displays products - in the simplest sense the url of the page for a particular product is:
site.com/products/manufacturer_model - so for example if I was displaying a Dell Latitude D700 laptop my URL would look like:
site.com/products/dell_latitude_d700
I have a number of products that contain characters that I would need to URL escape - so for example a Dell Latitude 12?34. Obviously I cannot include the '?' character in the URL. For the purpose of being SEO-friendly - should I ignore that character? e.g.
site.com/products/dell_latitude_1234
Or should I escape it? e.g.
site.com/products/dell_latitude_12%3F34
Seems like escaping it would be the most logical approach - but do crawlers understand this?
Well, using "_" is not so friendly to users, so I think using "-" is better (check seoMOZ beginners guide).
Also, you would like to check what characters really need escaping on RFC 3986. If you are using PHP, check out urlencode function page at php.net. I wrote a function to make this updated conversion a few months ago ;)
But getting back to your main question, do use escaped (when needed per RFC 3986) for writing your URLs. It is the safe path to not getting stuck or penalized.