Sample Filter
   11 tags on

1 answer

inputting data with pointers in class in c++

i wanted to write a code(with using pointers) to get two sides of a rectangular and calculate the perimeter and area of it but it's not working here goes the code: #include <iostream> #include …

17 secs ago
2 answers

Inherit from class dynamically created in a function

Due to the wierdness of the particular module I am working with, I am wondering if there is a general way for one class to inherit the properties of another class that is locally created in a method. …

37 secs ago
1 answer

How to test limit of available memory (C++)?

I have to check the limit of my PC's available memory by setting values of my constructor. The memory should be allocated dynamically. Example: class matrix{ int lines; int columns; ...

2 answers

Numpy: Create a mask array to select rectangle

Is there a way to generate an array, masking a rectangular area, without the need to initialize an empty array first? mask = np.zeros((10,10), dtype=bool) mask[10/2:,10/2:] = True Im looking for …

4 answers

Minimum number of moves to empty all buckets, which all have same capacity but different amount of water initially. I can only move left to right

Problem definition I have n buckets with the same capacity m, one next to the other. I can pour water from one bucket to the one to it's right.Tthe goal is to empty them all into another container …

1 answer

Shadow Mapping is not projected correctly

I'm having troubles with the implementation of shadow mapping in my OpenGL graphic engine. At first stage, I render the shadow map into a frame buffer object (with a depth texture attached to it) …

1 answer

Python Dictionary multi values

I have a dictionary of colors with multiple values: dictcolors = {'Red': '1,2,3,4,5', 'Green': '3,4,5', 'Purple': '6', 'Orange': '7', 'Blue': …

3 mins ago
2 answers

Run while loop one extra time after condition is met

I am making an area calculator to help me understand the basics of Python, but I want to do some type of validation on it - if a length is less than zero, then ask again. I've managed to do this with …

3 mins ago
1 answer

Script runs fine in PyScripter, crashes in python.exe (encoding error with Beautifulsoup)

def getPlural(): plural = soup.find("span", class_="form-of lang-de plural-form-of") if plural == None: return None else: return plural.get_text() The problem seems to lie in this part of my …

0 answers

VS2012 MSVCR120D.dll is missing

I am trying to set up my project in VS2012 to successfully compile and run an OSG code for debugging. I am also using OSG debug libraries. Compilation and linking ends successfully but after that I …

0 answers

clr console app fails at runtime when cant find referenced dll

Following the msdn example here I have created a CLR library (TestCLRWrapper) and I am now trying to use that in a CLR Console app (TestCLRConsole). Mine is doing something slightly different in that …

8 mins ago
4 answers

How to delete an empty list in a list? (Python)

I wrote a function which takes a .txt file. The first thing it does is split the file at ',' and add them to a list, which creates a list of lists.I used: lst = s.split(',') I do get a list of ...

8 mins ago
1 answer

How can I make my objects reinterpret-castable to arrays, like std::complex?

I just learned this because of this question, that the standard states for std::complex (26.4 [complex.numbers]): 4 If z is an lvalue expression of type cv std::complex<T> then: — the ...

8 mins ago
1 answer

Overloading a constructor to handle different data types

I have a class with the following constructor //matrix constructor mat::mat(int nrows,int ncols){ this->nrows=nrows; this->ncols=ncols; this->dat=new float *[nrows]; for(int ...

3 answers

Vim netrw - Explore when modified without split

I've opened a file and modified it - now I want to do :Explore without splitting. It splits - because I have an unsaved buffer. By default this is nice, becasuse Vim generally doesn't allow to switch …

9 mins ago
2 answers

How to forward declare third-party struct

In my original code, I refer to the third-party .H in the ClassOne header file and everything works fine. Now, I received a new requirement that doesn't allow me to refer to the third-party .H in the …

10 mins ago
0 answers

asio::async_write SEG FAULT

I am not sure why I am getting a segmentation fault when I begin an async_write() with a string as a buffer. I have successfully used this function in the past. Here is the method where I get the ...

10 mins ago
0 answers

Start daemon process within BaseHTTPServer

In order to allow helpdesk to restart an Oracle Instance, we are trying to implement a small python webserver that would start a shell script that starts the Oracle instance. The code is done and it …

0 answers

fast neo4j query with python and java API

I want to use neo4j for large graph querying (12M nodes, 1.5G relations). I have tested the performance, and using cypher it's unsatisfactory as for the web-server. Since java API query is >10x faster …

11 mins ago
3 answers

Why is the ternary operator not the same as an if-else here?

I'm using TR1's std::function to implement a simple callback mechanism. If I don't want to get called back, I register nullptr as the callback handler. This compiles and works fine: void ...

0 answers

django filter and delete model entries

I am relatively new to django, and I have two models on my DB (ModelA and ModelB). What I'd like to do is filter ModelA values from ModelB and delete these values from ModelB. So, for example, ...

2 answers

keyError in Flask application using Stripe's checkout

I am making a simple flask application using stripe's checkout. just like in: https://stripe.com/docs/checkout/guides/flask - app.py but I am getting error: Traceback (most recent call last): File …

0 answers

Understanding Python lambda expression in list comprehension

I am trying to understand an error I am getting in using a lambda as part of a list comprehension but I'm getting a bit confused. I have a list of file paths and I used map to open all of them using …

12 mins ago
0 answers

OpenCV 3.0>> camera relative pose estimation

Enviroment 3D Scene generated using 3DS Max Camera FOV is 45 degrees Two images are rendered using the same camera @ 800x600 resolution Image A having camera Z rotation == 0 deg Image B having ...

0 answers

Python - How to make line by line replacements using values from an array

I currently have a Python script that parses a file (in this case an XML file) and makes line by line replacements as necessary, depending on the values of multiple arrays. As it stands now the script …

2 answers

Getting wrong output when working with tuple and list in Python

Trying to learn some python and I have the following task: Get a phrase from the user as an input. Check if the input contains a consonant from a consonants tuple\list that I declare in the code. …

0 answers

How to identify a specific switch in Mininet when connected to a pox controller

I have a custom topology running on Mininet and it has 2 switches s1, and s2. I am using pox as the controller. I have written a python code to identify the switches, is this the correct way to do it? …

15 mins ago
1 answer

Python threading global variable issue

I have a few scripts that i want to run simultaneously, they read a CSV file, im trying the following; import sys import csv out = open("C:\PYDUMP\PYDUMPINST.csv","r") dataf=csv.reader(out) for …

0 answers

Windows Driver, Compilation Error KDMF

I'm trying to replicate (http://msdn.microsoft.com/en-us/library/windows/hardware/hh439665%28v=vs.85%29.aspx) the code to write a kernel mode driver, my development environment is windows 7 32 bit, …

2 answers

Adding a timestamp to a file, python subprocess linux

I’m trying to take a picture with my Raspicam on my raspberry and adding a timestamp too each picture. The code that I use doesn’t however work. It gives me a syntax error at .."+%H... I have mucked …

15 30 50 per page
1 2 3