Posts

Showing posts from September, 2013

How to check for the presence of an item in a Python tuple without encountering a ValueError? -

for'ing on tuples consisting of (spendcampaign, adset, adcontent) (each value changing on each loop, want catch when last item in tuple same last item in tuple in saved mapping oldadmapping (a tuple of tuples). if adcontent == oldadmapping[oldadmapping.index((spendcampaign, adset, adcontent))][2] i see breaks down valueerror (and equality check doesn't executed) whenever (spendcampaign, adset, adcontent) tuple not exist in oldadmapping . for dicts, have has_key() function allows check if key in dict while avoiding keyerror if it's not. there similar tuples? if not, what's best way of checking presence of item in tuple wuthout encountering valueerror ? you validate if tuple contains it: if (spendcampaign, adset, adcontent) in oldadmapping: index = oldadmapping.index((spendcampaign, adset, adcontent)) and in condition use index if adcontent == oldadmapping[index][2]: ...

css - Twitter Bootstrap 3 Media queries -

if suppose device width 800px, media query apply (execute)? @media screen , (min-width : 320px){ } /* small devices, phones */ @media screen , (min-width : 480px){ } /* small devices, tablets */ @media screen , (min-width : 768px){ } /* medium devices, desktops */ @media screen , (min-width : 992px){ } /* large devices, wide screens */ @media screen , (min-width : 1200px){ } if write css device having screen size between 768px 991px , declare it's css in media query @media screen , (min-width : 768px){ } then first 2 media queries gets applied how avoid this. you can use 3 media query 800px of width based on option @media screen , (min-width : 320px){ } /* small devices, phones */ @media screen , (min-width : 480px){ } /* small devices, tablets */ @media screen , (min-width : 768px){ }

Run php script with PHP-FPM -

i have installed nginx , php-fpm according http://blog.frd.mn/install-nginx-php-fpm-mysql-and-phpmyadmin-on-os-x-mavericks-using-homebrew/ visiting php webpage , php code not been rendered <?php echo 'test' ?>

uicollectionviewcell - Two column UICollectionView with header -

Image
i have layout has 2 columns side side. there simple way using single uicollectionview? requirements solution must work ios 8 , cells must stack vertically in each column this: ----------------- | | | b | ----------------- | c | e | | c | f | | d | | | e | | ----------------- the stacked cs demonstrate cells in left , right columns can different heights, it's not enough paint them left, right, left, right. this pretty straightforward using uicollectionview flow layout. since each cell can have dynamic height, thing need require each cell has width of 160 (or half collection view width). implement collectionview:layout:sizeforitematindexpath: each item can return it's appropriate height. since each cell has dynamic height though, end 1 column lot longer another. if want equal column heights, you'll want shuffle order of list in such way height first half of items approx

linux - How do I use epoll? -

i know interest in file descriptor registered epoll_ctl, can not find info on how use epoll. if want read , write files asynchronously, how do it? use normal read , write calls? call these functions before or after calling epoll_wait, , mark file descriptors used nonblock? you're mixing concepts. epoll(7) not same thing asynchronous i/o. select(2) , poll(2) , epoll(7) , other similar functions can block whether or not underlying file descriptors blocking or non-blocking; provide synchronous form of notification - system doesn't tell until explicitly ask it. the point of select(2) , poll(2) , family can i/o multiplexing: single blocking call, can wait interesting events in given set of file descriptors. not same asynchronous i/o. posix asynchronous i/o, on other hand, uses aio control blocks describe i/o operations ( struct aiocb ), , performed aio_read(3) , aio_write(3) , aio_return(3) , aio_suspend(3) . unless have reason this, don't - complicates

javascript - Finding an item without ID -

i've got set of divs different classes. there 40 divs 4 classes set randomly. need jquery script makes "background-color: white" on every grid-item click. tried this: $('.grid-item').click(function(){ $(this).css("background-color", "white"); }) but wasn't idea guess.. ..because didn't work! can me out, please? $('body').on('click', 'div', function(e){ $(this).css("background-color","white"); });

c# - Input string was not in a correct format even i have the right values in it -

