Posts

Showing posts from February, 2013

linux - Jenkins builds failing with a missing file error even though the file is there -

i have jenkins server running , have couple of builds working. however, morning when tried add 1 kept failing error - [test.gov] $ /bin/sh -xe /tmp/hudson7055290339554583413.sh + ./opt/jenkins/build.sh /tmp/hudson7055290339554583413.sh: line 2: /opt/jenkins/build.sh: no such file or directory build step 'execute shell' marked build failure the shell script @ path , has name. if make ./opt/jenkins/build.sh still fails same error. command have in "execute shell" section in "command" text box /opt/jenkins/build.sh . tried ./opt/jenkins/build.sh well. the script on centos system btw. this script trying run - echo "git pull" cd /var/www/path/for/my_website/docroot/ git checkout master git pull echo "change ownership apache" chown -r apache:apache * echo "running drush commands" drush updb -y #drush fra -y drush cc often "build.sh: no such file or directory" error means shebang line within buil

There is an error "unfortunately, my application has stopped" when i run my program in android studio -

i got error when run program in android studio. message error below : 10-22 19:13:54.831 3478-3478/com.example.natasya.myapplication e/androidruntime: fatal exception: main 10-22 19:13:54.831 3478-3478/com.example.natasya.myapplication e/androidruntime: process: com.example.natasya.myapplication, pid: 3478 10-22 19:13:54.831 3478-3478/com.example.natasya.myapplication e/androidruntime: java.lang.runtimeexception: unable start activity componentinfo{com.example.natasya.myapplication/com.example.natasya.myapplication.mainactivity}: java.lang.illegalargumentexception: invalid provider: null 10-22 19:13:54.831 3478-3478/com.example.natasya.myapplication e/androidruntime: @ android.app.activitythread.performlaunchactivity(activitythread.java:2416) 10-22 19:13:54.831 3478-3478/com.example.natasya.myapplication e/androidruntime: @ android.app.activitythread.handlelaunchactivity(activitythread.java:2476) 10-22 19:13:54.831 3478-3478/com.example.natasya.myapplication e/androidrunt

jquery - Bootstrap carousel not working on business catalyst hosted site -

i used same code below in dreamweaver. in local hosted environment, works fine. however, if put same code in business catalyst server, cannot show images. <!doctype html> <html> <head> <meta charset="utf-8" /> <meta http-equiv="x-ua-compatible" content="ie=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <!-- latest compiled , minified css --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"> <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> <script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>

Android TextView Padding with a drawable background in xml -

