domain-name interview questions
Top domain-name frequently asked interview questions
I want to allow my company’s customers to integrate our Google App Engine application into their domains. For example, let’s say one customer owns the domain coolcustomer.com
and wants to make our app accessible at service.coolcustomer.com
.
This article discusses how to set up multi-tenancy internally, but does not mention how to associate client domains with an app.
Ideally, I’d like to allow customers to associate a sub-domain in a self-service manner. This, of course, brings up the issue of validating that the customer has permission to add a sub-domain to a domain name.
What is the best approach to accomplish this?
Source: (StackOverflow)
I have a URL which can be any of the following formats:
http://example.com
https://example.com
http://example.com/foo
http://example.com/foo/bar
www.example.com
example.com
foo.example.com
www.foo.example.com
foo.bar.example.com
http://foo.bar.example.com/foo/bar
example.net/foo/bar
Essentially, I need to be able to match any normal URL. How can I extract example.com
(or .net, whatever the tld happens to be. I need this to work with any TLD.) from all of these via a single regex?
Source: (StackOverflow)
I've built a node.js-express app. By default it is listening on port 3000. I have the system hosted on an EC2 instance and have pointed a domain's A record to the AWS elastic IP address.
I'd like for HTTP requests to the domain name to automatically be directed to port:3000 or I'd like to be able to start the Express HTTP server up on port 80. (I tried starting up the node http server on port 80 but got an error)
I can access the node app if I type www.myurl.com:3000 but I need to be able to drop that requirement for the good of the end users.
Does anyone know how to make node and ports and domains all play nicely together on my amazon-buntu server?
Source: (StackOverflow)
I have 4 URLs that I would like to redirect to my main page. They are all just common misspellings and I want to have my bases covered so that users can access the site even if they have a letter off. How would I go about doing this with Google App Engine?
I would imagine that I need a python handler to do the redirects but what would this look like? Any resources or examples would be great.
Source: (StackOverflow)
I've got a domain name that would work nicely with a .it domain name (e.g. redd.it). This is for a web application I'm building, which if it ever generates revenue will be for a company in the US. Is this allowed?
Source: (StackOverflow)
Not only easy ones like .com or .net, but also, .co.uk, .fr, .gov.rw ... ?
Should I really make a huge mapping "tld to relevant whois server", or is there an easier way ?
Source: (StackOverflow)
I used the following to extract the domain from a url: (They are test cases)
String regex = "^(ww[a-zA-Z0-9-]{0,}\\.)";
ArrayList<String> cases = new ArrayList<String>();
cases.add("www.google.com");
cases.add("ww.socialrating.it");
cases.add("www-01.hopperspot.com");
cases.add("wwwsupernatural-brasil.blogspot.com");
cases.add("xtop10.net");
cases.add("zoyanailpolish.blogspot.com");
for (String t : cases) {
String res = t.replaceAll(regex, "");
}
I can get the following results:
google.com
hopperspot.com
socialrating.it
blogspot.com
xtop10.net
zoyanailpolish.blogspot.com
The first four cases are good. The last one is not good. What I want is: blogspot.com
for the last one, but it gives zoyanailpolish.blogspot.com
. What am I doing wrong?
Source: (StackOverflow)
I tried using EXEC sp_who2;
but it gives host, users, etc. It's great but I need to know my SQL Server's domain name so I can install a plugin to the SQL Server Management Studio. The plugin is a Dell product to analyse server usage - "spotlight studio plugin" and it runs as a service.
Thanks
Source: (StackOverflow)
Given a URL, how do I extract the registered domain using the Public Suffix List (list of effective TLDs, e.g. this list)?
For instance, considering a.bg
is a valid public suffix:
http://www.test.start.a.bg/hello.html -> start.a.bg
http://test.start.a.bg/ -> start.a.bg
http://test.start.abc.bg/ -> abc.bg (.bg is the public suffix)
This cannot be done using simple string manipulation because the public suffix can consist of multiple levels depending on the TLD.
P.S. It doesn't matter how I read the list (database or flat file), but the list should be accessible locally so I'm not always dependent on external services.
Source: (StackOverflow)
I realize that this question might not make sense to some, but I was just curious of why the domain names built starting from most specific and ending with most global identifier.
www.google.com
[most specific].[2nd level].[top level]
All other tree traversing formats, syntax conventions and identifiers (at least ones that I'm aware of) start with the most global namespace and end with the most specific node.
- Filepath: /root/subfolder1/subfolder2/file
- Component: com.android.notepad.NoteEditor
- Object: rootObject.subObject1.subObject2
- IP: 1.2.3.4
- Newsgroups: comp.lang.java.help
- Phone numbers: +1-555-555-1234
So I guess my question is whether there is any productive reason behind this special treatment of domain names by specifying them backwards, or it was just decided by throwing a coin?
EDIT:
More examples of forward conventions:
- Address (Russia): Country, City, Street House/Apt
- Date (Japanese and DB): YYYY-MM-DD
- Time: HH:mm:ss
Examples of Backward conventions:
- Address (US): Street House/Apt, City, State, Country
- Date (European): DD/MM/YYYY
The most specific first makes sense when addressing is identifiable easier and happens more often on local scale.
Mixed order:
- Date (US): MM/DD/YYYY - While Month gives more meaning to the Day, the Year is moved to be the last, because it less needed to uniquely identify the date in day-to-day use.
Source: (StackOverflow)
My question may be stupid, But honestly I searched a lot and got success but not complete.
I use xampp with windows 8.
My host file looks as follows.
127.0.0.1 localhost
127.0.0.1 www.mysite.com
My httpd-vhosts.config looks as follows.
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost 127.0.0.1>
ServerName www.mysite.com
ServerAlias mysite.com
DocumentRoot "C:/xampp/htdocs/mysite"
</VirtualHost>
This works perfect for http.
But I have enabled ssl.
When I type http://localhost
or https://localhost
, Both work fine.
When I type http://mysite.com
it works,
when I type https://mysite.com
it is redirected as https://mysite.com/xampp/
and shows me default welcome page of xampp.
I tried following things.
1) instead of using 127.0.0.1, I tried using *:80 in httpd-vhosts.conf But result was same.
2) instead of using 127.0.0.1, I tried using *:443 in httpd-vhosts.conf But at the time of restarting apache fails to start again.
Please let me know how can I access my site through domain name instead of localhost with https or http.
Source: (StackOverflow)
What is the shortest and/or efficient SQL statement to sort a table with a column of email address by it's DOMAIN name fragment?
That's essentially ignoring whatever is before "@" in the email addresses and case-insensitive. Let's ignore the internationalized domain names for this one.
Target at: mySQL, MSSQL, Oracle
Sample data from TABLE1
id name email
------------------------------------------
1 John Doe johndoe@domain.com
2 Jane Doe janedoe@helloworld.com
3 Ali Baba ali@babaland.com
4 Foo Bar foo@worldof.bar.net
5 Tarrack Ocama me@am-no-president.org
Order By Email
SELECT * FROM TABLE1 ORDER BY EMAIL ASC
id name email
------------------------------------------
3 Ali Baba ali@babaland.com
4 Foo Bar foo@worldof.bar.net
2 Jane Doe janedoe@helloworld.com
1 John Doe johndoe@domain.com
5 Tarrack Ocama me@am-no-president.org
Order By Domain
SELECT * FROM TABLE1 ORDER BY ?????? ASC
id name email
------------------------------------------
5 Tarrack Ocama me@am-no-president.org
3 Ali Baba ali@babaland.com
1 John Doe johndoe@domain.com
2 Jane Doe janedoe@helloworld.com
4 Foo Bar foo@worldof.bar.net
EDIT:
I am not asking for a single SQL statement that will work on all 3 or more SQL engines. Any contribution are welcomed. :)
Source: (StackOverflow)
Is it possible without using regular expression?
For example, I want to check that a string is a valid domain:
domain-name
abcd
example
Are valid domains. These are invalid of course:
domaia@name
ab$%cd
And so on. So basically it should start with an alphanumeric character, then there may be more alnum characters plus also a hyphen. And it must end with an alnum character, too.
If it's not possible, could you suggest me a regexp pattern to do this?
EDIT:
Why doesn't this work? Am I using preg_match incorrectly?
$domain = '@djkal';
$regexp = '/^[a-zA-Z0-9][a-zA-Z0-9\-\_]+[a-zA-Z0-9]$/';
if (false === preg_match($regexp, $domain)) {
throw new Exception('Domain invalid');
}
Source: (StackOverflow)