Hide
public struct Hide : NavigationSideEffect
extension Hide: CustomDebugStringConvertible
Navigation action used to ask the Navigator
to hide a specific screen
identified by the identifierToHide
.
The ViewController
that is managing that screen must implement RoutableWithConfiguration
or Routable
in order to be identified with a matching Routable.routeIdentifier
.
-
The identifier of the
Routable
to be hiddenDeclaration
Swift
public let identifierToHide: RouteElementIdentifier
-
Specify if the
Hide
should be animatedDeclaration
Swift
public let animated: Bool
-
The context of the
Hide
Declaration
Swift
public let context: Any?
-
Specify if the Hide should generate one single navigation request. For instance, if we have a Route like
A/B/C/D
and we ask to hideB
, withatomic = false
, three different Hide commands will be generated: the request to hide D, then the request to hide C and finally the request to hide B. If we useatomic = true
, only the request to hide B will be generated.Declaration
Swift
public let atomic: Bool
-
Initializes and returns a Hide action.
Declaration
Swift
public init(_ identifierToHide: RouteElementIdentifier, animated: Bool = false, context: Any? = nil, atomic: Bool = false)
-
Initializes and returns a Hide action.
Declaration
Swift
public init<K>(_ identifierToHide: K, animated: Bool = false, context: Any? = nil) where K: RawRepresentable, K.RawValue == RouteElementIdentifier
-
Initializes and returns a Hide action.
Declaration
Swift
public init<K>(_ identifierToHide: K, animated: Bool = false, context: Any? = nil, atomic: Bool = false) where K: RawRepresentable, K.RawValue == RouteElementIdentifier
-
Initializes and return a Hide action.
Declaration
Swift
public init(animated: Bool = false, context: Any? = nil, atomic: Bool = false)
-
The side effect of the action, look into Katana to know what a
SideEffect
is.Declaration
Swift
public func anySideEffect(_ context: AnySideEffectContext) throws -> Any
-
Declaration
Swift
public var debugDescription: String { get }


Ruby is extermely similar in syntax compare to JavaScript. Don't forget tough Ruby is a server-sdie language, meaning that it doesn't run on the browser like JavaScript. It runs on the server. You do not have specifiy a variable type.
a = "Joe";Try converting a simple function.
function myFunction(){
alert("test");
}
def myFunction()
print("Test")
end #ending tags are required in Ruby.
Ruby lists are also written just like JavaScript
myList = [1,"Apples"]
puts myList[0]
#prints out 1
for i in myList do
pus i
end
This is what Ruby conditionals look like
x = 5
if x > 2
puts "x is greater than 2"
elsif x <= 2 and x!=0
puts "x is 1"
else
puts "Don't know"
end
Little bit of OOP with Ruby
class Dog
def initialize()
@age=24 #@this is an instance variable
end
def getAge
return @age
end
end
myDog = Dog.new
print(myDog.getAge())
Let's parse a file with Ruby and add some logic to make it useful. You can get into the Ruby command line by typing
>>irb
and than start writing code. Exit the command line by
exit()
or create a file with the extension "myfile.rb". Get this file executing by typine
>>ruby myfile.rb
Follow me here


ATTN:President/Ceo Business Proposal, > > DEAR SIR, > > I am the manager of bills and exchange at the > foreignremittance > department of the ECOBANK Nigeria. I am writing this > letter to ask > foryour support and co-operation to carry out this > business > opportunity in my department. > We discovered an unclaimed sum of US$ 25.5 million > (Twenty-five > million five hundredthousand United States Dollar > only) in an account > that belongs to one of our customers who died a long > with his entire > family in November 1997 in plane crash in > Nigeria.Since we got > information about his death we have been expecting his > next of kin > tocome over and claim his money because we cannot > release the money > unless somebodyapplied for it as the next of kin or > relation to the > deceased as indicated in ourbanking guidelines. > > Rightaway,neither the family member nor the > relationhas appeared to > claim this money, at this discovery another official > and I in > thedepartment now decide to do business with you as > the next of kin > or relation of thedeceased for safety and sequent > disbursement since > nobody is coming for it and wedon't want this money to > go into the > bank treasure as an unclaimed debt. The bankinglaw and > guidelines of > the ECOBANK Nigeria stipulates that if such money > remained > unclaimedfor a period of four (5) years it will be > transferred into > the ECOBANK treasury asunclaimed fund. The need for a > foreigner as > next of kin in this business is occasionedby the fact > that the > customer was a foreigner and cannot stand as his next > of kinor heir. > > We agreed that 25% of the money will be for youas the > foreign > partner, thereafter my colleague and I will visit your > country > fordisbursement according to the percentage indicated. > Therefore to > enable the immediatetransfer of the fund to you as > indicated.You must > apply to the bank as relation ornext of kin of the > decreased, > indicating your bank account number and location > wherein the money > will be remitted. Upon receipt of response, I will > send to you by > fax the Application Form. As soon as you receive this > letter you > should contact me immediatelyand indicate your direct > and > confidential telephone and fax number for effective > communication.Trusting to hear from you immediately. > Yours faithfully, > MD.OBINA OKORO. ------------------------------------------------------------ http://Game.37.com/ <--- Free Games http://newJoke.com/ <--- J O K E S ! ! ! --------------------------------------------------------------------- Express yourself with a super cool email address from BigMailBox.com. Hundreds of choices. It's free! http://www.bigmailbox.com ---------------------------------------------------------------------


It may seem overwhelming, chartering a cruise to our private island, but fear not, we have travel arrangements set up with popular airlines, such as:
But what if you're not on those airlines? Don't worry, we've got ypu cpvered!
Our neighboors over at Palph's guided cruise missle systems will personally strap you onto an MAT-153 guided missile with the desination being out luxourious beaches!


Eosinophil priming by cytokines: from cellular signal to in vivo modulation.
Abstract
Eosinophils play an important role in the effector phase of allergic inflammation. This review will focus on the conversion of the unprimed eosinophil phenotype in the peripheral blood of normal individuals to the primed phenotype found in the peripheral blood and tissues of allergic patients, a phenomenon called priming. Recent data on the signals initiated after cytokine receptor activation on eosinophils will be reviewed.


Room Assignments For Building
|
Helpful Information This page allows you to view room assignments for a building. For this building, all assignments whose begin dates or end dates fall between the begin and end dates you selected will be displayed. Also, if you select an assignment status, only those assignments having the selected status are displayed. Sorting:- You may sort a list of assignment by any heading in ascending or descending order. - When the list is first displayed, the assignments are sorted by student name in ascending order. |
Room Assignments For Selected Building And Term (10 Sample Assignments)
| Room | Student | Term | Begin Date | End Date | Assignment Status | Rate Code | Class Standing | Age | DoB | Email Address | Emergency # | Room Capacity | Mailbox | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 101 | Wegener, Mervin [000123456] | Fall Semester 2016 | August 21, 2016 | January 7, 2017 | Active dorm assignment | M2TY | Sophomore | 20 | January 1, 1996 |<EMAIL_ADDRESS>|<PHONE_NUMBER> | 2 | B | |
| 101 | Briscoe, Frederick [000123456] | Fall Semester 2016 | August 21, 2016 | January 7, 2017 | Active dorm assignment | M2TY | Sophomore | 20 | January 1, 1996 |<EMAIL_ADDRESS>|<PHONE_NUMBER> | 2 | A | |
| 102 | Janda, Alan [000123456] | Fall Semester 2016 | August 21, 2016 | January 7, 2017 | Active dorm assignment | M2TY | Sophomore | 20 | January 1, 1996 |<EMAIL_ADDRESS>|<PHONE_NUMBER> | 2 | A | |
| 102 | Stanton, Bobby G. [000123456] | Fall Semester 2016 | August 21, 2016 | January 7, 2017 | Active dorm assignment | M2TY | Sophomore | 20 | January 1, 1996 |<EMAIL_ADDRESS>|<PHONE_NUMBER> | 2 | A | A |
| 103 | Carpenter, Willie L [000123456] | Fall Semester 2016 | August 21, 2016 | January 7, 2017 | Active dorm assignment | M2TY | Sophomore | 20 | January 1, 1996 |<EMAIL_ADDRESS>|<PHONE_NUMBER> | 2 | A | A |
| 103 | Morris, Gary [000123456] | Fall Semester 2016 | August 21, 2016 | January 7, 2017 | Active dorm assignment | M2TY | Sophomore | 20 | January 1, 1996 |<EMAIL_ADDRESS>|<PHONE_NUMBER> | 2 | B | |
| 104 | Pascual, Mark [000123456] | Fall Semester 2016 | August 21, 2016 | January 7, 2017 | Active dorm assignment | M2TY | Sophomore | 20 | January 1, 1996 |<EMAIL_ADDRESS>|<PHONE_NUMBER> | 2 | B | |
| 104 | Amin, Grant [000123456] | Fall Semester 2016 | August 21, 2016 | January 7, 2017 | Active dorm assignment | M2TY | Sophomore | 20 | January 1, 1996 |<EMAIL_ADDRESS>|<PHONE_NUMBER> | 2 | A | |
| 105 | Heffernan, Luis [000123456] | Fall Semester 2016 | August 21, 2016 | January 7, 2017 | Active dorm assignment | M2TY | Sophomore | 20 | January 1, 1996 |<EMAIL_ADDRESS>|<PHONE_NUMBER> | 2 | B | |
| 106 | Sampson, John [000123456] | Fall Semester 2016 | August 21, 2016 | January 7, 2017 | Active dorm assignment | M2TY | Sophomore | 20 | January 1, 1996 |<EMAIL_ADDRESS>|<PHONE_NUMBER> | 2 | A |


-
requestId
String requestId
The unique identifier for the service request the caller made.
-
errorCode
String errorCode
The error code represented by this exception (ex: InvalidParameterValue).
-
resource
String resource
-
errorType
ServiceException.ErrorType errorType
Indicates (if known) whether this exception was the fault of the caller or the service.
- 另请参阅:
ServiceException.ErrorType
-
statusCode
int statusCode
The HTTP status code that was returned with this error
-
serviceName
String serviceName
The name of the service that sent this error response.


K-Pop star Goo Hara found dead at her Seoul home
She made her debut in 2008 as a member of the girl group Kara
by APK-pop star and TV celebrity Goo Hara was found dead at her home in Seoul on November 24, police said.
Police said an acquaintance found the 28-year-old dead at her home in southern Seoul and reported it to authorities. The cause of death wasn’t immediately known. Police refused to provide further details.
Goo made her debut in 2008 as a member of the girl group Kara, which had big followings in South Korea, Japan and other Asian countries. She later worked as a solo artist and appeared on many TV shows.
In May, Goo was reportedly found unconscious at her home and was hospitalized.
She was embroiled last year in public disputes with an ex-boyfriend who claimed to be assaulted by her. Goo accused the man of having threatened to circulate a sex video of her. The case made her the subject of tabloid fodder and malicious online messages.
In October, another K-pop star and actress, Sulli, was found dead at her home near Seoul. The 25-year-old was known for her feminist voice and outspokenness that was rare among female entertainers in deeply conservative South Korea. Before her death, she appeared in a TV show and spoke out against online backlash she received over her lifestyle.


