Posts

Showing posts from June, 2011

c# - Why did System.String[] appear as the output from printing 2d array? -

Image
using this, i'm trying print list of contents of players.text know foreach loop print fine if console.writeline used. i'm attempting manipulate data in particular ways later, , need split using indicated delimiter. however, given code repeated system.string[] printout. i've done search or 2 , of i've found has 1 part or other, haven't found information on how use them together. string[] playerfile = file.readalllines("players.txt"); foreach (string s in playerfile) { //console.writeline(s); string[] playerstuff = s.split(';'); console.writeline(playerstuff); } console.readkey(); i realize it's simplistic question. often, me @ least, it's missing obvious drives me crazy. thanks in advance. player;team;pos;hr;rbi;avg abreu, j;cws;1b;30;101;0.29 altuve, j;hou;2b;15;66;0.313 andrus, e;tex;ss;7;62;0.258 arenado, n;col;3b;42;130;0.287 aybar, e;laa;ss;3;44;0.27 the above first few lines of input. basically, ...

github - Removing single/multiple file from a git commit(s) -

i new git , trying clean branch intend remove multiple files added. the files intend remove having additional white space came after removed code. without white space file same base branch , don't want show in pull request. the pull request talking have multiple commits , @ stage want merge. want remove files branch showing because of white space. did try few things nothing helped- git checkout origin/<remote-branch> <filename> git commit --amend but did not help, want pick specific files multiple commits made , remove them changes(branch). what assuming branch master. change command if not git reset master git add -p this interactively go though differences asking 1 one if want them

PHP loop listen for user input -

