|
I'm learning how to code. Someone just told me about while ( i --> 0 )
|
# ¿ Sep 25, 2015 10:19 |
|
|
# ¿ May 10, 2024 19:12 |
|
1337JiveTurkey posted:It's a postdecrement operator followed by a greater than comparator without a space in between. i-- > 0 is how you'd normally write it. No, normally you'd use a for loop, which were invented for exactly this purpose.
|
# ¿ Sep 25, 2015 14:00 |
|
Agile is the belief that you can run a marathon at a sprint, so long as you frequently stop and fire the starter's pistol again.
|
# ¿ Sep 28, 2015 10:12 |
|
Hammerite posted:Tangentially related, I was unaware until well after I started programming as an occupation that convention, when one is dedicating a whole line to a comment, is to place the comment on the line before the thing one is commenting about, rather than on the line after. Which makes no sense, but what can you do. Hm, to me it does make sense. "I'm gonna do this now" *does this* "so I can next do THAT" *does that*.
|
# ¿ Oct 6, 2015 12:16 |
|
Weird little HTML thing... Why does html think chucknorris is a color?
|
# ¿ Oct 8, 2015 14:21 |
|
What actually happens, according to the answers on that page, is that all characters that aren't hex digits are replaced by zeroes, then zeroes are appended until the number of chars can be divided by three, then the string is divided in three groups, and each group is read as a hex code for R, G, and B.
|
# ¿ Oct 8, 2015 14:48 |
|
Mogomra posted:Not the most horrifying thing I've ever seen, but certainly .jpg and .gif have a dot, but ttf and otf don't.
|
# ¿ Oct 15, 2015 21:48 |
|
GPS satellites are one of the few, if not the only, technology in common use that needs to take both special relativity (due to speed) and general relativity (due to gravity) into account. That's why it's the perfect high school example of why relativity matters.
|
# ¿ Oct 18, 2015 15:32 |
|
Lambda works perfectly well on my Windows 10.
|
# ¿ Oct 22, 2015 16:18 |
|
http://imgur.com/a/ARGjH
|
# ¿ Nov 21, 2015 19:18 |
|
Holy crap. https://www.quora.com/What-is-a-coders-worst-nightmare/answer/Mick-Stute?srid=RBKZ&share=1 This is worth reading.
|
# ¿ Nov 22, 2015 13:05 |
|
Not sure what this is but it certainly looks ugly
|
# ¿ Dec 12, 2015 18:39 |
|
No thanks.
|
# ¿ Jan 10, 2016 12:30 |
|
So, I had my first encounter with Groovy scripts today, and saw something like this:code:
|
# ¿ Jan 15, 2016 20:36 |
|
Pavlov posted:Then you'll just have people arguing that those are technically linear bounded automata, because a turing machine technically has an infinite tape. Just glue the ends together and it's practically infinite.
|
# ¿ Jan 16, 2016 09:25 |
|
http://blog.danlew.net/2015/04/18/is-your-user-a-goat/ I don't know if this was posted here before but it's cool. Related: Did you know there's a built-in Mathematica function for recognizing if an image has a goat in it? http://codegolf.stackexchange.com/questions/71631/upgoat-or-downgoat/71680#71680 Carbon dioxide fucked around with this message at 09:44 on Feb 13, 2016 |
# ¿ Feb 13, 2016 09:38 |
|
Related to this discussion: ಠ_ಠ
|
# ¿ Feb 26, 2016 07:18 |
|
|
# ¿ Mar 5, 2016 10:59 |
|
I heard something about there being a request to the Unicode Consortium about making the face emoji completely 'modifiable'. Different hair colors and styles, different eye colors, stuff like that. Yeah, they're really going off the deep end with that.
|
# ¿ Mar 6, 2016 10:20 |
|
sunaurus posted:I've started sending people here: https://www.atlassian.com/git/tutorials/setting-up-a-repository/git-init I'm in a team at work that's trying to prove that switching to Git from SVN will save us time during the review process once it's set-up right and we trained people on how to use it... and a lot of what I found so far is "git is perfect, if you don't understand the commands intuitively ur stupid " and "If you have trouble understanding git's workflow because you're used to SVN, that's your own problem, don't come asking us for help now!" That kind of attitude isn't very helpful, you know. Thanks for that link, it's one of the first actually helpful documents I've seen. Most tutorials do explain all the commands, but don't explain how you're supposed to use them, nor the difference in meaning they have compared to SVN or other VCSs.
|
# ¿ Apr 5, 2016 06:28 |
|
This week, I learned about code that should not be in mortal hands. I am talking about sun.misc.Unsafe. This is a Java class that allows for a whole bunch of things that are normally not possible at all in Java. It's mostly used by internal Java methods for performance reasons. Have an example use of Unsafe: Java code:
Some of the other things you can do with Unsafe:
The reason I heard about this is because they're changing stuff about this class in Java 9, which will have its official release in March 2017. I am not completely sure what will happen. The person who talked about it while giving a presentation about Java 9 said they're locking it down completely, which means that all those libraries will need to be updated. But some (somewhat older) webpage says that Oracle was thinking about making a public API for it. Source of my example, with a bunch of other examples: https://dzone.com/articles/understanding-sunmiscunsafe Carbon dioxide fucked around with this message at 10:19 on Apr 9, 2016 |
# ¿ Apr 9, 2016 10:13 |
|
feedmegin posted:Um. If true doesnt that make the sandbox totally worthless for security? Can you call this stuff in an applet? I am not sure. But I assume it works something like this. The JVM uses a certain part of memory. Within the JVM, this is basically divided into three parts: native, stack and heap. The stack has primitive variables and pointers to the heap, while the heap holds Java objects. Native memory is used for low-level java/JVM-internal stuff that normally cannot be reached with java code. Unsafe allows you to put an object into this native memory but the JVM cannot recognize it as an object unless you use Unsafe again to specifically read it as an object. The JVM can also allocate free native memory to the heap in order to expand the heap. But all of this native, stack and heap memory exists within the JVM. It's a division of memory that only makes sense within the Java Virtual Machine. The JVM itself lives in the true heap memory of the machine it runs on. So it's not like you get access to the real machine's native memory. Security is still fine. Someone correct me if I'm wrong, I'm not much of an expert on this low-level stuff.
|
# ¿ Apr 9, 2016 14:20 |
|
Mush Man posted:I hate to be the clueless idiot, but part of my job is working with WordPress and I don't know what the better or more secure alternatives are. The only other CMS I've gone near was someone else's hacked Joomla site. A lot of the appeal of WordPress is that our clients are don't need to call us every time they want to put up new content because they can do it easily themselves... The answer, for corporate websites at least, is to use a CMS that isn't php-based. The disadvantage is that you need at least a VPS for that, because sadly regular stock web hostings won't run anything but php. At my job we use OneHippo which is Java based and completely customizable. I personally think it's not a bad CMS. It differs from the most common ones by being component-based instead of page based. Basically, you define pages by putting reusable components together (header, footer, textbox, form, ...) , which may or may not have the same text/pictures/whatever in them. It gets quite powerful, especially if you're willing to dive into the code. I don't know much about security, and of course it depends on how much you customize the code, but it's gotta be better than wordpress because php is inherently broken.
|
# ¿ Apr 23, 2016 10:03 |
|
This is apparently a sudoku solver with all solutions hardcoded. http://pastebin.com/raw/1mPdgZgg Posting the raw link because the regular pastebin page (just remove the /raw from the URL) crashes browsers.
|
# ¿ Apr 23, 2016 18:06 |
|
Notorious QIG posted:Excuse me but without Cat extends Animal how can you teach freshmen about computers I had a teacher talk about design patterns, and he started with something like: Java code:
Then he started talking about "but what if we need to implement a new way of flying", and started changing the code to Java code:
|
# ¿ Apr 27, 2016 21:55 |
|
SupSuper posted:You don't have to imagine it: drat, so he wasn't even original. Oh well.
|
# ¿ Apr 28, 2016 06:30 |
|
HardDisk posted:It's just that it's not a high priority. You reminded me of https://www.youtube.com/watch?v=IFe9wiDfb0E
|
# ¿ Apr 28, 2016 19:51 |
|
code:
The little script to make this work
|
# ¿ May 7, 2016 07:51 |
|
It's actually sudowoodo without the second o but I couldn't be bothered the remove it figuring nobody would care.
|
# ¿ May 7, 2016 15:41 |
|
I barely understand what's going on there but it's beautiful. Reminds me of this. Not quite as neat but still funny. https://taskinoor.wordpress.com/2011/09/21/the-abuse-of-design-patterns-in-writing-a-hello-world-program/
|
# ¿ May 23, 2016 22:30 |
|
I'm not sure what you folks are talking about considering a 'type of' operator. Java has an instanceof operator, which only works on objects, not on primitives. instanceof returns true if an object is of the given type or extends or implements the given class/interface. Its main use is to find out if you're allowed to cast an object to a subclass, so you can reach specific subclass methods. Even then, it's often better to just have the subclass method override a method declaration in the superclass/interface. instanceof does not work on primitives, but that's no problem, because if you try to send the wrong primitive type into a method you'll get a compile error. There's no supertype for primitives, so you'll always know what you're dealing with. If you try to do arithmetic with primitives, it'll automatically upcast smaller primitive types to the largest used, and integer types to a floating point type. (Also if you do any arithmetic with bytes, shorts, of chars, it'll upcast them to int automatically and you'll have to manually downcast them to the old type if you want to keep it, because the JVM cannot do arithmetic with less than 32 bits). There's no way to directly cast primitive booleans to numeric values or vice versa, booleans are completely their own thing. String primitives do not exist, String literals automatically become a String object (with as its main member a char array). At work we often use Integer wrapper objects instead of primitives, because they are allowed to be null. Carbon dioxide fucked around with this message at 06:07 on Jun 16, 2016 |
# ¿ Jun 16, 2016 06:04 |
|
HappyHippo posted:The best part about c++ is that anytime anyone talks about it or answers a question, three more people pop up to say "yes but..." or otherwise clarify the answer. Because it's probably the most byzantine language ever created. Is that really only a thing for C++? I look up a lot of Java stuff on StackOverflow and more often than not people suggest a few alternative options.
|
# ¿ Jun 20, 2016 07:42 |
|
Form engines are literally the worst part of coding for the web.
|
# ¿ Jun 26, 2016 08:33 |
|
Real life horror: http://www.theregister.co.uk/2016/07/03/mri_software_bugs_could_upend_years_of_research/?mt=1467666616578 We're gonna run out of helium to cool the MRIs before this shitstorm is fixed.
|
# ¿ Jul 5, 2016 06:01 |
|
Kilson posted:Some Java: Oh god, that's an old java.util.Date isn't it? That's the old crappy implementation you never ever want to touch anymore. Use java.time.LocalDate (and the java.time.format.DateTimeFormatter for formatting Strings) if you can use Java 8. Otherwise, import and use the Joda Time library, which is the same thing, it just got internalized as java.time in Java 8.
|
# ¿ Jul 13, 2016 19:20 |
|
So I learned to program with Java. Now, at work we use Java 8 and I run in the occassional lambda expression. I've been trying to understand them for a while but coming from Java 7, they just won't click for me. I read about them, I try a thing or two, I think "ah that makes sense", and then a few days later I've forgotten why it made sense. Does anyone have any resources that explain them in a way that makes sense for someone who's used to think in purely Java 7 OOP?
|
# ¿ Jul 17, 2016 13:32 |
|
Thanks for the link to the vid and the explanations, folks!
|
# ¿ Jul 17, 2016 16:23 |
|
Hughlander posted:My quote is always, "Exceptions are for exceptional cases." A stack overflow is exceptional, a key missing from a map is not. Good coding practices are exceptional.
|
# ¿ Jul 31, 2016 18:50 |
|
Suspicious Dish posted:the real horror is html whitespace rules There are rules? I thought it was just every browser by itself in the wild, wild west.
|
# ¿ Aug 4, 2016 05:58 |
|
|
# ¿ May 10, 2024 19:12 |
|
http://jazcash.com/a-javascript-journey-with-only-six-characters/ The following is valid, executable javascript. Run it in your browser console if you don't believe me. [][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]+(![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[!+[]+!+[]]]+(+(!+[]+!+[]+!+[]+[!+[]+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(+![]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]](!+[]+!+[]+!+[]+[!+[]+!+[]+!+[]])+(!![]+[])[+[]]+(![]+[])[+[]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[!+[]+!+[]]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]])()
|
# ¿ Oct 8, 2016 15:23 |