host interview questions
Top host frequently asked interview questions
How to use Django to get the name for the host server?
I need the name of the hosting server instead of the client name?
Source: (StackOverflow)
I'm writing some code that processes URLs, and I want to make sure i'm not leaving some strange case out...
Are there any valid characters for a host other than: A-Z, 0-9, "-" and "."?
(This includes anything that can be in subdomains, etc. Esentially, anything between :// and the first /)
Thanks!
Source: (StackOverflow)
I changed some domain mappings in /etc/hosts
for xyz.com
. When I opened it on chrome it was reflecting that mapping. Now when I again changed the mapping in hosts file and reloaded the xyz.com
in chrome, but it didn't reflect the change this time.
I cleared cookies and cache and then tried the same, but still change wasn't reflected.
Now this time I cleared the cookies and cache and restarted the browser, it did reflected the change this time.
What is the workaround for this. Do I have to restart chrome everytime I change the DNS mapping in hosts?
Source: (StackOverflow)
I need to make my local node.js webapp listen 80 port. Now if run my app on port 80 I get this erro
events.js:72
throw er; // Unhandled 'error' event
^
Error: listen EACCES
at errnoException (net.js:901:11)
at Server._listen2 (net.js:1020:19)
at listen (net.js:1061:10)
at Server.listen (net.js:1127:5)
at Object.<anonymous> (\scripts\server.js:23:4)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
And if run app on 4321 port this error do not reproduced, so it's port depending.
What should I do to be able run my app on port 80 on Windows 7
Source: (StackOverflow)
I have a problem here with Symfony 2. I want to have virtual host on Windows Vista PC, so I can access my Symfony application like this myapp.local.com
.
What I have tried:
I added these lines to hosts file
127.0.0.1 local.com
127.0.0.1 myapp.local.com
These I added to apache httpd-vhosts.conf
< VirtualHost myapp.local.com:80 >
DocumentRoot "d:/data/www/myapp/web"
ServerName myapp.local.com
Alias /sf /$sf_symfony_data_dir/web/sf
< Directory "/$sf_symfony_data_dir/web/sf" >
AllowOverride All
Allow from All
< /Directory >
< Directory "d:/data/www/myapp/web" >
AllowOverride All
Allow from All
< /Directory >
< /VirtualHost >
but when I write myapp.local.com
in my browser, it brings the index of my www
directory. What am I doing wrong?
Source: (StackOverflow)
I created a Jekyll-powered blog and am hosting it with GitHub Pages.
Now, I want to set up a subdomain (blog.example.com), but can't make it work.
I have added a CNAME file with the text: blog.example.com. And I have added to A records in my Dreamhost account for the subdomain, both pointing to 204.232.175.78, provided by GitHub.
Any idea about what the missing part is, or if I'm doing something incorrectly?
Source: (StackOverflow)
I am writing software to communicate between tablet (Motorola Xoom with Android version 4.0.3 and Kernel version 2.6.39.4) and a peripheral device using USB Host API provided by Android. I use only two types of communication:
- control - controlTransfer(int requestType, int request, int value, int index, byte[] buffer, int length, int timeout)
- bulk - bulkTransfer(UsbEndpoint endpoint, byte[] buffer, int length, int timeout)
Control transfer works fine, but I have a problem with bulk transfer. I can use only 32768 as a size of the buffer for bulkTransfer function. It is not possible to use less or more. I know that I cannot use more because of the limit of the buffer pipe (size: 32769 bytes).
This peripheral device streams data which is not correctly read by bulkTranfer function. I suppose that some data is lost.
I find this: In Linux If a process attempts to read from an empty pipe (buffer), then read(2) will block until data is available. If a process attempts to write to a full pipe , then write(2) blocks until sufficient data has been read from the pipe to allow the write to complete.
And based on that, my explanation of the problem is that some data is not written to pipe (buffer) because of blocking flag made by write(2) function. Am I correct? If this is true I could change pipe buffer.
- My first solution for this problem is greater buffer. For
kernel >= 2.6.35, you can change the size of a pipe with fcntl(fd,
F_SETPIPE_SZ, size) but how can I find fd (file descriptor) for
USB pipes?
- Second option is to use "ulimit -p SIZE" but parameter p for my kernel is not for pipe but process.
Has anyone faced the same problem, any solutions?
Source: (StackOverflow)
I have a USB Host Mode application that works perfectly. I plug in the device, Android pops up the Allow the app APPNAME to access the USB device? permission request window, I check the Use by default for this USB device tick box and tap OK, then up comes my app and it communicates with the USB device perfectly.
BUT...
Then I unplug the device and plug it back in. Android pops up the Allow the app APPNAME to access the USB device? dialog again. WTH? I've already told Android to do this by default, so why is it asking me again?
This happens both with Icecream Sandwich 4.0.3 and Jellybean 4.1.
Ideally I want Android to remember I've granted permission for this particular USB device even after I've rebooted the Android device.
So why isn't Android remembering that I've granted permission?
Source: (StackOverflow)
Is there a good tutorial for using an Arduino with an Android where the Android device is the USB host? (The Android device has OS version 3.1 (Honeycomb) or later). The only host program on the developer site is the missile launcher, which seems far simpler than interfacing with an Arduino would be.
Specifics: I'm trying to make an Asus Transformer host an Arduino Uno, but since there is very little information on how the Android host mode works, I'm lost on where to start. I just need the Android to be able to read data values out of the Arduino's memory. The Arduino is being used to count the frequency of a signal, that value then needs to be passed to the Android. If I've missed some simple way of doing this, feel free to let me know.
(There is a lot of information floating around about using the ADK to make the Arduino the host, but with the Transformer, that isn't an option - see Stack Overflow question Is it possible to get the Android ADK working on an ASUS Eee Pad Transformer running 3.1?.
The information doesn't really need to be Transformer or Uno specific, I just can't seem to find examples of people using the new host mode on their tablets.
Source: (StackOverflow)
As more and more devices have KitKat, I'm trying to compile a list of devices support HCE.
Does anyone have the list? Feel free to add comments to contribute to this list.
Below is what I have so far:
Notes:
- Not all KitKat devices support HCE.
To detect HCE support, use this code snippet:
boolean isHceSupported =
getPackageManager().hasSystemFeature("android.hardware.nfc.hce");
Some people reported that KitKat HCE phones has "Tap & Pay" in NFC Setting. I don't know if using "Tap & Pay" as HCE detection method is valid because "Tap & Pay" can mean Tap & Pay using internal SE. It doesn't have to be HCE.
- Phones with Broadcom NFC controller will support HCE.
- Phones with NXP NFC controller may/may not support HCE.
- Or use this Android app to detect HCE & NFC controller type.
Support HCE:
- Sprint Note 3 (Broadcom)
- Sprint Galaxy S 4
- Nexus 5
- Nexus 7 (2013)
- Moto X (source)
Do not support HCE:
- T-Mobile Galaxy Note 3 (NXP)
- AT&T Galaxy Note 3
- Nexus 7 (2012)
Source: (StackOverflow)
Can somebody please post here an example how to host CLR in Delphi? I have read similar question here but I cannot use JCL as I want to host it in Delphi 5. Thank you.
EDIT: This article about hosting CLR in Fox Pro looks promising but I don't know how to access clrhost.dll from Delphi.
Edit 2: I give up on Delphi 5 requirement. Now I'm trying JCL with Delphi 7. But again I am unable to find any example. Here is what I have till now:
My C# assemply:
namespace DelphiNET
{
public class NETAdder
{
public int Add3(int left)
{
return left + 3;
}
}
}
I have compiled it to DelphiNET.dll
.
Now I want to use this assemply from Delphi:
uses JclDotNet, mscorlib_TLB;
procedure TForm1.Button1Click(Sender: TObject);
var
clr: TJclClrHost;
ads: TJclClrAppDomainSetup;
ad: TJclClrAppDomain;
ass: TJclClrAssembly;
obj: _ObjectHandle;
ov: OleVariant;
begin
clr := TJclClrHost.Create();
clr.Start;
ads := clr.CreateDomainSetup;
ads.ApplicationBase := 'C:\Delhi.NET';
ads.ConfigurationFile := 'C:\Delhi.NET\my.config';
ad := clr.CreateAppDomain('myNET', ads);
obj := (ad as _AppDomain).CreateInstanceFrom('DelphiNET.dll', 'DelphiNET.NETAdder');
ov := obj.Unwrap;
Button1.Caption := 'done ' + string(ov.Add3(5));
end;
This ends with error: EOleError: Variant does not reference an automation object
I have not worked with Delphi for a long time so I am stuck here...
Solution: There was problem in COM visibility which is not by default. This is the correct .NET assembly:
namespace DelphiNET
{
[ComVisible(true)]
public class NETAdder
{
public int Add3(int left)
{
return left + 3;
}
}
}
Important note:
When working with .NET from Delphi, it is important calling Set8087CW($133F);
at the begining of your program (i.e. before Application.Initialize;
). Delphi has enabled floating point exceptions by default (see this) and the CLR doesn’t like them. When I had them enabled, my program weirdly freezed.
Source: (StackOverflow)
e.g. for mail.google.com would it return google.com or mail.google.com?
I can't actually test it myself
Source: (StackOverflow)
I'm using ActionMailer to send a sign up confirmation email. The email needs to contain a link back to the site to verify the user, but I can't persuade Rails to generate a full URL (including the domain etc).
I'm using:
<%= url_for :controller => 'login', :action => 'verify', :guid => @user.new_user.guid, :only_path => false, :host => 'http://plantality.com' %>
in my view
Part b:
In development mode Rails gripes if I don't specify the host explicilty in the link above. But I don't want to do this in production. Any solutions?
Source: (StackOverflow)
I see I can test routes with rspec like this:
get("/").should route_to("welcome#index")
but I have constraints based on the hostname or parts of hostnames and redirects between several ones. How do I specify a hostname when testing?
How do I run the tests with proper configuration? I tried printing root_url and I got:
Missing host to link to! Please provide the :host parameter, set
default_url_options[:host], or set :only_path to true
Source: (StackOverflow)