* Halo2PC.com who made Halo 2 great again and provide us the awesome website design.
* MrZameg and Trompetica who create the medals idea and medals design.
* FIFA #1.
* Chris who made the stats system and the medals system development.
* Source Code will be available soon.
Powered by Chris😎.


class EventAdapter : Adapter<ViewHolder>
A RecyclerView adapter for displaying events in a standard list layout. |
|
class EventHandler
Convenience class for finding events from the database. |
|
class EventsActivity : NavigationDrawerActivity
Activity for displaying a list of birthdays and anniversaries. |


|
|
ximpl_
are subject to change without warning on any release, including revision releases.
Classes | |
| class | c_string_sink |
| Sink for translating a statement into c_string instructions. More... | |
| class | char_buffer_sink |
| Sink for translating a statement into char_buffer instructions. More... | |
| class | ff_FILE_sink |
Utility class that allows a standard C stream - stdout , stderr - to be passed as a sink. More... | |
| struct | null_sink |
| A class that acts as a bit-bucket sink. More... | |
| class | OutputDebugString_sink |
Sink for sending a statement to Windows' OutputDebugString() . More... | |
| class | shim_string_sink |
| This class acts as a sink for string shims, to be used with STLSoft 1.9. More... | |
| class | speech_sink |
| Sink for translating a statement into speech. More... | |
| class | string_array_sink |
| Sink for translating a statement into an entry in an array of strings. More... | |
| class | vectored_file_sink |
| Sink for translating a statement into iovec instructions. More... | |
| class | WindowsConsole_sink |
| Sink for coloured output via Windows' console. More... | |
| class | WindowsMessageBox_sink |
Sink for sending a statement to Windows' MessageBox() . More... | |
Functions | |
| template<typename S> | |
| S & | fmt_slices (S &sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results) |
| Action shim for generic string types. | |
| ACE_CString & | fmt_slices (ACE_CString &sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results) |
Writes an array of string slices into a ACE_CString sink. | |
| template<typename C, size_t N, typename A> | |
| stlsoft::auto_buffer< C, N, A > & | fmt_slices (stlsoft::auto_buffer< C, N, A > &sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results) |
| Formats into an auto_buffer. | |
| c_string_sink & | fmt_slices (c_string_sink &sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results) |
| Formats into a c_string. | |
| CComBSTR & | fmt_slices (CComBSTR &sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results) |
Writes an array of string slices into a CComBSTR sink. | |
| char_buffer_sink & | fmt_slices (char_buffer_sink &sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results) |
| Formats into a char_buffer. | |
| CString & | fmt_slices (CString &sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results) |
Writes an array of string slices into a CString sink. | |
| ff_FILE_sink | to_sink (FILE *stm) |
Conversion shim that allows a standard C stream - stdout , stderr - to be passed as a sink. | |
| FILE *& | fmt_slices (FILE *&sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results) |
Writes an array of string slices into a FILE* sink. | |
| ff_FILE_sink & | fmt_slices (ff_FILE_sink &sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results) |
Writes an array of string slices into a ff_FILE_sink sink. | |
| null_sink & | fmt_slices (null_sink &sink, int, size_t cchTotal, size_t numResults, ff_string_slice_t const *results) |
Writes an array of string slices into a null_sink sink. | |
| std::basic_ostream< ff_char_t > & | fmt_slices (std::basic_ostream< ff_char_t > &sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results) |
Writes an array of string slices into a std::ostream sink. | |
| OutputDebugString_sink & | fmt_slices (OutputDebugString_sink &sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results) |
Writes an array of string slices to Windows' OutputDebugString() . | |
| char const * | c_str_data_a (shim_string_sink const &sink) |
| Returns a possibly non-nul-terminated non-NULL C-style string representing the shim string. | |
| ff_char_t const * | c_str_data (shim_string_sink const &sink) |
| Returns a possibly non-nul-terminated non-NULL C-style string representing the shim string. | |
| size_t | c_str_len_a (shim_string_sink const &sink) |
| Returns the number of characters in the length of the C-style string representing the shim string. | |
| size_t | c_str_len (shim_string_sink const &sink) |
| Returns the number of characters in the length of the C-style string representing the shim string. | |
| speech_sink & | fmt_slices (speech_sink &sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results) |
| Writes an array of string slices into a speech sink. | |
| template<typename R, typename I> | |
| stlsoft::FILE_stream_base< R, I > & | fmt_slices (stlsoft::FILE_stream_base< R, I > &sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results) |
Writes an array of string slices into a stlsoft::FILE_stream sink. | |
| string_array_sink & | fmt_slices (string_array_sink &sink, int flags, size_t, size_t numResults, ff_string_slice_t const *results) |
| Writes an array of string slices into a string array sink. | |
| std::basic_stringstream < ff_char_t > & | fmt_slices (std::basic_stringstream< ff_char_t > &sink, int flags, size_t, size_t numResults, ff_string_slice_t const *results) |
Writes an array of string slices into a std::stringstream sink. | |
| vectored_file_sink & | fmt_slices (vectored_file_sink &sink, int flags, size_t, size_t numResults, ff_string_slice_t const *results) |
Writes an array of string slices into an iovec sink. | |
| WindowsConsole_sink | WindowsConsole (HANDLE hConsole, WORD textAttributes) |
| Creator function for the WindowsConsole_sink class. | |
| WindowsConsole_sink | WindowsConsole (WORD textAttributes) |
| Creator function for the WindowsConsole_sink class. | |
| WindowsConsole_sink & | fmt_slices (WindowsConsole_sink &sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results) |
Writes an array of string slices into a WindowsConsole_sink sink. | |
| WindowsMessageBox_sink | MessageBox (HWND hwnd, LPCTSTR caption, UINT type) |
| Creator function for the WindowsMessageBox_sink class. | |
| WindowsMessageBox_sink | MessageBox (LPCTSTR caption, UINT type) |
| Creator function for the WindowsMessageBox_sink class. | |
| WindowsMessageBox_sink & | fmt_slices (WindowsMessageBox_sink &sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results) |
Writes an array of string slices into a WindowsMessageBox_sink sink. |
| ff_char_t const* fastformat::sinks::c_str_data | ( | shim_string_sink const & | sink | ) | [inline] |
Returns a possibly non-nul-terminated non-NULL C-style string representing the shim string.
| char const* fastformat::sinks::c_str_data_a | ( | shim_string_sink const & | sink | ) | [inline] |
Returns a possibly non-nul-terminated non-NULL C-style string representing the shim string.
| size_t fastformat::sinks::c_str_len | ( | shim_string_sink const & | sink | ) | [inline] |
Returns the number of characters in the length of the C-style string representing the shim string.
| size_t fastformat::sinks::c_str_len_a | ( | shim_string_sink const & | sink | ) | [inline] |
Returns the number of characters in the length of the C-style string representing the shim string.
| vectored_file_sink& fastformat::sinks::fmt_slices | ( | vectored_file_sink & | sink, | |
| int | flags, | |||
| size_t | , | |||
| size_t | numResults, | |||
| ff_string_slice_t const * | results | |||
| ) | [inline] |
Writes an array of string slices into an iovec
sink.
| stlsoft::FILE_stream_base<R, I>& fastformat::sinks::fmt_slices | ( | stlsoft::FILE_stream_base< R, I > & | sink, | |
| int | flags, | |||
| size_t | cchTotal, | |||
| size_t | numResults, | |||
| ff_string_slice_t const * | results | |||
| ) | [inline] |
Writes an array of string slices into a stlsoft::FILE_stream
sink.
| c_string_sink& fastformat::sinks::fmt_slices | ( | c_string_sink & | sink, | |
| int | flags, | |||
| size_t | cchTotal, | |||
| size_t | numResults, | |||
| ff_string_slice_t const * | results | |||
| ) | [inline] |
Formats into a c_string.
| S& fastformat::sinks::fmt_slices | ( | S & | sink, | |
| int | flags, | |||
| size_t | cchTotal, | |||
| size_t | numResults, | |||
| ff_string_slice_t const * | results | |||
| ) | [inline] |
Action shim for generic string types.
| ff_FILE_sink fastformat::sinks::to_sink | ( | FILE * | stm | ) | [inline] |
Conversion shim that allows a standard C stream - stdout
, stderr
- to be passed as a sink.
ff::write(ff::to_sink(stderr), "oops!");
|
|
|
| FastFormat Library documentation © Matthew Wilson, 2006-2012 |


For a second time, Charley Bay stepped up as review manager. Given how much work it was for the v1 review, I can only say thank you.
Andrzej Krzemienski went far beyond the call of duty in the development of Outcome v2. He wrote the front page, and the start of the tutorial. He thus set the tone, pacing, style and form of the tutorial which I merely continued for the rest of the tutorial. He also volunteered considerable amounts of his time as as primary peer reviewer for the v2 design and implementation, asking many very valuable “stupid questions” at least one of which caused a major rethink and refactor. If Outcome v2 passes its second peer review, it’s because of Andrzej. Thank you.
Jonathan Müller invested countless hours in his doxygen replacement tool Standardese which Outcome uses to generate the reference API docs, and a not insignificant number of those went on fixing issues for Outcome. Thank you.
To Paul Bristow who proposed the name “Outcome” for the library after a very extended period of name bikeshedding on boost-dev.  But Outcome is a lot nicer, so thank you Paul.
My heartfelt thanks to Charley Bay for acting as review manager for Outcome in May 2017.
It is becoming ever harder to find a Boost review manager, so thank you! My thanks also
to the CppCast team Rob Irving and Jason Turner for so quickly getting me on to CppCast
to discuss expected<T, E>
during the Outcome peer review to help publicise the review.
More general thanks are due to those on boost-dev, Reddit and SG14 for extensive and often very detailed feedback on the library pretty much from its beginning. You are all too numerous to remember, but certainly Tongari and Andrzej Krzemienski come to mind as having engaged in particularly long discussion threads with tons of useful feedback which clarified my thinking. Andrzej also went through the documentation with a fine toothed comb before the review, finding many small errata and confusing wording.
Finally, my thanks to Vicente for driving Expected from its beginnings to hopefully standardisation before 2020. It’s many years of work getting something standardised, even more years than getting a library into Boost which as you can see from the history above took about three years.


