Posts

Showing posts from February, 2012

visual studio - Deploying to Azure: "Access to the path ... msshrtmi.dll is denied" -

i have long-standing azure project built in vs2012 against azure sdk 2.4, , attempting migrate vs2015 , azure 2.7. able build project , run locally, when attempt deploy fails following error: access path 'c:[user folder]\appdata\local\temp[random chars]\roles[solution]\base\x86\msshrtmi.dll' denied when attempt view containing folder doesn't exist... perhaps removed after publish failure? i've found msshrtmi.dll within solution folders, , have tried changing platform targeting has been claimed other msshrtmi.dll issues, of seem fails @ build time not publish time. i've re-built new azure solution , imported web role project , same result. i've never had delve deep in vs configuration/build/deploy world before , hoping can point me in right direction. thanks in advance help! i had same exception. resolution workaround given me microsoft azure tools team - package or publish on 64-bit machine. vm 32-bit. packaged on 64-bit machine, error we

windows - Replace part of a folder and its subfolders names using batch? -

i have folder structure on computer in form e.g. "photos" subfolders "summer 2012" "winter 2012" , have further subfolders. want place name "david" before each folder name i.e. "david photos" "david summer 2012" etc. . there batch file can write this? last attempt following: for /d /r %%g in ("\\sampledrive\photos") (ren "%%g" "dan%%g") however command window said syntax of command incorrect thank in advance help! using ren "%%g" "david %%g" rename folder "david \sampledrive\photos", cmd returns syntax incorrect. use %%~nxg instead, indicates folder, not path. @echo off /d /r "\sampledrive\photos" %%g in (*) ( ren "%%g" "david %%~nxg" ) echo finished! pause >nul

javascript - Find a specific text in tr td jquery using contains -

this question has answer here: how can detect if selector returns null? 7 answers this fiddle of finding text in tr. i used var reports = $('table#reports > tbody'); var tr1 = reports.find('tr:has(td:contains("first name"))'); to find text if text not exist still alerts exists. check if exist created if if (tr1) { alert('exist'); } else { alert('not'); } the problem .find() (infact traversing methods ) return jquery object truthy, condition true. if want see whether selector found matches can check length property of jquery object give number of dom element references returned selector, if there no matched elements return 0 so if (tr1.length) { alert('exist'); } else { alert('not'); }

c - Residual characters printed on stdout with socket communication -

in socket tcp communication, have server , client. both can read , write socket. the code written in c , uses linux system calls recv , write . recv saves received string in: char message_array[2000]; another array same dimensions used source write process. after both reading , writing process following operation performed, clear array elements: memset(&message_array, 0, sizeof(message_array)); moreover, fflush performed on stdin , stdout @ every write , every read process. the server prints on stdout writes , receives. if send small messages both terminals ("hello", "hi") several times (18-20), appears work correctly. if try send longer messages (longer 5 characters, shorter 2000!), server side has strange behaviour: prints message received client, inserts random number of trailing characters of previous messages. example have: client message: hello1 server message: hello2 client message: hello3 server message: hello4 client mess

android - Set layout_anchor at runtime on FloatingActionButton -

i trying animate android.support.design.widget.floatingactionbutton pinned appbarlayout. can set fine within layout xml , shows fine. doing shared element transition layout , fab showing before view set. tried set visibility gone , invisible seem disregarded if layout_anchor set in layout xml. there anyway around this? i activity load shared element transition fade in fab. can't hide fab on load. without using layout_anchor prefer keep if possible. if have fab the app:layout_anchor attribute, , want set visibility should use this: coordinatorlayout.layoutparams params = (coordinatorlayout.layoutparams) fab.getlayoutparams(); params.setanchorid(view.no_id); fab.setlayoutparams(params); fab.setvisibility(view.gone); if want set the app:layout_anchor dinamically can use same code: coordinatorlayout.layoutparams p = (coordinatorlayout.layoutparams) fab.getlayoutparams(); p.setanchorid(xxxx); fab.setlayoutparams(p);

php - How to get rid of unwanted Html and Css tags in Csv file? -

i have written code outputs table data onto csv file. in output files headings of table displayed , rest html , css tags don't want in output. code have written below: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>untitled document</title> </head> <?php //connecting database include 'dbconn.php'; // create file pointer connected output stream $output=fopen('php://output', 'w'); $filename = 'out.csv'; // $output = fopen('demosaved.csv', 'w'); ob_end_clean(); header('content-type: application/csv'); header('content-disposition: attachement; filename="' . $filename . '"'); //

java - XSL-FO Body Overflows Footer -

