Posts

Showing posts from July, 2011

Amazon S3: how to set requests to use virtual host in ruby aws sdk -

currently, sending requests s3 using aws-sdk ruby follow: #!/usr/bin/ruby # require 'aws-sdk' s3 = aws::s3::resource.new(region: 'test', endpoint:'http://10.0.23.45:8081') my_bucket = s3.bucket('test.bucket-name') my_bucket.objects.limit(50).each |obj| puts " #{obj.key} => #{obj.etag}" end but request trying hit url endpoint(virtual hosting): http://test.bucket-name.10.0.23.45:8081 i use path style addressing instead. want request url endpoint like: http://10.0.23.45:8081/test.bucket-name/ any idea how set path style addressing instead of virtual hosting address? thanks. you need set option :virtual_host true according documentation . so in case should work: s3.bucket('10.0.23.45:8081').object('test.bucket-name').public_url(virtual_host: true) #=> "http://10.0.23.45:8081/test.bucket-name/"

c# - Dependant assemblies of different version in a same project -

Image
project structure: as above structure defines havea main application (dlltestapp) , has reference 2 projects app1 , app2. app1 has reference assembly (myassembly v1.0) , app2 has reference same assembly different version (myassembly v2.0) if run project automatically picks latest 'myassembly' v2.0, i.e. under bin/release folder see 1 myassembly file v2.0. hence breaks app1 functionality .. but configure dlltestapp should reference myassembly v1.0 , v2.0 both different folder while building could please help?

javascript - Create a table with required & optional checkbox columns & check-one only columns -

