Posts

Showing posts from September, 2012

VB6: console get mouse position reading input buffer events -

can me writing code in vb6 reads input buffer events console window? important part mouse cursor position in cells , rows. i making program in vb6 uses console main gui (or should cui) , can't find example in vb code uses 'input buffer events'. this example code want it's in c++ , i'm using vb6: https://msdn.microsoft.com/en-us/library/ms685035(v=vs.85).aspx i have lot of trouble converting code because don't know c++. here other links gave me idea of how start: http://www.developer.com/net/vb/article.php/10926_1538861_6/writing-console-mode-applications-in-visual-basic.htm https://msdn.microsoft.com/en-us/library/windows/desktop/ms682073(v=vs.85).aspx http://www.xaprb.com/blog/2005/10/14/how-to-create-a-vb6-console-program/ http://blogs.msdn.com/b/oldnewthing/archive/2013/05/06/10416225.aspx http://microsoft.public.vb.winapi.narkive.com/avyxhxug/readconsoleinput-and-input-record http://www.pinvoke.net/default.aspx/kernel32/readconsoleinput...

How to properly search xml document using LINQ C# -

hey guys , gals having hard time time figuring out how search xml document. have been reading other forms crazy today can't seem understand it. hopeing give me little more detailed information on how correct way , why using linq. here xml file. <?xml version="1.0" encoding="utf-8"?> <body> <customers> <client> <firstname value="someguy" /> <lastname value="test" /> <phonenumber value="541555555" /> <address value="55 nowhere" /> <city value="sometown" /> <state value="somestate" /> </client> </customers> </body> what tyring accomplish return of values of each element matches name of customer. here code. ienumerable<xelement> test = doc.root.descendants() .where(nodename => nodename.name == "client" && nodename....

python - How to make a class iterable, but not have the iterator modified if you modify the class? -

i new python , coding in general, i'm lost. have coded "node" class (shown below @ bottom) instantiates binary search tree , couple of methods insert(), , elements() (which returns list of elements inorder transversing tree). supposed make class iterable: "iter__(self) should return nodeiterator, returns elements tree in sorted order. modifying tree should not modify existing iterators." i'm trying inserting code class right now: def __iter__(self): x=self.copy() x.i=0 return x def next(self): lst=x.elements() #??? no idea here. i defined x=self.copy() try cover fact modifying tree shouldn't modify iterator, don't know if right idea. here node class decorator used in 1 of methods: def depth(old_f): ''' write decorator overrides standard behavior of function returns true or false , instead returns 0 false or n number of recursive calls needed return true. ''' def new_f(*args): res =...

ios - Cannot find protocol declaration for 'WCSessionDelegate' -

i new ios development. created swift class follows: import watchconnectivity; import healthkit; @objc class blah : nsobject, wcsessiondelegate { ... } i need @objc use class objective-c (that exists). problem when compiler creates bridge [productname]-swift.h, complains cannot find wcsessiondelegate. exact error: cannot find protocol declaration 'wcsessiondelegate'; did mean 'nsurlsessiondelegate'? swift_class("_ttc8test8blah") @interface blah: nsobject <wcsessiondelegate> instead of implementing delegate, if change following, works. @objc class blah : nsobject { ... func setsessiondelegate(delegate:wcsessiondelegate) -> blah { self.mdelegate = delegate; return(self) } } i prefer former way. how resolve compilation error? thanks it looks [productname]-swift.h file adds include if mosules supported: #if defined(__has_feature) && __has_feature(modules) @import objectivec; @import watchconnectivity; @...

ImageMagick with Grails -

