Search Results

Search found 639 results on 26 pages for 'literal'.

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

  • Lifetime of a const string literal returned by a function

    - by Neeraj
    Consider this code: const char* someFun() { // ... some stuff return "Some text!!" } int main() { { // Block: A const char* retStr = someFun(); // use retStr } } My question is in the function sumFun() where is "some Text!!", stored (i think may be in some static area in ROM) and what will be its scope? Will the memory pointed by retStr be occupied throughout the program or be released once the block A exits? -- Thanks

    Read the article

  • Erlang - Eccentricity with accented characters and string literal

    - by erevfall
    Hey, I am trying to implement a function to differentiate between french vowels and consonnants. It should be trivial, let's see what I wrote down : -define(vowels,"aeiouyàâéèêëôù"). is_vowel(Char) -> C = string:to_lower(Char), lists:member(C,?vowels). It's pretty simple, but it behaves incorrectly : 2> char:is_vowel($â). false While the interpreted version works well : 3> C = string:to_lower($â), lists:member(C,"aeiouyàâéèêëôù"). true What's going on ?

    Read the article

  • jQuery Grouping Similar Items w/ Object Literal

    - by NessDan
    So I have this structure setup: <ul> <li>http://www.youtube.com/watch?v=dw1Vh9Yzryo</li> (Vid1) <li>http://www.youtube.com/watch?v=bOF3o8B292U</li> (Vid2) <li>http://www.youtube.com/watch?v=yAY4vNJd7A8</li> (Vid3) <li>http://www.youtube.com/watch?v=yAY4vNJd7A8</li> <li>http://www.youtube.com/watch?v=dw1Vh9Yzryo</li> <li>http://www.youtube.com/watch?v=bOF3o8B292U</li> <li>http://www.youtube.com/watch?v=yAY4vNJd7A8</li> <li>http://www.youtube.com/watch?v=dw1Vh9Yzryo</li> </ul> Vid1 is repeated 3 times, Vid2 is repeated 3 times, and Vid3 is repeated 2 times. I want to put them into a structure where I can reference them like this: youtube[0][repeated] = 3; youtube[0][download] = "http://www.youtube.com/get_video?video_id=dw1Vh9Yzryo&fmt=36" youtube[1][repeated] = 3; youtube[1][download] = "http://www.youtube.com/get_video?video_id=bOF3o8B292U&fmt=36" youtube[2][repeated] = 3; youtube[2][download] = "http://www.youtube.com/get_video?video_id=yAY4vNJd7A8&fmt=36" "This video was repeated " + youtube[0][repeated] + " times and you can download it here: " + youtube[0][download]; How can I set this multidimensional array up? Been Googling for hours and I don't know how to set it up. Can anyone help me out?

    Read the article

  • How can I add a function reference to an object literal

    - by rob
    I need to add binders to DOM elements after rendering is done. Therefore I want to pass a list with (ID, callback) tuples to the rendering function so it can bind it after the rendering is done. So i would like to create a list of such objects and pass it to the rendering function: {id:'#someDOMelement', callback: someObject.someFunction} and bind it after the rendering like this: $(binders[i].id).bind('click', binders[i].callback);

    Read the article

  • Equivalent of object using literal notation

    - by brz dot net
    See following class: function availItem(xs, s, m, l, xl) { this.xs = xs; this.s = s; this.m = m; this.l = l; this.xl = xl; } How can I declare the above class using JSON? I think It should be in following manner but problem is to pass argument. var availItem = { xs : xs, s : s, m : m, l : l, xl : xl } I want to use both in same manner like var obj =new availItem(xs,s,b,l,xl);

    Read the article

  • how to organize classes in ruby if they are literal subclasses

    - by RetroNoodle
    I know that title didn't make sense, Im sorry! Its hard to word what I am trying to ask. I had trouble googling it for the same reason. So this isn't even Ruby specific, but I am working in ruby and I am new to it, so bear with me. So you have a class that is a document. Inside each document, you have sentences, and each sentence has words. Words will have properties, like "noun" or a count of how many times they are used in the document, etc. I would like each of the elements, document, sentence, word be an object. Now, if you think literally - sentences are in documents, and words are in sentences. Should this be organized literally like this as well? Like inside the document class you will define and instantiate the sentence objects, and inside the sentence class you will define and instantiate the words? Or, should everything be separate and reference each other? Like the word class would sit outside the sentence class but the sentence class would be able to instantiate and work with words? This is a basic OOP question I guess, and I suppose you could argue to do it either way. What do you guys think? Each sentence in the document could be stored in a hash of sentence objects inside the document object, and each word in the sentence could be stored in a hash of word objects inside the sentence. I dont want to code myself into a corner here, thats why I am asking, plus I have wondered this before in other situations. Thank you!

    Read the article

  • treating paramater as literal

    - by I__
    DoCmd.TransferText acImportDelim, Import-Accounts, "tableImport", _ "C:\Documents and Settings\accounts.txt", True The second parameter: Import-Accounts is the actual name of the saved import specifications. supposedly it does NOT need to be in quotes; however in this case since there is a - there it is treating it as if i were doing an operation. is there a way i can force it to treat it literally instead of as an operation?

    Read the article

  • Possible to convert list of #defines into strings (C++)

    - by brandonC
    Suppose I have a list of #defines in a header file for an external library. These #defines represent error codes returned from functions. I want to write a conversion function that can take as an input an error code and return as an output a string literal representing the actual #define name. As an example, if I have #define NO_ERROR 0 #define ONE_KIND_OF_ERROR 1 #define ANOTHER_KIND_OF_ERROR 2 I would like a function to be able to called like int errorCode = doSomeLibraryFunction(); if (errorCode) writeToLog(convertToString(errorCode)); And have convertToString() be able to auto-convert that error code without being a giant switch-case looking like const char* convertToString(int errorCode) { switch (errorCode) { case NO_ERROR: return "NO_ERROR"; case ONE_KIND_OF_ERROR: return "ONE_KIND_OF_ERROR"; ... ... ... I have a feeling that if this is possible, it would be possible using templates and metaprogramming, but that would only work the error codes were actually a type and not a bunch of processor macros. Thanks

    Read the article

  • Java equivalent of C# @

    - by Simon Rigby
    Hi all, Quick question. Is there an equivalent of @ as applied to strings in Java: For example I can do @"c:\afolder\afile" in C# and have it ignore the escape characters when processing instead of having to do "c:\afolder\aFile". Is there a Java equivalent? hmmm: stackoverflow is escaping on me .. lol. The second example should read: c:(double-backslash)afolder(double-backslash)aFile

    Read the article

  • Can we use Resource Expressions in javascript and other parts except Literal?

    - by balexandre
    The Literal control works all the time <asp:Literal ID="Literal7" runat="server" Text="<%$ Resources:ErrorMessages, errorCompanyNotFound %>" /> But if I want to use this as a parameter in an image, like <img src="blahblah" alt="" title"<%$ Resources:ErrorMessages, errorCompanyNotFound %>" /> It gives the annoying error Literal expressions like '' are not allowed. Use instead. Same happens if I try to access it through Javascript var noHit = '<%$ Resources:ErrorMessages, errorCompanyNotFound %>'; Does anyone had any idea how can I fetch the Global Resource value under this circumstances?

    Read the article

  • C: Why does gcc allow char array initialization with string literal larger than array?

    - by Ashwin
    int main() { char a[7] = "Network"; return 0; } A string literal in C is terminated internally with a nul character. So, the above code should give a compilation error since the actual length of the string literal Network is 8 and it cannot fit in a char[7] array. However, gcc (even with -Wall) on Ubuntu compiles this code without any error or warning. Why does gcc allow this and not flag it as compilation error? gcc only gives a warning (still no error!) when the char array size is smaller than the string literal. For example, it warns on: char a[6] = "Network"; [Related] Visual C++ 2012 gives a compilation error for char a[7]: 1>d:\main.cpp(3): error C2117: 'a' : array bounds overflow 1> d:\main.cpp(3) : see declaration of 'a'

    Read the article

  • Showing errors in updatepanel after processing a CSV file

    - by Younes
    I have a csv importroutine which imports my CSV values into Sitecore. After this proces is done i want to show the errors in an asp:literal. This is not working, and I think this is because i need an updatepanel for this in order to be able to update text after the first postback (the csv upload / import). I made this: <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder> <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /> </ContentTemplate> </asp:UpdatePanel> and coded this: string melding = string.Format("Er zijn {0} objecten geïmporteerd.{1}", nrOfItemsImported, errors); ViewState["Melding"] = melding; And i have a button. On the onclick of this button I have: Literal literal = new Literal(); literal.Text = (string)ViewState["Melding"]; literal.ID = DateTime.Now.Ticks.ToString(); UpdatePanel1.ContentTemplateContainer.Controls.Add(literal); PlaceHolder1.Controls.Add(literal); When i now press the button i want to update the panel so that it will show my Literal with the errormsg on it. This however isn't happening. How can this be? I'm guessing it has something to do with my viewstate, i don't see keys on the viewstate after I press the button...

    Read the article

  • JSON to javaScript array

    - by saturn_research
    I'm having a problem handling JSON data within JavaScript, specifically in regards to using the data as an array and accessing and iterating through individual values. The JSON file is structured as follows: { "head": { "vars": [ "place" , "lat" , "long" , "page" ] } , "results": { "bindings": [ { "place": { "type": "literal" , "value": "Building A" } , "lat": { "datatype": "http://www.w3.org/2001/XMLSchema#float" , "type": "typed-literal" , "value": "10.3456" } , "long": { "datatype": "http://www.w3.org/2001/XMLSchema#float" , "type": "typed-literal" , "value": "-1.2345" } , "page": { "type": "uri" , "value": "http://www.example.com/a.html" } } , { "place": { "type": "literal" , "value": "Building B" } , "lat": { "datatype": "http://www.w3.org/2001/XMLSchema#float" , "type": "typed-literal" , "value": "11.3456" } , "long": { "datatype": "http://www.w3.org/2001/XMLSchema#float" , "type": "typed-literal" , "value": "-2.2345" } , "page": { "type": "uri" , "value": "http://www.example.com/b.html" } } , { "place": { "type": "literal" , "value": "Building C" } , "lat": { "datatype": "http://www.w3.org/2001/XMLSchema#float" , "type": "typed-literal" , "value": "12.3456" } , "long": { "datatype": "http://www.w3.org/2001/XMLSchema#float" , "type": "typed-literal" , "value": "-3.2345" } , "page": { "type": "uri" , "value": "http://www.example.com/c.html" } } ] } } I want to be able to convert this into a JavaScript array as follows in order that I can iterate through it and pull out the values for each location in order: var locations = [ ['Building A',10.3456,-1.2345,'http://www.example.com/a.html'], ['Building B',11.3456,-2.2345,'http://www.example.com/b.html'], ['Building C',12.3456,-3.2345,'http://www.example.com/c.html'] ]; Does anyone have any advice on how to achieve this? I have tried the following, but it picks up the "type" within the JSON, rather than just the value: $.each(JSONObject.results.bindings, function(i, object) { $.each(object, function(property, object) { $.each(object, function(property, value) { value; }); }); }); Any help, suggestions, advice or corrections would be greatly appreciated.

    Read the article

  • Are there disadvantages an literal + instead of an encoded + (%2B) in an URL?

    - by M_rk
    A client of mine has a product ending with a plus-sign (e.g. Google+) and would like the webpage of this product to have an URL that is human-readable (i.e. an URL that doesn't contain %2B). Since our projects use the following .htaccess RewriteRule RewriteRule ^(.*)$ index.php?$1 it is possible to use an urlencoded space in an URL like that. However, while the url would read like /google+, the actual meaning of the URL would be /google[space]. (The markup won't let me place a real space there.) Now my concern is that this would have disadvantages for SEO. Is this concern valid and/or are there other culprits to this approach?

    Read the article

  • compiling openss7

    - by deddihp
    hello, i got an error while compiling openss7. Do you know what happen ? Thanks.... gcc -DHAVE_CONFIG_H -I. -I. -I. -DLFS=1 -imacros ./config.h -imacros ./include/sys/config.h -I. -I./include -I./include -nostdinc -iwithprefix include -DLINUX -D__KERNEL__ -I/usr/src/linux-headers-lbm-2.6.28-11-generic -I/lib/modules/2.6.28-11-generic/build/include -Iinclude2 -I/lib/modules/2.6.28-11-generic/build/include -I/lib/modules/2.6.28-11-generic/build/arch/x86/include -include /lib/modules/2.6.28-11-generic/build/include/linux/autoconf.h -Iubuntu/include -I/lib/modules/2.6.28-11-generic/build/ubuntu/include -I/lib/modules/2.6.28-11-generic/build/arch/x86/include/asm/mach-default '-DKBUILD_STR(s)=#s' '-DKBUILD_BASENAME=KBUILD_STR('`echo libLfS_specfs_a-specfs.o | sed -e 's,lib.*_a-,,;s,\.o,,;s,-,_,g'`')' -DMODULE -D__NO_VERSION__ -DEXPORT_SYMTAB -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -O2 -m32 -msoft-float -mregparm=3 -freg-struct-return -mpreferred-stack-boundary=2 -march=i586 -mtune=generic -Wa,-mtune=generic32 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-stack-protector -fno-omit-frame-pointer -fno-optimize-sibling-calls -Wdeclaration-after-statement -Wno-pointer-sign -fwrapv -ffreestanding -c -o libLfS_specfs_a-specfs.o `test -f 'src/kernel/specfs.c' || echo './'`src/kernel/specfs.c In file included from src/kernel/specfs.c:123: src/kernel/strspecfs.c: In function ‘specfs_init_cache’: src/kernel/strspecfs.c:1406: warning: passing argument 5 of ‘kmem_cache_create’ from incompatible pointer type src/kernel/strspecfs.c:1406: error: too many arguments to function ‘kmem_cache_create’ In file included from src/kernel/specfs.c:126: src/kernel/strlookup.c: In function ‘cdev_lookup’: src/kernel/strlookup.c:508: warning: format not a string literal and no format arguments src/kernel/strlookup.c:514: warning: format not a string literal and no format arguments src/kernel/strlookup.c:521: warning: format not a string literal and no format arguments src/kernel/strlookup.c: In function ‘cdrv_lookup’: src/kernel/strlookup.c:562: warning: format not a string literal and no format arguments src/kernel/strlookup.c: In function ‘fmod_lookup’: src/kernel/strlookup.c:604: warning: format not a string literal and no format arguments src/kernel/strlookup.c: In function ‘cdev_search’: src/kernel/strlookup.c:709: warning: format not a string literal and no format arguments src/kernel/strlookup.c:716: warning: format not a string literal and no format arguments src/kernel/strlookup.c: In function ‘fmod_search’: src/kernel/strlookup.c:768: warning: format not a string literal and no format arguments src/kernel/strlookup.c: In function ‘cmin_search’: src/kernel/strlookup.c:823: warning: format not a string literal and no format arguments src/kernel/strlookup.c:830: warning: format not a string literal and no format arguments src/kernel/strlookup.c:840: warning: format not a string literal and no format arguments src/kernel/strlookup.c:848: warning: format not a string literal and no format arguments In file included from src/kernel/specfs.c:129: src/kernel/strattach.c: In function ‘check_mnt’: src/kernel/strattach.c:131: error: ‘struct vfsmount’ has no member named ‘mnt_namespace’ src/kernel/strattach.c:131: error: ‘struct task_struct’ has no member named ‘namespace’ src/kernel/strattach.c: In function ‘do_fattach’: src/kernel/strattach.c:200: error: ‘struct nameidata’ has no member named ‘dentry’ src/kernel/strattach.c:200: error: ‘struct nameidata’ has no member named ‘mnt’ src/kernel/strattach.c:200: error: ‘struct nameidata’ has no member named ‘dentry’ src/kernel/strattach.c:203: error: ‘struct nameidata’ has no member named ‘mnt’ src/kernel/strattach.c:208: error: ‘struct nameidata’ has no member named ‘mnt’ src/kernel/strattach.c:208: error: ‘struct nameidata’ has no member named ‘mnt’ src/kernel/strattach.c:208: error: ‘struct nameidata’ has no member named ‘dentry’ src/kernel/strattach.c:226: error: implicit declaration of function ‘path_release’ src/kernel/strattach.c: In function ‘do_fdetach’: src/kernel/strattach.c:253: error: ‘struct nameidata’ has no member named ‘dentry’ src/kernel/strattach.c:253: error: ‘struct nameidata’ has no member named ‘mnt’ src/kernel/strattach.c:255: error: ‘struct nameidata’ has no member named ‘mnt’ src/kernel/strattach.c:257: error: ‘struct nameidata’ has no member named ‘dentry’ src/kernel/strattach.c:262: error: ‘struct nameidata’ has no member named ‘mnt’ src/kernel/strattach.c:265: error: ‘struct nameidata’ has no member named ‘mnt’ In file included from src/kernel/specfs.c:132: src/kernel/strpipe.c: In function ‘do_spipe’: src/kernel/strpipe.c:372: warning: assignment discards qualifiers from pointer target type make[4]: *** [libLfS_specfs_a-specfs.o] Error 1 make[4]: Leaving directory `/home/deddihp/dev/source/openss7-0.9.2.G/streams-0.9.2.4' make[3]: *** [all-recursive] Error 1 make[3]: Leaving directory `/home/deddihp/dev/source/openss7-0.9.2.G/streams-0.9.2.4' make[2]: *** [all] Error 2 make[2]: Leaving directory `/home/deddihp/dev/source/openss7-0.9.2.G/streams-0.9.2.4' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/deddihp/dev/source/openss7-0.9.2.G' make: *** [all] Error 2

    Read the article

  • What is the difference between JSON and Object Literal Notation?

    - by burak ozdogan
    Hi, Can someone tell me what is the main difference between a Javascript object defined by using "Object Literal Notation" and JSON object? According to a Javascript book it says this is an object defined by using Object Notation: var newObject = { prop1 : true, showMessage : function (msg) {alert(msg)} }; Why it is not a JSON object in this case? Just because it is not defined by using quotation marks? Thanks,

    Read the article

  • I get the warning "Format not a string literal and no format arguments" at NSLog -- how can I correc

    - by dsobol
    Hello, I get the warning "Format not a string literal and no format arguments" on the NSLog call in the following block: (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { NSLog([NSString stringWithFormat:@"%d", buttonIndex]); } I have read in another post here that this error message indicates an insecure use of NSLog. Could someone point me in the direction of a properly formatted string for this? Thanks for any and all assistance! Regards, Steve O'Sullivan

    Read the article

  • How would you convert a String to a Java string literal?

    - by Simon Nickerson
    This is sort of the Java analogue of this question about C#. Suppose I have a String object which I want to represent in code and I want to produce a string literal that maps to the same thing. I was just about to write a state machine that ingests the string character by character and escapes appropriately, but then I wondered if there was a better way, or a library that provides a function to do this.

    Read the article

  • In Java, is there a way to write a string literal without having to escape quotes?

    - by Matthew
    Say you have a String literal with a lot of quotation marks inside it. You could escape them all, but it's a pain, and difficult to read. In some languages, you can just do this: foo = '"Hello, World"'; In Java, however, '' is used for chars, so you can't use it for Strings this way. Some languages have syntax to work around this. For example, in python, you can do this: """A pretty "convenient" string""" Does Java have anything similar?

    Read the article

  • DataGrid in Dojo , with json data from a servlet.

    - by Magesh
    Hello , i am using JSON for first time... and want to fill my datagrid with my JSON data, this is my JSON data, { "head": { "vars": [ "s" , "fname" , "lname" ] } , "results": { "bindings": [ { "s": { "type": "uri" , "value": "http://tn.gov.in/Person/41" } , "fname": { "type": "literal" , "value": "Gayathri" } , "lname": { "type": "literal" , "value": "Vasudevan" } } , { "s": { "type": "uri" , "value": "http://tn.gov.in/Person/37" } , "fname": { "type": "literal" , "value": "Magesh" } , "lname": { "type": "literal" , "value": "Vasudevan" } } , { "s": { "type": "uri" , "value": "http://tn.gov.in/Person/39" } , "fname": { "type": "literal" , "value": "Vasudevan " } , "lname": { "type": "literal" , "value": "Srinivasan" } } ] } } I want to display fname and lname in the data grid how should i so it? can any one give a sample code which works for above JSON ? i tried a lot with examples , i am getting a blank grid

    Read the article

  • Why doesn't an octal literal as a string cast to a number?

    - by Andy E
    In JavaScript, why does an octal number string cast as a decimal number? I can cast a hex literal string using Number() or +, why not an octal? For instance: 1000 === +"1000" // -> true 0xFF === +"0xFF" // -> true 0100 === +"0100" // -> false - +"0100" gives 100, not 64 I know I can parse with parseInt("0100" [, 8]), but I'd like to know why casting doesn't work like it does with hex and dec numbers. Also, does anyone know why octal literals are dropped from ECMAScript 5th Edition in strict mode?

    Read the article

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