Search Results

Search found 20383 results on 816 pages for 'hello'.

Page 56/816 | < Previous Page | 52 53 54 55 56 57 58 59 60 61 62 63  | Next Page >

  • Apply function to one element of a list in Python

    - by user189637
    I'm looking for a concise and functional style way to apply a function to one element of a tuple and return the new tuple, in Python. For example, for the following input: inp = ("hello", "my", "friend") I would like to be able to get the following output: out = ("hello", "MY", "friend") I came up with two solutions which I'm not satisfied with. One uses a higher-order function. def apply_at(arr, func, i): return arr[0:i] + [func(arr[i])] + arr[i+1:] apply_at(inp, lambda x: x.upper(), 1) One uses list comprehensions (this one assumes the length of the tuple is known). [(a,b.upper(),c) for a,b,c in [inp]][0] Is there a better way? Thanks!

    Read the article

  • Programming cookbook? [closed]

    - by user73669
    Possible Duplicate: What is the single most influential book every programmer should read? Hello With sites like The Daily WTF and recurring threads on Slashdot and elsewhere about bad programming, I figured that, to avoid people reinventing the wheel (badly or not), there should be a good, fat book on programming that would go through typical programming problems and show good, known algorithms, either in pseudo-code or some language with an easy syntax so that the language is not an issue. Here's the list of books on the subject I saw at my local computer bookstore. Can you recommend a couple, or add to this list if it's missing better options? The art of computer programming Code complete Masterminds of programming 97 things every programmer should know The passionate programmer Pragmatic thinking & learning Coders at work The algorithm design manual Algorithms and programming How to think about algorithms How to think like a programmer Why programs fail Beautiful data Beautiful code The productive programmer Solid code Write great code Clean code Programming language pragmatics Hello world Learning Processing Learn to program Thank you.

    Read the article

  • Perl, creating a hash of hashes.

    - by Mike
    Based on my current understanding of hashes in Perl, I would expect this code to print "hello world." It instead prints nothing. %a=(); %b=(); $b{str} = "hello"; $a{1}=%b; $b=(); $b{str} = "world"; $a{2}=%b; print "$a{1}{str} $a{2}{str}"; I assume that a hash is just like an array, so why can't I make a hash contain another?

    Read the article

  • Pure virtual destructor in interface

    - by ALOR
    Hello all. Here is my problem. I'm making C++ dll, which extensively relies on instance object exports. So i return my actual instances as a pointers to interface through some exported factory method. Interfaces i use are purely virtual, to avoid linking problame. So i need a pure virtual destructor too, and i implemented one (with empty body, as i googled it). All compiles perfectly well, except... I can't see, if the actual destructors are called or not - because when i added some std::cout << "hello destructor"; i never get to see it. I have some explicit "delete obj", that's not the problem. Am i missing something? Is there another way to delete my object through interface?

    Read the article

  • simple putStrLn in Haskell/Yampa with arrows syntax

    - by sisif
    i'm using Haskell with the Yampa FRP library which uses the arrows language extension. how can i do a simple putStrLn in a SF? mySF = proc x -> do y <- identity -< x*x putStrLn "Hello World!" ++ show y returnA -< y the arrow syntax complains about the expression not bein an arrow (of course), but even with arrows i get no output output <- identity -< putStrLn "Hello World!"

    Read the article

  • Type-aware rendering (and editing) of tabular data in pyqt4

    - by pihentagy
    I would like to have a very short / minimal example of how to create some tabular widget with different types of item in it. In the first round let's say I'd like to render [["Hello", 12, True], ["World", 13, False]] (Hello as string, 12 as number (right-align), True as a checkbox for eg.), but it would be nice to have Dates, Colors, and other type of info. Next round: editing (integer with spinbox, maybe sometimes a combobox is handy, but that may not work out of the box). There must be a simple solution, but I couldn't find...

    Read the article

  • Basic help needed with pointers

    - by sbsp
    Hi, i asked some time ago on an account i cant remember how to manipulate basic pointers and someone gave me a really good demo for example char *ptr = hello (hello = a char array) so now *ptr is pointing at h ptr++ = moves the ptr to point at the next element, to get its value i do *ptr and that gives me e ok so far i hope :D but now i need to manipulate a char **ptr and was wondering how i do this in a way that mimmicks the effects of a 2d array? some basic tips would be much appreciated as i need to do an assignment that has a **ptr to immitate a 2d array and without knowing how it does this first means i cant even solve it on paper (for example, how do you dereference a **ptr, how do you get [x][y] values etc) thanks

    Read the article

  • How can I detect if a string contains punctuation marks at the end?

    - by Sheehan Alam
    Lets assume I have the string: "Hello I like your shoes #today...!" I am tokenizing the string by spaces: return [string componentsSeparatedByString:@" "]; So my array contains: Hello I like your shoes #today...! I want to focus on "#today...!" any word that has a # in the prefix I am changing the font color. How can I make sure that only "#today" has its font color changed? I would basically like to figure out if a word has a punctuation mark at the end, and change the color for characters before the punctuation mark.

    Read the article

  • Send and receive Array as GET/POST using querystring

    - by Vanwaril
    I've got the following code, but it doesn't seem to work: var post_req = { array: [ [ { param1: 'something', param2: 123 } ], [ ], [ ], [ { param2: 'something', param4: 1234, param1: 'hello' } ] ] }; var data_send = querystring.stringify(post_req); var request = client.request('POST', '/', headers); request.end(data_send); and if( req.method == 'POST' ) { req.addListener('data', function(chunk) { POST = querystring.parse(chunk); console.log(POST); } } I end up with 5 sub-arrays, corresponding to the 5 parameters in the objects but with extra '][' characters in their names: { array: [ { '][param1': 'something' } , { '][param2': '123' } , { '][param2': 'something' } , { '][param4': '1234' } , { '][param1': 'hello' } ] }

    Read the article

  • How to stream an HttpResponse with Django

    - by muudscope
    I'm trying to get the 'hello world' of streaming responses working for Django (1.2). I figured out how to use a generator and the yield function. But the response still not streaming. I suspect there's a middleware that's mucking with it -- maybe ETAG calculator? But I'm not sure how to disable it. Can somebody please help? Here's the "hello world" of streaming that I have so far: def stream_response(request): resp = HttpResponse( stream_response_generator()) return resp def stream_response_generator(): for x in range(1,11): yield "%s\n" % x # Returns a chunk of the response to the browser time.sleep(1)

    Read the article

  • Is there anyway to write the following as a C++ macro?

    - by anon
    my_macro << 1 << "hello world" << blah->getValue() << std::endl; should expand into: std::ostringstream oss; oss << 1 << "hello world" << blah->getValue() << std::endl; ThreadSafeLogging(oss.str()); Thanks! EDIT: the accepted answer is awesome. Can we upvote 8 more times and win this responder a badge? (The answer only needs 6 more upvotes). 4 more votes to go from 21 to 25. 3 more. :-) Victory. :-)

    Read the article

  • Ant Exec environment var

    - by Mike
    I have a problem where I don't want to have to call a setEnv.sh file before i call my ant target that calls an exec task. Right now I have a way to save the environment variables in setenv.properties file in the key=value notation. The exec task for some reason does not see the variables that are set in the .properties file.... (I know i could use the tag but the setenv.properties is dynamically generated) setenv.properties: HELLO=XYZ part of my build.xml : <property file="setenv.properties"/> <target name="test" depends="setEnv"> <exec executable="/bin/ksh" newenvironment="false"> test.sh : echo ${HELLO} Any thoughts?

    Read the article

  • Print out the variable name objective-C

    - by vodkhang
    Continued from the last question here: Log method name in Obj-C . I just wondered if there is a way to print out the variable name as well. For example: NSString *name = "vodkhang"; NCLog(@"%@", name); and I hope that the output should be: name: vodkhang Just to summarize the previous post, currently, I can print out the class name, method name and the line number when I call NCLog(@"Hello World"); <ApplicationDelegate:applicationDidFinishLaunching:10>Hello world with #define NCLog(s, ...) NSLog(@"<%@:%d> %@", __FUNCTION__, __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__])

    Read the article

  • Drop Down List In A Gridview

    - by Or Betzalel
    I have a gridview, inside the gridview I have a template field and inside that, a drop down list. <asp:TemplateField> <ItemTemplate> <asp:DropDownList ID="Hello" runat="server"> </asp:DropDownList> </ItemTemplate> </asp:TemplateField> I want to databind the gridview but how do I make the drop down list change its value to according to the information I gave it while databinding? Im used to using DataField in bound fields <asp:BoundField HeaderText="Hello" DataField="HelloDB" />

    Read the article

< Previous Page | 52 53 54 55 56 57 58 59 60 61 62 63  | Next Page >