Saturn is the sixth planet from the Sun and the second-largest in the Solar System, after Jupiter. It is a gas giant with an average radius about nine times that of Earth. Although it has only one-eighth the average density of Earth, with its larger volume Saturn is just over 95 times more massive. Saturn is named after the Roman god of agriculture; its astronomical symbol (♄) represents the god's sickle.
Mean Distance from Sun(million km)
Period of Revolution
Period of Rotation at Equador
Eccentricity of Orbit
Equatorial diameter (km)
Mass
Density
Saturn
1,426.7
29.5 y
10 h 14 min
0.054
120,536
95.16
0.7
QUICK SATURN FACTS
Saturn is the least dense planet in the Solar System
The first astronomers thought the rings were moons.
Saturn has only been visited 4 times by spacecraft
Saturn has 62 moons
The length of a day on Saturn was a mystery until recently
Sometimes the rings disappear
There could be life near Saturn
DETAILED SATURN FACTS
Saturn can be seen with the naked eye.It is the fifth brightest object in the solar system and is also easily studied through binoculars or a small telescope.
Saturn is the flattest planet.Its polar diameter is 90% of its equatorial diameter, this is due to its low density and fast rotation. Saturn turns on its axis once every 10 hours and 34 minutes giving it the second-shortest day of any of the solar system’s planets.
Saturn’s upper atmosphere is divided into bands of clouds.The top layers are mostly ammonia ice. Below them, the clouds are largely water ice. Below are layers of cold hydrogen and sulfur ice mixtures.
Saturn is made mostly of hydrogen.It exists in layers that get denser farther into the planet. Eventually, deep inside, the hydrogen becomes metallic. At the core lies a hot interior.
Saturn has the most extensive rings in the solar system.The Saturnian rings are made mostly of chunks of ice and small amounts of carbonaceous dust. The rings stretch out more than 120,700 km from the planet, but are are amazingly thin: only about 20 meters thick.
Saturn has 150 moons and smaller moonlets.All are frozen worlds. The largest moons are Titan and Rhea. Enceladus appears to have an ocean below its frozen surface.
Four spacecraft have visited Saturn.Pioneer 11, Voyager 1 and 2, and the Cassini-Huygens mission have all studied the planet. Cassini continues to orbit Saturn, sending back a wealth of data about the planet, its moons, and rings.


THE PEACEMAKER RATING: 5.5 / 10 --> Not good enough to recommend
Review Date: May 18, 1998 Director: Mimi Leder Writer: Michael Schiffer Producers: Branko Lustig and Walter F. Parkes Actors: George Clooney as Thomas Devoe Nicole Kidman as Julia Kelly Genre: Thriller Year of Release: 1997
Mimi Leder's directorial debut was also the first theatrical release from the newly formed Hollywood studio Dreamworks SKG. S for Steven Spielberg, K Jeffrey Katzenberg, G for David Geffen.
PLOT: Russian bad guys steal some nuclear warheads from a train. Good Military Guy Devoe (Clooney), and Nuclear Expert Kelly (Kidman) are the two American wunderkinds appointed to find the warheads and save the world from a possible nuclear disaster.
CRITIQUE: Mostly unexciting, humdrum romp that doesn't really offer us any real action or suspense until the last half an hour. Set in various international destinations, this jargon-filled strategy session set amongst military folk, nuclear experts and politicians, is the movie equivalent of a long day at the dentist's office. Warning: There is a lot of talking in this film, and very little action. The special effects are limited to one great nuclear blast at the beginning of the picture, and many redundant explosions throughout the rest of the flick.
Clooney does okay in his wise-cracking, super-Special-Forces dude role, while Kidman literally runs through her part like she's in a hurry to get to London to film Stanley Kubrick's EYES WIDE SHUT with her husband, Tom Cruise.  And coincidentally enough, both stars always seem to be right. How exciting! Yawn.
The last forty minutes finally wakes us from the numbing sensation induced by the film's first hour and a half delivery (alas, Mrs. JoBlo couldn't make it all the way through), and does actually deliver some pretty neat suspense, good action, and a centered point of reference. Other than that, this film does not deliver in regards to its "thrills" moniker one bit, and will leave many a thriller fan invariably disappointed.  I did not.
Little Known Facts: George Clooney stands 5"10, was born in Kentucky, owns a pet pig, has taught actresses Kirsten Dunst to drive (on a golf cart) and Laurie Metcalf to drive a stick shift, is cousins with actor Miguel Ferrer, and nephew to singer/actress Rosemary Clooney. He also flailed through many TV sitcoms before settling into his dramatic shoes at ER ("Roseanne" and "The Facts of Life" are two of the shows in which he briefly participated). Nicole Kidman also stands 5"10, was born in Hawaii, but brought up in Australia, and has two adopted children with her husband of eight years, Tom Cruise. She is a high-school dropout. Mimi Leder directed many episodes of the popular NBC TV drama ER, starring the ever-popular George Clooney, before making her debut as a movie director with this film (I wonder how he got this gig?).
(c) 1998 Berge Garabedian
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


flex.myo.js emits a flex strength event allowing you to detect how active the user's arm is. It will used emit emits if this goes over certain thresholds to detect if the arm is 'flexed' or not.


Nanyang Technological University
2011-2015
Bachelor of Engineer in Computer SciencePython Java jQuery JavaScript
PHP MySQL HTML CSS BootStrap
Scrapy Tornado MonogoDB
English Chinese
Software Engineer
Using Python and Scrappy develop a Web Crawler to retrieve news, released products and new social events from website and social networks. Also this system able to filter out the noises and extract the relevant event and deliver personalised data to users.
Software Engineer
Design a web-based application interact with machine vision smart camera Using JavaScript, HTML5, Ajax and jQuery
Front-End Engineer
Responsible for web application design and development in Project ITAO(itao.sg)
Design site user interface
Create web site pages given client-provided content Using JavaScript, HTML, Joomla
Aug 2013 — Dec 2013
A robotic system that can receive control signals from mobile device(Android Based)and autonomously explore and traverse an unknown area, avoiding obstacles by follow the fastest path from START point to GOAL point. The system was implement usingArduino,Respberry Pi. The main programming language are python, Java
Jan 2013 — May 2013
cutting down the service time in rent and return. JAVA and JAVA SWING as main develop language.
Student Union Integrated Career Opportunities Network(ICON)
2012 - 2013Logistics Director
SNTU Student Union Welcome Week
2012 - 2013Logistics Director


