Questions tagged [bind]

This tag means different things in different contexts: consider using less ambiguous tags instead. Common meanings include: the bind function in socket programming; binding to naming contexts; the bind method in jQuery; BIND the DNS server (named), . For boost::bind in C++, use [boost-bind]. Do not use this tag just to say that you're binding something to something else.

bind
Filter by
Sorted by
Tagged with
831 votes
23 answers
577k views

What is the use of the JavaScript 'bind' method?

What is the use of bind() in JavaScript?
Sandy's user avatar
  • 14k
741 votes
24 answers
869k views

jQuery Event Keypress: Which key was pressed?

With jQuery, how do I find out which key was pressed when I bind to the keypress event? $('#searchbox input').bind('keypress', function(e) {}); I want to trigger a submit when ENTER is pressed. [...
BlaM's user avatar
  • 28.7k
316 votes
41 answers
900k views

Docker Error bind: address already in use

When I run docker-compose up in my Docker project it fails with the following message: Error starting userland proxy: listen tcp 0.0.0.0:3000: bind: address already in use netstat -pna | grep 3000 ...
Ngoral's user avatar
  • 4,504
225 votes
10 answers
81k views

Removing event listener which was added with bind

In JavaScript, what is the best way to remove a function added as an event listener using bind()? Example (function(){ // constructor MyClass = function() { this.myButton = document....
takfuruya's user avatar
  • 2,533
164 votes
12 answers
189k views

Update Angular model after setting input value with jQuery

I have this simple scenario: Input element which value is changed by jQuery's val() method. I am trying to update the angular model with the value that jQuery set. I tried to write a simple ...
Michal J.'s user avatar
  • 1,765
151 votes
14 answers
277k views

javax.xml.bind.JAXBException Implementation of JAXB-API has not been found on module path or classpath

I'm trying to run my Spring Boot application on Java 9, and I've faced with JAXB problem, which described in the guides, but didn't work for me. I've added dependency on JAXB api, and application ...
S34N's user avatar
  • 7,961
150 votes
9 answers
317k views

jQuery how to bind onclick event to dynamically added HTML element [duplicate]

I want to bind an onclick event to an element I insert dynamically with jQuery But It never runs the binded function. I'd be happy if you can point out why this example is not working and how I can ...
Jesper Rønn-Jensen's user avatar
144 votes
6 answers
67k views

How to bind an unbound method without calling it?

In Python, is there a way to bind an unbound method without calling it? I am writing a wxPython program, and for a certain class I decided it would be nice to group the data of all of my buttons ...
Dan Passaro's user avatar
  • 4,277
89 votes
4 answers
145k views

What does it mean to bind a multicast (UDP) socket?

I am using multicast UDP between hosts that have multiple network interfaces. I am using boost::asio, and am confused by the 2 operations receivers have to make: bind, then join-group. Why do you ...
haelix's user avatar
  • 4,395
86 votes
12 answers
78k views

Blazor: How to use the onchange event in <select> when using @bind also?

I need to be able to run a function after a selection in made in a <select>. The issue is I'm also binding with @bind and I get a error when I try to use @onchange stating that it is already in ...
Mike's user avatar
  • 1,159
79 votes
5 answers
56k views

Why use std::bind over lambdas in C++14?

Before C++11 I used boost::bind or boost::lambda a lot. The bind part made it into the standard library (std::bind) the other part became part of the core language (C++ lambdas) and made the use of ...
Ralph Tandetzky's user avatar
74 votes
8 answers
46k views

Bind Vs Lambda?

I have a question about which style is preferred: std::bind Vs lambda in C++0x. I know that they serve -somehow- different purposes but lets take an example of intersecting functionality. Using ...
Khaled Alshaya's user avatar
68 votes
4 answers
6k views

Why is the bind operator (>>=) defined as it is?

I have been studying Haskell for several weeks now (just for fun) and just watched Brian Beckman's great video introducing monads. He motivates monads with the need to create a more general ...
broken.eggshell's user avatar
65 votes
10 answers
45k views

What is the difference between the bind and live methods in jQuery?

I'm curious to know the differences between the bind and live functions. To me they seem to be almost identical. I read the benefits of live/bind methods, but it didn't tell me about the differences....
Kevin Brown's user avatar
  • 12.7k
64 votes
2 answers
157k views

Understanding ASP.NET Eval() and Bind()

Can anyone show me some absolutely minimal ASP.NET code to understand Eval() and Bind()? It is best if you provide me with two separate code-snippets or may be web-links.
user366312's user avatar
  • 16.6k
64 votes
5 answers
187k views

React - TypeError: Cannot read property 'props' of undefined

I'm trying to create a click event be able to delete an item on my list, but when I click it I get "TypeError: Cannot read property 'props' of undefined". I'm trying to stick to ES6 as much as ...
pyan's user avatar
  • 875
63 votes
15 answers
285k views

Cannot assign requested address using ServerSocket.socketBind

When I'm trying to set up a socket server, I've got an error message: Exception in thread "main" java.net.BindException: Cannot assign requested address: JVM_Bind at java.net.PlainSocketImpl....
Adrian Adamczyk's user avatar
62 votes
4 answers
67k views

Why is bind() used in TCP? Why is it used only on server side and not in client side?

I wanted to know the exact function of bind() in TCP. What does it mean by 'binding' a local address to the socket? If it's assigning a port number to the socket, then why don't we use it in the ...
Crocode's user avatar
  • 3,106
55 votes
2 answers
25k views

What does binding a Rails Server to 0.0.0.0 buy you?

I am using "www.xip.io" as a DNS wildcard for testing on different devices. I set my primary domain to my IP address. I fire up a rails server with bundle exec rails server and I go here www.<...
andy4thehuynh's user avatar
55 votes
4 answers
11k views

Why is JavaScript bind() necessary?

The problem in example 1 is 'this' referring to the global name instead of the myName object. I understand the use of bind() in setting the value of this to a specific object, so it solves the ...
Tom's user avatar
  • 1,656
51 votes
4 answers
35k views

.live() vs .bind() [duplicate]

I want to know the main difference between .live() vs. .bind() methods in jQuery.
Pranay Rana's user avatar
50 votes
6 answers
125k views

jQuery bind/unbind 'scroll' event on $(window)

I have this function: function block_scroll(key){ if (key) { $(window).bind("scroll", function(){ $('html, body').animate({scrollTop:0}, 'fast'); }); } else { ...
o01's user avatar
  • 5,315
46 votes
2 answers
223k views

How to enable named/bind/DNS full logging? [closed]

I am trying to find the perfect logging clause in named.conf that would help me enable full-level logs for named service. Can someone give an example here? My current clause is given below, but this ...
deppfx's user avatar
  • 711
46 votes
4 answers
44k views

Why does click event handler fire immediately upon page load?

I playing around with a function that I want to bind to all the links. At the present the function fires when the page loads, instead of when I click on the link. Here's my code. (I can post the ...
Jeff's user avatar
  • 3,963
44 votes
4 answers
20k views

php closures: why the 'static' in the anonymous function declaration when binding to static class?

The example in the php documentation on Closure::bind include static on the anonymous function declaration. why? I can't find the difference if it is removed. with: class A { private static $...
learning php's user avatar
  • 1,204
44 votes
13 answers
44k views

SQLite: bind list of values to "WHERE col IN ( :PRM )"

all I want to do is send a query like SELECT * FROM table WHERE col IN (110, 130, 90); So I prepared the following statement SELECT * FROM table WHERE col IN (:LST); Then I use sqlite_bind_text(...
Sebastian's user avatar
  • 2,219
40 votes
3 answers
63k views

Remove focus programmatically?

I have a jquery ui dialog with tabs loaded dynamically/JSON with content. Due to the complexity, I can't really post a fiddle or a relevant code (too much code). What's happening is that when the ...
Jason's user avatar
  • 7,612
40 votes
2 answers
16k views

When should I use std::bind?

Every time I need to use std::bind, I end up using a lambda instead. So when should I use std::bind? I just finished removing it from one codebase, and I found that lambdas were always simpler and ...
gnzlbg's user avatar
  • 7,295
39 votes
6 answers
106k views

(ubuntu) nginx: [emerg] bind() to 0.0.0.0:80 failed (13: permission denied)

I need help figuring out the root cause of this permission denied error. What permissions does nginx need? Why is it so complicated?
user2350858's user avatar
37 votes
5 answers
49k views

JQuery event model and preventing duplicate handlers

Once again I want to load a page which contains its own script into a div using $("divid").load(...). The problem I face is related to events. Let's say we trigger("monkey") from the parent page and ...
Mr AH's user avatar
  • 1,110
36 votes
5 answers
50k views

HAProxy doesn't start, can not bind UNIX socket [/run/haproxy/admin.sock]

I'm trying to start haproxy (version 1.5.8 2014/10/31) with an "empty" config file and I get: user@server:~$ sudo service haproxy start [....] Starting haproxy: haproxy[ALERT] 126/120540 (7363) : ...
Balazs Varhegyi's user avatar
36 votes
2 answers
57k views

dig returns SERVFAIL but +trace works

Here is the main problem: dig maktabkhooneh.info +trace works perfectly fine and returns the right answer. dig maktabkhooneh.info (without +trace) returns: ; <<>> DiG 9.8.1-P1 <<&...
Hamed Tabatabaei's user avatar
34 votes
5 answers
15k views

How to bind DataTemplate datatype to interface?

I am writing a composite loosely coupled MVVM WPF application and child VMs in a parent VM are interfaces rather than class instances, e.g. public IChildViewModel { get; set; } Now how do I render ...
Charlie's user avatar
  • 784
33 votes
3 answers
18k views

what's the difference between 'call/apply' and 'bind' [duplicate]

var obj = { x: 81, getX: function() { console.log( this.x) } }; var getX = obj.getX.bind(obj);//use obj as 'this'; getX();//81 var getX = function(){ obj.getX.apply(obj); } getX();//...
bennyrice's user avatar
  • 333
33 votes
3 answers
37k views

Bind more arguments of an already bound function in Javascript

I try to sort my thoughts about how javascript's bind() works. I see that if I do var f = function (a) { ... } var g = f.bind(obj); g(1) then f is called with obj as this and 1 as a. What I ...
Martin Pecka's user avatar
  • 3,023
33 votes
1 answer
151k views

Detect user scroll down or scroll up in jQuery [duplicate]

Possible Duplicate: Differentiate between scroll up/down in jquery? Is it possible to detect if user scroll down or scroll up ? Example : $(window).scroll(function(){ // IF USER SCROLL ...
Steffi's user avatar
  • 6,917
33 votes
1 answer
14k views

Lambda functions vs bind, memory! (and performance)

I would like to determine which is the best practice between equivalent solutions. The use case is an instance of a class that listen to an event. Dr. Axel Rauschmayer prefers the lambda for ...
Paleo's user avatar
  • 22.7k
32 votes
4 answers
82k views

jQuery: trigger a hover event from another element

When you hover over one <div>, I want an <a> on a separate part of the page to be "hovered" on also. <div class="initiator"> </div> <div> <a class="receiver href="#...
Don P's user avatar
  • 61.8k
32 votes
4 answers
40k views

Using cbind on an arbitrarily long list of objects

I would like to find a way to create a data.frame by using cbind() to join together many separate objects. For example, if A, B, C & D are all vectors of equal length, one can create data.frame ...
rtyro's user avatar
  • 321
31 votes
5 answers
17k views

What is the difference between $.proxy() and bind()?

In 2009, ECMAScript 5 added a built-in bind() function which takes an object as a parameter and returns an identical function in which this will always refer to the object you passed it. (I couldn't ...
Max Cantor's user avatar
  • 8,277
31 votes
2 answers
62k views

template argument deduction/substitution failed, when using std::function and std::bind

I have a compile error when using std::function in a templated member function, the following code is a simple example: #include <functional> #include <memory> using std::function; using ...
haipeng31's user avatar
  • 637
30 votes
4 answers
96k views

bind a jquery function to fancybox .close() event

I would like to trigger a simple jQuery function based on a fancybox closing. it is the only fancybox on the page $.fn.fancybox.close = function() { $('#sub_cont').hide(250, function() { $('#...
Jeff Voss's user avatar
  • 3,657
30 votes
2 answers
20k views

Communicate with foreground service android

First question here, but I've been around for a while. What do I have: I'm building an Android app which plays audio streams and online playlists. Everything is working fine now, but I'm having ...
ores's user avatar
  • 433
30 votes
1 answer
26k views

std::bind to std::function?

I get a compile error using this: std::vector<std::function<int(int)>> functions; std::function<int(int, int)> foo = [](int a, int b){ return a + b; }; std::function<int(int)>...
Philipp H.'s user avatar
  • 1,583
29 votes
2 answers
32k views

How to bind a socket to multiple interfaces

After hours of searching on the internet, I still wasn't able to find an answer for my problem. My task is to create a server that accepts sockets from a variable number of interfaces (given in a ...
Hynek Blaha's user avatar
28 votes
4 answers
74k views

Uncaught TypeError: Object [object Object] has no method 'on'

Can anyone help me to figure this out ? When I use the latest (or a newish) version of jQuery, the small script below works fine. However, when I use older versions of jQuery, my script says that the ...
dvlden's user avatar
  • 2,432
28 votes
2 answers
89k views

first unbind click and then bind (jquery)

1.I have a onclick event on, $('#locations').click(function(){ $('#train').unbind('click'); //do some stuff } 2.Once the close button is clicked $('.close').click(function(){ //do some stuff } ...
Prithviraj Mitra's user avatar
28 votes
3 answers
59k views

Binding multiple values in pdo

Is there's an easy way of binding multiple values in PDO without repitition ? Take a look at the following code : $result_set = $pdo->prepare("INSERT INTO `users` (`username`, `password`, `...
Yousuf Memon's user avatar
  • 4,708
28 votes
4 answers
11k views

Can I bind to a function that takes default arguments and then call it?

How can I bind to a function that takes default arguments, without specifying the default arguments and then call it without any arguments? void foo(int a, int b = 23) { std::cout << a <&...
Stephan Dollberg's user avatar
26 votes
3 answers
6k views

Can I get an unbound function from a bound function in JavaScript?

I'm getting my head wrapped about currying and other techniques using Function.prototype.bind. It seems extremely useful to change function scope (i.e., this value) in certain situations. However it ...
Dan Abramov's user avatar

1
2 3 4 5
81