|
Related: In Python a in [b, c, d] is equivalent to a == b or a == c or a == d, but it sometimes bugs me that you can't write a is in [b, c, d] to mean a is b or a is c or a is d. The best you can do is any(a is x for x in [b, c, d]).
|
# ? May 3, 2016 16:29 |
|
|
# ? Jun 8, 2024 11:25 |
|
Asymmetrikon posted:
Thanks, why the hell didn't I think of that On a deeper topic, I'm currently working on combining Replace with folds, and I can't figure out how to implement the recursion. Here's basically what I've got so far: code:
For instance, if I run it with code:
|
# ? May 3, 2016 16:31 |
|
Well, your lambda is taking acc (the result of the last fold op) as an accumulator, but isn't doing anything to it, and is just applying the function to y.
|
# ? May 3, 2016 16:42 |
|
Asymmetrikon posted:Well, your lambda is taking acc (the result of the last fold op) as an accumulator, but isn't doing anything to it, and is just applying the function to y. Yeah, in retrospect that is 100% obvious. It works fine now as code:
Oh well, on the upside I guess I am learning piece by piece, even though I feel like the world's biggest idiot most of the time
|
# ? May 3, 2016 16:53 |
|
TooMuchAbstraction posted:That's just functions as first-class objects (or "first-class functions"). I guess using that specifically for an object constructor is like having an extremely bare-bones factory. Or "first-class classes" -- in Python, for example, class definitions are callable but are not the same thing as functions. They are first-class values, though.
|
# ? May 3, 2016 17:53 |
|
qntm posted:Related: In Python a in [b, c, d] is equivalent to a == b or a == c or a == d, but it sometimes bugs me that you can't write a is in [b, c, d] to mean a is b or a is c or a is d. The best you can do is any(a is x for x in [b, c, d]).
|
# ? May 3, 2016 17:56 |
|
Sedro posted:If you wanted identity, why would you implement equality in the first place? I don't remember the exact use case, but __eq__ had already been implemented and meant something other than object identity.
|
# ? May 3, 2016 19:30 |
|
What's the best way to remote edit files? I have some code I cannot run or test locally, due to dependency issues, so my workflow is: edit -> git commit/push -> git pull from ssh'd terminal window -> run -> watch it crash and then repeat, with increasingly horrible commit messages I mean, it's a solo project so a silly commit history isn't that much of a problem, it's just a bit inefficient and obnoxious. Using scp seems even more obnoxious. I tried some remote editing Sublime Text plugin, but it's not working well on Windows. MSYS2's version of vim is... not stellar and sometimes has some really bad behavior, and vim isn't really my favorite editor anyway.
|
# ? May 4, 2016 20:34 |
|
Jsor posted:What's the best way to remote edit files? 1) Are you sure you can't locally replicate things? VM, docker, etc. can't get you a local-ish version of your environment? I developed a small javascript utility using python to set up a local web server on 0.0.0.0:9999 2) scp replaces two of those steps (the git ones) and should be a common enough that you can wrap it up in a single command (scp workingdir/* host:/path/). What does "run" look like? Through the ssh'd terminal or accessing a web server?
|
# ? May 4, 2016 20:46 |
|
JawnV6 posted:Sorry to presume the XY, but a few thoughts: ssh'd terminal. It's a hardware issue, I'm doing GPGPU stuff and my home card has memory issues. The scp thing is possible, the problem is that the directory I'm scping to has a pretty long path I'd prefer not to remember/type, there's always `!scp`, but I've accidentally screwed stuff up before by absent-mindedly changing my working directory. I guess there's always a .sh file in each directory that's just an scp line, which is functional if inelegant.
|
# ? May 4, 2016 20:54 |
|
...vim? You can also execute commands via ssh directly, so e.g. quote:ssh user@host 'run command/to/very/long/path'
|
# ? May 5, 2016 01:00 |
|
I just X11 forward my IDE installed remotely. vim is my go-to for editing scripts. It's honestly not great but it works.
|
# ? May 5, 2016 03:59 |
|
Jsor posted:What's the best way to remote edit files?
|
# ? May 5, 2016 14:32 |
|
ExcessBLarg! posted:Options: Or using emacs with TRAMP. If you know Emacs it will be hard to find a more convenient way.
|
# ? May 5, 2016 14:50 |
|
I need a open source tool to manage multiple nodejs instances. It'll boot 8 instances (or whatever I config it to), auto-restart each instance on crash or if mem usage exceeds 512mb (also configurable) and let me issue commands to monitor mem/cpu usage of all. Also, it'll ideally nodebalance (pun intended) to send incoming http requests to whichever instances are running correctly. Know any programs that can do this?
|
# ? May 5, 2016 15:02 |
|
This'll be your guy I reckon: https://github.com/Unitech/pm2 You could also just use supervisord or somethings, but pm2 is specific to node and probably a shoe in for getting what you want without too much effort.
|
# ? May 5, 2016 16:19 |
|
Maluco Marinero posted:This'll be your guy I reckon: OOooooo, that looks nice. Thanks man!
|
# ? May 5, 2016 18:14 |
|
Peanut and the Gang posted:auto-restart each instance on crash Peanut and the Gang posted:mem usage exceeds 512mb systemd and upstart can be configured to limit the memory size of a task.
|
# ? May 5, 2016 19:35 |
|
Jsor posted:What's the best way to remote edit files? I have some code I cannot run or test locally, due to dependency issues, so my workflow is: I dunno what language you're using, but PyCharm has a nice remote mode that does lets you work on remote files and even use a remote interpreter on your local machine. http://blog.jetbrains.com/pycharm/2015/03/feature-spotlight-python-remote-development-with-pycharm/
|
# ? May 5, 2016 21:43 |
|
Am I right in thinking that the amount of time that a file takes to load is based on the size of the file, regardless of how resource-intensive the file will be once it loads? I had been thinking an AI file would load slower than a texture, but then I realized that the AI files are a fraction of the size of the textures or models in a modern game.
|
# ? May 6, 2016 00:38 |
|
Thanks for the remote suggestions, everyone.22 Eargesplitten posted:Am I right in thinking that the amount of time that a file takes to load is based on the size of the file, regardless of how resource-intensive the file will be once it loads? I had been thinking an AI file would load slower than a texture, but then I realized that the AI files are a fraction of the size of the textures or models in a modern game. Load into memory? Yeah, it's purely* a function of how big the file is. This is ignoring any processing of the file you need to do, e.g. if you need to dynamically compile plugin code for your AI it may be slower, but a theoretical smaller-in-bytes texture may also be slower if you need to decompress it before use and so on. * May not be pedantically accurate, obviously if they're stored on different types of disks etc etc
|
# ? May 6, 2016 00:47 |
|
Jsor posted:* May not be pedantically accurate, obviously if they're stored on different types of disks etc etc The magic words are "all else being equal".
|
# ? May 6, 2016 01:13 |
|
22 Eargesplitten posted:Am I right in thinking that the amount of time that a file takes to load is based on the size of the file, regardless of how resource-intensive the file will be once it loads? Many file formats are designed so they don't have to be loaded into memory all at once. Of course in modern computers with many GB of RAM, it's not usually a problem to load the entire contents of files into memory; but even 20 years ago it was often impractical or infeasible to do so. As an example, the PDF format was designed so that a PDF reader can load and render a single page at once, regardless of the number of pages and overall size of the PDF file itself. That said, how long it takes to load (really, render) a single page of a PDF document depends greatly on the page contents, which if they include a lot of vector graphics, may involve a lot of complex data structures and drawing operations, but otherwise not necessarily take up much memory or disk space. I'm not as familiar with Illustrator itself, but I think that concept generally applies across vector graphic editors. It's interesting to note that the predecessor to PDF, PostScript, is a fully complete (i.e., Turing-complete) programming language and thus, can take arbitrary long to render a single page.
|
# ? May 6, 2016 03:57 |
|
Does Haskell offer any convenient way of picking out text between two substrings? The tagger I've worked on here for a while is working, and for further processing I'd want to be able to extract the tagged elements. They are surrounded by elements in the format of code:
code:
Apparently regex would be very helpful for this but regex + Haskell is a mire I'd rather avoid if I can. Shaman Tank Spec fucked around with this message at 20:09 on May 6, 2016 |
# ? May 6, 2016 20:01 |
|
If you're getting this in-depth with text parsing in Haskell, you should probably just look into Parsec.
|
# ? May 6, 2016 21:06 |
|
You're a programmer and an apex predator. Implement it yourself.
|
# ? May 6, 2016 21:15 |
|
Jsor posted:Using scp seems even more obnoxious. I use WinSCP and Notepad++. Hitting Save automatically transfers the modified local temp file back to the remote machine. It's hardly a development environment but it does the job.
|
# ? May 6, 2016 21:27 |
|
Asymmetrikon posted:If you're getting this in-depth with text parsing in Haskell, you should probably just look into Parsec. ThanKs, I might do. The trouble with doing it manually is that splits seem kinda wonky if you're splitting at the beginning or end of a list.
|
# ? May 6, 2016 22:39 |
|
sarehu posted:You're a programmer and an apex predator. Implement it yourself. Thanks for the pep talk, that's precisely what I did and it was surprisingly easy to do with just basic Haskell syntax. Once again a proper functional programmer would probably poo poo their pants and die at my code but it's done!
|
# ? May 7, 2016 13:59 |
|
Hello. I'm teaching myself Docker. I'm not sure this is the correct place to ask about it... Problem: I've built a docker image to run the old systems simulator, simh (references http://simh.trailing-edge.com and git://github.com/simh/simh). That image is based on debian, plus a bunch of packages to actually build the simulators, including some network setup and the whole gcc. My specific question is how can I build an image which uses gcc to do the building but does not need it at runtime. In other words, how do I make available gcc at buildtime, but not at runtime. Suposing that is posible at all.
|
# ? May 8, 2016 23:28 |
|
Amberskin posted:Hello. I'm teaching myself Docker. I'm not sure this is the correct place to ask about it... A docker image is a diff of the image it's based on. As long as you delete the dependency when you're done, it won't bloat the image. So on debian you would apt-get install --yes <stuff> && <do things> && apt-get purge --yes --auto-remove <stuff>
|
# ? May 9, 2016 00:20 |
|
Is there any downside to basically always using Docker when working with simple projects? I like the idea of a sandboxed code that I can move to any of my dev machines and it's been working well for me the last couple weeks. However, it's possible that my regular workflow was just lovely and I wasn't good about using things like virtualenv to do this stuff anyway.
|
# ? May 9, 2016 05:02 |
|
Sedro posted:A docker image is a diff of the image it's based on. As long as you delete the dependency when you're done, it won't bloat the image. Thanks! That makes sense.
|
# ? May 9, 2016 08:18 |
|
IT BEGINS posted:Is there any downside to basically always using Docker when working with simple projects? I like the idea of a sandboxed code that I can move to any of my dev machines and it's been working well for me the last couple weeks. However, it's possible that my regular workflow was just lovely and I wasn't good about using things like virtualenv to do this stuff anyway. I do this a lot, there's a few quirks you will notice and take care of on your own over time but in general it's fine and makes life easier. My personal machines run different distributions and Docker synchronises my dev environment smoothly.
|
# ? May 11, 2016 01:20 |
|
tazjin posted:I do this a lot, there's a few quirks you will notice and take care of on your own over time but in general it's fine and makes life easier. Cool - I haven't run into anything too bad yet, my big concern right now moving forward is how to distribute command line apps if I primarily use Docker to maintain them. I'm not a fan of forcing Docker as a dependency if it's not a webapp, but if it makes my entire process better than probably the trade-off is worth it.
|
# ? May 11, 2016 09:14 |
|
Can someone recommend me good books on software architecture, on different levels of abstraction?
|
# ? May 11, 2016 11:00 |
|
IT BEGINS posted:Cool - I haven't run into anything too bad yet, my big concern right now moving forward is how to distribute command line apps if I primarily use Docker to maintain them. I'm not a fan of forcing Docker as a dependency if it's not a webapp, but if it makes my entire process better than probably the trade-off is worth it. You should use distribution package systems for that because you want easy removal / upgrade paths for end-users.
|
# ? May 11, 2016 15:53 |
|
autotools question I'm trying to cross compile a package from source which requires me to run autotools (autoreconf) to generate the ./configure script etc. The problem is the tools dir that I have for the target device has its own libtoolize script, which is throwing errors since there are explicit path variables set from someone else's system. I don't know the first thing about autotools, is libtoolize in any way target-platform dependent or can i just delete this other guys script that is causing problems and let it run from my /usr/bin/libtoolize ?
|
# ? May 12, 2016 00:58 |
|
What you might find is older versions have issues cross platform, so you need to cleanup and rebuild with a newer set, usually projects include some sort of bootstrap like script:Sh code:
|
# ? May 12, 2016 01:12 |
|
|
# ? Jun 8, 2024 11:25 |
|
MrMoo posted:What you might find is older versions have issues cross platform, so you need to cleanup and rebuild with a newer set, usually projects include some sort of bootstrap like script: there's an autogen.sh script, which basically just calls autoreconf.
|
# ? May 12, 2016 01:54 |