Posts

Showing posts from August, 2011

ecmascript 6 - How to capture the json text inside fetch's then() -

this how call fetch fetchopts = {...} return fetch(url, fetchopts) .then(checkstatus) the url call return json data, in error condition: {error_message:"encountered issue update" status:"error", status_code:400} i hold of error_message field value , pass error constructor. inside checkstatus, handles exception way: function checkstatus(response) { let error = null; if (!response.headers.get('content-type').includes('application/json')) { error = new error(response.statustext); error.response = response; throw error; } if (response.status >= 200 && response.status < 300) { return response; } if (response.ok) { return response; } const jsondata = response.json() ; // <- `jsondata` promise error = new error(/* how extract error_message json data? */); error.response = response; throw error; } i have checked question not address need fetch: reject promise json error ob

Turning string into executable python code, and holding that variable name -

i'm looping on following: a might equal task, wash_dishes or play_piano exec("%a = production(precondition({%s}),action({%s},{%s}))" %(a, precondition, stop, start)) list_a.append(a) expect: list_a = [wash_dishes, play_piano] (where wash_dishes production created above, not "wash_dishes") a holds string (parsed json), , want add value of a (as variable) list. thanks in advance! hope made sense! use dictionary. in exec() code, put quotes around place variable substituted, use value string. symboltable = {} exec("symboltable['%s'] = production(precondition({%s}),action({%s},{%s}))" %(a, precondition, stop, start)) list_a.append(symboltable[a])

How to resolve RecordTooLargeException in Kafka Producer? -

i using flinkkafkaproducer08 send records kafka . sometime getting following exception, though record printing in error message small in size 0.02 mb . java.lang.runtimeexception: not forward element next operator caused by: java.lang.runtimeexception: not forward element next operator caused by: java.lang.exception: failed send data kafka: message 1513657 bytes when serialized larger maximum request size have configured max.request.size configuration. caused by: org.apache.kafka.common.errors.recordtoolargeexception: message 1513657 bytes when serialized larger maximum request size have configured max.request.size configuration tried change max.request.size on producer , requires brokers changes , restart of broker . there broker setting max message size: message.max.bytes : 1,000,000 (default) so need restart brokers -- should not issue. kafka built in robust way regard broker bounces. cf. http://kafka.apache.org/082/documentation.html#producerconfigs

javascript - Overlay fixed on top of div and keep position page scrolled -

i've following example below. when click yellow box, overlay shown , works fine. when scroll down ofc stays because has position fixed. how can make sure overlay stay ontop of .div when scroll, aka "don't move"? $('.modal').css("top", $(".div").offset().top).css("left", $(".div").offset().left).css("width", $(".div").css("width")).css("height", $(".div").css("height")); $(".div").click(function() { $('.modal').addclass("loading"); }) .div { margin-top: 100px; margin-left: auto; margin-right: auto; height: 300px; width: 300px; background-color: yellow; content: ""; } body { height: 500px; background-color:black; } .modal { display: none; position: fixed; z-index: 1000; top: 0; left: 0; height: 100%; width: 100%; background: rgba( 255, 255, 255, .

java - Activiti Process Updated Variable value is not getting persisted in DB -

i'm trying update process variable after starting process when starting activiti, pass random string value variable need update variable value afterwards. system.out.println(runtimeservice.getvariables(executionid)); runtimeservice.setvariable(executionid, varname, varvalue); system.out.println(runtimeservice.getvariables(executionid)); and output variableone : "randomvalue" variableone : "updatedvalue" but when documentation of task documentation the variable value ${variableone} i output the variable value randomvalue instead of the variable value updatedvalue the problem execution id not same process instance id. need update variable against process instance id rather execution id. cheers, greg

c - structure cast into unsigned char array without malloc/str methods -

i've read other questions response aren't helping me much. once again, i'm not developer wood worker trying make far complicated own brain. i work on pic alignment 4 bytes, structures define attribute ((packed)). i've found way uses malloc , str/mem-cpy, methods aren't safe interrupt, or malloc shouldn't using @ (cf. previous question) said structure contains 16 unsigned char, 1 s16 (2 bytes) et 3 s32 (4 bytes), 30 bytes long, 4bytes alignement making 32bytes long. (char coded on 8bits). 1) wrong until here? int len =sizeof(data_out.point[i]); unsigned char* raw; raw = malloc(len); memcpy(raw, &data_out.point[i], len); data_res[count].pdata = malloc(len); (int k = 0; k<len; k++) { data_res[count].pdata[k] = (uint8_t)(raw[k]); } data_res[count].datalen=len; count++; } data_out stucture (members not relevant except following one) point structure described before. data_res structure store uchar

javascript - Using nativescript converters -

