The basics
Single select boxes
Select2 can take a regular select box like this...
and turn it into this...
1
2
3
4
5
6
7
8
9
10
11

<select
class=
"js-example-basic-single"
>
<option
value=
"AL"
>Alabama
</option>...
<option
value=
"WY"
>Wyoming
</option>
</select>
Multiple select boxes
Select2 also supports multi-value select boxes. The select below
is declared with the
multiple
attribute.
1
2
3
4
5
6
7
8
9

<select
class=
"js-example-basic-multiple"
multiple=
"multiple"
>
<option
value=
"AL"
>Alabama
</option>...
<option
value=
"WY"
>Wyoming
</option>
</select>
Placeholders
A placeholder value can be defined and will be displayed until a
selection is made. Select2 uses the
placeholder
attribute on multiple select boxes, which requires IE 10+. You can
support it in older versions with the
Placeholders.js polyfill.
Data sources
In addition to handling options from a standard
<select>
, Select2 can also retrieve the results from other data sources.
Loading array data
Select2 provides a way to load the data from a local array. You can provide initial selections with array data by providing the option tag for the selected values, similar to how it would be done for a standard select.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

<select
class=
"js-example-data-array"
></select>
<select
class=
"js-example-data-array-selected"
>
<option
value=
"2"
selected=
"selected"
>duplicate
</option>
</select>
Loading remote data
Select2 comes with AJAX support built in, using jQuery's AJAX methods. In this example, we can search for repositories using GitHub's API.
When using Select2 with remote data, the HTML required for the
select
is the same as any other Select2. If you need to provide default
selections, you just need to include an
option
for each selection that contains the value and text that should be
displayed.
1
2
3
<select
class=
"js-data-example-ajax"
>
<option
value=
"3620194"
selected=
"selected"
>select2/select2
</option>
</select>
You can configure how Select2 searches for remote data using the
ajax
option. More information on the individual options that Select2
handles can be found in the options
documentation for ajax
.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$(
".js-data-example-ajax"
).
select2
({
ajax
:
{
url
:
"https://api.github.com/search/repositories"
,
dataType
:
'json'
,
delay
:
250
,
data
:
function
(
params
)
{
return
{
q
:
params
.
term
,
// search term
page
:
params.
page
};
},
processResults
:
function
(
data
,
params
)
{
// parse the results into the format expected by Select2
// since we are using custom formatting functions we do not need to
// alter the remote JSON data, except to indicate that infinite
// scrolling can be used
params
.
page
=
params
.
page
||
1
;
return {
results:
data.
items
,
pagination
:
{
more
:
(
params
.
page
*
30
)
<
data
.
total_count
}
};
},
cache
:
true
},
escapeMarkup
:
function
(
markup
)
{
return
markup
;
},
// let our custom formatter work
minimumInputLength
:
1
,
templateResult
:
formatRepo
,
// omitted for brevity, see the source of this page
templateSelection
:
formatRepoSelection
// omitted for brevity, see the source of this page
});
Select2 will pass any options in the
ajax
object to jQuery's
$.ajax
function, or the
transport
function you specify.
Disabled mode
Select2 will respond to the
disabled
attribute on
<select>
elements. You can also initialize Select2 with
disabled: true
to get the same effect.
Disabled results
Select2 will correctly handle disabled results, both with data
coming from a standard select (when the
disabled
attribute is set) and from remote sources, where the object has
disabled: true
set.
1
2
3
4
5
<select
class=
"js-example-disabled-results"
>
<option
value=
"one"
>First
</option>
<option
value=
"two"
disabled=
"disabled"
>Second (disabled)
</option>
<option value=
"three"
>Third
</option>
</select>
Limiting the number of selections
Select2 multi-value select boxes can set restrictions regarding the maximum number of options selected. The select below is declared with the
multiple
attribute with
maximumSelectionLength
in the select2 options.
1
2
3
$(
".js-example-basic-multiple-limit"
).
select2
({
maximumSelectionLength
:
2
});
Hiding the search box
Select2 allows you to hide the search box depending on the number
of options which are displayed. In this example, we use the value
Infinity
to tell Select2 to never display the search box.
1
2
3
$
(
".js-example-basic-hide-search"
).
select2
({
minimumResultsForSearch
:
Infinity
});
Programmatic control
DOM events
Select2 will trigger some events on the original select element, allowing you to integrate it with other components. You can find more information on events on the options page.
change
is fired whenever an option is selected or removed.
select2:open
is fired whenever the dropdown is opened.
select2:opening
is fired before this and can be prevented.
select2:close
is fired whenever the dropdown is closed.
select2:closing
is fired before this and can be prevented.
select2:select
is fired whenever a result is selected.
select2:selecting
is fired before this and can be prevented.
select2:unselect
is fired whenever a result is unselected.
select2:unselecting
is fired before this and can be prevented.
Programmatic access
Select2 supports methods that allow programmatic control of the component.
Tagging support
Select2 can be used to quickly set up fields used for tagging.
Note that when tagging is enabled the user can select from pre-existing options or create a new tag by picking the first choice, which is what the user has typed into the search box so far.
1
2
3
$
(
".js-example-tags"
).
select2
({
tags
:
true
})
Automatic tokenization
Select2 supports ability to add choices automatically as the user is typing into the search field. Try typing in the search field below and entering a space or a comma.
The separators that should be used when tokenizing can be specified using the tokenSeparators options.
1
2
3
4
$
(
".js-example-tokenizer"
).
select2
({
tags
:
true
,
tokenSeparators
:
[
','
,
' '
]
})
Customizing how results are matched
Unlike other dropdowns on this page, this one matches options only if the term appears in the beginning of the string as opposed to anywhere:
This custom matcher uses a compatibility module that is only bundled in the full version of Select2. You also have the option of using a more complex matcher.
1
2
3
4
5
6
7
8
9
10
11
12
13
function
matchStart
(
term
,
text
)
{
if
(
text
.
toUpperCase
().
indexOf
(
term
.
toUpperCase
())
==
0
)
{
return
true
;
}
return
false
;
}
$
.
fn
.
select2
.
amd
.
require
([
'select2/compat/matcher'
],
function
(
oldMatcher
)
{
$(
".js-example-matcher-start"
).
select2
({
matcher
:
oldMatcher
(
matchStart
)
})
});
Localization, RTL and diacritics support
Multiple languages
Select2 supports displaying the messages in different languages, as well as providing your own custom messages that can be displayed.
The language does not have to be defined when Select2 is being
initialized, but instead can be defined in the
[lang]
attribute of any parent elements as
[lang="es"]
.
1
2
3
$(
".js-example-language"
).
select2
({
language
:
"es"
});
RTL support
Select2 will work on RTL websites if the
dir
attribute is set on the
<select>
or any parents of it. You can also initialize Select2 with
dir: "rtl"
set.
1
2
3
$(
".js-example-rtl"
).
select2
({
dir
:
"rtl"
});
Diacritics support
Select2's default matcher will ignore diacritics, making it easier for users to filter results in international selects. Type "aero" into the select below.
1
$
(
".js-example-diacritics"
).
select2
();
Themes, templating and responsive design
Theme support
Select2 supports custom themes using the theme option so you can style Select2 to match the rest of your application.
These are using the
classic
theme, which matches the old look of Select2.
1
2
3
4
5
6
7
$
(
".js-example-theme-single"
).
select2
({
theme
:
"classic"
});
$(
".js-example-theme-multiple"
).
select2
({
theme:
"classic"
});
Templating
Various display options of the Select2 component can be changed:
You can access the
<option>
element (or
<optgroup>
) and any attributes on those elements using
.element
.
Templating is primarily controlled by the templateResult
and templateSelection
options.
1
2
3
4
5
6
7
8
9
10
11
function
formatState
(
state
)
{
if
(
!
state
.
id
)
{
return
state
.
text
;
}
var
$state
=
$
(
' '
+
state
.
text
+
''
);
return
$state
;
};
$
(
".js-example-templating"
).
select2
({
templateResult
:
formatState
});
Responsive design - Percent width
Select2's width can be set to a percentage of its parent to support responsive design. The two Select2 boxes below are styled to 50% and 75% width respectively.
1
2
<select
class=
"js-example-responsive"
style=
"width: 50%"
></select>
<select
class=
"js-example-responsive"
multiple=
"multiple"
style=
"width: 75%"
></select>
style
declaration into the tag.


