Posts

Showing posts from June, 2013

How to display all values checked in a checkbox using Rails? -

<form action="/decide_start_session" method="get"> <input type="checkbox" name = "subject" value = "netpresentvalue" checked> net present value <input type="checkbox" name = "subject" value = "famafrench" checked> fama french <%= submit_tag("start session", class: "btn btn-success") %> </form> puts params[:subject] i have first part in view , second line in controller in rails app. if user selects both checkboxes, rails console returns last item checked instead of of them together. idea on how can fix (show checkboxes in console)? if change name attribute of checkboxes subject[] , remove spaces around = in html, checked values passed controller array. <form action="/decide_start_session" method="get"> <input type="checkbox" name="subject[]" value="netpresentvalue"

C scanf not working in recursive function -

this question has answer here: scanf() misbehaving 3 answers i trying write function takes , checks if input integer between 1 , 1000. if not, calls itself. however, if give wrong input, example, "f" , doesn't stop scanf, rather becomes infinite loop. suggestion? input buffer? #include <stdio.h> int num,input; int take_input() { num = scanf("%d", &input); if( num != 1 || input < 1 || input > 1000 ) { printf("input must between 1 , 1000"); take_input(); } return 1; } int main() { take_input(); } first: don't need check if (num != 1) in second test... there if first test false. second: passing 1 argument read: scanf return either 1 or 0 (if didnt read correctly). happens is: if read 1 number num have value 1 , exit right after in first if. to make recursion work have to:

html - jquery - p element wont show after I hid it -

im trying build website , ive ran problem. got 4 pictures , whenever want click on picture, want show text. wont show, did link console log , shows working. can me this? thanks in advance! css <img class ="porfoto" title="tekstroy" id ="roy" src="img/roy.png"> <img class ="porfoto" title="tekstkinmen" id ="kinmen" src="img/kinmen.png"> <img class ="porfoto" title="tekstboris" id ="boris" src="img/boris.png"> <img class ="porfoto" title="tekstelse" id ="else" src="img/else.png"> <p id="tekstroy">hallo </p> <p id="tekstkinmen">hallo2<p> <p id="tekstboris">hallo3</p> <p id="tekstelse">hallo4</p> js $("#tekstroy").hide(); $("#tekstkinmen").hide(); $("#tekstboris").hi

jquery - One page prev/next navigation based on list/anchor links -

after finished laughing @ attempt modify jquery me with: http://goo.gl/mnhqq8 what happen is: to left 2 visible buttons prev/next hide other li's. prev button work , go previous anchor , next going next anchor. or going wrong way... open better suggestions. thanks only modified few parts: first, keep 2 buttons: <li><a href="#prev" class="scroll">prev</a></li> <li><a href="#next" class="scroll">next</a></li> next, keep track of different anchors, , 1 active: var anchors = ['anchortop', 'anchorone', 'anchortwo', 'anchorthree', 'anchorfour', 'anchorfive']; var currentidx = 0; finally, either decrement or increment currentidx depending on button clicked , section at: var full_url = this.href, parts = full_url.split('#'), btn = parts[1]; if (btn == 'prev' && currentidx > 0) { cur

matlab - Making coordinates out of arrays -

so, have 2 arrays: x' ans = 2.5770 2.5974 2.1031 2.7813 2.6083 2.9498 3.0053 3.3860 >> y' ans = 0.7132 0.5908 1.9988 1.0332 1.3301 1.1064 1.3522 1.3024 i combine n-th members of 2 arrays together, , plot coordinates on graph. should be: {(2.5770,0.7132), (2.5974,0.5908)...} is possible do? if so, how? schorsch showed simple plot, answer question asked in title, can combine arrays coordinates arranging vectors rectangles. your x , y vertical, can put them side-by-side in 2-column matrix: combined = [x y] or transform , have 2 rows: combined = [x' ; y'] (because they're vertical, don't want these, concatenate them out 1 long column or row: [x ; y] or [x' y'] ) just clear, though, not needed plotting. edit: suggested edit asked happens if plot(combined) . depends if it's horizontal or vertical version. in case, plotting 2x? matrix won't plot x vs. y.

javascript - Targeting a span that is wrapped around a radio input -

