save

in NetworkX cannot save a graph as jpg or png file

匆匆过客 提交于 2019-12-03 17:49:58
问题 I have a graph in NetworkX containing some info. After the graph is shown, I want to save it as jpg or png file. I used the matplotlib function savefig but when the image is saved, it does not contain anything. It is just a white image. Here is a sample code I wrote: import networkx as nx import matplotlib.pyplot as plt fig = plt.figure(figsize=(12,12)) ax = plt.subplot(111) ax.set_title('Graph - Shapes', fontsize=10) G = nx.DiGraph() G.add_node('shape1', level=1) G.add_node('shape2', level=2

Jenkins: how to save changelog for build

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 17:19:23
I have Jenkins-CI and C++ project under SVN. How to save changelog between successfull builds into text (or html) file ? Does Jenkins have any variable/temp file with content of .../changes page? Here is XPath code that can get you the changeset for a given build id via Jenkins API: http://[jenkins_host]/api/xml?depth=2&xpath=//build/id[text()='${BUILD_ID}']/../changeSet (Put actual build id instead of ${BUILD_ID}). This can be used by a script (say, a Pyhon script utilizing Python Jenkins ) that collects changeset results in the end of every build and stores them in a temp locations. After a

How to save files in External Storage Public Directory DOCUMENTS on Android 4.1.2

只愿长相守 提交于 2019-12-03 16:55:54
问题 i want to save a file on my Android 4.1.2 smartphone in the documents directory. This code snippet: File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS),"test.txt"); throws this exception: E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.NoSuchFieldError: android.os.Environment.DIRECTORY_DOCUMENTS While this one is working: File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS),"test.txt"); But i want

Avoid recursive save() when using celery to update Django model fields

倖福魔咒の 提交于 2019-12-03 16:38:47
问题 I'm overriding a model's save() method to call an asynchronous task with Celery. That task also saves the model, and so I end up with a recursive situation where the Celery task gets called repeatedly. Here's the code: Model's save method: def save(self, *args, **kwargs): super(Route, self).save(*args, **kwargs) from .tasks import get_elevation_data get_elevation_data.delay(self) get_elevation_data task: from celery.decorators import task @task() def get_elevation_data(route): ... route

How to bookmark a webpage in an Android application?

二次信任 提交于 2019-12-03 16:35:53
I am developing a Newspaper like application. I'm wondering how to save webpages with the click of a button and display it at a later point in time. I googled for this in vain. If anyone knows how to do this and can provide some useful links, it would be greatly appreciated. Perhaps you can just save the url in a database together with the favicon or try to get a screenshot from the site to use as icon? You could probably convert the Webview to a Drawable/Bitmap without too much problems. Here's two database/sql tutorials for Android: http://www.screaming-penguin.com/node/7742 http://developer

Saving Many to Many relationship to database in Symfony2

做~自己de王妃 提交于 2019-12-03 15:16:38
问题 In my Symfony2 project I have two related entities: Users and Favorites. They have a many-to-many relationship. My application works as follows: In my Twig-page I have an few items with a button 'Add to Favorites'. When you click the button my controller saves the item_id in the Favorites column. But then I want to save the user who added the item to his favorites and here my application fails. The User and the favorite exist but the joincolumn between Users and Favorites remains empty. I

Overriding dateCreated for testing in Grails

我是研究僧i 提交于 2019-12-03 15:14:02
问题 Is there any way I can override the value of dateCreated field in my domain class without turning off auto timestamping? I need to test controller and I have to provide specific domain objects with specific creation date but GORM seems to override values I provide. Edit My classes look like this: class Message { String content String title User author Date dateCreated Date lastUpdated static hasMany = [comments : Comment] static constraints = { content blank: false author nullable: false

Python - How can I make this un-pickleable object pickleable?

本小妞迷上赌 提交于 2019-12-03 14:29:24
So, I have an object that has quite a bit of non-pickleable things in it (pygame events, orderedDicts, clock, etc.) and I need to save it to disk. Thing is, if I can just get this thing to store a string that has the progress (a single integer is all I need), then I can pass it to the object's init and it will rebuild all of those things. Unfortunately, a framework I am using (Renpy) will pickle the object and attempt to load it, despite the fact that I could save it as a single integer, and I can't change that. So, what I'm asking is, how can I override methods so that whenever pickle tries

PHP + PDF, how to save a downloaded PDF using curl?

ε祈祈猫儿з 提交于 2019-12-03 14:17:27
Welcome I have a little problem with saving the downloaded pdf on the page. To download pdf I use Curl: $CurlConnect = curl_init(); curl_setopt($CurlConnect, CURLOPT_URL, 'http://website.com/invoices/download/1'); curl_setopt($CurlConnect, CURLOPT_POST, 1); curl_setopt($CurlConnect, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt($CurlConnect, CURLOPT_POSTFIELDS, $request); curl_setopt($CurlConnect, CURLOPT_USERPWD, $login.':'.$password); $Result = curl_exec($CurlConnect); Now in $Result (string) i have all PDF file content. And now begins my problem. I would like to save the downloaded pdf: header(

Best Way to keep Settings for a WinRT App?

南笙酒味 提交于 2019-12-03 13:21:25
问题 I'm working on a WinRT app that's actually also a game. I need to keep different information such as audio settings or player statistics somewhere in sort of a file or somehow. If it's a file, just write settings in or... ? I have an idea but I think is way too rudimentary... What is the best approach to obtain this? Any help or suggestions are greatly appreciated! 回答1: Here are some ways to save Data in a WinRT app, the method with Settings in the name is probably what you are looking for!-