Search Results

Search found 362 results on 15 pages for 'semantics'.

Page 1/15 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • initializer_list and move semantics

    - by FredOverflow
    Am I allowed to move elements out of a std::initializer_list<T>? #include <initializer_list> #include <utility> template<typename T> void foo(std::initializer_list<T> list) { for (auto it = list.begin(); it != list.end(); ++it) { bar(std::move(*it)); // kosher? } } Since std::intializer_list<T> requires special compiler attention and does not have value semantics like normal containers of the C++ standard library, I'd rather be safe than sorry and ask.

    Read the article

  • C#: Semantics for generics?

    - by Rosarch
    I have a list: private readonly IList<IList<GameObjectController>> removeTargets; PickUp inherits from GameObjectController. But when I try this: public IList<PickUp> Inventory // ... gameObjectManager.MoveFromListToWorld(this, user.Model.Inventory); I get a compiler error: cannot convert from 'System.Collections.Generic.IList' to 'System.Collections.Generic.IList' Why does this occur? Shouldn't this be fine, since PickUp is a subclass of GameObjectController? Do I need something like Java's Map<E extends GameObjectController>? Earlier, I was having a similar problem, where I was trying to implicitly cast inventory from an IList to an ICollection. Is this the same problem?

    Read the article

  • Javascript code semantics

    - by Mohammad
    if(myVar = img.parent('a').length > 0){ var Y = 1; }else{ var Y = 2; } When I run this code myVar (being announced for the first time) takes the value of img.parent('a').length > 0 and becomes either false or true depending on the case. First Question: Is this a correct way of defining myVar? Second Question: Am I defining Y for the second time? Is my second 'var' excess? i.e. should i just write Y = 2;

    Read the article

  • Subterranean IL: Exception handler semantics

    - by Simon Cooper
    In my blog posts on fault and filter exception handlers, I said that the same behaviour could be replicated using normal catch blocks. Well, that isn't entirely true... Changing the handler semantics Consider the following: .try { .try { .try { newobj instance void [mscorlib]System.Exception::.ctor() // IL for: // e.Data.Add("DictKey", true) throw } fault { ldstr "1: Fault handler" call void [mscorlib]System.Console::WriteLine(string) endfault } } filter { ldstr "2a: Filter logic" call void [mscorlib]System.Console::WriteLine(string) // IL for: // (bool)((Exception)e).Data["DictKey"] endfilter }{ ldstr "2b: Filter handler" call void [mscorlib]System.Console::WriteLine(string) leave.s Return } } catch object { ldstr "3: Catch handler" call void [mscorlib]System.Console::WriteLine(string) leave.s Return } Return: // rest of method If the filter handler is engaged (true is inserted into the exception dictionary) then the filter handler gets engaged, and the following gets printed to the console: 2a: Filter logic 1: Fault handler 2b: Filter handler and if the filter handler isn't engaged, then the following is printed: 2a:Filter logic 1: Fault handler 3: Catch handler Filter handler execution The filter handler is executed first. Hmm, ok. Well, what happens if we replaced the fault block with the C# equivalent (with the exception dictionary value set to false)? .try { // throw exception } catch object { ldstr "1: Fault handler" call void [mscorlib]System.Console::WriteLine(string) rethrow } we get this: 1: Fault handler 2a: Filter logic 3: Catch handler The fault handler is executed first, instead of the filter block. Eh? This change in behaviour is due to the way the CLR searches for exception handlers. When an exception is thrown, the CLR stops execution of the thread, and searches up the stack for an exception handler that can handle the exception and stop it propagating further - catch or filter handlers. It checks the type clause of catch clauses, and executes the code in filter blocks to see if the filter can handle the exception. When the CLR finds a valid handler, it saves the handler's location, then goes back to where the exception was thrown and executes fault and finally blocks between there and the handler location, discarding stack frames in the process, until it reaches the handler. So? By replacing a fault with a catch, we have changed the semantics of when the filter code is executed; by using a rethrow instruction, we've split up the exception handler search into two - one search to find the first catch, then a second when the rethrow instruction is encountered. This is only really obvious when mixing C# exception handlers with fault or filter handlers, so this doesn't affect code written only in C#. However it could cause some subtle and hard-to-debug effects with object initialization and ordering when using and calling code written in a language that can compile fault and filter handlers.

    Read the article

  • Adding VFACE semantic causes overlapping output semantics error

    - by user1423893
    My pixel shader input is a follows struct VertexShaderOut { float4 Position : POSITION0; float2 TextureCoordinates : TEXCOORD0; float4 PositionClone : TEXCOORD1; // Final position values must be cloned to be used in PS calculations float3 Normal : TEXCOORD2; //float3x3 TBN : TEXCOORD3; float CullFace : VFACE; // A negative value faces backwards (-1), while a positive value (+1) faces the camera (requires ps_3_0) }; I'm using ps_3_0 and I wish to utilise the VFACE semantic for correct lighting of normals depending on the cull mode. If I add the VFACE semantic then I get the following errors: error X5639: dcl usage+index: position,0 has already been specified for an output register error X4504: overlapping output semantics Why would this occur? I can't see why there would be too much data.

    Read the article

  • How to make other semantics behave like SV_Position?

    - by object
    I'm having a lot of trouble with shadow mapping, and I believe I've found the problem. When passing vectors from the vertex shader to the pixel shader, does the hardware automatically change any of the values based on the semantic? I've compiled a barebones pair of shaders which should illustrate the problem. Vertex shader : struct Vertex { float3 position : POSITION; }; struct Pixel { float4 position : SV_Position; float4 light_position : POSITION; }; cbuffer Matrices { matrix projection; }; Pixel RenderVertexShader(Vertex input) { Pixel output; output.position = mul(float4(input.position, 1.0f), projection); output.light_position = output.position; // We simply pass the same vector in screenspace through different semantics. return output; } And a simple pixel shader to go along with it: struct Pixel { float4 position : SV_Position; float4 light_position : POSITION; }; float4 RenderPixelShader(Pixel input) : SV_Target { // At this point, (input.position.z / input.position.w) is a normal depth value. // However, (input.light_position.z / input.light_position.w) is 0.999f or similar. // If the primitive is touching the near plane, it very quickly goes to 0. return (0.0f).rrrr; } How is it possible to make the hardware treat light_position in the same way which position is being treated between the vertex and pixel shaders? EDIT: Aha! (input.position.z) without dividing by W is the same as (input.light_position.z / input.light_position.w). Not sure why this is.

    Read the article

  • HTML5 Semantics - H1 or H2 for ARTICLE titles in a SECTION

    - by Matt
    It's my understanding (based from this chapter of Dive into HTML5: http://goo.gl/9zliD) that it can be considered semantically appropriate to use H1 tags in multiple areas of the page, as a method of setting the most important title for that particular content. If I'm using this methodology, and I have a SECTION which I've assigned an H1 of 'Articles', should I use H1 or H2 to define the titles for ARTICLEs in that SECTION? This is a bit confusing to me as the article titles are the most important heading for their ARTICLE, but are also 'children' of the SECTION's title. Example code: <section class="article-list"> <header> <h1>Articles</h1> </header> <article> <header> <h2>Article Title</h2> <time datetime="201-02-01">Today</time> </header> <p>Article text...</p> </article> <article> <header> <h2>Article Title</h2> <time datetime="2011-01-31">Yesterday</time> </header> <p>Article text...</p> </article> <article> <header> <h2>Article Title</h2> <time datetime="2011-01-30">The Day Before Yesterday</time> </header> <p>Article text...</p> </article> </section>

    Read the article

  • Search Engine Semantics and Website SEO

    Over the past few years, there's been a great deal of emphasis on Search Engine Optimization (SEO) and using it as a "silver bullet" to drive traffic to your website. Clients will frequently come to us for optimization services with the idea that afterwards they will see a huge traffic spike and products will fly off the shelves.

    Read the article

  • Search Engine Semantics and Website SEO

    Over the past few years, there's been a great deal of emphasis on Search Engine Optimization (SEO) and using it as a "silver bullet" to drive traffic to your website. Clients will frequently come to us for optimization services with the idea that afterwards they will see a huge traffic spike and products will fly off the shelves.

    Read the article

  • Is OO design's strength in semantics or encapsulation?

    - by Phil H
    Object-oriented design (OOD) combines data and its methods. This, as far as I can see, achieves two great things: it provides encapsulation (so I don't care what data there is, only how I get values I want) and semantics (it relates the data together with names, and its methods consistently use the data as originally intended). So where does OOD's strength lie? In constrast, functional programming attributes the richness to the verbs rather than the nouns, and so both encapsulation and semantics are provided by the methods rather than the data structures. I work with a system that is on the functional end of the spectrum, and continually long for the semantics and encapsulation of OO. But I can see that OO's encapsulation can be a barrier to flexible extension of an object. So at the moment, I can see the semantics as a greater strength. Or is encapsulation the key to all worthwhile code?

    Read the article

  • Is there any killer application for Ontology/semantics/OWL/RDF yet?

    - by narnirajesh
    Hi Guys, I got interested in semantic technologies after reading a lot of books, blogs and articles on the net saying that it would make data machine-understandable, allow intelligent agents make great reasoning, automated & dynamic service composition etc.. I am still reading the same stuff from 2 years. The number of articles/blogs/semantic-conferences have increased considerably. But I am still unable to see any killer-application. Why is it so? Or is there some application/product (commercial/open-source) already existing, which actually is doing all that being boasted of? To put it more precisely, is there any product that leverages semantic technologies (esp RDF/OWL/SPARQL) and is delivering functionality/performance/maintainability, which would not have been possible with the existing (no-semantic) technologies? Some product that is completely dependent on semantic technologies and really adds value to the customers and generating revenues?

    Read the article

  • semantics in perl

    - by clb
    i am new to perl and was asked to do a documentation on the semantics of perl.i did find some information but i cannot understand them.can some one explain it to me ion a simple way?a very simple explanation is enough.no need to go to deapth. explain how axiomatic,operatioonal and denotational semantics are implemented in perl thank you very much:)

    Read the article

  • Function-Local Static Const variable Initialization semantics.

    - by Hassan Syed
    The questions are in bold, for those that cannot be bothered reading a question in depth. This is a followup to this question. It is to do with the initialization semantics of static variables in functions. Static variables should be initialized once, and their internal state might be altered later - as I (currently) do in the linked question. However, the code in question does not require the feature to change the state of the variable later. Let me clarrify my position, since I don't require the string object's internal state to change. The code is for a trait class for meta programming, and as such would would benifit from a const char * const ptr -- thus Ideally a local cost static const variable is needed. My educated guess is that in this case the string in question will be optimally placed in memory by the link-loader, and that the code is more secure and maps to the intended semantics. This leads to the semantics of such a variable "The C++ Programming language Third Edition -- Stroustrup" does not have anything (that I could find) to say about this matter. All that is said is that the variable is initialized once when the flow of control of the thread first reaches the code. This leads me to ponder if the following code would be sensible, and if not what are the intended semantics ?. #include <iostream> const char * const GetString(const char * x_in) { static const char * const x = x_in; return x; } int main() { const char * const temp = GetString("yahoo"); std::cout << temp << std::endl; const char * const temp2 = GetString("yahoo2"); std::cout << temp2 << std::endl; } The following compiles on GCC and prints "yahoo" twice. Which is what I want -- However it might not be standards compliant (which is why I post this question). It might be more elegant to have two functions, "SetString" and "String" where the latter forwards to the first. If it is standards compliant does someone know of a templates implementation in boost (or elsewhere) ?

    Read the article

  • list or container O(1)-ish insertion/deletion performance, with array semantics

    - by Chris Kaminski
    I'm looking for a collection that offers list semantics, but also allows array semantics. Say I have a list with the following items: apple orange carrot pear then my container array would: container[0] == apple container[1] == orangle container[2] == carrot Then say I delete the orange element: container[0] == apple container[1] == carrot I don't particularly care if sort order is maintained, I'd just like the array values to function as accelerators to the list items, and I want to collapse gaps in the array without having to do an explicit resizing.

    Read the article

  • Using JavaCC to infer semantics from a Composite tree

    - by Skice
    Hi all, I am programming (in Java) a very limited symbolic calculus library that manages polynomials, exponentials and expolinomials (sums of elements like "x^n * e^(c x)"). I want the library to be extensible in the sense of new analytic forms (trigonometric, etc.) or new kinds of operations (logarithm, domain transformations, etc.), so a Composite pattern that represent the syntactic structure of an expression, together with a bunch of Visitors for the operations, does the job quite well. My problem arise when I try to implement operations that depends on the semantics more than on the syntax of the Expression (like integrals, for instance: there are a lot of resolution methods for specific classes of functions, but these same classes can be represented with more than a single syntax). So I thought I need something to "parse" the Composite tree to infer its semantics in order to invoke the right integration method (if any). Someone pointed me to JavaCC, but all the examples I've seen deal only with string parsing; so, I don't know if I'm digging in the right direction. Some suggestions? (I hope to have been clear enough!)

    Read the article

  • Using JavaScript for basic HTML layout

    - by Slobaum
    I've been doing HTML layout as well as programming for many years and I'm seeing a growing issue recently. Folks who primarily do HTML layout are becoming increasingly more comfortable using JavaScript to solve basic page layout problems. Rather than consider what HTML is capable of doing (to hit their target browsers), they're slapping on bloated JS frameworks that "fix" fairly basic problems. Let's get this out of the way right here: I find this practice annoying and often inconsiderate of those with special accessibility needs. Unfortunately, when you try to tell these folks that what they're doing isn't semantic, ideal, or possibly even a good idea, they always counter with the same old arguments: "JavaScript has a market saturation of 98%, we don't care about the other 2%." or "Who doesn't have JavaScript enabled these days?" or simply "We don't care about those users." I find that remarkably short-sighted. I would really like the opinion of the community at large. What do you think, am I holding too fast to a dying ideal? I am willing to accept that, but would like to be given good arguments as to why I should disregard 2%+ of my user base (among others). Is JavaScript's prevalence a good excuse to use a programmatic language to do basic layout, thus mucking up your behavior and layout? jQuery and similar "behavior" based frameworks are blurring the lines, especially for those who don't realize the difference. Honestly (and probably most importantly), I would like some "argument ammo" to use against these folks when the "it's the right way to do it" argument is unacceptable. Can you cite sources outlining your stance, please? Thanks everybody, please be civil :)

    Read the article

  • How to create a Semantic Network like wordnet based on Wikipedia?

    - by Forbidden Overseer
    I am an undergraduate student and I have to create a Semantic Network based on Wikipedia. This Semantic Network would be similar to Wordnet(except for it is based on Wikipedia and is concerned with "streams of text/topics" rather than simple words etc.) and I am thinking of using the Wikipedia XML dumps for the purpose. I guess I need to learn parsing an XML and "some other things" related to NLP and probably Machine Learning, but I am no way sure about anything involved herein after the XML parsing. Is the starting step: XML dump parsing into text a good idea/step? Any alternatives? What would be the steps involved after parsing XML into text to create a functional Semantic Network? What are the things/concepts I should learn in order to do them? I am not directly asking for book recommendations, but if you have read a book/article that teaches any thing related/helpful, please mention them. This may include a refernce to already existing implementations regarding the subject. Please correct me if I was wrong somewhere. Thanks!

    Read the article

  • RDF and OWL: Have these delivered the promises of the Semantic Web?

    - by Dark Templar
    These days I've been learning a lot about how different scientific fields are trying to move their data over to the Semantic Web in order to "free up data from being stored in isolated silos". I read a lot about how these fields are saying how their efforts are implementing the "visions" of the Semantic Web. As a learner (and from purely a learning perspective) I was curious to know why, if semantic technology is deemed to be so powerful, the efforts have been around for years but myself and a lot of people I know have never even heard of it until very recently? Also, I don't come across any scholarly articles deeming "oh, our inferencing engine was able to make such and such discovery, which is helping us pave our way to solving...." etc. It seems that there are genuine efforts across different institutions, fields, and disciplines to shift all their data to a "semantic" format, but what happens after all that's been done? All the ontologies have been created/unified, and then what?

    Read the article

  • Which useful alternative control structures do you know?

    - by bigown
    Similar question was closed on SO. Sometimes when we're programming, we find that some particular control structure would be very useful to us, but is not directly available in our programming language. What alternative control structures do you think are a useful way of organizing computation? The goal here is to get new ways of thinking about structuring code, in order to improve chunking and reasoning. You can create a wishful syntax/semantic not available now or cite a less known control structure on an existent programming language. Answers should give ideas for a new programming language or enhancing an actual language. Think of this as brainstorming, so post something you think is a crazy idea but it can be viable in some scenario. It's about imperative programming.

    Read the article

  • How can I make sense of the word "Functor" from a semantic standpoint?

    - by guillaume31
    When facing new programming jargon words, I first try to reason about them from an semantic and etymological standpoint when possible (that is, when they aren't obscure acronyms). For instance, you can get the beginning of a hint of what things like Polymorphism or even Monad are about with the help of a little Greek/Latin. At the very least, once you've learned the concept, the word itself appears to go along with it well. I guess that's part of why we name things names, to make mental representations and associations more fluent. I found Functor to be a tougher nut to crack. Not so much the C++ meaning -- an object that acts (-or) as a function (funct-), but the various functional meanings (in ML, Haskell) definitely left me puzzled. From the (mathematics) Functor Wikipedia article, it seems the word was borrowed from linguistics. I think I get what a "function word" or "functor" means in that context - a word that "makes function" as opposed to a word that "makes sense". But I can't really relate that to the notion of Functor in category theory, let alone functional programming. I imagined a Functor to be something that creates functions, or behaves like a function, or short for "functional constructor", but none of those seems to fit... How do experienced functional programmers reason about this ? Do they just need any label to put in front of a concept and be fine with it ? Generally speaking, isn't it partly why advanced functional programming is hard to grasp for mere mortals compared to, say, OO -- very abstract in that you can't relate it to anything familiar ? Note that I don't need a definition of Functor, only an explanation that would allow me to relate it to something more tangible, if there is any.

    Read the article

  • What should I call the process of converting an object to a string?

    - by shabbychef
    We are having a game of 'semantic football' in the office over this matter: I am writing a method for an object which will represent the object as a string. That string should be such that when typed (more likely, cut and pasted) into the interpreter window (I will keep the language name out of this for now), will produce an object which is, for our purposes, identical to the one upon which the method was called. There is a spirited discussion over the 'best' name for this method. The terms pickle, serialize, deflate, etc have been proposed. However, it seems that those terms assume some process for the de-pickling (unserialization, etc) that is not necessarily the language interpreter itself. That is, they do not specifically refer to the case where strings of valid code are produced. This is closer to a quine, but we are re-producing the object not the code, so this is not quite right. any suggestions?

    Read the article

  • Why would one bother marking up properly and semantically?

    - by Madara Uchiha
    Note that I (try) to mark up as semantically as possible because I like they way it looks and feels, but not because I'm aware of any other stunning advantages. The point of my question is to be able to educate others Well, I've seen a lot of articles and tutorials which often state "Let's mark this up in the most semantic possible way". But a strange thought came to me, why? Why would one need (or want) to bother with the specific elements which convey the correct semantic meaning? Specifically, I'm referring to the new HTML5 elements, such as <time>, <output>, or <address>. Especially, if the page "works" (it renders nicely in all browsers). Why would I want to use elements like <time> or <address>, where nothing at all (or at the worst case, a generic <span>) works just as nicely? I'm asking this because I'm seeing a multitude of (very popular) websites (this one included) which does not follow these so-called best practices.

    Read the article

  • Using 'new' in a projection?

    - by davenewza
    I wish to project a collection from one type (Something) to another type (SomethingElse). Yes, this is a very open-eneded question, but which of the two options below do you prefer? Creating a new instance using new: var result = query.Select(something => new SomethingElse(something)); Using a factory: var result = query.Select(something => SomethingElse.FromSomething(something)); When I think of a projection, I generally think of it as a conversion. Using new gives me this idea that I'm creating new objects during a conversion, which doesn't feel right. Semantically, SomethingElse.FromSomething() most definitely fits better. Although, the second option does require addition code to setup a factory, which could become unnecessarily compulsive.

    Read the article

  • Semantic algorithms

    - by Mythago
    I have a more theoretical than practical question. I'll start with an example - when I get an email and open it on my iPad, there is a feature, which recognizes the timestamp from the text and offers me to create an event in the calendar. Simply told, I want to know theoretically how it's done - I believe it's some kind of semantic parsing, and I would like if someone could point me to some resources, where I can read more about this.

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >