|
So I'm working on a project that uses twitter's API in Ruby. As of right now, none of my calls check for rate limiting - it was originally a weekend experiment, so I never really bothered checking. Now however I want to wrap all my calls to my twitter client object in blocks so that it can handle the too many requests exception.code:
bomblol fucked around with this message at 00:38 on Mar 29, 2016 |
# ? Mar 29, 2016 00:31 |
|
|
# ? May 18, 2024 05:42 |
|
No Safe Word posted:You suffer from the same affliction I try to rid myself of: gratuitous use of cat (sed can take a filename as an arg) I would't call it "suffering" Really though, when I'm building one up I always start with cat. No small part of it is afraid I'll forget which sed flags actually muck my file up and I know cat is far less likely to do that. But if I just want to see how the first 10 lines are going, piping into head makes a lot more sense than hopping back to the first thing and changing that command no matter how much interstitial inefficiency is created. Do you have a limited number of times to call cat every day?
|
# ? Mar 29, 2016 00:46 |
|
I feel the same way, but instead ofcode:
code:
|
# ? Mar 29, 2016 01:15 |
|
bomblol posted:It really uglies up the code having to do this for every call. Is there some way I can make a method, such as twitter_request(request) that I could somehow pass mentions({since_id: @last_seen_tweet, count: 20}) (or whatever the equivalent would be), and then inside that method wrap the call in exceptions? I was considering creating a new class MyTwitterClient or whatever that implements method_missing, send() it to the @twitter_client after wrapping it in the exception handler. But i would like to avoid creating another class just for that. Or maybe there's a better way to do it by subclassing the twitter client class. If this were Python I'd tell you to write a decorator function, which would look something like this: code:
The "*args, **kwargs" bit is what a "varargs" (variable argument list) function looks like in Python. Again, Ruby presumably has something similar. Basically it allows you to pass arguments between functions without actually caring what they are, and to work with functions that can accept an arbitrary number of arguments (print/printf are common examples of this). *args is a list (tuple in Python) of arguments, and **kwargs is a dictionary of arguments that were supplied by keyword.
|
# ? Mar 29, 2016 01:57 |
|
Anyone know of a good regular expressions tutorial? I'm working with Ruby and Python if it matters. Never used regular expressions before, so think something that starts from scratch.
|
# ? Mar 29, 2016 05:36 |
|
dantheman650 posted:Anyone know of a good regular expressions tutorial? I'm working with Ruby and Python if it matters. Never used regular expressions before, so think something that starts from scratch. This helped me for Python also try here for some regex practice
|
# ? Mar 29, 2016 06:23 |
|
Anyone who's familiar with stackoverflow should like this stupid twitter markov chain bot https://twitter.com/horse_overflow
|
# ? Mar 29, 2016 13:46 |
|
So I'm having some issues with Git-SVN. I'm trying to use it to get checkout of a very large SVN repository on a Windows computer via CygWIN -- attempts at getting a checkout via native SVN and/or Git clients have failed for various reasons, and all of my company's support scripts were written for Unix/Linux, so CygWIN appears to be my best shot. What I've been doing in the meantime is using regular SVN to get a checkout on my dev server and rsyncing all the code over to my Windows laptop for development purposes (deploying it back to the dev server for testing purposes via IntelliJ's built-in SFTP functionality), but this isn't a perfect solution, especially when large changes to how our files are organized come around (this happened last week, hence the Git-SVN experiments). Anyway, I'm attempting to check out the repository via the following command: code:
code:
code:
code:
code:
Obviously, this means that the sync will take days and use up my entire hard drive. I would not like this to happen. That's why I specified "-r HEAD" in my initial clone command (I've also tried -r 896498:HEAD with no difference); the problem seems to be that fetch is just kind of ignoring that parameter. My question: how do I either (a) keep my initial correctly-formatted clone command from dying of signal 11, or (b) when resuming it, tell fetch not to get me 750,000 loving revisions I don't want? fake-edit: Stack Overflow has also suggested I add "--parent" to my fetch command, this results in an immediate death with the output code:
|
# ? Mar 30, 2016 16:22 |
|
Does anyone have a favorite 'babby's first raytracer' guide or book?
|
# ? Mar 30, 2016 18:50 |
|
taqueso posted:Does anyone have a favorite 'babby's first raytracer' guide or book? Physically Based Rendering is the most comprehensive one out there, even won a technical Oscar. Covers a lot of stuff and goes much deeper than your first raytracer but it also covers the basics in good explanations so you can probably use it as a reference while trying to make your own. When I first made a raytracer years ago I just googled raytracer tutorials, which gives a real mixed bag but should be helpful to get bits and pieces of what's applicable to help you out.
|
# ? Mar 30, 2016 19:00 |
|
piratepilates posted:Physically Based Rendering is the most comprehensive one out there, even won a technical Oscar. Covers a lot of stuff and goes much deeper than your first raytracer but it also covers the basics in good explanations so you can probably use it as a reference while trying to make your own. quote:When I first made a raytracer years ago I just googled raytracer tutorials, which gives a real mixed bag but should be helpful to get bits and pieces of what's applicable to help you out.
|
# ? Mar 30, 2016 19:27 |
|
The Version Control Megathread might be able to help you out.
|
# ? Mar 30, 2016 20:41 |
|
taqueso posted:Thanks. I can probably have work buy that for me, even though it isn't directly applicable to anything we do. PBRT is a great book. It is in fact so great that there will be an updated and expanded 3rd edition published in June-ish, which you might want to get instead. Depending on what you want to achieve you can consider starting out with just shadertoy. You can follow a raymarching tutorial and working with just a shader strips away a lot of the annoying plumbing you'd otherwise need to do in order to get pixels on screen. Of course, there are limits to what you can do in shadertoy (exception: Inigo Quilez) but it's a good way to get started with a lot of the concepts involved in a more complicated renderer.
|
# ? Mar 30, 2016 22:17 |
|
taqueso posted:Does anyone have a favorite 'babby's first raytracer' guide or book?
|
# ? Mar 30, 2016 22:24 |
|
GrumpyDoctor posted:The Version Control Megathread might be able to help you out. didn't realize there was one, thanks for the record I ended up just using the native Windows installation to pull because it's way less buggy; turns out I can in fact do that and still use Unix scripts in CygWIN afterward
|
# ? Mar 30, 2016 22:35 |
|
Xerophyte posted:PBRT is a great book. It is in fact so great that there will be an updated and expanded 3rd edition published in June-ish, which you might want to get instead. I decided to get a used copy of 2nd edition, since I saw the 3rd edition was coming soon. I don't want to wait for July 15. I want to work on this to get a better handle on rust-lang, but the shader stuff does sound interesting. Star War Sex Parrot posted:I rather liked this book that I found a couple of months ago: Ray Tracing in One Weekend Thanks, I'll look at this one too.
|
# ? Mar 30, 2016 22:52 |
|
One of the guys who wrote PBRT is actually a goon who has posted in CoC before, I forget his name though.
|
# ? Mar 30, 2016 23:51 |
|
piratepilates posted:One of the guys who wrote PBRT is actually a goon who has posted in CoC before, I forget his name though. Greg Humphreys, yep. One of two goons I'm aware of who have an Academy Award.
|
# ? Mar 31, 2016 00:40 |
|
dantheman650 posted:Anyone know of a good regular expressions tutorial? I'm working with Ruby and Python if it matters. Never used regular expressions before, so think something that starts from scratch. http://www.regular-expressions.info/tutorial.html is pretty good, despite the .info tld.
|
# ? Mar 31, 2016 05:23 |
|
piratepilates posted:Physically Based Rendering is the most comprehensive one out there, even won a technical Oscar. Covers a lot of stuff and goes much deeper than your first raytracer but it also covers the basics in good explanations so you can probably use it as a reference while trying to make your own. i tried to do the free Course but ended up losing it as i didnt get the math. (next course starts 1st May) https://www.edx.org/course/computer-graphics-uc-san-diegox-cse167x-1
|
# ? Mar 31, 2016 07:37 |
|
taqueso posted:Does anyone have a favorite 'babby's first raytracer' guide or book? This edX course covers basic raytracing really well (and als openGL): https://www.edx.org/course/computer-graphics-uc-san-diegox-cse167x-1#! The instructor is quite a guru in the business, and it is easy to follow and enjoy. E: ^^^ Beaten
|
# ? Apr 1, 2016 16:26 |
|
Amberskin posted:This edX course covers basic raytracing really well (and als openGL): I could not follow that guy at all
|
# ? Apr 1, 2016 17:21 |
I want to force a HTTP request to a particular host timeout in order to test something. Any sort of iptables or hosts file trickery I can do to achieve that? edit: This seemed to work: http://stackoverflow.com/a/904609/400503 fletcher fucked around with this message at 22:22 on Apr 1, 2016 |
|
# ? Apr 1, 2016 21:54 |
|
fletcher posted:I want to force a HTTP request to a particular host timeout in order to test something. Any sort of iptables or hosts file trickery I can do to achieve that?
|
# ? Apr 2, 2016 00:38 |
|
Bob Morales posted:I could not follow that guy at all TheresaJayne posted:i tried to do the free Course but ended up losing it as i didnt get the math.
|
# ? Apr 2, 2016 18:30 |
|
Star War Sex Parrot posted:I rather liked this book that I found a couple of months ago: Ray Tracing in One Weekend How much does this text require the other ones he mentions? Thinking about maybe doing this while I'm traveling but if you have to look things up frequently it may not work so well.
|
# ? Apr 2, 2016 18:58 |
|
Star War Sex Parrot posted:I rather liked this book that I found a couple of months ago: Ray Tracing in One Weekend The third book in the series is apparently out, and also free for a few days. Might be worth checking out for anyone who liked the previous two.
|
# ? Apr 3, 2016 04:11 |
|
Bob Morales posted:I could not follow that guy at all i couldnt get the math
|
# ? Apr 4, 2016 08:05 |
|
TheresaJayne posted:i couldnt get the math You definitely want to become familiar with at least matrices before you start the course
|
# ? Apr 4, 2016 16:45 |
|
Hopefully this is the right thread. It's a hardware question, but specifically for programming use. I'm looking at possibly getting a new processor. Do Eclipse or Visual Studio in particular, or any of the common compilers / interpreters in general get much out of 4 cores, or are 2 hyperthreaded cores at a higher clock more effective? I guess I'm also interested about Unity, UE4, and possibly Cryengine if they get their poo poo sorted out.
|
# ? Apr 4, 2016 18:13 |
|
22 Eargesplitten posted:Hopefully this is the right thread. It's a hardware question, but specifically for programming use. I'm looking at possibly getting a new processor. Do Eclipse or Visual Studio in particular, or any of the common compilers / interpreters in general get much out of 4 cores, or are 2 hyperthreaded cores at a higher clock more effective? I guess I'm also interested about Unity, UE4, and possibly Cryengine if they get their poo poo sorted out. Compiling stuff benefits heavily from more processors, even from being distributed across machines. So it depends on the clock difference and maybe the workload. Hyperthreading is like a 10% gain, not too important. Compilation should be faster on quad core, but maybe not your single threaded unit tests. I'd go quad core, being a statically typed AOT compiled person, making likely assumptions about the clock difference.
|
# ? Apr 4, 2016 18:59 |
|
Okay, thanks. I've only ever had dual cores, since i3s are usually $70-100 cheaper than i5s. I'll see if I can swing an i5.
|
# ? Apr 4, 2016 20:19 |
|
I'm wrapping up an iOS app that has always been slated to be open source. I've never hosted an open source app, so I was are some best practices. My thoughts so far: - Github seems like an okay place to host the project - I don't really care if people contribute to the project or not - If someone did want to contribute, how does that work? Like, do you get a notification that someone wants to push to the project?
|
# ? Apr 4, 2016 22:37 |
|
lord funk posted:- If someone did want to contribute, how does that work? Like, do you get a notification that someone wants to push to the project? The usual way on GitHub is that they'll make a fork of your project, commit changes to that fork, and then submit a pull request to your project with those changes. Then you get a trouble-ticket-like system where you can talk about the changes, examine the file diffs, suggest alterations, and when you're happy you hit the accept button and the commits are added to your project.
|
# ? Apr 4, 2016 23:44 |
|
If it's not on Github it might as well not exist, so good call there. TooMuchAbstraction covered the pull requests feature. You'll get email notifications by default, they tell you how to proceed (or back out gently), so you won't miss anything. If you're lucky enough to get someone with a proven history of useful contributions, you can give them permission to push directly to your repository, thereby skipping the steps where they clone your repo and wait for you to accept a pull request. Or maybe you never bother doing this and stick to pull requests. Up to you.
|
# ? Apr 5, 2016 01:16 |
|
Thanks, that sounds straightforward.
|
# ? Apr 5, 2016 01:34 |
|
22 Eargesplitten posted:Hopefully this is the right thread. It's a hardware question, but specifically for programming use. I'm looking at possibly getting a new processor. Do Eclipse or Visual Studio in particular, or any of the common compilers / interpreters in general get much out of 4 cores, or are 2 hyperthreaded cores at a higher clock more effective? I guess I'm also interested about Unity, UE4, and possibly Cryengine if they get their poo poo sorted out. Yes - and it's common enough where big projects are used as compiler benchmarks for hardware. Think compiling Firefox or Chromium (Chrome) on Visual Studio
|
# ? Apr 5, 2016 19:51 |
|
Is there a name for a transmitted set of data where, in order to read any of its built in values correctly (including values not on a byte border), you have to swap every consecutive pair of bytes wholesale (ie swap bytes 0 and 1, 2 and 3, etc)? I just did this for some data I'm tearing my hair out at trying to read, and all of the numbers started making sense. Made-up example: in the first 24 bits i was expecting an integer unsigned equaling 169,457--or 0x0295F1. In the file the first four bytes are 0x9502xxF1, where xx is arbitrary--swap bytes 0/1 and 2/3, and I get the number I expected. If it were just little endian it'd be in the file as 0xF19502xx, so... what the gently caress?
|
# ? Apr 6, 2016 00:07 |
|
Ciaphas posted:Is there a name for a transmitted set of data where, in order to read any of its built in values correctly (including values not on a byte border), you have to swap every consecutive pair of bytes wholesale (ie swap bytes 0 and 1, 2 and 3, etc)? I just did this for some data I'm tearing my hair out at trying to read, and all of the numbers started making sense. quote:Mixed forms also exist, for instance the ordering of bytes in a 16-bit word may differ from the ordering of 16-bit words within a 32-bit word. Such cases are sometimes referred to as mixed-endian or middle-endian. There are also some bi-endian processors that operate in either little-endian or big-endian mode. I'm sorta assuming "including values not on a byte border" you mean word, or are there actual cases where you're swapping nybbles around?
|
# ? Apr 6, 2016 00:38 |
|
|
# ? May 18, 2024 05:42 |
|
My favorite endianness story was decoding the images from a scientific camera. The (grayscale) pixel values had 12 bits of depth and were encoded into 16 bits, with the following structure:code:
|
# ? Apr 6, 2016 00:57 |