Posts

Showing posts from September, 2015

What is the default typeface of the app bar text in Android? -

Image
the typeface of text default app bar isn't of typefaces available default -- compared of them visually app bar text , none of them matched. style i'm comparing theme.appcompat.light.darkactionbar . idea how text default text in app bar? here's i'm talking about: *text on left default app bar text , text on right default android text (sans-serif), bold -- of few typefaces available default, closest default app bar text *sans-serif not bold thin seems roboto medium 20sp according this info.

python - subprocess.Popen and relative directories -

i writing script open notepad.exe using subprocess.popen() import subprocess command = '%windir%\system32\\notepad.exe' process = subprocess.popen(command) output = process.communicate() print(output[0]) this throws filenotfounderror is possible change/add above code make work relative paths? did try run script c:\windows> after moving there, again failed. set shell=true, failed well. writing similar script using os.popen() works ok relative paths, regardless directory script run from, far understand popen not way forward.. early steps in world of programming/python. input appreciated. use os.path.expandvars expand %windir% : command = os.path.expandvars('%windir%\\system32\\notepad.exe') the result path can passed subprocess.popen . subprocess.popen not expand environment variables such %windir% . shell might should not depend on shell=true that.

java - order dependency (topological sort) with input of string -

https://leetcode.com/problems/course-schedule-ii/ question similar 1 instead, has input of string instead of numbers. following classes , sample test case , signatures. wondering how deal input of string import java.util.*; class order{ string order = ""; public order(string string){ this.order = string; } } class orderdependency{ order cur; order pre; public orderdependency(order o1, order o2){ cur = o1; pre = o2; } } public class order_dependency { public static list<order> getorderlist(list<orderdependency> orderdependencies){ ***code starts here*** } public static void main(string[] args) { order o1 = new order("a"); order o2 = new order("b"); order o3 = new order("c"); order o4 = new order("d"); orderdependency od1 = new orderdependency(o1, o2); orderdependency od2 = new orderdependency(o2, o3); ...

bash - Java Runtime exec() not working -

