Posts

Showing posts from June, 2013

Parse error: syntax error, unexpected '$data' (T_VARIABLE) in C:\wamp64\www\web\test.php on line 27 -

this question has answer here: php parse/syntax errors; , how solve them? 11 answers so error , can't understand why. in opinion syntax correct, still doesn't work way want. maybe don't understand mysql syntax in php <?php include 'db.php'; $data = array( 0 => array( 'comment_author_name' => 'jurgis', 'comment_author_rank' => 'pro', 'comment_date' => '2017-08-13 23:45:23', 'comment_message' => 'lorem ipsum (trump. lipsum) yra tekstas naudojamas spaudos ir grafinio dizaino industrijoje jau nuo xvi amžiaus pradžios.' ), 1 => array( 'comment_author_name' => 'martynas', 'comment_author_rank' => 'newbie', 'comment_date' => '2017-08-14 13:32:15', 'comment_message' => 'jis naudojamas parodyti gra...

php - Custom WordPress API Route Returning 500 Error -

the story created custom api route /wp-post-modal/v1/any-post-type pulls posts of post type. locally works (mamp), on multiple production servers (different environments) returns 500 error. api route works on local: http://wordpress.local/wp-json/wp-post-modal/v1/any-post-type?slug=modal-page api route examples on production (show api route exist): https://wp-post-modal.allureprojects.com/wp-json/wp-post-modal/v1 https://spedform.com/wp-json/wp-post-modal/v1 usage should work on production (but don't because of 500 error): https://wp-post-modal.allureprojects.com/wp-json/wp-post-modal/v1/any-post-type?slug=modal-content https://spedform.com/wp-json/wp-post-modal/v1/any-post-type?slug=privary-policy i checked nginx error logs on server , empty. code custom api route: /** * register api route: query post type */ public function any_post_api_route() { register_rest_route( $this->plugin_name . '/v1', '/any-post-type/', array( ...

Unable to install Python 3 -

i have python 2.7.9 installed. while uninstalling 3.4.4 ran problem said cannot uninstall files missing. deleted c:\python34. deleted registry entries. tried microsoft fixit install/uninstall. didn't show python 3.4 in list. every time want install python 3.4.4 stuck ' ..a dll required...could not run'. checked ...appdata/local/security has permissions. faced no such problems when had first installed python 3.4.4 please me.

cucumber - Why is the first Rails request extremely slow in testing? -

in ruby on rails, when run rails server, first request seems extremely slow, logs show slowness comes view rendering: 2017-08-14 10:24:12.707 [ 22139] [info ] completed 200 ok in 18547ms (views: 18501.6ms | activerecord: 3.7ms) i assume it's because needs connect database. next request of course, fast(er): 2017-08-14 11:01:54.937 [ 25662] [info ] completed 200 ok in 765ms (views: 714.0ms | activerecord: 8.3ms) i assume has cache, , has database connection. i've tried restart server, restart database, clear browser cache , rake db:sessions:clear , unable first request go slow again in development. here's things interesting. every single time run cucumber tests, first request incredibly slow: 2017-08-14 11:19:52.879 [ 27729] [info ] completed 200 ok in 38326ms (views: 38306.8ms | activerecord: 6.1ms) it's longer in development unknown reasons. what different between restarting rails server , re-running test makes first request of tests slow? steps can...

In Firefox, parent element won't get focus when child with fixed position is clicked -

i have fixed element inside focusable element. when click fixed element, parent focusable element should receive focus. works in chrome, edge , ie11, doesn't work in firefox. .focusable { background-color: red; width: 200px; height: 200px; } .focusable:focus { background-color: blue; } .fixed { top: 200px; background-color: green; position: fixed; height: 100px; width: 200px; } <div class="focusable" tabindex="0"> <div class="fixed"> parent not focus. </div> </div> do know workarounds? avoid handling mousedown event , calling preventdefault(). because using position fixed inner child element removing position:fixed , work fine

php - Conditional ISSET issue -