Before Change
// Take the messy free-form fuel & fuel_unit fields, and do our best to
// map them to some canonical categories... this is necessarily imperfect:
fuel_ferc1_df.fuel = pudl.helpers.cleanstrings(fuel_ferc1_df.fuel,
pc.ferc1_fuel_strings,
unmapped="")
fuel_ferc1_df.fuel_unit = \
pudl.helpers.cleanstrings(fuel_ferc1_df.fuel_unit,
pc.ferc1_fuel_unit_strings,
After Change
// grab table from dictionary of dfs, clean it up a bit
fuel_ferc1_df = (
_clean_cols(ferc1_raw_dfs["fuel_ferc1"], "f1_fuel").
// Standardize plant_name capitalization and remove leading/trailing
// white space -- necesary b/c plant_name is part of many foreign keys.
pipe(strip_lower, ["plant_name"]).


{% extends "base.html" %} {% block content %}
Teach or be taught, learn something new, help educate the world!
You have something to teach, go ahead and create your own classes. Let students sign up and help to educate the world.
Want to learn something new, look for a class that interests you. Always good to be improving yourself.
Not finding a class that interests you, or you have a specific topic you are interested in. Suggest it here then.


Custom Ivy settings file to be used when parsing Ivy module descriptors. Specified as a relative path from the workspace root.
This only needs to be specified if you use custom conflict managers and latest strategies in your Ivy files that can't be parsed otherwise.
Example: "modules/build/ivy/ivysettings.xml"


Issue: PUSHNEW-STORE-REQUIREDReferences: PUSHNEW
Related issues: PUSH-EVALUATION-ORDER
Category: CLARIFICATION
Edit history: v1, 14 Feb 1991, Sandra Loosemore
v2, 26 Mar 1991, Sandra Loosemore (amendment from meeting)
Status: v2 (proposal UNSPECIFIED) accepted by X3J13, Mar 1991
Problem description:
The description of the PUSHNEW macro says contradictory things about
whether the storing form for its place subform must or must not be
evaluated in the situation where the <item> is already a member of
the list.
In CLtL, PUSHNEW is first described as:
If the <item> is not already a member of the list (...), then the
<item> is consed onto the front of the list, and the augmented list is
stored back into <place> and returned; otherwise the unaugmented list
is returned.
This passage implies that PUSHNEW is effectively (modulo order of
evaluation issues and keyword arguments):
(if (not (member <item> <place>))
(setf <place> (cons <item> <place>))
<place>)
which executes the storing form for <place> only if the member test
fails.
However, later on it's said that PUSHNEW is effectively (again modulo
order of evaluation issues and keyword arguments):
(setf <place> (adjoin <item> <place>))
which executes the storing form for <place> unconditionally.
So which of these two models for its expansion is correct?
Proposal (PUSHNEW-STORE-REQUIRED:UNSPECIFIED):
Clarify that it is not specified whether PUSHNEW executes the storing
form for its <place> subform in the situation where the <item> is
already a member of the list.
Rationale:
The store operation might be expensive and there's no point in doing
it if the value being stored hasn't changed. On the other hand, in
some implementations PUSHNEW always does the store.
Current Practice:
In both Lucid and Allegro, PUSHNEW always does the store.
Cost to Implementors:
None. No implementation is required to change.
Cost to Users:
Probably none.
Cost of non-adoption:
The description of PUSHNEW is confusing.
Performance impact:
Not doing the store when it's not necessary can speed things up.
Benefits:
The cost of non-adoption is avoided.
Esthetics:
PUSHNEW would be less confusing if we could just agree on one or
the other of the two models as being correct and remove all mention
of the other from its description in the standard.
Discussion:
There is a potential for generalization to other read-modify-write
macros. See the discussion section of issue SETF-GET-DEFAULT.


--- layout: archive title: Zulip Chat Archive permalink: /stream/113489-new-members/topic/instantiating.20meta.20variales.html ---
Is there a way to instantiate meta variables. Consider the theorem below:
theorem x: ∃ x, x=5 := begin existsi _, .. end
What should the ... be replaced with? In this theorem, we could just change the existsi _ but in more complex theorems, meta variables seem to appear in many other places and it would be nice to instantiate them.
what information would you provide in order for the metavariables to be instantiated?
replacing ..
with refl
would prove the theorem, but I don't know if that is what you want
refl is not what I want. In Coq, you can provide a value using instantiate (meta_var := value). Is there something similar in Lean?
Doesn't this meta variable appear as a new goal?
existsi 7
will instantiate the metavariable. If you use a hole _
then you get a new goal ⊢ ℕ
as Patrick says. You can make this the first goal with show ℕ
or swap
and then instantiate it with exact 7
.
I've seen those new goals as holes--that is how to fill in the holes. Can swap be used beyond the second goal or is there something similar to switch for example the first and third goal?
https://github.com/leanprover/mathlib/blob/master/tactic/interactive.lean#L159
as explained by Kevin
You can also use show
if you have only one goal of that type
Last updated: Apr 24 2020 at 19:02 UTC


Finished re-reading "American Splendor" in honor of Mr. Pekar. If you think comics are only superheroes and kids' stuff, read this book.
7/20/2010, 3:20:15 PM
Favs: 0
Retweets: 0
link--- layout: tweet ---
Finished re-reading "American Splendor" in honor of Mr. Pekar. If you think comics are only superheroes and kids' stuff, read this book.
7/20/2010, 3:20:15 PM
Favs: 0
Retweets: 0
link


|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.security.sasl.Sasl
public class Sasl
A static class for creating SASL clients and servers.
This class defines the policy of how to locate, load, and instantiate SASL clients and servers.
For example, an application or library gets a SASL client by doing something like:
It can then proceed to use the instance to create an authentication connection.SaslClient sc = Sasl.createSaslClient(mechanisms, authorizationId, protocol, serverName, props, callbackHandler);
Similarly, a server gets a SASL server by using code that looks as follows:
SaslServer ss = Sasl.createSaslServer(mechanism, protocol, serverName, props, callbackHandler);
| Field Summary | |
|---|---|
static String |
MAX_BUFFER
The name of a property that specifies the maximum size of the receive buffer in bytes of SaslClient/SaslServer. |
static String |
POLICY_FORWARD_SECRECY
The name of a property that specifies whether mechanisms that implement forward secrecy between sessions are required. |
static String |
POLICY_NOACTIVE
The name of a property that specifies whether mechanisms susceptible to active (non-dictionary) attacks are not permitted. |
static String |
POLICY_NOANONYMOUS
The name of a property that specifies whether mechanisms that accept anonymous login are not permitted. |
static String |
POLICY_NODICTIONARY
The name of a property that specifies whether mechanisms susceptible to passive dictionary attacks are not permitted. |
static String |
POLICY_NOPLAINTEXT
The name of a property that specifies whether mechanisms susceptible to simple plain passive attacks (e.g., "PLAIN") are not permitted. |
static String |
POLICY_PASS_CREDENTIALS
The name of a property that specifies whether mechanisms that pass client credentials are required. |
static String |
QOP
The name of a property that specifies the quality-of-protection to use. |
static String |
RAW_SEND_SIZE
The name of a property that specifies the maximum size of the raw send buffer in bytes of SaslClient/SaslServer. |
static String |
REUSE
The name of a property that specifies whether to reuse previously authenticated session information. |
static String |
SERVER_AUTH
The name of a property that specifies whether the server must authenticate to the client. |
static String |
STRENGTH
The name of a property that specifies the cipher strength to use. |
| Method Summary | |
|---|---|
static SaslClient |
createSaslClient(String[] mechanisms,
String authorizationId,
String protocol,
String serverName,
Map<String,?> props,
CallbackHandler cbh)
Creates a SaslClient using the parameters supplied. |
static SaslServer |
createSaslServer(String mechanism,
String protocol,
String serverName,
Map<String,?> props,
CallbackHandler cbh)
Creates a SaslServer for the specified mechanism. |
static Enumeration<SaslClientFactory> |
getSaslClientFactories()
Gets an enumeration of known factories for producing SaslClient. |
static Enumeration<SaslServerFactory> |
getSaslServerFactories()
Gets an enumeration of known factories for producing SaslServer. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String QOP
public static final String STRENGTH
public static final String SERVER_AUTH
public static final String MAX_BUFFER
public static final String RAW_SEND_SIZE
public static final String REUSE
public static final String POLICY_NOPLAINTEXT
public static final String POLICY_NOACTIVE
public static final String POLICY_NODICTIONARY
public static final String POLICY_NOANONYMOUS
public static final String POLICY_FORWARD_SECRECY
public static final String POLICY_PASS_CREDENTIALS
| Method Detail |
|---|
public static SaslClient createSaslClient(String[] mechanisms, String authorizationId, String protocol, String serverName, Map<String,?> props, CallbackHandler cbh) throws SaslException
A security provider for SaslClientFactory registers with the
JCA Security Provider Framework keys of the form
SaslClientFactory.mechanism_name
and values that are class names of implementations of
javax.security.sasl.SaslClientFactory.
For example, a provider that contains a factory class,
com.wiz.sasl.digest.ClientFactory, that supports the
"DIGEST-MD5" mechanism would register the following entry with the JCA:
SaslClientFactory.DIGEST-MD5 com.wiz.sasl.digest.ClientFactory
See the "Java Cryptography Architecture API Specification & Reference" for information about how to install and configure security service providers.
mechanisms
- The non-null list of mechanism names to try. Each is the
IANA-registered name of a SASL mechanism. (e.g. "GSSAPI", "CRAM-MD5").authorizationId
- The possibly null protocol-dependent
identification to be used for authorization.
If null or empty, the server derives an authorization
ID from the client's authentication credentials.
When the SASL authentication completes successfully,
the specified entity is granted access.protocol
- The non-null string name of the protocol for which
the authentication is being performed (e.g., "ldap").serverName
- The non-null fully-qualified host name of the server
to authenticate to.props
- The possibly null set of properties used to
select the SASL mechanism and to configure the authentication
exchange of the selected mechanism.
For example, if props contains the
Sasl.POLICY_NOPLAINTEXT
property with the value
"true", then the selected
SASL mechanism must not be susceptible to simple plain passive attacks.
In addition to the standard properties declared in this class,
other, possibly mechanism-specific, properties can be included.
Properties not relevant to the selected mechanism are ignored.cbh
- The possibly null callback handler to used by the SASL
mechanisms to get further information from the application/library
to complete the authentication. For example, a SASL mechanism might
require the authentication ID, password and realm from the caller.
The authentication ID is requested by using a NameCallback.
The password is requested by using a PasswordCallback.
The realm is requested by using a RealmChoiceCallback if there is a list
of realms to choose from, and by using a RealmCallback if
the realm must be entered.
SaslException
- If cannot create a SaslClient because
of an error.public static SaslServer createSaslServer(String mechanism, String protocol, String serverName, Map<String,?> props, CallbackHandler cbh) throws SaslException
A security provider for SaslServerFactory registers with the
JCA Security Provider Framework keys of the form
SaslServerFactory.mechanism_name
and values that are class names of implementations of
javax.security.sasl.SaslServerFactory.
For example, a provider that contains a factory class,
com.wiz.sasl.digest.ServerFactory, that supports the
"DIGEST-MD5" mechanism would register the following entry with the JCA:
SaslServerFactory.DIGEST-MD5 com.wiz.sasl.digest.ServerFactory
See the "Java Cryptography Architecture API Specification & Reference" for information about how to install and configure security service providers.
mechanism
- The non-null mechanism name. It must be an
IANA-registered name of a SASL mechanism. (e.g. "GSSAPI", "CRAM-MD5").protocol
- The non-null string name of the protocol for which
the authentication is being performed (e.g., "ldap").serverName
- The non-null fully qualified host name of the server.props
- The possibly null set of properties used to
select the SASL mechanism and to configure the authentication
exchange of the selected mechanism.
For example, if props contains the
Sasl.POLICY_NOPLAINTEXT
property with the value
"true", then the selected
SASL mechanism must not be susceptible to simple plain passive attacks.
In addition to the standard properties declared in this class,
other, possibly mechanism-specific, properties can be included.
Properties not relevant to the selected mechanism are ignored.cbh
- The possibly null callback handler to used by the SASL
mechanisms to get further information from the application/library
to complete the authentication. For example, a SASL mechanism might
require the authentication ID, password and realm from the caller.
The authentication ID is requested by using a NameCallback.
The password is requested by using a PasswordCallback.
The realm is requested by using a RealmChoiceCallback if there is a list
of realms to choose from, and by using a RealmCallback if
the realm must be entered.
SaslException
- If cannot create a SaslServer because
of an error.public static Enumeration<SaslClientFactory> getSaslClientFactories()
createSaslClient(java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.util.Map, javax.security.auth.callback.CallbackHandler)
public static Enumeration<SaslServerFactory> getSaslServerFactories()
createSaslServer(java.lang.String, java.lang.String, java.lang.String, java.util.Map, javax.security.auth.callback.CallbackHandler)
|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2004, 2010 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.


Come join the movement !
- Your privacy,your data,paid for by you..NOT the advertisers !
- No data mining. No Ads, No surveillance
- Freedom to make empowered and enduring connetions with friends and family
- A sane and suitainable business model for the long term
- To the savvy and discerning good value sells itself !!


--- title: "Vision Upload Format: SecurityAliases " sidebar: nav: "sb_InvestmentManagers" ---
Data Feed: SecurityAliases
Category: AliasFeed
| Field | Type | Description | |
|---|---|---|---|
| --- Required Fields --- | |||
| alias1 | String | any valid security identifier | |
| alias2 | String | alias to add to security | |
The following tab-delimited feed could be used to update security aliases.
The first field should contain the id of an existing security; you can
follow this with one or more ids to add as aliases for the security.
The header line should be included, but the header values are ignored:
Related Feeds:
Sample Upload:
Interface ExternalFeedManager upload: "SecurityAliases" using:
"oldId newId
16161010 16161A10
69792610 69846210
54567410 54570010
61844710 61844A10
" ;
{% include doc-footer.htm copydates="1999" %}


Login Page
User Name (8 characters min, alphabetical letters only):
Password (Must be 9 digits long):
Login
Register


Troy Aikman Calls Out Cowboys’ Coaching During Patriots Game
by Tzvi MachlinThe Dallas Cowboys only narrowly avoided disaster in the middle of the fourth quarter against the Patriots today. After giving up a field goal to make it 13-6 New England, the ensuing kickoff could have all but ended the game.
Return man Tony Pollard lined up out of position and the kickoff hit the ground and sailed behind him. Pollard was able to jump on the ball – well behind the 15-yard line.
FOX commentator Troy Aikman noticed Pollard in the wrong position from the get-go and was almost unsurprised when the play went south.
After it happened, Aikman called out the coaching staff for letting that happen.
“That’s poor coaching,” he said at the start of the drive.
The Cowboys ultimately fell a few yards short of a touchdown, and had to settle for a field goal that made the game 13-9.
Bear in mind, that assessment on Troy Aikman’s part isn’t necessarily the fault of Jason Garrett. It falls on special teams coordinator Keith O’Quinn. But Garrett is the team’s leader, and he’s faced plenty of criticism today (and this season).
Nevertheless, if the Cowboys ultimately get done in by a mistake of that magnitude and miss the playoffs because of this loss, someone is going to be the raked over the coals for it.
The Patriots are leading the Cowboys, 13-9, with a little more than two minutes to play. The game is on FOX.


Welcome to Chapter 5 of the "Implementing a language with LLVM" tutorial. Parts 1-4 described the implementation of the simple Kaleidoscope language and included support for generating LLVM IR, followed by optimizations and a JIT compiler. Unfortunately, as presented, Kaleidoscope is mostly useless: it has no control flow other than call and return. This means that you can't have conditional branches in the code, significantly limiting its power. In this episode of "build that compiler", we'll extend Kaleidoscope to have an if/then/else expression plus a simple 'for' loop.
Extending Kaleidoscope to support if/then/else is quite straightforward. It basically requires adding lexer support for this "new" concept to the lexer, parser, AST, and LLVM code emitter. This example is nice, because it shows how easy it is to "grow" a language over time, incrementally extending it as new ideas are discovered.
Before we get going on "how" we add this extension, lets talk about "what" we want. The basic idea is that we want to be able to write this sort of thing:
def fib(x) if x < 3 then 1 else fib(x-1) + fib(x-2)
In Kaleidoscope, every construct is an expression: there are no statements. As such, the if/then/else expression needs to return a value like any other. Since we're using a mostly functional form, we'll have it evaluate its conditional, then return the 'then' or 'else' value based on how the condition was resolved. This is very similar to the C "?:" expression.
The semantics of the if/then/else expression is that it evaluates the condition to a boolean equality value: 0.0 is considered to be false and everything else is considered to be true. If the condition is true, the first subexpression is evaluated and returned, if the condition is false, the second subexpression is evaluated and returned. Since Kaleidoscope allows side-effects, this behavior is important to nail down.
Now that we know what we "want", let's break this down into its constituent pieces.
The lexer extensions are straightforward. First we add new token classes for the relevant tokens:
class IfToken(object): pass class ThenToken(object): pass class ElseToken(object): pass
Once we have that, we recognize the new keywords in the lexer. This is pretty simple stuff:
... if identifier == 'def': yield DefToken() elif identifier == 'extern': yield ExternToken() elif identifier == 'if': yield IfToken() elif identifier == 'then': yield ThenToken() elif identifier == 'else': yield ElseToken() else: yield IdentifierToken(identifier)
To represent the new expression we add a new AST node for it:
# Expression class for if/then/else. class IfExpressionNode(ExpressionNode): def __init__(self, condition, then_branch, else_branch): self.condition = condition self.then_branch = then_branch self.else_branch = else_branch def CodeGen(self): ...
The AST node just has pointers to the various subexpressions.
Now that we have the relevant tokens coming from the lexer and we have the AST node to build, our parsing logic is relatively straightforward. First we define a new parsing function:
# ifexpr ::= 'if' expression 'then' expression 'else' expression def ParseIfExpr(self): self.Next() # eat the if. # condition. condition = self.ParseExpression() if not isinstance(self.current, ThenToken): raise RuntimeError('Expected "then".') self.Next() # eat the then. then_branch = self.ParseExpression() if not isinstance(self.current, ElseToken): raise RuntimeError('Expected "else".') self.Next() # eat the else. else_branch = self.ParseExpression() return IfExpressionNode(condition, then_branch, else_branch)
Next we hook it up as a primary expression:
def ParsePrimary(self): if isinstance(self.current, IdentifierToken): return self.ParseIdentifierExpr() elif isinstance(self.current, NumberToken): return self.ParseNumberExpr(); elif isinstance(self.current, IfToken): return self.ParseIfExpr() elif self.current == CharacterToken('('): return self.ParseParenExpr() else: raise RuntimeError('Unknown token when expecting an expression.')
Now that we have it parsing and building the AST, the final piece is adding LLVM code generation support. This is the most interesting part of the if/then/else example, because this is where it starts to introduce new concepts. All of the code above has been thoroughly described in previous chapters.
To motivate the code we want to produce, lets take a look at a simple example. Consider:
extern foo(); extern bar(); def baz(x) if x then foo() else bar();
If you disable optimizations, the code you'll (soon) get from Kaleidoscope looks something like this:
declare double @foo() declare double @bar() define double @baz(double %x) { entry: %ifcond = fcmp one double %x, 0.000000e+00 br i1 %ifcond, label %then, label %else then: ; preds = %entry %calltmp = call double @foo() br label %ifcont else: ; preds = %entry %calltmp1 = call double @bar() br label %ifcont ifcont: ; preds = %else, %then %iftmp = phi double [ %calltmp, %then ], [ %calltmp1, %else ] ret double %iftmp }
To visualize the control flow graph, you can use a nifty feature of the LLVM 'opt' tool. If you put this LLVM IR into "t.ll" and run "llvm-as < t.ll | opt -analyze -view-cfg", a window will pop up and you'll see this graph:
Another way to get this is to call "function.viewCFG()" or "function.viewCFGOnly()" (where F is a "llvm.core.Function") either by inserting actual calls into the code and recompiling or by calling these in the debugger. LLVM has many nice features for visualizing various graphs, but note that these are available only if your LLVM was built with Graphviz support (accomplished by having Graphviz and Ghostview installed when building LLVM).
Getting back to the generated code, it is fairly simple: the entry block evaluates the conditional expression ("x" in our case here) and compares the result to 0.0 with the "fcmp one" instruction ('one' is "Ordered and Not Equal"). Based on the result of this expression, the code jumps to either the "then" or "else" blocks, which contain the expressions for the true/false cases.
Once the then/else blocks are finished executing, they both branch back to the 'ifcont' block to execute the code that happens after the if/then/else. In this case the only thing left to do is to return to the caller of the function. The question then becomes: how does the code know which expression to return?
The answer to this question involves an important SSA operation: the Phi operation. If you're not familiar with SSA, the wikipedia article is a good introduction and there are various other introductions to it available on your favorite search engine. The short version is that "execution" of the Phi operation requires "remembering" which block control came from. The Phi operation takes on the value corresponding to the input control block. In this case, if control comes in from the "then" block, it gets the value of "calltmp". If control comes from the "else" block, it gets the value of "calltmp1".
At this point, you are probably starting to think "Oh no! This means my simple and elegant front-end will have to start generating SSA form in order to use LLVM!". Fortunately, this is not the case, and we strongly advise not implementing an SSA construction algorithm in your front-end unless there is an amazingly good reason to do so. In practice, there are two sorts of values that float around in code written for your average imperative programming language that might need Phi nodes:
In Chapter 7 of this tutorial ("mutable variables"), we'll talk about #1 in depth. For now, just believe me that you don't need SSA construction to handle this case. For #2, you have the choice of using the techniques that we will describe for #1, or you can insert Phi nodes directly, if convenient. In this case, it is really really easy to generate the Phi node, so we choose to do it directly.
Okay, enough of the motivation and overview, lets generate code!
In order to generate code for this, we implement the Codegen method for IfExpressionNode:
def CodeGen(self): condition = self.condition.CodeGen() # Convert condition to a bool by comparing equal to 0.0. condition_bool = g_llvm_builder.fcmp( FCMP_ONE, condition, Constant.real(Type.double(), 0), 'ifcond')
This code is straightforward and similar to what we saw before. We emit the expression for the condition, then compare that value to zero to get a truth value as a 1-bit (bool) value.
function = g_llvm_builder.basic_block.function # Create blocks for the then and else cases. Insert the 'then' block at the # end of the function. then_block = function.append_basic_block('then') else_block = function.append_basic_block('else') merge_block = function.append_basic_block('ifcond') g_llvm_builder.cbranch(condition_bool, then_block, else_block)
This code creates the basic blocks that are related to the if/then/else statement, and correspond directly to the blocks in the example above. The first line gets the current Function object that is being built. It gets this by asking the builder for the current BasicBlock, and asking that block for its "parent" (the function it is currently embedded into).
Once it has that, it creates three block which are automatically inserted into the end of the function. Once the blocks are created, we can emit the conditional branch that chooses between them. Note that creating new blocks does not implicitly affect the Builder, so it is still inserting into the block that the condition went into.
# Emit then value. g_llvm_builder.position_at_end(then_block) then_value = self.then_branch.CodeGen() g_llvm_builder.branch(merge_block) # Codegen of 'Then' can change the current block; update then_block for the # PHI node. then_block = g_llvm_builder.basic_block
After the conditional branch is inserted, we move the builder to start inserting into the "then" block. Strictly speaking, this call moves the insertion point to be at the end of the specified block. However, since the "then" block is empty, it also starts out by inserting at the beginning of the block. :)
Once the insertion point is set, we recursively codegen the "then" expression from the AST. To finish off the "then" block, we create an unconditional branch to the merge block. One interesting (and very important) aspect of the LLVM IR is that it requires all basic blocks to be "terminated" with a control flow instruction such as return or branch. This means that all control flow, including fallthroughs must be made explicit in the LLVM IR. If you violate this rule, the verifier will emit an error.
The final line here is quite subtle, but is very important. The basic issue is that when we create the Phi node in the merge block, we need to set up the block/value pairs that indicate how the Phi will work. Importantly, the Phi node expects to have an entry for each predecessor of the block in the CFG. Why then, are we getting the current block when we just set it to then_block 5 lines above? The problem is that the "Then" expression may actually itself change the block that the Builder is emitting into if, for example, it contains a nested "if/then/else" expression. Because calling Codegen recursively could arbitrarily change the notion of the current block, we are required to get an up-to-date value for code that will set up the Phi node.
# Emit else block. g_llvm_builder.position_at_end(else_block) else_value = self.else_branch.CodeGen() g_llvm_builder.branch(merge_block) # Codegen of 'Else' can change the current block, update else_block for the # PHI node. else_block = g_llvm_builder.basic_block
Code generation for the 'else' block is basically identical to codegen for the 'then' block. The only significant difference is the first line, which adds the 'else' block to the function. Recall previously that the 'else' block was created, but not added to the function. Now that the 'then' and 'else' blocks are emitted, we can finish up with the merge code:
# Emit merge block. g_llvm_builder.position_at_end(merge_block) phi = g_llvm_builder.phi(Type.double(), 'iftmp') phi.add_incoming(then_value, then_block) phi.add_incoming(else_value, else_block) return phi
The first line changes the insertion point so that newly created code will go into the "merge" block. Once that is done, we need to create the PHI node and set up the block/value pairs for the PHI.
Finally, the CodeGen function returns the phi node as the value computed by the if/then/else expression. In our example above, this returned value will feed into the code for the top-level function, which will create the return instruction.
Overall, we now have the ability to execute conditional code in Kaleidoscope. With this extension, Kaleidoscope is a fairly complete language that can calculate a wide variety of numeric functions. Next up we'll add another useful expression that is familiar from non-functional languages...
Now that we know how to add basic control flow constructs to the language, we have the tools to add more powerful things. Lets add something more aggressive, a 'for' expression:
extern putchard(char) def printstar(n) for i = 1, i < n, 1.0 in putchard(42) # ascii 42 = '*' # print 100 '*' characters printstar(100)
This expression defines a new variable ("i" in this case) which iterates from a starting value, while the condition ("i < n" in this case) is true, incrementing by an optional step value ("1.0" in this case). If the step value is omitted, it defaults to 1.0. While the loop is true, it executes its body expression. Because we don't have anything better to return, we'll just define the loop as always returning 0.0. In the future when we have mutable variables, it will get more useful.
As before, lets talk about the changes that we need to Kaleidoscope to support this.
The lexer extensions are the same sort of thing as for if/then/else:
... class ThenToken(object): pass class ElseToken(object): pass class ForToken(object): pass class InToken(object): pass ... def Tokenize(string): ... elif identifier == 'else': yield ElseToken() elif identifier == 'for': yield ForToken() elif identifier == 'in': yield InToken() else: yield IdentifierToken(identifier)
The AST node is just as simple. It basically boils down to capturing the variable name and the constituent expressions in the node.
# Expression class for for/in. class ForExpressionNode(ExpressionNode): def __init__(self, loop_variable, start, end, step, body): self.loop_variable = loop_variable self.start = start self.end = end self.step = step self.body = body def CodeGen(self): ...
The parser code is also fairly standard. The only interesting thing here is handling of the optional step value. The parser code handles it by checking to see if the second comma is present. If not, it sets the step value to null in the AST node:
# forexpr ::= 'for' identifier '=' expr ',' expr (',' expr)? 'in' expression def ParseForExpr(self): self.Next() # eat the for. if not isinstance(self.current, IdentifierToken): raise RuntimeError('Expected identifier after for.') loop_variable = self.current.name self.Next() # eat the identifier. if self.current != CharacterToken('='): raise RuntimeError('Expected "=" after for variable.') self.Next() # eat the '='. start = self.ParseExpression() if self.current != CharacterToken(','): raise RuntimeError('Expected "," after for start value.') self.Next() # eat the ','. end = self.ParseExpression() # The step value is optional. if self.current == CharacterToken(','): self.Next() # eat the ','. step = self.ParseExpression() else: step = None if not isinstance(self.current, InToken): raise RuntimeError('Expected "in" after for variable specification.') self.Next() # eat 'in'. body = self.ParseExpression() return ForExpressionNode(loop_variable, start, end, step, body)
Now we get to the good part: the LLVM IR we want to generate for this thing. With the simple example above, we get this LLVM IR (note that this dump is generated with optimizations disabled for clarity):
declare double @putchard(double) define double @printstar(double %n) { entry: ; initial value = 1.0 (inlined into phi) br label %loop loop: ; preds = %loop, %entry %i = phi double [ 1.000000e+00, %entry ], [ %nextvar, %loop ] ; body %calltmp = call double @putchard(double 4.200000e+01) ; increment %nextvar = fadd double %i, 1.000000e+00 ; termination test %cmptmp = fcmp ult double %i, %n %booltmp = uitofp i1 %cmptmp to double %loopcond = fcmp one double %booltmp, 0.000000e+00 br i1 %loopcond, label %loop, label %afterloop afterloop: ; preds = %loop ; loop always returns 0.0 ret double 0.000000e+00 }
This loop contains all the same constructs we saw before: a phi node, several expressions, and some basic blocks. Lets see how this fits together.
The first part of Codegen is very simple: we just output the start expression for the loop value:
def CodeGen(self): # Emit the start code first, without 'variable' in scope. start_value = self.start.CodeGen()
With this out of the way, the next step is to set up the LLVM basic block for the start of the loop body. In the case above, the whole loop body is one block, but remember that the body code itself could consist of multiple blocks (e.g. if it contains an if/then/else or a for/in expression).
# Make the new basic block for the loop header, inserting after current # block. function = g_llvm_builder.basic_block.function pre_header_block = g_llvm_builder.basic_block loop_block = function.append_basic_block('loop') # Insert an explicit fallthrough from the current block to the loop_block. g_llvm_builder.branch(loop_block)
This code is similar to what we saw for if/then/else. Because we will need it to create the Phi node, we remember the block that falls through into the loop. Once we have that, we create the actual block that starts the loop and create an unconditional branch for the fall-through between the two blocks.
# Start insertion in loop_block. g_llvm_builder.position_at_end(loop_block); # Start the PHI node with an entry for start. variable_phi = g_llvm_builder.phi(Type.double(), self.loop_variable) variable_phi.add_incoming(start_value, pre_header_block)
Now that the "pre_header_block" for the loop is set up, we switch to emitting code for the loop body. To begin with, we move the insertion point and create the PHI node for the loop induction variable. Since we already know the incoming value for the starting value, we add it to the Phi node. Note that the Phi will eventually get a second value for the backedge, but we can't set it up yet (because it doesn't exist!).
# Within the loop, the variable is defined equal to the PHI node. If it # shadows an existing variable, we have to restore it, so save it now. old_value = g_named_values.get(self.loop_variable, None) g_named_values[self.loop_variable] = variable_phi # Emit the body of the loop. This, like any other expr, can change the # current BB. Note that we ignore the value computed by the body. self.body.CodeGen()
Now the code starts to get more interesting. Our 'for' loop introduces a new variable to the symbol table. This means that our symbol table can now contain either function arguments or loop variables. To handle this, before we codegen the body of the loop, we add the loop variable as the current value for its name. Note that it is possible that there is a variable of the same name in the outer scope. It would be easy to make this an error (emit an error and return null if there is already an entry for VarName) but we choose to allow shadowing of variables. In order to handle this correctly, we remember the Value that we are potentially shadowing in old_value (which will be None if there is no shadowed variable).
Once the loop variable is set into the symbol table, the code recursively codegen's the body. This allows the body to use the loop variable: any references to it will naturally find it in the symbol table.
# Emit the step value. if self.step: step_value = self.step.CodeGen() else: # If not specified, use 1.0. step_value = Constant.real(Type.double(), 1) next_value = g_llvm_builder.fadd(variable_phi, step_value, 'next')
Now that the body is emitted, we compute the next value of the iteration variable by adding the step value, or 1.0 if it isn't present. next_value will be the value of the loop variable on the next iteration of the loop.
# Compute the end condition and convert it to a bool by comparing to 0.0. end_condition = self.end.CodeGen() end_condition_bool = g_llvm_builder.fcmp( FCMP_ONE, end_condition, Constant.real(Type.double(), 0), 'loopcond')
Finally, we evaluate the exit value of the loop, to determine whether the loop should exit. This mirrors the condition evaluation for the if/then/else statement.
# Create the "after loop" block and insert it. loop_end_block = g_llvm_builder.basic_block after_block = function.append_basic_block('afterloop') # Insert the conditional branch into the end of loop_end_block. g_llvm_builder.cbranch(end_condition_bool, loop_block, after_block) # Any new code will be inserted in after_block. g_llvm_builder.position_at_end(after_block)
With the code for the body of the loop complete, we just need to finish up the control flow for it. This code remembers the end block (for the phi node), then creates the block for the loop exit ("afterloop"). Based on the value of the exit condition, it creates a conditional branch that chooses between executing the loop again and exiting the loop. Any future code is emitted in the "afterloop" block, so it sets the insertion position to it.
# Add a new entry to the PHI node for the backedge. variable_phi.add_incoming(next_value, loop_end_block) # Restore the unshadowed variable. if old_value: g_named_values[self.loop_variable] = old_value else: del g_named_values[self.loop_variable] # for expr always returns 0.0. return Constant.real(Type.double(), 0)
The final code handles various cleanups: now that we have the "next_value", we can add the incoming value to the loop PHI node. After that, we remove the loop variable from the symbol table, so that it isn't in scope after the for loop. Finally, code generation of the for loop always returns 0.0, so that is what we return from ForExpressionNode::CodeGen.
With this, we conclude the "adding control flow to Kaleidoscope" chapter of the tutorial. In this chapter we added two control flow constructs, and used them to motivate a couple of aspects of the LLVM IR that are important for front-end implementors to know. In the next chapter of our saga, we will get a bit crazier and add user-defined operators to our poor innocent language.
Here is the complete code listing for our running example, enhanced with the if/then/else and for expressions:
#!/usr/bin/env python import re from llvm.core import Module, Constant, Type, Function, Builder from llvm.ee import ExecutionEngine, TargetData from llvm.passes import FunctionPassManager from llvm.core import FCMP_ULT, FCMP_ONE from llvm.passes import (PASS_INSTCOMBINE, PASS_REASSOCIATE, PASS_GVN, PASS_SIMPLIFYCFG) ################################################################################ ## Globals ################################################################################ # The LLVM module, which holds all the IR code. g_llvm_module = Module.new('my cool jit') # The LLVM instruction builder. Created whenever a new function is entered. g_llvm_builder = None # A dictionary that keeps track of which values are defined in the current scope # and what their LLVM representation is. g_named_values = {} # The function optimization passes manager. g_llvm_pass_manager = FunctionPassManager.new(g_llvm_module) # The LLVM execution engine. g_llvm_executor = ExecutionEngine.new(g_llvm_module) ################################################################################ ## Lexer ################################################################################ # The lexer yields one of these types for each token. class EOFToken(object): pass class DefToken(object): pass class ExternToken(object): pass class IfToken(object): pass class ThenToken(object): pass class ElseToken(object): pass class ForToken(object): pass class InToken(object): pass class IdentifierToken(object): def __init__(self, name): self.name = name class NumberToken(object): def __init__(self, value): self.value = value class CharacterToken(object): def __init__(self, char): self.char = char def __eq__(self, other): return isinstance(other, CharacterToken) and self.char == other.char def __ne__(self, other): return not self == other # Regular expressions that tokens and comments of our language. REGEX_NUMBER = re.compile('[0-9]+(?:\.[0-9]+)?') REGEX_IDENTIFIER = re.compile('[a-zA-Z][a-zA-Z0-9]*') REGEX_COMMENT = re.compile('#.*') def Tokenize(string): while string: # Skip whitespace. if string[0].isspace(): string = string[1:] continue # Run regexes. comment_match = REGEX_COMMENT.match(string) number_match = REGEX_NUMBER.match(string) identifier_match = REGEX_IDENTIFIER.match(string) # Check if any of the regexes matched and yield the appropriate result. if comment_match: comment = comment_match.group(0) string = string[len(comment):] elif number_match: number = number_match.group(0) yield NumberToken(float(number)) string = string[len(number):] elif identifier_match: identifier = identifier_match.group(0) # Check if we matched a keyword. if identifier == 'def': yield DefToken() elif identifier == 'extern': yield ExternToken() elif identifier == 'if': yield IfToken() elif identifier == 'then': yield ThenToken() elif identifier == 'else': yield ElseToken() elif identifier == 'for': yield ForToken() elif identifier == 'in': yield InToken() else: yield IdentifierToken(identifier) string = string[len(identifier):] else: # Yield the ASCII value of the unknown character. yield CharacterToken(string[0]) string = string[1:] yield EOFToken() ################################################################################ ## Abstract Syntax Tree (aka Parse Tree) ################################################################################ # Base class for all expression nodes. class ExpressionNode(object): pass # Expression class for numeric literals like "1.0". class NumberExpressionNode(ExpressionNode): def __init__(self, value): self.value = value def CodeGen(self): return Constant.real(Type.double(), self.value) # Expression class for referencing a variable, like "a". class VariableExpressionNode(ExpressionNode): def __init__(self, name): self.name = name def CodeGen(self): if self.name in g_named_values: return g_named_values[self.name] else: raise RuntimeError('Unknown variable name: ' + self.name) # Expression class for a binary operator. class BinaryOperatorExpressionNode(ExpressionNode): def __init__(self, operator, left, right): self.operator = operator self.left = left self.right = right def CodeGen(self): left = self.left.CodeGen() right = self.right.CodeGen() if self.operator == '+': return g_llvm_builder.fadd(left, right, 'addtmp') elif self.operator == '-': return g_llvm_builder.fsub(left, right, 'subtmp') elif self.operator == '*': return g_llvm_builder.fmul(left, right, 'multmp') elif self.operator == '<': result = g_llvm_builder.fcmp(FCMP_ULT, left, right, 'cmptmp') # Convert bool 0 or 1 to double 0.0 or 1.0. return g_llvm_builder.uitofp(result, Type.double(), 'booltmp') else: raise RuntimeError('Unknown binary operator.') # Expression class for function calls. class CallExpressionNode(ExpressionNode): def __init__(self, callee, args): self.callee = callee self.args = args def CodeGen(self): # Look up the name in the global module table. callee = g_llvm_module.get_function_named(self.callee) # Check for argument mismatch error. if len(callee.args) != len(self.args): raise RuntimeError('Incorrect number of arguments passed.') arg_values = [i.CodeGen() for i in self.args] return g_llvm_builder.call(callee, arg_values, 'calltmp') # Expression class for if/then/else. class IfExpressionNode(ExpressionNode): def __init__(self, condition, then_branch, else_branch): self.condition = condition self.then_branch = then_branch self.else_branch = else_branch def CodeGen(self): condition = self.condition.CodeGen() # Convert condition to a bool by comparing equal to 0.0. condition_bool = g_llvm_builder.fcmp( FCMP_ONE, condition, Constant.real(Type.double(), 0), 'ifcond') function = g_llvm_builder.basic_block.function # Create blocks for the then and else cases. Insert the 'then' block at the # end of the function. then_block = function.append_basic_block('then') else_block = function.append_basic_block('else') merge_block = function.append_basic_block('ifcond') g_llvm_builder.cbranch(condition_bool, then_block, else_block) # Emit then value. g_llvm_builder.position_at_end(then_block) then_value = self.then_branch.CodeGen() g_llvm_builder.branch(merge_block) # Codegen of 'Then' can change the current block; update then_block for the # PHI node. then_block = g_llvm_builder.basic_block # Emit else block. g_llvm_builder.position_at_end(else_block) else_value = self.else_branch.CodeGen() g_llvm_builder.branch(merge_block) # Codegen of 'Else' can change the current block, update else_block for the # PHI node. else_block = g_llvm_builder.basic_block # Emit merge block. g_llvm_builder.position_at_end(merge_block) phi = g_llvm_builder.phi(Type.double(), 'iftmp') phi.add_incoming(then_value, then_block) phi.add_incoming(else_value, else_block) return phi # Expression class for for/in. class ForExpressionNode(ExpressionNode): def __init__(self, loop_variable, start, end, step, body): self.loop_variable = loop_variable self.start = start self.end = end self.step = step self.body = body def CodeGen(self): # Output this as: # ... # start = startexpr # goto loop # loop: # variable = phi [start, loopheader], [nextvariable, loopend] # ... # bodyexpr # ... # loopend: # step = stepexpr # nextvariable = variable + step # endcond = endexpr # br endcond, loop, endloop # outloop: # Emit the start code first, without 'variable' in scope. start_value = self.start.CodeGen() # Make the new basic block for the loop header, inserting after current # block. function = g_llvm_builder.basic_block.function pre_header_block = g_llvm_builder.basic_block loop_block = function.append_basic_block('loop') # Insert an explicit fallthrough from the current block to the loop_block. g_llvm_builder.branch(loop_block) # Start insertion in loop_block. g_llvm_builder.position_at_end(loop_block) # Start the PHI node with an entry for start. variable_phi = g_llvm_builder.phi(Type.double(), self.loop_variable) variable_phi.add_incoming(start_value, pre_header_block) # Within the loop, the variable is defined equal to the PHI node. If it # shadows an existing variable, we have to restore it, so save it now. old_value = g_named_values.get(self.loop_variable, None) g_named_values[self.loop_variable] = variable_phi # Emit the body of the loop. This, like any other expr, can change the # current BB. Note that we ignore the value computed by the body. self.body.CodeGen() # Emit the step value. if self.step: step_value = self.step.CodeGen() else: # If not specified, use 1.0. step_value = Constant.real(Type.double(), 1) next_value = g_llvm_builder.fadd(variable_phi, step_value, 'next') # Compute the end condition and convert it to a bool by comparing to 0.0. end_condition = self.end.CodeGen() end_condition_bool = g_llvm_builder.fcmp( FCMP_ONE, end_condition, Constant.real(Type.double(), 0), 'loopcond') # Create the "after loop" block and insert it. loop_end_block = g_llvm_builder.basic_block after_block = function.append_basic_block('afterloop') # Insert the conditional branch into the end of loop_end_block. g_llvm_builder.cbranch(end_condition_bool, loop_block, after_block) # Any new code will be inserted in after_block. g_llvm_builder.position_at_end(after_block) # Add a new entry to the PHI node for the backedge. variable_phi.add_incoming(next_value, loop_end_block) # Restore the unshadowed variable. if old_value: g_named_values[self.loop_variable] = old_value else: del g_named_values[self.loop_variable] # for expr always returns 0.0. return Constant.real(Type.double(), 0) # This class represents the "prototype" for a function, which captures its name, # and its argument names (thus implicitly the number of arguments the function # takes). class PrototypeNode(object): def __init__(self, name, args): self.name = name self.args = args def CodeGen(self): # Make the function type, eg. double(double,double). funct_type = Type.function( Type.double(), [Type.double()] * len(self.args), False) function = Function.new(g_llvm_module, funct_type, self.name) # If the name conflicted, there was already something with the same name. # If it has a body, don't allow redefinition or reextern. if function.name != self.name: function.delete() function = g_llvm_module.get_function_named(self.name) # If the function already has a body, reject this. if not function.is_declaration: raise RuntimeError('Redefinition of function.') # If the function took a different number of args, reject. if len(function.args) != len(self.args): raise RuntimeError('Redeclaration of a function with different number ' 'of args.') # Set names for all arguments and add them to the variables symbol table. for arg, arg_name in zip(function.args, self.args): arg.name = arg_name # Add arguments to variable symbol table. g_named_values[arg_name] = arg return function # This class represents a function definition itself. class FunctionNode(object): def __init__(self, prototype, body): self.prototype = prototype self.body = body def CodeGen(self): # Clear scope. g_named_values.clear() # Create a function object. function = self.prototype.CodeGen() # Create a new basic block to start insertion into. block = function.append_basic_block('entry') global g_llvm_builder g_llvm_builder = Builder.new(block) # Finish off the function. try: return_value = self.body.CodeGen() g_llvm_builder.ret(return_value) # Validate the generated code, checking for consistency. function.verify() # Optimize the function. g_llvm_pass_manager.run(function) except: function.delete() raise return function ################################################################################ ## Parser ################################################################################ class Parser(object): def __init__(self, tokens, binop_precedence): self.tokens = tokens self.binop_precedence = binop_precedence self.Next() # Provide a simple token buffer. Parser.current is the current token the # parser is looking at. Parser.Next() reads another token from the lexer and # updates Parser.current with its results. def Next(self): self.current = self.tokens.next() # Gets the precedence of the current token, or -1 if the token is not a binary # operator. def GetCurrentTokenPrecedence(self): if isinstance(self.current, CharacterToken): return self.binop_precedence.get(self.current.char, -1) else: return -1 # identifierexpr ::= identifier | identifier '(' expression* ')' def ParseIdentifierExpr(self): identifier_name = self.current.name self.Next() # eat identifier. if self.current != CharacterToken('('): # Simple variable reference. return VariableExpressionNode(identifier_name) # Call. self.Next() # eat '('. args = [] if self.current != CharacterToken(')'): while True: args.append(self.ParseExpression()) if self.current == CharacterToken(')'): break elif self.current != CharacterToken(','): raise RuntimeError('Expected ")" or "," in argument list.') self.Next() self.Next() # eat ')'. return CallExpressionNode(identifier_name, args) # numberexpr ::= number def ParseNumberExpr(self): result = NumberExpressionNode(self.current.value) self.Next() # consume the number. return result # parenexpr ::= '(' expression ')' def ParseParenExpr(self): self.Next() # eat '('. contents = self.ParseExpression() if self.current != CharacterToken(')'): raise RuntimeError('Expected ")".') self.Next() # eat ')'. return contents # ifexpr ::= 'if' expression 'then' expression 'else' expression def ParseIfExpr(self): self.Next() # eat the if. # condition. condition = self.ParseExpression() if not isinstance(self.current, ThenToken): raise RuntimeError('Expected "then".') self.Next() # eat the then. then_branch = self.ParseExpression() if not isinstance(self.current, ElseToken): raise RuntimeError('Expected "else".') self.Next() # eat the else. else_branch = self.ParseExpression() return IfExpressionNode(condition, then_branch, else_branch) # forexpr ::= 'for' identifier '=' expr ',' expr (',' expr)? 'in' expression def ParseForExpr(self): self.Next() # eat the for. if not isinstance(self.current, IdentifierToken): raise RuntimeError('Expected identifier after for.') loop_variable = self.current.name self.Next() # eat the identifier. if self.current != CharacterToken('='): raise RuntimeError('Expected "=" after for variable.') self.Next() # eat the '='. start = self.ParseExpression() if self.current != CharacterToken(','): raise RuntimeError('Expected "," after for start value.') self.Next() # eat the ','. end = self.ParseExpression() # The step value is optional. if self.current == CharacterToken(','): self.Next() # eat the ','. step = self.ParseExpression() else: step = None if not isinstance(self.current, InToken): raise RuntimeError('Expected "in" after for variable specification.') self.Next() # eat 'in'. body = self.ParseExpression() return ForExpressionNode(loop_variable, start, end, step, body) # primary ::= identifierexpr | numberexpr | parenexpr | ifexpr | forexpr def ParsePrimary(self): if isinstance(self.current, IdentifierToken): return self.ParseIdentifierExpr() elif isinstance(self.current, NumberToken): return self.ParseNumberExpr() elif isinstance(self.current, IfToken): return self.ParseIfExpr() elif isinstance(self.current, ForToken): return self.ParseForExpr() elif self.current == CharacterToken('('): return self.ParseParenExpr() else: raise RuntimeError('Unknown token when expecting an expression.') # binoprhs ::= (operator primary)* def ParseBinOpRHS(self, left, left_precedence): # If this is a binary operator, find its precedence. while True: precedence = self.GetCurrentTokenPrecedence() # If this is a binary operator that binds at least as tightly as the # current one, consume it; otherwise we are done. if precedence < left_precedence: return left binary_operator = self.current.char self.Next() # eat the operator. # Parse the primary expression after the binary operator. right = self.ParsePrimary() # If binary_operator binds less tightly with right than the operator after # right, let the pending operator take right as its left. next_precedence = self.GetCurrentTokenPrecedence() if precedence < next_precedence: right = self.ParseBinOpRHS(right, precedence + 1) # Merge left/right. left = BinaryOperatorExpressionNode(binary_operator, left, right) # expression ::= primary binoprhs def ParseExpression(self): left = self.ParsePrimary() return self.ParseBinOpRHS(left, 0) # prototype ::= id '(' id* ')' def ParsePrototype(self): if not isinstance(self.current, IdentifierToken): raise RuntimeError('Expected function name in prototype.') function_name = self.current.name self.Next() # eat function name. if self.current != CharacterToken('('): raise RuntimeError('Expected "(" in prototype.') self.Next() # eat '('. arg_names = [] while isinstance(self.current, IdentifierToken): arg_names.append(self.current.name) self.Next() if self.current != CharacterToken(')'): raise RuntimeError('Expected ")" in prototype.') # Success. self.Next() # eat ')'. return PrototypeNode(function_name, arg_names) # definition ::= 'def' prototype expression def ParseDefinition(self): self.Next() # eat def. proto = self.ParsePrototype() body = self.ParseExpression() return FunctionNode(proto, body) # toplevelexpr ::= expression def ParseTopLevelExpr(self): proto = PrototypeNode('', []) return FunctionNode(proto, self.ParseExpression()) # external ::= 'extern' prototype def ParseExtern(self): self.Next() # eat extern. return self.ParsePrototype() # Top-Level parsing def HandleDefinition(self): self.Handle(self.ParseDefinition, 'Read a function definition:') def HandleExtern(self): self.Handle(self.ParseExtern, 'Read an extern:') def HandleTopLevelExpression(self): try: function = self.ParseTopLevelExpr().CodeGen() result = g_llvm_executor.run_function(function, []) print 'Evaluated to:', result.as_real(Type.double()) except Exception, e: print 'Error:', e try: self.Next() # Skip for error recovery. except: pass def Handle(self, function, message): try: print message, function().CodeGen() except Exception, e: print 'Error:', e try: self.Next() # Skip for error recovery. except: pass ################################################################################ ## Main driver code. ################################################################################ def main(): # Set up the optimizer pipeline. Start with registering info about how the # target lays out data structures. g_llvm_pass_manager.add(g_llvm_executor.target_data) # Do simple "peephole" optimizations and bit-twiddling optzns. g_llvm_pass_manager.add(PASS_INSTCOMBINE) # Reassociate expressions. g_llvm_pass_manager.add(PASS_REASSOCIATE) # Eliminate Common SubExpressions. g_llvm_pass_manager.add(PASS_GVN) # Simplify the control flow graph (deleting unreachable blocks, etc). g_llvm_pass_manager.add(PASS_SIMPLIFYCFG) g_llvm_pass_manager.initialize() # Install standard binary operators. # 1 is lowest possible precedence. 40 is the highest. operator_precedence = { '<': 10, '+': 20, '-': 20, '*': 40 } # Run the main "interpreter loop". while True: print 'ready>', try: raw = raw_input() except KeyboardInterrupt: break parser = Parser(Tokenize(raw), operator_precedence) while True: # top ::= definition | external | expression | EOF if isinstance(parser.current, EOFToken): break if isinstance(parser.current, DefToken): parser.HandleDefinition() elif isinstance(parser.current, ExternToken): parser.HandleExtern() else: parser.HandleTopLevelExpression() # Print out all of the generated code. print '\n', g_llvm_module if __name__ == '__main__': main()


