Safe HaskellNone

WaiLib

Description

The Module contains all the functions for haskellwebapp2

  • Use Aeson to serialize record to Json
  • Record: Person
  • Insert data to MySqlit-simple file-based database
  • Upload file to server.
  • Use Redis(memcached) to store snippet and query snippet.
  • *srcaronlib.js* is symbollink to *$bjslib/aronjs.js*
  • All Javascript functions are in *src/aronlib.js*
  • Use responseJavascript to send *src/aronlib.js* to client side.
Synopsis

Documentation

query_redis :: [Char] Source #

KEY: Say something

M-x openurl help: file://Usersaaamyfilebitbucketstackprojectjupyterlab/jupyterlab.html gx LibraryWebServerDocumentsxfidoimagefoldlistimage.jpg

pdfdir :: [Char] Source #

keyLastCmd :: String Source #

KEY: Last snippet command is stored in Redis database, last redis cmd

s2Text :: String -> Text Source #

data Block Source #

Constructors

Block 

Fields

Instances

Instances details
Show Block Source # 
Instance details

Defined in WaiLib

Methods

showsPrec :: Int -> Block -> ShowS

show :: Block -> String

showList :: [Block] -> ShowS

Generic Block Source # 
Instance details

Defined in WaiLib

Associated Types

type Rep Block :: Type -> Type

Methods

from :: Block -> Rep Block x

to :: Rep Block x -> Block

FromJSON Block Source # 
Instance details

Defined in WaiLib

Methods

parseJSON :: Value -> Parser Block

parseJSONList :: Value -> Parser [Block]

ToJSON Block Source # 
Instance details

Defined in WaiLib

Methods

toJSON :: Block -> Value

toEncoding :: Block -> Encoding

toJSONList :: [Block] -> Value

toEncodingList :: [Block] -> Encoding

type Rep Block Source # 
Instance details

Defined in WaiLib

