Thanks for the memory!

This is the story of me trying to make run faster.

My first idea was to allocate any of the extra memory on the server to my web app. I found a settings file called “” and opened it up to find:

export JAVA_OPTS="-server -XX:+UseParallelGC -Xmx1024m -XX:PermSize=
256m -XX:MaxPermSize=512m -Djava.awt.headless=true"root@goose:/usr/

The 1024m basically means that OpenMRS on goose was allowed to have 1GB, or a small flash drive’s worth of memory. Dr. Wierman suggested changing the 256 to 512 and the 512 to 1024, or to keep increasing those values until I broke it. Confused, I wanted to find out how much memory goose even had. So, I did:

root@goose:~# cat /proc/meminfo
MemTotal:        1015836 kB
MemFree:           75104 kB
Buffers:           18084 kB
Cached:            54532 kB
SwapCached:       144048 kB
Active:           396248 kB
Inactive:         494176 kB
Active(anon):     373024 kB
Inactive(anon):   460656 kB
Active(file):      23224 kB
Inactive(file):    33520 kB
Unevictable:           0 kB
Mlocked:               0 kB
HighTotal:        129416 kB
HighFree:           1712 kB
LowTotal:         886420 kB
LowFree:           73392 kB
SwapTotal:       1036284 kB
SwapFree:         377404 kB
Dirty:                32 kB
Writeback:             0 kB
AnonPages:        674820 kB
Mapped:            11600 kB
Shmem:             15864 kB
Slab:              33732 kB
SReclaimable:      21136 kB
SUnreclaim:        12596 kB
KernelStack:        3000 kB
PageTables:         4104 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     1544200 kB
Committed_AS:    1973740 kB
VmallocTotal:     122880 kB
VmallocUsed:       10848 kB
VmallocChunk:     108876 kB
HardwareCorrupted:     0 kB
AnonHugePages:         0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       4096 kB
DirectMap4k:       36856 kB
DirectMap4M:      872448 kB

Simple enough, right? This is how I learned that out of slightly less than 1GB of “MemTotal” about 0.07 GB was “MemFree.” My OpenMRS was already allowed to have more memory than the server had to offer.

Dr. Wierman said he had a bag of memory laying around somewhere, and he would look for some that would work with goose. That sounded funny to me so I asked, “What does memory look like?” My question must have sounded funny to him too because he repeated it smiling and pulled out that previously mentioned bag of memory. Nothing in the bag matched the “MT-M 8810-WCX” sticker on goose, so Dr. Wierman opened up and handed me the 1GB memory from that server… “Here, you can put this in goose.” I took it excitedly down the hall. “Don’t forget to unplug it first!”


Adventures in Pair Programming – Week 10

What about pair programming?[1] Janet and I tried pair programming to start writing unit tests. Before this week I had zero experience, and writing the code together was a quick way to bring me up to speed on the when, where, and why of unit testing. We used some combination of Skype, iChat, and to pair program remotely. I shared my screen and control to observe how Janet set up the class path and used the Eclipse plug-in to generate test cases, and wrote the first few tests, explaining each step as she did. Then I wrote the next few tests.

So what about pair programming? The last time I programmed in a pair was in high school with my friend and the only other girl in my class, Cassidy, on a GridWorld project. Neither of us knew more than you would expect to learn in AP CS, but we had each other to use what we did know to solve problems creatively and check syntax. The whole process then and now did not go perfectly smoothly, which was okay. It reminded me that I’m not the only one who gets stuck. Having a partner in code makes it possible to brainstorm and troubleshoot more effectively, and stay focused.

Now What? Janet and I are going to try pair programming for a couple hours again on Wednesday, this time writing code with Hibernate. *I think* there is also talk around OpenMRS of using pair programming strategies to help, mentor, guide new community members.

[1] From Wikipedia: Pair programming is an agile software development technique in which two programmers work together at one workstation. One, thedriver, writes code while the other, the observer (or navigator), reviews each line of code as it is typed in. The two programmers switch roles frequently.

GSoC Week 9

My project is starting to work and interact with the OpenMRS API and the database, so I decided it would be helpful to download the OpenMRS demo data for testing purposes. It is helpful in that I have patients to experiment taking observations on, but I will have to make my own forms and other concept references. I went to school that day because I thought for sure I was going to have trouble downloading the demo data, but I only got one error that I was able to figure out. I noticed that I’ve gotten better at trouble shooting in general since this summer started, and errors don’t scare me like they used to. I was excited when I realized the demo data was successfully imported into my database and said something like, “I have patients!” which my friend heard as “I have patience!” We laughed and agreed it’s good to have both.

The easiest part of this week was writing the code to fetch the number of observations pointing to a given concept. My only other objectives were to display and test it. I am still figuring out unit testing and log messages. Trying to make my preview page look like the patient matching preview page was difficult. A few times I would save and build my project, unload and reload it into my OpenMRS instance just to see that what I thought would make my table columns look more even actually turned the whole thing green. This part was fun too.

Word on Creighton Energy and GSoC with OpenMRS

I went to school last week to attend a program-wide reflection on the first year of Creighton’s new Energy Technology Program.** What does this have to do with my participation in Google Summer of Code with OpenMRS?

To put it simply from a student perspective, we are passionate about what we’re doing. We are motivated by real world problems. We’re genuinely interested in learning from and helping each other. We regularly stay up until 2 am to work on projects or homework – not because we are worried about grades or making money – because what we’re learning is important to us and we’re excited by it. These are commonly reflected upon experiences of Creighton’s Energy Technology students. I feel exactly the same way with my project this summer. Based on blogs and facebook updates, presentations, and conversations with fellow OpenMRS GSoC students, I think they could relate too.

My OpenMRS GSoC mentors have different backgrounds just like the Energy Program has faculty from eight or nine different departments that I can think of off the top of my head. What I hear them all saying is, “Let’s challenge and teach you. Let’s try something new. Doubt what you’re told. Ask more questions. Think. Learn from your mistakes. Build community in the process. This is your project. Go for it. I’m available and flexible.” There have been moments this summer I thought this project was doomed, just like I thought I was going to fail Intro to Thermodynamics. In both cases, my mentors of sorts re-evaluated, met me where I was at, and we adjusted.

How do you thank someone or a whole community for being so supportive? Finish your project. Maybe write a blog about it. Do the same for someone else when you get the opportunity. 🙂

As a computer science major involved in the Energy Program, I’ve been given incredible support and encouragement from both sides of campus. The Energy Program is able to be especially intentional about pedagogy and open communication between students and faculty, and Creighton is better because of it. Google Summer of Code accepted “a total of 1,122 students… with 180 different open source projects.” (OpenMRS post). I don’t know much about the other 179 open source projects, but I definitely feel that OpenMRS has a special place in GSoC too.

** “This major prepares students for cutting-edge fields, but is based on Creighton’s roots in Ignatian pedagogy. In this Ignatian model, drawn from the Spiritual Exercises, teachers accompany learners in the pursuit of competence, conscience, and compassionate commitment. This model stresses personalized programs, active engagement of the student, and reflection on the experience.” (

GSoC Week 8

Eight weeks down, and I officially passed my midterm evaluation. Yay! I can’t believe eight weeks have gone by already. My focus this past week was adding concept search widgets for choosing a concept to keep and another concept to retire, and then submitting those values to the controller. I thought this was going to be an easy job, and all I had to do was follow how other modules do this. Turns out there are many different ways to get data from one page to the next all depending on different things. Then I had to decide what data to pass along – the whole concept or just the concept id, and the universe again revealed a number of possible combinations. I can sum up the coding aspect of this week in three words: guess and check.

My weekly iterations of the module also include documenting and testing. While I didn’t have a lot to document or test this week, I did update my project page with a technical diagram and read up on log4j.

Six ways to facilitate JSP navigation

If you’re me, and you finally get some code working, the last thing you want to do is restart your computer and see if it’s still there. I think the key to getting over this kind of fear is understanding the logic, the science, the brains behind the magic that makes code compile. Here is the first of a handful of technical expository posts on what I’m learning this summer, compilations of insight I gained by reading OpenMRS wikis, asking mentors, other OpenMRS developers, or Creighton experts, and Google-ing. This one is about all of the possibilities I discovered for getting from one Java Server Page to the next, and back again.

This might seem obvious, which is why beginners run the risk of over thinking it. The link can send the user anywhere and be styled to look like a button. Data can follow a link to the next page in your web app by using a cookie or setAttribute() of a session or request.

<a href="fortuneCookie.form">Read my fortune</a>

In this example, fortuneCookie represents a .jsp file, but my web app is happier with the .form extension. You might use .jsp, .form, .list, .htm, or something else, and results may vary.

form actions
Add an action to a form tag. When the form is submitted, the user is taken to the page specified by the action. For example:

<form action="fortuneCookie.form" method="POST"> ... </form> 

If a controller is also being used, methods can be annotated with “@ModelAttribute” and have parameters “@RequestParam(“fortuneCookieId”)” where fortuneCookieId is a form field determined These methods are processed first so their data is available.

Have a submit button that submits to a controller. If the button has a name and value, the controller that accepts the post can check if the name and value of a particular submit button exists and then redirect to a different page. The method used to redirect may return a String and if the button was clicked, return “redirect:fortuneTeaLeaves.form”; That should work.

Google search “JSP back button” and many of the examples use the javascript history back() method. I didn’t try this at home, but here is a great place to check it out:

one controller
With annotation-driven Spring MVC, you can use something like “@RequestMapping(“/module/fortunetelling/fortuneCookie”)” to annotate a method in a controller so it is called every time that page is requested.

Within the one controller, I have many, small, explicit methods. One advantage of having multiple methods with clear intentions is that they are easier to test than one method with multiple steps to follow. One method might be helpful if you need very similar behavior for each request.

multiple controllers
From what I can tell, using multiple controllers named after different pages is an alternative to annotation driven Spring MVC and a viable option if you have multiple data sources or “models.”

Pursuit of Happiness, and Code – Week 7

Monday morning, my Google Summer of Code mentors at OpenMRS and I had a Skype meeting to reflect on the summer so far and talk about what should be happening over the next six weeks. We spent about half of the time talking about a new and improved project plan to do more, small iterations rather than one linear kind of process. Agile style. I might not get as far as I wanted to by August 20th, but I will have a good first version that has end to end design and code patterns.

The second theme of our conversation was public communication. I now have a Post-it taped to my laptop with all of my goals for community involvement via mailing lists, this blog, Developer Forums, IRC, etc. This communication is the glue of the community, as my mentor Glen called it. I completely understand and appreciate the value of getting more involved. I actually don’t think of myself as being quiet or shy all the time, but there is anxiety around knowing everyone can read my questions and comments that expose exactly how much I do and don’t know. On the other hand, I have every reason to believe that they will bear with me while I get more comfortable speaking up, and it will be easier with time.

One of my earlier posts mentions the consolation of vocation that I was feeling with this whole opportunity. That feeling was because I found this meaningful outlet for my chosen academic major. Then later this week, I was learning the “science” behind how JSP’s work within MVC. My other mentor Janet and I found a virtual whiteboard and she drew me a picture of how the different pages might communicate with a controller. I applied this logic to my code and felt like I had just learned a new magic trick or something… This isn’t even work. This is fun.

Speaking of magic tricks, this week I also implemented OpenMRS on the server I adopted at Creighton:

Unrelated note on Independence Day: In the past 12 months I have learned more about US history than ever, and some of it is really ugly and overwhelming. On that note, I had a professor last semester explain the difference between patriotism and nationalism as sticking up for our values versus supporting our country no matter what it does right or wrong. Cheers to life, liberty, and the pursuit of happiness that doesn’t exploit our neighbors.