Sample Filter
   11 tags on

0 answers

Error in RDMA Atomic operations

I have a problem with executing RDMA atomic operations (FETCH_ADD and CMP_AND_SWAP). When I try to submit an atomic RDMA request, the ibv_post_send() function fails, with Errno set to "Invalid ...

0 answers

How to access tuple's elements in a class that inherits it

Suppose I'm trying to write a class that acts like a tuple in every way except one: when you print it, any values above 10 are replaced by 'H'. I would usually do this by having a class that inherits ...

1 answer

String Class Manipulation

Is it possible to fix size of string variable. For example I want string variable str of capacity 5. P.S: I don't want to use char str[5]. I want to use string class. So the variable declaration ...

1 answers | 2 mins ago by user1292432 on Stack Overflow stackoverflow.com
0 answers

resizing vector in cpp

Is there a cheap way to resize a vector V from the start and not the end. Such that the resulting vector W looks like this: V = 1,2,3,4 W = 2,4,4 Copying is a bad solution when the stored data in ...

2 answers

COM object lifetime

Consider the following scenario: This code executed by thread A: CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); globalSomeSTAComObject.CreateInstance((__uuidof(CLSID_SomeSTAComObject)); return ...

2 answers | 3 mins ago by JobNick on Stack Overflow stackoverflow.com
0 answers

initialize array, placement new, read variables, defined behavior?

given a class who's only member is a char[10], that has no inheritance nor virtual members, that has a constructor that does not mention the array in any way (such that it gets default-initialization ...

1 answer

cannot swap structs inside a class derived from vector

I have a class derived from vector, and its data elements hold structs. My problem is that when I attempt to use swap or any other method of moving the structs from one element to another I get ...

1 answers | 3 mins ago by Stephen on Stack Overflow stackoverflow.com
3 answers

using namespace std and library

Why we need both the "header file" and the using namespace tag for the any library function to get executed properly. For example cout will not work unless we use iostream. Also it will not work ...

3 answers | 4 mins ago by user1292432 on Stack Overflow stackoverflow.com
1 answer

trouble using lambda expressions and auto keyword in c++

I'm trying to learn how to use lambda expressions in C++. I tried this simple bit of code but I get compile errors: int main() { vector<int> vec; for(int i = 1; i<10; i++) { ...

4 answers

How is a graph tyically defined?

I saw an interview question that had the graph structure defined as: struct Node{ vector<Node*> neighbors; } I thought this was unusual, or perhaps a mistake, since there is nothing to ...

4 answers | 8 mins ago by Bob John on Stack Overflow stackoverflow.com
2 answers

find-package to a development library using CMAKE

This is a total cmake noob question I'm sure. I'm working on an OpenCV project and wish to test something using the latest beta release. How can I specify the beta libraries without installing them ...

2 answers | 9 mins ago by wentbackward on Stack Overflow stackoverflow.com
0 answers

Scala slick deletion query with Akka & Postgres

I'm trying to write a method that simply deletes a row from a database based on an id. import scala.concurrent.{ Future, future } import scala.concurrent.duration.DurationInt import ...

3 answers

django - prevent form submission if submitted form value is X

I am using Django 1.4.6 & python 2.7. I have a test form that allows the user to enter data from a select list: <select name="language_code" id="id_language_code"> <option ...

1 answer

Increasing max size of Mongo BSON Objects results in Boost library compile error

I need to increase the max size of BSON objects in Mongo. Since the BSON object size is not directly configurable, I've attempted to do this by changing the constant in the source and recompiling. ...

1 answers | 17 mins ago by Boris Kozak on Stack Overflow stackoverflow.com
1 answer

Python/Tornado - compressing static files

For django projects there is an awesome tool called django-compressor. It combines all js or css files under compress template tag into single cached file, like this: {% load compress %} {% compress ...

1 answer

Python Mechanize change unnamed input value (known id)

as is written in topic i have to change value of some input field using mechanize but i dont have name of it only id :/ Let's stick to the point. This is how form looks: <form id="Login" ...

1 answers | 29 mins ago by windoo on Stack Overflow stackoverflow.com
0 answers

Using imgInterfaceOpen() Can't Access To My Device When Using NI-IMAQ

When I use imgInterfaceOpen() API to access to my frame grabber,it will return an non-zero value to me, program closes,that means I can't access to the device. Strangely,the example code of NI-VISION ...

2 answers

MongoDb: $sort by $in

I am running a mongodb find query with an $in operator: collection.find({name: {$in: [name1, name2, ...]}}) I would like the results to be sorted in the same order as my name array: [name1, name2, ...

1 answer

Renaming multiple video files using RE and OS

I recently downloaded a large number of mkv files with names formatted like "South Park S01E01 Cartman Gets an Anal Probe (640x480) [Phr0stY].mkv". I want to strip all of the text except for the ...

1 answer

Scrapy - getting the the file size and type from a URL without downloading the file?

In Scrapy I want to crawl some pages that have large .zip files, and retrieve some data (size, url, etc.) about those files. One way I could do this is to yield requests for these urls, but I think ...

2 answers

Extracting numeric data lines between lines or two markers

I am trying to extract several lines of the data from a text file. this data set sits between two markers ("et 1027" and "t 0") as follows: .... (some data) et 1027 0.00000E+00 1.00000E-05 ...

2 answers | 40 mins ago by Birsen on Stack Overflow stackoverflow.com
0 answers

Is there a command line tool that can access the Internet and is installed (by default) on all Unix computers?

I'm a Vim user and I have a pretty customized .vimrc file. If I have to use 'vim' on computers that don't have my specific .vimrc, I might end up looking like an idiot because all the commands I ...

1 answer

Parsing local versus online HTML page using PyQuery in Python

Given the following URL: http://cisbp-rna.ccbr.utoronto.ca/TFreport.php?searchTF=T00022_0.6 This code has no problem parsing it: from pyquery import PyQuery as pq url= ...

1 answers | 43 mins ago by pdubois on Stack Overflow stackoverflow.com
3 answers

C++ - Read file until reaching end of line with >> operators

I have looked around a lot, and still not found how to do this, so, please bear with me. Let's say i have to read a txt file that contains different kinds of data, where the first float is an id, and ...

1 answer

Error loading IPython notebook

Once I opened a notebook file with Jupyter (it asks me to convert the file) I never can open it in the standard IPython notebook anymore. I get the following error: Error loading notebook Bad Request ...

0 answers

Using Django Scopes to distinguish between user and client

I am developing a REST API which is consumed by an angular js app as well as some other apps/clients. I am using Django REST Framework and I want to use django-oauth-toolkit OAUTH2 for authentication ...

3 answers

Can modern C++ get you performance for free?

It is sometimes claimed that C++11/14 can get you a performance boost even when merely compiling C++98 code. The justification is usually along the lines of move semantics, as in some cases the rvalue ...

7 answers

Displaying better error message than “No JSON object could be decoded”

Python code to load data from some long complicated JSON file: with open(filename, "r") as f: data = json.loads(f.read()) For many types of JSON error (missing delimiters, incorrect backslashes ...

7 answers | 55 mins ago by OJW on Stack Overflow stackoverflow.com
1 answer

error while trying to install a package using the python-apt API

I found a code which i need. It is from this link : How to install a package using the python-apt API #!/usr/bin/env python # aptinstall.py import apt import sys pkg_name = "libjs-yui-doc" cache = ...

1 answers | 1 hour ago by oiyio on Stack Overflow stackoverflow.com
5 answers

Iterate through a list multiple times

I need to do the following in python. I have a list of strings list, a string to search for, text, and a number of elements, x. I want to iterate through x consecutive elements of list, wrapping ...

5 answers | 1 hour ago by luke on Stack Overflow stackoverflow.com
15 30 50 per page
1 2 3