File: sitesearch.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">

<!--GENHTML INSERT ^^ ================================================================-->
12/15: Add a doctype spec on line 1 so IE does fixed footer positioning at bottom.
But use HTML 4 (not 5) spec, so images in tables look as they did with no doctype.
Makes some things render diff (e.g, tables at top, and having hdrs), but no worse.
More details:
<!--END INSERT========================================================================-->



<!--GENHTML INSERT====================================================================-->

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

For this file only: UTF-8 Unicode encoding, for non-ASCII or non-English characters.
If omitted, browsers may guess, but often fall back on US-ASCII or user settings.
Update Dec-2018: move the <meta> encoding declaration above this comment, and 
the _META_ genhtml tag to the top of <head> if needed, so <meta> is in the first 
1024 bytes of the file per HTML5 standard.  Nonconforming pages work fine in all 
20+ browsers tested, though Firefox issues a warning in its web console, and some
may restart the page parse - a minor performance penalty.  Not an issue in thumbspage 
output, app user guides, showcode pages, or unzipped programs' Apache index pages. 
<!--END INSERT========================================================================-->

<!--GENHTML INSERT====================================================================-->
Recoded Aug-18 to use relative path, after broken by https:// conversion: can't mix 
http:// page resources (see .htaccess note).  This required regenerating and uploading 
all .html files, but not hundreds of manual page edits - genhtml works!  Formerly 
used ICON-DEFAULT, which has now-dated docs on icon links and filetypes in general.
An icon file in the root folder suffices on some (but not all) web servers.

<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />

<!--END INSERT========================================================================-->

<!--GENHTML INSERT====================================================================-->
<!--this insert serves two purposes: stylesheet and mobile viewport-->

Nov-15: CSS file, code in <HEAD>, for fonts, borders, navbars, code, etc.
This could also use an in-page <STYLE> sheet, as genhtml pastes any text.

<link rel="stylesheet" type="text/css" href="_main.css">

Feb-18: Add a mobile-friendly viewport tag to every page's HEAD.
Fits content to device width, no zoom (user may), impacts MANY formats.
Extend STYLE instead of adding a new insert to avoid all-page updates.
Mobile support required other redesign: toolbar, code blocks, images,... 
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<!--END INSERT========================================================================-->

<!--GENHTML INSERT====================================================================-->
7/6/14: Google Analytics JavaScript (JS) code in <HEAD> (normally).
Used only to isolate high-traffic pages for dev work, iff JS and tracker enabled. 
The former training sites's id: ga('create', 'UA-52578333-1', 'auto').
The book site's id, now used for all: ga('create', 'UA-52579036-1', 'auto').
JavaScript is also used if enabled for thumbspage dynamic image scaling.
Jun-2019: tell Google Analytics to anonymize IP address on receipt for privacy.

  // Start async JS-file fetch, if not already cached

  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

  // Queue actions to run in order after async JS-file fetch finished

  ga('create', 'UA-52579036-1', 'auto');       // Create tracker object (and queue)
  ga('set', 'anonymizeIp', true);              // Anonymize IP addr (&aip) [Jun-2019]
  ga('send', 'pageview');                      // Send page-view event now 

<!--END INSERT========================================================================-->


/* sep18: or use "max-width: N%;" for input field - see pylotto.html (but not 95%) */