i want use imagemagick in grails application. using following dependencies in buildconfig.groovy compile('jmagick:jmagick:6.6.9') compile('org.im4java:im4java:1.2.0') however when try , run error: org.im4java.core.commandexception: java.io.ioexception: cannot run program "convert": error=2, no such file or directory. how use imagemagick or jmagick grails without installing directly, missing dependencies? jmagick , im4java take 2 different approaches using imagemagick. in short, jmagick uses java ini access imagemagick api , im4java calls imagemagick tools. in other words, jmagick bundles imagemagick while im4java not. know, error due imagemagick either not being installed or not being in environment path. im4java the 2 don't go together. example, cannot use im4java call out jmagick in order avoid installing imagemagick on computer hosting grails app. use im4java need install imagemagick. jmagick because jmagick partly implemen...

ios - Issues with UIPickerView inside a StackView -

i'm running problem size of pickers when put them inside of stack view. pickers change size default size when put stack view. not when not placed stack view just add height , width constraints picker before add stackview , should solve problem.

javascript - Are HTA files a poor choice for GUI? -

i've read few posts state microsoft stopping support hta files or something, leads me question choice of using .hta files project i'm working on. the htas being used contain simple javascript, css , html code. actual "engine" of software i'm creating created using commercial software. htas provide pretty front-end users. what limitations of doing so? there better alternative or ok next 5+ years? i htas since allow me design gui using css/html... , add simple scripts (java/jquery) needed. thanks feedback. the basic limitations of continued use if microsoft stops supporting them lack cross platform support. found following article , subsequent comments useful http://clintberry.com/2013/html5-apps-desktop-2013/ .

html - Edit webpage with javascript trick - how to "unedit"? -

