|
abraham linksys posted:This is basically "client-side templating 101." Though really, "reconstruction of data" shouldn't be needed if you have an API that's spitting out a format your JS/templates consume, and it can get ugly if it's an ad-hoc implementation and not based on one of many libraries that do this. Yeah, that's the thing - this is an ad-hoc implementation, not reused (or reusable) anywhere. Client-side interactivity consists of choosing which table to display and which column to sort by, both of which can trivially be done by rendering the data straight into the page as a table and then adding five lines of JS that invoke the library we already have specifically for doing this. (The "reconstruction of data" part occurs because there's a bunch of derived information that is already calculated in Python, but rather than rendering that into the template they just insert the raw data and then JS duplicates all of the existing Python logic to derive that information again). We have a perfectly good server-side templating system, and we have existing JS libraries for sortable tables and select-a-div-from-a-dropdown. This service implements something that normally involves ~50 lines of template and ~5 lines of JS using ~30 lines of template, ~300 lines of JS, and multiple extra layers of indirection (all of which must be modified if you want to, say, add a new column to the table).
|
# ? Oct 26, 2013 17:31 |
|
|
# ? Apr 27, 2024 08:01 |
|
So, Verizon has a large system internally called "DTI" that is one of the tools that field techs and support call technicians use to diagnose issues with the network. I contracted on this system for quite a while before moving on, but I still occasionally get billed part-time to help out if they can't debug issues. They recently started moving some of their servers from Solaris/Tomcat to Linux/WebSphere and were hitting a problem: during a stress test, they hit a "too many open files" warning. A simple lsof/netstat showed that there were a lot of sockets in TIME_WAIT. I asked them what those sockets were, and they said "yes, that's the return socket where traffic goes over". Me: "Wait, if it's the return socket, why does it have a port number of 8188" Them: "Uh, the return socket has a well-known port of 8188." I press a bit more, dig into some previously-untouched code, and what do I find: (paraphrasing here because the actual project spans over 200 classes, Oh, Java... I might also get the details of the Java socket API wrong, but hopefully you understand here) Java code:
In other words, they reinvented TCP on top of TCP. I hate that people learn the word "packet" when it comes to networking. YOU DO NOT NEED TO CARE ABOUT PACKETS. The abstraction layer TCP gives you is a bidirectional stream of bytes. grr.... this isn't the first time I've seen this, either.
|
# ? Oct 26, 2013 18:00 |
|
http://docs.unity3d.com/Documentation/ScriptReference/GameObject.html Unity documentation doesn't use real links. The links are of the form <a onclick="loadPage('GameObject-activeInHierarchy'); return false;" href="">activeInHierarchy</a>, which means that middle clicking on them to open them in the background does not work. Why would you even do that?
|
# ? Oct 26, 2013 18:36 |
|
Suspicious Dish posted:I hate that people learn the word "packet" when it comes to networking. YOU DO NOT NEED TO CARE ABOUT PACKETS. The abstraction layer TCP gives you is a bidirectional stream of bytes. grr.... this isn't the first time I've seen this, either.
|
# ? Oct 26, 2013 19:02 |
|
Rottbott posted:Sometimes you actually want a packet though. In TCP? Nope. The abstraction layer that TCP gives you is a bidirectional stream of bytes. These are built using packets, but there's no reason to sneak under the hook. If you want datagram messaging, you can use UDP, but that does not guarantee reliability or ordering or anything else.
|
# ? Oct 26, 2013 19:12 |
|
Suspicious Dish posted:
Won't nPackets truncate unless message.size is a multiple of 240, causing the header to contain an EndPacketId that is 1 short?
|
# ? Oct 26, 2013 20:29 |
|
As I said, the actual code is 20 classes tall (and some of them look like this); that's just some made up stuff that gets the spirit of it.
|
# ? Oct 26, 2013 20:36 |
|
Suspicious Dish posted:(and some of them look like this); Holy poo poo.
|
# ? Oct 26, 2013 20:38 |
|
Suspicious Dish posted:As I said, the actual code is 20 classes tall (and some of them look like this); that's just some made up stuff that gets the spirit of it. I actually made that face when I saw that code. If any code cried out for refactoring, that would be it!
|
# ? Oct 26, 2013 21:58 |
|
Wheany posted:http://docs.unity3d.com/Documentation/ScriptReference/GameObject.html Apparently this is really popular for whatever reason. I don't know. I do know that the other places I have seen this done uses the javascript links inside their help files as well. Maybe that is why?
|
# ? Oct 27, 2013 06:50 |
|
Wheany posted:http://docs.unity3d.com/Documentation/ScriptReference/GameObject.html I wonder if they did that with the intention of hindering scraping of their website? I can't think of another reason you would do that.
|
# ? Oct 27, 2013 10:15 |
|
code:
|
# ? Oct 28, 2013 01:11 |
|
Ephphatha posted:
|
# ? Oct 28, 2013 01:13 |
|
"Latitude" apparently has three t's in it, I have found.
|
# ? Oct 28, 2013 01:34 |
|
PrBacterio posted:Oh the fun you would have with the code base at my place of work. If even that (comparatively) insignificant little spelling mistake is enough to set you off I'd like to see your reaction to the kind of stuff I deal with every day Oh, it's not this one occasion. Every program that abbreviates the word parameter uses the abbreviation "parm". This is the first time I've seen the full word spelled that way though.
|
# ? Oct 28, 2013 04:07 |
|
Some C# code bases I've seen have "parms" variables littered across it. My guess is that they actually wanted to say "params" but couldn't because that's a C# keyword.
|
# ? Oct 28, 2013 04:32 |
|
Bognar posted:Some C# code bases I've seen have "parms" variables littered across it. My guess is that they actually wanted to say "params" but couldn't because that's a C# keyword. Except you can use keywords as variable names by prefixing them with "@". You shouldn't, but you can.
|
# ? Oct 28, 2013 04:43 |
|
I've always hated 'klass'.
|
# ? Oct 28, 2013 04:51 |
|
Suspicious Dish posted:In TCP? Nope. The abstraction layer that TCP gives you is a bidirectional stream of bytes. These are built using packets, but there's no reason to sneak under the hook. Performance concerns constantly motivate peeking under the hood. The internet would collapse in a storm of congestion without Nagle's algorithm, yet latency-critical applications need ways to forcibly flush.
|
# ? Oct 28, 2013 04:58 |
|
Scaevolus posted:Performance concerns constantly motivate peeking under the hood. The internet would collapse in a storm of congestion without Nagle's algorithm, yet latency-critical applications need ways to forcibly flush. Sure, abstractions are leaky and if you're implementing any serious realtime system you need to understand the congestion/latency tradeoff. But that's something you can really only can be taught once you already understand TCP. Building your own packet protocol and bidirectional stream-of-bytes transport that opens a new listening socket on every message on top of TCP is crazy. TCP gives you exactly that. They clearly don't understand TCP well enough to poke start to under it. That's why I feel like ever mentioning the word "packet" to people beginning to learn basic network programming is a serious disservice. Poke at that later, but for now, it's like a file that you can read from and write to and it magically pops out on the other side!
|
# ? Oct 28, 2013 05:58 |
|
Opinion Haver posted:I've always hated 'klass'. clazz
|
# ? Oct 28, 2013 06:15 |
|
dass
|
# ? Oct 28, 2013 06:30 |
|
Gonna start using this in my reflection code from now on.
|
# ? Oct 28, 2013 07:54 |
|
This is the worst
|
# ? Oct 28, 2013 08:15 |
|
cIass
|
# ? Oct 28, 2013 08:19 |
|
Suspicious Dish posted:In TCP? Nope. The abstraction layer that TCP gives you is a bidirectional stream of bytes. These are built using packets, but there's no reason to sneak under the hook. If you want datagram messaging, you can use UDP, but that does not guarantee reliability or ordering or anything else.
|
# ? Oct 28, 2013 10:16 |
|
I'm leading MY BOYFRIEND through the first CS class in the major and we're in a unit dealing with loops. He has to draw an ascii figure that looks like:pre:#================# | <><> | | <>....<> | | <>........<> | |<>............<>| |<>............<>| | <>........<> | | <>....<> | | <><> | #================# code:
|
# ? Oct 28, 2013 10:29 |
|
it is posted:
Code review style feedback is always a good idea, maybe ask him what the purpose of a loop from 1 to 1 is. Additionally, it most definitely is your responsibility as a teacher to write example code like you'd write real code and not, as you've done here, like you're painting a mural.
|
# ? Oct 28, 2013 10:42 |
|
This was annoying.code:
|
# ? Oct 28, 2013 11:49 |
|
it is posted:I'm leading MY BOYFRIEND through the first CS class in the major and we're in a unit dealing with loops. He has to draw an ascii figure that looks like: I want to throw curly braces at you like batarangs, especially because you're teaching someone how to code by example. As to your actual question, I'd ask him why he's got loops of length one, and if it's because he thinks that he has to have a loop you should explain that he doesn't. Be sure to ask, though; he might surprise you with "Well, what if the teacher wants <><><> tomorrow?" in which case he'll make an excellent enterprise developer
|
# ? Oct 28, 2013 13:06 |
|
Scaevolus posted:Performance concerns constantly motivate peeking under the hood. The internet would collapse in a storm of congestion without Nagle's algorithm, yet latency-critical applications need ways to forcibly flush. No it wouldn't Nagling is really only useful for interactive terminal sessions. What percent of total traffic is that? These days almost all traffic has an entire packet worth of data or it's entire payload sent from a program at one time. In either case Nagle isn't invoked.
|
# ? Oct 28, 2013 14:15 |
|
Hughlander posted:No it wouldn't Nagling is really only useful for interactive terminal sessions. What percent of total traffic is that? These days almost all traffic has an entire packet worth of data or it's entire payload sent from a program at one time. In either case Nagle isn't invoked. One of the biggest gains of SPDY over HTTP is not that it's compressed, but it uses a multiplexed socket for all its resources. TCP handshakes are decently expensive, and HTTP does one for every single resource, so we had to invent weird hacks like script concatenation and sprite sheeting to do more with one TCP socket. The modern web really run into Nagle.
|
# ? Oct 28, 2013 14:29 |
|
Suspicious Dish posted:One of the biggest gains of SPDY over HTTP is not that it's compressed, but it uses a multiplexed socket for all its resources. What do you think about Google's new protocol (already being used), quic?
|
# ? Oct 28, 2013 14:34 |
|
Suspicious Dish posted:One of the biggest gains of SPDY over HTTP is not that it's compressed, but it uses a multiplexed socket for all its resources. But number of TCP connections has nothing to do with Nagle again. All Nagle says is that if you have less than a full packet of data you coalesce the packets until you receive an ack from the remote end or you have a full packet worth of data. If you were using HTTP to request 40 resources with Nagle or without you'd send the same number of TCP packets. Yes with SPDY, and HTTP Keepalive you'd use less over all packets, but Nagle on or off has no effect.
|
# ? Oct 28, 2013 14:42 |
|
By "run into Nagle" I meant run into his observation that there are still lots of TCP packets that are really small, and that TCP congestion is a serious problem.Biowarfare posted:What do you think about Google's new protocol (already being used), quic? I haven't heard of it! Looks interesting, though, I'll read more about it.
|
# ? Oct 28, 2013 14:52 |
|
it is posted:and he's basically got it, but he's wrapping the System.out.print("<>") calls in a loop from 1 to 1. It's cute but I don't know if my responsibility as a teacher is to say "loops of length 1 are bad" or if I should let him get more comfortable with loop syntax and logic and then work on improving his style. I'm teaching a buddy of mine, and he keeps saying "if loop". I think things like that are indicative that the concept hasn't completely hit home yet, so I did a bunch of practice with loops and conditionals and went over the difference and when they're each appropriate. It all seems obvious to us now years later, but its a lot to take in at first. A loop of 1 definitely shows he's not quite got the idea, so I'd poke him on it a bit. Nothing too strong though, I like the suggestion of being socratic and just asking questions. "So why is that necessary?" Another newbie problem he was making was turning everything into loops where they didn't need to be; sometimes he'd come up with the proper logic for something, but nest that within a loop unnecessarily. I didn't learn debugging until later myself, but I think that's a mistake. Have you introduced him to debugging yet? Allowing him to set a breakpoint on the first instruction and just walk through the program each time he changes it can really help visualize and reinforce what the loops and control structures are doing to the flow of the program.
|
# ? Oct 28, 2013 16:02 |
|
No experience teaching programming here but after I got my first real job out of college and learned to use gdb I was pissed that it hadn't been taught along with our c++ assignments. I'm interested as to what people's experiences with teaching a debugger alongside a language. I expect that when the school switched to java the debugger started being taught to beginners because it is tightly integrated with the IDE.
|
# ? Oct 28, 2013 16:58 |
|
The debugging I was taught was printf(); shenanigans since I started with C. Toward the end of my C class we finally used codeblocks' debugger to do step through, which was nice and helped me start to understand what was going on. When I started to do Java we were pressured into using jGrasp (WHY?!?!?!?!?) and I had to on my own find out what IDEs were, why they were useful, and why the gently caress I'd ever bother using jGrasp because holy loving poo poo a lot of professors think harder is just better and are out of touch with industry. I won't even try to explain how badly we were taught OOP principles but suffice it to say that it was absolutely loving terrible. Thank gently caress that collections are easy and I had a good hand-holding with multi tier architecture, and for that matter, a perfect example of why you need IoC and loose coupling to get me up to speed. The same jGrasp professor thought it would be a good idea to teach students to do C with PICO. Apparently vi is just too much loving effort? I learned more from stackoverflow and CoC than school, and that's kind of a disappointment. I wish I had just picked some easy "CIS" or "MIS" degree to get the 4 year piece of parchment with a nice high GPA since I taught myself programming anyway. If I do finish my education it's just to get past HR departments that care anyway since I've been in the industry for a year now, but my god the bullshit that comes out of many schools is infuriating when you look at it from the perspective of not being a complete moron.
|
# ? Oct 28, 2013 17:27 |
|
Zaphod42 posted:I'm teaching a buddy of mine, and he keeps saying "if loop". I've noticed this in my students on many occasions. My working theory is that it has something to do with the syntactic similarity between conditionals and loops in curly-bracket languages. One of the strangest behaviors I have observed in lab courses is a behavior I call "soup programming", in which students read a problem description, add several loops, conditionals and variables to a procedure body and then proceed to spend half an hour rearranging those elements to try to get the result to compile, as if programming were a matter of selecting the correct ingredients and stirring. Usually when I help students who are doing this I tell them to step away from the keyboard and try to explain the problem and their approach to solving it verbally- if you can't explain something to a person you can't explain it to a computer.
|
# ? Oct 28, 2013 17:30 |
|
|
# ? Apr 27, 2024 08:01 |
|
The "if loop" idea sort of makes sense to me - while repeats 0 to N times, do ... while repeats 1 to N times, and if repeats 0 to 1 times. It's not a very useful way of thinking about things, but I'm not sure it's entirely wrong.
|
# ? Oct 28, 2013 17:42 |