Posts

Showing posts from August, 2011

Azure Stream Analytics query language get value by key from array of key value pairs -

i trying extract specific value array property in stream analytics query language. my data looks follows: "context": { "custom": { "dimensions": [{ "macaddress": "ma" }, { "ipaddress": "ipaddr" }] } } i trying obtain result has "macaddress", "ipaddress" column titles , "ma", "ipaddr" rows. i achieving this query: select getrecordpropertyvalue(getarrayelement(mysource.context.custom.dimensions, 0), 'macaddress') macaddress, getrecordpropertyvalue(getarrayelement(mysource.context.custom.dimensions, 1), 'ipaddress') ipaddress, i trying use cross apply far no luck. below cross apply query: select flat.arrayvalue.macaddress macaddress, flat.arrayvalue.ipaddress ipaddress [ffapi-track-events] mysource cross apply getarrayelements(mysource.context.custom.dimensions)

Autohotkey controlsend in hidden cmd -

i have script looks this: detecthiddenwindows, on run,%comspec% /k, , hide, pid2 winwait, ahk_pid %pid2% controlsend, ,winscp.com script="path\to\script.txt", ahk_pid %pid2% sleep,3000 ;-- close hidden dos window -- process, close, %pid2% process, waitclose, %pid2% but problem controlsend works , send right letters , change double columns single 1 , change winscp.com winscp>com , etc dont know these letters come idea how fix issue , make send right letters cuz frustrate me , makes whole script mess up. thanks lot max detecthiddenwindows, on run, winscp.com script="path\to\script.txt", , hide, pid2 sleep 6000 process, close, %pid2% process, waitclose, %pid2% that best way me ensure upload done , ready continue script. note: use runwait /c command (which substitute sleep command) summarize whole script provided above afraid still gives same issue mentioned above prefered directly using run , process close , waitclose commands. m

graphviz - How to access nodes edges of dot format graph (Generalised ) in haskell -

i want access nodes, edges , properties of 'xdotgraph' (g.dotgraph) , set again. here haskell code prints dot format graph using graphviz: $ cat example.dot digraph { [type1="", type2=""]; b [type1="", type2=""]; -> b [label=""]; } import data.graphviz import data.text.io t import qualified data.text.lazy b import qualified data.text.lazy.io l import qualified data.graphviz.types.generalised g import data.graphviz.printing xdottext <- l.readfile "example.xdot" let xdotgraph = parsedotgraph xdottext :: g.dotgraph string t.putstrln $ renderdot $ todot xdotgraph this works me (mostly identical code there few changes): #!/usr/bin/env stack {- stack runghc --resolver lts-6.0 --package graphviz -} import data.graphviz import data.text.io t import qualified data.text.lazy b import qualified data.text.lazy.io l import qualified data.graphviz.types.generalised g import data.graphviz.pr

node.js - Async to sync in nodejs -

i using library getmac mac address of server on nodejs running. api mac address async want use sync call. possible without using libraries sync, deasync etc? //async api require('getmac').getmac(function(err,macaddress){ if (err) throw err console.log(macaddress) }) you can use package var done = false; require('getmac').getmac(function(err,macaddress) { if (err) throw err console.log(macaddress) done = true; }); require('deasync').loopwhile(function(){return !done;});

list - Scala: type mismatch found in mapping -

error: type mismatch; found : list[list[(char, int)]] required: list[(char, int)] @ q<- x a2 reduceleft ((x,y)=> for{ q<- x b<- y } yield (q::b::nil) ) where, a2 : list[list[(char, int)]]. if a2 list[list[(char, int)]] , x list[(char, int)] , q (char, int) , , b, how found list[list[(char, int)]] ? the problem yield returns list[(char, int)] loop returns list[list[(char, int)]] . therefore, reduceleft complains since expects return type list[(char, int)] .

excel - Format to percent with 10 or a lot of decimals in vba -

Image
i've got tricky problem , don't understand happening , why. i have userform lot of percentage values. these values come excel sheet, this. user can change these values , put them in excel sheet. user's activity gets saved in log sheet. values saved there well. put values there this: private sub savev_click() dim wslog worksheet dim long dim j long dim lastrow long dim tbnr string j = 3 = 2 set wslog = thisworkbook.worksheets("log") wslog lastrow = findlastrow(wslog) lastcolumn = findlastcolumn(wslog) each tb in me.controls if typename(tb) = "textbox" select case 'case 2 , 3 values fixed , not of interest case 2 .cells(lastrow + 1, 1).value = tb.value case 3 .cells(lastrow + 1, 2).value = tb.value 'the following cases refer

