Wednesday, February 23, 2011

Chapter 7 Exercises

The chapter 7 exercises kind of tied in with some of the things I had been learning in operating systems so I was excited to combine the two together to do these assignments.  


7.2.2: For this exercise, I had to create hello.c.punct and hello.c and you use the unix diff -U command to test the output. With the -U the diff command output is...


--- hello.c.punct       2011-02-23 13:48:18.000000000 -0500
+++ hello.c     2011-02-23 13:50:01.000000000 -0500
@@ -5,6 +5,6 @@
 #include <stdio.h>
 int main() {
-    printf("Hello, World.\n");
+    printf("Hello, World!\n");
     return 0;
 }
while the output without the -U looks something like this:
8c8
<     printf("Hello, World.\n");
---
>     printf("Hello, World!\n");

7.8: The next assignment was to create a file  that represents a new file, foo being created with the contents bar. So first I needed to copy the original bar files into bar.c.original and then edit bar.c. to contain the new patch information. The I used the command $ diff -u bar.orig.c bar > foo.patch which created a patch file with the contents of bar.

7.9: This assignment was to patch the echo command from the coreutils project so that it echoes out arguments in reverse order. Although this assignment was not hard since there is a walkthrough in the TOS book I still took my time  and read the directions very carefully. After I download the necessary files, it was time to edit echo.c. After making a copy of echo.c, I went and edited the statements that needed to be fix and created the patch. Of course after making the patch I had to test it and it worked!!!. I felt so accomplished.

Tuesday, February 22, 2011

Finding a needle in a haystack

Implementing a fix for our bug doesn't seem like it would be to hard but first we just had to located where to implement our fix. After searching tons of .java,.js, and .jsp files. I finally came across two files that might help with shortPatientForm.jsp contained the code that deal with prefered identifiers so this was probably the best way to look.