in current xsl-fo master-flow declaration, body section overflows footer. w.write("<fo:simple-page-master master-name=\"main-master\" "); w.write("page-height=\"11in\" page-width=\"8.5in\" margin-top=\".5in\" ");\ w.write("margin-bottom=\".5in\" margin-left=\".5in\" margin-right=\".5in\">"); //w.write("<fo:region-body margin-top=\"20mm\" margin-bottom=\"4in\"/>"); w.write("<fo:region-body margin-top=\"25mm\" margin-bottom=\"1in\" space-after=\"1.5in\"/>"); w.write("<fo:region-before extent=\"13mm\"/>"); w.write("<fo:region-after region-name=\"footer\" extent=\"0mm\"/>"); w.write("</fo:simple-page-master>"); as suggested in this question have tried adjusting margin-bottom , extent of region-after, no avail. mar

c++ - get function not returning what i expect -

i trying create function in class return take i, j argument , return value of located @ object(i, j). so far in function converting i, j equivalent in 1d array * (number of columns) + j, in code equal 5. next want show value @ location 5 in array. seems return first value of array, not location 5 value. ideas going wrong? using pointer in wrong way? full program below: #include <iostream> using namespace std; class mymatrix{ public: //default constructor set member variables null states mymatrix(); mymatrix(int sizer, int sizec, double * input_data); ~mymatrix(); //destructor //member functions int get(int i, int j); private: int m; //rows int n; //columns double * data; }; int main(){ const int rows = 3; const int columns = 2; double * userinput; cout << "the array 3*2, or 6 elements." << end

java - Skip javadoc during compilation -

i'm trying build netbeans project (i'm not primary developer) through command line, using ant , it's failing in javadoc generation. is there way turn off javadoc during ant compilation? generation of javadoc can skipped explicitly invoking build phase. netbeans provide internal label this: ant -f src_dir -dnb.internal.action.name=build jar

php - why facebook photo album returns an empty array? -

