Slashdot Mirror


Bing Now Provides Exact Snippets of Code for Developers' Queries (searchenginejournal.com)

"Bing has launched a new intelligent search feature which provides the exact piece of code a developer is looking for," writes Search Engine Journal. An anonymous reader quotes their report: The code snippet will appear right on the search results page itself, which means users will not have to skim through long threads and articles to find the one thing they're looking for. Bing calls this new feature a "Code Sample Answer" and says it's designed to help save developers' time. "Many of us are developers too, and we thought: what if Bing were intelligent enough to do this for us? What if it could save users' time by automatically finding the exact piece of code containing the answer to the question? That is how Code Sample Answer was born..."

A Code Sample Answer will trigger only when Bing intelligently detects the coding intent with high confidence. "To achieve this level of precision for query intent detection, Bing's natural language processing pipelines for developers leverages patterns found in training data from developer queries collected over the years containing commonly used terms and text structure typical for coding queries. The system also leverages a multitude of click signals to improve the precision even further"... [I]t also covers other tools used by developers. For example, a Code Sample Answer can be triggered when searching for git commands and their syntax.

Bing extracts "the best matched code samples from popular, authoritative and well moderated sites like Stackoverflow, Github, W3Schools, MSDN, Tutorialpoints, etc. taking into account such aspects as fidelity of API and programming language match, counts of up/down-votes, completeness of the solution and more."

JAXenter.com notes they obtained similar results using the privacy-friendly search engine DuckDuckGo, and ultimately asks whether this functionality could affect the search habits of developers. "Is this new feature enough to make Bing a viable search engine tool for programmers or will Google be the go-to for hunting down source code?"

