Wikipedia:Reference desk/Archives/Computing/2016 February 26
Computing desk | ||
---|---|---|
< February 25 | << Jan | February | Mar >> | February 27 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
February 26
[edit]Programming language "cheat sheets" in the form of example programs
[edit]Anyone know of good programming language "cheat sheets" in the form of example programs that illustrate a language's syntax and features? I'm trying to find resources like that for common programming languages and could use some pointers. Thanks. --134.242.92.97 (talk) 00:59, 26 February 2016 (UTC)
- Rosetta Code is very popular. For example, you can see Euler's Method implemented in some fifty or more languages, including an example solution to solve Newton's Law of Cooling; or reverse a string of characters implemented in some 169 programming languages. Nimur (talk) 01:08, 26 February 2016 (UTC)
- Thanks for the links, as well as those from others who responded so far. I forgot to say in my original questions that I was particularly interested in example programs that have been crafted to illustrate a lot of the basic syntax/features in a relatively small amount of code (a page or two, not much longer than that). The programs don't need to solve any meaningful problem, but the density of syntax/features demonstrated should be high. A good example program should, for instance, illustrate
- the basic layout and "routine" parts of a program
- the syntax for single-line and block comments
- common conventions, e.g. capitalization style of identifiers
- the built-in data types
- how you'd import functions, types, classes, constants from another module
- the syntax for defining a class, its constructor & other methods
- the basic control structures supported & their syntax
- how you'd do file I/O in the language
- the scope rules
- the features for supporting exception handling
- ...
- Are there compact example programs crafted to demonstrate these for different languages? --134.242.92.97 (talk) 15:32, 26 February 2016 (UTC)
- This will only work if you only consider languages that are essentially identical except for their syntactic sugar. In actual fact, some programming languages are fundamentally different and have very different concepts. It is not merely a matter of learning which punctuation marks and bracket/whitespace conventions apply.
- For example: read through our article on these languages: APL, Verilog, and Haskell. How do you assign a variable in Haskell? You don't. How do you write a for-loop in Verilog? You don't. How do you ... I mean ... how do you think you might learn APL from a "cheat sheet"? You have to conduct a lot of structured learning before you can even find where the source-code is in a sample APL program listing.
- Nimur (talk) 16:35, 26 February 2016 (UTC)
- The "cheat sheets" are not intended to be a learning tool, but a handy refresher of the basics of something that I don't use regularly. For example, I don't have a regular need to write bash scripts, but on the occasions I do, I'd often have trouble recalling how to do something that I've looked up months before. There's always the man page, but I find a well-crafted example program to be much easier and more user-friendly for the purpose. --134.242.92.97 (talk) 17:01, 26 February 2016 (UTC)
- Thanks for the links, as well as those from others who responded so far. I forgot to say in my original questions that I was particularly interested in example programs that have been crafted to illustrate a lot of the basic syntax/features in a relatively small amount of code (a page or two, not much longer than that). The programs don't need to solve any meaningful problem, but the density of syntax/features demonstrated should be high. A good example program should, for instance, illustrate
- For less common programming languages you can look at codegolf. Many problems have solutions in multiple languages, like this one. They are trying to make the code as short as possible, so readability suffers, but it may be useful to you none the less. This page and that one show you the famous Hello World program in many languages. The Quixotic Potato (talk) 09:29, 26 February 2016 (UTC)
- The question has been updated so I'll update my answer: I am not sure if something like that exist, but there is something very similar that may be useful to you. On the internet there are many snippet collections for many different programming languages (Google: snippet collection c++/python/COBOL/Fortran/whatever). What you want is basically a collection of snippet collections. Google has already done that for you, and they've helpfully sorted out the best ones for each programming language. The Quixotic Potato (talk) 02:25, 27 February 2016 (UTC)
- This site has the lyrics to 99 Bottles of Beer in over 1500 languages. It's great fun although probably not much use for learning. This thread [1] on an IT techies forum has hundreds of links to cheat sheets. As it's a forum, some links might be dead but I always look here when I'm after a cheat sheet. --TrogWoolley (talk) 10:21, 26 February 2016 (UTC)
Multi links not working
[edit]Imac, still running Snow Leopard, using the latest Firefox. Just recently the Firefox add-on Multi Links has stopped working entirely (no longer even shows up at the bottom right corner of the browser window). I rely on it. I've restarted. Nada. I tried installing an updated version called multi links plus. Doesn't work. I tried a different add-on called multilinkus. It doesn't work either. Stumped. There must be something causing this. I know of no changes to any software I use but for keeping Firefox up to date. Anyway, I know that's not much to go on, so unless you have some idea what might be causing this, any suggestions for an add-on that provides a similar functionality?--Fuhghettaboutit (talk) 02:31, 26 February 2016 (UTC)
- Please describe the functionality you need. StuRat (talk) 03:55, 26 February 2016 (UTC)
- right click and hold to drag a box around links to open them all at once. The Quixotic Potato (talk) 09:22, 26 February 2016 (UTC)
- Snap Links Plus. Its probably caused by the new Firefox version. You can edit the plugin to allow it to run in newer versions of Firefox if you prefer the old plugin. I also use URL lister and ReloadEvery. The Quixotic Potato (talk) 09:14, 26 February 2016 (UTC)
- Ah thank you The Quixotic Potato. Snaplinks works – sort of. When I right click I get a menu ("save page as"; view background image"; "select all" etc.) I can drag the rectangle to open links, but it's partially obscured behind that menu.--Fuhghettaboutit (talk) 12:37, 26 February 2016 (UTC)
- That's really weird, when I hold down the right mouse button the menu does not appear (until I release the button). Just out of curiousity: try it without dragging. Hold down the right-mouse button in Firefox. Does it show a contextmenu before you release the mouse button? The Quixotic Potato (talk) 12:38, 26 February 2016 (UTC)
- Yes, no dragging, right click I get the menu, no way to avoid it I can see. I always get that menu (or a different one depending on context) when I right click – immediately. Maybe it's a setting issue or maybe it's how it works in Snow Leopard, and you're up to Maverick so don't remember the old interface (I have some good reasons for not updating, though the fact the latest Java would not install is making me think I may need to bite the bullet soon).--Fuhghettaboutit (talk) 13:25, 26 February 2016 (UTC)
- @Fuhghettaboutit: I do not currently own a Mac anymore so I am unable to test this, but I wouldn't be surprised if pressing Escape would close the menu. Can you try holding the right mouse button (the menu will appear) and then pressing Escape while still holding the right mouse button to see if it closes the menu? Maybe this workaround will allow you to use Snap Links without it being partially obscured by a menu. The Quixotic Potato (talk) 14:06, 26 February 2016 (UTC)
- Ah, I will try that! (in about 12 hours when I return home). Thanks!--Fuhghettaboutit (talk) 14:26, 26 February 2016 (UTC)
- @The Quixotic Potato: Yes, that works perfectly. Solved and most appreciated.--Fuhghettaboutit (talk) 23:05, 26 February 2016 (UTC)
- I love you too! Of course this is just a workaround, maybe one of our local Macintosh experts has more information. The Quixotic Potato (talk) 23:06, 26 February 2016 (UTC)
- @The Quixotic Potato: Yes, that works perfectly. Solved and most appreciated.--Fuhghettaboutit (talk) 23:05, 26 February 2016 (UTC)
- Ah, I will try that! (in about 12 hours when I return home). Thanks!--Fuhghettaboutit (talk) 14:26, 26 February 2016 (UTC)
- @Fuhghettaboutit: I do not currently own a Mac anymore so I am unable to test this, but I wouldn't be surprised if pressing Escape would close the menu. Can you try holding the right mouse button (the menu will appear) and then pressing Escape while still holding the right mouse button to see if it closes the menu? Maybe this workaround will allow you to use Snap Links without it being partially obscured by a menu. The Quixotic Potato (talk) 14:06, 26 February 2016 (UTC)
- Yes, no dragging, right click I get the menu, no way to avoid it I can see. I always get that menu (or a different one depending on context) when I right click – immediately. Maybe it's a setting issue or maybe it's how it works in Snow Leopard, and you're up to Maverick so don't remember the old interface (I have some good reasons for not updating, though the fact the latest Java would not install is making me think I may need to bite the bullet soon).--Fuhghettaboutit (talk) 13:25, 26 February 2016 (UTC)
- That's really weird, when I hold down the right mouse button the menu does not appear (until I release the button). Just out of curiousity: try it without dragging. Hold down the right-mouse button in Firefox. Does it show a contextmenu before you release the mouse button? The Quixotic Potato (talk) 12:38, 26 February 2016 (UTC)
- Ah thank you The Quixotic Potato. Snaplinks works – sort of. When I right click I get a menu ("save page as"; view background image"; "select all" etc.) I can drag the rectangle to open links, but it's partially obscured behind that menu.--Fuhghettaboutit (talk) 12:37, 26 February 2016 (UTC)
Facebook comments' history
[edit]On Facebook, you sometimes get those inane posts asking you to "name a city without an A" or similar. Completely pointless. But occasionally a facebook friend has posted a comment. When there are 800,000+ comments, how do you find out what your friend wrote? -- SGBailey (talk) 22:05, 26 February 2016 (UTC)
- Isn't there an option to only read comments from friends ? (If you have friended all those people making inane comments, I suggest you unfriend them.) StuRat (talk) 23:31, 26 February 2016 (UTC)
- And if you're interested in why those things show up, give this a read. As you may have suspected, it's a scam to increase the value of the Facebook account so the cockroach who created it can sell it off. Matt Deres (talk) 03:44, 28 February 2016 (UTC)