Twilio Message Segments - sms

I am using Twilio services for one of my projects.I wanted to have suggestions of how I can optimize my message sending, i.e currently when I send a message it goes in 6 segments which cost me more.Is there any way through which I decrease the number of segments in the SMS.
Thanks in advance
-Tapas

Twilio developer evangelist here.
The length of a single SMS message is usually 160 characters. Initially, to reduce the number of segments you are sending, you should look at shortening your message.
Under certain circumstances messages may have a limit of 70 characters. This happens when you use characters that are outside of the regular GSM character set, this could be things like emoji, Kanji or other symbol style languages and even accented characters. You can learn more about this in this blog post on sending Unicode characters by SMS.
In this case, you can possibly reduce the number of segments by limiting your character set to the basic GSM characters. If you need unicode characters because of the languages in which you are sending messages require them, then this may not help though.

Related

Selective Repeat number of acknowledgements

I've been trying to solve a question that uses selective repeat protocol but I cant seem to figure it out.
what is the maximum number of different acknowledgements messages that can be propagating?
or in the specific example, window size of 13 with sequence number from 1-211. in time t the last packet in the senders window has sequence number 171. assume that medium does not reorder messages in both directions. what is the maximum number of ACK messages with different sequence numbers that are currently propagating back from the receiver to sender at time t ?
Thanks in advance :)

Google translate character limit in a single POST

I have seen in unofficial comments that there is a 5000 character limit. In a single request I am sending an array of strings to be translated which could exceed this limit in total. It's also unclear if this limit applies to a single item in the array, or the total.
I need to know if I have to modify my logic to batch up these requests if there is a limit imposed but I couldn't find relevant information in the docs, including under https://cloud.google.com/translate/quotas
The 5000 character limit refers to all characters in the requests. It's briefly mentioned here.
It's a performance limit, not an artificial one, so I don't think stacking them in arrays who make it any better.

regular expression for creating email

I am new in programming. I need to know the regular expression for creating of email
username#domain.extension
daniel#gmail.com
which is the length of username. Maximum number of characters. Minumum number of characters
which is the length of domain. Maximum number of characters. Minumum number of characters
which is the length of extension. Maximum number of characters. Minumum number of characters
Characters commonly accepted in every part of the email address
This is my expression regular
/^([a-z 0-9_\.-]{3,10})#([\da-z\.-]+)\.([a-z\.]{2,6})$/
I'd like improve this
If you are looking to create this from scratch start with reading the RFC for email
https://www.rfc-editor.org/rfc/rfc2822
Otherwise either stick to something simple like you have or use a gem that has already walked through that document.
https://github.com/validates-email-format-of/validates_email_format_of

What is the maximum length of a display name in an email address

According to the question "What is the maximum length of a valid email address?", the maximum length of the address is 254. But I like to know what would be the maximum length of the display name:
Display Name <my#examplemailaddress.net>
Following this link https://www.ietf.org/mail-archive/web/ietf-822/current/msg00086.html the size is unlimited but practically according this link https://www.ietf.org/mail-archive/web/ietf-822/current/msg00088.html the size would be 72 characters. But I believe this answer is a bit outdated? What would be reasonable limit for today?
If you ask the maximal length allowed by the specs (the normative source is RFC5322 as of current_timestamp) then, indeed, there is no limit, since folding allows you to have an unlimted length of any field (while still respecting the advised 78 [or the larger 998] character limit).
Practical limit is a very subjective question, since "practical" would be the length which is fully displayed by "most" clients and environments; now that's pretty hard to calculate.
I would say the upper limit of practicality would be the total length of 78 characters from the "From:" header up to the last ">" character of the email address, since longer ones may probably break up while displaying in almost all environments, which would give you around 40 characters to use even for longer email addresses.
Most clients, however, probably expects to display around 20-25 characters under normal circumstances.
These are all displayed characters and not the actual length in bytes of a whatever way encoded address (especially for long utf-8 codes).

Is there pseudocode for UK address or phone number validation?

Do you have pseudocode for field validation of the following items in the UK? I am from the USA, so I only know the ones in the USA right now.
Address Line 1
Phone Number
Mobile Number (in case they have a special rule for this, which they might not)
Post Code
Address line 1, if you want to validate what the user entered freeform, you're probably hosed. There's huge variability. You can use the PostCode Address File (see below) to assist,
Typically, if you want a "standard" address, UK-oriented websites ask for the postcode, then prompt the user to choose the correct address from all addresses at that postcode
Phone and mobile numbers. See here http://en.wikipedia.org/wiki/Telephone_numbers_in_the_United_Kingdom. A script to validate these (in several languages) can be found here: http://www.braemoor.co.uk/software/telnumbers.shtml
Post code format: http://en.wikipedia.org/wiki/UK_postcodes (contains a regular expression for validation, and refers to the Postcode Address File which lists valid addresses)
Address line 1 could be almost anything. There aren't always house numbers.
Phone numbers: the length of an area code varies. I wouldn't like to swear whether the full length is constant, but I suspect it's always at least 10 digits. Mobile numbers typically (IME) start with 07 whereas landlines typeically start with 01 or 02. Special numbers (free, local rate etc) typically start with 08. I'll try to find a reference for this. (EDIT: Again, there's a good Wikipedia article.)
Wikipedia has a good article about UK postcodes, including regular expressions for them.
Perl has the Number::Phone module that can handle UK phone numbers. Royal Mail has services for address validation and list cleansing.
For UK phone numbers, your best bet (unfortunately) is probably to download the numbering plans from Ofcom (they're excel spreadsheets, with all relevant number ranges, split up into area codes, "geographical numbers", personal numbers, mobile numbers, assorted service numbers, the different pay-for numbers and also have a mapping from number range to operator (the latter is probably NOT something you need, though).
As always with this sort of question, don't get hung up on over-validation. Check for the most likely grossly-malformed inputs then move on. Trying to keep track of what prefixes and lengths of phone number are in use in any particular locale is an enormous waste of your time. Letting a few, possibly-fixable mistakes through is better than losing customers by telling them they are ‘invalid’.
(The nearest to a standard addressing format you get in the UK is postcode plus house number. Even then there are always exceptions. )
I've started the code (or at least a bunch of RegEx patterns) for Django forms validation for GB telephone numbers here.
With a basic explanation here.

Resources