Hi
I have a number of battery powered temperature sensors. I would like to reduce battery consumption. I see the constant that controls time between reads:-
const int time_between_readings= 20000;
How high can I take the constant and is there a point where increasing it is unlikely to help extend battery life.
Regards
Ian
Re: How can I reduce battery consumption on emontx
I've no idea about that, but take a look over at JeeLabs. I'm pretty sure I've read quite a bit there about battery-saving techniques, though I can't remember now how applicable they might be. You'll probably need to use a number of different approaches.
Re: How can I reduce battery consumption on emontx
Ian,
You may have to change the 'int' to a 'long' or 'unsigned long' to use some larger figures.
Re: How can I reduce battery consumption on emontx
Hi Ian,
I did a lot for reducing powerusage on my jeeheater project (a datalogger for centralheating system) you can find the sourcecode at: https://github.com/alco28/JeeHeat_monitor
I used two solutions: 1) disable the use of the ADAC reference module when you don't need it:
bitClear(PRR, PRADC); // power up the ADC
ADCSRA |= bit(ADEN); // enable the ADC
delay(10); // stabilize the voltage
ADCSRA &= ~ bit(ADEN); // disable the ADC
bitSet(PRR, PRADC); // power down the ADC
2) Use sleepfunctions for the RFM12B radiomodule. (from jeelabs lib).
and I also use and scheduler so I don't loop the whole sketch with the upload part to EmonCMS.
Re: How can I reduce battery consumption on emontx
Here is one more excellent article by Nick Gammon:
http://www.gammon.com.au/forum/?id=11497
Re: How can I reduce battery consumption on emontx
Many thanks for all the replies. Very helpful.
Regards
Ian


Search results
From Wikipedia, the free encyclopedia
You searched for 1600 Pennsylvania Ave NW, Washington, DC, 20502 (all pages starting with "1600 Pennsylvania Ave NW, Washington, DC, 20502" | all pages that link to "1600 Pennsylvania Ave NW, Washington, DC, 20502")
To view this page without search results but with all search options, use Special:Search.
For more information about searching Wikipedia, see Wikipedia:Searching.
Note that most free images and other media used at Wikipedia are stored at Wikimedia Commons, which must be searched separately.
No page text matches
Note: unsuccessful searches are often caused by searching for common words that are not indexed. Because these are very common words you will almost certainly receive better results by adding other words to narrow down the general area of interest. Is it about art, poetry, sculpture or physics? If it is, add one of those words or whatever is applicable to your own search as well as adding in other words that are likely to be used. Try to avoid searches containing only words in quotes. Those are slow.


|
com.levibostian.teller.type.Age |
Custom response class to represent a length of time. This is created because Duration is Java 8 only (requires API 26 on Android). I also did not want to bring in a library for this one very small need so I decided to create my own thing.
|
|
com.levibostian.teller.repository.GetCacheRequirementsTag |
|
|
com.levibostian.teller.cachestate.LocalCacheState |
Local response (response obtained from the user or device, no network fetch call) in apps are in 1 of 2 different types of state:
|
|
com.levibostian.teller.cachestate.listener.LocalCacheStateListener |
|
|
com.levibostian.teller.testing.cachestate.LocalCacheStateTesting |
Convenient utility to generate instances of LocalCacheState used for testing purposes.
|
|
com.levibostian.teller.repository.LocalRepository |
Teller repository that manages cache that is obtained and stored on the local device.
|
|
com.levibostian.teller.cachestate.OnlineCacheState |
Holds the current state of response that is obtained via a network call. This response structure is meant to be passed out of Teller and to the application using Teller so it can parse it and display the response representation in the app.
The online response state is not manipulated here. It is only stored.
Data in apps are in 1 of 3 different types of state:
|
|
com.levibostian.teller.cachestate.listener.OnlineCacheStateCacheListener |
|
|
com.levibostian.teller.cachestate.listener.OnlineCacheStateFetchingListener |
|
|
com.levibostian.teller.cachestate.listener.OnlineCacheStateListener |
|
|
com.levibostian.teller.cachestate.listener.OnlineCacheStateNoCacheStateListener |
|
|
com.levibostian.teller.testing.cachestate.OnlineCacheStateTesting |
Convenient utility to generate instances of OnlineCacheState used for testing purposes.
|
|
com.levibostian.teller.testing.cachestate.OnlineCacheStateTestingDsl |
Defining scope for OnlineCacheStateTesting DSL.
|
|
com.levibostian.teller.repository.OnlineRepository |
Teller repository that manages a cache that is obtained from a network fetch request.
|
|
com.levibostian.teller.repository.OnlineRepositoryCache |
|
|
com.levibostian.teller.repository.OnlineRepositoryFetchResponse |
|
|
com.levibostian.teller.testing.repository.OnlineRepositoryRefreshResultTesting |
Convenient utility to generate instances of OnlineRepository.RefreshResult used for testing purposes.
|
|
com.levibostian.teller.testing.repository.OnlineRepositoryTesting |
Used for testing purposes to initialize the state of a OnlineRepository subclass instance.
|
|
com.levibostian.teller.testing.repository.OnlineRepositoryTestingDsl |
Defining scope for OnlineRepositoryTesting DSL.
|
|
com.levibostian.teller.error.ServerNotAvailableException |
|
|
com.levibostian.teller.Teller |
|
|
com.levibostian.teller.error.UnknownHttpResponseError |
|
|
com.levibostian.teller.error.UserNotFoundException |
|


| [ Team LiB ] |
Chapter 14. Threads and ProcessesA thread is a flow of control that shares global state with other threads; all threads appear to execute simultaneously. Threads are not easy to master, but once you do, they may offer a simpler architecture or better performance (faster response, but typically not better throughput) for some problems. This chapter covers the facilities that Python provides for dealing with threads, including the thread, threading, and Queue modules. A process is an instance of a running program. Sometimes you get better results with multiple processes than with threads. The operating system protects processes from one another. Processes that want to communicate must explicitly arrange to do so, via local inter-process communication (IPC). Processes may communicate via files (covered in Chapter 10) or via databases (covered in Chapter 11). In both cases, the general way in which processes communicate using such data storage mechanisms is that one process can write data, and another process can later read that data back. This chapter covers the process-related parts of module os, including simple IPC by means of pipes, and a cross-platform IPC mechanism known as memory-mapped files, supplied to Python programs by module mmap. Network mechanisms are well suited for IPC, as they work between processes that run on different nodes of a network as well as those that run on the same node. Chapter 19 covers low-level network mechanisms that provide a flexible basis for IPC. Other, higher-level mechanisms, known as distributed computing, such as CORBA, DCOM/COM+, EJB, SOAP, XML-RPC, and .NET, make IPC easier, whether locally or remotely. However, distributed computing is not covered in this book. |
| [ Team LiB ] |


Quick RSVP
To RSVP for our first meeting on Sept. 22, use our MeetUp site or send an email to<EMAIL_ADDRESS>What is it?
A regular meetup for civic-minded individuals to present / discuss open data. We won’t be studying books: we’ll study data sets. Check out this site for more information.
We aim to include engaged citizens, government actors (the blue shirts!), map geeks, librarians, software nerds, statisticans – anyone who is interested in Open Data and its potential on PEI.
Why PEI?
Inspired by a lightning talk at CODS15, some members of PEI Developers would like to join Ottawa, Montreal, and Toronto with a similar venture. (Based on the strong turn-out for our August warm-up, many others are interested.)
As with PEI Developers, this is a volunteer, non-partisan initiative. We’re open and inclusive.
When
Our first meeting is September 22, 2015, featuring:
Peter Rukavina,
Visiting Scholar (Hacker in Residence),
Robertson Library, University of Prince Edward Island
Everyone welcome: the audience is not just software developers!
Just RSVP via MeetUp or send an email to peidevs@gmail.com


Introduction "File" Freqentry Asked Questions Bibliography Credit
Click here to download the latest version of Photo Operator.


| DOSE: |
1 capsl |
oral |
MDMA |
(capsule) |
This summer, at a festival called 'camp creek' in Maryahville, New York, I encountered an experience with ecstasy that was unlike any other trip I had experienced before it.  I was told it was the purest roll I would ever eat. It turned out to be the most intense and unforgettable drug experience I think I may have ever had. The nickname of the cut was 'crystal shards' or 'molly' which is short for molecule. Pure MDMA. I think I must have been on the up for about eight hours altogether. I remember being completely awestruck by the intense beauty that I saw all around me. First I stumbled upon a spontaneous mini-rave out in the camping grounds, with four-six DJ's hooked up to a generator and people dancing everywhere. It was (obviously) completely free and it went on till the sun came up.
I met a boy that night, which I later discovered just happened to be exactly two days older than myself, and it felt like the first time falling in love all over again. We spent the next several weeks together, simply because we had had such a blast when we met. I know this is nothing new. Everyone is your best friend when you're rolling, but this was not the only seemingly fateful coincidence that happened that night. And on top of that, I am generally a shy person, even when bursting with waves of serotonin, but this night I felt like a child again. There was no edge to this roll. No teeth clenching, no feeling of wanting to do everything and go everywhere, but not being able to move a muscle (not even your brain) - I really could have gone anywhere in the world, or beyond, and flew there with wings to boot.
And finally, unlike most pressed pills, when I woke up in the morning, expecting to feel like I got beat up and my dog died, I crawled out of the tent into the sunshine and I felt as though I was new and whole. It felt so surprisingly good that I was suspicious at first. Then I knew that this pill really was pure. Amazingly so.
This was about 4 or 5 months ago. I haven't eaten a single pressed pill, and I've been looking for my friend molly ever since. Anybody seen her? I think she ran away with my childhood fantasies to the faerie realm…
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