im trying hooks nativescript javascript , have basic question: let costformatter= { toview(value){ console.log('got:' + value); return '$' + value; }, tomodel(value){ console.log('got:' + value); return '$' + value; } }; http.getjson("<my api call>").then(function (r){ page.bindingcontext = { deals: r, costformatter:costformatter }; }, function (e){ //// argument (e) error! //console.log(e); }); in above code, define cost formatter want $ added beside price on every sale price on listview labels. render list view im using: <listview id="steamitems" items="{{ deals }}"> <listview.itemtemplate> <gridlayout columns="*, *, 50, 50" rows="50, 50, auto, *">

java - Unfortunately MyApp has stopped. How can I solve this? -

Image
i developing application, , everytime run it, message: unfortunately, myapp has stopped. what can solve this? about question - inspired what stack trace, , how can use debug application errors? , there lots of questions stating application has crashed, without further detail. question aims instruct novice android programmers on how try , fix problems themselves, or ask right questions. this answer describes process of retrieving stack trace. have stack trace? read on stack traces in " what stack trace, , how can use debug application errors? " the problem your application quit because uncaught runtimeexception thrown. common of these nullpointerexception . how solve it? every time android application crashes (or java application matter), stack trace written console (in case, logcat). stack trace contains vital information solving problem. android studio in bottom bar of window, click on android button. alternatively, can press alt +

How to only have 1 query in SQL Server -

i created 3 queries in sql server, want know if can have 1 query instead of these 3 queries? these 3 queries: select count(jonumber) january joborders jodate between '01/01/2017' , '01/31/2017' select count(jonumber) february joborders jodate between '02/01/2017' , '02/28/2017' select count(jonumber) total joborders jodate between '01/01/2017' , '02/28/2017' without knowing specific flavor of sql, can offer following single query uses conditional aggregation arrive @ same results: select sum(case when jodate between '2017-01-01' , '2017-01-31' 1 else 0 end) jancount, sum(case when jodate between '2017-02-01' , '2017-02-28' 1 else 0 end) febcount, count(*) totalcount joborders since using sql server, better approach group by month (and year), , let database worry counting records: select cast(month(jodate) varchar(2)) + '-' +

angularjs - Is it possible in angular material to create left-swipe-action with md-swipe? -

i newbie angular-material. i want create swipe action menu left-swipe-action md-swipe . so, when have swipe md-list-item md-list slid md-list-item , display action button md-list-item . is possible in angular-material? my angular-material md-list code following: <md-list class="p-0"> <md-list-item ng-repeat="treeobj in trees.treesarr track $index" ng-click="trees.fnshowdevices(treeobj)" md-swipe-left="trees.onswipeleft($event)"> <span class="status-bar" md-whiteframe="5" ng-class="{ok: 'md-green', warning: 'md-yellow',degraded:'md-orange',severe:'md-red',unknown:'md-grey'}[treeobj.health]"></span> <p class="m-0" style="line-height: normal"> {{ treeobj.name }} </p> <h5 class="m-0" ng-bind="trees.incidentcountobj[treeobj.id]">0</h5>

Ansible - multiple roles -

i trying run multiple roles using with_items command, getting error: "error! 'item' undefined" role.yml : --- - hosts: '{{ host }}' become: yes roles: - role: "{{item}}" with_items: "{{ roles }}" here command: ansible-playbook -i ./inventory/dev ./playbooks/role.yml --extra-vars='{"host": "db", "roles": ["mysql", "apache"]}' you cannot way. with_ loops not valid roles. if anything, need provide list of roles roles: directive, syntax list of host groups hosts: '{{ host }}' . problem is: ansible not resolve variable roles, roles: '{{ roles }}' not work. what can do, however, use include_role module in can access variables. no, include_role module doesn't take {{ item }} with_items value name either. so workaround can think of (assuming don't want process json beforehand) include roles statically: task

Overlapping Bar Chart using Chart.js -

Image
i want develop bar chart shown below possible develop using chart.js?

c# - Sharepoint online TokenHelper returns unauthorized_client -

Image
i trying write c# web api. web api supposed me acces token sharepoint online. far have been using famous tokenhelper class try me acces token. followed tutorials on how register app in sharepoint online , set permission app specific site, still returns me unauthorized_client . note : configured clientid , secrect etc in web.config code fiddler sharepoint site

c# - how to parse datetime according to host datetime format -

i having major issue in project regarding datetime. user gives input date or date database according project requiremnt. format given user different if insert manually , date format database different different servers. bring datetime in 1 format used method tryparseexact() in development runs in production fails production datetime format different parse , takes wrong dateformat instead of taking dd/mm/yyyy takes mm/dd/yyyy. have added code snippet parseing date time. sqlparameter startingdateparam=null; datetime mdate=null; string idate = geteffectivefromdate();//retriving date database string[] formats = new[] { "dd-mm-yyyy", "mm/dd/yyyy", "dd/mm/yyyy", "yyyy-mm-dd", "dd/mm/yyyy hh:mm:ss"}; string sysformat = cultureinfo.currentculture.datetimeformat.;//getting host datetime format if (datetime.tryparseexact(idate, formats, system.globalization.cultureinfo.currentculture, system.globalization.datetimestyles.none, out mdate)

cypher - Neo4J Get Data From Multiple Node with Multiple Relationship -

Image
hello following neo4j query checkin or review or pixel etc. given user business.which got perfectly.but i want pulse given user not given on business. following query not pulse. start n=node({otheruserid}) n match (n)-[r1]-(p)-[r2]-(b:business) r1.onpulse=true , r2.onpulse= true , ('check_in' in labels(p) or 'tip' in labels(p) or 'review' in labels(p) or 'rate' in labels(p)) p,r1,r2,n,b optional match(p)-[r3:has_pix]-(pix:pix) optional match (p)-[tg]-(tags) type(tg) in ['has_biz_tag', 'has_user_tag', 'has_hash_tag'] return n,r1,p,r2,r3 above relationship node. want neo4j query that.

c - Shifting elements in an array to the right by 1 -

i having trouble figuring out how shift elements in array right 1. array inialized [1 ,2, 3, 4, 5] . when shift, result should [2, 3, 4, 5, 1] , comes out [2, 3, 4, 5, 0] , , not sure why. here have far - for(k = 0; k <= n - 1; k++){ array[k] = array[k+1]; } printf("array now:\n"); k = 0; while(k < n) { printf("x[%d] = %f\n", k, array[k]); k++; } the result prints vertically. this basic code right shift 1 only. if want general code can work index right shift, suggest use variable. //array elements index 0 n-1 int tempdata = array[0]; // if right shift 1 for(k = 0; k < n-1; k++){ array[k] = array[k+1]; } array[n-1] = tempdata; //reinstall value of first index last index printf("array now:\n"); k = 0; while(k < n) { printf("x[%i] = %d\n", k, array[k]); k++; }

xml - how to add active class in xslt? -

could please tell me how add active class in xslt using call-template ? here code http://xsltransform.net/jxdigtt/1 expected output :active class added in a because pass 'a' selected item <ul> <li class="active">a</li> <li>b</li> </ul> expected output :active class added in b because pass 'b' selected item <ul> <li >a</li> <li class="active">b</li> </ul> full code <?xml version="1.0" encoding="utf-8" ?> <xsl:transform xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="1.0"> <xsl:output method="html" doctype-public="xslt-compat" omit-xml-declaration="yes" encoding="utf-8" indent="yes" /> <xsl:template match="/"> <hmtl> <head> <title>new version!</tit

swift - Cannot invoke initializer for type CGFloat with an argument list of type 'String' -

i making bar chart jbchart. change chartdata string. please me it. here's chartdata code: var chartdata = [1, 2, 3] then want change string uilabel other view controller. var chartdata = [score1, score2, score3] but error (cannot invoke initializer type cgfloat argument list of type 'string')in code: public func barchartview(_ barchartview: jbbarchartview!, heightforbarviewat index: uint) -> cgfloat { return cgfloat(chartdata[int(index)]) } the error saying cgfloat doesn't have initializer accept string argument. can use wrapped around first convert string float , convert float cgfloat . public func barchartview(_ barchartview: jbbarchartview!, heightforbarviewat index: uint) -> cgfloat { if let value = float(chartdata[int(index)]) { return cgfloat(value) } return 0 } note: sure string have number value otherwise return 0 height .

angularjs - how to populate select option in angular -

i have dynamically created data. based on creating form. problem option not added to select. wrong in this. customerb : { rows:3, columns: 2, name: 'customerb', fields: [ {type: "select", name:"teacher_id", label: "teacher" , endpoint: "/teachers", required: true, check:[ { id : "1982", name : "mr bob"}, { id : "18273", name : "mrs katrine"} ]} ], } html <div class="rows" ng-repeat="field in customerb"> <div class="columns" ng-repeat="newvalue in field"> <div class="controls" ng-switch="newvalue.type"> <div class="form-group"> <label class="control-label">{{newvalue.label}}</label> <select class="form-co

hadoop2 - APACHE DRILL:ISSUE connecting to hive with kerbros enabled -

i have cluster kerbroized ,i have installed drill in server , trying use hive part of kerbrorized cluster . as part of hive have put below configuration on drill-override.conf drill.exec: { security: { # user.auth.enabled:true, auth.mechanisms:["kerberos"], auth.principal:"xxxx/xxxxxxxx", auth.keytab:"/xxx/xxxx/drill.keytab" drill.exec.http.ssl_enabled="true" } } drill.exec: { cluster-id: "drillbits1", zk.connect: "localhost:2181" } when accessing hive drill ui ,getting below errors: 2017-04-07 12:32:48,322 [2718c667-5587-b307-58f7-b673e29b7dbf:frag:0:0] warn o.a.d.e.s.h.schema.hiveschemafactory - failure while getti ng hive database list. org.apache.thrift.texception: java.util.concurrent.executionexception: metaexception(message:got exception: org.apache.thrift.transport. ttransportexception null) i have tried drill version:1.5.0,1.10.0

oracle - Issue with comparision of day in PL/SQL -

i working on pl/sql. meanwhile, required compare whether date in table friday or not. applied below code it's still executing 'else' part of program. can please tell me way? begin select dt dat ticket_booking id=1; dy := to_char(dat, 'day'); if dy = to_char('friday') dbms_output.put_line(dy); else dbms_output.put_line('didnt print'||dy); end if; end; instead of day , need use fmday . begin select dt dat ticket_booking id=1; dy := to_char(dat, 'fmday'); if dy = to_char('friday') dbms_output.put_line(dy); else dbms_output.put_line('didnt print'||dy); end if; end;

Swift Dictionary Initialization of custom type gives: '>' is not a postfix unary operator error -

i trying initialise empty dictionary custom type in swift getting '>' not postfix unary operator error struct prims { var msset = [vertex<int> : double]() // lines gives error } i tried way; still getting same error struct prims { var msset: [vertex<int> : double] init() { self.msset = [vertex<int> : double]() } } i have defined vertex in separate file import foundation public struct vertex<t: hashable> { var data: t } extension vertex: hashable { public var hashvalue: int { return "\(data)".hashvalue } static public func ==(lhs: vertex, rhs: vertex) -> bool { return lhs.data == rhs.data } } extension vertex: customstringconvertible { public var description: string { return "\(data)" } } i looking why happening. know using var msset = dictionary<vertex<int>, double>() work. while can't tell why swift compiler emits

c# - Is it posible to a make generic return type from member -

is possible create method requires generic type, , return type based on member of given type something this class exampleclass { public t.returntype send<t>() t : classwithtype { ... } } abstract class classwithtype { internal abstract type returntype { get; } } and if it's not possible alternative. thanks in advance since comments said want send packet via socket , each packet has different return type - can encode return type in packet class itself: public abstract class packet<tresponse> { // other members here public abstract tresponse decoderesponse(byte[] raw); } public class intpacket : packet<int> { public override int decoderesponse(byte[] raw) { // decode return 0; } } then send method becomes: static tresponse send<tresponse>(packet<tresponse> packet) { // send, got response byte[] raw = getresponse(); return packet.decoderesponse(raw); } and c

forms - How to render prototype with Sonata's FormMapper? -

i'm using sonataadmin manage entities crud. need render prototype formtype collection, collection rendered sonata's collectiontype (not native-collection symfony). so code looks follows: (entity 1:n sub-entity) // entityadmin public function configureformfields(formmapper $formmapper) { // ... fields /* sonata\corebundle\form\type\collectiontype, rendering subentityadmin */ ->add( 'subentity', null, ['label' => false, 'required' => false], ['edit' => 'inline', 'inline' => 'standard'] ) // ... } what want achieve rendering new prototype-form field in symfony\component\form\extension\core\type\collectiontype stylings given sonata's form-mapping. i didn't found in sonata's repo, nor on internet on how use prototype here (yes, instead of append-form-field functionality via ajax). somehow possible? need add new elements (cust

php - IFTTT Status check URL and Key -

Image
i trying implement ifttt in website. have created service. have created api status , test setup check given type, like api-> abc.com/api/ifttt/v1/status & abc.com/api/ifttt/v1/test/setup using ci , routing purpose. added following header in host, content-type, ifttt-channel-key, accept-encoding channel key taken when creating applet remember. @ end of url but in response getting following error status check when doing endpoint test - valid request in green. - invalid channel key in red status code 401 shown please me out. thanks, for status/setup endpoint test : valid request checked when return status code 200 when correct ifttt-channel-key sent in headers with invalid channel key checked when return status code 401 when incorrect ifttt-channel-key sent in headers for instance request invalid channel key : request : get https://example.com/api/ifttt/v1/status http/1.1 accept: application/json accept-charset: utf-8 accept-encoding

yii2 - dynamicform wbraganca : What's wrong with my code -

after submit request, go blank page. please check code. thanks. i'm using yii2 framework , wbraganca dynamic form plugin. public function actioncreate() { $model = new purchaseorder(); $details = [ new purchaseorderdetail ]; $seq = sequence::findone(['id' => 'po', 'name' => (int)date('ymd')]); if(is_null($seq)){ $_seq = new sequence(); $_seq->id = 'po'; $_seq->name = (int)date('ymd'); $_seq->value = 0; $_seq->save(); $model->id = $_seq->id . '/' . $_seq->name . '/' .str_pad($_seq->value+1, 3, "0", str_pad_left); } else { $seq->value += 1; $model->id = $seq->id . '/' . $seq->name . '/' . str_pad($seq->value, 3, "0", str_pad_left); $seq->update(); } $model-&g

servlet 2.5 - Doesn't work Spring Boot legacy in my project -

i new in spring boot , trying use in project configured servlet 2.5. when run eclipse maven plugin goal "spring-boot:run" execution returns following error: `[tomcat-startstop-1] error o.apache.catalina.core.containerbase - child container failed during start java.util.concurrent.executionexception: org.apache.catalina.lifecycleexception: failed start component [standardengine[tomcat].standardhost[localhost].tomcatembeddedcontext[]] @ java.util.concurrent.futuretask.report(futuretask.java:122) [na:1.8.0_60] @ java.util.concurrent.futuretask.get(futuretask.java:192) [na:1.8.0_60] @ org.apache.catalina.core.containerbase.startinternal(containerbase.java:939) ~[tomcat-embed-core-8.5.11.jar:8.5.11] @ org.apache.catalina.core.standardhost.startinternal(standardhost.java:872) [tomcat-embed-core-8.5.11.jar:8.5.11] @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150) [tomcat-embed-core-8.5.11.jar:8.5.11] @ org.apache.catalina.core.containerbase$startchild.call

ruby on rails - How to get records from one table which are not in another table's fields (3) -

i want records table binaryfile binaryfile.id not in image.fullimage_id and not in image.preview_id and not in image.thumbnail_id i tried following, records binaryfile not in image.fullimage_id or not in image.preview_id or not in image.thumbnail_id binaryfiles = binaryfile.where('id not in (?)', [image.select("fullimage_id"), image.select("preview_id"), image.select("thumbnail_id")]) how can change condition or and ? binaryfile.where.not(id: image.pluck(:fullimage_id, :preview_id, :thumbnail_id).flatten)

All related data from another table does not show on my application ASP.NET Core -

this question has answer here: asp.net core api returning first result of list 2 answers i trying create online event tracker. have class date public class day { [key] public string daycounter { get; set; } public datetime daydate { get; set; } public list<event> events { get; set; } } and event class public class event { public int eventid { get; set; } public datetime starttime { get; set; } public datetime endtime { get; set; } public string activity { get; set; } public string daycounter { get; set; } public day day { get; set; } } i have used code first , created 2 tables days , events in azure. have created api controller below [enablecors("corspolicy")] [route("api/[controller]")] public class daysapicontroller : controller { public applicationdbcontext _context; public days

javascript - How to use webpack CLI output a module which can be imported? -

there 3 files here. file 1: src/module/a/index.js import b './b.js'; import c '../c/index.js'; const d = () => 'd'; export default { b, c, d }; file 2: src/module/a/b.js export default () => 'b'; file 3: src/module/c/index.js export default () => 'c' i want use webpack cli package code file. // file dist/lib/a.js const b = () => 'b'; const c = () => 'c'; const d = () => 'd'; export default { b, c, d }; because using es6 code, need transpiler babel, need webpack.config.js file in root directory. here minimal setup webpack.config.js const path = require('path'); const config = { entry: './src/index.js', // path index.js output: { path: path.resolve(__dirname, 'build'), filename: 'bundle.js', // output file publicpath: 'build/' // output dir }, module: { rules: [ { use: 'babel-lo

sql - Is integer column index faster than string column index in case of index range scan? -

i have database implementation task on sql server , there table a containing column - yearmonth . don't need date operations such calculating how many days or month between 2 dates etc. currently. yearmonth can defined date , int , or varchar(6) . perspective of saving data space, 4-bytes int best choice 6-digit int needed e.g. 201701 . whereas varchar(6) occupies 6 bytes, date occupies 2x4 bytes. (applied databases) but perspective of indexing, esp. in case of index range scan? if column yearmonth defined varchar(6) , index range scan can happen when using query select .. yearmonth in (...) if column yearmonth defined int or date , index range scan can happen operator <= , <= etc. in cases above, type of column definition more efficient when index range scan happens? most (if not all) dbms store date integer anyway, , datetime 2 integers, 1 date , 1 time, there little or no difference between two. think biggest consideration how intend use colum

python - better way to drop nan rows in pandas -

on own found way drop nan rows pandas dataframe. given dataframe dat column x contains nan values,is there more elegant way drop each row of dat has nan value in x column? dat = dat[np.logical_not(np.isnan(dat.x))] dat = dat.reset_index(drop=true) you can try this: dat.dropna() you pass param how drop if labels nan or of labels nan dat.dropna(how='any') #to drop if value in row has nan dat.dropna(how='all') #to drop if values in row nan hope answers question :))

How I can find the method(GET and POST) in a link Using Selenium web driver? -

i have search post , in project. suppose enter link , login system. web driver should searches , post in page. i had used list<webelement> listmethod = driver.findelements(by.tagname("form")); for(webelement listcall : listmethod){ system.out.println(listcall.getattributes("method")); } it solved problem

linux - Is there a easy way to display all contents of all files with a recursive mode in one directory? -

provided have following directory structure: . ├── 2.txt ├── 3.txt └── └── 1.txt now want display contents of files in directory, considered recursion. possible format displaying bellow: a/1.txt: ...the content of 1.txt 2.txt: ...the content of 2.txt 3.txt: ...the content of 3.txt you can use find command -exec option run cat command on files listed, in case, text files, find . -name "*.txt" -print -exec cat "{}" \; run command top folder containing files 2.txt , 3.txt should display file contents name needed.

tsql - How to remove all the duplicate records except the last occurence in a table -

Image
i have interim table without primary key , identity. need check 1 of columns (branch_ref) value duplicate entries , should mark flag 'd' if branch_ref same more 1 record except last occurrence in table. how can this? actual data stored in table. select branch_name,branch_reference,address_1,zip_cd,null flag_val branch_master as per above table, need flag updated ‘d’ except 6th (brach_reference=9910) , 16th record (branch_reference=99100 , zip_cd=612). when use row_number function identify duplicates order gets changed. select branch_name,branch_reference,address_1,zip_cd,flag_val, row_number() over(partition branch_reference order branch_reference) rid branch_master using below query update flag_val , updating wrong records. ;with cte ( select branch_name,branch_reference,address_1,zip_cd,flag_val, row_number() over(partition branch_reference order branch_reference) rid branch_master flag_val null )

r - Import files using key words -

i import image files using parts of names. have 100 .tif images names composed of 3 different elements, ai, bi , ci in such way: "a1 b1 c1.tif", "a1 b2 c1.tif", "a1 b1 c2.tif", "a2 b1 c1.tif"... defined ai, bi , ci @ beginning of code, , want call file contains these 3 elements. i have tried options have no chance correct, cannot find better: f = readtiff(ai bi ci) f = readtiff(ai, bi, ci) f = readtiff("ai bi ci") and same using readimage , file.name. getwd gives correct path. thank in advance. you can use paste command glue strings together. # for a, j b selection , k c selection my.filename <- paste("a", i, " b", j, " c", k, ".tif", sep = "") so if wanted import a1 b2 c2.tif i <- 1 j <- 2 k <- 2 my.filename <- paste("a", i, " b", j, " c", k, ".tif", sep = "") note paste0 defaults sep = "&q

r - rmarkdown::render leads to error when output_file path is absolute -

i have r package, 1 of function - produce report. in inst/markdown have template rep.rmd in package function producereport() have code: render.file <-"rep.rmd" render.file <- system.file(templates.path, render.file, package=getpackagename()) render.dir <- dirname(render.file) pdf.file <- "example.pdf" rmarkdown::render(render.file , quiet = false, output_format = "pdf_document", output_file = pdf.file) it works. but if change last line to: rmarkdown::render(render.file , quiet = false, output_format = "pdf_document", output_file = "d:/help/me/please/example.pdf") it not work (all paths exist). have error "! undefined control sequence. \grffile@filename ->d:\help \me\please\example _files/figure-... l.148 ...example_files/figure-latex/unnamed-chunk-2-1}" pandoc.exe: error producing pdf show traceback reru

postgresql - how to calculate only days between two dates in postgres sql query . -

suppose have given 2 dates, if difference 1 month should display 30 days.even months need convert days have tried age( date,now()::timestamp without time zone) giving months-dates-years format. ex: 10 mons 24 days 13:57:40.5265.but need following way. example if 2 months difference there need output 60 days. don't use age() function date/time arithmetic. returns "symbolic" results (which enough human representation, meaningless date/time calculations; compared standard difference). the standard difference operator ( - ) returns day-based results both date , timestamp , timestamp time zone (the former returns days int , latter 2 return day-based interval s): from day-based intervals can extract days extract() function: select current_date - '2017-01-01', extract(day now()::timestamp - '2017-01-01 00:00:00'), extract(day now() - '2017-01-01 00:00:00z'); http://rextester.com/rbto71933

How to access BIOS ROM binary from linux shell -

i want binary code in rom, made general file in linux. how it. , memory address rom accessed? it possible read rom bios content. when code not under protected mode os linux for example, when in boot mode. @ time rom bios content in memory @ 0x000f0000 address - take @ ibm pc system architecture memory map: http://wiki.osdev.org/memory_map_(x86) . can copy need right memory. if need rom bios content study, can use bios dump utilities - there lot of them. you can check utility biosd enter link description here ecode check utility flashrom . provided system supported, can read bios content issuing flashrom -r outputfile another utility dmidecode dmidecode -t bios read memory c:0000 f:ffff without need dmidecode sample command: dd if=/dev/mem bs=1k skip=768 count=256 2>/dev/null | strings -n 8

ibm mobilefirst - How to configure two IBM Worklight Server v6.1 to one IBM HTTP Server so that both the App Server would get equal number of hits? -

am having 2 ibm worklight v6.1 app servers configured 1 ibm http web server. issue number of hits on 1 of app server more other server eg: app1 having <20 hits whereas other server having 5 hits. want traffic distributed uniformly. please me in resolving issue. in present scenario load balancer configured before web servers.if follow mentioned in following link" https://www.ibm.com/support/knowledgecenter/en/ssaw57_8.5.5/com.ibm.websphere.nd.doc/ae/urun_rwlm_member_inst.html " able achieve uniform traffic hits in app servers. your query not specific mfp / worklight server. setting has achieved using websphere application server nd load balancing settings. websphere application server cluster settings gives option set weight cluster member.weight controls number of requests directed application server. for more details, refer cluster settings link.

python - pandas.read_csv returns empty dataframe -

here csv file: uipid,shid,pass,camera,pointheight,pointxpos,pointzpos,deffound,highestheight,xposition,zposition,rlevel,rejected,mixedp 50096853911,6345214,1,sxuxexcamera,218,12600,82570,no,-1,-1,-1,880,no,498 49876879038,6391743,1,szuzezcamera,313,210400,187807,no,-1,-1,-1,880,no,388 here code: df=pd.read_csv('.\sources\data.csv', delimiter=',', names=['uipid','shid','pass','camera','pointheight','pointxpos','pointzpos','deffound','highestheight', 'xposition','zposition','rlevel','rejected','mixedp'], skip_blank_lines=true, skipinitialspace=true, engine='python') and when select column print(df.loc[(df['uipid']==50096853911)) i empty df. empty dataframe columns[uipid,shid,pass,camera,pointheight,pointxpos,pointzpos,deffound,highestheight,xposition,zposition,rlevel,rejected,mixedp] index: [] and when set dtype in pd.re

javascript - Is there any way to distinguish between an unset property and a property set to undefined? -

this question has answer here: checking if key exists in javascript object? 13 answers say have object testobject = {a: undefined} . if console.log(testobject.a) , undefined. same happens if console.log(testobject.b) , doesn't exist. there way in javascript distinguish between a , b here? ask out of curiosity, have no use case. hasownproperty() method returns boolean indicating whether object has specified property own (not inherited) property. in given case - testobject = {a: undefined}; testobject.hasownproperty('a') //true testobject.hasownproperty('b') //false

tensorflow - SyncReplicasOptimizer Not Looping Over All Epochs -

after running following code, global_step variable not equal num_batches * epochs expected. instead, stops @ end of 1 epoch. asynchronous code without syncreplicasoptimiser works expected though. there i'm doing wrong? here's code: ( args.steps more num_batches * epochs ) sess = sv.prepare_or_wait_for_session(server.target) queue_runners = tf.get_collection(tf.graphkeys.queue_runners) sv.start_queue_runners(sess, queue_runners) tf.logging.info('started %d queues processing input data.', len(queue_runners)) if is_chief: sv.start_queue_runners(sess, chief_queue_runners) sess.run(init_tokens_op) print("{0} session ready".format(datetime.now().isoformat())) ##################################################################### ########################### training loop ########################### _current_state = np.zeros((ba

python regex to replace body of functions in C -

lets have functions in c this: int main(){ if(1){ printf("1"); } } what need find function body in { } , replace empty string. bothers me because of { } , can nested infinitely. there way find bodies or have use stack, or variables store nesting. unless regex learning project undertaken solely interest should consider taking more professional approach. appear have decided regex appropriate approach without considering alternatives. i'd suggest looking @ using pycparser , heavy lifting , present program in form makes easy want.

docker - Kubernetes/Spring Cloud Dataflow stream > spring.cloud.stream.bindings.output.destination is ignored by producer -

i'm trying run "hello, world" spring cloud data flow stream based on simple example explained @ http://cloud.spring.io/spring-cloud-dataflow/ . i'm able create simple source , sink , run on local scdf server using kafka, until here correct , messages produced , consumed in topic specified scdf. now, i'm trying deploy in private cloud based on instructions listed @ http://docs.spring.io/spring-cloud-dataflow-server-kubernetes/docs/current-snapshot/reference/htmlsingle/#_getting_started . using deployment i'm able deploy simple "time | log" out-of-the-box stream no problems, example fails since producer not writing in topic specified when pod created (for instance, spring.cloud.stream.bindings.output.destination=ntest33.nites-source9) in topic "output". have similar problem sink component, creates , expect messages in topic "input". i created stream definition using dashboard: nsource1 | log and container args source are

python - How to convert a large JSON file to CSV? -

i have large json files need convert (the largest 1 4 gb). online tools support small size not suitable me. looked stackoverflow scripts may work me. found one: import csv import json infile = open("some.json","r") outfile = open ("myfile1.csv","w") writer = csv.writer(outfile) row in infile: data = json.loads(row) writer.writerow(data) here link 1 of json files: https://pastebin.com/kwzgtzmp when run file, getting following error: traceback (most recent call last): file "c:/users/piyush/desktop/2008/runcsv.py", line 11, in <module> writer.writerow(data) _csv.error: sequence expected can tell me how can fix. don't know python appreciate if give me detailed answer.

ios - Converting Swift 2.3 to 3 error: cannot invoke dataTask with an argument list of type -

it project consists of registering user app , registered in mysql database. works in swift 2.3 want in swift 3 , not know how fix it. error on urlsessions.shared.datatask code: else{ let url = url(string: "http://localhost/billpain/secure/register.php")! let request = nsmutableurlrequest(url: url) request.httpmethod = "post" let body = "username=\(usernametxt.text!.lowercased())&password=\(passwordtxt.text!)&email=\(emailtxt.text!)&fullname=\(firstnametxt.text!)%20\(lastnametxt.text!)" request.httpbody = body.data(using: string.encoding.utf8) **urlsession.shared.datatask(with: request, completionhandler: {(data:data?, response:urlresponse?, error:nserror?) in** if error == nil { dispatchqueue.main.async(execute: { { let json = try jsonserialization.jsonobject(with: data!, options: .mutablecontainers) as? nsdi

jquery - Prioritize JavaScript array according to key value -

i have javascript array var airports = [ { iata: "cpt", city: "cape town", airport: "cape town international", country: "south africa", priority: 9 }, { iata: "hla", city: "johannesburg", airport: "lanseria", country: "south africa", priority: 1 }, { iata: "jnb", city: "johannesburg", airport: "or tambo international", country: "south africa", priority: 9 }, ]; take note: final .js file has on 3 000 airports listed. i'm trying autocomplete return prioritized results. in example above, if user starts typing "johannesburg" must prioritize according "priority" value e.g. jnb, or tambo international should show above hla, lanseria. currently autocomplete display results according listed in array. a fiddle can found here: https://jsfiddle.net/cgaybba/17p7uyvf/ tr

c# - Convert a list of excel sheets (sheet name list provided) into a single PDF file -

i need add selected set of sheets pdf using microsoft.office.interop.excel library in c#. have been searching throught net figure out how this. haven't been able find helpful. can me this. found following statement convert given sheet pdf. looks like, cannot append list of excel sheets 1 pdf when provide sheet names. xlws.exportasfixedformat(excel.xlfixedformattype.xltypepdf, endpath); help please. you can use worksheet.exportasfixedformat method. example: string exportfilepath = @"c:\desktop\test.pdf"; activeworksheet.exportasfixedformat(xlfixedformattype.xltypepdf, exportfilepath); or can use workbook.exportasfixedformat method string exportfilepath = @"c:\desktop\test.pdf"; activeworksheet.exportasfixedformat(xlfixedformattype.xltypepdf, exportfilepath); references: https://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.worksheet.exportasfixedformat.aspx https://msdn.microsoft.com/en-us/library/microsoft.office.t

How to get the last word in the last line in a file with Windows batch script? -

i have file sample.txt content below. h|20170331|cis a||a1140|grm //header a||a1140|grm a||a1140|grm a||a1140|grm a||a1140|grm t|20170331|5 //trailer i need last token in last line i.e. 5 . (it's count of line except header trailer) . as of now, tried below; it's giving first token, i.e. t , need last token i.e. 5 . @echo off rem /f "skip=1 tokens=2,* delims=" %%a in (sample.txt) set "variable=%%a" rem /f "delims=|" %%x in (sample.txt) set "variable=%%x" /f "delims=|" %%g in (sample.txt) set "variable=%%g" echo %variable% pause note file can contain thousands of records last token required. presuming want rid of //trailer add space delimiter. @echo off /f "tokens=3delims=| " %%a in (sample.txt) set lastrowcol3=%%a echo [lastrowcol3=%lastrowcol3%]

python - Get the distro from a distutils setup call -

i want unit test python extensions. achieve i'm running setup() in script: from distutils.core import setup, extension import os dir = os.path.dirname(__file__) def call_setup(): module1 = extension('callbacks', sources = [os.path.join(dir, 'callbacks.c')]) setup( script_name = 'setup.py', script_args = ['build'], name = 'packagename', ext_modules = [module1]) to avoid leaving junk in test directory want cleanup build after tests run. i'd run distutils.command.clean.clean() in unittest teardown() . how dist object distro must passed argument clean() ? thanks it looks call setup() should return distribution instance. see setup() function list of keyword arguments accepted distribution constructor. setup() creates distribution instance.