We Want to Know: What Would You Buy?
Clicks Left:
25
Hooray! You're Finished!
We appreciate your help! You can see the results here:
A chart normally displays here, but something went wrong :/


“Another blessed ‘passing-over’ I viewed was that of a little girl on earth crippled by an accident in which she was run over by a heavy dray, and which necessitated the amputation of her leg. Her mother had ‘died’ shortly before this accident, and she was left in the charge of people who had no kindliness, were hard and callous, her one sympathetic companion a little spaniel pup.  A neglected chill resulting in pneumonia happily finished off this poor little human fragment and relegated her to a sphere where love and happiness awaited her. The mother, attended by a band, of which I was a member, watched at the ‘death’-bed of this sweet little creature, and when the last breath of life had been drawn in that frail body, helped the luminous soul to ascend to a fairer setting.” — Lilian Walbrook, The Case Of Lester Coltman


"Well hello there adventurer! Please come have a seat I have supplies and information that will help you on your travels. I have a way of telling you which fighting style, or school of magic will suit you best. Are you a JavaScript warrior? or do you weild the magic of C#? The path ahead is very dangerous! All you must do is answer a few questions about yourself and I will give you the path you must follow."
"First! What weapon do you feel a draw towards?"
"Ahhh very interesting.. But I believe the dicipline you should follow is..."
JavaScript warrior!
JavaScript is the true strength in coding and fighting these days! Only the strongest will master the javascript power.
The Ruby Wizard!
Ruby is a sign of a stong diciplined mind. It is meant for strenth of for calculations and curiousity!
Python Monk!
Python will guide you down a different path that may not be known to many. The path of Python is not as difficult but you must stay focused.
C# Bard!
C# Bard might be considered one of the more popular languages. Liked by many and a language all can benefit from.