ENDRATE- edetate disodium, anhydrous injection, solution
WARNING
The use of this drug in any particular patient is recommended only when the severity of the clinical condition justifies the aggressive measures associated with this type of therapy.
Endrate (Edetate Disodium Injection, USP) is a sterile, nonpyrogenic, concentrated solution of edetate disodium in water for injection which as a result of a pH adjustment with sodium hydroxide contains varying amounts of disodium and trisodium salts. After dilution, it is administered by intravenous infusion.
Each mL contains edetate disodium, anhydrous 150 mg. May contain sodium hydroxide for pH adjustment. pH is 7.0 (6.5 to 7.5).
Edetate disodium is classified as a clinical chelating agent for emergency lowering of serum calcium in hypercalcemia.
The solution contains no bacteriostat, antimicrobial agent or buffer (except for pH adjustment) and is intended only for use (after dilution) as a single-dose infusion. When smaller doses are required, the unused portion should be discarded.
Edetate Disodium, USP is chemically designated disodium (ethylenedinitrilo) tetraacetate dihydrate, a white crystalline powder soluble in water. It is also described as the disodium salt of ethylenediamine tetraacetic acid (EDTA) and has the following structural formula:
Edetate Disodium Injection, USP forms chelates with the cations of calcium and many divalent and trivalent metals. Because of its affinity for calcium, edetate disodium will produce a lowering of the serum calcium level during intravenous infusion. Slow infusion over a protracted period may cause mobilization of extracirculatory calcium stores. Edetate disodiumexerts a negative inotropic effect upon the heart.
After intravenous administration, the chelate formed is excreted in the urine with 50% appearing in 1 hour and over 95% in 24 hours.
Edetate disodium likewise forms chelates with other polyvalent metals and produces increases in urinary excretion of magnesium, zinc and other trace elements. It does not form a chelate with potassium but may reduce the serum level and increase urinary loss of potassium.
Endrate (Edetate Disodium Injection, USP) is indicated in selected patients for the emergency treatment of hypercalcemia and for the control of ventricular arrhythmias associated with digitalis toxicity.
Endrate (Edetate Disodium Injection, USP) is contraindicated in anuric patients. It is not indicated for the treatment of generalized arteriosclerosis associated with advancing age.
See warning statement, page 1.
Rapid intravenous infusion or attainment of high serum concentration of edetate disodium may cause a precipitous drop in the serum calcium level and many result in fatality. Toxicity appears to be dependent upon both total dosage and speed of administration. The rate of administration and dosage should not exceed that indicated in DOSAGE AND ADMINISTRATION.
Because of its irritant effect on the tissues and because of the danger of serious side effects if administered in the undiluted form, Endrate (Edetate Disodium Injection, USP) should be diluted before infusion. See DOSAGE AND ADMINISTRATION.
After the infusion of edetate disodium, the patient should remain in bed for a short time because of the possibility of postural hypotension.
The possibility of an adverse effect on myocardial contractility should be considered when administering the drug to patients with heart disease. Caution is dictated in the use of this drug in patients with limited cardiac reserve or incipient congestive failure.
Edetate Disodium Injection, USP therapy should be used with caution in patients with clinical or subclinical potassium deficiency states. In such cases it is advisable to perform serum potassium blood levels for possible hypokalemia and to monitor ECG changes.
The possibility of hypomagnesemia should be kept in mind during prolonged therapy.
Treatment with edetate disodium has been shown to cause a lowering of blood sugar and insulin requirements in patients with diabetes who are treated with insulin.
Do not use unless solution is clear and container is intact. Discard unused portion.
Renal excretory function should be assessed prior to treatment. Periodic BUN and creatinine determinations and daily urinalysis should be performed on patients receiving this drug.
Because of the possibility of inducing an electrolyte imbalance during treatment with edetate disodium, appropriate laboratory determinations and studies to evaluate the status of cardiac function should be performed. Repetition of these tests is recommended as often as clinically indicated, particularly in patients with ventricular arrhythmia and those with a history of seizure disorders or intracranial lesions. If clinical evidence suggests any disturbance of liver function during treatment, appropriate laboratory determinations should be performed and withdrawal of the drug may be required.
The oxalate method of determining serum calcium tends to give low readings in the presence of edetate disodium; modification of this method, as by acidifying the sample or use of a different method may be required for accuracy. The least interference will be noted immediately before a subsequent dose is administered.
Definitive statements cannot be made due to insufficient data and conflicting information.
Animal reproduction studies have not been conducted with Edetate Disodium Injection. It is also not known whether Edetate Disodium Injection can cause fetal harm when administered to a pregnant woman or can affect reproduction capacity. Edetate Disodium Injection should be given to a pregnant woman only if clearly needed.
Clinical studies of Endrate® did not include sufficient numbers of patients aged 65 and over to determine whether they respond differently from younger subjects. Other reported clinical experience has not identified differences in responses between elderly and younger patients. In general, dose selection for an elderly patient should be cautious, reflecting the greater frequency of decreased hepatic, renal, or cardiac function, and of concomitant disease or other drug therapy.
This drug is known to be substantially excreted by the kidney, and the risk of toxic reactions to this drug may be greater in patients with impaired renal function. Because elderly patients are more likely to have decreased renal function, care should be taken in dose selection, and it may be useful to monitor renal function.
Gastrointestinal symptoms such as nausea, vomiting and diarrhea are fairly common following administration of this drug. Transient symptoms such as circumoral paresthesia, numbness and headache and a transient drop in systolic and diastolic blood pressure may occur. Thrombophlebitis, febrile reactions, hyperuricemia, anemia, exfoliative dermatitis and other toxic skin and mucous membrane reactions have been reported.
Nephrotoxicity and damage to the reticuloendothelial system with hemorrhagic tendencies have been reported with excessive dosages.
Because of the possibility that Edetate Disodium Injection, USP may produce a precipitous drop in the serum calcium level, a source of calcium replacement suitable for intravenous administration (such as calcium gluconate) should be instantly available at the bedside before edetate disodium is administered. Extreme caution is dictated in the use of intravenous calcium in the treatment of tetany, especially in digitalized patients because the action of the drug and the replacement of calcium ions may produce a reversal of the desired digitalis effect.
Edetate Disodium Injection, USP is administered by intravenous infusion only after dilution.
For Adults: The recommended daily dosage is 50 mg/kg of body weight to a maximum dose of 3 g in 24 hours. The dose, calculated by body weight, should be diluted in 500 mL of 5% Dextrose Injection, USP or 0.9% Sodium Chloride Injection, USP. The intravenous infusion should be regulated so that three or more hours are required for completion and the cardiac reserve of the patient is not exceeded. A suggested regimen includes five consecutive daily doses followed by two days without medication, with repeated courses as necessary to a total of 15 doses.
Parenteral drug products should be inspected visually for particulate matter and discoloration prior to administration, whenever solution and container permit. See PRECAUTIONS.
Drug Interactions
Additives may be incompatible with the reconstituted (diluted) solution required for intravenous infusion. Consult with pharmacist, if available. When introducing additives, use aseptic technique, mix thoroughly and do not store.
|
ENDRATE
edetate disodium, anhydrous injection, solution | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
| |||||||||||||||||||||||||
| |||||||||||||||||||||||||
| |||||||||||||||||||||||||


FB Hunter
Find people on Facebook
Liked
Member of
Follower of
Current job
Past job
Work at
Lives in
Lived in
X
AND
OR
Save query
Search Facebook
Export results
Saved queries


{% extends "record/base.html" %} {% block title %}Health Stack | Files{% endblock %} {% block content %}
No files! Create your folder, then click on the upload button at the top of this page to upload files


pam_console
Section: System Administrator's Manual (8)Updated: 2005/10/4
Index Return to Main Contents
NAME
pam_console - determine user owning the system consoleSYNOPSIS
session optional pam_console.soauth required pam_console.so
DESCRIPTION
pam_console.so is designed to give users at the physical console (virtual terminals and local xdm-managed X sessions by default, but that is configurable) capabilities that they would not otherwise have, and to take those capabilities away when the are no longer logged in at the console. It provides two main kinds of capabilities: file permissions and authentication.When a user logs in at the console and no other user is currently logged in at the console, pam_console.so will run handler programs specified in the file /etc/security/console.handlers such as pam_console_apply which changes permissions and ownership of files as described in the file /etc/security/console.perms. That user may then log in on other terminals that are considered part of the console, and as long as the user is still logged in at any one of those terminals, that user will own those devices. When the user logs out of the last terminal, the console may be taken by the next user to log in. Other users who have logged in at the console during the time that the first user was logged in will not be given ownership of the devices unless they log in on one of the terminals; having done so on any one terminal, the next user will own those devices until he or she has logged out of every terminal that is part of the physical console. Then the race can start for the next user. In practice, this is not a problem; the physical console is not generally in use by many people at the same time, and pam_console.so just tries to do the right thing in weird cases.
When an application attempts to authenticate the user and this user is already logged in at the console, pam_console.so checks whether there is a file in /etc/security/console.apps/ directory with the same name as the application servicename, and if such a file exists, authentication succeeds. This way pam_console may be utilized to run some system applications (reboots, config tools) without root password, or to enter user password on the first system login only.
ARGUMENTS
- debug
- turns on debugging
- allow_nonroot_tty
- gain console locks and change permissions even if the TTY's owner is not root.
- handlersfile=filename
- tells pam_console.so to get the list of the handlers from a different file than /etc/security/console.handlers
EXAMPLE
/etc/pam.d/some-system-tool:auth sufficient pam_rootok.so
auth required pam_console.so
/etc/pam.d/some-login-service:
auth sufficient pam_console.so
auth required pam_unix.so
session required pam_unix.so
session optional pam_console.so
FILES
/var/run/console//var/run/console/console.lock
/etc/security/console.apps
/etc/security/console.handlers
SECURITY NOTES
When pam_console "auth" is used for login services which provide possibility of remote login, it is necessary to make sure the application correctly sets PAM_RHOST variable, or to deny remote logins completely. Currently, /bin/login (invoked from telnetd) and gdm is OK, others may be not.SEE ALSO
console.perms(5)console.apps(5)
console.handlers(5)
pam_console_apply(8)
/usr/share/doc/pam*/html/index.html
BUGS
Let's hope not, but if you find any, please report them via the "Bug Track" link at http://bugzilla.redhat.com/bugzilla/AUTHORS
Michael K. Johnson<EMAIL_ADDRESS>of console.handlers and other improvements by Tomas Mraz<EMAIL_ADDRESS>Index
This document was created by man2html, using the manual pages.
Time: 05:34:28 GMT, December 24, 2015


The Jetson Nano can be used with the Mynt Eye in the same way you would use the Mynt Eye with a computer,
except that based on
benchmarks
Comparison of Phoronix Test Suite results from my laptop (i7-3630QM, Nvidia GT 650M, 15.6 GB DDR3L, 250 GB SSD) and the Jetson Nano. Results ranged from 1.6x faster to 21.5x faster, depending on the task.
the Jetson Nano is ~5x slower than an old laptop computer, depending on the task. The Jetson Nano is also
limited by its 4GB of RAM, but should be sufficient for use with the turtlebots. If you get to the point
where the Jetson Nano has inadequate processing power, Nvida sells more powerful systems in the
Jetson
family of products, and there are a variety of options from other manufacturers.


Just drap and drop events from there directly into the calendar.
Just enter event name to create a new one
{{ event.start }}
{{ event.end }}
{{ event.description }}


Horizontal bar graph with CSS3 and jQuery
0%
Please change a value and hit the enter key.
More script and css style :
www.htmldrive.net


This library provides pressure loss factors of a pipe segment (orifice, bending etc.) with a minimum amount of data. If available, data can be provided for both flow directions, i.e., flow from port_a to port_b and from port_b to port_a, as well as for the laminar and the turbulent region. It is also an option to provide the loss factor only for the turbulent region for a flow from port_a to port_b. Basically, the pressure drop is defined by the following equation:
Δp = 0.5*ζ*ρ*v*|v| = 0.5*ζ/A^2 * (1/ρ) * m_flow*|m_flow| = 8*ζ/(π^2*D^4*ρ) * m_flow*|m_flow|
where
| Name | Description |
|---|---|
| LossFactorData | Data structure defining constant loss factor data for dp = zeta*rho*v*|v|/2 and functions providing the data for some loss types |
| massFlowRate_dp | Return mass flow rate from constant loss factor data and pressure drop (m_flow = f(dp)) |
| massFlowRate_dp_and_Re | Return mass flow rate from constant loss factor data, pressure drop and Re (m_flow = f(dp)) |
| pressureLoss_m_flow | Return pressure drop from constant loss factor and mass flow rate (dp = f(m_flow)) |
| pressureLoss_m_flow_and_Re | Return pressure drop from constant loss factor, mass flow rate and Re (dp = f(m_flow)) |
| BaseModel | Generic pressure drop component with constant turbulent loss factor data and without an icon |
| TestWallFriction | Pressure drop in pipe due to wall friction (only for test purposes; if needed use Pipes.StaticPipe instead) |
| BaseModelNonconstantCrossSectionArea | Generic pressure drop component with constant turbulent loss factor data and without an icon, for non-constant cross section area |
| pressureLoss_m_flow_totalPressure | Return pressure drop from constant loss factor and mass flow rate (dp = f(m_flow)) |


Loading...
H
Keys
handleEvents
Core
Hash
Keys
health_decrease
types.h
healthText
Worm
height
Object::height()
Video::Height()
Held
KeyState::Held()
ButtonState::Held()
Help
Keys
help_window
types.h
Home
Keys
HORIZONTALBOUNDRY
camera.h
Searching...
No Matches


This implementation of the C++ Standard Library conforms to ISO/IEC 14882:2003 -- International Standard for Information Systems -- Programming Language C++. This release is source compatible with previous 2.x implementations.
1.x implementations of the library were based on ANSI's Working Paper for Draft Proposed International Standard for Information Systems -- Programming Language C++. The draft standard differs from the final standard in some areas. As a result, source written to 1.x implementations of the library will be incompatible with this implementation in these areas. See the readme file for details.
Please note that some compiler and library vendors have not yet implemented the whole range of language features defined by the ANSI/ISO standard.
NOTE -- The C++ Standard Library is not yet fully implemented by all compilers. You may experience difficulty if you attempt to use features of the library that are unsupported by your compiler.
In the User's Guide, we draw your attention to places in the code where this might be a problem. If your vendor is still in the process of meeting the standard, some of the techniques demonstrated in this User's Guide may not work. We include them anyway to demonstrate the full range of capabilities of the standard C++ language. Compilers will catch up, and this guide will be more useful to you if it is as complete as possible.
Everything in the Apache C++ Standard Library is contained in the std namespace. You must specify a using directive or explicitly scope any name from the library.
To use the vector class, for example, you could include one of the following using directives:
using namespace std; // Brings all names from std // into current scope. using std::vector; // Brings vector into // current scope.
or explicitly scope vector whenever it is used:
std::vector<int> v;
NOTE -- To enhance this manual's readability, namespace scoping is usually omitted in the text. You should assume that everything in the Apache C++ Standard Library is scoped in namespace std unless otherwise stated.