i need create table containing check-boxes few specific needs e-mail feature. (yes, know radio buttons have feature choosing either or, it's not i'm looking have done.) this table has 11 columns , x amount of rows: first column contains e-mail addresses. the second blank dividing rest of purpose, maybe button, etc. the next columns filled check-boxes in 4 have special requirements: columns 4 & 5 can have 1 or other check-box ticked in (i.e. if column 4 has check, column 5 unchecked , vice versa). code have found here works, option remains checked; not allowing user not choose between two. columns 8 & 9 optional/required check-boxes (i.e. if column 9 checked, column 8. however, column 8 can checked without column 9 checked. i've gotten other code section of page (with similar requirements, not in table) might worth making table's code bit more flexible include entire page other single instances of check-boxes. i've made jsbin of i

android - Use a drawable in rate app dialog -

i have dialog pop rate app , on dialog android icon. what want able chose drawable instead of system icon have app icon in place! first time in using rate app dialog apologies if basic question me tough one, think should need 1 section of code icon if require full class can post that. builder.setmessage(message) .settitle("rate " + app_title) .seticon(context.getapplicationinfo().icon) .setcancelable(false) you can pass resource id of app icon drawable , example: builder.setmessage(message) .settitle("rate " + app_title) .seticon(r.drawable.app_logo) .setcancelable(false); in case app_logo can drawable having app icon.

shell - Does PHP support process substitution? -

i've trying following examples such as: $ php -r 'require_once($argv[1]);' <(echo "hello") or: $ php -r 'file_get_contents($argv[1]);' <(echo "hello") both fails like: php warning: require_once(/dev/fd/63): failed open stream: no such file or directory in command line code on line 1 php warning: file_get_contents(/dev/fd/63): failed open stream: no such file or directory in command line code on line 1 or: $ php -r 'file_get_contents($argv[0]);' < <(echo "hello") which fails with: php fatal error: require_once(): failed opening required '-' (include_path='.:/usr/share/pear:/usr/share/php') in command line code on line 1 the above attempts inspired drush command, example: $ drush --early=<(echo print 123';') "" [warning] require_once(/dev/fd/63): failed open stream: no such file or directory preflight.inc:58 where inject dynamic php code

Escaping (, round brackets sybase SQL -

i working sybase sql , want exclude entries this: (not present) so tried using: select col table col not '(%)' do guys know happening? think need escap ( somehow, not know how. following returns error: select col table col not '\(%\)' escape '\' kind regards you might find helpful sybase event stream processor 5.0 ccl programmers guide - string functions like() scalar. determines whether given string matches specified pattern string. syntax like ( string, pattern ) parameters string string. pattern pattern of characters, string. can contain wildcards. usage determines whether string matches pattern string. function returns 1 if string matches pattern, , 0 otherwise. pattern argument can contain wildcards: '_' matches single arbitrary character, , '%' matches 0 or more arbitrary characters. function takes in 2 strings arguments, , returns integer. note: in sql

java - Hibernate, how to build query joining multiple tables at runtime -

i have 1 parent table , many children tables (say 5). based on input parameter, choose number of children tables parent fetch result. joining number of children tables parent table decide on run time parameter. number of table joined in query may 1 5. implement using hibernate orm, please suggest me better approaches achieve it. thank in advance.

javascript - RequireJS not loading module before use its variables -

i'm getting undefined error new library plugged in requirejs . know undefined error related 'wnumb' module not loading before used. if load 'wnumb' module in config.js this: require(['main', 'wnumb']); works. // conifg.js require.config({ paths: { 'main': 'main', 'socketio': './libs/socket.io/socket.io', 'plotly': './libs/plotly/plotly-latest.min', 'renderdatatoplotly': './scripts/renderdatatoplotly', 'nouislider': './libs/nouislider.8.5.1/nouislider.min', 'wnumb': './libs/wnumb-1.0.2/wnumb', 'sliders': './scripts/sliders', 'makeplotlywindowresponsive': './scripts/makeplotlywindowresponsive' } }); require(['main']); // main.js define([ 'socketio', 'sliders', //---------------------------------------------> note: sliders.js loading here 'm

android - Unable to display user input -

Image
i building android todo list app uses sqldatabase saving user input(task, time, date) facing weird problem, when try update default textview user input 1 of 3 textview changes,who's id mentioned 1st 1 input read @ last leaving rest textview unchanged. update_titleui public void update_titleui() { arraylist<string> tasklist = new arraylist<>(); sqlitedatabase db = mhelper.getreadabledatabase(); cursor cursor = db.query(taskcontract.taskentry.table, new string[]{taskcontract.taskentry._id, taskcontract.taskentry.col_task_title}, null, null, null, null, null); while (cursor.movetonext()) { int idx = cursor.getcolumnindex(taskcontract.taskentry.col_task_title); tasklist.add(cursor.getstring(idx)); } if (madapter == null) { madapter = new arrayadapter<>(this, r.layout.item_todo, r.id.task_title, tasklist); mtasklistview.setadapter(mad

asp.net - IIS Rewrite Rule Redirect HTTP to HTTPS causes multiple RedirectURL querystring -

we're using rule redirect http https: <rewrite> <rules> <rule name="redirect http https" enabled="true" stopprocessing="true"> <match url="(.*)" /> <conditions> <add input="{https}" pattern="^off$" /> </conditions> <action type="redirect" url="https://{http_host}{http_url}" redirecttype="seeother" /> </rule> </rules> </rewrite> this works fine when user has bookmarked url this: h t t p://www.mysite.com/myapp/login.aspx?returlurl=/someurl it redirect them https expected 2 returnurl querystring causes 404 error when login: h t t p s://www.mysite.com/myapp/login.aspx?returnurl=/someurl&returnurl=/someurl how handle case? in advance! change action to: <action type="redirect" url="https://{http_host

mysql - SQL multi value id -

i have .csv excel file (comma delimited) - table bellow, import database. after import csv, saves first record tech_id (so 64 , 101). how make import more values, separated ;. +--------+------------+-------------+---+-------------+ | id | start | end |...| tech_id | +--------+------------+-------------+---+-------------+ | 10883 | 27/3/2016 | 28/3/2016 |...| 64;15;259 | | 10884 | 27/3/2016 | 4/4/2016 |...| 17 | | 10885 | 28/3/2016 | 1/4/2016 |...| 101;29 | +--------+------------+-------------+---+-------------+

Actionscript 3 calling a Movieclip inside another Movieclip -

i working on cricket game, stuck here little problem. have programmed game registers when ball hits guy, , happen. striker(mcguy1) contains bat(mcbat) movieclip want call. want ball when hits bat movieclip , not whole guy. code that: // function hitting bat function hitbat(event:event):void { if(mcball.hittestobject(mcguy1)){ score++ mcball2.gotoandplay(2); mcball.gotoandstop(1); txtbox2.text = "you hit ball!"; myshot2.play(); txtbox3.text = "score: " + score; } else if(mcball.hittestobject(mcwall)) { txtbox2.text = "you missed!"; } } so instead of hittestobject mcguy1, want hitting mcbat movieclip. thanks in advance! you should able do if(mcball.hittestobject(mcguy1.mcbat)) instead of if(mcball.hittestobject(mcguy1)) mcbat member of mcguy1 if child.

javascript - Update departure date if arrival date is greater -

i want update departure-date in calendar when arrival-date greater, using javascript, adding 1 day. code problem when change arrival-date, departure-date remains same. function adddate() { date = new date(); var month = date.getmonth() + 1; var day = date.getdate(); var year = date.getfullyear(); if (document.getelementbyid('startdate').value == '') { document.getelementbyid('startdate').value = month + '/' + day + '/' + year; } if (document.getelementbyid('enddate').value == '') { document.getelementbyid('enddate').value = month + '/' + (day + 1) + '/' + year; } } <input type="text" id="startdate" style="background-color:#5c677b;height:25px;" name="checkin" placeholder="checkin"> <input type="text" id="enddate" style="background-color:#5c677b;height:25px;" n

python - Retain original format of datetime64 when converting to list -

>>>df = pd.dataframe(index=pd.date_range(dt.datetime(2016,8,1), dt.datetime(2016,8,9)), columns=['a','b'] ) >>>df.index datetimeindex(['2016-08-01', '2016-08-02', '2016-08-03', '2016-08-04', '2016-08-05', '2016-08-06', '2016-08-07', '2016-08-08', '2016-08-09'], dtype='datetime64[ns]', freq='d', tz=none) >>>df.index.values.tolist() [1470009600000000000l, 1470096000000000000l, 1470182400000000000l, 1470268800000000000l, 1470355200000000000l, 1470441600000000000l, 1470528000000000000l, 1470614400000000000l, 1470700800000000000l] basically datetime64[ns] format automatically converted long format. there way can keep format operations otherwise need convert if wanted access df content. example >>>df.loc[df.index.values.tolist()[3]] does not work, while >>>df.loc[df.index.values[3]] works.

android - Not able to read a characteristic value from BLE device -

i need write , read characteristic value android ble device. i'm able write not read. here how i'm writing : public void writecustomcharacteristic(int value) { if (mbluetoothadapter == null || mbluetoothgatt == null) { log.w(tag, "bluetoothadapter not initialized"); return; } /*check if service available on device*/ bluetoothgattservice mcustomservice = mbluetoothgatt.getservice(uuid.fromstring("<my service uuid>")); if(mcustomservice == null){ log.w(tag, "custom ble service not found"); return; } /*get read characteristic service*/ bluetoothgattcharacteristic mwritecharacteristic = mcustomservice.getcharacteristic(uuid.fromstring("<my characterstic uuid>")); mwritecharacteristic.setwritetype(bluetoothgattcharacteristic.write_type_no_response); mwritecharacteristic.setvalue(value,bluetoothgattcharacteristic.format_uint8,0); if(!mbluetoothgatt.w

android - Soft Keyboard always appears on WebView -

i have webview input tag inside. ve created custom keyboard (by extending keyboardview ) type characters in. but when "click" on input tag, softkeyboard of android appears, despite having set android:configchanges="orientation|keyboardhidden ", , android:windowsoftinputmode="statealwayshidden|adjustnothing ". anybody can me fix ? thanks.

php - Using Jenkins for Yii Codeception tests -

i trying automate yii 2 tests using jenkins. since tests have been decentralized, see tests run @ once. this, have created small shell script test-all.sh #!/bin/bash codecept in */tests i=${i%tests} cd "$i" codecept run --fail-fast cd ../ done when run command-line (git bash), tests run properly. however, when run file in jenkins, although build returns successfully, no tests being run. [ci] $ "c:\program files\git\usr\bin\sh.exe" -xe c:\windows\temp\hudson8239762865441374376.sh + cd /c/xampp/htdocs/mtnt-2 + /usr/bin/bash test-all.sh /c/xampp/htdocs/mtnt-2 test-all.sh: line 3: which: command not found test-all.sh: line 8: codecept: command not found test-all.sh: line 8: codecept: command not found test-all.sh: line 8: codecept: command not found test-all.sh: line 8: codecept: command not found finished: success it can't seem find which command , codecept command both in path variable. how fix this? updates so far, have atte

java - Method doesn't work -

for assignment, have use methods find number of patterns in array. pattern counted when sum of adjacent numbers in array more 7. i have use 2 methods, 1 being insertnumbers create array , being computepattern count patterns. however, pattern printed out doesn't match array printed out. here code. as assignment, rather not answers answers on part of code wrong, , how fix it. edit: here sample output. sample output #1: array: 2 7 2 3 1 5 7 4 3 6 number of patterns: 3 public static int[] insertnumbers() { //declaring array. int randomarray[] = new int[10]; //setting random numbers array. (int k = 0;k < randomarray.length;k++) { int = (int)((math.random()*9)+1); randomarray[k] = i; } //returning array other methods. return randomarray; } public static int computepattern() { int = 0; int b = 1; int pattern = 0; int[] randomarray = insertnumbers(); //computing number of patterns.

javascript - Take selected icon list values into an input box -

i'm new js , i'm trying make password generator using icons. it's designed click on number of icons in list , hex code put input box. 2 important bits: the hex codes appear in input box same no matter order selected icons in. you can toggle , untoggle icons. here code far: https://jsfiddle.net/uvzb8a6s/1/ html <input id="pass"> <ul id="icons"> <li class="icon">&#9824;</li> <li class="icon">&#9742;</li> <li class="icon">&#9743;</li> <li class="icon">&#9744;</li> </ul> js $('#icons li').click(function() { $(this).toggleclass( "active" ); $('#pass').text('#icons li'); }); how value of active li's listed input box, (if had clicked icon 3 , icon one: &#9824;&#9743; select li elements has active class li.active get texts .text() method. set input&#

Grails internall error with new controller -

i created intellij grails app,first opened console , did : grails create-app helloworld , cd helloworld , started app on localhost , ok opened project intellij , created controller print message "hi" , build project. after closed intellij went terminal , tried run app gave me error: error 500: internal server error uri /testc/index class javax.servlet.servletexception message could not resolve view name '/testc/index' in servlet name 'grailsdispatcherservlet' fairly impossible answer without example code, generating controller not magically make output appear. clue in "could not resolve view name..." i'd suggest read through grails docs. no sense repeating information here.

multithreading - killing Finished threads in python -

my multi-threading script raising error : thread.error : can't start new thread when reached 460 threads : threading.active_count() = 460 i assume old threads keeps stack up, since script didn't kill them. code: import threading import queue import time import os import csv def main(worker): #do work print worker return def threader(): while true: worker = q.get() main(worker) q.task_done() def main_threader(workers): global q global city q = queue.queue() x in range(20): t = threading.thread(target=threader) t.daemon = true print "\n\nthreading.active_count() = " + str(threading.active_count()) + "\n\n" t.start() worker in workers: q.put(worker) q.join() how kill old threads when job done? (is return not enough?) i'm sure old threads work done i'm printing results , i'm not sure why still active afterward , di

java - Calling Java8 method with BiFunction parameter fro Groovy -

i have piece of groovy code makes use of java8 completablefutures: completablefuture<integer> future1 = completablefuture.supplyasync({ thread.sleep(1500) return 1 }) completablefuture<integer> future2 = completablefuture.supplyasync({ thread.sleep(1000) return 2 }) def closure = { integer a, integer b -> + b } completablefuture<integer> result = future1.thencombineasync(future2, closure) println(result.get()) problem can't call thencombineasync in 2nd last line work. whatever do, second argument, required bifunction, not accepted compiler types don't match. i've tried lot of things. solution gets accomplished appreciated.

javascript - How to check an id in a webpage is there or not using jquery -

can tell me how know if id tag in webpage present or not. suggest using jquery. use length property of jquery object. amount of elements found selector. there no need use > 0 too, because 0 interpreted false . if( $("#myid").length ) { // available }

ios - get Timezone in format of UTC+5:30 -

i want timezone of user in string formatted utc+5:30 i have tried this. nstimezone *timezone=[nstimezone localtimezone]; nslog(@"%@ || %@",timezone.abbreviation,timezone.name); this gives me output. (but not getting time want) ist || asia/kolkata thanks you can use nsdate formatter offset utc: nsdateformatter *dates = [[nsdateformatter alloc]init]; [dates setdateformat:@"z"]; nslog(@"%@", [dates stringfromdate:[nsdate date]]); this log: +0530 (+5:30) if want in specific format can do: nsdateformatter *dateformatter = [[nsdateformatter alloc]init]; [dateformatter setdateformat:@"z"]; nsstring *offetstring = [dateformatter stringfromdate:[nsdate date]]; nsstring *formattedstring = [nsstring stringwithformat:@"utc%@:%@",[offetstring substringwithrange:nsmakerange(0, 3)],[offetstring substringwithrange:nsmakerange([offetstring length] - 2, 2)]];

java - Spring Boot Validation Set Parameter Name Provider -

i had validator bean used reflectionparameternameprovider return correct reflected variables names e.g. methodname.myvarname oppose methodname.arg0 @bean public validator validator() { final validatorfactory validatorfactory = validation.bydefaultprovider() .configure() .parameternameprovider(new reflectionparameternameprovider()) .buildvalidatorfactory(); return validatorfactory.getvalidator(); this worked correctly not autowire beans in custom validator. enable beans autowire in constraintvalidator must use. @bean public validator validator() { return new localvalidatorfactorybean(); } however cannot use reflectionparameternameprovider . question how use localvalidatorfactorybean reflectionparameternameprovider ? spring's localvalidatorfactorybean should include defaultparameternamediscoverer in turn should rely on standardreflectionparameternamediscoverer . not working you? on java 8? standardreflect

r - Dealing with NAs in vectors with user-defined functions -

i'm trying create function in r replicates excel's eomonth function (i.e. enter date , number of months , returns end of month date same number of months before / after input date). i've got function works on single input using lubridate package: eomonth <- function(date, months) { newdate <- date %m+% months(months) newdate <- ceiling_date(newdate, "month") - days(1) } the problem how 'vectorise' (not sure that's right word). when pass function vector (in case column in data frame), following message: nas not allowed in subscripted assignments i don't want ignore nas in vector (because sending results new column in data frame). want function, when sees na, return na, process valid dates function dictates. i'm confused how this; of posts have seen on topic relate how ignore / remove nas results. any appreciated. thanks. edit. added in sample data. below sample input data: 01/07/2016 na 22/07/2016 na 30/06

Auto post from joomla article to Instagram? -

we want auto publisher , whenever joomla article published, automatically publishes article data such title, image, description etc, on instagram. if possible or not? there extension in jed lessen burden of coding. can have @ here http://extensions.joomla.org/extensions/extension/social-web/social-display/jfbconnect . remember thats paid extension .

html - How to make div 100% height of table cell in IE -

i want render 2 dimensional array of equal sized boxes, box containing longest content dictate height of boxes, decided use html table line up. however, in ie i'm getting problem div inside table cell wont fill whole height, works fine in chrome. here snippet of markup , styles: .boxarraytable td { white-space: nowrap; overflow: hidden; padding-bottom: 30px; padding-right: 20px; } <table class="boxarraytable"> <tbody> <tr> <td><div class="box" /></td> <td><div class="box" /></td> </tr> <tr> <td><div class="box" /></td> <td><div class="box" /></td> </tr> </tbody> </table> div.box { overflow: auto; background-color: white; display: inline-block; min-width: 222px; height: 100%; } why doesn't work in ie , how working? should

typescript - How to bundle both js & ts files at the same time using gulp browserify? -

i got small javascript file (common.js) needs bundled compiled typescript files using gulp browserify. shall specify common.js in gulpfile.js? currently gulpfile.js below: var gulp = require("gulp"); var browserify = require("browserify"); var source = require('vinyl-source-stream'); var tsify = require("tsify"); gulp.task("ut", function () { return browserify({ basedir: "./", debug: true, entries: "./src/main.ts", cache: {}, packagecache: {} }) .external("jquery") .plugin(tsify) .bundle() .pipe(source("./dist/bundle.js")) .pipe(gulp.dest(env.gulp.browserify.outdir)); }); main.ts import { sayhello } "./component/greet"; import { showhello } "./component/greet"; showhello("greeting", "unit test source code"); this simplest solution add common.js file b

ios - Dispatch sizeToFit to background -

how dispatch background thread code -(void)viewdidlayoutsubviews { [super viewdidlayoutsubviews]; [self adjusttexttoscreen]; } -(void)adjusttexttoscreen { //label [self.detailedcommonlabel sizetofit]; //tablev cgrect frame = self.detailedcommontablev.frame; frame.size.height = self.detailedcommontablev.contentsize.height; self.detailedcommontablev.frame = frame; self.tableviewheight.constant = self.detailedcommontablev.frame.size.height; //back scroll height [self.detailedcommonscrollv setcontentsize:cgsizemake(self.detailedcommonscrollv.contentsize.width, self.detailedcommonimageslider.frame.size.height + self.detailedcommonlabel.frame.size.height + self.detailedcommontablev.frame.size.height + 40)]; } properly, because takes long calculating? i tried different combinations didn't work. sizetofit throws exception must in main thread. realm throws exceptions too. you can dispatch main thread doing ui stuff on it.

groovy - Get all elements at index in 2d array -

i writing ml algorithm have list of tuples so: [ [17582.0, 6.382129, 0.876581], [9868.0, 2.694977, 0.432818], [18333.0, 3.951256, 0.3333] ...] so, index=0 refer specific value feature. normalize, need min , max of every feature. is there short hand way elements @ index = 0 or index = 1, , on of tuples? assuming values in variable list then can do: def firstelements = list*.head() if need specific position, can do: def secondelements = list*.getat(1) to column-wise min , max, transpose list, calculation: def cwminmax = list.transpose().collect { [it.min(), it.max()] }

opencv python connectedComponents select component per label -

Image
i want select each component of image : in practice, each , every triangle, labels. don't figure out how. have code: #!/usr/bin/python import cv2 import numpy np img = cv2.imread('invmehs.png', -1) imgray = cv2.cvtcolor(img, cv2.color_bgr2gray) ret, imbw = cv2.threshold(imgray, 250, 255, cv2.thresh_binary) invbwmesh = cv2.bitwise_not(imbw) mask = np.ones(imbw.shape, dtype="uint8") * 255 connectivity = 4 output = cv2.connectedcomponentswithstats(imbw, connectivity, cv2.cv_32s) num_labels = output[0] labels = output[1] stats = output[2] centroids = output[3] labels = labels + 1 b = ( labels == 1) cv2.imwrite('tst.jpg',labels[b]) but image complety black :s thank much. the image want save (labels[b]) contains thin lines (greylevel 1). when saving image using jpeg format, compression algorithm smooths them, since have 1 greylevel background, erased. that's why black image saving in png format not alter image labels. in order kee

python - PyCharm does not support nose-testconfig and I need an alternative -

i have of test cases programmed using nose-testconfig, i'm trying configure pycharm in order have better ide improve productivity after investigating lot ask jetbrains discovered pycharm not support nose-testconfig plugin ini file cannot loaded before starting test, test cannot executed pycharm (i tried external tool configuration neither execute them, apparently same problem config file --tc-file=/home/inifiles/884_firefox.ini" ) is there way use nose-testconfig pycharm? have testing tool in pycharm, important me debugging functionality. have huge bunch of legacy test cases need able use in pycharm. pycharm support nose-testconfig. has configured in run->edit configurations->defaults->python tests->nosetests, check params check box , set required info there "--tc-file=deafault.ini "

javascript - The best way to have same module twice, while using T3JS framework -

i started working t3js framework (https ://github.com/box/t3js) in order keep code structured , easy scalable. i want find out right way include same module twice (or more times) in same page without ids messed up. take @ t3js documentation , examples , @ todos example (http ://t3js.org/examples/todo/). want that , @ same time make sure ids not messed up, , instantiations of module independent. here j3tan explains how can instanciate same module multiple times in 1 html file.

Array keys match PHPUnit -

i'm trying write phpunit test asserts array testing has correct keys. $structure = ['title', 'message', 'action']; $structure = array_flip($structure); $result = array_diff_key($structure, $response); $this->assertequals($result, []); this test works, there must cleaner way phpunit 4.8? you should write asserting each key: $this->assertarrayhaskey('key', $response); $this->assertarrayhaskey('message', $response); $this->assertarrayhaskey('action', $response); hope help

octave/matlab read text file line by line and save only numbers into matrix -

i have question regarding octave or matlab data post processing. have files exported fluent below: "surface integral report" mass-weighted average static temperature (k) crossplane-x-0.001 1242.9402 crossplane-x-0.025 1243.0017 crossplane-x-0.050 1243.2036 crossplane-x-0.075 1243.5321 crossplane-x-0.100 1243.9176 and want use octave/matlab post processing. if read first line line, , save lines "crossplane-x-" new file, or directly save data in lines matrix. since have many similar files, can make plots calling titles. go trouble on identify lines contain char "crossplane-x-". trying things this: clear, clean, clc; % open file , read line line fid = fopen ("h20h22_alonghgpath_temp.dat"); % save full lines new file if chars inside txtread = fgetl (fid) num_of_lines = fskipl(f

ionic framework - angularjs - filter value between 2 number -

i want ask. i'd search angularjs filter havent found yet solution mine. use angular make android app ionic framework. i have data price. want filter price range. ex: name type price item01 fruit 25000 item02 vegetable 50000 item03 vegetable 10000 i have 2 select box filtering <select ng-value="fprice"> <option value="">all</option> <option value="0">0-24999</option> <option value="25000">25000-49999</option> </select> <select ng-value="ftype"> <option value="">all</option> <option value="fruit">fruit</option> <option value="vegetable">vegetable</option> </select> i want if select second value (price) item02 didnt show. i have code like <ion-list> <ion-item ng-repeat="item in items | filter: { type: ftype, price: ??? }"

kotlin - TornadoFX - remove item with ContextMenu right click option -

so have table view displays observedarraylist of accounts account(name, login, pass) , data classes. when right click cell there pops option of delete. want delete account observedarraylist only can not find way this. not experienced javafx or tornadofx , can't find answer google or in tornadofx guides , docs. this code: class toolview : view() { override val root = vbox() companion object handler { //val account1 = account("google", "martvdham@gmail.com", "kkk") //val account2 = account("google", "martvdham@gmail.com", "password") var accounts = fxcollections.observablearraylist<account>( ) var gson = gsonbuilder().setprettyprinting().create() val ggson = gson() fun writedata(){ filewriter("accounts.json").use { ggson.tojson(accounts, it) } } fun readdata(){

mysql - Timediff of same field having same id -

supposed have fields below: id fromstatus time tostatus 1 ready 2016-08-05 08:36:27 break 1 break 2016-08-05 08:36:37 ready 1 ready 2016-08-05 08:40:27 break 1 break 2016-08-05 08:40:37 ready how can total time difference between break status ready status output should be id totalbreaktime 1 00:00:20

facebook - Getting the Cognito Identity ID when I am on a different page -

i able log in user used facebook authenticate. worked fine , page got redirected page expected. code given below. my question how can retrieve user id (or cognito identity id ) when on page ? (not in same page but, when on page) aws.config.region='us-east-1'; aws.config.credentials = new aws.cognitoidentitycredentials({ // either identitypoolid or identityid required // see identitypoolid param aws.cognitoidentity.getid (linked below) // see identityid param aws.cognitoidentity.getcredentialsforidentity // or aws.cognitoidentity.getopenidtoken (linked below) identitypoolid: cognitoidentitypoolid, // optional, necessary when identity pool not configured // use iam roles in amazon cognito console // see rolearn param aws.sts.assumerolewithwebidentity (linked below) rolearn: 'arn:aws:iam::9287589741169:role/cognito_111auth_role', // opt

multithreading - Python multiprocessing Pool vs multiprocessing ThreadPool -

i have list of image paths want divide between processes or threads each process processes part of list. processing includes loading image disk, computation , return result. i'm using python 2.7 multiprocessing.pool here's how create worker processes def processparallel(classifier,path): files=glob.glob(path+"\*.png") files_sorted=sorted(files,key=lambda file_name:int(file_name.split('--')[1])) p = multiprocessing.pool(processes=4,initializer=initializer,initargs=(classifier,)) data=p.map(loadandclassify, files_sorted) return data the issue i'm facing when log initialization time in intializer function, came know workers aren't initialized in parallel , rather each worker initialized gap of 5 seconds , here logs reference 2016-08-08 12:38:32,043 - custom_logging - info - worker started 2016-08-08 12:38:37,647 - custom_logging - info - worker started 2016-08-08 12:38:43,187 - custom_logging - info - worker started 2016-08

apache spark - failure running sparkclr-submit.cmd -

i trying run simple spark clr program local debug mode using vs2012 on windows environment. please find below steps did, downloaded v1.6.100 following page , extracted d drive https://github.com/microsoft/mobius/releases and in d drive, folder looks this, d:\sparkclr\spark-clr_2.10-1.6.100 set following environment variables, spark_home = d:\sparkclr\spark-clr_2.10-1.6.100\runtime sparkclr_home = d:\sparkclr\spark-clr_2.10-1.6.100\runtime java_home = c:\program files\java\jdk1.8.0_92 hadoop_home = d:\hadoopdirectory (winutils.exe present in d:\hadoopdirectory\bin) downloaded sparkclr nuget package in order set "csharpbackendportnumber" in app.config in local vs program, need run in debug mode per, https://github.com/microsoft/mobius/blob/master/notes/running-mobius-app.md#debug-mode but when run 'sparkclr-submit.cmd debug' d:\sparkclr\spark-clr_2.10-1.6.100\runtime\scripts i getting following exception, d:\sparkclr\spark-clr_2.10-1.6.100\r

html - empty selectpicker javascript -

how empty selectpicker use of javascript? testing purposes have 2 selectpickers, html code: <select id="selectzvlntype" class="selectpicker show-tick" data-size="5" data-live-search="true" data-width="100%"> <option value="0" selected disabled>kies type zorgverlener</option> <?php $q = "select id_zvln_type, zvln_type tbl_zvln_types order zvln_type asc"; $r = mysqli_query($dbc, $q); while($zvln_types = mysqli_fetch_assoc($r)) { ?> <option value="<?php echo $zvln_types['id_zvln_type']; ?>"><?php echo $zvln_types['zvln_type']; ?></option> <?php } ?> </select> html code of second selectpicker: <select class="selectpicker show-tick" data-size="5" data-live-search="true" data-width="100%" id="selectzkh

how to copy all of table information with dynamic vba cells in excel -

Image
i have table in sheet shown below also have vba codes in optionbuttons . codes optionbuttons looks this: private sub optionbutton11_click() worksheets("sheet1").activate range("$j$6").activate activecell.formular1c1 = "=rc[-5]*4" activecell.offset(5, 0).select activecell.select activecell.formular1c1 = "=sum(r[-7]c:r[-1]c)" end sub and this: private sub worksheets("sheet1").activate range("$j$8").activate activecell.formular1c1 = "=rc[-5]*2" activecell.offset(3, 0).select activecell.select activecell.formular1c1 = "=sum(r[-7]c:r[-1]c)" end sub i have 45 such tables on same sheet , not want code every radio button. code works 1st table how can copy rest? i wanna sheet in attachment you have first understand pattern followed code. if can identify pattern have use code buttons. also instead of using activex option button , use fo

database - Java more than one DB connection in UserTransaction -

static void clean() throws exception { final usertransaction tx = initialcontext.dolookup("usertransaction"); tx.begin(); try { final datasource ds = initialcontext.dolookup(databases.admin); connection connection1 = ds.getconnection(); connection connection2 = ds.getconnection(); preparedstatement st1 = connection1.preparestatement("xxx delete records xxx"); // delete data preparedstatement st2 = connection2.preparestatement("xxx insert records xxx"); // insert new data same primary deleted data above st1.executeupdate(); st1.close(); connection1.close(); st2.executeupdate(); st2.close(); connection2.close(); tx.commit(); } { if (tx.getstatus() == status.status_active) { tx.rollback(); } } } i have web app, dao taking datasource object create individual connection perform database operations. so have usertransaction , inside there 2 dao object doing separated action, fir

javascript - Better Solution for Unflattening Array of Objects -

for following array of objects [ {"corp": "abc", "t1": "hw a/v", "t2": "a/v system","t3": "audio","prod": "audio system","mfr": "one"}, {"corp": "abc", "t1": "hw a/v", "t2": "a/v system","t3": "audio","prod": "audio system","mfr": "two"}, {"corp": "abc", "t1": "hw a/v", "t2": "a/v system","t3": "video","prod": "video system","mfr": "other"} ] i intend unflatten object 1 below : [{ "corp": "abc", "list": [{ "t1": "hw a/v", "list": [{ "t2": "a/v system", "list": [{ "t3": "audio"

How to read data in specific column of XLSX file using python script -

i want read data given in 2nd , 3rd column xlsx file. import xlrd workbook = xlrd.open_workbook("c:/users/file.xlsx","rb") sheet = workbook.sheet_by_index(0) row in range(sheet.nrows): cols = (sheet.row_values(row,1)) , (sheet.row_values(row,2)) print(cols) but gives below error when executed above script.. biff_version = bk.getbof(xl_workbook_globals) file c:\python27\.....\xlrd_init_.py", line 1323, in getbof raise xlrderror('expected bof record; found 0x%04x' % opcode) xlrd.biffh.xlrderror: expected bof record; found 0x4b50 try this import xlrd workbook = xlrd.open_workbook("c:/users/file.xlsx","rb") sheets = workbook.sheet_names() required_data = [] sheet_name in sheets: sh = workbook.sheet_by_name(sheet_name) rownum in range(sh.nrows): row_valaues = sh.row_values(rownum) required_data.append((row_valaues[0], row_valaues[1])) print required_data

sip - How to configure nat for a conference using confBridge in Asterisk? -

i trying host conference meeting using asterisk's confbridge. how handle nat confbridge application handled in sip.conf specifying nat=yes is there way configure similar confbridge. went through confbridge.conf comments. couldnt find help. the issue facing receving 1 directional audio when try join 2 participants. possible reason? edit: configuaration of sip peers sip.conf have sip peers configured correctly guess. here sip peers configuration. [5001] type=friend username=aki secret=password callerid=aki<5001> host=dynamic context=t***e nat=yes [5002] type=friend username=apu secret=password callerid=apu<5002> host=dynamic context=t***e nat=yes this might better perspective. i writing own sip client using jain-sip. same configuration works well(bi-directional audio) when sipclient , 3rd party sip softphone communicating directly through asterisk. when use confbridge audio 3rd party sip softphone sipclient not audible. have tried different sip softph

How to redirect from spring ajax controller? -

i have controller @responsebody annotation. want if user doesn't exists process user's id , return json object. if exists redirect user page userinfo. below code gives ajax error. there way redirect user page userinfo? @requestmapping(value = "/user/userinfo", method = {requestmethod.get}) @responsebody public string getuserinfo(httpservletrequest request, httpservletresponse response, modelmap modelmap) { if(...){ .....//ajax return }else{ modelmap.addattribute("userinfo", userinfofromdb); return "user/user.jsp"; } } well, method annotated @responsebody . means string return value body of response. here returning "user/user.jsp" caller. as have full access response, can explicitely redirect response.sendredirect(...); . possible explicitely ask spring pass userinfofromdb redirectattribute through flash . can see more details on in this other answer

php - Laravel / MySQL / Javascript stack: integer is returned as string on production, but not locally, why? -

Image
i'm building cms uses laravel restful api , react (+ redux) frontend. (i've isolated problem separate frontend) the cms handles multiple sites multiple pages. when user adds new page, sends new site data: page title, , id of parent site. (i.e. ' new-page ', ' 15 ') after api saves data, returns new instance fresh database - page title, parent site id, , new page id (primary key) has has been assigned database. but , reason cannot figure out, on production server, site_id being returned string, , not integer. (this caused headache can solve parseint() , i'd know what's up). the code running on each identical. i've confirmed on both site_id column in database set int(10) unsigned . call api returns site , of associated pages gives me these results (note site_id property on each): development production slight differences between 2 environments: php php --version (development) php 5.6.24 (production) php 5.6.21 and mysq

r - Shiny: Dynamic colour (fill) input for ggplot -

i need post: dynamic color input in shiny server not give full answer problem. i have dynamic colour (fill) selection in shiny app. have prepared sample code: library(shiny) library(shinyjs) library(reshape2) library(ggplot2) dat <- data.frame(matrix(rnorm(60, 2, 3), ncol=3)) dat <- melt(dat) runapp(shinyapp( ui = fluidpage( selectizeinput("select","select:", choices=as.list(levels(dat$variable)), selected="x1",multiple =true), uioutput('mypanel'), plotoutput("plot"), downloadbutton('downloadplot',label='download plot') ), server = function(input, output, session) { cols <- reactive({ lapply(seq_along(unique(input$select)), function(i) { colourinput(paste("col", i, sep="_"), "choose colour:", "black") }) }) output$mypanel <- renderui({cols()}) cols2 <- reactive({ if (is.null(in