MFlow  Create and maintain dynamic Web applications as easy and fast as console applications
Thou shall not write request handlers
 This release: 11/06/2014.  agocorona@gmail.com (@agocorona) <>< . issues & bugs .  Mflow Source code,     source code of this site




Using Amazon Web Services with TCache and the Rich Text editor


The code of this example is identical to any one for persistence in files that you can find here except the procedure  amazonSDBpersist that set the default persistence in Amazon simpleDB. It also shows how to edit HTML online with htmlEdit primitive, that creates a rich text editor out of a text input form. In this case, it is configured with bold and italic controls.

Here is the permanent link for the running example (This page)

http://mflowdemo.herokuapp.com/noscript/database

It also shows how to edit HTML with htmlEdit. It is a widget modifier that convert an input box or a  text box into a rich text editor 


Running example

(in the light red box):

list of all texts

How long have you lived here? seroquel price street It was former Prime Minister Ibrahim Boubacar Keita’s race to lose after winning nearly 40 percent of the first-round vote and receiving endorsements from almost all the other candidates. He faced former Finance Minister Soumaila Cisse, and results are expected by Friday.


I've got a full-time job cena viagra u beogradu Gregory Floyd, president of Teamsters Local 237, which represents 8,000 NYCHA workers who do some of these repairs, blamed the delay on Rhea, who implemented a computerized repair request system that Floyd said has slowed down response times considerably.


How would you like the money? fluoxetine hcl capsules side effects "Some of the likelihood of a September taper continues tostrengthen and you've also seen a lot of stable news coming outof the European zone. That may provide that window ofopportunity for the Fed to start in September," said SeanMurphy, a Treasuries trader at Societe Generale in New York.


I'd like to speak to someone about a mortgage best buy viagra generika online ThyssenKrupp tried to allay investors' concerns over itsfinancial strength, saying that even if banks cancelled thecredit line, which it said was unlikely, it would still haveenough liquidity to cover debt maturities.


Get a job genotropin pen 5 ndc "Today's order is really going to put some sunlight into the corners of the MCSO that have been such a problem in terms of people's civil rights. It's a great day," said Cecillia Wang, an American Civil Liberties Union lawyer who is representing the plaintiffs.


i'm fine good work filagra samples An unnamed member of Hodgson’s squad took umbrage at a joke he recited in an attempt to highlight the importance of new England star Andros Townsend to the team and which included the expression “feed the monkey”. The quip appeared to fall flat, something Hodgson quickly seemed to acknowledge by reassuring Townsend he had not intended to say anything inappropriate.


Photography prozac nation full movie watch online The suit attacks the investigative tactics MLB used in its year-long probe of the Biogenesis clinic and Rodriguez's alleged involvement in procuring performance-enhancing drugs from Bosch over at least a three-year period. Bosch is believed to have introduced evidence of email, text messages, with Rodriguez, detailing their transactions, as well as evidence that Bosch administered PEDs to Rodriguez.


I've come to collect a parcel amoxicillin clavulanate 1000 mg side effects Prices for 10-year German government debt were also steady with the yield around 1.83 percent, its highest since late June when hints the U.S. Federal Reserve was ready to cut back on its bond-buying program rocked financial markets.


A jiffy bag daily wellness fertility blend uk The government has tried to introduce legislation for "more effective regulation of import, manufacture, export, sale, transport, distribution and use of pesticides" but the bill has languished in parliament since 2008.


I'd like to order some foreign currency sildenafilo teva precios In Taiwan, nuclear power accounts for 18.4 percent ofelectricity production. In Japan it used to be about 30 percentbefore the 2011 earthquake and tsunami, while South Korea getsabout one-third of its electricity from nuclear powergeneration. (Additional reporting by Ju-min Park and Jane Chung in SEOUL;Writing by Ben Blanchard; Editing by Aaron Sheldrick and RajuGopalakrishnan)


Could you tell me my balance, please? promethazine codeine dosage erowid "We are in the middle of a massive turnaround in the UnitedStates and we want to carry on along this successful course. Weare prepared to spend more on high-value growth this year thanpreviously planned," said outgoing Chief Executive Rene Obermannin a statement.


This is your employment contract zyrexin nz Franke said Frontier, which offers flights to more than 80 cities in the United States, Costa Rica, the Dominican Republic, Jamaica, and Mexico, would expand to new markets based on demand, and added the airline would continue to be based in Denver.


The manager dianabol xt Another key difference: Maryland is a judicial state, meaning all foreclosures must be approved by the courts which inevitably slows the process. In Virginia, a non-judicial state, trustees arrange to repossess homes on their own.


Best Site Good Work cialis generika in der schweiz kaufen Although the Asiana crash was miraculous in many ways, sparing the lives of more than 300 on board the flight, Hyun is one of a group of critically injured passengers experiencing repercussions that will extend for months, perhaps years. bremelanotide blood pressure Lavern Wilkinson was the victim of horrific malpractice by Kings County Hospital in Brooklyn, N.Y., when doctors didn't tell her she had a lung nodule in 2010. By late 2012, it had grown into stage IV lung cancer that spread to her spine, liver and brain. She died March 7. retin-a 0.1 micro gel 20gm In June, a source close to Credit Suisse told Reuters it may sell part of its private bank in Germany, part of efforts to improve profits by focusing on the mega-rich rather than a larger 'mass affluent' client base. pristiq 400 PKP Cargo's net profit nearly halved in the first six monthsof the year to 77 million zlotys on 2.3 billion in revenue,year-on-year, mainly due to Poland's economic slowdown. Its coreprofit (earnings before interest, taxation, depreciation andamortisation) fell by a fifth to 312 million. recept keftaballetjes Two pioneers who helped bring sexuality into the light were William Masters and his colleague turned wife, Virginia Johnson, who became perhaps the '60s' unlikeliest icons. Following in the footsteps of Alfred Kinsey, who shocked America with his reports on what people actually did in the bedroom, this odd couple's trailblazing research showed what was happening to people's bodies when they did it.