{% extends "layout.html" %} {% block title %} Hanabi Contests {% endblock title %} {% block layout-content %} {% if player %}
On hanab.live, you are registered as {{ player.hanab_username }}.
Start table
Table password: {{ table_password }}
No contests are active at this time.
{% endfor %}| # | Contest | Status | #P | Deadline | {% for contest in contests %}||||||
|---|---|---|---|---|---|---|---|---|---|---|
| {{ contest.pk }} | {% if contest.processed %}{{ contest.variant_name }} | Completed | {% elif not contest.has_ended %}{{ contest.variant_name }} | Ongoing | {% elif request.user.is_superuser %}{{ contest.variant_name }} | Pending | {% else %}{{ contest.variant_name }} | Pending | {% endif %}{{ contest.num_players }}p | {% if contest.processed or request.user.is_superuser %} {{ contest.end_date }} {% else %} {{ contest.end_date }} {% endif %} |
If you're new to the game Hanabi, you can read the rules on Wikipedia or watch a YouTube video, etc. (This is a popular game, so searches will turn up other results.)
Hanabi is a cooperative team game, so to do well, you'll need to discuss strategies beforehand with your team. Evan uses a strategy system called the H-group conventions, which you can read about on Evan's intro guide or from the comprehensive hanabi.github.io. Of course, you can find or invent your own conventions too.
This section details specifically how OTIS-run Hanabi tournaments work (rather than the rules of Hanabi the game itself).