Image
so... a known android issue setting drawable background textview in conjunction setting padding (e.g. paddingleft ) work if background set before padding . far (and annoying). but, if want via .xml (and not programmatically)? :( ideas? here want: but no matter paddingleft set, nothing changes. i'm positive should work, maybe it's layout bug? here (very simplified) layout: <relativelayout android:layout_width="match_parent" android:layout_height="match_parent" > <button android:id="@+id/call" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparenttop="true" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:background="@drawable/call_btn" android:paddingleft="@dimen/desired_left_padding" android:paddingstart="@dimen/desir

Calling Python Functions from Java (Without Jython, because it is too slow.) -

i need able call python functions java, , return of functions, should primitives only. i don't need access java objects in python or other stuff that. but, of all, need speed. need able load script @ start of application , call functions @ different time-intervals, can tiny (30-40 times per second). that's main-reason why don't think jython work me: has kinds of stuff don't need, , incredibly slow. so, constraints/requirements have: needs fast i need call python functions , result the script should loaded once do guys know way call python functions in pre-loaded script (so script not have loaded again , again each function call)? (ps: not think duplicate searched quite lot , links found did not answer question (for example calling python in java? ) ) you write jni code embed cpython interpreter. you write python program run daemon (or web service or whatever) , connect via sort of networking. intentionally vague here since such broad question

html - Responsive Adsense ad unit won't display at 320x50 px -

i have responsive adsense ad unit serve footer on responsive web site. using media queries, described in adsense documentation, in order set height/width @ different screen widths. here's css: <style> @media (min-width: 320px) { .adslot-desktop { width: 320px; height: 50px; display: inline-block; } } @media (min-width: 500px) { .adslot-desktop { width: 468px; height: 60px; display: inline-block; } } </style> and here's html: <ins class="adsbygoogle adslot-desktop" data-ad-client="xxxxx" data-ad-slot="xxxxxx" data-ad-format="auto"></ins> at screen widths on 500px, expected 468x60 ad. however, below 500px, i'm getting 320x100 ad. why not giving me 320x50 ad appear i'm specifying? i think you'll need remove data-ad-format , because data-ad-format smart sizing : we calculate required size dynamicall

How to passing vars to an Angular ui-modal template -

i tried out lot of, doesn't works. code runs not show vars "title" , "text" in modal. this code: // in controller: $confirm({title: "error", text: "test"}, { templateurl: "alertmodal") .then(function() { }); <!-- template --> <script type="text/ng-template" id="alertmodal"> <div class="modal-header"> <h3 class="modal-title">title: {{title}}</h3> </div> <div class="modal-body"> text: {{text}} </div> <div class="modal-footer"> <button class="btn btn-warning" type="button" data-ng-click="cancel()">cancel</button> </div> </script> the model triggered xml-request, want use service.

Is it possible to install Windows 10 IoT on Banana Pi? -

many devices/platforms supported microsoft. banana pi isn't listed here . specifications of banana pi (first generation in case) quite similar of raspbian pi: ╔═════╦═════════════════════════════╦════════════════════════════════╗ ║ ║ raspberry pi 2 b ║ banana pi (1) ║ ╠═════╬═════════════════════════════╬════════════════════════════════╣ ║ soc ║ broadcom bcm2836 ║ allwinner a20 ║ ║ cpu ║ arm cortex-a7 1ghz dualcore ║ arm cortex-a7 900 mhz quadcore ║ ║ gpu ║ broadcom videocore iv ║ mali400mp2 gpu ║ ║ ram ║ 1024 ddr2 ram ║ 1024 ddr3 ram ║ ║ lan ║ 10/100-mbit-ethernet ║ 10/100/1000-mbit/s-ethernet ║ ╚═════╩═════════════════════════════╩════════════════════════════════╝ source: http://jankarres.de/2015/03/raspberry-pi-2-performance-vergleich-und-benchmarks/ my question : is possible windows 10 iot running on banana pi (not theoretically)? a

C strcpy and strcat -

i have question strcpy , strcat. in program i'm trying make need year born fiscal code. fiscal code given char serial port, strcpy(temp, code[6]); strcat(temp, code[7]); yyyy = 1900 + (atoi(temp)); this came with: last 2 digits of year added 1900 (i know doesn't quite work people born in 2000). first digit copied full code temp variable using strcpy, add second digit use atoi , convert eveything integer; use strcat in way i've never seen before. doing right? no need strcpy / strcat (and not appropriate in context anyway). no need temporary string either. can this: yyyy = 1900 + (code[6] - '0') * 10 + (code[7] - '0'); this extracts 2 digit characters, converts each 1 integer in range 0..9, , calculates year these 2 values.

ios - '(_, _, _) -> Void' is not convertible to 'Result<Post> -> Void' -

