Posts

Showing posts from January, 2015

mysql - Rails sort child model based on parent model distance calculation -

i have product model , shop model. relationship between 2 shop has_many products , products belongs_to shop. the shop model has 2 fields longitude , latitude used distance calculation using geokit-rails . have been successful in sorting shops nearest distance given longitude , latitude using: shop.by_distance(origin:[params[:latitude], params[:longitude]]).sort_by{|s| s.distance_to([params[:latitude], params[:longitude]])} the problem products. products needs sorted according nearest shop location well. have searched through , found out child model can sorted parents attributes this: product.joins(:shop).order('shops.name') the order function works if supplied model field. how can sort products calculating shop distance. please help. have @ documentation on using :through - should need. so product like: class product < activerecord::base belongs_to :shop acts_as_mappable through: :shop ... end and query like: product.joins(:shop

python - [Variable as a String]>Special characters printed -

this question has answer here: windows path in python 2 answers i'm facing strange situation..after setting variable string, try print variable , string caracter replaced special caracter.. file_version_cmd="wmic datafile name='c:\\\program files (x86)\\\citrix\\\ica client\\\4.1\\\wfcrun32.exe'" print(file_version_cmd) output of print : wmic datafile name='c:\program files (x86)\citrix\ica client\♦.1\wfcrun32.exe' "..4.1.." replaced "..♦.1.." thanks help you have '\\\4.' in string created non-printable bytes '\4' using \ooo octal value escape sequence . digits interpreted octal numbers . the default \xhh syntax used represent value in hexadecimal. you can rewrite string using raw string literal : file_version_cmd = r"wmic datafile name='c:\program files (x86)\citrix

python - Pymodbus Rtu over Max485(Half duplex) -

i want communicate pic raspberry pi 3. wrote simple code on both devices , data when tx , rx pins connected directly wire.now long distance communication want implement max485. using library function @ raspberry pi side not able control de , re of max485 through gpio when trying read data. tried connecting re gnd , de vcc did not data.how solve problem?? import pymodbus pymodbus.client.sync import modbusserialclient modbusclient client= modbusclient(method = "rtu", port="/dev/ttyama0",stopbits = 1, bytesize = 8, parity = 'e' baudrate= 9600) while true: data = client.read_input_registers(30001, 4, unit=1) print data.registers this program fine direct connection .what modifications have done implement on max485?

python - How to drill down from entity list to entity instance in Google Appengine? -

i have list of entities, , want use entity key link more details of individual entity. class routedetails(ndb.model): """get list of routes datastore """ routename = ndb.stringproperty() @classmethod def query_routes(cls): return cls.query().order(-cls.routename) class routespage(webapp2.requesthandler): def get(self): adminlink = authenticate.get_adminlink() authmessage = authenticate.get_authmessage() self.output_routes(authmessage,adminlink) def output_routes(self,authmessage,adminlink): self.response.headers['content-type'] = 'text/html' html = templates.base html = html.replace('#title#', templates.routes_title) html = html.replace('#authmessage#', authmessage) html = html.replace('#adminlink#', adminlink) html = html.replace('#content#', '') self.response.out.write(html + 

ide - Should i install all of the workload and indvidual tools in visual studio 2017 -

i downloaded visual studio 2017 start working , noticed workloads , individual tools should installed , marked them , total installing size 80+ gb takes days , weeks installed , question should download of these start neatly , or tools on workload selection screen, every workload says function used for. select ones serve according development plans. example if going develop games c++, select c++ game development.

typescript - Can't provide environment variable from Webpack config to Angular 2 -

in config webpack have following. var config = require("./webfig"); config.module = config.module || []; config.plugins.push(new webpack.defineplugin({ "hazaa": "shazoo" })); module.exports = config; however, in ts file, when try access using line below, transpiler complains such thing isn't available. i'm not entirely how troubleshoot , googlearching produced not of value specific issue (as far i've recognized diagnostics properly). how access hazaa in typescript code? edit based on comments, i've introduced following changes. config.plugins.push(new webpack.defineplugin({ "hazaa": json.stringify("shazoo") })); a file called app.d.ts created in same directory pre-existing index.d.ts was. contains declare var hazaa: string; , i'm referring typings.json this. { "globaldependencies": { "core-js": "registry:dt/core-js#0.9.7+20161130133742", "app"

Usage of watch parameter in eject command of Angular CLI -

does know how use --watch parameter of eject command in angular cli? trying watch dist folder after building application , want ensure in right path. below steps have followed: eject cli using ng eject --aot --prod set build script of package.json webpack --config webpack.prod.config.js --watch execute command line npm run build even if have not used --watch parameter during ejection, folder seems watched correctly.

java - LocalDateTime.now() throwing exception when called in a JavaFX context with observer -

i'm writing javafx application fxcontroller observer different class. need last time observer received notification update. problem i'm trying use java8 time api, localdatetime , everytime i'm calling localdatetime.now() it's giving me nullpointerexception pointing tzbd file doesn't exist. however localdatetime.now() works on system if open console project , run code there. is problem javafx then? workaround this? code exception thrown : public void gettimestamp() { localdatetime c = localdatetime.now(); system.out.println("grand total has been updated ... @ " + c); } @override public void update(observable o, object arg) { grandtotal.settext( integer.tostring( controller.getreg().getgrandtotal() ) ); system.out.println("update() called @ "); gettimestamp(); } here full exception stacktrace : exception in thread "javafx application thread" java.lang.runtimeexceptio

Programatically Select a combobox item using the SelectedValue WPF -

i have combo box loaded through datasource(datatable). on scenario want combo box load desired value passing combobox1.selectedvalue = custid (say it's customer details). custid set selectedvaluepath in xaml. when set that, getting null exception. missing? my xaml: <combobox height="23" horizontalalignment="left" margin="332,42,0,0" name="cmbcustomername" verticalalignment="top" width="240" iseditable="true" displaymemberpath="customername" selectedvaluepath="custid" itemspanel="{staticresource cust}" selectionchanged="cmbcustomername_selectionchanged" allowdrop="true" fontweight="normal" text="--select customer name--" issynchronizedwithcurrentitem="true" /> update: c# code: public customer(int custid) { initializecomponent(); cmbcustomer.selectedvalue= custid.tostring(); } private void cmbcustomername_sele

swift - Table rows in segmented control wont scroll up when segment changes -

i have 2 segments onc , ofc , after data displayed in onc segment , scroll row15 , when change segment ofc , shows row15 want show row1 public func tableview(_ tableview: uitableview, numberofrowsinsection section: int) -> int { var typeofevent = 0 switch (eventsegctrl.selectedsegmentindex) { case 0: typeofevent = oncevents.count break case 1: typeofevent = ofcevents.count break default:break } return typeofevent } how solve this? the simplest solution on reload of tableview can set contentoffset cgpoint.zero . self.tableview.setcontentoffset(cgpoint.zero, animated: false)

How to count across DStreams in Apache Spark? -

i have following question. imagine there dstream of json strings coming in , apply few different filters in parallel on same dstream (so these filters not applied 1 after other). example here pseudo code if helps dstream.filter(x -> { check set of keys }) -> filteredstream1 dstream.filter(x -> { check set of keys}) -> filteredstream2 but cannot dstream.filter(x -> { check set of keys }).filter(x -> { check set of keys}) now want able count number of elements in filteredstream1 , filteredstream2 , combine result 1 message follows {"filteredstream1" : 50, "filteredstream2": 25} any easy way such leveraging rdd.count across streams or should use maptopair , reducebykey?

mysql - PHP: Database structure for user based networking -

some basics: using user authenticated login admin system allows users add customers, , array of info customers, including geo-location information use gmap api. goal allow users add each other networking purposes in regards customer clientele. wondering best approach @ building database/table structure should be. at moment, have database called pbud1 users table , customers table. networking, idea use users unique id-> uid identifier network. add table when network instantiated user, naming table network_ + the id 'users' table , ex: network_uid pbud1 . network_uid = pbud1 . users . uid . if user has id of 6 network_6 . within new table "network_6" , place relevant information on each row each user added users network, ie; nid(key/ai) net_user_id(uid), geo_location, business, name, etc... goal: allow each user within parent network access specific user.parent customers information. suggest users user.parent due geo_location of customer base between r

How to run Django and Wordpress using Nginx and Gunicorn at the same domain? -

i have django app running on domain e.g. www.example.com i want create wordpress landing page, , point landing page home url www.example.com , wordpress admin site www.example.com/admin or www.example.com/wp-admin. other urls should served django. so, want: www.example.com -> wordpress www.example.com/admin or www.example.com/wp-admin -> wordpress all other urls served django till now, nginx configuration using django: upstream django_server { server unix:/path/to/gunicorn.sock fail_timeout=0; } server { listen 80; server_name www.example.com example.com client_max_body_size 4g; access_log /path/to/nginx-access.log; error_log /path/to/nginx-error.log; location /static/ { alias /path/to/static/; } location /media/ { alias /path/to/media/; } location / { proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header host $http_host; proxy_redirect off;

Define range between two page breaks excel VBA -

i have excel sheet separated multiple page breaks - each change in column c (column c represents specific projecid). each line of table contains amount has been spent. amount stored in column q. (note - each project there can multiple rows - amounts in column q). depending if subtotal amount (column q) per project (column c) <0 or >0, different operations should performed within range. question - how loop through these ranges (between 2 page breaks) in order check subtotal amount , perform appropriate operations on rows within each range? thank in advance following code deletes previous page & can set range, sub pagebreak() dim cellrange range dim testcell range set cellrange = selection each testcell in cellrange activesheet.rows(testcell.row).pagebreak = xlpagebreaknone if testcell.value <> testcell.offset(-1, 0).value activesheet.rows(testcell.row).pagebreak = xlpagebreakmanual end if next t

javascript - How enable zoom for second y axis in charts JS -

i have 2 y axis in graph , both of needs zoomed on scroll.chart plugin () provides options - x,y,xy.here, xy zooms first y axis not not second. { // container pan options pan: { // boolean enable panning enabled: true, // panning directions. remove appropriate direction disable // eg. 'y' allow panning in y direction mode: 'xy' }, // container zoom options zoom: { // boolean enable zooming enabled: true, // zooming directions. remove appropriate direction disable // eg. 'y' allow zooming in y direction mode: 'xy', } }

forms - Why doesn't my Django template render a ModelForm's id or pk field? -

in django 1.10, i'm prepopulating modelform in template using record database in order edit record in form. however, when want render html form, doesn't show id (or pk ) fields. want put id in hidden <input> tag when form submits backend knows record edit when form submitted. web app doesn't have id in url. here models.py: from django.db import models class mymodel(models.model): name = models.charfield(max_length=50) phone = models.charfield(max_length=50) in database, i've added 1 mymodel record name 'alice' , phone '212-555-5555' . id/primary key 1 . here forms.py: from django import forms . import models class testform(forms.modelform): class meta: model = models.mymodel fields = ['id', 'name', 'phone'] here views.py: from django.shortcuts import render . import forms, models def test_page(request): m = models.mymodel.objects.get(name='alice') prepopulate

handlebars.js - Handlebarjs changes to rendering -

i'm looking way dissolve {{ > partial }} tags only. without dissolving other template tags. right way this? there way? handlebar template includes partial <div> {{ > partial }} {{ somevariable }} {{#if @first}} first! {{/if}} </div> this partial includes partial <div> {{ partialvariable }} {{#each array}} {{@root.foo}} {{ > partial__02 }} {{/each}} </div> nested partial <div> {{ variable }} </div> expected result <div> <div> {{ partialvariable }} {{#each array}} {{@root.foo}} <div> {{ variable }} </div> {{/each}} </div> {{ somevariable }} {{#if @first}} first! {{/if}} </div>

html - floating two div tags that equal 100% width moves second div to new line -

this question has answer here: css: width in percentage , borders 4 answers newbie everything. i have 2 div tags, first has width of 80% , second width of 20%. 80%+20%=100% second div moves next line. the objective use whole line without moving second. <!doctype html> <html> <head> <style> .border { border-style: dotted; } </style> </head> <body> <div class="border" style="width: 80%;">thing</div> <div class="border" style="width: 20%; float: left;">other thing</div> </body> </html> try this: css code: .table_formate { display:flex; width:100% } .border { border:1px solid #ddd; } html: <div class="table_formate"> <div class="border" style="width: 80%; float: left; background: #dd0d0d

Content cannot be null laravel -

i'm trying submit form , got error queryexception in connection.php line 647: sqlstate[23000]: integrity constraint violation: 1048 column 'content' cannot null (sql: insert content ( title , content , image , updated_at , created_at ) values (home, , [], 2017-03-28 11:10:58, 2017-03-28 11:10:58)) the content should able null. my migration table schema::create('content', function(blueprint $table) { $table->increments('id'); $table->string('title'); $table->text('content'); $table->string('image'); $table->timestamps(); }); my store method public function store() { $input = input::all(); $validation = validator::make($input, content::$rules); if($validation->fails()){ return redirect()->route('content.create') ->withinput() ->witherrors($validation) ->with('message', 'there validation erro

php - How $block->getChildHtml(); data passes in Magento 2? -

magento default customer.phtml file in directory of magento\module-customer\view\frontend\templates\account has following code in line 42 shows dropdown list when logged in. <?php echo $block->getchildhtml();?> where functionalities declared file? the getchildhtml() declared @ \magento\core\block\abstrackblock, object $block class extended abstrackblock , function call child block of current block , call tohtml() function, suggest use get_class($block) class name of $block . or find in template xml file defined customer.phtml , find block class name.. read more: http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/layouts/xml-instructions.html http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/templates/template-override.html

sql - MySQL Select where multiple rows in joined table -

let's have 2 tables, like: +-----------------------------+ |a | +------+-----------+----------+ | a_id | firstname | lastname | +------+-----------+----------+ | 1 | tom | cruise | | 3 | matt | damon | | 4 | ben | affleck | | 8 | ryan | gosling | +------+-----------+----------+ +-----------------------+ | b | +------+------+---------+ | b_id | a_id | b_value | +------+------+---------+ | 2 | 3 | 1 | | 1 | 3 | 2 | | 4 | 8 | 3 | | 8 | 1 | 4 | +------+------+---------+ i able to select rows a meet set of criteria b , there might multiple rows. for example: get first , last name(s) of has b_value of one, , other b_value of two. in example data, refers matt damon. get first , last name(s) of has b_value of three, or b_value of four. in example data, ryan gosling has b_value of three, , tom cruise has b_value of four, both ryan gosling , tom

php - How to style products of a certain category in Opencart 2.3.0.2 -

i want add unique style products of category in opencart 2.3.0.2. if want change style of particular category including html first open catalog/controller/extension/module/category.php at end of file find line: return $this->load->view('extension/module/category', $data); here can add if else condition particular category id like: if ($data['category_id'] == 25){ return $this->load->view('extension/module/categorycustom', $data); } else { return $this->load->view('extension/module/category', $data); } add new file at: catalog/view/theme/default/template/extension/module/categorycustom.tpl and copy content from catalog/view/theme/default/template/extension/module/category.tpl this change content of left side filter data. if want change main content @ right side open: catalog/controller/product/category.php find line around 377 $this->response->setoutput($this->

Date transformation Format R -

i have column in df date 1992 1992 1992 1992 1993 1993 1993 it integer or factor , transfomed date reshaped.test1$year <- as.date(as.factor(reshaped.test1$year), "%y") but out put date 1992/03/28 1992/03/28 1992/03/28 1992/03/28 1993/03/28 1993/03/28 the class (df$date) date fund solution tojust maintain year df$date <- format(f,'%y') but class changed this problem same work in q monthly frequent date

apache kafka - Td-agent 2x zookeeper -

i have td-agent on s1 (server 1), on s2 have zookeeper , kafka , on s3 have zookeeper , kafka, config of td-agent is type ruby_kafka zookeepers s2:2181,s3:2181 default_topic topic1 but when s2 going down td-agent on s1 don't sending data zookeeper on s3 td-agent has status [failed] 2017-03-28 11:05:10 +0000 [error]: fluent/supervisor.rb:373:rescue in main_process: config error file="/etc/td-agent/td-agent.conf" error="broker has not been set."

java - This code will get only first value from json string -

please me out need display json array data show first value json .i tried change values 1 value shown not array @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); button btnadd=(button)findviewbyid(r.id.btnhit); tvdata = (textview)findviewbyid(r.id.tvjsonitem); btnadd.setonclicklistener( new view.onclicklistener() { @override public void onclick(view v) { new jsontask().execute("https://api.myjson.com/bins/106o37"); } } ); } public class jsontask extends asynctask{ @override protected string doinbackground(string... params) { httpsurlconnection connection = null; bufferedreader reader = null; try { url url = new url(params[0]); connection = (httpsurlconnection) url.openconnection(); connection.con

Python how to iterate two infinite generators at the same time? -

i'd iterate on number of infinite generators: def x(y): while true: in xrange(y): yield i,j in zip(x(5),x(3)): print i,j the code above will produce nothing. doing wrong? that's because python 2 zip tries create list getting elements generator ever produce. want iterator, i.e. itertools.izip . in python 3 zip works izip .

ios - Video file compression in swift -

this question has answer here: swift - compressing video files 1 answer compressing video in ios 2 answers i m recording video , converting base64 string send server.but uploading of video taking lot of time. there compression library can used swift. tried bridging ffmpeg creating lot of issue of missing files. avurlasset not working me. suggestions on how compress audio , video files. func imagepickercontrollerdidcancel(picker: uiimagepickercontroller) { self.imagepickercontroller.dismissviewcontrolleranimated(true, completion: nil) } func imagepickercontroller(picker: uiimagepickercontroller, didfinishpickingmediawithinfo info: [string : anyobject]) { let mediatype = info[uiimagepickercontrollermediatype] as! nsstring self.imagepickercontr

Does nginx validate incoming SSL request -

i've nginx setup ssl on letsencrypt , working fine. api certification, server needs verify incoming https request has valid certificate or not making sure signed proper ca authorities. how can make sure nginx doing that? there option in nginx force valid ssl requests?

javascript - can I pan individual howler.js sprites? -

it seems single howler.js (v2.02) sprite file can given 1 stereo location? how can have stereo piano 88 notes set left right on electronic keyboard? i'm trying avoid 88 mp3 files. i did try setting pan @ point play actuated works if playing 1 note @ time. perhaps can have 2 identical sprite files, 1 left , 1 right, , able set mix of left , right each note - or - able wrap each sprite in new howl, think i'm clutching @ straws. relevant code follows; works no panning: var pnoarray = {}; (var = 0; < 88; i++) { pnoarray[i] = [ * 4000, 3850 ]; } pnosound = new howl( { src: [ 'spritetest1.mp3' ], sprite: pnoarray } ); mousedown event: if ( intersects.length > 0 ) { controls.enabled = false; selected = intersects[ 0 ].object; selected.rotation.x = selected.rotation.x + 0.03; //key action playing = pnosound.play( [selected.number] ); container.style.cursor = 'auto'; } mo

windows - ftp batch file script -

hoping can guide me / me. the issue, have 2 servers 1 running ubuntu has website clients login , download / view reports. other windows server 2012 r2 creates / stores reports. need move files windows ubuntu server clients can view. data large 7gb , growing @ 3 gb year. i need batch file connect using ftp , copy folder local folder. needs copy files have modified. i have ever written 1 batch file , cant seem find ftp batch scripts copies modifed files. your last resort cant seem find coder knows batch script (its dieing art). have never used powershell not know start here. any or advice please let me know. thanks john you can powershell winscp . exemple : try { # load winscp .net assembly add-type -path "winscpnet.dll" # setup session options $sessionoptions = new-object winscp.sessionoptions -property @{ protocol = [winscp.protocol]::sftp hostname = "example.com" username = "user" password = "mypassword&quo

github - git push -u origin master failed with encounter the issue of permission denied -

Image
i create new project in rstudio , , opened github project repository well. however, intend push project implementation github page, git complaints following error: $ git push -u origin master remote: permission julaitishayiding/mspc.git denied julaiti. fatal: unable access 'https://github.com/julaitishayiding/mspc.git/': requested url returned error: 403 i used git command this: cd /path/to/my/repo rm -rf .git git init git add --all git commit -m "initial commit" git remote add origin "https://github.com/julaitishayiding/mspc.git" $ git pull --rebase origin master git push -u origin master $ git pull origin master edit : i tried of adding .gitignore file using git add .gitignore , still can't work solving permission denied problem. .gitingore file has following content: .rproj.user .rhistory .rdata i looked related post in so , , tried of them git permission denied , still, can't solve problem. can me out issue? how fix bug? id

nested - Ansible - 'unicode object' has no attribute 'file_input' -

i'm working ansible 2.2.1.0 , work on old project made else errors. i have following variables in code: software_output: - { file_input: 'download_me.zip', file_output: 'download.zip' } software_version:"0.5,0.6" and have shell module instruction download on ftp: - name: "mysoftware | package on ftp" shell: > curl --ftp-ssl -k {{ ' --ssl-allow-beast ' if os == 'aix' else "" }} -# -f -u {{ ftp_user }}:{{ ftp_password }} -f "{{ ftp_url | replace('@@software_version@@',item[1]) }}{{ item[0].file_input }}" -o {{ require_inst_dir }}/{{ item[0].file_output }} 2>/dev/null with_nested: - software_output - "{{ software_version.split(',') }}" when: software_version defined but doesn't work @ all, have following error: 'unicode object' has no attribute 'file_input' it looks with_nested not used has used, did missed something?

java - Facing issue while clicking dropdown button using selenium webdriver code -

the application using having several dropdown buttons having same xml code. below code similar dropdown buttons. <button class="btn dropdown-toggle bs-placeholder btn-default" role="button" data-toggle="dropdown" type="button" data-id="invcontactlist" title="" data-original-title="nothing selected"> i have use below code click button driver.findelement(by.xpath("//button[@data-toggle='dropdown']")).click(); using code application run once there after gives error as: org.openqa.selenium.elementnotvisibleexception: element not visible , may not interacted command. have removed browser cookies wont help. can please me root cause , solution ? you might need wait element : webdriverwait wait = new webdriverwait(driver, 10); wait.until(expectedconditions.elementtobeclickable(by.xpath("//button[@data-toggle='dropdown']"))).click(); or wait.

go - GoLang Json Schema Filter -

is there example of how can not validate, limit data based on schema rather struct. not know schema ahead of time (during coding/development). read array of "schemas" in , objects support. don't want output extra, want ensure whatever output limited whats in schema. example in npm: https://github.com/alank64/json-schema-filter/blob/master/index.js is there existing way achieve in golang? using xeipuuv/gojsonschema library validate incoming data. incoming data may include fields (which ok in work flow). apis need output in schema security purposes, , need read schema when serving data, , limit resulting record fields available in schema.

node.js - eclipse debugging with npm and react -

unfortunately code on intranet , can't copied , pasted. sorry can't provide more details easily... i have been using eclipse java development years started using npm , react on project started before got on it. i set debugging of front end this . since new @ npm , react i'm not sure put "main file" in eclipse. when use app.js main file error on "import" statements in file ("unexpected reserve word.) when use bundle.js (the product of npm believe) error on line window.navigator.useragent... stating "window not defined." also, when run npm this: npm run-script dev-server , trying add run configuration under "node arguments." if has npm/react/eclipse working info appreciated.

python - Mininet-wifi custom topology -

Image
at first want wanted create complex topology (more switches connected each other) simple 1 not working. not able working connection eg. 'h1 ping h2' here topology: he script should create equivalent topology: !/usr/bin/python """ setting position of nodes (only stations , access points) , providing mobility. """ mininet.net import mininet mininet.node import controller, remotecontroller, ovskernelap mininet.link import tclink mininet.cli import cli mininet.log import setloglevel def topology(): "create network." net = mininet( controller=controller, link=tclink, accesspoint=ovskernelap ) print "*** creating nodes" h1 = net.addhost( 'h1', mac='00:00:00:00:00:01', ip='10.0.0.1/8' ) h2 = net.addhost( 'h2', mac='00:00:00:00:00:11', ip='10.0.1.1/8' ) sta1 = net.addstation( 'sta1', mac='00:00:00:00:00:02', ip='10.0.0.2/8',

android - how to make a download manger like Adm -

i know question general please if can help,help me. know how work files ,how download them , make recyclerview , cardview . don't know when user puts lots of files in downloading line , exit activity ,how can app continues download them , show percentage of download in notification bar , when user comes activity show percentage of download cardview on recyclerview him. can 1 tell me should do?

java - Lucene 6.4.1 special character equal sign "=" not escaped by QueryParser.escape(...) -

i'm working lucene 6.4.1 , exception input containing equals sign "=": caused by: invalid_syntax_cannot_parse: syntax error, cannot parse =: @ org.apache.lucene.queryparser.flexible.standard.parser.standardsyntaxparser.generateparseexception(standardsyntaxparser.java:1030) @ org.apache.lucene.queryparser.flexible.standard.parser.standardsyntaxparser.jj_consume_token(standardsyntaxparser.java:912) @ org.apache.lucene.queryparser.flexible.standard.parser.standardsyntaxparser.clause(standardsyntaxparser.java:462) @ org.apache.lucene.queryparser.flexible.standard.parser.standardsyntaxparser.modclause(standardsyntaxparser.java:279) @ org.apache.lucene.queryparser.flexible.standard.parser.standardsyntaxparser.conjquery(standardsyntaxparser.java:210) @ org.apache.lucene.queryparser.flexible.standard.parser.standardsyntaxparser.disjquery(standardsyntaxparser.java:180) @ org.apache.lucene.queryparser.flexible.standard.parser.standardsyntaxparser.query(standardsyntaxparser.

Google Analytics Measurement Protocol Batch Send Not Working -

i'm trying send batch hits google analytics measurement protocol, following directions link: https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide my post data follows: post /batch/ http/1.1 host: www.google-analytics.com cache-control: no-cache v=1&tid=ua-xxxxxxxx-xx&cid=57409376.1490567764&t=transaction&ti=21594451&tr=29.4&tt=0.0&ts=0.0&cm4=7.350000000000003&cu=brl&pa=purchase&pr1id=58d279b0e4b069eb07461b&pr1nm=credito&pr1ca=divers%c3%a3o&pr1qt=3&pr1cc=&pr1pr=9.8&pr1cm2=0.01&cd12=22882 v=1&tid=ua-xxxxxxxx-xx&cid=742537347.1490876083&t=transaction&ti=21594452&tr=24.9&tt=0.0&ts=0.0&cm4=4.979999999999997&cu=brl&pa=purchase&pr1id=58cadfa0e4b094f81b742c&pr1nm=show&pr1ca=divers%c3%a3o&pr1qt=1&pr1cc=&pr1pr=24.9&pr1cm2=0.01&cd12=28439 when send google analytics, returns me html code, this: <!doctype h

ios - Can't install IPA with AdHoc distribution certificate -

here senario facing problem... i have app on appstore have removed appstore result of provisioning certificate , certificate gone invalid , made active again ,and while installing application ,i using same provisioning certificate active not able install app on device idea why? there doing wrong new ios. make sure add device udid account. or confirm device added adhoc certificate.

Does Java 8, Wildfly Server, IntelliJ Idea work on Window 10 Home Edition -

kindly me know. java 8, wildfly server, intellij idea work on window 10 home edition? going buy laptop window 10 home edition. please help. there's no reason shouldn't. java runs fine on windows home editions, , that's need. i haven't tried run wildfly on windows 10, java 8 , intellij have run, other application servers weblogic, tomcat, jetty, , glassfish, , run without problems.

Matlab storing data in column or row -

i have written algorithm, storing data points in column. results contains mean , std . however, if store data points in row instead, results seem more close true value. there proper explanation this? in opinion, results should independent way of storage , remain same. function [c]=test(n,m) rng default b=randn(m,n) rng default a=randn(n,m) c=a'-b end i using generator calculations. results turns out different depending on if use randn(m,n) or randn(n,m) . (i taking m-th column or m-row sum them cumulatively).

SQL Server FOR XML nesting fragment -

i need produce xml fragment such following <owner> <individual> <name> <firstname>bob</firstname> <lastname>smith</lastname> </name> <address> <countrycode>nl</countrycode> <addressfree>123/456/netherlands/netherlands</addressfree> </address> </individual> </owner> <owner> <individual> <name> <firstname>tony</firstname> <lastname>hancock</lastname> </name> <address> <countrycode>us</countrycode> <addressfree>123/maryland/united states</addressfree> </address> </individual> </owner> i writing sql: select (select b.givenname [name/firstname] , b.familyname [name/lastname] , b.address_country [address/countrycode] , b.addressfree [address/addressfree] dbo.stage_clients_merge b

perl6 - Using Perl 6 custom operators -

i studying chemistry in university , want try writing textbook examples in perl6 or perl, balancing chemical formula or other processes! then encountered problem on perl6 custom operator. feel have been repeating code , myself when use feature. hard read , write. how can simplify this? #!/usr/bin/env perl6 use v6; #basic si(international system of units) type role metricprefix { method baseon ( str $base , numeric $input ) { given $base { when 'pico' { return $input * 10**-12 } when 'namo' { return $input * 10**-9 } when 'micro' { return $input * 10**-6} when 'milli' { return $input * 10**-3 } when 'centi' { return $input * 10**-2 } when 'hecto' { return $input * 10**2 } when 'kilo' { return $input * 10**3 } when 'mega' { return $input * 10**6 } when 'giga' { return $input * 10**9 }

node.js - Travis CI build exited with 1, test failed.. working on windows -

i trying setup development environment. using windows, try run units tests using mocha , run program, works fine. when try ci in travis ci, following error: "warning: not find test files matching pattern: buildscripts/testsetup.js" where code in package.json looks this: "scripts": { "start:config": "babel-node buildscripts/srcserver.js", "start": "npm-run-all --parallel start:config test", "test" : "mocha --reporter progress buildscripts/testsetup.js \"src/**/*.test.js\"" } it seems in travis, doesn't see buildscripts/testsetup.js config tests, sees if must contain test code. here's repo on github if need take @ code: https://github.com/derhallim/testenv i tried run build on appveyor, , worked fine. ideas?

vba - Copy specific columns instead of entire column -

i have created following vba code: sub x() dim sht worksheet, summarysht worksheet dim rmin range, rmax range each sht in worksheets if not sht.name "summary*" set summarysht = sheets.add(after:=sheets(sheets.count)) summarysht.name = "summary " & sht.name sht.range("f15000:f20000") set rmin = .find(what:=worksheetfunction.min(.cells), lookat:=xlwhole, lookin:=xlvalues) set rmax = .entirecolumn.find(what:=worksheetfunction.max(.entirecolumn)) .parent.range(rmin, rmax).entirerow.copy summarysht.range("a2") end end if now want macro not copy entire row columns "b" , "g". could me adjusting code need, i´m sure not big deal suck @ vba thats why.. thank much! i added new variable make code little more readable. code takes intersection of desired region columns b , g , combines them using union. sub x() dim sht worksheet, summarysht worksheet dim rmin range

python - Different results when passing function / method to equation solver -

this question follow-up of previous question pass class method fsolve . @jim's answer in question difference between function object name , function call clarified confusion , solved problem. however, when tried similar things in sympy: from sympy.solvers import solve sympy import symbol class demo(): def __init__(self, var): self.i = var def func(self): return self.i ** 2 - 4 x = symbol('x') def func(v): return v ** 2 - 4 new = demo(x) solve(new.func(), x) # works fine, function call solve(func(x), x) # works fine, function call why have different results? (in scipy need pass function name solver while in sympy need pass function call.) because different implementation of 2 libraries? in above example, if substitute function call function name, exception raised: file "<ipython-input-26-3554c1f86646>", line 13, in <module> solve(new.func, x) file "anaconda3\lib\site-packages\sympy\solvers\solvers.py"

Reading and appending a file in C -

i new c , wrote code collects student data, facing few problems.it's not reading file, secondly, when try append, new data not being added new line. doing wrong? #include <stdio.h> #include<stdlib.h> #include<string.h> int givechoiceforfileopentype(); void writefile(); void readfile(); void apendfile(); void printchoices(); int openfilefromconsole(file *fp1); void savestudentgradeinfotofile(file *fp1); typedef struct student { char name[50]; char id [20]; int score; }student; int main() { printchoices(); int choice = givechoiceforfileopentype(); switch(choice){ case 1: writefile(); break; case 2: readfile(); break; case 3: apendfile(); break; default: printf("error!!!\n"); } return 0; } void writefile(){ file *fp1 =fopen("e://registry.csv", "w"); openfilefromconsole(fp1); savestudentgradeinfotofile(fp1); fclose(fp1); } void readfi

php - Problems with Doctrine Subqueries and Aliases -

previously today, asked/answered following question: https://stackoverflow.com/a/43069362/4521733 now tried create query using doctrine query builder: $qb->select('sp') ->addselect( '(select count(spa.id) appbundle:projectattribute spa spa.project = sp.id , spa.attribute = pa.attribute , spa.attributevalue = pa.attributevalue) attributesimilarity' ) ->addselect( '(attributesimilarity * 1) similarity' ) ->from('appbundle:project', 'p') ->leftjoin('appbundle:projectattribute', 'pa', 'with', 'p = pa.project') ->leftjoin('appbundle:project', 'sp', 'with', 'p != sp') ->where('p = :project') ->setparameter(':project', $project) ->groupby('sp.id') ->orderby('similarity', 'desc') ->getquery() ->getresult(); unfortunately doesn't work:

c# - .NET SQL Query joining two different tables -

i'm brand new .net mvc, , while have basic experience writing sql queries, i'm not sure how go need .net. my initial query looks this: var results = (from s in db.members join sa in db.focusarea on s.id equals sa.memberid sa.area == searchstring select new { s.id, s.name, s.overview }).tolist(); this not functioning correctly. seaching in s.overview reason. and, need make query more complicated. in short, have 3 tables need search across. , query, not working: var conceptresults = (from s in db.cohorts join oa in db.outcomearea on s.id equals oa.cohortid ((oa.area.contains(searchstring)) || (oa.outcometype.contains(searchstring))) select new { s.id, s.name, s.overview }).tolist(); i need use searchstring search matches in both area , description in db.focusarea. i need use searchstring search matches (contains) in tab

Linq remove duplicate records as per column values C# -

i have class items properties id, name, action . the list of items populated duplicated items. for example: 1 item1 it00001 insert 2 item1 it00001 delete 3 item3 it00003 insert 4 item4 it00004 update how remove duplicates in list using linq? output be 3 item3 it00003 insert 4 item4 it00004 update you can linq: var filteredlist = list.groupby(o => o.name) .where(g => g.count() == 1) .selectmany(g => g.select(o => o)) .tolist();

python - String indices must be integers and while issue -

i writing code school homework. assignment this: write code read book codes till "000" entered , split books 2 categories depending on first 4 digits entered isbn , issn. note : use str , check prefix of code (in case isbn , issn). here code: bookarray = [] booknumber = str(input("give me book code - type 000 if want cancel")) while booknumber != "000": bookarray.append(booknumber) booknumber = str(input("give me book code - type 000 if want cancel")) if booknumber[0,4] == "isbn": isbnarray = booknumber elif booknumber[0,4] == "issn": issnarray = booknumber print(issnarray) print(isbnarray) any regarding same appreciated! in first year in python @ school. edit: expected output should 2 lists books' code numbers. currently, face autonomous loop on "while" not sure of how , why. if booknumber[0,4] == "isbn": you're passing tuple index booknumber ex

session - java: request.getSession().getAttribute is null -

i have set attribute in session got cxf resource through following code: httpsession session = request.getsession(); session.setattribute("field", "testvalue"); when try retrieve value in servlet: request.getsession().getattribute("field") the returned value null. i've debugged code , session in cxf resource has different id session in servlet. browser session same. can me figure out how fixed? thanks

c++ - Vizualizing vertex picking of a mesh in OpenGL -

for fun trying build miniature blender using (modern) opengl. part of want user able pick vertices. each time user picks vertex want vertex turn red. question has nothing finding intersecting vertex, rather how 1 visualize picked vertex. have managed paint picked triangle (instead of picked vertex) using following in fragment shader: if(gl_primitiveid==intersectingface) color=vec4(1.0f,0.0f,0.0f,1.0f); where intersectingface uniform holds index of meshe's intersecting face. in order pick vertex instead of face thought of loading sphere mesh scene,scaling down , translating center position of intersecting vertex. wondering whether there simpler solution one. there built-in variable tells index of vertex, rather the primitive: gl_vertexid . gl_vertexid : index of vertex being processed. when using non-indexed rendering, effective index of current vertex (the number of vertices processed + first​ value). indexed rendering, index used fetch vertex

docker - Not able to connect to HBase ( Zookeeper ) running on Vagrant -

i have simple vagrant machine has stand alone instance on hbase. when start hbase, i'm able access access hbase information url http://192.168.99.101:16010/master-status . but when try connect through java, i'm not able connect zookeeper. vagrant file vagrant.configure("2") |config| config.vm.box = "hbase-phoenix" # simple hbase phoenix box config.vm.box_check_update = false config.vbguest.auto_update = false config.vm.define "hbase_pnx" |hbase_pnx| hbase_pnx.vm.hostname = "hbasepnx" hbase_pnx.vm.network "private_network", ip: "192.168.99.101" hbase_pnx.vm.network "forwarded_port", guest: 2181, host: 2181 hbase_pnx.vm.network "forwarded_port", guest: 16010, host: 16010 end end the host file on vm looks like vagrant@hbasepnx:~$ cat /etc/hosts 192.168.99.101 hbasepmx hbasepnx 192.168.99.101 hbase-vm hbase-vm 192.168.99.101 localhost ::1 ip6-loc