in single product page, product id assigned var $productid . problem when, staying in 1 of fields of form , push enter key, page crashes since script can't find id again. implement script in following way. <?php $product_id = $_get['product_id']; include '../sys/conn.php'; $risultato = mysqli_query ($conn, " (mysql query) ") or die ("query not valid: " . mysqli_error($conn)); mysqli_close($conn); $row = mysqli_fetch_array($risultato); ?> that implemented in order if $_get not set properly, set 13321 (example value). <?php $product_id = $_get['product_id']; if(!isset($_get['product_id']){ $product_id='13321'; }else{ include '../sys/conn.php'; $risultato = mysqli_query ($conn, " (mysql query) ") or die ("query not valid: " . mysqli_error($conn)); mysqli_close($conn); $row = mysqli_fetch_array($risultato); } ?> the conditional clause looks not accepted , generates er...

android - Too many field references: 70613; max is 65536 -

Image
my project uses these plugins: onesignal googleplayservices adjust google analytics unity iap facebook sdk those plugins used in every project. but on field references count this .aar file list what should decrease reference count? so should decrease reference count ? you have many plugins many functions/fields. there limit when building unity's editor , have reached limit. to decrease reference count, have delete these plugins sure need them , deletion may not appropriate solution in case. the only way around , build android @ moment export project android project build android studio . removes reference limit imposed unity's editor. edit i forgot mention have enable multidex after exporting out. since many people go through problem daily, decided add thorough instruction on how fix problem exporting out , how fix without exporting it . fix exporting project 1a .export unity project android project. 1b .import android st...

syntax highlighting - enhanceCSharpSyntax(Visual Studio 2017, TextMate) -

