Posts

Showing posts from February, 2012

android.support.v7.widget.cardview cannot be found -

i'm using android studio 1.2.2 , attempting use cardview in layout, preview giving me warning class android.support.v7.widget.cardview not found. question has been asked various times, , have looked @ these solutions: error when adding cardview layout android.support.v7.widget.cardview not found (android studio 1.1 preview) but none of them have answer. have added gradle: dependencies { compile filetree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:cardview-v7:21.0.+' } and have added layout: xmlns:card_view="http://schemas.android.com/apk/res-auto" which pretty sums answers given on 2 similar questions asked, still getting same error, , when run on device, cardview doesn't show @ all. can point out other possible solutions? by way, minsdkversion 21. layout: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/

sonar runner - Update SonarQube 3.7.4 to 5.0 AddNetworkUseSubCharacteristic: Fail to upgrade database -

hi: both have errror when migrating: the log: 2015.07.16 15:36:57 info app[o.s.p.m.monitor] process[web] 2015.07.16 15:40:54 info web[dbmigration] == replacekeyregexpbykeysearchinmeasurefiltersdata: migrating ================ 2015.07.16 15:40:54 info web[dbmigration] == replacekeyregexpbykeysearchinmeasurefiltersdata: migrated (0.0150s) ======= 2015.07.16 15:40:54 info web[dbmigration] 2015.07.16 15:40:55 info web[dbmigration] == addprovisioningpermission: migrating ====================================== 2015.07.16 15:40:55 info web[dbmigration] == addprovisioningpermission: migrated (0.1250s) ============================= 2015.07.16 15:40:55 info web[dbmigration] 2015.07.16 15:40:55 info web[dbmigration] == addtechnicaldebttoissue: migrating ======================================== 2015.07.16 15:40:55 info web[dbmigration] -- add_column("issues", "technical_debt", :integer, {:null=>true}) 2015.07.16 15:40:55 info web[dbmigration]

javascript - Set the value of an input field inside a form with a specific attribute? -

i have below html. need jquery selector set value of hidden attribute (selectedentityid) inside form following attribute (data-ajax="true"): <form action="/myserver/list/toolbarfunction" method="post"> <input name="selectedentityid" id="selectedentityid" type="hidden" value=""> </form> <form action="/myserver/list/ajaxtoolbarfunction" method="post" data-ajax="true" data-ajax-success="successmessage" data-ajax-method="post" data-ajax-failure="failmessage"> <input name="selectedentityid" id="selectedentityid" type="hidden" value=""> </form> notes: need input element (selectedentityid) inside 2 forms , have same id. i have tried following: $("form[data-ajax='true'] #selectedentityid").val('123') but value not set , there

SWI-Prolog predicate for reading in lines from input file -

i'm trying write predicate accept line input file. every time it's used, should give next line, until reaches end of file, @ point should return false. this: database :- see('blah.txt'), loop, seen. loop :- accept_line(line), write('i found line.\n'), loop. accept_line([char | rest]) :- get0(char), c =\= "\n", !, accept_line(rest). accept_line([]). obviously doesn't work. works first line of input file , loops endlessly. can see need have line "c =\= -1" in there somewhere check end of file, can't see it'd go. so example input , output be... input example output found line. found line. or doing wrong? maybe there's built in rule simply? in swi-prolog, elegant way first use dcg describe "line" means, , use library(pio) apply dcg file. an important advantage of can apply the same dcg on queries on toplevel phrase/2 , not need create file test predi

javascript - Three.js creating geometry and mesh freezes animation -