i can use following scriptlet make webpage editable javascript:document.body.contenteditable='true'; document.designmode='on'; void 0 but after doing edits want (e.g., screenshot manual), how restore state of page normal uneditable state? have tried changing true , 0 false , 1 respectively, no avail. you need remove contenteditable attribute. var demo_editable = document.getelementbyid('demo-editable'); var demo_button = document.getelementbyid('demo-button'); demo_editable.setattribute('contenteditable',true); demo_button.onclick = function() { delete demo_editable.removeattribute('contenteditable'); } <div id="demo-editable">this editable</div><button id="demo-button">make not editable</button> or can set attribute false. var demo_editable = document.getelementbyid('demo-editable'); var demo_button = document.getelementbyid('d...

string - For Loop List Python for Variable URL -

so if wanted print contents of url page or cycle through many , change few segments of url how might so. given following: if know format following player, minus few tweeks id , last portion: format below: http://espn.go.com/mlb/player/_/id/31000/brad-brach lets know each players id , name: player_name = ['brad-brach','oliver-drake',...] player_id = ['31000','31615',...] in player_id: url = 'http://espn.go.com/mlb/player/_/id/'+player_id[i]+/'+player_name[i] do ever given know these players in player_id , player_name. how might iterate through player_id's , player_name's without getting typeerror: list indices must integers, not str i know url list , contents within player_id[0] string. missing here? select item list index not string of list, player_name['31000']?! player_name = ['brad-brach','oliver-drake',...] player_id = ['31000','31615',...] in xrange(len(pl...

appium - iPhone, iPad wake screen command Issues/Bugs -

is there appium command wake ios devices? have method takes while run, , device goes sleep. wake device can screenshot of current state. alternatively there bash command use? just change iphone settings: settings > general > auto-lock > never

c - cant get libsensors to work properly -

here code concerning libsensors. libraries: #include <unistd.h> #include <sensors/sensors.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <stdlib.h> #include <arpa/inet.h> #include <stdio.h> #include <string.h> #include <math.h> code concerning libsensors: char sd[16384]="^\0",bf[1]; char buf2[8192]="^\0"; sensors_chip_name const* scn; int c=0; int t4=1; while((scn=sensors_get_detected_chips(0,&c))!=0) { sensors_feature const *fea; int f=0; strcat(sd,scn->prefix); printf("%s",scn->prefix); strcat(sd,":"); strcat(sd,scn->path); strcat(sd,"("); while((fea=sensors_get_features(scn,&f))!=0) { strcat(sd,fea->name); strcat(sd,"("); sensors_subfeature const *sb; int s=0; ...

junit - Powermock - java.lang.IllegalStateException: Failed to transform class -

description: i trying test static method class. using powermock (1.6.2) + mockito (1.10.19) mocking along junit4 (4.12) & java8. issue: getting error: "failed transform class name com.gs.ops.domain.staticclass reason: java.io.ioexception: invalid constant type: 18" solutions tried: googled threads issue on powermock - mockito & java-8 excluded java assist powermock , added java assist 3.19.0-ga tried different versions of powermock (1.5.4, 1.6.2...) below exception stack trace: java.lang.illegalstateexception: failed transform class name com.staticclass. reason: java.io.ioexception: invalid constant type: 18 @ org.powermock.core.classloader.mockclassloader.loadmockclass(mockclassloader.java:266) @ org.powermock.core.classloader.mockclassloader.loadmodifiedclass(mockclassloader.java:180) @ org.powermock.core.classloader.defersupportingclassloader.loadclass(defersupportingclassloader.java:68) @ java.lang.classloader...

on Amazon EMR 4.0.0, setting /etc/spark/conf/spark-env.conf is ineffective -

i'm launching spark-based hiveserver2 on amazon emr, has classpath dependency. due bug in amazon emr: https://petz2000.wordpress.com/2015/08/18/get-blas-working-with-spark-on-amazon-emr/ my classpath cannot submitted through "--driver-class-path" option so i'm bounded modify /etc/spark/conf/spark-env.conf add classpath: # add hadoop libraries spark classpath spark_classpath="${spark_classpath}:${hadoop_home}/*:${hadoop_home}/../hadoop-hdfs/*:${hadoop_home}/../hadoop-mapreduce/*:${hadoop_home}/../hadoop-yarn/*:/home/hadoop/git/datapassport/*" where "/home/hadoop/git/datapassport/*" classpath. however after launching server successfully, spark environment parameter shows change ineffective: spark.driver.extraclasspath :/usr/lib/hadoop/*:/usr/lib/hadoop/../hadoop-hdfs/*:/usr/lib/hadoop/../hadoop-mapreduce/*:/usr/lib/hadoop/../hadoop-yarn/*:/etc/hive/conf:/usr/lib/hadoop/../hadoop-lzo/lib/*:/usr/share/aws/emr/emrfs/conf:/usr/share/aws...

Using DDL to create a Foreign Key, with Delphi -

i using delphi 7 create access db ddl statements. it's going relatively simple relational database simple stock invoice system. i've managed create table called customer no problem, on trying create table called order, in order have foreign key field customerid, following error message: "syntax error in field definition". customerid key field in customer table , want link 2 together. here ddl statements both. cs:= 'create table tblcustomer ('+ 'customerid number,' + 'fname text(20),' + 'sname text(20),' + 'addressline1 text(35))'; adocommand1.commandtext:=cs; adocommand1.execute; cs:='create index idxcustomerid on tblcustomer (customerid) primary'; adocommand1.commandtext:=cs; adocommand1.execute; cs:= 'create table tblorder ('+ 'orderid number,'+ //here line!! 'customerid number constraint customerid references tblcustomer (customerid),'+ 'orderdate dat...

pointers - Specifying "const" when overloading operators in c++ -

code: 4: typedef unsigned short ushort; 5: #include <iostream.h> 6: 7: class counter 8: { 9: public: 10: counter(); 11: ~counter(){} 12: ushort getitsval()const { return itsval; } 13: void setitsval(ushort x) {itsval = x; } 14: void increment() { ++itsval; } 15: const counter& operator++ (); 16: 17: private: 18: ushort itsval; 19: 20: }; 21: 22: counter::counter(): 23: itsval(0) 24: {}; 25: 26: const counter& counter::operator++() 27: { 28: ++itsval; 29: return *this; 30: } 31: 32: int main() 33: { 34: counter i; 35: cout << "the value of " << i.getitsval() << endl; 36: i.increment(); 37: cout << "the value of " << i.getitsval() << endl; 38: ++i; 39: cout << "the value of " << i.getitsval() << endl; 40: counter = ++i; 41...

Windows disk usage issues with python -

i executing python code follows. i running on folder ("articles") has couple hundred subfolders , 240,226 files in all. i timing execution. @ first times pretty stable went non-linear after 100,000 files. times (i timing @ 10,000 file intervals) can go non_linear after 30,000 or (or not). i have task manager open , correlate slow-downs 99% disk usage python.exe. have done gc-collect(). dels etc., turned off windows indexing. have re-started windows, emptied trash (i have few hundred gbs free). nothing helps, disk usage seems getting more erratic if anything. sorry long post - help def get_filenames(): (dirpath, dirnames, filenames) in os.walk("articles/"): dirs.extend(dirnames) dir in dirs: path = "articles" + "\\" + dir nxml_files.extend(glob.glob(path + "/*.nxml")) return nxml_files def extract_text_from_files(nxml_files): nxml_file in nxml_files: fast_p...

Basic JavaScript Algorithm, Fibonacci series -

sum odd numbers of fibonacci series , including given number. i can't figure out syntax problem i'm having. problem, loop, loop ends when greater or equal value of num , instead want end the, generated values of start . is there way make work? function sumfibs(num) { var odd = [1]; // odd numbers of fibonacci series var start = [0,1]; // fibonacci series // generating series , filtering out odd numbers for(i=1;i<num;i++) { var sum = 0; sum = start[i] + start[i-1]; start.push(sum); if(sum%2 != 0) { odd.push(sum); } } // generating sum of odd numbers var main = 0; // sum of odd numbers for(i=0;i<odd.length;i++) { main += odd[i] } console.log(start);console.log(odd);return main } sumfibs(4); it should if understand correctly while(start.length<num) { code here }

get the name of a query from an access table, then run the query -

i have access db pulls volumes table of exceptions. each volume has id. i've created queries pull details, possible volumes, , saved each 1 same name each volume id. each time volume exceptions pulled db, volume ids can change. so, there query runs updates volume table new ids. unless know way query, need write access vba code loop through volume table, identify name of each query , run queries until reaches end of table. example, code needs @ first record in volume table, 1040. name of query needs run. code needs find query named 1040 , run it. make table query. the table name facilityvolume , has 1 field named volume. value in field shorttext format though numeric. i've tried couple of different things. here latest try. dim db database dim vol recordset dim code querydef set db = currentdb() set vol = db.openrecordset("facilityvolume") set volume = vol.fields("volume") vol.movefirst until vol.eof =...

reactjs - React, get bound parent dom element name within component -

within component, how can access name of parent component nested inside? so if render thus: reactdom.render( <radialsdisplay data={imagedata}/>, document.getelementbyid('radials-1') ); how can retrieve id name #radials-1 within component itself? it makes sense pass property, if really need programmatically, , inside component, can wait component mount, find dom node, , @ parent. here's example: class application extends react.component { constructor() { super(); this.state = { containerid: "" }; } componentdidmount() { this.setstate({ containerid: reactdom.finddomnode(this).parentnode.getattribute("id") }); } render() { return <div>my container's id is: {this.state.containerid}</div>; } } reactdom.render(<application />, document.getelementbyid("react-app-container")); working demo: https://jsbin.com/yayepa/1/edit?html,js,output if ...

javascript - Parsing json stored in localstorage - Error NS_ERROR_DOM_BAD_URI -

i've read lot of posts around without success. i'm developing simple set/get localstorage of json stringified, in following link . unfortunately, got error: request failed: error, ns_error_dom_bad_uri: access restricted uri denied this sniplet i'm using (just tests): var id_expert = "1"; var testjson = "js/testjson.js"; $.getjson(testjson) .done(function( data ) { //////// store /////////// window.localstorage.setitem("id_expert_selected", id_expert); var list = 'questions_'+id_expert; window.localstorage.setitem(list,json.stringify(data)); ////////// retrieve ////////////// var id_exp = window.localstorage.getitem('id_expert_selected'); var list_answ = window.localstorage.getitem('questions_'+id_expert); var test = json.parse(list_answ) || {}; $.getjson( test ) .done(function( data ) { <-------...

r - To calculate equal-weight portfolio by rowMeans -

the head(pri) of data below, date aapl googl bac wfc wmt sp500 1 2011-01-03 44.90084 308.5285 13.84028 27.94722 47.98998 1271.50 2 2011-01-10 46.55196 312.4024 14.81153 29.05624 48.63777 1293.24 3 2011-01-18 43.64513 306.2212 13.84028 28.84330 49.45417 1283.35 4 2011-01-24 44.89817 300.7958 13.20897 28.24887 50.31493 1276.34 5 2011-01-31 46.28746 305.7958 13.87913 29.10863 49.72038 1310.87 6 2011-02-07 47.67007 312.5626 14.34533 29.99717 49.41867 1329.15 the head(ret) after calculating stock returns stock price shown below. ret<-sapply(pri[2:7], function(x) x[-1] / x[-length(x)] - 1) head(ret) aapl googl bac wfc wmt sp500 [1,]0.03677256 0.012555957 0.070175516 0.039682516 0.013498507 0.017097908 [2,]-0.06244261 -0.019785965 -0.065573838 -0.007328272 0.016785269 -0.007647470 [3,]0.02870957 -0.017717306 -0.045613952 -0.020608977 0.017405369 -0.005462275 [4,]0.030...

linq - SelectMany while Referencing Parent -

given list<foo> foos; public class foo { public string name { get; set; } public list<bar> bars { get; set; } } public class bar { public double score { get; set; } } i'm trying output, each object in foos , property foo.name along maximum bar.score. see how maximum score: foos.selectmany(f => f.bars).maxby(b => b.score).select(b => b.score); is there way corresponding name well, without adding reference bar foo? if made following change public class bar { public foo foo { get; set; } // can't add public double score { get; set; } } i do foos.selectmany(f => f.bars).maxby(b => b.score) .select(b => new { name = b.foo.name, score = b.score) }); however in real case, cannot add reference. you don't need use selectmany , use select max : var result = foos .select(f => new { name = f.name, maxscore = f.bars.max(b => b.score) });

