Posts

Showing posts from January, 2011

java - JUnit and other dependencies not recognized by CI build -

background: so team using microsoft's git services , we've set ci tests. not using maven, , project connected remote server through eclipse microsoft team services plugin, try interact remote repo through command line. current strategy: i'm not familiar how deal dependencies on remote repo java projects i've tried pushing .jar dependencies in our build path rest of source code (i know they're big , there's better way this). problem: when push .jar files, ci tests still fail following errors: src\jblastests.java(1):src\jblastests.java(1,): error : [javac] d:\a\1\s\ src\jblastests.java:1: error: package org.junit not exist src\jblastests.java(5):src\jblastests.java(5,): error : [javac] d:\a\1\s\ src\jblastests.java:5: error: package org.jblas not exist and more error reports related missing symbols due packages not being found. questions: 1) else needs on repo make build work? 2) there better way, besides maven, link libraries repo? ...

ggplot2 - Use an image as area fill in an R plot -

Image
how can graph similar (the dollar image graph)? or packages can with? have (gg)plot using geom_area. dollar graph image this purely novelty purposes, right? in code below, cover portion of dollar bill above blue curve using geom_ribbon . library(jpeg) library(grid) library(ggplot2) library(scales) theme_set(theme_classic()) # load image of dollar bill , convert raster grob download.file("https://2marks.files.wordpress.com/2013/07/george-washington-on-one-dollar-bill.jpg", "dollar_bill.jpg") db = readjpeg("dollar_bill.jpg") db = rastergrob(db, interpolate=true) # fake data set.seed(3) dat = data.frame(x=1913:2009) dat$y2 = seq(5,950, length=nrow(dat)) + rnorm(nrow(dat), 0, 5) dat$y1 = seq(100,5,length=nrow(dat)) + c(0, -0.5, rnorm(nrow(dat) - 2, 0, 2)) ggplot(dat, aes(x, y1)) + annotation_custom(db, xmin=1913, xmax=2009, ymin=0, ymax=100) + geom_ribbon(aes(ymin=y1, ymax=100), fill="white") + geom_line(...

python - Designing an Efficient neural network for a Regression data -

by following tutorials on tensorflow , reading basic stuff neural networks, have modeled neural network using python , tensorflow libraries. as of now,my ".csv" file data follows: at v ap rh pe 14.96 41.76 1024.07 73.17 463.26 25.18 62.96 1020.04 59.08 444.37 5.11 39.4 1012.16 92.14 488.56 20.86 57.32 1010.24 76.64 446.48 10.82 37.5 1009.23 96.62 473.9 26.27 59.44 1012.23 58.77 443.67 15.89 43.96 1014.02 75.24 467.35 9.48 44.71 1019.12 66.43 478.42 14.64 45 1021.78 41.25 475.98 ..................................... as of now,i have designed neural network function multiple inputs , multiple outputs. in above data,i considering first 3 columns inputs , next 2 columns outputs.so,once training data,if pass inputs 14.64,45,1021.78 ,i want neural network predict output values 41.25 , 475.98. here current code: import tensorflow tf import numpy np import pandas pd #import matplotlib.pyplot plt rng = np.random...

camera - Measure depth of facial features, e.g.: stereographically (two photos)? -

what's easiest/cheapest way of measuring depth of facial features millimeter? i thinking 2 photos taken smartphones @ static distance , angle person. e.g.: infer exact protrusion of nose @ each point of arch, eyes &etc.

javascript - 405 (Method Not Allowed) in Angular JS With WCF Service -

Image
currently working on wcf project. consuming wcf project angular js application when run application not provide error. there errors when launch developer tools in google chrome , cannot insert, update , delete etc. it's showing following errors...... me correct errors grateful. ?o=3&g=ec0825c4-90a4-2692-d257-cd2c2b565912&s=1a2c77e8-0498-4a11-b8b8-d740dbec71c4&z=1403834305:2 uncaught syntaxerror: unexpected token < 2angular.js:12701 options http://localhost:50028/studentservice.svc/addnewstudent 405 (method not allowed) index:1 xmlhttprequest cannot load http://localhost:50028/studentservice.svc/addnewstudent. response preflight has invalid http status code 405 modules.js:52 error occured[object object] index:1 http://localhost:50028/studentservice.svc/getallstudent/ 400 (bad request) angular.js:14642 referenceerror: $log not defined @ modules.js:18 @ angular.js:17000 @ m.$digest (angular.js:18182) @ m.$apply (angular.js:18480) @ l (angular....

