Posts

How do I get the path of a binary in c#? -

for reporting purposes i'm trying location of binary. i doing this, , working, i'm getting nullreferenceexception when try testproc.mainmodule.filename; , think may program closing before i'm able grab it. there better way this? processstartinfo testpsi = new processstartinfo(runoptions.testbinary); testpsi.redirectstandarderror = true; testpsi.redirectstandardoutput = true; testpsi.useshellexecute = false; process testproc = new process(); testproc.startinfo = testpsi; testproc.start(); ret = testproc.mainmodule.filename; testproc.kill(); if (ret != null) return ret; option 1: use path have. unless i'm missing something, looks you're creating process (with runoptions.testbinary ), should know path. can full path executable path.getfullpath(runoptions.testbinary) , or if binary on path , can manually examine each directory determine binary being executed from. option 2: use c#'s wmi libraries: if there differences in bitness (32-...

linux - Fork()-ing a new process -

fork()-ing process end calling do_fork() inside kernel, making exact copy of itself. when read through books, says child of fork call exec create new process. example: ls command on shell, create way. sh(parent) | sh(child) | ls(new process) but, not able understand how & exec*() called? because, can see shell(child) created in fork. but, when , new process created/executed? you have exec() if want new program running in 1 of processes (usually child not absolutely necessary). in specific case shell executes ls , shell first forks, child process execs. it's important realise 2 distinct operations. all fork() give 2 (nearly) identical processes , can use return code fork() decide if you're parent (you positive pid of child, or -1 if fork() failed) or child (you 0). see this answer description on how fork() , exec() work (under your control) , how can used without each other. similar do_fork() , exec stuff boils dow...

hyperlink - LESS stylesheet not registering -

is there trick less? can't of function in-browser. maybe i'm declaring stylesheet in browser wrong? it's literally not showing at all . i've included min , less files in same folder, make sure it's not directory issue. here html: <!doctype html> <head> <meta charset="utf-8"/> <meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>jessica colding</title> <link rel="stylesheet/less" type="text/less" href="style.less"/> <script src="less-1.3.3.min.js" type="text/javascript"></script> <!--[if lt ie 9]> <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> </head> <body lang="en"> ...

javascript - Target specific google chart data set -

say if google chart data array looks below, there way target specific data set google charts , something. if data = "13 dec 11 tue" point of 56 should use different color rest... ["13 dec 11 tue",56], ["14 dec 11 wed",168], ["15 dec 11 thu",181], ["16 dec 11 fri",163], ["17 dec 11 sat",172] ... yes, possible, requires coding in javascript , cannot done innately within google visualization save within tables using colorformatter . assuming want in chart, need write code it. option 1: create array of colors you can use series configuration option of charts set color of how each series displayed. for instance, if have 3 series, can set following option turn second 1 red: series: [{}, {color: 'red'}, {}] this set no options series 1 , 3, change color of series 2 red. so can loop through data javascript, , create array of colors assign various series. instance, if want value in column 1 higher 1...

java - How to get fragment from the view for Google Map v2 -

i have android application using google map api v1 key , working fine. need give code professor , show him working demo scratch on new desktop machine. means, cannot use google map api v1 key anymore reason needed make changes in code have google map api key v1 can used google map api v2 key . i trying show google map on top half of android screen , in bottom half, trying show list view . below code works fine google map api v1 key , need make changes in below code make work google map api v2 key meaning need show google map on top half of android screen. private googlemap map; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); bundle bundle = getintent().getextras(); user_id = bundle.getstring("userid"); layoutinflater inflater = layoutinflater.from(this); scrollview = (myhorizontalscrollview) inflater.inflate(r.layout.horz_scroll_with_list_menu, null); setcontentview(scrollview); menu = inflater.inflate(r.la...

C++ Passing pointer to function -

ok have function int main { .... char *wordl=word();//wordl pointer array of characters ... gamewindow(wordl,length); } void gamewindow(char &wordl,int length); my question how pass pointer such passed pointer points same array list.. , can access wordl[i] in gamewindow function. from comment below, implementation of word() : char* word() { int j=1988497762; cout<<j<<endl ; static char original[25]; int x; ifstream fin("out.txt"); (j=0;!fin.eof();j++) fin.getline(original,25); fin.close(); srand ( (unsigned) time(null) ); x = rand()%j; cout<<x<<"\n"; cout<<rand()<<endl; char c; ifstream finn("out.txt"); (j=0; !finn.eof(); j++) { finn>>c; finn.getline(original,25); if (x==j) break; } finn.close(); return original; } if want use (and not use std::vector or std::string ) need change gamewindow...

hadoop - How to handle multiline record for inputsplit? -

i have text file of 100 tb , has multiline records. , not given each records takes how many lines. 1 records can of size 5 lines, other may of 6 lines may 4 lines. not sure line size may vary each record. so cannot use default textinputformat, have written own inputformat , custom record reader confusion : when splits happening, not sure if each split contain full record. part of record can go in split 1 , in split 2. wrong. so, can suggest how handle scenario guarantee full record goes in single inputsplit ? thanks in advance -je you need know if records delimited known sequence of characters. if know can set textinputformat.record.delimiter config parameter separate records. if records aren't character delimited, you'll need logic that, example, counts known number of fields (if there known number of fields) , presents record. makes things more complex, prone error , slow there's lot of text processing going on. try determining if records delimi...