Why does reading a record struct fields from std::istream fail, and how can I fix it?

Why does reading a record struct fields from std::istream fail, and how can I fix it?

Suppose we have the following situation:A record struct is declared as follows struct Person { unsigned int id; std::string name; uint8_t age; // ...};Records are stored in a file using the following format:ID Forename Las

When is JavaScript's eval() not evil?

When is JavaScript's eval() not evil?

I'm writing some JavaScript code to parse user-entered functions (for spreadsheet-like functionality). Having parsed the formula I could convert it into JavaScript and run eval() on it to yield the result.However, I've always shied away fro

Why do I need to use std::move in the initialization list of a move-constructor?

Why do I need to use std::move in the initialization list of a move-constructor?

Let's say I have a (trivial) class, which is move-constructible and move-assignable but not copy-constructable or copy-assignable:class movable{ public: explicit movable(int) {} movable(movable&&) {} movable& operator=(movable&&)

How do you divide your project into applications in Django?

How do you divide your project into applications in Django?

I am not really sure how to divide my Django projects into applications.What things should I consider when laying out a Django project? 1:James Bennett has written a blog entry about this,Django tips: laying out an application, section "

Perfect Forwarding in C++03

Perfect Forwarding in C++03

If you have this functiontemplate f(T&);And then try to call it with, let's say an rvalue likef(1);Why isn't T just be deduced to be const int, making the argument a const int& and thus bindable to an rvalue? 1:This is mentioned as a pot

Error while using CUDA and C++11

Error while using CUDA and C++11

I am using CUDA 4.1 and GCC 4.5 ... (FINALLY! CUDA supports GCC 4.5, but still waiting for GCC 4.6). Anyways, is it possible to use C++11 with the CUDA 4.1?I tried passing:--compiler-options "-std=c++0x"to nvcc and it throws a bunch of erro

Kendo Grid Foreign key column bind dynamically

Kendo Grid Foreign key column bind dynamically

@(Html.Kendo().Grid((IEnumerable)Model.contact_lst) .Name("grid") .Columns(columns => { columns.Bound(o => o.ContactID).Visible(false); columns.Bound(o => o.ContactName).Title("Contact Name"); columns.Foreign

Meteor.js - temporarily prevent a template from re-rendering (disable reactivity)

Meteor.js - temporarily prevent a template from re-rendering (disable reactivity)

I have a page in my app with a list of Projects the user is working on.When they want to add a new project, I show a modal form to get the name of the project.If they click 'OK' I create the project and redirect to /project/[new project id]

Creating a two column Unordered List

Creating a two column Unordered List

I am looking to make a two column Unordered list similar to below but would like to know how to integrate the image of the plus sign as well. I'm looking for a solution with no CSS3 goodness so it can support older browsers.Here is a link t

Django Haystack : search for a term with and without accents

Django Haystack : search for a term with and without accents

I'm implementing a search system onto my django project, using django haystack. The problem is that some fields in my models have some french accents, and I would like to find the entries which contents the query with and without accents.I

How can I hook on scripts and CSS into ?

How can I hook on scripts and CSS into ?

The thing with the module I am making is that it kind of generates a javascript snippet, so I cannot use an action to just hook that into the section of the HTML since the action requires that I have a JS file (correct me if I am wrong). W

How do you rotate image in angularjs

How do you rotate image in angularjs

Hi I have an image that I want to rotate. There are two buttons left and right which rotate the image 45 degrees in opposite directions. I tried creating a directive using jquery rotate library but it doesn't work. Help?directive.js.dire

React: leave the contents of a component alone

React: leave the contents of a component alone

Is it possible to have React ignore a subtree? i.e., don't compare or update it?My use case is migrating to React. Re-writing all our Handlebars templates at once isn't feasible, but if we could use our existing templates for some subcompon

Dynamically creating an instance of a class from a string containing the class name in C++

Dynamically creating an instance of a class from a string containing the class name in C++

Lets say I have a base class with 100 children:class Base { virtual void feed(); ... };class Child1 : public Base { void feed(); //specific procedure for feeding Child1 ... };...class Child100 : public Base { void feed(); //speci

In Visual Studio 2013 / ASP.NET MVC 5, How do I add a new Controller?

In Visual Studio 2013 / ASP.NET MVC 5, How do I add a new Controller?

In ASP.NET MVC5 + VS 2013 (preview at time of writing), how do I add a new Controller? In past versions (VS 2012 / MVC 4), I was able to right click on the Controllers folder and click "Add Controller". That option is no longer there. Where

Load django template from the database

Load django template from the database

Im trying to render a django template from a database outside of djangos normal request-response structure. But it appears to be non-trivial due to the way django templates are compiled. I want to do something like this:>>> s = Template.obj

Create new cores in SOLR via HTTP?

Create new cores in SOLR via HTTP?

Is it possible to create new cores in SOLR via HTTP? I can't seem to find a definitive answer to what seems like a very simple question...Each core I want to create will have the same schema/configuration (multi-tenant SaaS architecture). I

Angular.js How to update the scope from a directive?

Angular.js How to update the scope from a directive?

How can I update scope in directive? My directive:var myModule = angular.module('myModule', []) .directive('t', function () { return { template: '{{text}}', link: function (scope, element, attrs) {

gdb Could not find operator[]

gdb Could not find operator[]

double var1, var2;std::vector x;var1 = 1;var2 = 2;x.push_back(&var1);x.push_back(&var2);When I debug this code in gdb and try print x[0] or *x[0] I get: Could not find operator[].Now if I include this line after the push_back:x[0] = &var1;I

get the Nth type of variadic template templates?

get the Nth type of variadic template templates?

How ot get the Nth type of variadic template templates? For exampletemplateclass MyClass{ Args[0] mA; // This is wrong. How to get the type?}; 1:You can use std::tuple:#includetemplateclass MyClass{ typename std::tuple_element::typ

What's the current status of restricted monads?

What's the current status of restricted monads?

Going back to at least the late 1990s there have been people wishing for the integration of restricted monads into Haskell in a friendly way.For example, without restricted monads you can't make an efficient monad out of Set, Map or probabi

In a template how do you access an outer scope while inside of a “with” or “range” scope?

In a template how do you access an outer scope while inside of a “with” or “range” scope?

When inside a with or range, the scope of . is changed. How do you access the calling scope? 1:{{with .Inner}} Outer: {{$.OuterValue}} Inner: {{.InnerValue}}{{end}}$ is documented in the text/template docs: When execution begins, $ is

is there a datatemplate for grid panel elements in WPF?

is there a datatemplate for grid panel elements in WPF?

Fairly new to WPF...I have a collection of data I would like to bind to a grid panel. Each object contains its grid row and column, as well as stuff to fill in at the grid location. I really like how I can create data templates in the lis

How to make Django create slug from unicode characters?

How to make Django create slug from unicode characters?

Django Unicode Slug how to ?class NewsModel(models.Model): title = models.CharField(max_length = 300) slug = models.CharField(max_length = 300) content = models.TextField() def save(self,*args, **kwargs): if self.slug is

How to change the position of the table of contents in rmarkdown?

How to change the position of the table of contents in rmarkdown?

With RStudio and knitr I see that I can add a TOC with the following code in my .rmd file. ----------------output: html_document: toc: yes-----------------However, this places the TOC at the very beginning of the HTML document. Is ther