Is there a way for me to flag something as incorrect? As an example, in [0] the python implementation should really be the SO link (using `with open() as f` rather than manually closing it)
Finally, and most importantly, there is no mention of the licensing of the code snippets here. StackOverflow [2] makes it excruciatiangly clear what the license is. Anyone who is using this for work purposes shouldn't touch this with a barge pole without a very clear disclaimer on the license of the code.
[0] https://howtoxwithy.com/how-to/b35668da-7cbe-456f-8db5-0d645... [1] https://stackoverflow.com/questions/34204523/how-to-write-to... [2] https://stackoverflow.com/help/licensing
THat's the problem with these types of sites (and the problem with SO), most of the answers and submissions are by people who don't know what they are doing.
I think these sort of sites always need a big disclaimer on every page (PLEASE DO NOT DO THIS IN PRODUCTION CODE). It's the blind leading the blind.
I do find answers that are marked as correct that are no longer the best answer, what i find less of is obviously wrong answers marked as correct
My understanding was that SO is basically the modern day O’Reilly cookbook.
I wouldn't agree with that. However, answers might get outdated.
‘ThAts nOt HoW YoU aPpLy TherMal PasSte’
The idea is that anyone can submit alternatives, the one with the highest number of votes will be most prominently displayed. I personally am not a Python developer and just seeded some initial snippets, but hopefully someone who is submits new ones.
That's a great point re. the licensing, I will have to look into it.
Googling questions brings me to stack overflow which has years worth of information, and answers to all of these how do I do X with Y questions, along with links to the documentation. Why would I want to use this site rather than stack overflow, what does it do differently? If SO has everything your site has plus more, (and lets be honest, SO has answers for those questions), I don't see the benefit here.
> I personally am not a Python developer and just seeded some initial snippets
While I understand why this is done, this is exactly the issue. The code you have right now is wrong, but stack overflow's is correct.
The problem with stack overflow (again, for someone like me) is that issues posted on there get abstracted to oblivion, resulting in posters proffering a million different, mostly correct, mostly complicated, solutions. Also, I believe OP’s product has a way narrower scope than stack overflow.
SO is not going anywhere anytime soon. I just don’t see why it has to be the end all resource.
Assuming OP can find a good way to deal with duplicate entries, it seems like a more “to the point” version of SO that can be referenced before having to deep dive SO’s massive sea of information.
Just a layman’s two cents.
> SO is not going anywhere anytime soon. I just don’t see why it has to be the end all resource.
I don't think SO has to be the end-all resource, but to me it seems that this site is just a subset of SO's functionality, and doesn't provide anything different.
Has anyone seen anything like this before? This submission seems like it could be a first step, but it's not the authors' goal.
Somewhat more on-topic, learnxinyminutes[0] is fantastic for jogging my memory on languages I use rarely.
[EDIT] - Oh also, I think that this kind of project could have some enterprise viability -- having private instances sharable by tech teams could make it much easier to on-board and share code snippets/best practices with team-members and keep tech-debt knowledge fresh.
Programmers of legalese are ... special. Even fewer people get into that field than get into programming. Because expressing your thoughts and modeling reality precisely is the hard part. Not the syntax.
All we do is send instructions to computers all day that are mostly executed perfectly, changing the language you use to speak to the computers is the point of higher level languages, and I strongly consider english to be just another frontend (in the LLVM sense), just one that is a lot harder to encode the semantics of fully. But the thing is, you don't need to encode the semantics fully -- just make paths one at a time for certain functionality (ex. `read_file(path: string): string` can have it's first "call sentence" be "read file from <path on disk: var> and store the contents in <new const var>")
I agree with the enterprise knowledge sharing! Every company has many snippets and commands they always use
I don't think it'll ever work, there's the obligatory xkcd comic about the limits of sophisticated programming languages. The code will never free you from the burden of having to specific exactly what you want.
Maybe an ML/AI parser for natural language would be a possible improvement and then tweak the details after the parsing. Likely just make things more complicated though.
In my mind it's less about freeing the user from specificity, but just changing the language under which that specificity happen. Honestly it's just syntax! Imagine something like:
> open file on disk at "/some/path/to/a/file" into $my_file_handle. read contents of file handle $my_file_handle into new variable $contents. print $contents to standard output.
Imagine every sentence just being a textual template for a function invocation, with context in-between functions (state) being preserved and managed implicitly with the use of variable names & prose. signatures for the functions required would be something like:
- open_file (path: string): file_handle
- read_bytes(fh: file_handle): string
- print(s: string): void
We already have functions like this and compose them in ways that the text suggests -- it's more about just adding a different way to group and recall up the composed functionality.
I started this project last Tuesday to scratch my own itch. It's basically copy/pasteable code snippets for common tasks in many languages.
Like many developers I work in different languages and often forget syntax or how to do simple things. I find if I'm working in a big codebase I can usually get comfortable quickly, but it's when I'm faced with a blank page in my editor I think... err how do I do this again?
I don't see any "about this site", "who created this site", etc. I don't see any information about who authored a particular snippet. Perhaps more information is available if you log in? But it seems like it should be possible to evaluate the trustworthiness of a site _before_ sharing information with it, so I don't feel comfortable interacting with the site as it is.
I stated elsewhere in this thread but the project is only 6 days old. I haven't had time to code up an /about page, reputation system and user profile pages just yet.
Some questions:
- Is the project open-source?
- Why no github signin?
- How do you search for X but only in Y language?
- How are you going to deal with duplication?
- Will you be doing a full 2D spread of combinations? E.g. writing to a file is pretty common - perhaps you can create a relationship between languages so that you can see how it's done in other languages from the same page.
- How will you handle cases where there are multiple ways of doing things?
- Is search broken? "Write to a file" is the first entry there without searching, but searching for "write to a file" shows no entries. - How will you handle cases where environment matters? E.g. writing a file in Javascript is going to be different between web browsers and Node.js, and force-inlining a function is going to be different between clang and msvc, etc.
- Is the project open-source? Not open source yet but no reason why it can't be.
- Why no github signin? Good point. I recently mulled over which O Auth providers to support and for an MVP I decided Google was enough.
- How do you search for X but only in Y language? - Will you be doing a full 2D spread of combinations? The idea is the page "How to write to a file" has all the language examples
- How are you going to deal with duplication? If it gets popular I will deal with that issue then.
- How will you handle cases where there are multiple ways of doing things? - How will you handle cases where environment matters? You can have multiple examples per language. The one with the most votes will be most prominently displayed.
The idea is that you can have multiple examples per language, the highest upvoted one is displayed first, then you can page through the others.
You can also comment on examples.
But yes, care needs to be taken for sure.
from pathlib import Path
p = Path("my_file.txt")
p.write_text("thing that needs to go into a file")
[0]https://docs.python.org/3/library/pathlib.html#pathlib.Path....I'd given up on the site as broken before I saw other comments here suggesting I missed something, so I tried loading it again, this time in Chrome, and there I saw more examples, but still all JS. with no other obvious options or way to find other languages.
Finally I noticed "5 other examples" in what is literally the least-highlighted text on the screen, and that led to me other languages.
Discoverability: 1 out of 10
As the header text rotates, it shifts the rest of the content up and down which is not helpful for reading or targeting.
All in all, I won't be back.
Looks alright for me in Safari, the snippets shown are just the ones with the most votes, right now those are all JS.
I do agree that the interface isn't 100% intuitive, I'm not much of a designer and I whipped this together in the last week. It will get better.
Maybe I'll check back in a few weeks after all!
>>> my_array = [1, 2, 3, 4, 5]
>>> my_array.remove(1)
>>> my_array
[2, 3, 4, 5]This project serves a few purposes:
- scratch my own itch. I am missing something like this
- test launch on Product Hunt/Hacker News. I developed this in 6 days and I have a larger product I want to launch soon (https://portabella.io) but I want that to go perfectly. This served as a kind of dry run
I beefed up the servers for today but day to day I only expect this to cost me a few bucks a month, so keeping it running is no issue.
It can also be nice to point to something and say, I made that, so I'm happy to have it up and running.
Having to grasp logical problem solving _and_ code syntax at the same time can be overwhelming when just starting.
ie. making an http request, do you include DNS, headers, TLS or is it simpler to just say `https.get(url)`
Then I'd say: Now that we've dissected the problem, let's write the code.
Yeah. High level. But I can see it making learning simpler as it separates the problem solving, from the implementation (code). And the same problem could be demo'ed across multple languages.
Could be pretty neat, but it won’t let me proceed to login with Google.
I was curious how categories and languages were managed. How do you prevent the inevitable “How do I hack The Gibson with Visual Basic 3” if they’re all fully crowd sourced?
Edit: mobile typos
I guess for now while it's small I have to heavily moderate, which I have no problem with. If something is detracting from the platform I will remove it, but it's a fine line where I cross into S/O territory where they mark everything as off topic.
It's possible your Google email is not verified?
Thanks for the bug report!
EDIT: I literally can't even click on the site's logo to go to their front page without being kicked out of their site entirely.
EDIT2: Oh you made that site. Don't use the history API to go backwards (: it's a UX nightmare.
403 ERROR The request could not be satisfied. Bad request. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner. If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
Generated by cloudfront (CloudFront) Request ID: CYfM2liDaLwK2Mu8q7vnSE5rn89Fg8HmUSY6jIrL_5iTxe2dU1ADyw==
For example: When I try to verify my account, (using https://backend.howtoxwithy.com/auth/confirm/BIGHEXNUMBER) I get a message:
No webpage was found for the web address: https://backend.howtoxwithy.com/auth/confirm/BIGHEXNUMBER
Also when I used https://howtoxwithy.com/how-to/615701ba-4707-423d-a012-47943... It let me login as David Whitten but when I used the NEW Button, two things:
1) I can't put in the language name I use. This increases the pain of using an obscure language. Since I use a very niche language, it is frustrating that languages that I know have significantly smaller worldwide code bases are there, but M is not. The page
https://github.com/csurfer/gitlang/blob/master/languages.txt
lists all the languages accepted on github as of 2016 (it is a simple list, suitable for a dropdown list). The page https://github.com/github/linguist/blob/master/lib/linguist/...
gives more details about the languages recognized by linguist.
2) Not reproducible: When I choose a language (like JavaScript) the dropdown list is blank for that item. I expect it is just that the text color is the same as the background, actually)
Thanks for that report.
I've fixed that issue with the drop down. I'll need to look into the account verification issues. I'm having no problems on my end.
I have a the development/bug tracking board here https://app.portabella.io/projects/daa40d3e-655f-4cb4-b4f4-6..., it's read only for the public right now. I'll get on to using a different list of programming languages shortly
This is given as how to write to a file in Javascript.
const {fs} = require('fs')
fs.writeFileSync('/tmp/myfile.txt', Buffer.from('hello'));
But you can't just do this in plain old JS. It needs to be Node running ES6+
[0]: https://howtoxwithy.com/how-to/b35668da-7cbe-456f-8db5-0d645...
This is actually really cool - imagine that you could go from pseudo-code to working program using this library.
Definitely agreed on organising better.
“Oh perfect, how to append an array in Java is what I’m looking for. Tap. nothing. question rotated out already. Ok.. Do I have to type the whole thing in search to find it now?“
Cherry on top. It's not as if python had a special syntax to use a resource and close it automatically at the end of the block, precisely to avoid this sort of issues. /s