For the longest time, I've been wanting to create a simple feed widget to place on a web page and have it display links from the syndicated site. Easier dreamt than done, until this thanksgiving weekend when I decided to partially put the long holiday to good use and write up a widget tool.
It's a weird thing. I get to be away form work for 4 days, yet I spend my free time coding and learning new programming techniques. There was certainly time spent with family, but for me, delving into coding challenges also has a therapeutic effect. Some programmers may understand the absurdity of this. There's that drudgery factor at work that you don't have to deal with when hobby programming. No boss to report to, no business politics, no users interrupting with questions or problems. I get to set the rules from end to end. Not to mention that at work I'm an ASP.NET programmer, and at home I turn into a PHP coder.
I realize that there are a bunch of these RSS/ATOM widgets already out there. So mine's another one to add to the list. Partial as I may be, I think it does a decent job and it allow for some basic customizations.
Since this is a new utility, consider it in beta mode until I say it's not. If Gmail can be in beta for eternity, why not this one? I've tested it quite a bit, but I'm sure there are still bugs to be fixed. Also I have no idea what impact this may have on my Web hosting account quotas. We'll find out. Documentation is not one of my strengths, but I will eventually produce an FAQ on some of the widget's capabilities, features, and customizations using, for instance, CSS. There are also plans to enhance it further, if there's enough demand for it.
For now, feel free to visit the RSS/ATOM widget tool page, create your JavaScript RSS/ATOM widget, and embed it in your Web pages. Let me know if you run into any bugs or have any suggestions. I'll try to address them as time permits.
rss,atom,rss widget,xml,web 2.0,ajax,javascriptLabels: javascript, web, xml
<
RSS ATOM Widget Utility>
// posted by rh
As some of you know, this site contains several utilities in the tools section. One of these tools is JavaScript Visitor IP Address and Host Name. It's a simple JavaScript block that can be placed inside any web page and it displays or prints the visitor's IP address and host name.
As is with the rest of the tools, this one was also born out of necessity and I decided to share it with everyone. But some people are not comfortable putting my scripts on their site. That's cool and I don’t blame them, they don’t know me. So here I am going to explain how to display or print the user's IP address and host name using a number of server-side technologies.
The keyword here is "server-side". That's right, there is no way you can glean that information from client-side JavaScript. Even my JavaScript utility uses server-side calls to obtain the data and then packages it up in JavaScript format and streams it back. If your site supports server-side scripting, then chances are one of the following will do the job for you.
Perl:print "IP: $ENV{'REMOTE_ADDR'}<br>Host: $ENV{'REMOTE_HOST'}";
SSI:IP: <!--#echo var="REMOTE_ADDR"--><br>Host: <!--#echo var="REMOTE_HOST"-->
PHP:<?= "IP: {$_SERVER['REMOTE_ADDR']}<br>Host: {$_SERVER['REMOTE_HOST']}" ?>
ASP:<%= "IP: " + Request.ServerVariables("REMOTE_ADDR") + "<br>Host: " + Request.ServerVariables("REMOTE_HOST") %>
ASP.NET:<%= "IP: " + Request.UserHostAddress + "<br>Host: " + Request.UserHostName %>
Python:print "IP: " + cgi.os.environ["REMOTE_ADDR"] + "<br>Host: " + cgi.os.environ["REMOTE_HOST"]
Ruby:print "IP: " + ENV["REMOTE_ADDR"] + "<br>Host: " + ENV["REMOTE_HOST"]
JSP:<%= "IP: " + request.getRemoteAddr() + "<br>Host: " + request.getRemoteHost() %>
Java Servlet:out.println("IP: " + request.getRemoteAddr() + "<br>Host: " + request.getRemoteHost());
A common issue with the above calls is that in many cases host names may be returned as IP addresses or nothing at all. In some cases that is because no reverse record for a client's IP address is available. But if this issues occurs all the time, it could mean that reverse resolution is turned off. This is generally done for performance reason, to save on server resources.
You can ask your hosting company to turn that service on, or you could configure reverse lookup yourself if you have access to the server configuration files. Here’s how reverse look up is switched on for Internet Information Server (IIS) and Apache.
IIS (execute at command line):adsutil set w3svc/EnableReverseDNS TRUE
Apache (edit httpd.conf file):HostnameLookups On
By the way, if you ever wanted to run a simple reverse lookup on an IP address, here's a
Reverse Whois tool for that job.
Before I end this post, here's one more piece of information for those who might wonder where parameters like REMOTE_ADDR or REMOTE_HOST come from. Those are part of a collection of parameters known as environment variables that web servers are expected to make available to the scripts. Want the gory details?
Read here.
There you have it. If you can put any of the above scripts to use instead of using my JavaScript utility, I'd appreciate the bandwidth savings. And to those who continue to use my utilities, your trust and confidence are appreciated.
javascript,
server-side scripting,
ip address,
hostname,
perl,
ssi,
asp,
ruby,
python,
jsp,
servletLabels: ip address, javascript, programming
<
IP address and Host name Scripts>
// posted by rh