Safe Haskell | None |
---|
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
- query_redis :: [Char]
- eleIdCodeBlock :: String
- pdfdir :: [Char]
- keyLastCmd :: String
- indexEditorHTML :: FilePath
- indexEditorJSON :: FilePath
- s2Text :: String -> Text
- data Block = Block {
- bblock :: [Text]
- data MBlock = MBlock {
- mblock :: [Integer]
- data GeneMatrix = GeneMatrix {}
- data Bgcolor = Bgcolor {
- colorname :: Text
- data Textcolor = Textcolor {
- textcolor :: Text
- data User = User {}
- data Image = Image {}
- data TodoItem = TodoItem {}
- data TodoReply = TodoReply {
- cmdReply :: Text
- data CompileCode = CompileCode {}
- data MatInt = MatInt {}
- data SnippetJSON = SnippetJSON {}
- data HTMLTable = HTMLTable {}
- data PreColor = PreColor {
- color :: Text
- background :: Text
- updateRetcmd :: String -> CodeBlockReply -> CodeBlockReply
- updateOk :: String -> CodeBlockReply -> CodeBlockReply
- data Person = Person {
- personId :: Int64
- personName :: Text
- personAge :: Text
- data UserInput = UserInput {}
- updir :: String
- hiddenLATEXCODE :: String
- hiddenCOMPILESAVE :: String
- dbname :: [Char]
- configFile :: FilePath
- lookupJust :: (Eq k, Hashable k) => k -> HashMap k a -> a
- confMap :: FilePath -> IO (HashMap String String)
- getHostName :: IO String
- getRootDirFull :: IO String
- styleChar :: String -> String -> Char -> Char -> String -> String
- href :: String -> String -> String -> String
- changeSymbol :: String -> String
- listToByteStr :: [[String]] -> ByteString
- cssStrong :: String -> String
- cssHead :: [[String]] -> [[String]]
- htmlLess :: [[String]] -> [[String]]
- htmlGreater :: [[String]] -> [[String]]
- keyWord :: [[String]] -> [[String]]
- redisGetLastCmd :: String -> IO String
- aplSymbol :: [[String]] -> [[String]]
- keyWord1 :: [[String]] -> [[String]]
- keyDash :: [[String]] -> [[String]]
- keySymbol1 :: [[String]] -> [[String]]
- keyName :: [[String]] -> [[String]]
- specialName :: [[String]] -> [[String]]
- javaClassName :: [[String]] -> [[String]]
- javaFunClass :: [[String]] -> [[String]]
- javaKeyWords :: [[String]] -> [[String]]
- javaCmdKeyWords :: [[String]] -> [[String]]
- mysqlKeyWords :: [[String]] -> [[String]]
- keyURL :: [[String]] -> [[String]]
- spChar :: [[String]] -> [[String]]
- bracketChar :: [[String]] -> [[String]]
- sbChar :: [[String]] -> [[String]]
- transformX :: [[String]] -> [[String]]
- wsApp :: ServerApp
- type Client = (Int, Connection)
- broadcast :: Text -> [Client] -> IO ()
- addClient :: Connection -> [Client] -> ([Client], Int)
- removeClient :: Int -> [Client] -> ([Client], ())
- chat :: IORef [Client] -> ServerApp
- alternateLineColor2 :: [CSSPro] -> [[String]] -> [[String]]
- blockId :: Integer -> String
- svgIconUpdate :: String
- svgIconInsert :: String
- svgIconDelete :: String
- svgIconSubtract :: String
- svgIconAdd :: String
- hiddenForm2 :: Integer -> String -> String
- foldListList :: ([[String]] -> [[String]]) -> [[String]] -> String
- foldListList2 :: ([[String]] -> [[String]]) -> [([String], Integer, Integer, Integer)] -> String
- myfun :: Text -> Text
- fun4 :: Text -> String
- foldListListTxt :: [[String]] -> String
- foldListListTxt2 :: [([String], Integer, Integer, Integer)] -> String
- pdfname :: String
- img :: String
- pdfPath :: [Char]
- docRoot :: [Char]
- doc :: FilePath
- cmdLog :: [Char]
- currCmdFile :: FilePath
- logCurrCmd :: [String] -> IO ()
- readCurrCmd :: IO String
- type HMap2 = HashMap String [([String], Integer, Integer, Integer)]
- type PDFMap = HashMap String String
- type RespMap = HashMap String String
- genePDF :: String -> IO ()
- app2 :: Connection -> IORef HMap2 -> IORef PDFMap -> RespMap -> Application
- resourceList :: IO [(String, String)]
- plainIndex :: Response
- pdfFile :: Response
- sendPDF :: FilePath -> FilePath -> Response
- sendImage :: FilePath -> FilePath -> Response
- pdfSentX :: ByteString -> Response
- insertinfo :: Response
- insertUser :: Response
- loginHtml :: Response
- htmlfetchjson :: Response
- searchUI :: Response
- notFound :: Response
- notFoundStr :: ByteString -> Response
- snippetP :: [Char]
- mapClear2 :: [String] -> HMap2 -> HMap2
- insertAll2 :: [(String, [([String], Integer, Integer, Integer)])] -> HMap2 -> HMap2
- insertAppend2 :: String -> [([String], Integer, Integer, Integer)] -> HMap2 -> HMap2
- listToPrefixMap :: [([String], ([String], Integer, Integer, Integer))] -> IORef HMap2 -> IO ()
- spanBlockX1 :: ([[String]] -> [[String]]) -> HMap2 -> Maybe ByteString -> String
- spanBlockFunc :: ([[String]] -> [[String]]) -> [[String]] -> String
- spanBlockXX2 :: HMap2 -> Maybe ByteString -> String
- (∘) :: [a] -> [a] -> [a]
- htmlPre :: String -> String
- replyHtml :: String -> String -> String
- anyRoute2 :: Connection -> IORef HMap2 -> Request -> Response
- getQueryString :: ByteString -> Request -> Maybe ByteString
- responseFromCmd :: Connection -> IORef HMap2 -> Maybe String -> Response
- uploadPage :: Response
- data SearchType
- readCmd :: FilePath -> SearchType -> IO String
- groupCountFilter :: [String] -> [String]
- optionHtml :: [String] -> String
- responseNothing :: String -> Response
- responseNothingBS :: ByteString -> Response
- responseJSON :: ToJSON a => a -> Response
- responseJSONBS :: ByteString -> Response
- responseNothingTest :: Response
- replyTaskHtml :: ByteString -> ByteString -> ByteString
- listPage :: Connection -> Application
- responseTaskBS :: ByteString -> Response
- responseCmd :: Connection -> String -> Response
- queryUserInput :: Connection -> String -> IO [String]
- responseJavaHtml :: String -> Response
- responseGenePDFHtml :: Connection -> Response
- responseHaskellHtml :: String -> Response
- queryRedisSnippet :: String -> Response
- ghcidRun :: Ghci -> String -> Response
- queryLibHaskell :: String -> Response
- queryLibCpp :: String -> Response
- queryLibJava :: String -> Response
- queryLibJavaPackage :: String -> String -> Response
- responseSearch :: Connection -> String -> Response
- searchMainHtml :: [String] -> String -> IO ByteString
- responseSnippetHTML2 :: Connection -> String -> IORef HMap2 -> Response
- responseSnippetTxt2 :: String -> IORef HMap2 -> Response
- responseSnippetJSON :: String -> IORef HMap2 -> Response
- geneRectMat :: Application
- geneHTMLTable :: Application
- getPreFromRedis :: Application
- updateCodeBlock :: Connection -> IORef HMap2 -> Application
- validateFormat :: String -> String -> (Bool, String)
- insertCodeBlock :: Connection -> IORef HMap2 -> Application
- data EditorCode = EditorCode {
- editorbeg :: Integer
- editorend :: Integer
- editorfile :: String
- editorcmd :: String
- editorcode :: String
- editortheme :: String
- editormode :: String
- data EditorCodeReply = EditorCodeReply {
- replybeg :: Integer
- replyend :: Integer
- ret :: String
- replydata :: String
- replyfname :: String
- replytheme :: String
- replymode :: String
- type MyLens a b = (a -> b, b -> a -> a)
- getRet :: EditorCodeReply -> String
- setRet :: String -> EditorCodeReply -> EditorCodeReply
- getReplytheme :: EditorCodeReply -> String
- setReplytheme :: String -> EditorCodeReply -> EditorCodeReply
- getL :: MyLens a b -> a -> b
- setL :: MyLens a b -> b -> a -> a
- modL :: MyLens a b -> (b -> b) -> a -> a
- ret' :: MyLens EditorCodeReply String
- replytheme' :: MyLens EditorCodeReply String
- (^=) :: MyLens a b -> b -> a -> a
- data ProcLatex = ProcLatex {}
- myloop :: String -> IO Int
- loopDelay :: Int -> String -> IO Int
- runOnExternalProgram :: String -> Int -> String -> FilePath -> IO (Either String String)
- data LatexFilePath = LatexFilePath {
- xHtmlPath :: String
- xLatexPath :: String
- xPDFPath :: String
- randomName :: IO String
- data EFileType
- datadirFull :: String -> EFileType -> IO String
- todoPostJSON :: Connection -> IORef HMap2 -> Application
- receiveEditorData :: Connection -> IORef HMap2 -> IORef PDFMap -> Application
- respondMatrix :: Connection -> IORef HMap2 -> Application
- commandService :: Connection -> IORef HMap2 -> Application
- deleteCodeBlock :: Connection -> IORef HMap2 -> Application
- updatePrefixMap :: [([String], ([String], Integer, Integer, Integer))] -> IORef HMap2 -> IO ()
- splitWhenTwo :: (a -> Bool) -> [a] -> ([a], [a])
- getPreStyle :: IO [(String, String)]
- updateBackground :: Application
- updateTextColor :: Application
- receiveCode :: Application
- receiveCode2 :: Application
- responseEditor :: Response
- responseJavascript :: FilePath -> Response
- responseCSS :: FilePath -> Response
- responsePDF :: FilePath -> Response
- responsePNG :: FilePath -> Response
- responseHtml :: FilePath -> Response
- replyEditor :: Response
- responseHelp :: Response
- replyCssButton :: Response
- wordcountReply :: Response
- matrixReply :: Response
- sendHTMLTableCmd :: Response
- replyJS :: Response
- insertDatabase :: Connection -> Application
- readDatabaseCodeBlock :: Connection -> IO [([String], ([String], Integer, Integer, Integer))]
- readSnippet2 :: FilePath -> IO [([String], [String])]
- queryCreateTable :: Query
- createCodeBlockTable :: Connection -> IO ()
- addCodeBlockTable :: Connection -> Text -> Text -> IO ()
- updateDatabaseCodeBlockTable :: Connection -> Text -> Text -> IO ()
- updateDatabaseNewCodeTable :: Connection -> Integer -> Text -> IO ()
- updateDatabaseScoreTable :: Connection -> Integer -> String -> IO ()
- updateDatabaseShowTable :: Connection -> Integer -> IO ()
- updateScoreCodeBlock :: Connection -> IORef HMap2 -> String -> Application
- addScoreCodeBlock :: Connection -> IORef HMap2 -> Application
- subtractScoreCodeBlock :: Connection -> IORef HMap2 -> Application
- insertDatabaseNewCodeTable :: Connection -> Integer -> Text -> IO ()
- duplicatedRowNoShow :: Connection -> Integer -> IO ()
- deleteDatabaseNewCodeTable :: Connection -> [Integer] -> Text -> IO ()
- deleteDatabaseCodeBlockTable :: Connection -> Text -> IO ()
- loginCheck :: Connection -> Application
- securityValidate :: ByteString -> ByteString -> ByteString -> ByteString -> ByteString -> Bool
- insertUserDB :: Connection -> Application
- upload :: String -> Application
- searchMap :: Application
- searchForm :: String -> String
Documentation
query_redis :: [Char] Source #
KEY: Say something
M-x openurl help: file://Usersaaamyfilebitbucketstackprojectjupyterlab/jupyterlab.html gx LibraryWebServerDocumentsxfidoimagefoldlistimage.jpg
eleIdCodeBlock :: String Source #
keyLastCmd :: String Source #
KEY: Last snippet command is stored in Redis database, last redis cmd
indexEditorHTML :: FilePath Source #
indexEditorJSON :: FilePath Source #
Instances
Show Block Source # | |
Generic Block Source # | |
FromJSON Block Source # | |
Defined in WaiLib parseJSON :: Value -> Parser Block parseJSONList :: Value -> Parser [Block] | |
ToJSON Block Source # | |
Defined in WaiLib | |
type Rep Block Source # | |
Instances
Show MBlock Source # | |
Generic MBlock Source # | |
FromJSON MBlock Source # | |
Defined in WaiLib parseJSON :: Value -> Parser MBlock parseJSONList :: Value -> Parser [MBlock] | |
ToJSON MBlock Source # | |
Defined in WaiLib toEncoding :: MBlock -> Encoding toJSONList :: [MBlock] -> Value toEncodingList :: [MBlock] -> Encoding | |
type Rep MBlock Source # | |
data GeneMatrix Source #
Instances
Show GeneMatrix Source # | |
Defined in WaiLib showsPrec :: Int -> GeneMatrix -> ShowS show :: GeneMatrix -> String showList :: [GeneMatrix] -> ShowS | |
Generic GeneMatrix Source # | |
Defined in WaiLib type Rep GeneMatrix :: Type -> Type from :: GeneMatrix -> Rep GeneMatrix x to :: Rep GeneMatrix x -> GeneMatrix | |
FromJSON GeneMatrix Source # | |
Defined in WaiLib parseJSON :: Value -> Parser GeneMatrix parseJSONList :: Value -> Parser [GeneMatrix] | |
ToJSON GeneMatrix Source # | |
Defined in WaiLib toJSON :: GeneMatrix -> Value toEncoding :: GeneMatrix -> Encoding toJSONList :: [GeneMatrix] -> Value toEncodingList :: [GeneMatrix] -> Encoding | |
type Rep GeneMatrix Source # | |
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)))) |
Instances
Show Bgcolor Source # | |
Generic Bgcolor Source # | |
FromJSON Bgcolor Source # | |
Defined in WaiLib parseJSON :: Value -> Parser Bgcolor parseJSONList :: Value -> Parser [Bgcolor] | |
ToJSON Bgcolor Source # | |
Defined in WaiLib toEncoding :: Bgcolor -> Encoding toJSONList :: [Bgcolor] -> Value toEncodingList :: [Bgcolor] -> Encoding | |
type Rep Bgcolor Source # | |
Instances
Show Textcolor Source # | |
Generic Textcolor Source # | |
FromJSON Textcolor Source # | |
Defined in WaiLib parseJSON :: Value -> Parser Textcolor parseJSONList :: Value -> Parser [Textcolor] | |
ToJSON Textcolor Source # | |
Defined in WaiLib toEncoding :: Textcolor -> Encoding toJSONList :: [Textcolor] -> Value toEncodingList :: [Textcolor] -> Encoding | |
type Rep Textcolor Source # | |
Instances
Eq TodoItem Source # | |
Read TodoItem Source # | |
Show TodoItem Source # | |
Generic TodoItem Source # | |
FromJSON TodoItem Source # | |
Defined in WaiLib parseJSON :: Value -> Parser TodoItem parseJSONList :: Value -> Parser [TodoItem] | |
ToJSON TodoItem Source # | |
Defined in WaiLib toEncoding :: TodoItem -> Encoding toJSONList :: [TodoItem] -> Value toEncodingList :: [TodoItem] -> Encoding | |
type Rep TodoItem Source # | |
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)))) |
Instances
Show TodoReply Source # | |
Generic TodoReply Source # | |
FromJSON TodoReply Source # | |
Defined in WaiLib parseJSON :: Value -> Parser TodoReply parseJSONList :: Value -> Parser [TodoReply] | |
ToJSON TodoReply Source # | |
Defined in WaiLib toEncoding :: TodoReply -> Encoding toJSONList :: [TodoReply] -> Value toEncodingList :: [TodoReply] -> Encoding | |
type Rep TodoReply Source # | |
data CompileCode Source #
Instances
Show CompileCode Source # | |
Defined in WaiLib showsPrec :: Int -> CompileCode -> ShowS show :: CompileCode -> String showList :: [CompileCode] -> ShowS | |
Generic CompileCode Source # | |
Defined in WaiLib type Rep CompileCode :: Type -> Type from :: CompileCode -> Rep CompileCode x to :: Rep CompileCode x -> CompileCode | |
FromJSON CompileCode Source # | |
Defined in WaiLib parseJSON :: Value -> Parser CompileCode parseJSONList :: Value -> Parser [CompileCode] | |
ToJSON CompileCode Source # | |
Defined in WaiLib toJSON :: CompileCode -> Value toEncoding :: CompileCode -> Encoding toJSONList :: [CompileCode] -> Value toEncodingList :: [CompileCode] -> Encoding | |
type Rep CompileCode Source # | |
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)))) |
Instances
Show MatInt Source # | |
Generic MatInt Source # | |
FromJSON MatInt Source # | |
Defined in WaiLib parseJSON :: Value -> Parser MatInt parseJSONList :: Value -> Parser [MatInt] | |
ToJSON MatInt Source # | |
Defined in WaiLib toEncoding :: MatInt -> Encoding toJSONList :: [MatInt] -> Value toEncodingList :: [MatInt] -> Encoding | |
type Rep MatInt Source # | |
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 #
Instances
Show SnippetJSON Source # | |
Defined in WaiLib showsPrec :: Int -> SnippetJSON -> ShowS show :: SnippetJSON -> String showList :: [SnippetJSON] -> ShowS | |
Generic SnippetJSON Source # | |
Defined in WaiLib type Rep SnippetJSON :: Type -> Type from :: SnippetJSON -> Rep SnippetJSON x to :: Rep SnippetJSON x -> SnippetJSON | |
FromJSON SnippetJSON Source # | |
Defined in WaiLib parseJSON :: Value -> Parser SnippetJSON parseJSONList :: Value -> Parser [SnippetJSON] | |
ToJSON SnippetJSON Source # | |
Defined in WaiLib toJSON :: SnippetJSON -> Value toEncoding :: SnippetJSON -> Encoding toJSONList :: [SnippetJSON] -> Value toEncodingList :: [SnippetJSON] -> Encoding | |
type Rep SnippetJSON Source # | |
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]])))) |
Instances
Show HTMLTable Source # | |
Generic HTMLTable Source # | |
FromJSON HTMLTable Source # | |
Defined in WaiLib parseJSON :: Value -> Parser HTMLTable parseJSONList :: Value -> Parser [HTMLTable] | |
ToJSON HTMLTable Source # | |
Defined in WaiLib toEncoding :: HTMLTable -> Encoding toJSONList :: [HTMLTable] -> Value toEncodingList :: [HTMLTable] -> Encoding | |
type Rep HTMLTable Source # | |
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]))) |
PreColor | |
|
Instances
Show PreColor Source # | |
Generic PreColor Source # | |
FromJSON PreColor Source # | |
Defined in WaiLib parseJSON :: Value -> Parser PreColor parseJSONList :: Value -> Parser [PreColor] | |
ToJSON PreColor Source # | |
Defined in WaiLib toEncoding :: PreColor -> Encoding toJSONList :: [PreColor] -> Value toEncodingList :: [PreColor] -> Encoding | |
type Rep PreColor Source # | |
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))) |
updateRetcmd :: String -> CodeBlockReply -> CodeBlockReply Source #
updateOk :: String -> CodeBlockReply -> CodeBlockReply Source #
Person to Json object
Person | |
|
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"
configFile :: FilePath Source #
lookupJust :: (Eq k, Hashable k) => k -> HashMap k a -> a Source #
getHostName :: IO String Source #
getRootDirFull :: IO String Source #
KEY: get the full rootdir
"Usersaaamyfilebitbucket/haskellwebapp2" "Usersaaamyfilemybin/haskellwebapp2Bin"
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
htmlGreater :: [[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"
keySymbol1 :: [[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 #
bracketChar :: [[String]] -> [[String]] Source #
transformX :: [[String]] -> [[String]] Source #
removeClient :: Int -> [Client] -> ([Client], ()) Source #
alternateLineColor2 :: [CSSPro] -> [[String]] -> [[String]] Source #
Fake optional parameter
alternateLineColor2 [] alternateLineColor2 [("background", "green"), ("background", "cyan")]
svgIconUpdate :: String Source #
svgIconInsert :: String Source #
svgIconDelete :: String Source #
svgIconSubtract :: String Source #
svgIconAdd :: 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 dog
cat"
, "fac ← {⍵ > 1 : ⍵×fac ⍵ - 1 ⋄ 1}"
, "nice"
, "update"
, "line444"
, "line555"
]
, 35
, 1635399200
, 8
)
]
)
]
foldListListTxt :: [[String]] -> String Source #
foldListListTxt2 :: [([String], Integer, Integer, Integer)] -> String 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)
- ↓ ↓ ↓ ↓
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.
:NOTE: USE IT
resourceList :: IO [(String, String)] Source #
NOTE: USE in main.hs
plainIndex :: Response Source #
insertinfo :: Response Source #
insertUser :: Response Source #
htmlfetchjson :: Response Source #
notFoundStr :: ByteString -> Response 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 #
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 #
- - http://localhost:8080/snippet?id=n%20test
- - ↑
- - + space = %20
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 #
responseNothingTest :: Response Source #
replyTaskHtml :: ByteString -> ByteString -> ByteString Source #
responseTaskBS :: ByteString -> Response Source #
responseCmd :: Connection -> String -> Response Source #
Response output from shell command
- The maximum number of lines are 200, " | head -200"
- 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 #
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
- remove spaces from cmd
- insert cmd to table: userinput if userinput exists, otherwise create table: userinput
- sorted all cmd and create Html form with all cmd
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
- 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
- See *haskellwebapp2/postMatrix.html*
- postMatrix.html
- Link To Matrix
- Receive request from client
- Decode body
- Pattern matching Record Maybe
GeneMatrix
- Construct record
MatInt
if ncol and nrow are inGeneMatrix
, otherwise create an emptyMatInt
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'
- Redis KEYS
$sel:color:PreColor
- Redis KEYS '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 #
EditorCode | |
|
Instances
Show EditorCode Source # | |
Defined in WaiLib showsPrec :: Int -> EditorCode -> ShowS show :: EditorCode -> String showList :: [EditorCode] -> ShowS | |
Generic EditorCode Source # | |
Defined in WaiLib type Rep EditorCode :: Type -> Type from :: EditorCode -> Rep EditorCode x to :: Rep EditorCode x -> EditorCode | |
FromJSON EditorCode Source # | |
Defined in WaiLib parseJSON :: Value -> Parser EditorCode parseJSONList :: Value -> Parser [EditorCode] | |
ToJSON EditorCode Source # | |
Defined in WaiLib toJSON :: EditorCode -> Value toEncoding :: EditorCode -> Encoding toJSONList :: [EditorCode] -> Value toEncodingList :: [EditorCode] -> Encoding | |
type Rep EditorCode Source # | |
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 #
EditorCodeReply | |
|
Instances
Show EditorCodeReply Source # | |
Defined in WaiLib showsPrec :: Int -> EditorCodeReply -> ShowS show :: EditorCodeReply -> String showList :: [EditorCodeReply] -> ShowS | |
Generic EditorCodeReply Source # | |
Defined in WaiLib type Rep EditorCodeReply :: Type -> Type from :: EditorCodeReply -> Rep EditorCodeReply x to :: Rep EditorCodeReply x -> EditorCodeReply | |
FromJSON EditorCodeReply Source # | |
Defined in WaiLib parseJSON :: Value -> Parser EditorCodeReply parseJSONList :: Value -> Parser [EditorCodeReply] | |
ToJSON EditorCodeReply Source # | |
Defined in WaiLib toJSON :: EditorCodeReply -> Value toEncoding :: EditorCodeReply -> Encoding toJSONList :: [EditorCodeReply] -> Value toEncodingList :: [EditorCodeReply] -> Encoding | |
type Rep EditorCodeReply Source # | |
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))))) |
getRet :: EditorCodeReply -> String Source #
setRet :: String -> EditorCodeReply -> EditorCodeReply Source #
getReplytheme :: EditorCodeReply -> String Source #
setReplytheme :: String -> EditorCodeReply -> EditorCodeReply Source #
ret' :: MyLens EditorCodeReply String Source #
replytheme' :: MyLens EditorCodeReply String Source #
runOnExternalProgram :: String -> Int -> String -> FilePath -> IO (Either String String) Source #
↓ ↓ ↓ ↓
data LatexFilePath Source #
LatexFilePath | |
|
Instances
Show LatexFilePath Source # | |
Defined in WaiLib showsPrec :: Int -> LatexFilePath -> ShowS show :: LatexFilePath -> String showList :: [LatexFilePath] -> ShowS | |
Generic LatexFilePath Source # | |
Defined in WaiLib type Rep LatexFilePath :: Type -> Type from :: LatexFilePath -> Rep LatexFilePath x to :: Rep LatexFilePath x -> LatexFilePath | |
type Rep LatexFilePath Source # | |
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 #
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
[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; }
------------------------------------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 #
sendHTMLTableCmd :: Response Source #
insertDatabase :: Connection -> Application Source #
Insert name and age to MySqlite-simple file-based database.
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 #
queryCreateTable :: Query 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
:: Connection | Connection |
-> IORef HMap2 | type HMap2 = M.HashMap String [([String], Integer, Integer, Integer)] |
-> Application |
subtractScoreCodeBlock Source #
:: 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 #
- ------------------------------------------------------------------------------- | Wed Dec 5 15:06:00 2018 Sat Jun 8 23:42:18 2019 | upload with following POST to upload file to server | -------------------------------------------------------------------------------- action="/upload" method="POST" enctype="multipart/form-data" Upload File: type="file" name="file"br type="submit" value="submit" /form | -------------------------------------------------------------------------------- http://localhost:8000/up/ | File is uploaded to => haskell_web/uploaddir
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