Search Results

Search found 407 results on 17 pages for 'dumps'.

Page 10/17 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • load a pickle file from a zipfile

    - by eric.frederich
    For some reason I cannot get cPickle.load to work on the file-type object returned by ZipFile.open(). If I call read() on the file-type object returned by ZipFile.open() I can use cPickle.loads though. Example .... import zipfile import cPickle # the data we want to store some_data = {1: 'one', 2: 'two', 3: 'three'} # # create a zipped pickle file # zf = zipfile.ZipFile('zipped_pickle.zip', 'w', zipfile.ZIP_DEFLATED) zf.writestr('data.pkl', cPickle.dumps(some_data)) zf.close() # # cPickle.loads works # zf = zipfile.ZipFile('zipped_pickle.zip', 'r') sd1 = cPickle.loads(zf.open('data.pkl').read()) zf.close() # # cPickle.load doesn't work # zf = zipfile.ZipFile('zipped_pickle.zip', 'r') sd2 = cPickle.load(zf.open('data.pkl')) zf.close() Note: I don't want to zip just the pickle file but many files of other types. This is just an example.

    Read the article

  • Bing search API using Jsonp not working, invalid label

    - by Blankman
    Struggling with Bing's json request (bing search, not map), I am getting an error back that says 'Invalid Label' My query url is: var bingurl="http://api.search.live.net/json.aspx?Appid=##APIKEY##&query=Honda&sources=web"; $.ajax({ type: "GET", url: bingurl, data: "{}", contentType: "application/json; charset=utf-8", dataType: "jsonp", success: function(data) { $callBack(data); }, error: function(msg) { alert("error" + msg); } }); Firebug reports 'invalid label' and then dumps the json response. No idea what is wrong? help appreciated.

    Read the article

  • cannot output a json encoded dict containing accents (noob inside)

    - by user296546
    Hi all, here is a fairly simple example wich is driving me nuts since a couple of days. Considering the following script: # -*- coding: utf-8 -* from json import dumps as json_dumps machaine = u"une personne émérite" print(machaine) output = {} output[1] = machaine jsonoutput = json_dumps(output) print(jsonoutput) The result of this from cli: une personne émérite {"1": "une personne \u00e9m\u00e9rite"} I don't understand why their such a difference between the two strings. i have been trying all sorts of encode, decode etc but i can't seem to be able to find the right way to do it. Does anybody has an idea ? Thanks in advance. Matthieu

    Read the article

  • what's faster: merging lists or dicts in python?

    - by tipu
    I'm working with an app that is cpu-bound more than memory bound, and I'm trying to merge two things whether they be sets or dicts. Now the thing is i can choose either one, but I'm wondering if merging dicts would be faster since it's all in memory? Or is it always going to be O(n), n being the size of the smaller set. The reason I asked about dicts rather than sets is because I can't convert a set to json, because that results in {key1, key2, key3} and json needs a key/value pair, so I am using a dict so json dumps returns {key1:1, key2:1, key3:1}. Yes this is wasteful, but if it proves to be faster then I'm okay with it.

    Read the article

  • How to clear the memory allocated for Customized Exception

    - by ilan
    Hi All I have a customized exception class. say class CustomExcep{}; My Application is a middleware made of C++. It is a webservice which is used for the communication between Java based web Front-end and the DCE Backend. whenever the DCE Backend is not running or down due to some core dumps, the application throws the CustomExcep. It's like this. CustomExcep * exc = new CustomExcep(); throw exc; I am unable to use the stack memory for this as it leads to some run-time exceptions. I need a solution to clear the memory used by this CustomException. Can we use Templates for this purpose? Any help would be appreciated. Thanks in Advance.

    Read the article

  • Strange profiling results: definitely non-bottleneck method pops up

    - by jkff
    I'm profiling a program using sampling profiling in YourKit and JProfiler, and also "manually" (I launch it and press Ctrl-Break several times to get thread dumps). All three methods give me extremely strange results: some tens of percents of time spent in a 3-line method that does not even do any allocation or synchronization and doesn't have loops etc. Moreover, after I made this method into a NOP and even removed its invocation completely, the observable program performance didn't change at all (although it got a negligible memory leak, since it was a method for freeing a cheap resource). I'm thinking that this might be because of the constraints that JVM puts on the moments at which a thread's stacktrace may be taken, and it somehow turns out that in my program it is exactly the moments where this method is invoked, although there is absolutely nothing special about it or the context in which it is invoked. What can be the explanation for this phenomenon? What are the aforementioned constraints? What further measurements can I take to clarify the situation?

    Read the article

  • Rectangular BackColor of selection in RichTextBox

    - by AgentConundrum
    Background: I'm going to start studying/coding at the local university's library. Since I'm not a student, I won't be able to utilize their wireless internet access. Since StackOverflow is such a great resource, I want to be able to take it with me, so I'm building a small desktop application to load/search/display the most recent data dumps. Problem: I want to display code blocks in the same sort of rectangular block as this site does, so I played with the RichTextBox control to try to create this effect. Unfortunately, the RichTextBox.SelectedBackColor property only colors the actual text, when what I want is a rectangle reaching to the outer limits of the selection. Example: This is what I am able to produce with the RichTextBox: This is what I would like to create: Questions: Is there any way to produce this effect using the RichTextBox? If not, are there any other controls I could use to create this effect?

    Read the article

  • Dummy SMTP Server for testing apps that send email

    - by Patrick McElhaney
    I have a lot of apps that send email. Sometimes it's one or two messages at a time. Sometimes it's thousands of messages. In development, I usually test by substituting my own address for any recipient addresses. I'm sure that's what everybody else does, until they get fed up with it and find a better solution. I was thinking about creating a dummy SMTP server that just catches the messages and dumps them in a SQLLite database, or an mbox file, or whatever. But surely such a tool already exists? How do you test sending email?

    Read the article

  • Selecting keys based on metadata, possible with Amazon S3?

    - by nbv4
    I'm sending files to my S3 bucket that are basically gzipped database dumps. They keys are a human readable date ("2010-05-04.dump"), and along with that, I'm setting a metadata field to the UNIX time of the dump. I want to write a script that retrieve the latest dump from the bucket. That is to say I want the the key with the largest unix time metadata value. Is this possible with Amazon S3, or is this not how S3 is meant to work? I'm using both the command line tool aws, and the python library boto

    Read the article

  • Manual stack backtrace on Windows mobile (SEH)

    - by caahab
    Following situation: I'm developing an windows mobile application using the sdk 6. Target machine is a nautiz x7. To improve the error reporting I want to catch the structured exceptions (SEH) and do a stack backtrace to store some information for analysis. So far I have the information where the exception was thrown (windows core.dll) and I can backtrace the return adresses thru the stack. But what I want to know is, which instruction in my code caused the exception? Does anyone know how to use the available exception and context information to get the appropriate function/instruction address? Unfortunately windows mobile 6 sdk for pocketpc does not support all the helper functions to do stackwalks or mini dumps.

    Read the article

  • Can I make valgrind ignore glibc libraries?

    - by Jack
    Is it possible to tell valgrind to ignore some set of libraries? Specifically glibc libraries.. Actual Problem: I have some code that runs fine in normal execution. No leaks etc. When I try to run it through valgrind, I get core dumps and program restarts/stops. Core usually points to glibc functions (usually fseek, mutex etc). I understand that there might be some issue with incompatible glibc / valgrind version. I tried various valgrind releases and glibc versions but no luck. Any suggestions?

    Read the article

  • Python json memory bloat

    - by Anoop
    import json import time from itertools import count def keygen(size): for i in count(1): s = str(i) yield '0' * (size - len(s)) + str(s) def jsontest(num): keys = keygen(20) kvjson = json.dumps(dict((keys.next(), '0' * 200) for i in range(num))) kvpairs = json.loads(kvjson) del kvpairs # Not required. Just to check if it makes any difference print 'load completed' jsontest(500000) while 1: time.sleep(1) Linux top indicates that the python process holds ~450Mb of RAM after completion of 'jsontest' function. If the call to 'json.loads' is omitted then this issue is not observed. A gc.collect after this function execution does releases the memory. Looks like the memory is not held in any caches or python's internal memory allocator as explicit call to gc.collect is releasing memory. Is this happening because the threshold for garbage collection (700, 10, 10) was never reached ? I did put some code after jsontest to simulate threshold. But it didn't help.

    Read the article

  • Is it possible to pickle python "units" units?

    - by Ajaxamander
    I'm using the Python "units" package (http://pypi.python.org/pypi/units/) and I've run into some trouble when trying to pickle them. I've tried to boil it down to the simplest possible to case to try and figure out what's going on. Here's my simple test: from units import unit, named_unit from units.predefined import define_units from units.compatibility import compatible from units.registry import REGISTRY a = unit('m') a_p = pickle.dumps(a) a_up = pickle.loads(a_p) logging.info(repr(unit('m'))) logging.info(repr(a)) logging.info(repr(a_up)) logging.info(a.is_si()) logging.info(a_up.is_si()) logging.info( compatible(a,a_up) ) logging.info(a(10) + a_up(10)) The output I'm seeing when I run this is: LeafUnit('m', True) LeafUnit('m', True) LeafUnit('m', True) True True False IncompatibleUnitsError I'd understand if pickling units broke them, if it weren't for the fact that repr() is returning identical results for them. What am I missing? This is using v0.04 of the units package, and Google App Engine 1.4 SDK 1

    Read the article

  • Clean Method for a ModelForm in a ModelFormSet made by modelformset_factory

    - by Salyangoz
    I was wondering if my approach is right or not. Assuming the Restaurant model has only a name. forms.py class BaseRestaurantOpinionForm(forms.ModelForm): opinion = forms.ChoiceField(choices=(('yes', 'yes'), ('no', 'no'), ('meh', 'meh')), required=False, )) class Meta: model = Restaurant fields = ['opinion'] views.py class RestaurantVoteListView(ListView): queryset = Restaurant.objects.all() template_name = "restaurants/list.html" def dispatch(self, request, *args, **kwargs): if request.POST: queryset = self.request.POST.dict() #clean here return HttpResponse(json.dumps(queryset), content_type="application/json") def get_context_data(self, **kwargs): context = super(EligibleRestaurantsListView, self).get_context_data(**kwargs) RestaurantFormSet = modelformset_factory( Restaurant,form=BaseRestaurantOpinionForm ) extra_context = { 'eligible_restaurants' : self.get_eligible_restaurants(), 'forms' : RestaurantFormSet(), } context.update(extra_context) return context Basically I'll be getting 3 voting buttons for each restaurant and then I want to read the votes. I was wondering from where/which clean function do I need to call to get something like: { ('3' : 'yes'), ('2' : 'no') } #{ 'restaurant_id' : 'vote' } This is my second/third question so tell me if I'm being unclear. Thanks.

    Read the article

  • Is it possible to run javascript with other target?

    - by Kristoffer Nolgren
    I have a facebook app that I authenticate using a general-purpose authentification. Like this: // Fixar oAuth jso_configure({ "facebook": { client_id: "393963983989013", redirect_uri: "http://resihop.herokuapp.com/", authorization: "https://www.facebook.com/dialog/oauth", presenttoken: "qs" } }); // Make sure that you have jso_ensureTokens({ "facebook": [""] }); // This dumps all cached tokens to console, for easyer debugging. //jso_dump(); jso_ensureTokens({ "facebook": [""] }); It's tirggered on document.ready. Because it's a facebook app I can't run the authentification in the iFrame. Facebook denies this using X-Frame-Options. The solution, if you authenticate with a link is to use target="_top". How do i Achieve the same effect in javascript? Maybe I need to edit one of the funcitons (though ideally not, as they are part of a library) in that case please point me in the right direction.

    Read the article

  • valgrind - ignore glibc functions?

    - by Jack
    Is it possible to tell valgrind to ignore some set of libraries? Specifically glibc libraries.. Actual Problem: I have some code that runs fine in normal execution. No leaks etc. When I try to run it through valgrind, I get core dumps and program restarts/stops. Core usually points to glibc functions (usually fseek, mutex etc). I understand that there might be some issue with incompatible glibc / valgrind version. I tried various valgrind releases and glibc versions but no luck. Any suggestions?

    Read the article

  • how do I filter RoutingErrors and their long stack trace out of my log? rails

    - by codeman73
    I am seeing several strange requests like this, with urls like /sitemap/, /google_sitemap.xml.gz, /sitemap.xml.gz, /google_sitemap.xml, /cgi-bin/awstat/awstats.pl, etc. The default rails behavior dumps these long stack traces into my log, like the following: ActionController::RoutingError (No route matches "/rails/info/properties" with {:method=>:get}): /dh/passenger/lib/phusion_passenger/rack/request_handler.rb:92:in `process_request' /dh/passenger/lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop' /dh/passenger/lib/phusion_passenger/railz/application_spawner.rb:400:in `start_request_handler' /dh/passenger/lib/phusion_passenger/railz/application_spawner.rb:351:in `handle_spawn_application' /dh/passenger/lib/phusion_passenger/utils.rb:184:in `safe_fork' etc. Is there any way to stop these long stack traces? I wouldn't mind the first line, the ActionController::RoutingError with the message and the url, but I'd like to get rid of the long stack of passenger stuff.

    Read the article

  • Is a program compiled with -g gcc flag slower than the same program compiled without -g?

    - by e271p314
    I'm compiling a program with -O3 for performance and -g for debug symbols (in case of crash I can use the core dump). One thing bothers me a lot, does the -g option results in a performance penalty? When I look on the output of the compilation with and without -g, I see that the output without -g is 80% smaller than the output of the compilation with -g. If the extra space goes for the debug symbols, I don't care about it (I guess) since this part is not used during runtime. But if for each instruction in the compilation output without -g I need to do 4 more instructions in the compilation output with -g than I certainly prefer to stop using -g option even at the cost of not being able to process core dumps. How to know the size of the debug symbols section inside the program and in general does compilation with -g creates a program which runs slower than the same code compiled without -g?

    Read the article

  • show output of file on client side using jquery + javascript .

    - by tazimk
    Hi, Written some code in my view function : This code reads a file from server . stores it in a list .passes to client def showfiledata(request): f = open("/home/tazim/webexample/test.txt") list = f.readlines() return_dict = {'list':list} json = simplejson.dumps(list) return HttpResponse(json,mimetype="application/json") On, client side the $.ajax callback function receives this list of lines. Now, My Question is . I have to display these lines in a textarea. But these lines should not be displayed at once . Each line should be appended in textarea with some delay. (Use of setInterval is required as per my knowledge) . Also I am using jquery in my templates. The server used is Django . Please provide some solution as in some sample code will be quite helpful .

    Read the article

  • How to analyse Dalvik GC behaviour?

    - by HRJ
    I am developing an application on Android. It is a long running application that continuously processes sensor data. While running the application I see a lot of GC messages in the logcat; about one every second. This is most probably because of objects being created and immediately de-referenced in a loop. How do I find which objects are being created and released immediately? All the java heap analysis tools that I have tried(*) are bothered with the counts and sizes of objects on the heap. While they are useful, I am more interested in finding out the site where temporary short-lived objects get created the most. (*) I tried jcat and Eclipse MAT. I couldn't get hat to work on the Android heap-dumps; it complained of an unsupported dump file version.

    Read the article

  • Import small number of records from a very large CSV file in Biztalk 2006

    - by rwmnau
    I have a Biztalk project that imports an incoming CSV file and dumps it to a database table. The import works fine, but I only need to keep about 200-300 records from a file with upwards of a million rows. My orchestration discards these rows, but the problem is that the flat file I'm importing is still 250MB, and when converted to XML using a regular flat file pipeline, it takes hours to process and sometimes causes the server to run out memory. Is there something I can do to have the Custom Pipeline itself discard rows I don't care about? The very first item in each CSV row is one of a few strings, and I only want to keep rows that start with a certain string. Thanks for any help you're able to provide.

    Read the article

  • How to speed up dumping a DataTable into an Excel worksheet?

    - by AngryHacker
    I have the following routine that dumps a DataTable into an Excel worksheet. private void RenderDataTableOnXlSheet(DataTable dt, Excel.Worksheet xlWk, string [] columnNames, string [] fieldNames) { // render the column names (e.g. headers) for (int i = 0; i < columnNames.Length; i++) xlWk.Cells[1, i + 1] = columnNames[i]; // render the data for (int i = 0; i < fieldNames.Length; i++) { for (int j = 0; j < dt.Rows.Count; j++) { xlWk.Cells[j + 2, i + 1] = dt.Rows[j][fieldNames[i]].ToString(); } } } For whatever reason, dumping DataTable of 25 columns and 400 rows takes about 10-15 seconds on my relatively modern PC. Takes even longer testers' machines. Is there anything I can do to speed up this code? Or is interop just inherently slow?

    Read the article

  • How can I sqldump a huge database?

    - by meder
    SELECT count(*) from table gives me 3296869 rows. The table only contains 4 columns, storing dropped domains. I tried to dump the sql through: $backupFile = $dbname . date("Y-m-d-H-i-s") . '.gz'; $command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > $backupFile"; However, this just dumps an empty 20 KB gzipped file. My client is using shared hosting so the server specs and resource usage aren't top of the line. I'm not even given ssh access or access directly to the database so I have to make queries through PHP scripts I upload via FTP ( SFTP isn't an option, again ). Is there some way I can perhaps sequentially download portions of it, or pass an argument to mysqldump that will optimize it? I came across http://jeremy.zawodny.com/blog/archives/000690.html which mentions the -q flag and tried that but it didn't seem to do anything differently.

    Read the article

  • Delphi: Application error logging in the field

    - by mawg
    Using Delphi 7, I wonder if there is a free component which will collect diagnostic information as my application runs at a remote site and will help me to debug error reports. Maybe it records each menu item selected, control clicked, text input, etc? Maybe it just dumps the stack on a crash. Maybe it does something else ... I don't mind adding code (e.g at the start and end of each procedure), as that might generate more useful info than a fully automatic system. I am not sure if the solution ought to "phone home" or if it is enough to produce a text file which can be emailed to me. Any suggestions?

    Read the article

  • Can you make a python script behave differently when imported than when run directly?

    - by futuraprime
    I often have to write data parsing scripts, and I'd like to be able to run them in two different ways: as a module and as a standalone script. So, for example: def parseData(filename): # data parsing code here return data def HypotheticalCommandLineOnlyHappyMagicFunction(): print json.dumps(parseData(sys.argv[1]), indent=4) the idea here being that in another python script I can call import dataparser and have access to dataParser.parseData in my script, or on the command line I can just run python dataparser.py and it would run my HypotheticalCommandLineOnlyHappyMagicFunction and shunt the data as json to stdout. Is there a way to do this in python?

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >