packages feed

happs-tutorial-0.8: templates/introductiontomacid.st

<h3>Introduction To MACID</h3>
<p>For now we're going to step away from Happstack.Server and making web applications with Happstack.
Instead, we'll be talking about the persistant state system provided by Happstack.State: MACID.</p>

<p>MACID is the Happstack storage mechanism that allows you to use whatever data structure you want
   to hold your permanent data, without worrying about getting it into and out of tabular form
   fit for storage in a traditional <a href="http://en.wikipedia.org/wiki/Relational_database_management_system">rdbms</a>.

<p>Before delving into how it works let's learn a bit about it from an operational perspective. 
   Assuming you have the tutorial installed and running locally: 

<ul>
  <li>Register a new user with username "testuser" and password "testpassword"
  <li>Optionally, fill out profile information for your new test user, and/or make some job posts.
</ul>

<p>The data you entered is stored on your filesystem in a directory under your running executable, called <i>_local</i>.

<p>~/happs-tutorial>ls _local/happs-tutorial_state/
<br>current-0000000000  events-0000000000  events-0000000001  events-0000000002

<p>You can grep for it too.

<p>
thartman@thartman-laptop:~/happs-tutorial>grep -ra testuser _local
<br>_local/happs-tutorial_state/events-0000000000:ß\$6¡·¢:1525374391 696985193?AppState1.AddUsertestuser e1
       ... (and lots more lines of binary data)</p>

<p>Hm... let's see, can we be sneaky and grep for the password?</p>

<p>Try it, you can't. Because the password is stored as an md5 hash, out of respect for the privacy of your users.
   See the newUserPage function in <a href=/src/ControllerPostActions.hs>ControllerPostActions</a> if you're curious.</p>

<p>Now it's time for your <a href="/tutorial/yourfirstmacid">first application</a>.</p>