public interface GfycatPlayer
| Modifier and Type | Method and Description |
|---|---|
android.view.View |
getView()
Returns view that represents this player.
|
void |
pause()
Pause animation playback.
|
void |
play()
Start animation playback.
|
void |
release()
You MUST call this method when @{link
GfycatPlayer is no longer needed in order to release resources and avoid memory leak. |
void |
setOnStartAnimationListener(java.lang.Runnable onStartAnimationListener)
Set callback that would be invoked on first animation start.
|
void |
setScaleType(android.widget.ImageView.ScaleType scaleType)
Set scale type, see #ImageView.ScaleType
|
void |
setShouldLoadPreview(boolean shouldLoadPreview)
If set to true preview image will be loaded and displayed while larger animated file is being loaded.
|
void |
setupGfycat(Gfycat gfycat) |
void |
setupGfycat(Gfycat gfycat,
ContextDetails contextDetails) |
void |
setupPreview(android.graphics.drawable.Drawable drawable,
boolean animate)
Set preview manually by calling this method.
|
void setShouldLoadPreview(boolean shouldLoadPreview)
Default value is false.
IMPORTANT: Call this method before setupGfycat(Gfycat)
, otherwise preview image will not be loaded.
Note:
Use FrameSequenceView#setupPreview(Drawable, boolean)
instead if you need to display your own preview.
You can also download preview image manually and set it as a preview with FrameSequenceView#setupPreview(Drawable, boolean)
if you already have one, or there are other needs.
void setupPreview(android.graphics.drawable.Drawable drawable, boolean animate)
Note: If setShouldLoadPreview(boolean)
is set to true then preview image will be replaced by the one loaded from FrameSequenceSource#loadPoster()
.
drawable
- to use as preview, until actual animation will be loaded is being loaded.animate
- set to true if transition animation needed.void setupGfycat(Gfycat gfycat, ContextDetails contextDetails)
gfycat
- contextDetails
- void setupGfycat(Gfycat gfycat)
void play()
void pause()
void setScaleType(android.widget.ImageView.ScaleType scaleType)
void release()
GfycatPlayer
is no longer needed in order to release resources and avoid memory leak.
Note: We are working on automatic resource release encapsulation. This method will be marked as Deprecated when done.
void setOnStartAnimationListener(java.lang.Runnable onStartAnimationListener)
android.view.View getView()


-
The Victim, The Comforter, The Guy’s Girl…
medium.com
There’s only room for certain kinds of women in the tech world.
-
On a Shoestring, India Sends Orbiter to Mars on Its First Try
www.nytimes.com
A spacecraft nicknamed MOM successfully reached Mars orbit Wednesday, making India the first nation to accomplish the feat on a maiden voyage.
-
Windows 9? Microsoft Might Just Call it Windows
www.pcmag.com
Microsoft is reportedly planning to announce a new name for its OS at a press event next week.
-
Think you drink a lot? This chart will tell you.
www.washingtonpost.com
The top 10 percent of American drinkers consume more than 10 drinks per day.
-
Apple’s IPhone Software Snafu Has Links to Flawed Maps - Bloomberg
www.bloomberg.com
Apple’s IPhone Software Snafu Has Links to Flawed Maps
-
Images Of Nature Reclaiming The Land From Human Civilization
www.neatorama.com
Try as we might humanity cannot take over the natural world for long- eventually nature fights back, and for the most part wins, despite our ...
-
Managing a Nightmare: The CIA Reveals How It Watched Over the Destruction ...
firstlook.org
Freshly-released CIA documents show how the largest newspapers in the country helped the agency contain a groundbreaking exposé of cocaine ...
-
Inside the building where Apple tortures the iPhone 6
www.theverge.com
A few blocks away from Apple's bustling campus in Cupertino is a rather nondescript building. Inside is absolutely the last place on earth you'd want ...
-
Why India's Mars mission is so cheap - and thrilling
www.bbc.com
India's Mangalyaan satellite is staggeringly cheap by Western standards - but it hopes to address some of the biggest questions on Mars, writes the ...
-
Top Chefs, Grocers Choose Farmed Salmon
online.wsj.com
Farmed salmon is becoming more popular among top chefs and high end grocers as the industry adjusts to environmental concerns.
-
NASA Rover Drill Pulls First Taste From Mars Mountain - NASA Jet ...
www.jpl.nasa.gov
The robotic arm of NASA's Curiosity rover is holding the rover's first sample of rock powder drilled from the base of Mount Sharp on Mars.
-
Dr. Dre: $620 million - In Photos: Hip-Hop Cash Kings 2014
www.forbes.com
Thanks to Apple's Beats buyout, Dre had the highest yearly earnings total of any musician ever evaluated by FORBES. The $620 million sum is also more ...
-
Drug addict gives baby crystal meth to stop him crying
www.mirror.co.uk
Miroslav Strnadova, 30, and his wife Silvia, 26, were arrested after taking the injured four month-old tot to hospital
-
Light Bulbs Get Smarter, but Not Easier
online.wsj.com
Wi-Fi enabled 'smartbulbs' do more, but they can't beat the wall switch for ease of use.
-
This Flapping Device Makes Electricity From Wind Rushing Past Your Car
gizmodo.com
As far as car accessories go, we have to admit this one looks pretty silly. But the Samsung scientists who made it could also be onto something. The ...
-
California Lawsuit Says Starbucks, Dunkin' Donuts Should Add Cancer ...
www.fastcompany.com
The group, Council for Education and Research on Toxins, claims that big-chain coffee contains a carcinogen called acrylamide.
-
Including female animals in scientific studies really pays off
www.theverge.com
Pretty much any animal medical researchers test is male. So too are the tissues they use to conduct tests. Despite the loads of research ...
-
The glaringly obvious guide to the next crash - FT.com
www.ft.com
Hindsight is a wonderful thing, especially when it comes to explaining market crashes. Six times in the past 50 years US equities dropped more than ...
-
‘Hunger Games’ Success Masks Stubborn Gender Gap in Film
www.bloomberg.com
Katniss Everdeen and Bella Swan have done little to close Hollywood’s gender gap.
-
Samsung is teaming with PayPal for mobile payments on a watch
gigaom.com
The next generation of Samsung smartwatches could have a fingerprint sensor to be used for mobile payments via PayPal. Both will have to fight back ...
-
Section 2: The Religious Landscape of the 2014 Elections
www.pewforum.org
Numbers, Facts and Trends Shaping Your World
-
Alibaba Is Already Bigger Than Facebook, Amazon, and IBM | WIRED
www.wired.com
Unlike any of this country's biggest tech companies, Alibaba has mastered the Chinese economy. And it's more likely to achieve the same results ...
-
A Hybrid Bicycle Built for the Changing Needs of City Dwellers - Design ...
design-milk.com
The ultimate hybrid utility bicycle built to satisfy the diverse needs of a city dweller complete with a modular accessory platform that adapts as ...
-
First iPhone 6 Owner Immediately Drops It - The Poke
www.thepoke.co.uk
The first proud owner of the iPhone 6 in Perth in Australia sent his new purchase crashing to the floor the moment it was out of the box. Related: Ne
-
Techmeme
www.techmeme.com
The essential tech news of the moment. Technology's news site of record. Not for dummies.
-
Alibaba IPO bulls are missing some red flags - MarketWatch
www.marketwatch.com
The ecommerce giant’s odd corporate structure that could create headaches for investors down the road.
-
Alibaba slips below $90 a share, but still up sharply
www.cnbc.com
Alibaba shares traded as high as $99.70 in its market debut, a gain of nearly 50% above its IPO price, before paring gains.


Electron Bookmarks MAS Sandbox
Test Path
Actions
With Bookmarks
Without Bookmarks
showOpenDialog
open (window)
app-scoped
doc-scoped
open (window)
open
showSaveDialog
open (window)
app-scoped
doc-scoped
open (window)
open
read permissions
test
test
write permissions
test
test
Other actions
init
inititalise bookmarks
list
list bookmarks
delete
deleteOne
deleteAll


|
|||||
|
Fall
Start with you: Make lists of your abilities, social/cultural preferences, and personal qualities. List things you may want to study and do in college. Learn about colleges. Look at their Web sites (www.collegeboard.com has links). Talk to friends, family, teachers, and recent grads of your school now in college. List college features that interest you. Resource check: Visit the counseling office and meet the counselors there. Is there a college night for students and families? When will college representatives visit your school? (Put the dates in your calendar) Examine catalogs and guides. At school, sign up early to take the PSAT/NMSQT®, which is given in October. If you plan to ask for testing accommodations (because of a disability), be sure your eligibility is approved by the College Board. Check with your school counselor. Make a file to manage your college search, testing, and application data. If appropriate (for example, if you’re interested in drama, music, art, sports, etc.), start to gather material for a portfolio. With your family, start to learn about financial aid. Read the Department of Education’s Funding Your Education (about federal aid programs). Use Getting Financial Aid published by the College Board and the financial aid calculator at www.collegeboard.com to estimate how much aid you might receive. Winter Make a family appointment with your counselor to discuss ways to improve your college- preparation and selection processes. Sign up to take the SAT® and/or ACT at least once in the spring and again next fall. Register online or through your school. Fee waivers are available for students with financial need. To prepare, download practice booklets from www.collegeboard.com (for the SAT) or from www.act.org (for ACT). Begin a search for financial aid sources. National sources include the College Board Scholarship Handbook and electronic sources. Don’t overlook local and state aid sources (ask a counselor or check your public library). Ask a counselor or teacher about taking the SAT Subject Tests” in the spring. You should take them while course material is still fresh in your mind. You can download “Taking the SAT Subject Tests;’ which offers test-prep advice, from www.collegeboard.com. If you’re in Advanced Placement Program® (AP®) classes, register for AP Exams, given in May. You can earn college credit for courses not given in the AP Program by taking CLEP® tests at a college test center See www.collegeboard.com to learn more. Spring Visit some local colleges—large, small, public, and private. Get a feel for what works for you. Attend college fairs, too. Scan local newspapers to see which civic, cultural, and service organizations in your area award financial aid to graduating seniors. Start a file. Develop a list of 15 or 20 colleges that attract you. Request viewbooks and information about financial aid and academic programs that interest you. Visit some colleges over your, spring break. If you are considering military academies or ROTC scholarships, contact your counselor before leaving school for the summer. If you want a four-year ROTC scholarship, you should begin the application process the summer before your senior year. Summer If you are an athlete planning to continue playing a sport in college, register with the NCAA Clearinghouse (www.ncaaclearinghouse.net). Find a full-time or part-time job, or participate in a camp or summer college program. Visit colleges. Take campus tours and, at colleges you’re serious about, make appointments to have interviews with admissions counselors. Create a résumé—a record of accomplishments, activities, and work experiences since you started high school. Download applications (or request paper copies) from colleges to which you’ll apply. Check application dates—large universities may have early dates or rolling admissions. View these other handouts:
Source: College Counseling Sourcebook, 4th Edition |
|||||
| If investment, financial, mortgage or insurance planning and/or products are required, College and Retirement Solutions, LLC may refer you to one of its affiliates, including The Ziering Insurance Agency. Any discussion of the Tax implications of planning is strictly for general purposes. Neither "CRS" nor its representatives may give specific tax advice. One should seek the advice and counsel of their accountant and/or tax advisor for information regarding their particular situation. |


Hers...
From Family and Friends
- Maheswaran ShanmugaSundaram
- Shenbagapushpam
- Late ShanmugaSundaram Pillai
- Sucila Devi
- Late Chidambaram Pillai
- Papathi
- Ramasamy
- Prema
- KaaliRathna
- Nellaiyappan
- ShanmugaVelu
- Indira Gandhi
- Parimala
- Sampath
- Ganesh Mani
- Latha
- Bhuvaneswari
- Sambamdam
- ShanmugaSundaram
- AmrithaValli
- Poorini
- Vishwanathan
- Anoj Sundar
- Eri
- Aswath Ram
- Uma
- Angith Ram
- Abitha
- Praveen
- Suseetha
- Manoj
- Adithya Sampath
- Anirudh Sriram
- Rishee Vignesh Mani
- Sachhien Sundar
- Kanagasree
- VijaySri
- Akshara Sri
- Master Vidyut Varun
- Baby Adhiyasri
- Master Mrityunjay
- Baby Mirunalini
- Divya
- Mani


This star generates a uniformly distributed position in the area (x_min, y_min) (x_max, y_max). The position is returned as a complex value, where x is the real part and y is the imag. part of the complex particle.
Derived from: DEStar
Location: The WiNeS-Library
Version: 1.1 "06/24/97"
Author: A. Wernicke
| restart | int |
| R_Pos | Complex |
| x_min | IntState | "300" |
| x_max | IntState | "5000" |
| y_min | IntState | "50" |
| y_max | IntState | "2600" |
copyright (c) 1997 Dresden University of Technology, Mobile Communications Systems


Funes the Memorious — 1942
First Draft of a Report on the EDVAC — 1945
As You May Think — 1945
A Mathematical Theory of Communication — 1948
Cybernetics: Or Control and Communication in the Animal and the Machine — 1948
The Computer and the Brain — 1958


Find and Replace
Enter a sentence.
Choose a word.
What would you like to replace it with?
Switcharoo!
Here is your new sentence:


-
substance abuse testing child welfare
Edmond Police Officers Earn Awards from the ... - Edmond, OK
Jul 31, 2012 . Officer of the Year is awarded to any full-time Oklahoma Law Enforcement . The Medal of Valor will be awarded to Edmond Police Officer Kyle .
http://edmondok.com/CivicAlerts.aspx?AID=93
-
barbie island princess mp3
City of Oklahoma City | Police
The Oklahoma City Police Department, with a uniformed force of 1029 officers and 237 civilian employees, protects citizens and property from criminal activity, .
http://www.okc.gov/okcpd/
-
reverse polarity electric test meters
National Police Week Recognizes Law Enforcement Officers
Honoring Police Officers Throughout the Year. The National Law Enforcement Memorial Fund works to show year-round appreciation for police officers.
http://source.southuniversity.edu/national-police-week-recognizes-law-enforcement-officers-41154.aspx
-
origem dos esportes n uticos
Police Officer James Richard Hill - Officer Down Memorial Page
Police Officer James Richard Hill | Marlow Police Department, Oklahoma . Your heroism and service is honored today, the 81rst anniversary year of your death.
http://www.odmp.org/officer/16111-police-officer-james-richard-hill
-
covenant players toledo oh
Oklahoma police officer dies during training | PRIVATE OFFICER ...
Jun 29, 2012 . Posts about Oklahoma police officer dies during training written by . Jenks Police Department about a year, Police Chief Cameron Arthur said.
http://privateofficernews.wordpress.com/tag/oklahoma-police-officer-dies-during-training/
-
relapse prevention skills for drug addicts
Guthrie Police Officer Works As Oklahoma's Child Porn Crusader ...
Feb 14, 2013 . GUTHRIE, Oklahoma -- You could call him Oklahoma's Child Porn Crusader. One local police officer is on a mission to get accused child .
http://www.news9.com/story/21202351/guthrie-police-officer-works-as-oklahomas-child-porn-crusader
-
flights from mumbai to shirdi
Oklahoma City police officer, driver killed in Logan County crash are ...
Dec 5, 2012 . Two people died early Wednesday, including an off-duty Oklahoma City police officer, in a single-vehicle crash in Logan County, the Oklahoma .
http://newsok.com/oklahoma-city-police-officer-driver-killed-in-logan-county-crash-are-identified/article/3734877
-
passing a drug test thc
Oklahoma | Police Thugs
Jan 10, 2013 . 70 Year Old Police Officer Arrested For 1st Degree Burglary And Assault . CREEK COUNTY, OK - Court records show 70-year-old Delbert .
http://policethugs.com/category/oklahoma/
-
women of the american west
How Much does a Police Officer Make a Year? - Answers.Ask.com
The average salary of a police officer is $44000 per year USD. Some positions to shoot for are Police Testing office - $71000, Desk Sergea... view more.
http://answers.ask.com/Business/Finance/how_much_does_a_police_officer_make_a_year
-
name anke opitz m nchen
How do I Become a Police Officer? (with pictures)
3 days ago . Post 536. I am a 17 year old girl and I really want to be a police officer. . Becoming an Oklahoma County Sheriff deputy is my dream. I'm really .
http://www.wisegeek.org/how-do-i-become-a-police-officer.htm
-
album and movie cover art
TULSA POLICE - OK | Find Police Officer Career and Education ...
Find Tulsa Police Officer information here. . How to Become a Tulsa Police Officer . State and Federal agency jobs require applicants to possess a 4-year .
http://www.legal-criminal-justice-schools.com/Criminal-Justice-Degrees/Tulsa-Police-Department.html
-
govenor scholar for the arts ky
Blackwell, Oklahoma Police Officer Job at Blackwell Police ...
Feb 27, 2013 . The City of Blackwell also gives officers $700.00 a year clothing . Applicants must be able to pass the Oklahoma Police Pension physical.
http://careercenter.discoverpolicing.org/jobseeker/job/10455455/Police%20Officer/Blackwell%20Police%20Department/?vnet=0&t735=159
-
ero-pro shark s3501 instructions
Police Officers Safety Association, Inc.
Every year in the United States, about 150 police officers are killed in the line of duty. Every day, 150 officers are assaulted and 10 are shot at. Over 180 police .
http://www.posai.org/
-
mr crowley keyboard tab
Man shot by Cushing police outside gym dies; OSBI investigating ...
Jan 11, 2013 . An 18-year-old man shot by two Cushing police officers during a confrontation outside a gym Thursday night has died. The Oklahoma State .
http://www.kjrh.com/dpp/news/state/cushing-police-shoot-man-outside-gym
-
fidelity home loan corp
Video: Oklahoma Police Officer Uses Taser on Handcuffed Woman, page 1
An Oklahoma woman is suing her local police station after an officer attacked her with . The shocking video shows City of McAlester police officer Sterling . we have multiple deaths per year due to the use of tasers by police.
http://www.abovetopsecret.com/forum/thread903472/pg1
-
tuttle christian church tuttle oklahoma
Forum: Oklahoma - Police Forums & Law Enforcement Forums @ Officer.com
Police Forums & Law Enforcement Forums @ Officer.com - Powered by vBulletin . Started by OK County Cop?, 03-08-2013 03:53 PM. Replies: 1; Views: 172 .
http://forums.officer.com/f178/
-
pennsylvania vehicle code 4310 ornamental
Requirements to Become a Police Officer
People who searched for requirements to become a police officer found the following . High School, GED, Some College (1-30 credits - up to 1 year), Some College . New Mexico (1); Nevada (1); Oklahoma (2); Oregon (1); Pennsylvania (1) .
http://education-portal.com/requirements_to_become_a_police_officer.html
-
barbados macaroni pie recipe
Police Officer Job - Blackwell Police Department ... - PoliceOne
Feb 27, 2013 . The City of Blackwell also gives officers $700.00 a year clothing . Applicants must be able to pass the Oklahoma Police Pension physical.
http://www.policeone.com/police-jobs/6132982-police-officer
-
paintball gun shops in cornwall
Police Officer Jobs in Oklahoma - Find Jobs in the United States ...
Explore Oklahoma Police Officer jobs and career resources on Monster. Find all the information you need to land a Police Officer job in Oklahoma and build a .
http://jobs.monster.com/v-security-q-police-officer-jobs-l-oklahoma.aspx
-
university of wisconsin logo paper
Man shot by Cushing police outside gym dies; OSBI investigating ...
Jan 11, 2013 . An 18-year-old man shot by two Cushing police officers during a confrontation outside a gym Thursday night has died. The Oklahoma State .
http://www.kjrh.com/dpp/news/state/cushing-police-shoot-man-outside-gym


--- title: Accelerated Failure Time Models keywords: fastai sidebar: home_sidebar summary: "AFT Model theory." description: "AFT Model theory." nb_path: "60_AFT_models.ipynb" ---
We can model the time to failure as: $$ \log T_i = \mu + \xi_i $$ where $\xi_i\sim p(\xi|\theta)$ and $\mu$ is the most likely log time of death (the mode of the distribution of $T_i$). We model log death as that way we do not need to restrict $\mu + \xi_i$ to be positive.
In the censored case, where $t_i$ is the time where an instance was censored, and $T_i$ is the unobserved time of death, we have: $$ \begin{aligned} \log T_i &= \mu(x_i) + \xi_i > \log t_i\\ \therefore \xi_i &> \log t_i - \mu(x_i) \end{aligned} $$ Note that $\mu$ is a function of the features $x$. The log likelihood of the data ($\mathcal{D}$) can then shown to be: $$ \begin{aligned} \log p(\mathcal{D}) = \sum_{i=1}^N \mathcal{1}(y_i=1)\log p(\xi_i = \log t_i - \mu(x_i)) + \mathcal{1}(y_i=0)\log p(\xi_i &> \log t_i - \mu(x_i)) \end{aligned} $$
Modelling based on only time and (death) event variables:
# import pandas as pd
# url = "https://raw.githubusercontent.com/vincentarelbundock/Rdatasets/master/csv/survival/flchain.csv"
# df = pd.read_csv(url).iloc[:,1:]
# df.rename(columns={'futime':'t', 'death':'e'}, inplace=True)
# cols = ["age", "sample.yr", "kappa"]
# db, t_scaler, x_scaler = create_dl(df[['t', 'e'] + cols])
# death_rate = 100*df["e"].mean()
# print(f"Death occurs in {death_rate:.2f}% of cases")
# print(df.shape)
# df.head()
# from fastai.basics import Learner
# from torchlife.losses import aft_loss
# model = AFTModel("Gumbel", t_scaler, x_scaler)
# learner = Learner(db, model, loss_func=aft_loss)
# # wd = 1e-4
# learner.lr_find(start_lr=1, end_lr=10)
# learner.recorder.plot()


02. Procedures and Processes Sussman enters…
What is it that programmers do? Design processes which achieve particular goals. Such as finding the square roots of numbers, or anything else. The way a programmer does this is by constructing spells. These are built out of instructions and expressions. In order for a programmer to do this effectively, they have to understand the relationship between the particular tasks that he writes, and the behavior of the process that they’re attempting to control.
Some wild build up to ‘What is it that programmers are doing?’ It is intended to help us learn how to think Some time passes, I pick up notes around 0:35:00
A General Framework (for learning a computer language) What are the primitive elements?
What are the means of combination?
What are the ways of putting things together?
What are the means of abstraction?


How to create an online programming judge like codechef for my collage?
replay | like | dislike
Comments : 32
Reply : 123
Your Comment
Top Comment
View The Submissions
View The Editorial
How to create an online programming judge like codechef for my collage?
replay | like | dislike
How to create an online programming judge like codechef for my collage?
replay | like | dislike


|
| | file (const std::string &path, file_open_mode mode, file_type type) |
| | Path constructor. More...
|
| |
| void | close () |
| | Closes the file. More...
|
| |
| bool | eof () const noexcept |
| | Checks the end of file indicator. More...
|
| |
| bool | error () const noexcept |
| | Checks the error indicator. More...
|
| |
| size_t | get_byte_count () const noexcept |
| | Retrieves the size of the file in bytes. More...
|
| |
| long | tell () const |
| | Retrieves the current position indicator. More...
|
| |
| void | seek_set (long pos) |
| | Sets the current position indicator. More...
|
| |
| void | seek_from_end (long pos) |
| | Moves the current position indicator to the specified position from the end. More...
|
| |
| void | seek_offset (long offset) |
| | Moves the current position indicator. More...
|
| |
| void | flush () const |
| | Flushes the file. More...
|
| |
| bool | getc (char &c) |
| | Reads a character from the file. More...
|
| |
| void | putc (char c) |
| | Writes a character into the file. More...
|
| |
| size_t | gets (std::string &str) |
| | Reads a string from the file. More...
|
| |
| void | puts (const std::string &str) |
| | Writes a string into the file. More...
|
| |
| size_t | read (void *buf, size_t element_size, size_t buf_size) |
| | Reads into a specified location in memory. More...
|
| |
| void | write (const void *buf, size_t element_size, size_t buf_size) |
| | Writes from a specified location in memory. More...
|
| |
| template<typename T > |
| size_t | read (T *buf, size_t buf_size) |
| | Reads into a specified location in memory. More...
|
| |
| template<typename T > |
| void | write (const T *buf, size_t buf_size) |
| | Writes from a specified location in memory. More...
|
| |
| template<typename Container , typename Enable = std::enable_if_t<is_contiguous_container<Container>::value>> |
| size_t | read (Container &buffer) |
| | Reads into a container. More...
|
| |
| template<typename Container , typename Enable = std::enable_if_t<is_contiguous_container<Container>::value>> |
| void | write (const Container &buffer) |
| | Writes from a container. More...
|
| |
|
| non_copyable () noexcept |
| | default constructor
|
| |
|
virtual | ~non_copyable () |
| | Destructor.
|
| |
|
| non_copyable (const non_copyable &)=delete |
| | Deleted copy constructor.
|
| |
|
| non_copyable (non_copyable &&)=default |
| | Defaulted move constructor.
|
| |
|
non_copyable & | operator= (const non_copyable &)=delete |
| | Deleted copy assignment operator.
|
| |
|
non_copyable & | operator= (non_copyable &&)=default |
| | Defaulted move assignment operator.
|
| |
Class representing a file.
| size_t hou::file::gets |
( |
std::string & |
str | ) |
|
Reads a string from the file.
It tries to read a number of characters equal to the size of the string, or until a newline character is encountered. If it is not possible to read enough characters, only the first characters of the string will be set. Check the return value to see how many characters were read.
Sets eof if reading over the end of the file.
- Parameters
-
| str | the string to be read into. |
- Exceptions
-
- Returns
- the number of characters read.
Reads into a specified location in memory.
The caller must ensure that the memory range between buf and buf + (element_size * buf_size) is valid. If this is not the case, calling this function results in undefined behaviour.
This function will try to read buf_size elements. If the end of the stream is reached, only part of buf will be written. Check the return value to see how many elements were read.
Sets eof if reading over the end of the file.
- Parameters
-
| buf | a pointer to the memory location to write into. |
| element_size | the size of a single element to be written. |
| buf_size | the number of elements to be written. |
- Exceptions
-
- Returns
- the number of elements read.
Reads into a specified location in memory.
The caller must ensure that the memory range between buf and buf + (sizeof(T) * buf_size) is valid. If this is not the case, calling this function results in undefined behaviour.
This function will try to read buf_size elements. If the end of the stream is reached, only part of buf will be written. Check the return value to see how many elements were read.
Sets eof if reading over the end of the file.
- Template Parameters
-
- Parameters
-
| buf | pointer to the memory location to read into. |
| buf_size | the number of elements to be read. |
- Exceptions
-
- Returns
- the number of elements read.
template<typename Container , typename Enable >
| size_t hou::file::read |
( |
Container & |
buffer | ) |
|
Reads into a container.
This function will try to read as many elements as the size of buffer. If the end of the stream is reached, only part of buf will be written. Check the return value to see how many elements were read.
Sets eof if reading over the end of the file.
- Template Parameters
-
| Container | the container type. |
- Parameters
-
| buffer | the container to read into. |
- Exceptions
-
- Returns
- the number of elements read.


Hm, this was really fast. No lag what so ever. Guess what...
By default Slidious preloads all linked pages to make the user experience seemless.
You can change the preloading behaviour of course. Check out the documentation for details.
Did I mention, that Slidious scans new content for links automatically and handles external links (like the one above) differently from (registered) internal ones.


|
- Chapter 3 -
Expressions, Conditions, and Operators
Objectives
On Chapter 2, "Introduction to the Query: The SELECT Statement,"
you used SELECT and FROM to manipulate data in interesting (and
useful) ways. ToChapter you learn more about SELECT and FROM and expand
the basic query with some new terms to go with query, table, and row, as well as
a new clause and a group of handy items called operators. When the sun sets on Day
3, you will
- Know what an expression is and how to use it
- Know what a condition is and how to use it
- Be familiar with the basic uses of the WHERE clause
- Be able to use arithmetic, comparison, character, logical, and set operators
- Have a working knowledge of some miscellaneous operators
NOTE: We used Oracle's Personal Oracle7
to generate today's examples. Other implementations of SQL may differ slightly in
the way in which commands are entered or output is displayed, but the results are
basically the same for all implementations that conform to the ANSI standard.
Expressions
The definition of an expression is simple: An expression returns a value.
Expression types are very broad, covering different data types such as String, Numeric,
and Boolean. In fact, pretty much anything following a clause (SELECT or
FROM, for example) is an expression. In the following example amount
is an expression that returns the value contained in the amount column.
SELECT amount FROM checks;
In the following statement NAME, ADDRESS, PHONE and ADDRESSguide
are expressions:
SELECT NAME, ADDRESS, PHONE
FROM ADDRESSguide;
Now, examine the following expression:
WHERE NAME = 'BROWN'
It contains a condition, NAME = 'BROWN', which is an example of a Boolean
expression. NAME = 'BROWN' will be either TRUE or FALSE,
depending on the condition =.
Conditions
If you ever want to find a particular item or group of items in your database,
you need one or more conditions. Conditions are contained in the WHERE clause.
In the preceding example, the condition is
NAME = 'BROWN'
To find everyone in your organization who worked more than 100 hours
last month, your condition would be
NUMBEROFHOURS > 100
Conditions enable you to make selective queries. In their most common form, conditions
comprise a variable, a constant, and a comparison operator. In the first example
the variable is NAME, the constant is 'BROWN', and the comparison
operator is =. In the second example the variable is NUMBEROFHOURS,
the constant is 100, and the comparison operator is >. You need
to know about two more elements before you can write conditional queries: the WHERE
clause and operators.
The WHERE Clause
The syntax of the WHERE clause is
SYNTAX:
WHERE <SEARCH CONDITION>
SELECT, FROM, and WHERE are the three most frequently
used clauses in SQL. WHERE simply causes your queries to be more selective.
Without the WHERE clause, the most useful thing you could do with a query
is display all records in the selected table(s). For example:
INPUT:
SQL> SELECT * FROM BIKES;
lists all rows of data in the table BIKES.
OUTPUT:
NAME FRAMESIZE COMPOSITION MILESRIDDEN TYPE
-------------- --------- ------------ ----------- -------
TREK 2300 22.5 CARBON FIBER 3500 RACING
BURLEY 22 STEEL 2000 TANDEM
GIANT 19 STEEL 1500 COMMUTER
FUJI 20 STEEL 500 TOURING
SPECIALIZED 16 STEEL 100 MOUNTAIN
CANNONDALE 22.5 ALUMINUM 3000 RACING
6 rows selected.
If you wanted a particular bike, you could type
INPUT/OUTPUT:
SQL> SELECT *
FROM BIKES
WHERE NAME = 'BURLEY';
which would yield only one record:
NAME FRAMESIZE COMPOSITION MILESRIDDEN TYPE
-------------- --------- -------------- ----------- -------
BURLEY 22 STEEL 2000 TANDEM
ANALYSIS:
This simple example shows how you can place a condition on the data that you want
to retrieve.
Operators
Operators are the elements you use inside an expression to articulate how you
want specified conditions to retrieve data. Operators fall into six groups: arithmetic,
comparison, character, logical, set, and miscellaneous.
Arithmetic Operators
The arithmetic operators are plus (+), minus (-), divide (/),
multiply (*), and modulo (%). The first four are self-explanatory.
Modulo returns the integer remainder of a division. Here are two examples:
5 % 2 = 1
6 % 2 = 0
The modulo operator does not work with data types that have decimals, such as
Real or Number.
If you place several of these arithmetic operators in an expression without any
parentheses, the operators are resolved in this order: multiplication, division,
modulo, addition, and subtraction. For example, the expression
2*6+9/3
equals
12 + 3 = 15
However, the expression
2 * (6 + 9) / 3
equals
2 * 15 / 3 = 10
Watch where you put those parentheses! Sometimes the expression does exactly what
you tell it to do, rather than what you want it to do.
The following sections examine the arithmetic operators in some detail and give
you a chance to write some queries.
Plus (+)
You can use the plus sign in several ways. Type the following statement to display
the PRICE table:
INPUT:
SQL> SELECT * FROM PRICE;
OUTPUT:
ITEM WHOLESALE
-------------- ----------
TOMATOES .34
POTATOES .51
BANANAS .67
TURNIPS .45
CHEESE .89
APPLES .23
6 rows selected.
Now type:
INPUT/OUTPUT:
SQL> SELECT ITEM, WHOLESALE, WHOLESALE + 0.15
FROM PRICE;
Here the + adds 15 cents to each price to produce the following:
ITEM WHOLESALE WHOLESALE+0.15
-------------- --------- --------------
TOMATOES .34 .49
POTATOES .51 .66
BANANAS .67 .82
TURNIPS .45 .60
CHEESE .89 1.04
APPLES .23 .38
6 rows selected.
ANALYSIS:
What is this last column with the unattractive column heading WHOLESALE+0.15?
It's not in the original table. (Remember, you used * in the SELECT
clause, which causes all the columns to be shown.) SQL allows you to create a virtual
or derived column by combining or modifying existing columns.
Retype the original entry:
INPUT/OUTPUT:
SQL> SELECT * FROM PRICE;
The following table results:
ITEM WHOLESALE
-------------- ---------
TOMATOES .34
POTATOES .51
BANANAS .67
TURNIPS .45
CHEESE .89
APPLES .23
6 rows selected.
ANALYSIS:
The output confirms that the original data has not been changed and that the column
heading WHOLESALE+0.15 is not a permanent part of it. In fact, the column
heading is so unattractive that you should do something about it.
Type the following:
INPUT/OUTPUT:
SQL> SELECT ITEM, WHOLESALE, (WHOLESALE + 0.15) RETAIL
FROM PRICE;
Here's the result:
ITEM WHOLESALE RETAIL
-------------- --------- ------
TOMATOES .34 .49
POTATOES .51 .66
BANANAS .67 .82
TURNIPS .45 .60
CHEESE .89 1.04
APPLES .23 .38
6 rows selected.
ANALYSIS:
This is wonderful! Not only can you create new columns, but you can also rename
them on the fly. You can rename any of the columns using the syntax column_name
alias (note the space between column_name and alias).
For example, the query
INPUT/OUTPUT:
SQL> SELECT ITEM PRODUCE, WHOLESALE, WHOLESALE + 0.25 RETAIL
FROM PRICE;
renames the columns as follows:
PRODUCE WHOLESALE RETAIL
-------------- --------- ---------
TOMATOES .34 .59
POTATOES .51 .76
BANANAS .67 .92
TURNIPS .45 .70
CHEESE .89 1.14
APPLES .23 .48
NOTE: Some implementations of SQL use
the syntax <column name = alias>. The preceding example would be written
as follows:
SQL> SELECT ITEM = PRODUCE,
WHOLESALE,
WHOLESALE + 0.25 = RETAIL,
FROM PRICE;
Check your implementation for the exact syntax.
You might be wondering what use aliasing is if you are not using command-line
SQL. Fair enough. Have you ever wondered how report builders work? Someday, when
you are asked to write a report generator, you'll remember this and not spend weeks
reinventing what Dr. Codd and IBM have wrought.
So far, you have seen two uses of the plus sign. The first instance was the use
of the plus sign in the SELECT clause to perform a calculation on the data
and display the calculation. The second use of the plus sign is in the WHERE
clause. Using operators in the WHERE clause gives you more flexibility when
you specify conditions for retrieving data.
In some implementations of SQL, the plus sign does double duty as a character
operator. You'll see that side of the plus a little later today.
Minus (-)
Minus also has two uses. First, it can change the sign of a number. You can use
the table HILOW to demonstrate this function.
INPUT:
SQL> SELECT * FROM HILOW;
OUTPUT:
STATE HIGHTEMP LOWTEMP
---------- -------- ---------
CA -50 120
FL 20 110
LA 15 99
ND -70 101
NE -60 100
For example, here's a way to manipulate the data:
INPUT/OUTPUT:
SQL> SELECT STATE, -HIGHTEMP LOWS, -LOWTEMP HIGHS
FROM HILOW;
STATE LOWS HIGHS
---------- -------- ---------
CA 50 -120
FL -20 -110
LA -15 -99
ND 70 -101
NE 60 -100
The second (and obvious) use of the minus sign is to subtract one column from
another. For example:
INPUT/OUTPUT:
SQL> SELECT STATE,
2 HIGHTEMP LOWS,
3 LOWTEMP HIGHS,
4 (LOWTEMP - HIGHTEMP) DIFFERENCE
5 FROM HILOW;
STATE LOWS HIGHS DIFFERENCE
---------- -------- -------- ----------
CA -50 120 170
FL 20 110 90
LA 15 99 84
ND -70 101 171
NE -60 100 160
Notice the use of aliases to fix the data that was entered incorrectly. This remedy
is merely a temporary patch, though, and not a permanent fix. You should see to it
that the data is corrected and entered correctly in the future. On Chapter 21, "Common
SQL Mistakes/Errors and Resolutions," you'll learn how to correct bad data.
This query not only fixed (at least visually) the incorrect data but also created
a new column containing the difference between the highs and lows of each state.
If you accidentally use the minus sign on a character field, you get something
like this:
INPUT/OUTPUT:
SQL> SELECT -STATE FROM HILOW;
ERROR:
ORA-01722: invalid number
no rows selected
The exact error message varies with implementation, but the result is the same.
Divide (/)
The division operator has only the one obvious meaning. Using the table PRICE,
type the following:
INPUT:
SQL> SELECT * FROM PRICE;
OUTPUT:
ITEM WHOLESALE
-------------- ---------
TOMATOES .34
POTATOES .51
BANANAS .67
TURNIPS .45
CHEESE .89
APPLES .23
6 rows selected.
You can show the effects of a two-for-one sale by typing the next statement:
INPUT/OUTPUT:
SQL> SELECT ITEM, WHOLESALE, (WHOLESALE/2) SALEPRICE
2 FROM PRICE;
ITEM WHOLESALE SALEPRICE
-------------- --------- ---------
TOMATOES .34 .17
POTATOES .51 .255
BANANAS .67 .335
TURNIPS .45 .225
CHEESE .89 .445
APPLES .23 .115
6 rows selected.
The use of division in the preceding SELECT statement is straightforward
(except that coming up with half pennies can be tough).
Multiply (*)
The multiplication operator is also straightforward. Again, using the PRICE
table, type the following:
INPUT:
SQL> SELECT * FROM PRICE;
OUTPUT:
ITEM WHOLESALE
-------------- ---------
TOMATOES .34
POTATOES .51
BANANAS .67
TURNIPS .45
CHEESE .89
APPLES .23
6 rows selected.
This query changes the table to reflect an across-the-board 10 percent discount:
INPUT/OUTPUT:
SQL> SELECT ITEM, WHOLESALE, WHOLESALE * 0.9 NEWPRICE
FROM PRICE;
ITEM WHOLESALE NEWPRICE
-------------- --------- --------
TOMATOES .34 .306
POTATOES .51 .459
BANANAS .67 .603
TURNIPS .45 .405
CHEESE .89 .801
APPLES .23 .207
6 rows selected.
These operators enable you to perform powerful calculations in a SELECT
statement.
Modulo (%)
The modulo operator returns the integer remainder of the division operation. Using
the table REMAINS, type the following:
INPUT:
SQL> SELECT * FROM REMAINS;
OUTPUT:
NUMERATOR DENOMINATOR
--------- ------------
10 5
8 3
23 9
40 17
1024 16
85 34
6 rows selected.
You can also create a new column, REMAINDER, to hold the values of NUMERATOR
% DENOMINATOR:
INPUT/OUTPUT:
SQL> SELECT NUMERATOR,
DENOMINATOR,
NUMERATOR%DENOMINATOR REMAINDER
FROM REMAINS;
NUMERATOR DENOMINATOR REMAINDER
--------- ----------- ---------
10 5 0
8 3 2
23 9 5
40 17 6
1024 16 0
85 34 17
6 rows selected.
Some implementations of SQL implement modulo as a function called MOD
(see Chapter 4, "Functions: Molding the Data You Retrieve"). The following
statement produces results that are identical to the results in the preceding statement:
SQL> SELECT NUMERATOR,
DENOMINATOR,
MOD(NUMERATOR,DENOMINATOR) REMAINDER
FROM REMAINS;
Precedence
This section examines the use of precedence in a SELECT statement. Using
the database PRECEDENCE, type the following:
SQL> SELECT * FROM PRECEDENCE;
N1 N2 N3 N4
--------- --------- --------- ---------
1 2 3 4
13 24 35 46
9 3 23 5
63 2 45 3
7 2 1 4
Use the following code segment to test precedence:
INPUT/OUTPUT:
SQL> SELECT
2 N1+N2*N3/N4,
3 (N1+N2)*N3/N4,
4 N1+(N2*N3)/N4
5 FROM PRECEDENCE;
N1+N2*N3/N4 (N1+N2)*N3/N4 N1+(N2*N3)/N4
----------- ------------- -------------
2.5 2.25 2.5
31.26087 28.152174 31.26087
22.8 55.2 22.8
93 975 93
7.5 2.25 7.5
Notice that the first and last columns are identical. If you added a fourth column
N1+N2* (N3/N4), its values would also be identical to those of the current
first and last columns.
Comparison Operators
True to their name, comparison operators compare expressions and return one of
three values: TRUE, FALSE, or Unknown. Wait a minute!
Unknown? TRUE and FALSE are self-explanatory, but what
is Unknown?
To understand how you could get an Unknown, you need to know a little
about the concept of NULL. In database terms NULL is the absence
of data in a field. It does not mean a column has a zero or a blank in it. A zero
or a blank is a value. NULL means nothing is in that field. If you make
a comparison like Field = 9 and the only value for Field is NULL,
the comparison will come back Unknown. Because Unknown is an uncomfortable
condition, most flavors of SQL change Unknown to FALSE and provide
a special operator, IS NULL, to test for a NULL condition.
Here's an example of NULL: Suppose an entry in the PRICE table
does not contain a value for WHOLESALE. The results of a query might look
like this:
INPUT:
SQL> SELECT * FROM PRICE;
OUTPUT:
ITEM WHOLESALE
-------------- ----------
TOMATOES .34
POTATOES .51
BANANAS .67
TURNIPS .45
CHEESE .89
APPLES .23
ORANGES
Notice that nothing is printed out in the WHOLESALE field position for
oranges. The value for the field WHOLESALE for oranges is NULL.
The NULL is noticeable in this case because it is in a numeric column. However,
if the NULL appeared in the ITEM column, it would be impossible
to tell the difference between NULL and a blank.
Try to find the NULL:
INPUT/OUTPUT:
SQL> SELECT *
2 FROM PRICE
3 WHERE WHOLESALE IS NULL;
ITEM WHOLESALE
-------------- ----------
ORANGES
ANALYSIS:
As you can see by the output, ORANGES is the only item whose value for
WHOLESALE is NULL or does not contain a value. What if you use
the equal sign (=) instead?
INPUT/OUTPUT:
SQL> SELECT *
FROM PRICE
WHERE WHOLESALE = NULL;
no rows selected
ANALYSIS:
You didn't find anything because the comparison WHOLESALE = NULL returned
a FALSE--the result was unknown. It would be more appropriate to use an
IS NULL instead of =, changing the WHERE statement to
WHERE WHOLESALE IS NULL. In this case you would get all the rows where a
NULL existed.
This example also illustrates both the use of the most common comparison operator,
the equal sign (=), and the playground of all comparison operators, the
WHERE clause. You already know about the WHERE clause, so here's
a brief look at the equal sign.
Equal (=)
Earlier toChapter you saw how some implementations of SQL use the equal sign in the
SELECT clause to assign an alias. In the WHERE clause, the equal
sign is the most commonly used comparison operator. Used alone, the equal sign is
a very convenient way of selecting one value out of many. Try this:
INPUT:
SQL> SELECT * FROM FRIENDS;
OUTPUT:
LASTNAME FIRSTNAME AREACODE PHONE ST ZIP
-------------- -------------- --------- -------- -- -----
BUNDY AL<PHONE_NUMBER> IL 22333
MEZA AL<PHONE_NUMBER> UK
MERRICK BUD<PHONE_NUMBER> CO 80212
MAST JD<PHONE_NUMBER> LA 23456
BULHER FERRIS<PHONE_NUMBER> IL 23332
Let's find JD's row. (On a short list this task appears trivial, but you may have
more friends than we do--or you may have a list with thousands of records.)
INPUT/OUTPUT:
SQL> SELECT *
FROM FRIENDS
WHERE FIRSTNAME = 'JD';
LASTNAME FIRSTNAME AREACODE PHONE ST ZIP
-------------- -------------- --------- -------- -- -----
MAST JD<PHONE_NUMBER> LA 23456
We got the result that we expected. Try this:
INPUT/OUTPUT:
SQL> SELECT *
FROM FRIENDS
WHERE FIRSTNAME = 'AL';
LASTNAME FIRSTNAME AREACODE PHONE ST ZIP
-------------- -------------- --------- -------- -- -----
BUNDY AL<PHONE_NUMBER> IL 22333
MEZA AL<PHONE_NUMBER> UK
NOTE: Here you see that = can
pull in multiple records. Notice that ZIP is blank on the second record.
ZIP is a character field (you learn how to create and populate tables on
Chapter 8, "Manipulating Data"), and in this particular record the NULL
demonstrates that a NULL in a character field is impossible to differentiate
from a blank field.
Here's another very important lesson concerning case sensitivity:
INPUT/OUTPUT:
SQL> SELECT * FROM FRIENDS
WHERE FIRSTNAME = 'BUD';
FIRSTNAME
--------------
BUD
1 row selected.
Now try this:
INPUT/OUTPUT:
SQL> select * from friends
where firstname = 'Bud';
no rows selected.
ANALYSIS:
Even though SQL syntax is not case sensitive, data is. Most companies prefer to
store data in uppercase to provide data consistency. You should always store data
either in all uppercase or in all lowercase. Mixing case creates difficulties when
you try to retrieve accurate data.
Greater Than (>) and Greater Than or Equal To (>=)
The greater than operator (>) works like this:
INPUT:
SQL> SELECT *
FROM FRIENDS
WHERE AREACODE > 300;
OUTPUT:
LASTNAME FIRSTNAME AREACODE PHONE ST ZIP
-------------- -------------- --------- -------- -- -----
MAST JD<PHONE_NUMBER> LA 23456
BULHER FERRIS<PHONE_NUMBER> IL 23332
ANALYSIS:
This example found all the area codes greater than (but not including) 300.
To include 300, type this:
INPUT/OUTPUT:
SQL> SELECT *
2 FROM FRIENDS
3 WHERE AREACODE >= 300;
LASTNAME FIRSTNAME AREACODE PHONE ST ZIP
-------------- -------------- --------- -------- -- -----
MERRICK BUD<PHONE_NUMBER> CO 80212
MAST JD<PHONE_NUMBER> LA 23456
BULHER FERRIS<PHONE_NUMBER> IL 23332
ANALYSIS:
With this change you get area codes starting at 300 and going up. You
could achieve the same results with the statement AREACODE > 299.
NOTE: Notice that no quotes surround 300
in this SQL statement. Number-defined fieldsnumber-defined fields do not require
quotes.
Less Than (<) and Less Than or Equal To (<=)
As you might expect, these comparison operators work the same way as >
and >= work, only in reverse:
INPUT:
SQL> SELECT *
2 FROM FRIENDS
3 WHERE STATE < 'LA';
OUTPUT:
LASTNAME FIRSTNAME AREACODE PHONE ST ZIP
-------------- -------------- --------- -------- -- ------
BUNDY AL<PHONE_NUMBER> IL 22333
MERRICK BUD<PHONE_NUMBER> CO 80212
BULHER FERRIS<PHONE_NUMBER> IL 23332
NOTE: How did STATE get changed
to ST? Because the column has only two characters, the column name is shortened
to two characters in the returned rows. If the column name had been COWS,
it would come out CO. The widths of AREACODE and PHONE
are wider than their column names, so they are not truncated.
ANALYSIS:
Wait a minute. Did you just use < on a character field? Of course
you did. You can use any of these operators on any data type. The result varies by
data type. For example, use lowercase in the following state search:
INPUT/OUTPUT:
SQL> SELECT *
2 FROM FRIENDS
3 WHERE STATE < 'la';
LASTNAME FIRSTNAME AREACODE PHONE ST ZIP
-------------- -------------- --------- -------- -- -----
BUNDY AL<PHONE_NUMBER> IL 22333
MEZA AL<PHONE_NUMBER> UK
MERRICK BUD<PHONE_NUMBER> CO 80212
MAST JD<PHONE_NUMBER> LA 23456
BULHER FERRIS<PHONE_NUMBER> IL 23332
ANALYSIS:
Uppercase is usually sorted before lowercase; therefore, the uppercase codes returned
are less than 'la'. Again, to be safe, check your implementation.
TIP: To be sure of how these operators
will behave, check your language tables. Most PC implementations use the ASCII tables.
Some other platforms use EBCDIC.
To include the state of Louisiana in the original search, type
INPUT/OUTPUT:
SQL> SELECT *
2 FROM FRIENDS
3 WHERE STATE <= 'LA';
LASTNAME FIRSTNAME AREACODE PHONE ST ZIP
-------------- -------------- --------- -------- -- -----
BUNDY AL<PHONE_NUMBER> IL 22333
MERRICK BUD<PHONE_NUMBER> CO 80212
MAST JD<PHONE_NUMBER> LA 23456
BULHER FERRIS<PHONE_NUMBER> IL 23332
Inequalities (< > or !=)
When you need to find everything except for certain data, use the inequality symbol,
which can be either < > or !=, depending on your SQL implementation.
For example, to find everyone who is not AL, type this:
INPUT:
SQL> SELECT *
2 FROM FRIENDS
3 WHERE FIRSTNAME <> 'AL';
OUTPUT:
LASTNAME FIRSTNAME AREACODE PHONE ST ZIP
-------------- -------------- --------- -------- -- -----
MERRICK BUD<PHONE_NUMBER> CO 80212
MAST JD<PHONE_NUMBER> LA 23456
BULHER FERRIS<PHONE_NUMBER> IL 23332
To find everyone not living in California, type this:
INPUT/OUTPUT:
SQL> SELECT *
2 FROM FRIENDS
3 WHERE STATE != 'CA';
LASTNAME FIRSTNAME AREACODE PHONE ST ZIP
-------------- -------------- --------- -------- -- -----
BUNDY AL<PHONE_NUMBER> IL 22333
MEZA AL<PHONE_NUMBER> UK
MERRICK BUD<PHONE_NUMBER> CO 80212
MAST JD<PHONE_NUMBER> LA 23456
BULHER FERRIS<PHONE_NUMBER> IL 23332
NOTE: Notice that both symbols, <>
and !=, can express "not equals."
Character Operators
You can use character operators to manipulate the way character strings are represented,
both in the output of data and in the process of placing conditions on data to be
retrieved. This section describes two character operators: the LIKE operator
and the || operator, which conveys the concept of character concatenation.
I Want to Be Like LIKE
What if you wanted to select parts of a database that fit a pattern but weren't
quite exact matches? You could use the equal sign and run through all the possible
cases, but that process would be boring and time-consuming. Instead, you could use
LIKE. Consider the following:
INPUT:
SQL> SELECT * FROM PARTS;
OUTPUT:
NAME LOCATION PARTNUMBER
-------------- -------------- ----------
APPENDIX MID-STOMACH 1
ADAMS APPLE THROAT 2
HEART CHEST 3
SPINE BACK 4
ANVIL EAR 5
KIDNEY MID-BACK 6
How can you find all the parts located in the back? A quick visual inspection
of this simple table shows that it has two parts, but unfortunately the locations
have slightly different names. Try this:
INPUT/OUTPUT:
SQL> SELECT *
2 FROM PARTS
3 WHERE LOCATION LIKE '%BACK%';
NAME LOCATION PARTNUMBER
-------------- -------------- ----------
SPINE BACK 4
KIDNEY MID-BACK 6
ANALYSIS:
You can see the use of the percent sign (%) in the statement after LIKE.
When used inside a LIKE expression, % is a wildcard. What you asked for
was any occurrence of BACK in the column location. If you queried
INPUT:
SQL> SELECT *
FROM PARTS
WHERE LOCATION LIKE 'BACK%';
you would get any occurrence that started with BACK:
OUTPUT:
NAME LOCATION PARTNUMBER
-------------- -------------- ----------
SPINE BACK 4
If you queried
INPUT:
SQL> SELECT *
FROM PARTS
WHERE NAME LIKE 'A%';
you would get any name that starts with A:
OUTPUT:
NAME LOCATION PARTNUMBER
-------------- -------------- ----------
APPENDIX MID-STOMACH 1
ADAMS APPLE THROAT 2
ANVIL EAR 5
Is LIKE case sensitive? Try the next query to find out.
INPUT/OUTPUT:
SQL> SELECT *
FROM PARTS
WHERE NAME LIKE 'a%';
no rows selected
ANALYSIS:
The answer is yes. References to data are always case sensitive.
What if you want to find data that matches all but one character in a certain
pattern? In this case you could use a different type of wildcard: the underscore.
Underscore (_)
The underscore is the single-character wildcard. Using a modified version of the
table FRIENDS, type this:
INPUT:
SQL> SELECT * FROM FRIENDS;
OUTPUT:
LASTNAME FIRSTNAME AREACODE PHONE ST ZIP
-------------- -------------- --------- -------- -- -----
BUNDY AL<PHONE_NUMBER> IL 22333
MEZA AL<PHONE_NUMBER> UK
MERRICK UD<PHONE_NUMBER> CO 80212
MAST JD<PHONE_NUMBER> LA 23456
BULHER FERRIS<PHONE_NUMBER> IL 23332
PERKINS ALTON<PHONE_NUMBER> CA 95633
BOSS SIR<PHONE_NUMBER> CT 95633
To find all the records where STATE starts with C, type the
following:
INPUT/OUTPUT:
SQL> SELECT *
2 FROM FRIENDS
3 WHERE STATE LIKE 'C_';
LASTNAME FIRSTNAME AREACODE PHONE ST ZIP
-------------- -------------- --------- -------- -- -----
MERRICK BUD<PHONE_NUMBER> CO 80212
PERKINS ALTON<PHONE_NUMBER> CA 95633
BOSS SIR<PHONE_NUMBER> CT 95633
You can use several underscores in a statement:
INPUT/OUTPUT:
SQL> SELECT *
2 FROM FRIENDS
3 WHERE PHONE LIKE'555-6_6_';
LASTNAME FIRSTNAME AREACODE PHONE ST ZIP
-------------- -------------- --------- -------- -- -----
MERRICK BUD<PHONE_NUMBER> CO 80212
MAST JD<PHONE_NUMBER> LA 23456
The previous statement could also be written as follows:
INPUT/OUTPUT:
SQL> SELECT *
2 FROM FRIENDS
3 WHERE PHONE LIKE '555-6%';
LASTNAME FIRSTNAME AREACODE PHONE ST ZIP
-------------- -------------- --------- -------- -- -----
MERRICK BUD<PHONE_NUMBER> CO 80212
MAST JD<PHONE_NUMBER> LA 23456
Notice that the results are identical. These two wildcards can be combined. The
next example finds all records with L as the second character:
INPUT/OUTPUT:
SQL> SELECT *
2 FROM FRIENDS
3 WHERE FIRSTNAME LIKE '_L%';
LASTNAME FIRSTNAME AREACODE PHONE ST ZIP
-------------- -------------- --------- -------- -- -----
BUNDY AL<PHONE_NUMBER> IL 22333
MEZA AL<PHONE_NUMBER> UK
PERKINS ALTON<PHONE_NUMBER> CA 95633
Concatenation (||)
The || (double pipe) symbol concatenates two strings. Try this:
INPUT:
SQL> SELECT FIRSTNAME || LASTNAME ENTIRENAME
2 FROM FRIENDS;
OUTPUT:
ENTIRENAME
----------------------
AL BUNDY
AL MEZA
BUD MERRICK
JD MAST
FERRIS BULHER
ALTON PERKINS
SIR BOSS
7 rows selected.
ANALYSIS:
Notice that || is used instead of +. If you use + to
try to concatenate the strings, the SQL interpreter used for this example (Personal
Oracle7) returns the following error:
INPUT/OUTPUT:
SQL> SELECT FIRSTNAME + LASTNAME ENTIRENAME
FROM FRIENDS;
ERROR:
ORA-01722: invalid number
It is looking for two numbers to add and throws the error invalid number
when it doesn't find any.
NOTE: Some implementations of SQL use
the plus sign to concatenate strings. Check your implementation.
Here's a more practical example using concatenation:
INPUT/OUTPUT:
SQL> SELECT LASTNAME || ',' || FIRSTNAME NAME
FROM FRIENDS;
NAME
------------------------------------------------------
BUNDY , AL
MEZA , AL
MERRICK , BUD
MAST , JD
BULHER , FERRIS
PERKINS , ALTON
BOSS , SIR
7 rows selected.
ANALYSIS:
This statement inserted a comma between the last name and the first name.
NOTE: Notice the extra spaces between
the first name and the last name in these examples. These spaces are actually part
of the data. With certain data types, spaces are right-padded to values less than
the total length allocated for a field. See your implementation. Data types will
be discussed on Chapter 9, "Creating and Maintaining Tables."
So far you have performed the comparisons one at a time. That method is fine for
some problems, but what if you need to find all the people at work with last names
starting with P who have less than three days of vacation time?
Logical Operators
logical operatorsLogical operators separate two or more conditions in the WHERE
clause of an SQL statement.
Vacation time is always a hot topic around the workplace. Say you designed a table
called VACATION for the accounting department:
INPUT:
SQL> SELECT * FROM VACATION;
OUTPUT:
LASTNAME EMPLOYEENUM YEARS LEAVETAKEN
-------------- ----------- --------- ----------
ABLE 101 2 4
BAKER 104 5 23
BLEDSOE 107 8 45
BOLIVAR 233 4 80
BOLD 210 15 100
COSTALES 211 10 78
6 rows selected.
Suppose your company gives each employee 12 days of leave each year. Using what
you have learned and a logical operator, find all the employees whose names start
with B and who have more than 50 days of leave coming.
INPUT/OUTPUT:
SQL> SELECT LASTNAME,
2 YEARS * 12 - LEAVETAKEN REMAINING
3 FROM VACATION
4 WHERE LASTNAME LIKE 'B%'
5 AND
6 YEARS * 12 - LEAVETAKEN > 50;
LASTNAME REMAINING
-------------- ---------
BLEDSOE 51
BOLD 80
ANALYSIS:
This query is the most complicated you have done so far. The SELECT clause
(lines 1 and 2) uses arithmetic operators to determine how many days of leave each
employee has remaining. The normal precedence computes YEARS * 12 - LEAVETAKEN.
(A clearer approach would be to write (YEARS * 12) - LEAVETAKEN.)
LIKE is used in line 4 with the wildcard % to find all the B
names. Line 6 uses the > to find all occurrences greater than 50.
The new element is on line 5. You used the logical operator AND to ensure
that you found records that met the criteria in lines 4 and 6.
AND
AND means that the expressions on both sides must be true to return TRUE.
If either expression is false, AND returns FALSE. For example,
to find out which employees have been with the company for 5 years or less
and have taken more than 20 days leave, try this:
INPUT:
SQL> SELECT LASTNAME
2 FROM VACATION
3 WHERE YEARS <= 5
4 AND
5 LEAVETAKEN > 20 ;
OUTPUT:
LASTNAME
--------
BAKER
BOLIVAR
If you want to know which employees have been with the company for 5
years or more and have taken less than 50 percent of their leave, you could
write:
INPUT/OUTPUT:
SQL> SELECT LASTNAME WORKAHOLICS
2 FROM VACATION
3 WHERE YEARS >= 5
4 AND
5 ((YEARS *12)-LEAVETAKEN)/(YEARS * 12) < 0.50;
WORKAHOLICS
---------------
BAKER
BLEDSOE
Check these people for burnout. Also check out how we used the AND to
combine these two conditions.
OR
You can also use OR to sum up a series of conditions. If any of the comparisons
is true, OR returns TRUE. To illustrate the difference, conditionsrun
the last query with OR instead of with AND:
INPUT:
SQL> SELECT LASTNAME WORKAHOLICS
2 FROM VACATION
3 WHERE YEARS >= 5
4 OR
5 ((YEARS *12)-LEAVETAKEN)/(YEARS * 12) >= 0.50;
OUTPUT:
WORKAHOLICS
---------------
ABLE
BAKER
BLEDSOE
BOLD
COSTALES
ANALYSIS:
The original names are still in the list, but you have three new entries (who
would probably resent being called workaholics). These three new names made the list
because they satisfied one of the conditions. OR requires that only one
of the conditions be true in order for data to be returned.
NOT
NOT means just that. If the condition it applies to evaluates to TRUE,
NOT make it FALSE. If the condition after the NOT is FALSE,
it becomes TRUE. For example, the following SELECT returns the
only two names not beginning with B in the table:
INPUT:
SQL> SELECT *
2 FROM VACATION
3 WHERE LASTNAME NOT LIKE 'B%';
OUTPUT:
LASTNAME EMPLOYEENUM YEARS LEAVETAKEN
-------------- ----------- -------- ----------
ABLE 101 2 4
COSTALES 211 10 78
NOT can also be used with the operator IS when applied to NULL.
Recall the PRICES table where we put a NULL value in the WHOLESALE
column opposite the item ORANGES.
INPUT/OUTPUT:
SQL> SELECT * FROM PRICE;
ITEM WHOLESALE
-------------- ---------
TOMATOES .34
POTATOES .51
BANANAS .67
TURNIPS .45
CHEESE .89
APPLES .23
ORANGES
7 rows selected.
To find the non-NULL items, type this:
INPUT/OUTPUT:
SQL> SELECT *
2 FROM PRICE
3 WHERE WHOLESALE IS NOT NULL;
ITEM WHOLESALE
-------------- ---------
TOMATOES .34
POTATOES .51
BANANAS .67
TURNIPS .45
CHEESE .89
APPLES .23
6 rows selected.
Set Operators
On Chapter 1, "Introduction to SQL," you learned that SQL is based on the
theory of sets. The following sections examine set operators.
UNION and UNION ALL
UNION returns the results of two queries minus the duplicate rows. The
following two tables represent the rosters of teams:
INPUT:
SQL> SELECT * FROM FOOTBALL;
OUTPUT:
NAME
--------------------
ABLE
BRAVO
CHARLIE
DECON
EXITOR
FUBAR
GOOBER
7 rows selected.
INPUT:
SQL> SELECT * FROM SOFTBALL;
OUTPUT:
NAME
--------------------
ABLE
BAKER
CHARLIE
DEAN
EXITOR
FALCONER
GOOBER
7 rows selected.
How many different people play on one team or another?
INPUT/OUTPUT:
SQL> SELECT NAME FROM SOFTBALL
2 UNION
3 SELECT NAME FROM FOOTBALL;
NAME
--------------------
ABLE
BAKER
BRAVO
CHARLIE
DEAN
DECON
EXITOR
FALCONER
FUBAR
GOOBER
10 rows selected.
UNION returns 10 distinct names from the two lists. How many names are
on both lists (including duplicates)?

