Posts

Scheme problem (using a function as a parameter) -

i'm scheme newbie , trying make sense of homework. i've function made earlier called duplicate , , looks this: ( define ( duplicate lis ) (if (null? lis) '()) ((cons (car lis) (cons (car lis) (duplicate (cdr lis)))) )) a typical i/o i: (duplicate '(1 2 3 4)) o: (1 1 2 2 3 3 4 4), basicly duplicates in list. moving on: i'm supposed make function that's called comp . it's supposed built this: (define (comp f g) (lambda (x) (f (g (x)))) where input '(1 2 3 4) , return (1 1 4 4 9 9 16 16) so f = duplicate , g = lambda . know lambda should this: (lambda (x) (* x x)) but here's problem starts, i've spent several hours on this, , can see not made progress. any appreciated. best regards. use map : > (map (lambda (x) (* x x)) (duplicate '(1 2 3 4))) => (1 1 4 4 9 9 16 16) or, modify duplicate take procedure second argument , apply each element of list: (define (duplicate lst p) ...

javascript - new Function() with variable parameters -

i need create function variable number of parameters using new function() constructor. this: args = ['a', 'b']; body = 'return(a + b);'; myfunc = new function(args, body); is possible without eval() ? thank much, guys! actually, a+b not primary concern. i'm working on code process , expand templates , needed pass unknown (and variable) number of arguments function introduced local variables. for example, if template contains: <span> =a </span> i need output value of parameter a . is, if user declared expanding function var expand = tplcompile('template', a, b, c) and calls expand(4, 2, 1) i need substitute =a 4 . , yes, i'm aware function similar eval() , runs slow don't have other choice. you can using apply() : args = ['a', 'b', 'return(a + b);']; myfunc = function.apply(null, args); without new operator, function gives same result. can use array functions ...

java - Sorting JTable Rows manually and with TableRowSorter simultaneously -

i have create table can sorted clicking on table header , reordering single , multiple rows hand. i made buttons move selected rows in table model up, down, top or bottom. buttons alter table model , afterwards update jtable. alone works fine. but when start sorting rows clicking on columns in table header goes wrong. manual sorting works collection in table model, sorting clicking header works kind of table view. is there way move rows manually in table view , not in table models collection? or there other better solution? the jtable api addresses relationship between model , view co-ordinates respect sorting. in particular, says, "in examples area, there demonstration of sorting algorithm making use of technique interpose yet coordinate system order of rows changed, rather order of columns." might compare you're doing relevant example in sorting , filtering .

Packet Sniffing from a BlackBerry app -

i want develop app basic packet sniffing. so, know if packet sniffing feasible blackberry. i don't think possible. can keep track of number of packets sent , received on radio, not see actual contents. see radioinfo.getnumberofpacketsreceived() , radioinfo.getnumberofpacketssent() .

ipad - Multitasking in iphone -

how implement multitasking open other application application (for example: opening pdf document in ibooks app)? see documentation uidocumentinteractioncontroller . offers functionality give user preview of document , present list of apps in can open document. afaik not possible send pdf ibooks programmatically without user interaction.

actionscript 2 - send a tweet from flash using as2? -

i need send tweet flash, i've been looking solution on net, found using as3. since don't know of as3, becomes difficult edit everything. i wonder if it's possible. does know solution? posting tweet requires user being authenicated via oauth. assuming have user authenicated, can post data url: http://twitter.com/statuses/update.xml w/ post vars: status , in_reply_to_status_id (optional) something this: var lv:loadvars = new loadvars() lv.status = 'mystatus' lv.in_reply_to_status_id = 'xxxxxx' lv.ondata = mydatahandlerfunction lv.sendandload( 'http://twitter.com/statuses/update.xml', lv, 'post'); the authentication process oauth complex. there few oauth libs out there flash, as3. if set on as2, can use serverside oauth library can interface as2 app with. twitteroauth all signs point learning as3 if plan on doing real flash/twitter work, can , running as2 little more work.

jquery - The problem about usage the of animate -

i have list example copy code 1. <ul id="applications"> 2. <li id="id-1" class="util"></li> 3. <li id="id-1" class="app"></li> 4. <li id="id-1" class="util"></li> 5. <li id="id-1" class="app"></li> 6. </ul> then want select of list animate effect, first of elements disappear, elements wanted display 1 one code: copy code 1. $('#applications li').each(function (index) { 2. settimeout(function (e) { 3. e.hide("slow"); 4. }, index * 100, $(this)); 5. }); 6. $('#applications li[class="app"]').each(function (index) { 7. settimeout(function (e) { 8. e.fadein("fast"); 9. }, index * 100, $(this)); 10. ...