Posts

Showing posts from September, 2014

c# - Why would this code be placed in a *.Designer.cs file? -

in project i'm maintaining, original developer put code @ top of main form's designer.cs file: private void memberlistbox_load() { datatable dtmembers = null; sqlserver sqldal = null; sqldal = new sqlserver(properties.settings.default.bidataconnection); sqldal.commandtimeout = 120; dataset dsmember = sqldal.runsqldataset("select poisontoe platypusdata..members abs(activeflg)=1 order poisontoe", "members"); dtmembers = dsmember.tables[0]; memberlistbox.datasource = dtmembers; memberlistbox.displaymember = "poisontoe"; foreach (datarow unitdprow in dtmembers.rows) { string x = unitdprow[0].tostring(); memberlistbox.setitemchecked(memberlistbox.findstring(x), true); } } wouldn't mainform.cs more usual location such code? purpose of having in mainform.designer.cs? should move out mainform.cs?

linux - Ptrace parent process -

i'm trying monitor/redirect syscalls in own process. ld_preload doesn't work when fwrite calls write inside libc, , got/plt hooks seem have same problem. i'm looking solution based on ptrace, can't fork() , run main app child because app communicates parent via signals. there thread 2006 suggests tracer can on thread group that's different tracee, doesn't seem work in practice: http://yarchive.net/comp/linux/ptrace_self_attach.html pid = fork(); if (pid == 0) { prctl(pr_set_ptracer, getppid()); raise(sigstop); } else { sleep(1); ptrace(ptrace_seize, pid, null, null); (;;) { int status; int ret = waitpid(pid, &status, 0); warn("wait=%d:", ret); ret = ptrace(ptrace_syscall, pid, null, null); warn("ptrace=%d:", ret); } } the problem i'm facing ptrace(ptrace_syscall) expects tracee in ptrace-wait state, i.e. must have raised sigstop , tracer needs wait() i

node.js - Gulp: Wait for express server to start before running tests -

i'm pretty new node. built sample express app , wrote bdd tests using cucumber.js. automate tests using gulp when run tests first start express app and, once server up, run through tests. however, tests run before server , therefore fail. there way wait (using gulp) server start , run tests? i'm using gulp-cucumber , gulp-express here (somewhat hidden gulp-load-plugins). my gulpfile (partial): var gulp = require('gulp'), plugins = require('gulp-load-plugins')(); gulp.task('server', function () { plugins.express.run(['bin/www']); }); gulp.task('cucumber', ['server'], function() { return gulp.src('features/*').pipe(plugins.cucumber({ 'steps': 'features/steps/*.steps.js', 'support': 'features/support/*.js' })); }); gulp.task('test', ['server', 'cucumber']); i have use solution - https://www.npmjs.com/package/run-sequence var gulp =

html - Make container div expand to size of inner contents using table-cell display -