i have shopping cart website. when submit "submit order button" giving me error saying input string not in correct format. below, have code declared variables. public class shoppingcart { public string categoryname; public int categoryid; public int productid; public int customerid; public string productname; public string productimage; public string productprice; public string productdescription; public int productquantity; public string bankdepositimage; public string customername; public string customeremailid; public string customerphoneno; public string customeraddress; public string productlist; public string paymentmethod; public string orderstatus; public string orderno; public int totalproducts; public int totalprice; public int stocktype; public int flag; in code textboxes. shoppingcart k = new shoppingcart() { customername = txtcustomer

javascript - arcade physics collision callback for group vs self -

im checking group collision within using code // creating group , adding sprites policecarsgroup = game.add.group(); addpolicecars(4 , policecarsgroup); and in update function game.physics.arcade.collide(policecarsgroup); it work fine there no callback function how set tried game.physics.arcade.collide(policecarsgroup,function(){ alert(""); }); but not working question how set collision callback function . you need pass second parameter collide method check collision against, hence it's third parameter callback. see the documentation . try this: game.physics.arcade.collide(policecarsgroup, policecarsgroup, function() { alert("collision!"); }); haven't tried it, should work.

matlab: creating additional variables in a for loop -

i got following problem: in code want matrix-...-matrix-vector in loop. in every loop want additional matrix multiply with, e.g. i=1: p1*z , i=2: p1*p2*z etc. code far. computing: i=1: p1*z, i=2: p2*z etc... for ii = 1:10 % projection on last_z projected_last_z = projection(:,:,ii) * last_z; end it considered bad practice create new variables in loop want. better collect results in cell array or so: n = 10; results = cell(1, n); % preallocate space = 1:n results{i} = some_calculation(i); end; you can retrieve result of k-th iteration using results{k} .

puppet - docker enterprise solution? -

i'm looking paid docker solution ( enterprise or plugin ) can take files repositories in artifactory , create docker image out of them. does such plugin exist? i'm not sure if should have pre-built 'base' image , add files artifactory or if should build entire image scratch . my solution: use docker through puppet. i've set puppet call docker script create image artifactory files. docker script runs hello world since i'm getting started docker , learning commands. see docker creating image have no idea stored. (maybe doesn't store it?) is there proper/standard way i'm trying accomplish here? there paid solutions this? i'm not devops please don't use devops jargon. thanks! in order information related docker images stored, can execute "docker info" command. sudo if required. reference: https://docs.docker.com/reference/commandline/info/ coming placing files in repository docker, kind of files ? docker has abili

node.js - Access a Service Bus Queue from a Custom API -

i have azure service bus queue set rest access. set queue accessible , can add messages c# command line client. want create list of apis mobile apps interact various parts of cloud solution. problem can't access queue custom api. seems straight forward enough. exports.get = function(request, response) { var accountname = "myservicebusnamespace"; var accountkey = "servicebuskey"; var servicebusservice = azure.createservicebusservice(accountname, accountkey); servicebusservice.createqueueifnotexists("mysbqueuename", function (error) { if (error) { console.log(error); } }); servicebusservice.sendqueuemessage("mysbqueuename", "message", function (error, res) { if (error) { console.log(error); } }); }; the error logged is: { [error: getaddrinfo enotfound] code: 'enotfound', errno: 'enotfound', syscall: 'getaddrinfo' } which indicates there's problem getting add

c++ - Qt- How to know about visibility of QDialog? -

is there anyway check visibility of specific qdialog? trying check this. here code: messagedialog::messagedialog(qwidget *parent, int id, qstring name, qpixmap *photo) : qdialog(parent), m_id(id), m_name(name) { // ... if (messagedialog.isvisible()) qdebug()<<"visbile"; else qdebug()<<"invisible"; } i'm getting error: error: expected primary-expression before '.' token if (messagedialog.isvisible()) the problem trying call non-static function on messagedialog class. should call isvisible() function on dialog object, in case, should use this or call isvisible() . if ( this->isvisible() ) // if ( isvisible() ) qdebug()<<"visbile"; else qdebug()<<"invisible"; but think won't either, because in constructor dialog not yet visible.

java - Reverse Routing Play with POST payload -

i have following use case wanted use reverse routing. project com.xyz.controllers --> hello.java -- result sayhello(); --> hellowrapper.java -- wrapsayhello() following routes file : post /hello @com.xyz.controllers.hello.sayhello() sayhello expects json body in request , reads of using request().body().asjson() how can 1 use reverse routing , have payload sent in request. see using reverse routing in wrapsayhello() method, can call method this routes.hello.sayhello() but have no clue on how send in json in request body original method expects any thoughts helpful ..

c# - Web Api "Optimize Code" breaks routes -

i'm having issue when build web api project in release. reason, 404 response when access web api route. if turn off 'optimize code' release builds, routes work expected. server running windows 2008 r2, iis 7.5. i'm using ninject ioc if matters @ all. i've tried using http://blogs.msdn.com/b/webdev/archive/2013/04/04/debugging-asp-net-web-api-with-route-debugger.aspx still 404. this works if running locally (win7). turns out running bug: http://aspnetwebstack.codeplex.com/workitem/1075 the production server missing assembly. although wasn't able find through tracing, fusion logs, etc, after upgrading 5.2.3, problem went away.

scala - Akka actors not receiving Array[Byte]? -

i trying write actor counts messages receives , prints when hits specific number of messages seen. i got work when sending messages actor string, when try send , array[bytes], actor doesn't perform it's receive function, doesn't invoke catch else case. code handling strings works: class countingactor extends actor { val log = logging(context.system, this) val starttime = system.currenttimemillis var count = 0 val actorname = self.path.name def count: actor.receive = { case message: string => count += 1 if(count % 50000 == 0 && count != 0){ var elapsed = (system.currenttimemillis - starttime) / 1000.0 var mps = count / elapsed log.info(s"processed $count messages in $elapsed ($mps msg/s) in $actorname") } case _ => log.info("something happened , dont know, wasn't string") } def receive = count } the code fails process , array[byte] same specify case array[by

Excel - cell matching -

Image
if value in column c matches value in column a, value in corresponding value in d should reflect in column b can done vlookup formula this: produces result identical sample:

javascript - Google Scripts external spreadsheet data validation -

i interested in automating data validation of google spreadsheet against google spreadsheet using google scripts. can't seem find way reference range of spreadsheet using openbyid method. thoughts? function externalsheetdatavalidation() { var cell = spreadsheetapp.getactiverange(); //var datavalidationsheet = spreadsheetapp.getactivespreadsheet().getsheetbyname("datavalidationrules"); //var datavalidationsheet = spreadsheetapp.openbyurl("https://docs.google.com/spreadsheets/d/10z2s1bsrihzzbbrmfpmhephnpx-kjdv3lllbv0l59g8/edit#gid=0"); var datavalidationsheet = spreadsheetapp.openbyid("10z2s1bsrihzzbbrmfpmhephnpx-kjdv3lllbv0l59g8"); var sheet = datavalidationsheet.getsheets()[0]; var range = spreadsheetapp.getactivesheet().getrange("a3:a4"); var rule = spreadsheetapp.newdatavalidation() .requirevalueinrange(range, true) .setallowinvalid(false) .build(); cell.setdatava

javascript - JQuery UI Sorting Breaks A Element Href Links -

example https://jsfiddle.net/e80tl2kl/ to start can click text in bars , open google in new tab. proceed click edit button , able drag tabs around not able click text open google. click edit again , should disable movement , enable links again. however clicking text of bar has been moved not open link on first click clicking second time will. for example i'm using $('a').attr('onclick', 'return true;'); to re-enable links. however have tried using: $('a').attr('onclick', ''); $('a').attr('onclick', null); $('a').attr('onclick', '').unbind('click'); $('a').prop('onclick',null).off('click'); all of have same result. why "first click doesn't work after moving" happen , how can fix it? probably bug jquery-ui , can fix easily. there's bind doesn't unbind on disable . can unbind manually thi

java - How to use variables defined in an if statement outside of it -

i have been trying make calculator , when define variables inside if statement says: exception in thread "main" java.lang.error: unresolved compilation problem: blocknum cannot resolved variable @ firsttry.main.main(main.java:57) now know have define variables outside of if statements, because of variable scope, when try so: package firsttry; import java.util.scanner; public class main { public static void main(string args[]){ int blocknum; blocknum = 1; i error of: exception in thread "main" java.lang.error: unresolved compilation problem: duplicate local variable blocknum @ firsttry.main.main(main.java:36) so how fix problem? have read solution problem variable scope define variable outside of if statement, doesnt seem work me? my full code: package firsttry; import java.util.scanner; public class main { public static void main(string args[]) { int blocknum; block

DB2 equivalent to SQL Server's SYSJOBS -

i db2 novice , need or pointers in right direction. need capture following fields (or similar) in db2, can capture in sql server following sql code, select jobs.name ,jstep.step_name ,jstep.command sysjobs jobs inner join sysjobsteps jstep on jstep.job_id = jobs.job_id jobs.name = 'some_job_name' surely, there's similar db2. but, can't seem find or google right combinations of key words. appreciated. db2 uses administrative task scheduler (ats). view need systools.admin_task_list . on side note, status of each task in systools.admin_task_status . hth.

google api - Rails: Fetch user information from youtube -

i'm using rails. can information user's playlists, channels, videos if user authenticated via google? thx! so, if use google youtube , user authenticated, , need find videos or channels related user should use: gem 'yt' documentation it helped me

HTML CSS No Color Showing -

the css colors selecting won't show , don't know if glitch or error i've checked everything. body { margin: 0; padding: 0; font-family: sans-serif; } header { backround-color: #00795; width: 100%; padding: 40px 0; color: white; text-align: center; } nav ul { backround-color: #43a286; overflow: hidden; color: white; padding: 0; text-align: center; margin: 0; } { text-decoration: none; color: inherit; } nav ul li { display: inline-block; padding: 20px; } nav ul li:hover { backround-color: #399077; } section { line-height: 1.5em; font-size: 0.9em; padding: 40px; width: 75% margin 0 auto; } <header> <h1> best website since google </h1> </header> <nav> <ul> <a href="#"> <li>home</li> &l

html - How to get text to stay in position on browser and device scale -

i got copy im needing put in footer. can position .special how nicely when browser set 1920px view, if change resolution or device looking @ position of text starts shift out of position. have tried using percentages when reaches point still not @ desired static position id be. so there way make div .special stay in same position regardless of scale not want cross on or move far away divder div .divide. id same .reason positioned on other side of .divide div im wanting .special text stay in position stay same on scale changes (sorry site isnt live cant link much, general idea me tweak help, thanks!) here html , css relevant topic: <!--===================================================content===================================================!--> <div class="contentwrap"> <div class="textwrap"> <div class="special"> <p>specializations</p> <p>with various skills in bra

javascript - AJAX post form won't work. It does absolutely nothing -

there error in code , there js file included inside page prevented executing inside $(document).ready(function () { ... i'm trying sumbit login form: <form class="form" id="ajaxform"> <input type="text" name="username" placeholder="username"> <input type="password" name="password" placeholder="password"> <button type="submit" id="login-button">login</button> </form> via ajax code: var request; $("#ajaxform").submit(function(event){ // abort pending request if (request) { request.abort(); } // setup local variables var $form = $(this); // let's select , cache fields var $inputs = $form.find("input, select, button, textarea"); // serialize data in form var serializeddata = $form.serialize(); // let's disable inputs duration of ajax requ

java - Update (and grow) dialog when new components are added -

i've got jdialog window user can add components manually "+" knob. i window resized automatically after each addition. pack() works before dialog set visible. visible, doesn't change de windows dimension. is there alternate/complementary way pack() ? kind regards, is there alternate/complementary way pack() ? no, use pack() call not re-lay out components resize containing top-level window (here jdialog). but visible, doesn't change de windows dimension. it doesn't matter if window visible. if pack() called on visualized top-level window ( big if), will change window's dimensions, if gui using layout managers properly. if yours not being changed, perhaps you're not calling method on correct reference or not using layouts in way, , in situation, want show pertinent code. your question begs question -- why not use pack() ? if it's because changes being done jpanel held jdialog, can dialog or whatever top-leve

refresh function for treeview wpf c# -

i have treeview: <treeview name="files" margin="0,0,569,108" grid.row="1" itemssource="{binding s1}" > <treeview.itemtemplate> <hierarchicaldatatemplate itemssource="{binding members}" > <stackpanel orientation="horizontal"> <image source="folder.jpg" margin="0,0,5,0" width="20" height="20"/> <textblock text="{binding name}" /> <textblock text=" ["/> <textblock text="{binding count}"/> <textblock text="]"/> </stackpanel> <hierarchicaldatatemplate.itemtemplate> <datatemplate> <checkbox content="{binding content}" checked="filecheckbox_checked" unchecked="filecheckbox_unchecked" /

.htaccess - htaccess: one controller under root control all pages under all subdomains without redirect -

i need htaccess file under root folder. please see photo url: site structure (sorry, can not upload image here) i have lots of cities folder subdomains, not wish every subdomain needs separated admin, wish can control them under same admin page. so if want : ny.example.com/news.php ==> example.com/controller/ny/news ( or example.com/controller.php?city=ny&section=news) how can write htaccess file please ? in root htaccess, add these rules : rewriteengine on rewritebase / rewritecond %{http_host} ^([^.]+)\.example\.com$ [nc] rewriterule ^ controller/%1/news/ [r,l] rewritecond %{request_filename} !-d rewriterule ^controller/([^/]+)/([^/]+)/?$ controller.php?city=$1&section=$2 [nc,l]

html - ul list gets hidden under a div -

i've been having issue in different places have ul list , im trying add on top of div (image, or background) list not appear on top. wonder if gets sent in back..i added z-index jsfiddle css .toolbar p{ text-align: right; padding: 10px 180px 0 0; color: #fff; font-size: 26px; z-index: 1; } .toolbar { width: auto; height: 50px; background-color: #cc1e2c; z-index: 1;} .social-icons { z-index: 2;} html <div class="col_full toolbar"> <p>call now: +1 555.555.1234</p> <ul class="social-icons"> <li> <a href="graphics/twitter_icon.jpg" target="_blank"> </a></li> <li> <a href="graphics/instagram_icon.jpg" target="_blank"> </a></li> <li> <a href="graphics/facebook_icon.jpg" target="_blank"> </a></li> </ul>

apache - Warnings and errors appearing on site after changing ubuntu user permissions Amazon EC2 server -

my site running on ec2 amazon server under ubuntu/apache2. my site running fine until changed permissions user 'ubuntu' doing command: chown -r ubuntu /var/www/html now site spitting out warning messages , errors :( www.kaysboutique.co.uk i did because wanted able write files via filezilla after following answer: amazon aws filezilla transfer permission denied fixed running these: sudo chown www-data -r /var/www/html if not fixed, run sudo chown -r www-data /var/www/html

hibernate - ClassNotFound : javax.persistence.Persistence when creating entity Manager Factory -

Image
i working on project jsf , hibernate. i divided project 3 layers (view, service, dao) in service layer creating instance of dao class, when reaching persistence.createentitymanagerfactory("e_gym") throws exception, see below blocks public abstract class basedao<t> implements serializable { private static final long serialversionuid = 1l; //the next line #18 private static final entitymanagerfactory emf = persistence.createentitymanagerfactory("e_gym"); //.... } public class techniqueservice implements serializable { private static final long serialversionuid = -853877188695729368l; private techniquedao techniquedao = new techniquedao(); public techniqueservice() {} //crud service methods... } here persistence.xml file: <?xml version="1.0" encoding="utf-8"?> http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="e_gym" transaction-t

java - How to use subclass methods in superclass? -

i have superclass called parameter. there many different types of parameters , have different methods of course. problem initialize parameter 1 of subs still doesn't allow me use subclass events! package com.lbg.c2; public class parameter { private string type; public static final parameter numberparam = new numberparam(); public static final parameter stringparam = new stringparam(); public static final parameter anytypeparam = new anytypeparam(); public static final parameter animationparam = new animationparam(); public static final parameter audioparam = new audioparam(); public static final parameter cmpparam = new cmpparam(); public static final parameter combooptionparam = new combooptionparam(); public static final parameter comboparam = new comboparam(); public static final parameter keybparam = new keybparam(); public static final parameter layerparam = new layerparam(); public static final parameter layoutparam = new layoutparam(); public static final paramet

How to I remove file from git repository but NOT have it removed from post_receive target? -

i'm new git thing. i'm using (yeah right) maintain own website files between local pc , remote webserver. there files, such settings , .htaccess files, want on server left alone after push. now... of them thought ahead , put .gitignore file @ start of , fine. others i've discovered since... add them .gitignore , still clobbered on push! ignored on local side sure. think happening files not getting transfered remove repo, copy in remote repo getting post_received processed on destination , poof . so tried "remove" once pushed, removed file final destination too! not @ want! so how can a) ignore file on destination end , b) remove remote repo , c) still have local copy untouched? gitignore correct way it. should fine if restore/generate files again on destination computer. remove made git delete files.

scala.js - Overload private constructor with polymorphic arguments in Scala -

i'm curious best solution in scala: class myclass private (x: any, y: int) { def this(x: int, y: int) = this(x, y) def this(x: string, y: int) = this(x, y) } val x0 = new myclass(1, 1) val x1 = new myclass("1", 1) //val x2 = new myclass(1.0, 1) // correctly doesn't typecheck the error below doesn't make lot of sense me, because appears viable constructor defined before auxiliary constructor: error:(3, 31) called constructor's definition must precede calling constructor's definition def this(x: int, y: int) = this(x, y) ^ for more context, i'm trying deal javascript apis in scala.js functions take parameter can either string or js.object , think exemplifies issue. ascribing type any explicitly help: class myclass private (x: any, y: int) { def this(x: int, y: int) = this(x: any, y) def this(x: string, y: int) = this(x: any, y) } in case, constructors call recursively, nonsensical.

shell - How to treat a file use awk -

i want read file using awk got stuck on fourth field automatically breaks after comma. data:- test.txt "a","b","ls","this,is,the,test" "k","o","mv","this,is,the,2nd test" "c","j","cd","this,is,the,3rd test" cat test.txt | awk -f , '{ ofs="|" ;print $2 $3 $4 }' output "b"|"ls"|"this "o"|"mv"|"this "j"|"cd"|"this but output should this "b"|"ls"|"this,is,the,test" "o"|"mv"|"this,is,the,2nd test" "j"|"cd"|"this,is,the,3rd test" any idea use gnu awk fpat: $ awk -v fpat='([^,]+)|(\"[^\"]+\")' -v ofs='|' '{print $2,$3,$4}' file "b"|"ls"|"this,is,the,test" "o"|"mv"|"this,is

ios - How to redraw my view in SWIFT? -

on ipad app, have uiviewcontroller button open modalview. @ibaction func showpostcommentviewcontroller(sender: anyobject){ let modalview = uistoryboard(name: "main", bundle: nil).instantiateviewcontrollerwithidentifier("postcommentviewcontroller") as! postcommentviewcontroller modalview.modaltransitionstyle = uimodaltransitionstyle.coververtical modalview.modalpresentationstyle = uimodalpresentationstyle.formsheet modalview.delegate=self self.presentviewcontroller(modalview, animated: true, completion: nil) } when close modalview dismissviewcontrolleranimated, "refresh" view controller (because added new content). modal view "formsheet" style, viewdidappear or viewwillappear aren't called. i tried use setneedsdisplay, doesn't work. i don't know how do. this perfect use case delegate pattern. 1) define protocol within postcommentviewcontroller . protocol postcommentvcinformationdelegate {

asp.net web api - Web API Help Pages and API Explorer returning 0 descriptions -

i have project web api project. @ point in past removed helppages , made app use owin. have been asked add api helppages in have done. have set startup class bit this: public void configuration(iappbuilder app) { // needs first app.usecors(microsoft.owin.cors.corsoptions.allowall); // more information on how configure application, visit http://go.microsoft.com/fwlink/?linkid=316888 var httpconfig = new httpconfiguration(); // register areas arearegistration.registerallareas(); configureoauthtokengeneration(app); configureoauthtokenconsumption(app); configurewebapi(httpconfig); app.usewebapi(httpconfig); } so route pages working. far can tell, should work problem apiexplorer doesn't pull descriptions. in configurewebapi method remove formatting, have commented out , still doesn't work, here method: private void configurewebapi(httpconfiguration config) { // web api configuration , services var formatters = config

Java JoptionPane trying to get it to work for sepreate method with double x4 -

i trying program show grade , letter grade know mess need print netbean says joptionpane requires double, double, double, double package garrett_sprunger_a5; import java.text.decimalformat; import java.util.scanner; import javax.swing.joptionpane; /** * * @author garrett */ public class garrett_sprunger_a5 { /** * @param args command line arguments */ public static void main(string[] args) { string inputstring; // reader's input double testscore1, //define testscore 1 testscore2, //define testscore 2 testscore3, //define testscore 3 averagescore; //define averagescore scanner keyboard = new scanner(system.in); //to hold users grade // (somehow able use // keyboard can't // varible match correctly) decimalformat formatter =

jquery - on change of textbox value, check condition on the basis of rails instance variable -

in rails application, have text-area value changes on basis of checkbox. text-area <%= f.text_area :sent_to, :class => 'form-control'%> on change of content of text-area, want count number of comma separated values in text-area , check if exceeds number stored in instance variable @org_msg_limit. instance variable have field promo_limit on basis of want check number of comma separated values in text-area. if value in text-area exceeds number in promo_limit display alert/message. how this? i tried make hidden field set value of variable instance vairable <%= hidden_field "trans_limit", :value => limit.trans_limit.to_i %> than made .change function follows not working. <script type="text/javascript"> $(document).ready(function(){ $('#sent_to').val().change(function() { alert("hello"); var limit = $('#trans_limit').val(); alert(limit); }); }); <

What version of curl supports SHA2 -

hello know of version curl supports sha2? i'd know if version curl-7.16.4 has sha2 support. thanks. i learned curl not support/implement ssl directly, through underlying ssl library which, in case, openssl 0.9.7.d. therefore question comes down whether openssl 0.9.7d suports sha2 not.

php - Android java.lang.NullPointerException: lock == null -

this question has answer here: what nullpointerexception, , how fix it? 12 answers i got following error. java.lang.nullpointerexception: lock == null while json file server.i googled cant find solution this. using wamp server, mysql , php connect database, when try register below error. i have highlighted both of error on line 189 , 232 in block quotes. please me wrong these lines. error log -04 19:41:08.572 2414-2481/com.brad.visor e/buffer error﹕ error converting result java.lang.nullpointerexception: lock == null 07-04 19:41:08.572 2414-2481/com.brad.visor e/json parser﹕ error parsing data org.json.jsonexception: end of input @ character 0 of 07-04 19:41:08.602 2414-2414/com.brad.visor e/androidruntime﹕ fatal exception: main process: com.brad.visor, pid: 2414 java.lang.nullpointerexception: attempt invoke virtual method 'java.lang.s

ruby on rails - Forbidden attribute error when updating object with hash.keys, hash.values -

i'm getting following error when try update 1 of objects: activemodel::forbiddenattributeserror extracted source (around line #21): def sanitize_for_mass_assignment(attributes) if attributes.respond_to?(:permitted?) && !attributes.permitted? raise activemodel::forbiddenattributeserror else attributes end the logic in controller following: params["employeeschedules"].each |key,value| #this gets params each scheduleid values = 1=> { "hrs" => 3}} @update_hash = value end logger.debug "@params = #{@update_hash}" logger.debug "keys= #{@update_hash.keys} values = #{@update_hash.values}" if employeeschedule.update(@update_hash.keys, @update_hash.values) #if employeeschedule.update([19,67], [{"hrs" => "1"}, {"hrs" =>"2"}]) if use line instead of 1 @update_hash.keys @update_hash.values, works though keys/values