Posts

Showing posts from January, 2014

c# - class vs static methods -

i'm new in python (come c#), trying figure out how oop works here. started begining try implement vector class. want have basis vectors (i, j, k) defined in vector class. in c#, can that: public class vector { // fields... public vector(int[] array){ //... } public static vector i(){ return new vector(new int[1, 0, 0]); } } exploring python found 2 ways how implement this: using either @classmethod or @staticmethod : class vector: def __init__(array): #... @classmethod def i(self): return vector([1, 0, 0]) since don't need have access information inside class, should use @classmethod ? i think you've confused naming of arguments bit. first argument class method receives class itself, vector, now, until have subclass. class method implemented this: @classmethod def i(cls): return cls([1, 0, 0]) generally, instance method (no decorator) calls first argument self , ins...

android - Cannot Receive App Intent Type Nearby Notification - Beacons -

i registered beacon (simulated app on android device , of type eddystone-uid) , tried set nearby notifications google beacon platform dashboard. when created notification of type "app intent", not received on device when close 1 acting beacon. however, if set nearby notification of type "web url", displayed on device within range of beacon. when setting notification of type app intent, provide following details: 1. intent scheme (same scheme in code below) 2. package name of app - same what's in app's manifest file left intent path field blank not mandatory. this intent filter in app's manifest: <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> <category android:name="android.intent.category.default"/> <category android:name="android.intent.categor...

asp.net mvc - C# MVC - Creating and uploading a zip file to FTP -

i creating xml file using following 2 methods: public string getxmlstringfromfeedmodel<t>(t feedmodel) { var builder = new stringbuilder(); using (stringwriter writer = new encodingstringwriter(builder, encoding.utf8)) { xmlserializer serializer = new xmlserializer(typeof(t)); serializer.serialize(writer, feedmodel); return writer.getstringbuilder().tostring(); } } public filecontentresult getxmlfilefromxmlstring(string xmlstring, string filename ) { return new filecontentresult(encoding.utf8.getbytes(xmlstring), "application/xml") { filedownloadname = filename }; } i zip file method public filecontentresult zipfile(filecontentresult file, string filename) { using (var compressedfilestream = new memorystream()) { //create archive , store stream in memory. using (var ziparchive = new ziparchive(compressedfilestream, ziparc...

java - Spring 4.3.10 controller throws Http 400 (Bad Request) whereas Spring 3.1.1 works just fine -

we have legacy code running spring 3.1.1. controller looks this: @requestmapping(value = "/model/save", method = { requestmethod.get, requestmethod.post }, headers = "accept=application/json; charset=utf-8") @responsebody public responsedto save(@requestbody jsonnode jsonproperty, httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { myobject myobject = new objectmapper().readvalue(jsonproperty, myobject.class); // save myobject here ... } right now, controller works expected. i'm in process of upgrading spring 4.3.10. part of task, have latest spring jars , corresponding jackson jars in classpath. time, http 400 (bad request) error. just looking @ legacy code, realized reading jsonnode request body , mapping model saved. changed code this: @requestmapping(value = "/model/save", method = { requestmethod.get, requestmethod.post }, headers = "accept=application/json; charset=u...

Similar Example in Angular UI Grid -

looking similar example of angular ui grid given in http://technoscripts.com/export-html-table/ datatables - png, excel, pdf etc., angular ui grid example has export pdf , csv below content of index.html <head> <script src="angular.min.js"></script> <script src="ui-grid.min.js"></script> <script src="csv.js"></script> <script src="pdfmake.js"></script> <script src="vfs_fonts.js"></script> <link rel="stylesheet" href="ui-grid.min.css" /> </head> <body> <div ng-controller="mainctrl"> <div id="grid" ui-grid="gridoptions" ui-grid-pagination ui-grid-exporter class="grid"></div> </div> <script src="app.js"></script> </body> </html> below content of app.js var app = angular.module('app...

node.js - How can I delete/uninstall everything? I want it to be the same as the time that hadn't started react native learning -

i have been learning reach native weeks. got stuck somewhere , start beginning. need uninstall react, react native, redux, thunk , etc. have node.js. how can delete/uninstall everything? want same time hadn't started react native learning. on windows need go control panel > add remove programs , features > find node.js , uninstall. poof! remove node... far npm packages go, looks stored default in \home\appdata\roaming\npm. delete folder rid of global packages. if have project installed non global (local) project packages need delete node_modules folder in projects folder

hadoop - Hive Dynamic Partition for HDFS file -

i want create external table partition column. partition column dynamic based on application id. for example hdfs folder location is /local/test/log/appid=app1 /local/test/log/appid=app2 /local/test/log/appid=app3 /local/test/log/appid=app4 inside above folders, there multiple log files in csv format. i want create hive external table partition appid, if run below query: select * table appid='app2'; it should return me result. so far, have created hive table, seems not working. here show create table details: create external table `app_log`( `log_time` string comment 'from deserializer', `log_src` string comment 'from deserializer', `log_msg` string comment 'from deserializer') partitioned ( `appid` string) row format serde 'org.apache.hadoop.hive.serde2.opencsvserde' serdeproperties ( 'escapechar'='\\', 'quotechar'='\"', 'separatorchar'=',') stored input...

javascript - Drop down menu Validation multiple buttons W/ Alert -

i'm trying create form gathers information regarding users. form has 5 steps: step 1: user information (name, email, phone, age, gender) step 2: yes or no question step 3: yes or no question step 4: yes or no question step 5: yes or no question the form allows users go next stage, or go previous step. before allowing user move next step, user must fulfill requirement. validation alert user if question not answered. how add validation drop down menu /w alert steps, allowing user go next step , previous. my code: var current_fs, next_fs, previous_fs; //fieldsets var left, opacity, scale; //fieldset properties animate var animating; //flag prevent quick multi-click glitches $(".next").click(function(){ document.getelementbyid('btnnext').addeventlistener('click', function(){ //text inputs if(!document.getelementbyid('fullname').value){ alert('full name required'); return false; } else if(!document.geteleme...

Procfile on Node.js/Heroku -

i rereading tutorial https://devcenter.heroku.com/articles/getting-started-with-nodejs#introduction polish understanding of node.js/heroku . there section called define procfile . but when go see own apps check inside file. see number of apps (not all) have no such file , working fine. so, going on? when procfile necessary? happens if there none? when better have one? to started, heroku try automatically detect type of app , start appropriately, when doesn't have profile (see example here - http://blog.taylorrf.com/blog/2014/12/15/heroku-default-server/ ). for example in node, if have index.js file , package.json file, it's node app started node index.js . while convenient, considered bad practice, because: heroku may change how auto detect apps in future, breaking deployment. you might missing out on configurations / optimizations doing (see article linked above).

visual studio code - why error connecting to github from powershell command line? -

first time using github. created repository on github.com. want push repository. getting "connection failed" error. when run " ssh -tv git@github.com " " connection timed out ". , " ssh -t -p 443 git@ssh.github.com " fails with: permission denied . i turned off windows firewall. same error. what do? how connect github? using vscode. working powershell command line. here commands tried: ps c:\gitsteve\maker> ssh -tv git@github.com openssh_7.1p2, openssl 1.0.2g 1 mar 2016 debug1: reading configuration data /etc/ssh/ssh_config debug1: connecting github.com [192.30.255.112] port 22. debug1: connect address 192.30.255.112 port 22: connection timed out debug1: connecting github.com [192.30.255.113] port 22. debug1: connect address 192.30.255.113 port 22: connection timed out ssh: connect host github.com port 22: connection timed out ps c:\gitsteve\maker> git push -u origin master ssh: connect host github.com port 22:...

user interface - Configuring Jenkins Multibranch Pipelines without the GUI -

is possible configure jenkins multibranch pipelines - associated credentials, plugins (for bitbucket repos plugin required), , nodes - terminal? my concern that, @ best, automating configuration of jenkins multibranch pipeline may have include manually performing above tasks via gui every time. you can use dsl plugin generate multi branch pipeline job here example multibranchpipelinejob('pipeline-test') { branchsources { git { remote('git@github.com:xxx/reponame.git') credentialsid('xxxxx-yyyyy-zzzzz') excludes('master') } } description ("""<p> <b>generate dsl - not change manually </b> <p>""") triggers { periodic(2) } orphaneditemstrategy { discardolditems { numtokeep(0) daystokeep(0) } } ...

java - concurrency - How to make it queue and not reject? -

using answer given user sjlee here impossible make cached thread pool size limit? with code new threadpoolexecutor(100, // core size 10000, // max size 1000, // idle timeout timeunit.milliseconds, new linkedblockingqueue<runnable>(integer.max_size)); // queue size if there more coresize 100 * queuesize 20 tasks, number of thread increase until hits max size. ok. but problem is, lets everything's done , there no more tasks, number of threads not decrease. how make executor reduce number of threads 0 when they're idling? next, how make executor queue extras run later? you can use allowcorethreadtimeout(true) core-thread terminate when timeout.

.NET Core 2.0 missing from my Visual Studio -

Image
so i've installed official .net core 2.0 sdk , when i'm in visual studio heaps of errors , target framework not listed :( it's .net core 2.0 isn't installed. and here's .csproj file: <project sdk="microsoft.net.sdk.web"> <propertygroup> <targetframework>netcoreapp2.0</targetframework> </propertygroup> <itemgroup> <folder include="wwwroot\" /> </itemgroup> <itemgroup> <packagereference include="microsoft.aspnetcore.all" version="2.0.0" /> </itemgroup> </project> also, dotnet --version returns 2.0.0 so .. there install tooling i'm missing? edit/update: here's system info vs: microsoft visual studio community 2017 version 15.3.1 visualstudio.15.release/15.3.1+26730.8 microsoft .net framework version 4.7.02046 installed version: community visual basic 2017 00369-60000-00001-aa912 microsoft visua...

Hyperledger fabric: No script -

Image
i following tutorial on http://hyperledger-fabric.readthedocs.io setup own hyperledger. building first network using "first-network" in fabric-samples. ./byfn -m generate ok, after using ./byfn -m receive below error: /bin/bash: ./scripts/script.sh: no such file or directory the script.sh file available in: \fabric-samples\first-network\scripts after running 'docker ps -a' get: my os windows 10. know causing , how resolve this? check out http://hyperledger-fabric.readthedocs.io/en/latest/prereqs.html#windows-extras - part on git settings required windows prior cloning samples repository: git config --global core.autocrlf false git config --global core.longpaths true

c++ - I met some strange errors when I practiced in LeetCode -

i try use stack implement queues, description . solution below: class myqueue { public: /** initialize data structure here. */ stack<int> my_stack; myqueue() { } /** push element x of queue. */ void push(int x) { stack<int> my_new_stack; my_new_stack.push(x); for(int = 0; < my_stack.size();i++){ my_new_stack.push(my_stack.top()); my_stack.pop(); } for(int = 0; i< my_new_stack.size();i++){ my_stack.push(my_new_stack.top()); my_new_stack.pop(); } } /** removes element in front of queue , returns element. */ int pop() { // queue empty int temp = my_stack.top(); my_stack.pop(); return temp; } /** front element. */ int peek() { return my_stack.top(); } /** returns whether queue empty. */ bool empty() { return my_stack.empty(); ; } }; /** * myqueue object insta...

visual studio 2012 - Could not load file or assembly 'CrystalDecisions.ReportAppServer.CommLayer, Version=11.5.3300.0 -

how resolve missing assembly exception while creating object of reportdocument in crystal reports runtime. environment: visual studio 2012 / 2013 in control panel installed programs list " crystal report run time engine .net framework 2.0 can seen ". detailed description of error: "could not load file or assembly 'crystaldecisions.reportappserver.commlayer, version=11.5.3300.0, culture=neutral, publickeytoken=692fbea5521e1304' or 1 of dependencies. system cannot find file specified.":"crystaldecisions.reportappserver.commlayer, version=11.5.3300.0, culture=neutral, publickeytoken=692fbea5521e1304"

replace - Replacing unique character with others in android studio -

i want replace character in string: "google.com\123" i want replace "\" "/" link correct. string google = "google.com\123"; google = google.replace("\", "/"); but doesn't work since "\" character unique. use code string google = "google.com\123"; google = google.replace("\\", "/"); this work

algorithm - Randomized Quick Sort worst case Time Complexity -

time complexity of normal quick sort in worst case o(n^2) when 1 of following 2 cases occur: input sorted either in increasing or decreasing order all elements in input array same in above 2 mentioned cases, partition algorithms divide array 2 sub-parts, 1 (n-1) elements , second 0 elements to avoid bad case, use version of quicksort i.e randomized quick-sort , in random element selected pivot. expected t.c of randomized quick-sort theta(nlogn) . my question is, input/case, randmized quick-sort result worst time complexity of o(n^2)? if input contains elements same, runtime of randomized quick-sort o(n^2). that's assuming you're using same partition algorithm in deterministic version. analysis identical. here's implementation of randomized quicksort counts number of compares performed: import random def quicksort(a, lo, hi): if lo >= hi: return 0 p, compares = partition(a, lo, hi) compares += quicksort(a, lo, p - 1) co...

java - JSP first running on tomcat -

Image
i run jsp page first time on tomcat print statement , printed 3 times instead of 1. <% system.out.println("hello world"); %> the output :

firefox devtools: cannot commit scss file changes, file reverts 2 seconds after save -

i running koala scss compiling. in ff devtools settings, activated source-map files. can alter scss file in ff devtools-style editor, save changes, koala goes green of joy, see the changes magically appear in ff main window. perfect point. strange happens: 2 seconds or after save, in devtools-style editor scss file reverts state before save. made changes in ff main window persist, don't vanish. same scss file on disk: made changes still there. not in devtools-style editor. here gone. ideas? thx!

c# - One Entity 2 Tables in EF Core 2.0 -

with ef core 2.0 possible map 1 entity in 2 tables? something similar in ef6 (the 2 configurations equal, samples). protected override void onmodelcreating(modelbuilder modelbuilder) { modelbuilder.applyconfiguration(delegate(entitymappingconfiguration<student> studentconfig) { studentconfig.properties(p => new { p.id, p.studentname }); studentconfig.totable("studentinfo"); }); action<entitymappingconfiguration<student>> studentmapping = m => { m.properties(p => new { p.id, p.height, p.weight, p.photo, p.dateofbirth }); m.totable("studentinfodetail"); }; modelbuilder.entity<student>().map(studentmapping); } ef core 2.0 adds table splitting , owned types (ef6 complex types replacement), asking - entity splitting , still not supported. there open feature request relational: entity splitting support...

android - How to post exception of arithmetic overflow in C/C++ with compiler convenience -

when run android program, find native exception, believe exception comes line of code may cause arithmetic overflow. question arithmetic overflow not report in c/c++, least when test g++ , linux os. i presume overflow reported because of additional compiler functions when compiling android. exact question how make following code post exceptions when running it. int main(){ size_t size = 0; size--; return 0; } size_t unsigned type. there never arithmetic overflow. instead result of calculations on unsigned types wrapped within value range, if repeatedly adding or subtracting 1 more maximum value. means after size-- , size hold value size_max . signed integer overflow, on other hand, has undefined behaviour. might interested in catching that. gcc has support catching undefined behaviour related signed integer overflow. given following program, undefined behaviour happens when size = int_min decremented: #include <stdio.h> #include <limits.h...

In SQL, what's the difference between count(column) and count(*)? -

i have following query: select column_name, count(column_name) table group column_name having count(column_name) > 1; what difference if replaced calls count(column_name) count(*) ? this question inspired how find duplicate values in table in oracle? . to clarify accepted answer (and maybe question), replacing count(column_name) count(*) return row in result contains null , count of null values in column. count(*) counts nulls , count(column) not [edit] added code people can run it create table #bla(id int,id2 int) insert #bla values(null,null) insert #bla values(1,null) insert #bla values(null,1) insert #bla values(1,null) insert #bla values(null,1) insert #bla values(1,null) insert #bla values(null,null) select count(*),count(id),count(id2) #bla results 7 3 2

c# - How to call Action<string, bool> from il generator -

in example code trying invoke anonymous action il generator. not sure if , how can load reference delegate , how call it. can if onfunctioncall static method not property. public delegate void testdelegate(); public static class exampleone { public static action<string, bool> onfunctioncall => (message, flag) => console.writeline("example"); } public static class exampletwo { public static ttype createdelegate<ttype>(action<string, bool> onfunctioncall) ttype : class { var method = new dynamicmethod($"{guid.newguid()}", typeof(void), type.emptytypes, typeof(ttype), true); ilgenerator il = method.getilgenerator(); // emit code invoke unmanaged function ... // loading first string argument il.emit(opcodes.ldstr, method.name); // not sure here how load boolean value stack il.emit(opcodes.ldc_i4_0); // line doesn't work // example...

Python web crawling error :"DistutilsPlatformError: Unable to find vcvarsall.bat" -

i wrote simple web crawling code, crawls craigslist. after defining "single_item_data", result breaks down , says "distutilsplatformerror: unable find vcvarsall.bat" 1 can explain reason why? thank responding question! import requests bs4 import beautifulsoup def trade_spider(max_page): page = 1 while page <= max_page: url = 'https://seoul.craigslist.co.kr/search/apa?s=%s' % max_page source_code = requests.get(url) plain_text = source_code.text soup = beautifulsoup(plain_text) link in soup.findall('a', {'class' : 'result-title hdrlnk'}): href = 'https://seoul.craigslist.co.kr' + link.get('href') title = link.string get_single_item_data(url) page += 1 def get_single_item_data(item_url): source_code = requests.get(item_url) plain_text = source_code.text soup = beautifulsoup(plain_text) i...

Kill Spark application used by Zeppelin on YARN after X time of inactivity -

running spark on yarn apache zeppelin, consumming x % of queue, if no-body using it. since running night cron jobs, kill/quit/exit zeppelin spark application, after x minutes of inactivity, queue free night jobs. killing cron decent working solution killing jobs @ fixed time (say 04 am). a more elegant solution integrate zeppelin livy (see https://docs.hortonworks.com/hdpdocuments/hdp2/hdp-2.6.1/bk_zeppelin-component-guide/content/zepp-with-spark.html ) livy can configured terminate (and release resources) after x minutes of inactivity.

android - How to set focus listener on TextInput in react native -

hi using textinput in react native application. want open date dialog on clicking on textinput . came in mind if allows listen focus events may work me. i didn't find word around this. know how set focus listener on textinput in react native ? <textinput style={{ height: 40, bordercolor: "gray", borderwidth: 1, margintop: 8 }} underlinecolorandroid="transparent" placeholder={strings.schedule_date} onkeypress={keypress => console.log(keypress)} /> you can use onfocus prop this. callback called when text input focused. can read document .

Android paypal capture and send specified details to the backend -

i implementing android paypal app, right i'm able send paymentid , approval on backend, how send amount backend? below json response. { "amount": "0.5", "currency_code": "myr", "short_description": "credit top-up", "intent": "sale" } { "client": { "environment": "sandbox", "paypal_sdk_version": "2.15.3", "platform": "android", "product_name": "paypal-android-sdk" }, "response": { "create_time": "2017-08-20t10:25:11z", "id": "pay-5mu049465a842625glgmwg6y", "intent": "sale", "state": "approved" }, "response_type": "payment" } i can capture , send id , state backend, couldn't capture amount , how able capture it? appreciated! according paypal documentation response bel...

python - zsh: conda not found even after included in path and installed -

i doing & messed everything. if type conda in terminal , says zsh conda not found here's .zshrc file alias python='python3' # added anaconda3 4.4.0 installer export path="/users/abhimanyuaryan/anaconda/bin:$path"export path="/usr/local/opt/opencv3/bin:$path" i tried re-installing anaconda says it's installed in home directory consider upgrading anacoda , installation fails with message installer failed error contact manufacturer assitance removed anaconda , reinstalled anaconda fixed problem

javascript - How to speed up the image/website loading, as its taking 30+sec? -

is there way speed image/website loading, it's taking 30+sec load, i'm guessing waiting of images ready, there way load images load, kind of dynamic loading? thank you!` http://photo-st-art.com/galleries/arts/

c++ - typedef struct with undeclared/undefined type -

i reading webrtc source code vad, , confused code typedef struct webrtcvadinst vadinst; i have searched code webrtcvadinst , did not find source related struct webrtcvadinst. on other hand, did find vadinst . typedef struct vadinstt_ { int vad; int32_t downsampling_filter_states[4]; ... ... int init_flag; } vadinstt; and vadinst* webrtcvad_create() { vadinstt* self = (vadinstt*)malloc(sizeof(vadinstt)); webrtcspl_init(); self->init_flag = 0; return (vadinst*)self; } and, compiles successfully. how work? the typedef combines forward declare , typedef in single line. in c++ written struct webrtcvadinst; // forward declare struct typedef webrtcvadinst vadinst; // , introduce alternate name there no problem in either language form pointer unknown struct, pointers structs (and classes in c++) required have same size. so code shown never uses struct (if exists) pointer (vadinst*) . , that's ok language-wis...

iis 7.5 - asp.net with strange URL -

i developed asp.net web application vs 2017 , .net framework 4.5 don't know why url appeared below attached image ip address/app name/ (some thing strange)/page name asp.net application url

css - Bootstrap positioning objects dinamically in columns -

i'm trying display objects in 3 columns using bootstrap 4. when using code appears in 1 column, this: web 1 column. but idea displayed (more or less): web template 3 columns . <div class="row-mt-5"> <div ng-repeat="woman in women"> <div class= "col-lg-4"> <!--card--> <div class="card"> <!--card image--> <img class="img-fluid" ng-src="{{woman.image_url}}" alt="{{woman.name}}"> <!--card content--> <div class="card-body"> <!--title--> <h4 class="card-title">{{woman.name}}</h4> <!--text--> <p class="card-text"> <h5>{{woman.field}}</h5> <br...

vb.net - VB to C# "valuechanged" syntax -

this question has answer here: c# equivalent vb.net 'handles button1.click, button2.click' 6 answers i trying learn c# , rewriting small calculator vb c#. have been used following vb: private sub nudgkcxcorddiammm_valuechanged(sender object, e eventargs) handles nudgkcxcorddiammm.valuechanged, nudgkcxpasses.valuechanged, nudgkcxfacets.valuechanged, nudgkcxcords.valuechanged, nudgkcxextracord.valuechanged with stated above able have value change between multiple different things ex: of "xxxxxx.valuechanged" listed above in 1 private sub. how write above in c#? you need register events dynamically using "+=" code below : public class test { public test() { nudgkcxcorddiammm.valuechanged += nudgkcxcorddiammm_valuechanged; } private void nudgkcxcorddiammm_valuechanged(object se...

css - White space at right of page -

my page has white space @ right using margins , paddings in mobile view. https://www.blazor.nl/uploads/get/a83c2617117c88b0/img-0002 my css: .page-wrapper .page-container { margin: 0; padding: 0; position: relative; } .page-wrapper .page-container .content-wrapper { margin: 0 50px 0 50px; min-height: 600px; position: relative; top: -120px; } .page-wrapper .page-container .content-wrapper .maincontent { padding: 30px; } } @media screen , (min-width: 768px) , (max-width: 992px) { .page-wrapper .page-container .content-wrapper .maincontent { padding: 20px; } } .page-wrapper .page-container { margin: 0; padding: 0; position: relative; } .page-wrapper .page-container .content-wrapper > h2 { color: #ffffff; margin: 0 0 10px; font-weight: 300; } @media (max-width: 767px) { .page-wrapper .page-container .content-wrapper > h2 { color: #696969; font-size: 24...

angular - template input and template reference variable in a template -

we create template input variable using let keyword while create template reference variable using #var var name of variable. can refer template reference variable anywhere in template. what scope of template input variable? how differ scope of template reference variable? can me understand examples? <div *ngfor="let hero of heroes">{{hero.name}}</div> <!--hero template input variable--> <input #heroinput> {{heroinput.value}} <!--heroinput template reference variable--> template context variable when compiler parses ng-template element contents identifies let-tplvar="ctxvalue" tokens , creates binding: [variable can used inside template] = "context variable" [tplvar] = "ctxvalue" context template variable can used anywhere inside template. ngfor : <div *ngfor="let hero of heroes">{{hero.name}}</div> the hero variable available...

python - exec() with nested loop in list comprehension inside function error -

exec() inside function gives different output, pass parameter needed function. consider code: def list_filter(expr,datalist,includelist) : exec(expr) print outlist datalist=['try kill me','black image'] includelist=['me'] expr="outlist = [i in datalist if all(j in j in includelist) ]" exec(expr) print outlist list_filter(expr,datalist,includelist) i have checked similar case here : how exec work locals? but different error, i'm using version 2.7.13 , check under general condition, exec() has no error @ all. found problem shows when there's 'nested loop' inside list comprehension statement, such using all() or any() . in case , if remove if condition list comprehension (make expr = "outlist = [i in datalist ]" ) correct output usual. any idea why? almost it's bad idea use exec in case shouldn't use @ all. but since asked: works correctly if pass in variables local scope: def lis...

node.js - Python socket.io - how to connect over HTTPS? -

i trying send socket.io message nodejs server on https. after googling around socketio on python; have written below simple code make test. although receive no compile error, receive nothing server. when analyzed via wireshark packetsniffer; noticed https connection not established (target server has valid signed certificate , can access server via js based frontend without problem).. from socketio_client import socketio, loggingnamespace nodejs_url = "https://targetserver.com" def on_message_response(*args): print('message', args) user_value = "test1" message_value = "hello" socketio(nodejs_url, 443, loggingnamespace) socketio: socketio.emit('message', { 'user': user_value, 'message': message_value}, on_message_response) socketio.wait_for_callbacks(seconds=1) do have idea why python socketio connection might not successful?

git - How to remove the shallow clone warning from HomeBrew -

➜ ~ brew info test error: no available formula name "test" ==> searching deleted formula... warning: homebrew/core shallow clone. complete history run: git -c "$(brew --repo homebrew/core)" fetch --unshallow error: no deleted formula found. i have modified git remote address mirror address of homebrew before. maybe it's relevant don't know. just says to complete history run: git -c "$(brew --repo homebrew/core)" fetch --unshallow

c++ - VCRUNTIME140D.dll was not found -

Image
i trying run program in visual studio 2015, getting below error when trying run in configuration x64 debug mode. (no problem when running in release mode or in 32bit configuration) in c:\windows\system32 vcruntime140.dll present. c:\windows\syswow64 both vcruntime140.dll & vcruntime140d.dll also, reinstalled visual c++ redistributable visual studio 2015 https://www.microsoft.com/en-in/download/confirmation.aspx?id=48145 . can me solve issue.

java - Required library at /natives/linux-arm/libconnect.so -

i'm working on own discord-bot using java. added feature use music-bot. wanted add volume command. added command in program. worked fine on microsoft windows computer. copied bot raspberry pi 3 because want use raspberry discord-bot server. started bot error library "/natives/linux-arm/libconnect.so" missing. i'm using lava-player on bot. how can fix problem? thank helping me. i'm still "newbie" on programming , i'm thankful every help edit: error list pastebin exception in thread "lava-daemon-pool-playback-1-thread-1" java.lang.unsatisfiedlinkerror: required library @ /natives/linux-arm/libconnector.so not found @ com.sedmelluq.discord.lavaplayer.natives.nativelibloader.extractlibrary(nativelibloader.java:93) @ com.sedmelluq.discord.lavaplayer.natives.nativelibloader.load(nativelibloader.java:77) @ com.sedmelluq.discord.lavaplayer.natives.connectornativelibloader.loadconnectorlibrary(connectornativel...

.NET Standard 2.0 / EntityFrameworkCore / DB2 / IBM.EntityFrameworkCore issue -

does here has experience ibm.entityframeworkcore package? i've created .net standard 2.0 library project in vs2017, added mentioned package, , tried make work following this , this tutorial ibm website, no luck. project compiled, @ runtime i'm getting system.typeloadexception following message: method 'applyservices' in type 'ibm.entityframeworkcore.infrastructure.internal.db2optionsextension' assembly 'ibm.entityframeworkcore, version=1.1.1.101, culture=neutral, publickeytoken=7c307b91aa13d208' not have implementation. any appreciated! thanks! update: exception happens try use context. means after context created, before dbcontext.onconfiguring call happens. i've solved it. turned out exception happens if actual entity types (i.e. mytype ) aren't defined in same assembly (project) context. in solution had entity types defined in 1 project, , dbcontext defined in different project, references first one, of course. t...

firebase - How can I make vuefire show loading screen? -

as title vuefire can auto data firebase database, needs loading time. want display css animation before data being fetched, there event can $watch when successed you can multiple ways. vuefire has readycallback out of box callback called when data fetched (ready). here is: var vm = new vue({ el: '#demo', data: function() { return { loaded: false } } firebase: { // simple syntax, bind array default anarray: db.ref('url/to/my/collection'), // can bind query // anarray: db.ref('url/to/my/collection').limittolast(25) // full syntax anobject: { source: db.ref('url/to/my/object'), // optionally bind object asobject: true, // optionally provide cancelcallback cancelcallback: function () {}, // called once data has been retrieved firebase readycallback: function () { this.loaded = true // note line } } } })

Scala: How to make a closure not to see changes in its free variable? -

in following code snippet, closure foo see changes made in x should in scala. however, how can make local variable y in foo hold value of x permanently , not see changes? scala> var x = 10 x: int = 10 scala> val foo = (a:int) => {val y = x; + y} foo: int => int = <function1> scala> foo(3) res1: int = 13 scala> x = 5 x: int = 5 scala> foo(3) //see changes made in x. how can make closure not see changes made on x? res2: int = 8 you this: val foo = ((x:int) => (a:int) => {val y = x; + y})(x) in case x bound in foo. what doing example of closure .

php - Laravel how to populate select box from database -

i have database table store list of country,now trying list of country in dropdown form,but not working, maybe missing something.this controller code ` public function details($id){ //fetch post data //$post = post::find($id); $country_options = country::pluck('country', 'id'); $country_options = db::table('regions')->orderby('country', 'asc')->pluck('country','id'); //pass posts data view , load list view return view('dashboard')->with('country_options',$country_options); }` and code echo dropdown in form ` ' @foreach($countries $country)'+ '<option value="{{ $country->id }}"> {{ $country->country }}</option>'+ '@endforeach'+` and route looks route::get('/business', 'businesscontroller@details')->name('business'); but keep getti...

javascript - "Uncaught syntax error" message from google chrome console -

Image
1m title said, keeping getting syntax error message chrome, , strange thing code execute, got error. tried use clear() clean console, did not work. and knows stable js console/editor can use learning js? want console/editor give me accurate result cos don’t want second guess myself. those constants in memory, when run whole script again trying declare first variable again. you need enter variables once console. plunker 1 tool can use learn javascript.

scala - Sangria-graphql: error when passing in derivedInputObjectType as an mutation argument -

i have following case class option fields: case class businessuserrow(id: string, firstname: option[string], lastname: option[string], email: option[string]) i trying create inputtype object business user object val businessuserinputtype = deriveinputobjecttype[businessuserrow]( inputobjecttypename("input"), inputobjecttypedescription("a business user") ) and want pass businessinputobject argument addbusinessuser mutation val businessuserinputarg = argument("input", businessuserinputtype) val mutation = objecttype("mutation", fields[repocontext, unit]( field("addbusinessuser", businessusertype, arguments = businessuserinputarg :: nil, resolve = c ⇒ c.ctx.businessuserrepo.create(c.arg(businessuserinputarg))))) but following compilation error: type dao.tables.businessuserrow @@ sangria.marshalling.frominput.inputobjectresult cannot used input. please consider defining implicit insta...

java - matching different sized strings -

actually went through research docuements , got situation match binary string binary string size uknown ex: "1110000010001001101011010100010000101101001001010010000101000011"== "1011010111010111111111010101100000000000101111101100011010011011" i want result true if string matches significant bits of string to compare 1 msb, compare first character below: boolean result = number1.charat(0) == number2.charat(0); for multiple msbs, use following code: int noofmsbs = 8; boolean result = number1.substring(0, noofmsbs - 1).equals(number2.substring(0, noofmsbs - 1)); to compare if whole number present msb in string: boolean result = number2.startswith(number1);

mysql - How to add a condition to the result of an SQL query? -

i have table, date_of_order|quantity 01/01/17 | 1 02/01/17 | 1 04/01/17 | 1 05/01/17 | 1 i need sum of quantities before 03/01/17, result of sql query include condition date if not in table, this: 03/01/17 2 i know how show sum: select sum(quantity) table_name date_of_order < '2017-01-03' but how include date(03/01/2017) result? thanks! just add separate column: select '2017-01-03' datestart, sum(quantity) table_name date_of_order < 2017-01-03

Android Kotlin class reified issue -

when want int value sharedpreferences getting unsupportedoperationexception show logcat, class int . what's wrong? operator inline fun <reified t : any> get(@xmls xml: string, @keys key: string, defaultvalue: t? = null): t { timber.d("${t::class} + $xml + $key + $defaultvalue") return when (t::class) { string::class -> getshared(xml)?.getstring(key, defaultvalue as? string ?: "") as? t ?: "" t int::class -> { timber.d("not triggered") //<< getshared(xml)?.getint(key, defaultvalue as? int ?: -1) as? t ?: -1 t } boolean::class -> getshared(xml)?.getboolean(key, defaultvalue as? boolean == true) as? t ?: true t float::class -> getshared(xml)?.getfloat(key, defaultvalue as? float ?: -1f) as? t ?: -1f t long::class -> getshared(xml)?.getlong(key, defaultvalue as? long ?: -1) as? t ?: -1 t else -> throw unsupportedoperationex...

arrays - Javascript combining two objects into new object with unique data element i.e. year -

i have following 2 objects in js year unique in both objects. want combine them new object year same. var financials = [{"year": 2013, "rev_prod1": 10000, "rev_prod2": 5000}, {"year": 2014, "rev_prod1": 8000, "rev_prod2": 10000}, {"year": 2015, "rev_prod1": 15000, "rev_prod2": 20000}] var stats = [{"year": 2013, "units_sold": 900, "hours": 55},{"year": 2014, "units_sold": 800, "hours": 45}, {"year": 2015, "units_sold": 1000, "hours": 70}] the expected output this: var combineddata = [{"year": 2013, "rev_prod1": 10000, "rev_prod2": 5000, "units_sold": 900, "hours": 55}, {"year": 2014, "rev_prod1": 8000, "rev_prod2": 10000, "units_sold": 800, "hours": 45}, {"year": 2015, "rev_prod1...

typoscript - Typo3 Sorting on view page by overwrite Demand? -

<f:link.page pageuid="{settings.listpid}" additionalparams="{tx_news_pi1:{overwritedemand:{order: 'crdate,asc'}}}" addquerystring="1"> sort crdate asc </f:link.page> <f:link.page pageuid="{settings.listpid}" additionalparams="{tx_news_pi1:{overwritedemand:{order: 'title,desc'}}}" addquerystring="1"> sort title desc </f:link.page> sort crdate asc sort title desc i added 2 sort link on page.i 1 sort working fine.when click on second sort.its not sorting according condition. sounds need condition changes asc or desc other value when asc link changes desc? replace hardcoded asc/desc text bits correct code i think when use addquerystring in link (with active order) order double in url? maybe can try excluding order link can sure there's 1 order in link: argumentstobee...

MySQL: Joining 3 tables doesn't return all results from 3rd Join -

goal : when given user_id , retrieve last 2 orders, payment information, , items inside order. query: select po.id, po.id order_id, po.user_id, po.deliveryaddress_id, po.delivery_type, po.store_id, po.placed_by, po.orderplaced_ts order_timestamp, pop.subtotal order_subtotal, pop.tax order_tax, pop.secondary_tax order_secondary_tax, pop.soda_tax order_soda_tax, pop.delivery_fee order_delivery_fee, pop.tip order_tip, pop.discount order_discount, pop.total order_total, pop.payment_method, pop.payment_details, pom.* `orders` po join `order_payments` pop on po.id = pop.order_id join`ord...

scrapy - cannot import name _parse_proxy (urllib2) -

i trying use scrapy python 2 , got error, file "/library/python/2.7/site-packages/twisted/internet/defer.py", line 1386, in _inlinecallbacks result = g.send(result) file "/library/python/2.7/site-packages/scrapy/crawler.py", line 95, in crawl six.reraise(*exc_info) file "/library/python/2.7/site-packages/scrapy/crawler.py", line 77, in crawl self.engine = self._create_engine() file "/library/python/2.7/site-packages/scrapy/crawler.py", line 102, in _create_engine return executionengine(self, lambda _: self.stop()) file "/library/python/2.7/site-packages/scrapy/core/engine.py", line 69, in __init__ self.downloader = downloader_cls(crawler) file "/library/python/2.7/site-packages/scrapy/core/downloader/__init__.py", line 88, in __init__ self.middleware = downloadermiddlewaremanager.from_crawler(crawler) file "/library/python/2.7/site-packages/scrapy/middleware.py", line 58, in...