I am trying to develop an application that accepts a postal code from a form. The form is accessible worldwide. I know that for US zip codes the standard character length is 5, but what is the min and max for non-US postal codes? I need to know because I am using a validation constraint:  /**      * The zip code used to retrieve a US based customer's state.      */     @Nullable     @Size(min=5, max=5)     private final String zip;   This question was marked as a duplicate because of this post: . Which doesn't specify the minimum for all non-US postal codes.
121040
I expect the column to be a VARCHAR2, in my Oracle Database.  US Zips are 9.  Canadian is 7.  I am thinking 32 characters would be reasonable upper limit  What am I missing?  [EDIT] TIL: 12 is a reasonable answer to the question Thanks to everyone who contributed.
90368
If I understand correctly in (unpadded) RSA the length of message M must be shorter than modulus n.  Encryption gives ciphertext that is also shorter than n.  Let's say I want to send a message of 2.5x length of n.  Is the split of message into chunks inferred somehow, or is that encoded somehow within ASN.1 keys? What are the different options/standards for this?  EDIT: Probably RSA is not used for messages longer than n but symmetric keys are generated with RSA and then they are used for longer messages?
55833
I have some client-side validation against a text box, which only allows numbers up to two decimal places with no other input.  This script was a basis for entering numeric values only, however it needs to be adapted so it can take a decimal point followed by only up to two decimal places.  I've tried things such as /[^\d].\d{0,2}, but then the replacement call wouldn't work, and I've got no idea how to do it.  Code  &lt;script type="text/JavaScript"&gt;   function valid(f) {     if (!/^\d*$/.test(f.value)) {       f.value = f.value.replace(/[^\d]/g,"");       alert("Invalid number");     }   } &lt;/script&gt;     Note  I need to match an empty string. If an empty string is provided and the form is submitted, the value defaults back to zero.
12151
What characters/symbols are allowed within the CSS class selectors? I know that the following characters are invalid, but what characters are valid?  ~ ! @ $ % ^ &amp; * ( ) + = , . / ' ; : " ? &gt; &lt; [ ] \ { } | ` #
5648
Declared a string and assigned SOQL value as shown below. While running I am getting an error.   String country = 'United States'; String accountQuery = 'SELECT Id,BillingPostalCode,County_Name__c '+      'FROM Account WHERE zipCodeLen__c =9 AND AND BillingCountry = '+ Country;   System.QueryException: unexpected token: 'AND'  System.QueryException: expecting a colon, found 'United'
95625
What is the formula for calculating the additional 3 characters needed to append to a 15 char Id in order to form its equivalent 18 char Id?   I have a situation where I need to compare 15 char Ids (uploaded by users) with their 18 char equivalents (stored in a local database), and it would be most efficient if I could convert the 15 char Ids to 18 chars before comparing (The 18 char Ids are PK fields in my local database, and while I could compare using a like query clause, it would be more efficient to convert to 18 chars and perform lookups based on those values).  The base algorithm would be great - even better is an C# implementation.
271
How do you left pad an int with zeros when converting to a String in java?  I'm basically looking to pad out integers up to 9999 with leading zeros (e.g. 1 = 0001).
18468
I'm developing an algorithm to parse a number out of a series of short-ish strings. These strings are somewhat regular, but there's a few different general forms and several exceptions. I'm trying to build a set of regexes that will handle the various forms and exceptions; I'll apply them one after another to see if I get a match.   One of these forms goes something like this:  X (Y) Z   Where:   X is a number I want to capture.  Z is static, pre-defined text. it's basically how I determine whether this particular form is applicable or not. Y is a a string of unknown length and content, surrounded by parenthesis.    Also: Y is optional; it doesn't always appear in a string with Z and X. So, I want to be able to extract the numbers from all of these strings:   10 Z 20 (foo) Z 30 (bar) Z   Right now, I have a regex that will capture the first one:  ([0-9]+) +Z   My problem is that I don't know how to construct a regex that will match a series of characters if and only if they're enclosed in parenthesis. Can this be done in a single regex?
112080
I'm looking for the ultimate postal code and zip code regex. I'm looking for something that will cover most (hopefully all) of the world.
33306
Hey! I was looking at this code at   I noticed that in some situations they used hex numbers, like in line 134:  for (j = 1; val &amp;&amp; j &lt;= 0x80; j &lt;&lt;= 1, q++)   Now why would they use the 0x80? I am not that good with hex but I found an online hex to decimal and it gave me 128 for 0x80.  Also before line 134, on line 114 they have this:  small_n = (n &amp; 0xffff0000) == 0;   The hex to decimal gave me 4294901760 for that hex number. So here in this line they are making a bit AND and comparing the result to 0??  Why not just use the number? Can anyone please explain and please do give examples of other situations.  Also I have seen large lines of code where it's just hex numbers and never really understood why :(
78933
I was just wondering what the most up-to-date source for US Zip Code boundaries would be.    My first thought was TIGER, whenever that comes out, but then I thought that the Postal Service might be a better bet.    Does anyone have some input?
6735
I've got a working PHP script that gets Longitude and Latitude values and then inputs them into a MySQL query. I'd like to make it solely MySQL. Here's my current PHP Code:  if ($distance != "Any" &amp;&amp; $customer_zip != "") { //get the great circle distance      //get the origin zip code info     $zip_sql = "SELECT * FROM zip_code WHERE zip_code = '$customer_zip'";     $result = mysql_query($zip_sql);     $row = mysql_fetch_array($result);     $origin_lat = $row['lat'];     $origin_lon = $row['lon'];      //get the range     $lat_range = $distance/69.172;     $lon_range = abs($distance/(cos($details[0]) * 69.172));     $min_lat = number_format($origin_lat - $lat_range, "4", ".", "");     $max_lat = number_format($origin_lat + $lat_range, "4", ".", "");     $min_lon = number_format($origin_lon - $lon_range, "4", ".", "");     $max_lon = number_format($origin_lon + $lon_range, "4", ".", "");     $sql .= "lat BETWEEN '$min_lat' AND '$max_lat' AND lon BETWEEN '$min_lon' AND '$max_lon' AND ";     }   Does anyone know how to make this entirely MySQL? I've browsed the Internet a bit but most of the literature on it is pretty confusing.
113299
I'm trying to learn a bit more about the details of proper database construction and ran across something that confuses me. In a current Wordpress installation, I'm finding varchar fields used for indexes which are longer than the 191 characters, which the documentation seems to say is the max. I'm running MariaDB 10.x which I believe matches up with MySQL 5.7, and the  confirms the limit when using utf8mb4_unicode_ci collation and compact as the format.  I'm finding varchar(200) and varchar(255) indexed fields, e.g. wp_postmeta, the field meta_key is varchar(255). Am I wrong or confused on this? The db is using the InnoDB engine. Thanks for any clarification.
43645
Suppose you want to generate a password using ASCII  characters ($128$ characters.)How many ways can you create a password of 10 characters long that has at least one lowercase letter (a-z) and at least one number ($0-9$)?  ** MY ANSWER: $26*10*(128)^{10}$**  I don't understand why this is wrong? Can anybody help? Thanks!
91108
We are currently developing a little AES implementation in a crypto-course at university.  As far as I know, AES uses a 128 bit block length, so all data that will be encrypted gets split up into blocks of 128 bits (16 bytes) into a 2d-array (or 1d in implementation) with 4 &times; 4 fields.  I was wondering and didn't find out what to do if the entered string to encrypt is not 128 bits long? The question is going further by thinking that there will never be exactly n &times; 128 bits of data to encrypt.  For a smaller key given by the user (e.g. "test") I know there is a key expansion algorithm defined.  But what should be done for data that is less than 128 bits?
87683
I'm developing a website that displays information about European festivals, including their addresss. Given that different countries use different address formats, I'm wondering what is the best "one size fits all" form that I can use to capture the address data. Obviously I could use something like:  Address Line 1 _____________ Address Line 2 _____________ Address Line 3 _____________ Address Line 4 _____________  Country* &lt;choose from drop down list&gt;   (Fields marked with * are mandatory)  The above is not very satisfactory as it allows the user to enter the address in an almost completely unstructured way. More specifically, it will make it difficult for me to extract the town/city and post code (if applicable), which I will need to do.  I want to make the form as structured as possible, while still accommodating all possible European address formats (within reason). The best I've come up with so far is:  Address Line 1 _____________ Town/City*     _____________ Address Line 3 _____________  Post Code      _____________ Country* &lt;choose from drop down list&gt;   This will force the user to enter the nearest town/city and country, which should allow me to plot the location on a map. I think the concept of town/city is pretty much universal, and if the country uses post codes, I can capture that information too.  However, it seems like this problem must have been considered at least a million times before. Are there any "best practices" that I should be following?
22689
I'm trying to generate a secret key to be used for HMAC SHA-256 signature processing. I've seen many sample of keys with variable length from 32 characters to 96 characters.  What is the ironclad rule for this key size?