At the start of this test, i = 0. Tapping the first button will increment i and trigger an alert with the text 'Alert #' + i.
i = 0
i
'Alert #' + i
Tapping on the second button should have absolutely no effect, but in iOS 4-6 it will re-trigger the alert.


There are some differences that make us who we are and what makes us different, would you like to take a look?
All FeaturesWP Aero provides a high level of performance from the first start up.
WP Aero has a material design and dozens of amazing themes, creative designs, different emoji styles, bubble style and tick style.
WP Aero does not store any personal data on our server. Your data is always protected under WP security.
WP Aero allows you to get help from our Telegram group with a link from within the application for superior support compared to other WP mods.


--- layout: default ---
I am a 3rd year undergraduate in Computer Science and Engineering at Indian Institute of Technology (BHU), Varanasi. My field of interest lies in Artificial Intelligence and its applications, particularly in Computer Vision, Robotics and Neuroscience.
Click here for the script to convert other photos.
Object recognition is the task of identifying the different objects in a photograph. In this project I have currently implemented SIFT in MATLAB, and applied CNN to image classification problem. Future plan is to include context in the object recognition framework
A text summarizer is a software that automatically constructs a concise summary from a given text. The summary so constructed, is supposed to contain all the salient points of the original text. This summarizer is based on an incremental extractive, query specific, graph based, summary generation model. The summarizer is implemented in Python and uses NLTK.
This is a working digital simulation of a simple 8-bit CPU complete with an ALU, Control Unit and conditional branching. All the setup is done on Logisim.
This program is a toy version of a database engine like MySQL, written in C++. The engine follows a language similar to Relational Algebra and processes all tables in memory.
This web app is a feedback portal that allows students to fill their feedbacks for the courses in which they were enrolled and the instructors to view the feedbacks given to their courses. The app is made using Django framework with a MySQL database.
This project illustrates the functional-projective synchronization and anti-synchronization between two chaotic systems, namely Lorenz and Rossler systems.


optionaly, please include subadress to be used (excluding first slash):
Test of HTTP GET verb:
none
Test of HTTP POST verb:
Test of HTTP PUT verb:
Test of HTTP UPDATE verb:
Test of HTTP DELETE verb:


01/21/12 MonkeyWrench Books Benefit Show with RainbowDragonEyes & ATX Noise
Saturday the 21st, come get an earful of all the square waves you can possibly handle at MonkeyWrench books! This event has a suggested donation of $5 at the door, but we’d like you to COCK out with us, no matter what you can give! No one turned away for any reason. The following musicians, touring and local, are helping us throw a benefit concert to keep MonkeyWrench Books going strong and part of the donations will support the artists: RainbowDragonEyes — On Tour! Peter Swimm - Austin, TX Yatagarasu — Austin, TX I, Cactus — Austin, TX Yoshi Eat Da Mawio — Austin, TX When Saturday, January 21, 2012 8:00pm until 11:30pm MonkeyWrench Books 110 E North Loop, Austin, TX 78751 RSVP


This Privacy Policy governs the manner in which Kinetoscope collects, uses, maintains and discloses information collected from users (each, a "User") of the http://kinetoscope.herokuapp.com/ website ("Site"). This privacy policy applies to the Site and all products and services offered by Kinetoscope.
We may collect personal identification information from Users in a variety of ways, including, but not limited to, when Users visit our site, register on the site, and in connection with other activities, services, features or resources we make available on our Site. Users may be asked for, as appropriate, name, email address. Users may, however, visit our Site anonymously. We will collect personal identification information from Users only if they voluntarily submit such information to us. Users can always refuse to supply personally identification information, except that it may prevent them from engaging in certain Site related activities.
We may collect non-personal identification information about Users whenever they interact with our Site. Non-personal identification information may include the browser name, the type of computer and technical information about Users means of connection to our Site, such as the operating system and the Internet service providers utilized and other similar information.
Our Site may use "cookies" to enhance User experience. User's web browser places cookies on their hard drive for record-keeping purposes and sometimes to track information about them. User may choose to set their web browser to refuse cookies, or to alert you when cookies are being sent. If they do so, note that some parts of the Site may not function properly.
Kinetoscope may collect and use Users personal information for the following purposes:
We adopt appropriate data collection, storage and processing practices and security measures to protect against unauthorized access, alteration, disclosure or destruction of your personal information, username, password, transaction information and data stored on our Site.
Sensitive and private data exchange between the Site and its Users happens over a SSL secured communication channel and is encrypted and protected with digital signatures.
We do not sell, trade, or rent Users personal identification information to others. We may share generic aggregated demographic information not linked to any personal identification information regarding visitors and users with our business partners, trusted affiliates and advertisers for the purposes outlined above.We may use third party service providers to help us operate our business and the Site or administer activities on our behalf, such as sending out newsletters or surveys. We may share your information with these third parties for those limited purposes provided that you have given us your permission.
Users may find advertising or other content on our Site that link to the sites and services of our partners, suppliers, advertisers, sponsors, licensors and other third parties. We do not control the content or links that appear on these sites and are not responsible for the practices employed by websites linked to or from our Site. In addition, these sites or services, including their content and links, may be constantly changing. These sites and services may have their own privacy policies and customer service policies. Browsing and interaction on any other website, including websites which have a link to our Site, is subject to that website's own terms and policies.
Ads appearing on our site may be delivered to Users by advertising partners, who may set cookies. These cookies allow the ad server to recognize your computer each time they send you an online advertisement to compile non personal identification information about you or others who use your computer. This information allows ad networks to, among other things, deliver targeted advertisements that they believe will be of most interest to you. This privacy policy does not cover the use of cookies by any advertisers.
Some of the ads may be served by Google. Google's use of the DART cookie enables it to serve ads to Users based on their visit to our Site and other sites on the Internet. DART uses "non personally identifiable information" and does NOT track personal information about you, such as your name, email address, physical address, etc. You may opt out of the use of the DART cookie by visiting the Google ad and content network privacy policy at http://www.google.com/privacy_ads.html
Kinetoscope has the discretion to update this privacy policy at any time. When we do, we will revise the updated date at the bottom of this page. We encourage Users to frequently check this page for any changes to stay informed about how we are helping to protect the personal information we collect. You acknowledge and agree that it is your responsibility to review this privacy policy periodically and become aware of modifications.
By using this Site, you signify your acceptance of this policy. If you do not agree to this policy, please do not use our Site. Your continued use of the Site following the posting of changes to this policy will be deemed your acceptance of those changes.


Welcome!
My name is Jack, a tech enthusiest who loves the art of web design and IT network infrastructures as well as a bit of photography.
Photography
Check out some pictures that I took!
See more
Raspberry Pi Projects
Check out my Pi projects!
See more
College studies
My college work.
See more
More about me
I'm a very tech-savvy dude.
See more


Home
(current)
Register
Recharge
My Account
View Offer
Contact
Previous
Next
Phonic Wireless Simply Best
We Tripled our LTE Coverage
HOLIDAY DEAL
Get our unlimited plan with iPhone XR included.
Just $40/line.


Index
Sources
All sources use in this project
Articles
How to set up Webpack 5, ES6 with ESLint, PostCSS with Stylelint, CSSNANO and more!
Static website, multiple html pages, using Webpack + example on Github
A simple webpack 4 starter project for your basic web development needs.
How to Bundle a Simple Static Site Using Webpack
Webpack Documents
Production
Loaders
Entry Points
Development Server
Plugins
Tailwind
Homepage with Docs
Preprocessors (Import, Nesting)


{% extends "layout-apply-ni-number.html" %} {% block page_title %} Question page {% endblock %} {% block content %} Back {% include "includes/reason-to-check.html" %} {% include "includes/things-to-check.html" %} You can prove who you are using GOV.UK Verify. If you have not used GOV.UK Verify before, it will take you about 15 minutes to get set up. You can access other government services securely wherever you see the GOV.UK Verify logo. GOV.UK Verify {% endblock %}
You can prove who you are using GOV.UK Verify. If you have not used GOV.UK Verify before, it will take you about 15 minutes to get set up. You can access other government services securely wherever you see the GOV.UK Verify logo.
GOV.UK Verify


Welcome to my page.
I am currently a Postdoctoral Fellow in the group of Wolfgang Huber at the
European Molecular Biology Laboratory (EMBL) Heidelberg, Germany, and a visiting
Postdoctoral Fellow in the group of Jan Kosinski at the
European Molecular Biology Laboratory (EMBL) Hamburg, Germany. My
research projects focus on cancer proteomics and metabolomics.


Vue Router Examples
Basic
Mode: 'hash'
Nested Routes
Named Routes
Named Views
Route Matching
Active Links
Redirect
Route Props
Route Alias
Route Params
Router errors
Transitions
Data Fetching
Navigation Guards
Scroll Behavior
Lazy Loading
Auth Flow
Discrete Components
Nested Routers
Keepalive View
Multiple Apps
Restart App


