w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Does type erasure of Java Generics cause full type casting?
The type-checking is done at compile-time. If you do this: List<Cheesecake> list = new ArrayList<Cheesecake>(); then the generic types can be checked at compile-time. This erases to: List list = new ArrayList(); which is no different to any other up-cast (e.g. Object o = new Integer(5);).

Categories : Java

Processing Java Error: The nested type (Node) cannot hide an enclosing type
Check if your tab or sketch name is the same as program's inner class name. Change the name of your tab/sketch and you'll be fine. Rename your sketch (foo.pde) which is also the name of the tab to something other than the class name. The main sketch in processing cannot have a nested class with the same name, other sketches (other tabs) can have classes that are the same name as the tab.

Categories : Java

Nested
    - display full path of structured list?
Not quite what your after, but close. Try this: <style> ol { list-style-type:upper-latin; } </style> That will print your index item labels as letters. If you wanted something like "1a...2a...2a.a" you'd have to use either javascript / server side code to build up your list in a loop programatically.

Categories : Jquery

How to populate data into a nested table in Oracle when the nested table is within a record type
This document: http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/composites.htm#CIHIEBJC describes how to work with collection types in PL/SQL: Basic example: DECLARE TYPE N_TYPE IS TABLE OF VARCHAR2(350); TYPE TYPE1 IS RECORD ( FIELD_1 VARCHAR2(100) , FIELD_2 VARCHAR2(30) , FIELD_3 N_TYPE); v_n n_type; v_type1 type1; BEGIN v_n := n_type(); -- initialize an empty collection v_n.extend( 3 ); -- add 3 elements to the table v_n( 1 ) := 'First string '; v_n( 2 ) := 'Second string '; v_n( 3 ) := 'Third string '; v_n.extend; -- add 1 element at the end of the table v_n( v_n.last ) := 'Next string'; --assign the table to the field_3 of the record v_type1.field_3 := v_n; -- check values FOR i in v_typ

Categories : Oracle

Mobile Safari - How to Default to Full Numeric Keypad for Decimal Entry w/o type="number", or disable Safari input type="number" correction
I know this is old but I see this being asked quite a lot. To prevent validation of the number input type (and other types) you can use the novalidate attribute on the <form> element: <form novalidate> <input type="number" name="test" class="answers" id="mileage" value="0.0" maxlength=5> </form> You'll still get the numeric keyboard but it won't force the user to enter numbers only.

Categories : Javascript

Extracting full name from Person or Group type?
With Sharepoint 2010 you can choose how the workflow will return it (Name, email, username, etc), but not with Sharepoint 2007. So I think you're stuck with domain/username until you upgrade Sharepoint.

Categories : Sharepoint

Can I forward-declare a typedef when its full type will have an as-yet-unknown form?
i think it's hard to do so, because typedef library::type<blah>::whatever Bar; requires the full definition of class library::type, it's not the forward-declare that can solve.

Categories : C++

Creating nested Map with different type
Why do you expect it to work? You've provided only key without value: val key = Map(1->2) val mymap = Map("name"->"somename", key) Perhaps you wanted to combine two maps? This can be done with: val mymap = Map("name"->"somename") ++ Map(1->2) // scala.collection.immutable.Map[Any,Any] = Map(name -> somename, 1 -> 2)

Categories : Scala

Extract nested type without passing it twice?
I don't think you can derive the type directly like you want. However, you can hide a type from the signature by making it a type variable instead. trait Overall[T] { type M <: Meta[T] def review(t:T): M } case class Helper extends Overall[Int] { override type M = Meta[Int] def review(t: Int): Meta[Int] = null; } You'll still have to declare it in subclasses, but not when using the class.

Categories : Scala

Multiple nested attributes of the same type
Something like this should work: class Symbol < ActiveRecord::Base has_many :creators, class_name: "User", foreign_key: "created_by_id" has_many :updaters, class_name: "User", foreign_key: "updated_by_id" belongs_to :creator, class_name: "User" end then use: symbol | symbol.creator.name | symbol.updater.name still, I am trying this on my app, so I am not sure 100% about it. EDIT class Symbol < ActiveRecord::Base has_one :creator, :class_name => User, :foreign_key => 'created_by_id' has_one :updater, :class_name => User, :foreign_key => 'updated_by_id' end

