Posts

Showing posts from February, 2013

How to refresh Wicket DataTable after submitting the Search button -

i refresh wicket datatable after submitting search button. here code: public class searchpanel extends panel { private static final long serialversionuid = 1l; private searchservice searchservice; public searchpanel(string id,final searchservice searchservice) { super(id); this.searchservice = searchservice; add(new searchform("searchform")); } private class searchform extends form { private static final long serialversionuid = 1l; private string searchstring; public searchform(string id) { super(id); add(new textfield("searchstring", new propertymodel(this, "searchstring"))); } public void onsubmit() { pageparameters params = new pageparameters(); searchservice.findbytitleproperty(params.get("searchstring").tostring()); } public string getsearchstring() { return searchstring;

Is it a bug that Java 8's HashMap misbehaves if the keys implement Comparable in a way that isn't consistent with equals? -

i know since java 8, if hashmap has enough hash collisions, , keys implement comparable , use balanced tree instead of linked list bin . can see, comparable interface does not require compareto() "consistent equals() " (though recommended). did miss something? seems new implementation allows hashmap violate requirements of map interface if keys happen have compliant, non-recommended comparable implementation. the following junit test exposes behaviour on openjdk 8u72: import static org.junit.assert.*; import java.util.hashset; import java.util.set; import org.junit.test; class foo implements comparable<foo> // comment out fix test case { private final int bar; private final int baz; foo(int bar, int baz) { this.bar = bar; this.baz = baz; } public boolean equals(object obj) { // note ignores 'baz' return obj instanceof foo && bar == ((foo) obj).bar; } public int h

c# - How to sort in EF parents by number of children of children of children? -

i have team s of coder s of project s of task s. how sort team s number of task s in entity framework using method syntax , code first approach (probably without loading whole collection contents of children of children, need sort only)? public class myappcontext : dbcontext { public dbset<cteam> teams { get; set; } // ...etc }   [table("team")] public class cteam { public int id { get; set; } [maxlength(128)] public string title { get; set; } [display(name = "coders")] public virtual icollection<ccoder> coders { get; set; } } [table("coder")] public class ccoder { public int id { get; set; } [maxlength(128)] public string name { get; set; } public virtual icollection<cproject> projects { get; set; } public int teamid { get; set; } public virtual cteam team { get; set; } } // cproject , ctask optionally, if give hint how raw sql should this, too. thanks! updat

scala - Impicit function can't be injected -

i have following code: case class number (value:int) and class calculator { def performcalc( input:number)(implicit calc: (number=>number) ) = calc(input) } now, when i, in specs2 test try this: class calculatortest extends mutable.specification { "calculator" should { "* accept explicit calculation parameter" in { implicit val addtwelve = (input: number) => number(input.value + 12) val calc = new calculator() val result = calc.performcalc(number(4)) result must beequalto(16) } } } i expected 'addtwelve' function injected implicitly parameter of performcalc. however, following failure: error:(49, 42) ambiguous implicit values: both method $conforms in object predef of type [a]=> <:<[a,a] , value addtwelve of type nl.example.number => nl.example.number match expected type nl.example.number => nl.example.number val result = calc.performcalc(number(4))

navigation drawer - Android Hamburger Icon Doing Nothing -

i have been able show "hamburger" icon on toolbar, when click on it, nothing happening... way bring drawer slide left.. here's code: @override public void oncreate(bundle savedinstancestate){ super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); mtoolbar = (toolbar) findviewbyid(r.id.my_toolbar); setsupportactionbar(mtoolbar); getsupportactionbar().setdisplayshowhomeenabled(true); getsupportactionbar().sethomebuttonenabled(true); mdrayerlayout = (drawerlayout) findviewbyid(r.id.drawer_layout); mdrayerlayout.setdrawershadow(r.drawable.drawer_shadow, gravitycompat.start); mdrawerlist = (listview) findviewbyid(r.id.left_drawer); mdrawerlist.setadapter(new arrayadapter<>(this, r.layout.drawer_list_item, test)); mdrawerlist.setonitemclicklistener(new drawerlistclicklistener()); mdrawertoggle = new actionbardrawertoggle(this, mdrayerlayout, r.string.navigation_drawer_open, r.string.navigation

android - webview across the platform. Architect View? -

i have c,linux background less knowledge web application. came across strange requirement, , finding difficult providing solution. requirement in short: one code/multiple platforms[ mobile desktop] what know: 1) ui front. webview provided across mobile, desktop applications. [ atlease know for: ios, mac, in windows/linux/mac qt ]. conclusion: can have html5 code, can utilized across desktop/mobile platform. problem: how native access html/javascript. go phonegap supports mobile, not desktop [ correct me if wrong]. , if go qt, not support android/ios [ correct me if wrong]. 2) writing middle layer in c++: ios/windows/mac/android supports c++. question: in ios/android know how bring webview using xcode. how can webview in windows , mac. in short, have open source framework supports mac/windows/ios/android is possible write our own native function invoke mechanism javascript c++ code, common. kindly suggest. answer : you can lau

JavaScript closure inside loops – simple practical example -

var funcs = []; (var = 0; < 3; i++) { // let's create 3 functions funcs[i] = function() { // , store them in funcs console.log("my value: " + i); // each should log value. }; } (var j = 0; j < 3; j++) { funcs[j](); // , let's run each 1 see } it outputs this: my value: 3 value: 3 value: 3 whereas i'd output: my value: 0 value: 1 value: 2 what's solution basic problem? well, problem variable i , within each of anonymous functions, bound same variable outside of function. what want bind variable within each function separate, unchanging value outside of function: var funcs = []; function createfunc(i) { return function() { console.log("my value: " + i); }; } (var = 0; < 3; i++) { funcs[i] = createfunc(i); } (var j = 0; j < 3; j++) { funcs[j](); // , let's run each 1 see }

lotus domino - Number of Notes.ini variable in each release? -

can 1 tell me exact list of notes.ini variables every notes/domino release ? got list based on category when searched in google. link i'm not aware of public definitive list beyond have linked. you can check following site notes.ini settings added against public sprs. http://www-10.lotus.com/ldd/fixlist.nsf/notes.ini?openview also may find others looking " ask professor ini " in developerworks (very old though, no recent ini settings).

Installing phpsh on linux, Python error -

i'm trying install phpsh on ubuntu , did on install guide, getting error: starting php traceback (most recent call last): file "/usr/local/bin/phpsh", line 47, in <module> verbose=opts.verbose) file "/usr/local/lib/python2.7/dist-packages/phpsh/__init__.py", line 503, in __init__ self.php_open_and_check() file "/usr/local/lib/python2.7/dist-packages/phpsh/__init__.py", line 641, in php_open_and_check self.php_open() file "/usr/local/lib/python2.7/dist-packages/phpsh/__init__.py", line 698, in php_open preexec_fn=os.setsid) file "/usr/lib/python2.7/subprocess.py", line 679, in __init__ errread, errwrite) file "/usr/lib/python2.7/subprocess.py", line 1259, in _execute_child raise child_exception oserror: [errno 2] no such file or directory why getting these errors? how install phpsh on linux? open ~/.bashrc terminal using: linux@terminal:vi ~/.bashrc set pythonp

send php table to an email address -

i have table in php format retrieved sql database, records display in table format, want mail records retrieved database here php code $productlist $sql =mysql_query("select * products id in(".implode(",",$where).")") $productcount=mysql_num_rows($sql); if ($productcount > 0) { while($row = mysql_fetch_array($sql)){ $id = $row["id"]; $product_name = $row["item_name"]; $price = $row["price"]; $productlist .= '<div class="coupon"> <table width="618" height="201" border="0"> <tr><td colspan="2" rowspan="4" align="left" valign="top">name '.$product_name.'" </td> <td> expires&nbsp;'.$expiry.'</td> <td width="129" bgcolor="#033b90">price '.$price.'</td> </tr> </table></div>'; is

ruby - Rails 5 Upgrade: No such middleware to insert after: ActionDispatch::ParamsParser (RuntimeError) -

i upgrading app rails 4.2 rails 5 beta1.1 in development. app worked before upgrade. have gone through basic upgrade steps (updating ruby, updating rails, , related steps at: http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html ). gemfile has been updated latest gems. when run $ rails middleware or $ rails console or $ rails server following error: no such middleware insert after: actiondispatch::paramsparser .../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/actionpack/lib/action_dispatch/middleware/stack.rb:108:in `assert_index' .../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/actionpack/lib/action_dispatch/middleware/stack.rb:80:in `insert_after' .../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/configuration.rb:69:in `block in merge_into' .../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/configuration.rb:68:in `each' .../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/l

maven - java.lang.IllegalStateException after adding rich faces libraries to pom.xml -

i trying run first jsf application using richfaces. unfortunately error below being thrown. there no bean added project. also, there's no tags added yet. trying run simple empty xhtml file. problem? i'm using eclipse luna 4.4.2, glassfish 4, , osx. 2016-02-03t00:34:59.661+0200|warning: standardwrappervalve[faces servlet]: servlet.service() servlet faces servlet threw exception java.lang.illegalstateexception @ com.sun.faces.context.facescontextimpl.assertnotreleased(facescontextimpl.java:712) @ com.sun.faces.context.facescontextimpl.getattributes(facescontextimpl.java:239) @ org.richfaces.context.extendedpartialviewcontext.setinstance(extendedpartialviewcontext.java:55) @ org.richfaces.context.extendedpartialviewcontext.release(extendedpartialviewcontext.java:64) @ org.richfaces.context.extendedpartialviewcontextimpl.release(extendedpartialviewcontextimpl.java:424) @ com.sun.faces.context.facescontextimpl.release(facescontextimpl.java:598)

php - For loop involving a range of dates -

i have date range in want process between each day. example between 2013-03-01 00:00:00 , 2013-04-01 00:00:00 there 31 days so loop this $date_next = $date_from; for($i=0;$i<31-1;$i++) { $date_next_str = new datetime($date_next); $date_next_1_str = new datetime($date_next); $date_next_1_str->modify("+1 day"); $date_next_1_str->modify("-1 second"); $date_next_1_str->modify("+1 day"); $date_next = $date_next_1_str->date; } so in first loop 2013-03-01 00:00:00 2013-03-01 23:59:59 however when assign $date_next_1_str->date $date_next @ end of loop, $date_next still shows 2013-03-01 23:59:59, supposed 2013-03-02 00:00:00. anyone can me this? in advance! you can quite using php's datetime , dateinterval , dateperiod objects:- $startdate = \datetime::createfromformat('y-m-d h:i:s', '2013-03-01 00:00:00'); $enddate = \datetime::createfromformat('y-m-d h:i:s', '201

android - Execution failed for task ':app:dexDebug'. 65K method limitation -

i when try build application. have 65k method limitation? have put in multidexenabled true under default config , compile 'com.android.support:multidex:1.0.0' under dependencies? agpbi: {"kind":"simple","text":"unexpected top-level error:","sources":[{}]} agpbi: {"kind":"simple","text":"java.lang.outofmemoryerror: java heap space","sources":[{}]} agpbi: {"kind":"simple","text":"\tat com.android.dx.ssa.ssabasicblock.\u003cinit\u003e(ssabasicblock.java:124)","sources":[{}]} agpbi: {"kind":"simple","text":"\tat com.android.dx.ssa.ssabasicblock.newfromrop(ssabasicblock.java:147)","sources":[{}]} agpbi: {"kind":"simple","text":"\tat com.android.dx.ssa.ssamethod.convertroptossablocks(ssamethod.java:173)","sources":[{}]} agpbi: {&q

Apache Storm - Kinesis Spout throwing AmazonClientException backing off -

2016-02-02 16:15:18 c.a.s.k.s.u.infiniteconstantbackoffretry [debug] caught exception of type com.amazonaws.amazonclientexception, backing off 1000 ms. i tested , put using streams , requests - both worked flawless. have 3 variants batch, storm , spark. spark - used kinesisstreams - working batch: can , put - working storm: planning use kinesisspout library kinesis. failing no clue. final kinesisspoutconfig config = new kinesisspoutconfig(streamname, zookeeperurl); config.withinitialpositioninstream(ipis); config.withregion(regions.fromname(regionname)); config.withcheckpointintervalmillis(integer.parseint(checkinterval)); config.withzookeeperprefix("kinesis-zooprefix-" + name); system.setproperty("aws.accesskeyid", key); system.setproperty("aws.secretkey", keysecret); systempropertiescredentialsprovider scp = new systempropertiescredentialsprovider(); final kinesisspout spout = new kinesisspoutconflux(config, scp, new clientconfiguration()); wh

jpa - datanucleus + postgresql + jpql error in simple update clause -

i have tried fix 6 hours now, , couldn't life of me figure out. i'm using : datanucleus 3.2.1, jpa postgresql 8.4.4 on x86_64-unknown-linux-gnu, compiled gcc gcc (gcc) 3.4.6 20060404 (red hat 3.4.6-10), 64-bit postgres jdbc driver version : 9.1-901.jdbc4 i'm trying execute simple update query through jpql. query : update myclass x set x.recordstatus='0' x.token='1234' my code looks : string updateclause = "update myclass x set x.recordstatus='0' x.token='1234'"; entitymanager entitymanager = getdefaultentitymanager(); query query = entitymanager.createquery(updateclause); query.executeupdate(); entitymanager.close(); the problem have error thrown driver caused by: org.postgresql.util.psqlexception: error: column "a0" of relation "my_class" not exist position: 42 @ org.postgresql.core.v3.queryexecutorimp

java - Duration does not support DAYS contrary to class documentation -

in java.time framework of java 8 , later, duration class says: this class models quantity or amount of time in terms of seconds , nanoseconds. can accessed using other duration-based units, such minutes , hours. in addition, days unit can used , treated equal 24 hours, ignoring daylight savings effects. yet when call get method , pass chronounit.days , exception thrown. localtime start = localtime.of ( 0 , 0 , 0 ); // first moment of day. localtime stop = localtime.of ( 2 , 0 , 0 ); // 2 am. duration duration = duration.between ( start , stop ); long days = duration.get ( chronounit.days ); exception in thread "main" java.time.temporal.unsupportedtemporaltypeexception: unsupported unit: days am misunderstanding something, or misusing classes? documentation get on duration class. gets value of requested unit. returns value each of 2 supported units, seconds , nanos. other units throw exception. however, duration class has method

c# - WPF DataGrid begin editing on Double Click not Single Click -

i have wpf datagrid text columns editable. able drag-drop them , place them in different view. unfortunately, if row has selection , try drag it, enters edition mode instead... rather enter edition mode on double click, single click on row can used start drag. currently, work around never select row before dragging it i saw couple of similar questions, none addressing problem. // theres million ways i'd rather public class doubleclickeditdatagrid : datagrid { protected override void oncanexecutebeginedit(canexecuteroutedeventargs e) { if (e.parameter mousebuttoneventargs) { if ((e.parameter mousebuttoneventargs).clickcount <= 1) { e.canexecute = false; return; } } base.oncanexecutebeginedit(e); } }

rabbitmq - How can I minimise connections with django-celery when using CloudAMQP through dotcloud? -

after spending few weeks getting django-celery-rabbitmq working on dotcloud have discovered dotcloud no longer supporting rabbitmq. instead recommend cloudamqp. i've set cloudamqp per tutorials: http://docs.dotcloud.com/tutorials/python/django-celery/ http://docs.dotcloud.com/tutorials/more/cloudamqp/ http://www.cloudamqp.com/docs-dotcloud.html and service works fine. however, when not have processes running, cloudamqp says there 3 connections. i had @ docs , ( http://www.cloudamqp.com/docs-python.html ) celery it's best set broker_pool_limit = 1 i have done connections remain @ 3. idea how can reduce number of connections 0 when app not in use? minimise number of connections ensure remain within quota?

linux - Averaging lines without awk using bash -

i'm starting use bash, , i'm having difficulties bash arithmetic. lets have cities 3 temperatures, , i'd average temperatures without using awk command. how can this? i've done awk, i'm practicing different techniques. # citytemp.txt 4 cities, 3 day's temperatures toronto 20 25 30 miami 80 80 110 london 40 20 60 new york 5 10 15 lets i'm trying write script output: 25 toronto 90 miami 40 london 10 new york i've done piping , awk command, i'm having problems doing without using awk. again, i'm new this. tried loop, didn't know doing. ---edit 1: benjamin w. i'm editing again, right i'm playing loop: #!/bin/bash in $(cat $1) echo "i is: ${i}" done < $1 this is, maybe obviously, printing every field citytemp.txt 1 @ time. ---edit 2: this ending attempt while read -a rows total=0 sum=0 in "${rows[@]}" sum=`expr $sum + $i` total=`expr $total + 1` do

java - How to get all fields along with value of Composite object? -

i facing issue value of fields of class reflaction. i have 1 class can have number of fields, number of classes , classes in turn can have number of fields, below public class a{ string string; int number; hashmap<string,string> map; b bclass; } above b again class member of class a. i want fields of type string , their's values , if field class if field class again, fields , values , example, map property of type hashmap class type need both key , value properties of string type. please see code snippet solve above problem private void extractstringfields(object object) throws illegalaccessexception { (field field : object.getclass().getdeclaredfields()) { field.setaccessible(true); system.out.println("filesd : "+field.getname()); object value = field.get(object); if (field.gettype().equals(string.class)) { system.out.println(field.getname() + "=" + value); }

How to load multiline JSON in spark with Java -

i looking way load multiline json spark using java. spark sqlcontext has methods load json, supports "one record per line". have multiline json file need process. example input: json contains words, definitions , example sentences : { "one-armedbandit": [ { "function": "noun", "definition": "slot machine", "examples": [ ] } ], ... } the spark ingestion methods indeed accept json-line format . consider using json processor convert data format before processing.

Trying to read titles from urls in google spreadsheet -

i've created function call title of given url google spreadsheets. now, seems inconsistent refresh code , works , following error same url worked previously: typeerror: cannot read property "title" undefined. i mean, links have titles not sure means? works, doesn't.. function grabtitle(url) { var response = urlfetchapp.fetch(url); var doc = xml.parse(response.getcontenttext(),true); var title = doc.html.head.title.gettext(); if (title == '') { return "unknown"; } else { return title; } }

json - On Android, how to read the exact text of a file, when one finishes with a newline, and another doesn't -

this related situation find myself in working saving text files in unity on android, reading them in native android. one of files read hmacmd5 signature, created code, byte[] bdata = system.text.encoding.utf8.getbytes (data); byte[] bkey = system.text.encoding.utf8.getbytes (key); using (hmacmd5 hmac = new hmacmd5(bkey)) { byte[] signature = hmac.computehash (bdata); return system.convert.tobase64string (signature); } and written phone with, public static void savetext (string path, string data) { using (filestream fs = new filestream(path, filemode.create)) { using (streamwriter sw = new streamwriter(fs)) { sw.write (data); } } } the other string we're saving json string dump. signature has newline character @ end of string, json string doesn't. know can manually add one, question reading accurate file contents. on android, based on previous answers, read file with, string readfile(file file) { stringbuilder tex

coffeescript - Is is possible to load .coffee script file to browser and execute? -

i trying load coffee script inside sample.coffee file along coffee-script.js file , perform simple operations on html. not able load sample.coffee file. <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="sample.coffee" type="text/coffeescript"></script> <script src="coffee-script.js" type="text/javascript"></script> </head> <body> </body> </html> here coffeescript code inside sample.coffee message = "welcome coffeescript" alert message i referred blog http://forgivingworm.wordpress.com/2010/09/27/running-coffeescript-in-browser/ i trying run in mvc4 project on .cshtml. running under ms world. i not sure if possible or not? insight appreciated. i dont think work tried it. need requirejs , coffeescript loader @ https://github.com/jrburke/require-cs . h

design - Parsing delimited files and creating a hash that excludes certain fields -

i have inherited application that, in part, handles processing many large delimited files , merging them database. in order speed process of chugging through these files, create file stores md5 of each file. once file comes in next day, compare md5 value of row being parsed set object contains md5 values gathered last time processing occurred. works great, , reduced amount of time upload our database 99%. except 1 ridiculous, , rather large (300mb), file. 1 has timestamp of when file created first record in each row. it's dumb, , cant ask sender change format. my question not how deal problem @ low level, though suggestions welcome! this app running in linux environment, , run this... cut -f 2- -d"|" stupid_file.dat | awk '{fs="|"; print $0}' > file.dat ...and on merry way processing file. plan if thread doesn't work out. what hoping higher level answer on different ways approach problem. language agnostic.the setup have "defi

google app engine - No matching distribution found for antlr-python-runtime -

pip install google_appengine collecting google-appengine using cached google-appengine-1.5.1.tar.gz collecting pyyaml (from google-appengine) using cached pyyaml-3.11.tar.gz collecting webob==0.9 (from google-appengine) using cached webob-0.9.tar.gz collecting ipaddr (from google-appengine) using cached ipaddr-2.1.11.tar.gz collecting antlr-python-runtime (from google-appengine) not find version satisfies requirement antlr-python-runtime (from google-appengine) (from versions: ) no matching distribution found antlr-python-runtime (from google-appengine) pip shows available doesn't install it: pip search antlr antlr4-python-alt - alternative python runtime antlr 4 antlr_python_runtime - runtime package antlr3 antlr4-python3-runtime - antlr 4.5.2.1 runtime python 3.4.0 antlr4-python2-runtime - antlr 4.5.2.1 runtime python 2.7.6 installed: 4.5.2.1 (latest) pip install antlr_python_runtime collecting antlr-python-runtime not find version sa

javascript - Using TimePicker or Datepicker in Durandal template project -

i new durandal. have tried of adding time picker project follows. schedule.js code: define([], function (require) { var script = require('jquery.pttimeselect'); var app = require('durandal/app'); var vm = { viewattached: viewattached, }; return vm; function viewattached(view) { $(view).find('#sample1').pttimeselect(); //$('#sample1').pttimeselect(); console.log("activated schedule module"); return true; } }); here jquery.pttimeselect time picker js file. need add jquery.pttimeselect.js here or else. schedule.html : <section> <p> <label>start</label><br /> <input id="sample1" class="ui-widget-content" name="s1time2" value="" /> </p> </section> problem facing getting basic time picker @ bottom of page. not getting add js , css files project. please new this. i using timepicker following link htt

ios - No such file location - Uploading image from Swift to S3 -

i trying upload image amazon s3 getting following error: optional(error domain=nscocoaerrordomain code=260 "the file “asset.jpg” couldn’t opened because there no such file." userinfo={nsfilepath=/asset.jpg, nsunderlyingerror=0x7fb0d8eb3b00 {error domain=nsposixerrordomain code=2 "no such file or directory"}}) the below code getting image or videos file path - stored in variable 'filelocation': func imagepickercontroller(picker: uiimagepickercontroller, didfinishpickingmediawithinfo info: [string : anyobject]) { //let mediatype2 : uiimage = info[uiimagepickercontrolleroriginalimage] as! uiimage let mediatype : cfstring = info[uiimagepickercontrollermediatype] as! cfstring //if video - save if mediatype == kuttypemovie { let path = (info[uiimagepickercontrollermediaurl] as! nsurl).path if uivideoatpathiscompatiblewithsavedphotosalbum(path!) && savevideovar == true{ uisavevideoatpathtosavedphotosa

javascript - TCPDF open links in new tab/window -

how open links in new tab/window in pdf document. tried target="_blank" did not work. found javascript solution on internet. how can use javascript in tcpdf. i tried following: $text = 'bla bla bla bla bla bla bla bla<br>'; $url = "http://google.com"; $links = ' <a href="javascript:open_win('.$url.');">click me</a> <a href="'.$url.'" target="_blank">click me</a> '; $output = $text.$links; $pdf->writehtml($output); but did not work. use below method <a href="javascript: w=window.open('yoursite.com/linktothepdf.pdf'); w.print(); w.close(); ">​​​​​​​​​​​​​​​​​print pdf</a>

linq - How to find where the records exists in the array or not using c# -

i having array of elements , records. want display records contains records in array. for eg: array contains: [1,2,3] records contains: [1,2,3,4,5,6,7,8,9,10] i want display 1,2,3 records. how compare in c# sorry english. assuming using linq query: int[] array = new[] { 1,2,3 }; var record1 = new[] { 1,2,3,4,5,6,7,8,9,10 }; var record2 = new[] { 4,5,6,7,8,9,10 }; var records = new[] { record1, record2 }; // return record if @ least 1 record in array matched var result1 = r in records array.any(a => r.contains(a)) select r; // return record if items in array matched var result2 = r in records array.all(a => r.contains(a)) select r;

python - SQLAlchemy Turning Floats Into Strings in SQL? -

i have model looks this: class property(base): __tablename__ = 'property' id = column('id', integer, primary_key=true, autoincrement='auto') name = column('name', string(255)) growth = column('growth', float(2)) in mysql, growth column of type float(6,2). when query on name, match fine. prop_obj = session.query(property).filter(property.name == fund_dict['name']) if add float property, growth, filter() clause not able match in db. prop_obj = session.query(property).filter(property.name == func_dict['name'], property.growth == func_dict['growth']) per sqlalchemy docs, when print out sql statement, see this: >>> statement = prop_obj.statement >>> print(statement.compile(dialect=mysql.dialect())) select `property`.`id`, `investment`.`name`, `property`.`growth` `property` `property`.`name` = %s , `property`.`growth` = %s does %s indicate substitution that's occurri

proxy - Disable firefox from loading content from the internet -

i looking view source html files in firefox, have downloaded. not want browser download files when opening html (e.g. images etc). easiest way of preventing firefox begin able access internet? i suspect setting proxy values, can't figure out. easiest way avoid disable network adapter. have tried before changing proxy settings , have found in instances if proxy server couldnt found firefix try connecting directly.

NPE while executing jetty websocket servlet on GAE -

am working chat app using jetty websocketservlet. when executing application, eclipse console displaying null pointer exception same in url jetty 8.1.9.v20130131 web socket issues .even though using jetty jars version 8.1.10 still facing error. can me solve this. thanks in advance.

android deprecated camera class -

i'm using deprecated android camera object. read here: https://source.android.com/devices/camera/versioning.html that though camera object deprecated should still work android 5.0+ version. ask this, because released app uses deprecated camera object , friends downloaded app , crashes. reported errors , see in trace stack camera can't open. app works on phone , phone version 5.0+. maybe i'm not opening camera correctly??? or maybe phones can't use deprecated class. here's code opening camera: @override public void onresume() { super.onresume(); if(!stoptouch)//ignore condition not relevant problem startupcam(); } private void startupcam() { if(faceproc==null)//ignore faceproc = facialprocessing.getinstance(); camera=camera.open(getcid()); //crashes here!!! calls getcid() defined below camera.setpreviewcallback(this); initpreview(width, height); startpreview(); starttimer(); } priv

android - Calling a method in a Java object from JNI returns error -

i know there many questions asked before, cannot figure out why code not working. have simple class stores string: public class jnistring { private string mstring; public jnistring() {} public string getstring() { return mstring; } public void setstring(string s) { mstring = s; } } my jni code (in c), supposed take jnistring object argument, call setstring() function store data, , return integer: jniexport jint jnicall java_com_sample_myclass_test(jnienv *env, jobject thiz, jobject jnistring) { jclass clazz = (*env)->findclass(env, "com/sample/jnistring"); jmethodid methodid = (*env)->getmethodid(env, clazz, "setstring", "(ljava/lang/string;)v"); jstring placeholder = (*env)->newstringutf(env, "placeholder"); (*env)->callvoidmethod(env, clazz, methodid, placeholder); return 1; } and java code: jnistring jnistring = new jnistring(); // call test() jn

javascript - Dropping Spine.js into an existing app? -

i've been looking @ quite few of mvc javascript frameworks lately , quite overall feel of spine.js fact using coffeescript. said, primary concern @ stage need able drop mvc framework iteratively large existing application. of documentation have seen on spine.js focuses on creating new applications. does have suggestions on best way go doing this; if there tutorial somewhere great too, google not friend on one. or bad idea , should go elsewhere when dealing legacy? while angular didn't click me in same way; did seem pretty straight forward on how use iteratively legacy application. i think it's rather bad idea "iteratively". i'm working freelancer company decided complete ui rework splited on few releases. in first stage planned drop existing js , use spine js mvc , require js amd. far - process "iteratively". project/app quite complex , took on half year (i'm involved since 2,5 months). it big mistake leave existing js , &

html - Finding the src of an image via Javascript -

i found answer question via simple google search, although, there slight problem ran into. so far, have image on html page id of newavatar. attempting find image via id, , save it's source variable, xml document used later on. when save source variable, or alert checking purposes, displaying full source, unusual. example, running site on wamp server, variable saving as: http://localhost/uploads/newuploadedimage.jpg when in reality, source should plain , simple, uploads/newuploadedimage.jpg the image tag is <img src="uploads/newuploadedimage.jpg" width="60px" height="60px;" id="newavatar"/> the way checking source is alert(document.getelementbyid('newavatar').src); any idea how rid of first lot of junk? all appreciated! by using @davidthomas comment before, managed working. changed alert to: alert(document.getelementbyid('newavatar').getattribute('src'));

Why the _directory function is called four times in a yeoman.generators.Base subclass? -

here how extend yeoman generator base class module.exports = yeoman.generators.base.extend({ prompting: function () { var done = this.async(); // have yeoman greet user. this.log(yosay( 'welcome cool ' + chalk.red('generator-zeetings') + ' generator!' )); var prompts = [{ ... }]; this.prompt(prompts, function (props) { this.props = props; // ... done(); }.bind(this)); }, _directory: function (source, destination) { // simplified question var src = path.join(source, 'index.html'); var dest = path.join(destination, 'final.html'); console.log('copy ' + src + ' ' + dest); this.fs.copytpl( this.templatepath(src), this.destinationpath(dest), this.props ); }, prepareapp: function () { this._directory(this.templatepath(), this.destinationroot('app')); }, preparedata: function (

Error:No such property: manifestPlaceholders for class: com.android.build.gradle.managed.ProductFlavor -

i use 'gradle-experimental:0.4.0' , want use onesignal sdk project. when try build project code have been mentioned in example here error: error:no such property: manifestplaceholders class: com.android.build.gradle.managed.productflavor. code in sample android { defaultconfig { manifestplaceholders = [manifestapplicationid: "${applicationid}", onesignal_app_id: "bbbbbb-324f-34fd-bed1-df8f05be55ba", onesignal_google_project_number: "11111111"] } } code in project model { android { compilesdkversion = 23 buildtoolsversion = "23.0.2" defaultconfig.with { applicationid = "com.myproject.company" manifestplaceholders = [manifestapplicationid: "${applicationid}", onesignal_app_id: "234jfi4-2342-4a23-234-24235436546&qu

Insert new row into a section of UITableView based on selected row in UIPickerView - Swift -

Image
i have custom inline uipickerview (essentially expanding/collapsing uipickerview) , there 3 options (rows) in picker view: "weekly", "monthly" , "enter manually". trying accomplish if user chooses row "enter manually", new row inserted below row containing custom uipickerview (which contain custom textinputcell have created - thats aside matter). uitableview represents form user can create "event" speak. there 4 sections , each section has different amount of rows, rows have expanding/collapsing uipickerviews , others have custom uitextfields, , others have expanding/collapsing uidatepickers. want happen 1 particular uipickerview, cannot seem working. had tried in didselectrowatindexpath when uipickerview collapsed selecting it's row: tableview.beginupdates() if(cell.iskindofclass(pickercell)) { let pickertableviewcell = cell as! pickercell if(!pickertableviewcell.isexpanded() && pickertableview

sql - Oracle keep unique constraint index -

when drop unique column (just unique not primary key) constraint, toad prompts me whether if want keep index. to me logical thing remove index why offer keep ? saving time if make same column unique @ later point in time ? (which kind of confuses me since old index may cause conflicts). as of 10g, oracle introduced "keep index" option on alter table...drop constraint . i've read, should other way around...in should drop index unless specify "keep index". assuming removed index via gui menus. with in mind, toad gui designed prompt that. wonder if ran alter table...drop constraint if still prompt you. going bet "not."

openlayers - show/hide kml on defined zoom levels -

i´m trying hide/show own kml files (polygons) depending on zoom levels in openlayers - when reached zoom level 1 layer should hide , show. far found solution ( how load layers depending on zoom level? ), doesn´t seem working in case. i´m relatively new javascript , don´t know if i´m using right, made changes example: map.events.register("zoomend", map, zoomchanged); //inserted in function init() function zoomchanged() { if (map.getzoom() == 18) { kml1.setvisibility (true); kml2.setvisibility (false); } else if (map.getzoom() == 19) { kml1.setvisibility (false); kml2.setvisibility (true); } } i tried solution hide kml1, in case layer isn´t drawn. layerswitcher works - layer unselectable in defined zoom levels, nothing visible when zoomed out (when layer selectable): var kml1 = new openlayers.layer.vector("prehled", {minscale: 1000,}, //1:10