in view controller have code: newpost!.save({ (post, error) in //error here. if let anerror = error { print("error calling post on /posts") print(anerror) return } guard let post = post else { print("error calling post on /posts: result nil") return } // success! print(post.description()) print(post.title) }) i don't quite understand result<whatever> syntax, result should alamofire 2, post class created, result<post> -> void altogether mean , should change it? update: func save(completionhandler: (result<post>) -> void) { let fields: [string: anyobject]? = self.tojson() if fields == nil { print("error: error converting newpost fields json") return } your completion handler definition , way have called different, try completion handler if want call way: func save(completi

PHP Regex preg_match Email Validation -

$email = 'john@business.com'; if(preg_match(\w+(@business.com)\z), $email){code goes here} i'm trying execute code in "code goes here" section of condition when $email contains email address ends in @business.com . i feel i'm perhaps misunderstanding how preg_match works, can't find information why if statement evaluating false. there many, many examples , other people having similar problems, solution problems doesn't seem highlight issues code. i working off example: http://php.net/manual/en/function.preg-match.php <?php // "i" after pattern delimiter indicates case-insensitive search if (preg_match("/php/i", "php web scripting language of choice.")) { echo "a match found."; } else { echo "a match not found."; } ?> no need use regex can use strstr function of php as if(strstr('xyz@business.com',"@") == "@business.com"){ // code

PHP , PDO , Foreign Key -

Image
i new php , doing project. question have: in above interface, have extracted category name , id 'category name' combo box category table. , after form, should enter 'category id' 'item table', because category id foreign key of item table this code have add require_once '../../config/config.php'; $query = 'select `category_id`, `category_name` `tbl_category`'; $tbl_category_category_id = $query; $item_name = $_post['item_name']; $price = $_post['price']; $tbl_distributor_distributor_id= $_post['tbl_distributor_distributor_id']; $item_lowlevel = $_post['item_lowlevel']; $status = $_post['status']; try { $sql = "insert `tbl_item`(`tbl_category_category_id`, `item_name`, `price`, `tbl_distributor_distributor_id`, `item_lowlevel`,`status`) values (:tbl_category_category_id, :item_name, :price, :tbl_distributor_distributor_id, :item_lowlevel ,:status)";

compare - Comparing two files using difflib in python -

i trying compare 2 files using difflib. after comparing want print "no changes" if no difference detected. if difference in lines. want print line. i tried this: with open("compare.txt") f, open("test.txt") g: flines = f.readlines() glines = g.readlines() d = difflib.differ() diff = d.compare(flines, glines) print("\n".join(diff)) it print contents of file if "no changes" detected. want print "no changes" if there no difference. check see if first character in each element has + or - @ start (marking line having changed): with open("compare.txt") f, open("test.txt") g: flines = f.readlines() glines = g.readlines() d = difflib.differ() diffs = [x x in d.compare(flines, glines) if x[0] in ('+', '-')] if diffs: # rows changes else: print('no changes&

cmd - ImageMagick Conversion from .ps to .png, run from python - invalid param -

i have been looking through similar posts , through imagemagick page, cannot seem find reason issue: note using windows machine. i have .ps image in folder , works when running command convert cmd: convert saved.ps newsaved.png however when try execute python script following code: args = ["convert","saved.ps newsave.png"] subprocess.popen(args) #or call(args) os.system("start newsave.png") the cmd window says newsave.png invalid parameter. (the error message being: invalid parameter - newsave.png in cmd window, closes instantly) having seperated comma in args has not helped. os.getcwd() returns current work directory well, know i'm in right dir. error happens when subprocess called. make each command-line argument separate element of args . also, use subprocess.call ensure convert function has completed before call os.system("start newsave.png") : args = ["convert", "saved.ps", "

command line arguments - get python argparser attributes into script namespace -

i used in python scripts: import sys my_int = int(sys.argv[1]) ...more commands... how can replicate exact functionality argparse module? need extract of variables parser? tedious. i don't want answer this: if __name__ == "__main__": parser = argumentparser() parser.add_argument("--my_int", type=int, dest="my_int") args = parser.parse_args() main(**vars(args)) because want able interrupt script in ipython , have variables still defined. locals().update(vars(args)) is answer

c - control a function pointer in the kernel -

if have controlled function pointer in kernel pointing somewhere want, let's make point own designed function evil in user land. err = writepage(page) //->writepage kernel function pointer pointing evil in userland there printf in evil , there kernel panic if kernel dereferences function pointer? since evil runs in kernel mode (correct me if i'm wrong), kernel not printf is. int evil() { printf("i don't think printf executed because evil executed kernel mode") } the kernel never sees " printf "; sees call different address, program doesn't call function name, sets registers containing parameters accordingly , calls function. that won't work, because address printf call points relative userland process' memory, , doesn't exist in kernel memory. you have realize processes run in virtual memory of own -- none of addresses used in program need make sense different process. so can't call function in use

php - I have this kind of an array. and want result like below arrays -

i have following array $result=array( [name] => array( [0] => xyz1 [1] => xyz2 ) [email] => array ( [0] => xyz1@gmail.com [1] => xyz2@gmail.com ) [phone] => array ( [0] => 23423423-1 [1] => 23423423-2 ) [address] => array ( [0] => xyz1 [1] => xyz2 )); and want $r1=array ( [name] => xyz1 [email] => xyz1@gmail.com [phone] => 23423423-1 [address] => xyz1 ); $r2=array ( [name] => xyz2 [email] => xyz2@gmail.com [phone] => 23423423-2 [address] => xyz2 ); assuming keys correspond each other indexes, i.e. 1st email value corresponds 1st name value etc, can loop through indexes , keys generate new array: foreach(array_keys($result['name']) $i) { $row = array(); foreach(array_keys($result) $key) { $row[$key] = $result[$key][$i]; } print_r($row); }

vim - Evil in dired/dired+ keymapping -

i'm looking way navigate in dired/dired+ , evil mode using 'h' 'j' 'k' 'l' in vim netrw. i've found lisp phrases , applied those don't work @ all. for instance, (eval-after-load 'dired '(progn ;; use standard dired bindings base (evil-make-overriding-map dired-mode-map 'normal t) (evil-define-key 'normal dired-mode-map "h" 'evil-backward-char "j" 'evil-next-line "k" 'evil-previous-line "l" 'evil-forward-char "r" 'dired-do-redisplay))) ; "l" emacs runs 'dired-do-kill-lines' if doesn't recognize configuration. give me configuration, please? what if press c-z until put in normal mode (vim mode) ? , can use keys navigate. use smart-mode-line see mode in (i don't recall shows default mode-line). you can choose enter dired mode in normal state: http://wikemacs.or