Why do we use .format, vs '%.2f' % order.get_cost() in django paypal -

just want ask quick question clarify things me, learning django paypal following tut , came accross following when creating payment processing view when creating paypal_dict: 'amount':'%.2f' % order.get_total_cost().quantize( decimal('.01')), 'item_name':'order {}'.format(order.id), my question is, why can't following: 'amount':'{}.2f'.format(order.get_total_cost().quantize( decimal('.01')) or 'item_name':'order %' % str(order.id) thanks! you can use either % or format depending on prefer. in single codebase, recommend picking 1 style , sticking consistency.

html - Make an <input> look like normal text in a paragraph -

take code here: <p>lorem ipsum <input type="text" value="algo" /> dolor sit ...</p> sample: http://codepen.io/dbugger/pen/krampx how can make input totally normal text, inside paragraph? set display: inline width seems still fixed. elements inherit default values browsers. need "reset" of them in order make input element appear surrounding text: p input { border: none; display: inline; font-family: inherit; font-size: inherit; padding: none; width: auto; } this close can css alone. if want variable width, have resort js instead of css, adjusting element it's value way beyond scope of css . modifying elements after fact, based on user input or changes due just-in-time effects, js/jquery used for. note depending on browser you're using (and due possibility future browsers might things radically different nowadays' practices), list not exhaustive. the way can "fake" effect in cl

java - Any shown/hidden events for JavaFX node? -

can determine moment, when node shown/hidden in javafx? but "shown" mean part of node graphics shown, "hidden" mean entire node somehow hidden, including overlapping other nodes and/or setting visible false. also ok descendants of node .

Conditional Sum SQL -

i new sql , have been presented with, seems me, complex task. have table generating number of various fruit purchased on given day. thus: g. g.b 2016-06-01 banana 45 0 2016-06-01 pear 158 0 2016-06-01 apple 0 23 .... dates continue i need develop kind of conditional sum count how many types of fruit bought specific grade on specific date. in above case on given date (2016-06-01) there 203 grade (g.a) bits of fruit , 23 grade b (g.b) pieces of fruit. naturally kind of sum(case when date=date grade else 0 ). but, baffled here. please, appreciated!!!! a simple group clause should job here (note: untested code) select date, sum(grade_a) grade_a_sum, sum(grade_b) grade_b_sum sales group date; this give grades every date. individual dates can selected if necessary.

uwp - Show ListView items below the the View -

Image
i create transparency effect in groove music app's control bar shown in picture. scroll bar seems end above blue bar seems actual listview doesn't go below bar. how possible make invisible content of listview/scrollviewer hidden below visible again? as @avk said, implement ui shown in picture, can put scrollviewer , blue bar in grid first, set blue bar's verticalalignment bottom , give opacity . blue bar should have fixed height . then key point here setting margin content , verticalscrollbar in scrollviewer . verticalscrollbar in template of scrollviewer . modify template of scrollviewer , can select " [scrollviewer] " in " document outline " , right click, select " edit templates " → " edit copy... ". in template, can set margin verticalscrollbar like: <scrollbar x:name="verticalscrollbar" grid.column="1" margin="0,0,0,64" horizontalalignment="right" istabstop=&

c# - Implement client-specific WCF ServicePointManager ServerCertificateValidationCallback? -

servicepointmanager.servercertificatevalidationcallback allows custom validation of service-side certificates. this works fine when there 1 custom validator. have multiple clients , need able specify different validators each client. now, best can tell, there 1 servicepointmanager clientbase objects, so, default, clients pass through same service-side certificate validation chain. if have to, suppose could: hook validators chain , add logic each understand when validate , when return true maintain collection of validators (ugh!) , invoke appropriately i'm hoping avoid both ... there extensible component built wcf supports multiple servicepointmanagers? help! suggestions or pointers welcome!

javascript - Promises: Execute something regardless of resolve/reject? -

using promises design pattern, possible implement following: var a, promise if promise.resolve = promise.responsevalue; if promise.reject = "failed" after resolution/rejection. not async!! send somewhere, not asynchronously. //not promise what i'm looking finally in try - catch situation. ps: i'm using es6 promise polyfill on nodejs if return value catch , can use then on result of catch . thepromise.then(result => dosomething(result) .catch(error => handleerrorandreturnsomething(error)) .then(resultorreturnfromcatch => /* ... */); ...but means you're converting rejection resolution (by returning catch rather throwing or returning rejected promise), , relies on fact. if want transparently passes along resolution/rejection without modifying it, there's nothing built es2015 ("es6") promises that, it's easy write (this in es2015, have es5 translation below): { le

