Posts

Showing posts from January, 2015

python - Installing packages from a list using pip -

i trying install list of packages using pip. the code used is: import pip def install(package_name): try: pip.main(['install', package_name]) except: print("unable install " + package_name) this code works fine , if package not available, gives error: no matching distributions found however, trying if installation fails (for eg: invalid package name), want print package failed. what can done that? any appreciated, thank you. try checking return value non-zero, indicates error occurred install. not errors trigger exceptions. import pip def install(package_name): try: pipcode = pip.main(['install', package_name]) if pipcode != 0: print("unable install " + package_name + " ; pipcode %d" % pipcode) except: print("unable install " + package_name) wiki

java - Comparing if two Date instances refer to the same day -

i have 2 java instances of java.util.date , have find out if refer same day. i can hard way, taking dates apart , compare days, making sure years match too. since such common problem, expect there easier solution problem. thanks! instances of java.util.date refer instants in time. day fall on depends on time zone you're using. use java.util.calendar represent instant in particular time zone... ... or use joda time instead, much, better api. either way, you'll have know time zone you're interested in. in joda time, once you've got relevant time zone, can convert both instants localdate objects , compare those. (that means can compare whether instant x in time zone on same day instant y in time zone b, should wish to...) wiki

amazon web services - AWS RDS: Connecting with Python -

i have created amazon ec2 instance , amazon rds db(mysql) instance both run in amazon virtual private cloud. looking connect these instances using python, have never connected rds before. does have experience doing assist? connecting rds no different connecting standard mysql instance. answer should - how connect mysql database in python? also, routing , networking might limiting factor establishing connecting. need public ip on instance or able route private ip space. wiki

java - How to take screenshot while popping the error message using Selenium -

i'm new selenium. need know how take screenshot while popping error message. i've browsed in web , used below codes not satisfying requirements file src=screenshot.getscreenshotas(outputtype.file); fileutils.copyfile(src, new file("d:\\"+result.getname()+".png")); the above code not capturing pop-up msg. capturing behind screen only. bufferedimage image = new robot().createscreencapture(new rectangle(tk.getscreensize())); imageio.write(image, "jpg", new file("d:\\"+formatter.format(now.gettime())+".jpg")); robo screenshot not working when switched other screen. when error occurs capturing present screen. someone please give me code snippet? wiki

php - Custom authorization parameter for a policy -

usually, policy, have parameters user , corresponding model. not seem work have custom parameters attached, though. what like: // mymodelpolicy.php class mymodelpolicy { public function foo(user $user, mymodel $model, $somestring) { /* ... */ } } and in blade: // some.blade.php @can('foo', $mymodelinstance, 'tralala') however, error foo expects 3 parameters , getting two. laravel gate delivers 2 , ignores 'tralala' . what easiest way accomplish desire? well, turns out easier thought of... documentation fails give short example on have is, use @can in distinct way: // some.blade.php @can('foo', [$mymodelinstance, 'tralala']) well, if api reference, see can wants array , rest follows. wiki

python - Nosetests missing command line option -

using nose 1.3.7 , documentation lists following command line option --xunit-prefix-with-testsuite-name whether prefix class name under test testsuite name. defaults false. documentation available on: https://nose.readthedocs.io/en/latest/usage.html but when trying use error: nosetests: error: no such option: --xunit-prefix-with-testsuite-name is there i'm missing? wiki

SourceLink in VSTS -

i'm trying integrate sourcelink visual studio team services using https://github.com/ctaggart/sourcelink have problems since package seems unable parse url of vsts repository. build started 8/22/2017 11:58:18 am. 1>project "d:\repos\core\classic-stats\src\acme.stats\acme.stats.csproj" on node 1 (build target(s)). 1>sourcelinkcreate: git rev-parse --show-toplevel d:/repos/core/classic-stats git config --get remote.origin.url https://acme.visualstudio.com/defaultcollection/core/_git/classic-stats git rev-parse head 8c6a68b325cf10b67332aa2ea15db952a88d027d sourcelinkurl: unable convert originurl: https://acme.visualstudio.com/defaultcollection/core/_git/classic-stats 1>done building project "d:\repos\core\classic-stats\src\acme.stats\acme.stats.csproj" (build target(s)) -- failed. build failed. 0 warning(s) 0 error(s) afaik there's support github , bitbucket, right? has been able integrate tfs builds

Unable to deploy to Azure Service Fabric from Powershell -

