Posts

javascript - How to get all text from all textboxes with class txt_Answer -

<table id="tb_answers"> <tbody> <td> <input class="txt_answer" placeholder="enter answer"> </td> <td> <td colspan="4"> </tr> </tbody> <tr> <td> <input class="txt_answer" placeholder="enter answer"> </td> <td> <td> </tr> <tr> <td> <input class="txt_answer" placeholder="enter answer"> </td> </tr> </table> i got 3 inputs answers.how text/answer class txt_answer tried this $('*[class="txt_answer"]').val() but returns me first value not of thaem by iterating , creating array $.map : var values = $.map($('input.txt_answer'), function(el) {return el.value;}); fiddle you should validate html, it's not valid

How to solve Illegal inheritance from final class in Scala -

i have code in scala when define a value, call methods in object setstr , useful , amazing. when define aclass final, compiler throws exception illegal inheritance final class. in cases should use final classes , type of method calling after class initiation useful me, , question how solve problem test("test function call") { val a: aclass = new aclass { setstr("pooya") func1(this) } } class aclass { // when declare class final, compiler raise error private var str:string="" def setstr(str:string)={ this.str=str } def amethod() = print(str) } def func1(a: aclass) { a.amethod() } when new aclass { ... } creating anonymous class extends class. when class final cannot extended. one way want that: val a: aclass = new aclass import a._ setstr("pooya") func1(this) following @vladimir's suggestion, cleaner way: val a: aclass = { val = new aclass import a._ sets...

ruby on rails - Updating password with BCrypt -

when login username , password bcrypt checks no problem, fine. but when go through process of recovering password , try login new password bcrypt never returns true. the code have follows: before_save :encrypt_password before_update :encrypt_password def authenticate player = player.find_by(mail: self.mail) unless player.nil? current_password = bcrypt::password.new(player.password) if current_password == self.password player else nil end end end private def encrypt_password unless self.password.nil? self.password = bcrypt::password.create(self.password) end i'm using rails 4 you don't need before_update callback. when creating new record (user in case), before_save triggered. right behavior. but when updating record, both before_update , before_save triggered, means password column encrypted twice. that's why unexpected behavior. check this page more information callbacks. what's more, think it...

html5 - Is it okay not to close HTML tags like <img> with />? -

i learned close html tags img , meta etc. this: <img src="..." /> <meta charset="..." /> <hr /> <br /> <input type="..." /> but i've seen numerous sites don't put /> @ end. put > @ end. results in: <img src="..."> <meta charset="..."> <hr> <br> <input type="..."> but me doesn't seem right... how can browser know if tag still needs closed somewhere when that? that's how learned years ago. but twitter bootstrap closing input tags without /> @ end. is valid html? , preferred way of doing it? <foo /> xml syntax. meaningful in xml (including xhtml). however, let deal html. how can browser know if tag still needs closed somewhere when that? some elements have required end tags. these must have explicit </foo> some elements cannot have child nodes , must not have explicit </foo> . example ...

android - Specifying resource qualifier -

my app being developed region users have english default language. however, app allows user choose local language. since user not setting device's overall language, default string resources called. possible resource specific qualifier e.g. values-myqualifier/strings.xml? if want set diffrent locale application can use following code: locale locale = new locale(countycode); locale.setdefault(locale); configuration config = new configuration(); config.locale = locale; getbasecontext().getresources().updateconfiguration(config, getbasecontext().getresources().getdisplaymetrics()); oncreate(null); check resourcebundle

Perl- print hash values while the key is matched -

i trying print hash values using html tags inside perl code. instead of values 1 . happens when try print hash values inside sub . right way ? package shembull; %rhash= ( lbl_name => "l", lbl_surname => "g", txt_nameemri => "n", txt_surname => "m", btn_submit => "submit", ); sub lbl_input { $value = @_; return "<label>".$value."</label>"; } sub txt_input { $value = @_; return "<textarea>".$value."</textarea>"; } sub btn_input { $value = @_; return"<button>".$value."</button>"; } foreach $tmp (keys %rhash){ if($tmp =~/lbl/){ print lbl_input ($rhash{$tmp}); } elsif($tmp =~/txt/){ print txt_input ($rhash{$tmp}); } elsif($tmp =~/btn/){ print btn_input ($rhash{$tmp}); } } what may e reason? thank ! my $value = @_; this put number o...

java ee - selectOneMenu Converter -

this question has answer here: validation error: value not valid 2 answers hi every body i'm working on primfaces pages , have make selectonemenu wich items database tried make way still have problem's converter source codes folowing : selectonemenu : <p:selectonemenu id="devises" required="true" value="#{pret.devise}" effect="fade" converter="devise"> <f:selectitem itemlabel="select one" itemvalue="" /> <f:selectitems value="#{devise.listdevise()}" var="devise" itemlabel="#{devise.nomdevise}" itemvalue="#{devise}"/> </p:selectonemenu> converter code: @facesconverter(value = "devise") public class deviseconverter implements converter{ public static list<devise> devises = devise....