| FIGURE 1 |
Data for the cross soil-type/area comparisons testing H1. (A ... |
| FIGURE 2 |
For the cross soil-type/area comparison (H1) these data are ... |
| FIGURE 3 |
Data for the moth resistant and susceptible tree comparisons ... |
| FIGURE 4 |
The decline in moth killed stem counts on large susceptible ... |


fun denyFriendRequest(uid: String): Unit
Deny friend request
uid - UID of the friend whose request to deny
uid


The Hegemony Consul
The Hegemony Consul
The Hegemony Consul
The Hegemony Consul
The Hegemony Consul
The Hegemony Consul
The Hegemony Consul
The Hegemony Consul


- onAnimationEnd(Animation) - Method in class org.buildmlearn.appstore.activities.FlashActivity
-
This method is called when the animation ends.
- onAnimationRepeat(Animation) - Method in class org.buildmlearn.appstore.activities.FlashActivity
-
Default methods implemented when the Class Animation.AnimationListener is implemented.
- onAnimationStart(Animation) - Method in class org.buildmlearn.appstore.activities.FlashActivity
-
Default methods implemented when the Class Animation.AnimationListener is implemented.
- onAttachedToWindow() - Method in class org.buildmlearn.appstore.utils.SlidingTabLayout
-
This method is executed when the window is attached to the view.
- onBack - Variable in class org.buildmlearn.appstore.activities.CategoriesView
-
- onBackPressed() - Method in class org.buildmlearn.appstore.activities.AppDetails
-
This method is called automatically when the back button is pressed.
- onBackPressed() - Method in class org.buildmlearn.appstore.activities.AppsActivity
-
It is automatically called when the back button is pressed.
- onBackPressed() - Method in class org.buildmlearn.appstore.activities.CategoriesActivity
-
This activity is automatically called when back button is pressed.
- onBackPressed() - Method in class org.buildmlearn.appstore.activities.CategoriesView
-
This method is automatically called when back button is pressed.
- onBackPressed() - Method in class org.buildmlearn.appstore.activities.HomeActivity
-
This method is automatically called when the user presses the back button on his mobile.
- onBackPressed() - Method in class org.buildmlearn.appstore.activities.SettingsActivity
-
This method is called when the back button is pressed.
- onBackPressed() - Method in class org.buildmlearn.appstore.activities.SpellingActivity
-
It is automatically called when the back button is pressed.
- onBackPressed() - Method in class org.buildmlearn.appstore.activities.WordInfoActivity
-
This method is automatically called when the back button is pressed.
- onBindViewHolder(CardCategoriesAdapter.CardViewHolder, int) - Method in class org.buildmlearn.appstore.adapters.CardCategoriesAdapter
-
It binds content to the views.
- onBindViewHolder(CardViewAdapter.CardViewHolder, int) - Method in class org.buildmlearn.appstore.adapters.CardViewAdapter
-
Binds content to the cardviewholder object
- onBindViewHolder(CategoriesAdapter.CategoriesViewHolder, int) - Method in class org.buildmlearn.appstore.adapters.CategoriesAdapter
-
Binds the content to the view
- onBindViewHolder(MyAppsViewAdapter.MyAppsViewHolder, int) - Method in class org.buildmlearn.appstore.adapters.MyAppsViewAdapter
-
Binds the content to the view
- onBuildHeaders(List<PreferenceActivity.Header>) - Method in class org.buildmlearn.appstore.activities.SettingsActivity
-
Called when the activity needs its list of headers build.
- onClick(View) - Method in class org.buildmlearn.appstore.activities.StartActivity
-
This method is called when the start button is pressed, and it navigates to respective activity depending on the type of the app which is launched.
- onClick(View, int, boolean) - Method in interface org.buildmlearn.appstore.adapters.CardCategoriesAdapter.CardViewHolder.ClickListener
-
Called when the view is clicked.
- onClick(View) - Method in class org.buildmlearn.appstore.adapters.CardCategoriesAdapter.CardViewHolder
-
- onClick(View, int, boolean) - Method in interface org.buildmlearn.appstore.adapters.CardViewAdapter.CardViewHolder.ClickListener
-
Called when the view is clicked.
- onClick(View) - Method in class org.buildmlearn.appstore.adapters.CardViewAdapter.CardViewHolder
-
- onClick(View, int, boolean) - Method in interface org.buildmlearn.appstore.adapters.CategoriesAdapter.CategoriesViewHolder.ClickListener
-
Called when the view is clicked.
- onClick(View) - Method in class org.buildmlearn.appstore.adapters.CategoriesAdapter.CategoriesViewHolder
-
- onClick(View, int, boolean) - Method in interface org.buildmlearn.appstore.adapters.MyAppsViewAdapter.MyAppsViewHolder.ClickListener
-
Called when the view is clicked.
- onClick(View) - Method in class org.buildmlearn.appstore.adapters.MyAppsViewAdapter.MyAppsViewHolder
-
- onClick(View) - Method in class org.buildmlearn.appstore.utils.SlidingTabLayout.TabClickListener
-
- onCreate(Bundle) - Method in class org.buildmlearn.appstore.activities.AppDetails
-
The method is executed first when the activity is created.
- onCreate(Bundle) - Method in class org.buildmlearn.appstore.activities.AppsActivity
-
The method is executed first when the activity is created.
- onCreate(Bundle) - Method in class org.buildmlearn.appstore.activities.CategoriesActivity
-
The method is executed first when the activity is created.
- onCreate(Bundle) - Method in class org.buildmlearn.appstore.activities.CategoriesView
-
The method is executed first when the activity is created.
- onCreate(Bundle) - Method in class org.buildmlearn.appstore.activities.FlashActivity
-
The method is executed first when the activity is created.
- onCreate(Bundle) - Method in class org.buildmlearn.appstore.activities.FullScreenViewActivity
-
The method is executed first when the activity is created.
- onCreate(Bundle) - Method in class org.buildmlearn.appstore.activities.HomeActivity
-
The method is executed first when the activity is created.
- onCreate(Bundle) - Method in class org.buildmlearn.appstore.activities.InfoActivity
-
The method is executed first when the activity is created.
- onCreate(Bundle) - Method in class org.buildmlearn.appstore.activities.InfoDetailActivity
-
The method is executed first when the activity is created.
- onCreate(Bundle) - Method in class org.buildmlearn.appstore.activities.NavigationActivity
-
The method is executed first when the activity is created.
- onCreate(Bundle) - Method in class org.buildmlearn.appstore.activities.QuestionActivity
-
The method is executed first when the activity is created.
- onCreate(Bundle) - Method in class org.buildmlearn.appstore.activities.ScoreActivity
-
The method is executed first when the activity is created.
- onCreate(Bundle) - Method in class org.buildmlearn.appstore.activities.SettingsActivity.AboutPreferenceFragment
-
- onCreate(Bundle) - Method in class org.buildmlearn.appstore.activities.SettingsActivity.GeneralPreferenceFragment
-
- onCreate(Bundle) - Method in class org.buildmlearn.appstore.activities.SettingsActivity
-
The method is executed first when the activity is created.
- onCreate(Bundle) - Method in class org.buildmlearn.appstore.activities.SpellingActivity
-
The method is executed first when the activity is created.
- onCreate(Bundle) - Method in class org.buildmlearn.appstore.activities.SplashActivity
-
The method is executed when the activity is created.
- onCreate(Bundle) - Method in class org.buildmlearn.appstore.activities.StartActivity
-
The method is executed first when the activity is created.
- onCreate(Bundle) - Method in class org.buildmlearn.appstore.activities.WordInfoActivity
-
The method is executed first when the activity is created.
- onCreateOptionsMenu(Menu) - Method in class org.buildmlearn.appstore.activities.NavigationActivity
-
This method creates menu items to be shown on the Action Bar.
- onCreateView(LayoutInflater, ViewGroup, Bundle) - Method in class org.buildmlearn.appstore.fragments.TabMyApps
-
It is called when the fragment is created.
- onCreateView(LayoutInflater, ViewGroup, Bundle) - Method in class org.buildmlearn.appstore.fragments.TabStore
-
It is called when the fragment is created.
- onCreateViewHolder(ViewGroup, int) - Method in class org.buildmlearn.appstore.adapters.CardCategoriesAdapter
-
Inflates the layout
- onCreateViewHolder(ViewGroup, int) - Method in class org.buildmlearn.appstore.adapters.CardViewAdapter
-
Inflates the layout
- onCreateViewHolder(ViewGroup, int) - Method in class org.buildmlearn.appstore.adapters.CategoriesAdapter
-
Inflates the layout
- onCreateViewHolder(ViewGroup, int) - Method in class org.buildmlearn.appstore.adapters.MyAppsViewAdapter
-
Inflates the layout
- onDestroy() - Method in class org.buildmlearn.appstore.activities.SpellingActivity
-
Releases the resources used by the TextToSpeech engine.
- onDestroy() - Method in class org.buildmlearn.appstore.activities.WordInfoActivity
-
Releases the resources used by the TextToSpeech engine.
- onDraw(Canvas) - Method in class org.buildmlearn.appstore.utils.SlidingTabStrip
-
This method is executed when the Object is drawn.
- onInit(int) - Method in class org.buildmlearn.appstore.activities.SpellingActivity
-
Initializes the Speech Synthesis
- onIsMultiPane() - Method in class org.buildmlearn.appstore.activities.SettingsActivity
-
Called to determine if the activity should run in multi-pane mode.
- onLongClick(View) - Method in class org.buildmlearn.appstore.adapters.CardCategoriesAdapter.CardViewHolder
-
- onLongClick(View) - Method in class org.buildmlearn.appstore.adapters.CardViewAdapter.CardViewHolder
-
- onLongClick(View) - Method in class org.buildmlearn.appstore.adapters.CategoriesAdapter.CategoriesViewHolder
-
- onLongClick(View) - Method in class org.buildmlearn.appstore.adapters.MyAppsViewAdapter.MyAppsViewHolder
-
- onPageScrolled(int, float, int) - Method in class org.buildmlearn.appstore.utils.SlidingTabLayout.InternalViewPagerListener
-
This method is executed when the page is scrolled/swiped in the view-pager.
- onPageScrollStateChanged(int) - Method in class org.buildmlearn.appstore.utils.SlidingTabLayout.InternalViewPagerListener
-
This method is executed when the page scrol state is changed.
- onPageSelected(int) - Method in class org.buildmlearn.appstore.utils.SlidingTabLayout.InternalViewPagerListener
-
This method is executed when a page is selected.
- onPostCreate(Bundle) - Method in class org.buildmlearn.appstore.activities.SettingsActivity
-
- onPostExecute(Void) - Method in class org.buildmlearn.appstore.activities.StartActivity.FileReadTask
-
This method is called after the task has been performed.
- onViewPagerPageChanged(int, float) - Method in class org.buildmlearn.appstore.utils.SlidingTabStrip
-
This method is activated, when the tabs are changed.
- org.buildmlearn.appstore.activities - package org.buildmlearn.appstore.activities
-
- org.buildmlearn.appstore.adapters - package org.buildmlearn.appstore.adapters
-
- org.buildmlearn.appstore.fragments - package org.buildmlearn.appstore.fragments
-
- org.buildmlearn.appstore.models - package org.buildmlearn.appstore.models
-
- org.buildmlearn.appstore.utils - package org.buildmlearn.appstore.utils
-


I’m a full stack bioinformatician. I work with cloud infrastructure to design, test, and implement robust and scalable data analysis pipelines and write user friendly applications to help researchers get the most out of their data.
Bioinformatics Analyst
Second Genome
Programmer Analyst
Schloss Lab, University of Michigan
MS Bioinformatics
University of Michigan
BA biology
Earlham College
Contact me if you would like to get in touch, discuss how I can help you with your next project, or just want to say hello.
The dynamics of a family’s gut microbiota reveal variations on a theme
PD Schloss, KD Iverson, JF Petrosino, SJ Schloss. Microbiome, 2014
microbiomejournal.biomedcentral.com/articles/10.1186/2049-2618-2-25
The Gut Microbiome Modulates Colon Tumorigenesis
JP Zackular, NT Baxter, KD Iverson, WD Sadler, JF Petrosino, GY Chen, PD Schloss.
mBio, 2013
mbio.asm.org/content/4/6/e00692-13.short
Stabilization of the murine gut microbiome following weaning
PD Schloss, AM Schubert, JP Zackular, KD Iverson, JF Petrosino. Gut Microbes, 2012
tandfonline.com/doi/abs/10.4161/gmic.21008


PICK YOU FAVORITE
X
Vanilla Ice Cream Recipe
- 3/4 cup white sugar
- 1 cup heavy whipping cream
- 2 1/4 cups milk
- 2 teaspoons vanilla extract
- Stir sugar, cream, and milk into a saucepan over low heat until sugar has dissolved. Heat just until mix is hot and a small ring of foam appears around the edge.
- Transfer cream mixture to a pourable container such as a large measuring cup. Stir in vanilla extract and chill mix thoroughly, at least 2 hours. (Overnight is best.)
- Pour cold ice cream mix into an ice cream maker, turn on the machine, and churn according to manufacturer's directions, 20 to 25 minutes.
- When ice cream is softly frozen, serve immediately or place a piece of plastic wrap directly on the ice cream and place in freezer to ripen, 2 to 3 hours.
X
Chocolate Cupcake Recipe
- 1 1/3 cups all-purpose flour
- 1/4 teaspoon baking soda
- 2 teaspoons baking powder
- 3/4 cup unsweetened cocoa powder
- 1/8 teaspoon salt
- 3 tablespoons butter, softened
- 1 1/2 cups white sugar
- 2 eggs
- 3/4 teaspoon vanilla extract
- 1 cup milk
- Preheat oven to 350 degrees F (175 degrees C). Line a muffin pan with paper or foil liners. Sift together the flour, baking powder, baking soda, cocoa and salt. Set aside.
- In a large bowl, cream together the butter and sugar until light and fluffy. Add the eggs one at a time, beating well with each addition, then stir in the vanilla. Add the flour mixture alternately with the milk; beat well. Fill the muffin cups 3/4 full.
- Bake for 15 to 17 minutes in the preheated oven, or until a toothpick inserted into the cake comes out clean. Frost with your favorite frosting when cool.
X
Lemon Plum Cake Recipe
- 1 1/2 cups all-purpose flour
- 1/2 teaspoon baking soda
- 1/4 teaspoon salt
- 1 tablespoon cinnamon
- 3/4 cup unsalted butter, softened
- 1/2 cup packed brown sugar
- 1/2 cup white sugar
- 3 eggs
- 1 tablespoon vanilla extract
- 2 1/2 teaspoons finely grated lemon zest
- 1/2 cup plain yogurt
- 3 plums, pitted and cut into eighths
- 2 tablespoons all-purpose flour
- 1 teaspoon confectioners' sugar
- Preheat oven to 375 degrees F (190 degrees C). Grease a 9-inch cake pan, and line the bottom with a round piece of parchment paper.
- In a large bowl, whisk together 1 1/2 cups flour, baking soda, salt, and cinnamon. In a separate bowl, beat butter, brown sugar, and white sugar with an electric mixer until light and fluffy; beat in eggs one at a time, then beat in vanilla extract and lemon zest. Mix the butter mixture into the flour mixture, alternating with yogurt until the mixture forms a smooth, even batter. Spread the batter into the prepared cake pan. Place the plum slices into a bowl, and toss with 2 tablespoons of flour. Arrange the plum slices onto the cake in a decorative pattern.
- Bake in the preheated oven until browned, about 30 minutes. Loosely cover the cake with foil, and bake until a toothpick inserted into the center of the cake comes out clean and the cake pulls away from the sides of the pan, 30 to 40 more minutes.
- Let cake cool completely in pan. Run a knife around the edge of the cake to loosen, and remove from pan. Dust with powdered sugar before slicing.


The purpose of this application is to create a surprize text, picture, or video which someone can unlock if they 1) have the password or 2) the timer (countdown) reaches zero.