my problem simple. i'm using template styling. way template handles form inputs wraps them in span tags. select radio button, have change class of span "checked". using checked="checked" or checked in input not work. example: <label class="radio"> <div class="radio" id="uniformed-undefined"> <span class="checked"> <input type="radio" name="grow" value="slash"> </span> </div> how can target <span class="checked"> based on input name "grow" , value "slash" ? i've looked .before() i'm not sure that's correct answer. jquery multiple attribute selector , jquery parent $("input[name='grow'][value='slash']").parent("span");

php - String Replace Alphabet Ignoring HTML Tags and Elements -

this code want to. issue replaces html tags , elements. want code ignore html tags , elements, , replace letters aren't within <...> of tags. currently, replaces every letter upper , lower letter. , prevents replaced letters being replaced again. splendid. if remove tags , leave plain text, would, it's not desired result. this needs work simple or complex strings. merely simple version of being done for. tags included <p><br><strong><b><em><i><u><strike><s> $foo = ' <p> <i>foobar</i> walks down street. <br /> <br /> <b style="font-size: 10px;">foo!</b> <br /> <br /> <strike>foobar.</strike> </p> <p> <i>foobar</i> walks down street. <br /> <br /> <b style="font-size: 10px;">foo!</b> <br /> <br /> <strike>foobar.</strike> </p> '; $replaces

jquery - load data of page in URL using javascript -

