Thursday, April 26, 2012

Assignment 4 DataDriven

See I said I would get it done on time this time around! Anyways, this took a lot longer than the other assignments, but I understand the concept I think. Shove instructions into a queue and then have a generic processing function take out the instructions. I ended up learning a lot about some of the underlying stuff for c#. I have worked with it before, but I don't I have ever understood too well till now. namespaces are nifty little things I dare say. Also that all structs are actually derived from a single type called Object. That's kind of really freaking cool. So yeah, for the most part. The test code that I used is the exact same as the test code given to us. That is... till I got to the interleaved part. I was pretty confused on how the code was written, it didn't make a lot of sense to me. So I simplified it in my eyes at least. It does the same thing though. I only have 1 queue instead of 3 and it is a queue of Objects. I just enqueue all the data as it is and then during processing I just check what type it is, Calc_Data or FSM_Data, and then typecast the Object Data and then doWork() on it. I honestly think it is pretty convenient, though I don't think you can do it like that in any other language since it abuses the all structs are Objects thing. Or maybe I'm wrong about that? Who knows, I'll get to it as it comes. I don't know how efficient it is though because of the getType() calls, so that might be an issue if there was a lot of it. I guess the other way would be to enqueue the two different types into their own queues, then have the interleaved q as a kind of marker q for the order that the stuff was put in and then during process you could just dequeue the interleaved q check what what type it was, then from that, dequeue the correct other queue. Though I think the dequeue calls would also be expensive so I dunno. Pondering. OH well. I got it working so I'm with this for right now.

Saturday, April 21, 2012

Assignment 3

Sooooo not gonna lie. I am late on this assignment because I derped hard and procrastinated... I hate myself sometimes because this was way easier than I thought it was going to be. I had missed class for the third lecture so I had to watch it to see what to do, but I freaked out because when I looked at the base code (which was practically nothing) I didn't know what to do. OF COURSE though, I didn't finish the whole lecture till this morning and then saw that you went over example code. I felt really stupid. So yeah, I copy pasted the code so that I could connect with myself (I only have one personal computer so yeah) and got the two programs to recognize each other. Once I had that done I started on just trying to send data across and got that working. Then I realized that the server didn't know how many elements were in the list and that data was not stored on the client side either so I made a loop to count it. But then I realized while writing this that there is probably a function that does that. OH LOOK THERE IS. So I fixed that just now. Anyways, I then made loops to send and recieve the info as individual packets. This was a bit confusing until I realized that I had one of my pointers pointing to the wrong int so I was filling my whole list with list size. But I fixed that and then it worked. Then I found that there was a sort function so I used that on a list that I made one the server side and then sent it back and it did everything that I wanted it to do. Success! So yeah, the only reason I'm late is because of my own self-machinations of laziness. I'll make sure this doesn't happen again. Thank god for slack days.

Monday, April 16, 2012

Assignment 2 Update

Yo, I just remembered about this. Darn it.


Anyways, I didn't have too many problems with this assignment at all. Turns out that I basically had done this before, albeit a little bit bigger in computer systems II, so figuring out how to do this stuff was pretty easy. I also had known about data alignment for a while because of a digital electronics class that I took so that was helpful too.

I did have some issues with Bird simply because I was being silly about the pointers, but then I figured it out. It's complicated, but not at the same time.

Outside of that, it was really easy for me. Don't know what else to say.