MOST POPULAR
Slack wants to let you call Microsoft Teams users (yes,
you read that right)
Napier Lopez • 2 hours ago
TNW Deals • 6 minutes ago
Rachel Kaser • 14 hours ago
Thomas Macaulay • 14 hours ago
James Briggs • 6 hours ago
Napier Lopez • 17 hours ago
David Canellis • 17 hours ago
Ben Dickson • 3 hours ago
Andrea Hak • 2 hour Ago


Testing Clicks
I'm a normal link
I go to an anchor
I open a window with javascript
looooooooooong short looooooooooong


Jrue Holiday-led Pelicans spoil Paul George's Clippers debut
NEW ORLEANS – Paul George expected to shoot well in his Clippers’ debut because his surgically repaired shoulders felt great.
It was the rest of his game — from ball handling to defense — that concerned him.
Jrue Holiday scored 36 points and stole the ball from George three times in the final minutes to lead the New Orleans Pelicans to a 132-127 victory over Los Angeles on Thursday night.
“I thought I was terrible,” said George, who was limited to 24 minutes by early foul trouble but still scored 33 points.
“That’s the best my shoulders have felt in a really long time, so I knew coming into tonight shooting wouldn’t be a problem,” George added. “Just playing basketball is what I’m lacking right now.”
George was playing for the first time since signing as a free agent with the Clippers because he’d been recovering from procedures in May on his right shoulder and June on his left.
“A lot of breakdowns happened because of my lack of being out there with those guys,” George said. “I’m here to win games and I didn’t get a win. . . . We had a chance to win tonight and a couple bad possessions in a row that we have down the stretch and we lose. That’s what I gauge good games and bad games on.”
Holiday, who had six steals in all, intercepted of Lou Williams’ attempted bounce pass in the final seconds to seal the victory. The play capped off a night in which Holiday scored 12 in the final 4:20, including a pair of pivotal 3s.
“It felt good,” said Holiday, who hadn’t scored as many as 20 points in any of his previous eight games. “It’s all about timing and rhythm. I felt like I got a little bit of that back tonight.”
Derrick Favors, in his first season with New Orleans, had 20 points and a career-best 20 rebounds in the first 20-20 game of his 10-year career.
“I’m starting to get comfortable now and just try to keep it going throughout the year,” Favors said. “It was a great game for me, a great game for the team, and we came out and played hard, but we just have to stay consistent.”
Teammate Frank Jackson added 23 points in a reserve role.
Los Angeles played without Kawhi Leonard, who was being rested for the third time this season to ease stress on his sore knee after playing a night earlier in a loss at Houston. But the Pelicans were hardly sympathetic with starters Brandon Ingram (right knee) and Lonzo Ball (groin) sidelined, as well.
George’s 3 cut the Pelicans’ lead to 126-123 with 42 seconds left. But the Clippers left Jackson unguarded on the perimeter on the other end, and he took his time squaring up and connecting on his fourth 3 of the game to restore New Orleans’ six-point lead with 30 seconds left.
J.J. Reddick, who started and scored 19, hit two free throws with 11.4 seconds left to help wrap up just the Pelicans’ third victory in 11 games this season.
Williams scored 31 points and Rodney McGruder 20 for Los Angeles, which has dropped two straight.
Suns 128, Hawks 112
In Phoenix, Kelly Oubre Jr. scored a season-high 30 points, Devin Booker added 27 and the Suns routed Atlanta.
Phoenix (7-4) is off to its best start through 11 games since 2009, when they started 9-2.
Dario Saric added 23 points after shooting 9 of 12 from the field, including 3 of 5 from 3-point range.
Jabari Parker led the Hawks (4-7) with 24 points. Trae Young had 21 points and 13 assists two nights after a 42-point, 11-assist performance in a win over Denver.
In Other Games
Heat 108, Cavaliers 97
Knicks 106, Mavericks 103
Bucks 124, Bulls 115
Nuggets 101, Nets 93
GET THE BEST OF THE JAPAN TIMES
IN FIVE EASY PIECES WITH TAKE 5
JOIN THE CONVERSATION


One of the first things that people get shown when they start learning shaders is how to write a simple, single light, diffuse shader. I have yet to see a single shader tutorial out there that ever returns to this initial exercise to demonstrate how to write shaders which can properly interact with multiple (and different kinds of) lights. So I’m going to try to fill in that gap with what I’ve managed to figure out on my own.
This will hopefully serve as a good starting point for any truly custom lighting shaders you want to write. To be clear, the end goal of this tutorial is simply to have a pixel shader that looks as close as possible to the built in Diffuse shader. The end result of this shader looks like this:
Ok, let’s get started with a basic skeleton of what we’re building. Mulit-light shaders (in Forward Rendering) use a separate pass for each pixel light in the scene. How this looks in practice is 2 defined passes in the shader. One (the Base Pass) renders the first light in the scene, and the second pass (the Add pass) gets called once for each additional light, and is additively blended with the previous passes. It looks something like this:
Shader "BetterDiffuse"
{
Properties
{
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB) Alpha (A)", 2D) = "white" {}
}
SubShader
{
Tags {"Queue" = "Geometry" "RenderType" = "Opaque"}
Pass
{
Tags {"LightMode" = "ForwardBase"}
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
ENDCG
}
Pass
{
Tags {"LightMode" = "ForwardAdd"}
Blend One One
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
ENDCG
}
}
Fallback "VertexLit"
}
Nothing compiles yet, but at least we have the basic structure we’re going to use in place. You can see above that the base and add passes are marked using the LightMode tag. This is a tag which tells unity which pass to use for which. The “Forward” prefix on Add and Base identifies that these passes are for Forward rendering. This tutorial won’t cover Deferred Rendering (mostly because I haven’t wrapped my head around it yet).
If you’re wondering, the fallback to VertexLit allows us to use the VertexLit shaders shadow passes. Our shader will not cast shadows properly without this.
Next, let’s look at what our vertex input and output structs need to be:
struct vertex_input
{
float4 vertex : POSITION;
float3 normal : NORMAL;
float4 texcoord : TEXCOORD0;
};
struct vertex_output
{
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
float3 lightDir : TEXCOORD1;
float3 normal : TEXCOORD2;
LIGHTING_COORDS(3,4)
};
Output wise, we need the obvious position, uv coords and vertex normal, we also need to get the vector from our vertex to the current light in object space. Finally, we need to grab light attenuation information, and shadow info. Unity has a macro for grabbing those last two items, LIGHTING_COORDS(x,y). This macro will put lighting info into TEXCOORDX and shadow info into TEXCOORDY. This takes care of the messy business of dealing with all the different datatypes needed for different types of lights.
Just remember to include UnityCG.cginc, Lighting.cginc and AutoLight.cginc if you’re using the Unity macros.
Ok, things are looking pretty good here. Let’s move on the vertex program. For the most part, the vertex program for each pass is fairly normal (for now, we’ll come back to this later when we talk about vertex lights).
vertex_output vert (vertex_input v)
{
vertex_output o;
o.pos = mul( UNITY_MATRIX_MVP, v.vertex);
o.uv = v.texcoord.xy;
o.normal = v.normal;
o.lightDir = ObjSpaceLightDir(v.vertex);
TRANSFER_VERTEX_TO_FRAGMENT(o);
return o;
}
The 2 lines before the return bear a bit more explanation. ObjSpaceLightDir(float4 x) is a method provided in AutoLight.cginc. Simply put, it returns a vector going from the light to the current vertex in object space. You can check out ObjSpaceLightDir in UnityCG.cginc if you’re interested in the details, but for our purposes, using the built in function will be fine.
TRANSFER_VERTEX_TO_FRAGMENT is the macro provided to transfer the data declared with LIGHTING_COORDS to the fragment program. It does some co-ordinate space conversions as well, but since we’re just going to grab the end values from all these calculations for our light attenuation, we don’t need to worry about them right now. For now our goal is just a pixel shader that looks like the Diffuse surface shader.
Alright, on to the fragment program for our passes. For one, we’re going to need to grab the colour from the texture we have applied to our mesh, and do a colour multiply on it to take into account the inspector inputs we defined at the top of the page. Then we’re going to be getting the lighting attenuation value from Unity. Finally, we’re going to use the lightDir variable we set in the vertex shader to calculate the diffuse lighting value with.
sampler2D _MainTex;
float4 _MainTex_ST;
fixed4 _Color;
fixed4 _LightColor0;
half4 frag(vertex_output i) : COLOR
{
fixed4 tex = tex2D(_MainTex, i.uv * _MainTex_ST.xy + _MainTex_ST.zw);
tex *= _Color;
fixed atten = LIGHT_ATTENUATION(i);
i.lightDir = normalize(i.lightDir);
fixed diff = saturate(dot(i.normal, i.lightDir));
fixed4 c;
c.rgb = UNITY_LIGHTMODEL_AMBIENT.rgb * 2 * tex.rgb;
c.rgb += (tex.rgb * _LightColor0.rgb * diff) * (atten * 2);
c.a = tex.a + _LightColor0.a * atten;
return c;
}
Not much here should be too out of the ordinary (save for the call to LIGHT_ATTENUATION). One thing that I’ve yet to be able to account for are the multiplications by 2 in the diffuse calculations. It’s very clear that this gives us an end result that looks like the built-in diffuse shader, but I’m not entirely sure why the built in diffuse shader would be multiplying these values by 2 either. Nevertheless, to hit our goal, we’re going to do it too. Just remember to leave out the ambient calculations in the ForwardAdd pass, otherwise things will be way too bright.
Great! If you try out the shader now, it should look pretty darn good. Don’t get too comfy though, there’s still one more task to do. If you add more than 3 lights to your scene you will notice the shader starts behaving strangely right now. This is because we haven’t specified what we want to do with Vertex lights. Unity only supports up to 4 Per-Pixel lights, but it will allow 4 more lights to be used on a per vertex basis. Unfortunately our current code doesn’t take into account these lights, so we need to add support for them now.
Step one is to add a float3 to our output struct to hold the summed colour of the lights for the current vertex. Next we need to convert our object space position and normal into world space, and pass them to a for loop that calculates the diffuse lighting for each of the 4 possible vertex lights. Once we get that colour into our frag shader, we just add it to the colour we’re already multiplying the texture by. The end result isn’t exactly identical to the built in shaders, but it’s a reasonable approximation.
Our new ForwardBase vertex_output struct looks like this:
struct vertex_output
{
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
float3 lightDir : TEXCOORD1;
float3 normal : TEXCOORD2;
LIGHTING_COORDS(3,4)
float3 vertexLighting : TEXCOORD5;
};
That pass’ vertex function is now:
vertex_output vert(vertex_input v)
{
vertex_output o;
o.pos = mul( UNITY_MATRIX_MVP, v.vertex);
o.uv = v.texcoord.xy;
o.lightDir = ObjSpaceLightDir(v.vertex);
o.normal = v.normal;
TRANSFER_VERTEX_TO_FRAGMENT(o);
o.vertexLighting = float3(0.0, 0.0, 0.0);
#ifdef VERTEXLIGHT_ON
float3 worldN = mul((float3x3)_Object2World, SCALED_NORMAL);
float4 worldPos = mul(_Object2World, v.vertex);
for (int index = 0; index < 4; index++)
{
float4 lightPosition = float4(unity_4LightPosX0[index],
unity_4LightPosY0[index],
unity_4LightPosZ0[index], 1.0);
float3 vertexToLightSource = float3(lightPosition - worldPos);
float3 lightDirection = normalize(vertexToLightSource);
float squaredDistance = dot(vertexToLightSource, vertexToLightSource);
float attenuation = 1.0 / (1.0 + unity_4LightAtten0[index] * squaredDistance);
float3 diffuseReflection = attenuation * float3(unity_LightColor[index])
* float3(_Color) * max(0.0, dot(worldN, lightDirection));
o.vertexLighting = o.vertexLighting + diffuseReflection * 2;
}
#endif
return o;
}
and the ForwardBase fragment function is:
fixed4 frag(vertex_output i) : COLOR
{
i.lightDir = normalize(i.lightDir);
fixed atten = LIGHT_ATTENUATION(i);
fixed4 tex = tex2D(_MainTex, i.uv);
tex *= _Color + fixed4(i.vertexLighting, 1.0);
fixed diff = saturate(dot(i.normal, i.lightDir));
fixed4 c;
c.rgb = (UNITY_LIGHTMODEL_AMBIENT.rgb * 2 * tex.rgb);
c.rgb += (tex.rgb * _LightColor0.rgb * diff) * (atten * 2);
c.a = tex.a + _LightColor0.a * atten;
return c;
}
The source for for the entire shader can be found here.
If you made it this far, congratulations! You now have a diffuse shader that takes into account all the lights unity has to offer! As always, feedback is very welcome (especially if you’ve spotted errors, or things that i’ve gotten wrong). You can find me on Twitter. Hope this tutorial helped!


