iPhone and Diabetes

Diabetes, Geek 7 Comments »

The iPhone is an amazing phone. Love it or hate it, you need to acknowledge that it was the first phone that was a game changer in the field of smart phones. Windows Mobile phones, while extremely functional and capable, didn’t have the ease of use to make it a viable choice over a simple feature phone to non tech-savvy people. The iPhone increased the speed of smartphone adoption and revitalized the mobile platform as a whole.

In spite of that, I was a late adopter of the iPhone, waiting until after the iPhone 3G but before the 3.0 OS was out for my purchase. With the promise of copy and paste as well as push notifications being thrown around with the upcoming update, I made the plunge in February of 2009, slightly before the iPhone 3.0 OS was announced.  On March 17th, 2009, the official announcement was made. This did include the aforementioned copy and paste and push notifications as well as landscape mode and MMS as well as some rich new APIs for developers to use.

At that announcement, Apple invited Lifescan to demonstrate an application that integrated the iPhone with a glucometer. A glucometer (glucose meter) is a device that, with a small sample of blood, can determine the amount of glucose in your blood stream. These meters are the speedometer of the diabetic, allowing the user to make informed decisions about their dietary intake, insulin usage as well as keep track of overall sugar control. There is no cure for diabetes; diabetics must manage their blood sugar levels on their own, and the only reliable way to gauge glucose levels is to measure them with a glucometer.

As a diabetic and a technology fan, I was overjoyed. Managing diabetes is a time consuming task. I welcome and encourage any tool that can be utilized to ease keeping track of glucose levels. Yet, here we are, over a year later, and the entire system promised in the 3.0 OS announcement is vaporware. Sure. there is other software that I’ve tried, both for the iPhone (such as Glucose Buddy and bant), and even some meters, with serial cables, can connect to proprietary software and transfer your data to your computer for further analysis. These work, but they are all designed to work best within their own framework. Though Glucose Buddy is able to export your data in a CSV format to you via email, it’s certainly not ideal for running an automated system.

What I’m looking for is a simple way to log my blood sugars into a database where I can then process the data however I want.  Perhaps I am an edge case, since, as a web developer, I know how to harness and process data. However, I am astonished that none of the diabetes applications have taken that step to allow full data usage. It’s my health data! I want to use it in a way that’s meaningful to me, not in the way that your application prescribes. Most of the applications that I’ve seen are bloated; they include carb counting, interfacing with twitter, a forum, or some other social network. I don’t want that. I need a place to enter a glucose reading, the time, a time slot (such as breakfast, lunch, dinner) and a free text area for notes. That’s it! The application should take minimal time to load and allow me to enter the data fast and move on with my life. When I’m ready, I should be able to upload the data to a server where I can then organize, graph, annotate and review my data further.

I have thought of writing my own application to do all of this processing. However, I have concerns about storing personally identifiable medical information in accordance with HIPAA regulations. I would like to research how these regulations would apply to an application for simple blood glucose management. In this litigious society, I’d rather not take a chance to be sued. If anybody has some good links that covers these issues, it would be appreciated if you could leave them in the comments.

Apple and Lifescan have demonstrated the future of blood glucose management. The technology exists to make this all happen. They have dangled it in front of me, showing how easy they could make diabetes management. Others have tried to fill the gap, but fall short with bloated applications that do little to enable data portability. I want simple. I want easy. I want to control my diabetes, rather than having my diabetes (and the technology that I use to monitor it) control me.

Creating a self-signed (wildcard) SSL certificate

Geek 5 Comments »

I’ve done my own self signed certificates before, but since I do this so infrequently, it is not something that I tend to keep in my brain long. (That’s what Google is for, right?!?)  So when I went to find out how to do this again, I found the most concise information on how to create a self-signed wildcard SSL certificate than any of my previous endeavors to cobble this information together.

Creating the self-signed wildcard SSL certificate

Courtesy of Justin Samuel, here it is:
mkdir /usr/share/ssl/certs/hostname.domain.com
cd /usr/share/ssl/certs/hostname.domain.com
(umask 077 && touch host.key host.cert host.info host.pem)
openssl genrsa 2048 > host.key
openssl req -new -x509 -nodes -sha1 -days 3650 -key host.key > host.cert
...[enter *.domain.com for the Common Name]...
openssl x509 -noout -fingerprint -text < host.cert > host.info
cat host.cert host.key > host.pem
chmod 400 host.key host.pem

Obviously, you can 1) create this directory wherever you want and 2) should probably substitute the word “host” for whatever your hostname is to decrease confusion.

What now?

