Posts

haskell - Typeclass for (what seems to be) a contravariant functor implementing function inversion -

lets have following import control.category (category, (.), id) data invertible b = invertible (a -> b) (b -> a) instance category invertible id = invertible prelude.id prelude.id (invertible f f') . (invertible g g') = invertible (f prelude.. g) (g' prelude.. f') invert (invertible x y) = invertible y x note following true: invert (g . f) == invert f . invert g this structure seems similar contravariant functor (wikipedia) , follows same axiom: f(g . f) = f(f) . f(g) in case, f invert . i looked @ data.functor.contravariant.contramap , has function of type: (a -> b) -> f b -> f but didn't know how'd i'd implement in situation. example, can't work out sensible choice f , , in situation, there's no function a -> b , invert . however, invert nevertheless fits mathematical axiom of contravariant functor, i'm thinking can fit existing class, can't find 1 , how it. or pointers appreciated. ...

java - How to get the subtraction result of two EditText in third EditText for Android? -

i'm new android programming. while making program looking program auto fill subtraction result of 2 edittext widgets in third edittext , without button. please me find solution. int firstvalue=firsttext.gettext.tostring(); int secondvalue=secondtext.gettext.tostring(); int answer=firstvalue - secondvalue; thirdvalue.settext(answer); hope works. if problem occour tell me

button - RippleView effect on view appears late android -

i using com.andexert.library.rippleview library here's a link its working not expected . ripple effect appears late i.e; when click on textview activity gets launched , ripple effect appears on textview of previous activity. also shows error " cannot resolve method setonripplecompletelistener() " xml file <com.andexert.library.rippleview android:id="@+id/ripple_view" android:layout_width="match_parent" android:layout_height="wrap_content" rv_centered="true" android:padding="0dp" android:layout_alignparentbottom="true"> <com.techmorphosis.utils.textviewcustomfont android:id="@+id/txt_lets_go" android:layout_width="match_parent" android:layout_height="wrap_content" android:textcolor="@color/white_text" android:background="@drawable/purple_button_bg" ...

android - Robolectric 3.0 testing Vibrator service -

i in process of migrating test cases latest robolectric 3.0. test viberator service in app, earlier used org.robolectric.shadows.shadowvibrator but not able test it, using custom shadow class. even robolectric wesite not updated , shows use robolectric.shadowof_() not exist. this link of website, not updated version. kindly guide. following code custom implementation:-- the custom class:-- @implements(vibrator.class) public class shadowvibrator { private boolean vibrating; private boolean cancelled; private long milliseconds; private long[] pattern; private int repeat; @implementation public void vibrate(long milliseconds) { vibrating = true; this.milliseconds = milliseconds; } @implementation public void vibrate(long[] pattern, int repeat) { vibrating = true; this.pattern = pattern; this.repeat = repeat; } @implementation public void cancel() { cancelled = true; ...

ios - Parse Local DataStore not showing pinned data -

i have tried make sure recommended steps followed in implementing parse local data store either pinning seems not working or querying pinned objects not working. have tried multiple options. below code view controller , have enabled datastore etc in app delegate file (using base parse starter project). please advise me problem. output in console - able fetch data parse server either not able pin or retrieve or else.. success 8888 optional([]) push notifications not supported in ios simulator. success 7777 optional([<restaurant: 0x7f98ca521f60, objectid: 0rrzncndje, localid: (null)> { name = time; }]) thanks help! import foundation import parse import parseui import uikit import foundation class restaurantadmin: viewcontroller { func getdatafromlocaldatastore() { var username = pfuser.currentuser()?.username var messages2: [anyobject]! var query2: pfquery = pfquery(classname: "restaurant") query2.fromlocaldatastore()...

ios - Watch OS2 NSTimer problems -

i'm working on app need start timer (using nstimer) when watch activated. timer asks information iphone (about every 1 seconds , maximum 5 seconds). i'm using start timer timer = [nstimer scheduledtimerwithtimeinterval:2 target:self selector:@selector(myfunction) userinfo:nil repeats:no]; in "myfunction" function, restart timer next time. - (void) myfunction { //here update label text // [...] [timer invalidate]; timer = nil; counter++; if(counter<5) { timer = [nstimer scheduledtimerwithtimeinterval:2 target:self selector:@selector(myfunction) userinfo:nil repeats:no]; } } my problem in simulator works fine in real watch (watch-os2 gm) timer doesn't start or starts 1 time , after seems freeze! see because update label in watch @ every elapsed period shows counter , i'm sure initialized in "will activate" function. don't understand why. same issue? i having similar , equally frustrating issue ...

select query in mysql to select the data before 15 minutes in php -

Image
i have table: i want select data res_time within past 15 minutes. using: select * test res_time >= date_sub(now(), interval 15 minute). select * `test` res_time between timestamp(date_sub(now(), interval 15 minute)) , timestamp(now()). if using php can this $beforetime = date("y-m-d h:i:s",strtotime("-15 minutes")); $query = "select * test res_time >= '$beforetime' " ; if want pure sql solution follow other mentioned solutions. cheers !!!