java - How to get iframe elements in selenium webdriver? -

how iframe elements in selenium webdriver ? tried not getting elements iframe. please me. you can find details here . please research on internet.

php - Using a default time zone for each user -

in system, going use default time zone asia/kolkata . if user accesses china, possible show complete system information related time zone? how implement this? note: going use mktime store dates in integer format. using ip2country find user country. i having big confusion in part of conversion of time stamp values, if user 1 post india, user 2 view from china displaying time based o china.

dependency management - Grails Upgrade to 2.5.5 - Unresolved dependencies - groovy-all 2.4.5 -

i trying upgrade grails application 2.0.0 2.5.5, running unresolved dependencies groovy-all jar. dependency resolver in buildconfig.groovy set ivy. also, location %userprofile%/.grails/ivy-cache/org.codehaus.groovy contains groovy-all.jar of version 2.4.5 java set jdk7 exact error: org.codehaus.groovy#groovy-all;2.4.5: configuration not found in org.codehaus.groovy#groovy-all;2.4.5: 'master'. required org.grails#grails-core;2.5.5 compile buildconfig.groovy grails.project.dependency.resolver = "ivy" repositories { mavenrepo "link company specific repo" mavencentral() } plugins { runtime ":hibernate4:4.3.10" runtime ":jquery:1.7.1" runtime ":resources:1.1.5" runtime ":bubbling:1.5.1" runtime ":calendar:1.2.1" runtime ":code-coverage:1.1.6" runtime ":jsecurity:0.3" runtime ":tomcat:7.0.42" runtime ":webflow:1.3.7"

search - Java: Trouble when using BFS to find a shortest path -