code:
for (var x = 0; x < inputs.length; x++) {
            var input = inputs[x];
            if (input && input.name == 'identifier' && input.type == 'text') {
                input.name = 'identifiers[' + index + '].identifier';
            }
            else if (input && input.name == 'preferred' && input.type == 'radio') {
                input.name = 'identifiers[' + index + '].preferred';
                input.id = 'identifiers[' + index + '].preferred';
            }




I suppose that  a loop can be added to test if the user has not clicked the preferred check box and has more than one identifier and If the user has not clicked preferred they will not be able to add/update a patient.
    

Thursday, February 10, 2011

Solving a bug

"A software bug is the common term used to describe an error, flaw, mistake, failure, or fault in a computer program or system that produces an incorrect or unexpected result, or causes it to behave in unintended ways." 
Keeping this in mind, my team and I set out to find a bug that would be simple for us to attempt to fix. Our project has been open for about 7 years so we had tons of bugs to dive into. One "bug" I found was for Timezone Support, but going with the definition above  I wouldn't actually consider this a bug however as it seems more like a feature that should be added but it seems like it would be easily implemented by my team since both mysql and Java have way to deal with timezones. Unfortunately this is not really a bug so my search continued. Bobby was able to find an interesting bug, where we would need to implement some sort of code to make users select a preferred identifier. There is also is TRUNK-222 in the introductory tickets, where if a patient only has 3 letters in their name you can search for them without knowing his family or middle name, which may or may not be simple for us to fix I have not actually looked at the code so it would be hard to judge. When I tried this bug myself, it seems to have been fixed with the newest version but this is not documented.

Tuesday, February 8, 2011

More Bugs, More Problems.



For openMRS, joining the bug tracker was very simple and straight forward. Searching through the bug logs was quite simple too, I was able to find the oldest open bug relatively easily it took time to derive the way the bugs were divided though. Bugs are given 3 different typings,Could, Should, and Must. The oldest bug under the could category is trunk-333.The oldest "should" bug is trunk-330. Both bugs have a severity level 3 so they are not a the top of the list of things to do but one team are looking into fixing trunk-333 and as of now trunk-330 is not assigned to anyone.

Reproducing a bug
After searching through the bugs  I found trunk-1702 .The problem was that ConceptService#saveConceptNameTag() does not save changes to the object rather it returns an existing object from the database. There is no other method to update ConceptNameTag either. My assignment was to see if I could reproduce the bug in the current build, OpenMRS 1.8. Despite my best efforts I was not able to reproduce the bug no matter how I tried, this bug has been fixed since version 1.6 so the original fix still does hold. I emailed Rafal Korytkowski to see if there are any steps that could be taken to reproduce the bug, he is pretty active so he should get back to me sometime soon.

Bug Triaging
For bug Triaging I chose 5 different bugs...

1. Trunk-1975-The BinaryDataHandler "getObs" method creates a complex obs where the data component is a FileInputStream. The getObs method leaves this input stream open when it returns the obs so that other methods (such as the ComplexObsServlet) can access the stream.
However, if the stream is not explicitly closed, the lock on the file is never released until the webapp is restarted. 
This ticket needs a severity level of 4 becauses if this project is going to be use by people who are not computer savvy, then they may/will not know how to explicitly close the stream. This ticket is well documented.
2. Trunk-1955 With this bug if you start to type Miriam and then back space it and type James Arbaugh, it yields results for "Mi". While this is bad, the severity level of this a lot lower than the first bug but it is necessary to fix. It is written well a  and definitely needs to be addressed.
3. Trunk-1963  this bug is a bit more confusing for me, maybe because I am new to OpenMRS or its the way its written. The original poster should probably reword this issue so that the severity level can be determined.
4. Trunk-201 this is an ideal bug report. The user provides not only what the bug does, the user tell you the exact steps used to reproduce this bug which will be very helpful when others try to fix it. The severity level should probably be about 3.
5.Trunk-2003 This bug is interesting because when a user adds a new patient address or name or identifier and they get sent back to the form after validation errors. The steps to reproduce it are very simple and its severity level is moderately high.

Sunday, February 6, 2011

Success well kind of...

After the last class meeting on Thursday, I sat down at my computer and started working with much more vigor than I had before. Before attempting to reinstall ubuntu on to my machine, I sat down and took a great look a the ubuntu docs to learn some commands that I should become familiar with and even figure out how to get the wireless network working so I wouldn't have to carry an Ethernet cord everywhere I went.  It was a relatively simple fix that I had overlooked many times before, but now that ubuntu was reinstalled it was time to attempt to build openMRS again. After using windows for all my life I was some what intimidated by the openMRS installation process in ubuntu, but I was quite easy. Thanks the google, installing all of the necessary software to run openMRS was a lot smoother than when I attempted the installation on windows. Sure there were errors here and there but the overall experience was ten times better. So after installing all the software it was time to download the code and build the project. Downloading the code was a very straight forward and simple process, but once I tried to build the project in eclispe it did fail so I will have to do a little more work on that but overall I would say I was pretty successful.

Thursday, February 3, 2011

Creating Executable Binary Code

Our next mission was to take the Freeciv source code and convert it to executable binary code. As with most things this semester, The process of turning source code into executable binary code can be extremely complicated and frustrating, but luckily i'm always for a challenge. I learned there are 5 main steps to building a project:
1.Compiling the code 
2.Linking object files and libraries 
3.Determining Build Dependencies
4.Testing the Build Results 
5. Packaging and Deploying

Also thanks Build automation tools, we don't have to do all these things by hand. I also learned many things that can help me with building the openMRS project.  For instance I was having trouble building openMRS so this quote stood out to me... "As you proceed through the build process, you may see many of the same errors; you may see completely different errors. No matter what happens, keep calm and carry on. Read the instructions. Don't expect to understand every word. Read logs carefully and thoughtfully. Google is your friend. Ask for help."


One of the first step was to install the gcc compiler since FreeCiv is written in C and had be done in Linux or UNIX.  Next gmake had to be installed. Installing gmake taught me a very important lesson of always, always read the instructions. This will probably be the most important thing I have ever learned because the building process can be overwhelming for anyone. After finally gathering and installing all of the prerequisites it was time to configure the project. Unfortunately  me and ubuntu/virtualbox have not quite come together just yet so I was not able to successfully configure the project, however I'm still attempting to configure the project and will update when possible.