ANALYSIS:
The combined list--courtesy of the UNION ALL statement--has 14 names.
UNION ALL works just like UNION except it does not eliminate duplicates.
Now show me a list of players who are on both teams. You can't do that with UNION--you
need to learn INTERSECT.
INTERSECT
INTERSECT returns only the rows found by both queries. The next SELECT
statement shows the list of players who play on both teams:
INPUT:
SQL> SELECT * FROM FOOTBALL
2 INTERSECT
3 SELECT * FROM SOFTBALL;
OUTPUT:
NAME
--------------------
ABLE
CHARLIE
EXITOR
GOOBER
ANALYSIS:
In this example INTERSECT finds the short list of players who are on
both teams by combining the results of the two SELECT statements.
MINUS (Difference)
Minus returns the rows from the first query that were not present in
the second. For example:
INPUT:
SQL> SELECT * FROM FOOTBALL
2 MINUS
3 SELECT * FROM SOFTBALL;
OUTPUT:
NAME
--------------------
BRAVO
DECON
FUBAR
ANALYSIS:
The preceding query shows the three football players who are not on the softball
team. If you reverse the order, you get the three softball players who aren't on
the football team:
INPUT:
SQL> SELECT * FROM SOFTBALL
2 MINUS
3 SELECT * FROM FOOTBALL;
OUTPUT:
NAME
--------------------
BAKER
DEAN
FALCONER
Miscellaneous Operators: IN and BETWEEN
The two operators IN and BETWEEN provide a shorthand for functions
you already know how to do. If you wanted to find friends in Colorado, California,
and Louisiana, you could type the following:
INPUT:
SQL> SELECT *
2 FROM FRIENDS
3 WHERE STATE= 'CA'
4 OR
5 STATE ='CO'
6 OR
7 STATE = 'LA';
OUTPUT:
LASTNAME FIRSTNAME AREACODE PHONE ST ZIP
-------------- -------------- --------- -------- -- -----
MERRICK BUD<PHONE_NUMBER> CO 80212
MAST JD<PHONE_NUMBER> LA 23456
PERKINS ALTON<PHONE_NUMBER> CA 95633
Or you could type this:
INPUT/OUTPUT:
SQL> SELECT *
2 FROM FRIENDS
3 WHERE STATE IN('CA','CO','LA');
LASTNAME FIRSTNAME AREACODE PHONE ST ZIP
-------------- -------------- --------- -------- -- -----
MERRICK BUD<PHONE_NUMBER> CO 80212
MAST JD<PHONE_NUMBER> LA 23456
PERKINS ALTON<PHONE_NUMBER> CA 95633
ANALYSIS:
The second example is shorter and more readable than the first. You never know
when you might have to go back and work on something you wrote months ago. IN
also works with numbers. Consider the following, where the column AREACODE
is a number:
INPUT/OUTPUT:
SQL> SELECT *
2 FROM FRIENDS
3 WHERE AREACODE IN(100,381,204);
LASTNAME FIRSTNAME AREACODE PHONE ST ZIP
-------------- -------------- --------- -------- -- -----
BUNDY AL<PHONE_NUMBER> IL 22333
MAST JD<PHONE_NUMBER> LA 23456
BOSS SIR<PHONE_NUMBER> CT 95633
If you needed a range of things from the PRICE table, you could write
the following:
INPUT/OUTPUT:
SQL> SELECT *
2 FROM PRICE
3 WHERE WHOLESALE > 0.25
4 AND
5 WHOLESALE < 0.75;
ITEM WHOLESALE
-------------- ---------
TOMATOES .34
POTATOES .51
BANANAS .67
TURNIPS .45
Or using BETWEEN, you would write this:
INPUT/OUTPUT:
SQL> SELECT *
2 FROM PRICE
3 WHERE WHOLESALE BETWEEN 0.25 AND 0.75;
ITEM WHOLESALE
-------------- ---------
TOMATOES .34
POTATOES .51
BANANAS .67
TURNIPS .45
Again, the second example is a cleaner, more readable solution than the first.
NOTE: If a WHOLESALE value of
0.25 existed in the PRICE table, that record would have been retrieved
also. Parameters used in the BETWEEN operator are inclusive parametersinclusive.
Summary
At the beginning of Chapter 3, you knew how to use the basic SELECT and FROM
clauses. Now you know how to use a host of operators that enable you to fine-tune
your requests to the database. You learned how to use arithmetic, comparison, character,
logical, and set operators. This powerful set of tools provides the cornerstone of
your SQL knowledge.
Q&A
- Q How does all of this information apply to me if I am not using SQL from
the command line as depicted in the examples?
A Whether you use SQL in COBOL as Embedded SQL or in Microsoft's Open Database
Connectivity (ODBC), you use the same basic constructions. You will use what you
learned toChapter and yesterChapter repeatedly as you work with SQL.
Q Why are you constantly telling me to check my implementation? I thought
there was a standard!
A There is an ANSI standard (the most recent version is 1992); however,
most vendors modify it somewhat to suit their databases. The basics are similar if
not identical, and each instance has extensions that other vendors copy and improve.
We have chosen to use ANSI as a starting point but point out the differences as we
go along.
Workshop
The Workshop provides quiz questions to help solidify your understanding of the
material covered, as well as exercises to provide you with experience in using what
you have learned. Try to answer the quiz and exercise questions before checking the
answers in Appendix F, "Answers to Quizzes and Exercises."
Quiz
Use the FRIENDS table to answer the following questions.
LASTNAME FIRSTNAME AREACODE PHONE ST ZIP
-------------- -------------- --------- -------- -- -----
BUNDY AL<PHONE_NUMBER> IL 22333
MEZA AL<PHONE_NUMBER> UK
MERRICK BUD<PHONE_NUMBER> CO 80212
MAST JD<PHONE_NUMBER> LA 23456
BULHER FERRIS<PHONE_NUMBER> IL 23332
PERKINS ALTON<PHONE_NUMBER> CA 95633
BOSS SIR<PHONE_NUMBER> CT 95633
- 1. Write a query that returns everyone in the database whose last name
begins with M.
2. Write a query that returns everyone who lives in Illinois with a first
name of AL.
3. Given two tables (PART1 and PART2) containing columns
named PARTNO, how would you find out which part numbers are in both tables?
Write the query.
4. What shorthand could you use instead of WHERE a >= 10 AND a <=30?
5. What will this query return?
SELECT FIRSTNAME
FROM FRIENDS
WHERE FIRSTNAME = 'AL'
AND LASTNAME = 'BULHER';
Exercises
- 1. Using the FRIENDS table, write a query that returns the following:
NAME ST
------------------- --
AL FROM IL
INPUT:
SQL> SELECT (FIRSTNAME || 'FROM') NAME, STATE
2 FROM FRIENDS
3 WHERE STATE = 'IL'
4 AND
5 LASTNAME = 'BUNDY';
OUTPUT:
NAME ST
------------------- --
AL FROM IL
- 2. Using the FRIENDS table, write a query that returns the following:
NAME PHONE
-------------------------- -------------
MERRICK, BUD<PHONE_NUMBER>
MAST, JD<PHONE_NUMBER>
BULHER, FERRIS<PHONE_NUMBER>
|


