Posts

python - Can't add legend in figure -

Image
i want add legend figure, doesn't show. in code below "forecast_canvas" instance of class canvas created in qt designer. ax = self.forecast_canvas.figure.add_subplot(111) ax.plot(self.new,'--',label='observed') ax.plot(data,color='green',label='forecast') self.forecast_canvas.draw() here's code of canvas : from matplotlib.backends.backend_qt4agg import figurecanvasqtagg figurecanvas import matplotlib.pyplot plt pyqt4 import qtgui class canvas(figurecanvas): def __init__(self, parent=none): self.figure = plt.figure() #plt.tight_layout(pad=4) figurecanvas.__init__(self, self.figure) self.setparent(parent) figurecanvas.setsizepolicy(self, qtgui.qsizepolicy.expanding, qtgui.qsizepolicy.expanding) figurecanvas.updategeometry(self) #plt.legend() i tried adding plt.legend() ...

ios - How to zoom out UIImageView content(image) on scroll of UITableView? -

Image
i trying achieve effect: https://cdn.dribbble.com/users/124059/screenshots/3727352/400.gif for i'm doing: override func tableview(_ tableview: uitableview, willdisplay cell: uitableviewcell, forrowat indexpath: indexpath) { let cell = tableview.dequeuereusablecell(withidentifier: "cardcell", for: indexpath) as! cardtableviewcell uiview.animate(withduration: 0.5, delay: 0.3, usingspringwithdamping: 0.1, initialspringvelocity: 0.5, options: .curveeaseinout, animations: { cell.coverimageview.transform = cgaffinetransform(scalex: 0.7, y: 0.7) }, completion: nil) } but code resizes uiimageview frame, not image inside of uiimageview. how can improve code? the trick mess frame of imageview make redraw , content mode changing. can manipulating frame or constraints , have masked inside view. run example , let me know. import uikit class viewcontroller: uiviewcontroller { var imageview = uiimageview() var maskview = uiview()...

python - batch data prefetching uisng queue on sharded data files -

i generated 500 sharded numpy data files, each of them contains 10000 data samples (e.g., image , label), example: file-000001.npy file-000002.npy file-000003.npy ... file-000500.npy each of .npy contains numpy dictionary keys , size {'image':10000x3x512x64 (dtype=np.float32),'label':10000x100 (dtype=np.float32)} . please note of these numpy files contain less 10000 samples, 8111 etc. during training, each epoch, need iterate 500x10000 samples. these data cannot loaded memory due capacity limits. common solution data prefetching queue. my thought follows: (1) first record filenames , count of data samples in each file, (2) each batch, compute batch indices, corresponding data files needed loaded memory read data samples compose batch data. during step (2), if set batch size 256 , possible need read 256 files , read 1 sample in each of them compose batch data. might slow , unpractical. based on queue, data loading might running ...

php - QTranslate Wordpress Pages Error 500 -

i have installed qtranslate on testing server on wordpress install. have transferred install live server (different web host) , when try , edit page, it's white (error 500 think). it's fine when trying edit posts, it's on pages editor goes white. i've tried reinstalling plugin, flushing database, changing .htaccess, increasing memory limit.... any ideas? help appreciated. thanks!

mongoose - Posting to a MongooseDB with .create -

so trying simple list work , update mongoosedb. using own variables determined. here code: app.post("/forumdetailsheader", function (req, res){ forumdetail.create({ text: req.body.text, done: false }, function(err, detail){ if (err) res.send(err); }); }); everything working , getting called correctly, except never show in mongoosedb has posted there correctly.

sdn - RYU: Simple switch test is giving OFPBAC_BAD_OUT_PORT error -

i running simple switch test simple switch test i running on real sdn switch , openvswitch installed on server. port numbers correct. mapping of port numbers correct. port number 30 on real sdn switch , connected port 1 on openvswitch conncected together. 3 links connected between server(openvswitch) , switch(real) my json file [ "action: 00_output", { "description": "ethernet/ipv4/tcp-->'actions=output:30'", "prerequisite":[ { "ofpflowmod":{ "table_id":0, "instructions":[ { "ofpinstructionactions":{ "actions":[ { "ofpactionoutput":{ "port":30 } } ...

c - What are the differences between constant expressions and nonmodifiable lvalues? -

from c in nutshell: constant expressions the compiler recognizes constant expressions in source code , replaces them values. resulting constant value must representable in expression’s type. may use constant expression wherever simple constant permitted. operators in constant expressions subject same rules in other expressions. because constant expressions evaluated @ translation time, though, cannot contain function calls or operations modify variables, such assignments. what constant expressions? doesn't define constant expressions what differences between constant expressions , non-modifiable lvalues (e.g. array names, lvalues have been declared const ) are constant expressions non-lvalues? are non-modifiable lvalues constant expressions? what constant expressions? §6.6- constant expression: a constant expression can evaluated during translation rather runtime, , accordingly may used in place constant may ...