|
5/24 |
2006/1/18-21 [Computer/SW/Apps, Computer/SW/Languages/Perl] UID:41420 Activity:low |
1/18 I need to gain 20-30lbs of weight and want to track my progress. I could do this in an Excel spreadsheet but I don't have it installed right now and would rather have some nifty web thingie - I googled and most of the stuff I found kind of sucked. Before I revert to Excel (if lazy) or write my own (if bored) does anyone have recommendations? \_ "need" to gain? why? \_ My BMI is 15.4 . If it wasn't from being sick and/or I was a girl, I'm sure that's eating disorder range :) -op \_ http://www-128.ibm.com/developerworks/library/l-gnuplot Look at figure 8. \_ Sigh, duh. I actually have used gnuplot a fair amount. This should be perfect for an unpolished barebones thing. Thanks! -op \_ If I wanted to gain 30 pounds, I'd get a spiked tail grafted on to my ass. This would help with both balance and self-defense, and seems like the best possible way to gain weight. It might also be possible to use your mouse or trackball with the tip of your tail, increasing productivity. \_ Dude, just roll your own. It's a really simple bit of Perl. \_ I'm not a big Perl hacker. It is pretty trivial but a nice one with login/security, and pretty pictures rather than text would take me at least a few hours to write, because I'm not particularly familiar with the web/graphics libraries - op \_ The less you do on the couch, the faster you can put on that weight. (or more seriously, vi does this just fine) \_ depends on what kind of weight. he could put on a lot of weight sitting on the couch or in front of the computer, he just needs to eat more. EAT MORE LARD! \_ I lost the weight because I was/am sick, and need to gain it back in a healthy way or it defeats the purpose. Thanks anyway! (defeating silly comments with reasonable responses) - op \_ So far as I know the only way to quickly gain weight is to gain fat. If you eat right and exercise a lot, you might take a couple of years to gain 30lbs of lean-ish body mass. Unless you have naturally high levels of testosterone and/or take steroids. Though there are some other drugs you could possibly take. \_ Luckily (?), I am actually on (safe) steriods for medication for a few months. I have seen a nutritionist... it's not too bad to put on a pound a week, it turns out (eat a lot and drink Ensure). More than that, maybe I'll get lucky - if I'm underweight, maybe my body wants to recover or something. -op \_ I know dawne wrote one a few years ago; I'll see if it's still lying around somewhere and easy to get working again. --dbushong \_ Found it: http://bushong.net/dawn/widgets/tracker The graphing's a little sluggish b/c GD's broken under mod_perl for me, but otherwise it seems to work. --dbushong \_ Oh, right, it doesn't handle weight _gain_. I'll work on it. \_ If you have a palm use EatWatch: http://www.fourmilab.ch/hackdiet/palm |
5/24 |
|
www-128.ibm.com/developerworks/library/l-gnuplot -> www-128.ibm.com/developerworks/library/l-gnuplot/ com), Staff Software Engineer, IBM 22 Jul 2004 Turn your data and functions into professional-looking graphs with Gnuplot 40, a freely distributed plotting tool. In this article, get a hands-on guide to gnuplot that emphasizes the idioms you'll need to use this tool effectively. Gnuplot is a freely distributed plotting tool with ports available for nearly every major platform. It can be operated in one of two modes: when you need to adjust and prettify a graph to "get it just right," you can operate it in interactive mode by issuing commands at the gnuplot prompt. Alternately, gnuplot can read commands from a file and produce graphs in batch mode. Batch-mode capability is especially useful if you are running a series of experiments and need to view graphs of the results after each run, for example; or when you need to return to a graph to modify some aspect long after the graph was originally generated. While it is hard to capture the mouse-clicks that you would use to prettify a graph in a WYSIWIG editor, you can easily save gnuplot commands in a file and load them up to re-execute in an interactive session six months later. Gnuplot was originally developed in 1986 by Colin Kelley and Thomas Williams. A number of contributors added support for different "terminals," creating variants. In 1989 and 1990, these were merged into gnuplot 20 And in April 2004, version 40 was announced. This tutorial will apply to version 40, but most of the commands introduced here should apply to other versions as well. In the following, we present a hands-on tutorial for the novice; but even if you have prior experience with gnuplot, you might find new idioms and new commands introduced in version 40 We start with a simple sine curve and customize it to look just as we want it to. In this article, we confine ourselves to 2D plots, since they are the most common. GNG: Gnuplot's Not GNU While its name may imply otherwise, gnuplot is not covered by the GPL. However, it is not freeware in the sense that you would be allowed to distribute a modified version of your gnuplot freely. Please read and accept the Copyright file in your distribution." Oftentimes, novice users may have a pretty good idea about how their graphs should look, but it is not apparent what gnuplot command they need to use. So the key to understanding gnuplot is to get a good grasp of its vocabulary, and the rest should be intuitive enough. In this tutorial, I will only be able to provide a feel for some of the common options you will end up using in gnuplot; So, for example, I tell you how to set the x-range to limit the range on the x-axis of the graph. Setting the y-range is similar (use yrange instead of xrange in the command), but I don't talk about it. The basics Fire up gnuplot by typing gnuplot at the command prompt of your shell. For example, you can use arrow keys to navigate the history of commands you have typed before, then edit and re-execute them; gnuplot can be recompiled to use the GNU readline library to move around on the input prompt, but the defaults function similarly. Gnuplot comes with extensive online help, which you cannot avoid using if you intend to do anything non-trivial. The syntax is uniform: help for any command is obtained by typing help <command>. Go ahead and start up gnuplot, and try the commands help set yrange and help set now (use q to quit the help after each command). Notice that yrange is one of the sub-options available under help set. In general, gnuplot help offers further help for all possible customizations of a command. Glancing at the examples section in the help is usually more than sufficient to understand how to use a command. Gnuplot also has an extensive set of demos that showcase its capabilities, usually located in the demo subdirectory of the install. You may want to hold off on this exercise until the end of this article, though, so that we can get started without further ado... For those who want to follow along, you may type each line of code in the code listings individually at the prompt. Alternatively, save the whole listing into a temporary file and run it by typing load 'filename' at the gnuplot prompt (don't forget the quotes). Type in plot sin at the prompt: you should see the familiar sine curve in a pop-up window. Figure 1 sin Figure 1 sin We just created the simplest possible graph. Let us say we want to see just one cycle of the sine wave. We do this by restricting the default x-range of the graph. replot reset Figure 2 Replotting the sine graph Figure 2 Replotting the sine graph We just used the replot command, which executes the previous plot command. This can be very useful when you are composing a graph and need to keep changing it to add desired features. Replot simply takes the previous plot string, adds an implied comma, and then appends the rest of the input given to it. The last command used, reset, is strictly not necessary for plotting the sine curve. It removes the effect of all previous set commands and restores default values. You should see something like this: Figure 3 sin/x Figure 3 sin/x From just these three simple examples, you can see that gnuplot understands pi and has a rich and natural vocabulary of mathematical functions. A rule of thumb is that the syntax is similar to the syntax in C, which in turn is similar to the syntax used in everyday mathematics. Next, let us give titles to the graph ("My First Graph") and the axes (x-axis is "angle, in degrees," and y-axis is "sin(angle)"). Listing 2 Giving titles to the graph and axes set title "My first graph" set xlabel "Angle, \n in degrees" set ylabel "sin(angle)" plot sin Notice that the \n in the xlabel produces a new line. In general, gnuplot does C-like backslash processing within double quoted strings. Windows users beware: If you tend to use double quoted strings for filenames, you will have to use two backslashes: for example, "c:\\developerworks" (or you can use a forward slash: "c:/developerworks"). Now, we notice that the x-axis is not really marked in degrees and does not look good. Let us fix this by adjusting the tic marks on the x-axis to make named (major) marks only at 90 degree increments and minor marks at 45 degree increments. The major tics have a "level" of 0, which is the default; and the minor tics have a level of 1 Each point is separately specified by a 3-tuple: "label" (in quotes), <point-at-which-tic-is-made>, and <optional-level>. Also observe that we don't need to list the points in any order. Like everything else in gnuplot, the xtics command is enormously versatile and there are convenient options for creating tic marks at regular increments (regular multiples, in logarithmic scale), and special formats for time-related data. Look up the examples in help set xtics for the juicy stuff. As a side note, observe that we use a backslash to extend the xtics command over more than one line of input. We also slapped on a grid with set grid, which lets you eye the graph quantitatively. We have been extensively using the set command until now. Gnuplot has a consistent way to undo sets: in gnuplot 40, the command is unset. Incidentally, all the examples we give can be run in interactive mode or in batch mode. To run it in interactive mode, type each command at the prompt. To run it in batch mode, type or cat the commands into a text file and either read it in at the gnuplot prompt using load 'filename', or give it as an argument to gnuplot at the shell prompt: $ gnuplot filename With the second method, gnuplot exits after executing all the commands in the input file, so it is especially efficient for batch-mode execution when plotting directly to a file (see next section). If the second method is used when plotting onscreen, the output window will disappear as soon as it is rendered (when gnuplot exits), so you will need to use an explicit "pause -1" command (see help pause) to make the window stick. Gnuplot command files used in batch-mode operation tend to stick around for a while, so it helps to use comments to improve readability. So in the example in Listing 3, gnuplot does not process we want only one cycle. Back to top T... |
www.fourmilab.ch/hackdiet/palm -> www.fourmilab.ch/hackdiet/palm/ Eat Watch--the weight monitoring, charting, and trend analysis software originally developed as Microsoft Excel macros in 1990. By the standards of the time, it was pretty cool to be able to enter weight and exercise log entries into a spreadsheet which automatically calculated the daily trend and variance, and then press a button and have a pretty, full-colour chart pop up complete with weight trend and calorie balance analysis. Never did I imagine when writing the original macros that Microsoft's unique blend of incompetence and contempt for their customers' investment would cause those macros (like virtually every other Excel macro package all around the world, except for the most trivial) to break on almost every successive release of Excel, all along the tedious, tear-drenched trudge from Excel 21 to Excel 2000; that ever steepening spiral into the foul pit of intellectual corruption from the days of "386 Enhanced Mode" to the era of the talking paper clip. abandoned all new software development for that platform. But the computer tools for The Hacker's Diet remained wedded to Excel, a proprietary platform which history had proven notoriously shaky and likely to continue to degrade since Microsoft abandoned the macro language in which I developed the tools in favour of an even worse one based on Visual Basic. Today, Microsoft provides little or no documentation of or support for the original macro language in current releases of Excel. useful software for it, it dawned on me that the weight logging, charting, and analysis package for The Hacker's Diet was an ideal Palm application. Here was a totally non-Microsoft platform with a good record for upward application compatibility and excellent developer support. Most people don't want to turn on their computer and fire up Excel every day to just enter daily log entries, so they keep a log on paper and then transfer the data to the computer every week or perhaps at the end of each month. But keyboarding a block of log entries is tedious and, like most tedious things, invites procrastination. And if you put off maintaining the log and charts for month after month, you may miss a creep in the trend, easily fixed when it begins, but which may require more distasteful dieting if discovered too late. With a PalmPilot version of the Eat Watch, there's no need to keep a paper log at all! If you're a proper geek like myself, your PalmPilot is never far from reach (just like a slide rule in days of yore), especially since it, unlike the slide rule, can serve as an alarm clock. Get up, weigh yourself, write the weight into the PalmPilot and get instant feedback, including an up to date chart. application there which produces permanent logs and charts in HTML, an open standard which can be examined with any Web browser or even (if you're particularly vain and/or proud of your progress), posted on a Web site! Like most Palm applications, the Eat Watch is organised into a collection of forms, each of which is discussed in the following sections. The program contains a number of Palm-style shortcuts and gimmicks to reduce the number of taps and characters you have to write; Monthly Log Monthly Log form This form is used to enter items in a monthly log. When you launch the Eat Watch application, the current month's log appears with today's date (highlighted in bold) scrolled into view. When you enter a weight and close the field (by writing Return or tapping in a different field) the trend is calculated for that day and the Variance (difference between today's weight and the trend) appears in the "Var" field, positive if the weight is above the trend, negative if below. Weight and variance are displayed to one decimal place for kilograms and pounds. When stones (a predominantly British unit of weight equal to 14 pounds) are chosen as the weight unit, weight is shown in stones and pounds separated by a space; for example, a weight of 152 pounds would appear as "10 12". No decimal places are shown for pound weights accompanying stones but you may enter them when making log entries. When you display the log in pounds or kilograms, you'll see the decimals. When weight is set to stones, variance continues to be shown in pounds--a variance of one or more stones would indicate something seriously amiss! You can enter weight with up to two decimal places (one when using stones), but it's rare to find a scale which shows weight to a resolution better than 100 grams, nor are such tiny increments in daily weight at all relevant to achieving and maintaining your weight goal. exercise program presented in The Hacker's Diet, use the "Rung" field to record which rung on the exercise ladder you completed that day. You can use the Flag ("Flg") field to mark any recurrent event you're interested in keeping track of on an ongoing basis, for example, whether you found the time for a game of tennis or had an ice cream snack before turning in for the night. In this example the user observes that on the 23rd and 24th of September she was in Paris, explaining the missing weight and exercise entries as well as, perhaps, the positive variance recorded upon her return. The navigation arrows at the top right of the form permit you to scroll to prior and subsequent months (if any). In the example, the month displayed is the current month and hence only the previous month button is shown. This is handy for entering exercise rung entries, which change infrequently and rarely at all once you've reached your goal. If you use the comments field to note when you're out of town, you can just double tap when you're in the same place as the day before. If you must enter a comment consisting of a single period, just write a space after it. Weight generally changes little from day to day, but if your scale reads to the nearest 100 or 200 grams (or the equivalent in pounds), a given day's weight will rarely be identical to that of the day preceding. This limits the utility of the field copying trick discussed in the last paragraph. The monthly log form permits you to abbreviate weight entries which differ slightly from the last. If you write the decimal character (period or comma, as selected on the Formats page of the Preferences application) followed by a single digit, the previous weight entry will be copied with the decimal digit replaced by the digit you wrote. Similarly, writing a single digit followed by the decimal character and a second digit copies the previous weight, replacing its units and decimal place with those you entered. If the decimal place is zero, you need not write it--simply write the units digit followed by the decimal character. In addition, when the display unit is set to stones, if the previous entry has a pounds field between 10 and 13 and you enter a single digit, decimal character, and optional decimal digit, the action taken depends on the units digit you enter. If it's between 0 and 3, it replaces the last digit of the pounds in the last entry, but if the digit is 4 or greater (which is invalid in a stones and pounds display), that digit replaces the two digit pounds field in the previous entry. This reduces the scribbling required if your weight happens to fluctuate around X stones 10. In addition, when the display unit is stones, you may enter two digits followed by the decimal character and an optional decimal digit to replace the pounds field of the last stones and pounds entry; you must enter the decimal character to distinguish the entry from one denoting an even number of stones. The examples in the table at the right should clarify how this works in practice. Thus you can enter the weight without having to first tap in the field. You can also open today's weight field for editing by tapping the "Today" button when no weight has been entered for the day. Exercise Ladder reference form, showing the daily exercises for your current rung. When you've completed the exercises, tap the "Record" button on that form to fill in today's rung field and return to the log form. Tap the Menu button to the left of the Graffiti area, drop down the View menu and tap the unit you wish: Kilograms, Pounds, or Stones.... |