|
src/app/app.component.ts
|
component |
AppComponent |
0 %
(0/4)
|
|
src/app/core/data/models/answer.model.ts
|
interface |
Answer |
0 %
(0/11)
|
|
src/app/core/data/models/audit.model.ts
|
interface |
Audit |
0 %
(0/9)
|
|
src/app/core/data/models/contact-person.model.ts
|
interface |
ContactPerson |
0 %
(0/12)
|
|
src/app/core/data/models/faccrit.model.ts
|
interface |
FacCrit |
0 %
(0/4)
|
|
src/app/core/data/models/interview.model.ts
|
interface |
Interview |
0 %
(0/9)
|
|
src/app/core/data/models/question.model.ts
|
interface |
Question |
0 %
(0/4)
|
|
src/app/core/http/answer.service.ts
|
injectable |
AnswerService |
50 %
(2/4)
|
|
src/app/core/http/audit.service.ts
|
injectable |
AuditService |
71 %
(5/7)
|
|
src/app/core/http/contact-person.service.ts
|
injectable |
ContactPersonService |
66 %
(4/6)
|
|
src/app/core/http/dtos/audit.dto.ts
|
interface |
AuditDto |
0 %
(0/12)
|
|
src/app/core/http/dtos/interview.dto.ts
|
interface |
InterviewDto |
0 %
(0/9)
|
|
src/app/core/http/dtos/post-audit.dto.ts
|
interface |
PostAuditDto |
0 %
(0/6)
|
|
src/app/core/http/dtos/post-interview.dto.ts
|
interface |
PostInterviewDto |
0 %
(0/6)
|
|
src/app/core/http/dtos/put-audit.dto.ts
|
interface |
PutAuditDto |
0 %
(0/4)
|
|
src/app/core/http/dtos/put-interview.dto.ts
|
interface |
PutInterviewDto |
0 %
(0/5)
|
|
src/app/core/http/facCrit.service.ts
|
injectable |
FacCritService |
50 %
(2/4)
|
|
src/app/core/http/interview.service.ts
|
injectable |
InterviewService |
71 %
(5/7)
|
|
src/app/core/http/question.service.ts
|
injectable |
QuestionService |
33 %
(1/3)
|
|
src/app/core/http/test/dummies/answers.ts
|
variable |
ANSWERS_DTO_DUMMY |
0 %
(0/1)
|
|
src/app/core/http/test/dummies/audits.ts
|
variable |
AUDITS_DTO_DUMMY |
0 %
(0/1)
|
|
src/app/core/http/test/dummies/contact-persons.ts
|
variable |
CONTACTPERSON_DTO_DUMMY |
0 %
(0/1)
|
|
src/app/core/http/test/dummies/faccrits.ts
|
variable |
FACCRITS_DUMMY |
0 %
(0/1)
|
|
src/app/core/http/test/dummies/interviews.ts
|
variable |
INTERVIEWS_DTO_DUMMY |
0 %
(0/1)
|
|
src/app/core/http/test/dummies/questions.ts
|
variable |
QUESTIONS_DTO_DUMMY |
0 %
(0/1)
|
|
src/app/core/ngxs/actions/audit.actions.ts
|
class |
AddAudit |
0 %
(0/4)
|
|
src/app/core/ngxs/actions/audit.actions.ts
|
class |
DeleteAudit |
0 %
(0/4)
|
|
src/app/core/ngxs/actions/audit.actions.ts
|
class |
LoadFacCritsByInterviewId |
0 %
(0/4)
|
|
src/app/core/ngxs/actions/audit.actions.ts
|
class |
UpdateAudit |
0 %
(0/5)
|
|
src/app/core/ngxs/actions/contact-person.action.ts
|
class |
AddContactPerson |
0 %
(0/4)
|
|
src/app/core/ngxs/actions/contact-person.action.ts
|
class |
DeleteContactPerson |
0 %
(0/4)
|
|
src/app/core/ngxs/actions/contact-person.action.ts
|
class |
UpdateContactPerson |
0 %
(0/5)
|
|
src/app/core/ngxs/actions/inteview.actions.ts
|
class |
AddInterview |
0 %
(0/5)
|
|
src/app/core/ngxs/actions/inteview.actions.ts
|
class |
UpdateAnswer |
0 %
(0/4)
|
|
src/app/core/ngxs/actions/inteview.actions.ts
|
class |
UpdateInterview |
0 %
(0/5)
|
|
src/app/core/ngxs/actions/router.actions.ts
|
class |
Navigate |
0 %
(0/4)
|
|
src/app/core/ngxs/app-router.state.ts
|
injectable |
AppRouterState |
14 %
(2/14)
|
|
src/app/core/ngxs/app-router.state.ts
|
interface |
AppRouterStateModel |
0 %
(0/11)
|
|
src/app/core/ngxs/audit.state.ts
|
injectable |
AuditState |
7 %
(1/13)
|
|
src/app/core/ngxs/audit.state.ts
|
interface |
AuditStateModel |
0 %
(0/3)
|
|
src/app/core/ngxs/contact-person.state.ts
|
injectable |
ContactPersonState |
12 %
(1/8)
|
|
src/app/core/ngxs/contact-person.state.ts
|
interface |
ContactPersonStateModel |
0 %
(0/2)
|
|
src/app/core/ngxs/interview.state.ts
|
injectable |
InterviewState |
9 %
(1/11)
|
|
src/app/core/ngxs/interview.state.ts
|
interface |
InterviewStateModel |
0 %
(0/4)
|
|
src/app/features/audit-overview/audit-info/audit-contact-person-card/contact-person-card.component.ts
|
component |
AuditContactPersonCardComponent |
0 %
(0/3)
|
|
src/app/features/audit-overview/audit-info/audit-info.component.ts
|
component |
AuditInfoComponent |
0 %
(0/5)
|
|
src/app/features/audit-overview/audit-overview.component.ts
|
component |
AuditOverviewComponent |
0 %
(0/7)
|
|
src/app/features/audit-overview/interview-list/criteria-by-factor-id.pipe.ts
|
pipe |
CriteriaByFactorIdPipe |
0 %
(0/1)
|
|
src/app/features/audit-overview/interview-list/interview-card/interview-card.component.ts
|
component |
InterviewCardComponent |
0 %
(0/4)
|
|
src/app/features/audit-overview/interview-list/interview-list.component.ts
|
component |
InterviewListComponent |
0 %
(0/7)
|
|
src/app/features/audit-overview/interview-list/interviews-by-fac-crit-id.pipe.ts
|
pipe |
InterviewsByFacCritIdPipe |
0 %
(0/1)
|
|
src/app/features/audits/audit-card/audit-card.component.ts
|
component |
AuditCardComponent |
0 %
(0/7)
|
|
src/app/features/audits/audits.component.ts
|
component |
AuditsComponent |
0 %
(0/4)
|
|
src/app/features/audits/sort-audit.pipe.ts
|
pipe |
SortAuditPipe |
0 %
(0/1)
|
|
src/app/features/contact-persons/contact-person-card/contact-person-card.component.ts
|
component |
ContactPersonCardComponent |
0 %
(0/4)
|
|
src/app/features/contact-persons/contact-persons.component.ts
|
component |
ContactPersonsComponent |
0 %
(0/3)
|
|
src/app/features/interview/answer-question-list/answer-question-list.component.ts
|
component |
AnswerQuestionListComponent |
0 %
(0/8)
|
|
src/app/features/interview/answer-question-list/questions-by-id.pipe.ts
|
pipe |
QuestionByIdPipe |
0 %
(0/1)
|
|
src/app/features/interview/answers-by-ids.pipe.ts
|
pipe |
AnswersByIdsPipe |
0 %
(0/1)
|
|
src/app/features/interview/interview.component.ts
|
component |
InterviewComponent |
0 %
(0/17)
|
|
src/app/shared/components/dialogs/add-audit-dialog/add-audit-dialog.component.ts
|
component |
AddAuditDialogComponent |
0 %
(0/8)
|
|
src/app/shared/components/dialogs/add-contact-person-dialog/add-contact-person-dialog.component.ts
|
component |
AddContactPersonDialogComponent |
0 %
(0/7)
|
|
src/app/shared/components/dialogs/add-interview-dialog/add-interview-dialog.component.ts
|
component |
AddInterviewDialogComponent |
9 %
(1/11)
|
|
src/app/shared/components/dialogs/confirm-discard-dialog/confirm-discard-dialog.component.ts
|
component |
ConfirmDiscardDialogComponent |
0 %
(0/7)
|
|
src/app/shared/components/dialogs/default-dialog-options.ts
|
variable |
defaultDialogOptions |
0 %
(0/1)
|
|
src/app/shared/components/dialogs/edit-audit-dialog/edit-audit-dialog.component.ts
|
component |
EditAuditDialogComponent |
0 %
(0/12)
|
|
src/app/shared/components/dialogs/edit-contact-person-dialog/edit-contact-person-dialog.component.ts
|
component |
EditContactPersonDialogComponent |
0 %
(0/11)
|
|
src/app/shared/components/forms/abstract-form-component.ts
|
class |
AbstractFormComponent |
0 %
(0/4)
|
|
src/app/shared/components/forms/audit-form/audit-form.component.ts
|
component |
AuditFormComponent |
0 %
(0/15)
|
|
src/app/shared/components/forms/audit-form/audit-form.component.ts
|
variable |
defaultScopeComplement |
0 %
(0/1)
|
|
src/app/shared/components/forms/contact-person-form/contact-person-form.component.ts
|
component |
ContactPersonFormComponent |
0 %
(0/12)
|
|
src/app/shared/components/forms/interview-form/interview-form.component.ts
|
component |
InterviewFormComponent |
0 %
(0/17)
|
|
src/app/shared/components/not-found/not-found.component.ts
|
component |
NotFoundComponent |
0 %
(0/4)
|
|
src/app/shared/components/sidebar/sidebar-interview-list/sidebar-interview-list.component.ts
|
component |
SidebarInterviewListComponent |
0 %
(0/7)
|
|
src/app/shared/components/sidebar/sidebar-interview/sidebar-interview.component.ts
|
component |
SidebarInterviewComponent |
0 %
(0/9)
|
|
src/app/shared/components/sidebar/sidebar.component.ts
|
component |
SidebarComponent |
0 %
(0/3)
|
|
src/app/shared/directives/action-listener.directive.ts
|
directive |
ActionListenerDirective |
25 %
(1/4)
|
|
src/app/shared/helpers/date-helpers.ts
|
function |
parseTimestamp |
100 %
(1/1)
|
|
src/app/shared/helpers/form-helpers.ts
|
function |
dateRangeValidator |
100 %
(1/1)
|
|
src/app/shared/pipes/criterias.pipe.ts
|
pipe |
CriteriasPipe |
0 %
(0/1)
|
|
src/app/shared/pipes/factors.pipe.ts
|
pipe |
FactorsPipe |
0 %
(0/1)
|
|
src/environments/environment.prod.ts
|
variable |
environment |
0 %
(0/1)
|
|
src/environments/environment.ts
|
variable |
environment |
0 %
(0/1)
|
|
src/test.ts
|
variable |
context |
0 %
(0/1)
|
|
src/test.ts
|
variable |
require |
0 %
(0/1)
|