My name is Aurèle, I live in France and I am still studying in highschool.
Since the age of 10, I've always been passionated about computers and I was lucky enough to have a family full of nerds, this is the reason I've became the developer I am today. I firstly learnt to program Minecraft plugins in Java for fun then it became a real passion!


| ||||||||||||||||||||
asn1parse(1)
NAMEasn1parse - ASN.1 parsing tool
SYNOPSISopenssl asn1parse [-inform PEM|DER] [-in filename] [-out filename] [-noout] [-offset number] [-length number] [-i] [-oid filename] [-dump] [-dlimit num] [-strparse offset] [-genstr string] [-genconf file] [-strictpem]
DESCRIPTIONThe asn1parse command is a diagnostic utility that can parse ASN.1 structures. It can also be used to extract data from ASN.1 formatted data.
OPTIONS
OUTPUTThe output will typically contain lines like this: 0:d=0 hl=4 l= 681 cons: SEQUENCE ..... 229:d=3 hl=3 l= 141 prim: BIT STRING 373:d=2 hl=3 l= 162 cons: cont [ 3 ] 376:d=3 hl=3 l= 159 cons: SEQUENCE 379:d=4 hl=2 l= 29 cons: SEQUENCE 381:d=5 hl=2 l= 3 prim: OBJECT :X509v3 Subject Key Identifier 386:d=5 hl=2 l= 22 prim: OCTET STRING 410:d=4 hl=2 l= 112 cons: SEQUENCE 412:d=5 hl=2 l= 3 prim: OBJECT :X509v3 Authority Key Identifier 417:d=5 hl=2 l= 105 prim: OCTET STRING 524:d=4 hl=2 l= 12 cons: SEQUENCE ..... This example is part of a self signed certificate. Each line starts with the offset in decimal. d=XX specifies the current depth. The depth is increased within the scope of any SET or SEQUENCE. hl=XX gives the header length (tag and length octets) of the current type. l=XX gives the length of the contents octets. The -i option can be used to make the output more readable. Some knowledge of the ASN.1 structure is needed to interpret the output. In this example the BIT STRING at offset 229 is the certificate public key. The contents octets of this will contain the public key information. This can be examined using the option -strparse 229 to yield: 0:d=0 hl=3 l= 137 cons: SEQUENCE 3:d=1 hl=3 l= 129 prim: INTEGER :E5D21E1F5C8D208EA7A2166C7FAF9F6BDF2059669C60876DDB70840F1A5AAFA59699FE471F379F1DD6A487E7D5409AB6A88D4A9746E24B91D8CF55DB3521015460C8EDE44EE8A4189F7A7BE77D6CD3A9AF2696F486855CF58BF0EDF2B4068058C7A947F52548DDF7E15E96B385F86422BEA9064A3EE9E1158A56E4A6F47E5897 135:d=1 hl=2 l= 3 prim: INTEGER :010001
NOTESIf an OID is not part of OpenSSL's internal table it will be represented in numerical form (for example <IP_ADDRESS>). The file passed to the -oid option allows additional OIDs to be included. Each line consists of three columns, the first column is the OID in numerical format and should be followed by white space. The second column is the ``short name'' which is a single word followed by white space. The final column is the rest of the line and is the ``long name''. asn1parse displays the long name. Example:
EXAMPLESParse a file: openssl asn1parse -in file.pem Parse a DER file: openssl asn1parse -inform DER -in file.der Generate a simple UTF8String: openssl asn1parse -genstr 'UTF8:Hello World' Generate and write out a UTF8String, don't print parsed output: openssl asn1parse -genstr 'UTF8:Hello World' -noout -out utf8.der Generate using a config file: openssl asn1parse -genconf asn1.cnf -noout -out asn1.der Example config file: asn1=SEQUENCE:seq_sect [seq_sect] field1=BOOL:TRUE field2=EXP:0, UTF8:some random string
BUGSThere should be options to change the format of output lines. The output of some ASN.1 types is not well handled (if at all).
SEE ALSO | ||||||||||||||||||||


