Posts

c++ - I need some clarification regarding this example on Stroustrup's new book about ADL -

i reproduce below argument-dependent lookup (adl) example given in pages 396 , 397 of stroustrup book (4th edition): namespace n { struct s { int i; }; void f(s); void g(s); void h(int); }; struct base { void f(n::s); }; struct d : base { void mf(n::s); void g(n::s x) { f(x); // call base::f() mf(x); // call d::mf() h(1); // error: no h(int) available } }; what comments above correct (i've tested it), doesn't seem agree author says in next paragraph: in standard, rules argument-dependent lookup phrased in terms of associated namespaces (iso §3.4.2). basically: if argument class member , associated namespaces class (including base classes) , class's enclosing namespaces. if argument member of namespace, associated namespaces enclosing namespaces. if argument built-in type, there no associated namespaces. in example, x , has type n::s not member of class d , nor of base...

Selecting html elements with jquery based on div and some other attribute -

this question has answer here: selecting element data attribute 10 answers i have html code: <p class="test" data-id=1>some value</p> <p class="test" data-id=2>some value</p> <p class="test" data-id=3>some value</p> <p class="test" data-id=4>some value</p> how can select <p> element based on data-id ? with jquery: alert($("p[data-id='1']").html()); demo jquery - attribute selector

c# - Cannot insert Phone Number into Database (MS Access File) -

i'm creating database app; ms access database file. happens inserted correctly, not phone numbers. when entering phone number application working throws me exception. i've double checked coding , database , can't figure out why issue caused. here's part of code. private void btn_save_click(object sender, eventargs e) { { try { oledbcommand dbcmd = new oledbcommand(); dbcmd.commandtype = commandtype.text; dbcmd.commandtext = "insert tbl_clientinfo (firstname, lastname, address, zipcode, city, state, country, language, phonenr, mobilenr)" + "values (@firstname, @lastname, @address, @zipcode, @city, @state, @country, @language, @phonenr, @mobilenr)"; dbcmd.parameters.addwithvalue("@firstname", txt_firstname.text); dbcmd.parameters.addwithvalue("@lastname", txt_lastname.text); dbcmd.parameter...

java - Same resource in two different servlets -

is possible have same resource in 2 different classes in 2 different servlets? i want this: public class one{ @resource(name="subscriptionservice") private subscriptionservice subscriptionservice; } public class two{ @resource(name="subscriptionservice") private subscriptionservice subscriptionservice; } @service("subscriptionservice") @transactional public class subscriptionservice { } there 2 different servlet class 1 , class 2 there 2 different instances of subscriptionservice. there way this? edit: web.xml <?xml version="1.0" encoding="utf-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <!-- definition of root spring container shared servlets , f...

javascript - Cannot get proper expression -

how can write following javascript coffeescript foo.bar(function() { dosomething(); })(x, y); for instance, following doesn't work: foo.bar -> dosomething() (x, y) something this: f -> ... (x, y) is little ambiguous in coffeescript since (x, y) valid expression on own. since things of form f(g(x)) , f(g) more common f(g)(x) , ambiguity resolved 2 statements: f -> ... and (x, y) when parser resolves ambiguity in way don't want, solution resolve ambiguity forcing desired interpretation parentheses: foo.bar(-> dosomething() )(x, y) that becomes this javascript : foo.bar(function() { return dosomething(); })(x, y); that may or may not have same effect javascript you're trying achieve. if foo.bar cares return value of argument then return dosomething(); and just dosomething(); can quite different; implicit "return last expression's value" in coffeescript can trip up. 1 example jquery...

constraints - How to pin buttons to the bottom iOS7 Autolayout -

Image
i having hardest time positioning items on scroll view. in 3.5" work fine, in 4" higher want them be. want buttons tied bottom of screen in both cases. should possible pinning , constraints, believe. no matter works in 1 not in other , wise versa. if let auto layout add own constraints worse if define manually. had same problem 3 buttons @ top somehow managed though place them under should top bar. lost ...

Is Boolean a Built-in Enum in C? -

i wondering if boolean built-in enumeration. according wikipedia ~ "some enumerator types may built language. boolean type, example pre-defined enumeration of values false , true." http://en.wikipedia.org/wiki/enumerated_type in c , other languages, boolean enum? , if not - can explain why? the question more of abstract, philosophical question "what type" c. in c, (more or less) integer @ heart, misses point. when "integer" referring arithmetic type, i.e. 1 arithmetic operations addition , multiplication make sense. by contrast, enumerative type type holds collection of discrete values have no further structure among them. property enumerative value has itself; there no operations on other checking equality. forgetfully, integers enumerative type (they enumerate number of shoes can have on shoe rack, sizes of herds of sheep), there's more them - have internal structure given arithmetic operations admit. a boolean val...