Posts

Showing posts from April, 2015

android - Error while launching app, apk does not exist on disk -

this error getting while running app , installing in emulator the apk file e:\project path\app\build\outputs\apk\app-debug.apk not exist on disk. error while installing apk i have tried clean , rebuild, restarting android studio doesn't me out. note : hello world program, , not getting error in message or log also. i have checked this , this didn't work me.

javascript - Firebase authentication Return null statement -

how can manage execute statement in condition when firebase-authentication return null statement during create user registration successfully.. firebase.auth().createuserwithemailandpassword(email, pass).catch(function(error) { var errorcode = error.code; var errormessage = error.message; if(errorcode == "auth/email-already-in-use"){ //condition working alert(errormessage); } else if(errorcode == null){ //this condition not working alert("registration successfully"); } else{ //condition working alert("weak password"); } }); if start new activity have check current user , if user available can start second activity this auth = firebaseauth.getinstance(); // firebase auth instance if (auth.getcurrentuser() != null) { startactivity(new intent(login_activity.this, secondactivity.class)); finish(); } if users not available have redirect user login activity or user creating activity wis

javascript - JSON value comparing and display the sibling property value -

i have 2 json files: first json: $scope.devicelist = { "devices": [ { "sub_family": "6s plus", "presales_description": "iphone 6 plus features stunning 5.5-inch retina hd display, amazing cameras , many advanced features, in breakthrough design. 5.5-inch retina hd display. a8 chip 64-bit desktop-class architecture. 8mp isight camera focus pixels , optical image stabilisation. touch id. fast 4g lte , wi-fi.1 long battery life.2 , ios 9 , icloud.", "camera": true, "device_type": "smartphone", "presales_vendor": "apple", "sim_form-factor": "nano", "memory": 64, "device_class": "hc14", "tv capable": true, "family": "iphone", "specification_reference": "d20", "variants": [ {

Angular 2 Reactive Forms RadioButton for CheckBox for a FormArray -

i using dynamic forms form fields being added formarray on button click this. this._formbuilder.group({ name: [propertyname, [validators.required]], datatype: [datatype, validators.required], dateformat: [dateformat], isprimary: [false] }); i want 1 isprimary true in array. how achieve either using radio buttons or checkboxes. please help.

c# - Crystal Report Database LogOn when transferred to Server -

how can solve this? when run system through local machine, not need log on database authentication, can see reports directly. when transferred system server others can access remotly, requires logon database , information correct. here .cs code public partial class printpreview : system.web.ui.page { reportdocument crprint = new reportdocument(); protected void page_init(object sender, eventargs e) { if (session["id"] == null) { response.redirect("../account/login.aspx"); } else { string = session["tid"].tostring(); //crystalreportviewer1.visible = true; string reportpath = server.mappath("../crystalreport2.rpt"); crprint.load(reportpath); crprint.setdatabaselogon("sa", "pr0cess", "172.20.3.24", "po"); crprint.setparametervalue("mosefno", i);

Need to find all the hours between a person wake up time and sleep time in jquery -

i have wakeup_time , sleep_time eg: wakeup_time=09:00 pm , sleep_time= 11:00 am i need find hours(12 h format) between 2 time. the wakeup , sleep time varry. expected result : 9 pm, 10pm, 12pm, 1 am, ......,10 , 11 another 1 . try this. var id=0; var unit=wakeup_unit; var time; for(var i=0;i<=totalhours;i++){ id=wakeup_time+i; if(id>=12){ if(id==12){ time=id; if(wakeup_time==12){ }else{ if(unit=="am"){ unit="pm"; }else if(unit=="pm"){ unit="am"; }else{ unit=unit; } } }else{ time=id-12; if(time>=12){ if(time==12){

html - How do I resize a specific box by css -

i want resize right box whereas left box value (400px) fix how do css? when resize browser window right box comes down not right. here css , html. #w { max-width: 1000px; width: 100%; margin: 0 auto; border: solid 1px #eee; box-sizing: border-box; } #left { max-width: 400px; width: 100%; border: solid 1px #000; height: 100px; float: left; box-sizing: border-box; } #right { max-width: 598px; width: 100%; border: solid 1px #000; height: 100px; float: left; box-sizing: border-box; } .clear { clear: both } <div id="w"> <div id="left"></div> <div id="right"></div> <div class="clear"></div> </div> try .div1 { width: 300px; height: 100px; border: 1px solid blue; } .div2 { width: 300px; height: 100px; padding: 50px; border: 1px solid red; } .div3 { width: 30

android - How can I construct this URL for RetroFit API -

this url using query results: http://query.yahooapis.com/v1/public/yql?q=select+*+from+yahoo.finance.historicaldata+where+symbol+%3d+%22yhoo%22+and+startdate+%3d+%222015-11-10%22+and+enddate+%3d+%222016-11-10%22&format=json&diagnostics=true&env=store%3a%2f%2fdatatables.org%2falltableswithkeys&callback= i using retrofit first far how build url: public static string getstockdataurl(string stock_symbol){ string startdate = utils.getlastyear() ; string enddate = utils.gettodaydate(); try{ string yahoo_base_url = constants.yahoo_base_query; string query_stock_data = constants.query_stock_data + constants.symbol_query +stock_symbol+ constants.start_date_query +startdate+"\" " + constants.end_date_query + enddate+"\""; return yahoo_base_url + urlencoder.encode(query_stock_data, "utf-8") + constants.format_q

powershell - What is the maximum length of the -ArgumentList parameter of the Start-Process cmdlet -

i'd use start-process call programm ps , pass bunch of arguments call said program should process in background. it might happen, total list of supplied arguments program might hundreds (something 200-300 in total), each again string of 32 bytes length. i've tried find out maximum length of -argumentlist couldn't find reference far. i doubt run problems amount of arguments supply, did bug me, how many arguments or how long in total might -argumentlist parameter be? combined length of 8191 characters, maybe. or maybe depends on program you're running. source: trial , error (windows 8.1 / psv4): start-process -filepath cmd -argumentlist (@('/k','echo 1') + (2..1852)) # works start-process -filepath cmd -argumentlist (@('/k','echo 1') + (2..1853)) # doesn't work around 6769 triggers exception: ps c:\> start-process -filepath cmd -argumentlist (@('/k','echo 1') + (2..6768)) start-process :

javascript - How to validate input parameters of a jQuery widget factory before initialize the widget with them? -

is there way validate input parameters of jquery widget factory before initialize widget options them? i want prevent incorrect parameters , use default options instead of them. something this: $.widget( "custom.colorit", { options: { color: 'red' }, _create: function(opts) { //<< opts not working here var validatedoptions == this._validateoptions(opts); // merge default options validated options this.options= $.extend(this.options,validatedoptions); this.element.text( this.options.color ); }, _validateoptions: function( opts ) { if(opts.color =='green') opts.color='blue'; if(opts.color =='black') opts.color= undefined; return opts; } });

eclipselink - JPA N+1 issue with inheritance -

if in situation have n+1 problem use jpa "join fetch" keyword if 1 indirection (i. e. select p person p join fetch p.address) or if more 1 indirection use jpa provider-proprietary query hint, in case eclipselink (i. e. select p person query hint eclipselink.join-fetch=p.address.city). thats explained in article java persistence performance . anyway, lately stumbled on datamodel 2 entities subclassed one. have account owns contact . contact abstract superclass extended person or company . , person have relationship list of hobby ies. @entity public class account { @onetoone private contact contact; } @entity @inheritance(strategy = inheritancetype.joined) public abstract class contact {} @entity public class person extends contact { @onetomany private list<hobby> hobbies; } @entity public class company extends contact {} i need load list of accounts, select account a . surely ran n+1 problem, because of hobbies. no problem thought,

Why this code compiles in java? -

this question has answer here: how use labels in java code? 2 answers i can see below code compiles in java not understand reason? public class test { @suppresswarnings("unused") public static void main(string[] args) { abc:system.out.println(9); } } the line in main labelled statement . these labels aren't use in isolation, can used break , continue statements.

Unable to debug in Java with eclipse -

i trying debug simple java application on machine using eclipse ide. when try debug application entering debug perspective, set breakpoint , start debug. within few seconds, following pop-up window: launching unicoderead has encountered problem. cannot connect vm . the message dumped on console follows: error: transport error 202: connect failed: connection refused error: jdwp transport dt_socket failed initialize, transport_init(510) jdwp exit error agent_error_transport_init(197): no transports initialized [../../../src/share/back/debuginit.c:708] fatal error in native method: jdwp no transports initialized, jvmtierror=agent_error_transport_init(197) how correct this? why happen? i had same problem. yesterday worked fine, nothing - same error gave. found out network admins made changes in meantime. firewall stuff. problem eclipse tries establish connection jvm @ "localhost" (and random port). when tried pinging localhost (or 127.0.0.1) got follow

I just updated Woocommerce but i cant see its new features -

Image
after updating woocommerce 2.6.7, layout of woocommerce backend did not change. not see options catalog, pages, etc? compare screen shots: and mine displaying:

java - spark maven package org.apache.spark.mllib.fpm does not exist -

i use maven manage java spark program. in program call fpgrowth algorithm in mllib.fpm. <dependency> <!--spark denpendency --> <groupid>org.apache.spark</groupid> <artifactid>spark-core_2.10</artifacrid> <version>1.5.1</version> </dependency> however there error :package org.apache.spark.mllib.fpm not exist. how solve question? the problem using mllib not have dependency specified in pom.xml. as can see spark version 1.5.1. hence try adding in pom.xml : <!-- https://mvnrepository.com/artifact/org.apache.spark/spark-mllib_2.10 --> <dependency> <groupid>org.apache.spark</groupid> <artifactid>spark-mllib_2.10</artifactid> <version>1.5.1</version> </dependency> this solve issue. !

java - How to choose a spesific object from ArrayList -

we making simple rpg game. right have class called battleground, player can fight monsters. use random generator pick out random monster when start fight. in terminal/main method, have commands "attack" , "run", either damage random monster, or make player leave/quit game. right now, trying add command called "attack scariest", let player fight against hardest monster damage(there 3 choose in our main). need method choose specific object arraylist monsters, based on damage. have tips on how that? this our code in battleground class starts game: public void startbattle() { printwelcomemessage(); boolean finished = false; this.currentmonster = getrandommonster(); if(this.currentmonster == null) { return; } system.out.println("a random monster chosen you. prepare meet mighty " + this.currentmonster.getname()); system.out.println("\n-------- player stats ---------"); system.out.println(t

java - The texture does not load after you export to jar -

Image
i have problem problem game created of lwjgl 2.9.3. when export project jar. program not want read through of textures. in eclipse worked properly. files loaded in jar. the error appears exception in thread "thread-42" java.lang.runtimeexception: resource not found: pajak/chodzenie/1.png @ org.newdawn.slick.util.resourceloader.getresourceasstream(resourceloader.java:69) the method reads texture public static texture loadtexture(string path,string filetype){ texture tex = null; inputstream in = resourceloader.getresourceasstream(path); try { tex = textureloader.gettexture(filetype, in); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } return tex; } loading textures theoretically, right, however, not work. rest of files have no problems. help

python - Hackerrank Weighted Average -

the question can found here i'm trying calculate weighted average when try populate array loop doing nothing ? size = raw_input() arr = raw_input() w = raw_input() deger = [1,2,2,2,2] size = [int(i) in size.split()] size = size[0] arr = [int(i) in arr.split()] w = [float(i) in w.split()] def wm (x,y,s): in range(0,s-1): deger[i] = int(input(x[i]*y[i])) return sum(deger) print(wm(arr,w,size)) just modifications based on code proper indentation: size = raw_input() arr = raw_input() w = raw_input() #deger = [1,2,2,2,2] # not necessary initialize 'deger' here size = [int(i) in size.split()] size = size[0] arr = [int(i) in arr.split()] w = [float(i) in w.split()] def wm (x,y,s): deger = [] # initialize empty 'deger' here in range(0,s): # 's-1' not include last item of x , y deger.append(x[i]*y[i]) return sum(deger) / sum(y) print('%.1f'%wm(arr,w,size)) # 1 decimal place required

Facebook marketing API - how to Copy Ads / creatives -

on facebook's documentation, in "what's new" have link titled "copy , reuse ads ads copy api." leads this . here, have 3 links, of them broken. my question is, how can copy (and change) ad, , more specifically, ad's creative, immutable (therefore need copy instead of update)? update at time, did information our contact @ facebook. however, meant wasn't approach us. also, there new documentation on copying ads , yet still not specifically, since not allow updating ad-creatives. we've since abandoned effort, , in fact, solve problem having marketing personnel export ads, update field needed script in excel file, uploading facebook. the ad copy feature https://developers.facebook.com/docs/marketing-api/buying-api/ad-units#ad-copies includes 3 kinds of copies, on campaign, ad set, or ad level. there not ad creative copy function. and there should not. ad creatives immutable, know. why want copy immutable one, instead of u

vagrant - Ansible - making folder shared -

is feasible make shared folder ansible once vagrant machine , running? want able share files between vagrant machine (opensuse) , local machine. (making folder shared vagrantfile not option because change users later on ansible , want share folder new user)

javascript array date error -

i bit confused one. this piece of code works has strange behavior. var tmpcurdte = eval(datasource[i].startdate); tmpcurdte.setdate(tmpcurdte.getdate() + 1); while (tmpcurdte < tmpenddte) { console.log("block date: " + tmpcurdte); blockdayarray[blockdayarray.length] = tmpcurdte; console.log("blockdayarray: " + blockdayarray); tmpcurdte.setdate(tmpcurdte.getdate() + 1); } output block date :sat nov 12 2016 00:00:00 gmt+0100 (cet) blockdayarray :**sat nov 12** 2016 00:00:00 gmt+0100 (cet) block date :sat dec 31 2016 00:00:00 gmt+0100 (cet) blockdayarray :**sun nov 13** 2016 00:00:00 gmt+0100 (cet),**sat dec 31** 2016 00:00:00 gmt+0100 (cet) block date :sun jan 01 2017 00:00:00 gmt+0100 (cet) blockdayarray :sun nov 13 2016 00:00:00 gmt+0100 (cet),**sun jan 01 2017** 00:00:00 gmt+0100 (cet),**sun jan 01 2017** 00:00:00 gmt+0100 (cet) block date :sat feb 04 2017 00:00:00 gmt+0100 (cet) blockdayarray :sun nov 13 2016 00:00:00 gmt+0100 (cet),mon jan

java - Algorithm for minimal cost + maximum matching in a general graph -

i've got dataset consisting of nodes , edges. nodes respresent people , edges represent relations, each has cost that's been calculated using euclidean distance. now wish match these nodes through respective edges, there 1 constraint: any node can matched single other node. now know i'm working in general graph, every node theoretically matched node in dataset, long there edge between them. what wish do, find solution maximum matches , overall minimum cost. node node b node c node d - edge 1: start: end cost node node b 0.5 - edge 2: start: end cost node b node c 1 - edge 3: start: end cost node c node d 0.5 - edge 2: start: end cost node d node 1 the solution problem, following: assign edge 1 , edge 3, maximum amount of matches ( in case, there's 2 solutions, there tons of branching edges other nodes) edge 1 , edge 3 assigned, because it's solution maximum amount o

javascript - fakewaffle responsive tab screen issue -

i'm using fakewaffle responsive tab plugin there didn't understand want make responsive on 480px not 768px couldn't how can did ? html <ul class="nav nav-tabs responsive" id="mytab"> <li class="active"><a href="#home">home</a> </li> <li><a href="#profile">profile</a> </li> <li><a href="#messages">messages</a> </li> </ul> <div class="tab-content responsive"> <div class="tab-pane active" id="home">...content...</div> <div class="tab-pane" id="profile">...content...</div> <div class="tab-pane" id="messages">...content...</div> </div> js $('#mytab a').click(function (e) { e.preventdefault() $(this).tab('show') }); (function ($) { fakewaffle.resp

R: Why does "ifelse" coerce factor into integer? -

this question has answer here: how prevent ifelse() turning date objects numeric objects 6 answers i'm attempting change values of variable na values if they're not in vector: sample <- factor(c('01', '014', '1', '14', '24')) df <- data.frame(var1 = 1:6, var2 = factor(c('01', '24', 'none', '1', 'unknown', '24'))) df$var2 <- ifelse(df$var2 %in% sample, df$var2, na) for reason r not preserve original values of factor variable turns them numeric sequence: > sample <- factor(c('01', '014', '1', '14', '24')) > df <- data.frame(var1 = 1:6, var2 = factor(c('01', '24', 'none', '1', 'unknown', '24'))) > class(df$var2) [1] "factor" >

python - Create exception hook in a thread -

the following code works when put in main module, exception hook not called when error occurs in thread, not if put code second time within thread. any suggestions why? import sys def myexcepthook(exctype, value, traceback): if exctype == keyboardinterrupt: print "handler code goes here" else: sys.__excepthook__(exctype, value, traceback) sys.excepthook = myexcepthook the thread called follows: t1 = threadmanager(1, "thread-1", 1) t1.start() class threadmanager(threading.thread): def run(self): print 9_) # should cause error ic caught hook

xmlstarlet finds my html invalid -

i'm using xmlstarlet query source code of following webpage, test: http://motherfuckingwebsite.com/ this command i'm using: xmlstarlet sel -t -v "//h2" mfw.html it returns bunch of errors this: mfw.html:81.8: premature end of data in tag body line 12 </html> it appears xmlstarlet doesn't validate document. when run xmlstarlet val mfw.html , output: mfw.html - invalid i observed similar behavior bunch of other html documents. understanding of xml/html validity @ fault here or problem somewhere else?

citrus framework - How do I ignore the content of a message? -

is there chance not validate contents , headers of message, i.e. check if message present & consume it? when "receive", automatically assumed want validate xml content. want consume message (from queue in use case) not relevant test. off queue. purge in next test run rather not. if expected control message payload empty message validation should skipped. xml dsl <receive endpoint="jmsqueueendpoint"> <message></message> </receive> java dsl receive(jmsqueueendpoint); however should mentioned receiving messages in test not relevant test bad thing

docker - CircleCI - Git could not resolve host when cloning repository -

when running npm install within circleci fetch node packages our github repositories through package.json. operation happening when building docker image dockerfile. this has been working great until last week when without changes in our side, started errors while cloning these packages. perform operation, using basic authentication in url providing user credentials in it. ie: https://<username>:<password>@github.com/elektron-technogoly/<repository>.git now, following errors: npm err! command failed: git clone ... npm err! fatal: unable access 'https://<username>:<password>@github.com/elektron-technogoly/<repository>.git': not resolve host: <username> from error message seems thinks username host , thus, fails. checked password still valid , did not expire. has - around last week - changed cause error? has basic authentication been disabled? update : playing bit seems when change base docker image (say node:4-slim no

Python Identify File Path to Module -

the regular os.path.dirname(__file__) doesn't work in special setting i'm in. hope not having influence, it's jython 2.7. text_dir = os.path.dirname(__file__) nameerror: global name '__file__' not defined if call os.path.dirname(__file__) inside function works fine. version 1 (works) bar.py import os def bar(): location = os.path.dirname(__file__) return location version 2 (doesn't work, see above nameerror) extension.py import os some_tool import extensions class extended(extensions): def foo(): location = os.path.dirname(__file__) any idea why? related jython? or because inside class ? or because inherting something? current workaround extension.py import bar some_tool import extensions class extended(extensions): def foo(): location = bar.bar() the answer below revision 1 of question it worked me: $ pwd /tmp $ cat test.py import os; print(os.path.dirname(os.path.realpath(__file__))) $ python

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

i using winscp .net assembly uploading files. want upload multiple files asynchronous way. have created method works single upload. public class uploadingdata { private sessionoptions _sessionoptions; private session _session; //connection etc private void onconnected() { foreach (var fileinfo in localfileslist) { var task = task.factory.startnew(() => uploadfilesasync(fileinfo)); } } private async task uploadfilesasync(string file) { string remotefilepath = _session.translatelocalpathtoremote(file, @"/", "/test_data_upload"); var uploading = _session.putfiles(file, remotefilepath, false); //when done await task.run(() => thread.sleep(1000)); } } please suggest me correct way. thanks you can use backgroundworker class this: string[] images = new string[50]; foreach (var path in images) { backgroundworker

c# - Listing arguments for a method node -

Image
i'm trying list arguments method. when use sample client can see following information: but when use _session.browse() children of "methodio" can't see arguments: var browsedescr = new browsedescription { nodeid = methodnode.nodeid.tostring(), browsedirection = browsedirection.forward, referencetypeid = referencetypeids.aggregates, includesubtypes = true, nodeclassmask = (uint)(nodeclass.variable | nodeclass.object), resultmask = (uint)browseresultmask.all }; var arguments = browse(browsedescr); result: i've tried: browse children of inputargument node to use _session.readnode(methodnode.nodeid.tostring()); so doing wrong? how can figure out arguments method has? from screenshot looks you're getting 2 expected nodes back, not? once have these nodes, actual datatype of input , output arguments method determined datatype of inputarguments , outputarguments nodes.

Does Canvas changes size and density using Cordova on Android App? -

i have 2 usages of same view (graphicoverlay mobile vision of google play services): 1 in native android activity; 1 in custom extension of cordova plugin. in first case canvas passed inside view's ondraw() method has precise same size of clipbound rect , density equal 0; in second case canvas passed inside view's ondraw() method has precise size , density of device screen (720x1280 , density=320 on galaxy s3). behaviour need first 1 when using cordova plugin. in both cases layout containing view same.

ggplot2 - Faulty legend in R with "color_scale_manual" -

Image
can please tell me why legend not displaying correctly (the point in legend hypericin filled green , not blue). here code: ggplot(df,aes(x=x, y=y))+ labs(list(title='mtt_darktox',x=expression('concentration['*mu*'m]'),y='survival[%]'))+ scale_x_continuous(breaks=seq(0,50,2.5))+ scale_y_continuous(breaks=seq(0,120,20))+ expand_limits(y=c(0,120))+ geom_point(data=df,shape = 21, size = 3, aes(colour='hypericin'), fill='blue')+ geom_errorbar(data=df,aes(ymin=y-sd1, ymax=y+sd1),width = 0.8, colour='blue')+ geom_line(data=df,aes(colour='hypericin'), size = 0.8)+ geom_point(data=df2,shape = 21, size = 3, aes(colour='#212'), fill='green')+ geom_errorbar(data=df2,aes(ymin=y-sd1, ymax=y+sd1),width = 0.8, colour='green')+ geom_line(data=df2,aes(colour='#212'), size = 0.8)+ scale_colour_manual(name='batch_nr', values=c('hyperi

weblogic12c - How to deploy Clojure/Luminus uberwar in Weblogic 12.c -

i have created microservice poc using clojure & luminus web framework , packaged war via lein uberwar . it has been tested , deployed , run in immutant , tomcat servers. our production environment oracle weblogic 12c . in order avoid errors i've created weblogic.xml file inside war content: <?xml version='1.0' encoding='utf-8'?> <weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd"> <container-descriptor> <filter-dispatched-requests-enabled>false</filter-dispatched-requests-enabled> <prefer-web-inf-classes>true</prefer-web-inf-classes> </container-descriptor> however internal error if server not detect entry point of application. <nov 10, 2016 9:25:57 utc> <warning> &l

selenium webdriver - Nunit : How can I retry fixture if one test fails? -

i noticed tests 1 test fixture randomly fail on teamcity, can't reproduce crashes in pc use [retry(retrynumber)] attribute, helps there way set retry for fixture , repeat whole fixture if 1 test fails? using c#+nunit+selenium webdriver

firebase - Can't handle refreshed token in custom FirebaseInstanceIDService Android -

Image
when i'm debuging, part of application doesn't execute, don't know when token refreshed, when clear data or uninstall application before debug. this following image presents code. please can explains me ? okay lets go step step first of in activity call piece of code , make sure token generated (assuming have done nothing wrong manifest , other configs json files etc.) firebaseinstanceid.getinstance().gettoken(); if token means code fine unable debug reasons if not working should go google documentation , match steps happy coding!!

node.js - Exclude null attributes from Mongoose query result -

i querying data using mongoose , returning response via express api. prevent null attributes being present in api response. there nice way via mongoose? recommended way of doing using express & mongoose? you can override tojson mongoose schema methods remove attributes returned json. @example yourschemaname.methods.tojson = function() { var obj = this.toobject(); if (obj.some_field_name === null) delete obj.some_field_name; return obj; } nested objects handling here have code that's gonna remove every null data on attributes have. const removeempty = (obj) => { object.keys(obj).foreach(key => (obj[key] && typeof obj[key] === 'object') && removeempty(obj[key]) || (obj[key] === '' || obj[key] === null) && delete obj[key] ); return obj; }; source : how-do-i-remove-all-null-and-empty-string-values-from-a-json-object

java - Load a class with all it's components from outter jar -

i have code: // getting jar url contains target class url[] classloaderurls = new url[]{new url("linktojar")}; // create new urlclassloader urlclassloader urlclassloader = new urlclassloader(classloaderurls); // load target class class<?> beanclass = urlclassloader.loadclass("com.my.class"); // create new instance loaded class constructor<?> constructor = beanclass.getconstructor(); object beanobj = constructor.newinstance(); // getting method loaded class , invoke method method = beanclass.getmethod("sayhello"); method.invoke(beanobj); it's supposed call sayhello method needs 1 bean work. the method prints "hello %name", name @autowired string. the call method working, problem it's saying "hello" because string not being autowired, , it's "null". how can make autowired possible, if context in jar i'm calling , seems not being load??

node.js - Run npm as superuser, it isn't a good idea? -

i'm getting errors npm while trying install/update packages without su permissions on linux. the easy way solve problem execute sudo npm install <package> , i'm not sure if idea. best way become owner of .npm folder, found stackoverflow's questions , blog posts. my question is: why run npm su isn't idea? running npm super user has risk of running untrusted code super user can potentially mess entire system. running npm unprivileged user has risk of running code less privileges , won't able mess entire system - own files (which can equally bad, depending on how @ it). what , recommend install node in home directory instead of globally on system if it's own computer. way don't have run sudo or su npm or make install of node itself. i run lot of versions of node compile sources different switches , convention use install node in versioned directories, either globally in /opt (but need sudo ) or locally in home directory i

How to check which person clone my project in github -

i have projects on github , , they're public . how know projects have been cloned, , whom? there way of telling have cloned project. but, github provides basic statistics visitors , clones in 'graphs' option on repository. here link . also can see has forked project: number showed on top right corner on repo present on github . go graphs->members check out forked repo. hope helps.

exact online - When syncing my model within Invantive Control for Excel I get the error "Could not find parameter with name 'P_SCHEME_CODE' -

Image
when try synchronise model retrieving gl account classification information exact online, following error: itgensdf031: not find parameter name 'p_scheme_code': what should change in order work? related sql query on exact online table glaccountclassifications : select division_code , glclassification_code_attr , glaccount_code_attr glaccountclassifications glaccountscheme_code_attr = :p_scheme_code order glaccount_code_attr , division_code the query listed uses :p_scheme_code . sql work, invantive control parses query retrieve list of fields metadata. needs know parameters , find values them in invantive control list of parameters defined in model editor under "parameters" in tree. in invantive control use parameter in query need use $p{p_scheme_code} instead of :p_scheme_code . $p{p_scheme_code} can inserted in query hand or using building blocks drop down , choosing defined parameter.

javascript - Progress bar with step answers in a form -

i try make progress bar step when click on next button survey. think missed in actual code. survey composed slider validate answer in output after click button. great if help, ! here html : <form class="form" name="frm" method="post" action="quest_a_rec.asp" onkeydown="testclavier();" > <input name="id" value="<%=data_questions("id_resultat")%>" type="hidden"> <div class="col-sm-12"> <div class="row col-sm-offset-2"> <div class="col-sm-8 cent" id="question"> <div class="left"> <p class="requestbig"><%=data_questions("libquestion")%></p> </div> <output><%=initoutput%></output> </div> </div&

android - How can i post this by volley -

"working_days": [ { "day_id": 2, "from": 11, "to": 22 }, { "day_id": 3, "from": 10, "to": 23 } ], that 's part of script need post i'm using volley gson can help { "userid": 2, "token": "bdajkvnbadkvda1ad1fadf4ad5f1da5", "name": "center 123", "address": "12 ramsis str.,", "lat": "30.31194946131", "long": "30.31194946131", "location": "assute", "phone": "032365653232", "owner_name": "ahmed", "owner_number": "164956465464", "registry_number": "2161312", "taxation_card": "2326-66321", &quo

linq - Cast List<object> to List<myclass> c# -

by code got list of selected rows in aspxgrid. string[] fieldname = new string[] { "userid", "name", "address" }; list<object> selectedlist = grid.getselectedfieldvalues(fieldname); now want perform 1 of below operation. filter list of object userid userid = 1 using linq cast list<object> list<users> i have tried following 2 methods exception occurs. unable cast object of type 'system.object[]' type 'cubedataobject.claims'. list<users> mylist = (list<users>)(object)selectedlist; list<users> listd = selectedlist.select(n => (users)n).tolist(); i have tried many other methods tired. it seems have list of boxed object[] . so, need unbox , values of userid , name , address corresponding index. here example: list<users> mylist = selectedlist .where(item => (int)((object[])item)[0] == 1) .select(item => { var values = (object[])item;

Getting Framework related error when trying to build a .net solution using MSBUILD plugin via Jenkins -

i trying create build using msbuild via jenkins .  installed msbuild plugin , configured path of same .i got below error when tried build , installed framework 4.5 in jenkins server . c:\windows\microsoft.net\framework\v4.0.30319\microsoft.common.targets(983,5): warning msb3644: reference assemblies framework ".netframework,version=v4.5" not found. resolve this, install sdk or targeting pack framework version or retarget application version of framework have sdk or targeting pack installed. note assemblies resolved global assembly cache (gac) , used in place of reference assemblies. therefore assembly may not correctly targeted framework intend. [c:\jenkins\jobs\job1\workspace\proj1\sample.csproj] when build again . got same error . while configuring msbuild plugin in jenkins need provide path of msbuild.exe . path change when framework 4.5 installed . ???? appreciate suggestion . thanks bala did try adding target framework version in msbuild target?

javascript - page is getting refress after uploading a file -

i trying upload file using ajax function , file getting uploaded problem after few time page getting refresh data has gone. please me prevent page load. my html code is: <form> <input type="file" name="upl" id="upl" /><br /> <input type="submit" name="submit" id="submit" /> </form> <p id="res"></p> my js file code is: $("#upl").on('change',function(e){ e.preventdefault(); e.stoppropagation(); var file_data = $(this).prop('files')[0]; var form_data = new formdata(); form_data.append('file', file_data); $.ajax({ url: 'upload.php', // point server-side php script datatype: 'text', // expect php script, if cache: false, contenttype: false, processdata: false, data: form_data,

ios - Realm: Can't update a object if one of its properties is another object that already exists -

i have schema: class a: object { var ida = "" var b: b? override class func primarykey() -> string { return "ida" } } class b: object { var idb = "" var name = "" override class func primarykey() -> string { return "idb" } } so if want save object: func updatea(a: a, b: b) { { try realm.write { a.b = b //here excepcion realm.add(a, update: true) } } catch { error } } when call update can't assign b a.b, get: *** terminating app due uncaught exception 'rlmexception', reason: 'can't create object existing primary key value "bkey".' if b object exists in database primary key that, if new object works. im pretty sure long time ago worked expected notice want save updating b object if 1 of properties has changed, name. , dont wanto create b object, use b object passed. it's expected isnt it, adding b crea

bash - How Can I Grep For Two Different Strings and Print Them? -

my data looks below: stx=anaa:1+5013546100917:kellogg company (gb) limited+5000119000006:tesco stores plc+160811:134338+63010+pioneer+invfil+b' mhd=1+invfil:9' typ=0700+invoices' sdt=5013546100917:12191+kellogg company (gb) limited+the kellogg building:talbot road:manchester::m16 opu+151194288' cdt=5000119000006:5000119000006+tesco stores plc+bought ledger departmrent:tesco house:po box 506:cardiff:cf4 4ts+220430231' fil=9476+1+160811' fdt=160313+160315' mtr=7' mhd=2+invoic:9' clo=5000119008510:0100851:4420009+tesco (co antrim)+kilbegs road:ballymena road:antrim:at:bt41 4nn' irf=92349489+160314+160314' and want grep "fil=" , "irf=" , print them out see results. i have tried various options none of them work! zgrep -i 'fil=\|irf=\|' `zgrep -il "5000119000006" *201609*` zgrep "fil=|irf=" `zgrep -il "50001190000006" *201609*' if file zipped: zegrep 'fil=|ir

css - Is there any way to send a message to email in html -

i making form right , have bit of problem. html doesn`t support mail-sendings without downloaded email program. there maybe way not send email send message instead can converted email? there service out there supports idea? know php solution, have access html/css server. please me out. you try using iframe this. still have php file. however, have host somewhere else. maybe google drive? or smth that.

wordpress - How can i set default post title when someone will go to add new post not placeholder, force to set at least 1 category and 3 tags -

Image
i trying set default post title when go add new post, tried question wordpress set default title when creating new custom post no solution. trying force 1 category select , @ least 3 tags. if 1 not add 1 category message displayed in top of post title field not javascript alert. you can use function add default title function my_default_title_filter() { global $post_type; if ('post' == $post_type) { return 'my filtered title'; } } add_filter('default_title', 'my_default_title_filter'); also maybe can use plugin force selecting category , tags https://wordpress.org/plugins/required-fields/

java - Constructing an object from a string -

is possible construct object given string, tostring() method, , class itself. for example have class book. class book { // ... string gettitle() { return title; } string getpubyear() { return pubyear; } void settitle(string _title) { title = _title; } void setpubyear(string _pubyear) { pubyear = _pubyear; } public string tostring(){ return title+" "+pubyear; } } if have string: "exampletitle 2017" how can create instance of class book, has attribute: title=exampletitle pubyear=2017 we can following: book book = new book(); string examplestring = "exampletitle 2017"; string[] parts = examplestring.split(); book.settitle(parts[0]); book.setpubyear(parts[1]); but long winded. there more automatic way this? you can add new constructor: public book(string s) { string[] parts = s.split(" "); if (parts.length() == 1) { this.

PHP file_get_contents timeout "local file" (NFS/mount) -

i know how set timeout on local file file_get_content (not http uri), sometime nfs mount partition slow , prefer give after time out (5s exemple), file_get_contents("/mnt/photo/photo.jpg"); i read answers other similar questions, guess solutions work http, , not local files: $ctx = stream_context_create(array('http'=>array('timeout' => 1200))); i suppose solution not me, it's web, right? ini_set('default_socket_timeout', 900); i'm afraid, can not control nfs timeouts via php, nfs protocol options controlled via mount options. php has no idea whether file on nfs, or on local hard drive. believe, there ways determine fact file on nfs, won't give control on timeouts. there 2 types of timeouts in nfs: minor , major . minor timeout occurs, when no confirmation received server within timeout specified in mount options ( timeo ). operation retried, , timeout doubled. major timeout occurs, when timeout interval reach