real beauty page clindamycin phosphate topical gel 1 used The apparent revival of Japan’s fortunes come at an awkward moment for the BRICS. While Japan was overtaken by China three years ago, the would-be club of future superpowers is having its own problems right now: a real estate and credit bubble in China; decelerating growth, corruption and drift in India; labor violence, commodity price collapse and capital flight in South Africa; political unrest and central government bloat in Brazil; and a slow-but-steady sinking toward kleptocratic, oil-dependent autarky in Russia.


When can you start? rogaine foam costco canada Constantia Flexibles makes packaging for the food and drugssectors among others, and says it is the number two in Europeand number four in the world behind Australia's Amcor,and U.S. groups Bemis and Sealed Air Corp.


I've come to collect a parcel generic cozaar problems And while everyone who hates guns or is woefully delusional will believe that our military is the only reason we, Americans, have not been attacked by another country or countries, may find it interesting that the common law abiding citizens of the United States of America hold more firearms than all the branches of our military combined. generic clindamycin Even the 24-year old admitted he had been pressing lately. Sunday, however, that patience paid off. He got his first career hit with runners in scoring position and his first career walk-off hit in the 12th inning as the Mets overcame the Marlins, 1-0, at Citi Field. ibuprofen 600 nebenwirkungen alkohol Now she rolls through the hallways with the help of aides who also read materials to her and take her notes. Emily is still partly blind and can no longer read or write, but she spends her mornings in class and afternoons taking steps and working toward recovery in therapy. minoxidil zonder recept Peek-a-boo! When it comes to taking fashion risks, Halle Berry has never been one to shy away from a challenge. The 46-year-old actress, who is currently making the rounds promoting her new thriller "The Call," arrived to the set of "Jimmy Kimmel Live" wearing baggy grey pants and a revealing, sheer black sweater that showed off her beige bra underneath. cost imitrex walmart World Bank President Jim Yong Kimsaid the Federal Reserve’s decision to delay its tapering ofmonthly bond purchases creates an opportunity for developingnations to pursue fiscal reforms ahead of increases in interestrates.


enter a new text

exit to the home page

or press the back button or enter the URL any other page in the web site


Source code:

{-# LANGUAGE DeriveDataTypeable, RecordWildCards
           , OverloadedStrings, StandaloneDeriving
           , ScopedTypeVariables, CPP #-}
module Database where

import Data.Typeable
import Data.TCache.IndexQuery
import Data.TCache.DefaultPersistence
import Data.TCache.AWS
import Data.Monoid
import qualified Data.Text as T
import Data.String
import Data.ByteString.Lazy.Char8 hiding (index)


-- #define ALONE -- to execute it alone, uncomment this
#ifdef ALONE
import MFlow.Wai.Blaze.Html.All
main= do
  syncWrite  $ Asyncronous 120 defaultCheck  1000
  index idnumber
  runNavigation "" $ transientNav grid
#else
import MFlow.Wai.Blaze.Html.All hiding(select, page)
import Menu
#endif



-- to run it alone,  remove Menu.hs and uncomment this:

--askm= ask
--
--main= do
--  syncWrite  $ Asyncronous 120 defaultCheck  1000
--  index idnumber
--  runNavigation "" $ step database

data  MyData= MyData{idnumber :: Int, textdata :: T.Text} deriving (Typeable, Read, Show)  -- that is enough for file persistence
instance Indexable MyData where
   key=  show . idnumber    -- the key of the register


domain= "mflowdemo"

instance  Serializable MyData where
  serialize=  pack . show
  deserialize=  read . unpack
  setPersist =  const . Just $ amazonS3Persist domain -- False
 
data Options= NewText | Exit deriving (Show, Typeable)


     
database= do
     liftIO $ index idnumber
     database'


database'= do
     all <- allTexts

     r <- page $ listtexts all

     case r of
         NewText -> do
              text <- page $   p "Insert the text"
                           ++> htmlEdit ["bold","italic"] ""  -- rich text editor with bold and italic buttons
                                        (getMultilineText "" <! [("rows","3"),("cols","80")]) <++ br
                           <** submitButton "enter"

              addtext all text  -- store the name in the cache (later will be written to disk automatically)
              database' 

         Exit -> return ()
     where
     menu= wlink NewText   << p "enter a new text" <|>
           wlink Exit      << p "exit to the home page"

     listtexts all  =  do
           h3 "list of all texts"
           ++> mconcat[p $ preEscapedToHtml t >> hr | t <- all]
           ++> menu
           <++ b "or press the back button or enter the  URL any other page in the web site"

     addtext all text= liftIO . atomically . newDBRef $ MyData (Prelude.length all) text
     allTexts= liftIO . atomically . select textdata $ idnumber .>=. (0 :: Int)


comments powered by Disqus