Popular recipes tagged "query" but not "yahoo"http://code.activestate.com/recipes/tags/query-yahoo/2013-09-13T06:34:08-07:00ActiveState Code Recipeseasy user input (Python) 2013-09-13T06:34:08-07:00yotahttp://code.activestate.com/recipes/users/4184815/http://code.activestate.com/recipes/578552-easy-user-input/ <p style="color: grey"> Python recipe 578552 by <a href="/recipes/users/4184815/">yota</a> (<a href="/recipes/tags/input/">input</a>, <a href="/recipes/tags/python3/">python3</a>, <a href="/recipes/tags/query/">query</a>, <a href="/recipes/tags/user/">user</a>). Revision 7. </p> <p>Improvement over <a href="http://code.activestate.com/recipes/577058/">Recipe 577058</a> and cie.</p> <p><code>easy_input()</code> function extends the built-in <code>input()</code> function. A question is prompted as well as some expected answers.</p> <p>The user input can be incomplete (ie. <code>y</code> or <code>ye</code> instead of <code>yes</code>)</p> <ul> <li>If no list of expected answer is provided, default will be "yes/no".</li> <li>If no default answer is provided, default will be the first expected answer.</li> </ul> <p>Try and see.</p> <p>Disclaimer: written in python3, meant for *nix shell, indented with tabs</p> <p><strong>Avoided caveat:</strong> If some expected <code>answer</code> have the same beginning, the user can not enter too few letters. Ex: <code>answer = ['continue', 'test', 'testicle']</code>, user can not input <code>t</code>, <code>te</code> or <code>tes</code> because it will be ambiguous. User can however input <code>test</code>, which is not.</p> dhcp query (Python) 2011-04-10T15:41:14-07:00hassanehttp://code.activestate.com/recipes/users/4177610/http://code.activestate.com/recipes/577649-dhcp-query/ <p style="color: grey"> Python recipe 577649 by <a href="/recipes/users/4177610/">hassane</a> (<a href="/recipes/tags/dhcp/">dhcp</a>, <a href="/recipes/tags/ipv4/">ipv4</a>, <a href="/recipes/tags/network/">network</a>, <a href="/recipes/tags/query/">query</a>, <a href="/recipes/tags/querying_dhcp_for_free_ip_address/">querying_dhcp_for_free_ip_address</a>). </p> <p>a simple python script that sends a dhcp discover packet and recieves the dhcp offer that contains a suggested ip address, gateway, dns servers and displays them.</p> Web based Query Browser (PHP) 2011-06-15T03:54:02-07:00Jonathan Fenechhttp://code.activestate.com/recipes/users/4169413/http://code.activestate.com/recipes/577753-web-based-query-browser/ <p style="color: grey"> PHP recipe 577753 by <a href="/recipes/users/4169413/">Jonathan Fenech</a> (<a href="/recipes/tags/based/">based</a>, <a href="/recipes/tags/browser/">browser</a>, <a href="/recipes/tags/php/">php</a>, <a href="/recipes/tags/query/">query</a>, <a href="/recipes/tags/web/">web</a>). </p> <p>Query browser works </p> <p>add password to this part of the code if you require a password for mysql</p> <p>Code =</p> <p>// Connect to the database $conn = mysql_connect('localhost', 'root' 'PASSWORD GOES HERE");</p> query yes/no (Python) 2010-03-09T17:57:28-08:00Trent Mickhttp://code.activestate.com/recipes/users/4173505/http://code.activestate.com/recipes/577058-query-yesno/ <p style="color: grey"> Python recipe 577058 by <a href="/recipes/users/4173505/">Trent Mick</a> (<a href="/recipes/tags/ask/">ask</a>, <a href="/recipes/tags/cli/">cli</a>, <a href="/recipes/tags/no/">no</a>, <a href="/recipes/tags/query/">query</a>, <a href="/recipes/tags/raw_input/">raw_input</a>, <a href="/recipes/tags/yes/">yes</a>). Revision 2. </p> <p>Ask the user a question using raw_input() and looking something like this:</p> <pre class="prettyprint"><code>QUESTION [Y/n] ...validate... </code></pre> <p>See also: <a href="http://code.activestate.com/recipes/577096/">Recipe 577096</a> (query custom answers), <a href="http://code.activestate.com/recipes/577097/">Recipe 577097</a> (query yes/no/quit), <a href="http://code.activestate.com/recipes/577098/">Recipe 577098</a> (query long), <a href="http://code.activestate.com/recipes/577099/">Recipe 577099</a> (query)</p> query yes/no/quit (Python) 2010-03-09T17:57:18-08:00Trent Mickhttp://code.activestate.com/recipes/users/4173505/http://code.activestate.com/recipes/577097-query-yesnoquit/ <p style="color: grey"> Python recipe 577097 by <a href="/recipes/users/4173505/">Trent Mick</a> (<a href="/recipes/tags/ask/">ask</a>, <a href="/recipes/tags/cli/">cli</a>, <a href="/recipes/tags/no/">no</a>, <a href="/recipes/tags/query/">query</a>, <a href="/recipes/tags/quit/">quit</a>, <a href="/recipes/tags/raw_input/">raw_input</a>, <a href="/recipes/tags/yes/">yes</a>). </p> <p>Ask the user a question using raw_input() and looking something like this:</p> <pre class="prettyprint"><code>QUESTION [Y/n/q] ...validate... </code></pre> <p>See also: <a href="http://code.activestate.com/recipes/577058/">Recipe 577058</a> (query yes/no), <a href="http://code.activestate.com/recipes/577096/">Recipe 577096</a> (query custom answers), <a href="http://code.activestate.com/recipes/577098/">Recipe 577098</a> (query long), <a href="http://code.activestate.com/recipes/577099/">Recipe 577099</a> (query)</p> command line query (Python) 2010-03-09T18:37:52-08:00Trent Mickhttp://code.activestate.com/recipes/users/4173505/http://code.activestate.com/recipes/577098-command-line-query/ <p style="color: grey"> Python recipe 577098 by <a href="/recipes/users/4173505/">Trent Mick</a> (<a href="/recipes/tags/ask/">ask</a>, <a href="/recipes/tags/cli/">cli</a>, <a href="/recipes/tags/query/">query</a>, <a href="/recipes/tags/raw_input/">raw_input</a>). Revision 3. </p> <p>Ask the user a question using raw_input() and looking something like this (<code>style=="compact"</code>):</p> <pre class="prettyprint"><code>QUESTION [DEFAULT]: _ ...validation... </code></pre> <p>or this (<code>style=="verbose"</code>):</p> <pre class="prettyprint"><code>QUESTION Hit &lt;Enter&gt; to use the default, DEFAULT. &gt; _ ...validate... </code></pre> <p>It supports some basic validation/normalization of the given answer.</p> <p>See also: <a href="http://code.activestate.com/recipes/577058/">Recipe 577058</a> (query yes/no), <a href="http://code.activestate.com/recipes/577097/">Recipe 577097</a> (query yes/no/quit), <a href="http://code.activestate.com/recipes/577096/">Recipe 577096</a> (query custom answers)</p> query custom answers (Python) 2010-03-09T17:57:22-08:00Trent Mickhttp://code.activestate.com/recipes/users/4173505/http://code.activestate.com/recipes/577096-query-custom-answers/ <p style="color: grey"> Python recipe 577096 by <a href="/recipes/users/4173505/">Trent Mick</a> (<a href="/recipes/tags/cli/">cli</a>, <a href="/recipes/tags/query/">query</a>). </p> <p>Ask the user a question using raw_input() and looking something like this:</p> <pre class="prettyprint"><code>Frob nots the zids? [Yes (default), No, quit] _ ...validate... </code></pre> <p>See also: <a href="http://code.activestate.com/recipes/577058/">Recipe 577058</a> (query yes/no), <a href="http://code.activestate.com/recipes/577097/">Recipe 577097</a> (query yes/no/quit), <a href="http://code.activestate.com/recipes/577098/">Recipe 577098</a> (query long), <a href="http://code.activestate.com/recipes/577099/">Recipe 577099</a> (query)</p> query (Python) 2010-03-09T18:34:05-08:00Trent Mickhttp://code.activestate.com/recipes/users/4173505/http://code.activestate.com/recipes/577099-query/ <p style="color: grey"> Python recipe 577099 by <a href="/recipes/users/4173505/">Trent Mick</a> (<a href="/recipes/tags/ask/">ask</a>, <a href="/recipes/tags/cli/">cli</a>, <a href="/recipes/tags/query/">query</a>, <a href="/recipes/tags/raw_input/">raw_input</a>). </p> <p>Ask/prompt the user for a short piece of data. <a href="http://code.activestate.com/recipes/577098/">Recipe 577098</a> is a much more generic/functional (but longer) take on this.</p>