i try execute shell command via java this if (program.isplatformlinux()) { exec = "/bin/bash -c xdg-open \"" + file.getabsolutepath() + "\""; exec2 = "xdg-open \"" + file.getabsolutepath() + "\""; system.out.println(exec); } else { //other code } runtime.getruntime().exec(exec); runtime.getruntime().exec(exec2); but nothing happens @ all. when execute code prints /bin/bash -c xdg-open "/home/user/desktop/file.txt" in console, not open file. have tried call bash first , xdg-open -command, there not change. what's problem here , how can solve this? edit: output of calling looks this: xdg-open "/home/user/desktop/files/einf in a- und b/allg fil/ref.txt" xdg-open: unexpected argument 'in' but seeems strange me - why command seperatet before in entire path set in quotation marks? please note don't need xdg-open this. can use java platform-agnosti...

javascript - Error While minifying app stylesheet -

i problem when run meteor build project. i checked github issue may need comment out line behavior: url(#default#vml); but don't know file line in? while minifying app stylesheet: path.js:8:11: path must string. received null @ assertpath (path.js:8:11) @ object.posix.relative (path.js:496:3) @ pathrelative (packages/minifier-css.js:449:30) @ packages/minifier-css.js:408:31 @ array.foreach (native) @ function._.each._.foreach (packages/underscore.js:139:11) @ packages/minifier-css.js:365:7 @ array.foreach (native) @ function._.each._.foreach (packages/underscore.js:139:11) @ rewriterules (packages/minifier-css.js:342:5) @ object.csstools.rewritecssurls (packages/minifier-css.js:328:5) @ packages/minifier-css.js:298:16 @ array.foreach (native) @ function._.each._.foreach (packages/underscore.js:139:11) @ object.csstools.mergecssasts (packages/minifier-css.js:275:7) @ mergecss (packages/minifier-postcss/plugin/minify-css....

Change Attachment Icon on Data Entry Form in Access 2016 -

so have data entry form "new employees" on access 2016. want include attachment employees image. in property sheet - have 3 options display data field attachment. display as: 1. image/icon 2. icon or 3. paper clip. first 2 options display blank box (you can click on dialog box click attachment). image/icon , icon options yes both functionally work both seem, inefficient. other option, paper clip, literally paperclip image , (0) functionally works (even better 1. 2. directly goes attachment dialog box) attachment dialog box when open it, visually unappealing. i want button when click on it, attachment dialog box opens , saves field value in place indicate. open other ideas. please advise.

swift - how can I use constraints on a group of elements in storyboard in ios? -

Image
in uistoryboard have following situation: a uiviewcontroller 2 elements - button , label. text on each component fetched localized.strings, has different length each time user chooses different language. in code have: mybutton.settitle("textonbutton".localized(), for: .normal) mybutton.sizetofit() txtlabel.text = "txt".localized() how should attach constraints 2 elements - when grouped - in center? example: this not in middle: this in middle: if 1 element, attach constraint midx , that's all, situation when there 2 elements? can - somehow - attach constraints group of elements? you can achieve of called stack view . in storyboard select both labels , click following button: in hierarchy notice both labels got wrapped inside stack view . have add horizontally in container and vertically in container constraints stack view. can add spacing between 2 labels in attribute inspector when stack view selected. result:

java - Kafka connect confluent elasticsearch sink (no class found error) -

i new kafka connect. want push messages kafka topic elasticsearch. after following available documentation.. downloaded , compiled elastic search sink release tar.zip ( https://github.com/confluentinc/kafka-connect-elasticsearch/releases ) i added elastic search properties file , included above jar in classpath. when run kafka connect in standalone mode error ./usr/bin/connect-standalone etc/schema-registry/connect-avro-standalone.properties etc/kafka-connect-elasticsearch/quickstart-elasticsearch.properties [2016-11-13 00:05:38,768] error task elasticsearch-sink-0 threw uncaught , unrecoverable exception (org.apache.kafka.connect.runtime.workertask:142) java.lang.noclassdeffounderror:io/searchbox/client/jestclientfactory @ io.confluent.connect.elasticsearch.elasticsearchsinktask.start(elasticsearchsinktask.java:81) @ io.confluent.connect.elasticsearch.elasticsearchsinktask.start(elasticsearchsinktask.java:52) @ org.apache.kafka.connect.runtime.workersinktask.initializean...

javascript - Clickable image in a lightbox on page loading -

i'm new on web developing. i need sample code displays clickable image in lightbox on page loading close button. also, if there's way, need show on desktop browsers (avoiding mobile), , display 5x per day per user ip. can help? thanks. all together, 1 file. <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <style> div{position:relative;box-sizing:border-box;} #overlay{position:fixed;top:0;left:0;right:0;bottom:0;background:black;opacity:0.7;z-index:1;} #lb{position:fixed;top:30px;left:20%;width:300px;height:300px;z-index:2;} #lb_hdr{height:30px;width:100%;overflow:hidden;background:#333;color:white;} #lb_hdr_title{float:left;height:100%;width:90%;padding:5px;} #lb_hdr_close{float:left;heig...

php - Converting query to parametrised query -

i have query on site , have been hacked because of it. i have spent 2 hours looking how convert query secure , have not got anywhere. if don't mind, please convert 1 me can see on rest? $camera_id = $_get['camera_id']; $cameras = mysqli_query($conn, "select * cameras id = $camera_id"); $camera = mysqli_fetch_array($cameras); try this. $camera_id = $_get['camera_id']; $cameras = mysqli_prepare($conn, "select * cameras id = ?"); mysqli_stmt_bind_param($cameras, $camera_id); $cameras->execute(); while making switch, switch straight away pdo. it's far better mysqli $db = new pdo('mysql:host=localhost;dbname=mydb', 'username', 'password'); $stmt = $db->prepare("select * cameras id = :camera_id"); $stmt->execute(array(":camera_id"=>$camera_id)); $result = $stmt->fetchall(); or instead of fetchall() while($row = $stmt->fetch(pdo::fetch_assoc)) { ...

angularjs - OrderBy in dirpaginate -

i have following code populate table:- <tr dir-paginate="user in newbillvalue|filter:search4|orderby:['bill_time','bill_id']|itemsperpage:10" pagination-id="newbills"> i want table ordered bill_time descending order , bill_id ascending order. how can done.

reactjs - React + react-router + typescript webpack production bundle issue -

i'm building app using react + react-router + redux + typescript + webpack, here's tsconfig.json: { "compileroptions": { "outdir": "./dist/", "sourcemap": true, "noimplicitany": true, "module": "commonjs", "target": "es6", "jsx": "react" }, "files": [ "./src/index.tsx" ] } and webpack.config.js looks like: var prod = json.parse(process.env.prod_env || '0'); ... module.exports = { ... plugins: prod ? [ new webpack.optimize.uglifyjsplugin({ compress: { warnings: false } }) ] : [], ... module: { loaders: [ // sass loader stylesheet. { test: /\.scss$/, loaders: ["style", "css", "sass"], exclude: /node_modules/ }, // files '.ts' or '...

python - How to use a CSV as input data for a Tensorflow neural network? -

i'm attempting write neural network changing mnist ml beginners code . have csv that's organized this: image_name |nevus? |dysplastic nevus?| melanoma? asdfgjkgdsl.png |1 |0 |0 an image name, , it's one-hot result. each image 1022 x 767, , i'd use color of each pixel input well. such, changed mnist code have 2,351,622 inputs (1022 pixels wide * 767 pixels high * 3 colors per pixel) , 3 outputs. # tensorflow.examples.tutorials.mnist import input_data # mnist = input_data.read_data_sets("mnist_data/", one_hot=true) def main(): x = tf.placeholder(tf.float32, [none, 2351622]) w = tf.variable(tf.zeroes([2351622, 3])) b = tf.variable(tf.zeroes([3])) y = tf.nn.softmax(tf.matmul(x, w) + b) y_ = tf.placeholder(tf.float32, [none, 3]) cross_entropy = tf.reduce_mean(-tf.reduce_sum(y_ * tf.log(y), reduction_indices=[1])) train_step = tf.train.gradientdescentoptimizer(0.5).minimize(cross_entropy) init ...

ios - Gamescene.sks and GameScene.swift don't seem to be linked in my project -

Image
i learning spritekit , started small project using level editor. however, gamescene.swift , gamescene.sks don't seem linked reason. below screenshots .sks file setup , small print statement in viewdidload of .swift file. please let me know doing wrong. or if missing something. the spritekit .sks file. my view controller's viewdidload function. class gameviewcontroller: uiviewcontroller { override func viewdidload() { super.viewdidload() let screensize = cgsize(width: uiscreen.main.bounds.width, height: uiscreen.main.bounds.height) gamecontroller.gamecontroller.setgamemanager(gameviewmanager: self); if let view = self.view as! skview? { // load skscene 'gamescene.sks' if let scene = skscene(filenamed: "gamescene") { // set scale mode scale fit window scene.scalemode = .aspectfill // present scene view.presentscen...

java - Getting null value when returned from actionListener -

i new java coding. please me in regard. in advance i wants display values derived mysql query combo box , select 1 of them through selecteditem , return selected value main function. // getserviceno method started here // java code populate jcombobox mysql database data // , returns selected value called program. import java.awt.flowlayout; import java.awt.event.*; import javax.swing.*; import java.sql.*; public class getserviceno extends jframe implements actionlistener { jframe frame = new jframe("select service"); private jcombobox jcb = new jcombobox(); jpanel panel = new jpanel(); jbutton jbtn = new jbutton("submit"); connection con; statement st; resultset rs; static string newserno; public getserviceno() { // getserviceno method started frame.setsize(350, 150); frame.setlayout(new flowlayout()); frame.setlocation(300,200); frame.setdefaultcloseoperation(jframe.exit_on_...

angularjs - Express serving index.html from Angular html5 mode not working -

i'm trying use html5 mode in angular js app sake of seo. however, faced problem express serving index.html request. deep linking didn't work , cannot refresh page. app.js app.use(servestatic(path.join(__dirname, 'public'))); app.use(servestatic(path.join(__dirname, 'node_modules'))); app.use(servestatic(path.join(__dirname, 'app_client'))); app.use('/api', routesapi); app.all('/*', function(req, res, next) { res.sendfile('./app_client/index.html', { root: __dirname }); console.log("send index"); }); i try many researches many sources, approach such app.get('/', function(req, res) { res.sendfile('index.html'); }); or router.get('/', function(req, res) { res.sendfile(path.join(__dirname, 'app_client', 'index.html')); }); or app.get('/*', function(req, res) { res.sendfile(__dirname + '/index.html') }); none seems work. know must wrong in ...

c# - SignalR not able to Authentication with Certificate -

i have read links refered non of them solve specific problem have. the issue not authentication in general, adding client certificate on client side , getting certificate on signalr server. far, not manage make work, there either server error or certificate on server null. if have working sample add client certificate on client side , getting on server, appreciate if send me that. **on client side have**: connection = new hubconnection(serveruri); var certificate = new x509certificate2(path); connection.addclientcertificate(certificate); hubproxy = connection.createhubproxy("myhub"); ***on server have config:*** <location path="signalr"> <system.webserver> <security> <access sslflags="sslnegotiatecert" /> </security> </system.webserver> </location> ***and certificate tried in hub*** public override bool authorizehubconnection(hubdescriptor hubdescriptor, irequest request) {...

python - Checking for arithmetic sequencing inside matrix without using numpy -

i'm wondering how can write function can determine if there's arithmetic sequence of length (this time four) in direction in matrix such that, if it's true, function returns list containing 4 coordinates (y,x) in matrix of occurrence of list. otherwise, returns nothing. see test below clarification. in mathematics, arithmetic progression (ap) or arithmetic sequence sequence of numbers such difference between consecutive terms constant. instance, sequence 5, 7, 9, 11, 13, 15 … arithmetic progression common difference of 2. p.s. location, components start vertical position first , horizontal 0 initial position both components in indexes. this how function tested. below function called as1. >>> as1([[1, 10, 18, 29, 2], [2, 7, 5, 6, 34], [21, 4, 3, 5, 2], [9, 1, 6, 10, 3], [16, -9, 9, 17, 4], [32, -6, 0, 26, 5]]) [[0, 1],[1, 1], [2, 1], [3, 1]] my attempt successful lists, not matrices: def as1(l):...

jwt - Call to undefined method Illuminate\Http\JsonResponse::validate() in Laravel 5.3 -

i implementing registration form using json post request , laravel 5.3 below controller settings <?php namespace app\http\controllers\auth; use app\user; use validator; use illuminate\http\request; use illuminate\http\response; use app\http\controllers\controller; use illuminate\foundation\auth\registersusers; class registercontroller extends controller { use registersusers; public function __construct() { $this->middleware('guest'); } protected function validator(array $data) { $data = $data['register']; $validator = validator::make($data, [ 'email' => 'required|email|max:255|unique:users', 'password' => 'required|min:6|confirmed', ]); if($validator->fails()) { $errors = $validator->errors()->all()[0]; //dd($errors); return response()->json(['errors'=>$errors]); } else { return $validator; } } protecte...

jquery - how manually set a vaule in a select2 which is fed from ajax call - laravel -

todo i trying set select2 value value fed ajax reqest. i have tried answers in these 2 threads: one two . my code: html: // blade {!! form::select('author_id', $author_array, @$auth_preset, array('class'=>'', 'id' => 'select_the_author', 'get-byajax' => 'author', 'ajax-target' => '#author_placeholder')) !!} // renders html (befere select2 initialization): (select author...) my js: $("select[get-byajax]").each(function(){ var baseurl = "{{url::to('get_by_ajax/')}}"; var itemkind = $(this).attr("get-byajax"); var readyurl = baseurl + '/' + itemkind; $(this).select2({ ajax: { url: readyurl, datatype: 'json', delay: 250, data: function (params) { ...

wordpress - How to delete dupliacte Woocommerce Products -

i have wordpress installation imported products in large database of products. installation supposed have 4436 products in it, reason when imported, made duplicates of of products. what can remove duplicates? have names , skus. http://update.pinkdynamite.co.uk/ if imported products duplicated, should find root cause. normal import, should not duplicated. my suggestion remove products , import again. to delete products @ 1 time, can use wp-cli. wp post delete $(wp post list --post_type='product' --format=ids) https://wp-cli.org/commands/post/delete/

javascript - Check local storage variable already present, if not create a new one -

i want create local storage variable checking present or not. if variable exist change variable name , create new one. not understand how it. please me this. thanks here code var vcount=1; var vname='session_'+vcount; while(localstorage.getitem(vname) === null) { vcount++; vname='session_'+vcount; //if variable name available create new variable } start count name , query local storage see if exists. if - increment count , save value loan storage. if not - doesn't exist save original. var vcount=1; var vname='session_'+vcount; var storedname= sessionstorage.getitem("vname"); if (storedname){ var vcount += 1; var vname='session_' + vcount; localstorage.setitem(vname, vname); //this increment number , set variable name } else { localstorage.setitem("vname", vname); }

javascript - Add Attribute to Three.js Object -

i want maintain information shapes i'm creating. use html canvas texture, know can keep values in element attributes arrays of canvases. i'm wondering though, there more straight-forward way of maintaining attributes works three.js shapes regardless of how constructed? the advantage (or problem) javascript, can objects. can add, or delete attributes as want time. thus, can add every property want 3 objects giving value : mythreeobject.myproperty = myvalue ; be careful though, if haven't assigned value property, property not exist (yet), thus, don't forget check if value exist before reading : if( "undefined" !== typeof mythreeobject.myproperty ) // ...

geometry - C++ : Modified Line Segment Intersection -

given n lines ( either horizontal or vertical ), need find total intersection of these line segments intersections per line. code follows : using namespace std; #define x second #define y first #define max 10000 typedef pair<int,int >point; struct event { point p1,p2; int type; event() {}; event(point p1,point p2, int type) : p1(p1), p2(p2),type(type) {}; //initialization of event }; int n,e; event events[max]; bool compare(event a, event b) { return a.p1.x<b.p1.x; } set<point >s; int hv_intersection() { ll count=0; (ll i=0;i<e;++i) { event c = events[i]; if (c.type==0) s.insert(c.p1);//insert starting point of line segment set else if (c.type==1) s.erase(c.p2);//remove starting point of line segment set, equivalent removing line segment else { (typeof(s.begin()) it=s.lower_bound(make_pair(c.p1.y,-1));it!=s.end() ...

Python 2.7 Inheriting Values from a Class which Inherits Values from User Input -

learning python , making program... have read docs , forums on inheritance, struggling wrap head around while trying implement it. can please me understand? i understand, think, inheritance user defined data class, implemented it. want have class inherit class inherits user defined data, second degree inheritance? i building program uses heavy math. have portion user define: angle, x0:x5, , y0:y5. have class calculate_xy_at_angle takes user defined data , calculates new x , y points. then have class take new x , y points , calculate ax:fx , ay:fy polynomial equation. code follows (i cut out code after x2... long , picture) my problem don't understand how values class calculate_xy_at_angle pass calculated values class abcdef_of_x? and once user defines data, how retrieve values last class? have do, in sense, pipeline started? ### placeholders user defined data angle = 30 x0 = 0 x1 = 1 x2 = 5 x3 = 7 x4 = 5 x5 = 1 y0 = 0 y1 = 5 y2 = 8 y3 = 9 y4 = 2 y5 = 0 cl...

python - Should we use options to get information that is not optional but we do that to make it look more intuitive? -

i trying write python program provide github features in cli creating issues, creating repos, creating prs, etc. i came github create issue --title <title> --description <description> --user <user> --repo <repo> i used argparse purpose import argparse parser = argparse.parser() parser.add_argument('create', options=['issue', 'repo', 'pull') action='store') parser.add_argument('--title', action="store", type=str) parser.add_argument('--description', action="store", type=str) parser.add_argument('--user', action="store") parser.add_argument('--repo') parser.parse_args('create issue --title title --description desc --user user --repo repo') i used options --title , --descriptions information in keyword form. while options meant optional, according style of parsing: if create issue --title , --d...

c# - Same code but getting different result -

when use below code getting different result on developer pc , remote server. string _qsdatetime = "12.11.2016 21:30"; var _countryzone = datetimezoneproviders.tzdb["tur"]; var _datepattern = localdatetimepattern.createwithcurrentculture("yyyy-mm-dd hh:mm:ss"); var _localtime = _datepattern.parse(_qsdatetime).value; var _localtime2targetzonetime = _localtime.inzonestrictly(_countryzone); var _targetzone2utc = _localtime2targetzonetime.withzone(datetimezone.utc).todatetimeutc(); _qsdatetime = _targetzone2utc.tostring("yyyy-mm-dd hh:mm:ss"); developer pc result is: " 2016-11-12 19:30:00" remote server result is: " 2016-12-11 19:30:00" remote server specs windows 2012 server english developer pc specs windows 7 turkish both of them regional date time setting same. why getting different result? i'm not too much familiar noda time have few things say: datetimezoneproviders.tzdb not have time zone id...

create png waveform from audio file with c++ then upload to php -

i have been reading lot developing function can output png image audio file using c++ , upload web server using php , later use on website similar how soundcloud used it. however, have come across no examples or documents on how this, , pretty baffled on start. i have fair amount of knowledge when comes php , , minor knowledge in c++ . i have found few js scripts job, however, canvas 's used draw out shape of waveforms must loaded when user lands on page, , on it's own drain on server, , takes way long on users end (hence reason want use png 's instead). wavesurfer example obviously not going easy feat, , i'm not expecting write out whole script this, able write out sample script me understanding on start?

jQuery mobile custom select menu not working when url has encoded parameters -

i have jquery mobile 1.4.5 custom select menu on page. if url has encoded parameters url gets appended id of menu , menu click event not show option menu popup. let me know solution please. not working when url below submitsecureform.aspx?encdata=jalt6qgrlgk%3d working when url below submitsecureform.aspx?encdata=jalt6qgrlgk= below how control looks <div class="ui-select"> <a href="#" role="button" id="ddl_institutionaccountnumber-button" aria-haspopup="true" class="ui-btn ui-icon-carat-d ui-btn-icon-right ui-corner-all ui-shadow"><span>[select one]</span></a> <select id="ddl_institutionaccountnumber" name="institutionaccountnumber" tabindex="-1"> <option value="0">[select one]</option> <option value="123456">val1</option> <option value="123457">val12</option> <option value=...

angularjs - Inner element (of type sting array) in scope object is not working with ng-repeat -

inner element (sting array) in scope object not working ng-repeat $scope.fakeoptions = ["option1","option2"]; $scope.question= { title: "new question title", options: ["option1","option2"], }; this not working <div ng-repeat="option in question.options" class="col-sm-3"> <input type="text" value="{{option}}" /> </div> where in case working <div ng-repeat="option in fakeoptions " class="col-sm-3"> <input type="text" value="{{option}}" /> </div> i new angular, in knockout using observable please assist. not sure what's going wrong works fine, see snippet below. note should use ng-model bind values inputs , shouldn't bind directly scope values, has little issue you're describing. angular.module("app", []).controller("ctrl", ...

c++ - stdin pipe not closing when read with Boost.ASIO -

i'm reading stdin using boost.asio, when pipe expect pipe close when input has been consumed. i.e. i'm doing @ commmand line: cat somefile.txt | myprog and i'd expect myprog see file close. instead waits forever. the code looks this: boost::asio::posix::stream_descriptor as_stdin(ios); { boost::system::error_code error; as_stdin.assign(dup(stdin_fileno), error); if ( error ) { exit(2); } } auto proc = [&as_stdinr](auto yield) { boost::asio::streambuf buffer; while ( as_stdin.is_open() ) { auto bytes = boost::asio::async_read_until(as_stdin, buffer, '\n', yield); if ( bytes ) { buffer.commit(bytes); std::istream in(&buffer); std::string line; std::getline(in, line); std::cerr << line << std::endl; } else { std::cerr << "no bytes read" << std::e...

devise - Why particular characters are hard coded to generate a secured token -

i trying understand philosophy behind harcoding particular characters in generating friendly token. thought process behind this https://github.com/plataformatec/devise/blob/master/lib/devise.rb#l481 def self.friendly_token(length = 20) # calculate real characters, must perform operation. # see securerandom.urlsafe_base64 rlength = (length * 3) / 4 securerandom.urlsafe_base64(rlength).tr('lio0', 'sxyz') end here in above snippet, l,i,o,0 getting replaced s, x, y, z respectively. other characters getting generated! example securerandom.urlsafe_base64(15) => "4-6rgwuh1sisflxa3c73" what r, g, w etc? the reason behind remove characters confusing. (hard distinguish) like o can confused 0 like l can confused i specific commit introduces explains in commit message https://github.com/plataformatec/devise/commit/6d65c28f1f709722dd86da49241f118813ea7090

The cache of elasticsearch? -

after read document of es ,there confusion it. doc_values built @ document index time on not text field,save data in disk. fielddata built @ query time,save data in memory.if field cached,when new docs has field add fielddata cache? doc_values , fielddata both cache ,are used when sorting on or computing aggregations on field? query cache ,only save query result,only same dsl can use it? es has other cache?

Find date sequence in PostgreSQL -

i'm trying find maximum sequence of days customer in data. want understand max sequence of days specific customer made. if enter app in 25/8/16 , 26/08/16 , 27/08/16 , 01/09/16 , 02/09/16 - max sequence 3 days (25,26,27). in end (the output) want 2 fields: custid | maxdaysequence i have following fields in data table: custid | orderdate(timestemp) for exmple: custid orderdate 1 25/08/2007 1 03/10/2007 1 13/10/2007 1 15/01/2008 1 16/03/2008 1 09/04/2008 2 18/09/2006 2 08/08/2007 2 28/11/2007 2 04/03/2008 3 27/11/2006 3 15/04/2007 3 13/05/2007 3 19/06/2007 3 22/09/2007 3 25/09/2007 3 28/01/2008 i'm using postgresql 2014. thanks trying: select custid, max(num_days) longest ( select custid,rn, count (*) num_days ( select custid, date(orderdate), cast (row_number() on (partition custid order date(orderdate)) varchar(5)) rn table_ ) x group custid, current_date -...

php - How to get country code or country prefix from a mobile number which doesn't contain country code -

i working on app gets phone number or without country code call or send sms. want know, there functionality / pattern can detect country code of number doesn't contain country code. for example have number: 1. 0167-xxxx-xxx 2. 0171-xxxx-xxx 3. 3212-xxx-xxx 4. 4808-xxx-xxx here, first 2 numbers bangladesh , last 2 numbers usa. so, there way determine / differentiate country numbers? so, there way determine / differentiate country numbers? no, can't , that's why country codes used.

asp.net - Difference between Yoeman generators for aspnet and aspnet-angular -

when install generators yeoman, go this. npm install --global generator-aspnet however, playing embedded menu system of yeoman, noticed lists other templates aspnet . 1 of them aspnet-angular . went webpage of less verbose learned nothing there. what difference between 2 generators: generator-aspnet , generator-aspnet-angular exactly? there difference (compared going first 1 , adding angular package manually npm)? nice thing on open source stuff can see access source code. following github repository in linked npm package, can see in generators/app/templates/controller/aboutcontroller.cs file following lines using system.web; using system.web.mvc; which tells us, it's generator legacy asp.net mvc (up mvc 5), because system.web.* namespaces have been removed asp.net core, since had tight coupling iis prevented asp.net core become portable , run w/o iis.

deserialization - Haskell: find out how many bytes a Get expression would consume -

i writing tool includes deserialization mechanism bachelor thesis, use get monad ( data.binary.get ). ran following problem: during deserialization, there part have getter of type get a , need read bytestring of length n , n amount of bytes consumed if ran getter @ position. in other words, need know how bytes getter consume without consuming them. there way this: readbytes :: -> bytestring readbytes getter = safe <- lookahead getremaininglazybytestring let info = rungetorfail getter safe -- n_cb = number of consumed bytes case info of right (_, n_cb, _) -> getlazybytestring n_cb but hideous beyond description. every time method called, copies entire remainder of file. even though doesn't seem hard problem in theory, , far monad has been capable of doing needed, cannot find better solution. i need know how bytes getter consume without consuming them. perhaps perform 2 cal...

How to express explicit and implicit rules in Snakemake? -

in order understand snakemake , want compare traditional makefile example snakemake. there nice introduction page make educational example prerequisites: # source: http://www.jfranken.de/homepages/johannes/vortraege/make_inhalt.en.html # declaration of variable clothes = coat shoes mobile sweater socks\ trousers shirt pants undershirt all: $(clothes) # explicit rule assigns commands several targets $(clothes): @echo put on $@; touch $@ # implicit rules state prerequisites coat: shoes mobile sweater shoes: socks trousers mobile: trousers sweater: shirt trousers: pants shirt shirt: undershirt # additional feature .phony: naked naked: ; @-rm $(clothes) i tried translate snakemake file, see end of post. works, have repeat touch command every article. tried copy make's approach distinguishung between explicit , implicit rules (using wildcards), didn't succeed. there more elegant way current one? # snakemake version of http://www.j...

sqlite - CakePHP v3 installation with SLQite, default web app can't find MySQL -

i'm on w7 32-bit platform. following installation instructions in http://book.cakephp.org/3.0/en/installation.html , , using builtin php server. default web app reports: database driver cake\database\driver\mysql cannot used due missing php extension or unmet dependency at stage in cake career, not know whether can rebuild default app, or how to. have configured php use pdo-sqlite not mysql, , used write app interrogates sqlite database via pdo. fixed it. looking configuration file in wrong place. right place <\my_app>\config\app.php, change driver name of sqlite driver , works.

estimation - Calculating audio pitch in MATLAB? -

yesterday finalised code detecting audio energy of track displayed on time, use part of audio thumbnailing project. however method can detect pitch of track displayed on time, have 2 options base research upon. [y, fs, nb] = wavread('three.wav'); %# load signal variable y framewidth = 441; %# 10 msec numsamples = length(y); %# number of samples in y numframes = floor(numsamples/framewidth); %# number of full frames in y energy = zeros(1,numframes); %# initialize energy frame = 1:numframes %# loop on frames startsample = (frame-1)*framewidth+1; %# starting index of frame endsample = startsample+framewidth-1; %# ending index of frame energy(frame) = sum(y(startsample:endsample).^2); %# calculate frame energy end that correct code energy method, , after researching, found need use discrete time...

Using Cookies to set an alert in javascript -

i'm trying create script when user opens site or welcomed prompt , after alert welcome entered in prompt set cookie 1 minute problems i'm facing are: 1. alert not show up 2. cookie not set function checkcookie() { var username=getcookie("username"); if (username!=null && username!="") { alert("welcome again "+ username); } else { username=prompt("please input name:",""); if (username !=null && username!="") { setcookie("username", username, 365); } else { alert("error"); } } } function setcookie (cname,cvalue,exdays) { var d = new date(); d.settime (d.gettime()+ (10*1000)); var expires ="; expires= "+ d.togmtstring(); document.cookie = cname + "=" + cvalue + "; " + expires; +"; path /"; } function getcookie(cname) { var nam...

django - python-social-auth patterns errors -

Image
i downloaded python-social-auth github , tried use encounter error when try install patterns packet. i'm using last version of django , last version of python. i've read patterns no longer available python 3.x. here patterns package used: urlpatterns = patterns('', url(r'^$', 'example.app.views.home'), url(r'^admin/', include(admin.site.urls)), url(r'^email-sent/', 'example.app.views.validation_sent'), url(r'^login/$', 'example.app.views.home'), url(r'^logout/$', 'example.app.views.logout'), url(r'^done/$', 'example.app.views.done', name='done'), url(r'^ajax-auth/(?p<backend>[^/]+)/$', 'example.app.views.ajax_auth', name='ajax-auth'), url(r'^email/$', 'example.app.views.require_email', name='require_email'), url(r'', include('social.apps.django_app.urls', na...

c# - How can I cast XNode to a custom type? -

my linq xml query xdocument xdoc = xdocument.load("test.xml"); ienumerable<xnode> lv1s = lv1 in xdoc.descendants("resources") select lv1.firstnode; which returns list of <entry> <key>keyname</key> <value>valuename</value> </entry> how can convert result of query list of following class? /// <remarks/> [system.serializableattribute()] [system.componentmodel.designercategoryattribute("code")] [system.xml.serialization.xmltypeattribute(anonymoustype = true)] [system.xml.serialization.xmlrootattribute(namespace = "", isnullable = false)] public partial class entry { private string keyfield; private string valuefield; /// <remarks/> public string key { { return this.keyfield; } set { this.keyfield = value; } ...

xcode - Swift - Horizontal Bar under selected button -

i want add white horizontal bar under selected button on menu. youtube app. this menu abd youtube i searched info couldnt find this. , code. thanks import uikit class tabviewcontroller: uiviewcontroller { @iboutlet var contentview: uiview! @iboutlet var buttons: [uibutton]! var rifleviewcontroller: uiviewcontroller! var pistolviewcontroller: uiviewcontroller! var shotgunviewcontroller: uiviewcontroller! var smgsviewcontroller: uiviewcontroller! var sniperviewcontroller: uiviewcontroller! var viewcontrollers: [uiviewcontroller]! var selectedindex: int = 0 override func viewdidload() { super.viewdidload() let storyboard = uistoryboard(name: "main", bundle: nil) rifleviewcontroller = storyboard.instantiateviewcontroller(withidentifier: "rifles") sniperviewcontroller = storyboard.instantiateviewcontroller(withidentifier: "snipers") smgsviewcontroller = storyboard....

ios - Show Current Location's Weather -

i have seen beautiful, intuitive & simple way show current location's weather in app : example and wanted know how can myself on navigationbar . looked tutorial never found 1 appreciate guide , tutorial or code me implement current location weather displayed in project well. thank in advance.

mysql - SQL - phpmyadmin - Foreign Key errno: 150 -

i seen many topics have same issue me no 1 had answer case. i've made model , sql script software. issue have errno: 150 foreign key in phpmyadmin. checked, both keys have same type issue still here. can me resolve issue please ? had : #1005 - can't create table `candidathlon`.`#sql-21ac_3b` (errno: 150"foreign key constraint incorrectly formed") with request : alter table participer_a add constraint fk_participer_a_dateevenement foreign key (dateevenement) references evenement(dateevenement) this tables have problem : create table evenement( numevenement int (11) auto_increment not null , nomevenement varchar (25) not null , dateevenement date not null , primary key (numevenement ,dateevenement ) , index (nomevenement) )engine=innodb; create table candidat( datenaissance date not null , numtelport varchar (25) not null , numtelfixe varchar (25) not null , adresse varchar (25)...

android - NativeExpressAdView XML attribute adSize was missing -

i trying use nativeexpressadview instead of ad shows required xml attribute 'adsize' missing in black background, red-bordered box. adding adunit , adsize adview programmatically this <com.google.android.gms.ads.nativeexpressadview android:id="@+id/nativeadview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"/> java code: nativead = (nativeexpressadview) itemview.findviewbyid(r.id.nativeadview); int widthindp = context.getresources().getconfiguration().screenwidthdp; widthindp -= context.getresources().getdimension(r.dimen.activity_horizontal_margin); nativead.setadunitid(context.getstring(r.string.dummy_ad_unit_id)); nativead.setadsize(new adsize(widthindp, 100)); nativead.loadad(adrequest); and adrequest declared follows: adrequest = new adrequest.builder() .addtestdevice(ad...

php - WP import data from file at server side and pick each data to echo -

i'm developing wordpress plugin site private page each member. inside plugin folder want include directory text file each member data retrieved upon page load , populated divs. not want file accessible user guess xml or json files should discarded. which method allow me import data "text" file , hide user? how can pick lines function echoed div? sorry terrible code, i'm still learning jquery('#mydiv').text('<?php echo get_user_file_data(); ?>'); add_action( 'wp_ajax_get_user_file_data', 'get_user_file_data' ); function get_user_file_data() { include( plugin_dir_path( __file__ ) . 'includes/myfile.txt'); $myfile = "myfile.txt"; $lines = file($myfile);//file in array var_dump($lines); foreach($lines $line) { $var = explode(':', $line, 2); $arr[$var[0]] = $var[1]; } return $arr; }