ios - Have 2 container views. Need to change one to a different view controller -

so have main view controller... , 2 view containers. vcon1 , vcon2 have them talking each other via delegates i'm not sure how change view controller displayed...so tap on button in vcon1 change vcon2 have new view controller... i have navagation controller in vcon2 i'm not sure want "stack" of view controllers in there...just want swap out 1 another. any suggestions appreciated.. if both of them have been added subviews on parentcontroller's view, it's matter of calling bringsubviewtofront . else can remove 1 of view controllers, , proceed add other one. can read more view controller containment @ objc.io

nsfilemanager - Error: The operation is not supported for this media - Swift -

i trying save video code on apple tv: func playeritemdidreachend(_ notification: notification) { if notification.object as? avplayeritem == player.currentitem { player.seek(to: kcmtimezero) let exporter = avassetexportsession(asset: asset, presetname: avassetexportpresethighestquality) let filename = "video.mp4" let documentsdirectory = filemanager.default.urls(for: filemanager.searchpathdirectory.documentdirectory, in: filemanager.searchpathdomainmask.userdomainmask).last! let outputurl = documentsdirectory.appendingpathcomponent(filename) exporter?.outputurl = nsurl.fileurl(withpath: outputurl.path) exporter?.outputfiletype = avfiletypempeg4 let path = nssearchpathfordirectoriesindomains(.documentdirectory, .userdomainmask, true)[0] string let url = nsurl(fileurlwithpath: path) let filepath = url.appendingpathcomponent(filename)?.path let filemanager = filemanager.default ...

Send SMS via Arduino without GSM -

is possible arduino send message internet without using gsm shield? i need arduino send message pressing push button, connected arduino , ethernet shield, without using gsm shield. i need send message using html/php api code included in server via get/post. i'm using code in code data nicely insert in sql database if insert data send sms via php api. it's not working. here php code: <?php $mysqli = new mysqli("localhost", "user", "password","db"); $tag=$_get["value"]; $result = $mysqli->query("insert tag_tbl (tag_value, status) values ('".$tag."', 1)"); if ($result === false) { echo "sql error:".$mysqli->error; } else { header("location: https://vas.banglalinksgsm.com/sendsms/sendsms?msisdn='xxxxx'&message='".$tag."'&userid=xxxxx&passwd=xxxxxx&sender=wsc"); } ?> i think want send message nu...

Can I override and overload static methods in Java? -

i'd know: why can't static methods overridden in java? can static methods overloaded in java? static methods can not overridden in exact sense of word, can hide parent static methods in practice means que compiler decide method execute @ compile time, , not in runtime, overridden instance methods. for neat example have here . and this java documentation explaining difference between overriding instance methods , hiding class (static) methods. overriding: overriding in java means particular method called based on run time type of object , not on compile time type of (which case overriden static methods) hiding: parent class methods static not part of child class (although accessible), there no question of overriding it. if add static method in subclass, identical 1 in parent class, subclass static method unique , distinct static method in parent class.

python 3.5 - how to frame model for deep learning with vectors as input? -

how can create deep learning model multiclass classification, if feature set contain 5 vectors of length 8 each? feature set looks features=[[0.34, 0.67, 0.87, .. ][0.67, 0.87, 0.88 ....][][][],....] model = sequential() model.add(dense(8, input_dim=40, activation='relu')) model.add(dense(33, activation='softmax')) model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy']) just flatten data tf.contrib.layers.flatten , , have 40 features in 1d, that's it. however if there specific 2d arrangement might consider convolutions exploit fact.

android - How to solve "java.lang.NumberFormatException: s == null at java.lang.Integer.parseInt" -

i tried different things solution failed, need know what's wrong code , should be. here logcat error e/androidruntime: fatal exception: main process: freemig.freemigmessenger, pid: 31699 java.lang.numberformatexception: s == null @ java.lang.integer.parseint(integer.java:570) @ java.lang.integer.parseint(integer.java:643) and happens on button click event private class sentmessageholder extends recyclerview.viewholder { textview messagetext, timetext; imagebutton ib; msgdltapiservice msgdltapiservice; string rec_id; string content_id; int[] ids = new int[100]; sentmessageholder(final view itemview) { super(itemview); messagetext = itemvie...

getting docker swarm cluster worker node error -

i'm working on docker swarm. when connect worker node error: error response daemon: rpc error: code = 14 desc = grpc: connection unavailable i have stopped firewall , setenforce 0. problem? if using vm can init docker swarm alternative ip address using docker "swarm init --advertise-addr :" example: docker swarm init --advertise-addr 192.168.99.100:2377 , add nodes swarm. example: docker swarm join --token --advertise-addr : docker swarm join --token swmtkn-1-randomtoken 192.168.99.100:2377 some people works 2377 port. check if works well.

intellij idea - incompatible types: java.lang.Object cannot be converted -

i new java.i writing program pre-order tree traversal you need use stack<tree> rather stack in fifth line of preoderiter . tells compiler stack stores tree s (rather default object ) when stack.pop() (see line underlined in red) knows result tree , not object .

tensorflow - Difference between tf.assign and assignment operator (=) -

i'm trying understand difference between tf.assign , assignment operator(=). have 3 sets of code first, using simple tf.assign import tensorflow tf tf.graph().as_default(): = tf.variable(1, name="a") assign_op = tf.assign(a, tf.add(a,1)) tf.session() sess: sess.run(tf.global_variables_initializer()) print sess.run(assign_op) print a.eval() print a.eval() the output expected as 2 2 2 second, using assignment operator import tensorflow tf tf.graph().as_default(): = tf.variable(1, name="a") = + 1 tf.session() sess: sess.run(tf.global_variables_initializer()) print sess.run(a) print a.eval() print a.eval() the results still 2, 2, 2. third, use both tf.assign , assignment operator import tensorflow tf tf.graph().as_default(): = tf.variable(1, name="a") = tf.assign(a, tf.add(a,1)) tf.session() sess: sess.run(tf.global_variables_initializer()) print sess.run(a) print a.eval() ...

giving crash on using a external library in xml of custom notification android -

in api level above 24 exception w/system: classloader referenced unknown path: /data/app/com.example.admin.emoji_test-2/lib/x86 in aapi level below 24 exception 08-20 11:45:32.481 1951-1951/com.android.systemui e/statusbar: couldn't inflate view notification com.mechmocha.unityproject/0xf android.view.inflateexception: binary xml file line #24: error inflating class io.github.rockerhieu.emojicon.emojicontextview @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:707) @ android.view.layoutinflater.rinflate(layoutinflater.java:755) @ android.view.layoutinflater.inflate(layoutinflater.java:492) @ android.view.layoutinflater.inflate(layoutinflater.java:397) @ android.widget.remoteviews.apply(remoteviews.java:2462) @ com.android.systemui.statusbar.basestatusbar.inflateviews(basestatusbar.java:662) @ com.android.systemui.statusbar.basestatusbar.createnotificationviews(basestatusbar.java:835) @ com.android.systemui.statusbar.phone.phonestatusbar.addnotif...

redux saga - yield on a function that returns object which includes a promise -

in saga have function need yield on doesnt return promise directly. function this: export function requestdownload(url): { let resolve, reject; return { type: request, url, promise: new promise(res=>resolve=res, rej=>reject=rej), resolve, reject } } i need yield on promise field in return. tried variations of call not able this. cannot modify requestdownload function return promise directly. is possible of redux-saga helpers? in summary trying do: i trying do: function* mysaga() { yield call(requestdownload, 'blah_url') } how about: function* mysaga() { let action = yield call(requestdownload, 'blah_url') try { let data = yield action.promise } catch(err) { // deal error } }

c# - Using Simple Injector to register lazy parameters by reflection -

my service classes have 2 irepository instance( icacherepository , isqlrepository ), icacherepository implementations use in services, isqlrepository implementations use. register implementations of icacherepository interface in simple injector reflection: var registrations = assembly.getexportedtypes() .where(type => type.isclass && basetype.isassignablefrom(icacherepository)) .select(type => new { interface = type.getinterfaces().first(), implementation = type }); foreach (var reg in registrations) { container.register(reg.interface, reg.implementation, lifestyle.transient); } i found lazy register solution registering 1 instance of interface. want register implementations of isqlrepository interface in lazy mode reflection. desired solution is: var registrations = assembly.getexportedtypes() .where(type => type.isclass && basetype.isassignablefrom(isqlrepository)) .select(type => new { interface = type.getinterfaces().first...

android - refresh fragment after changing data in database -

there mainactivity it's fragment named fragmentone . have list of items in fragment , these data save in database i make changes navigationview in mainactivity .. try delete rows database. works, after need refresh fragmentone, how can refresh fragmentone ui ? i have method named updateui in fragmentone how access method? when make method public goes wrong! i tested different ways failed.. can tell me how can this? mainactivity : public class mainactivity extends appcompatactivity { private drawerlayout mdrawerlayout; private tablayout tablayout; private viewpager viewpager; private detail mdetail; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //////// toolbar toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); actionbar actionbar = getsupportactionbar(); actionbar.sethomeasupindicator(r.drawable.ic_menu...

c# - SendTwoFactorCodeAsync returning 'UserId not found' after successful login, using SignManager with dependency -

i using signinmanager , authenticationmanager through dependency injection. working fine except sendtwofactorcodeasync here code: utilityconfig container.registertype<applicationsigninmanager>(); container.registertype<applicationusermanager>(); account controller var myuser = await usermanagerservice.value.findasync(model.mobile, model.password); if (myuser != null) { var result = await signinmanager.value.passwordsigninasync(model.mobile, model.password, false, shouldlockout: false); switch (result) { case signinstatus.success: { //success code } case signinstatus.requiresverification: { var code = await usermanagerservice.value.generatetwofactortokenasync(myuser.id, configurationmanager.appsettings["phonecodeprovider"]); var send = await signinmanager.value.sendtwofactorcodeasync(configurationma...

spring - How to configurate two user system in springsecurity? -

in web app,i have 2 user system,one administrators,another users.i use multiple httpsecurity configurate security filter chain separately administrators , users. firstly,when login in web app through administrators , users in signle browser @ same time,the latter login userinfo cover former. this big bug,when try fix it,i learn springsecurity architecture , implementation,springsecurity use session storing securitycontext between requests .thus,when login in web app through administrators , users in signle browser @ same time,the latter login userinfo cover former login userinfo. by override httpsessionsecuritycontextrepository ,i create securitycontextrepository : onesessionmulticontextrepository .i can use decide securitycontext take session or key use storing session current servletpath. this fix problem above,two user system can login in web app without affecting each other now.but there new problem,when logout one,another logout too!i found springsecurity invalid sess...

SoapUI groovy script build string on condition -

i have string log.info("my name :" + name) where name predefined string. now name can either peter or mary depending on boolean x. result can "my name mary" if x true or "my name peter" if x false. know can predetermine 'name' before doing log.info, if wanted within same line? like: log.info("my name is: " + if (x) "mary" else "peter") the above give me unexpected token "+" this quite simple. can use ternary operator log.info("my name is: " + x ? "mary" : "peter")

ios - Add ButtonDownload in cell of table in swift -

i want add downloadbutton cell of table download. added button success button call delegate. so, call delegate how? library https://github.com/pavelkatunin/downloadbutton enter image description here this code in cell. class downloadcell: uitableviewcell, pkdownloadbuttondelegate , pkdownloadersimulatordelegate { @iboutlet weak var lbllanguages: uilabel! @iboutlet weak var imgdownloaded: uiimageview! var downloadersimulator: pkdownloadersimulator? var pendingsimulator : pkdownloadersimulator? override func awakefromnib() { super.awakefromnib() startdownloadlanguage.delegate = self self.downloadersimulator = pkdownloadersimulator.init(progressinterval: 0.1) self.downloadersimulator?.delegate = self; self.pendingsimulator = pkdownloadersimulator.init(progressinterval: 0.05) self.pendingsimulator?.delegate = self; } override func setselected(_ selected: bool, animated: bool) { super.setselected(selected, animated: animated) } @iboutlet va...

html - video is not working in materializecss -

i working on site insert videos, 1 on direct html page , other 1 background video. using materializecss . have videos in videos folder. tried these codes background video .video-background{ background: transparent url("../videos/banner-video.mp4") no-repeat center fixed; background-size: 100% 100%; width: 100%; height: 500px; border:1px solid red; } inserting in html page <video class="responsive-video" controls> <source src="videos/video1.mp4" type="video/mp4"> non of them work, when check materializecss documentation there no need of adding script code. when check console of chrome , firefox, no error displaying

node.js - Decode Data field or Payload from TCP Packet of Filebeat -

i developing service in nodejs receive data filebeat, have decoded packet there 1 problem can not decode data field of tcp packet, tried , different packages. note: problem occurs filebeat tcp packet now questions are: i understand inside tcp packet , purpose of fields still, new tcp protocol missing something? what right way deal tcp packet if can provide in context of nodejs net , or tls packages right implementation of dealing tcp data?

php - Protecting my forms against XSS attacks -

register.php $_session['email'] = $_post['remail']; $_session['first_name'] = $_post['firstname']; $_session['last_name'] = $_post['lastname']; $first_name = $mysqli->escape_string($_post['firstname'])); $last_name = $mysqli->escape_string($_post['lastname']); $email = $mysqli->escape_string($_post['remail']); $password = $mysqli->escape_string(password_hash($_post['rpassword'], password_bcrypt)); $confirmpassword = $mysqli->escape_string(password_hash($_post['confirmpassword'], password_bcrypt)); $hash = $mysqli->escape_string(md5(rand(0,1000))); $result = $mysqli->query("select * users email='$email'") or die($mysqli->error()); if ($result->num_rows > 0) { $_session['message'] = '<div class="info-alert">user email exists!</div>'; header(...

Use configuration file from VS in powershell to deploy Azure Data Factory -

i have created configuration files (dev.json & qa.json) deploy azure data factory artifacts different environments using visual studio given here https://www.purplefrogsystems.com/paul/2017/01/using-azure-data-factory-configuration-files/. deploying using vs time taking task, decided use powershell. now, want use same configuration files (dev.json & qa.json) used deployment using powershell. how can achieve ? you're right can create objects in data factory powershell, @ time there no way automatically apply config file it. config files project level object , have elements apply adf object. such used in vs publish wizard. you incorporate config details powershell script using convertfrom-json cmdlet , parsing entries against adf objects you're creating.

ruby on rails - what is the reason behind "wasabi:resolver:httperror" -

Image
i getting error when trying parse wsdl external api gem using active model map data model. have tried same api using sample ruby script , it's working seeing error gem code. can me find issue or reason behind error

actionscript 3 - Replace KeyboardEvent to work with Aid for Android -

i have made ann app works fine on windows. problem use following event listener: stage.addeventlistener(keyboardevent.key_down, keydownhandler); when compile app android (air 23) event not working. ask event use air in android replace event?

ssh - SCP in ESXi not working -

everytime try copy files esxi machine other linux machine fails. either waits longer time or ends time out error. cmd used: scp local_file root@:ip:path/to/folder cmd err:ssh: connect host port 22: connection timed out lost connection linux machine has sshd service running. but, copying linux esxi works. where missing in configuration? in advance !! enable sshclient in firewall properties of server. in vsphere client select host -> configuration -> security profile -> firewall -> properties then enable ssh client enable outgoing scp connections.

Regex to check for valid URL in Firebase Security Rule -

i'm trying implement firebase security rule check if valid url using regex. here sample of url : https://firebasestorage.googleapis.com/andtherestisjustthepartafteriuploadedintofirebasestorage i used regex check: "imageurl": { ".validate": "newdata.val().matches(/((([a-za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[a-za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[a-za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)/)" } however, i'm getting error @ line 26: invalid escape: '\+'. any ideas? its not necessary escape + in regex class , instead use this: [-+=&;%@.\w_] i see syntax errors in pattern, character should escaped athors should not, pattern should : /((([a-za-z]{3,9}:(?:\\/\\/)?)(?:[-;:&=+\\$,\\w]+@)?‌​[a-za-z0-9.-]+|(?:ww‌​w.|[-;:&=+\\$,\\w]+@‌​)[a-za-z0-9.-]+)((?:‌​\\/[%+~\\/.\\w-_]*)?‌​\\??(?:[-+=&;%@.\\w_‌​]*)#?(?:[\\w]*))?)/ but i'm not sure of logic o...

java - image slider for displaying all images -

i new android app development , created image gallery app. working fine want display next image swiping , want images in gridview. when click on image displayed on full screen on swiping , same image displayed again , again. , when press button, app crashes.i found tutorials on how few images want images stored on sd card can me fix ? photosactivity.java : public class photosactivity extends appcompatactivity { int int_position; private gridview gridview; gridviewadapter adapter; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_image_gallery); gridview = (gridview)findviewbyid(r.id.gv_folder); int_position = getintent().getintextra("value", 0); adapter = new gridviewadapter(this, al_images,int_position); gridview.setadapter(adapter); gridview.setonitemclicklistener(new adapterview.onitemclicklistener() { ...

angularjs - show and hide element after executing a function -

i need when user logged in system log out button appear , when logged out button disappear implement i'd first try button click following code: $scope.test = function () { if ($rootscope.authenticated) { $rootscope.authenticated = false; } else { $rootscope.authenticated = true; } } <li class="dropdown" id="profile-messages" ng-class="authenticated ? 'show' : 'hide' " @*ng-show="authenticated"*@> <a title="" href="#" data-toggle="dropdown" data-target="#profile-messages" class="dropdown-toggle"> <i class="icon icon-user"></i> <span class="text" ng-model="username">{{username}}</span> <b class="caret"></b> </a>...

swift - can we use willset and didset with getter and setter -

i reading willset , didset of properties in swift came know can use these variable having initial value below: var property = "name" { willset { print("property changed") } didset { if property == oldvalue { print("values same") } else { print("value changed") } } } property = "anothername" so can use willget , didset below: var property2:string{ willset { print("value change") } didset { print("value changes") } } it gives me error: non-member observing properties require initializer var property2:string{ ^ so can explain me going on here , can use getter , setter willset , didset like: var property2:string{ get{return property2} set{propert2 = newvalue} willset { print("value change") } didset { ...

even or odd number using methods in java -

java code find or odd number using methods. please me getting below error.. compiler output my code class evenodd{ public static int evenodd(int num) { if(num%2==0){ system.out.println("true"); } else { system.out.println("false"); } public static void main(string[] args) { int evenodd=evenodd(9); } } } public static int evenodd(int num) { if(num%2==0){ system.out.println("true"); } else { system.out.println("false"); } this method missing return statement. wrote method as static int but didn't write return statement. instead printing. try code: class evenodd{ public static boolean evenodd(int num) { if(num%2==0){ return true; } return false; } public static void main(string[] args) { boolean iseven=evenodd(9); system.out.println(iseven); } }

c# - VS2017 htmlAgilityPack SelectSingleNode adds [1] to xpath? -

i want pull elements page following code using htmlagilitypack: htmlweb web = new htmlweb(); var htmldoc = web.load(@"https://www.reddit.com/r/upliftingnews/"); htmlnode getchild = htmldoc.documentnode.selectsinglenode("//html/body/div[4]/div[2]/div/div[1]"); string xpath = getchild.firstchild.xpath + "/div[2]/div/p[1]/a"; var node = htmldoc.documentnode.selectsinglenode(xpath).innertext; return node; this doesn't work since string xpath = "/html[1]/body[1]/div[4]/div[2]/div[1]/div[1]/p[1]/div[2]/div/p[1]/a". [1] added /html, /body , /div, essentially. why? how fix xpath becomes correct?