|
graffin posted:I am starting my first software development job in about a month and a half, and I want to get a good understanding of the software development life cycle. Are there any good books on this subject?
|
# ? Nov 21, 2008 15:13 |
|
|
# ? May 16, 2024 18:22 |
|
TSDK posted:Steve McConnell's Code Complete. Thanks. I have heard from many sources that this book is one of the best books to read as a developer.
|
# ? Nov 21, 2008 15:48 |
|
graffin posted:Thanks. I have heard from many sources that this book is one of the best books to read as a developer. As it sounds like you've not held a development position before... If you're working for a medium to large sized company, you will likely have zero input on their development practices as an extra junior developer. There will be exceptions, and you can use best practices for many things - but the overarching cycle is probably not in your hands.
|
# ? Nov 21, 2008 16:00 |
|
quadreb posted:As it sounds like you've not held a development position before... Thanks. I'm just looking to learn. Since I'm not even a CS major, I am not looking to revamp their practices. I just want a general idea of software development, so I can walk in there with all the CS people and not sound like an idiot.
|
# ? Nov 21, 2008 16:20 |
|
Turkmenbashi posted:No, I should be able to implement that. Thanks! Think in vectors, my friend, for that is the path to true Matlab enlightenment. a = zeros(8,3) a(:,3) = (mod((0:1:7),2)>0) % does 1's column a(:,2) = (mod((0:1:7),4)>1) % does 2's column a(:,1) = (mod((0:1:7),8)>3) % does 4's column I'm sure this could be refined if you didn't want modular arithmetic, but I believe this will be faster than looping it. Oh, and it leaves your table upside-down, but if that's a problem change it to be 7:-1:0, as such: a = zeros(8,3) a(:,3) = (mod((7:-1:0),2)>0) % does 1's column a(:,2) = (mod((7:-1:0),4)>1) % does 2's column a(:,1) = (mod((7:-1:0),8)>3) % does 4's column Which'll give you your requested table. edit: here is the first option for n columns: a = zeros(2^n,n); for i = 1:n a(:,(n+1-i)) = (mod((0:1:2^n-1),2^i)>2^(i-1)-1); end PROTIP: Don't set n>31 unless you've saved your work and hate matlab. Don't expect n=31 to work because matlab will tell you to get more memory. Don't expect n>16 to be quick to generate even the zero matrix - n=24 took like 30 seconds to produce the zero matrix alone. I don't know where the limits for this is. Nam Taf fucked around with this message at 08:37 on Nov 24, 2008 |
# ? Nov 24, 2008 08:16 |
|
Here's a little question for all you y'all. I'm doing a data structures assignment for school and I have to implement a system of two main roads that have roads crossing them. I also have to implement the shortest path search from town 1 to town 2. Here's an example: I've implemented this in Python. Here's how the path search algorithm works: I keep two shortest paths, left_path and right_path. They both start out as empty lists. I also keep left_price and right_price, which both start out as 0. And then, I see what the shortest path from the start to the next left node is. In the start, that could either be to take the left road directly (incur a cost of 10) or to take to right road and then cross over, which would incure a cost of 80. Obviously it's better to take the direct road. So new_left_price is now left_price + 10 and new_left_path is ['a']. Then I see what the shortest path to the next right node would be. Obviously, it's better to take the 10 road and then cross over for 30 instead of going over the road that costs 50. So new_right_price now becomes left_price + 10 + 30 and new_right_path becomes left_path + 'a' + 'r'. And this goes on for all the sections until I reach the end and then I just see which of the two possible paths is cheaper. It works, but I think this is O(n2). If I was just reporting the shortest path cost, it would be O(n), but the thing is that I have to make copies of the left_path and right_path lists because at any moment the right path can become the left path plus something. This problem could be easily avoided if I were using a purely functional language because with laziness and referential transparency you basically get persistence for free, but my assistant prof told be I can't do it in Haskell because he doesn't know wtf about Haskell. So, does anyone have any hints or suggestions for making this something better than O(n2)? hey mom its 420 fucked around with this message at 12:31 on Nov 24, 2008 |
# ? Nov 24, 2008 12:11 |
|
I like your pictures. That is all.
|
# ? Nov 24, 2008 12:42 |
|
Bonus posted:Here's a little question for all you y'all. I'm doing a data structures assignment for school and I have to implement a system of two main roads that have roads crossing them. I also have to implement the shortest path search from town 1 to town 2. Here's an example: Have you covered graphs yet? Implement the map as a graph, with one vertex per intersection, and an edge between any two connected intersections. You can then do a shortest path search by doing a breadth-first-search on the graph, sorting edges by their cost (I think you could do this by using a priority queue to keep track of which vertex to visit next, instead of a normal queue). The first path that arrives at the destination is the shortest. I'm just learning this stuff myself, so don't take my word for it, but I think it should work.
|
# ? Nov 24, 2008 14:58 |
|
Bonus posted:So, does anyone have any hints or suggestions for making this something better than O(n2)? You can create immutable data structures in non-functional languages. The language might not guarantee that it's immutable, but it's easy enough to just. not. mutate it. Also, it doesn't change the asymptotic complexity, but in your restricted setting there's a pretty obvious encoding for paths requiring only N-1 bits (where N is the length in segments of the main roads). PT6A: the problem setup is more restricted than the general problem over graphs, so it's worth considering whether we can improve over the general case. In this case, of course, the answer is "not really", although we should get better constant factors.
|
# ? Nov 24, 2008 15:44 |
|
Bonus posted:Here's a little question for all you y'all. I'm doing a data structures assignment for school and I have to implement a system of two main roads that have roads crossing them. I also have to implement the shortest path search from town 1 to town 2. Here's an example: http://en.wikipedia.org/wiki/Dijkstra's_algorithm This one works well if you dont have negative edge cycles. Use heap or some similar data structure for extracting minimum path from list of already covered vertices, and you can achieve logarithmic time. (wiki says its (|E|+|V|) log |V| )
|
# ? Nov 24, 2008 18:33 |
|
So I'm on RHEL4 and using gcc to compile. I want to link against a shared library using the command line option -lname but there's no libname.so file in my library path. That's because I'm building -m32 on a 64 bit platform. So there is a /usr/lib64/libname.so, but no /usr/lib/libname.so. However there is a /usr/lib/libname.so.1, I just need to make a symbolic link to it by the name libname.so and that solves my problem. The question is, why do none of the 32 bit .so files on my machine have these symbolic links setup, but the 64 bit .so files do? I'm guessing that's just the default since the machine is 64 bit. In the future is there a way to install things with (with rpm I suppose) such that the symlinks are setup for both 32 bit and 64 bit libaries, and is there a way now to quickly setup all the symlinks in places like /usr/lib, /usr/X11R6/lib, ... or do I just have to do it manually (ie: write some script to do it in batch, and manually execute that script on every machine I want to compile on)?
|
# ? Nov 24, 2008 22:03 |
|
Lexical Unit posted:
Doesn't appear to be the case on 64-bit RHEL5/em64t or 64-bit SLES9/ppc64(I don't have a 64-bit RHEL4 running unfortunately). Net, I believe the symlinks should be there for a _typical_ library. Do you have symlinks for zlib or expat?
|
# ? Nov 25, 2008 02:26 |
|
Ah that may be it. The library in question was Boost.Regex, not too far out there, but not _typical_ either. Could be a misconfigured boost installation is the problem. I was just wondering if maybe not having .so symlinks for off-architecture libs was standard operating procedure and I was ignorant of that, I guess not.
|
# ? Nov 25, 2008 14:48 |
|
rjmccall posted:You can create immutable data structures in non-functional languages. The language might not guarantee that it's immutable, but it's easy enough to just. not. mutate it. I implemented the search with Dijkstra by using the algorithm description from Wikipedia. It works, only the constant factor is much bigger than the one in my own algorithm and it's still O(n^2) because I didn't use a priority queue to store the unoptimized vertices but a normal list. Because I'm a bit confused when it comes to using a priority queue to store the unoptimized vertices. Here's the pseudocode from Wikipedia: code:
I did that with my own binary heap implementation, which takes a projection function, so I do something like heap.push(Q, vertex, key=lambda x:dist[x]) and u = heap.pop(Q, key=lambda x:dist[x]) hey mom its 420 fucked around with this message at 16:03 on Nov 25, 2008 |
# ? Nov 25, 2008 15:33 |
|
Bonus posted:If I use a binary heap for Q, I put them in by their distance from the source. That's all cool, but when relaxing (u,v), the distance for a vertice is changed and then suddenly the binary heap doesn't satisfy the heap property. If I rebuild the heap after relaxing (u,v), well that increases the complexity so much that it doesn't make sense to use a heap at all. No need to rebuild the heap; just remove (u, old_dist) and insert (u, new_dist), both of which are lg n operations.
|
# ? Nov 25, 2008 16:27 |
|
Uh, wait, but I'm supposed to modify the distence of v, not u. u is the priority element and modifying it is log n, but I'm supposed to modify v, which is the neighbour of the priority element and I don't know where that element is in the priority queue.
|
# ? Nov 25, 2008 17:11 |
|
Bonus posted:Uh, wait, but I'm supposed to modify the distence of v, not u. u is the priority element and modifying it is log n, but I'm supposed to modify v, which is the neighbour of the priority element and I don't know where that element is in the priority queue. Oh, right. Actually, it suffices to exchange the changed element with its parent while necessary. That's log(n) and preserves the heap property. I guess you'd also have to store per-node info as to where it is in the heap (and update it). Hmm.
|
# ? Nov 25, 2008 17:47 |
|
Haha, nevermind, I actually managed to make a solution in O(n) time. Can someone confirm that this is O(n)?code:
EDIT: I timed this, and it's a massive speed improvement over the previous version and the time looks like it's linear. w00t! hey mom its 420 fucked around with this message at 18:56 on Nov 25, 2008 |
# ? Nov 25, 2008 18:36 |
|
floWenoL posted:Oh, right. Actually, it suffices to exchange the changed element with its parent while necessary. That's log(n) and preserves the heap property. I guess you'd also have to store per-node info as to where it is in the heap (and update it). Hmm. The remove/add thing does work; Java code below. However .. O(n) solution is more awesome. code:
|
# ? Nov 25, 2008 19:11 |
|
Bonus posted:Well that's what I'm doing here, instead of mutating the list with the path, I'm copying it. It's just that when you have a lazy language, you usually get persistence for free, so you don't incur time penalties for making a copy. But that's what I mean. In a functional language, you would use a data structure that doesn't require a copy, and you can use that exact same data structure in Python. My Python might be rusty, but: code:
rjmccall fucked around with this message at 23:38 on Nov 25, 2008 |
# ? Nov 25, 2008 23:34 |
|
I need some help figuring out an algorithm for multiplying IEEE-compliant single floating points with only using an integer multiplication and in either binary or hexadecimal. The only part I'm able to figure out so far is what to do with the exponent and the sign. It's not a straight up multiplication, but I'm not sure what it is: Look at these mantissas: code:
I don't want to ruin my entire Thanksgiving because of this.
|
# ? Nov 27, 2008 19:11 |
|
It should just be a straight multiplication, but don't forget that the single precision format is normalised so that there's an implicit '1' at the front, and you'll need to shift the result appropriately back into normal form once you're done. EDIT: You can do the multiplication in calc.exe: code:
TSDK fucked around with this message at 19:43 on Nov 27, 2008 |
# ? Nov 27, 2008 19:34 |
|
Is that it? I feel kinda dumb now. Thanks. :P
|
# ? Nov 27, 2008 20:24 |
|
Been working on a batch file to automatically svn a file and ftp it. I have in the batch file so far: code:
code:
I was gonna use Filezilla for the uploading rather than the regular windows ftp, but it seems that only supports connecting and not uploading from command line.
|
# ? Nov 30, 2008 22:53 |
|
Why not just make an SVN hook to FTP it wherever it needs to go?
|
# ? Nov 30, 2008 23:41 |
|
Avenging Dentist posted:Why not just make an SVN hook to FTP it wherever it needs to go? Because that's far too logical and I don't know how to do that. But yeah, I'll look it up.
|
# ? Dec 1, 2008 00:08 |
|
I'm having a bit of trouble with debugging C++ and 0x86 assembly code together. For some reason, in Visual Studio C++ 2008 Express Version Latte with Sprinkles edition, if I press start debugging, it skips the the C++ part of the program and skips to debugging the ASM file. Here's the C++ code: code:
Any help is appreciated. EDIT: Input and output streams are being skipped. Sorry for not mentioning that. ndb fucked around with this message at 05:09 on Dec 1, 2008 |
# ? Dec 1, 2008 00:13 |
|
Why are you assigning the return value of FpMult (an int) to the string product? Why are you then immediately overwriting product with whatever cin reads in? Why does a function named FpMult() return an int? How exactly do you write a floating point number in hex?
|
# ? Dec 1, 2008 02:21 |
|
Both of those were the result of being sleep-deprived while programming. Thanks for catching them.code:
|
# ? Dec 1, 2008 03:02 |
|
Clock Explosion posted:Both of those were the result of being sleep-deprived while programming. Thanks for catching them. You might want to put in some newlines after your output. Also you have the logic for "y/n" screwed up. I made a test function for FpMult and everything works fine. So I'm going to go out on a limb and guess that you're treating the strings as char*s in your assembly code. That's not going to work.
|
# ? Dec 1, 2008 04:34 |
|
Avenging Dentist posted:You might want to put in some newlines after your output. Also you have the logic for "y/n" screwed up. But would that really cause the debugger to totally bypass the input streams in the C++ file? I have a feeling you're probably right about the char*, but I at least want to input some value in to see whether or not it works first. EDIT: Input and Output. ndb fucked around with this message at 05:08 on Dec 1, 2008 |
# ? Dec 1, 2008 04:55 |
|
Clock Explosion posted:But would that really cause the debugger to totally bypass the input streams in the C++ file? You are probably looking at the internal std::string data and not the raw char* and thus it looks like crap.
|
# ? Dec 1, 2008 05:00 |
|
Changing the code to this (probably not correct...I've never worked with C-style strings that much)...code:
PSUEDO-EDIT: That was probably a useful bit of information that was missing, the fact it's skipping the output stream as well.
|
# ? Dec 1, 2008 05:08 |
|
Let's say I have a process that needs to be initialized (new Org::Process;) and it handles the import of various files. But the nature of the import is that it takes a non-trivial amount of time and has side effects (10-20 minutes, bcp'ing). How should the interface for this be written? Or, what do you think? A) Org::Process->importFile( $file ) takes a file and immediately imports it. B) Org::Process->addFile( $file ) takes a file and defers its import to some later time when Org::Process->importFiles is called.
|
# ? Dec 1, 2008 20:37 |
|
It would seem that B) consists of enqueuing $files as they are given to you by the "user" and then doing Org::Process->importFile( $file ) as you de-queue them. But the "user" has already constructed their own (possibly informal) queue when they collected the $files they gave to you. If you can add more value than that, then it might make sense to create B), but even in that case it doesn't seem like it would make a lot of sense to hide A) from the "user"
|
# ? Dec 1, 2008 21:19 |
|
You should probably do both, that is have a class that does A) and another class that does B) using A) to do it. Always one task per class.
|
# ? Dec 1, 2008 21:53 |
|
Zombywuf posted:You should probably do both, that is have a class that does A) and another class that does B) using A) to do it. Always one task per class. Edit: Nevermind, I misunderstood the question. floWenoL fucked around with this message at 22:59 on Dec 1, 2008 |
# ? Dec 1, 2008 22:32 |
|
floWenoL posted:In particular, the most parsimonious way to do this would be to use a producer-consumer queue with a threadpool. If you need strict FIFO behavior, then you simply have 1 thread in your threadpool. Ok, before involving threads and poo poo, step back and think about what you NEED. Yes, this function will take a while to run could fail in the middle for a variety of outside reasons. Does this matter? Is this to be run from a command-line utility? If so, just copy each file as it's given to you, abort with an error code (or throw an exception) if it fails, and die with an error message if any of them happen. Is this to be run from a GUI that needs to not freeze while the copy is happening? If so, you're going to need to use a thread (or fork off a subprocess) to do the copying. Now decide how much error handling you need (if you can pop open a progress bar, you just need "still going" or "it failed", otherwise you have to worry about the user triggering other actions while your file copy is going on in the background.) But there's no point in trying to design a complex threaded architecture to handle every possible case if you're not going to need it.
|
# ? Dec 1, 2008 22:47 |
|
JoeNotCharles posted:But there's no point in trying to design a complex threaded architecture to handle every possible case if you're not going to need it. Yeah, you're right; I misinterpreted B to be an asynchronous version of A.
|
# ? Dec 1, 2008 22:59 |
|
|
# ? May 16, 2024 18:22 |
|
This is really pissing me off and I'm sure it's something stupid. For some reason, $_POST isn't populating.code:
code:
Edit: php 5.2 and apache 2.0.61 Gilgamesh fucked around with this message at 18:14 on Dec 3, 2008 |
# ? Dec 3, 2008 18:09 |