visual studio 2017 supports textmate grammar via visual studio extension textmate grammar . process, documented here , consist of creating folder structure under %userprofile%\.vs\extensions , creating .json file grammar ( .plist seems working). i want enhance syntax highlighting in vs2017 csharp. example, if write sql query in verbatim string, use syntax highlighting sql. textmate allows define rules embeded language, should possible. thanks this article , came textmate grammar json { "name": "embeded sql", "scopename": "source.cs.embeded-sql", "filetypes": [ "cs" ], "patterns": [ { "begin": "\\bsql\\b.*\"", // match double quoted string preceding sql, 'var sql = "select...' or 'dbexecute(/*sql*/"select...' "end": "^\";", // ends double quote , apostrophe ...

javascript - Ajax Uncaught TypeError: in simple function -

in code getting error uncaught typeerror: cannot read property 'tolowercase' of undefined but when remove delay(function(){ ... }, 1000); from source file code works don't know doing wrong or missing important do, here full code function checkurl(textname) { $.ajax({ type: "post", url: "includes/modcontent/checkurl.php", data: "checkurl=" + textname, datatype:'text', //or html, json, etc. success: function(response){ //alert(response); textname = response; } }); return textname; } $('input[name=txtpagename]').keyup(function() { delay(function(){ $('input[name=txtseourl]').val(checkurl($(this).val())); }, 1000); }); var delay = (function(){ var timer = 0; return function(callback, ms){ cleartimeout (timer); timer = settimeout(callback, ms); }; })(); the immediate issue, amongst others, you're changing scope of ...

c# - Select Right Generic Method with Reflection -

i want select right generic method via reflection , call it. usually quite easy. example var method = typeof(mytype).getmethod("themethod"); var typedmethod = method.makegenericmethod(thetypetoinstantiate); however issue start when there different generic overloads of method. example static-methods in system.linq.queryable-class. there 2 definitions of 'where'-method static iqueryable<t> where(this iqueryable<t> source, expression<func<t,bool>> predicate) static iqueryable<t> where(this iqueryable<t> source, expression<func<t,int,bool>> predicate) this meand getmethod doesn't work, because cannot destiguish two. therefore want select right one. so far took first or second method, depending on need. this: var method = typeof (queryable).getmethods().first(m => m.name == "where"); var typedmethod = method.makegenericmethod(thetypetoinstantiate); however i'm not happy this, because m...

bash - How do I replace the last character and insert a character to the beginning of a string? -

say have text file follows: accio. aguamenti. alohomora. aparecium. what i'd is: -accio! -aguamenti! -alohomora! -aparecium! this i've tried: sed 's/.*[a-z]/-&!/g' which yields: -accio!. -alohomora!. which pretty close not need. help? you need use capturing group exclude character @ end: $ sed 's/^\(.*\)\.$/-\1!/' file or in 2 steps: $ sed -e 's/\.$/!/' -e 's/.*/-&/' file

javascript - error "ETXTBSY: text file is busy" on npm install -

when running npm install [any package] or npm install on homestead following error: npm err! etxtbsy: text file busy, rmdir '/home/vagrant/valemus-shop-starter/valemus-shop/node_modules/fsevents' gist of debug log. https://gist.github.com/martijnimhoff/118aab71ef9fe4ceb9b97be03e33f1df box 'laravel/homestead' (v3.0.0) node: v8.2.1 npm: 5.3.0 i tried removing fsevents directory, doesn't exist. how fix this? the same thing happened me my environment linux fsevents module dedicated mac please try following command npm install --no-optional

Vue-Strap Carousel sometimes misbeahves -

i using vue-strap carousel component display carousel. here code use: <section id="slider-area"> <div class="container"> <div class="row"> <div class="col-sm-12"> <div id="mycarousel" class="carousel slide" data-ride="carousel"> <carousel :interval=5000> <slider v-for="(slide,index) in slides" :key="slide.id" > <img v-bind:src="slide.filename " > </slider> </carousel> </div> </div> </div> </div> </section> usually carousel displays , works correctly, however, if leave running while, notice strage behaviour, e.g. slide (and carousel) disappear , when next slide appears, carousel comes back. have ...

extjs - How to convert array of object to array of model object -

i have model defined bus having fields tyre (string), color(string) , company(string ).in main panel trying read data 1 ajax , other webservice call.both of needs displayed on same grid. in store creating array of records has 2 arrays 1 prepared ajax call , other prepared webservice data.i call method , data webservice , push main records array have data type of object stores different. when checked using chrome dev tools seems me 1 prepared ajax equivalent model , other 1 object having fields.the below have model:function points model defined. data:object > have values webservice array object. dirty:false editing:false events:object id:"travel.data.model.bus-ext-record-1613" index:2 internalid:"ext-record-1613" modified:object phantom:true raw:object store:m the 1 webservice normal object in array combining , trying show on grid grid display above type of object. data : object > see object not have other properties tyre: "eight" color:...

visual studio - Version is never updated, when building a NuGet package in VSTS -

i started create own nuget packages , today wanted set build on vsts, automatically generates nuget package out of vs-project , pushes vsts-feed. after while successful building project , pushing feed. continuous integration wanted add version number, write in assemblyinfo file. lead me problem have now: i can see number being changed in log of build , when download , integrate locally vs, version right. but not on feed. feed totally ignores number. version number seems 1.0.0 somehow, , never changes. after building again, error message, because: the feed contains 'samplenugetpackage 1.0.0' i hope information , these screenshots enough understand problem :) to touble shooting issue, please check below aspects: 1. check if change assmbly version correctly in assemblyinfo.cs file assume need changes assembly version 1.0.0.0 1.0.1.0 , should change below lines in assemblyinfo.cs : [assembly: assemblyversion("1.0.1.0")] [assembly: asse...

excel vba - VBA Search for Header, Copy, and Paste all data below header -

i need create macro searches column header name, finds column, copies data below it, , pastes cell a3 of worksheet. for example, on sheet 1 +-----+------+-------+ | row | part | price | +-----+------+-------+ | 1 | x | 5 | | 2 | y | 6 | | 3 | z | 7 | +-----+------+-------+ so, macro search "part", copy x, y, , z (the number of rows can change, cant copy b2:b4), , paste a3 of sheet 2. then, search price, copy 5, 6, , 7, , paste b3 of sheet 2. etc etc here have far: sub cleanup() sheets("sheet1").select pn = worksheetfunction.match("part_no", rows("1:1"), 0) sheets("sheet1").columns(pn).copy _ destination:=sheets("sheet2").range("a3") end sub thank you! something this: sub cleanup() dim arrcols, shtsrc worksheet, rngdest range, hdr, pn arrcols = array("part_no", "qty", "units") '<< colu...

C# runing exe inside panel -

i trying open compiled exe inside panel of code , program stays inside panel, in other words, if move window or if close window, act same program. it's working programs example, "notepad.exe", others doesn't (calc.exe example doesn't), insist open outside panel, that's when need help. that's code far: public partial class form1 : form { [dllimport("user32.dll")] static extern intptr setparent(intptr hwndchild, intptr hwndnewparent); [dllimport("user32.dll")] private static extern bool movewindow(intptr hwnd, int x, int y, int cx, int cy, bool repaint); public form1() { initializecomponent(); } private void form1_load(object sender, eventargs e) { process process = process.start("calc.exe"); process.waitforinputidle(); setparent(process.mainwindowhandle, this.panel1.handle); movew...

jquery - how can I display that the user succesfully registered on my sign-in modal -

this ajax script if (result=='123') { $.ajax({ type: 'ajax', method: 'post', url: url, data: data, async: false, datatype: 'json', success: function(response){ if(response.success){ $('#signinform')[0].reset(); if(response.type=='add'){ var type = 'added' }else if(response.type=='update'){ var type ="updated" } } else { alert('error'); } }, }); }//end of if(result == '123') });//end of #btnsave if user pass ...

Clicking on svg on gmail login using selenium-python -

Image
i trying test gmail login using selenium. want execute test case where: loads url enter email-id click on svg element takes me accounts being used on computer i tried clicking on finding xpath using xpath helper throws me timeout exception. can please help? import unittest selenium import webdriver selenium.webdriver.common.keys import keys selenium.webdriver.common.by import selenium.webdriver.support.ui import webdriverwait selenium.webdriver.support import expected_conditions ec selenium.common.exceptions import nosuchelementexception class gmail(unittest.testcase): def setup(self): self.driver = webdriver.chrome() self.driver.get("http://www.gmail.com") def test_1(self): driver=self.driver try: print "entering email-id" self.email_id=driver.find_element_by_name("identifier") self.email_id....

How to save a Flutter canvas as a bitmap image? -

i have flutter canvas , , i'd save canvas bitmap image (e.g. png, common bitmap format do). what's best way bits out of canvas, converted bitmap image format? thanks much! create picturerecorder . create canvas picturerecorder , draw stuff. call endrecording() on picturerecorder picture . call toimage() on picture . call tobytedata() on image . oops, isn't implemented yet. filed issue .

mysql - How to find duplicate entries but first group by a column and then count and show it -

hello cannot solve this. have table user entries , ips. goal find user 1 , user 2 same ip. user_id | ip 1003 | 1.1.1.1 1003 | 1.1.1.1 1003 | 2.2.2.2 1004 | 1.1.1.1 1004 | 3.3.3.3 1005 | 4.4.4.4 1005 | 5.5.5.5 what want this user_id | same_ip_count 1003 | 2 1004 | 2 here see 1003 , 1004 showing 2 because both had @ least 1 time same ip. what show me ips had multiple user. select ip, count(distinct user_id) used_by_user_count user_entry ip != '' group ip having used_by_user_count > 1 and result ip | used_by_user_count 1.1.1.1 | 2 but couldn't make work user_id instead of ips. tried subqueries (little bit guesses) failed. hope can me. edit: made quick sqlfiddle http://sqlfiddle.com/#!9/0f8f04/4 i self-join each row other row(s) have same ip different user. using inner join, naturally finds cases there more 1 user. add 1 count first user a ...

Sending File Over Python Socket - Hanging at socket.sendall -

i've written thought simple script download files on network python sockets, server hangs on socket.sendall on server side. can file want once, subsequent calls senddata cause crash. after looking bit more, i'm sure it's how i'm packing header data, meaning may low-level issue beyond ken. for context: 'master' code running on x86 computer, while 'slave' code running on raspberry pi 0 (arm). the header's defined in code, here's overview: file length , length of filename bundled 8-byte header of 2 uints. filename , first chunk of (h264 video) data bundled 1kb initial send. the server sends further data in 1kb chunks until it's sent whole file. i'm pretty puzzled why doesn't work seems routine bit of code. slave (server) #takes filename , sends data connected socket def senddata(filename,socket): try: filehandle = open(filename,'rb') except ioerror: socket.sendall('abort') ...

aspxgridview - Re-Binding Gridview with SQL SelectCommand -

i have gridview control populated sql query. have following code in void page_load() response.write("debug: " + qry); // debugging systemlist_sql.selectcommand = qry; systemlist.databind(); the data displayed in gridview fine, when submit page button control debug query updated new query info, not bind gridview on reload. code button below. <asp:button id="btngenerate" runat="server" text="generate report"/> i'm sure overlooking basic here, but... can't see it.

Why does math.random(999999999999) returns 1 in Lua? -

i tried: print(math.random(999999999999)) , has printed 1 . also math.random() includes 999999999999 printing same thing. examples: print(math.random(1.999999999999)) » 1 print(math.random(1999999999999)) » 1 for k,v in next,{math.random(999999999999), math.random(1999999999999), math.random(2.999999999999)} print(v) end » 1 local n = math.random(999999999999) print(n==1) » true then think understood (if know lua of course). can explain me? @edits: the lua version i'm using 5.2. i tried print(math.random(-999999999999)) , printed 111711452 . looks worked positive number. this problem surely because math.random treats input arguments passed in lua 5.1 and/or 5.2. [mathlib.c] 1 : as may know in c , standard int can represent values -2,147,483,648 2,147,483,647 . adding +1 2,147,483,647 , in use-case, overflow , wrap around value giving -2,147,483,648 . end result negative since you're multiplying positive negative number. ther...

java - NoClassDefFoundError when deploying Wiremock in Docker container -

i have wiremock project using ivy/ant dependencies/builds. when run launch file in eclipse starts server , requests succeed. when build docker image , run it, crashes immediately. docker build: docker build --force-rm -t <repo_location>/assignment_form_api_mock:latest -t <repo_location>/assignment_form_api_mock:1.0.6 . docker run: docker run -d --name form-api-mock -p 10404:8080 <repo_location>/assignment_form_api_mock --verbose --extensions="com.gatesbiz.assignmentdispatch.mock.requesttemplatetransformerglobal,com.gatesbiz.assignmentdispatch.mock.adminareasrequesttransformer,com.gatesbiz.assignmentdispatch.mock.formsrequesttransformer,com.gatesbiz.assignmentdispatch.mock.vehiclerequesttransformer" while loading extensions docker logs stack trace: 2017-08-14 18:05:24.276 verbose logging enabled slf4j: failed load class "org.slf4j.impl.staticloggerbinder". slf4j: defaulting no-operation (nop) logger implementation slf4j: see http://w...

sql - Filtering Data based on calculation in Excel -

Image
i have data coming in query. filtered data sql, i'm not sure if boss me possible in sql. i tally value in column c if "load_beer" in column d. group data person (column f) , day (column e). then, take each person's tally, , divide sum of of values in column c person day. if value greater 0.8, take of person's data day, , move new sheet. below sample of data i'm using: here sql i'm using: select tally_tran_mstr.logon_id, sum(tally_tran_mstr.full_pllt_qty), tally_tran_mstr.shift_dt,tally_tran_mstr.shift_nbr wbr_rw.tally_tran_mstr (tally_tran_mstr.pri_grp_cd='load_beer') group tally_tran_mstr.logon_id, tally_tran_mstr.shift_dt, tally_tran_mstr.shift_nbr the sql shows data has "load_beer", not tally everything, divide it, , see if greater 0.8. an example of i'm trying (calculated manually) stevens has 7 items associated name on 6/15/2017. 3 of "load_beer". load_beer summed 165. sum of 7 items 181. 165/...

Left-align headers in markdown table? -

Image
using table example " markdown cheatsheet " on github, this: | tables | | cool | | ------------- |:-------------:| -----:| | col 3 | right-aligned | $1600 | | col 2 | centered | $12 | | zebra stripes | neat | $1 | my question is, there way left-align header cells? it depends on implementation using. tables non-standard feature of markdown , each implementation supports them differently. example, "cheetsheet" pointed in question within markdown here project. project's readme includes following explanation: to discover can done markdown in markdown here, check out markdown here cheatsheet , other wiki pages . so "cheetsheet" specific implementation used markdown here. github has documented there implementation of markdown extension of commonmark spec ( commonmark markdown variant not support tables). according example 192 , column headers receive same alignment column cells: ...

javascript - Can a prompt take two arguments at the same time? -

i know if prompt can take 2 arguments simultaneously, , store them in distinct variables. example: var = prompt(variable storing number , variable storing string) console.log(variable storing string); is legal or pure fantasy? let me know if needs more explanation. the prompt function takes 2 arguments: text display , default text of input, not work. i'd suggest either required data through 2 separate prompts or ask user provide both in single prompt , parse returned string afterwards separate integer , string.

amazon web services - Logstash input Cloudwatch logs config -

i needing pull in logs from cloudwatch logstash application load balancers. have multiple want read in for. wondering if knew capabilities behind filters field in config file. basically curious if can put multiple loadbalancer ids in filters field or if have have seperate input fields each one? input { cloudwatch { namespace => "aws/applicationelb" metrics => [my_metrics] filters => {"loadbalancer" => "name1", "loadbalancer" => "name2"} region => "my_region" } } or input { cloudwatch { namespace => "aws/applicationelb" metrics => [my_metrics] filters => {"loadbalancer" => "name1"} region => "my_region" } } input { cloudwatch { namespace => "aws/applicationelb" metrics => [my_metrics] filters => {"loadbalancer...

vue.js - Computed property based on child components -

is possible create computed property relies on child components data? seems trivial task can't figure out... foo component <template> {{ foo }} </template> <script> export default { computed: { foo() { return math.random() } } } </script> parent component <template> foo computed property sum: {{ sum }} <foo v-for="n in 10"></foo> </template> export default { computed: { sum() { // return...? } } } </script> you can , it's pretty unusual approach things, it's not best choice whatever you're trying achieve. instead, might keep data in parent , pass component prop. if use value prop name, can nice clean syntax v-model . (you have use foos[index] due fact you can't v-model alias , in case you're generating index anyway). new vue({ el: '#app', data: { foos...

Overriding the java equals() method quirk -

i ran interesting (and frustrating) issue equals() method today caused thought tested class crash , cause bug took me long time track down. just completeness, wasn't using ide or debugger - old fashioned text editor , system.out's. time limited , school project. anyhow - i developing basic shopping cart contain arraylist of book objects. in order implement addbook(), removebook(), , hasbook() methods of cart, wanted check if book existed in cart. off go - public boolean equals(book b) { ... // more code here - null checks if (b.getid() == this.getid()) return true; else return false; } all works fine in testing. create 6 objects , fill them data. many adds, removes, has() operations on cart , works fine. read can either have equals(type var) or equals(object o) { (cast) var } assumed since working, didn't matter much. then ran problem - needed create book object id in within book class. no other data entered it. following: public boolean hasboo...

command line interface - How to filter directories in midnight commander -

maybe stupid question, how can filter directories in midnight commander? for example have folder lot of directories in following naming: holidays (2016) birthdays (2016) holidays (2015) ... how can filter " 2015 " on directory tier? thanks in advance!

bash - Which shebang line should I use? -

there scripts in project run fine without first line (like #!/bin/ ) – without interpreter path. so these scripts running fine, in cases fail, when run – execute fine. i need modify , put shell interpreter first line. the problem here scripts fail when use #!/bin/ksh while others fail when use #!/bin/bash . can tell me when use option? how can make sure work fine, other way generalize , make interpreter common scripts? each script written in programming language - bash, ksh, zsh, python, perl .... can't instance write python program , hope perl can run it. similarily, ksh program needs executed ksh, bash program bash. now, since bash, ksh, zsh , posix shell do have common subset, possible execute of these command processors. if - , if! - sure applies these scripts, propose use posix shell, because restrictive one. but if people designate script bash, or ksh, or else, maintainer of script might sooner or later use features particular 1 of shell la...

twilio - Returning Twiml through c# -

trying out basic in twilio & c#. new twilio & not strong mvc public class incomingcallcontroller : twiliocontroller { // get: incomingcall [httpget] public actionresult index() { var response = new voiceresponse(); var dial = new dial(); response.contenttype = "text/xml"; response.say("please wait...transferring call"); dial.number("+919812345678"); return twiml(response); } } i need above code snippet return static twiml equivalent have put in twiml bin. i have configured phone number webhook url http://someaddress.azurewebsites.net/incomingcall why getting 11210-http bad host name error i understand doing wrong here. have tried using both post , request. can has knowledge of point me in right direction? where going wrong? any appreciated. some issues created programmers in tearing hurry...

python - Create a fix button with scrollbar in Tkinter -

Image
i run example scrollbar based here . want add button ( prev ) frame , when scrollbar moves down, button still stay there, while other content moves along scrollbar. here code: import tkinter tk class example(tk.frame): def __init__(self, root): tk.frame.__init__(self, root) self.canvas = tk.canvas(root, borderwidth=0, background="#ffffff") self.frame = tk.frame(self.canvas, background="#ffffff") self.vsb = tk.scrollbar(root, orient="vertical", command=self.canvas.yview) self.canvas.configure(yscrollcommand=self.vsb.set) self.vsb.pack(side="right", fill="y") self.canvas.pack(side="left", fill="both", expand=true) self.canvas.create_window((4,4), window=self.frame, anchor="nw", tags="self.frame") self.frame.bind("<configure>", self.onframeconfigure) self.populate() def populate(sel...

What would be an effective way to call a function with arguments from a list in python -

my current code similar following. def func(args): optionalparameters = ((args.split(':')[1]).split(' '))[1:] second_func(optionalparameters) this assumes args colon-separated string; takes second half, splits space-delimited words , returns (a list of?) first. situation more 1 colon included isn't yet handled, because new language. can optional_parameters passed not list? since parameters optional following effective? def func(args): optionalparameters = ((args.split(':')[1]).split(' '))[1:] val1=val2=val3=none try: val1 = optionalparameters[0] except indexerror: pass try: val2 = optionalparameters[1] except indexerror: pass try: val3 = optionalparameters[2] except indexerror: pass second_func(val1, val2, val3) it seems standard library modules might able of this. i...

amazon web services - Is there a way to put data into Kinesis Firehose from S3 bucket? -

i want write streaming data s3 bucket redshift through firehose data streaming in real time (600 files every minute) , dont want form of data loss. how put data s3 kinesis firehose? its designed opposite, firehose sends incoming streaming data to amazon s3 not from amazon s3, , other s3 can send data other services redshift , elasticsearch service. i don't know whether solve problem can use copy s3 redshift. hope help!

nlp - Source Code vs. Natural Language Detection -

are there existing tools detecting whether piece of text source code or natural language? not need identify programming language nor natural language. however, ideally flexible programming , natural language. for example, piece of text identified source code: def fib(n): a, b = 0, 1 while < n: print(a, end=' ') a, b = b, a+b print() and piece of text identified natural language: hello! natural language.

grails - Issues with sending oauth-signed lti posts to moodle -

i'm attempting send grades moodle external tool i'm developing moodle. external tool written in grails. have moodle uses oauth log users external tool. understanding, should able change user's grade sending post request signed oauth url given me on login, xml document containing lis_result_sourcedid parameter given on login grade. code sending post request working save part signing request -- moodle consistently giving me response saying "message signature not valid". here code sending post request: string rawxml = getrawxml(); curmessageid++; def jsonmap = json.parsejson(sourcedid) rawxml = rawxml.replace("{message_id}", long.tostring(curmessageid)) .replace("{score}", double.tostring(grade)) .replace("{text_data}", textdata) .replace("{sourced_id}", sourcedid) def request = new httprequest() .seturi(responseurl) ...

c - Unicode escape sequences vs hexadecimal values -

to encode unicode/utf-8 characters in program, i've been using \uxxxx escape sequences, such as: wchar_t superscript_4 = l'\u2074'; // u+2074 superscript 4 '⁴' wchar_t subscript_4 = l'\u2084'; // u+2084 subscript 4 '₄' however, using hexadecimal should work fine, since unicode encoded in hexadecimal. wchar_t superscript_4 = 0x2074; wchar_t subscript_4 = 0x2084; will second example encode character properly? run wide-char issues, segmentation faults, or incorrectly stored character values? if so, why? if not, why? you could initialize them hex constants, initialize normal char s numeric constants, e.g. char c = 67; . works same way; assigns whatever char or wchar_t has value of int . in example give, , assuming unicode execution environment (not quite guaranteed highly probable) it’s subscript or superscript 4; in example it’s capital c . in particular , regular char s, technically character constants 'c' hav...

Angular 4 Bootstrap 4 not rendering properly -

Image
i have fresh created angular 4 cli app following packages installed: npm install bootstrap@4.0.0-beta jquery tether popper.js --save .angular-cli.json extraction: "styles": [ "styles.css", "../node_modules/bootstrap/dist/css/bootstrap.min.css" ], "scripts": [ "../node_modules/jquery/dist/jquery.slim.min.js", "../node_modules/tether/dist/js/tether.min.js", "../node_modules/popper.js/dist/umd/popper.min.js", "../node_modules/bootstrap/dist/js/bootstrap.min.js" ], with setup have navbar component html code the official bootstrap 4 page not rendering properly: has toggle button when browser in full screen mode, background color missing, "navbar" , toggler swapped. however, works when use bootstrap 4 cdn . other styles except navbar work expected in both cases. so, doing wrong when working bootstrap installed locally? it sounds there breaking change css in 4.0.0-...

mql - How to enter a new order only if / when the first one has been executed (filled)? [MQL5] -

i'm kinda of new in mql5. i have ea buys 1 stock first (let's petr4) , buys 1 (let's abev3). the problem can order second 1 when first 1 executed (not placed). i used mqltraderesult.retcode return number, shows if order has been placed , need know if order has been filled in order continue second operation. can me? thanks such indication ought coded in positionselect() call: first call if ( positionselect( "petr4" ) ) { ... /* further work go here */} this chooses open position further working it. returns true if function completed. returns false in case of failure. if there active position reported given symbol, further work go ahead inside {...} -code-block the hidden magic in fact, there either single- position symbol, or none @ all . makes rest of logic crystal-clear. execution of trade operations results in opening of position , changing of volume and/or direction, or disappearance. trade operations conducted bas...

Pass R variable to RODBC's sqlQuery with multiple entries? -

i'm in process of learning r, wave sas goodbye, i'm still new , somehow have difficulties finding i'm looking for. but specific case, read: pass r variable rodbc's sqlquery? , made work myself, long i'm inserting 1 variable in destination table. here code: library(rodbc) channel <- odbcconnect("test") b <- sqlquery(channel, "select top 1 noinscr table prixvente > 100 order datevente desc") sqlquery(channel, paste("insert testtable (uniqueid) values (",b,")", sep = "") when replace top 1 other number, let's top 2 , , run exact same code, following errors: [1] "42000 195 [microsoft][sql server native client 10.0][sql server] 'c' not recognized built-in function name." [2] "[rodbc] error: not sqlexecdirect 'insert testtable (uniqueid) values (c(8535735, 8449336))'" i understand because there c generated, assume column when ...

Updating template data extjs -

i making window panel holds tpl config , have passed config named recordref window component following, wish update tpl config data in recordref. rowdblclick: function(view, record,element,rowindex,e,eopts){ var me = this; ext.create('mywindow',{ recordref: record }); } my window looks this ext.define('mywindow',{ extend: 'ext.window.window', alias: 'widget.details', controller: 'details', ghost: false, constrain: true, title: 'details', modal: true, resizable: false, autoscroll: true, items: [ { xtype: 'panel', reference: 'infopanel', items: [ { xtype: 'panel', tpl: ['<p>name: {name}</p>', '<p>age: {age}</p>'], listeners: { render: ...

vue.js - vue router's router-link in google maps infowindow -

i've got working fine, except i've instead of <a> tag use <router-link> tag because of <a> tag unlike <router-link> (which intercepts click event , don't reload page) reloads page. const contentstring = ` <div class="popup"> <a href="/places/${place._id}"> <img src="..." /> <h5>${place.name}</h5> <p>${place.gmap.address}</p> </a> </div>` const infowindow = new google.maps.infowindow() infowindow.setcontent(contentstring) if replace <a> tag <router-link> doesn't render <a> tag if <router-link> in vuejs template. you right. router-link wasn't rendered because vue.js got no chance render it. can let vue.js render template @ first, rendered result string using innerhtml , , pass string google maps api( setcontent ). i'd provide 2 solutions here. ...

git - Going back to a previous commit in Gitkraken -

my programming partner , i, being new git , gitkraken, made mistakes, did pushes pulls , commits in wrong order, , got things bungled up. go snapshot several commits back, , manually compare current state of code. command along lines of "take working directory state this historic commit" or better yet, "give me contents of this historic commit different working directory, name" the options given me don't way, exactly. see "reset master commit" in several flavors, none of titles convince me i'm going @ previous state without damaging path current state. missing something? best way i'm trying do? i suggest tu use git reflog , command contains local history of commits , changes, log see events local repo. after finding exact commit want recover, can set commit starting point git reset --soft head@{n} what --soft does not touch index file or working tree @ (but resets head <commit>, modes do). leaves changed files ...