The Connection
interface provides support for the creation
of SQLXML
objects using the method createSQLXML
. The object
that is created does not contain any data. Data may be
added to the object by calling the setString
,
setBinaryStream
, setCharacterStream
or setResult
method on
the SQLXML
interface.
The following topics are covered:
In the following excerpt, the method
Connection.createSQLXML
is used to create an empty SQLXML
object. The SQLXML.setString
method is used to write data to the
SQLXML
object that was created.
Connection con = DriverManager.getConnection(url, props);
SQLXML SQLXML
= con.createSQLXML();
sqlxml.setString(val);
The SQLXML
data type is treated similarly to the more
primitive built-in types. A SQLXML
value can be retrieved
by calling the getSQLXML
method in the ResultSet
or
CallableStatement
interface.
For example, the following excerpt retrieves a
SQLXML
value from the first column of the ResultSet
rs:
SQLXML xmlVar = rs.getSQLXML(1);
SQLXML
objects remain valid for at least the duration of
the transaction in which they are created, unless their
free
method is invoked.
The SQLXML
interface provides the getString
,
getBinaryStream
, getCharacterStream
, and getSource
methods
to access its internal content. The following excerpt retrieves the contents of an
SQLXML
object using the getString
method:
SQLXML xmlVal= rs.getSQLXML(1); String val = xmlVal.getString();
The getBinaryStream
or getCharacterStream
methods can be
used to obtain an InputStream
or a Reader
object that can be
passed directly to an XML parser. The following excerpt obtains an InputStream
object from an SQLXML
Object and
then processes the stream using a DOM (Document Object Model) parser:
SQLXML sqlxml = rs.getSQLXML(column); InputStream binaryStream = sqlxml.getBinaryStream(); DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document result = parser.parse(binaryStream);
The getSource
method returns a javax.xml.transform.Source
object. Sources are used as input to XML parsers and XSLT
transformers.
The following excerpt retrieves
and parses the data from a SQLXML
object using the
SAXSource
object returned by invoking the
getSource
method:
SQLXML xmlVal= rs.getSQLXML(1); SAXSource saxSource = sqlxml.getSource(SAXSource.class); XMLReader xmlReader = saxSource.getXMLReader(); xmlReader.setContentHandler(myHandler); xmlReader.parse(saxSource.getInputSource());
A SQLXML
object can be passed as an input parameter to a
PreparedStatement
object just like other data types. The
method setSQLXML
sets the designated PreparedStatement
parameter with a SQLXML
object.
In the following excerpt, authorData
is
an instance of the java.sql.SQLXML
interface whose data was initialized
previously.
PreparedStatement pstmt = conn.prepareStatement( "INSERT INTO bio (xmlData, authId) VALUES (?, ?)"); pstmt.setSQLXML(1, authorData); pstmt.setInt(2, authorId);
The updateSQLXML
method can be used to update a column
value in an updatable result set.
If the java.xml.transform.Result
, Writer
, or OutputStream
object
for the SQLXML
object has not been closed prior to calling
setSQLXML
or updateSQLXML
, a SQLException
will be thrown.
The SQLXML
interface provides the methods setString
,
setBinaryStream
,
setCharacterStream
, or setResult
to initialize the content
for a SQLXML
object that has been created by calling the
Connection.createSQLXML
method.
The following excerpt uses the method
setResult
to return a SAXResult
object to
populate a newly created SQLXML
object:
SQLXML sqlxml = con.createSQLXML(); SAXResult saxResult = sqlxml.setResult(SAXResult.class); ContentHandler contentHandler = saxResult.getXMLReader().getContentHandler(); contentHandler.startDocument(); // set the XML elements and attributes into the result contentHandler.endDocument();
The following excerpt uses the
setCharacterStream
method to obtain a java.io.Writer
object
in order to initialize a SQLXML
object:
SQLXML sqlxml = con.createSQLXML(); Writer out= sqlxml.setCharacterStream(); BufferedReader in = new BufferedReader(new FileReader("xml/foo.xml")); String line = null; while((line = in.readLine() != null) { out.write(line); }
Similarly, the SQLXML
setString
method can be used to
initialize a SQLXML
object.
If an attempt is made to call the setString
,
setBinaryStream
, setCharacterStream
, and setResult
methods
on a SQLXML
object that has previously been initialized, a
SQLException
will be thrown. If more than one call to
the methods setBinaryStream
, setCharacterStream
, and setResult
occurs for
the same SQLXML
object, a SQLException
is thrown and the
previously returned javax.xml.transform.Result
, Writer
, or
OutputStream
object is not affected.
SQLXML
objects remain valid for at least the duration of the transaction in which they are created. This could potentially result in an application running out of resources during a long running transaction. Applications may release SQLXML
resources by invoking their free
method.
In the following excerpt, the method SQLXML.free
is called to release the resources held for a previously created SQLXML
object.
SQLXML xmlVar = con.createSQLXML(); xmlVar.setString(val); xmlVar.free();
MySQL and Java DB and their respective JDBC drivers do not fully support the SQLXML
JDBC data type as described on in this section. However, the sample RSSFeedsTable
demonstrates how to handle XML data with MySQL and Java DB.
The owner of The Coffee Break follows several RSS feeds from various web sites that cover restaurant and beverage industry news. An RSS (Really Simple Syndication or Rich Site Summary) feed is an XML document that contains a series of articles and associated metadata, such as the date of publication and author for each article. The owner would like to store these RSS feeds into a database table, including the RSS feed from The Coffee Break's blog.
The file rss-the-coffee-break-blog.xml
is an example RSS feed from The Coffee Break's blog.
The sample RSSFeedsTable
stores RSS feeds in the table RSS_FEEDS
, which is created with the following command:
create table RSS_FEEDS (RSS_NAME varchar(32) NOT NULL, RSS_FEED_XML longtext NOT NULL, PRIMARY KEY (RSS_NAME));
MySQL does not support the XML data type. Instead, this sample stores XML data in a column of type LONGTEXT
, which is a CLOB
SQL data type. MySQL has four CLOB
data types; the LONGTEXT
data type holds the greatest amount of characters among the four.
The method RSSFeedsTable.addRSSFeed
adds an RSS feed to the RSS_FEEDS
table. The first statements of this method converts the RSS feed (which is represented by an XML file in this sample) into an object of type org.w3c.dom.Document
, which represents a DOM (Document Object Model) document. This class, along with classes and interfaces contained in the package javax.xml
, contain methods that enable you to manipulate XML data content. For example, the following statement uses an XPath expression to retrieve the title of the RSS feed from the Document
object:
Node titleElement = (Node)xPath.evaluate("/rss/channel/title[1]", doc, XPathConstants.NODE);
The XPath expression /rss/channel/title[1]
retrieves the contents of the first <title>
element. For the file rss-the-coffee-break-blog.xml
, this is the string The Coffee Break Blog
.
The following statements add the RSS feed to the table RSS_FEEDS
:
// For databases that support the SQLXML data type, this creates a // SQLXML object from org.w3c.dom.Document. System.out.println("Adding XML file " + fileName); String insertRowQuery = "insert into RSS_FEEDS (RSS_NAME, RSS_FEED_XML) values" + " (?, ?)"; insertRow = con.prepareStatement(insertRowQuery); insertRow.setString(1, titleString); System.out.println("Creating SQLXML object with MySQL"); rssData = con.createSQLXML(); System.out.println("Creating DOMResult object"); DOMResult dom = (DOMResult)rssData.setResult(DOMResult.class); dom.setNode(doc); insertRow.setSQLXML(2, rssData); System.out.println("Running executeUpdate()"); insertRow.executeUpdate();
The RSSFeedsTable.viewTable
method retrieves the contents of RSS_FEEDS
. For each row, the method creates an object of type org.w3c.dom.Document
named doc
in which to store the XML content in the column RSS_FEED_XML
. The method retrieves the XML content and stores it in an object of type SQLXML
named rssFeedXML
. The contents of rssFeedXML
are parsed and stored in the doc
object.
Note: See the section "XML data types and operators" in Java DB Developer's Guide for more information about working with XML data in Java DB.
The sample RSSFeedsTable
stores RSS feeds in the table RSS_FEEDS
, which is created with the following command:
create table RSS_FEEDS (RSS_NAME varchar(32) NOT NULL, RSS_FEED_XML xml NOT NULL, PRIMARY KEY (RSS_NAME));
Java DB supports the XML data type, but it does not support the SQLXML
JDBC data type. Consequently, you must convert any XML data to a character format, and then use the Java DB operator XMLPARSE
to convert it to the XML data type.
The RSSFeedsTable.addRSSFeed
method adds an RSS feed to the RSS_FEEDS
table. The first statements of this method convert the RSS feed (which is represented by an XML file in this sample) into an object of type org.w3c.dom.Document
. This is described in the section Working with XML Data in MySQL.
The RSSFeedsTable.addRSSFeed
method converts the RSS feed to a String
object with the method JDBCTutorialUtilities.convertDocumentToString
.
Java DB has an operator named XMLPARSE
that parses a character string representation into a Java DB XML value, which is demonstrated by the following excerpt:
String insertRowQuery = "insert into RSS_FEEDS (RSS_NAME, RSS_FEED_XML) values" + " (?, xmlparse(document cast (? as clob) preserve whitespace))";
The XMLPARSE
operator requires that you convert the character representation of the XML document into a string data type that Java DB recognizes. In this example, it converts it into a CLOB
data type. In addition, the XMLPARSE
operator requires that Apache Xalan be listed in your Java class path. See Getting Started and the Java DB documentation for more information about Apache Xalan and Java DB requirements.
The method RSSFeedsTable.viewTable
retrieves the contents of RSS_FEEDS
. Because Java DB does not support the JDBC data type SQLXML
you must retrieve the XML content as a string. Java DB has an operator named XMLSERIALIZE
that converts an XML type to a character type:
String query = "select RSS_NAME, xmlserialize (RSS_FEED_XML as clob) from RSS_FEEDS";
As with the XMLPARSE
operator, the XMLSERIALIZE
operator requires that Apache Xalan be listed in your Java class path.


Warehouse Wars
Score
Legend
Empty
Square
Box
Player
Monster
Wall
Controls
YOU WIN!!!
YOU LOSE!!!
Login
Username:
Password:
Register
Username:
Name:
Email Address:
Password:
Confirm Password:
Gender:
Male
Female
Other
Edit Profile
Username:
Name:
Email Address:
Password:
Confirm Password:
Gender:
Male
Female
Other
My profile
Username:
Name:
Email:
Gender:
High Scores


{% load staticfiles %}
App development
KineMaster,Seoul Mate
Algorithms, Android
App Development
SDK and App Development
NexPlayerSDK, Seoul Mate
App Development
NexPlayer, Awera app
MVC, Laravel, Phalcon
Global MOOC Campus
Django, Google App Engine
Portfolio site, Seoul Mate, MOOC Circle
Git, Gerrit Code Review
hassanabidpk
App Engine
Personal blog(Udacity)
Backend
Portfolio site, Seoul Mate
Front end
Portfolio site
Mobile and Web cloud banckend
Seoul Mate, Awera app
Web Framework
Seoul Mate web app
Web Framework
Automation of NexPlayerSDK
Automation for android and ios Build
NexPlayerSDK,Seoul Mate
KineMaster(formerly NexEditor™) is an avant-garde video editing tool provided for Android smartphones and tablets built on the experience and technological expertise NexStreaming has in the embedded field. I developed Social Sharing SDK (Facebook, Youtube,Google+, Google Drive, Dropbox) for KineMaster as well as some of the UI Components
NexPlayer SDK is an HLS player SDK for Android, iOS, Windows Phone 8 and Android TV. My role in NexPlayer team is to develop modern APIs using Apple's new programming language Swift. Moreover, I also developed NexPlayer sample app using Swift
Seoul Mate is a diverse community - comprising of students, teachers, residents, travelers, and more. Our purpose is to provide information about Korean language, jobs, internships, scholarships and everyday life in South Korea. Until now, We have developed an android app as well as website. iOS app is coming at the end of July
With MOOC Circle, our mission is to gather people who are taking online courses enthusiastically and those who want to go one further step ahead towards Social Learning. We believe that the social hub of a MOOC can potentially empower people to advance their careers. We started with a small team of three, however we hope that many people will join our hub both in capacity of mentors and students. Our focus is primarily on practical computer science fields such as Android apps developments, and full stack web development. In near future, we plan to launch an English language course too.
This app lets you buy a mobile top up card for people residing in Ethiopia. It is easy to use and fast top up app. I am developing iOS version of the app using Swift programming language
If you are a female and you want to learn how to make websites, we have good news for you! We are holding a one-day workshop for beginners in Seoul! Django Girls Seoul is organized by Rachell Calhoun with support from members of the programming community.


Duke Encounters The leading online platform for Java Duke spotting
This sample web application is using OWASP AppSensor for Application Intrusion Detection. It is using a h2 in-memory database to temporarily persist all information. Keep in mind that all entered information will be lost when restarting the application.


Hello and welcome to the current page of the Rick!
Companies I have worked for by length of time:
- Alpha Company
- Granco Construction Inc.
- Reischling Press Inc.
- ShishkaBerries LLC
- Bigfoot Properties
- Sounds Unlimited
- Chipotle
- Select Staffing
- Angle Lake Cyclery
- If you are lucky, your company's name will appear on this list


Mohamed Salah injury: Liverpool star ruled out of Egypt international games with ankle problem
Salah has picked up a knock that will prevent him facing Kenya and Comoros
by Adam HamdaniLiverpool forward Mohamed Salah has been ruled out of Egypt’s two games during this international break due to injury.
The 27-year-old has picked up a knock that will prevent him facing Kenya and Comoros, the Egyptian Football Association (EFA) has said.
Salah was pictured with an ice pack on his ankle after he was substituted in the closing stages of the Reds’crucial 3-1 win over title rivals Manchester City in the Premier League on Sunday.
A statement on the EFA’s Twitter account read: “The medical staff of our national team, under the leadership of Dr Mohamed Abul-Ela, confirmed the lack of readiness of Mohamed Salah to play the matches against Kenya and Comoros after intensive tests.”
The statement said the injury needed “a period of treatment to recover”.
It continued: “The player had come to the camp this morning (Tuesday) after arriving in Cairo late yesterday evening and watched the evening training that the team played at the Burj Al Arab Stadium.”
Egypt host Kenya on Thursday and then face Comoros on Monday, both in African Cup of Nations qualifiers.
Premier League leaders Liverpool are not in action again until November 23, when they travel to Crystal Palace.


---
sort_order: 95
tei_id: rdx_191dd.p.idp16902656
annotation_count: 0
images:
small-thumbnail: https://readux.ecds.emory.edu/books/emory:191dd/pages/emory:rfgcm/mini-thumbnail/
json: https://readux.ecds.emory.edu/books/emory:191dd/pages/emory:rfgcm/info/
full: https://readux.ecds.emory.edu/books/emory:191dd/pages/emory:rfgcm/fs/
page: https://readux.ecds.emory.edu/books/emory:191dd/pages/emory:rfgcm/single-page/
thumbnail: https://readux.ecds.emory.edu/books/emory:191dd/pages/emory:rfgcm/thumbnail/
title: Page 95
number: 95
---
{% raw %}SUCCESSFUL STRATAGEM. 97{% endraw %}
{% raw %}break another arm, yet. Curse that dog of a Sf^uire—I will{% endraw %}
{% raw %}kill him as soou as this one is well—I will, sure!"{% endraw %}
{% raw %}" Do you hear that ?" whispered Flag, hoarsely. '' Boys,{% endraw %}
{% raw %}that's the man I told you about. I'll risk my life to take him{% endraw %}
{% raw %}whether you help me or not—but I hope you will help me.{% endraw %}
{% raw %}There's three of them, and four of us. They have arms, aud{% endraw %}
{% raw %}we have not; but we may be able to t.ake them aU, if we can{% endraw %}
{% raw %}frighten them first. I'll be captain, and you keep stUI tUl I{% endraw %}
{% raw %}give my orders. Hark !"{% endraw %}
{% raw %}There was one of the gang trying to undo the latch, which{% endraw %}
{% raw %}being a wooden one, and swollen with the raiu, did not read¬{% endraw %}
{% raw %}ily yield to his touch.{% endraw %}
{% raw %}A kw, hollow, sepulchral groan came from within, -\^•hich{% endraw %}
{% raw %}had the effect to arrest the man's hand. In the pause the{% endraw %}
{% raw %}groan was repeated, more heart-breaking, blood-chilling and{% endraw %}
{% raw %}horrible than before. The man hesitated, and on the repeti¬{% endraw %}
{% raw %}tion of the sounds hastUy retreated. There was a parley out¬{% endraw %}
{% raw %}side between the wounded man and his cowardly confederate,{% endraw %}
{% raw %}in which the former used more blasphemy than argument. At{% endraw %}
{% raw %}length Flag heard one of the men say :{% endraw %}
{% raw %}" W.aal, Joe, ef you ain't afeard, go in there by yourself;{% endraw %}
{% raw %}that's all I got ter say !"{% endraw %}
{% raw %}Joe, however, was not so forward in making an entrance{% endraw %}
{% raw %}as he desired his men to be ; and insisted ou the second of his{% endraw %}
{% raw %}confederates procuring the lantern before he advanced any{% endraw %}
{% raw %}further. Something foUowed in a whisper which Flag could{% endraw %}
{% raw %}not hear; and then some one made a successful attempt to{% endraw %}
{% raw %}open the door in spUe of Flag's most appalling groans, and the{% endraw %}
{% raw %}surveyors heard a pistol discharged several times over their{% endraw %}
{% raw %}heads. But as the pistol-shots did not sUence the ghostly{% endraw %}
{% raw %}noises, the man proved no more venturesome than his pre¬{% endraw %}
{% raw %}decessor, and retired without entering the hut.{% endraw %}
{% raw %}" Lie low," whispered Flag, when be was gone ; " don't ex¬{% endraw %}
{% raw %}pose yourselves to be shot. The next oue that comes wUl be{% endraw %}
{% raw %}the man I want."{% endraw %}
{% raw %}He was right in bis conjecture. Cursing his associates for{% endraw %}
{% raw %}cowards, Joe Carnes advanced to the open door, pausing an{% endraw %}
{% raw %}uistant to listen for the noises which had so frightened his{% endraw %}
{% raw %}comrades; but not hearing them repeated, he cautiously{% endraw %}
{% raw %}stepped inside, when he felt himself suddenly hooded and{% endraw %}


As the course information handout mentions, several of the assignments in this course allow you to optionally work in a pair with a partner. Each assignment will explicitly specify whether this is an option. Some common questions and tips on working on assignments with a partner are listed below.
Additionally, some helpful tools for sharing code privately online with your partner (if needed) are CollabEdit and Google Docs. Please Do NOT post shared partner code publicly on places like Pastebin or public GitHub repositories.
-
Q: Why are we doing pair programming in CS106A this quarter?
-
A: Pair programming serves two purposes. The first is that pair programming has potential benefits to students. Working with a partner can give you someone to talk to when you're stuck, or help you learn different ways of approaching the same problem.
The second is to ensure a high quality of service from our course staff. Pair programming helps reduce the heavy grading workload on our section leaders, so they can support you and best help you be successful in CS106A.
-
Q: What is the best strategy for working with a partner?
-
A: The exact work style you use with your partner is up to you. There are several ways that pairs can work together. Here are some possible strategies, along with our opinion about the effectiveness of each:
-
Sit together and write the code together: (Strongly recommended.) In this work style, you would sit next to each other at the same computer and collaborate to write the code. One person would type for a while, then the other, and back again. You can decide the interval for switching who controls the computer (the "driver"). Some people recommend switching roughly every 15-20 minutes, to make sure that each person gets to drive. Even if one of you is a faster typer, letting both people drive for equal time is good to avoid having one person dominate the work.
-
Work together using online tools: (Recommended.) In this work style, the two of you would be physically apart but would collaborate by sharing code using online tools. For example, you would put your code into CollabEdit or Google Docs (see links above) and talk to each other using a chat program like Google Hangouts, Skype, FaceTime, etc. This style can be effective for students who have different schedules or live far apart.
-
Do the assignment individually, and then compare/merge solutions: (Somewhat recommended, but we suggest one of the others above instead.) In this work style, each of you would complete the assignment on your own, then the two of you would have a meeting and compare solutions. You would then merge the solution into a best combined solution that you would submit together. This work style doesn't have as many benefits as working on the solution together, but it is still good to see how another student solved the problem and learn from each others' programs' strengths and weaknesses.
There are some work styles that we do NOT recommend because we do not think they follow the spirit of working in pairs, and do not allow both students to effectively learn the material. For example:
-
Splitting up the parts of the assignment: In this work style, each of you would complete parts of the assignment individually, then submit them together. For example, if the assignment has a "Part A" and a "Part B", one of you would do Part A and the other would do Part B. We do not recommend doing this because each of you will only learn part of the material for that assignment. This will leave you less prepared on exams and future assignments.
-
Taking turns on assignments: In this work style, in a pair of students named A and B, student A would do Homework X, then B would do Homework X+1, A would do Homework X+2, and so on. You should not do this, since each partner is expected to make a significant contribution toward solving the assignment. You should not claim to be part of a pair submission if you did not contribute significantly to help solve that problem. Moreover, your section leader may ask you to explain aspects of the submission during IGs. By doing this each of you will only learn half of the course material in detail. The assignments are by far the best vehicle for you to learn how to program effectively and truly come to understand the course material. Only completing half of them will leave you much less prepared to do well on exams and future assignments.
-
One person does all of the work: You should not do this, since each partner is expected to make a significant contribution toward solving the assignment. You should not claim to be part of a pair submission if you did not contribute significantly to help solve that problem. Moreover, your section leader may ask you to explain aspects of the submission during IGs. By doing this the other person will not learn the material well and will be grossly underprepared to do well on exams and future assignments. The assignments are by far the best vehicle for you to learn how to program effectively and truly come to understand the course material.
-
Q: Is every assignment going to be a pair assignment?
-
A: No; some assignments will be individual. Each assignment will clearly label whether it is an individual or pair assignment. Please follow each assignment's instructions properly, and if a given assignment is an individual assignment, please submit your own work and do not share code with a partner.
-
Q: Are there any constraints on whom I can work with?
-
A: You can only work with another student in your section time and location.
-
Q: How can I find a partner to work with?
-
A: Your section leader may provide time in section for you to find a partner if needed. You may also contact your section leader if you need help finding someone else in your section to partner with.
-
Q: Do I have to have the same partner for the whole quarter?
-
A: No; if you want to change partners, you may do so. However, in general, due to the overhead of changing partners along the way, we encourage you to use the same partner unless there is a serious problem or reason not to.
-
Q: How do we submit/get grades as a pair?
-
A: Only ONE of you should submit your project via Eclipse; please clearly mark at the top of the files in the project that you are both working in a pair. Your section leader will grade the assignment for both of you and schedule a joint IG to go over the assignment.
-
Q: How do late days work with teams? What if I switch partners?
-
A: Each student has an individual personal counter of late days remaining. If your team turns in an assignment late, each individual student's penalty is based on that student's number of late days remaining.
-
Q: My partner was a bad partner. They didn't do any work, or didn't do their share of the work, or didn't communicate or meet with me, etc. What can I do?
-
A: Have you tried speaking to your partner to let them know that you expect them to do more? Remind your partner what the course info handout says about expectations of each member of a pair. Many group issues can be resolved by better communication and setting expectations.
If talking to your partner does not resolve the situation, speak to your section leader and explain the details of what has happened. We will try to help you resolve the issue. If it is an ongoing problem, the section leader can help you find you a partner, or you can dissolve your partnership and submit individually. Please feel free to bring to our attention any complaints you may have about your partner.
NOTE: If you agree verbally (or via email) to work with a given partner on a given assignment, you are expected to work through that assignment with that partner to completion. You can't abandon your partner in the middle of an assignment unless the decision to unpair is mutual for both of you. Please be considerate for your partner and don't leave them hanging without an easy way to find a new partner mid-assignment. If you are planning to end your partnership and do the next assignment alone, please tell your partner this as soon as possible when the assignment is given out, so that they can make other arrangements.
-
Q: My partner was a bad partner, but not because they didn't do enough work. They did too much! They hogged the keyboard, or they did the whole assignment without waiting for me, or they didn't communicate with me, etc. I feel that I didn't get a real chance to help in writing the code and solving the assignment. What can I do?
-
A: The answer is similar to the previous question. Have you tried speaking to your partner to let them know that you expect them to let you contribute? Remind your partner what the course info handout says about expectations of each member of a pair. Many group issues can be resolved by better communication and setting expectations.
If talking to your partner does not resolve the situation, speak to your section leader and explain the details of what has happened. We will try to help you resolve the issue. If it is an ongoing problem, the section leader can help you find you a partner, or you can dissolve your partnership and submit individually. Please feel free to bring to our attention any complaints you may have about your partner.
-
Q: How do we get help if our pair is stuck on an assignment?
-
A: You can go ask for help from the section leaders in the LaIR. Keeping in mind that a big reason for implementing pairs is to help reduce staff workload, we request that if both of you are in the LaIR, that only one of you will enqueue for LaIR help at a time. That is, please don't try to "double up" by enqueuing both of your names in the line. If we find that a group is doing this, we will remove both of their names and move one of them to the very back of the queue. Thank you for your cooperation.
Also feel free to come ask the instructor or Head TA for help during office hours.
Don't forget to talk to each other plenty during the assignment along the way. One benefit of working in pairs is that each member of the pair can help the other improve his/her understanding of the material and help figure out how to solve the assignment.


In August of last year, I wrote a post that involved looking at when educational psychology jobs (mostly, but not only, academic jobs or those related to research and teaching) were posted to the excellent Ed Psych Jobs website. As that post made (in part) the (anticipated) point that most jobs were posted in September (in which 16% of jobs were posted there) and October (14%) (followed by August, with 11%), I thought that it may be helpful to see how accurate that was over the past year.
The code for scraping the data from the website is largely the same; fortunately, Ed Psych Jobs / Division 15 didn’t change the page’s permissions (see the section on the robots.txt
file in last year’s post) in terms of how its content may be scraped.
Here’s the main function:
library(rvest)
library(tidyverse)
library(lubridate)
read_the_dates <- function(page, url = "http://edpsychjobs.info/category/all-jobs/page/") {
Sys.sleep(1)
results_df <- tibble(
dates = vector(length = 1)
)
base_url <- paste0(url, page)
page_html <- read_html(base_url)
date <- html_nodes(page_html, ".published")
results_df <- mutate(results_df,
date = list(html_text(date)))
return(results_df)
}
Here is how it is used to access the webpages (check out the last post to see why the function uses 1:88
):
output_df <- map_df(1:88, read_the_dates)
Finally, these lines of code process and plot the data, with 2017 and 2018 plotted in different colors than the rest:
processed_dates <- output_df %>%
select(date) %>%
unnest(date) %>%
mutate(date = mdy(date),
month = month(date, label = T),
year = year(date))
df_plot_2 <- processed_dates %>%
count(year, month) %>%
complete(year, month, fill = list(n = 0)) %>%
mutate(n = ifelse(year == 2018 & month %in% c("Jul", "Aug", "Sep", "Oct", "Nov", "Dec"), NA, n),
year = as.factor(year))
ggplot(df_plot_2, aes(x = month, y = n, group = year, color = year)) +
geom_point() +
geom_line() +
scale_color_manual("", values = c("gray90", "gray70", "gray50", "gray30", "gray10", "red", "blue")) +
xlab(NULL) +
ylab("Number of Posts") +
ggtitle("Number of Posts / Month on EdPsychJobs")
So, in what months were jobs posted during this past (academic) year? The most were posted in October, followed by August, and then in November: more jobs were posted a bit later in the cycle this past year than over the previous five years. Of course, not all educational psychology jobs are posted on Ed Psych Jobs (though many are) and there are other great sources to find out about jobs (especially #edpsychjobhunters / now #edpsychjobs, thanks to Ben Heddy). And, of course, those looking for educational psychology jobs may look across many fields, including the learning sciences, youth and adolescent development, and teacher education.
A big takeaway from this analysis post for anyone who is looking for academic or research- or teaching-related jobs (at the post-secondary level): the fall, broadly, is a good time to look for jobs! This past academic year was (mostly) not an exception to this, and so job-seekers this year should consider August through (around) November to be the period when most of them are posted.
On a related note, I’m thrilled to share that I will not be searching for jobs this year. I’m very fortunate to be beginning an Assistant Professor of STEM Education position (a good fit for me given my interests and experience) in an outstanding department, Theory and Practice in Teacher Education at the University of Tennessee, Knoxville, this upcoming fall. Another note: I received a ton of support and kindness throughout the process. If you’re searching this year have questions / issues that you think I could perhaps weigh in on, let me know (some contact details are here).


Zen Tetris is yet another Tetris clone written in Python. Sounds uninteresting? I understand…but wait! This is not an ordinary Tetris clone! So, what’s different about Zen Tetris?
Um. Two of the three above items are thanks to beautiful images I borrowed from someone on the net. And by the way, this is my first Python program. I hope you’ll enjoy the game.
Zen Tetris has two modes. In 1-player mode, you can play a good, old Tetris In 2-player battle mode, two players can “battle” with Tetris. If one player deletes more than one lines, (deleted lines - 1) lines will be added to the other player’s play area. Wow, sounds exciting!
player 1 * Left arrow or “A” key - move left * Right arrow or “D” key - move right * Up arrow or “W” key - rotate * Down arrow or “S” key - drop
player 2 * “J”/“L” key - move left/right for 2nd player * “I” key - rotate for 2nd player * “K” key - drop for 2nd player
Thank you very much for the great library, images and sound effect data. Copyrights of these resources are owned by the authors. Visit their web pages for license information.
Zen Tetris - Copyright (C) 2020 Kyosuke Achiwa


In HTML, JavaScript code must be inserted between <script> and </script> tags.
A JavaScript function is a block of JavaScript code, that can be executed when "called" for. For example, a function can be called when an event occurs, like when the user clicks a button.
You can place any number of scripts in an HTML document.
Scripts can be placed in the <body>, or in the <head> section of an HTML page, or in both.
In this example, a JavaScript function is placed in the <head> section of an HTML page.
Al presionar el botón, llama la función myFunction definida en el encabezado de la página HTML.
Al presionar el botón, llama la función myFunction2 definida en el cuerpo de la página HTML. Tener presente esto:
Placing scripts at the bottom of the 'body' element improves the display speed, because script compilation slows down the display.
External scripts are practical when the same code is used in many different web pages.
JavaScript files have the file extension .js
To use an external script, put the name of the script file in the src (source) attribute of a <script> tag:
Example: <script src="myScript.js"></script>
Placing scripts in external files has some advantages:
To add several script files to one page use several script tags.


HTTP verbs that Node.js core’s HTTP parser supports.
This module provides an export that is just like http.METHODS
from Node.js core,
with the following differences:
http.METHODS
export (0.10 and lower).browserify
without pulling
in the http
shim module.bash
$ npm install methods
js
var methods = require('methods')
This is an array of lower-cased method names that Node.js supports. If Node.js
provides the http.METHODS
export, then this is the same array lower-cased,
otherwise it is a snapshot of the verbs from Node.js 0.10.


Daichir, Priest of Earth:
Thanks to your help, we have been able to stabilize the force shield surrounding the Mithril Mine.
This isn't a permanent solution, but it should buy us some time. I will contact you when we again need your services.
(This quest can only be completed once per day.)


# Learn Databases !
Everything you need to get started learning databases using Micorsoft SQL Server.
## Hardware Requirements
1. A computer with one of these Operating Systems:
- Mac OSX
- Windows 10 64bit (not Home edition)
- Linux or
- Chrome OS w/Linux Enabled [https://support.google.com/chromebook/answer/9145439?hl=en](https://support.google.com/chromebook/answer/9145439?hl=en)
2. At least 8GB RAM.
3. At least 8 GB free disk space.
## Software Requirements
1. Docker [https://docs.docker.com/get-docker/](https://docs.docker.com/get-docker/)
You must allocate at least 1CPU and 4GB of RAM to docker.
Mac: [https://docs.docker.com/docker-for-mac/#resources](https://docs.docker.com/docker-for-mac/#resources)
Windows: [https://docs.docker.com/docker-for-mac/#resources](https://docs.docker.com/docker-for-mac/#resources)
Linux/ChromeOS: No Configuration Necessary
2. Azure Data Studio [https://docs.microsoft.com/en-us/sql/azure-data-studio/download-azure-data-studio](https://docs.microsoft.com/en-us/sql/azure-data-studio/download-azure-data-studio).
This is the client tool used to connect to the databases.
## Using Learn Databases
### Starting up MSSQL Server
1. Open a terminal window inside the `learn-dataases` folder.
2. Type : `docker-compose up -d` to start everything.
3. Type : `docker-compose ps` to see the `mssql` Database, `webapp`, and `sqlpad` running.
### Creating the Sample Databases
There is a built-in web application for creating the sample databases. For some databases you can use the application to update the data.
1. Open a web browser and connect to `http://localhost:5000` to launch the Database Provisioner application. You can view connection information and also to setup the sample databases.
2. Click `Create` to create the databases. You need. You can click on `Info` to get details about the database.
### Connecting to MSSQL Server
1. Open `Azure Data Studio`
2. Under `Servers` select `Add New Connection`
3. Fill in the connection information based on the information displayed in the Database Provisioner application.
4. Here's a quick tutorial you can follow to learn Azure Data Studio. [https://docs.microsoft.com/en-us/sql/azure-data-studio/quickstart-sql-server](https://docs.microsoft.com/en-us/sql/azure-data-studio/quickstart-sql-server)
#### Browser-based connection to MSSQL Server
1. Open a web browser and connect to `http://localhost:5001` to launch the SQL Pad application.


Global variables of ballerina.data.sql package
| Variable Name | Data Type | Description |
|---|---|---|
| MYSQL | string | Construct MySQL DB jdbc url in the format of jdbc:mysql://[HOST]:[PORT]/[database] |
| SQLSERVER | string | Construct SQL Server DB jdbc url in the format of jdbc:sqlserver://[HOST]:[PORT];databaseName=[database] |
| ORACLE | string | Construct Oracle DB jdbc url in the format of jdbc:oracle:thin:[username/password]@[HOST]:[PORT]/[database] |
| SYBASE | string | Construct Sybase DB jdbc url in the format of jdbc:sybase:Tds:[HOST]:[PORT]/[database] |
| POSTGRE | string | Construct PostgreSQL DB jdbc url in the format of jdbc:postgresql://[HOST]:[PORT]/[database] |
| IBMDB2 | string | Construct IBM Db2 DB jdbc url in the format of jdbc:db2://[HOST]:[PORT]/[database] |
| HSQLDB_SERVER | string | Construct HSQLDB SERVER dB jdbc url in the format of jdbc:hsqldb:hsql://[HOST]:[PORT]/[database] |
| HSQLDB_FILE | string | Construct HSQLDB FILE DB jdbc url in the format of jdbc:hsqldb:file:[path]/[database] |
| H2_SERVER | string | Construct H2 SERVER DB jdbc url in the format of jdbc:h2:tcp://[HOST]:[PORT]/[database] |
| H2_FILE | string | Construct H2 FILE DB jdbc url in the format of jdbc:h2:file://[path]/[database] |
| DERBY_SERVER | string | Construct Derby SERVER DB jdbc url in the format of jdbc:derby://[HOST]:[PORT]/[database] |
| DERBY_FILE | string | Construct Derby FILE DB jdbc url in the format of jdbc:derby://[path]/[database] |
Connectors of ballerina.data.sql package
public connector ClientConnector (string dbType, string hostOrPath, int port, string dbName, string username, string password, ConnectionProperties options)
The Client Connector for SQL databases.
Parameters:
| Parameter Name | Data Type | Description |
|---|---|---|
| dbType | string | SQL database type |
| hostOrPath | string | Host name of the database or file path for file based database |
| port | int | Port of the database |
| dbName | string | Name of the database to connect |
| username | string | Username for the database connection |
| password | string | Password for the database connection |
| options | ConnectionProperties | ConnectionProperties for the connection pool configuration |
action batchUpdate(string query, Parameter[][] parameters)
The batchUpdate action implementation for SQL connector to batch data insert.
Parameters:
| Parameter Name | Data Type | Description |
|---|---|---|
| query | string | SQL query to execute |
| parameters | Parameter[][] | Parameter array used with the SQL query |
Return Parameters:
| Return Variable | Data Type | Description |
|---|---|---|
| int[] | Array of update counts |
action call(string query, Parameter[] parameters)
The call action implementation for SQL connector to invoke stored procedures/functions.
Parameters:
| Parameter Name | Data Type | Description |
|---|---|---|
| query | string | SQL query to execute |
| parameters | Parameter[] | Parameter array used with the SQL query |
Return Parameters:
| Return Variable | Data Type | Description |
|---|---|---|
| datatable | Result set for the given query |
action close()
The close action implementation for SQL connector to shutdown the connection pool.
action select(string query, Parameter[] parameters)
The select action implementation for SQL connector to select data from tables.
Parameters:
| Parameter Name | Data Type | Description |
|---|---|---|
| query | string | SQL query to execute |
| parameters | Parameter[] | Parameter array used with the SQL query |
Return Parameters:
| Return Variable | Data Type | Description |
|---|---|---|
| datatable | Result set for the given query |
action update(string query, Parameter[] parameters)
The update action implementation for SQL connector to update data and schema of the database.
Parameters:
| Parameter Name | Data Type | Description |
|---|---|---|
| query | string | SQL query to execute |
| parameters | Parameter[] | Parameter array used with the SQL query |
Return Parameters:
| Return Variable | Data Type | Description |
|---|---|---|
| int | Updated row count |
action updateWithGeneratedKeys(string query, Parameter[] parameters, string[] keyColumns)
The updateWithGeneratedKeys action implementation for SQL connector which returns the auto generated keys during the update action.
Parameters:
| Parameter Name | Data Type | Description |
|---|---|---|
| query | string | SQL query to execute |
| parameters | Parameter[] | Parameter array used with the SQL query |
| keyColumns | string[] | Names of auto generated columns for which the auto generated key values are returned |
Return Parameters:
| Return Variable | Data Type | Description |
|---|---|---|
| int | Updated row count during the query exectuion | |
| string[] | Array of auto generated key values during the query execution |
Structs of ballerina.data.sql package
public struct ConnectionProperties
ConnectionProperties structs represents the properties which are used to configure DB connection pool
Fields:
| Field Name | Data Type | Description |
|---|---|---|
| url | string | Platform independent DB access URL |
| dataSourceClassName | string | Name of the DataSource class provided by the JDBC driver |
| connectionTestQuery | string | Query that will be executed to validate that the connection to the database is still alive |
| poolName | string | User-defined name for the connection pool and appears mainly in logging |
| catalog | string | Catalog of connections created by this pool |
| connectionInitSql | string | SQL statement that will be executed after every new connection creation before adding it to the pool |
| driverClassName | string | Fully qualified Java class name of the JDBC driver to be used |
| transactionIsolation | string | Transaction isolation level of connections returned from the pool. The supported values are TRANSACTION_READ_UNCOMMITTED, TRANSACTION_READ_COMMITTED, TRANSACTION_REPEATABLE_READ and TRANSACTION_SERIALIZABLE |
| autoCommit | boolean | Auto-commit behavior of connections returned from the pool |
| isolateInternalQueries | boolean | Determines whether HikariCP isolates internal pool queries, such as the connection alive test, in their own transaction |
| allowPoolSuspension | boolean | Whether the pool can be suspended and resumed through JMX |
| readOnly | boolean | Whether Connections obtained from the pool are in read-only mode by default |
| isXA | boolean | Whether Connections are used for a distributed transaction |
| maximumPoolSize | int | Maximum size that the pool is allowed to reach, including both idle and in-use connections |
| connectionTimeout | int | Maximum number of milliseconds that a client will wait for a connection from the pool |
| idleTimeout | int | Maximum amount of time that a connection is allowed to sit idle in the pool |
| minimumIdle | int | Minimum number of idle connections that pool tries to maintain in the pool |
| maxLifetime | int | Maximum lifetime of a connection in the pool |
| validationTimeout | int | Maximum amount of time that a connection will be tested for aliveness |
| leakDetectionThreshold | int | Amount of time that a connection can be out of the pool before a message is logged indicating a possible connection leak |
| datasourceProperties | map | Data source specific properties which are used along with the dataSourceClassName |
public struct Parameter
Parameter struct represents a query parameter for the SQL queries specified in connector actions
Fields:
| Field Name | Data Type | Description |
|---|---|---|
| sqlType | string | The data type of the corresponding SQL parameter |
| value | any | Value of paramter pass into the SQL query |
| direction | int | Direction of the SQL Parameter 0 - IN, 1- OUT, 2 - INOUT |


Clicky Game
Click an image to begin!
Score: 0 | Top Score: 0
Don't click on any image more than once!


Carolyn Lewelling
Presidential Award
Awarded by 2016-2017 President Aditya Vaidyam for contributing to Purdue IEEE as the 2015-2016 Secretary, promoting leadership development and member growth, supporting inter-committee relations, and encouraging mentorship in the community
Brandon Stewart
Executive Committee Award
Awarded by the 2016-2017 IEEE Executive Committee for leading a project group not focused on robotics, maintaining communications and the mailing list, and server maintenance.
Yuqin "Sophia" Duan
Student Branch Award
Awarded by the 2016-2017 members of Purdue IEEE Student Branch for extraordinary service to continue the Learning Committee as a way to teach members value skills, introduction of research interests into IEEE, and friendliness to all members.


Please note: this document is designed to be viewed using browsers that understand frames, and will not work in other browsers.
home | documentation | detailed listings | summary listings


Interesting application form 😜
What is your name?
What is your favourite color?
Red
Green
Blue
Other
Would you like to become developer?
Yes
Ano
Igen
是
Why would you like to become a developer?
Submit


[Note: this document is formatted similarly to the SGI STL implementation documentation pages, and refers to concepts and classes defined there. However, neither this document nor the code it describes is associated with SGI, nor is it necessary to have SGI's STL implementation installed in order to use this class.]
dense_hash_set is a Hashed Associative Container that stores objects of type Key. dense_hash_set is a Simple Associative Container, meaning that its value type, as well as its key type, is key. It is also a Unique Associative Container, meaning that no two elements have keys that compare equal using EqualKey.
Looking up an element in a dense_hash_set by its key is efficient, so dense_hash_set is useful for "dictionaries" where the order of elements is irrelevant. If it is important for the elements to be in a particular order, however, then map is more appropriate.
dense_hash_set is distinguished from other hash-set implementations by its speed and by the ability to save and restore contents to disk. On the other hand, this hash-set implementation can use significantly more space than other hash-set implementations, and it also has requirements -- for instance, for a distinguished "empty key" -- that may not be easy for all applications to satisfy.
This class is appropriate for applications that need speedy access to relatively small "dictionaries" stored in memory, or for applications that need these dictionaries to be persistent. [implementation note])
hash<>
-- the kind used by gcc and most Unix compiler suites -- and not
Dinkumware semantics -- the kind used by Microsoft Visual Studio. If
you are using MSVC, this example will not compile as-is: you'll need
to change hash
to hash_compare
, and you
won't use eqstr
at all. See the MSVC documentation for
hash_map
and hash_compare
, for more
details.)
#include <iostream> #include <sparsehash/dense_hash_set> using google::dense_hash_set; // namespace where class lives by default using std::cout; using std::endl; using ext::hash; // or __gnu_cxx::hash, or maybe tr1::hash, depending on your OS struct eqstr { bool operator()(const char* s1, const char* s2) const { return (s1 == s2) || (s1 && s2 && strcmp(s1, s2) == 0); } }; void lookup(const hash_set<const char*, hash<const char*>, eqstr>& Set, const char* word) { dense_hash_set<const char*, hash<const char*>, eqstr>::const_iterator it = Set.find(word); cout << word << ": " << (it != Set.end() ? "present" : "not present") << endl; } int main() { dense_hash_set<const char*, hash<const char*>, eqstr> Set; Set.set_empty_key(NULL); Set.insert("kiwi"); Set.insert("plum"); Set.insert("apple"); Set.insert("mango"); Set.insert("apricot"); Set.insert("banana"); lookup(Set, "mango"); lookup(Set, "apple"); lookup(Set, "durian"); }
unordered_set
.
| Parameter | Description | Default |
|---|---|---|
| Key | The hash_set's key and value type. This is also defined as dense_hash_set::key_type and dense_hash_set::value_type. | |
| HashFcn |
The hash function used by the
hash_set. This is also defined as dense_hash_set::hasher.
Note: Hashtable performance depends heavily on the choice of hash function. See the performance page for more information. |
hash<Key> |
| EqualKey | The hash_set key equality function: a binary predicate that determines whether two keys are equal. This is also defined as dense_hash_set::key_equal. | equal_to<Key> |
| Alloc |
The STL allocator to use. By default, uses the provided allocator
libc_allocator_with_realloc , which likely gives better
performance than other STL allocators due to its built-in support
for realloc , which this container takes advantage of.
If you use an allocator other than the default, note that this
container imposes an additional requirement on the STL allocator
type beyond those in [lib.allocator.requirements]: it does not
support allocators that define alternate memory models. That is,
it assumes that pointer , const_pointer ,
size_type , and difference_type are just
T* , const T* , size_t , and
ptrdiff_t , respectively. This is also defined as
dense_hash_set::allocator_type.
|
| Member | Where defined | Description |
|---|---|---|
| value_type | Container | The type of object, T, stored in the hash_set. |
| key_type | Associative Container | The key type associated with value_type. |
| hasher | Hashed Associative Container | The dense_hash_set's hash function. |
| key_equal | Hashed Associative Container | Function object that compares keys for equality. |
| allocator_type | Unordered Associative Container (tr1) | The type of the Allocator given as a template parameter. |
| pointer | Container | Pointer to T. |
| reference | Container | Reference to T |
| const_reference | Container | Const reference to T |
| size_type | Container | An unsigned integral type. |
| difference_type | Container | A signed integral type. |
| iterator | Container | Iterator used to iterate through a dense_hash_set. |
| const_iterator | Container | Const iterator used to iterate through a dense_hash_set. (iterator and const_iterator are the same type.) |
| local_iterator | Unordered Associative Container (tr1) | Iterator used to iterate through a subset of dense_hash_set. |
| const_local_iterator | Unordered Associative Container (tr1) | Const iterator used to iterate through a subset of dense_hash_set. |
| iterator begin() const | Container | Returns an iterator pointing to the beginning of the dense_hash_set. |
| const_iterator cbegin() const | Container | Returns an const_iterator pointing to the beginning of the dense_hash_set. |
| iterator end() const | Container | Returns an iterator pointing to the end of the dense_hash_set. |
| const_iterator cend() const | Container | Returns an const_iterator pointing to the end of the dense_hash_set. |
| local_iterator begin(size_type i) | Unordered Associative Container (tr1) | Returns a local_iterator pointing to the beginning of bucket i in the dense_hash_set. |
| local_iterator end(size_type i) | Unordered Associative Container (tr1) | Returns a local_iterator pointing to the end of bucket i in the dense_hash_set. For dense_hash_set, each bucket contains either 0 or 1 item. |
| const_local_iterator begin(size_type i) const | Unordered Associative Container (tr1) | Returns a const_local_iterator pointing to the beginning of bucket i in the dense_hash_set. |
| const_local_iterator end(size_type i) const | Unordered Associative Container (tr1) | Returns a const_local_iterator pointing to the end of bucket i in the dense_hash_set. For dense_hash_set, each bucket contains either 0 or 1 item. |
| size_type size() const | Container | Returns the size of the dense_hash_set. |
| size_type max_size() const | Container | Returns the largest possible size of the dense_hash_set. |
| bool empty() const | Container | true if the dense_hash_set's size is 0. |
| size_type bucket_count() const | Hashed Associative Container | Returns the number of buckets used by the dense_hash_set. |
| size_type max_bucket_count() const | Hashed Associative Container | Returns the largest possible number of buckets used by the dense_hash_set. |
| size_type bucket_size(size_type i) const | Unordered Associative Container (tr1) | Returns the number of elements in bucket i. For dense_hash_set, this will be either 0 or 1. |
| size_type bucket(const key_type& key) const | Unordered Associative Container (tr1) | If the key exists in the set, returns the index of the bucket containing the given key, otherwise, return the bucket the key would be inserted into. This value may be passed to begin(size_type) and end(size_type). |
| float load_factor() const | Unordered Associative Container (tr1) | The number of elements in the dense_hash_set divided by the number of buckets. |
| float max_load_factor() const | Unordered Associative Container (tr1) | The maximum load factor before increasing the number of buckets in the dense_hash_set. |
| void max_load_factor(float new_grow) | Unordered Associative Container (tr1) | Sets the maximum load factor before increasing the number of buckets in the dense_hash_set. |
| float min_load_factor() const | dense_hash_set | The minimum load factor before decreasing the number of buckets in the dense_hash_set. |
| void min_load_factor(float new_grow) | dense_hash_set | Sets the minimum load factor before decreasing the number of buckets in the dense_hash_set. |
| void set_resizing_parameters(float shrink, float grow) | dense_hash_set | DEPRECATED. See below. |
| void resize(size_type n) | Hashed Associative Container | Increases the bucket count to hold at least n items. [2] [3] |
| void rehash(size_type n) | Unordered Associative Container (tr1) | Increases the bucket count to hold at least n items. This is identical to resize. [2] [3] |
| hasher hash_funct() const | Hashed Associative Container | Returns the hasher object used by the dense_hash_set. |
| hasher hash_function() const | Unordered Associative Container (tr1) | Returns the hasher object used by the dense_hash_set. This is idential to hash_funct. |
| key_equal key_eq() const | Hashed Associative Container | Returns the key_equal object used by the dense_hash_set. |
| allocator_type get_allocator() const | Unordered Associative Container (tr1) | Returns the allocator_type object used by the dense_hash_set: either the one passed in to the constructor, or a default Alloc instance. |
| dense_hash_set() | Container | Creates an empty dense_hash_set. |
| dense_hash_set(size_type n) | Hashed Associative Container | Creates an empty dense_hash_set that's optimized for holding up to n items. [3] |
| dense_hash_set(size_type n, const hasher& h) | Hashed Associative Container | Creates an empty dense_hash_set that's optimized for up to n items, using h as the hash function. |
| dense_hash_set(size_type n, const hasher& h, const key_equal& k) | Hashed Associative Container | Creates an empty dense_hash_set that's optimized for up to n items, using h as the hash function and k as the key equal function. |
| dense_hash_set(size_type n, const hasher& h, const key_equal& k, const allocator_type& a) | Unordered Associative Container (tr1) | Creates an empty dense_hash_set that's optimized for up to n items, using h as the hash function, k as the key equal function, and a as the allocator object. |
template <class InputIterator> dense_hash_set(InputIterator f, InputIterator l)[2] |
Unique Hashed Associative Container | Creates a dense_hash_set with a copy of a range. |
template <class InputIterator> dense_hash_set(InputIterator f, InputIterator l, size_type n)[2] |
Unique Hashed Associative Container | Creates a hash_set with a copy of a range that's optimized to hold up to n items. |
template <class InputIterator> dense_hash_set(InputIterator f, InputIterator l, size_type n, const hasher& h)[2] |
Unique Hashed Associative Container | Creates a hash_set with a copy of a range that's optimized to hold up to n items, using h as the hash function. |
template <class InputIterator> dense_hash_set(InputIterator f, InputIterator l, size_type n, const hasher& h, const key_equal& k)[2] |
Unique Hashed Associative Container | Creates a hash_set with a copy of a range that's optimized for holding up to n items, using h as the hash function and k as the key equal function. |
template <class InputIterator> dense_hash_set(InputIterator f, InputIterator l, size_type n, const hasher& h, const key_equal& k, const allocator_type& a)[2] |
Unordered Associative Container (tr1) | Creates a hash_set with a copy of a range that's optimized for holding up to n items, using h as the hash function, k as the key equal function, and a as the allocator object. |
| dense_hash_set(const hash_set&) | Container | The copy constructor. |
| dense_hash_set& operator=(const hash_set&) | Container | The assignment operator |
| void swap(hash_set&) | Container | Swaps the contents of two hash_sets. |
pair<iterator, bool> insert(const value_type& x) |
Unique Associative Container | Inserts x into the dense_hash_set. |
pair<iterator, bool> insert(value_type&& x) |
Unique Associative Container | Inserts x into the dense_hash_set. |
template <class InputIterator> void insert(InputIterator f, InputIterator l)[2] |
Unique Associative Container | Inserts a range into the dense_hash_set. |
template<class... Args> pair<iterator, bool> emplace(Args&&... args) |
dense_hash_set | Inserts a new element into the dense_hash_set. The element is constructed in-place with the given args. |
template<class... Args> pair<iterator, bool> emplace_hint(const_iterator hint, Args&&... args) |
dense_hash_set | Inserts a new element into the dense_hash_set, using hint as a suggestion where the element should go. The element is constructed in-place with the given args. |
| void set_empty_key(const key_type& key) [4] | dense_hash_set | See below. |
| void set_deleted_key(const key_type& key) [4] | dense_hash_set | See below. |
| void clear_deleted_key() [4] | dense_hash_set | See below. |
| iterator erase(const_iterator pos) | Associative Container | Erases the element pointed to by pos. Returns the iterator following the last removed element. [4] |
| size_type erase(const key_type& k) | Associative Container | Erases the element whose key is k. [4] |
| iterator erase(const_iterator first, const_iterator last) | Associative Container | Erases all elements in a range. Returns the iterator following the last removed element. [4] |
| void clear() | Associative Container | Erases all of the elements. |
| void clear_no_resize() | dense_hash_set | See below. |
| iterator find(const key_type& k) const | Associative Container | Finds an element whose key is k. |
| size_type count(const key_type& k) const | Unique Associative Container | Counts the number of elements whose key is k. |
pair<iterator, iterator> equal_range(const key_type& k) const |
Associative Container | Finds a range containing all elements whose key is k. |
| template <ValueSerializer, OUTPUT> bool serialize(ValueSerializer serializer, OUTPUT *fp) | dense_hash_set | See below. |
| template <ValueSerializer, INPUT> bool unserialize(ValueSerializer serializer, INPUT *fp) | dense_hash_set | See below. |
| NopointerSerializer | dense_hash_set | See below. |
| bool write_metadata(FILE *fp) | dense_hash_set | DEPRECATED. See below. |
| bool read_metadata(FILE *fp) | dense_hash_set | DEPRECATED. See below. |
| bool write_nopointer_data(FILE *fp) | dense_hash_set | DEPRECATED. See below. |
| bool read_nopointer_data(FILE *fp) | dense_hash_set | DEPRECATED. See below. |
bool operator==(const hash_set&, const hash_set&) |
Hashed Associative Container | Tests two hash_sets for equality. This is a global function, not a member function. |
| Member | Description |
|---|---|
| void set_empty_key(const key_type& key) | Sets the distinguished "empty" key to key. This must be called immediately after construct time, before calls to another other dense_hash_set operation. [4] |
| void set_deleted_key(const key_type& key) | Sets the distinguished "deleted" key to key. This must be called before any calls to erase(). [4] |
| void clear_deleted_key() | Clears the distinguished "deleted" key. After this is called, calls to erase() are not valid on this object. [4] |
| void clear_no_resize() | Clears the hashtable like clear() does, but does not recover the memory used for hashtable buckets. (The memory used by the items in the hashtable is still recovered.) This can save time for applications that want to reuse a dense_hash_set many times, each time with a similar number of objects. | void set_resizing_parameters(float shrink, float grow) | This function is DEPRECATED. It is equivalent to calling min_load_factor(shrink); max_load_factor(grow). |
| template <ValueSerializer, OUTPUT> bool serialize(ValueSerializer serializer, OUTPUT *fp) | Emit a serialization of the hash_set to a stream. See below. |
| template <ValueSerializer, INPUT> bool unserialize(ValueSerializer serializer, INPUT *fp) | Read in a serialization of a hash_set from a stream, replacing the existing hash_set contents with the serialized contents. See below. |
| bool write_metadata(FILE *fp) | This function is DEPRECATED. See below. |
| bool read_metadata(FILE *fp) | This function is DEPRECATED. See below. |
| bool write_nopointer_data(FILE *fp) | This function is DEPRECATED. See below. |
| bool read_nopointer_data(FILE *fp) | This function is DEPRECATED. See below. |
[1] This member function relies on member template functions, which may not be supported by all compilers. If your compiler supports member templates, you can call this function with any type of input iterator. If your compiler does not yet support member templates, though, then the arguments must either be of type const value_type* or of type dense_hash_set::const_iterator.
[2] In order to preserve iterators, erasing hashtable elements does not cause a hashtable to resize. This means that after a string of erase() calls, the hashtable will use more space than is required. At a cost of invalidating all current iterators, you can call resize() to manually compact the hashtable. The hashtable promotes too-small resize() arguments to the smallest legal value, so to compact a hashtable, it's sufficient to call resize(0).
[3] Unlike some other hashtable implementations, the optional n in the calls to the constructor, resize, and rehash indicates not the desired number of buckets that should be allocated, but instead the expected number of items to be inserted. The class then sizes the hash-set appropriately for the number of items specified. It's not an error to actually insert more or fewer items into the hashtable, but the implementation is most efficient -- does the fewest hashtable resizes -- if the number of inserted items is n or slightly less.
[4] dense_hash_set requires you call set_empty_key() immediately after constructing the hash-set, and before calling any other dense_hash_set method. (This is the largest difference between the dense_hash_set API and other hash-set APIs. See implementation.html for why this is necessary.) The argument to set_empty_key() should be a key-value that is never used for legitimate hash-set entries. If you have no such key value, you will be unable to use dense_hash_set. It is an error to call insert() with an item whose key is the "empty key."
dense_hash_set also requires you call set_deleted_key() before calling erase(). The argument to set_deleted_key() should be a key-value that is never used for legitimate hash-set entries. It must be different from the key-value used for set_empty_key(). It is an error to call erase() without first calling set_deleted_key(), and it is also an error to call insert() with an item whose key is the "deleted key."There is no need to call set_deleted_key if you do not wish to call erase() on the hash-set.
It is acceptable to change the deleted-key at any time by calling set_deleted_key() with a new argument. You can also call clear_deleted_key(), at which point all keys become valid for insertion but no hashtable entries can be deleted until set_deleted_key() is called again.
It is possible to save and restore dense_hash_set objects to an arbitrary stream (such as a disk file) using the serialize() and unserialize() methods.
Each of these methods takes two arguments: a serializer, which says how to write hashtable items to disk, and a stream, which can be a C++ stream (istream or its subclasses for input, ostream or its subclasses for output), a FILE*, or a user-defined type (as described below).
The
struct StringSerializer { bool operator()(FILE* fp, const std::string& value) const { assert(value.length() <= 255); // we only support writing small strings const unsigned char size = value.length(); if (fwrite(&size, 1, 1, fp) != 1) return false; if (fwrite(value.data(), size, 1, fp) != 1) return false; return true; } bool operator()(FILE* fp, std::string* value) const { unsigned char size; // all strings are <= 255 chars long if (fread(&size, 1, 1, fp) != 1) return false; char* buf = new char[size]; if (fread(buf, size, 1, fp) != 1) { delete[] buf; return false; } value->assign(buf, size); delete[] buf; return true; } };
Here is the functor being used in code (error checking omitted):
dense_hash_set<string> myset = CreateSet(); FILE* fp = fopen("hashtable.data", "w"); myset.serialize(StringSerializer(), fp); fclose(fp); dense_hash_set<string> myset2; FILE* fp_in = fopen("hashtable.data", "r"); myset2.unserialize(StringSerializer(), fp_in); fclose(fp_in); assert(myset == myset2);
Note that this example serializer can only serialize to a FILE*. If you want to also be able to use this serializer with C++ streams, you will need to write two more overloads of operator()'s, one that reads from an istream, and one that writes to an ostream. Likewise if you want to support serializing to a custom class.
If the key is "simple" enough, you can use the pre-supplied functor NopointerSerializer. This copies the hashtable data using the equivalent of a memcpy<>. Native C data types can be serialized this way, as can structs of native C data types. Pointers and STL objects cannot.
Note that NopointerSerializer() does not do any endian conversion. Thus, it is only appropriate when you intend to read the data on the same endian architecture as you write the data.
If you wish to serialize to your own stream type, you can do so by creating an object which supports two methods:
bool Write(const void* data, size_t length); bool Read(void* data, size_t length);
Write() writes length bytes of data to a stream (presumably a stream owned by the object), while Read() reads data bytes from the stream into data. Both return true on success or false on error.
To unserialize a hashtable from a stream, you wil typically create a new dense_hash_set object, then call unserialize() on it. unserialize() destroys the old contents of the object. You must pass in the appropriate ValueSerializer for the data being read in.
Both serialize() and unserialize() return true on success, or false if there was an error streaming the data.
Note that serialize() is not a const method, since it purges deleted elements before serializing. It is not safe to serialize from two threads at once, without synchronization.
NOTE: older versions of dense_hash_set provided a different API, consisting of read_metadata(), read_nopointer_data(), write_metadata(), write_nopointer_data(). These methods were never implemented and always did nothing but return false. You should exclusively use the new API for serialization.
erase() is guaranteed not to invalidate any iterators -- except for any iterators pointing to the item being erased, of course. insert() invalidates all iterators, as does resize().
This is implemented by making erase() not resize the hashtable. If you desire maximum space efficiency, you can call resize(0) after a string of erase() calls, to force the hashtable to resize to the smallest possible size.
In addition to invalidating iterators, insert() and resize() invalidate all pointers into the hashtable. If you want to store a pointer to an object held in a dense_hash_set, either do so after finishing hashtable inserts, or store the object on the heap and a pointer to it in the dense_hash_set.
The following are SGI STL, and some Google STL, concepts and classes related to dense_hash_set.
hash_set, Associative Container, Hashed Associative Container, Simple Associative Container, Unique Hashed Associative Container, set, map multiset, multimap, hash_map, hash_multiset, hash_multimap, sparse_hash_set, sparse_hash_map, dense_hash_map


Territory Manager:
There is nothing I can do for you. Given your level of achievement, I have nothing else to offer you. I look forward to witnessing your accomplishments in the next territory battle.


Google Duo adds Scooby-Doo video effects ahead of 2020 movie
by Ben SchoonScooby-Doo is returning to movie theaters in May of next year, and well ahead of that movie’s launch, Google Duo is joining in on the fun with some new effects.
Rolling out to users now via a server-side change, these three new video effects place Scooby-Doo in the frame of your video call or message. The three effects are all slightly different, with one placing Scooby in the bottom left of the frame as he looks back and forth. Another places him on the right side of the frame as he laughs.
 The effect only appears when your face is in the frame, and Scooby will move based on your head movements side to side or even up and down. I’ve only used this briefly, but this is definitely my favorite of the collection.
The movie these effects tie in with won’t arrive until May 2020, but if you’re a fan of the character or just want a dog on your head as you send a video message, they’re pretty cool. The Scooby-Doo effects in Google Duo should be live for most users as of today, alongside a handful of others that are already live.
More on Google Duo:
- Google Duo testing Effects and Filters for video messages [Gallery]
- Google Duo adds new video filters just in time for Halloween and Diwali
- Messages for web adds Google Duo calling integration
Thanks Jondan!
FTC: We use income earning auto affiliate links. More.


dimatto
menu
Home
Brand
Style Pick
Collection
Now
EN
CN
close
Special
Big issue
Must
Haves
Style
Alive
Upgrade
style Item
top


odsMap
ods-widgets
This widget allows you to build a map visualization and show data using various modes of display using layers. Each layer is based on a Dataset Context, a mode of display (clusters...), and various properties to define the display itself, such as colors.
Layers can be combined, so that you map shows various data sources in various ways.
Layers are dynamic, which means that if a context changes (e.g. a new refine is added), the layer will be refreshed and display the new relevant data.
This widget can also be used to control other widgets: you can configure a layer to act as a refine control on another context, so that for example if you click on a road you get a table view of the traffic on that road. You can also draw zones on the map, which will accordingly refine the context.
You can use the widget alone to propose a simple map using default settings, such as this:
 <ods-map context="mycontext" location="12,48.85218,2.36996"></ods-map>
However, the ability to build a more advanced and configurable map comes with a second odsMapLayer
tag, used to define a layer:
 <ods-map> <ods-map-layer context="mycontext" color="#FF0000" display="clusters"></ods-map-layer> </ods-map>
You can have several layers, each with their own configuration and context:
<ods-map> <ods-map-layer context="mycontext" color="#FF0000" display="clusters"></ods-map-layer> <ods-map-layer context="mycontext2" display="heatmap"></ods-map-layer> <ods-map-layer context="mycontext3" display="raw" color="#0000FF"></ods-map-layer> </ods-map>
You can show or hide layers using the showIf
property, similar to Angular's ngIf
.
<ods-map> <ods-map-layer context="mycontext" color="#FF0000" display="clusters"></ods-map-layer> <ods-map-layer context="mycontext2" display="heatmap" show-if="showHeatmap"></ods-map-layer> </ods-map>
You can also configure layers to only be visible between certain zoom levels, using showZoomMin
,
showZoomMax
, or both.
 <ods-map>  <ods-map-layer context="mycontext1" show-zoom-max="8"></ods-map-layer>  <ods-map-layer context="mycontext2" show-zoom-min="9" show-zoom-max="14"></ods-map-layer>  <ods-map-layer context="mycontext3" show-zoom-min="15"></ods-map-layer> </ods-map>
Several display modes are available, under two categories: visualization of the data itself (each point is a record), and visualization of an aggregation of data (each point is the result of an aggregation function).
auto
: depending on the number of points and the type of geometry, the best display mode is automatically chosen. This is the default display
mode, and makes sense mot of the time of you want to simply represent geo data.raw
: data is downloaded and displayed directly as is, with no clustering or simplification of any kind. Do not
use on large (1000+) datasets, as it may freeze the user's browser.clusters
: data is aggregated spatially into clusters; each cluster represents two or more "close" points. When at maximum
zoom, all points are shown.clustersforced
: data is aggregated spatially into clusters, but the number on the cluster is the result of an aggregation function.heatmap
: data is displayed as a heatmap; by default it represents the density of points, but it can be the result of an aggregation function.aggregation
: data is aggregated based on their geo shape (e.g. two records with the exact same associated shape); by default the color represents
the number of aggregated records, but it can be the result of an aggregation function. This mode supports aggregating the context
using a join with another context that contains geometrical shapes: use a joinContext
property, and localKey
and remoteKey
to configure
the field names of the local and joined datasets; you can also configure one of the fields from the "remote" dataset to be displayed when the mouse
hovers the shapes, using hoverField
and the name of a field.You can specify aggregation functions on display modes that support it (aggregation
, heatmap
, clustersforced
).
This is done using two parameters: function
(AVG for average, MIN for minimum, MAX for maximum, STDDEV for standard deviation,
COUNT to count the number of records, SUM for the sum of values), and expression
to define the value used for the
function, usually the name of a field (expression
is not required when the function is COUNT).
<ods-map>  <ods-map-layer context="mycontext" display="heatmap" expression="value" function="AVG"></ods-map-layer> </ods-map>
Apart from heatmap
, all display modes support color configuration. Three types of configurations are available, depending on the display mode.
color
: a simple color, as an hex code (#FF0F05) or a simple CSS color name like "red". Available for any mode except heatmap
.colorScale
: the name of a ColorBrewer [http://colorbrewer2.org/] scheme, like "YlGnBu". Available for aggregation
.colorRanges
: a serie of colors and ranges separated by a semicolon, to decide a color depending on a value. For example "red;20;orange;40;#00CE00" to color anything between
20 and 40 in orange, below 20 in red, and above 40 in a custom hex color. Combine with a decimal or integer field name in colorByField
to configure which field will be
used to decide on the color (for raw
) or with function
and expression
to determine the calculation used for the color (for aggregation
). Available for raw
and aggregation
.An additional colorFunction
property can contain the log
value to use logarithmic scales (instead of the default linear scale) for generating the color scale. Available for aggregation
and with color
and colorScale
display modes (or when none is specified).
On top of color configuration, the icon used as a marker on the map can be configured through the picto
property. The property supports the keywords listed in the Pictograms reference
When displaying shapes, you can also use borderColor
and opacity
to configure the color of the shape border and the opacity of the shape's fill.
If you are displaying data where multiple points or shapes are stacked, you can configure the order in which the items will be
displayed in the tooltip, using tooltipSort
and the name of a field, prefixed by -
to have a reversed sort.
Note: by default, numeric fields are sorted in decreasing order, date and datetime are sorted chronologically, and text fields are sorted
alphanumerically.
<ods-map>  <ods-map-layer context="mycontext" tooltip-sort="-field"></ods-map-layer> </ods-map>
By default, tooltips show the values associated with a point or shape in a simple template. You can configure your own template by adding
HTML inside the <ods-map-layer></ods-map-layer>
tag. Your template is AngularJS-enabled and will be provided with a record
object; this object contains
a fields
object with all the values associated with the clicked point or shape.
<ods-map location="12,48.86167,2.34146"> <ods-map-layer context="mycontext">
my value is: {{record.fields.myvalue}}
 </ods-map-layer> </ods-map>
If tooltips are not relevant for your data, you can disable them by using the tooltip-disabled="true"
option.
<ods-map> <ods-map-layer context="mycontext" tooltip-disabled="true"></ods-map-layer> </ods-map>
If your layer is displayed as raw
or aggregation
, you can configure a layer so that a click on an item triggers a refine on another context, using refineOnClickContext
.
One or more contexts can be defined:
<ods-map> <ods-map-layer context="mycontext" refine-on-click-context="mycontext2"></ods-map-layer> <ods-map-layer context="mycontext3" refine-on-click-context="[mycontext4, mycontext5]"></ods-map-layer> </ods-map>
By default, the filter occurs on geometry; for example, clicking on a shape filters the other context on the area.
You can also trigger a refine on specific fields; using refineOnClickMapField
to configure the name of the field to get the value from, and refineOnClickContextField
to configure the name of the field of the other context to refine on. If you have two or more contexts, you can configure the fields by indicating the context in the
name of the property, as refineOnClick[context]MapField
and refineOnClick[context]ContextField
.
<ods-map> <ods-map-layer context="mycontext" refine-on-click-context="[mycontext, mycontext2]" refine-on-click-mycontext-map-field="field1" refine-on-click-mycontext-context-field="field2" refine-on-click-mycontext2-map-field="field3" refine-on-click-mycontext2-context-field="field4"></ods-map-layer> </ods-map>
When you first load the map (if there is no location
parameter), and when your context parameters change, the
map is refreshed and moves to fit the content of the new data to display. If you want to exclude a layer's data
from the new position's calculation, you can use excludeFromRefit
:
<ods-map> <ods-map-layer context="mycontext"></ods-map-layer> <ods-map-layer context="mycontext3" exclude-from-refit="true"></ods-map-layer> </ods-map>
<ods-map context="{DatasetContext}" [sync-to-url]="{boolean}" [sync-to-object]="{Object}" [location]="{string}" [basemap]="{string}" [tooltip-sort]="{string}" [static-map]="{boolean}" [no-refit]="{boolean}" toolbar-geolocation="{boolean}" toolbar-drawing="{boolean}" toolbar-fullscreen="{boolean}" scroll-wheel-zoom="{boolean}" min-zoom="{integer}" max-zoom="{integer}" [ods-auto-resize]="{boolean}" auto-geolocation="{boolean}" display-control="{boolean}" display-control-single-layer="{boolean}" search-box="{boolean}"> </ods-map>
| Param | Type | Details |
|---|---|---|
| context | DatasetContext | Dataset Context to use |
| [syncToUrl] | boolean | If true, persists the |
| [syncToObject] | Object | An object where the |
| [location] | string | The default location of the map upon initialization, under the following format: "zoom,latitude,longitude". For example, to have a map centered on Paris, France, you can use "12,48.85218,2.36996". By default, if a location is not specified, the map will try to fit all the displayed data when initializing. |
| [basemap] | string | The identifier of the basemap to use by default, as defined in ODSWidgetsConfig.basemaps. By default, the first available basemap will be used. |
| [tooltipSort] | string | The identifier of the field used to define the tooltips rendering order at a same spot. Use "field" for default sort, use "-field" for reversed sort. By default, numeric fields are sorted in decreasing order, date and datetime are sorted chronologically, and text fields are sorted alphanumerically. |
| [staticMap] | boolean | If "true", then users won't be able to move or zoom on the map. They will still be able to click on markers. |
| [noRefit] | boolean | By default, the map refits its view whenever the displayed data changes. If "true", then the map will stay at the same location instead. |
| toolbarGeolocation | boolean | If "false", then the "geolocate" button won't be displayed in the map's toolbar. (default: true) |
| toolbarDrawing | boolean | If "false", then the drawing tools (to draw filter areas) won't be displayed in the map's toolbar. (default: true) |
| toolbarFullscreen | boolean | If "false", then the "go fullscreen" button won't be displayed in the map's toolbar. (default: true) |
| scrollWheelZoom | boolean | If "false", then scrolling your mouse wheel over the map won't zoom/unzoom it. (default: true) |
| minZoom | integer | Limits the map to a minimum zoom value. By default this is defined by the minimum zoom of the basemap. (default: none) |
| maxZoom | integer | Limits the map to a maximum zoom value. By default this is defined by the maximum zoom of the basemap. (default: none) |
| [odsAutoResize] | boolean | see Auto Resize for more informations |
| autoGeolocation | boolean | If "true", then the geolocation (center and zoom the map on the location of the user) is automatically done upon initialization.
Only available when there is no (default: false) |
| displayControl | boolean | If true, displays a control to toggle display of groups (or single datasets outside groups). Note:
it shouldn't be combined with the usage of (default: false) |
| displayControlSingleLayer | boolean | If true, only one layer will be displayed at a time using the control to toggle the display of groups. (default: false) |
| searchBox | boolean | If true, a search box will appear in the map, allowing you to jump to locations, or search data on the map. (default: false) |


Angular's HTML compiler
allows the developer to teach the
browser new HTML syntax. The compiler allows you to attach behavior to any HTML element or attribute
and even create new HTML elements or attributes with custom behavior. Angular calls these behavior
extensions directives
.
HTML has a lot of constructs for formatting the HTML for static documents in a declarative fashion.
For example if something needs to be centered, there is no need to provide instructions to the
browser how the window size needs to be divided in half so that the center is found, and that this
center needs to be aligned with the text's center. Simply add an align="center"
attribute to any
element to achieve the desired behavior. Such is the power of declarative language.
But the declarative language is also limited, since it does not allow you to teach the browser new syntax. For example there is no easy way to get the browser to align the text at 1/3 the position instead of 1/2. What is needed is a way to teach the browser new HTML syntax.
Angular comes pre-bundled with common directives which are useful for building any app. We also expect that you will create directives that are specific to your app. These extensions become a Domain Specific Language for building your application.
All of this compilation takes place in the web browser; no server side or pre-compilation step is involved.
Compiler is an angular service which traverses the DOM looking for attributes. The compilation process happens in two phases.
Compile: traverse the DOM and collect all of the directives. The result is a linking function.
Link: combine the directives with a scope and produce a live view. Any changes in the scope model are reflected in the view, and any user interactions with the view are reflected in the scope model. This makes the scope model the single source of truth.
Some directives such as
clone DOM elements once
for each item in a collection. Having a compile and link phase improves performance since the
cloned template only needs to be compiled once, and then linked once for each clone instance.ng-repeat
A directive is a behavior which should be triggered when specific HTML constructs are encountered
during the compilation process. The directives can be placed in element names, attributes, class
names, as well as comments. Here are some equivalent examples of invoking the
directive.ng-bind
  <ng-bind></ng-bind>
A directive is just a function which executes when the compiler encounters it in the DOM. See directive API
for in-depth documentation on how
to write directives.
Here is a directive which makes any element draggable. Notice the draggable
attribute on the

element.
The presence of the draggable
attribute on any element gives the element new behavior. The beauty of
this approach is that we have taught the browser a new trick. We have extended the vocabulary of
what the browser understands in a way which is natural to anyone who is familiar with HTML
principles.
There are many templating systems out there. Most of them consume a static string template and
combine it with data, resulting in a new string. The resulting text is then innerHTML
ed into
an element.
This means that any changes to the data need to be re-merged with the template and then
innerHTML
ed into the DOM. Some of the issues with this approach are: reading user input and merging it with data,
clobbering user input by overwriting it, managing the whole update process, and lack of behavior
expressiveness.
Angular is different. The Angular compiler consumes the DOM with directives, not string templates.
The result is a linking function, which when combined with a scope model results in a live view. The
view and scope model bindings are transparent. No action from the developer is needed to update
the view. And because no innerHTML
is used there are no issues of clobbering user input.
Furthermore, Angular directives can contain not just text bindings, but behavioral constructs as
well.
The Angular approach produces a stable DOM. This means that the DOM element instance bound to a model item instance does not change for the lifetime of the binding. This means that the code can get hold of the elements and register event handlers and know that the reference will not be destroyed by template data merge.


Create a control structure for running EM algorithms
em.control(ctrl = NULL, ...)
| nplot | how often to plot wages of comparaison to model0 |
|---|---|
| ncat | how often to log information |
| maxiter | maximum number of iterations |
| model_var | whether to allow for flexible variance (default is TRUE) |
| est_Amb | TBD |
| cstr_type | defines the type of constraints on the means for estimation |
| cstr_val | TBD |
| tol | tolerance for stopping the EM |
| tau | posterior likelihood to use instead of computing them using initial parameters |
| model0 | model to compare estimation to when plotting |
| presp=1e-9 | TBD |
| rel_weight | setting a particular weight for stayers versus movers (default is 1) |
| est_rho | vector of TRUE/FALSE that states which rho should be estimated |
| rho_in_diff | whether to estimate rho in level of in differences |
| dprior | Dirichlet prior for proportions (default 1.01) |
| nfirms_to_update=10, | number firms to update in probabilistic approach |
| proba_include | what terms to include in the liklihood for probabilistic approach (default to = c(1,1,1,1)) |
| check_lik | whether to check the likelihood at each updating parameter |
| stochastic | whether to use stochastic EM instead of straight EM |
| fixb | when TRUE, imposes fixed interactions in different time periods |
| fixm | when TRUE, levels are not updated, only variances and proportions |
| deps=1e-50 | TBD |
| file_backup_prefix | TBD |
| sd_floor= | floor imposed on all standard deviations (default is 1e-10) |
| posterior_reg | term added to posterior probablities (this is to deal with numerical issues, default is 1e-9) |
| textapp | text to show in logging |
| sdata_subsample | share of the stayers to use in estimation |
| sdata_subredraw | whether to redraw the subsample of stayers |
| vdec_sim_size | size to use in simulation |
| stayer_weight | weight attributed to stayers in joint estimation |
| est_rep= | number of starting values for EM |
| est_nbest | number of best starting values to select from using connectedness |


What's Wrong With This Pitcher? For Love of the Game
By Ross Anthony
Like New York's Yankee Fans, you might want to root against Kevin Costner as Detroit Tigers' aging pitcher Billy Chapel in another silly love story at the baseball diamond. And for the first couple of innings you'd have good reason to heckle. But like the aching Chapel, "For Love of the Game" slowly pulls itself out of a sluggish slump. Sliding in slow motion under your skin, it gradually pulls you from that slouched near-sleep position to the edge of the bleaches ... baited and waiting on that last pitch.
Unlike most sports films, this one starts rather promptly into the proverbial "big game." His lover (Preston) bails, his owner sells the team, and the next day after a sleepless night Chapel steps up to the mound in what could very possibly be his last pro game. Such a hurried start leaves the viewer wanting for traditional character setups; fear not, the bottom of each inning provides ample time for reflection. These "flashbacks" bring you up to speed on what looks like a possible no-hitter for a guy who throws for the love of the game.
Unfortunately, the film ends as it begins -- that last pitch is a fading sinker (metaphorically speaking). Engaging and well directed in the middle, but weak on beginning and end; Costner and Preston give outstanding performances throughout. While it still hits above average, a different climax may have made this a very fine film.
Save yourself a few bucks and quench your appetite for a good baseball love story: rent "The Natural" with Robert Redford now and "For the Love of the Game" around Christmas.
For Love of the Game, Copyright © 1999. Rated PG-13. Starring Kevin Costner, Kelly Preston, John C. Reilly, Jena Malone. Directed by Sam Raimi. Screenplay by Dana Stevens. Produced by Armyan Bernstein and Amy Robinson at Universal/Beacon/TIG.
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


In this session:
This part of the session is to make sure we understand the tf-idf weight scheme for representing documents as vectors and the cosine similarity measure. We will complete a program that does basically the following:
while (true) {
1. read two filenames f1, f2;
2. get the document identifiers id1, id2 of the files f1 and f2 in the index;
3. compute the tf-idf representation of id1, id2 as vectors v1, v2 (and print them);
4. compute the cosine similarity of v1, v2 (and print it);
}
We will use an IndexSearcher object to search the index for the two files in step 2,
and an IndexReader object to obtain the relevant information (tf's and idf's)
from the index in step 3;
Steps 1 and 4 do not require accessing the index.
First of all, we need to make sure that the index we build contains all the information required to compute tf-idf's, which is mainly frequencies of terms in documents. At least in some versions of Lucene, the IndexFiles.java class does not really store them by default (to save space). With the program we are going to complete, if we use such an index we will get a "null pointer error" because we will ask Lucene to give us a certain TermFreqVector that is not there.
To solve this, we need to change IndexFiles.java as follows. Locate the line where the "contents" field is added to the document that is being indexed. Will look roughly like this:
doc.add(new Field("contents",something-about-a-FileReader-or-BufferedReader));
and add the flag saying that the new Field should store TermVector information:
doc.add(new Field("contents",something-about-a-FileReader-or-BufferedReader,Field.TermVector.YES));
Compile IndexFiles.java, then index the novels directory.
Get the classes TfIdfViewer.java and TermWeight.java. TermWeight.java simply represents a pair (string,weight). Have a look at it and compile it now. TfIdfViewer.java is the (incomplete) program that implements the pseudocode above. When it is complete we should call it as:
% java TfIdfViewer -index mydirectory
and then enter pairs of filenames to display these files in tf-idf format and get their similarity. The names should include the directory paths as they appear in the index (you can use lucene to view them).
Study the existing code:
Once you are done with your program, try it out with the test collections from the previous sessions. First, test your implementation by computing the similarity of a file with itself (what should it give?).
You may even want to create a very simple collection with two documents and three or four terms so that you can check by hand your implementation.
To deliver: Write a brief report (less than 1 page) explaining a) if you read and understood the code that was provided, b) if you succeeded in implementing everything, c) any major difficulties you found, and d) any observations on your experiments or on what you learned this way. Pdf format is preferred. Make sure it has your name, date, and title. You must also deliver all that classes that you modified. Not the java classes you didn't modify. Please mark with visible comments the parts where you made changes. Pack everything in a .zip file.
Procedure: Normally, use the tool in the Racó called "Practiques via web". In an emergency, send by email to "gavalda" followed by<EMAIL_ADDRESS>Deadline: Work must be delivered within 2 weeks from the lab session you attend. Late deliveries risk being penalized or not accepted at all. If you anticipate problems with the deadline, tell me as soon as possible.
Rules: 1. You can solve the problem alone or with one other person, but at most one lab assignment with the same person in the whole course. 2. No plagiarism; don't discuss your work with others, except your teammate if you are solving the problem in two; if in doubt about what is allowed, ask us. 3. If you feel you are spending much more time than the rest of the group, ask us for help. Questions can be asked either in person or by email, and you'll never be penalized by asking questions, no matter how stupid they look in retrospect.


Some of the highlights of our trips are listed here, scroll down to start planning your lifechanging experince in Africa below.
Victoria Falls, Zimbabwe is home to the world’s largest waterfall. Considered one of the 7 Wonders of the Natural World, this magnificent site is the centerpiece of this amazing adventure.
Cape Town, South Africa is one of the most beautiful cities in the modern world with Table Mountain as the magnificent backdrop. Table Mountain is considered one of the 7 New Wonders of the Natural World and offers spectacular views of Cape Town from the top.