logging - What is the LoggingSession buffer size? -

i using loggingsession tracing in universal app. loggingsession uses in-memory circular buffer cache messages. size buffer? can/should 1 configure it? the max size of .etl file created via savetofileasync() seems 3kb. oberving directory in file explorer strangely shows .etl.tmp files size 260kb being created , deleted. loggingsession uses 4 buffers. buffer size either 64kb or 65kb, depending on version of windows. sizes not configurable. idea program continually logs info doing. if weird happens (i.e. unexpected exception) can save recent 256kb worth of logs , upload them. while raw buffers total 256kb or 260kb, if haven't logged events, they'll empty. loggingsession flush data disk, run raw data through compression, why final size small. bigger if there more data in buffers.

java - How to store iv, salt and cipher text? -

from on how achieve password based encryption clear need save salt, iv , cipher text in order decrypt later. from iv , salt can stored along cipher text i storing hex value in format datatypeconverter.printhexbinary(salt) + datatypeconverter.printhexbinary(iv) + datatypeconverter.printhexbinary(ciphertext); do need store values in binary format ? datatypeconverter.printbase64binary(salt) + datatypeconverter.printbase64binary(iv) + datatypeconverter.printbase64binary(ciphertext)); output indicates salt , iv ending awful livyaa/pzg4=fe4gtzucptrkqpuko+z1sa==4/gadioqypoazxr69i0wlc7yfn9/kogitzqpow2y3ms= will storing in hex format have effects of data loss ? will length of iv constant ? in case 32 characters (hexadecimal) or need store length of iv ? salt length fixed 8 bits (16 hexadecimal characters) (i using pbkdf2withhmacsha1 algorithm key generation , aes/cbc/pkcs5padding cipher) base64 encodes in chunks of 3 bytes 4 base64 chars . if number of byte

image - Photo uploads from my iOS app are being rotated -

i have ios app building. when upload portrait image server, , server resizes image, image rotated landscape. happens iphone uploads. uploading desktop app works fine. why happening, , how can correct it? @andew create 1 category of uiimage.. write code in uiimage+fixorientation.h file #import <uikit/uikit.h> @interface uiimage (fixorientation) - (uiimage *)fixorientation; @end and in #import "uiimage+fixorientation.h" file #import "uiimage+fixorientation.h" @implementation uiimage (fixorientation) - (uiimage *)fixorientation { // no-op if orientation correct if (self.imageorientation == uiimageorientationup) return self; // need calculate proper transformation make image upright. // in 2 steps: rotate if left/right/down, , flip if mirrored. cgaffinetransform transform = cgaffinetransformidentity; switch (self.imageorientation) { case uiimageorientationdown: case uiimageorientationdownmirrored:

