Posts

Understanding Type Classes, Scala implicit and C# -

i read blog post joe duffy haskell type classes , c# interfaces. i'm trying understand have enabled c# have type classes, , wonder whether feature scala's implicits solve it? having kind of feature enable writing this: public interface ireducableof<t> { t append(t a, t b); t empty(); } public t reduce(this ienumerable<t> vals, **implicit** ireducerof<t> reducer ) { enumerable.aggregate(vals, reducer.append); } making sure have in our context implementation of ireducerof<t> compiler "just" pick reducer , use execute code. of course, code cannot compile. but questions are: can enable implementing type classes? is similar happening in scala? i'm asking general understanding , not particular problem. update i've encountered github repo on possible implementation of type classes in c# yes, how type classes implemented in scala. general design principle in scala add general , re-usable features...

ios - I am getting the following error when i am trying t o build my project -

Image
ld: file small (length=0) file '/users/ashutoshp/library/developer/xcode/deriveddata/thebouqs-arlmufhxskabmgbuixdzfozlrsph/build/intermediates/thebouqs.build/debug-iphonesimulator/thebouqs.build/objects-normal/x86_64/homevc.o' architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation) i got same issue able solve following steps : just clear derived data contents xcode. quit , restart xcode. for clear derived data can use following steps or link . step 1 : click on xcode > preferences... step 2 : select location step 3 : delete derived data folder... hope you...

scala - Type inference is not happening in polymorphic function -

i have written 2 version of codes below . in 1st version , getting run time error below , not able understand why getting error while passing iterator type function : using . in version 2 running fine while passing type of resource type function : using . error:(23, 11) inferred type arguments [iterator[string],nothing] not conform method using's type parameter bounds [a <: anyref{def close(): unit},b] control.using(source.fromfile("c:\users\pswain\ideaprojects\test1\src\main\resources\employee").getlines){a => {for (line <- a) { println(line)}}} ^ 1st version:- /** * created pswain on 9/22/2016. */ import java.io.{ioexception, filenotfoundexception} import scala.io.source object control { def using[ <: {def close() : unit},b ] (resource : a) (f: => b) :b = { try { f(resource) } { resource.close() } } } object filehandling extends app { control.using(source.fromfile("c:\\users\\...

gradle - Android build tools unaligned 2.2.0 -

i have found when trying create signed release build, apk not aligned. else find this? there needed change work? com.android.tools.build:gradle:2.2.0 gradle command: assemblerelease temp solution: temporarily set build tools 2.1.3 , works fine.

java - Is realm a relational database? -

i have tried searching realm following questions not answered. please me understand following questions properly: realm relational database? how more efficient compared sqlite? no, realm not relational database. it allows declare relationships between objects same in object graph in language of choice. jp's talk on core describes in more detail , highly recommended. it stores objects in optimal memory-mapped format, using column-store techniques fast searching. accessors in different language sdks map directly functions using memory-mapped storage. in contrast, using relational database sqlite has multiple layers of copying buffers. note: on realm xamarin team.

How to clear the img placeholder for choose image using jQuery -

i have form fileupload. <input class="file" type="file" name="files[]"> i curently cloning input, if file choosen clones choosen filinput, there way clear selected image? script: $('.fieldset-content_doc').first().clone().appendto('.fieldset-clone_doc').find('.file').reset(); fieldset-content_doc: holds formvalues apparently issue reproducible on firefox. but, can set value property of element null : $('.fieldset-content_doc') .first() .clone() .appendto('.fieldset-clone_doc') .find('.file') .each(function() { this.value = null; }); see fiddle

ios - Trouble adding observer to NotificationCenter in Swift 3.0 -

i'm having trouble adding notification observer in swift 3.0. code so: notificationcenter.default.addobserver(self, selector: .playeritemdidplaytoendtime, name: notification.name(avplayeritemdidplaytoendtimenotification), object: playeritem) i getting error: "cannot invoke value of type notification.name.type (aka nsnotification.name.type) argument list (nsnotification.name)" with: avf_export nsstring *const avplayeritemdidplaytoendtimenotification ns_available(10_7, 4_0); what doing wrong here? as martin r commented, name argument should be: nsnotification.name.avplayeritemdidplaytoendtime and complete code be: notificationcenter.default.addobserver(self, selector: .playeritemdidplaytoendtime, name: nsnotification.name.avplayeritemdidplaytoendtime, object: playeritem)