Working with other input devices¶
Pyglet’s input module allows you to accept input from any USB human interface device (HID). High level interfaces are provided for working with joysticks and with the Apple Remote.
Using joysticks¶
Before using a joystick, you must find it and open it. To get a list of all joystick devices currently connected to your computer, call pyglet.input.get_joysticks:
joysticks = pyglet.input.get_joysticks()
Then choose a joystick from the list and call Joystick.open to open the device:
if joysticks:
joystick = joysticks[0]
joystick.open()
You may immediately begin querying the state of the joystick by looking at its attributes. The current position of the joystick is recorded in its ‘x’ and ‘y’ attributes, both of which are normalized to values within the range of -1 to 1. For the x-axis, x = -1 means the joystick is pushed all the way to the left and x = 1 means the joystick is pushed to the right. For the y-axis, a value of y = -1 means that the joystick is pushed up and a value of y = 1 means that the joystick is pushed down.
If your joystick has two analog controllers, the position of the second controller is typically given by z and rz, where z is the horizontal axis position and rz is the vertical axis position.
The state of the joystick buttons is contained in the buttons attribute as a list of boolean values. A True value indicates that the corresponding button is being pressed. While buttons may be labeled A, B, X, or Y on the physical joystick, they are simply referred to by their index when accessing the buttons list. There is no way to know which button index corresponds to which physical button on the device without simply testing the particular joystick. So it is a good idea to let users change button assignments.
Each open joystick dispatches events when the joystick changes state. For buttons, there is the on_joybutton_press event which is sent whenever any of the joystick’s buttons are pressed:
def on_joybutton_press(joystick, button):
pass
and the on_joybutton_release event which is sent whenever any of the joystick’s buttons are released:
def on_joybutton_release(joystick, button):
pass
The joystick parameter is the Joystick instance whose buttons changed state (useful if you have multiple joysticks connected). The button parameter signifies which button changed and is simply an integer value, the index of the corresponding button in the buttons list.
For most games, it is probably best to examine the current position of the joystick directly by using the x and y attributes. However if you want to receive notifications whenever these values change you should handle the on_joyaxis_motion event:
def on_joyaxis_motion(joystick, axis, value):
pass
The joystick parameter again tells you which joystick device changed. The axis parameter is string such as “x”, “y”, or “rx” telling you which axis changed value. And value gives the current normalized value of the axis, ranging between -1 and 1.
If the joystick has a hat switch, you may examine its current value by looking at the hat_x and hat_y attributes. For both, the values are either -1, 0, or 1. Note that hat_y will output 1 in the up position and -1 in the down position, which is the opposite of the y-axis control.
To be notified when the hat switch changes value, handle the on_joyhat_motion event:
def on_joyhat_motion(joystick, hat_x, hat_y):
pass
The hat_x and hat_y parameters give the same values as the joystick’s hat_x and hat_y attributes.
A good way to use the joystick event handlers might be to define them within a controller class and then call:
joystick.push_handlers(my_controller)
Using the Apple Remote¶
The Apple Remote is a small infrared remote originally distributed with the iMac. The remote has six buttons, which are accessed with the names left, `right, up, down, menu, and select. Additionally when certain buttons are held down, they act as virtual buttons. These are named left_hold, ‘right_hold`, menu_hold, and select_hold.
To use the remote, first call get_apple_remote:
remote = pyglet.input.get_apple_remote()
Then open it:
if remote:
remote.open(window, exclusive=True)
The remote is opened in exclusive mode so that while we are using the remote in our program, pressing the buttons does not activate Front Row, or change the volume, etc. on the computer.
The following event handlers tell you when a button on the remote has been either pressed or released:
def on_button_press(button):
pass
def on_button_release(button):
pass
The button parameter indicates which button changed and is a string equal to one of the ten button names defined above: “up”, “down”, “left”, “left_hold”, “right”, “right_hold”, “select”, “select_hold”, “menu”, or “menu_hold”.
To use the remote, you may define code for the event handlers in some controller class and then call:
remote.push_handlers(my_controller)


This is an introduction to writing CGI programs in the C language. The reader is assumed to know the basics of C as well how to write simple forms in HTML and to be able to install CGI scripts on a Web server. The principles are illustrated with very simple examples.
As my document How to write HTML forms briefly explains, you need a server side-script in order to use HTML forms reliably. Typically, there are simple server-side scripts available for simple, common ways of processing form submissions, such as sending the data in text format by E-mail to a specified address.
However, for more advanced processing, such as collecting data into a file or database, or retrieving information and sending it back, or doing some calculations with the submitted data, you will probably need to write a server-side script of your own.
CGI is simply an interface between HTML forms and server-side scripts. It is not the only possibility—see the excellent tutorial How the web works: HTTP and CGI explained by Lars Marius Garshol for both an introduction to the concepts of CGI and notes on other possibilities.
If someone suggests using JavaScript as an alternative to CGI, ask him to read my JavaScript and HTML: possibilities and caveats. Briefly, JavaScript is inherently unreliable at least if not “backed up” with server-side scripting.
The above-mentioned How the web works: HTTP and CGI explained is a great tutorial. The following introduction of mine is just another attempt to present the basics; please consult other sources if you get confused or need more information.
Let us consider the following simple HTML form:
<form action="http://www.cs.tut.fi/cgi-bin/run/~jkorpela/mult.cgi">

Multiplicand 1: <input name="m" size="5">

Multiplicand 2: <input name="n" size="5">

<input type="submit" value="Multiply!">

