|
ah I see, I guess I assumed most people would switch to 3.0 and I would be learning old tech. Nice to know I can just follow my book without a bunch of extra work. Thanks!
|
# ? Jan 16, 2012 00:30 |
|
|
# ? May 15, 2024 23:28 |
|
If your book's in Python 2, just use Python 2. Once you're through your book, the differences between 2 and 3 won't be a big deal for you.
pokeyman fucked around with this message at 05:23 on Jan 16, 2012 |
# ? Jan 16, 2012 01:13 |
|
That seems like a really bad book to follow if they suggest students use eval to convert input like that. What happens when students transfer this idea and apply this to some query string input in a web app.
|
# ? Jan 16, 2012 17:44 |
|
Strong Sauce posted:That seems like a really bad book to follow if they suggest students use eval to convert input like that. What happens when students transfer this idea and apply this to some query string input in a web app. my book is for 2.0, I found the 3.0 example stuff somewhere else.
|
# ? Jan 16, 2012 21:54 |
|
Xguard86 posted:my book is for 2.0, I found the 3.0 example stuff somewhere else. Doesn't matter what version you're using. eval()ing anything is still usually not a good idea, especially when introducing a language to beginners. That was a good opportunity to introduce int() and ValueError handling and instead they told you to do something dangerous.
|
# ? Jan 16, 2012 22:28 |
|
Anybody have suggestions on where to get started with audio programming? My stupid day job is as a dev, but I've never dealt with audio before. I'm interested in realtime synthesis and processing with an eventual goal of writing audio plugins (VST/AU) and maybe iOS/OS X audio apps. I found these at Amazon: Real Sound Synthesis for Interactive Applications The Audio Programming Book At this point, I figure I'll start with the second of those two, but I'd appreciate advice from somebody who's done this already. Advice on where to start with OS X/iOS audio would be good too. Maybe there are some good online guides?
|
# ? Jan 16, 2012 22:40 |
|
Xguard86 posted:ah I see, I guess I assumed most people would switch to 3.0 and I would be learning old tech. Nice to know I can just follow my book without a bunch of extra work. Thanks! yea, 3 breaks compatibility with most third party libraries so it isn't used much. Realistically, i'm not sure it will ever be.
|
# ? Jan 17, 2012 00:12 |
|
Soup in a Bag posted:Advice on where to start with OS X/iOS audio would be good too. Maybe there are some good online guides? Come say hi next door!
|
# ? Jan 17, 2012 00:18 |
|
Just adding input on the eval issue. You should almost never eval anything to begin with, but you never want to run eval on raw user input like that. As was said already, eval just executes what it is passed. So that doesn't seem too bad with what you're intending it to be used as, but what happens if someone puts in sys.exit()? (answer: your program exits, which if it is a web server in production is probably Not Good).
|
# ? Jan 17, 2012 04:38 |
|
Note that ast.literal_eval is safe to use if you want something that can take a bunch of random Python objects. literal_eval supports strings, ints, floats, tuples, lists and dicts (and in Python 2.7, sets).
|
# ? Jan 17, 2012 04:50 |
|
Munkeymon posted:Doesn't matter what version you're using. eval()ing anything is still usually not a good idea, especially when introducing a language to beginners. That was a good opportunity to introduce int() and ValueError handling and instead they told you to do something dangerous. I believe that what he is saying is that the actual text he is working from didn't suggest this technique (I hope that's the case). I'm assuming that it was from terrible Stack Overflow answer or something. But yes, don't do that. Hot drat! Good to know. VVV Modern Pragmatist fucked around with this message at 06:01 on Jan 17, 2012 |
# ? Jan 17, 2012 05:27 |
|
It said to use input, which has an implicit eval inside of it.
|
# ? Jan 17, 2012 05:39 |
|
Suspicious Dish posted:It said to use input, which has an implicit eval inside of it. Holy gently caress. I just checked the docs. Apparently in python2.x input() is just eval(raw_input()). That's so loving terrible. It looks like they changed it for python3.x to just getting a string though (which is probably why his stuff was breaking in that example anyway).
|
# ? Jan 17, 2012 05:48 |
|
Hooly poo poo. Nice going python. I know a lot of people who used raw_input for strings and input for ints. Look at this.
|
# ? Jan 17, 2012 06:25 |
|
In all likelihood input() is only there as a shim so Python 3 code doesn't completely poo poo a brick when passed over by a Python 2 interpreter, since there's supposed to be some sort of compatibility guff going on between the two which I don't fully understand. I wasn't aware it was as huge a security hole as literally being a wrapper around eval() though.
|
# ? Jan 17, 2012 17:41 |
Crosscontaminant posted:In all likelihood input() is only there as a shim so Python 3 code doesn't completely poo poo a brick when passed over by a Python 2 interpreter, since there's supposed to be some sort of compatibility guff going on between the two which I don't fully understand. I wasn't aware it was as huge a security hole as literally being a wrapper around eval() though. Python 1.4 docs: quote:input([prompt]) It has been that way since forever.
|
|
# ? Jan 17, 2012 17:59 |
|
Modern Pragmatist posted:I believe that what he is saying is that the actual text he is working from didn't suggest this technique (I hope that's the case). I'm assuming that it was from terrible Stack Overflow answer or something. But yes, don't do that. This is correct but the text makes no mention that input() is actually eval( raw_input()). Thats a little scary, I mean the book isn't about python but more for learning fundamental CS (or in my case, relearning it) but drat they could have at least put a little asterik with a warning not to run off and use it for anything outward facing. Based on that, I am considering scrapping this book since god knows what other terrible things it will teach me. Anyone have any suggestions for CS 101 books I can use for self study that won't teach me terrible things? I do have basic knowledge of general concepts, I took a couple of coding classes in school a couple of years ago, I just need practice and some handholding when things get more advanced. EDIT: oh hey someone asked exactly that question in the python thread, so answer if you want but I already found some good info. Xguard86 fucked around with this message at 23:35 on Jan 17, 2012 |
# ? Jan 17, 2012 23:28 |
|
Hi all, hiring/job search question -- I thought about putting this in the megathread but that looked more tailored for finding a first job, and that's not me. My startup may be winding down over the next few weeks, so I'm looking to get my personal webpage updated to show off my talents. Thanks to this startup I've done a shitton of web work that I've never done before, including implementing some (nice looking) designs. Is it legit to show screenshots of the finished product on my website and call it part of a "portfolio"? Or will people immediately think "oh hey he can do graphic design work as well" when in reality I can turn a PSD into nice CSS but I can't design my way out of a paper bag? Is there any way I can word this so that people understand?
|
# ? Jan 19, 2012 15:52 |
|
Put a shot of the psd along side the final product, and hope the writing surrounding it explains enough context?
|
# ? Jan 19, 2012 16:12 |
|
I'd just say you were given a design and were able to accurately implement it. Infact, if you DIDN'T create it, couldn't that cause you problems if you didn't clearly state they're not your design?
|
# ? Jan 19, 2012 18:36 |
|
Sab669 posted:I'd just say you were given a design and were able to accurately implement it. Infact, if you DIDN'T create it, couldn't that cause you problems if you didn't clearly state they're not your design? Yeah, exactly - that's what I want to avoid. I don't want to take any credit for something I didn't do and misrepresent. I was wondering how (if?) other devs handled this. Thanks to you & tef
|
# ? Jan 19, 2012 19:11 |
|
Hey, would anyone happen to know a decent resource I could use to help me learn automata theory?
|
# ? Jan 19, 2012 21:27 |
|
Rello posted:Hey, would anyone happen to know a decent resource I could use to help me learn automata theory? It kinda depends on why you want to learn it. There are a bunch of textbooks with titles like "Introduction to Computability Theory" that cover the basics, but if you have some specific applications in mind, they probably won't cover them.
|
# ? Jan 19, 2012 22:29 |
|
e; SELECT * FROM users where IQ < 75 AND username = 'sab669'
Sab669 fucked around with this message at 22:40 on Jan 19, 2012 |
# ? Jan 19, 2012 22:38 |
|
Sab669 posted:e; SELECT * FROM users where IQ < 75 AND username = 'sab669' code:
2x edit: oohh noooo that wouldnt even work because 75 isn't less than 75, I am the idiot!
|
# ? Jan 19, 2012 23:45 |
|
And friends should be listed in a separate table. Normalisation!
|
# ? Jan 19, 2012 23:56 |
|
Clearly users is a view and friends is an aggregate column.
|
# ? Jan 20, 2012 00:33 |
|
So for someone with basically no web development experience, what's the recommended go-to language for making a web site? I've been suggested Ruby on Rails or node.js, any thoughts on either one? Or something else?
|
# ? Jan 20, 2012 00:53 |
|
Kim Jong III posted:Yeah, exactly - that's what I want to avoid. I don't want to take any credit for something I didn't do and misrepresent. I was wondering how (if?) other devs handled this. Something like "Implementation by Kim Jong III, design by Adolf Shitlord" maybe? And then ask Alf or whoever owns the rights for permission.
|
# ? Jan 20, 2012 01:04 |
|
Any ideas on how I could go about generating all Latin squares of order n? So far I can create n such squares cyclically:code:
|
# ? Jan 20, 2012 01:36 |
|
Mr. Crow posted:So for someone with basically no web development experience, what's the recommended go-to language for making a web site? I've been suggested Ruby on Rails or node.js, any thoughts on either one? Or something else? What do you want it to do?
|
# ? Jan 20, 2012 01:37 |
|
mobby_6kl posted:Any ideas on how I could go about generating all Latin squares of order n? So far I can create n such squares cyclically: Create every possible square where each row contains one of each number and then run over the results and cull out the invalid ones? I'm sure someone'll come in with some beautiful way to do it but honestly that just sounds like the easiest way to me, though I don't know if that's C or C++.
|
# ? Jan 20, 2012 02:38 |
|
The fact that there isn't an exact formula for the number of Latin squares of side n suggests pretty strongly to me that there also isn't a good procedure for generating all of them.
|
# ? Jan 20, 2012 11:57 |
|
Mr.Hotkeys posted:Create every possible square where each row contains one of each number and then run over the results and cull out the invalid ones? I'm sure someone'll come in with some beautiful way to do it but honestly that just sounds like the easiest way to me, though I don't know if that's C or C++. Would probably use a huge amount of memory even for not very large n. Two observations: 1) You can fix the first row of the square, find all magic squares (let's say there are k of them) with that first row, and then generate the remaining squares by applying permutations of the integers 0 through n - 1. (This gives you n! × k squares in total.) 2) To generate those magic squares in the first place, you could take the approach of generating a tree of height n by filling in rows one by one, filtering out partial squares that have already failed to satisfy the requirement of having each number appear at most once in each column. Here is a partial illustration in the case n = 4:
|
# ? Jan 20, 2012 12:06 |
|
Hammerite posted:2) To generate those magic squares in the first place, FYI These are not magic squares.
|
# ? Jan 20, 2012 12:14 |
|
shrughes posted:FYI These are not magic squares. Oh yeah, I don't know what happened there. I was talking about Latin squares but saying "magic squares".
|
# ? Jan 20, 2012 12:20 |
|
Benson Cunningham posted:What do you want it to do? Nothing in particular at the moment, just gonna be a personal website to learn on. I guess which have the most wide reaching applications for future use?
|
# ? Jan 20, 2012 17:43 |
|
Mr. Crow posted:So for someone with basically no web development experience, what's the recommended go-to language for making a web site? I've been suggested Ruby on Rails or node.js, any thoughts on either one? Or something else? Mr. Crow posted:Nothing in particular at the moment, just gonna be a personal website to learn on. I guess which have the most wide reaching applications for future use? First you should understand that Rails is a full-stack web framework built on Ruby and node.js is a collection of system functions/tools based in javascript designed for event-driven high-scale applications. Right now I believe the most popular web framework for node.js is Express. If you are doing this in order to add to your list of skills in your resume (as in you want to use the most common languages/web frameworks), I would consider Django, then Rails, then node.js. I'm mainly doing Ruby now (not much Rails) and a lot of jobs are primarily looking for Python and Django developers. Not that there isn't positions with Rails/Ruby and Nodejs but from my own personal search these past couple of months there are a lot of people looking for Django and/or Python developers. If you're just doing this to learn, then use whatever language you want. Express and node.js are relatively stable but for some libraries there is no definitive or even top 3 that you can choose from. A lot of it will rely on you evaluating the libraries yourself since nodejs is still relatively young. Rails and Ruby are pretty mature projects with lots of documentation and examples with only a couple of libraries for each specific category so if you need to choose one you can just use Google and read other people's evaluation of it. In the end I think there is a future for node.js and Python and Ruby so just do the one you enjoy doing the most. When it comes time to getting a job employers will probably care more that you did something, even if its not in their preferred choice of stack/language.
|
# ? Jan 20, 2012 19:08 |
|
Mr.Hotkeys posted:Create every possible square where each row contains one of each number and then run over the results and cull out the invalid ones? I'm sure someone'll come in with some beautiful way to do it but honestly that just sounds like the easiest way to me, though I don't know if that's C or C++. I'm usually the first one to apply brute force to such issues, but as Hammerite pointed out, this would be very likely to run into running time and/or memory issues with increasing n. The code I posted is C, but that's only because I want to learn it and no other reason. If it's supposed to be in Java or something, converting it would be left as an exercise for the reader. Hammerite posted:Would probably use a huge amount of memory even for not very large n.
|
# ? Jan 20, 2012 19:40 |
|
|
# ? May 15, 2024 23:28 |
|
gcc's being lazy about the stack. It's compiling a function and after the args are consumed it just slaps new data into [esp] and [esp+4] before calling another function. Are there any flags that will force it to play nice and actually push the args? I'm doing some inline assembly that's getting mixed up and couldn't find any way to express "hey this is pushing something on the stack don't touch it". Right now I'm just modifying the machine code once it's done but that's annoying and I'd rather avoid it entirely.
|
# ? Jan 20, 2012 21:11 |