Google Unveils Code Search
derek_farn writes, "Google now has a page that supports source code searching. I hope they extend it to be more programming-language aware (e.g., search for identifiers and functions) like the specialist code search sites (Krugle, Koders, and Codease), who probably now have very worried investors. I don't see any option to search for Cobol. I guess there is not a lot of Cobol source available on the Internet, even although there is supposed to be more Cobol source in existence than any other language (perhaps that statement is not true in the noughties)." From the Cnet.com article: "Google engineers, many of whom participate in open-source projects, already use these code searching capabilities internally. Since it is a Google Labs project, the company is not yet seeking to monetize searches through ads."
sooner or later http://www.google.com/codesearch?as_q=fuck&btnG=Se arch+Code&as_lang=&as_license_restrict=i&as_licens e=&as_package=&as_filename=&as_case=
God is real unless declared as int
VB has been the language with the most LOC since the early-mid 90's.
As scary as that sounds.
not to undermine the Google's work but in the meantime you may as well try this one
http://koders.com/
I made a simple search for "fade file:.js" in order to find a javascript function that would fade a div or table or anything really (I know scriptaculous offers this already, just curious as to what's out there). I found something but the header of the file read:
... it seems to be restricted to one of two uses. If I'm looking for code that does natural language parsing, I could hope a comment somewhere contains NLP as a description of what's going on. Or, I could look for libraries out there with methods and then search for those methods to see how other people used them to get an idea of how they work. The vast majority of this code seems to be just web development front-end code at least from the few searches I've done. Too bad, that's a very small part of programming.
All Code herein is Copyright 2005 Match.com
Do not copy, reproduce, reuse or sell any code herein
without the express, written consent of Match.com.
For information contact webmaster@match.com.
All Rights Reserved.
Which is expected. However, that means this tool isn't useful for finding a method or function or class I can use and then using it
My work here is dung.
...I can forget RegEx's now.
But honestly, this might have some bells and whistles but I don't see myself getting rid of my regular expression searches any time soon.
"If you are a dreamer, a wisher, a liar, A hope-er, a pray-er, a magic bean buyer
It's the sound of millions of CS majors cheering!!!!
Dang, this a neat tool.
Yep, I never spell check.
More incorrect spellings can be found he
At last we can use regexps and search on all the important characters between the alphanumerics! For example the prefixed '@' in PHP - very hard to figure out what this is, without reading the reference cover to cover. Now at least we can search the codebase and hope to see some useful comments preceding it, or figure out from context what's going on.
e.g. "@fopen file:.php"
http://www.google.com/codesearch?hl=en&lr=&q=fucke d&btnG=Search
Open Source projects that you know are written in COBOL? I don't know of any. It is a lot of legacy code. There is very few new projects being started in COBOL.
This is pretty cool.. i hate trying to search code on normal google, it usually filters out most of the search characters and you end up with nothing useful.
Now if only they'd add regex searching to normal google (unless it already has it and i'm missing it?)
mmmm regex
[an error occurred while processing this directive]
Whenever I search for something code related on the web it's usually because I want to know how to do something. In such cases I dont really know what the code itself would be (i.e. the reason why I'm searching) so this wouldn't help at all. I suppose if you were looking for specific code it could be useful, but why would you be doing that? That would likely be your own code, so wouldn't a simple grep be easier?
I'm sure I'm missing something here - Google doesn't (usually) release useless new products :)
all bugs are shallow."
C sif%5C(%5B%5E)%5D*%5C)%3B+license%3Agpl+lang%3Ac%2 B%2B&btnG=Search
Well, it looks like that's not really the case: http://www.google.com/codesearch?hl=en&lr=&q=++%5
I hope this service will help improve code quality...
"I don't see any option to search for Cobol."
Well, that's one entire season of "Battlestar Galactica" rendered entirely pointless. Thanks a lot!
Where were you when the voynix came?
i sign my code changes in projects with "// cyc" or "// ric".. so naturally i tried those (and came up with sod all, naturally)... but the latter will also return
"// a long bit of text written by eric smith "
searching for
"//.ric"
on the other hand gets closer matches to what i intended
If you don't risk failure you don't risk success.
It's a good start. They really need to start searching Subversion/CVS repositories as well. One of the most obvious things that they seem to have missed is to index all the Sourceforge downloads.
were you expecting to see a sig here? perhaps you'd rather see the inside of an ambulance!
I would just like to burn a few karma to say that is the most disjointed, stream-of-consciousness summary I have seen in some time. There's one tiny little terse sentence announding the existence of the new search functionality, and somehow it manages do do so without even what kind of "code" we're talking about. Then the rants begin. The remainder of the paragraph has an average of one parenthetical remark per sentence, including two in a single sentence; and fully two-thirds of the rant is complaining about the lack of Cobol, of all things.
Phew, I feel better.
Patrick Doyle
I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
As a programmer who needs to solve a problem I need a place to find answers to the problem I am solving. Searching for a code won't do it because I am looking for an answer and not how to code it. To find answers I use Omgili - it is a vertical search engine that search ten of thousands of forums and millions of discussions. Usually someone already asked my question and hopefully it has an answer. It is highly recommended for troubleshooting and specific problems/questions.
How to find security holes in PHP web applications:
e +%5C%24_POST+-addslashes+lang%3Aphp
http://www.google.com/codesearch?hl=en&lr=&q=Wher
They who would give up an essential liberty for temporary security, deserve neither liberty or security - Ben Franklin
This functional language is so interesting, there should be more talk about it.
Utinam logica falsa tuam philosophiam totam suffodiant!
Will SCO be suing as their "copyrighted" code is now going to be available via Goooogle?
found these perhaps interesting: http://www.google.com/codesearch?q=+%22backdoor+pa ssword%22+show:jRPhp0ZHKTo:ci7RRg0kwvU:Xm5ri9nsh7w &sa=N&cd=4&ct=rc&cs_p=http://ftp.osuosl.org/pub/Fr eeBSD/distfiles/flash-0.9.5.tar.gz&cs_f=flash-0.9. 5/flash.1#a0
http://www.google.com/codesearch?q=+%22backdoor+pa ssword%22+show:1lII5NN2DDk:enqxwGER2sU:KEOg6Taq6iU &sa=N&cd=6&ct=rc&cs_p=http://ftp.osuosl.org/pub/Fr eeBSD/distfiles/xsw1.23.tgz&cs_f=xsw1.23/server/ne tlogin.c#a0
http://www.google.com/codesearch?q=+%22backdoor+pa ssword%22+show:L4YZQESJxWo:Yryh5NFJxw0:UVx7zLw_NI8 &sa=N&cd=9&ct=rc&cs_p=http://www.mudmagic.com/code s/dl/2463/copper-3.tar.gz&cs_f=Copper3/nanny.c#a0
Good programmers write good code. Great programmers find it on Google!
Read any good sonnets lately?
Your search 10 print "boobs" 20 goto 10 returned no results. Try searching again using fewer terms.
Fnord.
Google is not the first to unveil a code search service. Previously, Famous book publisher O'Reilly launched a beta of its Code Search service last month that allows users to search a combined 2.6 million lines of code published in its books.
For online services : Don't put up code that states explicitly, not for production .
For users : Stay away from online services that put up code that states "not for production". :-)
cpan.org
...
twiki.org
osuosl.org
I searched for some of my own code from sourceforge CVS, and it couldn't locate it.
...just look at this :
http://www.koders.com/
Ok, I read that headline wrong and though that Google had finally lost its mind completely...
Check out MashSearch.com
Anyone who is a coder knows that when it comes to solving a problem looking through someone else's code without knowing what to look for won't help you. Omgili is a discussion search engine that covers millions of questions and answers. Whenever I have a question about how to do something I search Omgili for answers - very good search engine!
Crap! There goes SCO's case.
Opus: the Swiss army knife of audio codec
I know I'm not alone in my most hated language
34486853790
Connection too slow for X forwarding? Try "ssh -CX user@host"
Well, once the search database factored out all of the boilerplate declarations, there was pretty much nothing left to store.
http://www.google.com/codesearch?hl=en&lr=&q=%22di rty+hack%22i x+me%22
http://www.google.com/codesearch?hl=en&lr=&q=%22f
If sco had this to search through linux.. Just imagine..
SCO: You used our patented while loop over 4000 times in our code...
I hope my CS professor doesn't find this until the semester is over.
The search apparently lumps everything with the word "basic" in the title together. QBasic, Visual Basic, VB.Net, etc...
While the non-visual and Visual Basic merges aren't that bad, putting VB.Net into that category is a major headache. VB.Net is syntactically similar to VB6, but is fully object oriented and is coded in just like C#. So looking for VB.Net samples in the Basic category returns a lot of VB6 code solutions that may look syntactically correct, but are far from the best practices.
-Rick
"Most people in the U.S. wouldn't know they live in a tyrannical state if it walked up and grabbed their junk." - MyFirs
Google Unveils Search Code? I was thinking they opend up.
Don't fight for your country, if your country does not fight for you.
...and I thought I was the only one being this clever and humorous in my source code...
SIG: TAKE OFF EVERY 'CAPTAIN'!!
This entire project is either a very good or very bad idea.
(1) Automated searching for security vulnerabilities.
(2) A lot of that code is copyrighted. Which yes, it's transmitted over the Intarwebs regularly, but now it's just a little easier.
I'm not saying it's not a *cool* idea, but from the looks of the Slashdotters trying out this new power, I'm not sure Google thought this all the way through. (1) is great when your code runs a web service and nobody sees it but your team or organization. (2) I can foresee a lot of CS kids using this to find that magic snippet to complete Problem Set 13, and/or a lot of copyrighted code finding its way into private projects.
Just sayin'.
Oh, how about this?
This is just too funny :-)
/* potential mating partner */ /*printf( "." ); fflush( stdout );/**/ /* mating must be mutual */ /*M_wait += 15;/**/ /*printf( "+" ); fflush( stdout );/**/ /* this is male object */ /* perform breeding in female object */ /* this is female object */ /* current position */ /* behind position */ /* back to field wall */ /* newborn's position */ /* move mother backward */ /* conception */ /*printf( "CHILD%d ", child );/**/ /* birth */
/* partner.printGenotype();
void Mammal::mate( Mammal& partner ) {
M_partner = partner.getId();
if( partner.getPartnerId() != M_id ) {
return;
}
if( M_gender == 0 ) {
partner.mate( *this );
return;
}
assert( M_gender == 1 );
int x = M_x, y = M_y;
switch( M_direction ) {
case EAST: x--; break;
case NORTH: y++; break;
case WEST: x++; break;
case SOUTH: y--; break;
}
if( !M_field->in( x, y ) ) return;
int cx = M_x, cy = M_y;
M_x = x;
M_y = y;
orgasm();
partner.orgasm();
Mammal* child;
child = new Mammal( *M_field, cx, cy, NEWBORNENERGY, *this, partner );
M_energy -= CHILDBIRTHENERGY;
M_population->add( *child );
printf( "MATE(%d,%d)->%d(%d) ", M_id, partner.getId(), child->getId(), child->getGeneration() );
partner.printState();
printGenotype();
printState();
child->printGenotype();
child->printState();/**/
}
void Mammal::orgasm() {
M_energy -= MATINGENERGY;
M_result = 1;
}
Beware: In C++, your friends can see your privates!
That was funny, not troll-y.
If you are going to search for that you might as well search for this.
http://www.google.com/codesearch?q=+damn+boss+sho
I just searched for "20 GOTO 10". Oh my. I don't know if that is funny or sad.
Have you read my journal today?
Google found a word in a source code archive on my site. The others did not.
I think google is the only one using regular expression patten matching from the users end.
Hint: completely clear the field or at least delete any end character when doing a different search as some non-printable characters might remain and give you bad results.
ALL YOUR CODE ARE BELONG TO GOOGLE! I just couldn't resist. I hope those other code search engines have a backup plan cause Google is taking them head on.
WTF?
no really lameness filter, there is no point in text in this message....
I am, and always will be, an idiot. Karma: Coma (mostly effected by
Just imagine if SCO had access to this a few years ago!
Large mainframe (ZOS / OS390) systems are still written in COBOL (or COBOL generators like DELTA).
:)
Yes, I work for one of several organisations that still has mainframes (and still will in 10 years time). It happens to be the best language for the tasks we have.
Some stats...
We run 97% of our transactions on the mainframe and 3% on the midrange (Java, webMethods, WebSphere, etc). At this time they both cost about the same to run. The difference is that the mainframe is processing _millions_ of transactions, the midrange isn't.
Until such time as newer languages can compete at the mainframe level we will continue to have new applications written in COBOL.
However, all of these projects are for (as far as I know) government departments and you won't see the source anywhere outside their mainframes. For those who want to be scared: our current systems interface with each other and the web in much the same way as the new "cool" technologies do. Google "CICS web interface" for more information. They do update the COBOL language too. It has changed since 1959 and is actually acceptable for the tasks it is currently used for in the mainframe world. Can't wait for the COBOL plugin for Eclipse.
This tool is going to be exceptionly useful for the code that is on the net.. regardless of what it is. Although.. searching for JCL right now is interesting enough as it is
You have a sick, twisted mind. Please subscribe me to your newsletter.
Truly useful idea that deserves mod points.
Because of that, it's probably considered proprietary information, so you aren't going to see it released to the public. I suspect a lot of it is fairly company-specific, anyway, and may be of little use outside its original context.
Mainframe/UNIX Bit Twiddler and long time Windows/Linux Hobbyist.
The Theorem Theorem: If If, Then Then.
I can't find any of the software with my name on it that's on SourceForge, though.
Your design to a real part online: Big Blue Saw
During a short period when we were supposed to modify the 2.4.X linux short term scheduler, we found functions that had no body, took no arguments, and were used as comments.
I have been wondering about them until today.
This one gets over 32,000 hits. Then there's 41,000 for this one.....
Wow, this is great! One of the things I use Google for most during the day is hunting for example code whenever I'm trying to use something new to me. This code search should make that a lot easier now. With that in mind, I'll have to be more mindful of posting my own code examples in a searchable format!
To the making of books there is no end, so let's get started
http://www.google.com/codesearch?hl=en&lr=&q=confi dential%7Cproprietary&btnG=Search
must... stay... awake...
I am sad to not see Delphi as an option.
Just in case anyone else was interested in what you get by searching that, results 1-2 are part of the COBOL language reference from IBM, but after that you get into sample code pretty quickly. (And if you wanted to add one more language to the list that you can write "Hello, world!" in, here you go.)
37,500 results total. Not too bad for a "dead" language.
"Ladies and gentlemen, my killbot features Lotus Notes and a machine gun. It is the finest available."
Code I have on my site in some ZIP file has obviously been downloaded, unpacked and indexed. Not that this process would be so hard, especially for Google with all of its technology in place, but my site isn't anywhere near important (and code is not in CVS and it's not on Sourceforge or one of the other repositories) and they have all of my little tools crawled and the snippets they show are very insightful for the searcher. A job well done.
That's the number of times it found the word "hack".
There are 0x40000000 types of people: those who understand 32-bit IEEE 754 floating point, and those who don't.
Some programmers put the default password in sourcecode and Most lazy users never change the default password.s word+is%22
This makes it easy to get the default password which can be exploited.
http://www.google.com/codesearch?q=%22default+pas
http://www.google.com/codesearch?q=+horrendous&sa= N
I want to know how to do something. In such cases I dont really know what the code itself would be (i.e. the reason why I'm searching) so this wouldn't help at all. I suppose if you were looking for specific code it could be useful, but why would you be doing that?
:-)
The fact that Google engineers are using it internally is a good sign. They've written one or two programs, you know.
It's great if you know what library to use. For example, let's say I know I want to use a QCheckTableItem. The API docs are OK, but not great. The Qt docs have examples for many things, but not everything (and I'm not sure if there's an example for this or not; it's not linked from that page).
So I type "QCheckTableItem" in the box, hit return, and presto, I've got 200 examples of this class being used in real-life code. Since I'm using Python, I can add "lang:py" to only see Python code -- something that's hard to do with a normal Google search, and impossible with the Qt examples (which are all C++).
If you don't even know what function/class/module you need, it's less useful, granted. Perhaps this will finally convince some people to comment their code. I'm so sick of programmers writing code without documentation. (Yeah yeah, you claim it's "self-documenting" but you also use variable names that look like your cat walked across the keyboard. crlWdLn, my ass.)
Some funny stuff there.
Web2.0: I love when people Flickr my cuil and digg my boingboing until my google is reddit and I start to yahoo
I also vote for including Component Pascal (Oberon) in the Google code search. There is an international communitiy of users who could benefit from this.
I don't think this word means what you think it means...much less, anything.
Take off every 'SIG'!!
I'm in iran and as a developer I was very interested in this new feature but this is what I see tring to open the Page!
We're sorry, but Code Search is not available in your country.
now come on! why ! well I think that's obvious.
Wish the regular Google could do that...
Philistines...
http://www.google.com/codesearch?q=change_on_insta ll&btnG=Search+Code
there's no place like ~
Companies can already purchase a Google search engine for their internal documents and such. It seems a natural extension for it to be good at searching source code as well.
We are searching for the lost tribe of humanity.
Holy shit!
If only SCO had their hands on this, they could have saved themselves a butt load of cash when they found out earlier that their case was a sham!
Curiosity was framed; ignorance killed the cat. -- Author unknown
... still using "GOTO"?q =gotorel=url2html-1642http://www.google.com/codese arch?hl=en&lr=&q=goto>
ahref=http://www.google.com/codesearch?hl=en&lr=&
http://www.google.com/codesearch?hl=en&lr=&q=FIXME &btnG=Search
http://www.google.com/codesearch?as_q=(IDENTIFICAT ION%7CENVIRONMENT%7CDATA%7CPROCEDURE)%5Cs%2BDIVISI ON&as_case=y
Me lost me cookie at the disco.
Indent style searches: K&R about 5,900,000 Alli (Actually, this is a bit broken! Anyone worked out how to enable multiline mode?) about 11,100,000
Me lost me cookie at the disco.
This news is being discussed at Slashdot Japan and they say Google uses http://gonzui.sourceforge.net/ software developed in Japan.
I prefer using , which has several more languages to search for (including COBOL), but of course, the code on koders is only code that has been submited to the site, which would give Google's code search an upper hand.
Jeff K. is my homeboy.
Always fun to search for: http://www.google.com/codesearch?hl=en&lr=&q=%22i+ am+the+walrus%22&btnG=Search Someone dial the RIAA hotline!
Some of the adjacent comments are amusing... or maybe scary... I wonder how much security code can be bypassed by a parameter of 666.
A whole new set of googlewhacks!
Try: hacked polygot