java - static / abstract conflict -

i have abstract class (averageddatarecord) need abstract further (datarecord) can extend original class , new concrete class (summeddatarecord) , i'm having problems getting of methods translate original abstract class new super class. public abstract class datarecord{ protected abstract datarecord getfirstrecord(arraylist<t> datalist); protected abstract datarecord getlastrecord(arraylist<t> datalist); protected datetime getfirstrecordtimestamp(arraylist<t> datalist){ datetime result = new datetime(default_datetime); datarecord record = this.getfirstrecord(datalist); if(null != record) result = record.getrecorddatetime(); return result; } protected datetime getlastrecordtimestamp(arraylist<t> datalist){ datetime result = new datetime(default_datetime); datarecord record = this.getlastrecord(datalist); if(null != record) result = record.getrecorddatetime(); return result; } } public abstrac...

javascript - What can override the attributes in an html input? -

i outputing values want html input php. reason not recognizing min , step attributes. how can html attributes overridden? edit - customizing anspress wordpress. here link through files plugin . any thoughts?? html structures output ( ap_ask_form() in php code below) <div id="ap-form-main" class="active ap-tab-item"> <?php ap_ask_form(); ?> </div> ask_form.php class anspress_ask_form { public function __construct() { add_filter('ap_ask_form_fields', array($this, 'ask_form_name_field')); } public function ask_form_name_field($args){ if(!is_user_logged_in() && ap_opt('allow_anonymous')) $args['fields'][] = array( 'name' => 'name', 'label' => __('name', 'ap'), 'type' => 'text', 'placeholder' => __('en...

inheritance - Abstract types can only be instantiated with additional type information - OSGI -

i using mongojack on osgi stack. below exception getting: set 29, 2015 3:12:59 pm com.mongodb.dbportpool goterror advertÊncia: emptying dbportpool localhost/127.0.0.1:27017 b/c of error org.codehaus.jackson.map. jsonmappingexception: can not construct instance of api.book, problem: abstract types can instantiated additional type information @ [source: de.undercouch.bson4jackson.io.littleendianinputstream@4fe0026c; pos: 0] @ org.codehaus.jackson.map.jsonmappingexception.from(jsonmappingexception.java:163) @ org.codehaus.jackson.map.deser.stddeserializationcontext.instantiationexception(stddeserializationcontext.java:233) @ org.codehaus.jackson.map.deser.abstractdeserializer.deserialize(abstractdeserializer.java:60) @ org.codehaus.jackson.map.objectmapper._readvalue(objectmapper.java:2704) @ org.codehaus.jackson.map.objectmapper.readvalue(objectmapper.java:1315) @ net.vz.mongodb.jackson.internal.stream.jacksondbdecoder.decode(jack...

sorting - anything wrong with below binary search code in Python -

let function perspective. thanks. def binarysearch(array, beginindex, endindex, value): while (beginindex < endindex): mid = (beginindex + endindex) // 2 if array[mid] < value: beginindex = mid + 1 elif array[mid] > value: endindex = mid - 1 else: #equal return mid if array[beginindex] == value: return beginindex else: return -1 here cases tested, print binarysearch([2,3], 0, 1, 2) print binarysearch([2,3], 0, 1, 3) print binarysearch([2,3], 0, 1, -1) print binarysearch([2,3,3,3,4,5], 0, 5, 3) thanks in advance, lin well, first thing "wrong" (if production code rather class assignment or personal exercise) you're reinventing wheel. python provides binary search part of included batteries through bisect module (and yes, it's on python 2 well). beyond that, doesn't work cases. example, tried: binarysearch(list(range(1000)), 0, 1000, 6)...

algorithm - Trouble figuring out these tough Big-O examples -

i'm trying study upcoming quiz big-o notation. i've got few examples here they're giving me trouble. seem little advanced lot of basic examples find online help. here problems i'm stuck on. 1. `for (i = 1; <= n/2; = * 2) { sum = sum + product; (j= 1; j < i*i*i; j = j + 2) { sum++; product += sum; } }` for one, i = * 2 in outer loop implies o(log(n)), , don't think i <= n/2 condition changes because of how ignore constants. outer loop stays o(log(n)). inner loops condition j < i*i*i confuses me because in terms of 'i' , not 'n'. big-o of inner loop o(i^3)? , big-o entire problem o( (i^3) * log(n) )? 2. `for (i = n; >= 1; = /2) { sum = sum + product (j = 1; j < i*i; j = j + 2) { sum ++; (k = 1 ; k < i*i*j; k++) product *= * j; } ...

android - Runtime.nativeLoad crashes when loading private library -

sigsegv: sigsegv #00 pc 4009a4c0 /system/bin/linker #01 pc 4009b004 /system/bin/linker #02 pc 4009b416 /system/bin/linker #03 pc 4009b9ca /system/bin/linker #04 pc 40099f42 /system/bin/linker #05 pc 00051074 /system/lib/libdvm.so (_z17dvmloadnativecodepkcp6objectppc) #06 pc 00068a18 /system/lib/libdvm.so #07 pc 00027fa0 /system/lib/libdvm.so #08 pc 0002f110 /system/lib/libdvm.so (_z11dvmmterpstdp6thread) #09 pc 0002c774 /system/lib/libdvm.so (_z12dvminterpretp6threadpk6methodp6jvalue) #10 pc 000619ea /system/lib/libdvm.so (_z15dvminvokemethodp6objectpk6methodp11arrayobjects5_p11classobjectb) #11 pc 00069af6 /system/lib/libdvm.so #12 pc 00027fa0 /system/lib/libdvm.so #13 pc 0002f110 /system/lib/libdvm.so (_z11dvmmterpstdp6thread) #14 pc 0002c774 /system/lib/libdvm.so (_z12dvminterpretp6threadpk6methodp6jvalue) #15 pc 000619ea /system/lib/libdvm.so (_z15dvminvokemethodp6objectpk6methodp11arrayobjects5_p11classobjectb) #16 pc 00069af6 /system/lib/libdvm.so #17 pc 00027fa0 /system/lib/...

python - Limit number of arguments passed in -

i using argparse take list of input files: import argparse p = argparse.argumentparser() p.add_argument("infile", nargs='+', type=argparse.filetype('r'), help="copy from") p.add_argument("outfile", help="copy to") args = p.parse_args() however, opens door user pass in prog /path/to/* outfile , source directory potentially have millions of file, shell expansion can overrun parser. questions are: is there way disable shell expansion (*) within? if not, if there way put cap on number of input files before assembled list? (1) no, shell expansion done shell. when python run, command line expanded already. use "*" or '*' deactivate happens on shell. (2) yes, length of sys.argv in code , exit if long. also shells have built-in limit expansion.

rust - Can I use a method or a function as a closure? -

i have methods on struct i'd pass around parameters. i'm pretty sure way pass around functions using closures. there way can without doing || { self.x() } ? you can absolutely use method or function closure. use full path function or method, including trait methods: a free function: struct monster { health: u8, } fn just_enough_attack(m: monster) -> u8 { m.health + 2 } fn main() { let sully = some(monster { health: 42 }); let health = sully.map(just_enough_attack); } an inherent method: struct monster { health: u8, } impl monster { fn health(&self) -> u8 { self.health } } fn main() { let sully = some(monster { health: 42 }); let health = sully.as_ref().map(monster::health); } a trait method: fn main() { let name = some("hello"); let owned_name = name.map(toowned::to_owned); } note argument type must match exactly, includes by-reference or by-value.

Nested IF field in Word VBA -

i'm trying create word addin adds complex if statement creation, list of possible mergefields. complex is { if { = or ( { compare { mergefield field_1 } <= "value" }, { compare { mergefield field_2 } >= "value" } ) } = 1 "true instructions" "false instructions" } im trying in vba, im having issues complex if, cant "}" end in right locations. if use terminator "selection.endkey unit:=wdline" in other location besides end, creates mess , putts } @ line. here code: selection.fields.add range:=selection.range, type:=wdfieldempty, _ preserveformatting:=false selection.typetext text:="if " selection.fields.add range:=selection.range, type:=wdfieldempty, _ preserveformatting:=false selection.typetext text:=" = " & jointoperator1 & " ( " 'first arg selection.fields.add range:=selection.range, type:=wdfieldempty, _ preserveformatting:=false selec...

r - incorporate code listings from an external file in knitr/markdown -

Image
i incorporate listings of code drawn external files in rmarkdown file. pretty (syntax highlighting, auto-indentation, etc.). the code not r code (otherwise use of existing tricks pretty-print r functions ) - specifically, it's bugs , stan code. i'm not targeting latex/pdf output: otherwise use listings package. i'd able incorporate files without unwieldy external cat firstpart.rmd codefile.rmd lastpart.rmd >wholefile.rmd system command, , without pre-processing step: this question suggests markdown processors multimarkdown , marked 2 have file inclusion syntax, think i'm stuck pandoc. at present i'm using code chunks this ```{r jagsmodel, echo=false, results="markup", comment=""} cat(readlines("logist.bug"),sep="\n") ``` which works ok doesn't me syntax highlighting ... here's 1 approach. need pygments installed ( pip install pygments ) , has able put (it should on it's own) ...