i'm using facebook sdk laravel 4. need return images of user log in via facebook. when use user, app administrator on facebook, images , albums returned normally. however, when try user other administrator, returns empty array. the code i'm using follows: $session = new facebooksession(session::get('facebook.token')); $request = new facebookrequest( $session, 'get', '/me/albums', ['fields' => 'name,photos.limit(20){source},id'] ); $response = $request->execute()->getgraphobject(); $imagesofallalbums = []; foreach ($response->asarray() $albuns) { foreach ($albuns $k => $album) { if (empty($album->photos)) continue; foreach ($album->photos $images) { foreach ($images $image) { if (empty($image->source)) continue; $imagesofallalbums[$album->name][] = $image->source; } } } } count($imagesof

List records from 1 Google sheet into another google sheet based upon criteria -

let me start saying this, have minimal excel knowledge. if question seems not proper stack overflow, please guide me else (or terms use google). i have 2 sheets. want access sheet b , through columns a1:a32 per se. if cell a1 contains 'yes', want paste a1, b1, c1, d1 sheet a. basically, if 16 cells out of 32 in column of sheet b have 'yes', there 16 records in sheet a. i don't know begin this. i've googled bit , stumbled across vlookup, not 100% sure how apply it. edit: sheet - empty sheet b - columns: istrue,name,x,y do either of these 2 formulae work want: =filter(sheet2!a:d,sheet2!a:a="yes") =query(sheet2!a:d,"where = 'yes'") (note 'yes' case-sensitive)

How to create Wifip2p group like "Zapya create group" in android? -

i want implement features "create group" , "search , join" ones in zapya using wifip2p or wifi in android. please me. zapya uses hotspot underlining technology. 1 creates group create hotspot , 1 searches , joins join hotspot . so first find on how create hotspot in android , other side how connected wifi ssid based on schema u decide . and once connected try find how send data between 2 connected devices using socket programming .

Creating jsf component dynamically and binding back to a ManagedBean -

my idea/requirement render dynamically generated jsf page , bind/capture user filled data , save db. dynamically rendering part working fine not able capture user filled data managedbean. using jsf 2.1. loginmanagedbean.java (requestscoped) private string fieldname; //getters , setters public string trytry() { htmlinputtext inputtext = (htmlinputtext) facescontext.getcurrentinstance().getapplication().createcomponent(htmlinputtext.component_type); inputtext.setid("it"); inputtext.setvalueexpression("value", facescontext.getcurrentinstance().getapplication().getexpressionfactory().createvalueexpression(facescontext.getcurrentinstance().getelcontext(),"#{loginmb.keyvaluemap['" + inputtext.getid() + "']}", string.class)); panelgroupchilds.add(inputtext); grid.getchildren().add(panelgrouptextbox); return "done"; } public string save() { system.out.println("fieldname --- " + thi

installation - Error while installing Android Studio -

i trying install android studio. have java below command output shows. java version "1.8.0_51" however when install right @ end of installation following error appears. failed install intel haxm. details please check installation log: "c:\users\henny\appdata\local\temp\nsvbcfe.tmp\haxm_silent_run.log" does know whats wrong? do know how turn on "intel virtualization technology" your cpu has support first. if not available, out of luck. if got intel vt, shall find option turn on/off in computer bios. but if want haxm emulator, go genymotion virtualbox based , faster stock emulator.

iphone - Can't get AIR app to display in landscape mode in iOS (AS3) -

this issue happening in ios only, android , pc versions of app display in landscape mode fine no issues i trying app display in landscape mode in ios or @ least able orient landscape mode when iphone/ipad tilted landscape position however no matter try app open in portrait mode dimensions 480x320 , have tried setting aspectratio in publish options landscape, have tried stage.setaspectratio(stageaspectratio.landscape); i have tried adding "aspectratio> landscape /aspectratio>" xml file i have been looking days fix on issue , nothing works please 1 help! how publishing app (i.e. flashcc, flashbuilder etc) , using latest air sdk? publishing landscape ios apps possible air suspect it's going issue how settings are. if you're targeting ipads perhaps try including landscape default image. default-landscape.png, default-landscaperight.png etc.

Apache Kafka 0.8.2.1 - Producer (Java API) does not write messages -

Image
i set apache kafka 0.8.2.1 in centos environment, created topic , sent / received dummy messages via command line producer / consumer. as can see in screenshot worked well. no i'm writing custom producer messages java topic. package de.jofre.kafka; import java.util.properties; import org.apache.kafka.clients.producer.kafkaproducer; import org.apache.kafka.clients.producer.producerrecord; import org.apache.kafka.common.serialization.stringserializer; public class testproducer { public static void main(string[] args) { properties props = new properties(); props.put("bootstrap.servers", "192.168.145.130:9092"); props.put("key.serializer", stringserializer.class.getname()); props.put("value.serializer", stringserializer.class.getname()); kafkaproducer<string, string> prod = new kafkaproducer<string, string>(props); producerrecord<string, string> record = new pr

Perl regex with pipes -

i'm not perl monk, if me digest regex(if one) do? my $pathhere = "/some/path/to/file"; $paththere = "/some/path/"; $pathhere =~ s|$paththere||; perl not everyday tool, quite shy on knowledge - guess subs match var value, guessing not way go - pipes throw me off... thanks in perl you'd use / delimiter in regexp. $pathhere =~ s/abc/def/; # replace 'abc' 'def' however can see paths, that's problematic, since you'd have escape everything. $pathhere =~ s/my\/path\/here/my\/newpath\/there/; consequently perl allows specify different delimiter character after 's', hence: $pathhere =~ s|my/path/here|my/newpath/there|; see the documentation more information.

php - laravel retrieving profile firstname from model returns Object of class Illuminate\Database\Eloquent\Builder could not be converted to string -

hi passing user_id user model , joining profile table retrieve first name of user so: public function scopefirstnamebyuserid($id) { return static::where('users.id','=',$id)->join('profiles', function ($join,$id) { $join->where('profiles.user_id', '=', $id); })->pluck('firstname'); } usage: user::firstnamebyuserid(2); however following error: missing argument 2 user::{closure}() edit# the function has been updated to: public function scopefirstnamebyuserid($id) { return static::where('users.id','=',$id)->join('profiles',function ($join) use ($id) { $join->where('profiles.user_id', '=', $id); })->pluck('firstname'); } but throws error: object of class illuminate\database\eloquent\builder not converted string any ideas i'm doing wrong? in

java - Hashmap is empty on GWT async callback -

server side, construct java.util.hashmap, populate values (key , value both string) , pass client via async callback. empty when gets client side. i can replicate net new hashmap used in 1 place server side. java 6 , gwt 2.7 server side service: public class service extends remoteserviceservlet implements iservice { public model buildmodel() { model model = new model(); model.additemtomymap("key", "value"); return model; } } model: public class model implements serializable { private map<string, string> mymap = new hashmap<string, string>(); public void additemtomymap(string key, string value) { if(key != null) { mymap.put(key, value); } } public map<string, string> getmymap() { return mymap; } } async interface: public interface iserviceasync { public void buildmodel(asynccall

Instantiation of RAM in FPGAs using VHDL -

i attempting implement dual port ram guided in this excellent blog post . however, modelsim giving following warning when compiling: ** warning: fifo_ram.vhdl(24): (vcom-1236) shared variables must of protected type. i seem unable create wave, indicating me variable not being recognised using code below. how can correctly declare variable "protected" type? also, more general question shared variables - variable shared between entities in design? library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.numeric_std.all; entity fifo_ram generic (data : natural := 8; addr : natural := 16); port (w_clk : in std_logic; w_en : in std_logic; w_addr : in std_logic_vector (addr-1 downto 0); w_data : in std_logic_vector (data-1 downto 0); -- r_clk : in std_logic; r_rdy : in std_logic; r_addr : in std_logic_vector (addr-1 downto 0); r_data : out

jquery - Javascript remove commas from string -

this question has answer here: remove characters string 5 answers i have below variable in javascript. want remove "comma" sign using jquery /javascript. var test = ",,2,4,,,3,,3,,," expected output: var test = "2,4,3,3" please advice use replace() regex var test = ",,2,4,,,3,,3,,,"; document.write(test.replace(/,+/g,',').replace(/^,|,$/g,'')); replace(/,+/g,',') - remove multiple comma one. replace(/^,|,$/g,'') - remove comma @ starting , ending.

indexing - Do SQL Server functions such as inline table-values functions persist? -

i aware derived table , common table expression (cte) not persist. live in memory til end of outer query. every call repeated execution. do functions such inline table-valued functions persist, meaning calculated once ? can index inline table-valued function? inline function same thing view or cte, except has parameters. if @ query plan you'll see logic function included in query using -- no, can't index , sql server doesn't cache it's results such, of course pages in buffer pool future use. i wouldn't each call cte repeated execution either, since sql server can freely decide how run query, long results correct. for multi statement udf each of calls (at least in versions 2014) separate executions, far know, every time, , not cached in sense assume mean.

fiware - Canot see any POI on Wirecloud Map Viewer, using Madrid example -

im taking firsts steps, working mashup wirecloud. finished santander poi example, see poi on map viewer, info on each poi, , chart info. then proceeded madrid example, in had first create entity on context broker etc, , 1 having problems. my curl request create entity: (curl localhost:1026/v1/updatecontext -s -s --header 'content-type: application/json' --header 'accept: application/json' -d @- | python -mjson.tool) <<eof { "contextelements": [ { "type": "city", "ispattern": "false", "id": "madrid", "attributes": [ { "name": "position", "type": "coords", "value": "40.418889, -3.691944", "metadatas": [ { "name": "

java - Error: Cannot Find Symbol / No Spelling Mistakes? -

basically, want create program find slope of 2 coordinates. i've done this, want program ask if wants re-start-- in, find different slope, without user having exit , re-open program. code, minus unnecessary bits: import java.io.console; public class slopefinder{ public static void main(string[] args) { console console = system.console(); do{ /* code find slope here. asks x1, y1, x2 , y2 values using readline method on console , parses strings , math, obviously. prints out slope. */ } string cont = console.readline(" find slope? y/n "); } while (cont.equalsignorecase("y")); } } the issue i'm having i'm getting error "cannot find symbol" in reference line says while(cont.equalsignorecase("y")); i don't understand i'm doing wrong? spelled correctly.. cont declared inside loop, it's not within scope in loop's condition. should declare before loop. string co

Get whole Space Content from Confluence REST Api -

is possible whole content of confluence space rest api? i try example curl -u admin:admin http://localhost:8080/confluence/rest/api/content/3965072?expand=body.storage but first page content. yes, need this: http://localhost:8080/confluence/rest/api/space/ space_key /content?expand=body.storage you can specific type of content item (page or blogpost) this: http://localhost:8080/confluence/rest/api/space/space_key/content/ page ?expand=body.storage http://localhost:8080/confluence/rest/api/space/space_key/content/ blogpost ?expand=body.storage you need take in consideration pagination: https://developer.atlassian.com/confdev/confluence-rest-api/pagination-in-the-rest-api

Email alert with Logstash -

i have configured elk stack (logstash, elastic search , and kibana)and have custom log file below. 05/august/2015:16:55:10 : www.****.com : statuscode = 200 : time in seconds load = 0.734 05/august/2015:16:55:11 : ****.my : statuscode = 403 : time in seconds load = 0.340 05/august/2015:17:00:01 : www. ****.mx : statuscode = 200 : time in seconds load = 2.282 05/august/2015:17:00:03 : www. ****.my : statuscode = 200 : time in seconds load = 2.663 05/august/2015:17:00:06 : www. ****.co.id : statuscode = 200 : time in seconds load = 1.455 05/august/2015:17:00:08 : ****. ****.my : statuscode = 200 : time in seconds load = 1.684 i have configured log succesfully on logstash , displaying in kibana. want configure email alert if of above website in logs shows 504 or 403 status code more 5 count continously. know need add filter matching pattern of log file. custom log, i’m unable it. the best way write own script, did in python. the following needed: the

c++ - std::mutex missing when building Qt app with MXE gcc -

i'm attempting qt application build command line under linux targetted windows. i've used mxe build toolchain targetting windows build fails whinging various thread related bits. mxe built winpthreads , know qt project build on windows inside of creator, using pre-packaged mingw compiler. i'm building using arm linux cross compiler, want windows done same. i'm trying 1 line build on build server or jenkins targets. i'm guessing i'm missing need pass mxe when doing cross toolchain build or alternatively missing need pass qmake build succeed. the issue default mxe build of gcc using win32 threads opposed mingws pthreads implementation. edit src/gcc.mk , ensure winpthreads added $(pkg)_deps list , change configure line --enable-threads=win32 becomes --enable-threads=posix. then re-make winpthreads , gcc. note there circular dependency here, need build gcc win32 threads (the default) first remake winpthreads. thanks andreia gaita - http://blog.w

jquery - ftpwebrequest with progress bar -

i'm creating asp.net mvc 5 application, users should able upload large files (2-3 gb). upload files, make use of ftpwebrequest class. right now, i've small jquery script makes ajax call, sends complete path server, , there controller uploads file external ftp server. i want add progress bar. below can find i've got far: on button click modal opens; uploading starts (even when close ie, continues); the process bar not working. what doing wrong? index.cshtml @{ viewbag.title = "file upload"; } <div class="row"> <h2>file upload</h2> </div> <div class="row"> <div class="form-group"> <input type="file" name="file" id="file" /> </div> <div class="form-group noleftpadding"> <input type="button" value="upload file" class="btn

gcc - How to get the complete path of source C file from its corresponsing binary object file using shell script -

i have object file uart.o trying complete path of source file binary file. using gcc renesas , cosmic compilers. using command - strings -a -f uart.o | grep "uart.c" lines containing paths string command. random data along lines. can complete path of source file object file in other way shell? an object file not typically encode full path corresponding source file. doing have security implications, since expose details of local filesystem layout access binary. the compiler operating exclusively on relative paths, anyway, , doesn't know or care complete filesystem path.

Using Ruby StringIO's gets method -

if run following code: require 'stringio' chunked_data = stringio.new("7\r\nhello, \r\n6\r\nworld!\r\n0\r\n") data = "" until chunked_data.eof? if chunk_head = chunked_data.gets("\r\n") print chunk_head if chunk = chunked_data.read(chunk_head.to_i) print chunk data << chunk end end end i output: 7 hello, 6 world! 0 according docs , gets method takes separator , returns next line based on separator. if replace \r\n in string , separator . , separator functionality seems no longer work , this: 7.hello, .6.world!.0. what's going on? to see what's going on, let's replace print more explicit output: require 'stringio' def parse(chunked_data, separator) data = "" until chunked_data.eof? if chunk_head = chunked_data.gets(separator) puts "chunk_head: #{chunk_head.inspect}" if chunk = chunked_data.read(chunk_head.to_i) puts &

javascript - How to save input values in a Backbone model -

currently i'm running situation when need grab 1 value selected option , value of 1 input , save in backbone model , save on server. here's markup: <select id="select" multiple size=5> <option value="room" name="room">room</option> <option value="teacher" name="teacher">teacher</option> <option value="group" name="group">group</option> </select> <input type="text" name="name"> <button type="button" class="save">save</button> by clicking on save button want store current 2 values in model. tried plugin modelbinder backbone, think use in wrong way. var createeditview = backbone.view.extend({ tagname: 'div', template: editresourcetpl, events: { 'click .save': 'save', }, initialize: function () { this.modelbinder = new backbo

arrays - C...string splitting issue -

i having issues firstcheck() function. explain directly below current code. bare me c skills lackluster. have written program using knowledge of c++. the firstcheck() function not working should. in readfile() function have split text given file array line line. firstcheck() should take array "mystring" , read first string until " " occurs (basically first word/character/etc.) can evaluate it. i'm pretty sure issue part. program seems stop , wait input assume because of "stdin" better way implement snippet? while(strcmp( fgets( item.mystring, sizeof item.mystring, stdin ), " " ) != 0 ) { myword[s] = strdup(item.mylines[s]); } should use scanf() instead? told using gets() bad practice, used fgets() instead assem.c #include "assem.h" int readfile(file *file, struct assem *item) { size_t =0; item->counter = 0; //this sort of constructor, if will. s

Parse error on Google GeoLocate API sample JSON -

has google changed geolocation api , not updated documentation? i have been following example code verbatim off of following page https://developers.google.com/maps/documentation/geolocation/intro i pasted sample request file on system called ex.json. double checked google maps geolocation api set on , executed following curl command curl -d ex.json -h "content-type: application/json" -i "https://www.googleapis.com/geolocation/v1/geolocate?key=[my key, yes pasted actual key in]" i received following response { "error": { "errors": [ { "domain": "global", "reason": "parseerror", "message": "parse error" } ], "code": 400, "message": "parse error" } } which according documentation means there wrong example json provided. completeness sample json looks { "homemobilecountrycode": 310, "homemobilenet

Xpages - Call bean method on click of a button -

i have form displayed in read mode using custom control bound view scoped bean. need have picker on cc users can select other documents. these display links (generated using repeat control). planned trigger method in view scoped bean save value when selection changes. now stuck with: onchange event of multi-valued field (used picker) not trigger ssjs code i tried creating button clicked using csjs on onchange of above field - not work either. in short, ssjs code not being triggered. this troubling me have created file download control wherein have added remove button calling method in bean , works fine. i using debugtoolbar mark leusink , not able display simple message or set scope variable. happening onchange , onclick events!! have provided cc code below. if want can put in xpage bound view scoped bean. <?xml version="1.0" encoding="utf-8"?> <xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xe="http://www.ibm.co

parsing - How do you write an arithmetic expression parser in JavaScript, without using eval or a constructor function? -

given string: var str1 = "25*5+5*7"; without using eval or constructor function in javascript, how able write function called "output" takes in string , outputs arithmetic value of string, in case 160? here's full precedence expression evaluator following recursive parsing idea linked-to in comment on op's question. to this, first wrote simple bnf grammar expressions wanted process: sum = product | sum "+" product | sum "-" product ; product = term | product "*" term | product "/" term ; term = "-" term | "(" sum ")" | number ; this requires bit of experience , straightforwardly. if have no experience bnf find incredibly useful describing complex streams of items expressions, messages, programming langauges, ... using grammar, followed procedure outlined in other message produce following code. should obvious driven grammar in dumb mechanical way, , therefore

javascript - Stubbing a function in sinon to return different value every time it is called -

i have function shown below: function test(parms) { var self = this; return this.test2(parms) .then(function (data) { if (data) { return ; } else { return bluebird.delay(1000) .then(self.test.bind(self, parms)); } }.bind(self)); }; i trying write unit tests function. using sinon.stub mock functionality of function test2 . i wrote test case test2 returns true , therefore test function completes execution. want test case on first instance test2 returns false , waits delay , next time test2 returns true . wrote test case below: var clock; var result; var test2stub; var count = 0; before(function () { clock = sinon.usefaketimers(); //object defined before test2stub = sinon.stub(object,"test2", function () { console.log("count is: " + count); if (count === 0) { return (bluebird.resol

types - Datatypes in Java and their representation -

i have question primitive types in java ( int , double , long , etc). question one: is there way in java have datatype, lets xtype (lossless type) can hold of primitive types? example of hypothetical usage: int x = 10; double y = 9.5; xtype newtypex = x; xtype newtypey = y; int m = newtypex; question two: is there away tell bits if number (primitive type) integer, or double, or float, etc? you can use number class, super class numeric primitive wrapper classes , in first snippet: int x = 10; double y = 9.5; number newtypex = x; number newtypey = y; the conversion between primitive types ( int , double ) , object type ( number ) possible through feature called autoboxing . however, line won't compile: int m = newtypex; because cannot assign super type variable int . compiler doesn't know exact type of newtypex here (even if assigned int value earlier); cares, variable double . for getting runtime type of number variable, can e.g. use getcla

amazon redshift - postgresql: merge rows keeping some information, without loops -

i have list of calls per every user separated minutes. users can buy in these calls or not. when user makes call within 45 minutes after last call, need consider same call first one. i need final number of calls ( aggregating calls separated less 45 minutes) , number of calls in bought something, per user. so example, have list this: buyer timestamp bougth_flag tom 20150201 9:15 1 anna 20150201 9:25 0 tom 20150201 10:15 0 tom 20150201 10:45 1 tom 20150201 10:48 1 anna 20150201 11:50 0 tom 20150201 11:52 0 anna 20150201 11:54 0 the final table be: buyer time_started calls articles_bought tom 20150201 9:15 1 1 anna 20150201 9:25 1 0 tom 20150201 10:

c# - Remove and delete all cookies of my ASP NET c-sharp application -

i need remove , delete cookies of asp net c-sharp application after sent on message email. i have tried solution without success because have error. server cannot modify cookies after http headers have been sent. in line: httpcontext.current.response.cookies.add(expiredcookie); the message email started regularly. the google search not me. anybody know how can resolve this? can suggest? can me? my code below. thank in advance. private void expireallcookies() { if (httpcontext.current != null) { int cookiecount = httpcontext.current.request.cookies.count; (var = 0; < cookiecount; i++) { var cookie = httpcontext.current.request.cookies[i]; if (cookie != null) { var cookiename = cookie.name; var expiredcookie = new httpcookie(cookiename) { expires = datetime.now.adddays(-1) }; httpcontext.current.response.cookies.add(expiredcookie);

ruby on rails - devise token auth + Save Facebook info -

i using devise auth token gem , ng-token auth authenticating single page app. besides registering email there option sign-up via facebook. works. my problem fb request scope set user_friends, email , public_info, when request don't see auth_hash request.env['omniauth.auth']. described in omniauth-facebook gem documentation . basically want save fb gives user in database. how it? i use end-point ionic2 app, facebook login requests on rails 5 api, using koala , devise token auth should able replicate on rails 5 app: def facebook @graph = koala::facebook::api.new(oauth_params[:token], env["facebook_secret"]) @profile = @graph.get_object("me?fields=email,first_name,last_name,picture.type(large)") unless @user = user.where(email: @profile["email"])&.first @user = user.new(email: @profile["email"]) end # # here make logic saving facebook's data on user model, # customize accordingly # if

Launch a Windows Phone app with android AAR (NFC) -

i have device hard-coded nfc tag opens android app based on android application record (aar). calls android app open type android.com:pkg , payload com.something.something. i have researched on how launch windows phone app existing tag, in end have found windows phone can launch app if nfc tag adequately programmed open windows phone app id or custom protocol registered in app. important use existing nfc tag opens android app id. what curious windows 10 mobile detects existing nfc tag want open app when touch phone , prompts me if want launch app? app id isn't installed did research on how put app id on windows phone app in end got deployment errors. android application records (aar) cannot used launch windows apps. windows uses different system launch apps (launch record). main probem windows uses different scheme identify apps (not java package name android does). moreover, windows apps cannot set automatically launched based on data contained in aar, hence, it&#

c++ - How to pass a dynamic array of structs to a member function? -

i wondering how can pass dynamically allocated array of structures main function member function of class. don't need change values in member function, print it. if integer array in following code snippet, mystruct not defined in myclass.h , myclass.cpp files. (which makes sense) if include main.cpp in myclass.h lot of weird errors. idea prepending struct in member function parameter, lead other errors well. i need declare struct array outside of class, not member, , cannot use stl containers. main.cpp : #include "myclass.h" int main() { myclass my_class; struct mystruct { int a; int b; }; mystruct* struct_array = new mystruct[4]; // fill struct array values... my_class.printstructarray(struct_array); } myclass.h : #include <iostream> class myclass { // ... void printstructarray(mystruct* struct_array); }; myclass.cpp : #include "myclass.h" void myclass::printstructarray(

python - Multiple plots on pdf with matplotlib -

i've been fighting pyplot few days now. want return pdf report 4 samples on each page. 4 inline subplots each: text name , statistics, , 3 graphs of values vs time. found tutorial online , tried (see below) gives nothing. pdf empty. can't find wrong. thank in advance ! from matplotlib.backends.backend_pdf import pdfpages import matplotlib.pyplot plt t=[n*5 n in range(len(ratio))] y_list_ratio=[[x*100/l[3]for x in l[2]]for l in hit_ratio] props = dict(boxstyle='round', facecolor='wheat', alpha=0.5) pp = pdfpages('multipage.pdf') # generate pages nb_plots = len(hit_ratio) nb_plots_per_page = 4 nb_pages = int(numpy.ceil(nb_plots / float(nb_plots_per_page))) grid_size = (nb_plots_per_page, 4) i, elt in enumerate(hit_ratio): # create figure instance (ie. new page) if needed if % nb_plots_per_page == 0: plt = plt.figure(figsize=(8.27, 11.69), dpi=100) # plot stuffs ! plt.subplot2grid(grid_size, (i % nb_plots_per_page, 0))

excel - Formulaically Locating a Block of Cells From a Search Result -

i have table of data lists series of dates against list of members regarding attendance. want find attendance each member against subset of dates. example: b c d e f 1 2015/02/15 2015/02/10 2015/02/5 2015/01/26 2015/01/16 2 person1 x y y y y 3 person2 x x x x x 4 person3 y x x y x if have date, example, 2015/02/12 in cell b12 want able find closest date prior (which in table c1 ; 2015/02/10 ) , select values in cells c2:f2 (i.e. cell , 3 'behind' it). values in these cells, determine whether or not have attended @ least twice out of 4 occasions (in example, person1 has, person2 , person3 haven't). i have found formula closest date =max(($b$1:$f$1<=b12)*b1:f1) don't know how use cell location , 'expand' member's data. i

Can a MapServer client set the DATARANGE via QueryString -

i have raster layer data values between 1.7 , 34.6 (data geotiff 1 band of float32). have simple style(below) render data in grayscale. adjusting datarange, can filter data range of interest. there way caller specify datarange on query string? class style colorrange 0 0 0 255 255 255 datarange 25 30 end end i’ve tried adding “&map.layer[0].class[0].style[0]=datarange+20+30” query string, error: loadstyle(): unknown identifier. parsing error near (datarange):(line 1) warning: haven't tried myself. expanding on "basic example" in runtime substitution section of http://mapserver.org/cgi/runsub.html#runsub , suggest modification. validation 'default_lowlimit' '25' 'default_highlimit' '35' 'lowlimit' '[0-9]+' 'highlimit' '[0-9]+' end class style colorrange 0 0 0 255 255 255 datarange '%lowlimit' '%highlimit' end end the default

sonarqube - Equivalent for sonar.visualstudio.skippedProjectPattern in MSBuild Runner? -

this second question based on same situation described in my last question . we have number of projects built several times, included in several different solutions. yet want them analyzed once, each part of specific solution. how exclude these project analysis when analyzing other solutions? have tried passing /d:sonar.visualstudio.skippedprojectpattern=... on msbuild.sonarqube.runner command line seems have no effect. there no equivalent sonar.visualstudio.skippedprojectpattern in msbuild sonarqube runner 1.0. i've created ticket backlog http://jira.sonarsource.com/browse/sonarmsbru-123 consider adding feature in future release.

Convert sqlalchemy ORM query object to sql query for Pandas DataFrame -

this question feels fiendishly simple haven't been able find answer. i have orm query object, say query_obj = session.query(class1).join(class2).filter(class2.attr == 'state') i can read dataframe so: testdf = pd.read_sql(query_obj.statement, query_obj.session.bind) but want use traditional sql query instead of orm: with engine.connect() connection: # execute query against database results = connection.execute(query_obj) # fetch results of query fetchall = results.fetchall() # build dataframe results dataframe = pd.dataframe(fetchall) where query traditional sql string. when run error along lines of "query_obj not executable" know how convert orm query traditional query? how 1 columns in after getting dataframe? context why i'm doing this: i've set orm layer on top of database , using query data pandas dataframe . works, it's maxing out memory. want cut in-memory overhead string folding (pass 3 outline

java - How to delay Eclipse error warnings -

i find error warnings in eclipse helpful. problem show when i'm still typing , haven't finished line of code @ hand. distracting. how can delay error warnings don't show until i've finished line , move next line? if talking java code, checkbox can found via 'preferences - java - editor' -> 'report problems type'. string tmp = // no syntax error here string tmp = ; // line end -> syntax error for other editors use 'general - editors - structured text editors'-> 'report problems type'. it's not necessary deactivate 'build automatically'. answer this similar question proko

php - Can I parameterize the table name in a prepared statement? -

i've used mysqli_stmt_bind_param function several times. however, if separate variables i'm trying protect against sql injection run errors. here's code sample: function insertrow( $db, $mysqli, $new_table, $partner, $merchant, $ips, $score, $category, $overall, $protocol ) { $statement = $mysqli->prepare("insert " .$new_table . " values (?,?,?,?,?,?,?);"); mysqli_stmt_bind_param( $statment, 'sssisss', $partner, $merchant, $ips, $score, $category, $overall, $protocol ); $statement->execute(); } is possible somehow replace .$new_table. concatenation question mark statement, make bind parameter statement, or add onto existing 1 protect against sql injection? like or form of this: function insertrow( $db, $mysqli, $new_table, $partner, $merchant, $ips, $score, $category, $overall, $protocol ) { $statement = $mysqli->prepare("insert (?) values (?,?,?,?,?,?,?);"); mysqli_stmt_bind_param( $statm