Returning a Collection from a method that specifies that it returns Collection

Returning a Collection from a method that specifies that it returns Collection

I'm trying to write a method that will return a collection (eg Arraylist) that is declared using generics as containing either a parent class or a class that extends the parent class. For this method the objects in the collection will alway

jquery validator plugin - no validation

jquery validator plugin - no validation

I know this suppose to be simple (according to the plugin page anyway)But I'm trying to use the plugin with no success, here's my form:and my jquery script:$(document).ready(function() { $.validator.addMethod("validJson", function(value,

Meteor mongodb $inc with update

Meteor mongodb $inc with update

I have this mongo collection and vars:items:{ type_one: 0, type_two: 0}var valueOne = 1;var nameItem = type_one;I try to update a value, but not work.I tried this:Collection.update({createdBy: user_id}, {$inc: { items.$.nameItem: valueOne}}

How to use MongoRegex (MongoDB C# Driver)

How to use MongoRegex (MongoDB C# Driver)

Has anyone have any idea how to use MongoRegex for the document search?I attempted this, but returns nothing back:var spec = new Document();spec.Add("Name", new MongoRegex("/" + searchKey + "*/", "i"));collection.Find(spec)Wondering why it

Mongo Aggregation : $group and $project array to object for counts

Mongo Aggregation : $group and $project array to object for counts

I have documents like:{ "platform":"android", "install_date":20151029}platform - can have one value from [android|ios|kindle|facebook ] . install_date - there are many install_datesThere are also many fields.Aim : I am calculating ins

How do I return all elements from a xml doc?

How do I return all elements from a xml doc?

From my xml document, I want to display all ns1:Statute nodes. My vb code is only displaying one node and not all 3. How do I display all 3 nodes with their elements? I am aware I need to use selectNodes instead of select single node, and

Is there a solid BB code parser for PHP with no dependencies? [closed]

Is there a solid BB code parser for PHP with no dependencies? [closed]

I've got a situation where the client is using php4 and doesn't look like they have PEAR. Is there an established PHP BBCode parser that will work with vBulletin's BBCode system?I just need to convert the BBCode to HTML. This is a data migr

ASP.Net FormsAuthentication Redirect Loses the cookie between Redirect and Application_AuthenticateR

ASP.Net FormsAuthentication Redirect Loses the cookie between Redirect and Application_AuthenticateR

I have a FormsAuthentication cookie that is persistent and works independently in a development, test, and production environment. I have a user that can authenticate, the user object is created, the authentication cookie is added to the re

How properly generate bootstrap grid via loop using Razor?

How properly generate bootstrap grid via loop using Razor?

I use ASP.NET MVC and bootstrap. I have many objects (>2) in collection and for each need a but with only 2 cols in a row. How to achive this using loop?There is 1 way but I am looking for something better:@model [email protected] (Html.BeginForm

Twig's dump function returns a blank screen

Twig's dump function returns a blank screen

I am using Twig's dump function in Symfony2. I have configured Symfony according to its instructions.I have a page variable, and an orders array. dump works on page, but not orders. When I call it on orders, I get a white screen - no php er

Java RTF Parser

Java RTF Parser

Does anyone know of a robust RTF parser I can use in Java? I need to extract plain text, including international text. It would also be nice to extract embedded images and files. It could also be a C++ or other library that I can easily

Why Does ItemsControl Not Use My ItemTemplate?

Why Does ItemsControl Not Use My ItemTemplate?

I am able to use an ItemTemplate within an ItemsControl to render items in a specific format. However, if one of the items within the ItemsControl happens to be, say, a TextBox, that TextBox is rendered rather than an instance of the Items

How to add global `AuthorizeFilter` or `AuthorizeAttribute` in ASP.NET Core?

How to add global `AuthorizeFilter` or `AuthorizeAttribute` in ASP.NET Core?

In ASP.NET MVC 4 and below we just add the following in Global.asax:GlobalFilters.Filters.Add(new AuthorizeAttribute() { Roles = "Admin, SuperUser" });Any idea how to do this in ASP.NET Core MVC? 1:From docs: You can register a filter g

How to convert a dynamic dll to static lib?

How to convert a dynamic dll to static lib?

I write a program helloworld.exe; it depends on a.dll. I don't have the source code of the a.dll, which is a dynamic dll. How can i change it to static library, so I can link it into helloworld.exe? 1:Sorry, but there's no direct way to

Python: Is it a good idea to dynamically create variables?

Python: Is it a good idea to dynamically create variables?

I recently found out how to dynamically create variables in python through this method:vars()['my_variable'] = 'Some Value'Thus creating the variable my_variable.My question is, is this a good idea? Or should I always declare the variables

How to get the least number after deleting k digits from the input number

How to get the least number after deleting k digits from the input number

For example, if the input number is 24635, the least number is 23 after deleting any 3 digits.It's not the same as taking the two smallest digits, because the order of the digits must be maintained. 1:Deleting k digits means keeping n -

Provide a hint in bulk upserts

Provide a hint in bulk upserts

Is there a way to provide a hint for an upsert in a bulk in MongoDB / Python?I would like to add a hint in a query like: Bulk.find().upsert().update().I have tried:Bulk.find().hint().upsert().update(): .hint() method does not exist.Bulk.fin

What is the underscore function for?

What is the underscore function for?

I've been using underscore as a collection of statics.What is the underscore function for:var _ = function(obj) { if (obj instanceof _) return obj; if (!(this instanceof _)) return new _(obj); this._wrapped = obj; };What is an exa

C# - how do I refresh DataGridView after removing rows

C# - how do I refresh DataGridView after removing rows

In my code I need to remove rows from the DataGridView after a recurring interval, and so I call the following function when a timer expires:private void removeRows(DataGridView dgv) { foreach (DataGridViewRow row in dgv.Rows) {

Are concurrent operations possible with Git repositories?

Are concurrent operations possible with Git repositories?

There are two scenarios that I'm interested in.The repository is shared and two users want to push changes to it at the same timeI want to schedule a nightly or weekly "gc" using a cron job. It runs and someone wants to push or clone during

How to pass List in Redirecttoaction

How to pass List in Redirecttoaction

I want to pass more then one parameter from RedirectToAction methodhow can I pass?My One Action Method [HttpPost, ActionName("SelectQuestion")] public ActionResult SelectQuestion(string email,List model) { List fadd = new List(

Circular Type References in TypeScript

Circular Type References in TypeScript

I am new to typescript and am trying to understand how I can setup a circular reference between two types. The reference need not be a full code reference, simply the interfaces, but with interfaces defined in separate files. For example,

Java two varargs in one method

Java two varargs in one method

Is there any way in java, to create a method, which is expecting two different varargs?I know, with the same object kind it isn't possible because the compiler does'nt know where to start or to end. But why it also is'nt possible with to di

Loading XAML at runtime using the MVVM pattern in WPF

Loading XAML at runtime using the MVVM pattern in WPF

This is a question that extends from the originally posted here:Link to loading-xaml through runtimeI'm working on a WPF MVVM application that loads XAML content dynamically from an external source, very similar as the answer in the post ab

Exposing the indexer / default property via COM Interop

Exposing the indexer / default property via COM Interop

I am attempting to write a component in C# to be consumed by classic ASP that allows me to access the indexer of the component (aka default property).For example:C# component:public class MyCollection { public string this[string key] {