</form>
It will look like the following on your current browser:
You can try it if you like. Just in case the server used isn’t running and accessible when you try it, here’s what you would get as the result:
Multiplication results
The product of 4 and 9 is 36.
We will now analyze how the example above works.
Assume that you type 4 into one input field and
9 into another and then invoke submission—www.cs.tut.fi
. The browser pick up this server name
from the value of ACTION
attribute where it
occurs as the host name part of a URL.
(Quite often, the ACTION
attribute refers, often using
a relative URL, to a script on the same server as the document
resides on, but this is not necessary, as this example shows.)
When sending the request, the browser provides additional information,
specifying a relative URL, in this case
/cgi-bin/run/~jkorpela/mult.cgi?m=4&n=9
This was constructed from that part of the ACTION
value
that follows the host name, by appending a question mark
“?
” and the form data in
a specifically encoded format.
The server to which the request was sent
(in this case, www.cs.tut.fi
)
will then process
it according to its own rules. Typically, the server’s configuration
defines how the relative URLs are mapped to file names and which
directories/folders are interpreted as containing CGI scripts.
As you may guess, the part cgi-bin/
in the URL causes
such interpretation in this case. This means that instead of just
picking up and
sending back (to the browser that sent the request) an HTML document
or some other file, the server invokes a script or a program
specified in the URL (mult.cgi
in this case) and passes
some data to it (the data m=4&n=9
in this case).
It depends on the server how this really happens.
In this particular case, the server actually runs the (executable)
program in the file mult.cgi
in the subdirectory
cgi-bin
of user
jkorpela
’s home directory. It could be something
quite different, depending on server configuration.
The often-mystified abbreviation CGI, for Common Gateway Interface, refers just to a convention on how the invocation and parameter passing takes place in detail.
Invocation means different things in different cases. For a Perl script, the server would invoke a Perl interpreter and make it execute the script in an interpretive manner. For an executable program, which has typically been produced by a compiler and a loader from a source program in a language like C, it would just be started as a separate process.
Although the word script typically suggests that the code is interpreted, the term CGI script refers both to such scripts and to executable programs. See the answer to question Is it a script or a program? in CGI Programming FAQ by Nick Kew.
In order to set up a C program as a CGI script, it needs to be turned into a binary executable program. This is often problematic, since people largely work on Windows whereas servers often run some version of UNIX or Linux. The system where you develop your program and the server where it should be installed as a CGI script may have quite different architectures, so that the same executable does not run on both of them.
This may create an unsolvable problem. If you are not allowed to log on the server and you cannot use a binary-compatible system (or a cross-compiler) either, you are out of luck. Many servers, however, allow you log on and use the server in interactive mode, as a “shell user,” and contain a C compiler.
You need to compile and load your C program on the server (or, in principle, on a system with the same architecture, so that binaries produced for it are executable on the server too).
Normally, you would proceed as follows:
GET
method,
the input is to be read from the environment variable.
QUERY_STRING
.
(The program may also read data from files—but these must then
reside on the server.)
It should generate output on the standard output stream
(stdout
) so that it starts with suitable HTTP
headers. Often, the output is in HTML format.
QUERY_STRING
so that it contains the test data as it will be sent as form
data. E.g.,
if you intend
to use a form where a field named foo
contains the input data,
you can give the commandYou need to put the executable into
a suitable directory and name it according to server-specific conventions.
Even the compilation commands needed here might differ from what
you are used to on your workstation.
For example, if the server runs some flavor of Unix and has the
Gnu C compiler available, you would typically use a compilation
command like gcc
and
then move (mv
) mult.c
to a directory with
a name like cgi-bin
.
Instead of gcc
, you might need to use cc
.
You really need to check local
instructions for such issues.
The filename extension .cgi
has no fixed meaning in general. However,
there can be server-dependent
(and operating system dependent) rules for naming executable files.
Typical extensions for executables are .cgi
and .exe
.
As usual when starting work with some new programming technology, you should probably first make a trivial program work. This avoids fighting with many potential problems at a time and concentrating first on the issues specific to the environment, here CGI.
You could use the following program that just prints Hello world but preceded by HTTP headers as required by the CGI interface. Here the header specifies that the data is plain ASCII text.
#include <stdio.h>
int main(void) {
printf("Content-Type: text/plain;charset=us-ascii\n\n");
printf("Hello world\n\n");
return 0;
}
After compiling, loading, and uploading, you should be able
to test the script simply by entering the URL in the browser’s
address bar. You could also make it the destination of a normal
link in an HTML document. The URL of course depends on how you set
things up; the URL for my installed Hello world
script is the following:
http://www.cs.tut.fi/cgi-bin/run/~jkorpela/hellow.cgi
For forms that use METHOD="GET"
(as our
simple example above uses, since
this is the default),
CGI specifications say that the data is passed to
the script or program in an environment variable called
QUERY_STRING
.
It depends on the scripting or programming
language used how a program can access the value of an environment
variable. In the C language, you would use the
library function getenv
(defined in the
standard library stdlib
) to access the value as
a string. You might then use various techniques to pick up data
from the string, convert parts of it to numeric values, etc.
The output from the script or program to “primary output
stream” (such as stdin
in the C language) is handled
in a special way. Effectively, it is directed so that it gets sent
back to the browser. Thus, by writing a C program that it writes
an HTML document onto its standard output, you will make that document
appear on user’s screen as a response to the form submission.
In this case, the source program in C is the following:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char *data;
long m,n;
printf("%s%c%c\n",
"Content-Type:text/html;charset=iso-8859-1",13,10);
printf("<TITLE>Multiplication results</TITLE>\n");
printf("
Multiplication results
\n");
data = getenv("QUERY_STRING");
if(data == NULL)
printf("
Error! Error in passing data from form to script.");
else if(sscanf(data,"m=%ld&n=%ld",&m,&n)!=2)
printf("
Error! Invalid data. Data must be numeric.");
else
printf("
The product of %ld and %ld is %ld.",m,n,m*n);
return 0;
}
As a disciplined programmer, you have probably noticed that the program makes no check against integer overflow, so it will return bogus results for very large operands. In real life, such checks would be needed, but such considerations would take us too far from our topic.
Note: The first printf
function call prints out
data that will be sent by the server as an HTTP header.
This is required for several reasons, including the fact that
a CGI script can send any data (such as an image or a plain text file)
to the browser, not just HTML documents.
For HTML documents, you can just use the printf
function
call above as such; however, if your
character encoding is different from ISO 8859-1 (ISO Latin 1),
which is the most common on the Web, you need to replace
iso-8859-1
by the
registered name of the encoding (“charset”) you use.
I have compiled this program and saved the executable program
under the name mult.cgi
in my directory for CGI scripts
at www.cs.tut.fi
.
This implies that any
form with
action=
will, when submitted, be processed by that program.
Consequently, anyone could write a form
of his own with the same ACTION
attribute and pass
whatever data he likes to my program. Therefore, the program
needs to be able to handle any data.
Generally, you need to check the data before starting to process it.
METHOD="POST"
METHOD="POST"
Let us consider next a different processing for form data. Assume that we wish to write a form that takes a line of text as input so that the form data is sent to a CGI script that appends the data to a text file on the server. (That text file could be readable by the author of the form and the script only, or it could be made readable to the world through another script.)
It might seem that the problem is similar to the
example considered above; one would just need
a different form and a different script (program).
In fact, there is a difference. The example above can be regarded
as a “pure query” that does not change the
“state of the world.”
In particular, it is “idempotent,” i.e. the same form data could
be submitted as many times as you like without causing any problems
(except minor waste of resources). However, our current task needs
to cause such changes—a change in the content of a file that is
intended to be more or less permanent. Therefore, one should use
METHOD="POST"
. This is explained in more detail in
the document
Methods GET
and POST
in HTML forms - what’s the difference?
Here we will take it for granted that
METHOD="POST"
needs to be used and we will consider the
technical implications.
For forms that use METHOD="POST"
,
CGI specifications say that the data is passed to
the script or program
in the standard input stream (stdin
), and the
length (in bytes, i.e. characters) of the data is passed
in an environment variable called
CONTENT_LENGTH
.
Reading from standard input sounds probably simpler than
reading from an environment variable, but there are complications.
The server is not required to pass the data so that
when the CGI script tries to read more data than there is, it would
get an end of file indication! That is, if you read e.g. using
the getchar
function in a C program, it is undefined
what happens after reading all the data characters; it is not guaranteed
that the function will return EOF
.
When reading the input, the program must not try to read more
than CONTENT_LENGTH
characters.
A relatively simple
C program
for accepting input via CGI and
METHOD="POST"
is the following:
#include <stdio.h>
#include <stdlib.h>
#define MAXLEN 80
#define EXTRA 5
/* 4 for field name "data", 1 for "=" */
#define MAXINPUT MAXLEN+EXTRA+2
/* 1 for added line break, 1 for trailing NUL */
#define DATAFILE "../data/data.txt"
void unencode(char *src, char *last, char *dest)
{
for(; src != last; src++, dest++)
if(*src == '+')
*dest = ' ';
else if(*src == '%') {
int code;
if(sscanf(src+1, "%2x", &code) != 1) code = '?';
*dest = code;
src +=2; }
else
*dest = *src;
*dest = '\n';
*++dest = '\0';
}
int main(void)
{
char *lenstr;
char input[MAXINPUT], data[MAXINPUT];
long len;
printf("%s%c%c\n",
"Content-Type:text/html;charset=iso-8859-1",13,10);
printf("<TITLE>Response</TITLE>\n");
lenstr = getenv("CONTENT_LENGTH");
if(lenstr == NULL || sscanf(lenstr,"%ld",&len)!=1 || len > MAXLEN)
printf("
Error in invocation - wrong FORM probably.");
else {
FILE *f;
fgets(input, len+1, stdin);
unencode(input+EXTRA, input+len, data);
f = fopen(DATAFILE, "a");
if(f == NULL)
printf("
Sorry, cannot store your data.");
else
fputs(data, f);
fclose(f);
printf("
Thank you! Your contribution has been stored.");
}
return 0;
}
Essentially, the program retrieves the
information about the number of characters in the input
from value of the
CONTENT_LENGTH
environment variable.
Then it unencodes (decodes) the data, since the data arrives in the
specifically encoded format that was already mentioned.
The program has been written for a form where the text input field
has the name data
(actually, just the length of the name
matters here). For example, if the user types
Hello there!
then the data will be passed to the program encoded as
data=Hello+there%21
(with space encoded as +
and exclamation mark encoded
as %21
). The unencode
routine in the program
converts this back to the original format. After that,
the data is appended to a file (with a fixed file name),
as well as echoed back to the user.
Having compiled the program I have saved it as collect.cgi
into the directory for CGI scripts. Now a form like the following
can be used for data submissions:
<FORM ACTION="http://www.cs.tut.fi/cgi-bin/run/~jkorpela/collect.cgi"
METHOD="POST">

Your input (80 chars max.):

<INPUT NAME="data" SIZE="60" MAXLENGTH="80">

<INPUT TYPE="SUBMIT" VALUE="Send">

</FORM>
Finally, we can write a simple program for viewing the data; it only needs to copy the content of a given text file onto standard output:
#include <stdio.h>
#include <stdlib.h>
#define DATAFILE "../data/data.txt"
int main(void)
{
FILE *f = fopen(DATAFILE,"r");
int ch;
if(f == NULL) {
printf("%s%c%c\n",
"Content-Type:text/html;charset=iso-8859-1",13,10);
printf("<TITLE>Failure</TITLE>\n");
printf("
Unable to open data file, sorry!"); }
else {
printf("%s%c%c\n",
"Content-Type:text/plain;charset=iso-8859-1",13,10);
while((ch=getc(f)) != EOF)
putchar(ch);
fclose(f); }
return 0;
}
Notice that this program prints (when successful) the data
as plain text, preceded by a header that says this, i.e.
has text/plain
instead of text/html
.
A form that invokes that program can be very simple, since no input data is needed:
<form action="http://www.cs.tut.fi/cgi-bin/run/~jkorpela/collect.cgi"
method="POST">

Your input (80 chars max.):

<input id="data" name="data" size="60" maxlength="80">

<input type="submit" value="Send">

</form>
Finally, here’s what the two forms look like. You can now test them:
Please notice that anything you submit here will become visible to the world:
The content of the text file to which the submissions are stored will be displayed as plain text.
Even though the output is declared to be plain text, Internet Explorer
may interpret it partly as containing HTML markup. Thus, if someone enters
data that contains such markup, strange things would happen.
The viewdata.c program takes this into account
by writing the NUL character ('\0'
) after each occurrence
of the greater-than character lt;
, so that it will not
be taken (even by IE) as starting a tag.
You may now wish to read The CGI specification, which tells you all the basic details about CGI. The next step is probably to see what the CGI Programming FAQ contains. Beware that it is relatively old.
There is a lot of material, including introductions and tutorials, in the CGI Resource Index. Notice in particular the section Programs and Scripts: C and C++: Libraries and Classes, which contains libraries that can make it easier to process form data. It can be instructive to parse simple data format by using code of your own, as was done in the simple examples above, but in practical application a library routine might be better.
The C language was originally designed for an environment where
only ASCII characters were used. Nowadays, it can be
used—with caution—for processing


Ocean [ay59], ocean, in Crystal Sea
Last updated Turn #102
Ocean [ay59], ocean, in Crystal Sea
------------------------------------------------------------------------
22: Pleasure Sloop [v5n], ship, 30 hulls, 1 rowing port, 90 sails,
22: 5% damaged, arrived from Ocean [ay58], owner:
22: Dorothy [v1b], Pen, with 94 sailors
22: Jupiter [m8j], Imperial Empire, duke, with 54 archers, 16 lt.
22: xbowmen, accompanied by:
22: Odin [y5z], Imperial Empire, with 28 archers, two lt. xbowmen
22: Hera [g3f], Imperial Empire, with 37 pikemen
22: Thor [r4g], Imperial Empire, with 29 pikemen
22: Apollo [b5e], Imperial Empire, with 20 lt. xbowmen
22: Helios [p6i], Imperial Empire, with 29 pikemen
22: Eos [a2t], Imperial Empire, with 19 pikemen
22: Venus [w5u], Imperial Empire, with 29 soldiers
22: Aryon [t6i], Imperial Empire, duke, with 15 soldiers, 18 lt.
22: xbowmen
22: Lanthara [r4v], Imperial Empire, with five soldiers, 20 pikemen
22: Licia [i1l], Imperial Empire, with 15 soldiers, five lt.
22: xbowmen
22: Thrix [n3v], Imperial Empire, with five soldiers, 20 pikemen
22: Manis [h3g], Imperial Empire, with 12 lt. xbowmen
23: Pleasure Sloop [v5n], ship, 30 hulls, 1 rowing port, 90 sails,
23: 5% damaged, departed for Ocean [ax59].
Routes leaving Ocean:
North, to Ocean [ax59], The Inner Sea, 6 days
East, to Ocean [ay60], 6 days
South, to Ocean [az59], 6 days
West, to Ocean [ay58], The Inner Sea, 6 days


The Utility Library contains base classes, data type definitions, geometry and container classes as well as a few utility functions. This library is used extensively by the VRML97 Class Library and the Solid Modeling Library.
vrBaseNode, vrField, vrRuntimeClass, vrFieldList
MFInt32, MFFloat, MFVec2f, MFVec3f, MFColor, MFRotation, MFString
vrBoundingBox, vrMatrix, vrPlane, vrRay, vrRect2D
vrArrayBase, vrArray, vrList, vrRefCountList, vrStack, vrRefCountStack
vrDumpContext, vrDumpString, vrTime, vrVersionInfo


CIST 9080
Spring 2016
Lecturers: Harvey Siy,
Myoungkyu Song
(March 16, 2016)
Title: Research in Software Engineering: Empirical Studies, Software Evolution and Analysis
Slides:
Background reading:
Some of our past contributions and ongoing work:
- An empirical study of code inspection: Porter, Adam A., et al. "An experiment to assess the cost-benefits of code inspections in large scale software development." IEEE Transactions on Software Engineering, 23.6 (1997): 329-346.
- Studying software artifacts to understand organizations: Staudenmayer, Nancy, et al. "Adapting to a new environment: How a legacy software organization copes with volatility and change." 5th International Product Development Conference, 1998.
- Properties of source code relationships: Meyer, P., H. Siy, and S. Bhowmick. "Identifying Important Classes Of Large Software Systems Through K-Core Decomposition." Advances in Complex Systems 17.07n08, 2015.
- Static code analysis to support code inspection: Tianyi Zhang, Myoungkyu Song, Joseph Pinedo, Miryung Kim, "Interactive code review for systematic changes." International Conference on Software Engineering, 2015.
- Assisting developers in writing correct code metadata: Myoungkyu Song, Eli Tilevich, "Metadata Invariants: Checking and inferring metadata coding conventions." International Conference on Software Engineering, 2012.


{$key+1}.echo str_replace('#','',$fi_v['question'])
{$key+1}.{$rw.question}----------
{$key+1}.{$c1.question}
四、多选题 {$key+1}.{$c2.question} $answer2 = get_ch2($c2['answer'],$c2['ch1'],$c2['ch2'],$c2['ch3'],$c2['ch4']); A.{$answer2.0} B.{$answer2.1} C.{$answer2.2} D.{$answer2.3} E.{$answer2.4}
{$key+1}.{$c2.question}
未开放


Protocols
The following protocols are available globally.
-
Undocumented
See more -
Your item models should follow this protocol, impelmenting
Hashable
andNSCoding
. TheFeedController
compares incoming items to the ones already present, integrating new ones while eliminating redundant ones. It must compare the items using thehashValue
in order to determine what items are new and which ones are not.Declaration
Swift
public protocol FeedItem: Hashable, NSCoding
-
Undocumented
See more -
See moreCachePreferences
tell the FeedController whether or not to cache the feed items, and if so, what the cache should be called.Declaration
Swift
public protocol CachePreferences


Room Drowing!
Seats, Datashow, Cuttering
Description
Current status - Avaliable for %% hours - In use (will be Avaliable in x hours) - Will be occupied in x hours
Last user, Next User
Hours Avaliable


Don't be put off by the title: "Boogie Nights" is one of the most vivid, tantalizing and unconventional American films of the past few years. It is intense, dazzling filmmaking by 26-year-old director Paul Thomas Anderson ("Hard Eight") and it is guaranteed to give him a major boost in the world of film and in his career. Yes, folks, he's that good.
"Boogie Nights" is an epic tale of the porno industry in the 1970's and early 1980's, and how it affected the lives of the actors, directors and everyone else involved in the making and production of what is now a billion dollar industry. Burt Reynolds, in what may be his finest role since Deliverance, is surprisingly credible and understated as a porn director named Jack Horner who yearns to make this industry respectable. One night at a disco, he discovers a potentially hot star in the form of a waiter, Eddie Adams (the extraordinary Mark Wahlberg). Jack talks to Eddie and tries to entice him into becoming one of his actors. Eddie is reluctant but decides it may not be such a bad idea.
The naive Eddie is nineteen years old and lives at home with his domineering parents who pressure him into going to school.  He gets the chance with Jack, and shortly becomes an overnight success.  "That's a catchy name," says Jack.
After a while, Eddie moves into Jack's home and becomes part of his unusual "family," which includes Jack's leading lady star Amber Waves (the always great Julianne Moore) who will gradually become Eddie's maternal co-star, and an energetic blonde named Rollergirl (Heather Graham - an actress who keeps you on the edge) who will remove all her clothing for a sex scene except for her roller skates. The house becomes a haven for excess in the numerous drug parties and the sexual dalliances in the bedrooms. Eddie is immersed in this world and loves all of the excess and addictions, particularly the addiction to cocaine that leads to his downfall. This is the heavenly dream of the 1970's party scene - to indulge in drugs and sex forever.
The world of porn filmmaking is one aspect that writer-director Anderson does not fully explore.  Amber even tells Eddie to come inside her thereby ruining the close-up come shot in a hysterically funny scene. What Anderson is really interested in is the effect porn has on the crew members and the actors: there's a credible section involving one crew member (William H. Macy) who sees his wife, a porn star, continually having sex with other men at parties or on the street in plain view.
Eddie's rise and fall and rise again are the most startling chain of events in the movie - he becomes so heavily addicted to cocaine that he is fired by Jack on the set due to his temper tantrums.  It's a no-win situation and it shows that if sex is no longer an addiction for Eddie, then the gratification pleasure of his drugs is.
"Boogie Nights" has a similar structure to Scorsese's "GoodFellas" and "Casino" in the stylistic camerawork and editing, and the two-act structure where we see the eventual rise leading to the downward abyss where nothing is left except...more excess. The transition from the decadent 70's of promiscuity, endless blissful fun and halter tops to the nastier, more violent era of the 80's, where all that bliss and decadence peter out (Jack has to resort to making porno on video because it is cheaper), is handled flawlessly by the deftly written screenplay and the audacious, engaging narrative structure. Anderson's point is that those who survive in the 80's, including Eddie, will still succumb to their initial addictions because that is all they have.
"Boogie Nights" is a garish, violent, unsentimental, alternately funny, humanistic and intricately layered film that will stay with you. It has no particularly likable characters, easy resolutions or sentimental situations. What it does brilliantly, though, is to make us empathize with the characters and with the crucial decisions and surprising events that take place in their lives, and how they learn to cope with their emotions and move on. "Boogie Nights" is about as pure a cinematic treat as you're likely to get.
For more reviews, check out JERRY AT THE MOVIES at http://buffs.moviething.com/buffs/faust/
E-mail me with any questions, comments or complaints at<EMAIL_ADDRESS>or<EMAIL_ADDRESS>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


Gem County Fire-EMS maintains three fire stations; one in Emmett built in 1983, one in Letha built in 2002, and one at the intersection of Butte road and Van Deusen road built in 2010. The stations are manned by 2 full time employees and over 30 trained volunteer firefighters who are from various backgrounds from farmers to executives. The Fire District has 3 engines, 3 water tenders, 3 light brush trucks, 2 heavy brush trucks, 1 ladder truck, 1 extrication/rescue truck, and 2 command vehicles.
Learn MoreGem County Fire-EMS has a total of 5 ambulances and one Rescue, 4 ambulances are stationed at station #4 in Emmett and 1 is stationed in the Sweet area. Gem County Fire-EMS provides emergency medical services to all of Gem County. The station in Emmett is staffed with 1 Paramedic and 1 EMT 24 hours a day. During the event of multiple calls at the same time a on call crew responds for coverage of additional emergency calls. The department employs over 20 employees trained to respond to medical emergencies.
Learn More


Fear Profits a Man Nothing The 13th Warrior
By Ross Anthony A strong B+, "The 13th Warrior" is a medieval adventure picture climaxing in the big good fight.  Well, unlucky again, Banderas gets strapped in as the 13th warrior of evil.
Once on the path to the village, Banderas listens keenly to the Northmen as they gruffly mock each other and especially him in their own language. Finally, Bandaras defends himself (his mother actually) in their native tongue -- shocking them all into speaking English. (Well not really English, I mean it's supposed to be still Northmen-ese. But since we are more or less experiencing the adventure through the eyes and ears of Banderas, when he finally learns their language so then do we understand the words.) This turns out to be a rather clever way of avoiding subtitles, you feel that you've instead learned a foreign language and therefore need no translation.
Rather straight to the point, the film offers camaraderie, honor, and coarse field battles (not unlike "Braveheart") with great sound mixed into a fine score. The dark cinematography is pocked only at times by abrupt color changes that create bumpy seams between scenes. In fact, I felt a portion at the beginning of the film had been clipped out all together. Still a strong "B+" almost an "A-".
Starring Antonio Banderas, Vladimir Kulich, Dennis Storhoi, Daniel Southern, Neil Maffin. Directed by John McTiernan. Written by William Wisher and Warrne Lewis. Produced by John McTiernan, Michael Crichton, Ned Dowd at Touchstone. Rated R.
Grade..........................B+
Copyright © 1999 Ross Anthony, currently based in Los Angeles, has scripted and shot documentaries, music videos, and shorts in 35 countries across North America, Europe, Africa and Asia. For more reviews visit: http://RossAnthony.com
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


Before Change
period=-1*ms))
// Period is smaller than the highest spike time
assert_raises(ValueError, lambda: SpikeGeneratorGroup(1, [0], [2]*ms,
period=1*ms))
// Period is not an integer multiple of dt
SG = SpikeGeneratorGroup(1, [], []*second, period=1.25*ms, dt=0.1*ms)
net = Network(SG)
assert_raises(NotImplementedError, lambda: net.run(0*ms))
After Change
inconsistent period and dt arguments.
"""
// Period is negative
with pytest.raises(ValueError):
SpikeGeneratorGroup(1, [], []*second, period=-1*ms)
// Period is smaller than the highest spike time
with pytest.raises(ValueError):
SpikeGeneratorGroup(1, [0], [2]*ms, period=1*ms)
// Period is not an integer multiple of dt
SG = SpikeGeneratorGroup(1, [], []*second, period=1.25*ms, dt=0.1*ms)
net = Network(SG)
with pytest.raises(NotImplementedError):
net.run(0*ms)


Are you experiencing thirty to sixty day lag times in having your construction draw request/account receivable reviewed, approved and funded by the prime or public sector unit? Accordingly, CFA is prepared to advance funds to you under an approved line of credit to your company, within five days of your draw request/account receivable being submitted to the prime or public sector.
02
How do I get funds into my account?
After your request is reviewed and approved by CFA, the funds requested will be wired into your operating account by 2:00PM on the day of final approval.
03
How do I know if I am a candidate for a loan?
If you are a small contractor or a small prime which operates on a very tight cash flow and which has demonstrated a strong, honest and competent reputation, you qualify as a candidate for the services of CFA.
04
Does the funding process create an additional operational commitment in my company?
The request process includes the preparation of a one page advance calculation coupled with a copy of the draw request/account receivable being submitted to the prime or public sector unit.
05
How much can I borrow?
The line of credit is limited to a total of $500K subject to no more than four draws against the line of credit.
06
What is the cost of the line of credit?
CFA charges a 5% facility fee. The facility fee is netted out of the advance request resulting in only 95% of the advance request being funded. If the advance is not paid back by the end of sixty days, then on the sixty-first day interest will accrue at Prime + 10% for the next thirty days; at which time the advance must be paid off. If the advance is paid off prior to sixty days, CFA will refund 1.25% of the facility fee.
07
Are there any additional costs?
In addition to a facility fee and an interest rate commencing on the sixty-first day of the advance, there is an application fee of $250 and a document preparation fee of $500.


MEOWTH! THAT'S RIGHT!
Hailing from Windsor, Ontario Canada, Adam enjoys sitting quietly and/or staring out the window at nothing in particular. On a list of hobbies he would have: Hiking, camping, video games, and going to the movies. Of 3 siblings, Adam is his mother’s favorite — he knows. During the creation of this project, Adam voted himself the third Most Valuable Contributor behind only Joseph and Duane. Adam’s future plans include finishing 401 then while conducting his job search, win the lottery and retire to his estate where he will sit quietly and stare out the window for the rest of his days. He’s also super single. Long walks. Beaches. Candle light. Etc.
MAKE IT DOUBLE!
Hello! My name is Duane Rush and thank you for visiting our site. I am a former biologist gone software developer. I was born in Tacoma and raised in Gig Harbor until the end of second grade. Then my family moved to the Palm Springs area of California until we moved back to Washington after I was out of High School. I obtained my bachelors degree in Cell Biology from Central Washington University and after graduating worked a job that showed me that this was not the path I wanted my life to take. So now here I am at code fellows! Some other cool facts about me would be that I love animals, video games, most things nerdy as well as being on the water as much as possible.
PREPARE FOR TROUBLE!
My name is Joseph Kim. I recently graduated from the University of Washington with a degree in mathematics. During my time at UW, I had the opportunity to take the introductory Java courses and have been intrigued by computer science ever since. After graduation, I worked briefly in IT and my plan now is to take the 401 Python class, get a job, and eventually return to school to get a proper computer science degree.


Auto Complete Type:
Geodode
Establishment
Address
Enter an address:
Address = {{vm.place.formatted_address}}
Location: {{vm.place.geometry.location}}
address : {{vm.address}}


The Best App
Link to some page
Link to some page
Link to some page
Link to some page
Link to some page
element after nav


Numbers 2:14
Then the tribe of Gad: and the captain of the sons of Gad shall be Eliasaph the son of Reuel.


Default
Set themes to buttons, not to group:
Set themes to groups:
Set modifiers to buttons, not to groups:
Set modifiers to groups, not to buttons:


close
{{ current.title }}
{{ current.artist }}
{{ muted ? 'volume_off' : 'volume_up' }}
schedule
{{ position | time }} / {{ duration | time }}
Sources
close
note_add
Play local audio files
add
Import playlist from hard drive
wifi_tethering
Import playlist from '{{ source }}'
loop
add
Online playlist
Playlist
close
{{ stream.title }}
{{ current == playlist[index] && playing ? 'pause' : 'play_arrow' }}
TODO: Add pagination (http://framework7.io/docs/infinite-scroll.html)
Play on
close
Scanning for available devices this may take a while ...
cast
{{ device.name }}
play_arrow
INFO: Player status: idle
Settings
close
Load last playlist on start
Last.fm cover


Pokemon is a series of video games developed by Game Freak and published by Nintendo and The Pokemon Company as part of the Pokemon media franchise. Created by Satoshi Tajiri with assistance from Ken Sugimori,the first games released in 1996 in Japan for the Game Boy, and the main series of role-playing video games (RPGs), also referred as the "core series" by their developers
Let us know some pokemon types.
Water is one of the three basic elemental types along with Fire and Grass, which constitute the three starter Pokemon. This creates a simple triangle to explain the type concept easily to new platers. Water is the most common type with over 100 Pokemon, which are vased on a wide variety of fish and other sea-dwelling creatures.
Fire is one of the three basic elemental types along with Water and Grass, which constitute the three starter Pokemon. This creates a simple triangle to explain the type comcept easily to new platers. Fire types are notoriously rare in the early stages of the games so choosing the Fire variation starter is often a plus.
Grass is one of the three basic elemental types along with Fire and WAter, which consitute the three starter Pokemon. This creates a simple triangle to explain the type concept easily to new platers.Grass is one of the weakest types statistically, with 5 defensive weaknesses and 7 types that are resistant to Grass moves.
Statistics of weight lossThe AR game's potential for weight loss was a big part of that discussion. In the process getting out their doors and visiting parks, players found they were losing weight almost in spite of themselves. A Reddit Pokemon Go fan won acclaim for reporting that he'd lost 65 pounds between July and December. |
Statistics of app downloadsPokemon Go is one of the most successful mobile games of all time, breaking records like fastest to earn $100 million and most-downloaded in its first month of release. To date, it has grossed almost $2 billion in revenue and been downloaded 800 million times. Although no longer the global phenomenon it was in 2016, the game remains incredbly popular. |
GreninjaWater/Dark |
"Greninja is the final evolution of Pokemon X and Y water-type starter Froakie. It has the ability to take on an appearance resembling its trainer. Pokedex says: Greninja creates throwing stars out of compressed water. When it spins them and throws them at high speed, these stars can split metal in two." |
|
LucarioFighting, Steelr |
"Lucario is a bipedal, wolf-like Pokemon with blue, cream, and black fur. It is considered to be prideful and loyal to its trainer. Pokedes says: By catching the aura emanating from others, Lucario can read their thoughts and movements." |
|
MimikyuGhost Fairy |
"Mimikyu caused quite a stir fo its peculiar looks and sad backstory when it was originally announced for Pokemon Sun and Moon in 2016. Mimikyu is described as a Pokemon who felt so lonly that it decided to wear a rag in order to look like Pikachu, everyone's favorite Pokemon. Pokedex says: Its actual appearance is unknown. A scholar who saw what was under its rag was overwhelmed by terror and died from the shock." |
|
CharizardFlying, Fire |
"Charizard is an orange draconic Pokemon who has a fiery tempter. It is the final evolution of Charmander, one of the starter Pokemon for the original game. Pokedex says: Charizard flies around the sky in search of powerful opponents. It breathes fire of such great heat that it melts anything. However, it never turns its fiery breath on any opponent weaker than itself." |
Question Every Pokemon Trainer Should Be Able To Answer
Here's a Pokemon Go type chart to get you started on what's effective against what.
Pokemon Battles appear in most forms of Pokemon media, being the central gameplay aspect of the core series games, as well as being a constant focus of the anime.
Pokemon Go's Types are exactly the same as those in the main Pokemon games, but the effect of those type matchups os slightly different: in brief, things like effective or resisted attacks have slightly different multipliers to the main Polemon games- although a December 2018 update brought them slightly closer in line.
| Type | Strong Against | Weak Against | Resistant To |
|---|---|---|---|
| Normal | None | Rock, Ghost, Steel | Ghost |
| Fighting | Normal, Rock, Steel, Ice, Dark | Flying, Poison, Psychic, Bug, Ghost, Fairy | Rock, Bug, Dark |
| Flying | Fighting, Bug, Grass | Rock, Steel, Electric | Fighing, Ground, Bug, Grass |
| Poison | Grass, Fairy | Poison, Ground, Rock, Ghost, Steel | Fighting, Poison, Grass, Fairy |
| Ground | Poison, Rock, Steel, Fire, Electric | Flying, Bug, Grass | Poison, Rock, Electric |
Pokemon Go in 2020 continues to add new features, such the arrival of the Go Battle League, Remote Raids and the trade evolution feature. There are also planned changes to PokeCoins on the way. Meanwhile, coming soon is the Johto Throwback quest.
Greninja
Ability: Torrent
Ash |
"Ash Ketchum, known as Satoshi in Japan, is a fictional character in the Pokemon franchise owned by Nintendo. He is the protagonist of the Pokemon anime and certain manga series as well as on various merchandise related to the franchise. In Japanese, the character is voiced by Rika Matsumoto, and Hana Takeda." |
|
LanceDragon Master |
"Lance is a recurring character in Pokemon. He is a user of Dragon-types being the final Elite Four member in Red, Blue and their remakes. In Pokemon Gold, Silver, Crystal and their remakes, he is the Champion.Lance has appeared in the Pokemon series games from Generation I-III. He first appeared in the original Red and Blue games, being the final member of the Elite Four, and again in Generation III's Red and Blue remakes, FireRed and LeafGreen. Lance in the Genertion II games differed from the previous though, as he was Pokemon Champion by this time." |
|
CynthiaShirona |
"Cynthia is a powerful Pokemon trainer and the Champion of the Sinnoh region where Professor Carolina, Cynthia's grandmother, runs the Pokemon Research Lab in Celestic Town. She enjoys visiting the Solaceon Town Ruins. Later, in Pokemon: DP Galactic Battles, she helps fight Team Galactic as well. In the anime, she has a vill in east Unova but in the Pokemon Black and White Games, she borrows Caitlin's villa (from the Elite Four)." |
|
Ipsum loermOokido Yukinari |
"Ookido Youkinari Hakaseamuel Oak is most notable for his vast research facility, where he cares for and studies hundreds of Pokemon, incluking those owned by, but not currently traveling with, Trainers from Pallet Town. He has confidence in his grandson, Gary Oak, but more often joins Ash's mother and friends in cheering on Ash in his competitions." |
(1996-1999)
(2002-2006)
(1999-2002)
(2006-2010)
Pokemon Sleep is an upcoming mobile game for Android and iOS, as part of the Pokemon series.
Publisher: Ther Pokemon Company
Take a pokemonTM jouney to the Kanto region with your energetic partner, Pikachu!
Publishers: Nintendo, The Pokemon Company
Pokemon Go is a 2016 augmented reality mobile game developed.
Developer: Niantic
"Junich Masuda is a Japanese video game composer, director, designer, producer, singer, and programmer best known for his work in the Pokemon franchise. He is a member of the Game Freak board of directors, and has been employed at the company since 1989 when he founded it along Satoshi Tajiri and Ken Sugimori"
"Shigeki Morimoto is a game designer and programmer currently working at Game Freak. He has been involved in nearly every main series Pokemon game, since Pokemon Red and Blue Versions where he was a programmer, and the creater of the battle system and the Pokemon "Mew"."
"Ken Sugimori is a Japanesevideo game designer, illustrator, manga artist, and director. He is most famous as the character designer and art director for the Pokemon franchise. Sugimori is also credited with the art direction for other titles, including Pulseman"


version 1.0
Thank you for buying Sunray Admin and supporting Redstartheme. Feel free to contact me if you have any questions.
Also, email me if you have any feature requests or advises, I'll happy to help you.
Our promise is that Pleasure will be constantly kept up to date.
Thank You.
The Sunray Hospital Admin is a Bootstrap 4 admin dashboard template with huge collection of reusable UI components and integrated with jQuery plugins. Template have also Material Design components, which you can use in your application.
Sunray Hospital Admin is a lightweight and easy to use, clean and polished, resourceful and reliable, responsive HTML5 and Bootstrap 4 admin template.It works natively on mobile devices, making it an accessible way of managing your own website from wherever you are.
Admin/
Documentation/ ├── css/ ├── Fonts/ └── Images/ └── Js/ └── index.html/ Source/ └── assets/ └──css/ └──img/ └──js/ └──plugins/ └── admin/ └──fonts/ └──.html/
The Sunray Admin comes with 21 different combinations themes, User can select any theme as per her/his choice.
Key point in Sunray Admin is the custom theme, You cam set ANY COLOR theme of your choice.
You need to change in theme-color.css
file in css folder. You can set color for --sidebar-color
--sidebar-font-color
--logo-color
--header-color
value as per your choice. Just delete header-white dark-sidebar-color logo-dark
from body
tag
and add header-custom custom-sidebar-color logo-custom
class in body
tag. Thats it !!!
This template is fully responsive and fluid layout. Following are the general structures.
Below code is used at the beginning of all HTML pages
<!DOCTYPE html> <html lang="en"> <head>Sunray | Bootstrap Responsive Hospital Admin Template </head>
Following are the markup of main structure.
.......
Following are the markup of left side. Which contains logo and side bar navigation.


Include file ‘gallery images=images caption=”” cols=3’ contains invalid characters or sequences Anybody who has looked into the abyss of his or her consciousness knows that the abyss looks back at you, as Nietzche said. The unconscious mind is a very live and active zoo of escaped animals raging about in pure chaos and savagery.  And in all of this unintelligible impulse speaks back from the chasm some kind of insidious intelligence. In modern psychology, this hidden intentionality has been called the id, the shadow, or the unconscious.
Pluma Blanca called this entity “psorax”. His definition of this entity of the unconscious is much more mystical and profound than any other explanation that I know. It is more of a practical understanding of how the mind creates frustrated realities that remain trapped within one, like an itch under the skin. He called it psorax because he saw it as the vital, pranic energy that becomes contaminated and gets trapped behind the skin, in the physical body. This blocked vitality distorts the body’s natural functions and may accumulate like a festering sore attracting more mental parasites like itself to itself, thus making a hodge-podge stew of evil and illness. This idea makes more sense when one understands deeply the relation between the mind and the body and how prana, or vital energy moves between them. Psorax is a trapped energy, a mental plasm that can’t effectively project itself outwardly as it would like to. Each time it does it becomes even more frustrated. It has the intelligence of mind behind it, but the frustrated intentionality toward matter, or the physical body pulling upon it. This is the reason that by living with false ideas about oneself or the world is the greatest danger of conscious, human existence. Materialism is the greatest of deprivations as it destroys the mind slowly but surely. Not having this clarity and responsibility of how each one of us is a co-creator in this creation always leads to a fall. Psorax is a psycho-physical entity that in some ways is self-created by the individual while at the same time is aided by the fact that there are exchanges between these entities of psorax between human beings, or minds incarnated in physical human bodies. One can receive as well as transmit this psychic virus in much the same way that one receives and transmits physical viruses. A practical example: you are at peace. There are only a few light, positive thoughts in the mind and some pleasant feelings. Behind this subtle activity of mind is a deep, mysterious witness that just pleasantly is. Out of nowhere, it seems, there enters a dark, violent image on the mental scene. Is it my own unconscious attacking my peace, or is it because another person has come near and I sense his suffering? If I’m not at peace, then I may never understand and just get locked into a reception and transmission of negativity. This seed wants to take root within me, it vibrates my body and perhaps excites some memories and fears. It wants to become one with me. Only from a state of deep calm and non- judgement one can begin to witness these activities; how they affect the mind, change the feelings, and even how and where these influences vibrate and take root in the physical body. Most importantly is to distinguish your’s from another’s psorax. Pluma Blanca was an advanced yogi as well as a healer, and used his pinnacled knowledge to observe these phenomenon, how they create physical and mental illness, and developed ways of curing these ailments based on this understanding. Deep, sincere meditation is of course the most effective manner of seeing and processing the shadow, but this depends on so much: mental health, physical health, determination and discernment that are only developed by ardent efforts in one’s spiritual life. In yoga, yama and niyama is the base of this practice. This practical morality imparts self awareness and practical universal ideas of how to maintain mental balance through proper personal and social responsibility. Without these fundamental ideas of humanism imparted to individuals one is but a mix of animal impulses and social determination, or a game of Russian roulette. A society without spiritual principles that foster ethical awareness is but a vehicle for destructive, unconscious forces where psorax takes all into the abyss. I think this is why Pluma Blanca lived in a cave and only taught a few good people. Anandamurti, on the other hand, impulsed others to fight within society against the depraving effects of what he termed “negative microvita”. Both are right according to who they were, where they were, and what they expressed as enlightened individuals. Its not enough to believe and conceptualize about such things. Beliefs and opinions give rise to superstition and dogmas about ghosts, hauntings, and possessions, and the like. Without the efforts of both of these men who spoke about these phenomenon in the most practical and scientific manner possible to speak of such phenomenon, I know that I would be even more in the dark about understanding negative microvita or psorax, and perhaps be yapping about the devil and hell-fire and salvation.
</div> </div> </div> </div>


MAIN POST
About me!
Yuuki is currently a Second year undergraduate student at University of Essex, majoring in Biological Sciences including Placement Year. He expects to graduate in June 2022 and is looking for opportunities in the fields of Bioinformatics, Immunology, Molecular and Cellular Biology. Born and raised in America to an Italian mother and Japanese father, he then moved to England where he is now studying a B.S. in Biological Sciences at the University of Essex.


How the EastEnders characters voted in the Brexit referendum - and why
EastEnders has never been shy at tentatively dipping its toe into the world of politics, with the show inserting topical scenes seeing characters discuss major events such as the Brexit referendum. But while we got quite a stilted and balanced conversation at the Queen Vic after the vote to leave was announced, how would the characters have actually voted?
Comedian Sooz Kempner (@SoozUK) has delved through the roster of characters to have a look at just that – and her observations are utterly on point. From Dot Branning’s (June Brown) confusion over racial issues and Grant Mitchell (Ross Kemp) Brexiting from abroad through to Sonia Fowler (Natalie Cassidy) constantly reminding everyone that she is an NHS nurse and Stacey Fowler (Lacey Turner) voting remain because pizzas come from Italy, just about every response you’ve ever heard any vote here is represented by the Walford constituents.
Here is the thread in full to be enjoyed:
Advertisement Advertisement
Our personal highlights include:
Grant Mitchell
Leave. Postal vote from Portugal.
Phil Mitchell
Remain. For a while it looked like he wasn’t going to get in to a feud with Grant over this but then Grant called him “a Remoaner” in the Mitchell WhatsApp group and now they’re not speaking again.
Peggy Mitchell
Remain. Regrets the time she welcomed Boris Johnson in to the Queen Vic, now wishing she’d “nutted the twat”, get outta my pub etc etc.
Bianca Butcher
Leave. Very keen on the theory that all politicians are liars and she doesn’t trust a single one of them. Was going to vote Brexit Party on December 12th but they’re not standing in her constituency so Farage is a traitor to her now too. Will now vote Tory.
Sonia Fowler
Remain. Begins every comment about Brexit by putting a hand to her chest and saying ‘as an NHS nurse’ and all her points are valid but people sure are tired of hearing them.
Martin Fowler
Remain.
Stacey Fowler
Remain. Thinks raising her eyebrows and telling people ‘pizza…kebabs…Danish pastries…they’re all from Europe’ is a valid point well made.
Ian Beale
Leave. Sweats with regret every time he thinks about it. Refuses to vote Labour but desperate for a second referendum. For a while went round saying that ‘Boris Johnson will get us a second vote, mark my words’ but he didn’t believe that and neither does anyone else.
Advertisement Advertisement
Among other characters who were assessed by Sooz’s cutting analysis were Frank and Pat Butcher, Alfie Moon and all four Ben Mitchells.
Brexit might not bring us many light moments – but we certainly enjoyed this one!


--- layout: help ---
Two utility methods, Fail() and Ignore() are provided in order to allow more direct control of the test process:
Assert.Fail(); Assert.Fail( string message ); Assert.Fail( string message, object[] parms ); Assert.Ignore(); Assert.Ignore( string message ); Assert.Ignore( string message, object[] parms );
The Assert.Fail method provides you with the ability to generate a failure based on tests that are not encapsulated by the other methods. It is also useful in developing your own project-specific assertions.
Here's an example of its use to create a private assertion that tests whether a string contains an expected value.
public void AssertStringContains( string expected, string actual ) { AssertStringContains( expected, actual, string.Empty ); } public void AssertStringContains( string expected, string actual, string message ) { if ( actual.IndexOf( expected ) < 0 ) Assert.Fail( message ); }
The Assert.Ignore method provides you with the ability to dynamically cause a test or suite to be ignored at runtime. It may be called in a test, setup or fixture setup method. We recommend that you use this only in isolated cases. The category facility is provided for more extensive inclusion or exclusion of tests or you may elect to simply divide tests run on different occasions into different assemblies.


--- layout: archive title: Zulip Chat Archive permalink: /stream/113488-general/topic/CPU.20overload.2Boverheat.html ---
2018-09-07.png
Lean uses a lot of the memory and heats up my laptop a lot
Works as intended
Do you think we'll have Lean on GPU one day?
Because it's important to make sure that lean destroys your whole computer, not just the CPU area
{% endraw %}Last updated: Apr 24 2020 at 19:02 UTC


To solve that problem we can register on animation SlideInOut event done To get control remove the content not before animation has been finished we register to beforeRemove event on ngx-responsivemenu-overflow directive.
Now after the animation is done we notify the async event all has been done, so the overflow can removed from dom


Current Plan
Unlimited access to essential tools for design, bootstrap themes, illustrator and icons.
Next Payment: on $499.00 USD Jan 1, 2022
E-mail<EMAIL_ADDRESS>Phone:<PHONE_NUMBER>
E-mail<EMAIL_ADDRESS>Phone:<PHONE_NUMBER>


*FOR IMMEDIATE RELEASE*
June 9, 2014
Contact: Megan Perry<EMAIL_ADDRESS>703-522-2214
Women’s Rights Groups Demand that U.S. Stop Negotiating TPP with Brunei Until the Sultan Revokes New Taliban-Like Laws
WASHINGTON – A coalition of women’s rights groups have joined the Feminist Majority Foundation (FMF) in calling for the Obama Administration to initiate the process of removing Brunei from negotiations on a prospective Trans-Pacific Partnership (TPP) agreement with the United States – or to suspend TPP talks – until Brunei revokes its new Taliban-like penal code.
“Women’s rights and human rights cannot take a backseat to profit and trade,” said FMF President Eleanor Smeal. “As a global leader, the United States should not negotiate a free trade agreement with a country that has enacted laws hostile to basic human rights and dignity.”
Twelve women’s rights organizations – including FMF, American Association of University Women, the Clearinghouse on Women’s Issues, the Institute for Science and Human Values, Jewish Women International, National Center for Lesbian Rights, National Council of Jewish Women, the National Organization for Women, the Women’s Global Program of the Communications Consortium Media Center, Women’s Online Media and Education Network, and the U.S. National Committee for UN Women – delivered a letter to the White House expressing outrage over Brunei’s new penal code and asking the Administration stop negotiating the TPP with Brunei.
The Trans-Pacific Partnership is a proposed regional free trade agreement being negotiated between the U.S. and Australia, Brunei, Canada, Chile, Japan, Malaysia, Mexico, New Zealand, Peru, Singapore, and Vietnam. The TPP addresses a broad range of issues, including trade in goods and services; regulation of intellectual property and foreign investments; as well as labor and environmental rules, among other topics. TPP negotiations have been ongoing since 2010, with very little information about the negotiated documents released to Congress or to the public.
“The U.S. must insist that Brunei address human rights concerns by revoking its penal code before the U.S. continues negotiations with Brunei on the TPP,” continued Smeal. “There is simply no place in a civilized society for kill-a-gay and flog-a-woman penal codes. Our foreign policy should make that clear, especially in the execution of our trade agreements.”
The Office of the United Nations High Commissioner on Human Rights has expressed deep concern about Brunei’s new penal code and stated that its draconian punishments would violate international law. The new penal code, which went into effect on May 1, is set to be implemented in three phases. The first phase includes fines and prison sentences for such “crimes” as becoming pregnant outside of marriage. The second phase includes corporal punishment, such as amputations and flogging of women who have abortions. The third phase includes the stoning to death of gay men and lesbians and those convicted of adultery.
FMF has launched a petition drive and social media campaig calling on the Sultan of Brunei to revoke the new penal code [ http://bit.ly/StopTheSultan ], and together with Mavis and Jay Leno, held a rally in Los Angeles, California on May 5 across from the Beverly Hills Hotel – part of the Dorchester Collection of properties, owned by the Sultan – to protest the law.
###
1600 Wilson Boulevard, Suite 801, Arlington, VA, 22209 |<PHONE_NUMBER> |<EMAIL_ADDRESS>You have received this e-mail because of your interest in women’s issues. To unsubscribe, please click here. [ http://org.salsalabs.com/o/1400/p/salsa/supporter/unsubscribe/public/index.sjs?unsubscribe_page_KEY=494 ]


class: center, middle # IEMS 5780
Building and Deploying Scalable
Machine Learning Services ### Lecture 3 - Text Classification (1) #### Albert Au Yeung
20th September, 2019 --- class: center, middle # Text Classification --- # What is Text Classification? * Putting a piece of **text** into a suitable **category** * Categories / classes are **pre-defined** * An example of **supervised learning** * **Inputs** - text (e.g. news article, user reviews, email content) * **Output** - topics / categories (e.g. sports / financial / technology news. or spam / non-spam emails) - polarity of opinions (e.g. positive, neutral, negative) - relevancy - tags (multi-label classification task, e.g. [predicting tags for stackoverflow questions](https://archive.org/details/stackexchange) --- # Spam Email Detection * [https://developers.google.com/machine-learning/guides/text-classification/]([https://developers.google.com/machine-learning/guides/text-classification/])
--- # Characteristics of Text Classification - Highly **unstructured** (not in tabular format) - Data can be very **noisy** - Unput can be very short (e.g. "Nice restaurant!"), and can also be very long (e.g. a detailed report of an event on a newspaper) - unseen data very likely to contain **unseen features** (new words, phrases, symbols or codes) - Many new features might come up over time (e.g. new jargons, new words) - Things can become very different across **different languages** - ... --- # Features & Representation * Since texts are **not structured** input, we need some ways to convert a text into a **vector representation** (feature vectors) * What would be the **features** `\(X\)` of a text document? - Individual **words** / **phrases** / **sentences** - Can also consider: - **Length** of the text - Existence of special **entities** in the text (e.g. person names, organizations, countries, etc.) - Source (e.g. which newspaper it is from) - **Date/time** of creation, publication, modification, etc. - ... --- class: middle, center # Natural Language Processing --- # Natural Language Processing * NLP involves making the computer **understand** natural language input and **generate** natural language output * It is a field that involves computer science, linguistics, artificial intelligence, human-computer interface, etc.
--- # Examples: Real-time Speech Translation * [Real-time Skype Translator by Microsoft Research](https://www.youtube.com/watch?v=JrlTzS7Fk6o) * [AI Powered Machine Translation](https://www.youtube.com/watch?v=GYiU3hyMMxs) * [Skype Translator: Speak Chinese like a local](https://www.youtube.com/watch?v=mWTySUGXR2k) --- # How is NLP Done? * Natural languages are usually **unstructured**, in which we find **alphabets**, **symbols**, **numbers and codes**, and even **emojis**. * We need to apply different **pre-processing** algorithms before we can use the data for analysis and machine learning * Common preprocessing tasks: - Tokenization - Stemming - Term Weighting - Parsing - Part-of-Speech (POS) Tagging - Pattern extraction using regular expressions --- # Tokenization * **Token** is a unit in natural language processing * Usually it is a word in English (or other languages using Latin alphabets), separated by space * **Tokenization** = breaking up the raw text into words (or other meaningful units) * Problems: - How do we treat punctuations? - John’s book (John + ‘s + book ?) - Doesn't (does + not, or does + n’t ?) - Hyphenated words: so-called, high-risk, anti-social --- # Chinese (Asian Languages) Segmentation * There is no space between words/phrases in Chinese and other **Asian languages** such as Japanese and Korean ```json 超強颱風「山竹」目前集結太平洋地區，料明日登陸菲律賓，周日再吹襲香港。 美國氣象學家警告，「山竹」威力相等於5級颶風，比吹襲美東颶風「佛羅倫斯」 更強。菲律賓政府嚴陣以待，並已疏散120萬名沿岸居民。 ``` ```json 大阪府北部地震や台風２１号など度重なる災害を受け、京都市は１４日、 各省庁への要望活動を始めた。停電の早期解消に向けた関西電力の指導や、 二条城などの文化財の復旧を支援する制度の拡充を国に求めた。 ``` ```json 스마트폰과 4세대(4G) 롱텀에볼루션(LTE)으로 재편된 휴대전화 시장에 2세대(2G)폰이 2년 만에 나온다. 삼성전자는 이달 중 폴더폰 '와이즈2 2G(모델명 SHC-Z160S)'를 SK텔레콤을 통해 출시한다. 국내 휴대전화 시장에 2G폰이 출시되는 것은 2011년 LG전자 ``` --- # Tokenizing in Python * A commonly used tokenizer in **English** is the one provided by the [Natural Language ToolKit (NLTK)](https://www.nltk.org/) * Example: ```python import nltk sentence = "Antoni Gaudí was a Spanish architect from Catalonia." nltk.word_tokenize(sentence) # ['Antoni', 'Gaudí', 'was', 'a', 'Spanish', 'architect', 'from', 'Catalonia', '.'] sentence = "Every morning I wake up at about seven o'clock." nltk.word_tokenize(sentence) # ['Every', 'morning', 'I', 'wake', 'up', 'at', 'about', 'seven', "o'clock", '.'] ``` --- # Tokenizing in Python * In Chinese, a commonly used open source package is called [jieba](https://github.com/fxsjy/jieba) * Example: ```python import jieba sentence = "超強颱風「山竹」目前集結太平洋地區，料明日登陸菲律賓，周日再吹襲香港。" tokens = list(jieba.cut(s)) # ['超強', '颱', '風', '「', '山竹', '」', '目前', '集結', '太平洋', # '地區', '，', '料', '明日', '登陸菲律賓', '，', '周日', '再吹襲', # '香港', '。'] ``` --- # Normalization * A related issue: words in uppercase or lowercase * E.g. Usually we do not want to treat `house`, `House` and `HOUSE` differently * Normally, we convert all words into lowercases (lowercasing) (*Problem?*) * Truecasing: try to preserve uppercase in entity names, in order to distinguish between something like `Mr. Brown` and `brown colour`. --- # Stemming * A word may appear in different forms, consider: - cat, cats / bus, buses - run, running, runs - fun, funny / beautiful, beautifully * **Stemming** is the action of reducing words to its **stem** or **root** - cat, cats --> cat - run, running, runs --> run * Many different ways to do this: - Lookup table - Rule-based (Suffix stripping) - Stochastic methods (machine learning) --- # Stemming * The widely used stemming method used is the [Porter Stemmer](https://tartarus.org/martin/PorterStemmer/), invented by Martin F. Porter in 1980. * Available in many different programming languages (e.g. C, C++, Python, Java, etc.) * Demo available at: http://qaa.ath.cx/porter_js_demo.html ```python from nltk.stem.porter import PorterStemmer stemmer = PorterStemmer() stemmer.stem("running"), stemmer.stem("run"), stemmer.stem("runs") # All returns 'run' stemmer.stem("beauty"), stemmer.stem("beautiful") # All returns 'beauti' ``` --- # Parts of Speech * Words have different **roles** in a sentence: - **nouns** (e.g. house, car, people) - **verbs** (e.g. run, walk, pay, eat) - **adjectives** (e.g. beautiful, quick) * Roughly, we can divide words into two broad categories: - Content words (e.g. nouns, verbs) - Function words (e.g. prepositions) * **Content words** are also called **open-class** words (not a finite set of words, word can be created or become obsolete) * **Function words** are called **close-class** words, because usually, they do not change over a long period of time. --- class: split # Parts of Speech .column-left[
] .column-right[ * [Penn tree bank POS Tags](https://www.ling.upenn.edu/courses/Fall_2003/ling001/penn_treebank_pos.html) ] --- # Parts of Speech * **POS tagging** can be treated as a **machine learning** problem * Given a token and its features (e.g. the word itself, previous word, next word, prefix/suffix of the word), predict its POS tag * A **trained model** can be found in NLTK ```python import nltk sentence = "Antoni Gaudí was a Spanish architect from Catalonia." tokens = nltk.word_tokenize(sentence) pos_tagged = nltk.pos_tag(tokens) # [('Antoni', 'NNP'), ('Gaudí', 'NNP'), ('was', 'VBD'), ('a', 'DT'), # ('Spanish', 'JJ'), ('architect', 'NN'), ('from', 'IN'), # ('Catalonia', 'NNP'), ('.', '.')] ``` --- class: middle, center # Document Representation --- # Document Representation * How do we **represent** a document in a program? * We need to represent documents as a **feature vector** before we can **classify** them * A commonly used representation is called the **bag-of-words model (bow)** * Ignore any grammar, dependencies, punctuations, part-of-speech, etc. * Order of word is assumed to be **NOT** important
--- # Bag-of-words Model * Once each document is represented by a **bag of words**, we can use a **vector** to represent each of them * Firstly, let `\(N\)` be the total number of unique words (i.e. the **size** of our *vocabulary**) * We can use a vector of length `\(N\)` (N-dimension) to represent a document - Each element in the vector corresponds to **one unique word** - The element is 1 if the document contains the word, otherwise it is 0 * This is called **one-hot encoding** * For example, if we have a vocabulary of (0="boy", 1="girl", 2="school"), a document with two words `boy` and `school` will be represented by the following vector: $$ v = (1, 0, 1)$$ --- # Vector Space Representation * This **vector space representation** of document can be extended * The value in the vectors can be assigned **different** meanings - Existence of individual words (0 or 1) - Number of times a word appears (0, 1, 2, ...) - A certain weighting assigned to the word (any real number) * Intuitively, a word that appears more than the others should be more important * However, some words are commonly used in general - articles (a, an, the) - pronouns (his, her, we, you, ...) - prepositions (of, in, over, ...) * How can we assign a **meaningful weight**? --- # Term Weighting * A commonly used **term weighting** scheme is called **tf-idf** (term frequency-inverse document frequency) * Determine the **importance** of a word to a document by how often they appear across the whole corpus * Consider a corpus with five documents:
--- # TF-IDF * Term Frequency (tf) $$ tf(w, d) = \text{Number of times } w \text{ appears in } d $$ * Document Frequency (df) $$ df(w) = \text{Number of documents that contain } w $$ * Inverse Document Frequency (idf) - Rare words has high idf, frequent words has low idf $$ idf(w) = log ( N / df(w)) $$ $$ tfidf(w, d) = tf(w, d) \times idf(w) $$ --- # TF-IDF
* Example: comparing importance of the word `china` vs. `and` $$ tfidf(\text{china}, d_2) = 1 \times log \frac{5}{2} = 0.3979 $$ $$ tfidf(\text{and}, d_2) = 1 \times log \frac{5}{4} = 0.0969 $$ --- # Transforming Documents in Scikit-learn * In Python, you can use the [CountVectorizer](http://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.text.CountVectorizer.html) or [TfidfVectorizer](http://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.text.TfidfVectorizer.html) to convert texts into vectors ```python from sklearn.feature_extraction.text import CountVectorizer docs = [ "CUHK is located in Shatin", "CUHK has a large campus", "Shatin is a district in the New Territories" ] vectorizer = CountVectorizer() vectorizer.fit(docs) # Create the vocabulary vectorizer.vocabulary # {'located': 7, 'has': 3, 'new': 8, 'shatin': 9, 'the': 11, 'cuhk': 1, # 'territories': 10, 'district': 2, 'is': 5, 'in': 4, 'campus': 0, 'large': 6} vectorizer.transform(["CUHK is in Shatin"]).todense() # matrix([[0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0]]) ``` --- # TfidfVectorizer ```python from sklearn.feature_extraction.text import TfidfVectorizer docs = [ "CUHK is located in Shatin", "CUHK has a large campus", "Shatin is a district in the New Territories" ] vectorizer = TfidfVectorizer() vectorizer.fit(docs) # Create the vocabulary vectorizer.vocabulary # {'located': 7, 'has': 3, 'new': 8, 'shatin': 9, 'the': 11, 'cuhk': 1, # 'territories': 10, 'district': 2, 'is': 5, 'in': 4, 'campus': 0, 'large': 6} vectorizer.transform(["CUHK is in Shatin"]).todense() # matrix([[0. , 0.5, 0. , 0. , 0.5, 0.5, 0. , 0. , 0. , 0.5, 0. , 0. ]]) ``` --- class: middle, center # Models for Text Classification --- # Models for Text Classification ### Characteristics of data * Huge number of features (high dimensionality) * Very sparse data (most words appear only appear a few times) ### Suitable Models * Logistic Regression * SVM * Naive Bayes * Neural networks (next lecture) --- # Logistic Regression * Recall that logistic regression is a **linear model** for classification
* `\(\boldsymbol{x}\)` is a feature vector of an input * Using the vector space model, each document is represented as a feature vector `\(\boldsymbol{x}_i\)`, whose dimension is `\(N\)` (size of vocabulary) * What is our **assumptions** in such a model? - Each word is **independent** - Each word **contributes** some information (+ve or -ve) to whether the document belongs to one class or another --- # Logistic Regression * Let's try this on a toy example to classify whether a text is about CUHK * Check the [documentation of Logistic Regression](http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) on scikit-learn * Notebook: [https://drive.google.com/file/d/1tKfPsEhBKmyBgDaV5_vD-xy039fnc-Tg/view?usp=sharing](https://drive.google.com/file/d/1tKfPsEhBKmyBgDaV5_vD-xy039fnc-Tg/view?usp=sharing) * Our data: ```python docs = [ "CUHK is a university in Hong Kong", "Hong Kong is a city in Southeast Asia", "Asia is the most populous continent", "CUHK is located in Shatin" ] labels = [1, 0, 0, 1] ``` --- # Naïve Bayes Classifiers * **Naïve Bayes classifier** is a simple yet powerful probability-based classifier that can be applied to many different problems * Idea: Probability of a **document** belonging to a class depending on the probability of the **words** in the document belonging to the class * Some notations: $$ P(c) - \text{Probability of the class } c \\\ P(d|c) - \text{Probability of a document given class } c \\\ P(c|d) - \text{Probability of class } c \text{ given document } d \\\ P(w|c) - \text{Probability of a word } w \text{ given class } c $$ --- # Naïve Bayes Classifiers * Given a new document `\(d\)`, we want to decide which class it belongs to, i.e. we want to find a class `\(c\)` such that the following probability is the largest (compared to other classes) $$ P(c|d) $$ * How do we do so? * We can break the problem into smaller problems: - A document is composed of **individual words** - Let's assume that each word is **independent** - Each word has a different **probability** of appearing in a document of a class --- # Some Maths
* `\(P(w_1w_2\dots w_{n_d}|c)\)` is the joint probability of all words that appear in document `\(d\)` given that it is in class `\(c\)` * If we assume that each word appears independently, then the above can be simplified as the **product** of the probabilities of indiviudal words `\(w_i\)` * `\(P(c)\)` is the **prior probability** of class `\(c\)` --- # Training a Naive Bayes Classifier * When training a NB classifier, we actually want to estimate `\(P(c)\)` and `\(P(w_k|c)\)` $$ P(c) = \frac{\text{Number of documents in class } c}{\text{Total number of documents}} = \frac{N_c}{N} $$ $$ P(w|c) = \text{Probability of } w \text{ appearing in class } c = \frac{f(w, c)}{\sum_{w_i}f(w_i, c)} $$ * This is called the **maximum likelihood estimation** of the parameters in the Naive Bayes model --- # Naive Bayes Classifier * Let's try the toy example again using Naive Bayes classifier this time * Check the [documentation of Naive Bayes classifier](http://scikit-learn.org/stable/modules/generated/sklearn.naive_bayes.MultinomialNB.html#sklearn.naive_bayes.MultinomialNB) in scikit-learn * Notebook: [https://colab.research.google.com/drive/1lK0AT5vf8c4crF9F2mp1j7MGOxbcn0ei](https://colab.research.google.com/drive/1lK0AT5vf8c4crF9F2mp1j7MGOxbcn0ei) --- # Logistic Regression vs. Naive Bayes * The two models are very similar * Both assume that words are **independent** in a document * **Logistic Regression** is a **discriminative model** --> it tries to find out `\(p(y|x)\)` - Directly classifies the inputs into one of the classes * **Naive Bayes** is a **generative model** --> it tries to find out `\(p(x, y)\)` - Tries to model how data is generated, and use that information to perform classification - Models the differences in the probabilities of different classes (useful in the case of imbalanced dataset) * If you are interested, check out [a paper comparing logistic regression and naive bayes](https://papers.nips.cc/paper/2020-on-discriminative-vs-generative-classifiers-a-comparison-of-logistic-regression-and-naive-bayes) --- # Practical Example - Let's go through an example using the data below: - [SMS Spam Collection Dataset](https://archive.ics.uci.edu/ml/datasets/sms+spam+collection): 4,827 "ham" messages, 747 "spam" messages - We will use the following modules in scikit-learn: - `sklearn.feature_extraction.text.CountVectorizer` - `sklearn.naive_bayes.MultinomialNB` - `sklearn.pipeline.Pipeline`
(combining the count vectorizer and Naive Bayes model into a pipeline) - `sklearn.model_selection.train_test_split`
(for splitting data into train and test sets) - `roc_auc_score`, `precision_score`, `recall_score` in `sklearn.metrics`
(for evaluating our trained model) --- # Reading the Data - We can use `pandas` to read in the tab-separated data easily: ```python import pandas as pd # The data is tab-separated, and there is no header row df = pd.read_csv("data/sms/SMSSpamCollection", sep="\t", header=None) # Add column names, convert ham to 0 and spam to 1 df.columns = ["label", "text"] df.loc[:, "label"] = df["label"].apply(lambda x: 0 if x == "ham" else 1) ```
--- # Splitting in Train and Test Sets - We use `train_test_split` to split the dataset into train and test sets - Note that the data is **highly imbalanced**, so we need to use [**stratified sampling**](https://en.wikipedia.org/wiki/Stratified_sampling) ```python from sklearn.model_selection import train_test_split X = df["text"] y = df["label"] # We want to use 30% of the data as test data X_train, X_test, y_train, y_test = train_test_split( X, y, test_size=0.3, stratify=y, random_state=100) ``` - Note: Always specify an integer for `random_state` so that you can **reproduce the experiment** - You can check that the ratio of ham to spam in `X`, `X_train` and `X_test` are all 0.87 : 0.13. --- # Model Training - To train our model, we create a scikit-learn pipeline that: - Takes the input texts and convert them into word vectors - Use the word vectors and their labels to train the model ```python from sklearn.feature_extraction.text import CountVectorizer from sklearn.naive_bayes import MultinomialNB from sklearn.pipeline import Pipeline clf = Pipeline([ # Creating a pipeline ('vec', CountVectorizer()), # The count vectorizer using default params ('nb', MultinomialNB()) # The multinomial NB using default params ]) clf.fit(X_train, y_train) # Use the training data to fit the model ``` --- # Evaluation - We can check our model performance using the following scores: - **AUC score** - **Precision** and **Recall** of the spam class ```python from sklearn.metrics import roc_auc_score, precision_score, recall_score y_pred = clf.predict(X_test) print("AUC : {:.4f}".format(roc_auc_score(y_test, y_pred))) print("Precision: {:.4f}".format(precision_score(y_test, y_pred))) print("Recall : {:.4f}".format(recall_score(y_test, y_pred))) # Prints the following # # Precision: 0.9624 # Recall : 0.9152 ``` - (The scores you obtain will probably be slightly different from above) --- # Evaluation - Instead of computing the precision and recall scores separately, you can also use `sklearn.metrics.classification_report` to obtain a full report of the classification results on the test set ```python from sklearn.metrics import classification_report print(classification_report(y_test, y_pred)) # Prints the following # # precision recall f1-score support # 0 0.99 0.99 0.99 1448 # 1 0.96 0.92 0.94 224 # avg / total 0.98 0.98 0.98 1672 ``` --- # What's Next? - We have gone through the basic steps of training a text classifier - Consider this your **baseline** model - How do you improve your model? - **Investigate** when does the model make mistakes - Check if your model **overfits** or **underfits** - Consider **pre-processing** of the data - Consider tunning the **hyper-parameters** of the model - Consider using **another algorithm / model** - Try **cross validation** - Do **feature selection** - ... --- # Model Persistence * To use your model elsewhere (e.g. in **another program**), you need to **save** or **persist** your trained model * Assuming that you will only load the model in **Python** again, we can use the `joblib` module ```python from sklearn.externals import joblib ... model.fit(X, y) # Training a model ... joblib.dump(model, "model.pkl") # Save the model into a file named 'model.pkl' ``` --- # Loading a Model * To load a model that was dumped using `joblib` before: ```python from sklearn.externals import joblib model = joblib.load("model.pkl") ... predictions = model.predict(X_test) # apply the loaded model on new data ``` * Note that in addition to the model itself, you should keep track of: - The **version of scikit-learn** that you used to train your model - The **performance** (e.g. cross-validation scores) of the model - The **training data** used to train the model - The **source code** for preprocessing the data --- # Putting the Model in Production * When using a model in a production system, in addition to the accuracy/precision/recall of the model, we need to consider: - **Size** of the model --> would it be too big to be copied around? - **Memory usage** --> how much memory will it take up after loaded? - **CPU usage** --> how much CPU resources needed to generate a prediction? - **Time to predict** --> time requried to generate a prediction - **Preprocessing** --> how complicated is the preprocessing steps? --- class: center, middle # End of Lecture 3


INDIAN SUMMER A film review by James Berardinelli Copyright 1993 James Berardinelli
RATING: 5.6 out of 10 (C-, *1/2 out of *****)
Date Released: 4/23/93 Running Length: 1:42 Rated: PG-13 (Mature themes, sexual situations, language)
Starring: Alan Arkin, Matt Craven, Diane Lane, Bill Paxton, Elizabeth Perkins, Kevin Pollak, Sam Raimi, Vincent Spano, Julie Warner, Kimberly Williams Director: Mike Binder Producers: Jeff Silver and Robert Newmeyer Screenplay: Mike Binder Music: Miles Goodman Released by Touchstone Pictures
A group of eight friends gather together at the camp where they spent several halcyon summers two decades ago. The camp director, Uncle Lou (Alan Arkin) has invited them back for a final get-together as he prepares to close the camp. Of course, there are various interpersonal dramas that have to be resolved. The marriage between Matt (Vincent Spano) and Kelly (Julie Warner) is on the rocks, a situation that is exacerbated by the presence of Matt's old flame Jennifer (Elizabeth Perkins). Jack (Bill Paxton) is trying to come to terms with his past. A year after her husband's tragic death, Beth (Diane Lane) is still trying to recover. Jamie (Matt Craven) brings alone his fiancee Gwen (Kimberly Williams), who is ten years his junior.
There are some pretty good laughs in this film. One hilarious sequence involves Sam Raimi (the director of such films as the EVIL DEAD series) attempting to transfer baggage from a canoe to a dock. In another scene, Bill Paxton relates the humorous events surrounding his first erection. Both of these instances, as well as a few others, had the entire audience in stitches.
Unfortunately, the good-but-uneven sense of comedy and some excellent performances cannot camouflage the shallowness of the plot, the ineptness of the direction, and the pitifully juvenile dialogue. This movie desperately needed someone competent to take control, and writer/director Mike Binder is clearly not that person. Someone in high school could have crafted better lines for the characters, and Binder is obsessed with close-ups. He too often uses them in the most inappropriate of places, diluting tension and weakening interaction between the actors.
The story is simplistic and the character conflict weak. There isn't an original moment in the film. Coming-of-age stories have been done so often that for one to make an impression, it needs to find a new angle (PETER'S FRIENDS, Ken Branagh's recent film, although clearly superior to this production, fell into the same trap--little that's new). INDIAN SUMMER doesn't even attempt to strike out towards new ground. It finds a comfortable, cliche-filled groove and sits there.
The ensemble cast does a marvelous job from top to bottom. Alan Arkin, the consummate professional, is wonderfully dry as director of the camp. Kevin Pollak puts his wit to good use, although his one-theme jokes become tiresome after a while. Sam Raimi, not known for his acting, gives a credible performance as the glassy-eyed, inept Stick.
The actors are so good, in fact, that despite being given paper-thin characters and embarrassing lines, they almost pull it off. Now and then, I found INDIAN SUMMER drawing me in simply because these performers are nearly perfect. All of them have been in good projects in the past and doubtless we will be graced by additional fine performances in the future. If there's a reason to see INDIAN SUMMER, and it's a very slim one indeed, it's to see the cast.
INDIAN SUMMER is Mike Binder's semi-autobiographical tale about summers that he spent at camp. Obviously there's a lot of nostalgia involved for him, but he fails to get it across to the audience. Cheap cinematography tricks like graying out the film won't suddenly cause the audience to wax sentimental. Binder fails in both the directing and writing fronts and if he hadn't chosen such an exemplary cast, this could have been a real disaster. As it is, INDIAN SUMMER is just a singularly unremarkable and uninteresting movie.
James Berardinelli<EMAIL_ADDRESS>.
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