Posts

objective c - EXC_BAD_ACCESS error when using an NSURLSession NSURLSessionDownloadTask on some hardware in iOS 9 -

update works in ios9 beta 5 original question executing line of code causes exc_bad_access error happen shortly after in library code on non-main thread before completion handler called. [[[nsurlsession sharedsession] downloadtaskwithurl:[nsurl urlwithstring: @"https://www.google.com/images/srpr/logo11w.png"] completionhandler:^(nsurl *location, nsurlresponse *response, nserror *error) { nslog(@"at download completion handler"); }] resume]; it happens on ipad model a1403 on ios 9 beta 3 , 4, not on ios8.1, , works fine on ipad model a1566 on both ios 9 , ios 8.4. i've logged bug apple. is else having issue? see workaround? tests: ios 8.1 - device a1566 - working ios 8.4 - device a1403 - working ios 9 beta 4 - simulator - wo...

jquery - Scroll modal on show -

i'm using jquery show bootstrap modal, unable scroll until manually click inside it. i've tried focus(): $('#action-modal-body').focus() i've tried click(): $('#action-modal-body').click() i've added delay account modal animation: settimeout(function (){ $('#action-modal-body').click() }, 1000); now bootstrap 3 events has change can achieved (plus smooth animation top) $('#modalidhere').on('shown.bs.modal', function () { $('#modalidhere').animate({ scrolltop: 100 }, 'slow'); });

php - Adding Pagination to WordPress Page Templates -

i built wordpress theme existing theme (one engine theme). site launched , seems working except pagination. have tried many things failed work. template pages meant paginate @ point no 1 seem work. below looping code blog page template: <?php $newsposts = get_posts(); foreach($newsposts $post) : setup_postdata($post); ?> //the html codes added here <?php endforeach; ?> i want make post per page 4 , add default wordpress pagination function: <?php posts_nav_link(); ?> the page template here blog.php, can see page in action here: www.kayodeolusoji.net/blog appreciated! try this: i add 'paged' atrribute in $args wiht wp_query $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $posts_per_page=4; $args = array( 'paged' => $paged, 'posts_per_page'=>$posts_per_page ); ...

python - How to return django form object in an AJAX request from django template? -

i trying call view django template via ajax call. i want form object in response view such can render form via jquery in div element. is possible ? how? this tried: home.html function get_edit_form(button, id) { $.ajax({ url: "/manage/licenses/{{mls_signup_code}}/{{agent_id}}/" + id + "/", type: "get", data: {id: id}, success: function(response) { console.log(response); $("#formdiv").html({{ response.as_p }}); } }) } views.py elif request.method == "get": owned_license_id = request.get.get('id', '') form = ownedlicenseform(owned_license_id) return form i see trying do, cannot render html form way: $("#formdiv").html({{ response.as_p }}); i think confusing server side rendering (django templates) client side rendering. server side rendering happens when se...

gcc - Benchmarking a pure C++ function -

how prevent gcc/clang inlining , optimizing out multiple invocations of pure function? i trying benchmark code of form int __attribute__ ((noinline)) my_loop(int const* array, int len) { // use array compute result. } my benchmark code looks this: int main() { const int number = 2048; // own aligned_malloc implementation. int* input = (int*)aligned_malloc(sizeof(int) * number, 32); // fill array random numbers. make_random(input, number); const int num_runs = 10000000; (int = 0; < num_runs; i++) { const int result = my_loop(input, number); // call pure function. } // since program exits don't free input. } as expected clang seems able turn no-op @ o2 (perhaps @ o1). a few things tried benchmark implementation are: accumulate intermediate results in integer , print results @ end: const int num_runs = 10000000; uint64_t total = 0; (int = 0; < num_runs; i++) { total += my_loop(input, number); // call pure function. } printf(...

r - reshape and aggregate datatable -

i asked similar question , because haven't quite gotten handle on tidyr or reshape have ask question. have datatable containing repeat id values (see below): id product ni 1 direct auto 15 2 direct auto 15 3 direct auto 15 4 direct auto 15 5 direct auto 15 6 direct auto 15 6 mortgage 50 9 direct auto 15 10 direct auto 15 11 direct auto 15 12 direct auto 15 13 direct auto 15 14 direct auto 15 15 direct auto 15 16 direct auto 15 1 mortgage 50 5 personal 110 19 direct auto 15 20 direct auto 15 1 direct auto 15 i id aggregated 1 row, product column 'spread' values become variables, variable containing aggregated count of each product id, , ni summed each of product groups id. see example below: id directauto da_ni mortgage mortgage_ni personal p_ni 1 2 30 1 50 na na 2 1 15 na na na na 3 1 15 na na na na 4 1 15 na na na na 5 1 15 ...

three.js - Creating a 3d graph using VivaGraphJS and using a particle system -

i'm trying create force directed graph layout data of nodes , edges have.i want use vivagraphjs this. want integrate particle cloud in threejs. know how them individually, i'm lost when comes using them together. you use ngraph.pixel , combines three.js renderer 3d layout engine ngraph family. see more demos here . both vivagraph , ngraph.pixel sharing same primitive structures.