javascript - How to load a script only for certain country in blogger? -

i have script want load country in blogger, how can that? i tried doing like <script> if (url contains .com) { <script src=""></script> } </script> but it's not working because nesting of script failing, first </script> tag closes outer <script> well. like this, <script> if (url.indexof(".com") > -1) { var script = document.createelement('script'); script.src = "you/script/url"; document.getelementsbytagname('head')[0].appendchild(script); } </script>

c# - How to reload a form -

i have looking solution still found nothing here code: private void form1_load(object sender, eventargs e) { richtextbox rtb = new richtextbox(); rtb.text = file.readalltext(@"c:\users\admin\desktop\myfile\customers.txt"); int = 0; foreach (string line in rtb.lines) { if (line == "--") { listviewitem item = new listviewitem(); item.text = rtb.lines[i + 1]; item.subitems.add(rtb.lines[i + 2]); item.subitems.add(rtb.lines[i + 3]); item.subitems.add(rtb.lines[i + 4]); listview1.items.add(item); } += 1; } } private void button1_click(object sender, eventargs e) { form2 pop = new form2(); pop.showdialog(); string name = pop.name; int age = int.parse(pop.age); string dob = pop.dateofbirth; string addr = pop.address; streamwriter write = new streamwriter(@"c:\users\admin\desktop\myfile\customers.txt"

java - program wont wait for the proper input -

this question has answer here: scanner skipping nextline() after using next(), nextint() or other nextfoo()? 14 answers i have slot machine program. program works doesnt asking if countinue playing. specific line of code " system.out.println("play again?"); ans =scan.nextline();" package project3_16; import java.util.*; public class project3_16 { public static void main(string[] args) { scanner scan = new scanner(system.in); int money=0,bet=0,returnbet,hold=0,hold1=0,hold2=0; string ans=("yes"),slota,slotb,slotc; int again=0; string[] slot1 = {"۞","☯","☠","♕","∎","☢","♨","♣","Ω","★"}; while(ans.equalsignorecase("yes")){ system.out.println("would play slot machine?"); ans= scan.nextline();

c# - Read matrix elements in row wise -

i writing c# program matrix.when enter matrix inputs console, each element coming in separate row.but, want read row elements in single line. this code console.writeline("enter matrix"); int n= convert.toint32(console.readline()); int[ , ] matrix=new int[n,n]; for(int i=0; i<n; i++){ for(int j=0; j<n; j++){ matrix[i,j]=convert.toint32(console.readline()); // console.write("\t"); } } present getting like 1 2 3 4 but, want 1 2 3 4 help me. if want read 1 row in 1 line, can ask user enter space-separated values 1 2 , 3 4 , read this console.writeline("enter matrix size"); int n = convert.toint32(console.readline()); //add size , other validation if required int[,] matrix = new int[n, n]; console.writeline("enter values separated space."); (int = 0; < n; i++) {

linux - How do I update kernel-utils? -

brace yourself, i'm windows admin messing centos 6 server. let's start saying know little linux. i'm trying load rmmagent, gfi/maxfocus's agent. it's failing dependency check on kernel-utils , unzip. error: failed dependencies: kernel-utils needed rmmagent-1.0.2.centos6-1.2.x86_64 unzip needed rmmagent-1.0.2.centos6-1.2.x86_64 i googled myself death, think don't know enough linux make go. can educate me or point me right place learn how this? thanks! -jeff ps: got unzip installed without issue. we had same issue. spoke logicnow support , give solution: wget -c ftp://rpmfind.net/linux/mandriva/official/9.1/i586/mandrake/rpms/ksymoops-2.4.8-1mdk.i586.rpm yum install ksymoops-2.4.8-1mdk.i586.rpm

android - RecyclerView Recycled ViewHolder Image View wrong size -

Image
i have recycler view different view holders. a couple of view holders have image views pass glide display images. the problem is, when recycler view starts recycling views, imageview width/height of recycled view display image incorrectly. here imageview: <imageview android:id="@+id/image" android:layout_margintop="@dimen/feed_item_margin" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"/> this passed glide glide.with(itemview.getcontext()) .load(uri.parse(mediautils .getmedia(feedcontent).getmediaurl())) .placeholder(r.drawable.placeholder) .diskcachestrategy(diskcachestrategy.source) .crossfade().into(image); this works until recyclerview starts recycling first image in recyclerview looks how it's meant look. however, when scroll away item , scroll looks this: so image has become distorted , not not full

javascript - Table is not forming correctly in AngularJS -

Image
edit 1 - plnkr demonstrate problem - http://plnkr.co/edit/qqn2k3jtsnopxs9vi7ck?p=preview ---------------- original code , problem ---------------- i using angular datatable generate table view. my simple controller code follows - function tabletestctrl ($scope, dtoptionsbuilder, dtcolumnbuilder, localstorageservice) { console.log('from table'); var tbdata = localstorageservice.get('tabledata') || {}; var dd = new array(); dd = [{"name": "tiger nixon", "age": "61"},{"name": "garrett winters","age": "63"}]; //$scope.dtoptions = dtoptionsbuilder.fromsource(dd); $scope.dtoptions = dd; console.log($scope.dtoptions); $scope.dtcolumns = [ dtcolumnbuilder.newcolumn('name').withtitle('name'), dtcolumnbuilder.newcolumn('age').withtitle('age') ]; } my view co

iOS application hangs when running UI Automation instrument from the command line after a while? -

mac mini , iphone 5s when running uiatutomation command line instruments -w <uuid> -t /applications/xcode.app/contents/applications/instruments.app/contents/plugins/automationinstrument.xrplugin/contents/resources/automation.tracetemplate app_path -e uiascript javascripts_path -e uiaresultspath ~/ it starts ok; but time later (about half hour); application stucks,the output command line print ok; i can't tap anywhere continue,only kill instruments process can solve problem. but run same command in ios simulator,is ok run end;

sms - Can you send rich text messages via Twilio? -

i trying send rich text message via twilio. able send regular sms messages, want include hyperlink in body of text. i tried twilio mediaurl include rtf file, didn't work. including html in body of message doesn't work sends in plain text. i'm posting via curl twilio endpoints, i'd prefer not have php or other language achieve this. want send raw data twilio , receive rich text message back, if it's possible. twilio developer evangelist here. using twilio can send mms messages numbers in , canada. when pass mediaurl file needs hosted somewhere publicly on web , included within message. you can pass files of of mime types listed here , though when sending rtf result depend on how receiving device supports rtf files. if want include link, i'd recommend shortening url (using bit.ly or similar) , sending part of text. smart phones auto link url. built in sms apps on phones don't support markup of sort, why attempt html showed raw markup.

excel - Write text with overline -

Image
i know there formula can use , execute make text overlined, looks strange when click on text. using equation tools - accent , overbar works, limited on font , need use font, not cambria math. easier way can generated code behind. does knows how write text overline in excel? consider: sub helloworld() dim s string, s2 string s = "helloworld" = 1 len(s) s2 = s2 & mid(s, i, 1) & chrw(773) next activecell .font.name = "arial ms unicode" .value = s2 end end sub note have picked commonly available font.

Java ArrayBlockingQueue for implementing muliple producers and multiple consumer -

say in system have multiple producer threads , multiple consumer threads , planning use arrayblockingqueue shared resources. see implementation of arrayblockingqueue when insert() call notempty.signal instead of notempty.signalall. therefore, wonder wake consumer threads waiting elements, or wake 1 consumer thread? if wakes 1 consumer thread, can use implement multiple consumer thread in app?

c - MPI Segmentation fault (signal 11) -

i have been trying more 2 days see mistakes have done couldn't find anything. keep getting following error: = bad termination of 1 of application processes = exit code: 139 = cleaning remaining processes = can ignore below cleanup messages your application terminated exit string: segmentation fault (signal 11) typically refers problem application. please see faq page debugging suggestions make: *** [run] error 139 so problem in mpi_bcast , in function have mpi_gather . can me figure out what's wrong? when compile code type following: /usr/bin/mpicc -i/usr/include -l/usr/lib z.main.c z.mainmr.c z.mainwr.c -o 1dcode -g -lm for run: usr/bin/mpirun -np 2 ./1dcode dat.txt o.out.txt for example code includes function: #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <math.h> #include <string.h> #include "functions.h" #include <mpi.h> /*...................z.

javascript - Play audio of wav file with increasing file size -

i play audio via javascript in following way: this.audio = new audio(); this.audio.src = "path/to/audio.wav"; this.audio.play(); the file audio.wav on server larger time , audio keep playing without interruptions. however, stop playing once reached point of initial file size. what can make play seamlessly? i pretty sure depends lot on server configuration. wave format (in pretty of flavors, including microsoft , riff) has field data size on top of data block. read audio element if preload attribute set blank, auto or metadata thus, web browser making request such file might request many bytes , close connection. there's nothing in the api description says it'll read until actual end of file met. one thing comes mind, though, registering on "end" event. then, according this answer , should able start playing again, seeking position you've ended on. server should start streaming data position need. if doesn't work directly

c# - Understanding WPF - store Data in Model or ViewModel -

i unsure store data in wpf application. there 2 principles might collide. please clear up? principle 1: data should stored in model. follows, example observablecollection<string> articles should stored in model. property in viewmodel make available view. principle 2: states relying on view should stored in viewmodel. means string _selectedarticle variable corresponding property string selectedarticle should stored in viewmodel. so far, i've put methods or values don't affect view model, because (maybe too) followed principle 2. i'm not sure if right approach. should keep data in model , in viewmodel or there place store data? the simple answer be: data should stored belongs. the model should contain data - may contain data got external services, user input, data access layer , other. viewmodel should wrap part of data, wich presented user, proper wrappres provide ability view , change data - public properties, observablecollections, et

regex - How to cut html tag from very large multiline text file with content with use perl, sed or awk? -

i want transform text (remove <math>.*?</math> ) sed, awk or perl: {| |- | colspan="2"| : <math> [\underbrace{\color{red}4,2}_{4 > 2},5,1,7] \rightarrow [2,\underbrace{\color{olivegreen}4,5}_{4 < 5},1,7] \rightarrow [2,4,\underbrace{\color{red}5,1}_{5 > 1},7] \rightarrow [2,4,1,\underbrace{\color{olivegreen}5,7}_{5 < 7}] </math> |- | : <math> [\underbrace{\color{olivegreen}2,4}_{2 < 4},1,5,{\color{blue}7}] \rightarrow [2,\underbrace{\color{red}4,1}_{4 > 1},5,{\color{blue}7}] \rightarrow [2,1,\underbrace{\color{olivegreen}4,5}_{4 < 5},{\color{blue}7}] </math> : <math> [\underbrace{\color{red}2,1}_{2 > 1},4,{\color{blue}5},{\color{blue}7}] \rightarrow [1,\underbrace{\color{olivegreen}2,4}_{2 < 4},{\color{blue}5},{\color{blue}7}] </math> : <math> [\underbrace{\color{olivegreen}1,2}_{1 < 2},{\color{blue}4},{\color{blue}5},{\color{blue}7}] </math> |} into such text (please forgive me

ios - Swift Generics Inheritance -

i'm trying create utils make http request. want use : var callback = callback<loginresultbean>(onsuccess: { (data) -> () in print("true"); }) { (error) -> () in print("false"); } var handler = connectionhandler<loginresultbean>(url : "https://.....", callback : callback); loginbeanresult can change other model want retrieve server. but doesn't compile cause of error : 'connectionhandler' requires 'loginresultbean' inherit 'basemodel' but loginbeanresult inherit basemodel don't understand error. here class code : //basemodel.swift import objectmapper import foundation class basemodel : nsobject, mappable { required init?(_ map: map) { } func mapping(map: map) { } } . //loginbeanresult.swift import objectmapper import foundation class loginresultbean : basemodel { var jeton : string?; var etat : string?; va