The url of our search page is build like this:
http://www.example.com/results/name/John/city/Miami/gender/Male
This would display every male named John in Miami.
When one of the filters is left empty, the url would be something like this:
http://www.example.com/results/name/John/city//gender/Male
So there are two slashes in the url.
Outlook doesn't seem to like this. When you click on the second url, it removes one of the two slashes. This leaves the url like this:
http://www.example.com/results/name/John/city/gender/Male
Persons names John in the city 'gender'..
What would be the best way to fix this problem?
This is a bug in Microsoft Office.
URLs with two consecutive slashes are allowed by RFC 2396, but they're not commonly used. As the RFC says (extract from Appendix A):
abs_path = "/" path_segments
path_segments = segment *( "/" segment )
segment = *pchar *( ";" param )
Note that segment is defined as containing ZERO OR MORE characters. (You might argue that this is a spec bug, and it shouldn't be allowed... but it is)
As you've discovered, Microsoft Office will "fix" URLs containing double slashes. This is apparently a deliberate feature for "cleanliness and consistency". There is no way to override or disable it. Source.
So, as other people have suggested, you're probably going to have to change the way the server formats URLs.
Try to replace (one of) the slashes with ASCII code 2F (decimal 47).
"Regkey" should help: You need to implement this key
Path: "HKEY_CURRENT_USER\Software\Microsoft\Office\Common"
Name: "AllowConsecutiveSlashesInUrlPathComponent"
Type: "REG_DWORD"
Value: "1"
For implementation & more detail see here.
The standard is to collapse the two slashes into one, so there is no way to prevent this from happening. It might be a good idea to put something between those slashes to indicate to your search page that that field is blank.
Alternatively, you could change the search page to use a query string such as this:
http://www.example.com/results?name=John&city=&gender=Male
You can use - instead of blank segment. For example:
http://www.example.com/results/name/John/city/-/gender/Male
I agree with Peter, just replace the second "/" with "%2F" or "%2f" is enough.
If you must use slashes, consider fixing this on the server side. Create a list of keywords (city|results|...) and, if a slash is followed by one of the keywords, treat it as an empty entry. (edited) Double slashes should not be treated as one, but as you found out, some applications "fix" this.
An alternative and standard way of fixing this is using a placeholder, normally a dot, because it has no special meaning:
http://example.com/results/name/./city/amsterdam
Related
I'm trying to build a couple of segments based on entry url. Unfortunately, the site has inconsistent name conventions/url structures so using 'Starts With' or some of the other search operators isn't much help. Is there a way to 'paste' (and use a separator) a list of various entry urls or am I going to have to do this one by one?
Current (inefficient)
::Entry URL = URL 1 OR Entry URL = URL 2, etc..
Hoping for (more efficient)
:Entry URL matches any of these: URL1, URL2, etc (pasted in single field?)
Thanks for any help!
Use match type "matches regex" and list your values with "|" in one field.
URL1|URL2
I want to find all usages of my react component in code.
I tried <Button> but Special chars <> are not supported.
Tried "Button" and i get "Button" and button with lowercase as results as well.
So exact match is also not supported.
Is there is a way to find a string exactly without any additional results?
Unfortunately, search symbols (<> and "" in your scenario) is not supported in code search.
In tfs the symbol "" is used for finding an exact match to a set of words by enclosing your search terms in double-quotes. For example, "Client not found".
Is there is a way to find a string exactly without any additional
results?
Yes, but it seems a little complex, just reference my answer in another thread:Is there a way to make TFS code search recognize the "#" symbol?
Checked for some characters in code search. You can't use the symbol
characters except * and ? as part of your search query, which
including below characters: . , : ; / \ ` ' " # = ! # $ & + ^ | ~ < >
( ) { } [ ]. The search will simply ignore these symbols.
But you can use wildcard characters * and ? to broaden your search.
You can use wildcard characters anywhere in your search string except
as a prefix in a simple search string or a query that uses a code type
filter. For example, you cannot use a search query such as
*RequestHandler or class:?RequestHandler. However, you can use prefix wildcards with the other search filter functions; for
example, the
search query strings file:*RequestHandler.cs and repo:?Handlers are
valid.
Please see Broaden your search with wildcards for details.
If you want to search the strings including these symbol exactly(such
as '#' here), you can code search with other strings (eg,
testexample.com here) to narrow down the scope first, then copy the
specific code to text editor which support the symbols (eg,
Notepad++), then search stings with the symbol characters.
Besides, if you are using Git, another workaround is using the code
search tool Hound: a lightning fast code search tool, it supports
the symbol characters. Reference this thread to use it:
How can I publish source code (Visual Studio) on a intranet?
Also, there is a User Voice here to suggest the feature, you can go and vote it up to achieve that in future.
Consider the the following text
The capital asset as defined in section 2(14) is an exhaustive definition which encompasses all properties of any kind with certain exceptions but the key word is that the property should be "held" section 2.
Now I want to find section 2, for the same I have written the following Regex:
/\bsection+\.*\s+2\b/i
But it is also matching section 2 of section 2(14). I just want it to only match the exact text, not the part of text which is matching with the regex. I know I need to modify the regex, but what are the changes required?
Try with \bsection+\.*\s+2([ .,;?|!])/i . This will only match with section 2 if it is followed by a space or a punctuation mark different than (.
/\bsection+.*\s+2\b([[:punct:]]|\s/
basically you would want the word to end with whitespace or a punctuation.
How do one code an email, say, alibaba#gmail.com to a***a#g***l.c*m in ruby on rails?
I found this when I tried to recover my password to my gmail account.
If you have the email already split into address and domain this is much easier. But to do that its simply:
email = 'alibaba#gmail.com'
address, domain = email.split('#')
If you don't care about the character count between the first and last of each token:
"#{address[0]}***#{address[-1]}"
for the a**a before the # and similar can be done for the domain but using split on the . character:
working_domain = domain.split('.')
"#{working_domain[0][0]}***#{working_domain[0][-1]}.#{working_domain[1][0]}*#{working_domain[1][-1]}"
That's a pretty ugly way to do it and its not very DRY and doesnt care about character counts. You should be able to encapsulate all of this into a function or 3 and make this simpler to use.
From the example you give in the question ("alibaba#gmail.com" => "a***a#g***l.c*m"), it appears you don't need the number of *'s to match the number of replaced characters. If that's the case, you can solve this with a simple regex substitution, no splitting or parsing of the address necessary:
email = 'alibaba#gmail.com'
email.gsub(/(?<=[\w\d])[\w\d]+(?=[\w\d])/, "**")
# => "a**a#g**l.c**m"
Breaking down that regex, just for clarity: [\w\d]+ matches strings of alphanumeric characters, excluding one alphanumeric to the left ((?<=[\w\d])) and another to the right ((?=[\w\d])) of each matched group, and replaces each match with "**".
I hope this helps.
After having the unpleasant surprise that Comma Seperated Value (CSV) files are not necessarily comma-separated, I'm trying to find out if there is any way to detect what the regional settings list separator value is on the client machine from http request.
Scenario is as follows: A user can download some data in CSV format from web site (RoR, if it matters). That CSV file is generated on the fly, sent to the user, and most of the time double-clicked and opened in MS Excel on Windows machine at the destination. Now, if the user has ',' set as the list separator, the data is properly arranged in columns, but if any other separator (';' is widely used here) is set, it all just gets thrown into a single column. So, is there any way to detect what separator is used on the client machine, and generate the file accordingly?
I have a sinking feeling that it is not, but I'd like to be sure before I pass the 'can't be done, sorry' line to the customer :)
Here's a JavaScript solution that I just wrote based on the method shown here:
function getListSeparator() {
var list = ['a', 'b'], str;
if (list.toLocaleString) {
str = list.toLocaleString();
if (str.indexOf(';') > 0 && str.indexOf(',') == -1) {
return ';';
}
}
return ',';
}
The key is in the toLocaleString() method that uses the system list separator.
You could use JavaScript to get the list separator and set it in a cookie which you could then detect from your server.
I checked all the Windows Locales, and it seems that the default list separator is virtually always either ',' or ';'. For some locales the drop-down list in the Control Panel offers both options; for others it offers just ','. One locale, Divehi, has a strange character that I've not seen before as the list separator, and, for any locale, it is possible for the user to enter any string they want as the list separator.
Putting random strings as the separator in a CSV file sounds like trouble to me, so my function above will only return either a ';' or a '.', and it will only return a ';' if it can't find a ',' in the Array.toLocaleString string. I'm not entirely sure about whether array.toLocaleString has a format that's guaranteed across browsers, hence the indexOf checks rather than picking out a character at a specific index.
Using Array.toLocaleString to get the list separator works on IE6, IE7, and IE8, but unfortunately it doesn't seem to work on Firefox, Safari, Opera, and Chrome (or at least the versions of those browsers on my computer): they all seem to separate array items with a comma, irrespective of the Windows "list separator" setting.
Also worth noting that by default Excel seems to use the system "decimal separator" when it's parsing numbers out of CSV files. Yuk. So, if you're localizing the list separator you might want to localize the decimal separator too.
I think everyone should use Calc from OpenOffice - it asks when you open a file about encoding, column separators and other. I don't know answer for your question, but maybe you can try to send data in html tables or in xml - excel should read both of them correctly. From my experience it isn't easy to export data to excel. Few weeks ago I have problem with it and after few hours of work I asked a person, who couldn't open my csv file in excel, about version. It was Excel 98...
Take a look on html example and xml.
The simplier version of getListSeparator function, enabling any character to be a separator:
function getListSeparator_bis()
{
var list = ['a', 'b'];
return(list.toLocaleString().charAt(1));
}// getListSeparator_bis
Just set any char (f.e. '#') as list separator in your OS and try the code as above. The appropriate char (i.e. '#' if set as sugested) is returned.
Could you just have the users with non comma separators set a profile kind of option and then generate CSVs based on user settings with the default being commas?
Toms, as far as I'm aware there is no way of achieving what you're after. The most you can do is try and detect the user locale and map it against a database of locales/list separators, altering the list separator in the .CSV file as a result.