84 comments

  1. Trump is a traitor - snip his tiny balls off by Anonymous Coward · · Score: 0, Insightful

    Mueller's search is the best search engine in America. #Traitorfinder

  2. Let me bing up a vrius by xack · · Score: 4, Interesting

    It won't be long before stuff like fork bombs and data deleters get "suggested" for common programming queries.

    1. Re:Let me bing up a vrius by Fly+Swatter · · Score: 3, Interesting

      More likely will be snippets that download harmless sounding payload and execute.

    2. Re: Let me bing up a vrius by Anonymous Coward · · Score: 0

      Viruses and spare (oh wait, that's already there in win 10)

    3. Re: Let me bing up a vrius by theshowmecanuck · · Score: 1

      Mod up

      --
      -- I ignore anonymous replies to my comments and postings.
    4. Re:Let me bing up a vrius by KiloByte · · Score: 2, Insightful

      It won't be long before stuff like fork bombs and data deleters get "suggested" for common programming queries.

      I don't see a downside. Someone bad enough to code via cargo culting snippets shouldn't be allowed anywhere near actual data. Sure, it'd decimate Javascript and PHP coder base, but that's not a downside either.

      --
      The creatures outside looked from Alt-Right to Antifa; but already it was impossible to say which was which.
    5. Re:Let me bing up a vrius by DogDude · · Score: 1

      They're taking the code from relatively reliable sources. You'd have to spam Github, somehow.

      --
      I don't respond to AC's.
    6. Re:Let me bing up a vrius by Dracolytch · · Score: 3, Informative

      I just checked some quick examples in JavaScript, and didn't love the syntax it gave back as a result. Meanwhile, the StackOverflow pages in the search results provided much more correct answers. StackOverflow's answers often provide context, which is very important when building software.

      --
      This sig has been enciphered with a one-time pad. It could say almost anything.
    7. Re:Let me bing up a vrius by Hal_Porter · · Score: 1

      No one would suggest a fork bomb on the Internet.

      --
      echo -e 'global _start\n _start:\n mov eax, 2\n int 80h\n jmp _start' > a.asm; nasm a.asm -f elf; ld a.o -o a;
    8. Re:Let me bing up a vrius by datavirtue · · Score: 4, Informative

      Yeah...anyone who runs a search and employs the first snippet they find is a moron. There is context and the need to make sure you and most everyone else is not doing it wrong. A lot of times you can find an answer on SO but you need to read all the way to the bottom and follow the links to other SO posts and answers to find the best way to handle something. When you don't know what you are doing it is often difficult to judge what is correct.

      TLDR; Cut and paste coding is more involved than just cut and paste.

      --
      I object to power without constructive purpose. --Spock
    9. Re: Let me bing up a vrius by Anonymous Coward · · Score: 0

      do you mean like the disk backup command: rm -rf /*

    10. Re:Let me bing up a vrius by Anonymous Coward · · Score: 0

      I cut and paste code. Not because I don't know the answer but because its faster than my typeing speed.

    11. Re:Let me bing up a vrius by cascadingstylesheet · · Score: 2

      It won't be long before stuff like fork bombs and data deleters get "suggested" for common programming queries.

      I don't see a downside. Someone bad enough to code via cargo culting snippets shouldn't be allowed anywhere near actual data. Sure, it'd decimate Javascript and PHP coder base, but that's not a downside either.

      Nothing wrong with whistling up a quick code snippet, as long as you understand it.

    12. Re: Let me bing up a vrius by Anonymous Coward · · Score: 0

      I obviously have no idea how this will play out, but I for one would love this. Often when I am searching online for a code bit my results are walls of text I do not need. A small snippet, for me, would be ideal even if it is only a 1/10th of what I was looking for. I donâ(TM)t need a guided tour, just a nudge in he right direction and the rest clicks on its own.

      As for malicious code, again to someone like me that would be wildly apparent in any small (note snippet in the title) bit of code. Sure you could trick me with big multifunction/method blobs of spaghetti code, but I would never even consider just dropping something like that into my program.

      I guess your point is valid for a small number of users, but I think even bad programmers would avoid what you are describing if for no other reason than not understanding how to implement it anyway.

    13. Re:Let me bing up a vrius by KiloByte · · Score: 1

      Nothing wrong with whistling up a quick code snippet, as long as you understand it.

      Exactly! Real programmers will spot the trap, cargo-culters won't.

      --
      The creatures outside looked from Alt-Right to Antifa; but already it was impossible to say which was which.
    14. Re:Let me bing up a vrius by Anonymous Coward · · Score: 0

      This is why linux/unix will never be mainstream.

      Because you are not allowed, under any circumstances ever, to be a beginner.

      And you have to be a beginner sometime.

      I have been working with computers for forty years now. And I'm trying to switch to Linux. When I go to do something on my Ubuntu box, I need references. And I'm NOT going to understand all of the options and settings for a command. Oh sure, I will vet the commands, and possibly detect if anything stupid is going to happen - but I can't really guarantee it, because I'm a beginner at Linux.

      Sigh. I have no illusions that the people who need to get my point will get my point.

    15. Re:Let me bing up a vrius by KiloByte · · Score: 1

      Because you are not allowed, under any circumstances ever, to be a beginner.

      There's a difference between a beginner tinkering on his own toy box at home and a "programmer" that doesn't even know what O(n) means leaving customers' private data for every script kiddie for the taking.

      --
      The creatures outside looked from Alt-Right to Antifa; but already it was impossible to say which was which.
    16. Re:Let me bing up a vrius by q4Fry · · Score: 1

      Here's someone who built the obligatory XKCD: https://gkoberger.github.io/st...

  3. Bung should just provide automatic by Anonymous Coward · · Score: 0

    Way to make Google the default search engine. å"¦ ly thing it's used for

  4. Code in which language by Applehu+Akbar · · Score: 2

    Let me guess: it's always C# ?

    1. Re: Code in which language by Anonymous Coward · · Score: 0

      Python is the new most popular language, so wouldn't be surprised if that shows up

    2. Re:Code in which language by hcs_$reboot · · Score: 1

      No, you can also get code in CMD batch language.

      --
      Slashdot, fix the reply notifications... You won't get away with it...
    3. Re: Code in which language by datavirtue · · Score: 1

      Python is the new most popular language for throw away code.

      --
      I object to power without constructive purpose. --Spock
    4. Re: Code in which language by MemeRot · · Score: 1

      Python is not the most popular, though it's moved up a lot. Languages without static typing are barbaric

    5. Re:Code in which language by OneHundredAndTen · · Score: 1

      Coming from Microsoft, it's probably more like Intercal.

    6. Re: Code in which language by Anonymous Coward · · Score: 0

      So I can't expect it to return any Pascal code?

    7. Re:Code in which language by K.+S.+Kyosuke · · Score: 1

      Coming from

      Ha! I see what you did there...

      --
      Ezekiel 23:20
    8. Re:Code in which language by Applehu+Akbar · · Score: 1

      Coming from Microsoft, it's probably more like Intercal.

      {
      Whoosh();
      }

    9. Re: Code in which language by maestroX · · Score: 1

      Languages without static typing are slutty, fast and fun with unexpected side effects.

    10. Re: Code in which language by Jahta · · Score: 1

      Python is not the most popular, though it's moved up a lot. Languages without static typing are barbaric

      As older /.ers will remember, "Real Programmers don't write in PASCAL, or BLISS, or ADA, or any of those pinko computer science languages. Strong typing is for people with weak memories." - Real Programmers Don't Write Specs

  5. Wow! by Bobrick · · Score: 1

    Every time, I'm shocked that Bing still exists.

    1. Re:Wow! by Anonymous Coward · · Score: 0

      Same with the rest of us and Trump's administration, what kind of treason is it going to take for Pompeo to admit Putin's got Donnie's dick in a box? Resign you cowardly boobs, let Mueller sort 'em out. (Get a rope)

    2. Re: Wow! by Anonymous Coward · · Score: 0

      What would ms install by default on Windows without edge and Bing? Google and chrome? Lol

    3. Re:Wow! by Anonymous Coward · · Score: 0

      bing seems ok, What really shocks me though is that google still dominates search, they are the worst of all possible options at the moment yet they have the dominate market share, I guess they are like the ie6 of search.

    4. Re:Wow! by Anonymous Coward · · Score: 0

      What sort of thing could be used to blackmail Trump? That man has no shame, and remarkably, whatever comes out about him seems to be shugged off by his supporters.

      I think Trump admires Putin for being the leader that Trump wants to be, but I wouldn't be sure Putin is exerting direct control over Trump, more like Putin see Trump as a useful idiot, who can be easily manipulated.

  6. Duck Duck Go started this by Jeremiah+Cornelius · · Score: 3, Informative

    They have been returning command syntax for queries like "ffmpeg deinterlace" since last year, at least.
    ffmpeg -i input.vob -vf yadif -c:v libx264 -preset slow -crf 19 -c:a aac -b:a 256k output.mp4

    --
    "Flyin' in just a sweet place,
    Never been known to fail..."
    1. Re:Duck Duck Go started this by Anonymous Coward · · Score: 0

      I agree that parent post contributes to the discussion, however I am conflicted about this because it's piggybacking off of an obvious troll.

      If we want to cut off the trolls, then IMO any attempt to piggyback off obvious AC troll posts for top position should be considered an act of trolling, and moderated as such. However, doing that would be harsh penalty for people just trying to have their posts seen, so perhaps a better solution would be to allow moderators to de-link posts like the one above and re-insert it into the comment stream as a top-level comment with position based on its timestamp.

  7. Zero day exploits ahead by hcs_$reboot · · Score: 1

    "give me that piece of code that you use to generate code"

    --
    Slashdot, fix the reply notifications... You won't get away with it...
    1. Re: Zero day exploits ahead by Anonymous Coward · · Score: 0

      You have to say site or Alexa first

  8. This explains something by Anonymous Coward · · Score: 0

    Young coders are so bad because they just copy code snippets and pass them off as their own work.

    No wonder security is so bad - they just keep copying the bad code over and over.

  9. So Visual Studio's code editor by Anonymous Coward · · Score: 0

    ...will just accept questions and fill in the necessary code?

    1. Re:So Visual Studio's code editor by datavirtue · · Score: 2

      Shh... don't give them any ideas. Managers and executives already think everything is easy/simple. If they hear about this it will only lead to more ham-fisted bullshit. Never mind, we have already jumped the shark.

      --
      I object to power without constructive purpose. --Spock
    2. Re:So Visual Studio's code editor by Hognoxious · · Score: 1

      $ dotheneedful --on-having-one-doubt 'revert same'

      --
      Confucius say, "Find worm in apple - bad. Find half a worm - worse."
    3. Re:So Visual Studio's code editor by cas2000 · · Score: 2

      Don't be ridiculous, developers can't be expected to remember and type long complicated command lines.

      It'll be a button, with a dialog box for the options. A huge blinking button in prime screen real-estate so nobody can miss it. In a stunningly helpful UI innovation almost as good as Clippy, the mouse pointer will gravitate towards the button whenever the user is idle for a few seconds.

      It'll be trademarked, marketed, and patented as One Click Programming.

  10. I am a clueless manager... by richrz · · Score: 3, Insightful

    Now I can forward more stuff to look smart!

    1. Re:I am a clueless manager... by datavirtue · · Score: 1

      Mod up.

      --
      I object to power without constructive purpose. --Spock
    2. Re:I am a clueless manager... by Dast · · Score: 1

      Manager: "What are you talking about, 2-4 weeks? This problem shouldn't take you more than an hour. Just ask Bing for the code!"

      Developer: "Bing, tell me what code to add to Windows to make it suck less."

      --

      This sig is false.

  11. I've used duckduck by Anonymous Coward · · Score: 0

    but feel like a schmuck when I do[1]. I don't use ggl by default, but bing[2]. When the shit has hit the fan though I put g...com in the box up there because, well, because it's the last resort and dealing with it is like taking one in the nuts, for the team[3].

    [1] rarely finds what I am looking for

    [2] bing since it won't mutilate me (spindle, probably)

    [3] better to get it in the nuts and find what I am looking for than to walk away and not

  12. Unrelated nonsensical comments by Anonymous Coward · · Score: 0

    Have probably already ruined the internet. The President and politics have no purpose for being mentioned in this thread.

    I guess one good side effect of the election of Donald Trump has shown the importance to significantly increase spending on mental healthcare.

    1. Re:Unrelated nonsensical comments by skids · · Score: 1

      The Internet, as far as search engines go, was long ruined well before this.

      Most of the stuff you have to dig into obscure google docs or use "advanced search" to get google to do -- it used to do quite well back in the days either naturally with a few obvious extra search terms, or with some rather more well documented syntax... it got significantly dumbed down in 90s and some stuff it just can't do anymore.

      No fan of Bing, but making search engines more code-aware (not code-aware as in "oh that's code better omit it" but code-aware as in useful for searching code) is an admirable endeavor. Of course, results matter and I'll believe it when I see it... outside of examples from the PowerPoint slides used by the devs to promote their project at conferences.

  13. Weird by cerberusss · · Score: 1

    Bing extracts "the best matched code samples from popular, authoritative and well moderated sites like Stackoverflow

    If it got popular enough, this would impact the number of upvotes. And the whole idea of StackOverflow is that upvotes determine a working answer.

    --
    8 of 13 people found this answer helpful. Did you?
  14. Three wrong answers by superxstudios · · Score: 1

    Just tried three of the most basic code questions I could think of, wrong answers every time:

    "C++ opengl draw triangle" returned:
    float c = -1.0 + 2.0*desiredPixel/pixelWidth

    "C++ opengl set vertex shader" returned:
    // (Vertex buffer must be bound at this point)
      glEnableVertexAttribArray( a ); // 'a' would be 0 if you did the latter
      glVertexAttribPointer( a, 3, GL_FLOAT, GL_FALSE, sizeof( your vertex ), nullptr );

    "C++ directx 11 create 3d texture" returned:
    desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
    ComPtr<ID3D11Texture2D> tex;
    HRESULT hr = mDevice->CreateTexture2D( &desc, &initData, tex.GetAddressOf() );
    if (SUCCEEDED(hr)) {
      D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc = {};...

    Nope, nope, nope...

    1. Re:Three wrong answers by Stephan+Schulz · · Score: 1

      Nope, nope, nope...

      At least you got an answer. I queried about transparent connection to IPV4/IPV6, about accepting a TCP connection, and about multiplying to matrices in C, and I got zilch...

      --

      Stephan

  15. Samples are not for production by fuzzyf · · Score: 1

    Code samples are pretty much always "not for proudction".
    It's good that samples are easily available, as code often explains a concept better than documentation for many developers.

    The risk is that these samples are just copied in to an application with all the codesmells that it contains.

    1. Re:Samples are not for production by datavirtue · · Score: 1

      "Code samples are pretty much always "not for proudction". "

      Someone please notify all the developers and architects about this please. Please. [whimpers]

      --
      I object to power without constructive purpose. --Spock
    2. Re:Samples are not for production by datavirtue · · Score: 1

      "It's good that samples are easily available, as code often explains a concept better than documentation for many developers."

      This is not good. They are just too lazy (or rushed) to read any documentation.

      We did a major project years ago where the lead architect thought a particular system was behaving in a certain way because he did not read the documentation. He thought the system was load balanced when in fact is was just fault tolerant. The system collapsed under load requiring a number of different work-arounds that are still in place even after the initial problem was factored out.

      --
      I object to power without constructive purpose. --Spock
    3. Re: Samples are not for production by maestroX · · Score: 1

      Knuth wants his books back.

    4. Re:Samples are not for production by drinkypoo · · Score: 1

      This is not good. They are just too lazy (or rushed) to read any documentation.

      Often, documentation is also lazy or rushed... and leans heavily on code samples.

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
  16. Re:Copyright by wolfheart111 · · Score: 1

    Doesnt stack have a new copyright in place?

    --
    [($)]
  17. Not a good thing by gweihir · · Score: 3, Insightful

    It will allow some "developers" that have no clue what they are doing to fly under the radar for some more time and do more damage. And that is basically the only thing this will do.

    --
    Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    1. Re:Not a good thing by datavirtue · · Score: 3, Insightful

      These people have taken over. They are now development managers, senior developers, and architects.

      You know how you learn not deploy shit code to production? When you have to support it. Most of the people in the above mentioned roles have never had to support software in production, much less troubleshoot the root cause. I have, and the most common issue has been copy-pasta code and snippets from popular websites and blogs (sprinkle in the failure to read the documentation).

      All corporations remove support far away from developers. All corporations have absolute shit software despite the army of professionals working for them. They throw it over the wall and call it a day. The managers insulate the team from issues by lying to management or not telling them at all.

      --
      I object to power without constructive purpose. --Spock
    2. Re:Not a good thing by Dutch+Gun · · Score: 1

      True. I don't think I'd ever trust what a search engine thought was the correct answer from SO. I'd be much more comfortable looking to see the context of the code. Was there disagreement about the answer, or an alternate approach not marked as answer but with a higher rating? Were there caveats? Is there additional error handling required?

      This is all stuff a responsible programmer would definitely want to know when they get their answer.

      --
      Irony: Agile development has too much intertia to be abandoned now.
    3. Re:Not a good thing by gtall · · Score: 2

      Well, that and it means MS is spewing their code around, probably contains STDs.

    4. Re:Not a good thing by Anonymous Coward · · Score: 0

      This is nothing new. People have been doing copypasta programming since the advent of human-readable code.

    5. Re:Not a good thing by skoskav · · Score: 2

      It's like the programming equivalent of an automatic shotgun, where someone thought that shotguns needed to fire faster and less accurately.

    6. Re:Not a good thing by gweihir · · Score: 1

      I fully agree on that.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    7. Re:Not a good thing by Anonymous Coward · · Score: 0

      You’re missing the bigger picture here, this keeps those that know what they are doing in a job performing firefighting duties much longer than the alternative; doing things right the first time means by now we would be long into AI territory and out of a job. This reason and this reason alone is why I worship M$. Don’t bite the hand that feeds you ;)

    8. Re:Not a good thing by drinkypoo · · Score: 1

      All corporations remove support far away from developers.

      When I worked for Tivoli systems (just post-IBM-buyout) I was the liaison between my team (TME10 Inventory) and the developers. I brought our concerns to them, and they would address them. I would ask them questions about how the product was actually supposed to work, and I would bring those responses to my team. Sometimes I would literally overhear one of my coworkers giving a customer the wrong answer, and I would be able to tell them "no, that's not how that works" specifically because not all corporations remove support far away from developers.

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
    9. Re:Not a good thing by drinkypoo · · Score: 1

      It's like the programming equivalent of an automatic shotgun, where someone thought that shotguns needed to fire faster and less accurately.

      If your goal is to throw a lot of lead into a crowd real fast, an automatic shotgun is relatively practical. Or if you want to use less-lethal rounds like beanbags, and expect to have to engage multiple assailants with them. So no, it's nothing like that, because those make sense and this doesn't.

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
  18. Stealing Page Hits by narcoossee · · Score: 2

    So they're stealing page hits and ad impressions of the sites providing this code. Google does the same thing when you ask it questions - they show what they believe to be the answer, with a link to the source...which you'll probably never click through to, because you've already gotten your answer.

  19. Search powered by GitHub? by devslash0 · · Score: 2

    I can't help but think that this feature has more to do with the recent acquisition of GitHub than we know. Seems like Microsoft has started using your code to power its search engine and monetize your code. What about copyrights? Does it respect terms outlined in projects licences?

  20. So by SurenEnfiajyan · · Score: 2

    I'm, going to buy a workstation with 1TB of RAM and search in Bing "Windows implementation, course work". I hope this will bring an example of a working Windows source code and the browser won't crash.

  21. and since bing is from microsoft..... by Anonymous Coward · · Score: 0

    and since bing is from microsoft, the code already has memory leaks, security holes, and thousands of patch & unpatched bugs that microsoft calls "features"

    1. Re: and since bing is from microsoft..... by Anonymous Coward · · Score: 0

      Nah, Bing is where codeplex went to die.

  22. I knew I had already seen this by cascadingstylesheet · · Score: 2

    It's been on DuckDuckGo for quite some time. Often quite useful.

    1. Re:I knew I had already seen this by Anonymous Coward · · Score: 0

      I tried to like duckduckgo, but having to add -microsoft -windows to every query to not get some crap windows results when searching for pretty much *anything* got too annoying. Maybe since duckduckgo buys their crawl data from microsoft, it is somehow tainted, but it is truly ridiculous how much microsoft crap comes up in the search results.

    2. Re:I knew I had already seen this by Anonymous Coward · · Score: 0

      That's the price you pay for not being tracked. You don't get personalised results.

      The fact is most people use Windows, so most likely most people who do those searches are looking for a result relevant to Windows.

  23. come on by Anonymous Coward · · Score: 1

    just change that stupid name already!
    id say thats 95% of reason why i dont use the stupid thing. the rest is the shitty search that dont find anything

  24. Almost - accidental backdoors everywhere by raymorris · · Score: 2

    Example, or explanatory, code very frequently comes with a note such as "data validation and error handled omitted for clarity". They aren't kidding - important code is left out in order to leave bare only what's being demonstrated. Putting such code online without proper validation and error handling is putting a glaring security hole in place.

    I wrote a snippet of demo code years ago which was put into production on hundreds of thousands of web sites, though it should not have been. I demonstrated an idea with some code, which wasn't supposed to be production ready. A popular site copy-pasted it from my site, and others copy-pasted it from there. It ended up on Stack overflow repeatedly and other places as copy-pasted code that many, many people used in production. It was not secure.

    Without checking, I would bet that Bing is serving up my code when someone searches how to do that, because it's on many well-known sites. It's not secure, production-ready code, though. It's demonstration code illustrating a certain technique.

    1. Re:Almost - accidental backdoors everywhere by Anonymous Coward · · Score: 1

      I think you really should type up an article explaining why the code snippet is wrong and how to do it correctly, and then link that article here and other places when you talk about it. That way the search engines will eventually start serving up the right answer, and history will credit you as the one who taught everyone the right way to do it.

      tl;dr: Please write an article and start linking to it.

  25. Weee! by Anonymous Coward · · Score: 0

    So..... no copyright infrigements... yet?

  26. helps explain the github purchase by Anonymous Coward · · Score: 0

    And now we know there was more behind the github purchase. They are still trying to make Bing relevant to someone, or something.

  27. bing up a vrius, prius or prion by Anonymous Coward · · Score: 0

    I don't see an upside or any side at all. Google has long provided us with a search engine.

    If you have a question, Google will find that question or a similar one on the web. If you enter an answer, such as 'yes' or 'no', Google will find the answer and maybe a question too.