Trying to deploy the contract on Kadena testnet chain 1 and errors with this message.
Error from (api.testnet.chainweb.com): : Failure: Interface not defined: free.fungible-xchain-v1
free.fungible-xchain-v1 is deployed and I can find it from the Chainweaver module explorer https://chainweaver.kadena.network/contracts
I'm using the free namespace too.
Can you please help me on this?
Best
(namespace "free")
(define-keyset "free.admin-keyset-23456"
(read-keyset "admin-keyset-234"))
(module token-tunca GOVERNANCE
#doc "Arkade token smart contract"
#model
[ (defproperty conserves-mass (amount:decimal)
(= (column-delta token-table 'balance) 0.0))
(defproperty valid-account-id (accountId:string)
(and
(>= (length accountId) 3)
(<= (length accountId) 256)))
]
(implements free.fungible-v2)
(implements free.fungible-xchain-v1)
; --------------------------------------------------------------------------
; Schemas and Tables
(defschema token-schema
#doc " An account, holding a token balance. \
\ \
\ ROW KEY: accountId. "
balance:decimal
guard:guard
)
(deftable token-table:{token-schema})
; --------------------------------------------------------------------------
; Capabilities
(defcap GOVERNANCE
()
#doc " Give the admin full access to call and upgrade the module. "
(enforce-keyset "free.admin-keyset-23456")
)
(defcap ACCOUNT_GUARD
( accountId:string )
#doc " Look up the guard for an account, required to debit from that account. "
(enforce-guard (at 'guard (read token-table accountId ['guard])))
)
(defcap DEBIT
( sender:string )
#doc " Capability to perform debiting operations. "
(enforce-guard (at 'guard (read token-table sender ['guard])))
(enforce (!= sender "") "Invalid sender.")
)
(defcap CREDIT
( receiver:string )
#doc " Capability to perform crediting operations. "
(enforce (!= receiver "") "Invalid receiver.")
)
(defcap TRANSFER:bool
( sender:string
receiver:string
amount:decimal )
#doc " Capability to perform transfer between two accounts. "
#managed amount TRANSFER-mgr
(enforce (!= sender receiver) "Sender cannot be the receiver.")
(enforce-unit amount)
(enforce (> amount 0.0) "Transfer amount must be positive.")
(compose-capability (DEBIT sender))
(compose-capability (CREDIT receiver))
)
(defun TRANSFER-mgr:decimal
( managed:decimal
requested:decimal )
(let ((newbal (- managed requested)))
(enforce (>= newbal 0.0)
(format "TRANSFER exceeded for balance {}" [managed]))
newbal
)
)
(defcap TRANSFER_XCHAIN:bool
( sender:string
receiver:string
amount:decimal
target-chain:string
)
#managed amount TRANSFER_XCHAIN-mgr
(enforce-unit amount)
(enforce (> amount 0.0) "Cross-chain transfers require a positive amount")
(compose-capability (DEBIT sender))
)
(defun TRANSFER_XCHAIN-mgr:decimal
( managed:decimal
requested:decimal
)
(enforce (>= managed requested)
(format "TRANSFER_XCHAIN exceeded for balance {}" [managed]))
0.0
)
(defcap TRANSFER_XCHAIN_RECD:bool
( sender:string
receiver:string
amount:decimal
source-chain:string
)
#event true
)
; --------------------------------------------------------------------------
; Constants
(defconst INITIAL_SUPPLY:decimal 1000000000.0
" Initial supply of 1 billion tokens. ")
(defconst DECIMALS 12
" Specifies the minimum denomination for token transactions. ")
(defconst ACCOUNT_ID_CHARSET CHARSET_LATIN1
" Allowed character set for account IDs. ")
(defconst ACCOUNT_ID_PROHIBITED_CHARACTER "$")
(defconst ACCOUNT_ID_MIN_LENGTH 3
" Minimum character length for account IDs. ")
(defconst ACCOUNT_ID_MAX_LENGTH 256
" Maximum character length for account IDs. ")
; --------------------------------------------------------------------------
; Utilities
(defun validate-account-id
( accountId:string )
#doc " Enforce that an account ID meets charset and length requirements. "
(enforce
(is-charset ACCOUNT_ID_CHARSET accountId)
(format
"Account ID does not conform to the required charset: {}"
[accountId]))
(enforce
(not (contains accountId ACCOUNT_ID_PROHIBITED_CHARACTER))
(format "Account ID contained a prohibited character: {}" [accountId]))
(let ((accountLength (length accountId)))
(enforce
(>= accountLength ACCOUNT_ID_MIN_LENGTH)
(format
"Account ID does not conform to the min length requirement: {}"
[accountId]))
(enforce
(<= accountLength ACCOUNT_ID_MAX_LENGTH)
(format
"Account ID does not conform to the max length requirement: {}"
[accountId]))
)
)
;; ; --------------------------------------------------------------------------
;; ; Fungible-v2 Implementation
(defun transfer-create:string
( sender:string
receiver:string
receiver-guard:guard
amount:decimal )
#doc " Transfer to an account, creating it if it does not exist. "
#model [ (property (conserves-mass amount))
(property (> amount 0.0))
(property (valid-account-id sender))
(property (valid-account-id receiver))
(property (!= sender receiver)) ]
(with-capability (TRANSFER sender receiver amount)
(debit sender amount)
(credit receiver receiver-guard amount)
)
)
(defun transfer:string
( sender:string
receiver:string
amount:decimal )
#doc " Transfer to an account, failing if the account does not exist. "
#model [ (property (conserves-mass amount))
(property (> amount 0.0))
(property (valid-account-id sender))
(property (valid-account-id receiver))
(property (!= sender receiver)) ]
(with-read token-table receiver
{ "guard" := guard }
(transfer-create sender receiver guard amount)
)
)
(defun debit
( accountId:string
amount:decimal )
#doc " Decrease an account balance. Internal use only. "
#model [ (property (> amount 0.0))
(property (valid-account-id accountId))
]
(validate-account-id accountId)
(enforce (> amount 0.0) "Debit amount must be positive.")
(enforce-unit amount)
(require-capability (DEBIT accountId))
(with-read token-table accountId
{ "balance" := balance }
(enforce (<= amount balance) "Insufficient funds.")
(update token-table accountId
{ "balance" : (- balance amount) }
)
)
)
(defun credit
( accountId:string
guard:guard
amount:decimal )
#doc " Increase an account balance. Internal use only. "
#model [ (property (> amount 0.0))
(property (valid-account-id accountId))
]
(validate-account-id accountId)
(enforce (> amount 0.0) "Credit amount must be positive.")
(enforce-unit amount)
(require-capability (CREDIT accountId))
(with-default-read token-table accountId
{ "balance" : -1.0
, "guard" : guard
}
{ "balance" := balance
, "guard" := currentGuard
}
(enforce (= currentGuard guard) "Account guards do not match.")
(let ((is-new
(if (= balance -1.0)
(enforce-reserved accountId guard)
false)))
(write token-table accountId
{ "balance" : (if is-new amount (+ balance amount))
, "guard" : currentGuard
}
))
)
)
(defun check-reserved:string (account:string)
" Checks ACCOUNT for reserved name and returns type if \
\ found or empty string. Reserved names start with a \
\ single char and colon, e.g. 'c:foo', which would return 'c' as type."
(let ((pfx (take 2 account)))
(if (= ":" (take -1 pfx)) (take 1 pfx) "")))
(defun enforce-reserved:bool (account:string guard:guard)
#doc "Enforce reserved account name protocols."
(if (validate-principal guard account)
true
(let ((r (check-reserved account)))
(if (= r "")
true
(if (= r "k")
(enforce false "Single-key account protocol violation")
(enforce false
(format "Reserved protocol guard violation: {}" [r]))
)))))
(defschema crosschain-schema
#doc " Schema for yielded value in cross-chain transfers "
receiver:string
receiver-guard:guard
amount:decimal
source-chain:string
)
(defpact transfer-crosschain:string
( sender:string
receiver:string
receiver-guard:guard
target-chain:string
amount:decimal )
#model [ (property (> amount 0.0))
(property (!= receiver ""))
(property (valid-account-id sender))
(property (valid-account-id receiver))
]
(step
(with-capability (TRANSFER_XCHAIN sender receiver amount target-chain)
(validate-account-id sender)
(validate-account-id receiver)
(enforce (!= "" target-chain) "empty target-chain")
(enforce (!= (at 'chain-id (chain-data)) target-chain)
"cannot run cross-chain transfers to the same chain")
(enforce (> amount 0.0)
"transfer quantity must be positive")
(enforce-unit amount)
;; Step 1 - debit sender account on current chain
(debit sender amount)
(emit-event (TRANSFER sender "" amount))
(let
((crosschain-details:object{crosschain-schema}
{ "receiver" : receiver
, "receiver-guard" : receiver-guard
, "amount" : amount
, "source-chain" : (at 'chain-id (chain-data))
}
))
(yield crosschain-details target-chain)
)
)
)
(step
(resume
{ "receiver" := receiver
, "receiver-guard" := receiver-guard
, "amount" := amount
}
;; Step 2 - credit receiver account on target chain
(with-capability (CREDIT receiver)
(credit receiver receiver-guard amount)
)
)
)
)
(defun get-balance:decimal
( account:string )
(at 'balance (read token-table account ['balance]))
)
(defun details:object{free.fungible-v2.account-details}
( account:string )
(with-read token-table account
{ "balance" := balance
, "guard" := guard
}
{ "account" : account
, "balance" : balance
, "guard" : guard
}
)
)
(defun precision:integer
()
DECIMALS
)
(defun enforce-unit:bool
( amount:decimal )
#doc " Enforce the minimum denomination for token transactions. "
(enforce
(= (floor amount DECIMALS) amount)
(format "Amount violates minimum denomination: {}" [amount])
)
)
(defun create-account:string
( account:string
guard:guard )
#doc " Create a new account. "
#model [ (property (valid-account-id account)) ]
(enforce-reserved account guard)
(insert token-table account
{ "balance" : 0.0
, "guard" : guard
}
)
)
(defun rotate:string
( account:string
new-guard:guard )
(with-read token-table account
{ "guard" := oldGuard }
(enforce-guard oldGuard)
(enforce-guard new-guard)
(update token-table account
{ "guard" : new-guard }
)
)
)
)
You specified your module implements an interface that does not exist.
Remove free from the interface names: free.fungible-xchain-v1 and free.fungible-v2 should be fungible-xchain-v1 and fungible-v2.
Alternatively you can create the interfaces by deploying them to the specified name.
See also the interface you are trying to implement: https://balance.chainweb.com/modules.html?server=api.chainweb.com&module=fungible-xchain-v1&chain=0
An example in the real world of how to implement it: https://balance.chainweb.com/modules.html?server=api.chainweb.com&module=coin&chain=0&line=20
Related
[PROCEDURE SEND_MAIL(
P_FROM IN VARCHAR ,
P_TO IN VARCHAR ,
P_CC IN VARCHAR ,
P_PASSWORD IN VARCHAR2 ,
P_SUBJ IN VARCHAR,
P_MSG IN VARCHAR2
)
IS
conn utl_smtp.connection ;
reply utl_smtp.reply;
err_no number;
BEGIN
conn:=utl_smtp.open_connection(host => 'smtp.office365.com',port => 587,
wallet_path => 'file:D:\app\oracle\product\11.2.0\dbhome_1\BIN\owm\wallets\oracle',
wallet_password => 'Iectest123',secure_connection_before_smtp => true);
exception
when others then
messagebox(SQLCODE||','||SQLERRM);
end ;
utl_smtp.helo(conn, lv_mailhost);
utl_smtp.STARTTLS(conn);
utl_smtp.command( conn, utl_raw.cast_to_varchar2
( utl_encode.base64_encode( utl_raw.cast_to_raw(p_from))));
utl_smtp_SEC.command( conn, utl_raw.cast_to_varchar2
( utl_encode.base64_encode( utl_raw.cast_to_raw(P_PASSWORD ))));
utl_smtp.mail(conn, p_from);
utl_smtp.rcpt(conn, p_to);
utl_smtp.open_data(conn);
utl_smtp.write_data(conn,'MIME-Version: 1.0'|| chr(13)||chr(10) );
utl_smtp_SEC.write_data(conn, 'Content-Type: text/plain; charset=iso-8859-6' || --iso-8859-6
chr(13)||chr(10)); --iso-8859-6
utl_smtp.write_data(conn, 'Content-Transfer-Encoding: Cp1256' ||-- ARABIC.AR8MSWIN1256
chr(13)||chr(10)); --8bit
utl_smtp.write_data(conn, 'From:' ||p_from || chr(13)||chr(10));
utl_smtp.write_data(conn, 'To:' ||p_to || chr(13)||chr(10));
utl_smtp.write_data(conn, 'Cc:' ||p_cc || chr(13)||chr(10));
utl_smtp.write_data(conn, 'Reply-To:' ||p_from || chr(13)||chr(10));
utl_smtp.write_data(conn, 'Subject:' ||p_subj|| chr(13)||chr(10));
utl_smtp.write_data(conn, chr(13)||chr(10));
---------
utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(p_msg));
utl_smtp.close_data(conn);
utl_smtp.quit(conn);
messagebox('send Sucessful');
EXCEPTION WHEN OTHERS THEN
msgbox(sqlerrm);
END;][1]
when i run the procedure i get error ora-28759 failure to open file
althought the path is right and the DBA gave me permission and full control of the whole folder
The user I'm running the code as can access the wallet path
I just don't know where is the problem
is it in the code or on the configuration of the wallet cause i have no experience in the wallet issues
I am trying to create a mod for a game server that i am playing, the idea is to give flag permissions to people based on being a mod or admin. The flags can be assigned by the server owner in a config file.
What i am trying to create, is a for loop that reads a section of the config file and passes the index and value to a function that then sends the information to the server.
function PLUGIN:cmdgiveflags ( netuser , cmd, args )
if (netuser:CanAdmin()) then
local a, targetuser = rust.FindNetUsersByName( args[1] )
if (not a) then
if (targetuser == 0) then
rust.Notice( netuser , "No Players by that name!" )
else
rust.Notice( netuser , "Multiple Players by the name!" )
end
return
end
if ( args[2] == "admin" ) then
**for key,value in pairs(self.Config.admin) do self.addflag(targetuser,key,value) end**
elseif ( args[2] == "mod") then
**for key,value in pairs(self.Config.mod) do self.addflag(targetuser,key,value) end**
else
rust.Notice( netuser , "Invalid Option, must be mod or admin" )
end
else
rust.Notice( netuser , "Only and Admin can use this command" )
end
end
function PLUGIN:addflag (targetuser, key, value)
print ("targetuser is "..targetuser)
**print ("key is "..key)**
**print ("value is "..value)**
if (value == true) then
if (key == "cangod" ) or (key == "canban") or (key == "cankick") or (key == "all") then
rust.RunServerCommand( "oxmin.giveflag " .. targetuser .. " " .. key )
print (targetuser .. " has been given the flag: " .. key )
else
rust.RunServerCommand( "flags.addflag " .. targetuser .. " " .. key )
print (targetuser .. " has been given the flag: " .. key )
end
end
end
The problem that i am having is when the variables key and value are sent to the addflags functions, key shows up as true and value is nil. but if i just do print(key,value) in the for loop they come out as expected. I only just started coding in Lua so I'm not too sure what the rules all are just yet. Any help would be appreciated.
Oh and sorry if the code isnt formatted correctly on the site, not sure how to get it to paste with the correct formatting.
You want self:addflag instead of self.addflag.
The definition
function PLUGIN:addflag (targetuser, key, value)
is sugar for
function PLUGIN.addflag (self, targetuser, key, value)
The call
self:addflag(targetuser,key,value)
is sugar for
self.addflag(self,targetuser,key,value)
So you have to make a call that is consistent with the definition of the function.
I have been trying to get org-mobile to work on my machine with little
success. I have read many previous answers from this mailing list to no
avail.
When I try to run org-mobile-push I get an error in the minibuffer: "Wrong
type argument: listp, todo".
I have attached a Backtrace of the error and my org-mode settings. I also
attached a debugger eval of the "todo" variable, which I think (I'm not
great at elisp) is causing the error.
Can anyone tell me how I can get org-mobile-push to work correctly?
Cheers!
---- Backtrace and org settings follow ----
Debugger entered--Lisp error: (void-variable todo)
eval(todo)
eval-expression(todo)
debugger-eval-expression(todo)
call-interactively(debugger-eval-expression nil nil)
recursive-edit()
byte-code("\306^P
#\307=\203!^#\310\311\312\"\210\313\311!\211^ZA#)\242\314=\203!^#\310\315\312\"\210\316^K!\210\317
\210\320
!\210\f\203d^#\321ed\"^MV\203W^#eb\210\322^M\245y\210`^^^[db\210\322^M\245^MZy\210^N^[`|\210)\323c\210eb\210\324\325\326
\"\210\327\306!\210\324\330!\210\331\312^^^\^^^]\324\330!\210\212\332
\210+\331\207" [unread-command-char debugger-args x debugger-buffer
noninteractive debugger-batch-max-lines -1 debug backtrace-debug 4 t
backtrace-frame lambda 5 pop-to-buffer debugger-mode debugger-setup-buffer
count-lines 2 "...\n" message "%s" buffer-string kill-emacs "" nil
recursive-edit middlestart buffer-read-only standard-output] 4)
Debugger entered--Lisp error: (wrong-type-argument listp todo)
car(todo)
(setq type (car e) match (nth 1 e) settings (nth 2 e))
(while (setq e (pop cmds)) (setq type (car e) match (nth 1 e) settings
(nth 2 e)) (setq settings (append gsettings settings)) (setq settings (cons
... settings)) (push (list type match settings) new))
(cond ((stringp ...)) ((eq ... ...)) ((memq ... ...)) ((and ... ...))
((memq ... ...) (setq key ... desc ... type ... match ... settings ...)
(setq settings ...) (push ... new)) ((or ... ...)) (t (setq gkey ... gdesc
... gsettings ... cmds ...) (setq cnt 0) (while ... ... ... ... ...)))
(while (setq e (pop thelist)) (cond (...) (...) (...) (...) (... ... ...
...) (...) (t ... ... ...)))
(let ((custom-list ...) (default-list ...) thelist new e key desc type
match settings cmds gkey gdesc gsettings cnt) (cond (... ...) (... ...)
(... ... ... ...) (... ... ...)) (while (setq e ...) (cond ... ... ... ...
... ... ...)) (and new (list "X" "SUMO" ... ...)))
org-mobile-sumo-agenda-command()
(let* ((file ...) (file1 ...) (sumo ...) (org-agenda-custom-commands ...)
(org-mobile-creating-agendas t)) (unless (file-writable-p file1) (error
"Cannot write to file %s" file1)) (when sumo (org-store-agenda-views))
(when org-mobile-use-encryption (org-mobile-encrypt-and-move file1 file)
(delete-file file1) (org-mobile-cleanup-encryption-tempfile)))
org-mobile-create-sumo-agenda()
(let ((inhibit-redisplay t)) (org-mobile-create-sumo-agenda))
(save-window-excursion (run-hooks (quote org-mobile-pre-push-hook))
(org-mobile-check-setup) (org-mobile-prepare-file-lists) (message "Creating
agendas...") (let (...) (org-mobile-create-sumo-agenda)) (message "Creating
agendas...done") (org-save-all-org-buffers) (message "Copying files...")
(org-mobile-copy-agenda-files) (message "Writing index file...")
(org-mobile-create-index-file) (message "Writing checksums...")
(org-mobile-write-checksums) (run-hooks (quote org-mobile-post-push-hook)))
(save-excursion (save-window-excursion (run-hooks ...)
(org-mobile-check-setup) (org-mobile-prepare-file-lists) (message "Creating
agendas...") (let ... ...) (message "Creating agendas...done")
(org-save-all-org-buffers) (message "Copying files...")
(org-mobile-copy-agenda-files) (message "Writing index file...")
(org-mobile-create-index-file) (message "Writing checksums...")
(org-mobile-write-checksums) (run-hooks ...)))
(let ((org-agenda-buffer-name "*SUMO*") (org-agenda-filter
org-agenda-filter) (org-agenda-redo-command org-agenda-redo-command))
(save-excursion (save-window-excursion ... ... ... ... ... ... ... ... ...
... ... ... ... ...)))
(let ((a-buffer ...)) (let (... ... ...) (save-excursion ...))
(redraw-display) (when (and a-buffer ...) (if ... ... ...)))
org-mobile-push()
call-interactively(org-mobile-push t nil)
execute-extended-command(nil)
call-interactively(execute-extended-command nil nil)
Emacs : GNU Emacs 23.2.1 (i686-pc-linux-gnu, GTK+ Version 2.24.4)
of 2011-04-04 on rothera, modified by Debian
Package: Org-mode version 7.7
current state:
(setq
org-log-done 'time
org-export-latex-after-initial-vars-hook '(org-beamer-after-initial-vars)
org-speed-command-hook '(org-speed-command-default-hook
org-babel-speed-command-hook)
org-agenda-custom-commands '(("c" "TODO list, Priority down" todo
"NEXTACTION"
((org-agenda-sorting-strategy (quote (priority-down)))
)
("/media/sf_Conor/todolistprioritydown.ps"))
("x" "Todo List and Agenda"
(todo (quote (priority-down))
(agenda "" (org-agenda-ndays 1)))
((org-agenda-sorting-strategy (quote (time-up))))
("/media/sf_Conor/todolistprioritydown.ps"))
("w" "other Work" tags-todo "DONE"
((org-agenda-files
(quote
("/media/sf_Conor/Dropbox/Orgmode/2011/todo.org"))
)
(org-agenda-sorting-strategy
(quote (priority-up effort-down)))
)
("/media/sf_Conor/computer.html"))
("p" "Priority List" tags-todo
((org-agenda-sorting-strategy (quote (priority-up)))))
)
org-agenda-files '("/media/sf_Conor/Dropbox/Orgmode/2011/
accountmanagement.org"
"/media/sf_Conor/Dropbox/Orgmode/2011/heritage.org"
"/media/sf_Conor/Dropbox/Orgmode/2011/arbitrage.org"
"/media/sf_Conor/Dropbox/Orgmode/2011/kontagent.org"
"/media/sf_Conor/Dropbox/Orgmode/2011/todo.org")
org-blocker-hook '(org-block-todo-from-children-or-siblings-or-parent)
org-agenda-exporter-settings '((ps-number-of-columns 2) (ps-landscape-mode
t)
(org-agenda-add-entry-text-maxlines 5)
(htmlize-output-type (quote css)))
org-metaup-hook '(org-babel-load-in-session-maybe)
org-after-todo-state-change-hook '(wicked/org-clock-out-if-waiting
wicked/org-clock-in-if-starting
org-clock-out-if-current)
org-agenda-todo-ignore-scheduled t
org-show-entry-below t
org-export-blocks-postblock-hook '(org-exp-res/src-name-cleanup)
org-export-latex-format-toc-function 'org-export-latex-format-toc-default
org-mobile-inbox-for-pull "/media/sf_Conor/Dropbox/Orgmode/2011/
from-mobile.org"
org-tab-first-hook '(org-hide-block-toggle-maybe
org-src-native-tab-command-maybe
org-babel-hide-result-toggle-maybe)
org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
org-confirm-shell-link-function 'yes-or-no-p
org-export-first-hook '(org-beamer-initialize-open-trackers)
org-clock-persist t
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-agenda-start-with-follow-mode t
org-directory "/media/sf_Conor/Dropbox/Orgmode/2011/"
org-export-docbook-xslt-proc-command ""
org-babel-pre-tangle-hook '(save-buffer)
org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
org-cycle-show-empty-lines
org-optimize-window-after-visibility-change)
org-export-preprocess-before-normalizing-links-hook
'(org-remove-file-link-modifiers)
org-agenda-dim-blocked-tasks nil
org-mode-hook '((lambda nil (org-set-local (quote yas/trigger-key) [tab])
(define-key yas/keymap [tab] (quote yas/next-field-group))
(define-key org-mode-map "\301"
(quote org-archive-to-archive-sibling))
)
org-clock-load
(lambda nil
(org-add-hook (quote change-major-mode-hook)
(quote org-show-block-all) (quote append) (quote local))
)
(lambda nil
(org-add-hook (quote change-major-mode-hook)
(quote org-babel-show-result-all) (quote append) (quote local))
)
org-babel-result-hide-spec org-babel-hide-all-hashes)
org-refile-targets '(:level . 2)
org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point
org-babel-execute-safely-maybe)
org-confirm-elisp-link-function 'yes-or-no-p
org-export-interblocks '((lob org-babel-exp-lob-one-liners)
(src org-babel-exp-inline-src-blocks))
org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
org-enforce-todo-dependencies t
org-occur-hook '(org-first-headline-recenter)
org-from-is-user-regexp "\\<Conor Nash\\>"
org-mobile-directory "/media/sf_Conor/Dropbox/MobileOrg/"
org-export-preprocess-before-selecting-backend-code-hook
'(org-beamer-select-beamer-code)
org-export-latex-final-hook '(org-beamer-amend-header org-beamer-fix-toc
org-beamer-auto-fragile-frames
org-beamer-place-default-actions-for-lists)
org-metadown-hook '(org-babel-pop-to-session-maybe)
org-export-blocks '((src org-babel-exp-src-block nil)
(comment org-export-blocks-format-comment t)
(ditaa org-export-blocks-format-ditaa nil)
(dot org-export-blocks-format-dot nil))
)
I believe your problem is with the org-agenda-custom-commands variable. In particular you have the value
("x" "Todo List and Agenda"
(todo (quote (priority-down))
(agenda "" (org-agenda-ndays 1)))
((org-agenda-sorting-strategy (quote (time-up))))
("/media/sf_Conor/todolistprioritydown.ps"))
which is the cause of the problem, at least I get the same error when I set org-agenda-custom-commands as you have and run M-x org-agenda RET x. Changing it's value to
("x" "Todo List and Agenda"
((todo (quote (priority-down)))
(agenda "" ((org-agenda-ndays 1))))
((org-agenda-sorting-strategy (quote (time-up))))
("/media/sf_Conor/todolistprioritydown.ps"))
"fixes" the error, but I don't know if it actually does what you want. Note there are extra parentheses in 2 places: around (todo (quote (priority-down))) and ((org-agenda-ndays 1)).
Don't know about the backtracenot a elisper also but I've setup mine using the following post,
http://nakkaya.com/2010/03/19/org-mode-in-your-pocket-setting-up-mobileorg/
My .emacs:
;; enable orgmode en set files
(require 'org-install)
(setq org-directory "~/Dropbox/GTD/")
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-log-done t)
(setq org-agenda-files (list (concat org-directory "nextactions.org")
(concat org-directory "projects.org")
(concat org-directory "birthday.org")))
;; Daily action list
(setq org-agenda-custom-commands
'(
("D" "Daily Action List"
(
(agenda "" ((org-agenda-ndays 1)
(org-agenda-sorting-strategy
(quote ((agenda time-up priority-down tag-up) )))
(org-deadline-warning-days 0)
))))
;; Office list
("H" "Office and Home Lists"
((agenda)
(tags-todo "OFFICE")
(tags-todo "HOME")))
)
)
;; Turn on diary within org-mode
(setq org-agenda-include-diary t)
;; Turn on Capture
(setq org-default-notes-file (concat org-directory "notes.org"))
(define-key global-map "\C-cc" 'org-capture)
;; Capture templates
(setq org-capture-templates
'(
("t" "Todo" entry (file+headline (concat org-directory "nextactions.org") "Inbox") "* TODO %?\n %i\n %a")
("j" "Journal" entry (file+datetree (concat org-directory "journal.org")) "* %?\nEntered on %U\n %i\n %a")
)
)
C-c c presents the capture menu buffer. I press then t and capture the buffer that appears (CAPTURE-notes.org). After C-c C-c the entry is added to notes.org instead of nextactions.org section "Inbox".
I have no .emacs parsing errors, how can I fix this so the todo capture-template puts its entry in nextactions.org?
Edit: Setting org-default-notes-file to nextactions.org lets me operate at least the first org-capture template (because its file is the same anyway). The second one stays writing to the default-notes-file.
What org-mode version are you using? I don't remember the exact version, but quoted capture templates were not eval'ed before that.
So you should try either
Update org-mode
use backquotes
(setq org-capture-templates
`(("t" "Todo" entry (file+headline ,(concat org-directory "nextactions.org")
"Inbox")
"* TODO %?\n %i\n %a")
("j" "Journal" entry (file+datetree ,(concat org-directory "journal.org"))
"* %?\nEntered on %U\n %i\n %a")
))
use the literal filepath
(setq org-capture-templates
'(("t" "Todo" entry (file+headline "~/Dropbox/GTD/nextactions.org"
"Inbox")
"* TODO %?\n %i\n %a")
("j" "Journal" entry (file+datetree "~/Dropbox/GTD/journal.org")
"* %?\nEntered on %U\n %i\n %a")
))
Apart from that I see no problem with your config, I use a similar one.
infact you can even refile from the capture buffer to which ever agenda file you want to with C-c C-w.
How to insert a blob in database using the clojure.contrib.sql?
I've tried the following reading from a file but I'm getting this exception:
SQLException:
Message: Invalid column type
SQLState: 99999
Error Code: 17004
java.lang.Exception: transaction rolled back: Invalid column type (repl-1:125)
(clojure.contrib.sql/with-connection
db
(clojure.contrib.sql/transaction
(clojure.contrib.sql/insert-values :test_blob [:blob_id :a_blob] [3 (FileInputStream. "c:/somefile.xls")]) ))
Thanks.
I was able to solve this by converting the FileInputStream into a ByteArray.
(clojure.contrib.sql/with-connection
db
(clojure.contrib.sql/transaction
(clojure.contrib.sql/insert-values :test_blob [:blob_id :a_blob] [3 (to-byte-array(FileInputStream. "c:/somefile.xls"))]) ))
In theory, you can use any of the clojure.contrib.sql/insert-* methods to insert a blob, passing the blob as either a byte array, java.sql.Blob or a java.io.InputStream object. In practice, it is driver-dependent.
For many JDBC implementations, all of the above work as expected, but if you're using sqlitejdbc 0.5.6 from Clojars, you'll find your blob coerced to a string via toString(). All the clojure.contrib.sql/insert-* commands are issued via clojure.contrib.sql/do-prepared, which calls setObject() on a java.sql.PreparedStatement. The sqlitejdbc implementation does not handle setObject() for any of the blob data types, but defaults to coercing them to a string. Here's a work-around that enables you to store blobs in SQLite:
(use '[clojure.contrib.io :only (input-stream to-byte-array)])
(require '[clojure.contrib.sql :as sql])
(defn my-do-prepared
"Executes an (optionally parameterized) SQL prepared statement on the
open database connection. Each param-group is a seq of values for all of
the parameters. This is a modified version of clojure.contrib.sql/do-prepared
with special handling of byte arrays."
[sql & param-groups]
(with-open [stmt (.prepareStatement (sql/connection) sql)]
(doseq [param-group param-groups]
(doseq [[index value] (map vector (iterate inc 1) param-group)]
(if (= (class value) (class (to-byte-array "")))
(.setBytes stmt index value)
(.setObject stmt index value)))
(.addBatch stmt))
(sql/transaction
(seq (.executeBatch stmt)))))
(defn my-load-blob [filename]
(let [blob (to-byte-array (input-stream filename))]
(sql/with-connection db
(my-do-prepared "insert into mytable (blob_column) values (?)" [blob]))))
A more recent reply to this thread with the code to read the data as well :
(ns com.my-items.polypheme.db.demo
(:require
[clojure.java.io :as io]
[clojure.java.jdbc :as sql]))
(def db {:dbtype "postgresql"
:dbname "my_db_name"
:host "my_server"
:user "user",
:password "user"})
(defn file->bytes [file]
(with-open [xin (io/input-stream file)
xout (java.io.ByteArrayOutputStream.)]
(io/copy xin xout)
(.toByteArray xout)))
(defn insert-image [db-config file]
(let [bytes (file->bytes file)]
(sql/with-db-transaction [conn db-config]
(sql/insert! conn :image {:name (.getName file) :data bytes}))))
(insert-image db (io/file "resources" "my_nice_picture.JPG"))
;;read data
(defn read-image [db-config id]
(-> (sql/get-by-id db-config :image id)
:data
(#(new java.io.ByteArrayInputStream %))))
I believe it's just the same way you'd insert any other value: use one of insert-records, insert-rows or insert-values. E.g.:
(insert-values :mytable [:id :blobcolumn] [42 blob])
More examples: http://github.com/richhickey/clojure-contrib/blob/master/src/test/clojure/clojure/contrib/test_sql.clj