i trying create scrolling text animation, , add more text animation while running. this function creating text geometry , mesh: function createtext(){ textgeo = new three.textgeometry( "some new text quite long", { size: 20, height: height, font: font }); textmesh1 = new three.mesh( textgeo, new three.meshbasicmaterial( { color: 0x112358 } ) ); textmesh1.position.x = (window.innerwidth / 2) + 100; textmesh1.position.y = ((window.innerheight / 2) * -1) + 40; textmesh1.position.z = 0; textmesh1.rotation.x = 0; textmesh1.rotation.y = 0; group.add( textmesh1 ); } and animate function: function animate() { var fistbox = new three.box3(); requestanimationframe( animate ); for(i = 0; < group.children.length; i++){ group.children[i].position.x -= 2; } fistbox.setfromobject(group.children[0]); if(group.children[0].position.x < ((window.innerwidth / 2) * -1) - fistbox.size().x ){ scene.remov

operating system - Process synchronization - Critical section -

i studying final in os. on process sync chapter. our book offering following algorithm deal critical section. claims algorithm solves problem of starvation , offers bounded wait. here pseudocode var flag: array [0..1] of boolean; turn: 0..1; repeat flag[i] := true; turn := j; while (flag[j] , turn=j) no-op; critical section flag[i] := false; remainder section until false; from understanding, starvation occurs when process in critical section , process needs access it, first process won't finish. second process has wait forever. remember cpu scheduling implementing aging in algorithm, example, solve starvation. don't see how happen here. am wrong? there i'm not seeing here? thank you. imagine have 2 processes: 1 , 2, process1 wants go cs: let's start first process: repeat flag[1] := true; turn := 2; i want explain "while" in code: if falg[2] equal true: means the process2 has ran blow line of

concurrency - how to make this play scala controller work? -

i trying create controller extracts file on fly archive , then renders static asset default asset controller import play.api.play.current // import controllers.assets import play.api.logger import myextract.extract import scala.concurrent.{executioncontext, future} import play.api.libs.concurrent.execution.implicits.defaultcontext object myassets extends controller { // drop version , serve asset def at(path: string, file: string): action[anycontent] = action.async { logger.info("looking file = %s" format file) val ret = future { extract.getfile(path, file) // extracts file archive // throws exception if file cannot extracted } ret.map { v => assets.at(path, file) } } } i these errors @ compile ./activator compile [info] loading project definition /home/sylvain/yo-scala/project [info]

r - What are the internals of merge followed by aggregation with data.table? -

one common use case data.table in work merge 2 tables followed aggregation intermediary result not needed further on. example: library(data.table) set.seed(200) a.dt <- data.table(k1=2000+sample.int(12, 50, replace = true))[ , k2 := month.abb[(sample(12, .n, replace = true))]][ , .(val = rnbinom(1, 50, .8)) , = .(k1, k2)] b.dt <- a.dt[ , .(k3 = letters[7:12]), = k1][ , adj1 := 1/rbeta(1, 2, 5) , by= k3][ , adj2 := rbeta(.n, 5, .5)] setkey(a.dt, k1) setkey(b.dt, k1) result.dt <- a.dt[b.dt, allow.cartesian = true][ , .(weighted = sum(val * adj1 * adj2)) , = .(k3, k1, k2)] my question if intermediary data.table "a.dt[b.dt, allow.cartesian = true]" first allocated in full or directly piped following aggregation? yours, alexander

tortoisesvn - How to remove read-only property from files that WERE under svn without svn? -

this may sound duplicate question not, read other similar ones , not apply me. happened... i had 1 computer tortoise svn installed , project under control, when got new computer did copy project folder old computer , save in new computer. i did not install svn on new computer because no longer need problem when try edit in project can't because error "access path denied". i tried removing read-only property windows didn't work, assume files have kind of locking svn, how can remove locking? if possible, without having install again svn. also, i'm trying edit visual studio , when saving error.

meteor - Accessing other templates' instances -

you can access current template's instance doing template.instance() . run situations have access other templates' instances well. example, if use reactivevar , want or set variables attached other template instances. i came across how parent template instance (of current template) not complete. q1. how can access template's instance, not current template's q2. against meteor way if need access other templates' instances? you can try set template variable directly @ template level instead of inside instance. template.example.myvariable = new reactivevar(); instead of template.example.oncreated(function (){ this.myvariable = new reactivevar(); });

java - C3P0 connection pool stall with Heroku Postgres -

this relates unsolved post: here c3p0 seems enter deadlock after initializing connection pool on heroku. problem not occur on local postgres. here's connection configuration hibernate.hbm.xml <property name="hibernate.dialect">org.hibernate.dialect.postgresqldialect</property> <!-- enable hibernate's automatic session context management --> <property name="current_session_context_class">thread</property> <property name="hibernate.connection.url">jdbc:postgresql://myurl:5432/mydb?user=myusername&amp;password=myoassword&amp;sslfactory=org.postgresql.ssl.nonvalidatingfactory&amp;ssl=true</property> <property name="hibernate.connection.driver_class">org.postgresql.driver</property> <property name="hibernate.connection.username">myusername</property> <property name="hibernate.connection.password">mypass

javascript - Trying to delete entry from MongoDB database using Express.js & Jade -

i created app adds , removes 'case studies'. able add entries easily, when try delete entry, redirected of form page form action url appended end. entry in fact deleted when go original form page, ideally i'd able stay on same page add/delete entries. form.jade form(method="post", action="/form/#{entry._id}?_method=delete") input(type="submit", value="delete") form.js /* delete case study */ router.delete('/:id', function (req, res) { entry.findbyid(req.params.id) .exec(function(err, entries) { // changed `if (err || !doc)` `if (err || !entries)` if (err || !entries) { res.statuscode = 404; res.send({}); } else { entries.remove(function(err) { if (err) { res.statuscode = 403; res.send(err); } else { res.send('deleted entry link: ', entries.link);

powershell - How to create an XML file on a remote host? -

the script should connect server , create xml file below content. <?xml version='1.0'?> <action> <type>update_job</type> <attribute name="job_id" value="331" /> <attribute name="variables"> <map> <entry name="cc_waitapprove_continue" value="true"/> <entry name="cc_approved" value="false"/> </map> </attribute> </action> update 1: able create xml file in same server using following code, not sure how code connect server , create xml file there: param( [string] $jobid, [string] $path) $location = $path #"c:\users\sks" $x = @" <?xml version='1.0'?> <action> <type>update_job</type> <attribute name="job_id" value="$jobid" /> <attribute name="variables"> <map> &l

c# - Populating List with related information -

i have list view populated using controller: public actionresult listclubmembershiptype(int clubid) { //populate list var types = s in db.membershiptypes (s.clubid == clubid) orderby s.type select s; viewbag.typescount = types.count(); var model = types.select(t => new listmembershiptypeviewmodel { type = t.type, clubid = clubid, cost = t.cost, reducedcost = t.reducedcost, minage = t.minage, maxage = t.maxage, }); return partialview("_listclubmembershiptype", model); } i populate variable in view model called reduceddate data pulled 2 other tables, day & month. ive tried following line: reduceddate = db.days.find(t.dayid).daynum + "/" + db.months.find(t.monthid).monthname, but gives following error: additional information: method 'grcwebapp.model

javascript - Collecting text box values in Visual Basic -

i have javascript code assigns value text box: document.getelementbyid('longitudetextbox').value = location.coords.longitude; what want value of text box on visual basic: dim logitude string = longitudetextbox.text this works if code inside button, if use on page event page_load , i'm not receiving data. try using when pageload.complete = true

java - Code for only accepting integers -

import javax.swing.*; import java.awt.*; public class jcd { public static void main(string[] args) { string input, inputs; int input1, input2; input = joptionpane.showinputdialog("enter first number"); inputs = joptionpane.showinputdialog("enter second number"); input1 = integer.parseint(input); input2 = integer.parseint(inputs); joptionpane.showmessagedialog(null, "the gcd of 2 numbers " + input + "and" + inputs + " is: " + findgcd(input1, input2)); }// close void private static int findgcd(int number1, int number2) { // base case if (number2 == 0) { return number1; }// end if return findgcd(number2, number1 % number2); }// end static } // close class what can add accept integers? if not given integer go ask again..... put input request in while statement, check if it's int,

c++ - What could cause a mutex to misbehave? -

i've been busy last couple of months debugging rare crash caused somewhere within large proprietary c++ image processing library, compiled gcc 4.7.2 arm cortex-a9 linux target. since common symptom glibc complaining heap corruption, first step employ heap corruption checker catch oob memory writes. used technique described in https://stackoverflow.com/a/17850402/3779334 divert calls free/malloc own function, padding every allocated chunk of memory amount of known data catch out-of-bounds writes - found nothing, when padding as 1 kb before , after every single allocated block (there hundreds of thousands of allocated blocks due intensive use of stl containers, can't enlarge padding further, plus assume write more 1kb out of bounds trigger segfault anyway). bounds checker has found other problems in past don't doubt functionality. (before says 'valgrind', yes, have tried no results either.) now, memory bounds checker has feature prepends every allocated block

installation - Arduino Due: not sync to MAC/ PC -

Image
situation: arduino due encounter sync issue, following setting: however show these: , arduino board tx blinking. what tried doesn't work: 1) on both mac (yosemite 10.10.3) , win7 (home premium), both show same error 2) try solutions suggested online, remove connection on pin0, don't have connection on pin0 3) press connect usb & press reset button on arduino board

python - Understanding isomorphic strings algorithm -

i understanding following code find if strings isomorphic or not. code uses 2 hashes s_dict , t_dict respectively. assuming strings of same length. def isisomorphic(s, t): s_dict = {} t_dict = {} in range(len(s)): if s[i] in s_dict.keys() , s_dict[s[i]] != t[i]: return false if t[i] in t_dict.keys() , t_dict[t[i]] != s[i]: return false s_dict[s[i]] = t[i] t_dict[t[i]] = s[i] return true now, if modify above code such 1 hash s_dict() used, gives desired results limited test cases. modified code follows: def isisomorphic(s, t): s_dict = {} in range(len(s)): if s[i] in s_dict.keys() , s_dict[s[i]] != t[i]: return false s_dict[s[i]] = t[i] return true what test cases in above modified code fail? understanding of isomorphic strings wrong? one simple example, code doesn't work on s='ab',t='aa'. basically have have both way isomorphic. c

Possible to provide a URL as an OpenGraph object in Facebook SDK 4 for Android -

i aware shareopengraphobject.builder() in sdk4 allows build open graph object hard coding values using .putstring("og:type", "books.book") etc... but before sdk 4 update provide url represented object straight opengraphaction.settype() , publish story using opengraphactiondialogbuilder. not seem case anymore. is there way dynamically build open graph story using url open graph object in facebook sdk 4 android? you need use putstring() method on shareopengraphaction.builder() : shareopengraphaction action = new shareopengraphaction.builder() .setactiontype("books.reads") .putstring("book", "http://www.myserver.com/my_object_page") .build(); shareopengraphcontent content = new shareopengraphcontent.builder() .setpreviewpropertyname("book") .setaction(action) .build(); sharedialog.show(this, content);

angularjs - ngRepeat with $scope.$apply creates duplicates in directive -

i have directive puts dynamic data qtip via template. fetching template , using $compile on (excuse coffeescript): $http.get scope.qtiptemplate, cache: $templatecache .then (html) -> clone = $compile html.data generateqtip text: -> scope.$apply -> clone scope the generateqtip creates new qtip on directive element , puts first argument content property on options object. what happens though is, every time open qtip, ngrepeat in template produces duplicate lists, limitto filter. example code: <ul> <li ng-repeat="person in object.people | limitto:3 track $index">{{person.name}}</li> </ul> produces following first time open qtip: john doe jane doe johnny dowy and on second time: john doe jane doe johnny dowy john doe jane doe johnny dowy and on third time: john doe jane doe johnny dowy john doe jane doe johnny dowy john doe jane do

hibernate - IntelliJ Idea JSF Bean Validation -

i changed ide eclipse java ee edition intellij idea. developing jsf project. project can deployed without errors, bean validators defined annotation e.g. this: @size(max = 8, message = "abc") private string username; are never invoked. suggestions problem be? in eclipse worked correct , bean-validation-toolbar of intellij detects validation constraints correctly. i using jsf mojarra 2.2.8, hibernate validator 5.1.3 final, eclipse luna , intellij 14. i don't had special configuration in web.xml, server: apache tomcat 8.0.22 i downgraded jsf mojarra 2.2.1 , hibernate validator 5.0.1 , works fine.

How can I get image from URI returned from Android photos app? -

i using this question reference how image uri embedded url, being returned photos app starting while back. now, i've noticed these uris no longer contain url , rather contain kind of key. don't know image now. uri i'm getting looks this: content://com.google.android.apps.photos.contentprovider/0/1/mediakey:/*long-key*/actual how meant use display bitmap user selected photos app? read uri using getcontentresolver().openinputstream(uri)

jquery - HTML input affecting entire page -

i making page can enter html , see output in div side. code: $("#tryit").keyup(function() { var input = $(this).val(); $("#readout").html(input); }); #readout { height: 400px; width: 48%; border: 1px solid black; overflow: auto; float: right; clear: none; display: inline-block; } #tryit { height: 396px; width: 50%; float: left; clear: none; display: inline-block; font-family: monospace; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <textarea name="tryit" id="tryit" rows="10">&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;new webpage&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt; </textarea> <div id="readout"></div> it works should: outputs html #readout .

java - What does the OFFSET do in repaint()-method with varargs? -

private void movesquare(int x, int y) { int offset = 1; if ((squarex!=x) || (squarey!=y)) { repaint(squarex,squarey,squarew+offset,squareh+offset); squarex=x; squarey=y; repaint(squarex,squarey,squarew+offset,squareh+offset); } } this snippet java-tutorials. it's tutorial painting in java. https://docs.oracle.com/javase/tutorial/uiswing/painting/step3.html i don't understand offset exactly doing. or happens inside repaint()-method. i know, necessary paint square correctly, because noticed, without offset, square missing side, not painted, or not deleted first repaint()-method. i let program write variables (used painting rectangle (squarex...and on)) in console. width , heigth 20 , not 21 (width + offset). when read variables inside paintcomponent()-method. why don't understand, why square drawn correctly first time, every other time gets repainted without offset, drawn incorrectly. and can't inside repa

html - Show specific part of background image -

i'm having little problem 1 of background images in div element. i'm using following css: .mybox { background-image:url('....'); background-repeat:no-repeat; background-size:cover; } my background image picture people on it. now, if increase width of browser window, @ specific point, of people cutted off (due automatic resize of image 'background-size:cover'). my question is: there option (or jquery plugin), set specific part on background image visible on window sizes , fill whole element? there variety of solutions try; however, might want start simple applying background-position. https://developer.mozilla.org/en-us/docs/web/css/background-position using background image of group of people example, might set background-position: top heads never cut off. can set vertical , horizontal position in pixel or percent units.

java - values in LinkedList changed outside of the function, clone() a 2D arrays -

if try read linkedlist “solvedbords”outside solve function values in 2d array “board” saved in solvedbords turns 0. but in “solved” function values in in 2d array “board” saved in solvedbords entirely accurate. is due recursion? explanation appreciated main class public class main { public static void main(string[] arg){ testqueen n = new testqueen(); } } test class import javax.swing.*; import java.util.linkedlist; public class testqueen { private int[][] board; private linkedlist<int[][]> solvedbords = new linkedlist<>(); private static int boardsize = 0; testqueen() { boardsize = 8; board = new int[boardsize][boardsize]; start(); } void start() { solve(0); system.out.println("solvedbords = " + solvedbords.size()); while (!solvedbords.isempty()) { system.out.println("this in start funktion"); printbord(solvedbords.pop());

c++ - Constructor inheritance for class derived from template class in visual studio 2015 rc -

according page of msvs2015rc new features constructor inheritance should supported. yes, works in simple cases this: struct b { b(int) {} }; struct d : b { using b::b; // can create d object b's constructor }; but if i'll try create more complex example: template <class t> struct b { b(int) {} }; template <template <class> class c, class t> struct d : c<t> { using c<t>::c; }; int main() { d<b,int> d(42); return 0; } i've got compiler errors: error c2039: 'c': not member of 'b<t>' error c2873: 'c': symbol cannot used in using-declaration error c2664: 'd<b,int>::d(d<b,int> &&)': cannot convert argument 1 'int' 'const d<b,int> &' i can eliminate these errors if , if rename template template class c b : template <template <class> class b, class t> struct d : b<t> { using b<t>::b;

Show Expired data using DateAdd function in SQL Server -

i want show data expired or data going expire in 1 month. have 2 columns of dates use different reasons , want check both columns. example: productname date1 date2 xyz 5/8/2015 9/7/2015 mlk 8/2/2015 5/3/2016 gml 4/4/2017 7/8/2017 mmm 5/8/2016 7/30/2015 desired results: productname date1 date2 xyz 5/8/2015 9/7/2015 mlk 8/2/2015 5/3/2016 mmm 5/8/2016 7/30/2015 i want show xyz because date1 has expired. want show mlk because date1 expire in 1 month. want show mmm because date2 expire in 1 month. please help. thanks so want know when date1 or date2 less 1 month today. using dateadd , can date 1 month on today, compare using < : select * yourtable date1 < dateadd(mm, 1, getdate()) or date2 < dateadd(mm, 1, getdate())

Dynamically allocate and delete an array of objects in c++ -

so did research, , far have following (example code): a class: class my_class { my_class(int a, double b); ... } and dynamic array: my_class **array_t; and initialization (with random numbers): int amount = 10; array_t= new my_class*[amount]; (int = 0; < amount; i++) { array_t[i] = new my_class(1, 2.0); } i think should work, right? @ least compiler not throwing errors @ me. now change size of array_t. thought simplest way delete array, , allocate new memory it. tried this: 1: (int = 0; < amount; i++) { 2: delete array_t[i]; 3: } 4: delete[] array_t; and in next step allocate new memory shown above. however following error messages: line 2: error: expected primary-expression before '[' token line 4: error: expected primary-expression before ';' token i read loop not necessary. anyway none of 2 delete statements work.. this might stupid error, don't know wrong in here :d appreciated! try write delete [] array_

multithreading - What is purpose of Read Lock in java synchronization -

i new in multithreading , confused , why read lock needed in java synchronization .also understand use case of write lock.in scenario need limit reader access threads. suppose don't have read lock in java , what's problem. suppose there shared resource r. thread t1 reading , it's not locked there no read lock in java(as said)meanwhile second thread try access r1 write on it. there in no information attached r1 thread read , second thread write lock , start writing not aspected. read lock information attached resource tell later threads resource in access reading , wait write access or can access read. read lock can access multiple thread.

regex - How do you map input to multiple replacement values with a regular expression for C# -

i have 2 input values: apple carrot i find regular expression can use c# program using regex.replace() recognize these inputs , replace them unrelated values. not have chance change code. can provide input, pattern, , replacement parameters. for example: if apple found, replace fruit if carrot found, replace vegetable i can match them ^apple|tomato$ see no way make substitution want. options replacement seem input or singular fixed value. there is, unfortunately, no way single regex replacement. there no way alter value of capturing group in pattern itself, or "hard-code" value of group in pattern. if, however, application allows provide multiple pattern/replacement pairs executed in succession, providing pairs: pair 1 pattern: ^apple$ replacement: fruit pair 2 pattern: ^tomato$ replacement: vegetable

Android picasso scale photos to be bigger or fit the imageView (no white space) -

i have serious problem picasso library scaling. problem have layout consisting of 3 main views , buttons. views : imageview 50% mapview 20% edittextview 30% and want load pictures of unknown resolution imageview without leaving white spaces. trying use .fit().centerinside left white spaces on sides. how layout looks like: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:layout_below="@+id/photo1" android:weightsum="10"> <imageview android:id="@+id/photo1" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="5&

javascript - In app purchases Cordova Plugin -

i use cordova plugin in-app purchases ios app ( https://github.com/j3k0/cordova-plugin-purchase/blob/master/doc/api.md#refresh ). i've followed code example shows: store.register({ id: 'credits_test', alias: 'credits_advance', type: store.consumable }); store.refresh(); store.when("credits_test").approved(function (product) { product.finish(); updatecreditspurchased(p.token, 1, product ints[0]); }); $(".btn").click(function() { store.order("credits_test"); }) i don't have validators on store object , use sandbox account testings. now reason product state "valid", on approved event before fire "finish" event , see in console log product stuck in queue.. any ideas? that correct behaviour have selected product type of consumable when finished, consumable product valid state, while other enter owned s

How to check for true condition in elasticsearch scripting? -

i have documents boolean field { "field1" : true } now want check, whether "field1" true or not, , run query if true. how can using scripts in elasticsearch? daniel's approach superior literally using scripts because faster, if had need within script, need check if value indexed 't' or 'f' in elasticsearch 1.x. in elasticsearch 2.x , above, lucene changed using more traditional 1 , 0 . es 2.x (and above): { "query" : { "bool" : { "filter" : [ { "script" : { "inline" : "doc['field1'].value == 1" } } ] } } } es 1.x: { "query" : { "filtered" : { "filter" : { "script" : { "script" : "doc['field1'].value == 't'" } } } } } it's bad idea ever use script unless required canno

android - Filtering RecyclerView cards when NavigationView menu item selected -

i have activity design support navigationview implementation. drawer has 3 menu items : home, sort x, sort y. activity displays recyclerview cards shows data list. list has objects have string tag ("x" or "y"). need sort recyclerview tag when respective menu item selected. myactivity activity: i npe when call setfilter method home fragment. public class myactivity extends appcompatactivity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); . . . init(); } private void init() { mdrawerlayout = (drawerlayout) findviewbyid(r.id.drawer_layout); mnavigationview = (navigationview) findviewbyid(r.id.navigation); mnavigationview.setnavigationitemselectedlistener(new navigationview.onnavigationitemselectedlistener() { @override public boolean onnavigationitemselected(menuitem menuitem) { home homefrag = new home(); mdrawerlayout.closedrawers();