Jay and Silent Bob Strike Back (2001) Kevin Smith, Jason Mewes, Shannen Doherty, Renée Humphrey, Ben Affleck, James Van Der Beek, Jason Biggs, Matt Damon, Joey Lauren Adams, Shannon Elizabeth, Eliza Dushku, Carrie Fisher, Tracy Morgan, Scott Mosier, Ali Larter, Diedrich Bader, Jason Lee, George Carlin, Jeff Anderson, Dwight Ewell, Will Ferrell, Ever Carradine, Steve Kmetko, Chris Rock, Judd Nelson, Jules Asner, Brian O'Halloran, Jennifer Schwalbach Smith, Seann William Scott, Steven Anthony Lawrence, Art Oughton, Mark Hamill, Harley Quinn Smith, Joe Quesada, Adam Carolla, Marc Blucas, Jon Stewart, Paul Dini, Wes Craven, Morris Day, Walter Flanagan, Bryan Johnson, Jamie Kennedy, Gus Van Sant. Written and directed by Kevin Smith. 97 minutes. Rated R, 3.5 stars (out of five stars)
Review by Ed Johnson-Ott, NUVO Newsweekly www.nuvo.net Archive reviews at http://reviews.imdb.com/ReviewsBy?Edward+Johnson-Ott To receive reviews by e-mail at no charge, send subscription requests to<EMAIL_ADDRESS>or e-mail<EMAIL_ADDRESS>with the word "subscribe" in the subject line.
"Jay and Silent Bob Strike Back" is a raucous road comedy that operates on three levels. Aficionados of crude humor will howl at the obscenity-laden dialogue and raunchy sight gags. Film buffs will get dizzy keeping up with the references, re-creations and parodies of movies and rips at movie stars. And faithful followers of writer/director/actor Kevin Smith's View-Askew Universe will be in hog heaven, as virtually everyone from Smith's first four movies pops up to say "Hello."
For those of you who haven't seen "Clerks, "Mallrats," "Chasing Amy" and "Dogma," I'll try to give you a proper set-up (please bear in mind that I am far from an expert – for more information, visit www.viewaskew.com). Introduced to audiences in "Clerks," Jay (Jason Mewes) and Silent Bob (Smith) have appeared in every Smith film, as well as numerous comic books and a short-lived animated TV series. They even did a walk-on in "Scream 3."  Jay is an insult machine, with his laid-back "hetero lifemate" Silent Bob the frequent recipient of jabs attacking his weight and questioning his sexual orientation.
Jay and Silent Bob are also underground legends. In "Chasing Amy" we learned that Holden McNeil (Ben Affleck, who also appears in "J&SBSB" as himself) and Banky Edwards (Jason Lee, who also appears here briefly as "Mallrats" veteran Brodie Bruce) created a highly successful superhero comic book series, "Bluntman and Chronic," based on Jay and Silent Bob. When the two artists parted company, Holden gave the characters to Banky, who struck a lucrative deal with a Hollywood studio, which brings us to the beginning of "J&SBSB."
Are you still with me? If not, study the previous two paragraphs before you see the film. Or just settle back and let the movie flow over you.
Spoiler Alert: The following reveals numerous plot points. I suggest you read them, because knowing the plot will help you keep up with the jokes.
As "J&SBSB" opens, Jay and Silent Bob find their lives turned upside down when a restraining order bars them from holding court in front of their beloved convenience store. To make matters worse, they learn that strangers are mocking them online. Holden gives the boys (whose world is so small that they don't know what the Internet is) a crash course in Cyber Film Geekdom 101, showing them an "Ain't It Cool News" type Web site and one of its bile-filled message boards. Taking the fanboy attacks on Bluntman and Chronic personally, they decide to go after Banky, who never got permission to use their personas in the film. Jay and Silent Bob will travel to Hollywood and stop production of the Bluntman and Chronic movie, by any means necessary.
 Jay will fall in love with the beguiling Justice (Shannon Elizabeth). Her "Charlie's Angels" style friends Sissy (Eliza Dushku), Chrissy (Ali Larter), and Missy (Jennifer Schwalbach, Smith's wife), key figures in the militant animal rights group CLIT, will mock the boys, even as they agree to participate in a raid on a product testing lab. About a million clit jokes will be made as Federal Wildlife Marshal Willenholly (Will Ferrell) pursues Jay, Silent Bob and their new monkey friend across America.
In Hollywood, they will break onto a movie studio lot and watch Ben Affleck and Matt Damon rehearse for "Good Will Hunting 2: Hunting Season." Affleck and Damon will squabble with each other, taking shots at each others movies; six ("Bounce, "The Talented Mr. Ripley," "All the Pretty Horses," "The Legend of Bagger Vance," "Forces of Nature" and "Reindeer Games") in less than 20 seconds! Mark Hamill will turn up for a light saber battle and a paranoid director (Chris Rock) will rant about racism. Finally, Jay and Silent Bob will face the big screen versions of Bluntman and Chronic, played by James Van Der Beek and Jason Biggs, prompting some juicy "Dawson's Creek" and "American Pie" jokes.
You will either find the whole affair hopelessly juvenile and indulgent or you will laugh and laugh (how much depends on your knowledge of movies in general and the Smith oeuvre in particular).  If you are me, you will decide that, despite some dull spots and a few parodies that are just too easy, "Jay and Silent Bob Strike Back" is wicked fun and another feather in the cap of Kevin Smith.
© 2001 Ed Johnson-Ott
========== X-RAMR-ID: 29294 X-Language: en X-RT-ReviewID: 245687 X-RT-TitleID: 1109455 X-RT-SourceID: 591 X-RT-AuthorID: 1099 X-RT-RatingText: 3.5/5
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


Hello fellow creatures of this planet, This is what I created my second week of Digital Engineering This is my wax seal stamp that I 3-D printed using the Makerbot Printer, and designed in Fusion 360.
The stamp took roughly 25 hours to 3D print and when completed was large enough to grasp the entire handle in your hand. This is the original design for the stamp designed in Fusion 360.
This is the file you can download to replicate on your own!!!!
STL File (.stl)


Components/types upload
Edit (pull request)You cannot upload the same archive (same id and version) mutliple times. If you changed an archive, you must increment the version number so you can upload it to Alien.
Create your own component
You can find more information on TOSCA and how you can write new types in TOSCA archives here.
There are multiple ways to upload components in alien4cloud for evey one of them you must first go to the section of the main menu.
Drag you archive file > Drop it on the dash dotted area
Once upload has been completed successfully you should be able to see the node types contained in the archive in the components browsing panel.
Click on [Upload CSAR] > Select your archive (The file is automaticly uploaded)
Once upload has been completed successfully you should be able to see the node types contained in the archive in the components browsing panel.
Alien4cloud allow you to import components from git repositories. Users with COMPONENT_MANAGER role can, from the component section, access the git repository synchronization section by clicking on the left menu .
The git repositories management screen allow you to register a git repository to import and trigger the import. In order to register a new git repository click on the button. Then fill the information on the modal as specified below.
- Repository URL: This is the url of your git repository, for example https://github.com/alien4cloud/samples.git. Note that we support only http(s) urls.
- Credentials: The username and password that alien4cloud will use to connect to the github repository.
- On branch / Archive(s) to import: List of branches/sub-folders association to locate the TOSCA archive(s) to import from the git repository. The sub-folders is optional and by default alien will locate all archives within the git repository.
- Save the repository locally: If false alien4cloud will keep the repository content local, if not the git import process will fetch the repository, process the import in alien4cloud and then remove the local clone of the git repository. If true the repository local clone will not be removed from alien server. Default is false.
Alien4cloud is very flexible on the structure of your git repositories and how you keep archives within. We ourself decided to keep multiple archives within the single samples repository. This choice is a really specific choice as we tag the samples branch not following the versions of the archives but to the version of alien the samples support. You may also store multiple archives within a single git repository when all archives are sharing the same version and are packaged together. Note that in that case you have the choice of having a single archive or multiple ones. The choice here should be focused on usability and merge perspective. The devops guide section contains more information on possible choices and example on how and why you should go for one of them.
Once imported you can see the new created git location in the list:
Click on to trigger the import process. Once completed the import result is displayed with it’s state, and eventual errors, warning or info messages.
You can now browse and search for components.
Roles and security
In order to be able to add components to the repository you must have the COMPONENT_MANAGER role. Note that if the archive you wish to upload contains both tosca types (node types, relationship types etc.) and both a topology template, then you must have both the COMPONENT_MANAGER (for type upload) and ARCHITECT (for template upload) role. Note that
Upload issues
Alien 4 Cloud performs validation of your archive agains the TOSCA specification.
The following image shows the upload of an archive with an error :
When deploying on some cloud technologies alien4cloud uses some node template names in the name of the generated ressources (VMs, BlockStorage etc.). Some cloud APIs do not manage special characters as dashes or underscore. In addition some people like to set the hostname based on the name of the node template. Therefore and while this is authorized in TOSCA alien4cloud prevent naming the node template with such characters.
If a node template name contains some special character (is: not an alphanumeric character from the basic Latin alphabet and the underscore) we will automatically replace these characters.


Source code for hep_ml.preprocessing
"""
**hep_ml.preprocessing** contains useful operations with data.
Algorithms implemented here follow sklearn conventions for transformers and inherited from BaseEstimator and TransformerMixin.
Minor difference compared to sklearn is that transformations preserve names of features in DataFrames
(if it is possible).
See also: sklearn.preprocessing for other useful data transformations.
Examples
--------
Transformers may be used as any other transformer, manually training and applying:
>>> from hep_ml.preprocessing import IronTransformer
>>> transformer = IronTransformer().fit(trainX)
>>> new_trainX = transformer.transform(trainX)
>>> new_testX = transformer.transform(testX)
Apart from this, transformers may be plugged as part of sklearn.Pipeline:
>>> from sklearn.pipeline import Pipeline
>>> from hep_ml.nnet import SimpleNeuralNetwork
>>> clf = Pipeline(['pre', IronTransformer(),
>>> 'nnet', SimpleNeuralNetwork()])
Also, neural networks support special argument 'scaler'. You can pass any transformer there:
>>> clf = SimpleNeuralNetwork(layers=[10, 8], scaler=IronTransformer())
"""
from __future__ import division, print_function, absolute_import
from collections import OrderedDict
import numpy
import pandas
from sklearn.base import BaseEstimator, TransformerMixin
from .commonutils import check_sample_weight, to_pandas_dataframe, weighted_quantile
__author__ = 'Alex Rogozhnikov'
__all__ = ['BinTransformer', 'IronTransformer']
[docs]class BinTransformer(BaseEstimator, TransformerMixin):
def __init__(self, max_bins=128):
"""
Bin transformer transforms all features (which are expected to be numerical)
to small integers.
This simple transformation, while loosing part of information, can increase speed of some algorithms.
:param int max_bins: maximal number of bins along each axis.
"""
self.max_bins = max_bins
[docs] def fit(self, X, y=None, sample_weight=None):
"""Prepare transformation rule, compute bin edges.
:param X: pandas.DataFrame or numpy.array with data
:param y: labels, ignored
:param sample_weight: weights, ignored
:return: self
"""
assert self.max_bins < 255, 'Too high number of bins!'
X = to_pandas_dataframe(X)
self.percentiles = OrderedDict()
for column in X.columns:
values = numpy.array(X[column])
if len(numpy.unique(values)) < self.max_bins:
self.percentiles[column] = numpy.unique(values)[:-1]
else:
targets = numpy.linspace(0, 100, self.max_bins + 1)[1:-1]
self.percentiles[column] = numpy.percentile(values, targets)
return self
[docs] def transform(self, X, extend_to=1):
"""
:param X: pandas.DataFrame or numpy.array with data
:param int extend_to: extends number of samples to be divisible by extend_to
:return: numpy.array with transformed features (names of columns are not preserved),
dtype is 'int8' for space efficiency.
"""
X = to_pandas_dataframe(X)
assert list(X.columns) == list(self.percentiles.keys()), 'Wrong names of columns'
n_samples = len(X)
extended_length = ((n_samples + extend_to - 1) // extend_to) * extend_to
bin_indices = numpy.zeros([extended_length, X.shape[1]], dtype='uint8', order='F')
for i, column in enumerate(X.columns):
bin_indices[:n_samples, i] = numpy.searchsorted(self.percentiles[column], numpy.array(X[column]))
return bin_indices
[docs]class IronTransformer(BaseEstimator, TransformerMixin):
def __init__(self, max_points=10000, symmetrize=False):
"""
IronTransformer fits one-dimensional transformation for each feature.
After applying this transformations distribution of each feature turns into uniform.
This is very handy to work with features with different scale and complex distributions.
The name of transformer comes from https://en.wikipedia.org/wiki/Clothes_iron,
which makes anything flat, being applied with enough pressure :)
Recommended to apply with neural networks and other algorithms sensitive to scale of features.
:param symmetrize: if True, resulting distribution is uniform in [-1, 1], otherwise in [0, 1]
:param int max_points: leave so many points in monotonic transformation.
"""
self.symmetrize = symmetrize
self.max_points = max_points
[docs] def fit(self, X, y=None, sample_weight=None):
"""Fit formula. Compute set of 1-dimensional transformations.
:param X: pandas.DataFrame with data
:param y: ignored
:param sample_weight: ignored
:return: self
"""
X = to_pandas_dataframe(X)
sample_weight = check_sample_weight(X, sample_weight=sample_weight)
sample_weight = sample_weight / sample_weight.sum()
self.feature_maps = OrderedDict()
for column in X.columns:
# TODO add support for NaNs
data = numpy.array(X[column], dtype=float)
data_unique, indices = numpy.unique(data, return_inverse=True)
weights_unique = numpy.bincount(indices, weights=sample_weight)
assert len(weights_unique) == len(data_unique)
if len(data_unique) < self.max_points:
feature_quantiles = numpy.cumsum(weights_unique) - weights_unique * 0.5
self.feature_maps[column] = (data_unique, feature_quantiles)
else:
feature_quantiles = numpy.linspace(0, 1, self.max_points)
feature_values = weighted_quantile(data, quantiles=feature_quantiles, sample_weight=sample_weight)
feature_values, indices = numpy.unique(feature_values, return_index=True)
feature_quantiles = feature_quantiles[indices]
self.feature_maps[column] = (feature_values, feature_quantiles)
return self
[docs] def transform(self, X):
"""Transform data.
:param X: pandas.DataFrame with data
:return: pandas.DataFrame with transformed features
"""
X = to_pandas_dataframe(X)
assert list(X.columns) == list(self.feature_maps.keys()), \
'Columns passed {} are different from expected {}'.format(X.columns, list(self.feature_maps.keys()))
result = pandas.DataFrame(numpy.zeros(X.shape, dtype=float), columns=X.columns)
for column, (feature_values, feature_percentiles) in self.feature_maps.items():
data = numpy.array(X[column], dtype=float)
result[column] = numpy.interp(data, feature_values, feature_percentiles)
if self.symmetrize:
result = 2 * result - 1
return result


| Date/Time | {{transaction.time_stamp_str}} | Amount (Sats) | 0 || transaction.amount === 0">{{transaction.amount | number}} ({{transaction.amount * -1 | number}}) | Fees (Sats) | {{transaction.total_fees | number}} | Block Height | {{transaction.block_height | number}} | Confirmations | {{transaction?.num_confirmations | number}} |
|
No transactions available. |
|---|


Namespace: DataObjectExtension
Assembly: DataObjectExtension (DataObjectExtension.dll) version <IP_ADDRESS>
public struct Map
| Constructor | Description |
|---|---|
| Map(string, string, Func<object, object>) | Constructor of the 'Map' struct. |
| Field | Description |
|---|---|
| Convert | This delegate is used to convert the value of the source property into the type which is required by the target property. |
| Property | Description |
|---|---|
| IsEmpty | This flag tells if the struct should be considered empty. |
| SourceName | The name of the source property. |
| TargetName | The name of the target property. |


Censored¶
-
class
censored.
Tobit
(add_intercept: bool = False, compute_statistics: bool = True)¶ A regression model for censored or truncated variables
-
bootstrap
(X: numpy.ndarray)¶ Implement bootstrap method for marginal effect variance computation for Logit and Probit Bootstrap variance of marginal effects (X (n x k)) Output: (n x k) - variances for k marginal effects for the n observations
-
compute_marginal_effects
(X: numpy.ndarray, theta: numpy.ndarray, out: str = 'latent')¶ Calculate marginal effects given X and theta out:
‘latent’ : dE[y*|X]/dx ‘censored’ : dE[y|X]/dx
-
compute_statistics
()¶ Compute standard error
-
delta_method
()¶ Implement delta method for marginal effect variance computation for Logit or Probit
-
fit
(X: numpy.ndarray, y: numpy.ndarray)¶ Fit censored model, using the BFGS algorithm for MLE (minimize the negative log-likelihood)
-
get_covariance_matrix
(cov_type: str = 'sandwich')¶ Compute covariance matrix for the parameters The asymptotical variance is the inverse information matrix
-
get_dummy_columns
()¶ refresh dummy_columns list - tells which column in X is dummy variable, which one is continuous
-
get_marginal_effect_variances
(X: numpy.ndarray)¶ Calculate variance of marginal effects X (n x k) Output: (n x k) - variances for k marginal effects for the n observations
-
get_marginal_effects
(X: numpy.ndarray, variances: bool = True)¶ Calculate marginal effects X (n x k) - must follow the structure of X Output: (n x k) - k marginal effects for the n observations
variances: - variances for the (n x k) marginal effects -> return (marginals, var_marginals)
-
hessian
(theta: numpy.ndarray)¶ Compute and construct hessian at theta, the formulae found in Calzolari & Fiorentini 1993
-
information
()¶ Implement Fisher Information matrix computation
-
objective_function
(theta: numpy.ndarray)¶ negative log likelihood theta: {beta, sigma}
-
outer_product
(theta: numpy.ndarray)¶ Compute outer product of gradients at theta the formulae found in Calzolari & Fiorentini 1993
-
predict
(X, out: str = 'latent')¶ - Predict out:
‘latent’ : E[y* | X] ‘censored’ : E[y | X] ‘truncated’ : E[y | y>0,X] ‘P(censored)’ : P(y=0 | X) ‘P(uncensored)’ : P(y>0 | X)
-
score
(theta: numpy.ndarray)¶ Implement objective function derivative
-


--- layout: page title: Lean Prover Zulip Chat Archive permalink: archive/113489newmembers/47161finsetsemilatticesupbot.html ---
Hi! In finset.lean there is
instance : semilattice_inf_bot (finset α) := { bot := ∅, bot_le := empty_subset, ..finset.lattice.lattice }
but no equivalent instance for semilattice_sup_bot. Is there some good reason for this?
I don't see any reason why this is missing.
Thanks
{% endraw %}


Lorem ipsum, dolor sit amet consectetur adipisicing elit. Perferendis, quos?
Veritatis quod nihil dolorem, ut assumenda rem sed debitis obcaecati!
In laboriosam impedit ex saepe voluptatum soluta molestiae explicabo. Vero.
Magnam nostrum cumque ab consequuntur aut reprehenderit debitis aliquid facere.
Some quick example text to build on the card title and make up the bulk of the card's content.
Go somewhereSome quick example text to build on the card title and make up the bulk of the card's content.
Go somewhereSome quick example text to build on the card title and make up the bulk of the card's content.
Go somewhere


Home Page
You just finished up quite the adventure. A dragon was slayed, a precious ring was found, and the people of this land are now safe. You and your adventure party are celebrating at a local tavern. What do you do now?


--- layout: post title: San Diego Ruby Users Group categories: - sightings author: marcel published: true date: 2006-03-26 03:32:00.000000000 +01:00 ---
There is some action down in San Diego on the Ruby and Rails front. The local RUG, after some time of inactivity, is revving back up. If you live in the area and are keen on meeting up with like minded Rubyists and Railers, take a look over at Kevin Clark’s blog for more information.


--- layout: minimal title: "About me" permalink: /about/index.html description: "About me, cakism" ---
I'm a developer based in Stockholm, Sweden. I enjoy long walks in places of great natural beauty, fluffy animals and colorful stuff in general.


Uvea I.S. is a future oriented, highly dynamic company with a strong WWW interest. Our product base can be found here. We offer an informal, work from home environment. A formal, personal approach to the client is required in our service oriented vision. We follow and use leading edge technologies for communications within the company and with the clients. If technology is your friend, then you may find a home with Uvea I.S. All positions require a minimum of 6 months Internet experience, Internet access from home or "Work Space", and an excellent understanding of Internet culture.
Position(s) Available: Web Presence Sales, Advertising Sales
If you would like to offer yourself for the above position, email your resume to<EMAIL_ADDRESS>Subject:Web Presence Sales (96120200)
If you would like to offer yourself for the above position, email your resume to<EMAIL_ADDRESS>Subject:Advertising Sales (96120201)
Back to the companies.


In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code, but left the implementation of the neural network up to you (for the most part). After you've submitted this project, feel free to explore the data and the model more.
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
A critical step in working with neural networks is preparing the data correctly. Variables on different scales make it difficult for the network to efficiently learn the correct weights. Below, we've written the code to load and prepare the data. You'll learn more about this soon!
data_path = 'Bike-Sharing-Dataset/hour.csv'
rides = pd.read_csv(data_path)
rides.head()
This dataset has the number of riders for each hour of each day from January 1 2011 to December 31 2012. The number of riders is split between casual and registered, summed up in the cnt
column. You can see the first few rows of the data above.
Below is a plot showing the number of bike riders over the first 10 days in the data set. You can see the hourly rentals here. This data is pretty complicated! The weekends have lower over all ridership and there are spikes when people are biking to and from work during the week. Looking at the data above, we also have information about temperature, humidity, and windspeed, all of these likely affecting the number of riders. You'll be trying to capture all this with your model.
rides[:24*10].plot(x='dteday', y='cnt')
Here we have some categorical variables like season, weather, month. To include these in our model, we'll need to make binary dummy variables. This is simple to do with Pandas thanks to get_dummies()
.
dummy_fields = ['season', 'weathersit', 'mnth', 'hr', 'weekday']
for each in dummy_fields:
dummies = pd.get_dummies(rides[each], prefix=each, drop_first=False)
rides = pd.concat([rides, dummies], axis=1)
fields_to_drop = ['instant', 'dteday', 'season', 'weathersit',
'weekday', 'atemp', 'mnth', 'workingday', 'hr']
data = rides.drop(fields_to_drop, axis=1)
data.head()
To make training the network easier, we'll standardize each of the continuous variables. That is, we'll shift and scale the variables such that they have zero mean and a standard deviation of 1.
The scaling factors are saved so we can go backwards when we use the network for predictions.
quant_features = ['casual', 'registered', 'cnt', 'temp', 'hum', 'windspeed']
# Store scalings in a dictionary so we can convert back later
scaled_features = {}
for each in quant_features:
mean, std = data[each].mean(), data[each].std()
scaled_features[each] = [mean, std]
data.loc[:, each] = (data[each] - mean)/std
We'll save the last 21 days of the data to use as a test set after we've trained the network. We'll use this set to make predictions and compare them with the actual number of riders.
# Save the last 21 days
test_data = data[-21*24:]
data = data[:-21*24]
# Separate the data into features and targets
target_fields = ['cnt', 'casual', 'registered']
features, targets = data.drop(target_fields, axis=1), data[target_fields]
test_features, test_targets = test_data.drop(target_fields, axis=1), test_data[target_fields]
We'll split the data into two sets, one for training and one for validating as the network is being trained. Since this is time series data, we'll train on historical data, then try to predict on future data (the validation set).
# Hold out the last 60 days of the remaining data as a validation set
train_features, train_targets = features[:-60*24], targets[:-60*24]
val_features, val_targets = features[-60*24:], targets[-60*24:]
Below you'll build your network. We've built out the structure and the backwards pass. You'll implement the forward pass through the network. You'll also set the hyperparameters: the learning rate, the number of hidden units, and the number of training passes.
The network has two layers, a hidden layer and an output layer. The hidden layer will use the sigmoid function for activations. The output layer has only one node and is used for the regression, the output of the node is the same as the input of the node. That is, the activation function is $f(x)=x$. A function that takes the input signal and generates an output signal, but takes into account the threshold, is called an activation function. We work through each layer of our network calculating the outputs for each neuron. All of the outputs from one layer become inputs to the neurons on the next layer. This process is called forward propagation.
We use the weights to propagate signals forward from the input to the output layers in a neural network. We use the weights to also propagate error backwards from the output back into the network to update our weights. This is called backpropagation.
Hint: You'll need the derivative of the output activation function ($f(x) = x$) for the backpropagation implementation. If you aren't familiar with calculus, this function is equivalent to the equation $y = x$. What is the slope of that equation? That is the derivative of $f(x)$.
Below, you have these tasks:
self.activation_function
in __init__
to your sigmoid function.train
method.train
method, including calculating the output error.run
method.class NeuralNetwork(object):
def sigmoid(self,x):
return 1/(1+np.exp(-x))
def identity(self,x):
return x
def identity_derivative(self):
return 1
def sigmoid_derivative(self,x):
sigmoid(x)*(1-sigmoid(x))
def __init__(self, input_nodes, hidden_nodes, output_nodes, learning_rate):
# Set number of nodes in input, hidden and output layers.
self.input_nodes = input_nodes
self.hidden_nodes = hidden_nodes
self.output_nodes = output_nodes
# Initialize weights
self.weights_input_to_hidden = np.random.normal(0.0, self.hidden_nodes**-0.5,
(self.hidden_nodes, self.input_nodes))
self.weights_hidden_to_output = np.random.normal(0.0, self.output_nodes**-0.5,
(self.output_nodes, self.hidden_nodes))
print("weights_hidden_to_output " + str(self.weights_hidden_to_output) )
self.lr = learning_rate
#### Set this to your implemented sigmoid function ####
# Activation function is the sigmoid function
self.activation_function = self.sigmoid
def train(self, inputs_list, targets_list):
# Convert inputs list to 2d array
inputs = np.array(inputs_list, ndmin=2).T
targets = np.array(targets_list, ndmin=2).T
#### Implement the forward pass here ####
### Forward pass ###
# TODO: Hidden layer
hidden_inputs = np.dot(self.weights_input_to_hidden,inputs)# signals into hidden layer
hidden_outputs = self.activation_function(hidden_inputs)# signals from hidden lay\er
#print("hidden_inputs shape " + str(hidden_inputs.shape))
#print("hidden_outputs shape " + str(hidden_outputs.shape))
# TODO: Output layer
final_inputs = np.dot(self.weights_hidden_to_output,hidden_outputs)# signals into final output layer
#print("final input shape " + str(final_inputs))
final_outputs = self.identity(final_inputs)# signals from final output layer
#print("final output shape " + str(final_outputs.shape))
#### Implement the backward pass here ####
### Backward pass ###
# TODO: Output error
output_errors = (targets-final_outputs)*self.identity_derivative()# Output layer error is the difference between desired target and actual output.
#print("output_errors shape " + str(output_errors.shape))
# TODO: Backpropagated error
# 1- error from output to hidden
hidden_errors = np.dot(output_errors,self.weights_hidden_to_output) # errors propagated to the hidden layer
hidden_grad = hidden_outputs * (1-hidden_outputs) # hidden layer gradients
#print("hidden_errors " + str(hidden_errors.shape))
#print("hidden_grad " + str(hidden_grad))
#print("input shape " + str(inputs.shape))
# TODO: Update the weights
self.weights_hidden_to_output +=self.lr*(output_errors*hidden_outputs.T)# update hidden-to-output weights with gradient descent step
#print("final weights_hidden_to_output " + str(self.weights_hidden_to_output))
self.weights_input_to_hidden +=self.lr*(hidden_errors.T*inputs.T)*hidden_grad# update input-to-hidden weights with gradient descent step
def run(self, inputs_list):
# Run a forward pass through the network
inputs = np.array(inputs_list, ndmin=2).T
#### Implement the forward pass here ####
# TODO: Hidden layer
#print("inputs_list shape" + str(inputs_list.shape))
#print ("weights_input_to_hidden shape " +str(self.weights_input_to_hidden.shape) )
hidden_inputs = np.dot(self.weights_input_to_hidden,inputs)# signals into hidden layer
#print ("hidden_inputs shape " +str(hidden_inputs.shape) )
hidden_outputs =self.activation_function(hidden_inputs) # signals from hidden layer
#print ("hidden_outputs shape " +str(hidden_outputs.shape) )
# TODO: Output layer
final_inputs = np.dot(self.weights_hidden_to_output,hidden_outputs)# signals into final output layer
final_outputs = self.identity(final_inputs)# signals from final output layer
return final_outputs
def MSE(y, Y):
return np.mean((y-Y)**2)
Here you'll set the hyperparameters for the network. The strategy here is to find hyperparameters such that the error on the training set is low, but you're not overfitting to the data. If you train the network too long or have too many hidden nodes, it can become overly specific to the training set and will fail to generalize to the validation set. That is, the loss on the validation set will start increasing as the training set loss drops.
You'll also be using a method know as Stochastic Gradient Descent (SGD) to train the network. The idea is that for each training pass, you grab a random sample of the data instead of using the whole data set. You use many more training passes than with normal gradient descent, but each pass is much faster. This ends up training the network more efficiently. You'll learn more about SGD later.
This is the number of times the dataset will pass through the network, each time updating the weights. As the number of epochs increases, the network becomes better and better at predicting the targets in the training set. You'll need to choose enough epochs to train the network well but not too many or you'll be overfitting.
This scales the size of weight updates. If this is too big, the weights tend to explode and the network fails to fit the data. A good choice to start at is 0.1. If the network has problems fitting the data, try reducing the learning rate. Note that the lower the learning rate, the smaller the steps are in the weight updates and the longer it takes for the neural network to converge.
The more hidden nodes you have, the more accurate predictions the model will make. Try a few different numbers and see how it affects the performance. You can look at the losses dictionary for a metric of the network performance. If the number of hidden units is too low, then the model won't have enough space to learn and if it is too high there are too many options for the direction that the learning can take. The trick here is to find the right balance in number of hidden units you choose.
import sys
### Set the hyperparameters here ###
epochs = 1000
learning_rate = 0.031
hidden_nodes = 5
output_nodes = 1
N_i = train_features.shape[1]
network = NeuralNetwork(N_i, hidden_nodes, output_nodes, learning_rate)
losses = {'train':[], 'validation':[]}
for e in range(epochs):
# Go through a random batch of 128 records from the training data set
batch = np.random.choice(train_features.index, size=128)
for record, target in zip(train_features.ix[batch].values,
train_targets.ix[batch]['cnt']):
network.train(record, target)
# Printing out the training progress
train_loss = MSE(network.run(train_features), train_targets['cnt'].values)
val_loss = MSE(network.run(val_features), val_targets['cnt'].values)
sys.stdout.write("\rProgress: " + str(100 * e/float(epochs))[:4] \
+ "% ... Training loss: " + str(train_loss)[:5] \
+ " ... Validation loss: " + str(val_loss)[:5])
losses['train'].append(train_loss)
losses['validation'].append(val_loss)
print("training completed!!!")
plt.plot(losses['train'], label='Training loss')
plt.plot(losses['validation'], label='Validation loss')
plt.legend()
plt.ylim(ymax=0.5)
Here, use the test data to view how well your network is modeling the data. If something is completely wrong here, make sure each step in your network is implemented correctly.
fig, ax = plt.subplots(figsize=(8,4))
mean, std = scaled_features['cnt']
predictions = network.run(test_features)*std + mean
ax.plot(predictions[0], label='Prediction')
ax.plot((test_targets['cnt']*std + mean).values, label='Data')
ax.set_xlim(right=len(predictions))
ax.legend()
dates = pd.to_datetime(rides.ix[test_data.index]['dteday'])
dates = dates.apply(lambda d: d.strftime('%b %d'))
ax.set_xticks(np.arange(len(dates))[12::24])
_ = ax.set_xticklabels(dates[12::24], rotation=45)
Answer these questions about your results. How well does the model predict the data? Where does it fail? Why does it fail where it does?
Note: You can edit the text in this cell by double clicking on it. When you want to render the text, press control + enter
Run these unit tests to check the correctness of your network implementation. These tests must all be successful to pass the project.
import unittest
inputs = [0.5, -0.2, 0.1]
targets = [0.4]
test_w_i_h = np.array([[0.1, 0.4, -0.3],
[-0.2, 0.5, 0.2]])
test_w_h_o = np.array([[0.3, -0.1]])
class TestMethods(unittest.TestCase):
##########
# Unit tests for data loading
##########
def test_data_path(self):
# Test that file path to dataset has been unaltered
self.assertTrue(data_path.lower() == 'bike-sharing-dataset/hour.csv')
def test_data_loaded(self):
# Test that data frame loaded
self.assertTrue(isinstance(rides, pd.DataFrame))
##########
# Unit tests for network functionality
##########
def test_activation(self):
network = NeuralNetwork(3, 2, 1, 0.5)
# Test that the activation function is a sigmoid
self.assertTrue(np.all(network.activation_function(0.5) == 1/(1+np.exp(-0.5))))
def test_train(self):
# Test that weights are updated correctly on training
network = NeuralNetwork(3, 2, 1, 0.5)
network.weights_input_to_hidden = test_w_i_h.copy()
network.weights_hidden_to_output = test_w_h_o.copy()
network.train(inputs, targets)
self.assertTrue(np.allclose(network.weights_hidden_to_output,
np.array([[ 0.37275328, -0.03172939]])))
self.assertTrue(np.allclose(network.weights_input_to_hidden,
np.array([[ 0.10562014, 0.39775194, -0.29887597],
[-0.20185996, 0.50074398, 0.19962801]])))
def test_run(self):
# Test correctness of run method
network = NeuralNetwork(3, 2, 1, 0.5)
network.weights_input_to_hidden = test_w_i_h.copy()
network.weights_hidden_to_output = test_w_h_o.copy()
self.assertTrue(np.allclose(network.run(inputs), 0.09998924))
suite = unittest.TestLoader().loadTestsFromModule(TestMethods())
unittest.TextTestRunner().run(suite)


|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface TwiMaster
An interface for controlling a TWI module, in TWI bus-master mode, enabling communication with multiple TWI-enabled slave modules.
TWI (Two-Wire Interface) is a common hardware communication protocol,
enabling half-duplex, synchronous point-to-multi-point data transfer. It
requires a physical connection of two lines (SDA, SCL) shared by all the bus
nodes, where the SDA is open-drain and externally pulled-up. TwiMaster
instances are obtained by calling
IOIO.openTwiMaster(int, ioio.lib.api.TwiMaster.Rate, boolean)
.
TWI is the generic name for the specific I2C and SMBus protocols, differing mostly by the voltage levels they require. This module supports both.
A TWI transaction is comprised of optional sending of a data buffer from the
master to a single slave, followed by an optional reception of a data buffer
from that slave. Slaves are designated by addresses, which may be 7-bit
(common) or 10-bit (less common). TWI transactions may fail, as a result of
the slave not responding or as result of the slave NACK'ing the request. Such
a transaction is executed using the
writeRead(int, boolean, byte[], int, byte[], int)
method.
The instance is alive since its creation. If the connection with the IOIO drops at any point, the instance transitions to a disconnected state, in
The instance is alive since its creation. If the connection with the IOIO
drops at any point, the instance transitions to a disconnected state, in
which every attempt to use it (except Closeable.close()
) will throw a
ConnectionLostException
. Whenever Closeable.close()
is invoked the
instance may no longer be used. Any resources associated with it are freed
and can be reused.
Typical usage:
// Uses the SDA1/SCL1 pins, I2C volatege levels at 100KHz.
TwiMaster twi = ioio.openTwiMaster(1, TwiMaster.RATE_100KHz, false);
final byte[] request = new byte[]{ 0x23, 0x45 };
final byte[] response = new byte[3];
if (twi.writeRead(0x19, false, request, 2, response, 3)) {
// response is valid
...
} else {
// handle error
}
twi.close(); // free TWI module and pins
IOIO.openTwiMaster(int, ioio.lib.api.TwiMaster.Rate, boolean)
| Nested Class Summary | |
|---|---|
static class |
TwiMaster.Rate
|
static interface |
TwiMaster.Result
An object that can be waited on for asynchronous calls. |
| Method Summary | |
|---|---|
boolean |
writeRead(int address,
boolean tenBitAddr,
byte[] writeData,
int writeSize,
byte[] readData,
int readSize)
Perform a single TWI transaction which includes optional transmission and optional reception of data to a single slave. |
TwiMaster.Result |
writeReadAsync(int address,
boolean tenBitAddr,
byte[] writeData,
int writeSize,
byte[] readData,
int readSize)
Asynchronous version of writeRead(int, boolean, byte[], int, byte[], int) . |
| Methods inherited from interface ioio.lib.api.Closeable |
|---|
close |
| Method Detail |
|---|
boolean writeRead(int address, boolean tenBitAddr, byte[] writeData, int writeSize, byte[] readData, int readSize) throws ConnectionLostException, java.lang.InterruptedException
address
- The slave address, either 7-bit or 10-bit. Note that in some
TWI device documentation the documented addresses are actually
2x the address values used here, as they regard the trailing
0-bit as part of the address.tenBitAddr
- Whether this is a 10-bit addressing mode.writeData
- The request data.writeSize
- The number of bytes to write. Valid value are 0-255.readData
- The array where the response should be stored.readSize
- The expected number of response bytes. Valid value are 0-255.
ConnectionLostException
- Connection to the IOIO has been lost.
java.lang.InterruptedException
- Calling thread has been interrupted.TwiMaster.Result writeReadAsync(int address, boolean tenBitAddr, byte[] writeData, int writeSize, byte[] readData, int readSize) throws ConnectionLostException
writeRead(int, boolean, byte[], int, byte[], int)
. Returns
immediately and provides a TwiMaster.Result
object on which the client can
wait for the result.
ConnectionLostException
writeRead(int, boolean, byte[], int, byte[], int)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


nips nips2010 nips2010-120 nips2010-120-reference knowledge-graph by maker-knowledge-mining
Source: pdf
Author: Jan Gasthaus, Yee W. Teh
Abstract: The sequence memoizer is a model for sequence data with state-of-the-art performance on language modeling and compression. We propose a number of improvements to the model and inference algorithm, including an enlarged range of hyperparameters, a memory-efﬁcient representation, and inference algorithms operating on the new representation. Our derivations are based on precise deﬁnitions of the various processes that will also allow us to provide an elementary proof of the “mysterious” coagulation and fragmentation properties used in the original paper on the sequence memoizer by Wood et al. (2009). We present some experimental results supporting our improvements. 1
[1] F. Wood, C. Archambeau, J. Gasthaus, L. F. James, and Y. W. Teh. A stochastic memoizer for sequence data. In Proceedings of the International Conference on Machine Learning, volume 26, pages 1129–1136, 2009.
[2] J. Gasthaus, F. Wood, and Y. W. Teh. Lossless compression based on the Sequence Memoizer. In James A. Storer and Michael W. Marcellin, editors, Data Compression Conference, pages 337–345, Los Alamitos, CA, USA, 2010. IEEE Computer Society.
[3] Y. W. Teh. A Bayesian interpretation of interpolated Kneser-Ney. Technical Report TRA2/06, School of Computing, National University of Singapore, 2006.
[4] J. Pitman. Coalescents with multiple collisions. Annals of Probability, 27:1870–1902, 1999.
[5] M. W. Ho, L. F. James, and J. W. Lau. Coagulation fragmentation laws induced by general coagulations of two-parameter Poisson-Dirichlet processes. http://arxiv.org/abs/math.PR/0601608, 2006.
[6] Y. W. Teh, M. I. Jordan, M. J. Beal, and D. M. Blei. Hierarchical Dirichlet processes. Journal of the American Statistical Association, 101(476):1566–1581, 2006.
[7] P. Blunsom, T. Cohn, S. Goldwater, and M. Johnson. A note on the implementation of hierarchical Dirichlet processes. In Proceedings of the ACL-IJCNLP 2009 Conference Short Papers, pages 337–340, Suntec, Singapore, August 2009. Association for Computational Linguistics.
[8] J. Pitman and M. Yor. The two-parameter Poisson-Dirichlet distribution derived from a stable subordinator. Annals of Probability, 25:855–900, 1997.
[9] H. Ishwaran and L. F. James. Gibbs sampling methods for stick-breaking priors. Journal of the American Statistical Association, 96(453):161–173, 2001.
[10] L. C. Hsu and P. J.-S. Shiue. A uniﬁed approach to generalized Stirling numbers. Advances in Applied Mathematics, 20:366–384, 1998.
[11] Y. W. Teh. A hierarchical Bayesian language model based on Pitman-Yor processes. In Proceedings of the 21st International Conference on Computational Linguistics and 44th Annual Meeting of the Association for Computational Linguistics, pages 985–992, 2006.
[12] Y. Bengio, R. Ducharme, P. Vincent, and C. Jauvin. A neural probabilistic language model. Journal of Machine Learning Research, 3:1137–1155, 2003. 9


This all happened less than an hour ago.
I'm in my freshly cleaned dorm room, lights off except for a red rope light, and Brian Eno ambient music is playing in the background. I got an ounce of dried Salvia leaf in the mail today (along with 65 HBWR seeds and a gram of Salvia 5x), so I thought it would be a good opportunity to try the quid method of taking Salvia. Of course by 'good opportunity' I mean that I have the drugs and there are no pressing matters I have to attend to.
So I make two quids, each with about 8 dried leaves crushed and wrapped up in a bit of coffee filter.  After 20 minutes of that all I was noticing was a bit of a sparkle in my vision, so I took it out and popped in the other one. I lay down on my bed and felt like my body was levitating above the bed a couple of feet, which was kind of pleasant but I could imagine it being more 'pleasant' on certain other drugs. My vision was pretty much normal, except for a bit of 'sparkle vision' and this shadow-figure that kept appearing for a couple seconds on the wall right in front of me. The longer I chewed the quids the more defined the figure became, and it seemed masculine which surprised me since, if anything, I was expecting Lady Salvia to come greet me.
I spat out the second quid because it didn't seem like anything major was going to happen with that method tonight, and I packed a single leaf into a bubbler.
After the first hit I was definitely in sub-breakthrough Salvia-space. This space is hard to describe... it's not like any other 'psychedelic space'. I think the main difference is that I have no control over Salvia space.
I take the second hit and go lie down on my bed again.  I use the word 'God' instead of 'figure' because by this point his power was undeniable. I felt like I was about to break through into something intense, since my brain and body felt like they were being literally pulled away from my current resting place. I have experienced this sensation on Salvia before, but never with such force. At first I tried to relax and go with it, but I wasn't getting anywhere. It became uncomfortable, and I wished I would either break through or come down. I tried to fight it by ignoring it, and that seemed to work. However, I believe I was tricked into thinking I could fight it, because the next thing I knew I was packing another leaf and sparking it up. I toked it down in two big hits and sat back into my canvas chair... but only for a second...
The next thing I knew I was standing up. I had not willed myself to stand up. I felt a VERY strong urge to take a step to my right. Then another step. And another.
'Wait! I am in control of where I go, and I'm staying right here!'
Yeah right. The urge to keep walking was undeniable. I reached my desk and felt like I was being 'allowed' to put my bowl and lighter back in my drawer. Then I realized my destination was my bed, so I surrendered to the urge and lay down on my bed.
Once I was on my bed I felt a huge relief, although I hoped that Salvia was going to play nice at this point.
Then I began to sink into my bed and felt like I was becoming one with the bed. I was looking down at my body and noticed it started to turn into scales. The scales then became what I can only describe as living, breathing Plant-Eyes. It was clear to me that these Plant-Eyes (which soon engulfed my entire body and most of the room around me) were slaves to the Shadow God. Since I was made of these Plant-Eyes (and since I wasn't even completely in control of my own body) I was also a slave to the Shadow God.
But being a slave wasn't that bad. Actually I was grateful for the Shadow God's forceful means of showing me this, because otherwise I wouldn't have had that experience.
After a few minutes of this (I had no time distortion, by the way) I thought I was coming down, and noticed I had to pee, so I walked down the hall to my bathroom, with the intention of going back to my room afterwards. However, several times in the bathroom I was tricked (by the Salvia / Shadow God) into being convinced that I actually had intended to go downstairs into the common room where my friends were watching a movie. Then I would remind myself, repeatedly, that I actually was going to go back to my room.
Of course I went straight down to the common room, but by the time I got down there I was mostly back to baseline, but still in awe of what just happened and how I could be manipulated so easily by Salvia.
So, the experience freaked me out just a little, but not too much. It certainly wasn't 'enjoyable' or 'recreational' but it most certainly was 'weird' and 'powerful'. It was also the first time I have been controlled by an entity =)
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


| Interface | Description |
|---|---|
| Test | |
| TestResult |
| Class | Description |
|---|---|
| FixedSecureRandom |
A secure random that returns pre-seeded data to calls of nextBytes() or generateSeed().
|
| FixedSecureRandom.BigInteger |
BigInteger Source - in this case we expect requests for data that will be used
for BigIntegers.
|
| FixedSecureRandom.Data |
Data Source - in this case we just expect requests for byte arrays.
|
| FixedSecureRandom.Source |
Base class for sources of fixed "Randomness"
|
| NumberParsing |
Parsing
|
| SimpleTest | |
| SimpleTestResult | |
| TestRandomBigInteger |
A fixed secure random designed to return data for someone needing to create a single BigInteger.
|
| TestRandomData |
A fixed secure random designed to return data for someone needing random bytes.
|
| TestRandomEntropySourceProvider |
A class for returning "quick entropy" for testing purposes.
|
| UncloseableOutputStream |
This is a testing utility class to check the property that an
OutputStream is never
closed in some particular context - typically when wrapped by another OutputStream that
should not be forwarding its OutputStream.close() calls. |
| Exception | Description |
|---|---|
| TestFailedException |


Total Tests
1
Failed Tests
0 (0%)
Skipped Tests
0 (0%)
Execution Time
67.1 s
Failed Tests (0)
Skipped Tests (0)
Passed Tests (1)
Test27
67.1 s