class state : import java.util.arrays; public class state { private int data[][]; public int[][] getdata() { return data; } public void setdata(int[][] data) { this.data = data; } public void swap(int row1, int col1, int row2, int col2){ int temp = this.data[row1][col1]; this.data[row1][col1] = this.data[row2][col2]; this.data[row2][col2] = temp; } public state copystate() { int height = this.data.length; int width = this.data[0].length; int[][] temp = new int[height][width]; (int = 0; < height; i++) { for(int j=0; j< width; j++){ temp[i][j] = this.data[i][j]; } } state target = new state(temp); return target; } public state(int[][] data) { super(); this.data = data; } } class node : public class node { private state state; private node parent; private arraylist<node> children; public node(state state){ this.state = state; parent = null; children = new array

C++ Validation Message -

i gets multiple time of error message after input multiple characters. example:"1300412". seem bring input loop, keep showing me "invalid input". how fix let show out "invalid input" once after wrong input entered. here me code, please me. void main(){ char option; do{ system("cls"); cout << " select function: " << endl; cout << "(a) asset depreciation." << endl; cout << "(b) printing charge." << endl; cout << "(c) packaging program." << endl; cout << "(q) exit." << endl << endl; cout << "please enter option:"; cin >> option; option = toupper(option); if (option == 'a'){ asset_depreciation(); } else if (option == 'b'){ printing_charge(); } else if (option == 'c'){ packaging_program(); } else

c# - How to use the Input.Location and mock location in the unity editor -

i building location based game, bit pokemon go. reading location on android phone without problem, can't location data when i'm developing in unity editor since input.location.isenabledbyuser false in editor it ok mock/hard code location, can try without deploying phone. i tried hard code this: locationinfo readlocation(){ #if unity_editor var location = new locationinfo(); location.latitude = 59.000f; location.longitude = 18.000f; location.altitude= 0.0f; location.horizontalaccuracy = 5.0f; location.verticalaccuracy = 5.0f; return location; #elif return input.location.lastdata; #endif } but of properties of location read only, i'm getting compilation errors. there way enable location service in editor, or hardcode location? is there way enable location service in editor, or hardcode location? this 1 of reasons why unity remote 4 made. setup unity remote connect mobile device editor. can real locati

android - How to avoid gesture overlap when using DrawerLayout? -

i have layout, can dragged right side of screen. @bind(r.id.left_drawer_layout) drawerlayout drawerlayout; @onclick(r.id.left_drawer) void onleftdrawer() { if (drawerlayout.isdraweropen(gravitycompat.start)) { closeleftdrawer(); } else { drawerlayout.opendrawer(gravitycompat.start); } } inside drawer have webview displays content huge in size, compared webview borders. that's why need scroll in direction: up down left right the 2 last gestures overwriten drawerlayout while levels upper webview. how can overwrite behavoir of webview can draggable(scrollable) in direction , not affect drawerlayout? the solution pretty simple: lock drawerlayout while touching our webview: webview.setontouchlistener(new ontouchlistener() { @override public boolean ontouch(view v, motionevent event) { if (event.getaction() == motionevent.action_down) { ((mainactivity) getactiv

spring - No bean named 'springSecurityFilterChain' is defined in combination of Web.xml and Java Config -

here root application context class @configuration @import({websecurityconfig.class}) public class contextconfig { } my websecurityconfig class @configuration @enablewebsecurity public class websecurityconfig extends websecurityconfigureradapter{ @override public void configure(websecurity web) throws exception { web.ignoring().antmatchers("/resources/**"); } @override protected void configure(httpsecurity http) throws exception { http.authorizerequests().antmatchers("/hello/**").permitall().anyrequest() .hasrole("user") .and() .formlogin() .permitall(); } @override protected void configure(authenticationmanagerbuilder auth) throws exception { auth.inmemoryauthentication().withuser("user").password("password&

sql - How to increase performance of the query which counts the records by a specific time interval? -

i use postgresql 9.5. below can find structure of table, query , result of query. increase performance of query. query counts records specific time interval, example: 250 milliseconds , 1 second , 22 minutes , 2 days , 30 minutes , etc. the query fast large intervals 60 minutes small intervals 4 seconds it's slow. the important things: i work large database (20 million rows , more in query use part of database using where clause, example: 1 million or more). there id_user_table , sip columns in where clause. in cases, where clause colud include of columns of table, depends on user's choice. at moment i've created b-tree index on starttime column: create index starttime_interval on data_store (starttime); do know ways increase performance of query? for example, means of: creating indexes on columns (which indexes? , how create them?), improving query, changing settings in postgresql, or somethings else. here's structure of table:

ruby on rails - Format response to friendly parsed json -

so have web scraping coming this: ["sevent({\"event_id\":\"id\",\"date\":\"sat 5 nov 2016, 19:30\",\"suppress_b... now im wanting render in parsed json. how render looks @ moment: respond_to |format| format.json { render :json => {:testing => price1}} end however returns this: { "testing": [ "tmevent({\"event_id\":\"id\",\"date\":\"sat 5 nov 2016, 19:30\ how make looks better, (more this): sevent:{ event_id: id, date: sat 5 nov 2016, 19:30} (if place code jsonformatter works , looks how wanted it!) any help? sam use pretty_generate function example: require 'json' my_object = { :array => [1, 2, 3, { :sample => "hash"} ], :foo => "bar" } puts json.pretty_generate(my_object)

java - How to add an integer element to ArrayList of wildcards in Generics? -

i have arraylist generic wildcards type, taking number extends. trying add integer values arraylist. buts it's giving me error saying that arraylist<? extends number> numberlist = new arraylist<number>(); numberlist = new arraylist<integer>(); numberlist.add(100); the method add(int, capture#2-of ?) in type arraylist<capture#2-of ?> not applicable arguments (int). i have tried way also, giving me same error arraylist<?> numberlist = new arraylist<number>(); numberlist = new arraylist<integer>(); numberlist.add(100); the error : the method add(int, capture#2-of ?) in type arraylist<capture#2-of ?> not applicable arguments (int) you can't. ? extends part tells compiler: of type, don't know, extends number. so compiler can't guarantee type of whatever want add compatible unknown type. therefor can't add such collection.

How to perform fixed point representation in vhdl without introducing any package -

i have 32bit fractional number 4 integer bits , 28 fractional bits , interested in implementing in vhdl without use of package such ieee_proposed.fixed_pkg.all . there other method of representing 32 bit number using standard packages such numeric_std.all. appreciated

javascript - Cannot find instance of an object -

Image
the problem facing @ moment right have warnings: which created code snippet: but if correct code changing line 24 to: the result error saying in line 24 insance not declared, in picture visible added script gameobject, has no variables filled in. been dealing 2 days now, need help. thank you! change code getcompenent , addcomponent into: rendcat110 = catfiltered110.getcomponent<renderer>(); the . have after getcomponent give error.

c# - Direct Query Power BI - Cannot load visuals with big data -

Image
we have direct query dashboard set connect azure database. our azure database has 15m rows fact table , on p2 tier. from desktop version, takes around 10 minutes show visuals on dashboard, no error. but when tried publish power bi service or import power bi embedded, of visuals cannot loaded. and detail of error is: i not sure problem is, guessed it's related timeout, cannot find configuration setup timeout power bi service. and power bi embedded, cannot find property set timeout when updating data source gateway using c# code. this timeout - expected amount of data being retrieved visuals? i'd recommend optimizing database return results faster. unfortunately timeout not configurable in power bi service or power bi embedded.

How to fetch the addresss of few places on google map which show unavailable with given lat,lng -

i facing problem relates geocoding in using google geocode map api given lat,lng (for example 32.983025 75.710981),the return result gives status zero_result.how can handle find find address particular lat,lng,which should understandable end user. enter image description here you can check status of returned result. if status not ok can give error message saying address not found. <status>ok</status> you can validate input , inform user needs in "lat, lon" format

java - Payara micro - persistent timer -

is possible have persistent ejb timer service payara micro? i have 2 or more application instances in cluster. there scheduled task (@schedule) in application. not instances run timer, 1 instance should run it, either one. this should work persistent=true in @schedule like: @schedule(second = "*/5", minute = "*", hour = "*", persistent=true) but... on deploy time receive message: javax.ejb.createexception: persistent timers not supported in setup if deploy persistent=false, works, cluster instances execute timer: @schedule(second = "*/5", minute = "*", hour = "*", persistent=false) does means should use full payara (glassfish) full jee support, or there way enable in payara micro? stick simple standard solutions, without custom code , 3th libraries. for testing, run instances with: java -jar payara-micro-4.1.1.162.jar --autobindhttp --deploy my.war thank in advance persistent ejb timers power

python string comparison unexpected results -

this question has answer here: compare 2 python strings contain numbers 5 answers >>> '1.2.3'>'1.1.5' true >>> '1.1.3'>'1.1.5' false >>> '1.1.5'>'1.1.5' false >>> '1.1.7'>'1.1.5' true >>> '1.1.9'>'1.1.5' true >>> '1.1.10'>'1.1.5' false >>> '1.2'>'1.1.5' true >>> '1.2.9'>'1.1.5' true >>> '1.2.10'>'1.1.5' true hi, i trying compare 2 strings shown above. first of all, surprised python comparing strings of numbers. firstly thought compare lengths, different values it's giving exact values , astonished. but, '1.1.10' > '1.1.5' it's false... don't know why.... can help... a = '

ajax - KnockoutJs - How to "synchronize" subscriptions and click event? -

simple situation. have form textboxes, bound observables. observables has subscriptions logic (server validation, whatever, ajax call). there button on form "save data" logic. data should saved when callbacks finished. subscribtions fired when value changed, on focus lost, not on every change. now can type textbox click on save button. happens? click event called, , data saved. faster subscribtion event fired , server returns data. how "synchronize" click "done" promise of subscriptions? need prevent save data before done. there no relation between subscription of textbox value , button. async, can't call "wait function" in click event. other problem should subcription fired later click event. any solution this? add variable manage button state - <button data-bind="disable: serversidecheckinprogress">save data</button> within ajax call - //declare serversidecheckinprogress false on init save

javascript - Multiple Stripe payment forms on single page -

i trying token stripe account. working fine if there 1 form not on multiple. want token form submited user purpose sending ajax request stripe giving seperate id every form. showing type error b not defined. want know weather there syntax error or not. if not why not working. <form id="stripe_form-1" role="form" method="post" action="#"> <div id="#payment-errors-1"></div> <input type="text" name="cc_number" value=""> <input type="text" name="cvv" value=""> <input type="text" name="ex_month" value=""> <input type="text" name="ex_year" value=""> <button id="sbtn-1 type=""button" onclick="stripefunction1()" </button> </form> <form id="stripe_form-2" role="form" method="post" action="#"

OpenGL: Why do square textures take less memory -

question: why same amount of pixels take dramatically less video memory if stored in square texture in long rectangular texture? example: i'm creating 360 4x16384 size textures glteximage2d command. internal format gl_rgba. video memory: 1328 mb. if i'm creating 360 256x256 textures same data, memory usage less 100mb. using integrated intel hd4000 gpu. it's not texture being rectangular. it's 1 of dimensions being extremely small . in order select texels textures in optimal fashion, hardware employ what's known swizzling. general idea restructure bytes in texture pixels neighbor each other in 2 dimensions neighbors in memory too. doing requires texture of minimum size in both dimensions. now, texture filtering hardware can ignore minimum size , fetch pixels within texture's actual size is. storage still there, taking space no useful purpose. given you're seeing, there's chance intel's swizzling hardware has base minimum siz