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:



<!--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.
Browsers may guess correctly if omitted, but may also use US-ASCII or user settings.
<meta> is used for multiple goals (e.g., http-equiv="Refresh" content="10; URL=...). 
Caution: some files saved with Windows tools may be Latin-1 (windows-1252): see 
their HTML tags, and open/save with care in coding-explicit editors like PyEdit -
opening and saving as UTF-8 blindly may trash Latin-1 quotes, and other text.

Update Dec-2018: move the <meta> charset (Unicode encoding) declaration above the 
comment here, and the _META_ to the top of <head> if needed, so it's in the first 
1024 bytes of the file.  Else, Firefox issues a warning in its web console, and it 
(and perhaps others) must restart the page parse - a minor performance penalty.
The new form now shows up at byte 736, after _DOCTYPE_ and the standard <> opening.  

The 1024-bytes rule is per HTML5 standard, though other browsers do not complain, 
and all the nonconforming pages worked fine in all 20+ browsers tested.  Lots of 
files at this site have no <meta> charset declaration at all, which is also iffy 
on standards, but Firefox falls back on US-ASCII - as intended by these pages (and
Firefox is being too dogmatic: the web is hardly the place for standards police...).  

This was not an issue in thumbspage result pages, app user guides, showcode response
pages, or unzipped programs' Apache index pages.  It may also be possible to give 
charset (encoding) in an HTTP response instead of <meta> tags, but this site still
has some non-UTF-8 pages, and has limited server control.

<!--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 in the root folder suffices on some (but not all) web servers.

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


<!--GENHTML INSERT========================================================-->
Nov-15: CSS file, code in <HEAD>, for fonts, borders, navbars, etc.
Could also be an in-page <STYLE> sheet, as genhtml pastes any text.

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

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


<!--GENHTML INSERT==================================================================-->
7/6/14: JS analytics code in <HEAD>, to isolate high-traffic pages, iff JS enabled. 
Former training sites's id: ga('create', 'UA-52578333-1', 'auto').
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.

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

  ga('create', 'UA-52579036-1', 'auto');
  ga('send', 'pageview');



/* 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 here:

<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 read 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.  

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>





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