i have html page want load on click of class using javascript. thinking of fetching html using iframe. page contains content in form of overlay. i have used .load() function of jquery not anything. pages working both in same domain hoping page have loaded. how can achieve this? $(".popup-layout").click(function() { // want load iframe here. should iframe sit on current page diplay:none. }); i use ajax loaded content on iframe, opion though. $(".popup-layout").click(function() { $.get("yourfile.html", function(data){ $("#content").html(data); // div load content in }); });

php - using namespace with array_map() -

in php web project, 2 subfolders within classes folder follows: project\classes\app project\classes\utility there class called cleanse in utility subfolder. here copy of part of code in class: namespace classes\utility; class cleanse { # attributes protected static $_ns = __namespace__; # methods public static function escape($values) { return is_array($values) ? array_map(self::$_ns.'\cleanse::escape', $values) : htmlentities($values, ent_quotes, 'utf-8'); } } i wondering if $_ns should declared static or not. there better way declare attribute , if so, how can called within functions of class? maybe i'm missing here, why putting value of php magic static namespace own variable? why not use namespace directly? otherwise, can use private class can access variable , use $this->_ns, realistically, use namespace variable itself. if decide declare

mysql - Trying to get RmySQL to work but not understanding bash's export or filesystem conventions -

i trying install rmysql on mac (mavericks) , errors out when try build source, saying: configuration error: not find mysql installation include and/or library directories. manually specify location of mysql libraries , header files , re-run r cmd install. instructions: define , export 2 shell variables pkg_cppflags , pkg_libs include directory header files (*.h) , libraries, example (using bourne shell syntax): export pkg_cppflags="-i" export pkg_libs="-l -lmysqlclient" re-run r install command: r cmd install rmysql_.tar.gz i tried follow instructions entering: export pkg_cppflags="-i/usr/local/mysql/include" export pkg_libs="-l/usr/local/mysql/lib -lmysqlclient" but when re-run rmysql still doesn't work. moreover, if type $pkg_libs to see variable holds, -bash: -l/usr/local/mysql/lib: no such file or directory' i know /usr/local/mysql/lib exi

html - Bootstrap form elements not aligned in horizontal form -

Image
i have horizontal modal form defined to: <div id="formelements" class="modal-body form-horizontal"> <div id="cattemplate" class="form-group" style="display:none"> <div class="controls col-sm-1"> <a href="javascript:;"><span class="glyphicon glyphicon-minus"></span></a> </div> <div class="controls col-sm-7"> <input class="form-control" placeholder="category"> </div> <div class="controls col-xm-3"> <input class="form-control" type="number" min="0" max="100" style="width:100px;" placeholder="weight %"> </div> </div> </div> but link floats little bit above horizontal line of other form elements. attached s

jquery - Row selecting in MVC doesn't work -

i make row getting selected through coding seems allow me selecting multiple rows. 1: $('#linetables tbody').on('click', 'tr', function () { 2: console.log("row clicked"); 3: if ($(this).hasclass('selected')) { 4: $(this).removeclass('selected'); 5: console.log("removed selected class"); 6: } 7: else { 8: $(this).addclass('selected'); 9: console.log("added selected class"); 10: } 11: }); i want allow single row selection. source code datatables.net code below. error in console tells me typeerror: $(...).datatable not function. put js , css files given on website in project correctly. why still getting error message console. datatables.net confirms code initialising datatables that's it! we've got html table want enhance, , we've got >software , styles need. required to tell

dictionary - Can two strings arguments be passed to a python dict() built in function? -

i have loop build dictionary from. part of code i'm having trouble both key , value strings. cannot convert ip variable string int nor float. here method class i'm attempting build dictionary with. there loop elsewhere walking ip range i'm interested in feeding method parameter 'ip'. def dictbuild(self,ip): s = pxssh.pxssh() s.force_password = true try: s.login(str(ip), 'root', 'password') s.sendline('hostname') # run command s.prompt() # match prompt out = s.before # print before prompt, returns byte object , need decode(utf-8) out = out.decode('utf-8') out = out.split() out = out[1] print(type(out)) #these type function give easy output of data types in traceback print(type(ip)) ipdict = dict(out=ip) ###getting stuck here on 2 string types. print(ipdict) s.logout() except (pxssh.exceptionpx

javascript - How to close the window on the latest version of Mozilla Firefox? -

Image
i using mozilla firefox 30.0 , seems doesn't support window.close() anymore. you may refer on image below or if small you, here link . i opened website of google using window.open , tried close using window.close() says undefined . is there other option can using close window using javascript on firefox? the firebug console unfortunately not display warning goes along it, reads (in regular firefox web console}: scripts may not close windows not opened script. also mdn window.close states: this method allowed called windows opened script using window.open method. so, aren't allowed call window.close() on windows explicitly opened user. ps: isn't new behavior, around ages (even before firefox called firefox). ps: give example, allowed this, only, i.e. close window returned window.open : var w = window.open("http://google.com"); settimeout(function() { w.close(); }, 1000);

php - insert batch from array 2 dimension codeigniter -

i wanto insert , insert batch 1 form 2 tables , post data have contain array 2 dimension, , result print_r post data array ( [foo] => blalala [bar] => xxxxxx [date] => 2014-06-30 [time] => 08:34:30 [fruit] => array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 ) [car] => array ( [0] => 2 [1] => 3 [2] => 5 [3] => 7 ) [food] => array ( [0] => 2 [1] => 3 ) [drink] => array ( [0] => 3 ) [snack] => array ( [0] => 2 ) ) and result want $array_master = array( [foo] => blalala, [bar] => xxxxxx, [date] => 2014-06-30, [time] => 08:34:30, ); and next array count data 2nd dimension array [fruit],[food],[car],[drink],[snack] [0] => array ( [agenda_terkait_type] => **(if [fruit] ==1,[food] ==2,[car] ==3,[drink] ==4,[snack] ==5)**

c - printf()/puts() after use of ncurses -

i'm using ncurses library in c project, , encountered problem use of printf() / puts() after curses initialized and de-initialized. here's simplified illustration: initscr(); endwin(); puts("first"); usleep(1e6); puts("second"); both first , second appear on screen after containing executable exits (after little on 1 second), instead of printing first first, , then, second later, second . ncurses seems buffering stdout somehow , flushing on exit. fflush(stdout) seems solve problem: initscr(); endwin(); puts("first."); fflush(stdout); usleep(1e6); puts("second"); when stdout manually flushed, output displayed expected (with second gap). if add more puts() statements afterwards usleep() s in between, though, i'd need repeat calls fflush(stdout) after each one, , i'm wondering if there's better solution that, say, permanently resets program pre-curses mode. ncurses calls setvbuf , putting strea

javascript - How to use JS to change content in bootstrap modal -

i using twitter bootstrap's modal make pop screen login. this following code shows pop-up form when login clicked. <section id="modal-login-form"> <div class="modal fade" id="m-login" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <p><h4 class="modal-title" id="mymodallabel">register</h4></p> <button id="login" type="button" class="btn btn-login">login</button>

Visual studio Project template to create a windows service in c++ -

is there project template available in microsoft visual studio 2010 create windows service in c++. in vs 2013,you can using atl project wizard create windows service program. , still can set service class inheriting servicebase class. from msdn: how to: write services programmatically

Centos, ZPanel and Cloudflare DNS recorddns error -

i stuck in problem. have vps gave me dedicated ipv6 address , shared ipv4 address. have tunneled , installed zpanel on centos server. can access zpanel 31.220.48.155:22277 , have set new domain in zpanel. added 31.220.48.155:22277 in cloudflare record wont allow saying "you entered '31.220.48.155:22277' not valid ip address." stuck. please help... '31.220.48.155:22277 not valid ipv4 address & put in 31.220.48.155. looks you're trying add port number after ip address & not correct.

javascript - GET parameter not passing through -

i'm having weird error while trying pass get variables. on product page have multiple sizes same product, each size has own form 2 variables, product id (product_id) , quantity (qty) , sent page (add.php) added cart. my problem qty passed no problem product_id not go through, used burp suite check data sent between server , client , when click on submit button product_id not attached url (as can see below) get /newsite/add.php?qty=1 http/1.1 here code use $selectquery = "select * products product_master_id = $masterid order length(product_quantity_description), product_quantity_description"; $selectresult = mysql_query($selectquery); $i = 0; while($selectrow = mysql_fetch_array($selectresult)) { echo '<form action="add.php?product_id='.$selectrow['product_id'].'&qty=<script>document.getelementbyid(\'qty'.$i.'\').value</script>" class="form form-inline clearfix"> <

Maven project is not picking local repository after copying -

i had working workspace set in maven. due unavoidable reasons have change system , hence need set new workspace. hence copied .m2/repository folder working system new system. but unfortunately local nopt picking jars local repository , throwing compiler error. have copied home directory .m2/repository folder can please me here? thanks, rengasami r the local repository path defined in settings.xml file (found either in m2_home/conf or user_home/.m2 ). check value of <localrepository> matches path have defined. another solution run command mvn help:effective-settings , , display content of settings.xml maven using, find information easily.

curl - How to get url content through proxy ip and port in php? -

i want content of url through proxy. had taken proxy ip , port http://letushide.com/filter/http,all,all/list_of_free_http_proxy_servers but using following code , return blank page. $url = "http://google.co.in"; $agent = "mozilla/5.0 (x11; u; linux i686; en-us) applewebkit/532.4 (khtml, gecko) chrome/4.0.233.0 safari/532.4"; $referer = "http://www.google.com/"; $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_httpproxytunnel, 1); curl_setopt($ch, curlopt_proxy, '190.122.xxx.xxx:8080'); curl_setopt($ch, curlopt_referer, $referer); curl_setopt($ch, curlopt_followlocation, 1); curl_setopt($ch, curlopt_maxredirs, 2); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_connecttimeout, 10); curl_setopt($ch, curlopt_useragent, $agent); $data = curl_exec($ch); curl_close($ch); echo $data;

c++ - When is "already a friend" warning useful? -

i have code uses preprocessor-heavy framework generate utility classes. apparently, of macros result in same friend declaration being included twice in class, this: class friendly { // ::: friend class bestie; friend class bestie; // ::: }; when built gcc (4.8.1), generates warning like bestie friend of friendly [enabled default] i can't see use in warning. i'm curious why included in gcc in first place. however, hardly answerable community, i'll state question this: what problems arise friend declaration being repeated, or programmer errors such occurrence indicate? the problem can think of hinting @ "you may have intended write else here instead of same thing again, helpfully warn this." however, in such case, intended friendship missing, lead "access control violation" error in code exercising friendship, see little use of warning itself. are there potential problems i'm overlooking? i dont think usefull d

xml - Old text file is downloaded while downloading from server -

i trying download xml file server windows store application. while trying downloading file getting downloaded. when make changes xml file, still downloading old file , changes not reflected. while access xml file in chrome ... changes there. after time automatically downloads last updated file... , issue continues... below 2 methods tried download file ... url: contains direct file path on server. using xdocument: string xml = xdocument.load(url,loadoptions.preservewhitespace).tostring(); using httpclient: string xml = string.empty; using (var httpclient = new httpclient()) { xml = httpclient.getstringasync(url).result; } thanks in advance. kindly help. yes, sound caching issue. ideally, fix having server send right caching policy file (i.e. not saying it's valid longer is). failing that, can change httpclient.httpbaseprotocolfilter.httpcachecontrol.re

android - Proguard obfuscating does not work -

i'm trying obfuscate package names including 1 of used libraries. i use build config in gradle file: buildtypes { debug { versionnamesuffix "-development" debuggable true runproguard true proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } #... this proguard file: # butterknife -dontwarn butterknife.internal.** -keep class **$$viewinjector { *; } -keepnames class * { @butterknife.injectview *;} # ormlite uses reflection -keepclassmembers class com.j256.** { *; } -keep class my.package.name.database.** { *; } -keep class com.j256.** #test -repackageclasses 'qqq1' -flattenpackagehierarchy 'qqq2' -allowaccessmodification -forceprocessing i'm using command dumping dexed classes: 7z x -aoa my.apk classes.dex && dexdump classes.dex | grep "class desc" | less and still see full package names if grep "qqq" no results see

jquery - MVC4 Sidebar Active Item? -

Image
hello have question using template , has sidebar menu the problem see when click components opening when click grids in it, closing dont want close should stay opened. working when start html in mvc doesn't work. "postback" ? if yes how can solve it. thank . ok codes <div id="container" class="row-fluid"> <!-- begin sidebar --> <div id="sidebar" class="nav-collapse collapse"> <!-- begin sidebar toggler button --> <div class="sidebar-toggler hidden-phone"></div> <!-- begin sidebar toggler button --> <!-- begin responsive quick search form --> <div class="navbar-inverse"> <form class="navbar-search visible-phone"> <input type="text" class="search-query" placeholder="search" /> </form> </div>

php - Laravel 4 session doesn't expire after lifetime limit -

i've set 'lifetime' => 10 in session config file, doesn't expire @ all. in laravel 3 setting, after logging in, when limit of 10 minutes exceeded, session expires , user redirected login again. in laravel 4 doesn't happen. after 10 minutes can refresh, , still session valid. i'm testing both on same machine analogical settings... missing? i've got it. problem config pair lifetime , expire_on_close . if expire_on_close set true, laravel 4 ignore lifetime . had: 'lifetime' => 1, 'expire_on_close' => true, and in case, session valid after 1 min - expire after closing browser. changed to: 'lifetime' => 1, 'expire_on_close' => false, and session expiring after 1 min. no matter if browser closed or not - close enough i've wanted. the reason why confused , haven't figured out earlier comments there unclear in matter , in laravel 3 worked differently...

javascript - Remove .html, .php, .aspx , etc from the URL in static sites -

i have situation have show html pages without using extension such page named about-us.html , want show about-us you should use urlrewriting remove file extension if use apache then apache link for iis iis link

How to manage filesystem quota in Dart 1.5? -

in older versions of dart, there used function window.storageinfo.requestquota(window.persistent, quota) on top of that, there used function report: queryusageandquota i can see storageinfo class has been renamed deprecatedstorageinfo, , no longer available via window.storageinfo. how can access functionality? quota exceeded errors, although increased value passed to: window.requestfilesystem(quota, persistent: true) it seems chrome in process of migrating w3c quota management api see also https://code.google.com/p/chromium/issues/detail?id=332325 http://src.chromium.org/viewvc/blink/trunk/layouttests/storage/quota/storagequota-request-persistent-quota.html?pathrev=165920 but seems has not yet landed in dartium. the object returned window.navigator.storagequota has no usable methods.

c++ - Problems with QProcess after fork() and execv() -

i have program launches worker process, waits finish (listens sigchld signal) , launches worker process. inside worker processes launch qprocess calls program. in test case call touch - standard linux command. i use fork() , execv() launch worker processes. the problem qprocess finishes in first worker process only. after new worker processes spawned, qprocess never says finished. touch command job fine time. in worker processes except first 1 becomes zombie in end. here's minimal test program: #include <qcoreapplication> #include <qprocess> #include <qdebug> #include <signal.h> #include <wait.h> void spawnworkerprocess(); void launchqprocess(); void catchsigchild(int i); void execchild(); int main(int argc, char *argv[]) { qcoreapplication app(argc, argv); if (argc > 1) // worker process { launchqprocess(); } else // main process { if (signal(sigchld, catchsigchild) == sig_err)

java - How to profile thread lifecycle performance -

in context of building http web server...we understand theoretically, creating , destroying threads per request relatively costly , doesn't scale well. common knowledge (or hope is). thread pools solution here...but kind of want understand things @ lower level accept theory true. sure, can run black-box tests using jmeter see how application might perform under load, if want observe why happens? can profiler tool tell me how , why thread allocation per request costly? thanks! if wanted measure can this. when wisdom divined long time ago when thread creation more expensive. e.g. on linux, each thread new process. also "expensive" means different things different applications. if every request 1 system takes long time, adding milli-second won't make difference. if every request takes few milliseconds, adding milli-second start thread pretty bad. import java.util.arraylist; import java.util.list; public class threadrestartermain { public s

knockout.js - Disable select list with knockout -

i'm trying disable select list using knockout disable binding. doesn't work. list still enabled when value (readonly.isnew) true. i've checked value correct i.e. readonly.isnew. works fine checkbox, not select list. <select name="mydropdown" data-bind=" options: $parents[1].readonly.mylist, value: selectedmethod, disable: !(readonly.isnew)"></select> i guess isnew observable, in case need unwarp when used in expressions: disable: !(readonly.isnew()) if put observable data-bind knockout automatically unwrap it, example write , work: disable: readonly.isnew however when use expression in data-bind knockout cannot unwrap observable , should yourself. example if want hide select when there no records should write following: visible : $parents[1].readonly.mylist().length > 0

html - Saving web-pages using batch file -

it way let me save or snap file computer in every 1 hour http://aqicn.org/city/beijing/ this webpage want save or snap. have tried before wget , since third party software, lecture dun want. there got solution? pc window 7 32 bit. telnet should help. telnet http://aqicn.org/ port 80 (http) or 443 (https) in cmd , http get request. don't know how automate process though.

java - NullPointerException in JUnit Test -

i'm doing tests app , when send null catch nullpointerexception. method still contines test present error. how can avoid it?. testservice.java integer number = null; servicetotest service; try{ service.methodtotest(number); } catch(exception e){ //do stuff } servicetotest.java public void methodtotest(integer number){ if(number != null) //do stuff } i tried if(number.equals(null)) have same exception use @test(expected=nullpointerexception.class) instead of @test and error-message go away.

vlc rtsp to mp4 transcoding error -

i trying transcode live rtsp stream mp4 file using cvlc getting error below. ideas why getting error? here's command use - cvlc -vvv rtsp://184.173.147.99:5555/mpeg2transportstreamfromudpsourcetest --sout '#transcode{vcodec=mp4v,acodec=none,vb=128,deinterlace}:file{dst=out.mp4}' here's error get [0x7f72400011b8] avcodec encoder debug: libavcodec initialized [mpeg4 @ 0x29ef5c0] timebase 333333/20000000 not supported mpeg 4 standard, maximum admitted value timebase denominator 65535 [0x7f72400011b8] avcodec encoder error: cannot open encoder [0x7f72400011b8] main encoder error: streaming / transcoding failed [0x7f72400011b8] main encoder error: vlc not open encoder. [0x7f72400011b8] main encoder debug: no encoder module matching "any" loaded the error tells wrong timebase. if read on conversation in ffmpeg user list suggestion define correct framerate. so first guess check on command , introduce option defining wanted framerate 1 automa

c# - Datagrid view move Scrollbar to last selected row -

i working c# , devexpress. i have devexpress gridview around 100 records. records me backed thread. thread refresh after 30 seconds. i showing 20 rows , vertical scroll bar appeared. my problem .... when select 40 row, , after 30 seconds when thread works, jump top row of grid though selected other rows . scroll selected row. how this. please me. with regards, it seems selection cleared after refresh. so, can use gridview.toprowindex property. here example: //get top row index before refresh var toprowindex = gridview.toprowindex; //refresh records //set top row index gridview.toprowindex = toprowindex;

java - Drawing multiple sprites in libgdx -

Image
i using libgdx 1.2.0 + eclipse. want draw multiple sprites class in game screen, 1 sprite gets drawn. render method @override public void render(float delta) { gdx.gl.glclearcolor(100/255f, 0, 0, 1); gdx.gl.glclear(gl20.gl_color_buffer_bit); if(gdx.input.justtouched()){ touchx = gdx.input.getx(); touchy = gdx.input.gety(); //for(int i=0; < enemy.length; i++) //system.out.println(enemy[i].x + " " + enemy[i].y); } for(int i=0; i< enemy.length; i++){ enemy[i].update(delta); if(enemy[i].getsprite().getboundingrectangle().contains(touchx/ppx, touchy/ppy)) enemy[i].reset(); if(enemy[i].gameover){ gameover = true; //system.out.println("over"); } } game.batch.begin(); //if(!gameover){ for(int i=0; < enemy.length; i++) enemy[i].getsprite().draw(game.batch); //} game.batch.end(); } same th

java - Couldn't Able to access Methods using Jmeter-Webdriver -

var pkg = javaimporter(org.openqa.selenium) var support_ui = javaimporter(org.openqa.selenium.support.ui.webdriverwait) var wait = new support_ui.webdriverwait(wds.browser, 5000) **var support_page=javaimporter(org.openqa.selenium.webdriver.timeouts)** **var support_p=new support_page.pageloadtimeout(30, timeunit.seconds)** var url = wds.args[0]; var user = wds.args[1]; var pwd = wds.args[2]; wds.sampleresult.samplestart() wds.browser.get(url) var wait=new support_ui.webdriverwait(wds.browser,15000) var username = wds.browser.findelement(pkg.by.id('login_txtusername')).sendkeys([user]) //username.click() //username.sendkeys(['pandian']) var userpwd = wds.browser.findelement(pkg.by.id('login_txtpassword')).sendkeys([pwd]) //userpwd.click() //userpwd.sendkeys(['1234']) var button = wds.browser.findelement(pkg.by.id('login_btnlogin')).click() //button.click() when try import webdriver.timeouts class it's imported not able access method p

r - Why doesn't setDT have any effect in this case? -

consider following code library(data.table) # 1.9.2 x <- data.frame(letters[1:2]) setdt(x) class(x) ## [1] "data.table" "data.frame" which expected result. if run x <- letters[1:2] setdt(data.frame(x)) class(x) ## [1] "character" the class of x remained unchanged reason. one possibility setdt changes classes of objects in global environment, i've tried x <- data.frame(letters[1:2]) ftest <- function(x) setdt(x) ftest(x) class(x) ##[1] "data.table" "data.frame" seems setdt don't care environment of object in order change class. so what's causing above behaviour? bug or there common sense behind it? setdt changes data.frame , returns invisibly. since don't save data.frame , lost. need somehow save data.frame , data.table saved. e.g. setdt(y <- data.frame(x)) class(y) ## [1] "data.table" "data.frame" or z <- setdt(data.frame(x)) class(z

linux - how to tell if iptables are now blocking a url -

i using ubuntu , have blocked outgoing connections few ips iptables. how can tell if attempt violate rule made (e.g. process trying access ip). there kind of event/callback mechanism (preffered)? there log can track? iptables -l -v will display current iptables configuration, along packet , bytes counters matched each rule. alternatively, can insert new rule iptables, log packets matching rule: http://www.thegeekstuff.com/2012/08/iptables-log-packets/

web - Client-Side Editing of HTML Webpage -

i'm not sure put put post in stackoverflow since related programming. anyways, website done , want client able edit pages without learning html @ once. want s/he able change text without learning html on website or programme. possible, if please, please, me. there project can this? appreciated. thanks! if want text on site editible, site built on backend suited editing such joomla or wordpress. if want scratch, you'd have have database containing of text elements want them able edit, use php echo text page. that way, make simple interface edit text in database would, in turn, edit text on site. example: index page <div id="description"><?php echo $description;></div> update page <form action="update.php" method="post"> <input type="text" name="description" value="<?php echo $description;?>"> <input type="submit"> </form> if example

java - Cannot get the passing values from jsp to servlet -

if run jsp, while exporting contents excel, not getting values in downloaded excel file. empty. here tried.. how pass table values servlet? excel.jsp <%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <%@ page import ="javax.swing.joptionpane"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>export excel - demo</title> </head> <body> <table align="left" border="2"> <thead> <tr bgcolor="lightgreen"> <th>sr. no.</th> <th>text data</th> <th>number data</th> </tr>

Dart HttpClient.getUrl invoked by Timer without client or http server -

edit : problem wasn't related timer or httpserver, dart.io sleep function pausing everything. described in documentation, bad. // i have weird problem httpclient working in server code. call client.geturl(uri.parse(url)).then((httpclientrequest response) => response.close()).then(httpbodyhandler.processresponse).then((httpclientresponsebody body) { print(body.response.statuscode); from timer object , never reach print step. copy , paste code previous version, wasn't called timer httprequest. working code in question [here][1]. fails on long line, suspect last future never reach (httpclientresponsebody). timer object created (just test code): main() { t = new timer.periodic(new duration(minutes: period), (timer t) => hit()); } void hit() { if (new datetime.now().hour == 17) { print("syncing rock"); loadurlbody(furl + filter).then((content) { print("content loaded"); //edit: okay, here source, might trivial

sql server - Getting error Incorrect syntax near the keyword 'BEGIN' when executing stored procedure -

so, i'm new ms sql (have been using oracle last 5-7 years) , should straight forward thing do, reckon i'm missing simple. (i've tried following examples here: http://technet.microsoft.com/en-us/library/ms190669(v=sql.105).aspx ) so, create following stored procedure query table (this simple , pointless procedure can't proceed more complex procedure until resolve problem) create procedure sp_gettransactions select * mytransactions; i try execute procedure execute dbo.sp_gettransactions (i've tried without dbo. , same error) this gives me helpful error incorrect syntax near keyword 'begin'. now, maybe i'm crazy don't see begin statement anywhere in procedure (i've tried adding 1 no avail). can give me pointers here? thanks actually, problem turns out client using. executing sql scripts using oracle's sqldeveloper mssql jtds driver. seems driver works fine part, when comes running stored procedures there's bug.

javascript - how to store values in an array -

in following code getting scanned value of barcode. var scancode = function () { window.plugins.barcodescanner.scan(function(result) { alert("scanned code: " + result.text + ". format: " + result.format + ". cancelled: " + result.cancelled); localstorage.setitem("myvalue1", result.text); window.location.href = 'page5.html'; var barcodeval = localstorage.getitem("myvalue1"); var test2 = localstorage.getitem("code"); code = json.parse(test2); var k = parseint(localstorage.getitem("counter")); document.getelementbyid(code[k]).innerhtml = barcodeval; alert(code[k]); alert(k); k++; localstorage["counter"] = k; localstorage.setitem("code", json.stringify(code)); }, function (error) { alert("scan failed: " + error); }); myvalue1 value getting scanning . have defined array , counter in js file as localstorage["counte

sql - Bulk insert 0 rows inserted -

im trying use following statement in sql insert data csv sql.. create table test (a bigint, b smallint, c real, d real, e real, f real, g real, h real, real, j real, k real, l real, m real, n real, o real, p real, q varchar(max), r varchar(max)) bulk insert test 'c:\datafiles\tests.csv' (fieldterminator = ',', rowterminator = '\n', firstrow = 2 ) my data looks like: "a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r" "900010000000257","46","580.29","1912.31","237.73","841.41",,,"253.35","995.30","225.38","2808.70","1536.87","2250.60","1628.19","111.91",, "900010000000425","46","1580.29"

validation - Check OptionMenu selection and update GUI -

i'm working on class project , i'm trying take beyond requirements little here (i'm doing own homework, need improving it!) want update gui based on selections user makes instead of having irrelevent options available time (requirements present options). i'm still new python , more new tkinter attempt has been following: #step type ttk.label(mainframe, text = "step type").grid(column = 1, row = 16) type_entry = optionmenu(mainframe, steptype, "kill", "explore" , "conversation") type_entry.grid(column = 2, row = 16, sticky = (e)) #step goal if steptype.get() == "kill": ttk.label(mainframe, text = "required kills").grid(column = 1, row = 17) goal_entry = ttk.entry(mainframe, width = 20, textvariable = stepgoal) goal_entry.grid(column = 2, row = 17, sticky = (e)) elif steptype.get() == "explore": ttk.label(mainframe, text = "location id").grid(column = 1, row = 17) goal_

html5 video - Switching mp4 embedded subtitles? -

seeing ios has no plans of fixing full screen captions problem, i've been forced embed soft subtitles site's mp4s. question is, how can switch languages or disable captioning javascript control? basically, how not using ios device on full screen change captioning? there perhaps html5 video hook can use?

infopath - Section Lines Disappearing Graphical Issue -

i having display issue infopath. section lines , section text disappear in form designer. lines there disappear after click few times , scroll. still exist , can clicked cannot seem them. not sure right causing them disappear. i able them again switching views. problem occurs both infopath 2010, , 2007. happens different forms. appears sort of display issue. have not noticed display issue's in other programs. i think cause because formatted computer, swapped graphics cards same model number looks newer revision because fan failed on last card. specs may relevant: using amd firepro v4900, latest driver 13.352.1009 of posting. 3 monitor setup. windows 7 x64. has else run , found fix?