.inputsize {                              /* 451+: default large (last setting wins) */
    width: 250px;
    border-width: thin;                   /* sep18: or Android Chrome omits at high res */ 
    /* background-color: green; */        /* to test media-query 'clicks' */

@media screen and (max-width: 450px) {    /* 351..450: medium input field for mobile */
.inputsize {
    width: 155px;
    /* background-color: blue; */

@media screen and (max-width: 350px) {    /* 0..350: small input field for mobile */
.inputsize {
    width: 125px;
    /* background-color: red; */

LI {
    margin-bottom: 8px;    /* add space between, else hard to read+tap (all LI) */

A.emph {
    color: black;
SPAN.emph {
    background-color: white;     /* wheat? cornsilk? */
    font-weight: bold;           /* bold? normal? */





<DIV style="background-color: cornsilk;
            border: thin solid black;
            border-left:  0px;
            border-right: 0px;    /* last wins */

<H2 style="padding-top: 2px; padding-left: 2px;">Search</H2>

<!-- Jun 2018: add accept-charset to avoid HTML-entity encoding of chars  -->
<!-- outside page's default (though it also changed to UTF-8 for new tip) -->
<FORM method=POST accept-charset="UTF-8" action="cgi/">
<TABLE border=0 cellpadding=5 bgcolor=tan>

  <TH align=right>Search this site:
  <TD><select name=searchsite>
      <option>Entire site
      <!-- Jun 2017: now just one site to rule them all... -->
      <!-- <option>Books only --> 
      <!-- <option>Training only -->

  <TH align=right>Search for this:
  <!-- Feb 2018: smaller on mobile (was size=50) -->
  <TD><input type=text name=searchterm class=inputsize>    

  <!-- in order of preference: see below -->
  <TH align=right>Search provider:
  <TD><select name=searchhost>
      <option>Baidu         <!-- Jun 2018: added -->
      <option>Yandex        <!-- Jun 2018: added -->
      <!-- Jun 2018: <option>Ixquick - merged into StartPage in 2016 -->

  <TD><input type=submit value="Search">



<!-- dec18: use border instead of hr so ok in chrome at low zooms


<H2 style="margin-top: 30px;">How This Page Works</H2>

<!-- Feb 2018: mobile-friendly viewer, not HREF=""; -->
<!-- removed the extra copy of the .py in "."; redundancy kills; -->
When you press this page's Search button, it triggers a Python script on 
the server, which in turn builds a "<I>term</I> site:<I>site</I>" site-specific
search query and passes it to a selected search provider using an HTTP redirect.  
You can view and fetch the code of both sides of this interaction 
with these two links:

<P style="margin-left: 26px;">
<SPAN class=emph>
<A class=emph HREF="cgi/">this page</A>
<A class=emph HREF="cgi/">Python script</A>

The net effect displays results in the provider's 
<A HREF="sitesearch-result.png">page</A>.  The script uses 
basic CGI, and its redirect is a simple technique that leverages work 
already performed by search providers that have crawled the site 
(invited or not).  Assorted tips:

<!-- Jun 2018: add tip about searching for non-ASCII Unicode chars; -->
<!-- use HTML entities for non-BMPs, so works in tools like PyEdit; --> 

<LI>To search for Unicode symbols (like  
&#128586;,  <!-- see-no-evil monkey -->
&#128522;,  <!-- a mandatory smiley -->
and ☞), try Google or StartPage first.

<LI>To return to this site, use your browser's Back button on 
the search-results page.

<LI>To learn more about redirects, see 
<A HREF="">this</A>,
<A HREF="">this</A>, and
<A HREF="">this</A>.

<LI>To explore search alternatives, try 
<A HREF="">here</A> and 
<A HREF="">here</A>, though
many require JavaScript on the client, PHP on the server, or worse&mdash;per the
next section.


<H2>Search-Provider Cautions</H2>

Because this page delegates searches to third-parties, it comes with some 
inherent caveats.  First and foremost, some search providers may both 
<I>track</I> searchers, and insert <I>ads</I>  and unrelated <I>photos</I> 
in results.  In testing, Google's search results for "fortran" at this site 
included paid ads for compilers, and Bing displayed pictures of pastry chefs
for "decorators" (yes, really).  Google also disables the Back button in 
some contexts, for reasons not yet isolated.

<!-- Jun 2018: Ixquick was merged into StartPage in 2016 -->
In light of such constraints, the privacy-respecting sites 
<A href="">DuckDuckGo</A> and 
<A HREF="">StartPage</A>
are <I>strongly recommended</I> for users of this page.
Of these, DuckDuckGo seems best in terms of search results so far 
(sometimes finding more than Google), and StartPage seems a close runner-up.
Although other search providers can be selected above for comparison, 
their monetization focus makes them innately perilous, 
and a use-at-your-own-risk proposition.  

There's more on this story in this site's full privacy policy 
<A HREF="privacy-policy.html">here</A>.
Search would ideally avoid third parties altogether, of course, but a 
more custom solution is currently outside this site's proprietor's schedule. 
For more on web-search privacy options, see 
<A HREF="">this</A>;  
or try a web search...


<!--GENHTML INSERT====================================================================-->
Nov15: added via, to avoid pasting footer in every file on changes.
See for other options and their tradeoffs.


<!--Feb18: make table responsive, for mobile-friendly scrollbar on small screens -->
<DIV class=footerdiv>

<TABLE class=footertable bgcolor=tan width="100%">

<!-- NESTED INSERT: can't nest > 2 deep -->      <!-- gif now is Home, not -->
<TD align=center>                                <!-- border=0 for IE img links       -->
  <A class=blocklinkbar href="index.html">       <!-- scale larger gif for better res -->
  <IMG SRC="PythonPowered.gif" ALT="[Home]" border=0 width=55 height=22></A>  
<TD align=center>
  <A class=blocklinkbar HREF="index-book-links.html">Books</A>
<TD align=center>
  <A class=blocklinkbar HREF="programs.html">Programs</A>
<TD align=center>
  <A class=blocklinkbar HREF="posts.html">Blog</A>
<TD align=center>
  <A class=blocklinkbar HREF="about-python.html">Python</A>
<TD align=center>
  <A class=blocklinkbar HREF="formalbio.html">Author</A>
<TD align=center>
  <A class=blocklinkbar HREF="training.html">Training</A>
<TD align=center>
  <A class=blocklinkbar HREF="sitesearch.html">Search</A>
<TD align=center>
  <A class=blocklinkbar HREF="">Email</A>
<TD align=center>
  <A class=blocklinkbar HREF="#">Top</A>
<TD align=center>



<!--END INSERT========================================================================-->


[Home] Books Programs Blog Python Author Training Search Email ©M.Lutz