Categories : Ruby

not_analyzed for a nested type on ElasticSearch?
The following is the json mapping that you should be using for the tags nested field: { "type" : { "properties" : { "tags" : { "type": "nested", "properties" : { "tag" : { "type": "multi_field", "fields" : { "tag": {"type" : "string", "index" : "analyzed", "store": "yes"}, "untouched" : {"type" : "string", "index" : "not_analyzed"} } }, "tag_url" : { "type": "multi_field", "fields" : { "tag_url": {"type" : "string", "index" : "analyzed", "store": "yes"},

Categories : Elasticsearch

Specialization of a template to a nested class type
There's some complicated declaration ordering here: template <class T> struct Trait; template <class T> struct X {}; template<class T> class TraitUser:public X<typename Trait<T>::Type> { //Trait<T> gets used in here }; class A { private: class B; }; template<> struct Trait<A::B> { typedef int Type; }; class A::B : public TraitUser<B> {};

Categories : C++

C++ accessing nested type using alias (using vs typedef)
This seems to be a GCC 4.7 bug. Here is my test to compile your code, and it works using gcc 4.8.1 So as the spec says this: using q_t = Q<T>; // is equivalent to this typedef Q<T> q_t;

Categories : C++

ElasticSearch : search and return nested type
Sadly you can't get back only parts of the a document. If the document matches a query, you will get the whole thing back; the root and all nested docs. If you want to get only parts back, then you could look at using parent/child docs. Also you aren't seeing any hits as you have a small syntax error in the nested query. Look closely at the field name: { "from": 0, "size": 10, "query" : { "nested" : { "path" : "pages", "score_mode" : "avg", "query" : { "term" : { "pages.tags.name" : "japonese" } } } } } If you need help with parent child docs feel free to ask! (There should be examples if you do a google search) Good luck!

Categories : Elasticsearch

error: has incomplete type|: within a nested class?
Essentially what you're trying to do is: class A { A a; }; int main() { A a; return 0; } (You can see that this produces the same error here) This is infinite recursion, you're defining a type using itself. Take a pointer instead, like so: class A { A* a; }; int main() { A a; return 0; } As you can see here this compiles.

Categories : C++

Why does my type check on nested collection fails in this case?
If you want to detect any Map: for(element <- maps) { if(element.isInstanceOf[Map[_, _]]) { print("this is a collection instance ") } println(element) } But this didn't work because you check whole tuple ("s" -> 2 etc.) instead of second element of tuple: for(element <- maps) { if(element._2.isInstanceOf[Map[_, _]]) { print("this is a collection instance ") } println(element._2) } Or with pattern matching: for((_, v) <- maps) { if(v.isInstanceOf[Map[_, _]]) { print("this is a collection instance ") } println(v) } Or with even more pattern matching: maps foreach { case (_, v: Map[_, _]) => println("this is a collection instance " + v) case (_, v) => println(v) }

Categories : Scala

Java nested generic class with only one type parameter
The generic type parameter Pair<T> is not valid; you just need to declare <T> and use it when implementing the interface. // Just <T> here; Added missing (2nd) '>' class PairStream<T> implements Stream<Pair<T>> { public Pair<T> get() { /* ... */ } }

Categories : Java

Android Arbitrarily Nested ListView Type Menu
Look into Wizard Pager to see if this does what you need. Otherwise, you could implement it as an activity that takes a tree and has an adapter that shows its current level, and then passes subtrees to new activities via intent extras. Or you could implement it as a Fragment that does approximately the same thing and stay in the same activity and just do FragmentTransactions.

Categories : Android

Python Deeply Nested Dictionary of a Specific Type
This approach is similar to your first example, except you can specify whatever depth you want without a lot of typing. from collections import defaultdict def nested_default_dict(num_keys, init_func): if num_keys == 1: return defaultdict(init_func) else: return defaultdict(lambda: nested_default_dict(num_keys-1, init_func)) foo = nested_default_dict(5, set) foo[1][2][3][4][5].add("Hello World") foo[1][2][3][4][5].add("Lorem Ipsum") foo[1][2][3][4][5].add("Dolor sit amet") print foo[1][2][3][4][5] bar = nested_default_dict(3, list) bar[4][8][15].append(16) bar[4][8][15].append(23) bar[4][8][15].append(42) print bar[4][8][15] Result: set(['Dolor sit amet', 'Lorem Ipsum', 'Hello World']) [16, 23, 42] One drawback is that the dicts don't look very pretty when

Categories : Python

what is the difference between nested table and object type in oracle?
An object type/abstract data type/record is like a row or tuple: it contains an ordered set of attributes. To populate address you must set one and only one value for each of homeno, street, and city. A nested table is like a table: it contains an unordered set of rows. Usually a nested table only contains a set of simple values, like a number. In your example, it is a set of object types. To populate deposits you can create any number of deposit_ty. For example: declare customer customer_ty := customer_ty( 'ABC', 'Name', address_ty('123', 'fake street', 'Springfield'), sysdate, deposit_ntty( deposit_ty(1, null, 100, 1), deposit_ty(2, null, 200, 2) ) ); begin null; end; Also, you probably want to use a VARCHAR2 instea

Categories : Oracle

vim: display the type of C aggregate (struct/union) members, even when nested
If i'm working on a project with several nested structs i add preview to the completeopt option. In combination with the excellent omnicppcomplete plugin a tiny scratch window pops up if you select an entry in the completion menu. That scratch window shows some properties of the selected tag. Among other things it contains the search pattern for the tag which in case of a struct member usually contains its datatype.

Categories : C

Static nested class as generic type bound doesn't work
First, you don't have to static-import the class. Just qualify the reference to your inner classes: public abstract class AbstractContainer<ElementType extends AbstractContainer.AbstractElement> { and public class ConcreteContainer extends AbstractContainer<ConcreteContainer.ConcreteElement> When compiling with Java 1.6, I don't see your compiler error. But I do see it when compiling with 1.7. As it happens, fully-qualifying AbstractElement when declaring ConcreteElement seems to satisfy the compiiler: public class ConcreteContainer extends AbstractContainer<ConcreteContainer.ConcreteElement> { // fully qualify here public static class ConcreteElement extends AbstractContainer.AbstractElement { }

Categories : Java

Cannot deserialize the current JSON array (e.g. [1,2,3]) into type with complex and nested objects
According to your JSON data, the objects that you need to map to have to look like this (unless you have your own JsonDeserializer of course): public class Banner { public string LocationCodeString { get; set; } public int LocationCodeInt { get; set; } public string MediaUrl { get; set; } } public class CampaignWithChosenProposal { public List<Banner> Banners { get; set; } public string Code { get; set; } public string CustomerInstruction { get; set; } public string InfoLink { get; set; } public string LobbySubTitle { get; set; } public string LobbyTitle { get; set; } public string MoreText { get; set; } public int NumOfColumns { get; set; } public int NumOfRows { get; set; } public string OriginString { get; set; } public int

Categories : C#

Reading nested configuration section element of same type from web.config file
My advice? Ditch configuration manager and load the config into an XDocument. Say you have a config file shown below: <Settings> <ApplicationSettings> <AppSetting1 Value="Test1" /> <AppSetting2 Value="Test2" /> </ApplicationSettings> <DeviceSettings> <DeviceSetting1 Value="Test3" /> <DeviceSetting2 Value="Test4" /> </DeviceSettings> </Settings> To get a value from it you can load the config into an XDocument: XDocument xdoc = XDocument.Load(@"Path ofile.xml"); Then: String test1 = xdoc.Element("Settings").Element("ApplicationSettings").Element("Appsetting1").Attribute("Name").Value;

Categories : C#

MongoDB - How do I change the type of an string found in an array nested within a subdocument
Your code is assuming that the find returns the embedded assignment objects rather than the object. Change : obj.as_total_hours = parseInt(obj.as_total_hours); db.providers.save(obj); to obj.assignments.assignment.forEach(function(obj) { obj.as_total_hours = parseInt(obj.as_total_hours); }) db.providers.save(obj); You could also change the {$exists:true} to {$type: 2} (or combine them) so that the query only finds strings.

Categories : Mongodb

Recovering a singleton instance via reflection from sealed super trait, when type is nested
This is not an answer yet, but maybe a work-around, in case it helps anyone. It worked for me the first time but not the second time, because isn't science all about reproducing the results?: scala> res22.head res24: reflect.runtime.universe.Symbol = object Bar scala> .asClass res25: reflect.runtime.universe.ClassSymbol = object Bar scala> .isModule isModule isModuleClass scala> .isModuleClass res26: Boolean = true scala> res25.companionSymbol res27: reflect.runtime.universe.Symbol = object Bar scala> .isModule res28: Boolean = true And let me just check: scala> cm reflectModule res27.asModule res30: reflect.runtime.universe.ModuleMirror = module mirror for Foo.Bar (bound to null) scala> .instance res31: Any = Bar Copying every command exactly

Categories : Scala

Java nested wildcard bound types multiple times or as generic type parameter
If I understand what you intend to do, it would change the semantics of your class. Right now in your current class, you could have for example: class T1 extends Type {} class T2 extends Type {} class C1 extends Criteria<T1> {} class C2 extends Criteria<T2> {} class C3 extends Criteria<T2> {} class F1 extends Filter<C1> {} class Manager extends AbstractManager<F1> {} And then, even though Manager is based on F1, some user code would be perfectly legal if it did: Manager m = new Manager(); C2 c2 = new C2(); C3 c3 = new C3(); m.setCriteria(Arrays.asList(new C2[]{c2}); m.doSomethingWithCriteria(Arrays.asList(new C3[]{c3}); I don't know if it was your intent, but it is legal (from a compiler point of view). However, if you were somehow able to name that wild

Categories : Java

Struts 1.1 nested and in combination
Use <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> and the code will look like <c:choose> <c:when test="${element.method1 == true}"> <c:choose> <c:when test="${element.method2 == true}"> <span style="color:green;"><c:out value="${element.prop1}/></span> </c:when> <c:otherwise> <span style="color:red;"><c:out value="${element.prop1}/></span> </c:otherwise> </c:choose> </c:when> <c:otherwise> <span style="color:black;"><c:out value="${element.prop1}/></span> </c:otherwise> </c:choose>

Categories : Java

C++: "Invalid covariant return type" errors in nested classes with methods returning template-based objects
The function with the signature B::test(void) returns an object of type Q<A>, while C::test(void) (which is the same signature, so you're overwriting the function) returns Q<B>. I think that is impossible. As far as I know it is impossible to overload a function by return type and overwrites of parent functions need to stick to the same return type. From the Standard §10.3/7 The return type of an overriding function shall be either identical to the return type of the overridden function or covariant with the classes of the functions. If a function D::f overrides a function B::f, the return types of the functions are covariant if they satisfy the following criteria: both are pointers to classes, both are lvalue references to classes, or both are rvalue references

Categories : C++

Node.js` "http.get" doesn't return full response body to a browser but just a piece of tag. How to get full response?
Your data event is firing multiple times, but you can only "end" your output once... you should probably refactor your handler as follows... // In /myapppath http.get("http://stackoverflow.com/", function(result) { var responseParts = []; result.setEncoding('utf8'); result.on("data", function(chunk) { //add this chunk to the output to send responseParts.push(chunk); }); result.on("end", function(){ //now send your complete response res.end(responseParts.join('')); }); });

Categories : Node Js

Generic Class with Static Nested Class of the Same Type
You could declare the type of stctype as <? extends T>. private final Class<? extends T> stcType; This will ensure that the stctype is able to handle T or any subclass of T. In order to get rid of the compiler error, you can now safely cast the helper.crtObject().getClass(); to Class<? extends T> as follows: stcClass = (Class<? extends T>) helper.crtObject().getClass();

Categories : Java

Mongo/DataNucleus/JPA with embedded type query gives: Cannot find type of (part of) ... since symbol has no type; implicit variable?
FINE: Compilation of filter to be evaluated completely in-datastore was impossible : Invoke expression is not supported by this mapper so it is not currently implemented to convert JPQL "collField.contains(val)" (the equivalent of what you typed in for your query) into a MongoDB query, hence cant evaluate it in the datastore. Since you know what it needs converting into, you can easily enough get the code for the DataNucleus MongoDB plugin and find class QueryToMongoDBMapper and contribute support for that particular query.

Categories : Mongodb

JQuery selector for finding a nested span within a nested class is not working
I don't see any problem with your code at the moment, let's reformat it a bit: var tabs = $('.collapse').not('.in'); console.log("tabs.length: " + tabs.length); tabs.each(function () { var $this = $(this), thisErrors = $this.find('.field-validation-error'), thisId = '#' + $this.attr('id'); console.log("current tab ID: " + thisId); console.log("number of errors: " + thisErrors.length); if (thisErrors.length) { $(thisId).collapse('show'); } }); Or working fiddle: http://jsfiddle.net/Rq8y7/ Does it work now? And what's the debug message in console after you run above code?

Categories : Jquery

How can I bind data from nested List<> objects to nested ListView controls?
You can bind the datasource of your inner list view to a property of the items bound to your outer listview. However, to do that the inner listview as to be in the itemtemplate of the outer listview. See the code below and note the DataSource='<%# Eval("Labels_color") %>' attribute for the inner list view. <asp:ListView ID="ListView_Orp_Results" runat="server" ItemPlaceholderID="itemPlaceholder"> <LayoutTemplate> <div id="outer_result_container"> <div id="itemPlaceholder" /> </div> </LayoutTemplate> <ItemTemplate> <div id="result_photo">...</div> <div id="result_category">...</div> <div id="result_detector">...</div> <div id="inner_result_container" runat="server"

Categories : Asp Net

how does Cpython implement its type Objects, i.e. type's type is always type?
The code that defines PyType_Type.ob_type = &PyType_Type involves a couple of indirections. It all starts in the function _Py_ReadyTypes() when it calls PyType_Ready(&PyType_Type). Before the function is called, the members tp_base and ob_type are both NULL. The function first sets type->tp_base to &PyBaseObject_Type (which is object in Python space) and then sets type->ob_type = PyBaseObject_Type.ob_type. The code uses Py_TYPE() which is just a macro for ob->ob_type. Since the type of object is type the code sets the type of type to type. Now you have: >>> type.__bases__ (<class 'object'>,) >>> type(object) <class 'type'> >>> type(type(object)) <class 'type'> The definition makes type an instance of object plus itself a

Categories : Python

Using nested type declared in a generic class within the generic interface that the class is implementing
The only way that you can make this work is to define the procedural type outside of the implementing class. Like this: type IMyIntf<A> = interface; TMyProc<A> = reference to procedure(Intf: IMyIntf<A>); IMyIntf<A> = interface procedure Foo(Proc: TMyProc<A>); end; TMyClass<A> = class(TInterfacedObject, IMyIntf<A>) procedure Foo(Proc: TMyProc<A>); end;

Categories : Delphi

Type 'MyClass' cannot inherit from a type that is not marked with DataContractAttribute or SerializableAttribute. Consider marking the base type
One approach would be to override it: public new byte[] SomeByteArray { get; set; } and then you could ignore it with the IgnoreDataMember attribute.

Categories : C#

Parsing a flattly-written nested text template into a usable nested data structure for N levels
Replaces each ">" with a tab. Output is pretty much exactly as your brute force output. (file.txt is your template file as above) test = open("file.txt", "r") for line in test: print line.replace(">", " ") #print line

Categories : Python

MySQL - Reference main query in nested select (need to be nested)
This cannot work. SELECT clause is always evaluated at the end of the execution chain, @teamg_id variable will always be 0 in the nested subquery. Try this query, it is not tested (I can't see your data, playing whith sample data always helps), but probably it gives desired results. I commented out some parts and add one join condition. /* SET @teamg_id := 0; */ SELECT /* @teamg_id := player.team_id, */ player.team_id AS player_team, event.local_team_id AS local_team, event.visitor_team_id AS visitor_team, action.unique_id AS action_id, action.player_id AS player_id, player.name AS player_name, playerindex.rank AS player_pos, playerindex.ses_var_nest AS ses_var_nest FROM er_players player

Categories : Mysql

nested json with jQuery: create List of nested item
Your problem is that institut is an array containing a single object, so you can reference that single object using institut[0]. This will work: $.each(data.fakultaeten, function (key, value) { var mother = "<li id='first'>" + value.name + "<ul>"; $.each(value.institut[0], function (key1, value1) { alert(key1); }); }); Here is a working example

Categories : Jquery



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.