i have php script run on console. while(1) { dostuff(); sleep(2); } i need accept input console. don't want loop stop each time , wait me input text. what want while loop continue normal, if type in console, php script able read text , update variable. can done ? you can non-blocking i/o. you'll need stream_set_blocking method , stream_select : stream_set_blocking(stdin, false); while (1) { dostuff(); $readstreams = [stdin]; $timeout = 2; // stream_select block $timeout seconds or until stdin // contains data read. $numberofstreamswithdata = stream_select( $readstreams, $writestreams = [], $except = [], $timeout ); if ($numberofstreamswithdata > 0) { $userinput = fgets(stdin); // process $userinput see fit } else { // no user input; repeat loop normal } }

puppet - Encrypted Hiera eyaml variable decrypts on master but not on node -

i set hiera-eyaml on puppet 3.8, opensource environment. defaults.yaml db_password: enc[pkcs7,mxcgfds......] site.pp $password=hiera(db_password) if i'm running: puppet master --debug --compile funky_hostname.mydomain.com --environment=dev i can see tempated configfile generating correctly: password="password123" but when i'm running on actual node (funky_hostname.mydomain.com), i'm getting original, encrypted string result: password="enc[pkcs7,mxcgfds......]" isn't hiera decryption happening on puppet master side? puppet catalogues compiled on puppet master. compiled catalogue shared client on ssl connection (assuming puppet ca has signed ssl certificate request client). catalogue realised on client. compilation stage involves merging hiera data (and decrypting first if using eyaml backend). if using e.g. gpg encryption, gpg recipients file on puppet master used in deciding keys use in decryption process. net resu...

css - Font Awesome add multiple icons to button -

Image
i have button: <button type="button" style="margin-bottom: 5px;" class="btn btn-danger btn-default btn-gray btn-primary btn-primary2 btn-success2 btn-warning btn-black btn-success btn_bottom_padding" data-toggle="modal" data-target="#mymodal" data-bind="css: {'btn-gray': isgray(), 'btn-danger': isred(),'btn-success':isgreen(), 'btn-primary': isblue(),'btn-success2':islimegreen(), 'btn-primary2': isskyblue(),'btn-warning':isorange(),'btn-black': isblack(),'btn-default':iswhite()},click:$root.getclick"> <span data-bind="text:shortname()"></span> <span data-bind="visible: isred()" class="fa fa-exclamation-triangle"></span> @*<span data-bind="" class="fa fa-bolt"></span>*@ </button> the thing wanted add multiple icons like: i managed add excla...

file - How to get directory permissions in Bash script without backtick evaluation? -

i'm updating bash script in z/os. current script uses result of backtick command test condition, so: var=`command` [test value of var] the problem 1 customer has no access /tmp directory, , z/os uses files in /tmp hold intermediate data backtick commands. i figure test before backtick command /tmp accessibility, , change script's behavior accordingly. i'm not finding way that, though. suggestions? if [[ -w /tmp ]]... test if current user has write access /tmp . there might alternative. don't have z/os, unixs have variable tmpdir can set temporary directory, example: export tmpdir="$home" might work. on note, backticks considered deprecated. use var=$(command) instead.

c# - ASP.NET Web Api, Database connection in Threads -

i have issue using database in thread in asp.net application. when want start application want start thread called "backgroundworker" it, runs in background till whole application stopped. the problem have massive problems dbcontext in thread. i try start walker in startup.cs in methods "configureservices" or "configure" , initialize dbcontext in constructor in walker "dbcontext = new applicationcontext()" tells me connection not configured, when try operate in while(true) queue on database. if write own controller walker receives applicationcontext in constructor , starts thread this, if call controller once request: public backgroundworker(chronicuscontext dbcontext) { _dbcontext = dbcontext; _messageservice = new mailmessageservice(); } // get: api/backgroundworker [httpget] [route("start")] public void startworker() { //thread thread = new thread(this.dobackgroundwork);...

php - How can I sanitize laravel 5.2/5.3 Request Inputs? -

i have myrequest.php class extending app\http\requests\request . want trim() every input before validation because e-mail space after not pass validation. however sanitize() removed src/illuminate/foundation/http/formrequest.php create abstract sanitizedrequest class extends usual request class. yourrequest class should extend sanitizedrequest abstract class. your sanitizedrequest class overrides request::all() so... namespace app\http\requests\forms; use app\http\requests\request; abstract class sanitizedrequest extends request{ private $clean = false; public function all(){ return $this->sanitize(parent::all()); } protected function sanitize(array $inputs){ if($this->clean){ return $inputs; } foreach($inputs $i => $item){ $inputs[$i] = trim($item); } $this->replace($inputs); $this->clean = true; return $inputs; } } then normal customrequest, extend s...

Android google play : disable automatically translation of short description -

i have pubblished app on android play store , selected english language , have put english short , long description. with italian smartphone opened app page on google play store, short description automatically translated in italian. why ? don't want translation. possible ? wrong ? this might simple: provide own "italian" - exact copy of english.

xcode - how to use ".mm .cpp" files with Objective c project? -

i have downloaded static library example1 , collection of files written .mm , .cpp extensions . my own static library example2 written in objective c , has .m file extensions. how can call example1 library example2 library? i have read thing using header bridge, not know should exactly? there way use both libraries without header bridge? can 1 show me how example1 , example2 ?

c - Macro argument with different results -

this question has answer here: the need parentheses in macros in c 8 answers so have been having rather 'unyielding' problem macro call in c program. macro used : #define macro(x) x*x and problem when printf("%d",macro(3)); it displays 9 result (which correct). when pass 3 2+1 follows : printf("%d",macro(2+1)); it strangely displays outcome of 5. can please have me informed why? printf("%d",macro(2+1)); after preprocessing become printf("%d",2+1*2+1); since multiplication has high precidenece on addition, print 5; to resolve issue have define macro follows #define macro(x) (x)*(x)

How can I get firemonkey to display a local notification on iOS? -

i've pulled following code embarcadero site (here) generate local notification. procedure tform1.setnumberclick(sender: tobject); var mynotification: tnotification; begin // create instance of tnotification mynotification := notificationcenter1.createnotification; try mynotification.number :=18; mynotification.alertbody := 'delphi mobile device here!'; notificationcenter1.presentnotification(mynotification); mynotification.disposeof; end; end; it compiles , runs. expected, did have create notificationcenter1 tnotificationcenter on form. works find under android, under ios butkus. no local notification, no count on icon, not error. did ever work under xe8? has changed respect local notification between xe8 , 10/seattle? my phone running ios 9.2. did change in ios between 8.x , 9.x breaks local notifications firemonkey? i've followed tutorial before, , works. there 2 sample apps ship with 10 seattle. send can...

php - How to define friendly URL rules using .htaccess? -

long time trying define rewriting rules not succeed yet? have simple page http://www.myurl.com/pdf.php?id=2 . want make friendly this: http://www.myurl.com/pdf/2/ ... i wrote rule after spending time on google: options +followsymlinks rewriteengine on rewriterule ^pdf/([0-9]+)\$ pdf.php?id=$1. when uploaded .htaccess file on server , try run first give me 500 error. second time loaded page not show me friendly url; showing before. kindly tell me better solution, followed many instructions make useful not successful. client not going further unless showed him friendly url. kindly me possible. client hosting organization: justhost.com. you can using apache's rewrite engine. this: rewriteengine on rewriterule ^pdf/([0-9/]+)$ /pdf.php?id=$1 [l] this allow go http://yoursite.com/pdf/192 instead of http://yoursite.com/pdf.php?id=192

r - Faster to run two loops or one loop -

in general, if number of iterations of 2 loops same, faster run 2 loops or combine 2 loops 1 loop? i have imagined running 1 loop should faster, when wrote test code, not case. can explain why is? here code example in r tic <- function(gcfirst = true, type=c("elapsed", "user.self", "sys.self")) { type <- match.arg(type) assign(".type", type, envir=baseenv()) if(gcfirst) gc(false) tic <- proc.time()[type] assign(".tic", tic, envir=baseenv()) invisible(tic) } toc <- function() { type <- get(".type", envir=baseenv()) toc <- proc.time()[type] tic <- get(".tic", envir=baseenv()) print(toc - tic) invisible(toc) } > tic() > for(i in 1:10000){ + x = rnorm(1000) + y = rnorm(1000) + } > toc() elapsed 1.78 > > > tic() > for(i in 1:10000){ + x = rnorm(1000) + } > for(i in 1:10000){ + y = rnorm(1000) + } > toc() elapsed...

javascript - How do I write a Node.js module to handle an incoming piped stream -

i'm trying write node module accepts incoming piped binary (or base-64-encoded) stream, frankly don't know start. can't see examples in node docs handling incoming streams; see examples on consuming them? say example want able this: var asset = new projectasset('myfile', __dirname + '/image.jpg') var stream = fs.createreadstream(__dirname + '/image.jpg', { encoding: 'base64' }).pipe(asset) stream.on('finish', function() { done() }) i've gotten projectasset looking this, i'm @ loss of go next: 'use strict' var stream = require('stream'), util = require('util') var projectasset = function() { var self = object.defineproperty(self, 'binarydata', { configurable: true, writable: true }) stream.stream.call(self) self.on('pipe', function(src) { // happen here? how set self.binarydata? }) return self } util.inherits...

Qualitative predictor variables not appearing in regression summary output R -

i have big dataset use run linear regression models qualitative predictor variables. call dataset wn , qualitative variables ostate , dstate (states in us). here see there 62 unique values of ostate , dstate within wn: > unique(wn$ostate) [1] ny ma pa de dc va md wv nc ri sc nh ga fl al tn ms me ky oh in mi vt ia wi mn sd nd mt ct il mo ks ne nj la ar ok tx co wy id ut az nm nv ca or wa 62 levels: aa ae ak al ap ar az ca co ct dc de fl fm ga gu hi ia id il in ks ky la ma md me mh mi mn mo mp ms mt nc nd ne nh nj nm nv ny oh ok or pa pr pw ri sc sd tn tx ut va vi vt wa ... wy > unique(wn$dstate) [1] ma ri nh me vt ct ny nj pa de dc va md wv nc sc ga fl al tn ms ky oh in mi ia wi mn sd nd mt il mo ks ne la ar ok tx co wy id ut az nm nv ca or wa 62 levels: aa ae ak al ap ar az ca co ct dc de fl fm ga gu hi ia id il in ks ky la ma md me mh mi mn mo mp ms mt nc nd ne nh nj nm nv ny oh ok or pa pr pw ri sc sd tn tx ut va vi vt wa ... wy now running regression model predict rate...

How to change the apache user for a virtual host in Centos 7? -

i trying set web server on centos 7. have created virtual host editing /etc/httpd/conf/httpd.conf. root directory of virtual host set /var/www/html/domain.com. able open domain.com in browser no issue. however, when use get_current_user() in php file test user server running under, output "root" security concernt. how change user of virtual host? when set similar scenario in ubuntu, used apache2-mpm-itk module , configured virtual host "assignuserid your_username your_username" , did trick. don't know how in centos. thanks you can try use suexecusergroup that. i found method plesk's configuration. <virtualhost *:80> . . . <ifmodule mod_suexec.c> suexecusergroup "anyuser" "anygroup" </ifmodule> . . . /virtualhost>

Ceilometer or Healthnmon for measuring VM stats in OpenStack -

i looking measure stats vms running in openstack environment. stats uptime, cpu or ram consumption vm. my understanding reading documentation ceilometer , healthnmon measuring stats of resources used on individual openstack nodes. is true or can ceilometer or healthnmon extended capture monitoring stats vms well? ceilometer meters can used monitor vm vital stats. in hea templates been used monitor vm cpu utilizations , memory consumptions.

java - Why is my array still NULL -

i attempting create simple way lay out tiles game. how ever new java , oop, reason variables in array still null after assigned variables them via loop. what have done wrong, why array still null? thanks. stages stage1 = new stages(); public void stage1init() { stage1.stagew = 30; stage1.stageh = 30; stage1.tilesize = 100; stage1.stagestartx = 2; stage1.stagestarty = 24; //layout stage1 int w = stage1.stageh; int h = stage1.stagew; for(int = 0; < h; i++) { for(int j = 0; j < w; j++) { stage1.tilepositionx[i][j] = 100 * j; stage1.tilepositiony[i][j] = 100 * j; } } } //draw current stage public void drawstage1() { int w = stage1.stageh; int h = stage1.stagew; for(int = 0; < h; i++) { for(int j = 0; j < w; j++) { savecurrenttransform(); t...

Get specific URL with PHP Simple HTML DOM Parser -

This summary is not available. Please click here to view the post.

html - Foundation interchange responsive images only loading img src -

new foundation.so far, don't know why interchange isn't working. image working img src. none of others being dynamically generated. it's not bad path, code wrong below or perhaps javascript file needed? have foundation.interchange.js along rest of js files. <img data-interchange="[img/small.jpg, (small)], [img/medium.jpg, (medium)], [img/large.jpg, (large)]" data-uuid="interchange-i2pip11r1" src="img/large-banner.jpg"> i had problem , looking long time find answer , had use normal css images because couldn't solve problem. @media (max-width: 1120px) { .map { width: 625px; height: 380px; } } @media (max-width: 855px) { .map { width: 480px; height: 375px; } } @media (max-width: 675px) { .map { width: 0; height: 0; } } map class image.

java - Apache Commons CLI 1.3.1: Option coming after another option with multiple arguments is consumed as ARGUMENT -

i'm using apache commons cli 1.3.1 process options , of options can take 1 unlimited number arguments. trivia example 2 options this usage: myprogram -optionx <arg1> <arg2> <arg3> < ... > [-optiony] -optionx <arg1> <arg2> <arg3> < ... > optionx takes 1 unlimited number of arguments. -optiony optiony optional what found second option optiony recognized argument of optionx instead of being recognized option itself. means if type myprogram -optionx arg1 arg2 -optiony in command line, 3 arguments ( arg1 , arg2 , , -optiony ) associated optionx . here code can use reproduce problem. import org.apache.commons.cli.*; public class testcli { public static void main(string[] args) { option optobj1 = option.builder("optionx") .argname("arg1> <arg2> <arg3> < ... ") ...

java - How to set custom icons for individual nodes on a JTree? -

i need able set icons jtree individual nodes. example, have jtree , need nodes have custom icons represent are. (wrench icon) settings (bug icon) debug (smiley face icon) fun stuff ... and on. have tried several sources , got 1 working, messed tree events so, no cigar. in advance. as requested: class country { private string name; private string flagicon; country(string name, string flagicon) { this.name = name; this.flagicon = flagicon; } public string getname() { return name; } public void setname(string name) { this.name = name; } public string getflagicon() { return flagicon; } public void setflagicon(string flagicon) { this.flagicon = flagicon; } } class countrytreecellrenderer implements treecellrenderer { private jlabel label; countrytreecellrenderer() { label = new jlabel(); } public component gettreecellrenderercomponent(jtree tree, ...

php - Magento header jumping -

i have strange bug while browsing through categories on magento webshop header of webshop changes height on different pages ( http://shop.tvornica-snova.hr/index.php/ ) ie if on homepage, , click on of categories header extends additinal 10px in height , kind of pushes content down. i seem have same html structure , layout both homepage , categories cannot figure out bug. can help? check out header-top section of markup normal page, , "jumping" page. normal: <div class="logo"> <strong>magento commerce</strong> <a href="http://shop.tvornica-snova.hr/index.php/" title="magento commerce" class="logo"> <img src="http://shop.tvornica-snova.hr/skin/frontend/default/f002_yellow/images/logotvornica.png" alt="magento commerce"> </a> </div> jumping: <a href="http://shop.tvornica-snova.hr/index.php/" title="magento commer...

java - Enabling AES-256 Cipher suites on Openfire -

i'm putting xmpp server project of mine, , have rather strict encryption standards. namely, need tls protocol utilize aes-256 cipher suites , equivalents. basically, doesn't require jce unlimited policy, want excluded. yes, know it's highly prohibitive on client because need able use/install jce policy. i'm ok that, , i'm not allowed work around it. as understand, openfire runs off of base jre. i've found how install jce unlimited policy in jre, , further how remove cipher suites java environment via jdk.tls.disabledalgorithms in java.security. however, testing shows when set environment client , server have no shared supported suites, , encrypted connections set "required," client can still connect , communicate. i'm trying avoid behavior. furthermore, release of openfire 4.0, , ability modify list of enabled cipher suites directly, notice aes-256 ciphers not on supported list in first place, when jce unlimited policy installed. meaning, w...

apache zookeeper - VM architecture for running HA Mesos Cluster -

i'm reading mesos architecture docs which, ironically, don't specify components supposed run on vms/physicals. it looks like, run mesos in ha, need several categories of components: mesos masters zookeeper instances (quorum) hadoop clusters (job nodes? name nodes?) but there's never mention of how many need of each type. so ask: how many vms/physicals need run mesos ha, , components should deployed each? did have @ ha docs ? run mesos in ha, you'll need mesos masters , zookeeper. hadoop-related configurations out of scope mesos ha itself. to have ha setup, you'll need uneven number of nodes masters , zookeeper (because of quorum mechanism). in our case, we're running 3 master , 3 zookeeper nodes on 3 machines (one master , 1 zookeeper instance per machine), , number of mesos slaves/agents on different machines. theoretically, slaves/agents can run on same machines masters/zookeepers well. guess matter of preferences , availability o...

Adding code example to QT C++ -

i'd add qt example code simple project. sample code here: https://wiki.qt.io/download_data_from_url it consists of filedownloader.cpp , filedownloader.h -- code downloads graphic supplied url. i've added these files project , clean compile. think understand code ok (i'm c coder, not c++) don't understand how can pass qurl created project filedownloader.cpp the "project" simple main.cpp/mainwindow.cpp/mainwindow.ui offers button pressed. pressing button calls routine below: void mainwindow::on_pushbutton_clicked() { // pass filedownloader process qurl fileloc("http://www.test.com/test.jpg"); } how feed qurl fileloc filedownload.cpp? you have add new method filedownloader, accepts qurl , starts download. filedownloader.h: #ifndef filedownloader_h #define filedownloader_h #include <qobject> #include <qbytearray> #include <qnetworkaccessmanager> #include <qnetworkrequest> #include <qnetworkreply>...

scope - Javascript game loop state in an anonymous function -

i'm messing around canvas, , starting reading bunch of game loop snippets/posts , combining them best 1 possible. i came upon snippet today (it's part way through a post , make further iterations on later. i'm integrating ideas go), it's perplexing me little. game.run = ( function() { var loops = 0; var skipticks = 1000 / game.fps; var maxframeskip = 10; var nextgametick = (new date).gettime(); return function { loops = 0; while ((new date).gettime() > nextgametick && loops < maxframeskip) { game.update(); nextgametick += skipticks; loops++; } game.draw(); }; } )(); game._intervalid = setinterval(game.run, 1000 / game.fps); so game.run gets assigned result of outer function, inside function. inside function relies on nextgametick , defined in outer function... so game keeping state in outer...

javascript - how will asp.net mvc-5 bunble behave if i am referecing .min and the full scripts -

i working on asp.net mvc-5 web application . , inside bundle define following (where referencing .js , min.js files):- bundles.add(new scriptbundle("~/bundles/jstemplate").include( "~/bower_components/moment/min/moment.min.js", "~/bower_components/fullcalendar/dist/fullcalendar.min.js", "~/js/jquery.datatables.min.js", "~/bower_components/responsive-tables/responsive-tables.js", "~/bower_components/bootstrap-tour/build/js/bootstrap-tour.min.js", "~/js/jquery.raty.min.js", )); where referencing .js & min.js files, how bundle work in case on production server ?. know bundle (when debug=false) these 2 main tasks:- 1. combine scripts inside bundle single file 2. minify combined file. now in case bundle contain minify , non-minify files, mean minify files additional minification ? or minified files can not minified , bundle deliver .min.js client ? the bundle minify files first(if...

c# - Change values in Class Attribute at runtime -

if have class this [attr("blah", data = "blah")] public class test : superclass{} is there way can change values of attribute of instance of class @ runtime? eg in pseudo code superclass test = new test(); test.attr.value = "blah1"; test.attr.data = "blah2"; (i have instance of class want change attributes on, cast class extends) there no implicit connection between attributes , objects instances. between class , attribute. best bet attribute in constructor , "cache" values in properties on object. of course doesn't make sense if looking @ test class, make sense if constructor of superclass looks custom attributes on type retrieved "this.gettype()".

node.js - Strange symbols in log with winston -

initialization: var winston = require('winston'); var logger = new (winston.logger)({ levels: { trace: 0, input: 1, verbose: 2, prompt: 3, debug: 4, info: 5, data: 6, help: 7, warn: 8, error: 9 }, colors: { trace: 'magenta', input: 'grey', verbose: 'cyan', prompt: 'grey', debug: 'blue', info: 'green', data: 'grey', help: 'cyan', warn: 'yellow', error: 'red' } }); logger.add(winston.transports.console, { level: 'error', prettyprint: true, colorize: true, silent: false, timestamp: false, json: false }); for example call logger this: logger.info("issandbox: " + issandbox); in idea see: info: issandbox: true but when i've uploaded script ubuntu server, saw in log: ...

audio - Accessing Files in the Raw folder in Android -

i working on exporting function in android application. files wav files stored in res/raw folder. how can access files? uri = uri.parse("android.resource://" + getpackagename() + "/raw/" + selection[i]); try{ file[i] = new file(uri.getpath()); if(file[i].exists()){ log.i("exist", "exist"); }else{ log.i("exist", "not"); } } catch(exception e){ log.i("error", "file not found"); } selection[i] filename of file need in res/raw folder. code returns "not", means has not found file want res/raw folder. can me please? thanks. i'm not sure can access resource through file that. here's how i'm reading html files in raw folder: public static string getstringfromresource(context context, @rawres int id) { ...

go - Golang - TLS handshake error -

i running https web server in go. testing using angular web app (chrome browser) makes ajax calls web server. if keep hitting web server continuously seems working. whenever leave idle sometime , hit web server ajax call browser doesn't response. see log line in server log. 2016/01/16 04:06:47.006977 http: tls handshake error 42.21.139.47:51463: eof i can confirm ip address ip address. i starting https server this: r := mux.newrouter() r.handlefunc("/status", handlestatus) setuploginendpoint(&cfg.session, r) setuplogoutendpoint(cfg.session.cookiename, r) setupchangepasswordendpoint(cfg.session.cookiename, r) setupmetricsinkendpoint(cfg.metric.sinkapikey, r) setupmetricqueryendpoint(cfg.session.cookiename, r) http.listenandservetls(":443", "../cert.pem", "../keys.pem", &server{r}) i can confirm closing request body in every handler using defer r.body.close(). i using go 1.5.2. any appreciated. regards, sathya ...

r - Set precision inside a function -

i trying figure out how increase precision of output of function. need have output of acf function @ least 5 digits accuracy, while gives me 3. v = c(1.1,3.2,2.1,4.5) acfv = acf(v) acfv the precision-adjusting function know options(digits=...) , works explicit calculations in global environment. can me? you looking @ print-method output. acf values stored in full numeric precision: > acfv$acf , , 1 [,1] [1,] 1.0000000 [2,] -0.3399337 [3,] 0.2900897 [4,] -0.4501561

javascript - Automatically Submit Form If there is Value -

i have problem store visitor session. have idea fix automatically submit form input if there value. if use auto submit javascript, automatically submit regardless of whether or not existing value in input section. html code <form id="id_form" action="login.php" method="post"> username: <input type="text" name="user" id="user" value="this_value" /><br /> password: <input type="password" name="password" id="password" value="this_password" /><br /> save password: <input type="checkbox" name="session"/><br /> <input type="submit" value="submit" /> </form> javascript <script> setinterval(function() {submitform();}) { document.getelementbyid("id_form").submit(); } </script> visitors save password checking section, submit automatical...

scala - Can I use shapeless to return the same arity of HList as passed HList? -

here example. i'm trying wrap external api accepts , returns same arity of list : def externapi(args: list[int]): list[string] = args.map(_.tostring) i thought excuse learn shapeless seems hlist able do. def foo(args: hlist): hlist = ??? how can encode in type passed hlist , returned hlist of same arity? to expand on @stew's comment, can use sized enforce equal arity between lists. import shapeless._ import syntax.sized._ def externapi[n <: nat](args: sized[list[int], n]): sized[list[string], n] = args.map(_.tostring) usage: scala> externapi(sized[list](1, 2, 3, 4)) res0: shapeless.sized[list[string],shapeless.nat._4] = list(1, 2, 3, 4) scala> res0 foreach println 1 2 3 4 i'm far shapeless expert, don't know if there way hlist , seems collections homogeneous anyway.

c# - Null Table adapter value with if then statement -

i have vb.net program checks see if specific terminal has been used on last week. i'd use if statement send me results. if tableadapter empty (null) execute in program... right have: me.1tableadapter.fill(me.swipercheck.1, dtstartdate, todayend) if (me.swipercheck.1.count = 0) msgbox ("it worked") here dataset query: select case when count(sterminal) = 0 null else count(sterminal) end terminal swipe (dtcreated between @startdate , @enddate) , (sterminal = 'swiper 1') however it's not working , know output "null" if output not null, program works correctly. if want return no records when count 0 have this: select count(sterminal) terminal swipe (dtcreated between @startdate , @enddate) , (sterminal = 'swiper 1') having count(sterminal) > 0 that should make orignial if work correctly.

php mysql query | html table -

Image
guys confused populated data in table not showing first record html table: <table class="table table-bordered table-condensed" align="center" bordercolor="#cccccc"> <tr bgcolor="#009933"> <td align="center" style="color:#fff;">name</td> <td align="center" style="color:#fff;">course</td> <td align="center" style="color:#fff;">grade</td> <td align="center" style="color:#fff;">remark</td> </tr> <?php while($result= mysql_fetch_array($query1)){ echo "<tr>"; echo "<td>".$result[...

linux - awesome wm - how to bind a key to another key -

i'm new awesome wm , i'm trying bind key key. e.g. when press alt+j , act pressed down key on keyboard. i don't know whether awesome wm has function or not? any function this? awful.key({ altkey }, "j", function () "down" i think may misunderstanding question. interpretation 1: just copy code other key binding. in default config, mod+j is: awful.key({ modkey, }, "j", function () awful.client.focus.byidx( 1) if client.focus client.focus:raise() end end), copy part , change key: awful.key({ }, "down", function () awful.client.focus.byidx( 1) if client.focus client.fo...

python - Run app from Flask-Migrate manager -

i used these lines start application: from app import app app.run(host='0.0.0.0', port=8080, debug=true) using flask-migrate, have instead: from app import manager manager.run() manager.run not take same arguments app.run , how define host , port? manage.py replaces running app python app.py . provided flask-script, not flask-migrate adds commands it. use runserver command supplies run dev server. can pass host , port command: python manage.py runserver -h localhost -p 8080 -d or can override defaults when configuring manager: manager = manager() manager.add_command('runserver', server(host='localhost', port=8080, debug=true)

Bad Authentication Data QuickBlox - Android -

i working on quickblox sdk , using sdk trying login on facebook . have visited helpfull links on stackoverflow this , didn't me . here code snippet . qbauth.createsession(new qbentitycallbackimpl<qbsession>() { @override public void onsuccess(qbsession session, bundle params) { string token = session.gettoken(); qbusers.signinusingsocialprovider(qbprovider.facebook, token, null, new qbentitycallbackimpl<qbuser>() { @override public void onsuccess(qbuser user, bundle args) { toast.maketext(getapplicationcontext() , "success" ,toast.length_short).show(); } @override public void onerror(list<string> errors) { toast.maketext(getapplicationcontext() , "onerror" ,toast.length_short).show(); } }); } @override public void onerror(list<string> errors) { } }); logcat details : access-co...

c# - MVC3 Razor CMS - create localized page dynamically -

i building cms allows admin create pages (.cshtml) dynamically without controller. so far if page created code behind , saved in page folder, can access new page. however in page folder cannot create directory-type structure new pages. ex. page/home/new, page/settings/mysettings ..etc only pages created in page folder displayed correctly, others 404 error. the other problem cannot perform globalization of new pages. what able access new pages like: en/home/aboutus english culture fr/accueil/qui-sommes-nous french culture. globalized content stored in db. any link, tutorial, documentation or hints how highly appreciated. thanks, vishal

python - Keras AttributeError: 'module' object has no attribute 'relu' -

when try use keras in python, pycharm tells me: file "d:/bitbucket/kaggle/homesite quote conversion/keras_nn_test_0.96363.py", line 167, in <module> model.compile(loss='binary_crossentropy', optimizer="sgd") attributeerror: 'module' object has no attribute 'relu' does know why? this has been marked issue on issue tracker , caused fact version on pip not date. users on there suggested, re-installing theano cloning repository , using setup.py solves issue. p.s: explicitly mentioned in their installation guide : note: you should use latest version of theano, not pypi version. install with: sudo pip install git+git://github.com/theano/theano.git along other dependencies, of course.

android - Monitoring Listener detects only one beacon -

i have 3 estimote beacons (div kit). in android app i'm trying change 3 textviews show each beacon's major , minor. i've changed beacons settings advertise signal every 1ms shortest period of time. the problem beaconmanager object detecting 1 beacon , takes while that. here code app.java public class app extends application { public static beaconmanager mbeaconmanager; @override public void oncreate() { super.oncreate(); mbeaconmanager = new beaconmanager(getapplicationcontext()); mbeaconmanager.setbackgroundscanperiod(timeunit.seconds.tomillis(1), 0); mbeaconmanager.connect(new beaconmanager.servicereadycallback() { @override public void onserviceready() { mbeaconmanager.startmonitoring(new region( "monitored region", uuid.fromstring("b9407f30-f5f8-466e-aff9-25556b57fe6d"), null, null...

javascript - Uncaught TypeError: elements[i].attr is not a function -

this code: function () { var container = document.getelementbyid('data-table'); var elements = container.getelementsbytagname("input"); (i = 0; < elements.length; i++) { elements[i].on("ifchanged", handle_company_state(elements[i].attr('id'))); } } function handle_company_state(element_id) { //.... } when i'm trying run i' getting error: uncaught typeerror: elements[i].attr not function why? i think looking like: function () { var elements = $("#data-table input"); (i = 0; < elements.length; i++) { $(elements[i]).on("ifchanged", handle_company_state($(elements[i]).attr('id'))); } } function handle_company_state(element_id) { //.... }

d - How to create a tuple of ranges? -

template tupindextorange(alias tup, indicies...){ import std.meta; import std.typecons; static if(indicies.length == 0){ enum tupindextorange = tuple(); } else{ enum tupindextorange = tuple(tup[ indicies[0] ][], tupindextorange!(tup,indicies[1..$])); } } void main(){ alias integrals = aliasseq!(array!int, array!float, array!double); tuple!integrals integrals; integrals[0].insertback(1); integrals[1].insertback(2); integrals[2].insertback(3); auto t = tupindextorange!(integrals, 0, 1, 2); auto r = zip(t.expand); } err: source/app.d(119,34): error: variable integrals cannot read @ compile time source/app.d(119,33): called here: tuple(integrals.__expand_field_2.opslice(), tuple()) source/app.d(119,56): error: template instance app.main.tupindextorange!(integrals, 2) error instantiating source/app.d(119,56): instantiated here: tupindextorange!(integrals, 1, 2) source/app.d(219,12): instantiated here: tupindextorange!(integrals...

java - How to prevent Android from inserting the trailing \n\n when SetText using Html.FromHtml()? -

i settext edittext way: edittext.settext(html.fromhtml("<p><a href='#'>cadbury</a> fav chocolate</p>"); problem is, line inserts 2 additional breakpoints on edittext when value using html.tohtml(edittext.gettext()) result is: "<p><a href='#'>cadbury</a> fav chocolate</p>\n\n" i dont want trailing \n's, how remove them?

javascript - ReferenceError: $setTimeout is not defined -

i'm doing course , ran across , error. i'm making tinder producthunt using ionic , angular. ionic $ 0 776918 error referenceerror: $settimeout not defined @ scope.$scope.sendfeedback (http://localhost:8100/js/controllers.js:41:5) @ fn (eval @ <anonymous> (http://localhost:8100/lib/ionic/js/ionic.bundle.js:26457:15), <anonymous>:4:239) @ http://localhost:8100/lib/ionic/js/ionic.bundle.js:62386:9 @ scope.$eval (http://localhost:8100/lib/ionic/js/ionic.bundle.js:29158:28) @ scope.$apply (http://localhost:8100/lib/ionic/js/ionic.bundle.js:29257:23) @ htmlanchorelement.<anonymous> (http://localhost:8100/lib/ionic/js/ionic.bundle.js:62385:13) @ htmlanchorelement.eventhandler (http://localhost:8100/lib/ionic/js/ionic.bundle.js:16583:21) @ triggermouseevent (http://localhost:8100/lib/ionic/js/ionic.bundle.js:2948:7) @ tapclick (http://localhost:8100/lib/ionic/js/ionic.bundle.js:2937:3) @ htmldocument.tapmouseup (h...

java - How to add number of String values to an ArrayList? -

i have scenario wherein have bean class i'm getting client names , other client related details. i'm creating bean object , getting details. arraylist<clientbean> clientlist = (arraylist<clientbean>) (new queriesdao()) .getallclient(); from above code getting details of client. , client names i'm through index form, clientbean clist = clientlist.get(2); (clientbean clientbean : clientlist) { clientbean.getclientname(); // here i'm getting client names 1 one. } my question how add client names in arraylist dynamically? generally add values list (so arraylist ) can use methods: add(e e) add element @ end of list add(int index, e element) add element in specified position addall(collection<? extends e> c) add element @ end of list addall(int index, collection<? extends e> c) add element starting specified position please check documentation (linked on answer) detail...

python - XMPP rspauth token should contain what in a DIGEST-MD5 auth? -

background: i'm fiddling xmpp server doesn't work. so documentation on particular response token called rspauth not documented anywhere really. appear skip , go static string looking this: cnnwyxv0ad1lytqwzjywmzm1yzqyn2i1nti3yjg0zgjhymnkzmzmza== which b64decodes to: rspauth=ea40f60335c427b5527b84dbabcdfffd however @ last stages of md5-digest authentication, supposedly should sending following: <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'> cnnwyxv0ad1lytqwzjywmzm1yzqyn2i1nti3yjg0zgjhymnkzmzmza== </challenge> again, i'm not sure why everywhere in every bug report uses static string. xmpp client respond with: jabber: error -10 : sasl(-10): server failed mutual authentication step: digest-md5: server wants believe knows shared secret i try follow rfc's close can, , this rfc says rspauth= : the server receives , validates "digest-response". server checks nonce-count "00000001". if supports sub...

javascript - Show a different gallery depending on which button is clicked -

i have gallery here nation select buttons opens 1 background image in div ".displayarea", picking pics array "arrayindex". , "next"/"previous" select buttons, open separate gallery, in div ".containsnext", placed above displayarea div. close button closes both these divs. working far. want display different gallery different arrays(or can same, don't know more efficient)within .containsnext div, based on nation button clicked. say, button "croatia", pic photos array on line 3 displayed, button spain, array, arrayspain(line 9) displayed. know supposed post code of have tried, did not come useful. background pic in displayarea, have done following function addimageinto(arrayindex, container) { var displayarea = document.queryselector('.displayarea'); if (displayarea.queryselector('.' + container.id)) { return; } displayarea.innerhtml = ''; but cam not able achieve goal that. else working, ...