Wednesday, October 30, 2013

Robotics - Infrared Sensor

While some other people tried to get the other conveyor belt on (without enough links), I tried to correct the lack of sensitivity on the controls. Since the joystick puts in values up to 128, but the motors take values up to 100, I figured that it could be more sensitive if I scale the inputs instead of clamping them. That took quite a while to get right. At first, the scale function produced zero for a negative input. I fixed that by changing some of the variables to floats. Then, it was insanely more sensitive going forward than backward. That was fixed by compacting the function to one line. Finally, the scale function produced positive outputs even from negative inputs. Evidently, I didn't think that the nature of division would keep the sign and had added an inverter factor; removing that part made it work correctly. We then started to investigate the infrared sensor, which will be useful during the autonomous period. It's been attached (somewhat) and I have begun reading white papers on how to properly address it in code.

Monday, October 28, 2013

Robotics - Conveyors

Though we're short a few of those little plastic links, the robotics team has constructed and attached both conveyor belts to the robot. I created the team's ninth test program to implement them in code. They work very well except for the fact that the teeth (necessary to hold onto the blocks) get stuck between the conveyor, which is too low, and the ground. In other news, I did successfully fix the strange wheel-activating bug. Evidently, it really is necessary to access the variable of the "joystick" object, not just the stray variables created in JoystickDriver.c. With the wheels working again, we tested my simple arcade drive and found out that it really does not make any sense. For one thing, left and right are reversed when going backwards. For another, it does not stop when the analog sticks are released.

Sunday, October 27, 2013

Robotics - Issues

Yesterday morning, we had a robotics meeting. Unfortunately, since it started at 8:00 AM, there were very few people there. In fact, there were only three people from my team, myself included. We almost immediately ran into issues with the controller, despite having fixed it last time. At first, the motors were activating without any controller input, but then they stopped activating at all. It took most of the meeting to determine that I had crossed some uninsulated wires, causing the fuse to blow. However, when it blew, it did not do it successfully, allowing just a little bit of electricity to arc over. We're not sure what caused the motors to activate, but we're pretty sure a new fuse will fix the problem. In other news, a failed firmware download rendered the NXT unusable. I did find a way to fix it on the Internet, which I will perform tomorrow.

Friday, October 25, 2013

Logofrag - Thread View

After an insane amount of coding, I believe I have finished the basic thread view. I'm not actually sure how well it displays the frags (since I have not yet made a page to add them), but it does correctly create the thread information section and judge the capabilities of the user. Before creating the detail view page, I'm going to do the frag-adding one. I also fixed the CSS, finally making the margins make sense.

Thursday, October 24, 2013

Robotics - Fixed Everything

Today was an extremely productive meeting day of the robotics team! It started with three members, myself included, walking down to a nearby hardware store to purchase some string. Once everyone arrived, we started fiddling with some gears on the robot in preparation for allowing the conveyor belt to be swung around. While that happened, I did more research on using controllers through a laptop. After a few more attempts at actually running it (some of them failing due to not turning on the battery pack), it succeeded! Controllers hooked up through the RobotC dev environment could control the robot's motors! The problem was that I had not opened the Joystick Control window, which is essential for relaying the instructions. After calming down from that accomplishment, we then noticed that only one of the motor control switches was receiving power. It did not take long, upon inspection, to notice that we had actually not connected the battery to the secondary switch. Once that was done, the controller could also run the conveyor belt! Still having the better part of an hour left, the team's captain wanted to try to install the Samantha module (a device for connecting controllers to the NXT wirelessly). After scrounging a flash drive and a few short cables, the Samantha module was configured and communicating with the Cisco router on my development desk. Apparently, last year's team had never managed to correctly install the Samantha module, so they were very excited that it worked perfectly. The last few minutes of the meeting were used to show off our immense progress to the other team in the building.

Wednesday, October 23, 2013

Robotics - Infuriating Controllers

The robotics team finally found the charger for the battery pack, so we used today's meeting to test my controller-operated mobility code. The first few tries failed due to the battery being wired incorrectly (backwards). After that, the wheels started spinning despite not having been activated by the controller. That went on for another few tries until I did some checking with the debug window and discovered that the X/Y roller things had small non-zero even when at rest. To fix that, I added an epsilon function that would return zero if the input was too insignificant. While continuing to check out the controller debug window, I found that the buttons were not mapped how I thought. It took about 20 minutes to determine that the controller was in Xbox mode, not desktop mode. Once that was fixed, the rest of the meeting was comprised of my being very upset at the robot inexplicably continuing to activate motors without my consent.

Tuesday, October 22, 2013

VB .NET - Lambdas