--- layout: post title: Reverse shot date: '2013-05-02T13:40:00+02:00' categories: - Atoleiros Battle - Storyboards picture_url: https://film-Storyboards.tumblr.com/post/49450246149/reverse-shot-from-this-one ---
Reverse shot from this one.


The equation shown above is called Ridge Regression (L2) - the beta coefficients are squared and summed. However, another regularization method is Lasso Regreesion (L1), which sums the absolute value of the beta coefficients. Even more, you can combine Ridge and Lasso linearly to get Elastic Net Regression (both squared and absolute value components are included in the cost function).
L2 regularization tends to yield a “dense” solution, where the magnitude of the coefficients are evenly reduced. For example, for a model with 3 parameters, B1, B2, and B3 will reduce by a similar factor.
However, with L1 regularization, the shrinkage of the parameters may be uneven, driving the value of some coefficients to 0. In other words, it will produce a sparse solution. Because of this property, it is often used for feature selection- it can help identify the most predictive features, while zeroing the others.


8.4 The getopt Module
The getopt module helps parse the command-line
options and arguments passed to a Python program, available in
sys.argv. The getopt module
distinguishes arguments proper from options: options start with
'-' (or '--' for long-form
options). The first non-option argument terminates option parsing
(similar to most Unix commands, and differently from GNU and Windows
commands). Module getopt supplies a single
function, also called getopt.
getopt(args,options,long_options=[ ])
|
|
Parses
command-line options. args is usually
sys.argv[1:]. options
is a string: each character is an option letter, followed by
':' if the option takes a parameter.
long_options is a list of strings, each a
long-option name, without the leading '--',
followed by '=' if the option takes a parameter.
When getopt encounters an error, it raises
GetoptError, an exception class supplied by the
getopt module. Otherwise,
getopt returns a pair
(opts,args_proper),
where opts is a list of pairs of the form
(option,parameter)
in the same order in which options are found in
args. Each
option is a string that starts with a
single hyphen for a short-form option or two hyphens for a long-form
one; each parameter is also a string (an
empty string for options that don't take
parameters). args_proper is the list of
program argument strings that are left after removing the options.
|


