configure LDT with torch but 'path' is a nil value - torch

I configure my LDT with torch using this tutorial.
But when i tried to excute a torch program, it returns such a error:
lua: ./util/BatchLoaderUnk.lua:14: attempt to index global 'path' (a nil value)
But i know 'path' is a in-build metatable.

Related

how to load custom dictionary in marklogic using gradle?

I have to execute following custom-dictionary.xqy file using gradle
xquery version "1.0-ml";
import module namespace cdict = "http://marklogic.com/xdmp/custom-dictionary" at "/MarkLogic/custom-dictionary.xqy";
import module namespace mem = "http://xqdev.com/in-mem-update" at '/MarkLogic/appservices/utils/in-mem-update.xqy';
declare default element namespace "http://marklogic.com/xdmp/custom-dictionary";
let $lang := 'en'
let $terms := <dictionary xmlns="http://marklogic.com/xdmp/custom-dictionary">
<entry>
<word>meeting</word>
<stem>meets</stem>
</entry>
</dictionary>
let $dict-exists := <a>{cdict:dictionary-read($lang)}</a>
return
(if($dict-exists/*)
then
let $new-dict := mem:node-insert-child($dict-exists//dictionary,$terms//entry)
return
cdict:dictionary-write($lang,$new-dict/dictionary)
else
cdict:dictionary-write($lang,$terms)
,"Success"
)
and I am adding a task in build.gradle file to execute the XQuery module
task addDictionary(type: com.marklogic.gradle.task.ServerEvalTask) {
client = mlAppConfig.newAppServicesDatabaseClient("databaseName")
xquery = "xdmp:invoke('path of custom-dictionary.xqy')"
}
But getting following error
Execution failed for task ':addDictionary'.
> Local message: failed to apply resource at eval: Internal Server Error. Server Message: Server (not a REST instance?) did not respond with an expected REST Error message.
I am not getting where I am doing wrong. Is there any other way to execute an XQuery using a gradle task?

ERROR: LoadError: UndefVarError: type not defined

I am working in Julia and I'm trying to use Documenter.jl to create a documentation page for Examples.jl and I keep getting this error when I try to run my make.jl file:
ERROR: LoadError: UndefVarError: type not defined
Here is my code for the make.jl file:
using Documenter
using Examples
makedocs(
sitename = "Examples.jl",
pages = Any[
"About" => "index.md",
"Main" => "main.md",
"Graphs" => "graphs.md",
"Utilities" => "utilities.md",
"Tutorial" => "tutorial.md"
]
)
Any ideas how to fix this error? Thanks
As #Matt B. pointed out, type is no longer a valid keyword. In Julia 0.x you used to define types as:
type foo
bar
end
Now we use struct or mutable struct instead. e.g.
struct foo
bar
end
Go through your code and see if you see type anywhere.

Kong: Attempt to index field 'host' (a nil value)

[Kong] Encounter error: Attempt to index field 'host' (a nil value)
When I use kong with high load, I encounter this issue and the stacktrace is:
2019/10/16 07:12:28 [error] 253#0: *109865 lua entry thread aborted: runtime error: /usr/local/share/lua/5.1/resty/dns/balancer/base.lua:211: attempt to index field 'host' (a nil value)
stack traceback:
coroutine 0:
/usr/local/share/lua/5.1/resty/dns/balancer/base.lua: in function 'getPeer'
/usr/local/share/lua/5.1/resty/dns/balancer/ring.lua:319: in function 'getPeer'
/usr/local/share/lua/5.1/kong/runloop/balancer.lua:834: in function 'execute'
/usr/local/share/lua/5.1/kong/runloop/handler.lua:753: in function 'balancer_execute'
/usr/local/share/lua/5.1/kong/runloop/handler.lua:1260: in function 'after'
/usr/local/share/lua/5.1/kong/init.lua:745: in function 'access'
access_by_lua(nginx-kong.conf:89):2: in main chunk

Error attempting to decode with wreq

I'm trying really hard to understand how to use lenses and wreq and its turning out to really slow me down.
The error seems to be claiming there's some mismatched type here. I'm not sure exactly how to handle that though. I'm still fairly new to haskell and these lenses are pretty confusing. However, wreq seems to be cleaner, which is why I chose to use it. Can anyone help me understand what the error is, and how to fix it? I seem to run into alot of these type errors. I am aware that Maybe TestInfo won't be returned by my code at the moment. That's ok. That error know how to handle. This error however, I don't.
Here is my code:
Module TestInformation:
{-# LANGUAGE OverloadedStrings #-}
module TestInformation where
import Auth
import Network.Wreq
import Control.Lens
import Data.Aeson
import Data.Aeson.Lens (_String)
type TestNumber = String
data TestInfo = TestInfo {
TestId :: Int,
TestName :: String,
}
instance FromJSON TestInfo
getTestInfo :: Key -> TestNumber -> Maybe TestInfo
getTestInfo key test =
decode (res ^. responseBody . _String)
where opts = defaults & auth ?~ oauth2Bearer key
res = getWith opts ("http://testsite.com/v1/tests/" ++ test)
Module Auth:
module Auth where
import qualified Data.ByteString as B
type Key = B.ByteString
The error:
GHCi, version 7.10.1: http://www.haskell.org/ghc/ :? for help
[1 of 2] Compiling Auth ( Auth.hs, interpreted )
[2 of 2] Compiling TestInformation ( TestInformation.hs, interpreted )
TestInformation.hs:36:18:
Couldn't match type ‘Response body10’
with ‘IO (Response Data.ByteString.Lazy.Internal.ByteString)’
Expected type: (body10
-> Const Data.ByteString.Lazy.Internal.ByteString body10)
-> IO (Response Data.ByteString.Lazy.Internal.ByteString)
-> Const
Data.ByteString.Lazy.Internal.ByteString
(IO (Response Data.ByteString.Lazy.Internal.ByteString))
Actual type: (body10
-> Const Data.ByteString.Lazy.Internal.ByteString body10)
-> Response body10
-> Const Data.ByteString.Lazy.Internal.ByteString (Response body10)
In the first argument of ‘(.)’, namely ‘responseBody’
In the second argument of ‘(^.)’, namely ‘responseBody . _String’
TestInformation.hs:36:33:
Couldn't match type ‘Data.ByteString.Lazy.Internal.ByteString’
with ‘Data.Text.Internal.Text’
Expected type: (Data.ByteString.Lazy.Internal.ByteString
-> Const
Data.ByteString.Lazy.Internal.ByteString
Data.ByteString.Lazy.Internal.ByteString)
-> body10 -> Const Data.ByteString.Lazy.Internal.ByteString body10
Actual type: (Data.Text.Internal.Text
-> Const
Data.ByteString.Lazy.Internal.ByteString Data.Text.Internal.Text)
-> body10 -> Const Data.ByteString.Lazy.Internal.ByteString body10
In the second argument of ‘(.)’, namely ‘_String’
In the second argument of ‘(^.)’, namely ‘responseBody . _String’
Failed, modules loaded: Auth.
Leaving GHCi.
This type checks for me:
getTestInfo :: Key -> TestNumber -> IO (Maybe TestInfo)
getTestInfo key test = do
res <- getWith opts ("http://testsite.com/v1/tests/" ++ test)
return $ decode (res ^. responseBody)
where opts = defaults & auth ?~ oauth2Bearer key
getWith is an IO action, so to get its return value you need to use the monadic binding operator <-.
Full program: http://lpaste.net/133443 http://lpaste.net/133498

There is an error using CMUCL

When staring cmucl with quicklisp, i get the following error:
Error in KERNEL::UNDEFINED-SYMBOL-ERROR-HANDLER: the function GENERATE-CRC32-TABLE is undefined.
[Condition of type UNDEFINED-FUNCTION]
Restarts:
0: [CONTINUE ] Return NIL from load of #P"/home/***/.cache/common-lisp/cmu-19f__19f_-freebsd-x86/home/***/quicklisp/quicklisp/deflate.sse2f".
1: [TRY-RECOMPILING] Recompile deflate and try loading it again
2: [RETRY ] Retry Loading component: ("quicklisp" "deflate").
3: [ACCEPT ] Continue, treating
Loading component: ("quicklisp" "deflate") as having
been successful.
4: Return NIL from load of #P"home:quicklisp/setup.lisp".
5: Return NIL from load of "home:.cmucl-init".
6: [ABORT ] Skip remaining initializations.
Debug (type H for help)
(KERNEL::UNDEFINED-SYMBOL-ERROR-HANDLER "<error finding name>"
#.(SYSTEM:INT-SAP #x47FD70D4)
#<Alien (*
SYSTEM:SYSTEM-AREA-POINTER) at #x47FD6DC0>
(16))
Source: Error finding source:
Error in function DEBUG::GET-FILE-TOP-LEVEL-FORM: Source file no longer exists:
target:code/interr.lisp.
How can i fix it, thanks !
The easiest fix is to use a recent version of CMUCL.

Resources