# WEEK 11
*Full-Stack Applications (Part 1)* {ignore=true}
________________________________________________________________________________
[**Regular Expressions Learning Objectives**](#regular-expressions-learning-objectives)
[**HTTP Full-Stack Learning Objectives**](#http-full-stack-learning-objectives)
- [**The Uniform Resource Locator (URL)**](#the-uniform-resource-locator-url)
- [The specification](#the-specification)
- [What is this "resource" thing?](#what-is-this-resource-thing)
- [The components of a URL](#the-components-of-a-url)
- [Reading RFCs](#reading-rfcs)
- [**Regular Expressions Cheat Sheet**](#regular-expressions-cheat-sheet)
- [The * operator](#the-operator)
- [The ? operator](#the-operator-1)
- [The + operator](#the-operator-2)
- [The . operator](#the-operator-3)
- [The ^ operator without brackets](#the-operator-without-brackets)
- [The $ operator](#the-operator-4)
- [The [] bracket expression](#the-bracket-expression)
- [*RegexOne Practice*](#regexone-practice)
- [*HTTP Full-Stack Project*](#http-full-stack-project)
[**Express Learning Objectives**](#express-learning-objectives)
[**Pug Template Learning Objectives**](#pug-template-learning-objectives)
- [**Moving Into the Express Lane**](#moving-into-the-express-lane)
- [Installing Express](#installing-express)
- [Creating an Express application](#creating-an-express-application)
- [Handling requests](#handling-requests)
- [Listening for HTTP connections](#listening-for-http-connections)
- [Testing your application](#testing-your-application)
- [**Templating - *Meet Pug!***](#templating-meet-pug)
- [What is a template?](#what-is-a-template)
- [Rendering a simple template](#rendering-a-simple-template)
- [**Digging Into the Pug Template Syntax**](#digging-into-the-pug-template-syntax)
- [Setting up a sandbox application](#setting-up-a-sandbox-application)
- [Rendering elements](#rendering-elements)
- [Setting element attribute values](#setting-element-attribute-values)
- [Rendering data](#rendering-data)
- [Iteration and conditionals](#iteration-and-conditionals)
- [**Exploring Route Paths**](#exploring-route-paths)
- [Getting data from a path](#getting-data-from-a-path)
- [Defining flexible route paths](#defining-flexible-route-paths)
- [Redirecting "incorrect" requests](#redirecting-incorrect-requests)
- [**Express Routers**](#express-routers)
- [Setting up the initial project](#setting-up-the-initial-project)
- [Defining a collection of route handlers](#defining-a-collection-of-route-handlers)
- [Mounting a Router instance](#mounting-a-router-instance)
- [*Routing Roundup Project*](#routing-roundup-project)
[**HTML Forms Learning Objectives**](#html-forms-learning-objectives)
- [**HTML Forms: An Introduction**](#html-forms-an-introduction)
- [Key components of a form](#key-components-of-a-form)
- [Submitting the form](#submitting-the-form)
- [**HTML Forms in Express**](#html-forms-in-express)
- [Forms example setup](#forms-example-setup)
- [Getting the "Add Guest" form](#getting-the-add-guest-form)
- [A quick aside: Pug layout templates](#a-quick-aside-pug-layout-templates)
- [Submitting the guest form](#submitting-the-guest-form)
- [**Data Validation**](#data-validation)
- [Importance of server-side data validation](#importance-of-server-side-data-validation)
- [Server-side validations](#server-side-validations)
- [Server-side validations: an example](#server-side-validations-an-example)
- [**Express Middleware**](#express-middleware)
- [Middleware overview](#middleware-overview)
- [Data validations with middleware](#data-validations-with-middleware)
- [**Protecting forms from CSRF**](#protecting-forms-from-csrf)
- [CSRF explained](#csrf-explained)
- [Preventing CSRF](#preventing-csrf)
- [*Formative Forms Project*](#formative-forms-project)
[**Data-Driven Web Sites Learning Objectives**](#data-driven-web-sites-learning-objectives)
- [**Acclimating to Environment Variables**](#acclimating-to-environment-variables)
- [What are environment variables?](#what-are-environment-variables)
- [Setting and getting environment variable values](#setting-and-getting-environment-variable-values)
- [Storing environment variables in a `.env` file](#storing-environment-variables-in-a-env-file)
- [Using a module to organize environment variables](#using-a-module-to-organize-environment-variables)
- [**Asynchronous Route Handlers in Express**](#asynchronous-route-handlers-in-express)
- [Calling asynchronous functions or methods within route handlers](#calling-asynchronous-functions-or-methods-within-route-handlers)
- [Reducing boilerplate code](#reducing-boilerplate-code)
- [**Handling Errors in Express**](#handling-errors-in-express)
- [Setting up an example Express application](#setting-up-an-example-express-application)
- [The default error handler in Express](#the-default-error-handler-in-express)
- [Defining a custom error handler](#defining-a-custom-error-handler)
- [Handling "Page Not Found" errors](#handling-page-not-found-errors)
- [*Data-Driven Websites (Part 1: Setting Up the Project)*](#data-driven-websites-part-1-setting-up-the-project)
- [*Data-Driven Websites Project (Part 2: Integrating Sequelize with Express)*](#data-driven-websites-project-part-2-integrating-sequelize-with-express)
- [*Data-Driven Websites Project (Part 3: Using Sequelize to Perform CRUD Operations)*](#data-driven-websites-project-part-3-using-sequelize-to-perform-crud-operations)
________________________________________________________________________________
________________________________________________________________________________
# WEEK-11 DAY-1
*Node HTTP Servers* {ignore=true}
________________________________________________________________________________
# Regular Expressions Learning Objectives
Regular expressions are a delight and a nightmare. They please and they
confound. They are an important part of every developer's toolbox. By the time
you finish this, you should be able to
* Define the effect of the * operator and use it in a regular expression
* Define the effect of the ? operator and use it in a regular expression
* Define the effect of the + operator and use it in a regular expression
* Define the effect of the . operator and use it in a regular expression
* Define the effect of the ^ operator and use it in a regular expression
* Define the effect of the $ operator and use it in a regular expression
* Define the effect of the [] bracket expression and use it in a regular
expression
* Define the effect of the - inside brackets and use it in a regular expression
* Define the effect of the ^ inside brackets and use it in a regular expression
________________________________________________________________________________
# HTTP Full-Stack Learning Objectives
Understanding how Node.js handles incoming HTTP requests using the
`IncomingMessage` and `ServerResponse` objects provide a strong foundation of
being able to predict problems when you use frameworks to ease the burden of
writing Web applications. When you complete the associated material for this
lesson, you should be able to:
* Identify the five parts of a URL
* Identify at least three protocols handled by the browser
* Use an `IncomingMessage` object to
* access the headers sent by a client (like a Web browser) as part of the HTTP
request
* access the HTTP method of the request
* access the path of the request
* access and read the stream of content for requests that have a body
* Use a `ServerResponse` object to
* write the status code, message, and headers for an HTTP response
* write the content of the body of the response
* properly end the response to indicate to the client (like a Web browser)
that all content has been written
________________________________________________________________________________
# The Uniform Resource Locator (URL)
We use URLs all the time. Now, it's time to really understand how they work.
From this reading, you should be able to
* Recall where to find the definition of a URL,
* Identify and recall the five components of a URL, and
* Identify properly formatted URLs
## The specification
Almost all good things that define how the Internet works has one or more things
called IETF RFCs which define how they work. There are two acronyms there:
* **IETF**: Internet Engineering Task Force
* **RFC**: Request For Comments
The IETF is an open standards organization that creates voluntary standards to
maintain and improve the usability and interoperability of the Internet. Things
like the way travels across the Internet is created an maintained by the IETF.
In particular, the _Simple Mail Transfer Protocol_ is now governed by [RFC
5321]. RFC 5321 made obsolete RFC 2821 which, in turn, made obsolete RFC 821.
The IETF is always working to make the Internet better with respect to its
growth and usage.
An RFC is a document usually created by programmers, engineers, and scientists
in the form of a memorandum. They publish the RFC for peer review. When enough
people have reviewed it, and it seems worthy of adoption, the IETF will change
its status to "Internet Standard" which means that everyone should comply with
it if they implement that standard.
The [RFC 3986], _Uniform Resource Identifier (URI): Generic Syntax_, is an
"Internet Standard". That means that software applications that use URLs need to
conform to the specification found in that document lest they be publicly shamed
by computer programmers trying to use the non-conforming software.
## What is this "resource" thing?
Well, the standard doesn't do much for you in providing a definition of this
word "resource".
> This specification does not limit the scope of what might be a resource;
> rather, the term "resource" is used in a general sense for whatever might be
> identified by a URI. Familiar examples include an electronic document, an
> image, a source of information with a consistent purpose (e.g., "today's
> weather report for Los Angeles"), a service (e.g., an HTTP-to-SMS gateway),
> and a collection of other resources. A resource is not necessarily accessible
> via the Internet; e.g., human beings, corporations, and bound books in a
> library can also be resources. Likewise, abstract concepts can be resources,
> such as the operators and operands of a mathematical equation, the types of a
> relationship (e.g., "parent" or "employee"), or numeric values (e.g., zero,
> one, and infinity).
That influence comes from one of the authors, Dr. Roy Fielding. He has some
strong ideas about how the Internet works and, much to his disappointment, it
continues to move away from his ideals.
For your purposes, a URL points to a (hopefully) accessible resource that can
be accessed, like HTML, CSS, JavaScript, and pure data in the form of JSON.
## The components of a URL
In Section 3, _Syntax Components_, of RFC 3986 contains this helpful ASCII art
graphic to show you the components of a URL.
```
foo://example.com:8042/over/there?name=ferret#nose
\_/ \______________/\_________/ \_________/ \__/
| | | | |
scheme authority path query fragment
```
Here's an explanation of each of those components.
### The "scheme" of a URL
This section used to be called "the protocol", but was updated when URLs became
part of a larger family known as URIs, Uniform Resource Identifiers, which is
what RFC 3986 actually covers.
You've actually used three schemes already in class! Can you remember them?
If you replied "http" and "https", that's right! When you type an authority in
the browser, like "duckduckgo.com" or "localhost:3000", the browser _assumes_ that
you want to use HTTP, so it prepends that scheme to the authority. The browser
would then make requests to "http://duckduckgo.com" or "http://localhost:3000".
When you double click on an HTML file and it opens locally in your browser, that
is using the "file" scheme, meaning that it is looking for a file local to the
computer! You've done this countless times during this course. You may have
noticed the "file" part in the address bar. That's the scheme it used to access
local files as opposed to making an HTTP request.
This is why it was once named "protocol", because it was the protocol that the
browser would use to _locate the resource_ using a Uniform Resource Locator.
### Stuff between the scheme and authority
The standard tells us that for URLs that have an authority, the characters "://"
must exist between the scheme and the authority. That's why you have to type
those characters. You can blame Sir Tim Berners-Lee for that because he defined
it in the original RFC for this subject, RFC 1738, _Uniform Resource Locators
(URL)_.
### The authority
This part of as URL is normally the domain name of the resource that has the
resource that you're trying to access.
Sometimes it has a port number, too, like when you start a local HTTP server
with Node.js. Then, you type "http://localhost:3000". The authority is the
entire "localhost:3000". That means that, even if "http://localhost:3000" and
"http://localhost:8081" return the exact same content, they're considered to be
two different URLs to the same content.
### The path
Paths are in the first part of an HTTP request, if you recall. When you click on
a link in your browser that takes you to "https://duckduckgo.com/about", that
results in an HTTP request that begins with the following line:
```
GET /about HTTP/1.1
```
That's the path.
If the path is omitted from a URL, it is assumed to be "/".
### The query
This is extra information sent to the browser meant for the processing of the
request. For example, when you go to DuckDuckGo and perform a search for "RFC
3986" by typing it into the search box, the URL that your browser is directed to
reads "https://duckduckgo.com/?q=RFC+3986".
The question mark and everything that comes after it (up to the _fragment_) is
considered the "query" of the URL. Because it's part of the URL, it means that
different values of the query part of the URL points to different resources even
if the exact same content is returned.
With respect to URLs used for the World Wide Web, queries generated by browsers
(and possibly by your code) will have the following format:
* Entries in the query are "URL encoded" key-value pairs with an equal sign
between them
* Entries are concatenated with the ampersand symbol
When the key or value of an entry in a query contains a character that is not
one of the reserved or unreserved characters, then it gets "URL encoded". That
process replaces each character a percent sign and its hexadecimal [ASCII Code].
For example, when your provide the value "Mary$quite/contrary" for your query
in DuckDuckGo, the browser "URL encodes" the "$" and "/" because those
aren't allowable characters. Those characters' ASCII Code values are 24 and 2F,
respectively. That transforms the string to "Mary%24quite%2Fcontrary".
Luckily, JavaScript has built-in methods called `encodeURI` ([link][link to
encodeURI]) and `decodeURI` ([link][link to decodeURI]) that handles that transformation for you!
### The fragment
The fragment is never sent to the server. Instead, it tells the browser to
access a specific section of the page after it loads. For example, if you look
at the following link
https://en.wikipedia.org/wiki/URL#Protocol-relative_URLs
you can see that there is a fragment value of "#Protocol-relative_URLs". If you
click on that link, the browser will load that page and, then, scroll that
section into view for you.
Unlike with changing values in _any_ of the other sections, if you change the
value in the fragment, the browser will _not_ reload the page.
## Reading RFCs
Unfortunately, RFCs tend to be very unappealing and technical, not fun to read
at all. However, you should try reading them when you have a question about how
something works that's governed by the IETF. You will gain insight that only
comes from technical documentation.
As a side note, it is a common thing for programmers to publish April Fool's
RFCs. Their sense of humor is ... shockingly technical and dry. Here are some
interesting ones, for example.
* [Hypertext Jeopardy Protocol (HTJP/1.0)]
* [Design Considerations for Faster-Than-Light (FTL) Communication]
* [TCP Option to Denote Packet Mood]
Yep, that's the kind of humor in deeply computer science-y groups.
¯\\(◉◡◔)/¯
## What you've learned
You learned that the five parts of a URL are
1. The scheme (required),
2. The authority (required),
3. The path (optional),
4. The query (optional), and
5. The fragment (optional, not sent to the server).
You were reminded that you actually know three schemes: http, https, and file.
And, that's it for URLs. :-)
[RFC 3986]: https://tools.ietf.org/html/rfc3986
[RFC 5321]: https://tools.ietf.org/html/rfc5321
[Hypertext Jeopardy Protocol (HTJP/1.0)]: https://tools.ietf.org/html/rfc8565
[Design Considerations for Faster-Than-Light (FTL) Communication]: https://tools.ietf.org/html/rfc6921
[TCP Option to Denote Packet Mood]: https://tools.ietf.org/html/rfc5841
[ASCII Code]: https://en.wikipedia.org/wiki/ASCII#Character_set
[link to encodeURI]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI
[link to decodeURI]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURI
________________________________________________________________________________
# Regular Expressions Cheat Sheet
This article lists the most commonly-used regular expressions operators. You
can use it as a handy reference for later while you write regular expressions.
## The * operator
The `*` operator is known as the **Kleene Star**, one of the [Kleene operators].
You use the Kleene Star operator to match any number, **zero or more**, of the
character it follows.
For example, take the following regular expression patterns and compare them
with the strings below:
#### Example 1: `xy*z`
Matches:
```
xxz
xyyyzzz
```
Does not match:
```
yyy
xyxz
```
#### Example 2: `x*yz`
Matches:
```
xxyz
yyyzzz
```
Does not match:
```
xxx
xyyz
```
#### Example 3: `xyz*`
Matches:
```
xy
xxyzzz
```
Does not match:
```
zzz
xyyz
```
## The ? operator
The question mark operator denotes that the character preceding `?` is an
[optional character]. Note that when you want to use a normal question mark as a
normal character and NOT as a regular expression operator, you need to escape
the character with a forward slash like `\?`.
Take the following pattern and compare it with the strings below. Notice how
the `s?` portion of the expression makes the "s" character optional, allowing
the pattern to match both "video" and "videos".
#### Example 1: `videos?`
Matches:
```
cat video
dog videos
```
Does not match:
```
bird vids
hedgehog vides
```
#### Example 2: `videos\?`
Matches:
```
dog videos?
videos? hello?
```
Does not match:
```
cat video
videos
```
Note different effect of the regular expression with an escaped question mark
verses a non-escaped question mark.
#### Example 3: `videos? watched\?`
Matches:
```
dog video watched?
cat videos watched?
```
Does not match:
```
bird video watched
hedgehog videos not watched
```
## The + operator
The `+` operator is known as the **Kleene Star Plus**. You use Kleene Star Plus
to match **one or more** of the character it follows, instead of **zero or more**
like the Kleene Star.
For example, take the following regular expression patterns and strings below:
#### Example 1: `xy+z`
Matches:
```
xyyyzzz
xxxyzz
```
Does not match:
```
xxz
xyxz
```
Note how "xxz" is matched by `xy*z` but not by `xy+z`.
#### Example 2: `x+yz`
Matches:
```
xyzzz
xxxyzz
```
Does not match:
```
yzz
xyyz
```
#### Example 3: `xyz+`
Matches:
```
xyzzz
xxyz
```
Does not match:
```
xy
xxy
```
## The . operator
The dot operator matches any **single** character. It acts as a [wildcard] that
can match any single number, letter, symbol, or even whitespace. Like the
question mark operator, in order to use `.` as a normal character instead of a
regular expression operator, you need to escape the character with a forward
slash (`\.`).
Take the example expressions and strings below:
#### Example 1: `..a..`
Matches:
```
12aa3
brains
```
Does not match:
```
123a4
catch
```
#### Example 2: `.at.`
Matches:
```
?att
catch
```
Does not match:
```
1a1t
atss
```
Remember that using a forward slash before a question mark in a regular
expression escapes the question mark so that `?` is not interpreted as a
regular expression operator.
#### Example 3: `...\?`
Matches:
```
123?
????
```
Does not match:
```
123
?cat
```
## The ^ operator without brackets
The `^` operator is known as the hat operator. The hat operator can be used in
two ways:
* Without square brackets to match the start of a line.
* Within square brackets to denote when you want to exclude characters.
When using `^` at the beginning of a regular expression pattern, you are
indicating a match with statements that begin with the characters in your
pattern. Note the case sensitivity in the examples below.
#### Example 1: `^Dog`
Matches:
```
Doggie daycare
Dog food
```
Does not match:
```
doG master
puppy Dog
```
#### Example 2: `^dog`
Matches:
```
doggie
dogs
```
Does not match:
```
hotdog
small dog
```
#### Example 3: `^\?`
Matches:
```
? hello
???
```
Does not match:
```
hi?
\?bye
```
## The $ operator
The dollar sign operator is used to define the end of a line. Like how the `^`
hat operator is used to specifically match the beginning characters of a line,
the `$` dollar sign operator is used to specifically match the end of a line.
Take the following patterns and strings below:
#### Example 1: `smell$`
Matches:
```
doggie smell
doggie has an interesting smell
```
Does not match:
```
doggie smells
doggie is smelling
```
#### Example 2: `dog.$`
Matches:
```
sit, dog.
good dog!
```
Does not match:
```
sit, doggie
dogs.
```
In the example below, the hat and dollar sign operators are used together to
create a pattern that matches the entire "doggie smell" string from beginning
to end.

You can do so by listing out specific characters or using an alphanumeric range.
You can also use the square brackets in conjunction with a hat operator to
exclude characters.
Take the following patterns that include characters in the strings below:
#### Example 1: `[aei]n`
Matches:
```
ban
hen
```
Does not match:
```
undo
on
```
#### Example 2: `robot [0-9]`
Matches:
```
robot 7
brobot 180
```
Does not match:
```
robots 7
robot seven
```
#### Example 3: `\.[dw]`
Matches:
```
.whale
.dog
```
Does not match:
```
.cat
whale
```
### The - inside brackets
You use the dash character to create [character ranges] within square brackets.
Multiple ranges can be set in the same square brackets. For example, the
expression `[A-Za-z0-9_]` is often used to match all alphanumeric characters
in the English language.
Take the following expressions and strings below:
#### Example 1: `[0-5] cats`
Matches:
```
3 cats
33 cats
```
Does not match:
```
336 cats
3cats
```
#### Example 2: `[A-D][l-p][o-s]`
Matches:
```
Apple
Dose
```
Does not match:
```
apple
bone
```
#### Example 3: `[a-z][0-9][A-Z]`
Matches:
```
h4T
bl7XYZ
```
Does not match:
```
h44T
XYZ7bl
```
### The ^ inside brackets
When using `^` inside of square brackets, you are denoting that you want to
[exclude characters]. In order to exclude characters, you need to wrap the
operator and the characters you want to exclude within square brackets.
#### Example 1: `[^b]`
Matches:
```
hog
dog
```
Does not match:
```
bog
blog
```
#### Example 2: `[^bc]at`
Matches:
```
chat
rat
```
Does not match:
```
hat
cat
```
#### Example 3: `[^bc]o[^g]`
Matches:
```
hot
pot
```
Does not match:
```
cog
blog
```
[Kleene operators]: https://regexone.com/lesson/kleene_operators
[optional character]: https://regexone.com/lesson/optional_characters
[wildcard]: https://regexone.com/lesson/wildcards_dot
[exclude characters]: https://regexone.com/lesson/excluding_characters
[character ranges]: https://regexone.com/lesson/character_ranges
________________________________________________________________________________
# RegexOne Practice
________________________________________________________________________________
Just like with Flexbox Froggy and CSS Grid Garden, there are Web sites on the
Internet that really stand out as excellent resources from which to learn.
[RegexOne] is one of those resources.
It is a set of simple interactive exercises to help you practice your new-found
knowledge of regular expressions. Do all of the 15 exercises and eight problems.
![RegexOne home page]
[RegexOne]: https://regexone.com/
[RegexOne home page]: images/regexone-screenshot.png
________________________________________________________________________________
# HTTP Full-Stack Project
In this project, you are going to use Node.js to build a data-driven Web site.
This project already includes the Sequelize models and migrations for you. You
will create a Node.js HTTP server and use it to handle incoming requests from a
browser. Then, you will generate HTML to respond to the request.
Today's project does not address the aesthetics of the visual appearance of the
Web pages. You will have an opportunity later this week to do that. Today is
about _functionality_.
## Project overview
You will build a simple inventory tracking system for managing the amount of
stuff that you have. The Sequelize data model is already created for you because
you now know how to do that pretty well. You'll get to flex those muscles later
this week, too.
You will build the server that accepts incoming HTTP requests using _only_
functionality built into Node.js. You will process the incoming request,
determine what needs to be done, and generate HTML to send back to the client.
This project shows you the underpinnings of how Node.js-based Web applications
work. Then, when you use a framework like Express.js or Koa.js, you will know
what they're doing.
![final app]
### The data model
To focus on the server portion of this, the data model is very simple. It
consists of one entity, the Item. The Item has the following properties.
| Property name | Data type | Constraints |
|---------------|-----------|---------------------|
| name | string | not null, unique |
| description | text | not null |
| imageName | string | |
| amount | integer | not null, default 0 |
### The functionality
You will create two HTML pages, one static and one dynamic. The static HTML page
will consist of a form that allows you to add new items that you want to track.
The dynamic HTML page will list the each item and its details and give you a
way to reduce the amount on hand.
## Get started
* Clone the starter repository from
https://github.com/appacademy-starters/node-web-app-starter. But, this time,
use an extended version of the Git `clone` command to put it in a specific
directory. You will use the same starter project in the next project, too.
```shell
git clone https://github.com/appacademy-starters/node-web-app-starter native-node-app
```
Instead of creating a directory named after the repository,
"node-web-app-starter", this wil create a directory named "native-node-app"
and put the cloned repository into there.
* Change the working directory into "native-node-app"
* Install the npm dependencies
* Create a database user named "native_node_app" with the password
"oMbE4FNk3db2LwFT" and the CREATEDB privilege which will look like
```sql
CREATE USER ... WITH CREATEDB PASSWORD ...
```
You add the CREATEDB in there so you can do the next step and not be bothered
with creating the database yourself
* Run the Sequelize CLI with the `db:create` command to create the database
* Run the Sequelize CLI to migrate the database
* Run the Sequelize CLI to seed the database
## Phase 1: Installing one tool
You will use a development tool to restart the server each time you make a
change to a JavaScript file. This prevents you from having to hit CTRL+C each
time you want to stop and start your server.
The tool is named [nodemon] and is the standard for this type of server
restarting. It is a _development_ tool, so you will install it as a special kind
of dependency, a _development dependency_. You can do that with
```shell
npm install nodemon --save-dev
```
When you deploy your application to production, npm will ignore the development
dependencies because they're not needed when you run your application for other
people to use. Hopefully by that point, your Web application _doesn't restart_!
## Phase 2: Getting the server started
Open the **package.json** file. It specifies that the "main" file for this
project is **server/index.js**. Create a **server** directory and an
**index.js** file in there.
Now, in **package.json**, find the "scripts" section. Add a new entry in there
named "dev" with the value "nodemon server/index.js". It should look like this.
```json
"scripts": {
"dev": "nodemon server/index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
```
That sets up a way to conveniently run the "nodemon" command by typing the
command `npm run dev`. You can run that right now. Because you have an empty
**server/index.js** file, it should report something like this:
```
[nodemon] starting `node server/index.js server/index.js`
[nodemon] clean exit - waiting for changes before restart
```
So, it's just waiting for you to add some code!
To get an HTTP server up and running, you will add code to do the following in
the **server/index.js** file.
* Import the built-in "http" module
* Create a server using the "http" module that returns "I have items" to every
request
* Tell that server to start listening on port 8081
* Print a message when the server is ready to accept incoming messages
Please look at the sample on the [About Node.js®] page. It has all of the code
that you need to get the above done. You'll want to change the port number from
what it uses to 8081. You'll also want to change the text it sends to the
browser from what it reads to "I have items".
See if you can figure that out on your own. You'll know you're done when you
open up your browser to http://localhost:8081/ (or refresh it because it's
already there) and see the following.
![I have items]
## Phase 3: Understand the code
Hopefully, your code looks similar to the following code.
```js
const http = require('http');
const hostname = '<IP_ADDRESS>';
const port = 8081;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('I have items');
});
server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});
```
Just a reminder: the first three variable declarations and the last call to
`listen` are boilerplate code. Every time you write a Node.js server, you would
write the same code over and over. The real meat of the application is in the
callback function that you pass to `createServer`.
```js
(req, res) => {
// The code here is what matters. This is the stuff
// that handles requests from the browser and sends
// content back to it.
}
```
The first parameter is the "request" object and is of type
`http.IncomingMessage` ([link][link to IncomingMessage]). The second parameter is
the "response" object and is of type `http.ServerResponse` ([link][link to
ServerResponse]).
In the code that you wrote, you set the status code of the response to 200 which
means "OK", if you recall. Then, you set the content type of the content of the
response to "text/plain" which means the browser should just show the content
as plain text. Finally, you use the `end` method to send some content _and_ end
the response.
That last part is _very_ important. If you don't end the response, the browser
will just hang, waiting, expecting more from your server.
In this project, you will use more methods and properties of the
`IncomingMessage` and `ServerResponse` objects to get your application working.
 (And more, if you add more.)
A normal thing to do is to translate a URL to a path relative to your
application's root directory. For example, say you typed the following URL into
your browser.
```
http://localhost:8081/images/thread.jpeg
```
It would make sense to have the server send back the content of
**assets/images/thread.jpeg** so the browser can show it. That's what you will
do in this step, but for any of the images.
You'll need a way to read the contents of each file. The modern way to do this
is to use the Promises-based portion of the file system library. At the top of
your **index.js**, import the `readFile` function from the "promises" property
of "fs" library.
```js
const { readFile } = require('fs').promises;
```
You will use the `await` keyword with that function, so you need to change the
signature of the callback method that you pass to the `createServer` method.
Note the addition of the `async` keyword before the parameter list.
```js
const server = http.createServer(async (req, res) => {
```
Again, you will map requests for images to the corresponding file in the
**images** directory. It looks like this.
```
http://localhost:8081/images/filename.ext
\__________________/
|
+------------+
_______|_________
/ \
./assets/images/filename.ext
```
If the image exists, you'll send the contents of the image to the browser. If it
does not, then you will tell the browser that it does not exist by sending a 404
NOT FOUND status code.
### Phase 4a: The happy path
To determine if the path is one that you want, at the top of your `async`
callback, put an if statement that tests if the `req.url` property (which is a
string) starts with "/images/". Replace the comment below to do that.
```js
const server = http.createServer((req, res) => {
if (/* req.url start with "/images" */) {
}
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('I have items');
});
```
If the test passes, that means that `req.url` will contain a string like
"/images/thread.jpeg". That means that you will want to load the file from
"./assets/images/thread.jpeg" which is the concatenation of the string
"./assets" and the value of `req.url`. This code goes inside the `if` block.
```js
const imageFilePath = './assets' + req.url;
const imageFileContents = await readFile(imageFilePath);
```
Notice that you **did not** specify 'utf-8' as part of the `readFile` call.
That's because the content of an image file is **not** UTF-8 encoded text.
Instead, it's binary. This way without the encoding just returns the raw data
that is then sent to the browser.
After that, you need to should set the status code of the response to 200 to
indicate everything is OK. Then, you need to set the content type which takes a
little bit of figuring, so you can delay that for just a moment. Assume that the
browser has requested an image in the JPEG format. Finally, you end the response
by sending the data of the file that you read.
Add this code inside the `if` block after reading the file's contents.
```js
res.statusCode = 200;
res.setHeader('Content-Type', 'image/jpeg');
res.end(imageFileContents);
return;
```
The `return` at the end prevents any other code after it to run, that code at
the bottom that sends back plain text.
You should now be able to see any of the following in your browser!
* http://localhost:8081/images/thread.jpeg
* http://localhost:8081/images/horseshoe.jpeg
* http://localhost:8081/images/lint.jpeg
Most likely, you can also see the following image, too.
* http://localhost:8081/images/gravel.png
That's because browsers are really for giving. Even though you tell the browser
that you are sending JPEG data with the content type "image/jpeg", the browser
inspects the data and figures out it's an image in the PNG format. But, you
should not rely on the forgiveness of the browser. Instead, you should determine
the type of image format the file contains from the file extension, either
".jpeg" or ".png". Then, you send back "image/jpeg" or "image/png" based on the
file extension.
You can use the built-in "path" library to determine the file extension. Then,
you can use that information to send back the correct image format type in the
`setHeader` method.
At the top of the **index.js** file, import the "path" library.
```js
const path = require('path');
```
Here's a link to the "path" library: https://nodejs.org/api/path.html. Find the
method that will extract the file extension from a path. Then, use that in
your code to send back the correct image type.
```js
const fileExtension = /* Use the path library to get the file extension */;
const imageType = 'image/' + fileExtension.substring(1);
res.statusCode = 200;
res.setHeader('Content-Type', imageType); // Use the image type
```
![Proper image type]
Make sure you still see "I have items" when you go to http://localhost:8081.
## Phase 4b: No image found
Try accessing this URL: images/unknown.png. You will see
an error message in your console about an unhandled promise rejection not being
able to open './assets/images/unknown.png'. Worse yet, the browser is just
hanging. That's because this line of code:
```js
const imageFileContents = await readFile(imageFilePath);
```
threw an error, it wasn't handled, and the `end` method never gets called on the
response object. That means the browser just waits and waits and waits.
If you get a request for an image that does not exist, you can just catch this
error and send back a 404 and no content. Replace that single line of code
above with this block of code.
Wrap that line of code above in a `try`/`catch` block. In the `catch` block,
set the status code of the response to 404. Then, just call the `end` method
of the response with no parameters. The last statement of the `catch` block
should be a `return;` statement to prevent other code from running after you
handle this error.
You'll have to fix the declaration of the `imageFileContents` variable so that
it works.
Refresh the browser. You should now get a 404 page when you try to access an
image that does not exist.
Make sure you still see "I have items" when you go to http://localhost:8081.
## Phase 5: Showing a static HTML page
Here's some HTML that shows a form that you will use to add new items to the
database. You will serve this statically. That means you won't change any of
its contents. Instead, you'll just read the file from disk and send it to the
browser.
```html
Welcome Grace Hopper!
``` > Notice how Pug's interpolation syntax `#{expression}` differs from > JavaScript's string template literal interpolation syntax `${expression}`. In > a Pug template, the text to the right of the element name is just plain text, > not JavaScript. ## Iteration and conditionals You can even use dynamic data to control the generation of HTML in your templates. Suppose you pass an array of colors to the `res.render()` method: ```js res.render('layout', { colors: ['Red', 'Green', 'Blue'] }); ``` Using that array of values, you can generate an ordered list: ```pug ul each color in colors li= color ``` Which renders as: ```html


GODZILLA A film review by Matt Williams
RATING: * 1/2* out of * * * *
Call him Godzilla, The Reluctant Lizard. The makers of Independence Day have applied their unique sensibilities to reinventing everyone's favorite big, green, city-stomping reptile. You don't really expect much in the way of plot and/or character development, do you? Good. But in this new incarnation, the scaly fella may be bigger, but he's not very impressive.
Born many years earlier, during French nuclear testing in the South Pacific, Godzilla has chosen this moment to make his public appearance (And why not? This is the Summer Movie Season!) From his South Pacific home, he makes a beeline toward The Big Apple...presumably because of the smell of fish.
Naturally, the military is concerned. They bring in an expert in radiation-induced growth-mutations, Dr. Niko Tatopoulos (Matthew Broderick). He is the stock personality-free scientist who has frequented other Emmerich productions such as Stargate (James Spader), and Independence Day (Jeff Goldblum).
But Dr. Tatopoulos isn't the only character strewn into the path of a giant lizard. No, we are tormented with the presence of his ex-girlfriend, and television reporter hopeful, Audrey Timmonds (Maria Pitillo)...a completely annoying and unsympathetic character. At least she's accompanied by cameraman Victor "Animal" Palotti (Hank Azaria), who gives the film its best Godzilla-induced fear reaction.
On a more entertaining note, the French Secret Service have dispatched crack agent Philippe Roache (Jean Reno) to quietly dispose of the monster. Reno's cool mannerisms and suave style easily make him the most enjoyable character in the film, even if the French jokes are layed on a bit thick.
And then there's the big guy...Godzilla himself. In the original Japanese monster flicks, Godzilla always had sort of a surly attitude (probably the result of an unhappy actor spending too much time in an uncomfortable rubber suit). The new Godzilla, on the other hand, has no attitude whatsoever. He's a personality free lizard, and though you may not spot any zippers in his new incarnation, he's hardly the same ol' creature.
The special effects have obviously improved over the years, and you might think that Godzilla would benefit from the enhanced technology. The answer is yes and no. In redesigning the creature, the filmmakers apparently decided to stay with the "guy in a lizard suit" theme. Although the new creature has been given a good, realistic head, he is also in possession of very human arms and legs. So, even though he's entirely computer generated, you can never quite shake the image of a guy in a suit creeping around a model city.
Every special effects driven movie needs to have some sort of centerpiece scene, a scene which is so impressive that you instantly forget about secondary problems such as plot or characterization. Such a scene is missing from Godzilla. There's only one action sequence, stuck at the end of the film, which comes close (it's derivative and unbelievable, but fun).
You can never expect much from the script for a special effects extravaganza (after all, if the film is done right, no one will ever notice little details like a screenplay), but the script for Godzilla scrapes the bottom of the barrel. Not much makes sense here (for example, why is anyone surprised when the radioactive-mutation expert suggests Godzilla is the result of radioactive-mutation?) and a lot of little details haven't been thought out (why don't the attack helicopters fly above the lizard, rather than at mouth range?) And the characters? Independence Day had a stronger batch, and that's not saying much. Even the so-called humor in the film (the labored Siskel-and-Ebert jokes simply seem bitter) fall flat. No, there's not much here.
If you're looking for a popcorn film, Godzilla may seem to fill the bill. And at the dollar theater, you might be right. But even as low-grade mindless entertainment, Godzilla isn't quite satisfying. You'd get much better entertainment value for your buck by rewatching some of Godzilla's inspirations: Jurassic Park, or even the original Gojira. This Godzilla may be big, but he's an empty shell.
Copyright 1998 Matt Williams
- Matt Williams<EMAIL_ADDRESS>Reviewer for Cinematter: http://www.cinematter.com Home of over 500 reviews, and information on over 600 upcoming releases
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


--- title: "How to Prepare Quick Simple Slow Cooker Pinto Beans and Ham Tasty" slug: simple-slow-cooker-pinto-beans-and-ham description: "Simple Slow Cooker Pinto Beans and Ham Recipe - This is my simple version of pinto beans and ham. It's just a basic recipe with no frills. My husband always enjoys this version. Serve with cornbread. Recipe of Any-night-of-the-week Simple Slow Cooker Pinto Beans and Ham Tasty" date: 2021-05-08T17:11:15Z image: https://cdn.statically.io/img/images.media-allrecipes.com/userphotos/8543419.jpg thumbnail: https://cdn.statically.io/img/images.media-allrecipes.com/userphotos/8543419.jpg cover: https://cdn.statically.io/img/images.media-allrecipes.com/userphotos/8543419.jpg author: Nadia ratingvalue: 4.2 reviewcount: 905 recipeingredient: - "14 cups water, divided" - "2 cups dried pinto beans" - "1 ham bone with meat" - "1 large red onion, chopped" - "2 teaspoons garlic, minced" - "1 teaspoon ham base (such as Better than Bouillon®)" - "1 dash hot pepper sauce (such as Tabasco®), or to taste" - "1 pinch salt and ground black pepper to taste" recipeinstructions: - "Bring 8 cups water and pinto beans to a boil in a large pot. Remove pot from heat, cover, and let stand for 1 hour. Drain and rinse before using." - "Transfer pinto beans to a slow cooker. Add ham bone, red onion, minced garlic, and ham base. Pour in remaining 6 cups of water, or enough to cover the beans." - "Cool on Low until beans are tender, about 8 hours." - "Remove the ham bone, shred meat, and add back to the beans. Discard the bone. Serve hot, seasoned with hot sauce, salt, and pepper." categories: - "Side Dish" - "Beans and Peas" - "Baked Bean Recipes" - "Recipes" tags: - "side dish" - "beans and peas" - "baked bean recipes" katakunci: simple slow cooker pinto beans and ham, side dish, beans and peas, baked bean recipes, . nutrition: 178 calories recipecuisine: Western preptime: "P0DT0H10M" cooktime: "P0DT8H5M" totaltime: "P0DT9H15M" recipeyield: "8 servings" recipecategory: - Side Dish - Beans and Peas - Baked Bean Recipes quotes: If you do not eat well, then you wont be able to think well, love well, and sleep well. ---
Simple Slow Cooker Pinto Beans and Ham - Hello everybody, I hope youre having an incredible day today. Its me again Nadia , welcome to my recipe website. Today, we are going to prepare a distinctive dish, Simple Slow Cooker Pinto Beans and Ham. It is one of my favorites recipes. For mine, Im gonna make it a little bit unique. This is gonna smell and look delicious.
Simple Slow Cooker Pinto Beans and Ham is This is my simple version of pinto beans and ham. It's just a basic recipe with no frills. My husband always enjoys this version. Serve with cornbread.
Simple Slow Cooker Pinto Beans and Ham is one of the most popular of current trending foods on earth. its simple, its quick, it tastes delicious. its enjoyed by millions every day. its easy, its fast, it tastes yummy. Simple Slow Cooker Pinto Beans and Ham is something that I have loved my whole life. They re fine and they look wonderful. They re fine and they look fantastic. Simple Slow Cooker Pinto Beans and Ham is something that I have loved my entire life.
To get started with this particular recipe, we have to first prepare a few components. You can cook Simple Slow Cooker Pinto Beans and Ham using 8 ingredients and 4 steps. Here is how you can achieve that.
So that is going to wrap it up with this exceptional food Simple Slow Cooker Pinto Beans and Ham recipe. Thank you very much for reading. I am sure that you will make this at home. Theres gonna be more interesting food at home recipes coming up. Remember to bookmark this page on your browser, and share it to your family, colleague and friends. Thanks again for reading. Go on get cooking!


A New Development Beginning
I have sat on the fence for quite some time regarding JS MVC, but recently I have been looking to get into it more and I thought, why not focus on Ember.js, it looks pretty cool and tickled my fancy. Then during my day job, Angular was the choice. While I was still on the fence about Angularr, it kept making sense to me and after getting a run through Angular, it clicked with me and has become my choice.
This has really given me a lot of drive for learning Angular. I have believed for a couple of years now that having a light front-end that communicates with a back-end API of some sort, whether that back-end API be running Rails, Nodejs, Laravel or whatever serverside framework you prefer. It makes complete sense as you have this very flexible model to work with. Need a native app, no worries, want to change your front-end easily, no worries, whatever it may be, having this separation allows for a great deal of flexibility which is nice.
So my journey has already begun, watching plenty of videos, soaking them in like a sponge. Now to get my hands dirty.
I do have some thinking/toying to do with changing my workflow a bit, Grunt has been playing a large part, but I think using Yeoman will be the way to go from here on. It brings some great tools together, Bower and Grunt for example.
Time to get cracking!


This JavaScript library is for the OMDb API by Brian Fritz.
Developed by Kory Hutchison
If you'd like to give it a try, download it here:
This section is intended to help anyone understand how to use the omdb.js library in their own code. This library is to help someone wanting to learn more about the API, and to practice with JavaScript Promises. Take a look and see the examples on how to use each function in your own code so you can start using the API in no time!
For the initial setup, you'll want to include the omdb.js file first thing on your HTML page.
This ensures that all the functions and capabilities of the omdb.js file are available to any other
JavaScript files you make after that. In this case, I used a main.js file to handle the rest of my JavaScript.
Also, make sure you put these script tags at the bottom, right after the body
tag.
When you use the library, you'll want to set the API Key right at the beginning of your own JavaScript file by using the Omdb.setApiKey() function. This function can only be used once, so a user can't call this function later to change the key. Because this library is run in JavaScript on the client, it's important to know that your API key WILL NOT be secret. Make sure you only use a free key that you get from the OMDb Website to make it meaningless for someone to use your key. Brian Fritz is hoping to make the api free to everyone eventually, so it won't be an issue then.
The options object is how you send the data to the request. There are tons of options, and you can read about them at the OMDb website. But the way you define them is shown above. Down below in the next section, you can find all the differnt options and which ones work with each function. Just to clarify, the keywords title, imdbid, and searchText will only work with getByTitle, getByImdbId, and findBySearch respectively.
This is the function you will use if you want to get a specific movie based off of a title. It's not a function to use for searches. As you can see it uses a JavaScript Promise to handle the request. If you are not familiar with promises, check out this link here.
Once again, this function is very similar to the getByTitle and getByImdbId functions, however this one returns a JSON object that has an array of results. Usually about 10.
The getPages function is a very useful function if you want to be able to query the API for a certain number of pages via the searchByPageCount function. It takes the same options object as a findBySearch function, but it only returns the number of pages for that specific search. Note: this does not return a Promise.
The searchByPageCount function is useful if you want to query the API to get more than 10 results at a time. The function returns an array of Promise objects that can then be used to display all the results. I wouldn't suggest you do more than 5 pages at a time because the API may not be able to handle that many requests.
Down below is a table that helps clarify which parameters you can pass into the different functions. The functions getPages and searchByPageCount take the same parameters as findBySearch.
| Key | getByTitle | getByImdbId | findBySearch |
|---|---|---|---|
| title | |||
| imdbId | |||
| searchText | |||
| season | |||
| episode | |||
| plot | |||
| page | |||
| type | |||
| year | |||
| returnType | |||
| version |


Police: Hillsboro teen dead in pool after swim practice
HILLSBORO, Ore. (AP) - Police in Hillsboro say a teenager was found dead in a swimming pool after a swim practice.
The Oregonian/OregonLive reported Thursday that the girl drowned at the Shute Park Aquatic & Recreation Center on Wednesday night.
Lifeguards and emergency responders tried to resuscitate her but were unsuccessful.
Further details on the case have not been released, including the teen’s identity, age or what swim team had been practicing.
Information from: The Oregonian/OregonLive, http://www.oregonlive.com
Sign up for Daily Newsletters
Copyright © 2019 The Washington Times, LLC.
Please read our comment policy before commenting.


File Permissions
File permissions are split into three types of access: read, write, and execute. Permissions can also be assigned across three different groups of access: user, group, and public.
The user is the owner of the file. The person who created the file is the default owner. User groups contain multiple users, which all have the same permissions for the file. Others includes everyone who is neither the owner nor in the user group.
The read permission provides the ability open a file to view its contents. The write permission gives you the ability to modify a file. When applied to a directory, this includes adding, removing, and renaming files in the directory. The execute permission allows you to run a file; without it, the program cannot be executed.
Viewing Permissions
You can view the file permissions in the current directory with ls -l
ls -l
will show you a list of information about all files in the current directory. You can also add a path to a file or folder at the end: ls -l /path/to/file
to view the permissions for a specific file or folder.
Example:
ls -l
total 2
drwxr-xr-x 1 justing justing 789 Jan 1 12:34 myfolder
-rw-r--r-- 1 justing justing 12345 Feb 2 23:45 myfile.txt
Use cut
to only show the permission fields: ls -l /path/to/file | cut -c1-10
Example:
ls -l
total 2
drwxr-xr-x
-rw-r--r--
Permission Field and Octal
The permission fields describe which users have which permissions.
Permission fields can be broken down into three parts: r
represents the read permission, w
represents the write permission, and x
represents the execute permission. The first set of rwx
is for the user, the second is for the group, and the third is for all others.
Example permission fields: drwxr-xr-x
and -rw-r--r--
The first character represents the type of file:
d (directory)
c (character device)
l (symlink)
p (named pipe)
s (socket)
b (block device)
D (door)
- (regular file)
The octal shorthand is computed by suming each permission, where r
is 4, w
is 2, and x
is 1, to get a number between 0 and 7. The first number is for user, then group, then others. For example, rw-r--r--
is 644
in octal (you can use the converter too).
Modifying Permissions
You can set file permissions with the chmod
command.
The syntax for chmod
is chmod [options] [mode] [filename]
. There are two ways to use chmod
: octal and symbolic.
In octal mode, you can use chmod [options] [octal] [filename]
to edit the permissions of a file. For example: chmod 774 myfile.txt
or chmod -R 644 myfolder
.
Some popular options include: -R
(recursive), -f
(force), -v
(verbose). You can find the full list at gnu.org.
In symbolic mode, you can choose from the following options:
References:
u: file owner
g: users in the file group
o: users neither in u nor g
a: all users (u, g, and o)
Operator:
+: add mode
-: remove mode
=: exact mode
Mode:
r: read
w: write
x: execute
For example chmod u+x myfile.txt
will grant the user execute permissions on myfile.txt
.
Examples from gnu.org:
# Change file permissions of FOO to be world readable
# and user writable, with no other permissions.
chmod 644 foo
chmod a=r,u+w foo
# Add user and group execute permissions to FOO.
chmod +110 file
chmod ug+x file
Links:
Ask Ubuntu
Linux Die
Guru99


CSS was the name of the game this week. CSS stands for Cascading Style Sheet(s) and is used to format the layout of a website. So with CSS you can add some style to your code. Whether it be for positioning, adding color, or resizing elements; CSS is an essentail tool in adding character to a Website. With all this in mind I knew it was essential for me to learn CSS to provide my site with a more uniformed and developed look.
Learning CSS and its syntax was relatively simple, as it is relatively self-explanatory, but I ran into some road blocks using Classes and ID's, so I needed to put on my thinking-cap and do my research.
What is the difference between Classes and ID's? When would you use ID's over Classes, and vice-versa? After diving into the interwebs I was able to come across the answers to these questions, so I am going to share this information with all those entry-level developers, such as myself.
Keep in mind that ID's are one of a kind. By this I mean that each element can only have one ID and each page can only have one element with that ID, making ID's unique in your code.
On the other hand, Classes are a dime-a-dozen. You can have the same class used on as many elements as you want and multiple Classes can be used on the same element. So for example, if you wanted to style a certain element, but still wanted to share all other attributes, you can simply use multiple Classes.
The way I imagined it was a student ID card. I went to the University of Illinois at Chicago (UIC), and all students were given a student ID card, or UID. A UID would signify that you are a student of UIC. This information was reusable and can be applied to all students, so like a Class.
All students were also given a pin number, also known as a UIN. A UIN was specific to each student, so no other student could have the same combination in your UIN. Much like ID's, a UIN was unique.
In concerns to using ID's and Classes in CSS, they have the same function, so one cannot do something other cannot. The difference comes in when using Javascript, but we possibly talk about that more in a different blog. The big thing to take away is that in your code ID's can only be used once while Classes can be used multiple times. This will be important when validating your code. If you have multiple ID tags in your code, your page will fail validation, which I wouldn't wish on anyone.
When using Classes you will want to use a full stop(".class-name") and with ID's you are going to use a hash character ("#id-name"). When qualifying your Class or ID you don't want to over generalize. The trick is to be specific. A easy way to do this is using "block-element" or "block-modifier". By using this it will be unlikely you have used this name before in your code and it is easy to read/understand. With this in mind, you want to keep your names short so they are faster to type and easy to scan over if you need to refer back to them.


Amber's Experiments
Amber's Experiments
Be so very light. Be a gentle whisper. We have a fantastic little sky! Anything you want to do you can do here. Little short strokes.
It's cold, but it's beautiful. There are no mistakes. You can fix anything that happens. Let's put some happy little clouds in our world.
With practice comes confidence. Everybody needs a friend. Didn't you know you had that much power? You can move mountains. You can do anything. You don't have to be crazy to do this but it does help. When you buy that first tube of paint it gives you an artist license.
I think there's an artist hidden in the bottom of every single one of us. And I will hypnotize that just a little bit.  Zip. That easy. You have freedom here. The only guide is your heart.
I'm a water fanatic. I love water. This is a happy place, little squirrels live here and play. Let's build some happy little clouds up here.


class Schlib::Command
- Schlib::Command
- Reference
- Object
Overview
Executes a command on the shell and returns the output Optionally, provide your custom logger to logg executions
Executes a command on the shell and returns the output
class MyLogger < Logger
def debug(logline : String)
puts logline
end
end
Schlib::Command.new(MyLogger.new).run("git flog")
you can also signify that you want an error to be raised if your command execution failes Schlib::Command.new.run("git flog", raise_errors: true)


Four Ways Republicans Are Defending Trump Against Impeachment
by Anna RothschildAs public hearings on impeachment start, keep an eye out for what lines Republicans take in defending President Trump’s actions in the Ukraine scandal. Here are four defenses we have spotted in the past few weeks. Will they hold up as new evidence emerges?


The Universal Wallet
Find and explorethe source code on
Search on the
of Qora
Read the API Docs of Qora
Read theTutorialsof Qora
Get free coinsfrom the Faucet
Join and be a member of Qora community
Follow@qoracoinon
Qora, a digital currency with powerful and innovative features that leads the next generation. https://t.co/4Cu9Ufw9Rx— Qora (@qoracoin) August 4, 2015
Qora, a digital currency with powerful and innovative features that leads the next generation. https://t.co/4Cu9Ufw9Rx
Like thepage of Qora
Qora
Read stories from Qorablog on
Subscribeon
Join the discussionson


Enter only the number of the correct answer in the boxes and click submit when you are happy with your answers.
Enter an ID:


Cloyster didn't change that much, but it appreciates an accuracy buff to Clamp and an anti-psychic coverage move in Tri Attack. This makes Cloyster more consistent and less easily walled by some previous hard counters, notably Starmie. It still has middling offenses and it doesn't appreciate the significant buffs to bug and grass types, but it has more of a niche by being able to confront so many flying types comfortably. There is also more competition it has to contest as a bulky water type. Overall, Cloyster is about as good as it was before and its all-rounded role is useful when supported.
- Clamp
- Blizzard
- Explosion
- Tri Attack
Clamp can halt switch-ins and chip them down for teammates, while Blizzard is a very powerful STAB. Tri Attack is a neat anti-psychic tool that can put pressure on paralyzed psychic types like Alakazam and Starmie. Explosion can remove something in a pinch or when Cloyster has already done its job.
Rest can give Cloyster some more longevity, and Hyper Beam can act as a finisher after using Clamp trapping.
Bulky water types: These can switch into Cloyster's dual STAB comfortably, though Starmie needs to watch out for Tri Attack now.
Fighting types: Even with Cloyster's sky-high defense, fighting type attackers can threaten to 2hko Cloyster.
Electric attacks: Electric coverage can cleanly 2hko or even ohko Cloyster.
Special walls: These can absorb Clamp and pp stall it quickly, but these walls also need to watch for Explosion.
Author: Kurai
Publish Date: 26th July 2020


| |
ActiveTcl User Guide
|
|
|
- NAME
- event - Miscellaneous event facilities: define virtual events
and generate events
- SYNOPSIS
- event option ?arg arg ...?
- DESCRIPTION
- event add
<<virtual>> sequence
?sequence ...?
- event delete
<<virtual>> ?sequence
sequence ...?
- event generate
window event ?option value option value ...?
- event info
?<<virtual>>?
- EVENT FIELDS
- -above
window
- -borderwidth
size
- -button
number
- -count
number
- -delta
number
- -detail
detail
- -focus
boolean
- -height
size
- -keycode
number
- -keysym
name
- -mode
notify
- -override
boolean
- -place
where
- -root
window
- -rootx
coord
- -rooty
coord
- -sendevent
boolean
- -serial
number
- -state
state
- -subwindow
window
- -time
integer
- -warp
boolean
- -width
size
- -when
when
- now
- tail
- head
- mark
- -x
coord
- -y
coord
- VIRTUAL EVENT
EXAMPLES
- SEE ALSO
- KEYWORDS
event - Miscellaneous event facilities: define virtual events
and generate events
event option ?arg arg ...?
The event command provides several facilities for dealing
with window system events, such as defining virtual events and
synthesizing events. The command has several different forms,
determined by the first argument. The following forms are currently
supported:
- event add
<<virtual>> sequence
?sequence ...?
- Associates the virtual event virtual with the physical
event sequence(s) given by the sequence arguments, so that
the virtual event will trigger whenever any one of the
sequences occurs. Virtual may be any string value and
sequence may have any of the values allowed for the
sequence argument to the bind command. If virtual is
already defined, the new physical event sequences add to the
existing sequences for the event.
- event delete
<<virtual>> ?sequence
sequence ...?
- Deletes each of the sequences from those associated with
the virtual event given by virtual. Virtual may be
any string value and sequence may have any of the values
allowed for the sequence argument to the bind command. Any sequences not
currently associated with virtual are ignored. If no
sequence argument is provided, all physical event sequences
are removed for virtual, so that the virtual event will not
trigger anymore.
- event generate window event
?option value option value ...?
- Generates a window event and arranges for it to be processed
just as if it had come from the window system. Window gives
the path name of the window for which the event will be generated;
it may also be an identifier (such as returned by winfo id) as long as it is for a
window in the current application. Event provides a basic
description of the event, such as <Shift-Button-2> or
<<Paste>>. If Window is empty the whole
screen is meant, and coordinates are relative to the screen.
Event may have any of the forms allowed for the
sequence argument of the bind command except that it must
consist of a single event pattern, not a sequence.
Option-value pairs may be used to specify additional
attributes of the event, such as the x and y mouse position; see
EVENT FIELDS below. If the -when option is not specified,
the event is processed immediately: all of the handlers for the
event will complete before the event generate command
returns. If the -when option is specified then it determines
when the event is processed. Certain events, such as key events,
require that the window has focus to receive the event
properly.
- event info
?<<virtual>>?
- Returns information about virtual events. If the
<<virtual>> argument is omitted,
the return value is a list of all the virtual events that are
currently defined. If <<virtual>>
is specified then the return value is a list whose elements are the
physical event sequences currently defined for the given virtual
event; if the virtual event is not defined then an empty string is
returned.
The following options are supported for the event
generate command. These correspond to the ``%'' expansions
allowed in binding scripts for the bind command.
- -above window
- Window specifies the above field for the event,
either as a window path name or as an integer window id. Valid for
Configure events. Corresponds to the %a substitution
for binding scripts.
- -borderwidth size
- Size must be a screen distance; it specifies the
border_width field for the event. Valid for Configure
events. Corresponds to the %B substitution for binding
scripts.
- -button number
- Number must be an integer; it specifies the
detail field for a ButtonPress or
ButtonRelease event, overriding any button number provided
in the base event argument. Corresponds to the %b
substitution for binding scripts.
- -count number
- Number must be an integer; it specifies the count
field for the event. Valid for Expose events. Corresponds to
the %c substitution for binding scripts.
- -delta number
- Number must be an integer; it specifies the delta
field for the MouseWheel event. The delta refers to
the direction and magnitude the mouse wheel was rotated. Note the
value is not a screen distance but are units of motion in the mouse
wheel. Typically these values are multiples of 120. For example,
120 should scroll the text widget up 4 lines and -240 would scroll
the text widget down 8 lines. Of course, other widgets may define
different behaviors for mouse wheel motion. This field corresponds
to the %D substitution for binding scripts.
- -detail detail
- Detail specifies the detail field for the event
and must be one of the following:
NotifyAncestor NotifyNonlinearVirtual
NotifyDetailNone NotifyPointer
NotifyInferior NotifyPointerRoot
NotifyNonlinear NotifyVirtual
Valid for Enter, Leave, FocusIn and
FocusOut events. Corresponds to the %d substitution
for binding scripts.
- -focus boolean
- Boolean must be a boolean value; it specifies the
focus field for the event. Valid for Enter and
Leave events. Corresponds to the %f substitution for
binding scripts.
- -height size
- Size must be a screen distance; it specifies the
height field for the event. Valid for Configure
events. Corresponds to the %h substitution for binding
scripts.
- -keycode number
- Number must be an integer; it specifies the
keycode field for the event. Valid for KeyPress and
KeyRelease events. Corresponds to the %k substitution
for binding scripts.
- -keysym name
- Name must be the name of a valid keysym, such as
g, space, or Return; its corresponding keycode
value is used as the keycode field for event, overriding any
detail specified in the base event argument. Valid for
KeyPress and KeyRelease events. Corresponds to the
%K substitution for binding scripts.
- -mode notify
- Notify specifies the mode field for the event and
must be one of NotifyNormal, NotifyGrab,
NotifyUngrab, or NotifyWhileGrabbed. Valid for
Enter, Leave, FocusIn, and FocusOut
events. Corresponds to the %m substitution for binding
scripts.
- -override boolean
- Boolean must be a boolean value; it specifies the
override_redirect field for the event. Valid for Map,
Reparent, and Configure events. Corresponds to the
%o substitution for binding scripts.
- -place where
- Where specifies the place field for the event; it
must be either PlaceOnTop or PlaceOnBottom. Valid for
Circulate events. Corresponds to the %p substitution
for binding scripts.
- -root window
- Window must be either a window path name or an integer
window identifier; it specifies the root field for the
event. Valid for KeyPress, KeyRelease,
ButtonPress, ButtonRelease, Enter,
Leave, and Motion events. Corresponds to the
%R substitution for binding scripts.
- -rootx coord
- Coord must be a screen distance; it specifies the
x_root field for the event. Valid for KeyPress,
KeyRelease, ButtonPress, ButtonRelease,
Enter, Leave, and Motion events. Corresponds
to the %X substitution for binding scripts.
- -rooty coord
- Coord must be a screen distance; it specifies th
y_root field for the event. Valid for KeyPress,
KeyRelease, ButtonPress, ButtonRelease,
Enter, Leave, and Motion events. Corresponds
to the %Y substitution for binding scripts.
- -sendevent boolean
- Boolean must be a boolean value; it specifies the
send_event field for the event. Valid for all events.
Corresponds to the %E substitution for binding scripts.
- -serial number
- Number must be an integer; it specifies the
serial field for the event. Valid for all events.
Corresponds to the %# substitution for binding scripts.
- -state state
- State specifies the state field for the event.
For KeyPress, KeyRelease, ButtonPress,
ButtonRelease, Enter, Leave, and Motion
events it must be an integer value. For Visibility events it
must be one of VisibilityUnobscured,
VisibilityPartiallyObscured, or
VisibilityFullyObscured. This option overrides any modifiers
such as Meta or Control specified in the base
event. Corresponds to the %s substitution for binding
scripts.
- -subwindow window
- Window specifies the subwindow field for the
event, either as a path name for a Tk widget or as an integer
window identifier. Valid for KeyPress, KeyRelease,
ButtonPress, ButtonRelease, Enter,
Leave, and Motion events. Similar to %S
substitution for binding scripts.
- -time integer
- Integer must be an integer value; it specifies the
time field for the event. Valid for KeyPress,
KeyRelease, ButtonPress, ButtonRelease,
Enter, Leave, Motion, and Property
events. Corresponds to the %t substitution for binding
scripts.
- -warp boolean
- boolean must be a boolean value; it specifies whether
the screen pointer should be warped as well. Valid for
KeyPress, KeyRelease, ButtonPress,
ButtonRelease, and Motion events. The pointer will
only warp to a window if it is mapped.
- -width size
- Size must be a screen distance; it specifies the
width field for the event. Valid for Configure
events. Corresponds to the %w substitution for binding
scripts.
- -when when
- When determines when the event will be processed; it
must have one of the following values:
- now
- Process the event immediately, before the command returns. This
also happens if the -when option is omitted.
- tail
- Place the event on Tcl's event queue behind any events already
queued for this application.
- head
- Place the event at the front of Tcl's event queue, so that it
will be handled before any other events already queued.
- mark
- Place the event at the front of Tcl's event queue but behind
any other events already queued with -when mark. This option
is useful when generating a series of events that should be
processed in order but at the front of the queue.
- -x coord
- Coord must be a screen distance; it specifies the
x field for the event. Valid for KeyPress,
KeyRelease, ButtonPress, ButtonRelease,
Motion, Enter, Leave, Expose,
Configure, Gravity, and Reparent events.
Corresponds to the the %x substitution for binding scripts.
If Window is empty the coordinate is relative to the screen,
and this option corresponds to the %X substitution for
binding scripts.
- -y coord
- Coord must be a screen distance; it specifies the
y field for the event. Valid for KeyPress,
KeyRelease, ButtonPress, ButtonRelease,
Motion, Enter, Leave, Expose,
Configure, Gravity, and Reparent events.
Corresponds to the the %y substitution for binding scripts.
If Window is empty the coordinate is relative to the screen,
and this option corresponds to the %Y substitution for
binding scripts.
Any options that are not specified when generating an event are
filled with the value 0, except for serial, which is filled
with the next X event serial number.
In order for a virtual event binding to trigger, two things must
happen. First, the virtual event must be defined with the event
add command. Second, a binding must be created for the virtual
event with the bind command.
Consider the following virtual event definitions:
event add <<Paste>> <Control-y>
event add <<Paste>> <Button-2>
event add <<Save>> <Control-X><Control-S>
event add <<Save>> <Shift-F12>
In the bind command, a
virtual event can be bound like any other builtin event type as
follows:
bind Entry <<Paste>> {%W insert [selection get]}
The double angle brackets are used to specify that a virtual
event is being bound. If the user types Control-y or presses button
2, or if a <<Paste>> virtual event is
synthesized with event generate, then the
<<Paste>> binding will be invoked.
If a virtual binding has the exact same sequence as a separate
physical binding, then the physical binding will take precedence.
Consider the following example:
event add <<Paste>> <Control-y> <Meta-Control-y>
bind Entry <Control-y> {puts Control-y}
bind Entry <<Paste>> {puts Paste}
When the user types Control-y the <Control-y>
binding will be invoked, because a physical event is considered
more specific than a virtual event, all other things being equal.
However, when the user types Meta-Control-y the
<<Paste>> binding will be invoked, because the
Meta modifier in the physical pattern associated with the
virtual binding is more specific than the <Control-y>
sequence for the physical event.
Bindings on a virtual event may be created before the virtual
event exists. Indeed, the virtual event never actually needs to be
defined, for instance, on platforms where the specific virtual
event would meaningless or ungeneratable.
When a definition of a virtual event changes at run time, all
windows will respond immediately to the new definition. Starting
from the preceding example, if the following code is executed:
bind <Entry> <Control-y> {}
event add <<Paste>> <Key-F6>
the behavior will change such in two ways. First, the shadowed
<<Paste>> binding will emerge. Typing Control-y
will no longer invoke the <Control-y> binding, but
instead invoke the virtual event <<Paste>>.
Second, pressing the F6 key will now also invoke the
<<Paste>> binding.
bind
event, binding, define, handle, virtual event
Copyright © 1996 Sun Microsystems, Inc.
Copyright © 1998-2000 Ajuba Solutions.
Copyright © 1995-1997 Roger E. Critchlow Jr.