seems pretty standard problem: need container div element expand horizontally according width property of inner fieldset . i've found far offers 2 solutions. first solution use display:inline-block . however, i'm using display:table-cell position container won't work. the second add min-width container div. solve issue, width of inner fieldset not static, while looks fine when there's lot of content in fieldset looks awkward otherwise (there huge gap between particular div , 1 it's right). is there way force container div automatically resize, based on inner content, without using 2 solutions above? fiddle: http://jsfiddle.net/mj3h1682/ edit added following script page. method using css , if knows of one. <script type="text/javascript"> $(document).ready(function() { var width = $('#profile').outerwidth() + 20; $('#partialcolumn1').css('min-width', width); }); </script>

android - Retrofit 500 Internal server error getting data -

i'm starting out retrofit, i'm trying data server via @post request keep returning 500 internal server error. my aim send user name through request , server should return json string containing list of data given user. i'm sure simple i'm fresh using retrofit, code below: my servicegenerator(uses authentication): private static final string url = "http://ip address/projectzws/projectzwebservice.asmx"; private static restadapter.builder builder = new restadapter.builder() .setendpoint(url) .setclient(new okclient(new okhttpclient())); public static <s> s createservice(class<s> serviceclass, string username, string password) { if (username != null && password != null) { // concatenate username , password colon authentication string credentials = username + ":" + password; // create base64 encodet string final string basic = "basic " + base64.

java - Android app:dex:Debug error - cannot seem to solve -

please see link attached exact error. can run other android projects, 1 trying run refuses work: https://gyazo.com/bc05c903dddc7dd3b79f9979d6bc42aa build.gradle buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.3.0' // note: not place application dependencies here; belong // in individual module build.gradle files } } allprojects { repositories { jcenter() } } build.gradle (app) apply plugin: 'com.android.application' android { compilesdkversion 23 buildtoolsversion '23.0.1' defaultconfig { applicationid "com.tapthatstudios.fingersoffury" minsdkversion 21 targetsdkversion 23 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile 'com.android.supp

Custom sorting in PowerBI chart -

Image
recently came across 1 issue in need show column order per defined way in powerbi report. thing is, powerbi sorts columns in either ascending(a->z) or descending(z->a) order, if 1 has apply custom order how should achieve this? here , example here can see order on x-axis ascending or can show descending, if sort order respect need; may below : 1.2 wheel preview --> 1.2 gtr --> 1.2 ultra --> 1.2 rtr , possible in powerbi desktop while creating report, if yes, guidelines followed appreciated. :) thanks. add column source data , populate values desired sort order. select column want custom sort , click modeling > sort column. select new column sortby column existing column, in screenshot: sortcategory column used sort order category column. now create chart , categories on axis sorted according values of sortcategory column.

java - What could make WildFly undeploy automatically an EAR? -

i have application hosted in wildfly 8.2.1.final , after days undeploy automatically ear. the server started ./standalone.sh , ear deployed putting ear in standalone/deployments folder along .dodeploy file. the last lines of server.log shows: info [org.wildfly.extension.undertow] (msc service thread 1-7) jbas017535: unregistered web context: /app info [org.wildfly.extension.undertow] (msc service thread 1-5) jbas017535: unregistered web context: /appportal info [org.jboss.as.jpa] (serverservice thread pool -- 60) jbas011410: stopping persistence unit (phase 2 of 2) service 'appear.ear/appejb.jar#appejb' info [org.jboss.weld.deployer] (msc service thread 1-5) jbas016009: stopping weld service deployment appear.ear info [org.jboss.as.jpa] (serverservice thread pool -- 60) jbas011410: stopping persistence unit (phase 1 of 2) service 'appear.ear/appejb.jar#appejb' info [org.jboss.as.server.deployment] (msc service thread 1-3) jbas015974: stopped subdeplo

swift - segue to next ViewController and pass data if condition is valid -

i trying segue first viewcontroller second 1 , pass value of var dateandtime = nsdate() second view controller. my first approach segue first viewcontroller second one, define name of segue in attributes inspector. next, link button @ibaction func nextbuttontofifthviewcontroller in first viewcontroller, use if else statement , prepareforsegue , code not compile because not allowed override prepareforsegue . @ibaction func nextbuttontofifthviewcontroller(sender: anyobject) { if timerestricted.contains(hourcomponents){ self.label.text = "please choose time betwen 7:00 - 19:00" } else { override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) { var destviewcontroller:fifthviewcontroller = segue.destinationviewcontroller as! fifthviewcontroller destviewcontroller.dateandtimeselected = dateandtime } } my second approach use performseguewithidentifier , wont able pass data next view controller because d

c++ - Weird error when defining variables -

so, i'm trying use lua c api on game, i'm having errors defining variables in .cpp file i have library called clua.h define of stuff i'm using in following code, , compiles fine. (i not sharing it, because it's pretty valuable , highly sought after game i'm using in, don't want else have work, either way there's no problem library) #include <iostream> #include <windows.h> #include <string> #include "clua.h" using namespace std; void clua::init(){ lua_tolstring = (lua_tolstring)0x00517f70; lua_getfield = (lua_getfield)0x00516d70; lua_pcall = (lua_pcall)0x00517340; } for starters, on #include line, i'm getting error called "pch warning" on # then, when define of lua states farther down, on = sign, error saying expected identifier if understanding issue correctly, looks naming variables same class name. example, cannot name int variable 'int'. so, if class name 'lua_tolstring',

selenium - Check for child tag inside parent tag -

is possible know if parent contains child specific class name. sample code <div id="parent_tag"> <div id="div1"> <span>title 1</span> </div> <div id="div2"> <b>title 2</b> </div> <div id="div3"> <span>title 3</span> </div> </div> i trying access "span tag" title 3. know can specifying id. if want generically (i.e elements). first approach should "i span tag inside div". don't know how that? please help. try xpath : //div/span[text()="title 3"]

increment and decrement with cout in C++ -

this question has answer here: unexpected order of evaluation (compiler bug?) [duplicate] 3 answers i'm new c++ , study increment , decrement operators. tried example: int x = 4; cout << ++x << " " << x++ << " " << x++ << endl << endl; cout << x << endl; it returns weird output on c++ .net , qtcreator , 5 online c++ compilers: 7 5 4 7 the weird thing expect this: 5 5 6 7 can explain happens? please notice cout << x++ << ++x; notation for: operator<<( operator<< (cout, x++), ++x); the order in x++ , ++x statements evaluated undefined , effect of code. even if seems happens right left in particular examples, should not rely on means. just make experiment using multiple statements as: cout <<

iOS NSURLSession background upload completes with error if device locked -

i'm attempting upload large files reliably possible. i've chosen nsurlsession using nsurlsessionconfiguration.backgroundsessionconfigurationwithidentifier configuration , create , resume upload task. works great except if user locks screen while file being uploaded. originally, upload stop in 10 secs nsposixerrordomain error code 1: "operation not permitted". after researching issue here, set file's nsfileprotectionkey nsfileprotectioncompleteunlessopen . after fix, entire file uploaded. i've confirmed looking @ file on server. still same error upon completion. i've confirmed not occur if device not have passcode set, think still has file encryption/data protection. i've tried setting file's nsfileprotectionkey nsfileprotectionnone , still same error once upload finishes. i have no idea system attempting triggers error. there application file system needs write once upload completes? have idea might triggering "operation not

git-push tag sending too many objects -

i'm facing issue when pushing new tags remote repository. seems sending whole repository every new tag. however, create tags branch work on, pushing branch before push tag. when push branch, sends new commit objects. i have been using following procedure on 2 years without problems, until recently. i make changes in local development branch (e.g. master) , push remote: host:folder user$ git push origin master fetching remote heads... refs/ refs/heads/ refs/tags/ updating 'refs/heads/master' 226334abbe733ffa8bb1a0fb8a34843aa9127c13 ccdfb7de73d4a17b31aa83e0c9626e19b23717ac sending 23 objects done updating remote server info https://githost/repo/ 226334a..ccdfb7d master -> master then checkout production branch, merge changes , push branch, too: host:folder user$ git checkout production switched branch 'production' branch up-to-date 'origin/production'. host:folder user$ git merge master updating 226334a..ccdfb7d fast-f

mysql - Select row based on max date across several columns -

Image
for mysql database i have table includes duplicate rows because of date values in several columns. looking select single row each unique customer id based on max date value evaluated across several date columns [customer id, startdate, stopdate, modifydate, buydate] for each customer id, i'd return row has maximum date either in startdate, stopdate, modifydate or buydate columns ( there nulls in date columns. editing include example - sure how create table here: *** edit been trying quite awhile create table here example. can't figure out. posting image? desired rows returned indicated in red. assuming values never null , can use greatest() : select t.* table t greatest(t.startdate, stopdate, buydate) = (select max(greatest(t.startdate, stopdate, buydate)) t t2 t2.customerid = t.customerid ); note: return multiple rows customer if more 1 row contains maximum date.

java - Android - ArrayList and RecycleView.Adapter -

i have got chordslistactivity looks this: public class chordslistactivity extends activity { private recyclerview chordslist; private recyclerview.layoutmanager listlayoutmanager; private arraylist<accordo> getchords() { arraylist<accordo> chords = new arraylist<>(); accordo a=new accordo(); a.setname("do maggiore"); a.setnote("do, mi, sol"); a.setimage(r.drawable.do_maggiore); chords.add(a); a=new accordo(); a.setname("do 5"); a.setnote("na, na, na"); a.setimage(r.drawable.do5); chords.add(a); return chords; } @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_chords_list); chordslist = (recyclerview) findviewbyid(r.id.chords_recycler); //use linear layout manager listlayoutmanager = new linearlayoutmanager(this); chordslist.setlayoutmanager(listlayoutmanager);

Describe websocket api via Swagger -

is possible describe websocket server api via swagger? we have events broadcasting via websocket server , want describe them via 1 swagger specification file. is there documentation generators websockets? it seems possible using swagger-socket . still, seems java/scala server implementation exists now, means not codegens there "standard" swagger rest services.

c# - Any change on a dll requires running setup on the user machine -

i writing in-house applications used multiple users in factory. those different applications may refer same dll. changes done on dll requires running setup applications use on user's pc installed on. is there way deploy dll on user's pc last version without having run setup on each machine? i make creating batch file first copy dll installed folder , run application. not seem acceptable me. not sure relevant answer creating setup using installshield limited version maybe dll belongs gac (see what gac in .net? ) given proper policy files can update application use specific version (or range of versions). way can leave of applications use old version if you've made change not backwards compatible anymore.

Highcharts - Change opacity of chart when tooltip is shown -

when tooltip shown, possible change opacity of data points in chart, exception of data point label shown? i.e. in default column chart, when mouse moves on column, column highlighted bit. same event, i'd other column's opacity change 50%. thanks you can use point mouseover , mouseout events callback functions in case of chart. inside events can update color of specific points. http://api.highcharts.com/highcharts#plotoptions.area.point.events.mouseover http://api.highcharts.com/highcharts#plotoptions.area.point.events.mouseout if use rgba colors, able set opacity. point: { events: { mouseover: function() { highcharts.each(this.series.data, function(p, i) { p.update({ color: 'rgba(50,120,60,0.5)' }, false) }); this.update({ color: 'rgba(50,120,60,1)' }); }, mouseout: function() { highcharts.each(this.series.data, function(p, i) {

linux - Does RPM build always take the files from ~/rpmbuild? -

everywhere have seen on internet, default location rpmbuild user's home directory, ~/rpmbuild . if wish build in folder location, say, ~/foo/bar/rpmbuild ? why this? difference make if build location else? edit: means ~/rpmmacros file anywhere. you can build rpms without having modify or maintain .rpmmacros file specifying _topdir in rpmbuild command line. example, rpmbuild --define '_topdir $(rpmbuild_dir)' \ --define 'version $(version)' \ --define 'release $(release)' \ -bb $(pkgname).spec is in 1 of makefiles rpm project build rpms under ${rpmbuild_dir} specified version , release numbers variables. use lot can have multiple rpm-building projects don't conflict each other trying build in same directory.

javascript - Why does underscore use immediately invoked function expression to wrap all of its code? -

<html> <head> </head> <body> <script src="underscore.js"></script> <script src="app.js"></script> </body> </html> i saw whenever html loaded, code in underscore.js (even code don't need) executed because of invoked function expression. flaw of underscore.js? why don't wrap code of underscore.js inside normal object instead of function object (the invoked function expression) ? it common pattern can control export. .call(this) may put on window or node's global . as "all code ... executed" - functions won't executed, parsed other scripts.

Google Maps API Android - map not appearing when using keystore -

i able run app fine using debug keystore - when attempt run production version generated keystore - no map. i have verified should - api key - check! keysrore sha1 - check! log follows: authorization failure. please see https://developers.google.com/maps/documentation/android/start how correctly set map. in google developer console ( https://console.developers.google.com ) ensure "google maps android api v2" enabled. ensure following android key exists: api key: xxxxxxxxxxxxxxxxx-xxxxxxxx android application (;): xxxxxxxxxxxxxxxxxxxxxx;xx.xxx

sitecore - Glass mapper does not load item childeren -

we facing issue in glass mapper 4.0 not load item children. here our controller class , inheriting glasscontroller: public class carouselcontroller : glasscontroller { public actionresult getcarousel() { model = this.getdatasourceitem<carouselviewmodel>(); return view(model); } } and here our view model: public class carouselviewmodel:carousel_folder { [sitecorechildren] public virtual ienumerable<carousel> carousels { get; set; } } we parent node information not childeren (carousels) in result here result get: [result image][1] also, following classes generated tds: [sitecoretype(templateid = icarousel_folderconstants.templateidstring )] //, cachable = true public partial interface icarousel_folder : iglassbase {} carousel template inheriting 2 templates content base , image base. i had issue before, me added [sitecorechildren(islazy = false)] model , works fine, in case should : public class ca

twilio - How do I send a user token via SMS with Authy and PHP? -

i trying run demo authy in php. have installed authy library composer, can register user using hardcoded values this: $authy_api = new authy\authyapi('<testing api key>', 'http://sandbox-api.authy.com'); // actual key omitted -- using key generated testing, not 1 production $user = $authy_api->registeruser('something@something.com', '999-999-9999', 30); // actual credentials omitted if($user->ok()){ echo "success!"; $id = $user->id(); echo($id); } when above script runs, 5-digit user id indeed generated, seems going well, yet sms never delivered phone. one possible problem number registered app phone (associated admin account), since (per docs) each phone number has uniquely identify user, maybe mine registered app , therefore no need arose send new token. should case, id of user object may registered one. the problem remains other phone numbers however. i'm lost. turns out, there nothing

gcc - clang error compiling mongodb from source -

i took git checkout of mongodb source files , trying compile it. have gcc installed part of xcode-7.3.1 command-line tools now when trying build mongodb binaries using: scons i getting below error: scons: reading sconscript files ... scons version: 2.5.0 python version: 2 7 10 'final' 0 checking whether c compiler works... yes checking whether c++ compiler works... yes checking c++ compiler can link c++ program... yes checking if c++ compiler "g++" gcc... no checking if c++ compiler "g++" clang... yes checking if c compiler "gcc" clang... no c compiler not match identified c++ compiler see /users/debashish.g/mongo-code/mongo/build/scons/config.log details in config log shows: scons: configure: checking if c compiler "gcc" clang... build/scons/sconf_temp/conftest_5.c <- | |#if defined(__clang__) |/* using toolchain defined(__clang__) */ |#else |#error |#endif | gcc -o build/scons/sconf_temp/conftest_5.o -c build/scon

scala - How to make scalajs project depend on a subproject? -

i use case class sub project , receive error: referring non-existent @ runtime in build.sbt, have: lazy val scalajsproject = (project in file("scala-project/")) .dependson(modelproject) i guess dependson not work scalajs? i followed instruction here https://github.com/scala-js/scalajs-cross-compile-example create crossproject. , put models shared folder of crossproject. , recoginizes both in jvm , js project.

Right database for storing large amounts of entity relationship data -

i'm trying choose database suits use case. here simple example of i'm trying store in database: lets say, have 'users' , 'groups'. each user can part of number of groups. there hierarchy in groups ie.. each group can have multiple child groups.(and child groups can again have grandchildren , on...) requirements: i adding multiple users parent group , should automatically added child groups.. so, have child groups of given group , add these users every 1 of them. operation should atomic. i have multiple threads running in parallel updating groups & adding users them. don't want race conditions. if go rdbms approach, have user table, group table , relationship tables user-group mapping , parentgroup-childgroup mapping. able handle requirements using transactions/locks etc.. but, - number of users going few million , each user on average part of couple of hundred groups , height of group hierarchy tree less(<20), relationship tabl

Matlab Subscripted assignment dimension mismatch error -

i'm trying perform row multiplication 2 matrices: a , b . a subscripted assignment dimension mismatch error thrown on line c(1,i) = a(i,:)*b; . do have syntax error causing dimensions on left , right sides of = sign unequal? function c = rowproduct(a,b) [n,m]=size(a); [p,q]=size(b); c=zeros(1,n); if( m == p) i=1:n c(1,i) = a(i,:)*b; end else error('matrix dimension mismatch'); end end try replace c(1,i) = a(i,:)*b; c(i,:) = a(i,:)*b;

angularjs - Spring Security, Angular JS, Tomcat 7, CORS with form login not working -

i have requirement invoke cross domain ajax call angular app, @ localhost:8000. [i using grunt connect:livereload launches web server] the angular route localhost:8000/user/login displays form login, submission of makes ajax call backend spring rest controller integrated spring security. app hosted @ localhost:8080/mynext-app/login ajax call inside angular directive: mynextapp-login.validate.js: angular.module('login').directive('loginvalidate', function() { //jquery.validate.js settings in between. // followed handler submithandler: function(form) { var email = $("#email").val(); var password = $("#pwd").val(); var request = $.ajax({ url: "http://localhost:8080/mynext-app/login", method: "post", contenttype: "application/json", crossdomain:true, data: { ema

c++ - How properly dynamically allocate 2d array inside void function? -

i 'm still newbie in c++, don't mean me. know how initialize 2 dimentional array in void function. this example code gives me exceptions access violation locations instead: #include "stdafx.h" void matrixinit(char***); void matrixdel(char**); void main(void){ char** game=0; matrixinit(&game); matrixdel(game); return; } void matrixinit(char*** matrix) { matrix = new char**[3]; (int i(0); < 3; i++) { matrix[i] = new char*[3]; (int j(0); j < 3; j++) *matrix[i][j] = '0'; } return; } void matrixdel(char** matrix) { (int i(0); < 3; i++) delete[] matrix[i]; delete[] *matrix; return; } props @fireant allocating array. after research , debugger plays, figure out. hope solution in future! #include "stdafx.h" using namespace std; int** matrixinit(int, int); void matrixinit(int***, int, int); void matrixdel(int**, int); void matrixfill(int**, i

continue - Alternative to Goto keyword in python -

this question has answer here: `goto` in python 6 answers def fun_name(): condition: condition: if condition: #continue else: pass how jump outer loop there no goto or label keyword in python ? continue return me inner loop. there way achieve ? use 'break' keyword break out of inner loop.

translation - Transchoice and yaml in Symfony -

i'm convinced of yml translation files in symfony. strings structured. my question simple: following chaining in plural string valid? , if answer yes, how that? product: list: plural: "{0} product.list.none|{1} product.list.one|]1,19] product.list.lower20|[20,inf[ product.list.larger20" none: there no product one: there 1 product lower20: there %count% products larger20: there many products the correct syntax : product: list: plural: "{0} there no product|{1} there 1 product|]1,19] there %count% products|[20,inf[ there many products"

mysql - How to set column value as variable in msaccess php -

Image
my query : $att="select attdata.rollno,attdata.name,attdata.year,attdata.sec,attdata.".$date." attdata attdata.sec='".$sec."' , attdata.dept='".$dept."' , attdata.year='".$year."' , attdata".$date."='ab' "; my database design view my error warning: odbc_exec() [function.odbc-exec]: sql error: [microsoft][odbc microsoft access driver] syntax error (missing operator) in query expression 'attdata.sec='a' , attdata.dept='cse' , attdata.year='iv' , attdata'02-07-2016'='ab' ''., sql state 37000 in sqlexecdirect in c:\wamp\www\sms1.7.16\repotdaygen_allyear.php on line 325 select invalid37000 try ...i added square brackets around $date in 2 spots $att="select attdata.rollno,attdata.name,attdata.year,attdata.sec,attdata.[".$date."] attdata attdata.sec='".$s

ios - Build UIAlertController recursively and present it -

i want present uialertcontroller uialertcontrollerstyleactionsheet 1 after another. this, must present next uialertcontroller inside of handler of uialertaction . uialertcontroller *a = [uialertcontroller alertcontrollerwithtitle:@"alert a" message:@"my alert a" preferredstyle:uialertcontrollerstyleactionsheet]; uialertaction* a_action = [uialertaction actionwithtitle:@"a action" style:uialertactionstyledefault handler:^(uialertaction * action) { uialertcontroller *b = [uialertcontroller alertcontrollerwithtitle:@"alert b" message:@"my alert b" preferredstyle:uialertcontrollerstyleactionsheet]; uialertaction* b_action = [uialertaction actionwithtitle:@"b action" style:uialertactionstyledefault handler:^(uialertaction * action) { uialertcontroller *c = [uialertcontroller alertcontrollerwithtitle:@"alert c" message:@"my alert c" preferredstyle:uialertcontrollerstyleactionsheet];

css - Why isn't media query working on my blog? -

this blog: blog i've written following code in css: @media screen , (max-width: 600px){ .title a{ color: red !important; } } @media screen , (max-width: 500px){ header{ display: none !important; } } but nothing when open blog in phone. site opens whether open in phone or desktop browser. why so? you have in header, <meta content="width=1100" name="viewport"> please change to: <meta name="viewport" content="width=device-width, initial-scale=1"> for understanding how meta viewport works see: https://developer.mozilla.org/en/docs/mozilla/mobile/viewport_meta_tag what happens in code have set "atleast 1100px" width web pages. by changing device width, web pages wide device.

php - Getting multiple files value by javascript or jquery is not working properly -

i trying send images on server using jquery , ajax method. want upload multiple files not able properly. my html codes, <input type="file" name="imgs" multiple class="form-control floating-label" placeholder=""> my jquery codes, var imgdata = new formdata(); imgdata.append('uid', user_id); imgdata.append('o_img', $('input[name="imgs"]').get(0).files); $.ajax({ url : cdn_host + "index.php?action=upload", type: "post", data : imgdata, enctype: 'multipart/form-data', contenttype: false, processdata: false, success: function(data, textstatus, jqxhr) { if(jqxhr.status == 200){ if(data.error == 'true'){ alert'(true'); }else if(data.error == 'false'){

Is Python list variable not passing by reference? -

i'm confused pass-by-ref , pass-by-value in python. in following code, when listb = lista , listb should being assigned pointer (reference) list in lista variable. changes listb should reflected on lista. however, not case in test. doing wrong code? i'm running python 3.4.3 >>> lista = [1,2,3] >>> listb = lista >>> lista = [4,5,6] >>> print(lista, listb) [4, 5, 6] [1, 2, 3] >>> listb[0] ='new' >>> print(lista, listb) [4, 5, 6] ['new', 2, 3] when lista = [4,5,6] , reference lista (that assigned listb ) no longer points lista , since replaced lista new list. if remove line, find works expected.

java - Create input control using jasper restapiv2 -

i'm using jasper api rest v2 https://github.com/jaspersoft/jrs-rest-java-client . i'm trying create input control's dynamically. clientinputcontrol cliinp = new clientinputcontrol(); cliinp.setlabel("funcionario_id_1"); cliinp.setdatatype(new clientdatatype().settype(typeofdatatype.date)); cliinp.seturi("/datatypes/funcionario_id_1"); session.resourcesservice().resource("/datatypes").createnew(cliinp); i need create input control can add report. when executing code have exception in thread "main" com.jaspersoft.jasperserver.jaxrs.client.core.exceptions.badrequestexception: bad request edit log files give following error: mt error:[{ "message":"the type 0 invalid", "errorcode":"illegal.parameter.value.error", "parameters": ["type", "0"] }] can tell me i'm doing wrong?

c# - windows service won't start after changing target framework -

i have windows service worked when target framework .net 2, when changed .net 4 recompiled project, re-installed using installutil started service i'm getting "windows not start service on local computer. error 1067: process terminated unexpectedly." not sure how proceed, onstart() method not being hit debugger.break() line. idea how proceed? there settings or configuration need update if change target framework? some things check when uninstalled 2.0 version did uninstall? check control panel|services see if removed. reboot in between make sure uninstalled correctly. are using correct installutil.exe 4.0? correct 32 bit/64 bit version machine , application? when switched 2 4, did correctly change startup object? check project properties , make sure correct startup object selected.

symfony - Twig template inheritance from bundle folder -

i'm using template inheritates template base template it's on mybundle/view folder (like child template) not found ,only works if base template on app/resource/views folder {% extends 'src/userbundle/resources/views/user/base1.html.twig' %} {% block body %} <ul id="navigation"> {% user in users %} <li>{{ user.getusername }}</li> {% endfor %} </ul> {% endblock %} works {% base1.html.twig' %} //looks base1 on app/resources/views it's mandatory place base templates on app/resouces/views or can place in mybundle/resources/views? if super template in bundle have extend this: {% extends 'userbundle:user:base1.html.twig' %}

php - wkhtmltopdf not converting html to pdf -

wkhtmltopdf open source (lgplv3) command line tools render html pdf. can find more information wkhtmltopdf here wkhtmltopdf not working if input file name has special characters. let me put example clear scienerio below code working fine shell_exec('wkhtmltopdf http://example.com/docs/export_import_data_masters.html test.pdf'); but below code not working if url have brackets in file name shell_exec('wkhtmltopdf http://example.com/docs/export_(import_data)_masters.html test.pdf'); it fails create pdf url if url has special characters in file name. hope able clear question. note : file link provided third party can't change file name or file path. there 2 issues here: the second url invalid. remember saying? "garbage in, garbage out"? brackets not amongst characters allowed in urls, have escape them form valid url: http://example.com/docs/export_%28import_data%29_masters.html you have consider command execute in such mann

mysql - Need to access field of a table which is defined by a condition -

i need access field of database table defined condition in query.i need access service_leg column , filter data column. select pa1.countryname, pw.serviceprovideractorwid, pa2.id, pw.orderid, pw.issorderref, po.modelcode, pw.itemid, pe1.eventcode starteventcode, pe2.eventcode endeventcode, case when pw.enddate < pof.retdate 'to_service' else 'from service' end "service_leg", pa1.roleid, pad.activitycode, pw.tat, pw.totelapse phwactivitydetail pw join phdactor pa1 on pa1.actorwid = pw.orderissactorwid join phdactor pa2 on pa2.actorwid = pw.serviceprovideractorwid join phdobject po on po.objectwid = pw.objectwid join phdevent pe1 on pe1.eventwid = pw.starteventwid join phdevent pe2 on pe2.eventwid = pw.endeventwid join phaorderflowcatch pof on pof.orderdid = pw.orderdid join phxactivitydef pad on pad.activitydefdid = pw.activitydefdid join gldcalendar gc on gc.datenum = pw.enddatenum; thank you. use outer sub-query achieve that.

OneDrive API help in getting download link of file -

i need download url of file using onedrive api. this works string url = " https://apis.live.net/v5.0/ " + file_id + "/shared_read_link?access_token=" + auth_token but doesn't string url = " https://apis.live.net/v5.0/ " + file_id + "/content?suppress_redirects=true?access_token=" + auth_token; its throwing error, unauthorized.. can tell why? thanks sujit & should have been used in place of ?. correct answer is string url = " https://apis.live.net/v5.0/ " + file_id + "/content?suppress_redirects=true&access_token=" + auth_token;

reactjs - ag-Grid React - exporting data from grid as excel file (.xls, .xlsx) -

i able export grid data excel files, ag-grid doesn't support yet have come own export function it. problem having of examples have seen rely on fact data being extracted html table whereas ag-grid compiles <div> s best way write function export data .xls or .xlsx file? thanks time

java - Execute thread periodically until Future value matches criteria -

i need stall main thread until particular situation happens, can start different thread. to freeze main thread thought of launching thread checked particular situation periodically. when situation reached, can launch second thread. i knew "return value" of thread using future , callable in fashion , knew how schedule threads . but how can mix both? this trying do: thread startresolution = new thread(() -> target(path + "/" + id + "/schedule").request().get()); thread stopresolution = new thread(() -> { response response = target(path + "/" + id + "/schedule/stop-resolution").request().get(); system.out.println(response.readentity(string.class)); }); startresolution.start(); // want lock main thread here until returs particular state target(path + "/" + id + "/schedule/resolution-state").request().get(string.class); stopresolution.start(); startresolution.join(); stopresolution.join()

reflection - Is it safe to call kclass.memberProperties on an unknown (Any) object? -

i assumed it's ok access members field of kclass object. have found case when it's not. both tests throw exceptions. @test fun mapproperties() { val map = mapof("a" "b") val cls = map.javaclass.kotlin cls.members } throws: kotlin.reflect.kotlinreflectioninternalerror: incorrect resolution sequence java field public open val values: kotlin.collections.mutablecollection<(v..v?)> defined in java.util.collections.singletonmap[javapropertydescriptor@10163d6] @test fun mapproperties2() { val map = mapof("a" "b") val cls = clsbyreified(map) cls.members } inline fun <reified t: any> clsbyreified(instance: t): kclass<t> { return t::class } throws: kotlin.reflect.kotlinreflectioninternalerror: no metadata found public abstract val entries: [not-computed] defined in kotlin.collections.map[deserializedpropertydescriptor@5c1a8622] not sure if stumbled upon bug or missing something.

c# - Show another button where the original button was located -

currently in form starting @using (html.beginform have submit button this: <input id="submitbutton" type="submit" value="update stuff" /> now after submit, want show button instead of button example: <input id="continuebutton" type="button" value="continie next page" /> so understand should have property on model example @model.showsubmitbutton goes true or false. learning should close @if(model.showsubmitbutton) <input id="submitbutton" type="submit" value="update stuff" /> else <input id="continuebutton" type="button" value="continie next page" /> but can't razor syntax wrong if way of doing correct begin it. need part. , want mvc, not js because don't know js yet. use this @if(model.showsubmitbutton) { <input id="submitbutton" type="submit" value="update stuff

webdriver - Not able to click or get element due to space before and after "shetty ruat pravin ruat(pravin.uat@gmail.com)" ..please find html code below -

enter image description here tried, xpath //h3[text()='available customers']/parent::div/following-sibling::div//li//div[@class='longtext ng-binding ng-scope']//i[@ng-show='item.selected'] but didn't work there space before shetty ruat pravin ruat(pravin.uat@gmail.com) cannot reach till there , or gettext try this: webdriverwait wait = new webdriverwait(driver, 10); webelement element = wait.until(expectedconditions.elementtobeclickable(by.cssselector("li > div.longtext")))); if(element.gettext().contains("shetty ruat pravin") { element.findelement(by.cssselector("i.fa")).click(); }

jqGrid: Search form changed to be flat? -

Image
this subject based on " jqgrid - change filter/search pop form - flat on page - not dialog " . i've made search form flat based on subject , right want not show on page , want show when user press search button jqgrid. can give me hint or solution how that, please? @oleg can me , please? thanks th solution close old one. can use following options of searching dialog: overlay: 0, drag: false, beforeshowsearch: function ($form) { var $searchdialog = $form.closest(".ui-jqdialog"), $gbox = $(this).closest(".ui-jqgrid"); $searchdialog.insertbefore($gbox); $searchdialog.css({ position: "relative", zindex: "auto", float: "left" }) $gbox.css({clear:"left"}); } other options (like closeonescape: true, closeaftersearch: true, closeafterreset: true, searchonenter: true, searchoperators: true , other) can chosen depend on preferences. the demo displays

Printing current file name with extension in C++ -

i writing c++ code , want print current filename extension. yes, it's 1 of asked questions. 1 solution use argv[0]. cool, it's not giving extension. can have extension? you can print full path name using std::cout << __file__ . if want print file name alone, can do: std::string file = __file__; size_t index; (index = file.size(); index > 0; index--) { if (file[index - 1] == '\\' || file[index - 1] == '/') break; } std::cout << file.substr(index);

gunicorn - How to restart Foreman when code in a Django site changes? -

i'm running django website in vagrant box (roughly) mirrors heroku set-up. uses foreman procfile this: web: gunicorn projectname.wsgi > /vagrant/gunicorn.log 2>&1 however, when change django code, server doesn't restart or reload code, makes development... painful! how can make foreman serve new code when changes?

java - How to multiply SQL columns from 2 tables and insert into a seperate column? -

i trying write sql android application takes quantity of inventory 1 table multiply price of item in table total store column. based on have read seems pretty simple, isn't working me. have tried multiple solutions, @ point have done put sql code in separate method called totalprice() called on button click in method. public static final string table_invoice = "invoice"; public static final string invoice_id = "invoice_id"; public static final string invoice_date = "date"; public static final string table_inventory = "inventory"; public static final string inventory_id = "inventory_id"; public static final string inventory_item = "item"; public static final string inventory_xs = "extrasmall"; public static final string inventory_s = "small"; public static final string inventory_m = "medium"; public static final string inventory_l = "large"; public static final string inventory

c++ - Best STL containers to avoid heap fragmentation -

i have program analyzes 150,000 files. valgrind reports no memory leak program slows on time. some of problems related using std::string , mktime taking time. (see c++ slows on time reading 70,000 files ) but still slows down on time. lotharyx suggested container usage causing heap fragmentation. i read various flow charts on pros , cons of different stl containers didn't quite it. in pseudo code below, i'm not sure i've made right choices avoid heap fragmentation. filelist.clear() scan disks , build "filelist", std::set of file paths matching pattern. // filepaths named date, eg 20160530.051000, intrinsically ordered foreach(filepath in filelist) { if (alreadyhavefiledetails(filepath)) continue; // otherwise collect file details fileinfostruct; // size, contents, mod fileinfomap[time_t date] = fileinfostruct; } // fileinfomap ordered collection of information structs of 100,000 files // traverse list in order fore

android - Hot to convert a Mat object to byte[] data object in "onPreviewFrame" and show it in camera preview -

in android app, trying take frames in "onpreviewframe" , convert them mat object can on them image processing, don't know how convert them byte[] type , make them shown on camera preview. does 1 know how that? here onpreviewframe function, trying change frame color grey: public void onpreviewframe(byte[] data, camera arg1) { mat mrgba = new mat(previewsizewidth, previewsizeheight, cvtype.cv_8uc3); mrgba.put(0, 0, data); imgproc.cvtcolor(mrgba, mrgba, imgproc.color_bgr2gray); mrgba.put(0, 0, data); mcamera.addcallbackbuffer(data); } thanks in advance! from older implementation of opencv camera viewer pipeline: private mat myuv, mgraysubmat; @override public void onpreviewframe(byte[] data, camera camera) { if(myuv == null) { myuv = new mat(height + height / 2, width, cvtype.cv_8uc1); mgraysubmat = myuv.submat(0, height, 0, width); } myuv.put(0, 0, data); imgproc.cvtcolor(mgraysubmat, mrgba, imgp

replace - gsub required for character + using R -

i'm new r. i'm stucked on step project. i'm unable gsub character + example if have string khjvg+56a result should khjvg56a . here i'm trying. gsub('^+[[:punct]]', "", 'khjvg+56a') but getting same string passed does solve problem? gsub('[[:punct:]]', "", 'khjvg+56a') i think don't need ^ (beginning of line) , 1 : missing. as stated @nicola, gsub('\\+', "", 'khjvg+56a') more specific + , `[[:punct:]] target punctuation sign.

angularjs - How to track the last Variable of *ngFor in the ngForTrackBy function of Angular 2 -

if use *ngfor="let item of items; let = index; let islast=last" value of islast in ui using {{islast}}. if use ngfortrackby: myfunction , function support index:number , obj : contains value of item. so how 1 "last" variable stated in https://angular.io/docs/ts/latest/api/common/index/ngfor-directive.html in custom ngfortrackby function? possible? is there way track *ngfor completed rendering, can limit number of row shown scroll-able window?

string - Reverse exercise (Python Codecademy course, part "Practice makes perfect" 15/15) -

the task runs follows: define function called reverse takes string textand returns string in reverse.you may not use reversed or [::-1] this. my code works right want understand 1 detail. tks all. def reverse (text): result = '' in range (len(text)-1,-1,-1): result += text[i] return result the point wrote in 3rd line for in range (len(text)-1,0,-1): but program returned '!nohty' instead of '!nohtyp'. changed (len(text)-1,-1,-1) ant it's ok. why?! because text (python!) of 7 length , lists 0 based (starting 0) , loop decreasing, need have -1. the string "python!" 7 characters. range exclusive final number, range accounting 6, 5, 4, 3, 2, 1, 0. the length - 1 = 6, range of 6 -1, -1 exclusive accounts numbers 0 - 6. because lists 0 based, accounts all. 0 range's second argument, numbers 6, 5, 4, 3, 2, 1, doesn't account whole word. for example: the word "stack" has 5 letters. once list

Function in Scheme that shows the minimum and the maximum numbers (integers) in a list -

is there way make function in scheme receives list of numbers (integers) , creates list maximum , minimum numbers of list ? i know how make function each maximum, (define (mini a) (if (null? (cdr a)) (car a) (min (car a) (mini(cdr a))) ) ) and mininum: (define (maxi a) (if (null? (cdr a)) (car a) (min (car a) (maxi(cdr a))) ) ) what want 1 function both, in simplest way possible, because i'm new paradigm. well you're pretty close. use functions have. (define (maximini a) (list (maxi a) (mini a))) a big part of writing scheme programs decomposing functionality separate, reusable procedures. encapsulating min , max behaviour mixture of concerns. if there limitation of 1 traversal (define (min b) (if (< b) b)) (define (max b) (if (> b) b)) (define (maximini a) (let loop [(x -inf.0) (y +inf.0) (a a)] (if (empty? a) (list x y) (loop (max (car a) x) (min (car a) y) (cdr a))))) (maximini '(-4 3 2 1 10 -5)) ;

wpf - Is there a MouseDown setter property for a rectangle that acts as a button control template? -

as title suggests, i'm looking trigger property triggers when left mouse button clicked on button. problem being button has rectangle it's control template , i'd change fill/stroke when button/rectangle clicked. the trigger property can find works "ismouseover" anything mousedown or ispressed doesn't work. my xaml right now: <button x:name="my_button" click="my_button_click" margin="268,91,-266,-94"> <button.template> <controltemplate> <rectangle horizontalalignment="left" height="20" stroke="black" verticalalignment="top" width="141" margin="105,10,0,0" strokethickness="2"> <rectangle.style> <style targettype="{x:type rectangle}"> <setter property="fill" value="blue" />