Bind jQuery UI autocomplete using .live()

jQuery UI autocomplete function automatically adds the class “ui-autocomplete-input” to the element. I’d recommend live binding the element on focus without the “ui-autocomplete-input” class to prevent re-binding on every keydown event within that element. $(“.foo:not(.ui-autocomplete-input)”).live(“focus”, function (event) { $(this).autocomplete(options); }); Edit My answer is now out of date since jQuery 1.7, see Nathan Strutz’s comment … Read more

react-native onPress binding with an argument

You can do the binding in the constructor by using ES6: export default class Nav extends Component { constructor(props) { super(props); this.onPress = this.onPress.bind(this); } and then onPress(txt) { console.log(txt); } render() { return ( <View> <Text>####################</Text> <Text>Intro Screen</Text> <Text>Number: {this.props.numbers}</Text> <TouchableHighlight onPress={() => this.onPress(‘foo’)}> <Text>Go to Foo</Text> </TouchableHighlight> </View> ); } }

Do bindings nested inside of a lazy one-time ng-repeat binding bind just once?

Scenario 1: <li ng-repeat=”item in ::items”>{{::item.name}}</li> Both expressions will be one-time bound. Adding an item or changing an existing item’s name will not be reflected. Demo: http://plnkr.co/edit/53r8FCmcNK4MmM6Uzxp2?p=preview Scenario 2: <li ng-repeat=”item in ::items”>{{item.name}}</li> First expression will be one-time bound. Adding an item will not be reflected. Changing an existing item’s name will be reflected. Demo: … Read more

Angular 2 output from router-outlet

<router-outlet></router-outlet> can’t be used to emit an event from the child component. One way to communicate between two components is to use a common service. Create a service shared-service.ts import { Observable } from “rxjs/Observable”; import { Injectable } from “@angular/core”; import { Subject } from “rxjs/Subject”; @Injectable() export class SharedService { // Observable string … Read more

MVVM: Binding radio buttons to a view model?

If you start with Jason’s suggestion then the problem becomes a single bound selection from a list which translates very nicely to a ListBox. At that point it’s trivial to apply styling to a ListBox control so that it shows up as a RadioButton list. <ListBox ItemsSource=”{Binding …}” SelectedItem=”{Binding …}”> <ListBox.ItemContainerStyle> <Style TargetType=”{x:Type ListBoxItem}”> <Setter … Read more

Let vs. Binding in Clojure

let creates a lexically scoped immutable alias for some value. binding creates a dynamically scoped binding for some Var. Dynamic binding means that the code inside your binding form and any code which that code calls (even if not in the local lexical scope) will see the new binding. Given: user> (def ^:dynamic x 0) … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)