|
Pie Colony posted:Am I in any way crippling my career? Obviously it's not the worst thing to be constantly learning, but (1) I am learning a lot of cool theory and principles, but it's not like my next job will use any of those things, especially me only having a bachelor's with no plans to get a MS/PhD and (2) I'm missing out on a lot of "practical" knowledge about tool chains, build systems, deployment, testing, etc. Since I have no idea what your career path is, here's some general advice. Learn to properly build, maintain and use a relational database. It's probably the most useful thing I've picked up at my current job that's in demand everywhere and incredibly practical. If you have plenty of downtime, keep plugging away at personal projects. You're essentially building up a portfolio to show off to new potential employers, and who knows, you might actually make money off of it on the side. Study up on modern sdlc styles if you're worried about learning "tool chains, build systems, deployment, testing, etc". Most places do their own thing anyways so you'll never go into a job knowing everything up front.
|
# ? Jun 20, 2013 01:37 |
|
|
# ? May 30, 2024 10:11 |
|
I mostly copied this from the internet and I know it works, but I don't understand how this function works. Number is an input that is asked for from the user.code:
1 1 2 3 5 Where do the 2, 3, 5 come from? It isn't fitting into my little squirrel brain.
|
# ? Jun 20, 2013 01:43 |
|
Recursion can be hard to understand. Let's break it down for you. Let's say the user enters the number 3. Then we'll call fibonacciRecursion(3). if (number == 1 || number == 2). This is false as the number is not 1 or 2. return fibonacciRecursion(number - 1) + fibonacciRecursion(number - 2); expands to: return fibonacciRecursion(2) + fibonacciRecursion(1); Those, themselves, run in order. fibonacciRecursion(2) is 1, and fibonacciRecursion(1) both evaluate to 1, so it returns 1 + 1, or 2. Make sure you understand this part before you read on. If you don't fully understand this part, the next one will confuse to no end. It's hard and it took me a few years to fully "grasp" recursion, so feel free to ask what may seem like silly questions if you still don't understand this half. There's two "main" points of confusion I've seen while teaching: first, recursive algorithms can and will run infinitely if you don't program them properly. Note that there's a case where you don't call the function, which when the number is 1 or 2. As we're always counting down by 1 or 2, any valid input will hit this. This is known as the base case. Recursive algorithms without a base case will run infinitely or crash or do stupid things. There's no magic in the computer that will stop that from happening/ Second, every time you call a function, it gets a new location for variables that don't interfere with the old ones. They're still around, and will still be around with the same values when the "inner" functions complete. OK, now let's say the user enters 5. fibonacciRecursion(5). This expands to: fibonacciRecursion(4) + fibonacciRecursion(3) We know that fibonacciRecursion(3) is 2 from above (although we could calculate it again, but that would waste space), so let's replace that right away. fibonacciRecursion(4) + 2 And if we expand the remaining call, then we have: (fibonacciRecursion(3) + fibonacciRecursion(2)) + 2 We've seen both of those before. (2 + fibonacciRecursion(2)) + 2 (2 + 1) + 2 Thus, fibonacciRecursion(5) is indeed 5. Suspicious Dish fucked around with this message at 01:57 on Jun 20, 2013 |
# ? Jun 20, 2013 01:53 |
|
You really can't "cripple your career" in this industry. Well, not unless you do something like intentionally post your customers' credit card info to Reddit. Or you get prosecuted for assaulting your coworkers. Don't do these things. It is possible to be a bad fit and have that come up in your first job. For example, if you are completely incompetent or personally abrasive or prone to starting/promulgating endless flame wars on internal mailing lists, then you have a tragic flaw which very well might cripple your career no matter where you go if you do not learn to cope. Or you can apply at Mozilla, which seems to collect at least the latter two categories. It is also possible to get pigeon-holed into doing the same thing forever. Sometimes pigeons just accept the hole they got shoved into and never try to leave. Sometimes pigeons get comfortable in their hole and then convince themselves that they've forgotten how to fly. Sometimes pigeons don't realize when they're being offered a new hole. Sometimes pigeons badly want to try different holes but then just crap all over the place when it happens. Sometimes there's really only the one hole, and the best a pigeon can hope for in it is to either dig out their own little ribbon-filled crevice or to get assigned to watch the other pigeons — or to fly away. Working at a "big name" isn't necessarily going to mean that the work is more interesting. It might mean that your work affects more people; on the other hand, it might also mean that you'll be more isolated from the people you affect. Or it might mean that you'll get stuck doing something completely unrelated to customers at all, just a cog in one monstrous machine — but that work might be incredibly interesting. It really depends on what motivates you. Academia is really a very different subject, but if you are interested in a doctorate in a theory-heavy area, I can tell you straight off that nobody will care about a reference you get from your boss at a web-design company, unless it's one hell of an interesting company.
|
# ? Jun 20, 2013 03:31 |
|
The Little Schemer is an awesome book to learn about recursion. Download Racket, get the book and if you've got the time you might get through it in two or three days. It's a small book focused at teaching one specific thing: recursion.
aerique fucked around with this message at 08:12 on Jun 20, 2013 |
# ? Jun 20, 2013 08:09 |
|
Pie Colony posted:I'm working at my (first) job and I have a lot of downtime, partially because it's not challenging so I get it done fast and wait on testers, partially because there's not a real trend of rushing projects/ticket at the company. Anyway, I'm using the downtime to try to learn a lot about programming/comp sci. I am reading textbooks on stuff like PLT, automata theory, database theory, artificial intelligence, blah blah and sometimes (but less often - primarily since I don't have a lot of ideas for interesting stuff) programming small-medium sized projects (eso lang interpreters, AIs, etc). Even if future jobs don't use those skills, and even if you're not that great at them, it still makes you look like a better candidate compared to those who don't. If you want more hands-on experience without sacrificing personal time, you could ask your company (if you don't get written approval and you build something valuable it might come back to bite you) if they mind you working on personal projects during downtime. They might interpret this request in a bad way of course, depending on the culture. Else, stay the course, or use personal time for it.
|
# ? Jun 20, 2013 16:48 |
|
Suspicious Dish posted:Recursion can be hard to understand. Let's break it down for you. Ok, I think I get it, so it's always just a bunch of 1's added up from the if number == 1 case? Thanks for the excellent explanation
|
# ? Jun 20, 2013 17:19 |
|
Well, you have to think about what everything expands to. Since fibbonacciRecursion(5) is so long to type, let's just use f(5) f(5) = f(4) + f(3) f(5) = f(4) + (f(2) + f(1)) f(5) = f(4) + (1 + 1) f(5) = (f(3) + f(2)) + (1 + 1) f(5) = ((f(2) + f(1)) + f(2)) + (1 + 1) f(5) = (((1 + 1) + 1) + (1 + 1)
|
# ? Jun 20, 2013 22:14 |
|
The Fibonacci case is a little bit complicated because you have the double recursive call. Instead let's look at the factorial function, which is a little simpler. I'm The standard implementation is a loop like so: code:
code:
|
# ? Jun 20, 2013 22:55 |
|
Just to nitpick but your factorial function isn't checking for a negative input.
|
# ? Jun 20, 2013 23:09 |
|
Hard NOP Life posted:Just to nitpick but your factorial function isn't checking for a negative input.
|
# ? Jun 20, 2013 23:38 |
|
Hard NOP Life posted:Just to nitpick but your factorial function isn't checking for a negative input. Pseudo-God posted:It's sufficient to explain the concept. There are many things the input does not check, such as whether it's a floating point, a string, or totally something else.
|
# ? Jun 20, 2013 23:41 |
|
Hard NOP Life posted:Just to nitpick but your factorial function isn't checking for a negative input. It's teaching code, not production code. Error checking gets in the way of illustrating the point.
|
# ? Jun 21, 2013 00:17 |
|
JawnV6 posted:Just how little faith are you putting into the type system?
|
# ? Jun 21, 2013 00:40 |
|
Right, but that's a method with a given type signature, you can't pass in a string or a floating point. The reading of the input is totally separate from the definition of the function. And while I appreciate that it's just an example, I think it's also important to show what can happen if you're not careful with a recursive function. Luckily this one will eventually wrap like Jawn said but other examples could lead to an infinite recursion.
|
# ? Jun 21, 2013 02:00 |
|
Infinite recursion and a stack overflow or a CPU spinning are okay failure cases. If you checked for negative input you'd just want to abort the process anyway. You aren't checking if the input value is greater than 12 either.
|
# ? Jun 21, 2013 05:06 |
|
An example of recursion which I prefer is finding the size of all the files underneath a specified directory. It's less abstract and the directory tree structure really lends itself to recursion. Finding the size of a file by itself is really easy because there's a built in function in whatever language you're using for that. In Java if you've got a File object that corresponds to a filesystem file then all you do is call file.length(). If it's not then it might be a special file which doesn't actually take up any space on the disk or it might be a directory. For a directory you just add up the sizes of everything inside of it. We could sit there and spell out again how to find the size of everything inside of that but we've already got how to do that written out. code:
To get an idea of how a computer really does this, it helps to get a chalkboard and a laptop. Start in a directory of your choice and then just start adding up the file sizes, using the leftmost part of the chalkboard as a scratchpad. When you run into a subdirectory, write down the name of where you are in the current directory so you don't lose track of your spot, draw a line to the right of where you've been keeping count and just start adding up the file sizes in that directory. Now start adding up the files in that directory doing the exact same thing. Whenever you hit another subdirectory, draw another line and repeat the process. When you actually finish a directory, take that tally and add it to the count to the left and then erase everything to the right of the line since you don't need it any more. Now just pick up where you left off in that directory until you hit the end of it and take its tally and add it to the count to the left and so on. When you've finished the directory all the way on the left, you're done.
|
# ? Jun 21, 2013 05:18 |
|
Just remember that in reality "directory size" can be a very nebulous concept. With file systems supporting sparse files, softlinks, hardlinks, network shares and even loops it can be dangerous to do something like calculating directory size.
|
# ? Jun 21, 2013 11:48 |
|
shrughes posted:Infinite recursion and a stack overflow or a CPU spinning are okay failure cases. If you checked for negative input you'd just want to abort the process anyway. You aren't checking if the input value is greater than 12 either. A stack overflow can be avoided in a lot of languages by reworking the code a bit to use tail call optimization. The mantra of "leave no work left to be done" is a good one to know if you are writing any recursive code. The factorial example given earlier is "bad" (no offense!) because it does all the work out the way out. This will overflow the stack with a sufficiently large input. code:
code:
----- Disclaimer: That is "browser code" that I didn't try to run. I think it conveys the general idea though. I am also being lazy and not checking my inputs.
|
# ? Jun 21, 2013 17:00 |
|
Earlier I actually considered posting, as a joke, that we give this new programmer who didn't understand recursion a lesson on tail call optimization, stack overflows, lamdba calculus, etc. Looks like it wouldn't have been a very good joke.
|
# ? Jun 21, 2013 20:52 |
|
armorer posted:A stack overflow can be avoided in a lot of languages by reworking the code a bit to use tail call optimization. The mantra of "leave no work left to be done" is a good one to know if you are writing any recursive code. You'd then just write iterative code, because in any language without explicit tail call syntax (seen in early versions or proposals of Java, and SysRPL of all things), relying on the compiler to do tail call optimization or the runtime to tail call eliminate is an act that introduces fragility into your system. shrughes fucked around with this message at 21:29 on Jun 21, 2013 |
# ? Jun 21, 2013 21:27 |
|
Bunny Cuddlin posted:Earlier I actually considered posting, as a joke, that we give this new programmer who didn't understand recursion a lesson on tail call optimization, stack overflows, lamdba calculus, etc. Looks like it wouldn't have been a very good joke. Tail call optimization isn't very complicated, and if you are just learning recursion it's good to learn it so you don't get into bad habits. And as for relying on it: If you are writing recursive code in a language that supports it, and the solution allows for it, then do it. It is that easy. If you are writing recursive code in a language that doesn't support it, then you should think really hard about whether or not there is a better solution.
|
# ? Jun 21, 2013 21:57 |
|
This might be more of a system admin question than a VB question but I think this is an appropriate place to ask- I have a VB script that copies files and pushes them out to computers on the network, but the files on the destination machine don't seem to retain the original's permissions... All machines involved are Windows 7. Anyone have a quick guess as to why this might be?
|
# ? Jun 21, 2013 22:11 |
|
How insanely difficult (or not) would it be to program a robot to move around predefined space to predefined points autonomously? We're doing a side project at work to have something happen when someone breaks a build, I think it would be cool to have some sort of "robot" drive around the office to said persons office and... do something. I have never done anything remotely like this before so I don't even know where to look or how feasible it is. I realise it would probably take a long time to get it working.
|
# ? Jun 21, 2013 22:15 |
|
It's perfectly feasible; there are many different approaches that can work well for that sort of thing. It's going to be a lot of work and learning if you've never done anything with robotics before, though.
|
# ? Jun 22, 2013 00:16 |
|
Brady posted:This might be more of a system admin question than a VB question but I think this is an appropriate place to ask- Not sure it's changed in Win7, but generally in Windows the files will inherit the permission of their parent object (i.e., the containing folder at the destination) when copied or moved, unless the move occurs on the same volume, in which case they will retain the original permissions. If you're just calling copy or something to do the copying, trying using xcopy instead; you can use the /o switch to copy the DACL and the /x switch to copy the SACL (which also includes the DACL).
|
# ? Jun 22, 2013 23:16 |
|
Anyone do a lot with R? I need a graphics package that will allow me to annotate a 3-d graph of a function, with annotations at specific parts of the graph. My ideal would be a line coming off the graph at say a maximum point, to a text box that goes into more detail about the function at that point (might be asking too much for R). If there's nothing like that then I can just create that visual in a different program, but I'd like something I adjust and play around with and still get the correct info on there.
|
# ? Jun 23, 2013 15:46 |
|
Not sure if this is the best place for this but here goes... I have a camera that only has linux\windows usb driver support for x86. I want to use it with an ARM board like a beagleboard. Would it be realistic to run something like qemu to get it working? beagle -> ARM linux -> qemu -> x86 linux -> camera driver?
|
# ? Jun 23, 2013 20:57 |
|
Hoops posted:Anyone do a lot with R? I need a graphics package that will allow me to annotate a 3-d graph of a function, with annotations at specific parts of the graph. My ideal would be a line coming off the graph at say a maximum point, to a text box that goes into more detail about the function at that point (might be asking too much for R). You might ask the scientific programming megathread.
|
# ? Jun 23, 2013 21:15 |
|
Are there any programming certifications worth getting? Japan loves certifications.
|
# ? Jun 25, 2013 23:02 |
|
Yeah the Java ones
|
# ? Jun 25, 2013 23:29 |
IIS Question: Say I have two different web services, one at c:\apples, one at c:\bananas, and I want to have them both accessible from the same port. So typing apples.company.com into a web browser will pull up the apples service and the same with bananas and the bananas service. Can I do this without assigning multiple ports? How about multiple sites? What If I have one site at c:\fruit and need apples.company.com to point to c:\fruit\apples and bananas.company.com to point to c:\fruit\bananas? Maybe there's a better thread to ask this in?
|
|
# ? Jun 26, 2013 20:22 |
|
You'd probably do better in the webhosting megathread in sh/sc (http://forums.somethingawful.com/showthread.php?threadid=3289126) The feature you are talking about is usually called vhosts . I don't know how it works in IIS
|
# ? Jun 26, 2013 20:28 |
|
I have a noisy data set. I want to smooth it out. I started analytically and it was a mess of effects that I don't want to dig into so I took a bunch of readings and want to extract a smooth curve out of that. Averaging around each integer is still fairly noisy, what sort of algorithms or techniques should I look into?
|
# ? Jun 26, 2013 23:08 |
Is the data organised around a physical axis, e.g. time or space? If so you can use a simple gaussian kernel, like those used in image processing. (By gaussian kernel I mean a normal distribution function with rho chosen depending on how much smoothing you want.) If your time (or distance) axis is on a discrete scale you can pre-calculate a series of coefficients to use in a weighted moving average. If the axis is continuous, you will have to calculate the coefficient for each data point for every point. Also, if your data is not evenly distributed across the axis (distance between points varies), keep in mind you should probably be working with the distance and not the count of points to participate in each averaged point. Oh yeah, and don't have every point participate in the average, limit it to a window unless you have plenty of time.
|
|
# ? Jun 26, 2013 23:26 |
|
JawnV6 posted:I have a noisy data set. I want to smooth it out. I started analytically and it was a mess of effects that I don't want to dig into so I took a bunch of readings and want to extract a smooth curve out of that. Averaging around each integer is still fairly noisy, what sort of algorithms or techniques should I look into? A simple recursive low-pass filter, like an exponential average, is very quick to implement. If that doesn't do the job you want, you can look at something like a windowed sinc.
|
# ? Jun 27, 2013 00:30 |
|
Otto Skorzeny posted:A simple recursive low-pass filter, like an exponential average, is very quick to implement. Worked for me. Thanks!
|
# ? Jun 27, 2013 21:58 |
|
It has been awhile since I made a windows GUI app. Is WPF the way to go, or is there a newer hotness? I will be using C#.
|
# ? Jun 28, 2013 17:15 |
|
I think WinRT is technically the newest hotness (sort of), but it can use the same XAML that a regular WPF app can. That said, you should probably go with WPF which is going to be more widely supported right now. You should also look up the (in my opinion terribly named) MVVM model because it actually does make WPF a lot easier to work with.
|
# ? Jun 28, 2013 19:57 |
|
|
# ? May 30, 2024 10:11 |
|
Thanks. WinRT looks a bit too new and hot for me (only Windows 8 AFAICT), so WPF it is.
|
# ? Jun 28, 2013 20:40 |