Posts

Showing posts from August, 2014

java - Why cant we have wrapper class objects as constant? -

in java 7, given code: final integer i=9; final int x=5; switch(x){ case 1: case i://compilation error thrown here } what reason behind this? integer = 9; with i reference integer object , it's not valid type switch on in java. following valid variable types, can switch on convertible ints - int, byte,short,char enums string constants - support added in java 7 other these valid values, cannot switch on other object

linux - conditionally replacing number with word -

i using python script detect connected devices in local network every 2 minutes - saving output in file (i save last number of ip). this code: import os os.system('for ip in $(seq 1 10); ping -c 1 192.168.1.$ip>/dev/null; ' '[ $? -eq 0 ] && echo "$ip" || : ; ' 'done > /home/pi/desktop/network/logs/loglocal.txt') the output ist example: 1 2 4 7 my question if possible replace number 7 through word? if device 7 found programm writes "seven" not 7 in file. thanks help! the following script job: # note can use `{a..b}` instead of `seq` ip in {1..10} ; # no need execute command , check it's # return value. can in 1 line if ping -c 1 192.168.1.$ip > /dev/null ; # check `7` if [ "$ip" = "7" ] ; echo "seven" else if [ "$ip" = 5 ] ; echo "five" # ... , on else echo ...

environment variables - Specifically Getting the System TEMP Path in C# -

i using system.io.path.gettemppath() method retrieve temporary folder environment variables. however, finding return temp or tmp variable current user if exists otherwise return system temp or tmp variable. is there way system temp variable? i aware of several other questions on path.gettemppath() method answers referencing documentation msdn how method decides return. aware of behavior of method msdn , asking if there way ensure getting system temporary folder. perhaps looking environment.getenvironmentvariable method. this usage gives user's %temp% folder: environment.getenvironmentvariable("temp"); such c:\users\myusername\appdata\local\temp and gives system's %temp% folder: environment.getenvironmentvariable("temp", environmentvariabletarget.machine); such c:\windows\temp

text cleaning in R -

i have single column in r looks this: path column ag.1.4->ao.5.5->iv.9.12->ag.4.35 ao.11.234->iv.345.455.1.2->ag.9.531 i want transform into: path column ag->ao->iv->ag ao->iv->ag how can this? thank you here full dput data: structure(list(rank = c(10394749l, 36749879l), count = c(1l, 1l), percent = c(0.001011122, 0.001011122), path = c("ao.legacy payment.not_completed->ao.legacy payment.not_completed->ao.legacy payment.completed", "ao.legacy payment.not_completed->agent.payment.completed")), .names = c("rank", "count", "percent", "path"), class = "data.frame", row.names = c(na, -2l)) you use gsub match . , numbers following . ( \\.[0-9]+ ) , replace '' . df1$path.column <- gsub('\\.[0-9]+', '', df1$path.column) df1 # path.column #1 ag -> ao -> iv -> ag #2 ao -> iv -> ag update ...

How to create External Panels in jQuery mobile? -

i trying create multi page application , using jquery mobile, have couple of panels using jquery mobile: <div data-role="panel" id="left-panel" data-theme="b" data-display="overlay"></div> <div data-role="panel" id="right-panel" data-display="overlay" data-position="right" data-theme="b"></div> however, cumbersome add these panels every page create. need in using these panels in pages i'm create. in advance! this script worked me $(document).on("pagecreate", ".demo-page", function() { var panell = '<div data-role="panel" id="left-panel" data-position="left" data-display="reveal" data-theme="a"><ul data-role="listview" data-inset="true"><li><a href="index.html" data-transition="slide">home</a></li><l...

bioinformatics - Trim DNA sequence using R -

i have dna sequence files , many sequences start "cccatgcagacatagtg" or "ctccatgcagacatagtg" , have tag sequence "atgca". want remove "atgca" "cc" , "ctc". final product "gacatagtg". does know r function can that? tried trimlrpatterns in biostrings not work since trim end not within sequence. please let me know if have solution that. thanks. try this: # dummy dna mydna <- c("cccatgcagacatagtg","ctccatgcagacatagtg") # define tag tag <- "atgca" # remove character(s) before tag, including tag. gsub(paste0("^.*",tag),"",mydna) # output # [1] "gacatagtg" "gacatagtg"

jpa - how to bind/ unbind a Date type attribute to a DatePicker object -

i have following code: @fxml private datepicker birthday; //other code private final changelistener<person> personlistener = (value, oldvalue, newvalue) -> { //other code birthday.valueproperty().unbindbidirectional(oldvalue.getbirthday()); //other code }; birthday property of type java.time.localdate, , belongs class person. because use jpa, want not use javafx properties. above code fails compile. compiler's error message is: error: no suitable method found unbindbidirectional(localdate) birthdaypicker.valueproperty().unbindbidirectional(oldv.getbirthday()); method property.unbindbidirectional(property<localdate>) not applicable (argument mismatch; localdate cannot converted property<localdate>) method objectproperty.unbindbidirectional(property<localdate>) not applicable (argument mismatch; localdate cannot converted property<localdate>) how can solve problem? update: person class has followin code: @en...

jquery - CORS asyncronous ajax call with xhrFields is not working across all browsers (IE8) -

i'm making ajax call across cross domain url , fails in ie8 using below code.it fails in ie8 error object or property not defined, , gives response undefined. have set , $.support.cors = true; $.ajax({ async: false, cache: false, url: " http://test/price ", crossdomain: true, type: "post", datatype: "json", data: jsondata, xhrfields: { withcredentials: true }, success: function (response) { } error: function (xhr, exception) { } above code works in firefox , chrome browsers. make work in ie8, removed below part of code xhrfields: { withcredentials: true }, now works in ie8, ie8+ browsers f...

url rewriting - Rewrite URL of php page to be png -

i thinking of making tool own development similar placehold.it. have this. <img src="url.com/picture.php?id=51"/> to be <img src="url.com/51.png"/> any ideas? edit: though have used stack overflow answer questions , looks stuff up, first time asking question. bit crazy. apparently isn't detailed enough. thought less more , seemed make sense. anyway... wondering if can make php page behave image. able pass data php page, stuff variables, return content in form of image. example: this <img scr="url.com/picture.php?color=blue"/> could seen browser <img scr="url.com/blue.png"/> my guess needs done rewrite rule. have done little work in past making pretty urls (www.example.com/some/random/url vs example.com/somerandom.php?a=url) wasn't sure if changing type php png work. hopefully make sense now. you can using .htaccess .here rewriterule. rewriteengine on rewriterule ^([0...

html - Simple indication that file is uploading after pressing Submit -

i'm looking simple way show file being uploaded after submit button pressed. files can 50 mb in size , users can think browser has frozen because takes long time. i'm not looking animated, word loading... appears next (or in place of) submit button. onclick might i'm not sure if interfere submit process. display "spinning gif" right next submit button made visible on onsubmit event. redirect form new page or reload current page when form done uploading. here's simple example: <script> $(".spinner").hide(); function loadspinner() { $(".spinner").show(); //do validations //redirect } </script> the form this: < form onsubmit="loadspinner()"> . . . <div> <input id="submitbutton" type="submit" /> <span class="spinner"><img src="images/loading.gif" ...

javascript - The WordPress Ajax request returns 0 -

i can't figure out why nothing returned real beginner in ajax .. read lot of topics using ajax in woprdpress examples super advanced me here js code combo_checkout_irange.js jquery(document).ready(function() { jquery('#loader').hide(); jquery('#check-out-date').hide(); jquery('#check-in-date').change(function(){ jquery('#check-out-date').fadeout(); jquery('#loader').show(); jquery.ajax({ type: 'post', url:myajax.ajaxurl, data: { action : 'my_ajax_handler', parent_id: jquery("#check-in-date").val() }, success: function(data){ alert(data); jquery('#loader').hide(); jquery('#check-out-date').show(); jquery('#check-out-date').append(data); }}); return false; }); ...

user interface - Multiple GUIs not launching from AutoHotKey -

i trying automate process of generating template request medical exams our outsourced provider. there 6 guis in script: special instructions list upcoming appointments contact information power of attorney listed? electronic or hard-copy file? authorization number , effective date range each gui asks user pick 1 choice or other, , based on answers, pastes block of text in template. the first gui special instructions runs fine. instead of proceeding second gui, script ends. used scite4 editor try see what's going on, , after first gui runs, skips end. here's code first 2 guis , end: ;special instructions gui ;gui, add, text, w400 h40, special instructions? gui, add, radio, vspecinstrs checked, yes gui, add, radio, , no gui, add, edit, w370 r4 vlistofinstrs, gui, add, button, vbuttonnext1 gnextselected1, next gui, add, button, xp+60 vbuttoncancel1 gcancelselected1, cancel gui, show, w400 h150, special instructions? return ; nextselected1: gui, submit, ; ...

javascript - How do I use the dojo constraints object to customize the text input field for an IP address in my dojo TextBox or NumberTextBox -

Image
how use constraints object customize text input field ip address in dojo textbox or numbertextbox. or there object should using user has type ip address correctly. i want create input field users input ip address requires this: pattern:'min:1,max255.min:0,max255.min:0,max255.min:0,max255' i believe current problem i'm trying use numbertextbox , has constraints overriding constraints. i know constraint options have available documentation on dojo constraints found deprecated , link replaced pointed datetimebox. :| here snippet of code: cellwidget.outproactfeedsdestaddr.set('constraints', {pattern:'min:1,max255.min:0,max255.min:0,max255.min:0,max255'}); while ip addresses numeric in sense, numbertextbox intended typical single numeric values, that's not option here. you've potentially got couple of choices: use validationtextbox , give appropriate regexp (note dijit expects string property, , applies ^ , $ around itself...

html - Site scroll bar that appears when you refresh multiple times -

i have problem site ... http://reliancetrustgroup.com/ if refresh page several times you'll see once page appears scroll appears once without scrolling from can cause problem? .page-id-5 #content{ height:auto !important; } i tried adding code solve, unfortunately not work ... is. can me solve problem? there scrollbar every time in latest chrome on osx me. you can avoid adding height: 100vh; main page container. however, know vh isn't quite supported in every browser yet. also, if this, you'll want space of elements based on percentages or vh units if monitor shorter, of elements fit. you'll want remove overflow: hidden; because may cause information hidden.

SQL Server - With Clause -

i creating query containing clause. so: with temp (pin) ( select t1.field_val table1 t1 t1.primkey = '9549' , t1.field2 = 10 ) select wfu.ss_peid, wfu2.ifas_userid temp temp inner join table2 t2 on temp.pin = t2.pin inner join table3 t3 on t2.id = t3.id left outer join table3b t3b on t3.id = t3b.id t3.asstid not null or wfu.asstid != '' in select statement in clause above, have t1.primkey hard coded '9549'. when change use parameter passed in @var so: with temp (pin) ( select t1.field_val table1 t1 t1.primkey = @var , t1.field2 = 10 ) select wfu.ss_peid, wfu2.ifas_userid temp temp inner join table2 t2 on temp.pin = t2.pin inner join table3 t3 on t2.id = t3.id left outer join table3b t3b on t3.id = t3b.id t3.asstid not null or wfu.asstid != '' it no longer works. why wouldn't select statement in clause work parameter variable in it? ... edit: :) apologies. in head seemed understood not happening....

ios - How to get Source URL from -(bool) application openURL? -

i have app opens pdf http url using -(bool)application:openurl: . go safari, open pdf in safari, , use [open in "myapp"] i want save url, when user closes app , opens again, pdf can opened again. -(bool)application:(uiapplication *)application openurl:(nsurl *)url { nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; // store [defaults setobject:[url absolutestring] forkey:@"lastpdfurl"]; [defaults synchronize]; <...etc...> return yes; } when load key lastpdfurl , instead of getting: (nsstring*) @"http://www.somewebsite.com/lastpdf.pdf" i local url after pdf imported app, like: (nsstring*) @"file:///<..dir..>/developer/coresimulator/devices/<..deviceid..>/ data/containers/data/application/<..appid..>/documents/inbox/lastpdf.pdf" so question is: is possible in file importing interaction source url importing performed? i.e. " http://www.somewebsite.com/lastpdf.pd...

r - This seems to work fine but keep having "command #Bugs:gen.inits cannot be executed (is greyed out)" -

i doing simple regression model winbugs via r2winbugs. results appear ok, winbugs keeps showing line , don't know why: command #bugs:gen.inits cannot executed (is greyed out) does have idea? thanks! the r code calling winbugs: # prepare data ni = 12 #nb of tagging year prl <- c(0.13,0.23,0.28,0.22,0.29,0.25,0.31,0.32,0.32,0.40,0.33,0.35) #proportion of tag lost input.tlr <- list(ni=ni,prl=prl) # generates intial values 2 chains nbchains = 2 init1 <- list(beta1=runif(1,-1,1),beta2=runif(1,-1,1),taug=rgamma(1,1,1)) init2 <- list(beta1=runif(1,-1,1),beta2=runif(1,-1,1),taug=rgamma(1,1,1)) inits <- list(init1,init2) # call winbugs parameters <- c("gamma","beta1","beta2","taug") out.tlr <- bugs(data=input.tlr, inits=inits, parameters=parameters, "tlr.txt", n.chains=2, n.iter=20000, n.burnin=5000,n.thin=1,debug=true) the winbugs code is: model { ###### tag lost rate model ###### (i in 1:ni) { prl[i...

c# - ViewModel child properties coming back as NULL on POST -

i'm new mvc , have encountered problem not understand. seems common situation it's not working me. i have 2 models , 1 viewmodel public class event { public int eventid { get; set; } public string subject { get; set; } public string description { public string address1 { get; set; } public string city { get; set; } public string state { get; set; } public string zip { get; set; } public string phone { get; set; } public datetime startdate { get; set; } public datetime enddate { get; set; } public string email { get; set; } public string description { get; set; } public bool recurring { get; set; } } public class reoccur { public int reoccuranceid { get; set; } public int duration { get; set; } public string frequency { get; set; } public string nthfrequency { get; set; } public string nthday { get; set; } public bool weekend { get; set; } public int nthoccurrences { get; set; } pub...

c++ - Infinite loop, removing duplicates from a stack? -

i infinite loop when printing new stack that's returned removeduplicates function, don't know what's causing it? other functions working perfectly. functions should keeps first occurrence if element duplicated. code: class stack { node *head; public: stack() { head = null; }; ~stack() { while (head) { node * temp = head; head = head->next; delete temp; } } void push(int data); int pop(); bool isempty(); void print(); stack removeduplicates(); }; void stack::push(int data) { node *temp = new node(data); temp->next = head; head = temp; } int stack::pop() { if (head != null ) { int x = head->data; node *temp = head; head = head->next; delete temp; return x; } else { cout << "the stack empty!"; return -1; } } bool s...

google analytics - Extracting query parameter value with POSIX regex -

tinkering around google analytics advanced filters. i know if request uri /?w=value1&x=value2&y=value3 , want extract value of x, regex x=([^&]*) my question why work? google support says following: [] = match 1 item in list ^ = match beginning of field * = match 0 or more of previous item how come give me value of query parameter x in x=([^&]*) any appreciated. thanks! the ^ in [^&]* means character not in list. ^ character acts 'not' when in brackets [] , beginning of string when not in brackets. putting together, x=([^&]*) after x= stop when hits next & .

jquery - How do I add a fade effect to this slideshow? -

i have slideshow here love give fade effect. not sure how it, not familiar javascript, know how copy , paste code ( make mistakes) page here: http://lazlo.us/bw/getimages.html i using php script pull images directory create slideshow. the javascript creates slideshow straightforward ( found on the net): var curimg = 0; function rotateimages() { document.getelementbyid("slideshow").setattribute("src", "" + galleryarray[curimg]); curimg = (curimg<galleryarray.length - 1)? curimg + 1 : 0; } window.onload = function() { setinterval("rotateimages()", 3500); } anyone me put fade effect it? lazlo instead of updating src of image, you'll need insert second element, , fade in. here's simple fiddle threw uses css handle transitions on opacity . basically, will: create image element insert before existing image element wait 100ms, , set opacity of old image 0 an image preloader helpful kick off an...

etl - SSIS Name based mapping for flat file import -

this question has answer here: ssis task inconsistent column count import? 2 answers a vendor of ours cannot guarantee flat files column order. how flat file connection handle when columns rearranged? the flat file connection not rearrange columns if appear in different order. have load data headers , reorder them dynamically, either using ssis or database.

Video encoding in ios -

so know there existing questions on stackoverflow streaming live video on ios devices server i'm going ask encoding portion. i'm bit lost on software encoding services available encode raw (live) video footage ios device send server aws . after using avcam capture videos, use ffmpeg encode raw video on fly , send encoded video server using http or rtsp ? or have concepts wrong? the video encoded when stored on ios device - encoding way of digitally representing video, in cases capturing values represent color , brightness etc of each pixel in each frame of video. most encoding includes techniques compress video conserve space. these techniques include using of frames reference following frames (and in come cases preceding frames). example first frame might reference frame (commonly called frame) , following 5 frames, instead of storing pixel data, pixels have changes stored. easy understand how might save lot of storage, particularly scenes there little move...

php - Check if website is in the blocked list -

am creating class handles redirection exterior locations. created method called isblocked returns boolean result. function works follows: it loops through $_blocked variable , compares input string found, it returns true otherwise false. bellow actual incase explanation not enough. public static function isblocked($location) { for($i = 0; $i < sizeof(self::$_blocked); $i++) { if(self::$_blocked[$i] === $location) { return true; } else { return false; } } } this works perfectly, problem comes when example, lets "google.com" on list , input "www.google.com", return false. obvious since using identical operator === . question following: there function in php work urls apart url_encode & url_decode ? can create regular expression let me know if there other approach this. thanks in advance. it occurs me match backwards, since it's many one...

opengl es - Depth Map is white - webgl -

Image
i using shaders draw depth map in image. here shader code : vertex shader: void main(void) { gl_pointsize = apointsize; gl_position = upmatrix * umvmatrix * vec4(avertexposition, 1.0); vcolor = avertexcolor; visdepth = aisdepth; vhastexture = ahastexture; if (ahastexture > 0.5) vtexturecoord = atexturecoord; } fragement shader: void main(void) { if (vhastexture < 0.5 && visdepth < 0.5) gl_fragcolor = vcolor; if (vhastexture > 0.5) { vec4 texturecolor = texture2d(utexture, vec2(vtexturecoord.s, vtexturecoord.t)); gl_fragcolor = vec4(texturecolor.rgb, texturecolor.a * utexturealpha); } if (visdepth > 0.5){ float ndcdepth = (2.0 * gl_fragcoord.z - gl_depthrange.near - gl_depthrange.far) / (gl_depthrange.far - gl_depthrange.near); float clipdepth = ndcdepth /gl_fragc...

c - Trying to understand POSIX Threads -

i trying grasp on use of posix threads , created simple program increments global variable 10. on runs way through fine, other seg faults in random spots. while type of issue seems regular thing threads, cannot understand why happens in such simple example. current thought maybe parent ending before due not joining threads, if try join seg fault on first thread... join statement left in commented out. join used in correct syntax? not preforming join leading seg fault? #include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <errno.h> #include <string.h> #define numphilo 5 thread_t threads[numphilo]; //array of threads pthread_mutex_t mutex; // initialize mutex int x = 5; //for test int y = 10; int philofunct(){ pthread_mutex_lock (&mutex); x = x+y; pthread_mutex_unlock (&mutex); printf("philo fucntion x = %d\n",x); return x; } int main(){ pthread_mutex_init(&mutex...

java - How to write loop for webpage counter -

there's element on webpage thats counter looks this: <span id="counter_index_page_325846">00:00:51</span> how write loop element every time counter gets down 00:00:01 , keeps doing assuming goes minute every action performed. this have far: while (counter_index_page_325846.value < 00:00:01 ) { //perform action } you must way while (counter_index_page_325846.value > 00:00:01) counter_index_page_325846 = // assign new value use greate (>), otherwise while loop won't work

Does Google charge my app that uses them as an identity provider for openID connect? -

i've migrated app use openid connect signing in google, , made google developers account , app client_id , client_secret. if i'm using app allow users sign in google, , not accessing of google info except email, charged google? thanks in advance there no charges associated use of google's openid connect apis (note there no quota associated api).

java - How do I download a file that is embedded in a web site? -

at moment can download files has type of format: https://jdbc.postgresql.org/download/postgresql-8.1-415.jdbc2.jar but how download files aren't visible in url file? e.g skype's url path: http://www.skype.com/sv/download-skype/skype-for-mac/downloading/ as guys can see, there no way can download file using filepath.substring(filepath.lastindexof("/") + 1); so there other ways this? did find file embedded in page using firebug http://www.skype.com/go/getskype-macosx.dmg my question is, can programmatically go through page , access file? here code works fine downloading public static void filedownload(string urlfile) throws ioexception { url url = new url(urlfile); httpurlconnection httpurlconnection = (httpurlconnection) url.openconnection(); int responsecode = httpurlconnection.getresponsecode(); if (responsecode == httpurlconnection.http_ok) { string filename = ""; string disposition = htt...

javascript - Sort through a model(array) in Backbone? -

i'm learning backbone forgive me if title incorrect. i want sort through model (is model array?, have got wrong?) can't it. in regular js can use function sort through array , know works: getobjects: function(obj, key, val) { var objects = []; (var in obj) { if (!obj.hasownproperty(i)) continue; if (typeof obj[i] == 'object') { objects = objects.concat(getobjects(obj[i], key, val)); } else if (i == key && obj[key] == val) { objects.push(obj); } } return objects; } but don't know should put in backbone. tried putting in view, error saying "undefined not function" getobjects. window.winelistview = backbone.view.extend({ initialize: function () { this.render(); }, //sort through json when getting different priority tasks getobjects: function(obj, key, val) { var objects = []; (var in obj) { if (!obj.hasownproperty(i)) continue; if (typeof obj[i] == 'object') ...

sql - Counting distinct rows using recursive cte over non-distinct index -

given following schema: create table identifiers ( id text primary key ); create table days ( day date primary key ); create table data ( id text references identifiers , day date references days , values numeric[] ); create index on data (id, day); what best way count distinct days between 2 timestamps? i've tried following 2 methods: explain analyze select count(distinct day) data day between '2010-01-01' , '2011-01-01'; query plan ---------------------------------------------------------------------------------------------------------------------------------------------------------- aggregate (cost=200331.32..200331.33 rows=1 width=4) (actual time=1647.574..1647.575 rows=1 loops=1) -> index scan using data_day_sid_idx on data (cost=0.56..196942.12 rows=1355678 width=4) (actual time=0.34...

twig - failure with find() function using PHP with Silex -

here failure message in terminal running 'phpunit tests': 1) stylisttest::test_find null not match expected type "object". /users/evanbutler/desktop/hairsalonapp/tests/stylisttest.php:163 here's test method: function test_find() { //arrange $name = "stylist jane"; $id = 1; $name2 = "stylist bob"; $id2 = 2; $test_stylist = new stylist($name, $id); $test_stylist->save(); $test_stylist2 = new stylist($name2, $id2); $test_stylist2->save(); //act $result = stylist::find($test_stylist->getid()); //assert $this->assertequals($test_stylist, $result); } and here's method: static function find($search_id) { $found_stylist = null; $stylists = stylist::getall(); foreach($stylists $stylist) { $stylist_id = $stylist->getid(); if ($stylist_id == $search_id) { $found_styist = $stylist; } } return $found_stylist; } her...

linux - Perform substitution in a substitution file with autotools -

i have tried around , cannot seem find correct information. substitute @srcdir@ in file used ac_subst_file. possible? ac_output doesn't allow 2 substitution steps, don't think that's possible. however, this: my_substitution_file: srcdir %srcdir% configure.ac: ac_prog_sed file=my_substitution_file ac_subst_file([file]) ac_config_files([my_file.in]) ac_output makefile.am: my_file: my_file.in makefile $(am_v_gen)$(sed) -e s,%srcdir%,$(srcdir), <$< >$@ my_file.in.in: here my_substitution_file has say: @file@ all together, should result in file called my_file contents: here my_substitution_file has say: srcdir /path/to/your/source

Linux File Read and Write - C++ [Updated] -

i supposed create program reads source.txt's first 100 characters, write them in destination1.txt, , replace "2" "s" , write them destination2.txt. below code #include <sys/types.h> #include <unistd.h> #include <sys/stat.h> #include <fcntl.h> #include <cstdio> #include <iostream> using namespace std; int main(int argc, const char* argv[]){ argv[0] = "source.txt"; argv[1] = "destination1.txt"; argv[2] = "destination2.txt"; int count=100; char buff[125]; int fid1 = open(argv[0],o_rdwr); read(fid1,buff,count); close(fid1); int fid2 = open(argv[1],o_rdwr); write(fid2,buff,count); close(fid2); //how change characters? return 0; } thanks guys able copying. how perform character replacement? if it's fstream know how loop. i'm supposed use linux system calls. define array out_buf , copy buff out_buf character character, rep...

Arity-generic programming in Agda -

how write arity-generic functions in agda? possible write dependent , universe polymorphic arity-generic functions? i'll take n-ary composition function example. the simplest version open import data.vec.n-ary comp : ∀ n {α β γ} {x : set α} {y : set β} {z : set γ} -> (y -> z) -> n-ary n x y -> n-ary n x z comp 0 g y = {!!} comp (suc n) g f = {!!} here how n-ary defined in data.vec.n-ary module: n-ary : ∀ {ℓ₁ ℓ₂} (n : ℕ) → set ℓ₁ → set ℓ₂ → set (n-ary-level ℓ₁ ℓ₂ n) n-ary 0 b = b n-ary (suc n) b = → n-ary n b i.e. comp receives number n , function g : y -> z , function f , has arity n , resulting type y . in comp 0 g y = {!!} case have goal : z y : y g : y -> z hence hole can filled g y . in comp (suc n) g f = {!!} case, n-ary (suc n) x y reduces x -> n-ary n x y , n-ary (suc n) x z reduces x -> n-ary n x z . have goal : x -> n-ary n x z f : x -> n-ary n x y g : y -> z c-c c-r re...