Loves programming, music and appreciates what God has given us.
I'm a software developer and you can visit my programming blog here. During the weekends, or when I'm not working or spending time with the missus, I enjoy playing music on my bass. Here are some of me and my band's original composition over the years.
 Here are some of the photos that I've taken through out the past couple of years.


221 B Baker Street
The Master Detective Game
Select a location to search for clues...
APOTHECARY
BANK
CARRIAGE DEPOT
DOCK
HOTEL
LOCKSMITH
MUSEUM
NEWSPAPER SHOP
PARK
PAWNBROKER
PLAYHOUSE
PUB
SCOTLAND YARD
TOBACCONIST
Clue Found On The Scene
HIDE THIS CLUE
Select a mystery:
--SELECT A MYSTERY--
Case #1
Case #2
Case #3
Case #4
Case #5
Case #6
Case #7
Case #8
Case #9
Case #10
Case #11
Case #12
Case #13
Case #14
Case #15
Case #16
Case #17
Case #18
Case #19
Case #20
Location Search History
TIMER


FragmentedMP4Writer
public class FragmentedMP4Writer
A class that reads in audio and video samples and produces fragmented mp4’s and playlists
Usage Example:
// URL to a temp dir
let outputDir = URL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true)
let writer = FragmentedMP4Writer(outputDir) // setup the writer without any options
writer.configure(settings: videoSettings) // Pass in video settings config
writer.configure(settings: audioSettings) // Pass in audio settings confg
// Specify a hls vod style playlist (file will appear in outputDir/vod.m3u8)
let playlist = Playlist(type: .hls_vod, fileName: "vod.m3u8")
try writer.add(playlist: playlist)
// Append some samples
writer.append(compressedSample)
// Signal when complete. All queued samples in the writer will be immediately flushed.
writer.stop()
-
Create a new writer
Throws
Will throw errors if any problems with setup ariseDeclaration
Swift
public init(_ outputDir: URL, targetDuration: TimeInterval = 6, streamType: StreamType = [.video, .audio], delegate: FileWriterDelegate? = nil) throws
Parameters
outputDir
A URL on the local filesystem that playlists and fragmented mp4’s should be written to
targetDuration
The target duration that each segment should be
streamType
Type of stream that is being read. eg: audio/video, video only, audio only
delegate
Delegate that is notified when files are written or updated
-
Configure the writer with video settings. This happens after initial setup because a video source might not be known / available
Declaration
Swift
public func configure(settings: VideoSettings)
Parameters
settings
VideoSettings struct describing video portion of the stream
-
Configure the writer with audio settings This happens after initial setup because an audio source might not be known / available
Declaration
Swift
public func configure(settings: AudioSettings)
Parameters
settings
AudioSettings struct describing the audio portion of the stream
-
Append a sample for writing
Declaration
Swift
public func append(sample: CompressedSample)
Parameters
sample
Sample data that should be written to the stream
type
Flag indicating whether the sample is audio or video
-
Add another playlist to be generated. The mp4 writer can generate multiple playlists at once
Throws
Throws a writer error if the playlist could not be addedDeclaration
Swift
public func add(playlist: Playlist) throws
Parameters
playlist
Playlist to be generated
-
Appends and end tag for now
Declaration
Swift
public func stop()


