Posts

Showing posts from July, 2010

java - Filter invoke twice when register as Spring bean -

i want use @autowire filter . define filter in securityconfig below: @override protected void configure(httpsecurity http) throws exception { http.sessionmanagement().sessioncreationpolicy(sessioncreationpolicy.stateless); http.addfilterbefore(geta(), basicauthenticationfilter.class); http.csrf().disable(); } @bean public geta(){ return new a(); } this filter a extends spring's genericfilterbean . i below output when invoke controller, shows filter hits twice. filter before filter before mycontroller invoke filter after filter after my observation is, invocation invoke spring container because if filter not register bean, hits once. reason , how can fix it? as have observed, spring boot automatically register bean filter servlet container. 1 option not expose filter bean , register spring security. if want able autowire dependencies filter needs bean. means need tell spring boot not register filte

html - ICE Connection failed on raspberry -

i have raspberry 3 hosts webrtc server (based on uv4l library) on port 8080. when click on button "call" script goes moment after shows "ice connection failed". here interface i'm sure webcam correctively linked uv4l. it's school application i'm using university network maybe there firewall restrictions or else block communication... if help, lot have day !

Android pending intent not invoked in twilio incoming call -

i making calling app using twilio sdk have integrated stuff , in wokring condition. problem when android app remains in background long time app didn't receive incoming call request , pending intent not invoked twilio here code: if (!twilio.isinitialized()) { /* * needed setting/abandoning audio focus during call */ twilio.initialize(context, new twilio.initlistener() { /* * sdk initialized can register using capability token. * capability token json web token (jwt) specifies how associated device * can interact twilio services. */ @override public void oninitialized() { isinitialized = true; twilio.setloglevel(log.verbose); /* * retrieve capability token own web server */ retrievecapabilitytoken(

Update static global variable from another file in c -

update static variable outside of file without modifying file in static variable declared in c lang. proj1 creates dll. proj1 has abc.h file , defined below : static bool stvar = false;//declared global static variable func1() { stvar= true; } func2() { if(stvar == true) { .... } else { func1(); //call func1 sets stvar = true; } } proj2 creates exe. has cprog1.c file. cprog1.c file defined follows: cprogfunc1() { func2(); //call func2 sets stvar = true; } cprogfunc2() { stvar = false; func2(); } we setting stvar false in cprogfunc2() make execute else block in func2() of abc. h file . value set in cprogfunc2() under cprog1.c not reflected in abc.h file. updating static variable outside declaration because cannot modify under proj1 . please suggest ways update static variable cprog1.c file without modifying abc.h/proj1 . if not possible suggest workaround. thanks. solutions tried : making stvar non

javascript - Form inside while loop working on only the 1st result -

