|
IRC/Twitch chat logs look like rear end when I open them in Sublime Text, so is there a certain file format or viewer I can use to make them not look like that? There also appears to be some Unicode issues going on.
|
# ? Oct 22, 2017 14:40 |
|
|
# ? May 30, 2024 11:27 |
|
I know I'm going to regret asking this, but anyone have examples of good code they think everyone should read?
|
# ? Oct 22, 2017 14:45 |
|
carry on then posted:I know I'm going to regret asking this, but anyone have examples of good code they think everyone should read? Mine. Everyone else's is garbage. But you have to read it while I'm writing it, if you wait a couple weeks mine becomes garbage too
|
# ? Oct 22, 2017 14:46 |
|
It's not terribly uncommon for me to leave a long comment explaining code I didn't even write...where I explain how some library I'm using works or how I'm using the library. This is because so much documentation is crap and I don't want me or someone else later to have to go through the pain I did to figure out WTF.
|
# ? Oct 22, 2017 15:45 |
|
Thermopyle posted:It's not terribly uncommon for me to leave a long comment explaining code I didn't even write...where I explain how some library I'm using works or how I'm using the library. I do this all the time too, but I add it straight to the library code. If it takes me ten minutes to figure out a section of code, I’m commenting it. Then the next person only needs to take ten seconds to read my comment.
|
# ? Oct 22, 2017 16:19 |
|
carry on then posted:I know I'm going to regret asking this, but anyone have examples of good code they think everyone should read? I've read people rave about the Quake source code https://github.com/id-Software/Quake But I don't know what you would gain by looking at it. e: maybe it was actually the Doom 3 code: https://kotaku.com/5975610/the-exceptional-beauty-of-doom-3s-source-code
|
# ? Oct 22, 2017 17:36 |
|
Anyone know the best way of remotely stopping and starting services on a Windows server from a c# application? Everything works fine if my user is an administrator on the remote computer but the users in general wont be. There seem to be a few options: 1) UAC. Well for one I just tried this and it didn't seem to work and secondly im not sure we want our users logging on and off every second. 2) Some sort of service account which is only allowed to talk to the service. 3) Impersonation, not sure I quite understand this, if anyone does please explain! Im crap at network stuff so any help much appreciated!
|
# ? Oct 23, 2017 11:03 |
You want a user to stop/start a service on a machine where the user does not have a login of their own, that has sufficient permissions? The only reasonable way I see is to have a gatekeeper-service that authenticates+authorizes the user, then does the action using a service account on behalf of the user.
|
|
# ? Oct 23, 2017 14:57 |
|
baka kaba posted:The way I look at it, when you're going to write a thing, you need to plan what it's going to do, step by step. So you briefly sketch out those bullet points, so you have a short, readable explanation of what basically needs to happen baka kaba got it exactly right. I probably spend as much time teaching new hires good commenting techniques as anything else. The main thing comments need to do is document intent. Its true that you should be able to read code well enough to tell what it does without comments. Unfortunately, if I'm looking at some code that was written more than a week ago, it's usually because it is doing something wrong. So being able to tell what the code is doing isn't a lot of help. I need to know what the code is supposed to be doing before I can fix it and good comments can let me come to grips with what should be happening a lot faster and so provide a fix faster.
|
# ? Oct 23, 2017 16:19 |
|
nielsm posted:You want a user to stop/start a service on a machine where the user does not have a login of their own, that has sufficient permissions? I ended with a combination of service account and impersonation. Service account on server can only turn specific service on and off, impersonation on application accesses it. Works but not sure I'm happy any other suggestions welcome.
|
# ? Oct 23, 2017 17:21 |
|
Suspicious Dish posted:Practice reading code. Just like how you were in kindergarten and you struggled with reading, it will take some energy and practice, but it's a learnable and extremely valuable skill. It's probably the biggest unpracticed skill. I want to highlight this. I've always had a problem with expecting to be able to read code the way I would read a book or article, and then feeling inadequate when I didn't really digest anything. If you're looking at 20 lines, put aside 5 minutes and acknowledge that it wasn't written all at once by someone clacking away, it was someone sitting down, saying, "okay I need to do this, this and this, okay so this part is for (auto& t : wait is it thingy or is it thingy.get() better look it up real quick oh it was thingy.get_foos() so close parentheses then curly brace new line..." And then (hopefully) they wrote tests and tested it, failed, and fixed the failures
|
# ? Oct 23, 2017 17:24 |
|
carry on then posted:I know I'm going to regret asking this, but anyone have examples of good code they think everyone should read? Unfortunately, we don't produce "code for a 6th grade reading level" like we do for books, so there's no definitive answer to this question. I can certainly give examples of code I found particularly easy to work on (my first codebase I found super easy to read and work on was an early version of notify-osd). I suggest something that's small in scope and fairly early on in development before feature or scope creep have happened. I've heard the redis codebase (and anything by antirez) is particularly clean C code. From a cursory glance, it feels fairly nice. Here's a terrible suggestion: start reading JSON parsers. Everybody and their pet cat has written a JSON parser (here's mine). It's a simple enough problem that you can reinvent the wheel in 10 different ways. My JSON parser is going to look different from json-glib is going to look different from json-c is going to look different than yajl. Learn the different tricks. Learn your HAKMEM. Learn what ((foo + 3) & ~3) does. Learn your do { stmt; } while(0);s. For JavaScript, learn your if(~a.indexOf('foo')) and your A lot of larger libraries have their meat in a few files, and a *large* bit of data structures and fluff in the other files. The hardest part of reading this code can be navigating to find the meat of the library. After 10 years of reading code, this is still mostly guesswork, experience, and a lot of grepping and searching. Keep a log of your travels and if you see something suspicious, jot it down.
|
# ? Oct 23, 2017 21:31 |
|
Suspicious Dish posted:Unfortunately, we don't produce "code for a 6th grade reading level" like we do for books, so there's no definitive answer to this question. I can certainly give examples of code I found particularly easy to work on (my first codebase I found super easy to read and work on was an early version of notify-osd). I suggest something that's small in scope and fairly early on in development before feature or scope creep have happened. Ugh don't use bitwise operators to coerce to a boolean. It's stupidly opaque and your language probably has a better way to do it.
|
# ? Oct 23, 2017 22:44 |
|
I'm not saying you should write code like that. I'm saying you should figure out what it does and learn it -- it's part of the culture and you will run across it when reading code, like it or not.
|
# ? Oct 23, 2017 22:55 |
|
Blinkz0rz posted:Ugh don't use bitwise operators to coerce to a boolean. It's stupidly opaque and your language probably has a better way to do it. Yeah, now it does.
|
# ? Oct 23, 2017 22:57 |
|
Not sure why you were talking down to me like I'm a freshman CS student but thanks for the suggestions?
|
# ? Oct 23, 2017 23:09 |
|
Suspicious Dish posted:I'm not saying you should write code like that. I'm saying you should figure out what it does and learn it -- it's part of the culture and you will run across it when reading code, like it or not. I don't know what code cultures you've encountered, but the only contexts I've encountered bitmasks in were one of a) interacting with hardware, b) legacy code (dating from the 90's or earlier), or c) lovely code. So, I'm not saying you won't encounter it, but it's probably not something you should be emulating.
|
# ? Oct 23, 2017 23:13 |
|
You've never dealt with colors? File formats? Aligning memory? Hash functions? Data structures in general? Traversing something in Morton order? I use bitwise stuff extremely frequently.
|
# ? Oct 23, 2017 23:20 |
|
Suspicious Dish posted:You've never dealt with colors? File formats? Aligning memory? Hash functions? Data structures in general? Traversing something in Morton order? I use bitwise stuff extremely frequently. Colors: only for hardware control (parsing scientific camera images). File formats: using one of the millions of libraries that abstract this for you (or just saying "gently caress it" and aligning everything at word boundaries). Aligning memory: only for hardware control. Hash functions: only using library functions (e.g. Python's `hash` function). Data structures in general: all the time, but again, not using bitmasks. Morton order: I had to look this up because I've never heard of it. I think your experience is not my experience. In fact I think that both of our experiences are pretty far from the average developer's experience. And that's OK! But it's important to be aware of the differences between peoples' kinds of experiences so one doesn't recommend something that people won't actually end up using.
|
# ? Oct 23, 2017 23:25 |
|
carry on then posted:Not sure why you were talking down to me like I'm a freshman CS student but thanks for the suggestions? No one's talking down to you, it's just that you asked the sort of question a freshman CS student might ask (which doesn't make it a bad question!). It might help if we had more information about your experience so we could recommend things that are new to you. You could tell us what sort of codebases you've already looked through, what languages you might be looking for, and so on. Like SD said coding isn't like an English curriculum so we won't be able to point you to the Shakespeare or whatever of code. Comedy option: TAOCP
|
# ? Oct 24, 2017 00:16 |
|
Suspicious Dish posted:You've never dealt with colors? File formats? Aligning memory? Hash functions? Data structures in general? Traversing something in Morton order? I use bitwise stuff extremely frequently. I'm not super-confident in this, but I don't think its crazy to think most developers don't deal with those things...they just use whatever their language provides them which probably doesn't require them to use bitwise stuff.
|
# ? Oct 24, 2017 00:55 |
|
csammis posted:No one's talking down to you, it's just that you asked the sort of question a freshman CS student might ask (which doesn't make it a bad question!). It might help if we had more information about your experience so we could recommend things that are new to you. You could tell us what sort of codebases you've already looked through, what languages you might be looking for, and so on. Like SD said coding isn't like an English curriculum so we won't be able to point you to the Shakespeare or whatever of code. My point was I wasn’t asking for specific recommendations for me, I was asking for things people think *everyone* should read, because invariably at least one person pipes up with “there is no good code” which is my primary frustration with these kinds of discussions, that no one can even agree on whether code is good or not because one of the fastest ways to show how good you are is to just constantly criticize everything.
|
# ? Oct 24, 2017 01:27 |
|
So, what would y'all's criteria be for something you'd recommend as "good code"? For me I guess it'd be:
The concern I have with trying to find some representative examples is that so much of this stuff isn't really evident until you actually go in and try to change the code. Like, I might have some code that looks decent to a casual read-through, but if you tried to use it you'd quickly realize that its implementation is incomplete and unnecessarily complex. I guess the tool analogy would be two hammers, that both look well-made and have equivalent form, fit, balance, etc., but one of them is made out of cheap steel and breaks/bends as soon as you try to use it for more than hanging some pictures on the wall. How are you going to recognize the inferior tool before you try to use it?
|
# ? Oct 24, 2017 01:40 |
|
When I say "learn to read code", that doesn't mean "learn to read good code", it means learning to read code. Good, bad, ugly. Not reading code to criticize it, not reading code to laugh at it, but reading code to understand what it's doing, and how to modify it. That's why I suggested reading 10 different JSON parsers rather than pointing you to a wide body of code that is universally praised as good. I feel I'm good at reading code "uncritically" and understanding that a large range of aesthetic styles are subjective, that tradeoffs are made without me knowing about the constraints, that systems can accelerate in complexity faster than anybody can catch up with them, and that communication is hard and most developers seem to be angry at the concept of anybody asking them questions about how they built something. That's a skillset that's important to develop. Anybody can point and laugh at bad code, fewer people are able to understand it and modify it successfully.
|
# ? Oct 24, 2017 03:48 |
|
ufarn posted:IRC/Twitch chat logs look like rear end when I open them in Sublime Text, so is there a certain file format or viewer I can use to make them not look like that? There also appears to be some Unicode issues going on. i wrote a log parser which outputs html or plaintext. at the moment it only understands mirc logs, but that wouldn’t be too hard to change if you use some other client. here’s an online version: https://dispel.azurewebsites.net/ and the source code (feel free to fork etc): https://github.com/gulbanana/dispel-murk
|
# ? Oct 24, 2017 07:06 |
|
I'm thinking about writing a language support plugin for IDEA. Anyone here done this before? Am I in for a world of pain?
|
# ? Oct 24, 2017 15:50 |
|
Thermopyle posted:I'm thinking about writing a language support plugin for IDEA. Anyone here done this before? Am I in for a world of pain? I've worked on various plugins and maintain one. Try to find a plugin which does something similar to what you want. There's a list of open source plugins on https://github.com/JetBrains/gradle-intellij-plugin
|
# ? Oct 24, 2017 16:22 |
|
TooMuchAbstraction posted:I don't know what code cultures you've encountered, but the only contexts I've encountered bitmasks in were one of a) interacting with hardware, b) legacy code (dating from the 90's or earlier), or c) lovely code. I think the more important use is saving memory in a high-level language which doesn't give you any other tools for that. If you're programming in Java, and you have a class with a dozen or so boolean or small-integer fields, and you're planning to make like a million instances of it, it can absolutely be worth packing those fields into a single int in order to shave 20-30 bytes off each object — or potentially to avoid creating an object at all.
|
# ? Oct 24, 2017 18:55 |
|
Thermopyle posted:I'm not super-confident in this, but I don't think its crazy to think most developers don't deal with those things...they just use whatever their language provides them which probably doesn't require them to use bitwise stuff. I suspect there is more embedded and low level work out there than you think, we don't all write Javascript. My day job is C on a Cortex M0 and my hobby project is a compiler that directly generates machine code and you had best believe both involve bitwise stuff.
|
# ? Oct 25, 2017 22:28 |
|
Hey quick question here... I have some HTML, CSS and JS under my belt since last time I posted. It's all been online tutorials though so I'm trying to figure out what I can use to build my own stuff. I have notepad++ and sublime text... Is that as good as it gets for web developers? Anything else out there for a web developer that doesn't cost money? (Gotta spend money to make money type of problem here...)
|
# ? Oct 26, 2017 20:24 |
tricksnake posted:Hey quick question here... I have some HTML, CSS and JS under my belt since last time I posted. It's all been online tutorials though so I'm trying to figure out what I can use to build my own stuff. I have notepad++ and sublime text... Is that as good as it gets for web developers? Anything else out there for a web developer that doesn't cost money? (Gotta spend money to make money type of problem here...) VSCode is another good (and free) editor, I think many Sublime users have started using that instead actually, since development of Sublime seems to have stagnated or something. Look into the big cloud hosting companies, they all have a (more or less) free tier that lets you get sites hosted somewhere for actual free, and allows you to play with the technologies actual large providers use.
|
|
# ? Oct 26, 2017 20:31 |
|
tricksnake posted:Hey quick question here... I have some HTML, CSS and JS under my belt since last time I posted. It's all been online tutorials though so I'm trying to figure out what I can use to build my own stuff. I have notepad++ and sublime text... Is that as good as it gets for web developers? Anything else out there for a web developer that doesn't cost money? (Gotta spend money to make money type of problem here...) Also worth checking out (all free): Atom Brackets VS Code Capri Sun Tzu fucked around with this message at 20:36 on Oct 26, 2017 |
# ? Oct 26, 2017 20:32 |
|
Ok thanks dudes. And as for paid stuff, what do you think, Dreamweaver? edit: Is VSCode the same thing as Visual Studio 2017? tricksnake fucked around with this message at 20:50 on Oct 26, 2017 |
# ? Oct 26, 2017 20:42 |
tricksnake posted:Ok thanks dudes. And as for paid stuff, what do you think, Dreamweaver? Dreamweaver is too expensive for what it offers, gonna echo the WebStorm suggestion, their tools are very good. VS Code only shares the name with VS 2017, it's an entirely different application, a lightweight customizable editor. (code is https://code.visualstudio.com/ and 2017 is https://www.visualstudio.com/vs/) Shy fucked around with this message at 21:16 on Oct 26, 2017 |
|
# ? Oct 26, 2017 21:13 |
|
Shy posted:Dreamweaver is too expensive for what it offers, gonna echo the WebStorm suggestion, their tools are very good. I'll take a look at WebStorm very soon and see if I can hack it. Maybe check out some tuts or the documentation... How's the setup for VS Code? Is it lengthy/complicated? I had a hell of a time trying to setup VS 2017 just for simple C when I was trying to learn that for a class. EDIT: Just found the intro stuff after the jump on the VS Code page. I'll just follow this stuff, seems like a lot of tuts here. tricksnake fucked around with this message at 21:22 on Oct 26, 2017 |
# ? Oct 26, 2017 21:16 |
Nah it's just a simple editor, install it and customize with plugins you think you could use https://code.visualstudio.com/docs/editor/extension-gallery
|
|
# ? Oct 26, 2017 21:21 |
|
tricksnake posted:I'll take a look at WebStorm very soon and see if I can hack it. Maybe check out some tuts or the documentation... It's got great autocompletion for .NET projects. I wish more schools would adopt lightweight editors like VS Code because I think experiences like yours are common - beginners get frustrated trying to navigate the ins and outs of massive IDE tools when they just want to learn how to code.
|
# ? Oct 26, 2017 22:23 |
|
Met a guy who works for Facebook a while back and specializes in that data science stuff with a background in using the usual Python libraries for graduate school stuff. Oddly enough, I open up HackerNews this morning and discover this O'Reilly book author who is releasing his book online. The topic that the book covers are exactly the libraries that the guy I met specializes in: https://notebooks.azure.com/jakevdp/libraries/PythonDataScienceHandbook This made me wonder: let's say I study through this book over the course of the next week and maybe make a personal project or two that does something trivial for the purpose of demonstrating that I know how the libraries work and then put it up on my Github. At that point, would I be retarded for re-doing my resume to apply for an entry-level Data Scientist job? It can't be that simple, right?
|
# ? Oct 26, 2017 23:50 |
|
Love Stole the Day posted:Met a guy who works for Facebook a while back and specializes in that data science stuff with a background in using the usual Python libraries for graduate school stuff. Oddly enough, I open up HackerNews this morning and discover this O'Reilly book author who is releasing his book online. The topic that the book covers are exactly the libraries that the guy I met specializes in: https://notebooks.azure.com/jakevdp/libraries/PythonDataScienceHandbook Anyone can do code:
However, Introduction to Statistical Learning will totally be your friend if you want to go down this route (even if you don't want to work in R). EDIT: I definitely don't want to discourage you, though, it's eminently doable if you can acquire a modicum of statistical intuition through experimentation. Ghost of Reagan Past fucked around with this message at 00:35 on Oct 27, 2017 |
# ? Oct 27, 2017 00:05 |
|
|
# ? May 30, 2024 11:27 |
|
Ghost of Reagan Past posted:However, understanding what the gently caress you just did, how to evaluate that the results are good, tweaking it for performance, etc., isn't a weekend project. It's less of a dark art than people think, and it's within the grasp of a lot of people (for the record I don't have a statistics background at all and I am a data scientist), but it's not just "read a book and do a few trivial projects." Absolutely, do the work, make the things, it's worth doing, but don't expect that to make you a data scientist overnight. Stupid follow-up question because you don't have PMs enabled unfortunately: if I actually had a bit of an educational background in math and financial analysis, which involves a lot of statistics... and then did those things, would it still not be that simple to be employable for an entry-level Data Science job? Or am I just splitting hairs and lawyer-ing like a jackass about this.
|
# ? Oct 27, 2017 01:07 |