Usage:
/list?table=xxx Where xxx = stations, models, rcp
/humidity?station_id=val&rcp_id=val
/temp?station_id=val&rcp_id=val
/fdi?station_id=val&rcp_id=val
/avg_temp?station_id=val


iReporter
Home
Create Record
View Profile
Logout
Home
/ view record
Record Information
Record Type
Red-Flag
Date Created
Nov-25-2018
Status
Under Review
Location (lat, lon)
453121, 3544555
Image(s)
Video(s)
Comment
The record has to do with a money laundry act


Allow us to introduce to you our company. We are an IT development company located in Belarus. Our team is an experienced and dynamic developed IT professionals.
We provide scalable, high available, fault tolerance and highload systems. Main areas are customer-oriented systems and complex systems for resolving any problems.
5 лет
на рынке
120 проектов
завершенных
успешно
1 год
хостинга
бесплатно
Партнеры
Google и
Yandex
Data storage technologies: SQL(MS SQL, mySQL, SQLite, PostgreSQL, Oracle), NoSQL(MongoDB, Redis)
Data security: SSL, TSL, asymmetric and symmetric encryption, hash, MAC
Other tools: RabbitMQ, NLog, Log4net, Elastic, Logstash, DevXpress,
Netflix Ribbon, Esendex, Mandrill, Hazelcast,ReactiveRX Netty, Angular JS, webpack, nginx, Awaitility, Groovy on Grails,
Jedis,CSS, HTML, wsdl, xslt, JEXEL, SoapUI, AccuRev,NodeJS, Twitter Bootstrap, RequireJS