i have inside of while loop. processing ajax. working on first , not on other results. please have look. <?php while($a = $stmt->fetch()){ ?> <form method="post" action=""> <input type="hidden" value="<?php echo $mbs_id; ?>" class="memid"> <select class="validity" class="upgrade-valsel"> <?php while($mv = $mval->fetch()){ extract($mv); ?> <option value="<?php echo $mv_id; ?>"><?php echo $mv_validity; if($mv_validity == 1){ echo " month"; }else{ echo " months"; } ?></option> <?php } ?> </select> <input type="submit" value="upgrade" class="submit"> <div class="center-align" style="margin-left: -20px"><img src="images/loading.gif" width="auto"

hadoop - Clarity of terms used in HDFS? -

Image
i have come across several terms while getting familiar hdfs. few of terms like: namespace , metadata , transaction logs , fsimage , editlogs . sometimes appears these terms describe same thing, "having information", not clear on this. in general metadata means data data metadata refer these terms or these terms have different purpose in context of hadoop hdfs? namepace : within hadoop 'namespace' refers file names paths maintained name node. metadata : includes name of file, size, permissions etc... metadata stored in file called fsimage . fsimage : complete state of hdfs file system @ point of time. any changes done filesystem not written fsimage there stored in separate file (on same location fsimage stored) called editlog . editlogs: log lists each file system change made after recent fsimage.

java - Buttons to pause and reset timer -

i add button pauses timer running , button reset timer. the code below: import processing.sound.*; void playsoundfile(string filename) { soundfile player; player = new soundfile(this, filename); player.play(); } //load image pimage bg; //store millis function int m = millis(); //also stores millis later use int startingtime; void setup() { size(410,308); //load background image , store in url variable string url = "http://yodas.ws/2007/11/keele1.jpg"; bg = loadimage(url,"jpg"); //stores millis function startingtime = millis(); } void draw() { //sets background image loaded background (bg); //stores second, minute, hour int s = second(); int m = minute(); int h = hour(); //stores , converts second, minute , hour string string sec = str(s); string minu = str(m); string hr = str(h); string time = hr + ":" + minu; //displays time variable text (time, 300, 50); //sets colour of text fill(255,172,108); //sets text size 32 pixels textsize(

spark sql - whether to use row transformation or UDF -

i having input table (i) 100 columns , 10 million records. want output table (o) has 50 columns , these columns derived columns of i.e. there 50 functions map column(s) of 50 columns of o i.e. o1 = f(i1) , o2 = f(i2, i3) ..., o50 = f(i50, i60, i70) . in spark sql can in 2 ways: row transformation entire row of parsed (ex: map function) 1 one produce row of o. use udf guess work @ column level i.e. take existing column(s) of input , produce 1 of corresponding column of o i.e. use 50 udf functions. i want know 1 of above 2 more efficient (higher distributed , parallel processing) , why or if equally fast/performant , given processing entire input table , producing entirely new output table o i.e. bulk data processing. i going write whole thing catalyst optimizer , simpler note jacek laskowski says in book mastering apache spark 2 : " use higher-level standard column-based functions dataset operators whenever possible before reverting using own custom udf func

Java Calendar: Subtract two Dates to get difference in days between the two -

this question has answer here: calculating difference between 2 java date instances 43 answers i want check how many days has been since user logged in: calendar lastlogin = calendar.getinstance(); lastlogin.settime(randomplayer.getlastlogin()); calendar today = calendar.getinstance(); how subtract difference in days between two? i.e number of days since last login. i suggest using localdate instead: import java.time.localdate; import java.time.temporal.chronounit; public class daysbetween { public static void main(string[] args) { localdate lastlogin = localdate.of(2017, 4, 1); localdate today = localdate.now(); system.out.println(daysbetween(lastlogin, today)); } private static long daysbetween(localdate from, localdate to) { return chronounit.days.between(from, to); } } or, if really want stick

node.js - Local installation of express-generator -

i have installed express-generator locally below command. npm install express-generator can utilize module generate structure in same folder. yes, use path ./node_modules/express-generator/bin/express-cli.js

html - (SVG) Is it possible to have multiple instances of <object>? -

Image
i want embed svgs via <object> -tag (with <img> inside backwards compatibility). <object type="image/svg+xml" data="/res/qm.svg"></object> <object type="image/svg+xml" data="/res/valid.svg"></object> <object type="image/svg+xml" data="/res/qm.svg"></object> <object type="image/svg+xml" data="/res/valid.svg"></object> <object type="image/svg+xml" data="/res/qm.svg"></object> <object type="image/svg+xml" data="/res/valid.svg"></object> <object type="image/svg+xml" data="/res/qm.svg"></object> <object type="image/svg+xml" data="/res/valid.svg"></object> now i've notice if want use picture multiple times on page downloaded every time again (testet ff only). can that? if not, mean discard object-approach.

reactjs - Avoid children re-render when component props change? -

i'm using react why-did-you-update node package, warns me when re-render avoidable. and following code example import react, {component, proptypes} 'react'; export default class testcomponent extends component { render() { const style = { marginleft: this.props.offset * 5 }; return ( <div style={style}> {this.props.children} </div> ) } } testcomponent.proptypes = { offset: proptypes.number, }; testcomponent.defaultprops = { offset: 0 }; i'm using component : <testcomponent offset={this.state.offset}> <p>a lorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur

c# - Prevent from autoformatting after using statement -

i have code: var = 2; i type using(...){} above declaration i`m getting: using(...) { } var = 2; visual studio adds tab a declaration. want prevent this, how can achieve ? edit: added braces don`t want have a inside using. that because using statement executes codes whitin scope variable whitin using exists. correct syntax using is: using (var disposeme = new disposeme()) { // here use disposeme object during lifetime var = 2; } // here disposeme gets disposed. with regards, john

Configure Visual Studio's Librarian via CMake -

i've been searching long time no luck able configure vs' librarian. problem need compile external static libraries mine , can done via 'link additional libraries' option , manually selecting necessary dependencies , corresponding paths. understand need call 'link_libraries()' , 'target_link_libraries()' in cmakelists.txt , configuration successful, i'm able build project except doesn't combine external static libraries output library. i'm wondering if it's possible configure vs project via cmake.

ionic framework - TypeScript: Return Result of a Promise -

i working on ionic app uses fireface login facebook. followed docs here: https://github.com/angular/angularfire2/blob/master/docs/auth-with-ionic2.md almost @ end of docs can see piece of code fb login (using native fb app if available): signinwithfacebook(): firebase.promise<firebaseauthstate> { if (this.platform.is('cordova')) { return facebook.login(['email', 'public_profile']).then(res => { const facebookcredential = firebase.auth.facebookauthprovider.credential(res.authresponse.accesstoken); return firebase.auth().signinwithcredential(facebookcredential); }); } else { ... } } this kind of screws return type of method signinwithfacebook. method should return result of promise triggered facebook.login(...) - return facebooklogin-promise has different data type. i'm bit confused how can re-model lines return promise created firebase.auth().signinwithcredential(facebookcredential). do ha

perl - Nginx rewrite all to index.pl -

i'm trying nginx serve index.pl url user enters for example, want url https://www.example.me/723738 serve https://www.example.me/index.pl i don't want use simple re-direct, because user must still have original url typed in address bar - perl script display url entered. my problem request returns 502 gateway error cloudflare, i've been fiddling nginx config setting can't serve index.pl here's relevant snippet of nginx settings server{ listen [::]:80 default_server; server_name _; root /usr/share/nginx/html; rewrite ^.*$ /index.pl; # load configuration files default server block. include /etc/nginx/default.d/*.conf; location / { } location ~ \.pl$ { gzip off; include /etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.1:9001; fastcgi_index index.cgi; fastcgi_param script_filename $document_root$fastcgi_scrip

How to load ajax in jquery-dialogextend 2.0.4 -

am trying develop application user can select date , view transaction histories in pop on button clicked ajax called , return return inside pop. ref: http://romb.github.io/jquery-dialogextend/example.html <div><button type="button" id="button">button</button></div> <script> $(function () { var remoteurl = 'send.php'; var largeparams = { param1: $("#date").val() }; $("#button").click(function () { $("#form").dialog({ "title": "dialog title", "width": 640, "height": 480, "modal": true, "resizable": true, "draggable": true, "dialogclass": "ui-dialog-red", messa

Upnp/c# Fail send event -

i'm trying build upnp device in c#. have implemented subscriber when try notify variable state change, message didn't listen. test subscription , event, i'm using device spy intel. here code send notification: try { hostname host = new hostname(hostname); streamsocket _socket = new streamsocket(); await _socket.connectasync(host, portnumber.tostring()); var html = encoding.utf8.getbytes(message); datawriter dw = new datawriter(_socket.outputstream); dw.writestring(message); await dw.storeasync(); } catch (exception ex) { } here send packet: notify /65088e88-1082-4ac9-98d2-111df151507d/urn:upnp-org:serviceid:acdlserviceid http/1.1 host: 10.10.50.161:58583 content-type: text/xml; charset="utf-8" content-lenght: 126 nt: upnp:event nts: upnp:propchange sid: uuid:8937a19d-bf7b-4903-8875-e5992abe975b seq: 0 <e:propertyset xmlns

authentication - Getting data from this website (with login requirement) via node.js and the request module -

i trying scrap data node.js , request module website: https://ebanking.easybank.at/internetbanking/internetbanking?d=login&svc=easybank&ui=html&lang=de when logging in via browser login page redirects url: https://ebanking.easybank.at/internetbanking/internetbanking/019664455840$ it looks url contains session id. how can construct url, , scarp data past login page? also not return error wrong credentials: var request = require('request'); request.get( 'https://ebanking.easybank.at/internetbanking/internetbanking?d=login&svc=easybank&ui=html&lang=de' ).auth('xxxx', 'xxxx', true); how can check if authentication successful? here tutorial point me in right direction?

laravel 5 - Extending fields doesn't create database columns in OctoberCMS -

i'm trying extend backend user fields in octobercms after adding new field if try save form there's error says field doesn't exist in database. how can add column new field? here's code: public function boot() { // extend backend form usage event::listen('backend.form.extendfields', function($widget) { // user controller if (!$widget->getcontroller() instanceof \backend\controllers\users) { return; } // user model if (!$widget->model instanceof \backend\models\user) { return; } // add birthday field $widget->addtabfields([ 'birthday' => [ 'label' => 'birthday', 'comment' => 'select users birthday', 'type' => 'datepicker', 'tab' => 'billing' ] ]); }); }

gcc - IA-32 x86 Assembly function definition convention? -

this question has answer here: does prologue , epilogue mandatory when writing assembly functions? 1 answer what purpose of ebp frame pointer register? 5 answers why pushl %ebp # save old base pointer movl %esp, %ebp # set ebp current esp movl %ebp, %esp popl %ebp ^this, when defining functions in assembly? below translation of code without pushes , pops , esp register used access variables. asm( "_calculatea:;" " movl 8(%esp), %eax;" " andl 4(%esp), %eax;" " ret;" ); it shorter , works fine, what's deal?

python - Why is the stack trace when using Jinja2 templates with Django not as specific as with the default Django template engine? -

i have installed latest version of django-jinja plugin , followed instructions templates processed jinja instead of defulat django templating language on fresh install of django 1.11. the first thing noticed stack traces appear when there error unspecific compared dtl templates, , compared flask projects (that default jinja). default template engines, stack trace short , sweet , pinpoints right error happened, mentioning file name , line number. jinja templates in django, can dig usable information out of several lines spits out running through couple dozen functions of installed packages, time consuming pick through , decipher. is there prevents jinja override having ability interpret stack trace 'human friendly' django/flask default engines? fix this?

tensorflow tf.Print not printing anything in Jupyter -

trying debug statements in python/tensorflow1.0 using jupyter , not output printed tf.print thought sess.run(during training in below code) should have evaluated db1 tensor , print output did not happen db1.eval in evaluate phase , printing entire tensor x out "message x:". def combine_inputs(x): db1=tf.print(x,[x],message='x:') return (tf.matmul(x, w) + b,db1) <<training code>> _,summary=sess.run([train_op,merged_summaries]) ## merged_summaries tensor triggers combine_inputs function. there ## other tensor functions/coding in between , not giving entire code keep ## simple; code works expected except tf.print <<evaluate code>> print(db1.eval()) confused on following a) why tf.print not printing during sess.run during training? b) why explicit db1.eval necessary , expected tf.print trigger sess.run. if eval required , copy tensor x in code db1 , evaluate out tf.print. correct? tried going through other questions (like b

c# - Show winform during unit test -

i'm having bit of trouble showing winform during unit test. i'm using user validated testing procedure show user 2 different image segments captured during selenium ui testing , diff between them , allowing user pass or fail test based on whether or not images different. i've created form 2 picturebox elements , added methods form allow form take in images require , load them picturebox , show form. i've tried searching google + , can't find similar questions regarding this. in test have: var compareform = new plotcompare.plotcompare(); compareform.add_original_image(image1); compareform.add_diff_image(imagediff); compareform.show(); but .show(); call doesn't show form. the issue can reasonably think of project i'm using class library because holds tests , therefore doesn't have main function can access. would appreciate help, in advance. https://stackoverflow.com/a/34799721/3110529 answered this, setting showintaskbar prop

python - Search for text between 2 strings multiple times on the same line -

i have run little bit of trouble need search text between different strings. pulling url pasted in 1 line. what searching multiple ips in document (which on same line). full strings in search this: "ip_str": "0.0.0.0"} so find text between "ip_str": " , "} also possible save of them output text document? sounds away string splitting: data = open('input.txt').read() fout = open('output.txt', 'w') parts = data.split('"ip_str": "') part in parts[1:]: part_cleaned = part.split('"}')[0] fout.write(part_cleaned + '\n') it's quick-and-dirty if write , run once think it's enough. using python's json module cleaner.

ios - How to merge SKSpriteNode into a SKTexture to form new SKSpriteNode in Swift 3? -

i'm developing ios app. have skspritenode on screen , i'm getting drawing user i'm storing sktexture. combine these 2 , introduce them new skspritenode. the problem: cannot find documentation how merge skspritenode sktexture. i'm sure there's way this. have example code this? you have use coregraphics this. convert both sktextures cgimage using sktexture.cgimage() method, combine them using coregraphics , create new texture result. sktexture.init(cgimage:) method let use cgimage object construct texture. i haven't used core graphics much, here few links related reads. think want use cglayer class tell coregraphics how stack textures , reuse sprite texture on time coregraphics can cache make things faster. core graphics uses quartz 2d fast 2d graphics operations. haven't played it, think should looking for. references : sktexture related: cgimage() method init(cgimage:) method core graphics related: core graphics framew

asp.net mvc - knockout binding mvc not working -

i experimenting mvc , knockout.js maybe have binding problem. my viewmodel is: var urlpath = window.location.pathname; var currencyvm = function () { var self = this; var validationoptions = { insertmessages: true, decorateelement: true, errorelementclass: 'errorfill' }; ko.validation.init(validationoptions); //viewmodel self.id = ko.observable(0); self.id_region = ko.observable(""); self.description = ko.observable(""); self.symbol = ko.observable(""); self.paypalcode = ko.observable(""); self.ifscode = ko.observable(""); self.isgridvisible = ko.observable(true); self.iseditvisible = ko.observable(false); self.isaddvisible = ko.observable(false); //objects --------------------------------------------- self.currency = ko.observable(); self.currencys = ko.observablearray([]); //methods --------------------------------------------- //edit self.editcurrency = function (dataitem) { self.isgridvisible(false);

Python backend, Login with facebook, error: "An active access token must be used to.." -

i create working "login facebook" button. there many posts on issue cannot find 1 tat helps. it works. short lived token to, app-id , client secret, request access token. , access token in json. however, when append so: ' https://graph.facebook.com/v2.4/me?%s&fields=name,id,email ' % token i dreaded: an active access token must used query information current user here's output (... = elipsis): short lived access token received 2q ... 8zd send request long lived access token to: https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token&client_id=1234 ... 3c8&fb_exchange_token=2q ... 8zd result = h.request(url, 'get')[1] was: {"access_token":"abc ... mn","token_type":"bearer","expires_in":5174030} token now: abc...mn url sent api access:https://graph.facebook.com/v2.4/me?abc...mn&fields=name,id,email api json result: {"error":{

Selenium xpath text() - simple selection seemingly not working -

i use selenium webdriver 2.53.1 on java, chrome. i find element , save in webelement variable named dropdownmenulist . here outerhtml, formatted. <ul tabindex="-1" class="dropdownmenu apmurldropdownmenu thing menu" role="menu" aria-label="menu region"> <li class="menuitem apmurldropdownmenu" tabindex="-1" role="menuitem"> <div class="thing text">cardnamewebpage</div> </li> <li class="menuitem apmurldropdownmenu" tabindex="-1" role="menuitem"> <div class="thing text">cardnamewebpage</div> </li> <li class="menuitem apmurldropdownmenu" tabindex="-1" role="menuitem"> <div class="thing text">cardnamewebpage</div> </li> <!-- react-text: 9 --> <!-- /react-text --> </ul> then s

java.lang.NumberFormatException: null When I try to read a number from a .txt -

try { bufferedreader in = new bufferedreader(new filereader("encuestas/encuesta_"+s+".txt")); try { this.id = integer.valueof(in.readline()); this.genero = in.readline(); this.fecha = in.readline(); this.n_preguntas = integer.valueof(in.readline()); for(int = 0; < this.n_preguntas; ++i){ integer tip = integer.valueof(in.readline()); string aux = ""; aux = in.readline(); when try read integer tip = integer.valueof(in.readline()); doesn't work , don't understand why... same before , working. error: 5. leer encuestajava.lang.numberformatexception: null @ java.lang.integer.parseint(integer.java:542) @ java.lang.integer.valueof(integer.java:766) @ prop.dominio.encuesta.leer(encuesta.java:134) @ prop.dominio.driver_encuesta.main(driver_encuesta.java:219) simply check this, for(int = 0; < this.n_preguntas; +

android - Firebase query by child's child key -

Image
i have structure in firebase database how can "ch1" knowing 1 of uids? ("uid1"/"uid2") tried this: firebasedatabase.getinstance().getreference().child("messages").orderbychild("users").startat("users",partnerid) , gave me chats.

python - Sending out a csv attachment with Django Email, is forcing the COLUMN_HEADERS into the next row if they are over 998 characters long -

steps reproduce: 1) long line of comma separated values (mine starts balking @ 998 characters). 2) send out through django email: message.attach('some.csv', csv_file, 'text/csv') 3) open file in email, , notice values have been written second row, instead of staying on 1 row. input/output input: csv_file = 'field_1,field_2,field_3,...,field_998, field_999' expected output (all on 1 row): field_1 | field_2 | field_3 | ... | field_998 | field_999 actual output: field_1 | field_2 | field_3 | ... | field_ 998 | field_999 (please note example, starts balk @ 998 char's not strings) this happening through django email attachment being sent text/csv , limitations of that. it's acting 'word wrap'. changing text/csv application/octet-stream , leaves data as-is. https://docs.djangoproject.com/en/1.11/topics/email/#emailmessage-objects

css - Positioning Logo in header using bootstrap -

Image
this question exact duplicate of: finding position logo on bootstrap difficult i trying position logo @ top left, inside navbar. my logo not respond when try position far-left of navbar using 'margin-right'. when position logo left, pushing menu out right middle of navbar. could give me advice? thank you. <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- above 3 meta tags *must* come first in head; other head content must come *after* these tags --> <title>arabella hill</title> <!-- bootstrap --> <link href="css/bootstrap.min.css" rel="stylesheet"> <!-- html5 shim

extjs - Sencha - Conditionally adding namesapce in requires -

i have requirement want add namespaces in requires conditionally. e.g. in below example want add 'views.popupgrid' name space on specific condition. it's loaded. requires: ['ext.window.messagebox','views.popupgrid','user.myuser' ] conditional dependencies not supported sencha toolchain. while able write in text editor of choice requires:[ (location.hash=='#test')?'testpopup':'normalpopup' ] and work in uncompiled version, sencha cmd not able compile correctly, , throw errors. therefore, sencha architect not support syntax. what can do, while staying standards-compliant: can use ext.loader.loadscript , e.g. this: ext.define('myform',{ extend: 'ext.form.panel' initcomponent:function() { var me = this; me.callparent(arguments); if(x==3) ext.loader.loadscript({ url:'mycustomformcomponent.js', onload:function(){

python - Pandas/Numpy: Fastest way to create a ladder? -

Image
i have pandas dataframe like: color cost temp 0 blue 12.0 80.4 1 red 8.1 81.2 2 pink 24.5 83.5 and want create "ladder" or "range" of costs every row @ 50 cent increments, $0.50 below current cost $0.50 above current cost. current code similar follow: incremented_prices = [] df['original_idx'] = df.index # know it's original label row in df.iterrows(): current_price = row['cost'] more_costs = numpy.arange(current_price-1, current_price+1, step=0.5) cost in more_costs: row_c = row.copy() row_c['cost'] = cost incremented_prices.append(row_c) df_incremented = pandas.concat(incremented_prices) and code produce dataframe like: color cost temp original_idx 0 blue 11.5 80.4 0 1 blue 12.0 80.4 0 2 blue 12.5 80.4 0 3 red 7.6 81.2 1 4 red

ios - Not able to build ReactiveCocoa -

i building project got developer. while building reactivecocoa gives following error multiple times. tried online solution none of them worked. has else faced before? while building module 'reactivecocoa' imported pods/reactivecocoa/reactivecocoa/reactivecocoa.h:17: in file included <module-includes>:1: in file included /users/sankethpurwar/library/developer/xcode/deriveddata/heckscher-gzryniksoxyxjkdzbdonuizetozb/build/products/debug-iphoneos/reactivecocoa/reactivecocoa.framework/headers/reactivecocoa-umbrella.h:82: in file included /users/sankethpurwar/library/developer/xcode/deriveddata/heckscher-gzryniksoxyxjkdzbdonuizetozb/build/products/debug-iphoneos/reactivecocoa/reactivecocoa.framework/headers/reactivecocoa.h:19: pods/reactivecocoa/reactivecocoa/nsarray+racsequenceadditions.h:13:21: error: duplicate definition of category 'racsequenceadditions' on interface 'nsarray' @interface nsarray (racsequenceadditions)

python - How to subprocess the files on console directly (with or without using StringIO)? -

i trying read gtf file , edit (using subprocess, grep , awk) before loading pandas. i have file name has header info (indicated # ), need grep , remove first. can in python want introduce grep pipeline make processing more efficient. i tried doing: import subprocess io import stringio gtf_file = open('chr2_only.gtf', 'r').read() gtf_update = subprocess.popen(["grep '^#' " + stringio(gtf_file)], shell=true) and gtf_update = subprocess.popen(["grep '^#' " + gtf_file], shell=true) both of these codes throw error, 1st attempt was: traceback (most recent call last): file "/home/everestial007/pycharmprojects/stitcher/phase-stitcher-markov/markov_final_test/phase_to_vcf.py", line 39, in <module> gtf_update = subprocess.popen(["grep '^#' " + stringio(gtf_file)], shell=true) typeerror: can't convert '_io.stringio' object str implicitly however, if specify filename directly w

MySQL Error 1442 -

i have 2 tables: sanction these attributes: driverid , calification , points people these attributes: pid , city , totalpoints and have trigger: drop trigger if exists updatepoints_tgr; delimiter $$ create trigger updatepoints_tgr after update on sanctions each row begin if new.points > old.points update people set totalpoints = totalpoints + (new.points - old.points) people.pid = new.driverid; elseif new.points < old.points update people set totalpoints = totalpoints - (new.points - old.points) people.pid = new.driverid; end if; end$$ delimiter ; and when try execute update update sanctions join people on sanctions.driverid=people.pid set points=points+6 city='barcelona' , calification='lightpenalty' i error: can't update table 'people' in stored function/trigger because used statement invoked stored function/trigger. how can f

python - Normalize slices of a ndarray -

i have 3 columns array. first column of array have values between 1 , 10. need extract lines first column 1 , normalize third column of slice of array. repeat same thing rows first column equal 2 etc. if run code, leaves array unchanged: for u in np.unique(x[:,0]): mask= x[:, 0] == u x[mask][:,2]=x[mask][:,2]/np.sum((x[mask][:,2])) if run other slice of code, see r (i placed print r in loop) work want. point original array x unchanged. for u in np.unique(x[:,0]): r = x[x[:, 0] == u] r[:,2]=r[:,2]/np.sum((x[x[:,0]==u][:,2])) why that? doing wrong??? here's alternative vectorized approach performance in mind solve problem using np.unique , np.bincount - tags = np.unique(x[:,0], return_inverse=1)[1] x[:,2] /= np.bincount(tags, x[:,2])[tags] to further boost performance, 1 can avoid use of np.unique , directly compute equivalent of np.bincount(tags, xc[:,2]) , while making use of fact numbers in first column between 1 , 10 , - np.bincoun

jquery - Confirm delete modal/dialog with Twitter bootstrap not working -

Image
a viewcomponent in asp.net core 1.1 project on vs2015 has confirm delete modal/dialog twitter bootstrap shown below. when user clicks on delete button confirm delete not trigger jquery function shown below. modal/dialog pops fine when click on delete button id= deletebtnid inside modal/dialog expect popup `alert('test') not happening. question: may missing? no errors shown in chrome's developer tool. view calls viewcomponent : @model myproj.models.testmodel html .... .... <div id="deletebtnparentid"> @await component.invokeasync("testvc") </div> viewcomponent : @model ienumerable<myproj.models.testmodel> <table> @foreach (var item in model) { <tr> <td> <a asp-action="testaction">@item.title</a> </td> <td> <button type="button" class="btn btn-info btn-xs" data

time series from list of dates-python -

i have list of dates (lista) each entry in represents occurrence. how make time series out of list in python3? sequence of dates on x axis, , frequency of each date on y lista = [2016-04-05, 2016-04-05, 2016-04-07, 2016-09-10, 2016-03-05, 2016-07-11, 2017-01-01] desired output: [2016-04-05, 2], [2016-04-06, 0], [2016-04-07, 1], [2016-04-08, 0], ……………… .., [2017-01-01, 1] desired format of output: [[date, frequency],....,*] i have date code as: date=pd.date_range('2016-04-05', '2017-01-01', freq='d') print(date) which gives: [2016-04-05, 2016-04-06, 2016-04-07,....,] i need code below step through date above frequency each date. for item in lista: if item>=date[0] , item<date[1]: print(lista.count(item)) using counter collections module straight forward: code: dates = [ '2016-04-05', '2016-04-05', '2016-04-07', '2016-09-10', '2016-

R function masking scope conflict between data.table and lubridate -

edit: see simple fix below. i'm running odd behavior. applying via lapply multiple functions within j expression of data.table works when explicitly name library in case 1. in case 2, if don't name library, works first time, if call same line second time, fails error message: error in fun(x[[i]], ...) : not find function "f" # case 1 unloadnamespace('data.table') unloadnamespace('lubridate') require(data.table) require(lubridate) dt <- data.table(x=as.posixct("2013-01-01 00:53:00", tz="japan")) dt[, c('year','month', 'day') := lapply(c(lubridate::year, lubridate::month, lubridate::day), function(f) f(x) )] # passes dt[, c('year','month', 'day') := lapply(c(lubridate::year, lubridate::month, lubridate::day), function(f) f(x) )] # passes # case 2 unloadnamespace('data.table') unloadnamespace('lubridate') require(data.table) require(lubridate) dt <- data

Python, Tkinter, SQlite3 after login successful redirecting the user to a new window -

i'm new within programming , created following source code verify if user logs in successfully. want redirect user new window , rid of current window, after input correct credentials within entries. possible use top-level method this? def is_valid(): usernamevalidity=username_entry.get() passwordvalidity=password_entry.get() cursor.execute('''select password users username = ?''', (usernamevalidity,)) cursor.execute('''select username users password = ?''', (passwordvalidity,)) loginattempt = cursor.fetchone()? print (is_valid) # testing if loginattempt: print (" 1 of accounts have logged in ") isvalidtext.config(text=" have logged in! ", fg="black", highlightthickness=1) else:? print (" 1 of accounts inputted wrong credentials! ") isvalidtext.config(text=" invalid username or password! ", fg="black&qu

How to scale and change background of Google Map marker with javascript -

is possible animate scaling of marker icon instead of changing icon javascript? i'ved added multiple markers google map so: var houseicon = { path: 'm0,12h4.5v7.5h3v12h12v6l6,0l0,6v12z', fillcolor: '#ff4b3d', fillopacity: 0.8, scale: 1, strokecolor: '#ff4b3d', strokeweight: 1 }; var marker = new google.maps.marker({ position : latlng, map : map, id : 'post-'+marker_id, icon: houseicon }); i wish able scale icon , preferrably change it's backgroundcolor when hover html element located outside google map. i've used seticon() method change background ..but i'd to, if possible, animate scaling of icon instead of displaying bigger icon. here current hover function: $('.my-element').hover( function() { data_id = $(this).attr('data-id'); for( i= 0; < map.markers.length; i++ ){ if( map.markers[i].id== 'post-&

c# - Entity Framework - How do I combine data from a database and something else, like WMI? -

i playing around writing simple app asks servermanager in microsoft.web.administration list of web sites configured on local machine , combines annotations in sort of database. namespace listwebsites.models { public class site { public int id { get; set; } public string hostname { get; set; } public string protocol { get; set; } public int? port { get; set; } public string comments { get; set; } } public class sitedbcontext : dbcontext { public dbset<site> sites { get; set; } public void getsiteinfo() { using (var server = new servermanager()) { var siteinfo = site in server.sites let bindings = site.bindings.select(b => new { host = b.host, protocol = b.protocol, port = b.endpoint?.port }) select new { site.name, bindings }; } } } } i want id , comments co

mysql - Guidence in PHP login script -

this question has answer here: undefined function mysql_connect() 13 answers i started learning little php , sessions (using xampp run php scripts). i watching few vidoes , reading few books before started. the thing have here video saw php , sessions me going. have little problem here person in video did not have. this login.php code: <?php session_start(); // starting session $error = ''; // variable store error message if (isset($_post['submit'])) { if (empty($_post['username']) || empty($_post['password'])) { $error = "brukernavn eller passord er ugyldig!"; } else { // define $username , $password $username = $_post['username']; $password = $_post['password']; // establishing connection server passing server_name, user_id , passwor

java - JComponent dont know how create panel withoud repeat code -

i having problem create panel witch allow me read/write file. mean have class book(with fields author, pages, publication date) , comics class witch extend class book. in class have 3 fields , have book. want create panel edit object class comics panel should have field both class dont want duplicate code when write class witch extends book. so far have abstract public class book implements serializable { string author; string publication_date; integer pages; public string tostring(){ return ""; } public void edit(){}; } , class comics witch edit through jpanel public class comics extends book implements serializable { integer number1; integer number2; string name; public samochod(string author, string publication_date, int pages, int number1, int number2, string name){ this.author = author; this.publication_date = publication_date; this.pages = pages; this.number1 = number1; this.number2 = number2; this.name = n

android - Firebase Database Exception -

this question has answer here: android save object in firebase 1 answer here class intend read location type data item firebase database , store in location type object. tried store datasnapshot in object of class had location type argument in constructor, got same error saying : " com.google.firebase.database.databaseexception: class android.location.location missing constructor no arguments" package com.example.aadi.sarthi_; import android.content.context; import android.content.intent; import android.location.location; import android.os.bundle; import android.support.annotation.nullable; import android.support.v4.app.fragment; import android.support.v7.widget.linearlayoutmanager; import android.support.v7.widget.recyclerview; import android.util.log; import android.view.layoutinflater; import android.view.menuitem; import android.view.view; import an