Posts

How to import a module in Python 3 from a string? -

a solution problem available python 2, uses imp module deprecated in python 3. imp has been replaced importlib works file based imports. specifically, importlib.import_module requires file name - not string or file handler. i made workaround dumping contents of url file , importing it def initlog(): modulename = '_mylogging' try: import _mylogging except importerror: r = requests.get('http://(...)/mylogging.py') open(modulename+'.py', "w") f: f.write(r.text) finally: import _mylogging return _mylogging.mylogging().getlogger() but avoid intermediate file. putting security, network performance , availability issues aside - is there way feed string importlib ? (or file handler, in case use io.stringio ) you can adapt exactly same answer 3.x, using the replacement imp.new_module : from types import moduletype foo = moduletype('foo') and the replaceme...

r - VennDiagram without group names and with Arial font -

Image
i have been requested redo following venn diagram in r arial font , without group names... looking @ venndiagram manual not see how can it... this mwe: #install.packages("venndiagram") library(venndiagram) <- c(1,2,3,4,5,6) b <- c(4,5,6,7,8,9,10,11,12) c <- c(1,2,10,11,12,5,13,14,15,16) venn.diagram(list("a" = a, "b" = b, "c" = c), fill = c("red", "blue", "green"), alpha = c(0.5, 0.5, 0.5), cat.cex = .75, cex = .75, lty =2, lwd =0.5, fontfamily ="serif", filename = "test.tiff", imagetype = "tiff", height = 3000, width = 3000, resolution = 1500, units = "px", main="title", main.pos=c(0.1,1.05), main.fontfamily="serif", main.cex=.75) is possible remove group names a, b, , c, , change font family arial, or should think approach instead of r? besides, p...

java - libgdx: Why does my custom actor have a memory leak? -

i have created following custom actor draw lines on libgdx public class linewidget extends actor implements disposable { private position posa; private position posb; public final vector2 _a; public final vector2 _b; private textureregion linetexture; private final textureregion linetexturegreen = assets.instance.images.linegreen; private final textureregion linetextureorange = assets.instance.images.lineorange; private final textureregion linetexturered = assets.instance.images.linered; public linewidget(position a, position b) { this._a = a.getpositionvector(); this._b = b.getpositionvector(); this.posa = a; this.posb = b; } @override public void act(float delta) { super.act(delta); } @override public void draw(batch batch, float parentalpha) { super.draw(batch, parentalpha); setlinecolor(posa, posb); float xdif = _b.x-_a.x; float ydif = _b.y-_a.x; float l2 = xdif*xdif+ydif*ydif; float invl = (float)(1/math.sqrt(l2)); //di...

Django Class-based Views with Multiple Forms -

by default django’s class-based views support single form per view. i need more forms per view because want combine foreignkey relations various modelform instances , appear in formmodel. in django documentation , other tutorials found formsets, in default examples repeat same form multiple times, not need. inline formsets looks need , didn't found example gcbv createview. can give me examples, link tutorial ? for example: class product(models.model): name = models.charfield(max_length=200,db_index=true) class productimage(models.model): # foreign key product = models.foreignkey('products.product', on_delete=models.cascade) image = models.imagefield(upload_to=upload_to) class productcreateview(createview): model = product form_class = productmodelform success_url = '../' class productmodelform(forms.modelform): class meta: model = product in template want appear in same form product form fields, image field, can repeated multi...

html - File Attachment not going in mail in php -

i making form in html in there upload button , details of user.i want send details of form along file uploaded user.but not working.i posting both code of html code , php code also. tell me missing. <!doctype html> <html> <head> <link rel="stylesheet" type="text/css" href="style.css" /> <body> <div class="element"> <a href="index.php"><img src="logo.gif"></a> <br><br> <div class="new"></div> <center><h2>submit information below</h2></center> <form name="registration" method="post" action="fromaction.php" enctype="mutipart/form-data" autocomplete="off"> <!-- <span class="erorr"> ---> <div class="image"></div> <label>name:</label> ...

c# - Tracing variables passing on a multi class level -

i working on c# static source code analysis tool roslyn , need ideas on how implement/keep track of path of variables passing. given: a = request.query; b = a; c = a; somesink(b); i must able provide path a->b, b->somesink(b) . basic idea program should take account complex cases such variables passing through multi-class files, variables additional i.e a = b + c . scope of project c# project, library works c# do, using roslyn parse source codes , doing analysis it.

java - How to define gradle "runtime" -

i using spring boot gradle. gradle pack application jar these tasks: bootrepackage { mainclass = 'tv.mukamuka.api.application' } jar { destinationdir = file(destpath) basename = project.name } and dependencies below: compile('com.eclipsesource.j2v8:j2v8_macosx_x86_64:3.1.6') runtime('com.eclipsesource.j2v8:j2v8_linux_x86_64:3.0.0') however, bootrepackage task doesn't build jar runtime dependencies. how can define "runtime" in build?