8 ms·
Show HN: how2 – stackoverflow.com from the terminal
- danso 11y agoNice! Installed it and will now make it part of all the computers I use. I found this funny: > It uses Google and Stackoverflow APIs, because Stackoverflow search on its own doesn't works as well. It doesn't really make sense why Google would be a better entrance point into StackOverflow's content -- but it is -- as I imagine the Google algorithm uses SO's API itself to incorporate SO's data into pagerank in some way (the tags, the points, etc.)...OTOH, after landing on a particular question via Google, if it isn't the thing I actually need, I find SO's list of related questions to almost always be on point.
- csantini 11y agoTry Stackexchange search, it never gets you what you are looking for, they are just using some kind of Elastic Search. I think Google instead indexes SO pages as any html, and does a much better job at figuring out what "unzip .bz2" means.
- forgotpwtomain 11y agoGoogle ignores special characters though - that makes it really hard to search for some things.
- zuck9 11y agoNot always. Since a year or two, I'm seeing they take into account many special characters: https://www.google.com/search?q= https://www.google.com/search?q=. https://www.google.com/search?q=.bz2 https://www.google.com/search?q=.bz2 and https://www.google.com/search?q=bz2 https://www.google.com/search?q=bz2 are different, for instance.
- chatmasta 11y agoI think google flags accounts as programmers and treats their searches differently. If I'm logged out of Google, searching for programming questions sometimes leads to sites on completely unrelated topics. Whereas when I'm logged into my account, from which 99% of my searches are programming intensive, I get all relevant programming results.
- JupiterMoon 11y agoGoogle does this with all areas of interest. Politics, knitting, cat videos, programming etc. Sometimes it is useful sometimes it will re-enforce an echo chamber effect.
- oneeyedpigeon 11y agoIME, Google's search is better than 99.9% of internal site searches.
- dogweather 11y agoWhich is weird because a site's designers _know_ which parts of the content are relevant.
- Domenic_S 11y agoI don't think it's weird at all. Google has some of the brightest search minds and years of experience; an site's team is lucky to have someone on staff who even knows what porter-stemming is.
- dogweather 11y agoOk, true. I've personally found that I can kick Google's butt simply because Google cannot trust the site's creator. This puts them at a big disadvantage right out of the gate.
- flashman 11y agoIt's not that weird. I know what content is on my site, but fuzzy matching the vast variety of input strings is non-trivial to do well. (Emphasis on 'to do well' because there are a lot of ways to get it working but poorly.)
- mc_hammer 11y agoit does though, google uses clicks as a weight for the sorting algo. so they can tell the last click for a question.. hopefully the working answer.
- Mizza 11y agoOr the more mature 'howdoi' - https://github.com/gleitz/howdoi https://github.com/gleitz/howdoi
- csantini 11y agohowdoi beahaves in a very different way. It doesn't give you unix.stackexchange.com answers by default: $ howdoi unzip bz2 readcsvbz2file <- read.csv(bzfile("file.csv.bz2")) how2 switches API depending on what language you are querying.
- danso 11y agoIt's also much nicer looking and more interactive, FWIW...I also agree with its defaults. $ howdoi inverse grep a file Simply pops this up: $ grep -L "foo" * ...apparently it scrapes the answer result and print the last occurrence of code-formatted text. Whereas `how2` pretty-prints the entire answer, narrative and code, so I know what the respondent was actually addressing. FWIW, both tools don't address what I want (I was thinking `grep -v`)...but that's not a fault of the tools, but of the ambiguity in how we ask questions. `howdoi` has far more faith in there being "Just One Answer"...where `how2` let's you move very quickly between the relevant choices, giving you the right amount of context to navigate. Well done OP!
- gnufied 11y agoUh oh, ~> howdoi parse json python {"maps":[{"id":"blabla","iscategorical":"0"}, {"id":"blabla","iscategorical":"0"}], "masks":{"id":"valore"}, "om_points":"value", "parameters":{"id":"valore"} } Yep can't agree more.
- metakermit 11y agoYou can also get the whole answer in `howdoi` by passing the `-a` flag: howdoi -a inverse grep a file Even basic syntax highlighting is supported using `-c`.
- 11y ago
- GordonS 11y agoAt first, I thought 'why2'?! But then I saw the video, the way you can specify a language, and the nice format that results are displayed in, along with the option to see more options - this is actually quite nice! It would be good to have the option to use it with Server Fault (also from StackExchange network) too.
- amelius 11y agoHow does it perform the natural language processing in the search? Or does it rely on stackoverflow for that?
- csantini 11y agoit uses Google. Because stackoverflow doesn't give you what you want.
- skoczymroczny 11y agoDoes it know how to parse HTML using regexes?
- csantini 11y agoNot yet.
- brudgers 11y agoOver the long run, if I'm living in the terminal rather than the browser, I probably will be better off learning to be effective finding help via `man` pages rather than taking on a dependency on a latent network connection and "possibly" relevant content...and node and npm and javascript. In the short run, a tool like this may make it easier to get to the point where I am living in the terminal.
- mixmastamyk 11y agoman can't help with many/most? languages. Though I agree a node dependency on lean computers is too much.
- calebm 11y agoThe next logical step is stackoverflow-powered code generation :)
- ihuman 11y agoThis already exists: https://gkoberger.github.io/stacksort/ https://gkoberger.github.io/stacksort/
- astazangasta 11y agoMy first reaction ("Wowza!") was tempered by the fear that this sort of intervening layer may erode participation (and thus quality) of Stack Overflow. I suppose such a thing will never be popular enough to make this sort of effect.
- anthk 11y agoapropos
- chishaku 11y agoVery nice. I much prefer this to howdoi. A couple suggestions: Does the `-l lang` flag correspond to stackoverflow tags which aren't necessarily limited to languages? This should be specified because the right tag can significantly increase the quality of search results. Also, it would be nice to have a keyboard shortcut that opens a question/answer in the browser. That way I can easily vote.
- csantini 11y agoI'm not currently using tags, thank you for the suggestion. Not sure is available in the SO api, I'll check. The keyboard shortcut is not hard to add. You could do it yourself :P
- haphazardeous 11y agoSaw this earlier this morning but just had to use it and boom! It worked perfectly. I really like the idea of using things on the console and the user interface is nice and sleek. would love to see this getting even better over time!
- andrepd 11y agoAwesome! It would be great if I could use it to query any stackexchange site, like TeX, for instance. Like `how2 prevent table from floating -s tex` would search on tex.se
- csantini 11y agoActually that answer would be on tex.stackexchange.com. http://tex.stackexchange.com/questions/2275/keeping-tables-figures-close-to-where-they-are-mentioned http://tex.stackexchange.com/questions/2275/keeping-tables-f... I'm not supporting this yet, let's see if I can make it work so that it uses also other stackexchange.com domains. Thanks for the suggestion!
- na85 11y agoI believe tex.stackexchange.com is what GP meant by "tex.se", as in "tex.StackExchange"
- redwards510 11y agoThis is awesome! I have one burning question though: what is the proper -l lang parameter to use for Windows consoles? I tried: how2 -l windows enable tab completion and got nothing. "PowerShell" and "batch" bring back results, but I am drawing a blank on what to call the Windows Shell (cmd.exe). Thanks!
- vadskye 11y ago"how2 -l cmd change directory" works for me. "how2 -l cmd enable tab completion" still returns nothing, though; I think that's just a query it can't answer. (A quick manual search returned totally unhelpful results, so I wouldn't blame how2 for that...)
- uxcn 11y agoText web browsers also make a lot of stuff like this reasonably easy inside a terminal. Someone mentioned http://elinks.or.cz/ http://elinks.or.cz/ a while ago.
- jimmyppi 11y agoAnother alternative that just searches google (or bing if you want to go crazy) and extracts commands from the search hits: https://github.com/jimmyppi/searchcmd https://github.com/jimmyppi/searchcmd $ searchcmd "unzip bz2" ..... tar xjvf (michaelangela.wordpress.com, superuser.com) bunzip2 filename.bz2 (cyberciti.biz, linuxquestions.org) tar xvjf filename.tar.bz2 (superuser.com) bzip2 -d filename.bz2 (superuser.com) bzip2 -dk filename.bz2 (superuser.com)
- parsethis 11y agoloving this! helps me stay in the terminal