i trying connect secured cluster hosted in south india data center , able deploy application azure service fabric using visual studio when trying deploy application powershell, getting following error : warning: failed contact naming service. attempting contact failover manager service... warning: failed contact failover manager service, attempting contact fmm... false connect-servicefabriccluster : not ping of provided service fabric gateway endpoints. @ line:7 char:1 + connect-servicefabriccluster -connectionendpoint $endpoint + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : invalidoperation: (:) [connect-servicefabriccluster], fabrictransientexception + fullyqualifiederrorid : testclusterconnectionerrorid,microsoft.servicefabric.powershell.connectcluster script cmdlet connect-servicefabriccluster -connectionendpoint $endpoint -keepaliveintervalinsec 20 -x509credential -servercertthumbp

sql - ORA-00907: missing right parenthesis - Following error is coming when i am putting Case statement in where clause -

$ following code highlights clause of bi publisher query, in have input paramter :p_country, through recieving values either ph/my/cn on basis of have put clause. where prg.payroll_relationship_id = peu.payroll_relationship_id , peu.element_entry_id = pee.element_entry_id , pee.element_type_id = pet.element_type_id , prg.assignment_id = paaf.assignment_id , ppsv.person_id = ppnf.person_id , ppsv.person_id = paaf.person_id --and ppnf.person_id = ccpp.person_id , paaf.primary_assignment_flag = 'y' , paaf.assignment_type = 'e' , paaf.period_of_service_id = ppos.period_of_service_id , ppos.person_id = paaf.person_id , ppos.legal_entity_id = ple.organization_id , ppnf.name_type = 'global' , (case when (:p_country = 'ph') (upper(pet.element_name) in ('phctc ext')) when (:p_country = 'my') (upper(pet.element_name) in ('myctc ext'))

How to use a wild card for part of the path in Angular router? -

i have following routing setup. const routes: routes = [ { path: "submenu1", component: submenucomponent, outlet: "menus" }, { path: "submenu2", component: submenucomponent, outlet: "menus" }, { path: "submenu3", component: submenucomponent, outlet: "menus" }, ... ]; i tried use wild card ** match starting submenu in following way. sadly, seem not match way , no routing @ all. const routes: routes = [ { path: "submenu**", component: submenucomponent, outlet: "menus" }, //{ path: "submenu1", component: submenucomponent, outlet: "menus" }, //{ path: "submenu2", component: submenucomponent, outlet: "menus" }, //{ path: "submenu3", component: submenucomponent, outlet: "menus" }, ... ]; how do that? how following ? const routes: routes = [ { path: "submenu1", component: submenucomponent, outlet: &q

java - why onMouseClick doesnt work in javafx circle shape? -

Image
i want click on 1 of 3 button on title of internal window change color black. times works , does`nt work. please @ code tell me whats wrong it!? i used javac 1.8u20 compile , jre 1.9 run... if use or 3 layer of pane inside of each other how events handle? there problem? package core.windowmanager; import javafx.geometry.insets; import javafx.geometry.pos; import javafx.scene.cursor; import javafx.scene.node; import javafx.scene.control.label; import javafx.scene.effect.dropshadow; import javafx.scene.layout.*; import javafx.scene.paint.color; import javafx.scene.shape.circle; import javafx.stage.screen; import static javafx.scene.paint.color.rgb; /** * created yn on 22/08/17. * declare win not more ... */ public class win { /** * add win in scene */ private final anchorpane root; /** * title , hashcode instance win id */ private final string winid; /** * win pane contains title , content pane */ private final anchorpane winpane = new anchorpane(); /** * title pan

ios - Animation to expand from center to the edges, revealing parentView below -

i have added uiview (containing within uivisualeffectview - blur) subview of view. animate subview center outwards towards edges in radial fashion, expanding circle. should reveal superview below. here code: self.blurview = [[uiview alloc]initwithframe:cgrectmake(0, 0, self.view.bounds.size.width, imageheight)]; [superview addsubview: self.blurview]; uivisualeffect *blureffect = [uiblureffect effectwithstyle:uiblureffectstylelight]; uivisualeffectview *visualeffectview = [[uivisualeffectview alloc] initwitheffect:blureffect]; visualeffectview.frame = self.blurview.bounds; [self.blurview addsubview:visualeffectbuttonview]; [uiview animatewithduration:3.0 delay:0 options:uiviewanimationoptioncurvelinear animations:^{ //code animation self.blurview.frame = cgrectmake(self.blurview.frame.origin.x, -self.blurview.frame.size.height, self.blurview.frame.size.width, self.blurview.frame.size.height

javascript - Jquery How To Stop Append from Appending Previous Element -

i'm having trouble display star of each hotel , not sure on how it. have 5 hotels, , each has different value of hotelstar. my javascript code: function getstarhotel() { var parent = $(' p.star '), imagepath = 'image/hotelstar.png', img; (var = 0; < hotelstar; i++) { img = new image(); img.src = imagepath; $(parent).append('<img src="image/hotelstar.png" class="hotelstar" />') } } and html code is: <h1>hotel 1</h1> <p class="star"><script> hotelstar = 4; getstarhotel(); </script></p> <h1>hotel 2</h1> <p class="star"><script> hotelstar = 3; getstarhotel(); </script></p> <h1>hotel 3</h1> <p class="star"><script> hotelstar = 2; getstarhotel(); </script></p>

gradlew - How can I always use the latest version of custom gradle wrapper -

i have custom gradle wrapper used company wide. wrapper published artifactory. has version 1.0. distributionurl in gradle-wrapper.properties pointing artifactory , version 1.0. when create version 1.1 of custom wrapper there possibility project use wrapper automatically pull newest version or need change distributionurl in each project? not know of, seems bad idea: 1 of great things in gradle wrapper allows sure project uses gradle version has been developed , 'just works'. having moving version defeat that. for sake of argument, suppose having fixed url distributionurl, , change gradle distribution on web server, keeping same fixed name (not sure how gradle wrapper behave, , again bad idea). instead, have seed project (in git) update url, , propagate changes in each project merging seed. automated, , bonus can track when gradle version changed each project (and potentially broke build) because have corresponding commits. wiki

css - SASS variables not working -

i new sass , follow steps given on sass guide website install sass not working @ , not convert sass css, have taken variable colors did not work.i think missing major part in please guide me can assignment further. html: <html> <head> <title>sass1</title> <link rel="stylesheet" type="text/css" href="sass1.scss"/> </head> <body> <div class="container"> <div class="sub_container"> <div class="first_box"> <div class="inner_box"></div> <div class="inner_box"></div> <div class="inner_box"></div> <div class="inner_box"></div> <div class="inner_box"></div> </div>

javascript - Refactor loop within loop to sum up total of property -

i have data: const data = [{ date: '2017-08-4', data: [{ "name": "male", "value": 2, }, { "name": "female", "value": 46, } ] }, { date: '2017-08-5', data: [{ "name": "male", "value": 2, }, { "name": "female", "value": 20, } ] }] i want find total sum of value of male code. let total_male_of_alldays = 0 data.foreach(obj => { obj.data.foreach(obj2 => { if(obj2.name === 'male'){ total_male_of_alldays += obj2.value }

sql server - SQL filtered index when the column in the filtered expression is possible not present? -

i want create sql command create index condition. both columns on index based column used in filter expression possible not present. added condition both columns present still invalid column name error column in filter expression. there way around this? if exists (select 1 sys.all_columns name='field1' , object_id=object_id('[dbo].[table1]') ) , exists (select 1 sys.all_columns name='field2' , object_id=object_id('[dbo].[table1]') ) begin create nonclustered index [ix_table1_field1] on [dbo].[table1] ( [field1] ) ([field2]=(1)) end table problem occurs create table [dbo].[table1] ( [field1] [int] ) if understand want, think need use dynamic sql this: declare @tablename nvarchar(max) = n'table2', @field1 nvarchar(max) = n'field1', @field2 nvarchar(max) = n'field2'; declare @sql nvarchar(max) = ''; if exists (select 1 sys.all_column

c++ - Building audio analysis library Essentia failed with Gaia support -

i trying build essentia ( https://github.com/mtg/essentia ), audio analysis library, gaia ( https://github.com/mtg/gaia ) support in debian 9.0 source. before that, 1 of dependencies, namely gaia , built, also, source. installed in /usr/local/ . when comes essentia , compilation of sources fails following errors: [...] in file included ../src/algorithms/essentia_algorithms_reg.cpp:21:0: ../src/algorithms/highlevel/gaiatransform.h: @ global scope: ../src/algorithms/highlevel/gaiatransform.h:37:10: error: ‘transfochain’ in namespace ‘gaia2’ not name type gaia2::transfochain _history; ^~~~~~~~~~~~ ../src/algorithms/highlevel/gaiatransform.h: in constructor ‘essentia::standard::gaiatransform::gaiatransform()’: ../src/algorithms/highlevel/gaiatransform.h:47:5: error: ‘init’ not member of ‘gaia2’ gaia2::init(); ^~~~~ ../src/algorithms/highlevel/gaiatransform.h:47:5: note: suggested alternative: in file include

reactjs - Redirecting to a Users Home Page with React upon Login -

i building first react app, currently trying redirect user home page after putting in login credentials. my click handler redirecting them root page, doesn't set user experience. want them render show page. handlesubmit(e) { e.preventdefault(); const user = object.assign({}, this.state); this.props.form(user) .then( () => { this.props.history.push('/'); } ); } i changed .push to, this.props.history.push(`/api/users/${user.id}`) user in case routing /api/users/undefined.. the login works, because log user in , renders root afterward. i have working user show page shows users profile. any direction appreciated. wiki

Python 2.7: error in Canny Edge detection TypeError("Image data can not convert to float") -

Image
i using canny edge detection algorithm in python 2.7.12 image (.jpg) i used following code: import cv2 import numpy np matplotlib import pyplot plt img = cv2.imread('35.jpg') edges = cv2.canny(img,150,200) plt.subplot(121),plt.imshow(img,cmap = 'gray') plt.title('original image'), plt.xticks([]), plt.yticks([]) plt.subplot(122),plt.imshow(edges,cmap = 'gray') plt.title('edge image'), plt.xticks([]), plt.yticks([]) plt.show() but shows me error like traceback (most recent call last): file "d:/python/test4.py", line 11, in <module> plt.subplot(121),plt.imshow(img,cmap = 'gray') file "c:\python27\lib\site-packages\matplotlib\pyplot.py", line 3157, in imshow **kwargs) file "c:\python27\lib\site-packages\matplotlib\__init__.py", line 1898, in inner return func(ax, *args, **kwargs) file "c:\python27\lib\site-packages\matplotlib\axes\_axes.py", line 5124, in imshow

swift3 - Swift 3: how to get the width&height of imageview after loading view? -

i want width , height of image view after set image of imageview after view loading. used below source, failed them. got original width & height (50, 50). destination image loaded on imageview successfully.(size: 1050x890) var photoname: string? override func viewdidload() { if let photoname = photoname { imageview.image = uiimage(named: photoname) } } fileprivate func updateminzoomscaleforsize(_ size: cgsize) { let width = imageview.frame.size.width let height = imageview.frame.size.height let widthscale = size.width / width let heightscale = size.height / height let minscale = min(widthscale, heightscale) scrollview.minimumzoomscale = minscale scrollview.zoomscale = minscale } override func viewdidlayoutsubviews() { super.viewdidlayoutsubviews() updateminzoomscaleforsize(view.bounds.size) } where fault? please me! thank reading question. wiki

c# - How to group by and split columns dynamically with sql query? -

i have table contains rows below; id date city income 1 2013 kansas 10$ 1 2013 kansas 15$ 1 2014 kansas 30$ 2 2013 chicago 50$ ... i need such query transform this; id date city income1 income2 1 2013 kansas 10$ 15$ 1 2014 kansas 30$ 2 2013 chicago 50$ ... so should group id, date split income values different columns.. how try achieve thing not right; select id, date, min(city), concat(income,',') [sheet 1$] group id, date create table table1(id int, year int, city varchar(10), income int) insert table1 values(1, 2013, 'kansas', 10) insert table1 values(1, 2013, 'kansas', 10) insert table1 values(1, 2013, 'kansas', 15) insert table1 values(1, 2014, 'kansas', 30) insert table1 values(2, 2013, 'chicago', 50) select max(rn) maxcol from( select *, row_number() over(partition id,year order id) rn table1 )as tbl1 select * ( select *, row_number() ove

c# - How can I pass list of strongly type objects from controller to a dropdown on a view? -

i pass list of typed object dropdown located on view. usually achieve used viewbags in following example: public actionresult chooselevel() { list<levels> levellist = getalllevels(); viewbag.levellist = levellist var model = new levels(); return view(model); } and write on view, , levels listed there: <div class="form-group"> @html.labelfor(model => model.levelid, new { @class = "control-label col-md-3 col-sm-3" }) <div class="col-md-9 col-sm-9"> @html.dropdownlistfor(model => model.levelid, new selectlist(viewbag.levellist, "levelid", "levelname"), "", new { @class = "form-control" }) </div> </div> but i'm wondering can pass list of levels there, , choose them dropdown list, without storing them viewbag first? example : public actionresult chooselevel() { list<levels> levellist = getalllevels(); return

ruby - Excel Table manipulation using Microsoft Graph API -

i'm trying use rest via ruby manipulate tables general purpose excel automation using microsoft graph api , ruby httparty. i'm using commands microsoft graph docs . append row table @ specific location, use post https://graph.microsoft.com/v1.0/me/drive/root/children/test.xlsx/ workbook/tables/table1/rows {"index":0,"values":[["a","b","c"]]} but how update row? patch https://graph.microsoft.com/v1.0/me/drive/root/children/test.xlsx/ workbook/tables/table1/rows {"index":0,"values":[["a","b","c"]]} returns success, no change reflected! and delete row, there no direct option - solution using range delete method post https://graph.microsoft.com/v1.0/me/drive/root/children/test.xlsx/ workbook/worksheets/sheet1/range(address='a8:e8')/delete { "shift" : "up" } but using same syntax above, try adding range full of values s

android - Add background across day in CombinedChart MpAndroidChart library -

Image
i need current task. didn't find solutions that. need show info current , previous week in combinedchart. group data in grouped bardata , add 2 linedataset chart. chart below. but don`t know how can select(highlight) interval of day across 1 day (example mon, wed, fri). i need achive this. i don't know how add background or shadow behind specific grouped barentries? any ideas? thank time! wiki

Ruby -- convert a nested hash to a multidimensional array -

i have hash named h . want store contents in multidimensional array named ar . getting error no implicit conversion nil integer . here code: h = {"bob" => {email: "abc" , tel: "123"} , "daisy" => {email: "cab" , tel: "123456"}} keys = h.keys l = h.length ar = array.new(l) { array.new(3) } in 0..l-1 ar[[2][i]] = keys[i] ar[[1][i]] = h[keys[i]][:email] ar[[0][i]] = h[keys[i]][:tel] end puts ar.to_s the desired output is: [[email_1, email_2, ..][tel_1, tel_2, ..][name_1, name_2, ..]] for example: [["abc", "cab"] , ["123", "123456"] , ["bob", "daisy"]] this way handle this: h.values.each_with_object({}) |h,obj| obj.merge!(h) { |_k,v1,v2| ([v1] << v2).flatten } end.values << h.keys #=> [["abc", "cab"], ["123", "123456"], ["bob", "daisy"]] first grab

symfony application wont load after composer update -

ever since have ran composer update none of pages on application able accessed, keep getting spinning loading wheel. i have checked apache access , error logs can't see anything. has experienced before? any appreciated , if i'm missing key bit of information me please let me know. make sure php version suitable. use 7 if possible. optimize again , clear cache composer install --optimize-autoloader bin/console cache:clear wiki

Git diff to show changes in CSS block across commits -

i have block of css here, part of larger file: .card-container { font-family: "open sans", sans-serif; display: flex; justify-content: flex-start; flex-wrap: wrap; display: inline-block; width: 12.92em; height: auto; margin-right: 2em; margin-bottom: 4em; border-radius: 0.5em; background-color: #fff; box-shadow: 6px 6px 6px rgba(0,0,0,0.3); position: relative; padding-bottom: 5vh; } i want display changes on last 2-4 commits in particular code block only. git diff head head^ ./assets/css/app.css will let me check whole file i want show each revision of css, not two. head, head^, head^^ , on. the output should show 4 different code blocks, ideally date , message of each commit. i need able focus on code block ".card-container".."padding-bottom: 5vh"; .. wildcard, , 2 strings define start , end of code block. you can try following one-liner: git show head~2:path/to/your/file.css | sed -n '/^.card-

How do I extract data from JSON with PHP? -

this intended general reference question , answer covering many of never-ending "how access data in json?" questions. here handle broad basics of decoding json in php , accessing results. i have json: { "type": "donut", "name": "cake", "toppings": [ { "id": "5002", "type": "glazed" }, { "id": "5006", "type": "chocolate sprinkles" }, { "id": "5004", "type": "maple" } ] } how decode in php , access resulting data? intro first off have string. json not array, object, or data structure. json text-based serialization format - fancy string, still string. decode in php using json_decode() . $data = json_decode($json); therein might find: scalars: strings , ints , floats , , bools nulls (a special type of own) compound types: objects , arr

javascript - Maximum call stack size exceeded in plotly 3d scatter plot -

i implementing 3d scatterplot using plotly.js , task working on - change color of dot when hover (or click - not matter) on it. have found example works 2d scatter plot. however, not work 3d scatter plot. after "onhover" event, script starts executing " plotly_onhover " function infinitely many times, till throws error. here code working 2d scatter: https://codepen.io/plotly/pen/xgxbrj and code not working 3d scatter: https://codepen.io/anon/pen/pkewob the problem in plotly.restyle('mydiv', update, [tn]); line. suppose calling "plotly_onhover" function again , again. why not happen in 2d scatter plot then? please, me, @ sea. wiki

Text file data to an associative array in PHP and search data -

i'm beginner in php. have text file this: name-id-number abid-01-80 sakib-02-76 i can take data array unable take associative array. want following things: take data associative array in php. search number using id. find out total of numbers i believe understand want, , it's simple. first need read file php array. can done this: $filedata = file($filename, file_ignore_new_lines); now build desired array using foreach() loop, explode , standard array assignment. search requirement unclear, in example, make associated array element array associative array keys 'id' , 'num'. as create new array, can compute sum, demonstrated. <?php $filedata = array('abid-01-80', 'sakib-02-76'); $linearray = array(); $numtotal = 0; foreach ($filedata $line) { $values = explode('-', $line); $numtotal += $values[2]; $linearray[$values[0]] = array('id' => $values[1], 'num' => $values[2]);

php - unable to save single image along with multiple images in codeigniter -

i have created tab add products while adding products can add single product image shown on main along can can able upload multiple images along images single image featured problem single image uploading correctly saving first image , skipping rest can me out concern controller: public function addproduct() { $config['upload_path'] = getcwd().'/assets/uploads/products/'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = '10000'; $this->load->library('upload', $config); if (!$this->upload->do_upload('profile_picture') && $this->form_validation->run() == false) { $error = $this->upload->display_errors(); $this->session->set_flashdata('success_msg', validation_errors() . $error); redirect('admin/products?add=1', $session_data); } else { $data = $this->upload->data(); $data = array( 'name' => $this->input->post('

php - laravel 5.4 file upload error -

i trying upload excel document in laravel 5.4 using 'maatwebsite/excel'. have 2 systems run web app. first local windows using vagrant homestead. second aws instance running close homestead can get. both have same code base git repository. have updated composer sudo composer dump-autoload -o sudo composer update after composer did it's thing in both machines, aws instance not upload files greater 2 mb. in /etc/php/7.0/fpm/php.ini have changed: upload_max_filesize = 100m post_max_size = 100m here dd($request->all()) both machines: vagrant homestead: array:4 [▼ "_token" => "n6cm28un74nywko8khzrltmy2xplfslwtrvvgypl" "project_id" => "1" "modtype" => "replace" "import" => uploadedfile {#309 ▼ -test: false -originalname: "test.xlsx" -mimetype: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" -size: 2252013 -erro

reactjs - react-datetime onClick event stop propagation -

i working https://github.com/youcanbookme/react-datetime standard out of box. task @ hand stop click event propagating further parents because toggles parents box. anyone knows how add click handler? for example works: (<input type="text" value={item.service_close_date} onclick={(e) => { e.stoppropagation(); } } />); but not: (<datetime value={item.service_close_date} onclick={(e) => { e.stoppropagation(); } } />); there no click handler in datetime see. wiki

Swagger impl on Spring 2.5 -

i have spring project built on 2.5.6 , in using jersy 1.2 well. want integrate swagger project. so question version of swagger supports spring 2.5.6 +jersey 1.2. i not able find documentation on compatablility version. any appreciated wiki

c# - Path as a variable in attribute routing WebApi2 -

i trying use directory path variable (in urn) in attribute routing webapi2. attribute route looks following [httpdelete] [route("api/directory/{dirpath}/content")] public ihttpactionresult cleandirectory(string dirpath) { //required functionality } so when want delete content in d:\somedir , use following url delete api/directory/d:\somedir/content but returns 404 not found. allowed use '\' or '/' in attribute routes ? wiki

scala - What happens in Future.pipeTo within actor -

i have call 3rd party library(which returs future) within actor receive. piping future self, can process reply messsage in mailbox. class myactor{ def receive:receive = { case x:message => { val future = calltothridpartylib(x) future pipeto self } case x:reply => { //process reply received on future completion } } } my questions what overhead of approach? will there separate thread allocated each such pipeto statement? if so, should there thread pool manage pipeto avoid threads getting used up? thank you what victor says, essentially: overhead of pipeto low: creates 1 closure, sends 1 message. that's it, no additional threading involved. message being sent thread on future has been completed, , received, actor messages, on dispatcher has been configured given actor. you should take care of executioncontext calltothirdpartylib though. if uses blocking calls inside, , use default akka dispatcher run (what code

javascript - How to pin and overlap multiple elements with ScrollMagic? -

i have 9 slides 3 elements inside, animated greensock , scrollmagic. currently, page long , if use setpin() elements going crazy. here example: https://codepen.io/htmltuts/pen/prvvwk what want whenever scroll page, want page position same, animations should continue working. after 3 elements animated, should disappear , other 3 comes in same position , starting same animation. is possible pin every container , leaving scroll behavior in page? if understand right mean make pen items fixed. you break aport animated elements & scroll triggering elements so create scroll / trigger elements triggering animation.(called block# in example, make invisible css) then create fixed element animate on my simplefied example below https://codepen.io/ray1618/pen/xaqpqv // init controller var controller = new scrollmagic.controller(); var tween1 = new timelinemax(); tween1.to('.fixedblock1', 1, {rotation: 180, ease:power0.easenone}); var tween2 = new timeli

java - How to set tomcat session timeout per path? -

i know how change global session-timeout in tomcat8 : <session-config> <session-timeout>30</session-timeout> </session-config> question: how can change timeout per application path ? like want deploy multiple applications to: /myapp/v1 /myapp/v2 /myapp/v3 /someapp now want /myapp/* path have different timeout. on testserver. on production server timeout should kept default tomcat 30mins. that's why don't want add web.xml app itself, affect production deployment when new war deployed. is possible @ all? if matters: i'm using spring-boot . your best bet handle within sessionhandler class, along lines of this: public class apphttpsessionlistener implements httpsessionlistener { @override public void sessioncreated(httpsessionevent event) { event.getsession().setmaxinactiveinterval(15 * 60); } @override public void sessiondestroyed(httpsessionevent event) { // session destroyed

Deprecated updateConfiguration() - Android -

Image
i defined layouts multiple languages , multiple devices below: i set proper layout custom language bellow : string languagetoload = "ar"; locale locale = new locale(languagetoload); locale.setdefault(locale); configuration config = new configuration(); config.setlocale(locale); getbasecontext().getresources().updateconfiguration(config, null); this.setcontentview(r.layout.activity_main); for language (ar - arabic) fetch layout-ldrtl or layout-ldrtl-sw600dp , other language (en - english) fetch layout-ldltr or layout-ldltr-sw600dp , above code work. problem : in line getbasecontext().getresources().updateconfiguration(config, null); me updateconfiguration deprecated , use createconfigurationcontext when use method source don't work true , don't me proper layout . resolved problem. use link in activity use bellow code : context context = mycontextwrapper.wrap(this, "en"); layoutinflater inflater = (layoutinflater) getsyste

Execute functions apart from argparse which are defined in main in Python -

i'm using argparse use user arguments run functions in program running fine. i'm unable run other generic functions i'm calling in main(). skips functions without running , showing output. how do or doing wrong ? let's in below program want functions mytop20 , listapps run using user arguments runs fine if remove boilerplate main() function objective run_in_main() function should run in main() import argparse def my_top20_func(): print "called my_top20_func" def my_listapps_func(): print "called my_listapps_func" def run_in_main(): print "called main" parser = argparse.argumentparser() function_map = {'top20' : my_top20_func, 'listapps' : my_listapps_func } parser.add_argument('command', choices=function_map.keys()) args = parser.parse_args() func = function_map[args.command] func() if __name__ == "__main__": run_in_main() as use case quite similar have take

javascript - One view for 2 or more pages (backbone.js) -

i have 2 pages. 1 of them dashboard lot of functionality. second page shared dashboard - simple version of first page. dashboard contains view of database (it can contain other info, problem one). can click on filter button , modal window opened. so, simple version of dashboard doesn't have possibility. i'd add it, don't want copy+past code full version of dashboard because code of part 2 thousand lines. i'll add primitive code example: dashboardview = someanotherview.extend({ initialize: function() {...}, events: {...} // huge objects of jquery events, render: function () {...}, ... // 2k lines of functions events }); how can use view on page? tried call function view: dashboardview.prototype.filterclicked(event); but in case event.curenttarget null (it necessary function), tried send "this" context, failed. is there possibility in backbone.js use 1 view 2+ pages without huge copy/past code? ideally if have simple version , full version

javascript - Will react-router affect page load time? -

for example, if have 3 routes in routes.js file compared of 10 routes in same file. file containing 10 routes take longer time load? supposing every route import same size of component. or component imported after we've enter route? the first page load might longer usual (still not noticeable in cases), after that, page entirely cached, resulting in super fast load times, since browser remember everything. wiki

python - Odd anchoring behavior when zooming in PyQt/Pyside -

consider following code: # pyside import qtcore, qtgui, qtnetwork, qtwebkit pyqt4 import qtcore, qtgui, qtnetwork, qtwebkit import os import sys class imageview(qtgui.qgraphicsview): def __init__(self, file): super().__init__() self.setscene(qtgui.qgraphicsscene()) self.settransformationanchor(self.anchorundermouse) self.sethorizontalscrollbarpolicy(qtcore.qt.scrollbaralwaysoff) self.setverticalscrollbarpolicy(qtcore.qt.scrollbaralwaysoff) item = qtgui.qgraphicspixmapitem(qtgui.qpixmap(file)) self.scene().additem(item) self.scene().setscenerect(self.scene().itemsboundingrect()) self.fitinview(self.scene().scenerect(), qtcore.qt.keepaspectratio) def wheelevent(self, event): print(self.transformationanchor()) self.scale(1.1, 1.1) class host(qtgui.qtabwidget): def removetab(self, args): self.widget(args).deletelater() super().removetab(args) def new_image(s

ios - Compiler Flag -fno-objc-arc not working in Swift -

Image
my program being written in swift, class dependency on "no leak skshapenode." class written in obj-c , therefore needs compiler flags used. implemented -fno-objc-arc on skshapenodeleakfree.m file yet compiler still doesn't detect arc disabled. the -fno-objc-arc setting in "compile sources" of target's "build phases" looks fine. it looks must have incorrectly imported .m file in bridging header. should #import .h file in bridging header. explain why you're seeing objective-c arc messages under "swift compiler error" section. wiki

java - Gitlab-CI not recognize the yml on the folders -

so have multiple folders inside empty idea project , each folder has pom.xml. i need deploy each folder separately gitlab ci recognize main folder empty project. if understand achitecture well, should have separate git repository each of folders in parent idea project. it : /rootproject |- gitrepo1 |- .gitlab-ci.yml |- gitrepo2 |- .gitlab-ci.yml |- gitrepo3 |- .gitlab-ci.yml this way can have separate ci pipelines , deployments each subfolder. there open issue considering possibility change default location of .gitlab-ci.yml file, not yet available : https://gitlab.com/gitlab-org/gitlab-ce/issues/15041 wiki

java - Issue rounding a double with math.round() -

this question has answer here: round double 2 decimal places [duplicate] 13 answers i have java exercise need write method takes 3 parameters; 2 doubles, , 1 char in specific order. once have them need return double value rounded 2 decimal places using math.round(). depending on rules shown. im not sure how can go getting double value down 2 decimal places, appreciated. thankyou! import java.util.scanner; public class questionfour { public static void main(string[] args){ scanner scan = new scanner(system.in); system.out.println("enter double number"); double num1 = scan.nextdouble(); system.out.println("enter double number"); double num2 = scan.nextdouble(); system.out.println("enter 1 of +, -, *, /, %"); char c = scan.next().charat(0); system.out.println("the value of calculation is: " + docalculation(nu

python - How to recover an ipython session with errors? -

i'm working ipython , manage crash (accidental ctrl-c, running out of battery…). how can pick left when restarting it? it logging already, , %rerun seems should want do, error made brings halt. i use ipython (and sloppily…) "play" data , test ideas, things like pla_df = orignal_very_long_and_complicated_name_df.copy() some_stuff = play_df.xs('foo', level = 'bar', axis = 1) nameerror: name 'play_df' not defined whoops, missed "y", i'll up-arrow twice , redo it: play_df = orignal_very_long_and_complicated_name_df.copy() some_stuff = play_df.xs('foo', level = 'bar', axis = 1) happen quite , 1 of reasons why use ipython. if make small error, it's small key press or two, , can fix it, without causing trouble. but %rerun stops @ error, instead of going through whole history, include fix it, 2 lines below. how can %rerun run everything, line after line, no matter if 1 of lines throws error? cut ou

java - 400 Bad Request HTTP Response using a WCF POST via Android -

Image
facing issues calling wcf service android. web.config: <?xml version="1.0"?> <configuration> <system.web> <compilation debug="true" targetframework="4.0" /> <httpruntime targetframework="4.0"/> </system.web> <system.servicemodel> <behaviors> <endpointbehaviors> <behavior name="httpbehavior"> <webhttp helpenabled="true" automaticformatselectionenabled="false" /> </behavior> </endpointbehaviors> <servicebehaviors> <behavior> <servicemetadata httpgetenabled="true" httpsgetenabled="true"/> <servicedebug includeexceptiondetailinfaults="true"/> </behavior> <behavior name="webbehavior"> </behavior> </servicebehaviors> </behaviors&

logic - About the Bicondition in java -

Image
i'm trying write program truth table logic. truth table biconditional: need help. how can when write true <=> false return right result "true" or "false". sorry bad english. you can make logic using equals operator. import java.util.*; class biconditional { public static void main(string[] args) { scanner s=new scanner(system.in); string p=s.next(); string q=s.next(); if(p.equals(q)) system.out.println("true"); else system.out.println("false"); } } you can change user input , equality operator when inputting in 0 or 1 . wiki

javascript - Reset the src of <audio> on Edge -

i'm having issues audio tag on edge browser. i'm trying clear source of audio tag use play recorded sound input device. can choose if want send or not audio, optional, i'm trying give option of deleting source of audio when user click trash button, want clear input , preview audio tag. works fine in other browsers on edge when clean audio source of preview audio tag shows message of "this type of audio file not supported" instead of restarting time 0 or disable when starts. anyone have idea of how can achieve that? var source = "http://d.mimp3.eu/i/ms6mfogoji8nmnkoba6zg653/system-of-a-down-lonely-day.mp3"; audio = document.getelementbyid('audiotochange'); function addsource(){ audio.setattribute("src", source ); } function removesource(){ audio.removeattribute("src"); } function clearsource () { audio.setattribute("src", "" ); } function clearandremove () {