All that remains is to tell apache (or whatever needs to use the certificate) about it.  Here’s my code to get it installed on apache:
SSLEngine on
SSLCertificateFile /path/to/host.cert
SSLCertificateKeyFile /path/to/host.key
SSLProtocol all
SSLCipherSuite HIGH:MEDIUM

What about my NameVirtualHost?

Aye, there’s the rub.  Due to the nature of the SSL layer in HTTPS, negotiating a secure connection happens before the HTTP protocol is initiated. That means that at the time the SSL layer is in play, the “Host” header has not been sent and, therefore, apache cannot determine which NameVirtualHost to use.

But, frankly, if you’re self-signing your certificates, the browser is going to throw a warning anyway. Might as well just make it as generic as possible and then all traffic running on through the HTTPS port will share the same certificate.

Why I use Smarty: PHP is an ugly templating language

Geek, PHP Development 14 Comments »

There’s a debate going on here regarding Smarty‘s usefulness as a developer tool. It was sparked (again) by the launch (or at least newly noticed) nosmarty.net. I commented:

I don’t understand how ZF or Symfony or any framework can be an “alternative” for Smarty. Smarty is not a framework — it is simply a templating engine. It should not be used as anything other than a component of the view layer of your MVC application. Just like any other software, it has a learning curve and a certain amount of quirks. Using Smarty does not guarantee good design — that still needs to be handled by programmers who have more experience than writing a “Hello, World!” program and reading a tutorial.

I think the fact that it’s been around since 2001 and is still in use is a testament to it’s usefulness within the community. If Smarty is used in the right manner, I don’t see why it can’t have it’s place within the arsenal of tools for developers to use.

It was countered by Paul M. Jones with:

In my opinion (note the small “o”) there *is* no right manner in which to use Smarty. It is the solution to a mis-stated problem. I suppose I shall have to expound on that at greater length in another blog post. Oh, I already have! http://paul-m-jones.com/?p=273

I understand this point, however I still have one reason to use Smarty: PHP is an ugly templating language. I’ve used Smarty and Symfony (which relies on PHP’s alternative syntax for templating) and I still prefer Smarty.

The examples on nosmarty.net generally site one instance of echoing a variable. In this small case, sure, I can see — why use a heavier templating system that takes longer to parse and can be a bitch to configure and deal with. However, if you’re looking at a portion of a html page that has to output multiple variables, Smarty is much easier on the eyes.

SMARTY:
<td>Name</td><td>{$name}</td>
<td>Email</td><td>{$email}</td>
<td>Phone</td><td>{$phone}</td>

PHP:
<td>Name</td><td><?php echo $name; ?></td>
<td>Email</td><td><?php echo $email; ?></td>
<td>Phone</td><td><?php echo $phone; ?></td>

When you start repeating <?php … ?> everywhere it gets fairly redundant, and, frankly, ugly.

Perhaps my use case for Smarty is a bit selfish, but, ultimately, programming style and comfort boils down to personal preference. Most, if not all, programming tools have the ability to be misused. I still consider Smarty to be a useful tool in my development arsenal. Though I have not used smarty in over 2 years now, using strictly PHP templating (mainly due to Symfony’s templating conventions), I would happily start using it again to regain readable templates.

De-annoyifying Subversion Externals

Geek, PHP Development 2 Comments »

Subversion externals are a way to include other packages in your code that are maintained somewhere else.  For example, if I was developing an application that needed to send out mail, I could use SwiftMailer and define that as an external for my project. When I run ”svn up” it will grab files from the SwiftMailer project and copy them locally. (How to define externals is beyond the scope of this post. RTFM!)

One annoying part of externals is that even if there are no changes to your code, your Subversion status output will be filled with externals information. For example, I have included symfony as an external in my project and now the default status output is:

X      lib/symfony

Performing status on external item at 'lib/symfony'
X      lib/symfony/doc
X      lib/symfony/lib/plugins/sfDoctrinePlugin
X      lib/symfony/lib/plugins/sfPropelPlugin
X      lib/symfony/lib/vendor/lime

Performing status on external item at 'lib/symfony/lib/plugins/sfPropelPlugin'
X      lib/symfony/lib/plugins/sfPropelPlugin/lib/vendor/propel
X      lib/symfony/lib/plugins/sfPropelPlugin/lib/vendor/phing
X      lib/symfony/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator

Performing status on external item at 'lib/symfony/lib/plugins/sfPropelPlugin/lib/vendor/phing'

Performing status on external item at 'lib/symfony/lib/plugins/sfPropelPlugin/lib/vendor/propel'

Performing status on external item at 'lib/symfony/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator'

