Posts

c - select interrupted system call -

i creating timer runs approximately every second , waiting key pressed (which not doing). while running shows: select : interrupted system call select : interrupted system call select : interrupted system call select : interrupted system call can tell me why happening: struct sigaction s1; static timer_t tid3; sigfillset(&s1.sa_mask); s1.sa_flags = sa_siginfo; s1.sa_sigaction = signalhandler; if (sigaction(sigu, &s1, null) == -1) { perror("s1 failed"); exit( exit_failure ); } printf("\ntimer %d setting \n",timeridentity); tid3=settimer(sigu, 1000, 1); // ---------- set timer values ------------------- static struct sigevent sigev; static timer_t tid; static struct itimerspec itval; static struct itimerspec oitval; sigev.sigev_notify = sigev_signal; sigev.sigev_signo = signo; sigev.sigev_value.sival_ptr = &tid; if (timer_create(clock_realtime, &sigev, &tid) == 0) { itval.it_value.tv_sec = sec/1000; itval.it_va...

android - AppWidgetProvider onEnabled() -- is widget list known at that point? -

i use alarmmanager set repeating alarm each widget updating purposes. it's working well, on devices. in order re-establish alarms after reboot, relying on onenabled() method, since called once group of app widgets. , in that, have following: alarmmanager alarmmanager = (alarmmanager) context.getsystemservice(context.alarm_service); appwidgetmanager appwidgetmanager = appwidgetmanager.getinstance(context); int appwidgetids[] = appwidgetmanager.getappwidgetids(new componentname(context, myappwidgetprovider.class)); (int appwidgetid : appwidgetids) { // call function set repeating alarm widget (including doing widget update now)... updateappwidgetalarm(context, appwidgetid, appwidgetmanager, alarmmanager); } whilst seems work in cases, appears devices onenabled() method not doing @ all. know being called, logging put in, nothing happening. i suspect maybe appwidgetids array empty, because @ time after reboot list has not yet been populated. put in more log...

Selecting value of active select with jQuery -

in viw have 5-15 dynamically created dropdowns this: <select class="task-type" id="21"> <option value=""></option> <option value="easy">easy</option> <option value="hard">hard</option> </select> where class task-type used every dropdown , id unique each every , represents record in database, vary 1 10000. i have following jquery code try pick value of dropdown has changed value: $( '.task-type-select' ).change(function(){ alert($( ".task-type-select option:selected" ).text()); }); however, alerts every dropdown's value, need changed one. any or guidance appreciated. you can use this keyword reference element raised event. there can use val() method selected value: $('.task-type-select').change(function(){ console.log($(this).val()); });

ruby - undefined method `zone` for Time:Class after requiring active_support/time_with_zone -

i'm on ruby 2.2.1 , have active_support 4.2 installed want use time.zone.parse('2007-02-10 15:30:45') as described here: http://api.rubyonrails.org/classes/activesupport/timewithzone.html but after requiring active_support , active_support/time_with_zone , doesn't seem time.zone still doesn't work. observe: 2.2.1 :002 > require "active_support" => true 2.2.1 :003 > time.zone nomethoderror: undefined method `zone' time:class 2.2.1 :004 > require "active_support/time_with_zone" => true 2.2.1 :005 > time.zone nomethoderror: undefined method `zone' time:class what's going on? the zone class method time class in active_support/core_ext/time/zones . can require class if want use time.zone better approach might require active_support/all suggested solution require "active_support/all" if want check out source code fort active_support @ github repo

linux - "ambiguous redirect " error in shell script -

i'm getting "ambiguous redirect " error in shell script if use double quotes suggested getting "ambiguous redirect" error . i'm passing shell variable awk -f ',' -v grep_values="${grep_value}" '$6==grep_values' file awk -f ',' -v grep_values="${grep_value}" '$6=="${grep_values}"' file any suggestions.

javascript - Is it possible to inject dynamic angular dependencies -

i have many widgets , component. after time admin can add new component via bower , include in html file using grunt . but how dynamic dependencies can handle in angular.? for example. have following module name , dependencies app = angular.module("sematree", ['ngroute','ngresource', 'ui.bootstrap', 'adf', 'adf.structures.base', 'adf.widget.table']); after time want add stackedcolumnchart.js component in application folder , want add 'adf.widget.stackedcolumnchart' in dependencies opening angular file. is possibility can add dependencies using grunt.? or can handle dynamic under same folder.? kindly give me idea.

php - Alias mock persists over test classes -

i have created alias mock using mockery in class mock calls public static methods made in class want test. in different test class b want use these public static methods (not mocked) seems alias mock created in test class persists when test class b executed. when running tests in test class b exception: badmethodcallexception: static method helper::formatdate() not exist on mock object , though helper class should not mocked in class b. i have tried add: /** * @runtestsinseparateprocesses * @preserveglobalstate disabled */ in test classes make them run separately, error: phpunit_framework_exception: php fatal error: class 'testcase' not found anyone has ideas how solve this? try using aspectmock, supposed mock static methods: https://github.com/codeception/aspectmock anyway problem indication of code not being testable. should consider refactoring , not using static calls need mocked.