Sample Filter
   11 tags on

1 answer

Baleful Python rites working when they souldn't

I have the following code: >>> pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')] >>> pairs.sort(key=lambda pair: pair[1]) >>> pairs [(4, 'four'), (1, 'one'), (3, ...

1 answer

How do i make it so it recalls the same list from dictionary in python?

if group == "A": if name in groupA: groupA = pickle.load(open("groupA.p", "rb")) groupA[name] = [score] score.append(count) pickle.dump(groupA, open("groupA.p", ...

1 answer

List files whose name contains a date string with python

I have this code to list files like '*20150304.csv' but returns nothing #!/usr/bin/env python dir_local = '/var/log/' import os import glob from datetime import date, timedelta today = ...

1 answers | 2 mins ago by David on Stack Overflow
2 answers

Vector construction when wrapped in a Shared Pointer

So I am working on a transformation from an OO-language with garbage collection capabilities to C++. To start out I want to wrap all objects in shared pointers to solve the memory de-allocation issue. ...

0 answers

Python scripts gives 401 error while corresponding curl request works

I'm trying to run the following script. It returns an "unauthorized 401 error". If I execute an corresponding curl request it gets executed correctly. import requests import json url = ...

0 answers

GDB macro maintain counter of objects

I need to maintain counter of each type of object seen while iterating over list of objects in gdb script and print it at last. since gdb doesn't support dictionaries (key, value pair) For example, ...

0 answers

Using theano with single examples out of batch

I'm currently using the machine learning library theano to produce a project which utilises deep learning techniques, to find an internal representation of the MNIST dataset. So far my codebase is ...

0 answers

Is it possible to use Celery to run an already compiled (py2exe) python script

Is it possible to use Celery to run an already compiled (py2exe) python script, if yes, how I can invoke it ?

1 answer

Is there a function similar as `np.outer` for vector/matrix “outer” product?

I was wondering if there is a function in numpy that acts similarly to np.outer, but with a bi-dimensional array and a vector as input parameters. The resould should be a 3-dimensional array. For ...

0 answers

Fails to import matplotlib as plt

I've tried to import matplotlib as plt and get a very long error ending with : ImportError: DLL load failed: %1 is not a valid Win32 application. my system: pycharm, python3.4 (64bit). I've ...

2 answers

How to check if some text is present on a web page using selenium 2?

Hi I am using selenium to automate test on web pages. I am using selenium 2 and python and would like to have answers in this framework only. SO how do I check whether some text is present or not? I ...

2 answers

How can I specify an exact output size for my networkx graph?

The above is the output of my current graph. However, I have yet to manage what I am trying to achieve. I need to output my graph in a larger size so that each node/edge can be viewed with ease. ...

2 answers | 7 mins ago by user428370 on Stack Overflow
0 answers

Python new style signals and slot between thread and gui app

I am newbie to OOP and python. I am trying to emit signal from Qthread to Qt GUI main window using new style signals and slots. This is the thread. Inside I will emit signals for updating message ...

1 answer

scala By-name parameter on a anonymous function

I'm struggling to write an anonymous function with by-name parameter. Here is what i tired. val fun = (x: Boolean, y: =>Int) => if(x) y else 0 This fail with following error. Error:(106, ...

1 answers | 8 mins ago by Sajith Silva on Stack Overflow
2 answers

Why is it faster to allocate memory in the heap for a local array compared to a global array?

Below is a simple experiment that I decided to run. test1() is a function that allocates memory for the global array g and then has a for loop that updates all the elements of this array. Finally it ...

4 answers

Change shell print color in python 3.3.2

Is there any way to change shell print color in python 3.3.2 in Linux Ubuntu and Windows 7? I've read all other topics but non of them working on this version or I should install a module but can I do ...

2 answers

Create new lists of the shortest and longest words in an existing list - Python

I know there is a better way to do this but I can't seem to find it. As you can see below I am getting the longest and shortest results but only because I know what the longest and shortest words are ...

2 answers

Python kbhit() problems

I'm trying to write a very simple program that will wait for x seconds before checking to see it a key has been pressed then, depending on this outcome will go into a different loop further down the ...

2 answers | 11 mins ago by user2756892 on Stack Overflow
0 answers

How to use end='' and sep='' in print function

i'm making a simple game in console, so i want to draw a "map" using a hash as wall, here'is my code: from os import system from msvcrt import getch import sys class Map(object): positionX, ...

2 answers

how use of error control functions in c++?

my source code is bellow : #include <QtCore/QCoreApplication> #include <stdio.h> #include <errno.h> using namespace std; int main(int argc, char *argv[]) { QCoreApplication ...

2 answers | 13 mins ago by Mohammadreza on Stack Overflow
0 answers

Django keeps calling another package to paginate — how?

My code imports Paginator from django.core.paginator. (Django 1.6.7) However, when run, somehow it is calling a custom paginator. I don't want it to do this, as the custom paginator template has ...

1 answer

boost::property_tree::ordered_end() missing

I am trying to iterate over a boost property tree. The docs state that You can get an ordered view of all children by using ordered_begin() and ordered_end(). However, when I write for ( ...

1 answer

Sorting Two Vectors At Once?

My current project involves sorting points based on their distance from the origin of an x-y coordinate plane. It has to find each point's distance from the origin, sort the distances, and outputs the ...

4 answers

Pass date to a variable from the script

I have this script for delete images older than a date. Mi question is if I can pass the date when I call to run the script. Example: The script is called and delete images older ...

4 answers | 14 mins ago by Patagonikus on Stack Overflow
1 answer

Visual Studio 2008 doesn't appear X64 option for win 7 64 bit

I install visual studio 2008 express on win 7 64 bit and I also install Windows Software Development Kit (SDK). I try to transform a DLL(c++ source code) from 32 to 64 bit but the X64 option doesn't ...

1 answer

CCLabelTTF::setString not accepting white space at start and end of string

I'm trying to set value of a label in cocos2d-x. It's not showing spaces if I add them on start or end of string, like label->setString("10 10"); working correctly. But if I use ...

3 answers

Avoid leak in Boost Log trivial usage

I am getting valgrind leak reports from a server side application that use boostlog that is distributed with boost 1.56. the valgrind report is : ==8021== 37,088 bytes in 1,159 blocks are definitely ...

0 answers

Proving the existence of some delta for a convergent complex function

How would you go around proving the existence of some delta, for an arbitrary convergent complex function? Given; lim(z -> z0) g(z) = B, where B does not equal zero

0 answers

fast way from 8bit grayscale numpy array to QPixmap

I get a 2dimensional (800 x 600) numpy array every 0.5 sec. representing an greyscale image (8bit). I tried converting it to PIL image and then using ImageQt to get a Pixmap, but ImageQt doesn't work ...

7 answers

Handling “class” attribute in Beautifulsoup

I'm having trouble parsing html elements with "class" attribute using Beautifulsoup. The code looks like this soup = BeautifulSoup(sdata) mydivs = soup.findAll('div') for div in mydivs: if ...

7 answers | 18 mins ago by Neo on Stack Overflow
15 30 50 per page
1 2 3