Performing status on external item at 'lib/symfony/lib/plugins/sfDoctrinePlugin'
X      lib/symfony/lib/plugins/sfDoctrinePlugin/i18n
X      lib/symfony/lib/plugins/sfDoctrinePlugin/web
X      lib/symfony/lib/plugins/sfDoctrinePlugin/lib/doctrine

Performing status on external item at 'lib/symfony/lib/plugins/sfDoctrinePlugin/i18n'

Performing status on external item at 'lib/symfony/lib/plugins/sfDoctrinePlugin/web'

Performing status on external item at 'lib/symfony/lib/plugins/sfDoctrinePlugin/lib/doctrine'

Performing status on external item at 'lib/symfony/doc'

Performing status on external item at 'lib/symfony/lib/vendor/lime'

This is obviously annoying as it obfuscates the part of the project that I’m working on. The switch command does have an option to ignore externals, aptly called –ignore-externals but I don’t want to have to type that in every time I run a svn st command.

After browsing around the net for a bit, I found this piece of bash script that will swap the defaults for me:

svn() {
        case "$1" in
                st|stat|status)
                        svnargs1=""
                        svnargs2="--ignore-externals"
                        for i in $@; do
                                if [ "--examine-externals" == "$i" ]; then
                                        svnargs2=""
                                else
                                        svnargs1="$svnargs1 $i"
                                fi
                        done
                        command svn $svnargs1 $svnargs2
                        ;;
                *)
                        command svn "$@"
                        ;;
        esac
}

What’s nice about this script is that I can run status on the externals as well by specifying –examine-externals — and they’ll be back, in all their annoying (yet sometimes needed) glory.

On my Mac, I just placed the code in /etc/bashrc and now it’s available as a layer over the svn binary. (You may need to restart your terminal session for it to take effect.)

Where art thou my css?

Geek, PHP Development No Comments »

I’ve been playing with the symfony auto-generated forms, which are a really nice way to bootstrap an application. However, the forms that it generates are not styled at all, which makes developing with it (and looking at it all the time) quite painful on the eyes. Here’s some CSS to make your auto-gen tables look more like what the forms book shows in the examples. All you’d need to do is class the table with “autoform”.

table.autoform {
	border: solid 1px #CCC;
	border-collapse: collapse;
	border-spacing: 0px;
	padding: 0px;
	margin: 0px;
	border-spacing: 0px;
}

table.autoform th,table.autoform td {
	border: solid 1px #CCC;
	border-collapse: collapse;
	border-spacing: 0px;
	padding: 3px;
	margin: 0px;
}

table.autoform th {
	background: #EEE;
	font-weight: bold;
	text-align: left;
	padding-left: 10px;
	padding-right: 20px;
}

table.autoform ul.error_list {
	color: red;
	padding-left: 20px;
	margin: 0px;
}

Zend Studio for Eclipse, Take 1

Geek, PHP Development, Reviews 1 Comment »

Zend Studio for Eclipse has finally arrived! I’ve been waiting for this upgrade for years. Zend Studio, in its previous incarnation, was certainly no slouch of a product. I’ve been using it since version 4. Aside from various Java platform issues, their product was extremely stable and increased my productivity over using other less featured editors.

My experience with Eclipse began in college while taking advanced programming courses in Java. It was an amazing product back then, and has only grown better since. However, the marriage of Zend Studio to Eclipse has proven to be a bit of a disappointment. Perhaps it is because I’m too used to the way that Studio 5.5 works and need to shift my IDE paradigm back to Eclipse. Maybe it’s the difference in how the system is configured by the preferences. Either way, it will take a bit of time to get used to and that’s just not something that I can afford at my job right now. Using Studio for Eclipse will have to be a weekend project to slowly ween myself off of 5.5 and learn how to manipulate Eclipse to assist, rather than hinder, my development.

One of the major pieces of integration that I’m interested in the new version of Studio is how well it handles remote files. My current development process requires that I use ssh/sftp to open and save files to a remote file system. In Zend Studio Neon (their beta version of the Eclipse integration, as well as in Eclipse in general), remote filesystem access was still a bit lacking and buggy. At first glance, it seems as if they have figured this out in Studio for Eclipse. However, I’m running into issues building the workspace through the remote filesystem. It’s slow and bogs down the Java process so I can’t develop while it’s building. I tried, heaven help me, to stop the build process, which locked up Studio, and now I can’t seem to open Zend Studio for Eclipse at all.

As for right now, I’m going to uninstall it and try re-installing over the weekend and playing around a bit more. They may call it Studio 6.0.0 — however, I think I need to treat this as a 1.0 release. Overall, I don’t think this release will be stable enough for me to use until a few more rounds of bug fixes, but I certainly like the direction that the platform is heading.


Copyright © 2007-2024 dotEvan. All rights reserved.