A JavaScript library for defining and working with lexical scopes.
Latest version: 0.10.1
// Create a new lexical scope
var scope = Scope.create({
locals: {foo: 3},
literals: {
multiplyFoo: function(val) {foo *= val;}
}
});
// Call a local function.
scope.multiplyFoo(4);
// Evaluate an expression locally.
scope.eval('foo++');
// Get a local variable.
log(scope.foo); // 13
// Extend a scope.
var inner = scope.extend({
locals: {bar: 'bar'}
});
// Inner scope has access to the outer scope:
inner.foo = 6;
log(scope.foo)); // 6
// But outer scope does not have access to the inner scope:
log(scope.eval('bar')); // Error: bar is not defined.
There are two ways to install ScopeJS: via npm or via git.
npm install -g scope
(Leave off the -g if you don't wish to install globally.)To install from source, you should have CoffeeScript installed.
Then run:
git clone git://github.com/dbrans/scope.git
cd scope
cake install
var Scope = require('scope').Scope;
var scope = Scope.create(...);
Include browser/scope.js
in your html page:
<script type="text/javascript" src="PATH_TO_SCOPE/browser/scope.js"></script>
browser/scope.js
defines Scope
as a global variable. So you can just go
ahead and use it:
var scope = Scope.create(...);
Please use the github page for ScopeJS to discuss and raise issues about ScopeJS.
Consider this function literal as a string:
var EVAL_LITERAL = "(function (expr) {return eval(expr)})";
Eval-ing this string in some lexical scope creates a 'scoped eval': a function that, if passed outside of the current scope, can evaluate expressions inside that scope. Here's a demonstration:
var scopeEval = (function() {
var x = 3;
return eval(EVAL_LITERAL);
})();
log(scopeEval('x')); // 3
log(eval('x')); // Error: x is not defined
In general, given a list of variable names var1
, var2
, ..., you can dynamically
create a lexical scope where those variables are defined like this:
var vars = ['var1', 'var2', ..., 'varN'];
var scopeEval = (function() {
eval("var " + vars.join(',') + ';' + EVAL_LITERAL);
})();
This idea of a scoped eval function is at the heart of ScopeJS.
Let's develop this idea a little bit.
Let's call the scope in which our examples are imagined to run the current scope and the scope in which a scopeEval expression runs, the target scope.
For simplicity, in our examples the current scope is the outer scope of the target scope. In other words,
// For simplicity:
// CURRENT SCOPE
var scopeEval = (function() {
// TARGET SCOPE
eval("var " + vars.join(',') + ';' + EVAL_LITERAL);
})();
In ScopeJS, however, the target scope lives somewhere else and cannot see the
current scope (see the Scope.eval
class method in the
Annotated Source)
In these examples, the variables var1, var2, etc. refer to variables that are already declared in the target scope. Any assignment to undeclared variables is a typo and would create global variables.
We can evaluate array, object and function literals inside the target scope. Those literals have access to local variables. Consider:
scopeEval('var1 = 3');
var obj = scopeEval('[var1]');
log(obj[0]); // 3
Function literals that are eval'd in a scope close over local variables in that scope and can manipulate them directly:
var addToVar = scopeEval('(function(x){var1 += x})');
addToVar(2);
log(scopeEval('var1')); // 5
As you may have noticed, it's impossible to declare a new variable in the target scope, once it is created. This is because the eval happens in the function local scope described by EVAL_LITERAL. This means that newly declared variables only exist for the duration of that function's invocation:
// Here 'newvar' exists:
log(scopeEval('var newvar = 3; newvar')); // 3
// ...but here it doesn't:
scopeEval('newvar'); // Error: newvar is not defined
Instead, we create an inner scope where new variables are defined.
var newvars = ['newvar1', 'newvar2', ...];
var innerEval = scopeEval('var ' + newvars.join(',') + ';' + EVAL_LITERAL);
Because we used scopeEval
to create our lexical scope, innerEval and scopeEval
share variables var1, var2, etc. In addition, innerEval has it's own variables
newvar1, newvar2, ...
// var1 is visible in both scopes
innerEval('var1 = 6');
log(scopeEval('var1')); // 6
// newvar1 is only visible in the inner scope
innerEval('newvar1 = 'A');
log(scopeEval('newvar1')); // Error: newvar1 is not defined.
We might say that innerEval
extends scopeEval
because innerEval
includes
scopeEval
's variables and declares new ones.
scopeEval
is actually the outer lexical scope of innerEval
, or rather the target
scopes of those two functions. A static view of the nested
scopes we've created so far might look like this:
// GLOBAL SCOPE
(function() {
// scopeEval's target scope
var var1, var2, ...;
(function () {
// innerEval's target scope
var newvar1, newvar2, ...;
})()
})()
For API documentation, please refer to the annotated source
Every root scope defines all the coffeescript helpers that are currently generated by the CoffeeScript compiler. This means that recompiling functions that were once compiled from CoffeeScript will work fine:
# This is coffeescript
scope.eval ->
# invoke CoffeeScript's __bind runtime helper.
=>
If you have a string of CoffeeScript code that you want to compile or run inside a target scope, use
CoffeeScript.compile code, bare:true
to compile code
first. 'Native' CoffeeScript eval/compile
support could be envisioned for the future.
One important caveat when setting a variable in the target scope inside a CoffeeScript function: The CoffeeScript compiler does lexical analysis around a function to decide if a variable has been seen before or if it needs to be declared inside the function. So, unless you have a local variable with the same name in the current scope, the CoffeeScript compiler will declare a variable with that name inside your function, even if that variable exists in the target scope. This function-local variable will mask the one in the target scope:
scope = Scope.create
locals:
foo: 3
literals:
# Won't have the desired effect.
setFoo: (val) -> foo = val
In the above code, calling scope.setFoo 4
will have no effect since, in the current scope,
CoffeeScript compiles (val) -> foo = val
to
function(val) {
var foo;
return foo = val;
}
A fix which analyzes decompiled CoffeeScript functions is possible.


{# basic/globaltoc.html ~~~~~~~~~~~~~~~~~~~~ Sphinx sidebar template: global table of contents. :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. #}
Send any questions using the Send Us a Message link below, or submit your question to StackOverflow using with the 'allen-sdk' tag.
If you encounter any problems using the AllenSDK, please create an issue on Github's issue tracker.


Coffee shop reviews
Hello {{currentUser.email}}
All Reviews
Sign up
My Reviews
Add Review
Log in
Log out
Title
Link
Link
Link
Link


Succumbed to the CSS dark side
Well, it didn't take me long to succumb to the power of the CSS dark side! ;-)
I had a few people comment about my website being "broken" - and my semi-auto reply of "going back to basics" - but this hasn't bothered me much, it's quite interesting to start a discussion around the idea.
However, I do admit that there are enhancements to be had with applying basic stylings. So I've started a minimal experiment, to explore those enhancements.
Initially I'll apply web-safe fonts and reasonable viewports - I've already had Google scold me for excessive viewport width on mobile devices! The strange part to that is I've tested my blog on phones and tablets, which it renders fine. Still worth exploring the options.
If you have any feedback, I am open to suggestions.


REST API¶
The REST APIs are undergoing active development and many of the below APIs are either not yet implemented or not fully functional. This mainly serves as a reference of what the final APIs will eventually look like.
GET /api/info¶
Returns basic information about the LedFx instance as JSON
{
url: "http://<IP_ADDRESS>:8888",
name: "LedFx",
version: "0.0.1"
}
GET /api/config¶
Returns the current configuration for LedFx as JSON
GET /api/log¶
Returns the error logs for the currently active LedFx session
GET /api/schema/devices¶
Returns all the valid schemas for a LedFx device as JSON
GET /api/schema/effects¶
Returns all the valid schemas for a LedFx effect as JSON
GET /api/devices¶
Returns all the devices registered with LedFx as JSON
POST /api/devices¶
Adds a new device to LedFx based on the provided JSON configuration.
GET /api/devices/<deviceId>¶
Returns information about the device with the matching device id as JSON
PUT /api/devices/<deviceId>¶
Modifies the information pertaining to the device with the matching device id and returns the new device as JSON
DELETE /api/devices/<deviceId>¶
Deletes the device with the matching device id.
GET /api/effects¶
Returns all the effects currently created in LedFx as JSON
POST /api/effects¶
Create a new Effect based on the provided JSON configuration.
GET /api/effects/<effectId>¶
Returns information about the effect with the matching effect id as JSON
PUT /api/effects/<effectId>¶
Modifies the configuration of the effect with a matching effect id and returns the new configuration as JSON
DELETE /api/effects/<effectId>¶
Deletes the effect with the matching effect id.


Samantha Zgak
Designer | Artist | Photographer
My name is Samantha Zgak, and I am a senior studying Visual Communication Design at Eastern Washington University. My passions include art, design, and photography. I have been dabbling with all different mediums so I can create visually appealing pieces. Some include digital programs, acrilic paint, watercolor, ceramics, and many more.
“What is design? It's where you stand with a foot in two worlds - the world of technology and the world of people and human purposes - and you try to bring the two together.”
Mitchell Kapor


|
−x, −y, −z (0, 0, 0)
|
−13.4
|
−3
|
−101.2
|
68
|
−61.4
|
| −x, y+1/2, −z+1/2 (0, −1, −1) |
0.5 |
−0.5 |
−6.5 |
5.1 |
−2.3 |
| −x, −y, −z (0, 2, −1) |
1.4 |
−0.2 |
−4.7 |
0.6 |
−2.3 |
| x, −y+1/2, z+1/2 (0, 1, −1) |
−6.5 |
−2.6 |
−17.4 |
13.3 |
−15.6 |
| −x, y+1/2, −z+1/2 (0, −1, 0) |
−2.7 |
−0.6 |
−8.6 |
4.7 |
−7.8 |
|
−x, −y, −z (1, 0, 0)
|
−13.5
|
−3.8
|
−107.7
|
74.3
|
−63.8
|
| x, y, z (0, 0, 1) |
−3.2 |
−0.9 |
−14.3 |
9.1 |
−10.7 |
|
−x, −y, −z (1, 2, 1)
|
−18
|
−5.8
|
−24.5
|
27.6
|
−27.8
|
| −x, y+1/2, −z+1/2 (−1, −1, 0) |
−4.4 |
−1.2 |
−10.1 |
4.3 |
−11.5 |
| x, −y+1/2, z+1/2 (0, 2, 0) |
−0.8 |
−0.5 |
−10.6 |
8.1 |
−5.3 |


--- title: fitArea sidebar: function_reference_sidebar permalink: crystalShape.fitArea.html folder: function_reference toc: false ---
change habitus of crystal shape to fit given faceAreas
| cS | crystalShape |
| faceArea | list of desired face areas |
| cS | crystalShape |