type Rep Block = D1 ('MetaData "Block" "WaiLib" "main" 'False) (C1 ('MetaCons "Block" 'PrefixI 'True) (S1 ('MetaSel ('Just "bblock") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text])))

data MBlock Source #

Constructors

MBlock 

Fields

Instances

Instances details
Show MBlock Source # 
Instance details

Defined in WaiLib

Methods

showsPrec :: Int -> MBlock -> ShowS

show :: MBlock -> String

showList :: [MBlock] -> ShowS

Generic MBlock Source # 
Instance details

Defined in WaiLib

Associated Types

type Rep MBlock :: Type -> Type

Methods

from :: MBlock -> Rep MBlock x

to :: Rep MBlock x -> MBlock

FromJSON MBlock Source # 
Instance details

Defined in WaiLib

Methods

parseJSON :: Value -> Parser MBlock

parseJSONList :: Value -> Parser [MBlock]

ToJSON MBlock Source # 
Instance details

Defined in WaiLib

Methods

toJSON :: MBlock -> Value

toEncoding :: MBlock -> Encoding

toJSONList :: [MBlock] -> Value

toEncodingList :: [MBlock] -> Encoding

type Rep MBlock Source # 
Instance details

Defined in WaiLib

type Rep MBlock = D1 ('MetaData "MBlock" "WaiLib" "main" 'False) (C1 ('MetaCons "MBlock" 'PrefixI 'True) (S1 ('MetaSel ('Just "mblock") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Integer])))

data GeneMatrix Source #

Constructors

GeneMatrix 

Fields

Instances

Instances details
Show GeneMatrix Source # 
Instance details

Defined in WaiLib

Methods

showsPrec :: Int -> GeneMatrix -> ShowS

show :: GeneMatrix -> String

showList :: [GeneMatrix] -> ShowS

Generic GeneMatrix Source # 
Instance details

Defined in WaiLib

Associated Types

type Rep GeneMatrix :: Type -> Type

Methods

from :: GeneMatrix -> Rep GeneMatrix x

to :: Rep GeneMatrix x -> GeneMatrix

FromJSON GeneMatrix Source # 
Instance details

Defined in WaiLib

Methods

parseJSON :: Value -> Parser GeneMatrix

parseJSONList :: Value -> Parser [GeneMatrix]

ToJSON GeneMatrix Source # 
Instance details

Defined in WaiLib

Methods

toJSON :: GeneMatrix -> Value

toEncoding :: GeneMatrix -> Encoding

toJSONList :: [GeneMatrix] -> Value

toEncodingList :: [GeneMatrix] -> Encoding

type Rep GeneMatrix Source # 
Instance details

Defined in WaiLib

type Rep GeneMatrix = D1 ('MetaData "GeneMatrix" "WaiLib" "main" 'False) (C1 ('MetaCons "GeneMatrix" 'PrefixI 'True) (S1 ('MetaSel ('Just "cmd") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "ncol") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer) :*: S1 ('MetaSel ('Just "nrow") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer))))

data Bgcolor Source #

Constructors

Bgcolor 

Fields

Instances

Instances details
Show Bgcolor Source # 
Instance details

Defined in WaiLib

Methods

showsPrec :: Int -> Bgcolor -> ShowS

show :: Bgcolor -> String

showList :: [Bgcolor] -> ShowS

Generic Bgcolor Source # 
Instance details

Defined in WaiLib

Associated Types

type Rep Bgcolor :: Type -> Type

Methods

from :: Bgcolor -> Rep Bgcolor x

to :: Rep Bgcolor x -> Bgcolor

FromJSON Bgcolor Source # 
Instance details

Defined in WaiLib

Methods

parseJSON :: Value -> Parser Bgcolor

parseJSONList :: Value -> Parser [Bgcolor]

ToJSON Bgcolor Source # 
Instance details

Defined in WaiLib

Methods

toJSON :: Bgcolor -> Value

toEncoding :: Bgcolor -> Encoding

toJSONList :: [Bgcolor] -> Value

toEncodingList :: [Bgcolor] -> Encoding

type Rep Bgcolor Source # 
Instance details

Defined in WaiLib

type Rep Bgcolor = D1 ('MetaData "Bgcolor" "WaiLib" "main" 'False) (C1 ('MetaCons "Bgcolor" 'PrefixI 'True) (S1 ('MetaSel ('Just "colorname") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

data Textcolor Source #

Constructors

Textcolor 

Fields

Instances

Instances details
Show Textcolor Source # 
Instance details

Defined in WaiLib

Methods

showsPrec :: Int -> Textcolor -> ShowS

show :: Textcolor -> String

showList :: [Textcolor] -> ShowS

Generic Textcolor Source # 
Instance details

Defined in WaiLib

Associated Types

type Rep Textcolor :: Type -> Type

Methods

from :: Textcolor -> Rep Textcolor x

to :: Rep Textcolor x -> Textcolor

FromJSON Textcolor Source # 
Instance details

Defined in WaiLib

Methods

parseJSON :: Value -> Parser Textcolor

parseJSONList :: Value -> Parser [Textcolor]

ToJSON Textcolor Source # 
Instance details

Defined in WaiLib

Methods

toJSON :: Textcolor -> Value

toEncoding :: Textcolor -> Encoding

toJSONList :: [Textcolor] -> Value

toEncodingList :: [Textcolor] -> Encoding

type Rep Textcolor Source # 
Instance details

Defined in WaiLib

type Rep Textcolor = D1 ('MetaData "Textcolor" "WaiLib" "main" 'False) (C1 ('MetaCons "Textcolor" 'PrefixI 'True) (S1 ('MetaSel ('Just "textcolor") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

data User Source #

Constructors

User 

Fields

Instances

Instances details
Eq User Source # 
Instance details

Defined in WaiLib

Methods

(==) :: User -> User -> Bool

(/=) :: User -> User -> Bool

Read User Source # 
Instance details

Defined in WaiLib

Methods

readsPrec :: Int -> ReadS User

readList :: ReadS [User]

readPrec :: ReadPrec User

readListPrec :: ReadPrec [User]

Show User Source # 
Instance details

Defined in WaiLib

Methods

showsPrec :: Int -> User -> ShowS

show :: User -> String

showList :: [User] -> ShowS

FromRow User Source # 
Instance details

Defined in WaiLib

Methods

fromRow :: RowParser User

ToRow User Source # 
Instance details

Defined in WaiLib

Methods

toRow :: User -> [SQLData]

data Image Source #

Constructors

Image 

Fields

Instances

Instances details
Eq Image Source # 
Instance details

Defined in WaiLib

Methods

(==) :: Image -> Image -> Bool

(/=) :: Image -> Image -> Bool

Read Image Source # 
Instance details

Defined in WaiLib

Methods

readsPrec :: Int -> ReadS Image

readList :: ReadS [Image]

readPrec :: ReadPrec Image

readListPrec :: ReadPrec [Image]

Show Image Source # 
Instance details

Defined in WaiLib

Methods

showsPrec :: Int -> Image -> ShowS

show :: Image -> String

showList :: [Image] -> ShowS

FromRow Image Source # 
Instance details

Defined in WaiLib

Methods

fromRow :: RowParser Image

ToRow Image Source # 
Instance details

Defined in WaiLib

Methods

toRow :: Image -> [SQLData]

data TodoItem Source #

Constructors

TodoItem 

Fields

Instances

Instances details
Eq TodoItem Source # 
Instance details

Defined in WaiLib

Methods

(==) :: TodoItem -> TodoItem -> Bool

(/=) :: TodoItem -> TodoItem -> Bool

Read TodoItem Source # 
Instance details

Defined in WaiLib

Methods

readsPrec :: Int -> ReadS TodoItem

readList :: ReadS [TodoItem]

readPrec :: ReadPrec TodoItem

readListPrec :: ReadPrec [TodoItem]

Show TodoItem Source # 
Instance details

Defined in WaiLib

Methods

showsPrec :: Int -> TodoItem -> ShowS

show :: TodoItem -> String

showList :: [TodoItem] -> ShowS

Generic TodoItem Source # 
Instance details

Defined in WaiLib

Associated Types

type Rep TodoItem :: Type -> Type

Methods

from :: TodoItem -> Rep TodoItem x

to :: Rep TodoItem x -> TodoItem

FromJSON TodoItem Source # 
Instance details

Defined in WaiLib

Methods

parseJSON :: Value -> Parser TodoItem

parseJSONList :: Value -> Parser [TodoItem]

ToJSON TodoItem Source # 
Instance details

Defined in WaiLib

Methods

toJSON :: TodoItem -> Value

toEncoding :: TodoItem -> Encoding

toJSONList :: [TodoItem] -> Value

toEncodingList :: [TodoItem] -> Encoding

type Rep TodoItem Source # 
Instance details

Defined in WaiLib

type Rep TodoItem = D1 ('MetaData "TodoItem" "WaiLib" "main" 'False) (C1 ('MetaCons "TodoItem" 'PrefixI 'True) (S1 ('MetaSel ('Just "todoId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64) :*: (S1 ('MetaSel ('Just "keyItem") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "todoItem") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))))

data TodoReply Source #

Constructors

TodoReply 

Fields

Instances

Instances details
Show TodoReply Source # 
Instance details

Defined in WaiLib

Methods

showsPrec :: Int -> TodoReply -> ShowS

show :: TodoReply -> String

showList :: [TodoReply] -> ShowS

Generic TodoReply Source # 
Instance details

Defined in WaiLib

Associated Types

type Rep TodoReply :: Type -> Type

Methods

from :: TodoReply -> Rep TodoReply x

to :: Rep TodoReply x -> TodoReply

FromJSON TodoReply Source # 
Instance details

Defined in WaiLib

Methods

parseJSON :: Value -> Parser TodoReply

parseJSONList :: Value -> Parser [TodoReply]

ToJSON TodoReply Source # 
Instance details

Defined in WaiLib

Methods

toJSON :: TodoReply -> Value

toEncoding :: TodoReply -> Encoding

toJSONList :: [TodoReply] -> Value

toEncodingList :: [TodoReply] -> Encoding

type Rep TodoReply Source # 
Instance details

Defined in WaiLib

type Rep TodoReply = D1 ('MetaData "TodoReply" "WaiLib" "main" 'False) (C1 ('MetaCons "TodoReply" 'PrefixI 'True) (S1 ('MetaSel ('Just "cmdReply") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

data CompileCode Source #

Constructors

CompileCode 

Fields

Instances

Instances details
Show CompileCode Source # 
Instance details

Defined in WaiLib

Methods

showsPrec :: Int -> CompileCode -> ShowS

show :: CompileCode -> String

showList :: [CompileCode] -> ShowS

Generic CompileCode Source # 
Instance details

Defined in WaiLib

Associated Types

type Rep CompileCode :: Type -> Type

Methods

from :: CompileCode -> Rep CompileCode x

to :: Rep CompileCode x -> CompileCode

FromJSON CompileCode Source # 
Instance details

Defined in WaiLib

Methods

parseJSON :: Value -> Parser CompileCode

parseJSONList :: Value -> Parser [CompileCode]

ToJSON CompileCode Source # 
Instance details

Defined in WaiLib

Methods

toJSON :: CompileCode -> Value

toEncoding :: CompileCode -> Encoding

toJSONList :: [CompileCode] -> Value

toEncodingList :: [CompileCode] -> Encoding

type Rep CompileCode Source # 
Instance details

Defined in WaiLib

type Rep CompileCode = D1 ('MetaData "CompileCode" "WaiLib" "main" 'False) (C1 ('MetaCons "CompileCode" 'PrefixI 'True) (S1 ('MetaSel ('Just "compiler") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "option") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "code") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))))

data MatInt Source #

Constructors

MatInt 

Fields

Instances

Instances details
Show MatInt Source # 
Instance details

Defined in WaiLib

Methods

showsPrec :: Int -> MatInt -> ShowS

show :: MatInt -> String

showList :: [MatInt] -> ShowS

Generic MatInt Source # 
Instance details

Defined in WaiLib

Associated Types

type Rep MatInt :: Type -> Type

Methods

from :: MatInt -> Rep MatInt x

to :: Rep MatInt x -> MatInt

FromJSON MatInt Source # 
Instance details

Defined in WaiLib

Methods

parseJSON :: Value -> Parser MatInt

parseJSONList :: Value -> Parser [MatInt]

ToJSON MatInt Source # 
Instance details

Defined in WaiLib

Methods

toJSON :: MatInt -> Value

toEncoding :: MatInt -> Encoding

toJSONList :: [MatInt] -> Value

toEncodingList :: [MatInt] -> Encoding

type Rep MatInt Source # 
Instance details

Defined in WaiLib

type Rep MatInt = D1 ('MetaData "MatInt" "WaiLib" "main" 'False) (C1 ('MetaCons "MatInt" 'PrefixI 'True) (S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "matrix") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [[Integer]])))

data SnippetJSON Source #

Constructors

SnippetJSON 

Fields

Instances

Instances details
Show SnippetJSON Source # 
Instance details

Defined in WaiLib

Methods

showsPrec :: Int -> SnippetJSON -> ShowS

show :: SnippetJSON -> String

showList :: [SnippetJSON] -> ShowS

Generic SnippetJSON Source # 
Instance details

Defined in WaiLib

Associated Types

type Rep SnippetJSON :: Type -> Type

Methods

from :: SnippetJSON -> Rep SnippetJSON x

to :: Rep SnippetJSON x -> SnippetJSON

FromJSON SnippetJSON Source # 
Instance details

Defined in WaiLib

Methods

parseJSON :: Value -> Parser SnippetJSON

parseJSONList :: Value -> Parser [SnippetJSON]

ToJSON SnippetJSON Source # 
Instance details

Defined in WaiLib

Methods

toJSON :: SnippetJSON -> Value

toEncoding :: SnippetJSON -> Encoding

toJSONList :: [SnippetJSON] -> Value

toEncodingList :: [SnippetJSON] -> Encoding

type Rep SnippetJSON Source # 
Instance details

Defined in WaiLib

type Rep SnippetJSON = D1 ('MetaData "SnippetJSON" "WaiLib" "main" 'False) (C1 ('MetaCons "SnippetJSON" 'PrefixI 'True) (S1 ('MetaSel ('Just "pidls") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Integer]) :*: (S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "snippet") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [[String]]))))

data HTMLTable Source #

Constructors

HTMLTable 

Fields

Instances

Instances details
Show HTMLTable Source # 
Instance details

Defined in WaiLib

Methods

showsPrec :: Int -> HTMLTable -> ShowS

show :: HTMLTable -> String

showList :: [HTMLTable] -> ShowS

Generic HTMLTable Source # 
Instance details

Defined in WaiLib

Associated Types

type Rep HTMLTable :: Type -> Type

Methods

from :: HTMLTable -> Rep HTMLTable x

to :: Rep HTMLTable x -> HTMLTable

FromJSON HTMLTable Source # 
Instance details

Defined in WaiLib

Methods

parseJSON :: Value -> Parser HTMLTable

parseJSONList :: Value -> Parser [HTMLTable]

ToJSON HTMLTable Source # 
Instance details

Defined in WaiLib

Methods

toJSON :: HTMLTable -> Value

toEncoding :: HTMLTable -> Encoding

toJSONList :: [HTMLTable] -> Value

toEncodingList :: [HTMLTable] -> Encoding

type Rep HTMLTable Source # 
Instance details

Defined in WaiLib

type Rep HTMLTable = D1 ('MetaData "HTMLTable" "WaiLib" "main" 'False) (C1 ('MetaCons "HTMLTable" 'PrefixI 'True) (S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "matrix") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text])))

data PreColor Source #

Constructors

PreColor 

Fields

Instances

Instances details
Show PreColor Source # 
Instance details

Defined in WaiLib

Methods

showsPrec :: Int -> PreColor -> ShowS

show :: PreColor -> String

showList :: [PreColor] -> ShowS

Generic PreColor Source # 
Instance details

Defined in WaiLib

Associated Types

type Rep PreColor :: Type -> Type

Methods

from :: PreColor -> Rep PreColor x

to :: Rep PreColor x -> PreColor

FromJSON PreColor Source # 
Instance details

Defined in WaiLib

Methods

parseJSON :: Value -> Parser PreColor

parseJSONList :: Value -> Parser [PreColor]

ToJSON PreColor Source # 
Instance details

Defined in WaiLib

Methods

toJSON :: PreColor -> Value

toEncoding :: PreColor -> Encoding

toJSONList :: [PreColor] -> Value

toEncodingList :: [PreColor] -> Encoding

type Rep PreColor Source # 
Instance details

Defined in WaiLib

type Rep PreColor = D1 ('MetaData "PreColor" "WaiLib" "main" 'False) (C1 ('MetaCons "PreColor" 'PrefixI 'True) (S1 ('MetaSel ('Just "color") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "background") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

data Person Source #

Person to Json object

Constructors

Person 

Fields

Instances

Instances details
Eq Person Source # 
Instance details

Defined in WaiLib

Methods

(==) :: Person -> Person -> Bool

(/=) :: Person -> Person -> Bool

Read Person Source # 
Instance details

Defined in WaiLib

Methods

readsPrec :: Int -> ReadS Person

readList :: ReadS [Person]

readPrec :: ReadPrec Person

readListPrec :: ReadPrec [Person]

Show Person Source # 
Instance details

Defined in WaiLib

Methods

showsPrec :: Int -> Person -> ShowS

show :: Person -> String

showList :: [Person] -> ShowS

FromRow Person Source # 
Instance details

Defined in WaiLib

Methods

fromRow :: RowParser Person

ToRow Person Source # 
Instance details

Defined in WaiLib

Methods

toRow :: Person -> [SQLData]

data UserInput Source #

define record for all the code blocks can not define [TS.Text] => sqlite3 does not support [TS.Text] data CodeBlock = CodeBlock { codeblockId :: Int64 , header :: TS.Text , codeblock :: TS.Text } deriving (Eq, Read, Show)

Create UserInput table in Sqlite

  • login database
  • sqite3 Usersaaamyfilebitbuckettestfileuserinput.db
  • cmdId = pid
  • xcmd = input command, e.g. "c ls"

Constructors

UserInput 

Fields

Instances

Instances details
Eq UserInput Source # 
Instance details

Defined in WaiLib

Methods

(==) :: UserInput -> UserInput -> Bool

(/=) :: UserInput -> UserInput -> Bool

Read UserInput Source # 
Instance details

Defined in WaiLib

Methods

readsPrec :: Int -> ReadS UserInput

readList :: ReadS [UserInput]

readPrec :: ReadPrec UserInput

readListPrec :: ReadPrec [UserInput]

Show UserInput Source # 
Instance details

Defined in WaiLib

Methods

showsPrec :: Int -> UserInput -> ShowS

show :: UserInput -> String

showList :: [UserInput] -> ShowS

FromRow UserInput Source # 
Instance details

Defined in WaiLib

Methods

fromRow :: RowParser UserInput

ToRow UserInput Source # 
Instance details

Defined in WaiLib

Methods

toRow :: UserInput -> [SQLData]

updir :: String Source #

dbname :: [Char] Source #

configFile :: FilePath Source #

lookupJust :: (Eq k, Hashable k) => k -> HashMap k a -> a Source #

confMap :: FilePath -> IO (HashMap String String) Source #

getHostName :: IO String Source #

getRootDirFull :: IO String Source #

KEY: get the full rootdir

     "Usersaaamyfilebitbucket/haskellwebapp2"
     "Usersaaamyfilemybin/haskellwebapp2Bin"
   

styleChar :: String -> String -> Char -> Char -> String -> String Source #

href :: String -> String -> String -> String Source #

  • ------------------------------------------------------------------------------- | Thu Nov 15 13:18:04 2018 | Simple web server for request and response | Handle search code snippet | -------------------------------------------------------------------------------- run.sh => ./wai ghc -i$bhaskelllib --make wai.hs -o wai

changeSymbol :: String -> String Source #

listToByteStr :: [[String]] -> ByteString Source #

Convert [[String]] to ByteString

cssStrong :: String -> String Source #

cssHead :: [[String]] -> [[String]] Source #

htmlLess :: [[String]] -> [[String]] Source #

htmlGreater :: [[String]] -> [[String]] Source #

keyWord :: [[String]] -> [[String]] Source #

redisGetLastCmd :: String -> IO String Source #

aplSymbol :: [[String]] -> [[String]] Source #

KEY: apl symbol

DATE: Monday, 24 July 2023 16:42 PDT

APL symbol SEE: UsersaaamyfilebitbucketpublicfileaplSymbol.txt -- FIXED: Remove / from apl code in order to fix URL format -- Unicode code point: 9017 0x2339 ⌹ -- https://unicodeplus.com/U+2339 -- putStrLn "9017"

keyWord1 :: [[String]] -> [[String]] Source #

keyDash :: [[String]] -> [[String]] Source #

keySymbol1 :: [[String]] -> [[String]] Source #

keyName :: [[String]] -> [[String]] Source #

specialName :: [[String]] -> [[String]] Source #

javaClassName :: [[String]] -> [[String]] Source #

javaFunClass :: [[String]] -> [[String]] Source #

javaKeyWords :: [[String]] -> [[String]] Source #

javaCmdKeyWords :: [[String]] -> [[String]] Source #

mysqlKeyWords :: [[String]] -> [[String]] Source #

keyURL :: [[String]] -> [[String]] Source #

spChar :: [[String]] -> [[String]] Source #

bracketChar :: [[String]] -> [[String]] Source #

sbChar :: [[String]] -> [[String]] Source #

transformX :: [[String]] -> [[String]] Source #

wsApp :: ServerApp Source #

type Client = (Int, Connection) Source #

broadcast :: Text -> [Client] -> IO () Source #

addClient :: Connection -> [Client] -> ([Client], Int) Source #

removeClient :: Int -> [Client] -> ([Client], ()) Source #

chat :: IORef [Client] -> ServerApp Source #

alternateLineColor2 :: [CSSPro] -> [[String]] -> [[String]] Source #

Fake optional parameter

alternateLineColor2 []
alternateLineColor2 [("background", "green"), ("background", "cyan")]

blockId :: Integer -> String Source #

svgIconAdd :: String Source #

hiddenForm2 :: Integer -> String -> String Source #

Hide all the data in TextArea

  • IN USE
   action="serverFun.hs" name="someName" method="POST"
   id="ttId" class="text" cols="86" rows ="20" name="textName"/textarea

   type="submit" value="Email" class="submitButton"
   /form

   cols="20" rows="20" id="textArea" style="display:none;font-size:18px;" class="hide"/textarea

   autofocus="true" onfocus="textAreaAdjust(this);"/textarea
   

We update the codeblock according to "header"(use ID?)

TODO1: use Ajax to update codeblock in database See aronlib.js requestPreFromRedis

   data CodeBlock = 
   CodeBlock 
   { id        :: Int64
   , header    :: TS.Text
   , codeblock :: TS.Text
   } deriving (Eq, Read, Show)
   

pid => id => from CodeBlock table from sqlite3

:DATE: 26-10-2020 :NOTE: USE IT NOW ✅ :FIXME: Click hide/show DOES NOT WORK, the click location is off :IMG: file://Usersaaamyfilebitbucketimageclickhide.png

foldListList :: ([[String]] -> [[String]]) -> [[String]] -> String Source #

KEY:

    In Java
    Function f = x -> x + 1
    BiFunction f = (x, y) -> x + y
    
    
    foldr(x y -> [div] ++ x ++ [cdiv] ++ brr + y) (0, []) zhtml
    
    The id can be used to for TextArea editor
    e.g.
     onclick="editfun()"/TextArea
    
    script
    function editfun(){
    
    }
    
    /script
    
    See file gf: UsersaaamyfilebitbuckethtmlshowTextAreaOnClick.html
    
    id="3" style="kk" code1 /div 
    id="4" style="kk" code2 /div 
    
    ([[String]] -> [[String]]) 
    stylish allBlock

    Mon Dec  2 12:55:08 2019 
    Fixex issue inside 'stylish allBlock', apply br to stylish allBlock instead of zhtml

    TODO1
    foldListList ::([([String], Integer)]->[([String], Integer)])->[([String], Integer)]->String

   DATE: Mon 28 Nov 18:50:38 2022 
   NOTE: USE IT NOW
   

foldListList2 :: ([[String]] -> [[String]]) -> [([String], Integer, Integer, Integer)] -> String Source #

  [([String], Integer, Integer,  Integer)]
  [(codeBody, pid,      addedtime, score)]

  [
    ( [ "line2" ]         -- [String]
    , 4                   -- pid
    , 8                   -- addedtime
    , 3                   -- score
    )
  ]

  [
       ( "23423"
       ,
           [
               (
                   [ "23423:*:what0000"   -- [String]
                   , "line 4"             
                   ]
               , 117                      -- table pid
               , 1635398867               -- addedtime
               , 33                       -- score
               )
           ,
               (
                   [ "23423:*:test"
                   , "line1000"
                   ]
               , 113
               , 1635380323
               , 0
               )
           ]
       )
   ,
       ( "updat"
       ,
           [
               (
                   [ "test:*: test10, ok, update444"
                   , " line dogcat"
                   , "fac ← {⍵ > 1 : ⍵×fac ⍵ - 1 ⋄ 1}"
                   , "nice"
                   , "update"
                   , "line444"
                   , "line555"
                   ]
               , 35
               , 1635399200
               , 8
               )
           ]
       )
   ]


  

myfun :: Text -> Text Source #

fun4 :: Text -> String Source #

foldListListTxt :: [[String]] -> String Source #

foldListListTxt2 :: [([String], Integer, Integer, Integer)] -> String Source #

pdfname :: String Source #

img :: String Source #

pdfPath :: [Char] Source #

docRoot :: [Char] Source #

doc :: FilePath Source #

cmdLog :: [Char] Source #

currCmdFile :: FilePath Source #

logCurrCmd :: [String] -> IO () Source #

readCurrCmd :: IO String Source #

type HMap2 = HashMap String [([String], Integer, Integer, Integer)] Source #

([String
, Integer, Integer, Integer)]
(codeBody, pid, addedtime, score)
↓ ↓ ↓ ↓

type PDFMap = HashMap String String Source #

type RespMap = HashMap String String Source #

genePDF :: String -> IO () Source #

app2 :: Connection -> IORef HMap2 -> IORef PDFMap -> RespMap -> Application Source #

Main Application entry

   type Application = Request -> (Response -> IO ResponseReceived) -> IO ResponseReceived
   
  • Add *src/aronlib.js* as *Javascript* library which includes all javascript functions
  • Copy to clipboard still not working so far.

Here_is_Why

:NOTE: USE IT

resourceList :: IO [(String, String)] Source #

NOTE: USE in main.hs

plainIndex :: Response Source #

pdfFile :: Response Source #

sendPDF :: FilePath -> FilePath -> Response Source #

Send pdf file to browser

sendImage :: FilePath -> FilePath -> Response Source #

Send png file, image file to browser

pdfSentX :: ByteString -> Response Source #

insertinfo :: Response Source #

insertUser :: Response Source #

loginHtml :: Response Source #

htmlfetchjson :: Response Source #

searchUI :: Response Source #

notFound :: Response Source #

notFoundStr :: ByteString -> Response Source #

snippetP :: [Char] Source #

mapClear2 :: [String] -> HMap2 -> HMap2 Source #

insertAll2 :: [(String, [([String], Integer, Integer, Integer)])] -> HMap2 -> HMap2 Source #

insertAppend2 :: String -> [([String], Integer, Integer, Integer)] -> HMap2 -> HMap2 Source #

listToPrefixMap :: [([String], ([String], Integer, Integer, Integer))] -> IORef HMap2 -> IO () Source #

Generate HMap2 from a list of codeblock

Data HMap2 = M.HashMap String [([String], Integer, Integer, Integer)]

spanBlockX1 :: ([[String]] -> [[String]]) -> HMap2 -> Maybe ByteString -> String Source #

spanBlockFunc :: ([[String]] -> [[String]]) -> [[String]] -> String Source #

spanBlockXX2 :: HMap2 -> Maybe ByteString -> String Source #

(∘) :: [a] -> [a] -> [a] Source #

htmlPre :: String -> String Source #

replyHtml :: String -> String -> String Source #

User input, autocomplete, search field

anyRoute2 :: Connection -> IORef HMap2 -> Request -> Response Source #

snippet?id=queryStr S8.unpack: ByteString to String type Application = Request -> (Response -> IO ResponseReceived) -> IO ResponseReceived anyRoute => Response

:NOTE: Use

getQueryString :: ByteString -> Request -> Maybe ByteString Source #

responseFromCmd :: Connection -> IORef HMap2 -> Maybe String -> Response Source #

uploadPage :: Response Source #

http://localhost:8000/up/ | NOTE: file => /upload dir | Plz see uploadPage.html | Usersaaamyfilebitbuckethaskellwebapp2uploadPage.html | responseFile :: H.Status -> H.ResponseHeaders -> FilePath -> Maybe FilePart -> Response

readCmd :: FilePath -> SearchType -> IO String Source #

groupCountFilter :: [String] -> [String] Source #

Filter some commands out from a list.

optionHtml :: [String] -> String Source #

responseNothing :: String -> Response Source #

responseNothingBS :: ByteString -> Response Source #

responseJSON :: ToJSON a => a -> Response Source #

Response JSON record to client side

responseJSONBS :: ByteString -> Response Source #

replyTaskHtml :: ByteString -> ByteString -> ByteString Source #

listPage :: Connection -> Application Source #

responseTaskBS :: ByteString -> Response Source #

responseCmd :: Connection -> String -> Response Source #

Response output from shell command

  1. The maximum number of lines are 200, " | head -200"
  1. Exit code can not be checked, ExitSuccess

Wed May 8 23:10:41 2019 3 Error can be checked in stderr >(e, so, si) <- A.runSh $ toSText (drop 2 ncmd) > if si is NOT empty then there is stderr

type streamBody = (Builder -> IO()) -> IO() -> IO()

queryUserInput :: Connection -> String -> IO [String] Source #

responseJavaHtml :: String -> Response Source #

responseGenePDFHtml :: Connection -> Response Source #

Html table contains png/pdf file gallery

responseHaskellHtml :: String -> Response Source #

queryRedisSnippet :: String -> Response Source #

ghcidRun :: Ghci -> String -> Response Source #

Run ghci_stack.sh as a process, return some info

queryLibHaskell :: String -> Response Source #

query function info from redis without Html

query_redis = "$HOME/myfile/symbin/RedisQuery "
preKey = "AronModule."  AronModule.hs
preKey = "Aron."        Aron.java

queryLibCpp :: String -> Response Source #

queryLibJava :: String -> Response Source #

Should use queryLibJavaPackage

NOT BEEN USED

queryLibJavaPackage :: String -> String -> Response Source #

Get java $jlib/AronLib.java without HTML

responseSearch :: Connection -> String -> Response Source #

Get user input: cmd = "s java regex", autocomplete commands

TODO1 add host name here name <- run "uname" ls run "uname">= x -> if len x > 0 then return head x else []

:NOTE: USE in anyRoute2

  data Response
      = ResponseFile H.Status H.ResponseHeaders FilePath (Maybe FilePart)
      | ResponseBuilder H.Status H.ResponseHeaders Builder
      | ResponseStream H.Status H.ResponseHeaders StreamingBody
      | ResponseRaw (IO B.ByteString -> (B.ByteString -> IO ()) -> IO ()) Response
    deriving Typeable

  responseStream::Status -> ResponseHeaders -> StreamingBody -> Response
  type StreamingBody = ( Builder -> IO() ) -> IO () -> IO ()
  

searchMainHtml :: [String] -> String -> IO ByteString Source #

responseSnippetHTML2 :: Connection -> String -> IORef HMap2 -> Response Source #

Get user input: cmd = "s java regex", autocomplete commands

  1. remove spaces from cmd
  2. insert cmd to table: userinput if userinput exists, otherwise create table: userinput
  3. sorted all cmd and create Html form with all cmd
  4. create Html output from cmd query.

    + store user input commands, autocomplete commands in a table: userinput + if table does not exist, create one, otherwise insert data to table: userinput + autocomplete, query commands from sqlite table

  1. No Search field, only query blocks data

:NOTE: USE in anyRoute2

REFNOTE: Usersaaamyfilebitbucketpublicfilenotdelete/codeblock.hs

XXX

responseSnippetTxt2 :: String -> IORef HMap2 -> Response Source #

Query snippet from HMap2 without Html

:NOTE: USE in anyRoute2

cmd -> "n emacs"

responseSnippetJSON :: String -> IORef HMap2 -> Response Source #

KEY: json snippet, json codeblock

 SEE: $j/HttpRequestJson.java
      $scr/sj.sh

geneRectMat :: Application Source #

Generate matrix from Json javascript XMLHttpRequest

     MatInt{name="", matrix=[]}
   

geneHTMLTable :: Application Source #

Generate HTML Table

getPreFromRedis :: Application Source #

Get text color and background color from Redis

  • The function will be called from Ajax in aronlib.js
  • Click on the background/color => make a Ajax call
        ("getcolor":_)        -> getPreFromRedis request respond -- Send JSON PreColor{color::TS.Text, background::TS.Text} to client side, in aronlib.js
       
aronlib.js => Ajax => getPreFromRedis
getPreStyle::IO [(String, String)]
  • send JSON to client
data PreColor = PreColor{color::TS.Text, background::TS.Text}
redis-cli
keys 'HTMLPre.color'
keys 'HTMLPre.background-color'

updateCodeBlock :: Connection -> IORef HMap2 -> Application Source #

KEY: Update snippet from client side

  • Need pid from client side

SEE: hiddenForm2 @ Post method action="/update" name="Update" class="hf" id="f123" method="POST"

  • - In AronModule.hs data UpdateCodeBlock = UpdateCodeBlock{pid::Integer, newcode::String, begt::Integer, endt::Integer} deriving (GEN.Generic, Show) ↑ + -> Primary Key in TABLE: CodeBlock

Duplicate row id = pid, and set show=0 @

validateFormat :: String -> String -> (Bool, String) Source #

KEY: validate snippet format and padding

  • Check whether the input data is valid format
  • At least two lines
  • First line: a:b:c
   snippet:*: code
   line 1

   a:b:c len ["a", "b", "c"] > 2


   Input:
   dog, cat pig
   line 1

   Padding:
   314:*:dog, cat pig
   line 1
  
   

insertCodeBlock :: Connection -> IORef HMap2 -> Application Source #

KEY: insert code block, insert code to database, update prefix map

  • It supports command line and Emacs
   

data EditorCode Source #

Constructors

EditorCode 

Fields

Instances

Instances details
Show EditorCode Source # 
Instance details

Defined in WaiLib

Methods

showsPrec :: Int -> EditorCode -> ShowS

show :: EditorCode -> String

showList :: [EditorCode] -> ShowS

Generic EditorCode Source # 
Instance details

Defined in WaiLib

Associated Types

type Rep EditorCode :: Type -> Type

Methods

from :: EditorCode -> Rep EditorCode x

to :: Rep EditorCode x -> EditorCode

FromJSON EditorCode Source # 
Instance details

Defined in WaiLib

Methods

parseJSON :: Value -> Parser EditorCode

parseJSONList :: Value -> Parser [EditorCode]

ToJSON EditorCode Source # 
Instance details

Defined in WaiLib

Methods

toJSON :: EditorCode -> Value

toEncoding :: EditorCode -> Encoding

toJSONList :: [EditorCode] -> Value

toEncodingList :: [EditorCode] -> Encoding

type Rep EditorCode Source # 
Instance details

Defined in WaiLib

type Rep EditorCode = D1 ('MetaData "EditorCode" "WaiLib" "main" 'False) (C1 ('MetaCons "EditorCode" 'PrefixI 'True) ((S1 ('MetaSel ('Just "editorbeg") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer) :*: (S1 ('MetaSel ('Just "editorend") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer) :*: S1 ('MetaSel ('Just "editorfile") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))) :*: ((S1 ('MetaSel ('Just "editorcmd") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "editorcode") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :*: (S1 ('MetaSel ('Just "editortheme") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "editormode") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))))

data EditorCodeReply Source #

Constructors

EditorCodeReply 

Fields

Instances

Instances details
Show EditorCodeReply Source # 
Instance details

Defined in WaiLib

Methods

showsPrec :: Int -> EditorCodeReply -> ShowS

show :: EditorCodeReply -> String

showList :: [EditorCodeReply] -> ShowS

Generic EditorCodeReply Source # 
Instance details

Defined in WaiLib

Associated Types

type Rep EditorCodeReply :: Type -> Type

FromJSON EditorCodeReply Source # 
Instance details

Defined in WaiLib

Methods

parseJSON :: Value -> Parser EditorCodeReply

parseJSONList :: Value -> Parser [EditorCodeReply]

ToJSON EditorCodeReply Source # 
Instance details

Defined in WaiLib

Methods

toJSON :: EditorCodeReply -> Value

toEncoding :: EditorCodeReply -> Encoding

toJSONList :: [EditorCodeReply] -> Value

toEncodingList :: [EditorCodeReply] -> Encoding

type Rep EditorCodeReply Source # 
Instance details

Defined in WaiLib

type Rep EditorCodeReply = D1 ('MetaData "EditorCodeReply" "WaiLib" "main" 'False) (C1 ('MetaCons "EditorCodeReply" 'PrefixI 'True) ((S1 ('MetaSel ('Just "replybeg") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer) :*: (S1 ('MetaSel ('Just "replyend") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer) :*: S1 ('MetaSel ('Just "ret") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))) :*: ((S1 ('MetaSel ('Just "replydata") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "replyfname") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :*: (S1 ('MetaSel ('Just "replytheme") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "replymode") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))))

type MyLens a b = (a -> b, b -> a -> a) Source #

getL :: MyLens a b -> a -> b Source #

setL :: MyLens a b -> b -> a -> a Source #

modL :: MyLens a b -> (b -> b) -> a -> a Source #

(^=) :: MyLens a b -> b -> a -> a Source #

data ProcLatex Source #

Constructors

ProcLatex 

Fields

Instances

Instances details
Show ProcLatex Source # 
Instance details

Defined in WaiLib

Methods

showsPrec :: Int -> ProcLatex -> ShowS

show :: ProcLatex -> String

showList :: [ProcLatex] -> ShowS

myloop :: String -> IO Int Source #

loopDelay :: Int -> String -> IO Int Source #

runOnExternalProgram :: String -> Int -> String -> FilePath -> IO (Either String String) Source #

↓ ↓ ↓ ↓

data LatexFilePath Source #

Constructors

LatexFilePath 

Fields

Instances

Instances details
Show LatexFilePath Source # 
Instance details

Defined in WaiLib

Methods

showsPrec :: Int -> LatexFilePath -> ShowS

show :: LatexFilePath -> String

showList :: [LatexFilePath] -> ShowS

Generic LatexFilePath Source # 
Instance details

Defined in WaiLib

Associated Types

type Rep LatexFilePath :: Type -> Type

type Rep LatexFilePath Source # 
Instance details

Defined in WaiLib

type Rep LatexFilePath = D1 ('MetaData "LatexFilePath" "WaiLib" "main" 'False) (C1 ('MetaCons "LatexFilePath" 'PrefixI 'True) (S1 ('MetaSel ('Just "xHtmlPath") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: (S1 ('MetaSel ('Just "xLatexPath") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "xPDFPath") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))))

randomName :: IO String Source #

data EFileType Source #

Constructors

EHTML 
EPDF 
EJSON 

datadirFull :: String -> EFileType -> IO String Source #

KEY:

TODO: add root directory config file?

  configFile = "./config.txt"
  data EFileType = EHTML | EPDF | EJSON
  

todoPostJSON :: Connection -> IORef HMap2 -> Application Source #

KEY: todo end point, todo app

receiveEditorData :: Connection -> IORef HMap2 -> IORef PDFMap -> Application Source #

click on "compile" goto aronlib.js getElementsById("editor") get latex source code form JSON object => "compile" => latex source code send to Server

Server Side: ("editordata") -> receiveEditorData decode JSON object => "compile" => latex source code => write latex source code to file $b/"latex.tex" => pass path $b/latex.tex to runOnExternalProgram pdflatex compile latex.tex => latex.pdf Either (String String) <= return from runOnExternalProgram

Response to Client side in JSON => ret => True => Compile => OK ret => False => Compile => Error => On Client side aronlib.js => If ret == True

respondMatrix :: Connection -> IORef HMap2 -> Application Source #

commandService :: Connection -> IORef HMap2 -> Application Source #

data CommandService = CommandService{cmdServ::String, paramArg::String, inputData::String} deriving (Generic, Show) instance DA.FromJSON CommandService instance DA.ToJSON CommandService where toEncoding = DA.genericToEncoding DA.defaultOptions

KEY: support services from outside browser

   case 1:
      cmdStr = "alignment"
      cmdParam = "="

      a = b
       c  =d
      e = f
        ⇓
      a = b
      c = d
      e = f

   case 2: use space as delimter
      cmdStr = "alignment"
      cmdParam = ""

      a  b
       c  d
      e  f
        ⇓
      a b
      c d
      e f

    Emacs Copy Selected Region
         |
         ↓
    Write to $btmpx.x
         |
         ↓
    Read $btmpx.x
    Http Request => [Send Json]
    $sym/RequestJson  alignment
         |
         ↓
    commandService [Receive Json]
         |
         + → alignment ($btmpx.x inside)
         |
         + → alignmentstr -p kk   (Use pipe instead of file)
         |
         + → commentCode ($btmpx.x inside)
         |
         + → uncommentcode ($btmpx.x inside)
         ↓
    runSh above cmd
         |
         ↓
    Capture STDOUT => Json => ReplyCode{...stdoutx=stdout}
         |
         ↓
    Response JSON ReplyCode{...stdoutx=stdout}

   bitbuckettmpx.x , NOT tmpx.x
   Store all the code to be processed: alignment, alignmentstr, commentCode, uncommentcode

   

deleteCodeBlock :: Connection -> IORef HMap2 -> Application Source #

updatePrefixMap :: [([String], ([String], Integer, Integer, Integer))] -> IORef HMap2 -> IO () Source #

type HMap2 = M.HashMap String [([String], Integer)]

splitWhenTwo :: (a -> Bool) -> [a] -> ([a], [a]) Source #

getPreStyle :: IO [(String, String)] Source #

redis get, redis set, background color, color

   Redis color/background DB
   HTMLPre.color:#333333
   HTMLPre.background:#AAAAAA
   

getPreStyle

    [txtColor, bgColor]
    =>
    [
        ( "color"
        , "#8c9172"
        )
    ,
        ( "background-color"
        , "#3c6358"
        )
    ]
   

updateBackground :: Application Source #

Update background color from user

  • See modifycolor.css submitUpdateBackground
  • Receive background color from client and decode the JSON string

src/mystyle.css pre { display: block; font-family: monospace; font-size: 14pt; white-space: pre; margin-top: 1px; * margin-right: 1px; * margin-bottom: 1px; * margin-left: 4px; * background: #6b695869; <-- change color border-style: outset; border-width: thin; }

data R1 = R1{name::String} data R2 = R2{name::String}

data RR1 = RR1 Maybe R1 data RR2 = RR2 Maybe R2

   pre{color:#90996c;
      background-color:#000000;
   }
 

getPreStyle

  ------------------------------------styleList-----------------------------------
  [
      ( "color"
      , "#8c9172"
      )
  ,
      ( "background-color"
      , "#3c6358"
      )
  ]
 

updateTextColor :: Application Source #

Update pre text color

  • Receive text color from client and decode the JSON string
  • See src/aronlib.js

See updateBackground

NOT USED NOW

receiveCode :: Application Source #

receiveCode2 :: Application Source #

responseEditor :: Response Source #

responseJavascript :: FilePath -> Response Source #

response javacript file function

  • response aronlib.js to client

responseCSS :: FilePath -> Response Source #

responsePDF :: FilePath -> Response Source #

KEY: response PDF file, send pdf file to client

  pdfSent::BS.ByteString -> Response
  

responsePNG :: FilePath -> Response Source #

response png/PNG file

  pdfSent::BS.ByteString -> Response
  

responseHtml :: FilePath -> Response Source #

replyEditor :: Response Source #

NOTE: file => /upload dir | Plz see uploadPage.html

responseHelp :: Response Source #

replyCssButton :: Response Source #

wordcountReply :: Response Source #

matrixReply :: Response Source #

replyJS :: Response Source #

insertDatabase :: Connection -> Application Source #

Insert name and age to MySqlite-simple file-based database.

http://localhost:8000/insert/

File: insert.html action="/insert" method="POST" enctype="multipart/form-data" Name type="text" name="name"br Age type="text" name="age"br type="submit" value="submit" /form

insert data to table: people
"INSERT INTO people (name, age) VALUES (?,?)" 

readDatabaseCodeBlock :: Connection -> IO [([String], ([String], Integer, Integer, Integer))] Source #

   -- defind in AronModule.hs
   data CodeBlock = 
   CodeBlock 
   { codeblockId  :: Int64
   , header       :: TS.Text
   , codeblock    :: TS.Text
   } deriving (Eq, Read, Show)


   Input:
   a:*.hs:c,d
   line 1
   line 2

   mycode <- query_ conn "SELECT id, header, codeblock from CodeBlock" :: IO [CodeBlock]

   id        = 106
   header    = a:*:c
   codeblock = a:*.hs:c,d n line 1 n line 2

   tupleList = [(["a", "c,d"], ["a:*.hs:c", "line 1", "line 2"],    106)
   pplist    = [(["a", "c", "d"], ["a:*.hs:c", "line 1", "line 2"], 106)

   DATE: Thursday, 29 June 2023 00:11 PDT
   Update CodeBlock table with new column: show INTEGER DEFAULT 1
   SET show = 0 to hide the row
   

readSnippet2 :: FilePath -> IO [([String], [String])] Source #

createCodeBlockTable :: Connection -> IO () Source #

Create CodeBlock table

NOT USED

addCodeBlockTable :: Connection -> Text -> Text -> IO () Source #

NOT USED

updateDatabaseCodeBlockTable :: Connection -> Text -> Text -> IO () Source #

NOT USED

updateDatabaseNewCodeTable :: Connection -> Integer -> Text -> IO () Source #

Update database table

  data CodeBlock =
      CodeBlock
      { codeBlockId :: Int64
      , header      :: TS.Text
      , codeblock   :: TS.Text
      , addedtime   :: Int64
      , score       :: Int64
      } deriving (Eq, Read, Show)
  

updateDatabaseScoreTable :: Connection -> Integer -> String -> IO () Source #

updateDatabaseShowTable :: Connection -> Integer -> IO () Source #

updateScoreCodeBlock :: Connection -> IORef HMap2 -> String -> Application Source #

Two Commands only

"upscore" => score += 1 "downscore" => score -= 1

addScoreCodeBlock Source #

Arguments

:: Connection

Connection

-> IORef HMap2

type HMap2 = M.HashMap String [([String], Integer, Integer, Integer)]

-> Application 

subtractScoreCodeBlock Source #

Arguments

:: Connection

Connection

-> IORef HMap2

type HMap2 = M.HashMap String [([String], Integer, Integer, Integer)]

-> Application 

insertDatabaseNewCodeTable :: Connection -> Integer -> Text -> IO () Source #

KEY: insert code to database -- data CodeBlock = -- CodeBlock -- { codeblockId :: Int64 -- , header :: TS.Text -- , codeblock :: TS.Text -- } deriving (Eq, Read, Show)

duplicatedRowNoShow :: Connection -> Integer -> IO () Source #

KEY: duplicated row and set show=0

deleteDatabaseNewCodeTable :: Connection -> [Integer] -> Text -> IO () Source #

Fake deletion, SET show = 0 in database table 
NOTE: ucode is NOT USED

deleteDatabaseCodeBlockTable :: Connection -> Text -> IO () Source #

loginCheck :: Connection -> Application Source #

securityValidate :: ByteString -> ByteString -> ByteString -> ByteString -> ByteString -> Bool Source #

validate user input and santize me

insertUserDB :: Connection -> Application Source #

upload :: String -> Application Source #

searchMap :: Application Source #

searchForm :: String -> String Source #

user input autocomplete

  • search field, search input, search form

change background color Javascript

  • search form has moved to htmlBody.htmlbs

submitUpdateBackground => aronlib.js

NOTE: NOT USE IT NOW ❌ gf: js/aronlib.js