I have recently discovered that lambdas are amazing things. They take a little bit of getting used to, but once mastered, correct use of them will save programmer time and increase program efficiency. A lambda, essentially, is a function or subroutine written in one line that can be passed as an argument, usually in a LINQ method. When a method expects an argument of type Func or Sub (like IEnumerable.ForEach), it's time for a lambda. Start a lambda by writing Function or Sub and an argument in parentheses without type - the object that's going to be put in as the input of the lambda method. Then, simply write the return value. The simplest lambda is the identity lambda: Function(n) n. It takes in object n and returns it. For a Sub, you obviously won't have a return value, so just write what action it performs. Sub(n) MsgBox(n.ToString) accepts object n and writes its string representation in a message box. If you are using more complicated methods, use an AddressOf pointer to indicate that you want to pass the objects through a declared method.

Monday, October 21, 2013

Robotics - Conveyor Chain

LEGO is amazingly fast at shipping components. The conveyor belt kit my robotics team ordered on Thursday arrived today. It's made up of a lot of snap-in links that are designed to accept plastic "teeth" at appropriate intervals. These things are exceedingly difficult to snap in, so it took the entire team about an hour to finish creating the chain. While the build team applied the belt to the gears, I created a much better Robot-C program to support movement from controllers.

Sunday, October 20, 2013

Windows 8.1

If you haven't already heard, Windows 8.1 is out! If you already have Windows 8, you can get it for free from Microsoft in the Windows Store. The upgrade leaves files and user settings alone, so there's nothing to worry about. Installation was exceedingly simple; all I had to do was press the download button and it started going to town. After about half an hour, my computer rebooted and spent another half hour in the BIOS doing all manner of interesting things. Then I encountered a problem. It froze at "Getting devices ready". However, unplugging my USB devices for a few seconds fixed the problem. The rest of the installation went smoothly. It was fun getting to do some of the initial set-up again. I can't really see any differences besides the Start button, a different metro background, and that "Computer" in File Explorer was changed to "This PC".

Wednesday, October 16, 2013

Robotics - Development Time

I might have already written a little about this somewhere but I figured I'd give a more detailed account.

My school has two FTC robotics teams this year. I've been assigned to the veteran team despite being a rookie - apparently expectations are high. For the past month, we've been considering options for the robot's design and creating some basic structure. Basically, every year in FTC, there's a different arena in which the robot needs to perform tasks. This year, the main thing is pushing blocks around and putting them into containers. I'm not that great of an engineer, but I have already started understanding how to program in RobotC, the C-like language designed for the NXT module. So far, I've created three test programs to try out the API and get used to the limitations. As soon as we get a battery charger, I'll be able to prepare some mobility programming.

Tuesday, October 15, 2013

Advanced Programming with Twisted Oak Studios

Twisted Oak Studios is a game development consultation firm that also does all manner of other high-level and complicated programming things that I do not understand. Over the past few weeks, I've read every blog article they've ever published. I've learned a lot, especially about functional programming ideas. I highly recommend that you read all the articles on their blog.

Sunday, October 13, 2013

Logofrag - XSS Alert Page

One of the critical functions of Logofrag is viewing threads. So, I started actually writing the code-behind to render the thread page today. Since I remembered that I was going to display a warning if angle brackets or ampersands were allowed in fragments (because possible XSS vulnerability), that was the first thing I implemented. There is now a very nice alert when accessing such a thread.

Saturday, October 12, 2013

Explaining DVD Region

Everyone knows that DRM (Digital Rights Management) is a real pain. One of the artifacts of this is DVD regions. One might see error messages about these when you put a disc in a player and see an error message that disallows the disc to play. As I understand it, certain discs are intended to be played only in certain parts of the world, probably because other countries have different copyright laws than the producer. DVD players are probably legally required to make overriding this difficult, so changing the playing region is often a very technical thing to do. In fact, a lot of players limit the amount of times their playing region can be changes. Fortunately, all Windows computers that have DVD support expose an API element for switching the region.

Friday, October 11, 2013

CSS-Only Hover Menu

I was thinking about using mouseover information boxes on Logofrag fragments, similar to RES does for usernames. After some searching, I came up with an article called "Creating a pure CSS drop-down menu" that wonderfully explains how this can work without any sort of JavaScript. Unfortunately, it requires that all the mouseover text be sent to the client to render the web page in the first place.

Sunday, October 6, 2013

Essay: Classifying Programming Languages

I wrote a classification essay for writing class entitled Classifying Programming Languages.  It's in MLA format; signal phrases are used because the teacher said so.  Download (DOCX), 15KB.

Wednesday, October 2, 2013

Logofrag - Fixed the Session

As I predicted, work on Logofrag is going along very slowly (something to do with schoolwork being so time-consuming and Etho being so entertaining).  I did some reading of the MSDN ASP.NET docs and discovered that, unlike Request.QueryString, Session items are Nothing by default.  I had been doing all kinds of stuff to see if it existed, make sure it was an integer, and parse it appropriately.  That was useless because I could just shove an Int32 into it and then retrieve that exact same value later.  So, I went through the small codebase and removed the string-parsing logic from accesses to the logged-in user ID.  Progress!