AutoCAD 2013 - Error: ARXLOAD failed - autocad

currently i have autocad 2012 and want to upgrade to autocad 2013.
I have a custom made addition to my autocad.
But when i try to load this i get this:
COM.VLX loaded.; error: ARXLOAD failed
Here is a part of my acaddoc.lsp:
;; ACADDOC.LSP is loaded into memory before the drawing is completely
;; initialized. S::STARTUP is called when a new drawing or an existing
;; drawing is opened. And is guaranteed to perform any setup operations
;; after a drawing is initialized.
(defun LoadARXVBA(/ strplatform strExt)
(if (wcmatch (getvar "platform") "*(x64)*")
(setq strExt "x64.arx")
(setq strExt ".arx")
)
;; load arx modules
(arxload (strcat "DetectESC" strExt))
(arxload (strcat "osnap" strExt))
(arxload (strcat "beditReactor" strExt))
;; load vba projects
(vla-loaddvb (acadobject) (findfile "sinkblock.dvb"))
(vla-loaddvb (acadobject) (findfile "triggers.dvb"))
(if (member "plotlog.arx" (arx));if loaded by acad.rx
(vla-loaddvb (acadobject) (findfile "PlotLog.dvb"))
)
;; connect to plotlog server
(if (member (strcat "plotlog" strExt) (arx))
(vla-runmacro (acadobject) "StartMonitor")
)
;; visuallisp projects
(load "base.vlx")
(load "startup.vlx")
(load "TSLOAD"); Load TIMESAVERS' commands:
(defun EVALCHK (dummy / ) 1)
;; run stuff
(startup)
)
(defun-q main(/)
;; load visuallisp & vba projects
(setvar "screenmenu" 1)
(setvar "menubar" 1)
(load "com.vlx")
(if (eq (vla-get-visible (acadobject)) :vlax-true)
(LoadARXVBA)
) ;end if
(princ)
) ;end main
(setvar "savetime" 8)
;; append 'main function to any posible existing S::STARTUP function
(setq s::startup (append s::startup main))
;|«Visual LISP© Format Options»
(100 2 1 2 nil "end of " 100 70 0 0 nil T T nil T)
;*** DO NOT add text below the comment! ***|;
Can anyone help me with this?
I have read at some places that there something changed in the arx loading ...

The ARX module will need to be rebuilt with the ObjectARX 2013 SDK for use in AutoCAD 2013.

Download ObjectARX 2013 : http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=785550 and rebuild your solution using the 2013 SDK.
Here is the ObjectARX Wizard for AutoCAD 2013 and MSVC 2010 : http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=785550
Hope it helped.
Tom,

Related

Why is my emacs barking (noise at the end of file)?

I'm fairly certain this was self-inflicted but I cannot for the life of me remember how.
Every time I hit the end of a buffer in emacs and press C-n emacs barks like a dog. I think the bark is probably a custom sound file somewhere made to replace the bell noise that's there by default. I don't know where the sound file or the configuration setting are, though.
Here is the only configuration file I have:
init.el
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(gdb-many-windows t)
'(gdb-show-main t)
'(inhibit-startup-screen t)
'(package-selected-packages '(slime nasm-mode org-roam zig-mode)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
;; INIT.EL
;; Maximize the window on startup
(add-to-list 'default-frame-alist '(fullscreen . maximized))
;; Turn off backups
(setq make-backup-files nil)
;; Auto revert changed buffers
(global-auto-revert-mode 1)
;; source: http://steve.yegge.googlepages.com/my-dot-emacs-file
(defun rename-file-and-buffer (new-name)
"Renames both current buffer and file it's visiting to NEW-NAME."
(interactive "sNew name: ")
(let ((name (buffer-name))
(filename (buffer-file-name)))
(if (not filename)
(message "Buffer '%s' is not visiting a file!" name)
(if (get-buffer new-name)
(message "A buffer named '%s' already exists!" new-name)
(progn
(rename-file filename new-name 1)
(rename-buffer new-name)
(set-visited-file-name new-name)
(set-buffer-modified-p nil))))))
;; source: https://stackoverflow.com/questions/38672928/how-to-set-emacs-up-for-assembly-programming-and-fix-indentation
(defun my-asm-mode-hook ()
;; you can use `comment-dwim' (M-;) for this kind of behaviour anyway
(local-unset-key (vector asm-comment-char))
;; (local-unset-key "<return>") ; doesn't work. "RET" in a terminal. http://emacs.stackexchange.com/questions/13286/how-can-i-stop-the-enter-key-from-triggering-a-completion-in-company-mode
(electric-indent-local-mode) ; toggle off
; (setq tab-width 4)
(setq indent-tabs-mode nil)
;; asm-mode sets it locally to nil, to "stay closer to the old TAB behaviour".
;; (setq tab-always-indent (default-value 'tab-always-indent))
(defun asm-calculate-indentation ()
(or
;; Flush labels to the left margin.
; (and (looking-at "\\(\\.\\|\\sw\\|\\s_\\)+:") 0)
(and (looking-at "[.#_[:word:]]+:") 0)
;; Same thing for `;;;' comments.
(and (looking-at "\\s<\\s<\\s<") 0)
;; %if nasm macro stuff goes to the left margin
(and (looking-at "%") 0)
(and (looking-at "c?global\\|section\\|default\\|align\\|INIT_..X") 0)
;; Simple `;' comments go to the comment-column
;(and (looking-at "\\s<\\(\\S<\\|\\'\\)") comment-column)
;; The rest goes at column 4
(or 4)))
)
(add-hook 'asm-mode-hook #'my-asm-mode-hook)
(setq inferior-lisp-program "sbcl")
(windmove-default-keybindings)
(add-hook 'c-mode-hook #'display-fill-column-indicator-mode)
I have two questions about this problem:
How do I disable this "feature"?
Where is emacs storing the configuration for this if not in init.el?
Most likely the sound is set somewhere in your OS as an alarm default.
Here's a great resource for further customizing whether and how the alarm triggers:
https://www.emacswiki.org/emacs/AlarmBell
To turn it off completely: (setq ring-bell-function 'ignore)

Need to extend elisp function

All,
I must suck at eLisp. Banged this first function out in no time.
(defun sort-lines-reverse (beg end)
"sort lines in reverse order"
(interactive
(if (use-region-p)
(list (region-beginning) (region-end))
(list (point-min) (point-max))))
(if (and beg end)
(sort-lines 1 beg end))
)
works perfectly. Hosed this next one
(defun sort-numeric-fields-reverse (field beg end)
"sort numeric fields in reverse order"
(interactive
(if (use-region-p)
(list (read-number "Field number: " 1) (region-beginning) (region-end))
(list (read-number "Field number: " 1) (point-min) (point-max)))
(message "calling if")
(if (and beg end)
((message "inside if")
(sort-numeric-fields field beg end)
(reverse-region beg end))
)
))
No runs no hits no errors. Don't see a single message displayed in messages. I do get my field number prompt.
A snippet of randomly generated test data if one so wishes.
8 412086510
8 744308263
8 1482781895
8 995992436
1 1021762533
1 897682569
1 963686690
1 166565707
1 2096612583
1 829723388
1 587753131
1 264251710
32 139885828
32 781244288
Adding insult to injury in my KDE Neon environment the C-M-x to bring up the lisp debugger doesn't do squat.
The only real difference between these two functions is in this one I have to prompt for a field number. Inside the if I run 2 functions instead of one. After getting the first one to work the second should have been a cakewalk.
Help would be appreciated.
Two issues:
missing ) at the end of interactive, after (if (use-region-p) ...
missing progn in (if (and beg end)...
(progn is superfluous because if has been replaced by when.)
Corrected version:
(defun sort-numeric-fields-reverse (field beg end)
"sort numeric fields in reverse order"
(interactive
(if (use-region-p)
(list (read-number "Field number: " 1) (region-beginning) (region-end))
(list (read-number "Field number: " 1) (point-min) (point-max))))
(message "calling if")
(when (and beg end)
(message "inside if")
(sort-numeric-fields field beg end)
(reverse-region beg end)))
EDIT: Code changed: if-progn replaced with when according to hint from #phils.
Hint: using an adequate editor makes the typing easy and gives you control over parentheses.

Trailing backslash error web-mode content type

I get this error when trying to set content type in web-mode: File mode specification error: (invalid-regexp Trailing backslash)
I have had a hard time debugging this. I'm very new to emacs so I need some help setting web-mode. I have been following the documentation in web-mode.org but it has been difficult to decypher. Thanks.
(use-package
web-mode
:defer 2
:ensure t
:mode ("\\.html?\\"
"\\.hbs$\\"
"\\.vue$\\"
"\\.css?\\"
"components/.*\\.js[x]?\\'"
"containers/.*\\.js[x]?\\'")
:config (progn
(setq web-mode-enable-auto-closing t
web-mode-enable-auto-opening t
web-mode-enable-auto-pairing t
web-mode-enable-auto-indentation t
web-mode-enable-auto-quoting t
;; right now paired with AutoComplete
web-mode-ac-sources-alist
'(("css" . (ac-source-css-property))
("vue" . (ac-source-words-in-buffer ac-source-abbrev))
("html" . (ac-source-words-in-buffer ac-source-abbrev)))
web-mode-content-types-alist
'(("jsx" . "components/.*\\.js[x]?\\'")
("jsx" . "containers/.*\\.js[x]?\\'")))))
;; usually I set them in containers/ or components/ directorie
;; and to keep seperate from plain JS
;; adjust indents for web-mode to 2 spaces
(defun my-web-mode-hook ()
"Hooks for Web mode. Adjust indents"
;;; http://web-mode.org/
(setq web-mode-markup-indent-offset 2)
(setq web-mode-css-indent-offset 2)
(setq web-mode-code-indent-offset 2))
(add-hook 'web-mode-hook 'my-web-mode-hook)
In the list of regexps after :mode, make sure that they all end with \\'. Currently two of them do, but four of them lost the final ' character.
:mode ("\\.html?\\'"
"\\.hbs$\\'"
"\\.vue$\\'"
"\\.css?\\'"
"components/.*\\.js[x]?\\'"
"containers/.*\\.js[x]?\\'")
\' is a special regexp construct that "matches the empty string, but only at the end of the buffer or string being matched against".

clojure.java.jdbc/query large resultset lazily

I'm trying to read millions of rows from a database and write to a text file.
This is a continuation of my question database dump to text file with side effects
My problem now seems to be that the logging doesn't happen until the program completes. Another indicator that i'm not processing lazily is that the text file isn't written at all until the program finishes.
Based on an IRC tip it seems my issue is likely having to do with :result-set-fnand defaulting to doall in the clojure.java.jdbc/query area of the code.
I have tried to replace this with a for function but still discover that memory consumption is high as it pulls the entire result set into memory.
How can i have a :result-set-fn that doesn't pull everything in like doall? How can I progressively write the log file as the program is running, rather then dump everything once the -main execution is finished?
(let [
db-spec local-postgres
sql "select * from public.f_5500_sf "
log-report-interval 1000
fetch-size 100
field-delim "\t"
row-delim "\n"
db-connection (doto ( j/get-connection db-spec) (.setAutoCommit false))
statement (j/prepare-statement db-connection sql :fetch-size fetch-size )
joiner (fn [v] (str (join field-delim v ) row-delim ) )
start (System/currentTimeMillis)
rate-calc (fn [r] (float (/ r (/ ( - (System/currentTimeMillis) start) 100))))
row-count (atom 0)
result-set-fn (fn [rs] (lazy-seq rs))
lazy-results (rest (j/query db-connection [statement] :as-arrays? true :row-fn joiner :result-set-fn result-set-fn))
]; }}}
(.setAutoCommit db-connection false)
(info "Started dbdump session...")
(with-open [^java.io.Writer wrtr (io/writer "output.txt")]
(info "Running query...")
(doseq [row lazy-results]
(.write wrtr row)
))
(info (format "Completed write with %d rows" #row-count))
)
I took the recent fixes for clojure.java.jdbc by putting [org.clojure/java.jdbc "0.3.0-beta1"] in my project.clj dependencies listing. This one enhances/corrects the :as-arrays? true functionality of clojure.java.jdbc/query described here.
I think this helped somewhat however I may still have been able to override the :result-set-fn to vec.
The core issue was resolved by tucking all row logic into :row-fn. The initial OutOfMemory problems had to do with iterating through j/query result sets rather than defining the specific :row-fn.
New (working) code is below:
(defn -main []
(let [; {{{
db-spec local-postgres
source-sql "select * from public.f_5500 "
log-report-interval 1000
fetch-size 1000
row-count (atom 0)
field-delim "\u0001" ; unlikely to be in source feed,
; although i should still check in
; replace-newline below (for when "\t"
; is used especially)
row-delim "\n" ; unless fixed-width, target doesn't
; support non-printable chars for recDelim like
db-connection (doto ( j/get-connection db-spec) (.setAutoCommit false))
statement (j/prepare-statement db-connection source-sql :fetch-size fetch-size :concurrency :read-only)
start (System/currentTimeMillis)
rate-calc (fn [r] (float (/ r (/ ( - (System/currentTimeMillis) start) 100))))
replace-newline (fn [s] (if (string? s) (clojure.string/replace s #"\n" " ") s))
row-fn (fn [v]
(swap! row-count inc)
(when (zero? (mod #row-count log-report-interval))
(info (format "wrote %d rows" #row-count))
(info (format "\trows/s %.2f" (rate-calc #row-count)))
(info (format "\tPercent Mem used %s " (memory-percent-used))))
(str (join field-delim (doall (map #(replace-newline %) v))) row-delim ))
]; }}}
(info "Started database table dump session...")
(with-open [^java.io.Writer wrtr (io/writer "./sql/output.txt")]
(j/query db-connection [statement] :as-arrays? true :row-fn
#(.write wrtr (row-fn %))))
(info (format "\t\t\tCompleted with %d rows" #row-count))
(info (format "\t\t\tCompleted in %s seconds" (float (/ (- (System/currentTimeMillis) start) 1000))))
(info (format "\t\t\tAverage rows/s %.2f" (rate-calc #row-count)))
nil)
)
Other things i experimented (with limited success) involved the timbre logging and turning off stardard out; i wondered if with using a REPL it might cache the results before displaying back to my editor (vim fireplace) and i wasn't sure if that was utilizing a lot of the memory.
Also, I added the logging parts around memory free with (.freeMemory (java.lang.Runtime/getRuntime)). I wasn't as familiar with VisualVM and pinpointing exactly where my issue was.
I am happy with how it works now, thanks everyone for your help.
You can use prepare-statement with the :fetch-size option. Otherwise, the query itself is eager despite the results being delivered in a lazy sequence.
prepare-statement requires a connection object, so you'll need to explicitly create one. Here's an example of how your usage might look:
(let [db-spec local-postgres
sql "select * from big_table limit 500000 "
fetch-size 10000 ;; or whatever's appropriate
cnxn (doto (j/get-connection db-spec)
(.setAutoCommit false))
stmt (j/prepare-statement cnxn sql :fetch-size fetch-size)
results (rest (j/query cnxn [stmt]))]
;; ...
)
Another option
Since the problem seems to be with query, try with-query-results. It's considered deprecated but is still there and works. Here's an example usage:
(let [db-spec local-postgres
sql "select * from big_table limit 500000 "
fetch-size 100 ;; or whatever's appropriate
cnxn (doto (j/get-connection db-spec)
(.setAutoCommit false))
stmt (j/prepare-statement cnxn sql :fetch-size fetch-size)]
(j/with-query-results results [stmt] ;; binds the results to `results`
(doseq [row results]
;;
)))
I've have found a better solution: you need to declare a cursor and fetch chunks of data from it in a transaction. Example:
(db/with-tx
(db/execute! "declare cur cursor for select * from huge_table")
(loop []
(when-let [rows (-> "fetch 10 from cur" db/query not-empty)]
(doseq [row rows]
(process-a-row row))
(recur))))
Here, db/with-tx, db/execute! and db/query are my own shortcuts declared in db namespace:
(def ^:dynamic
*db* {:dbtype "postgresql"
:connection-uri <some db url>)})
(defn query [& args]
(apply jdbc/query *db* args))
(defn execute! [& args]
(apply jdbc/execute! *db* args))
(defmacro with-tx
"Runs a series of queries into transaction."
[& body]
`(jdbc/with-db-transaction [tx# *db*]
(binding [*db* tx#]
~#body)))

Extracting URLs from an Emacs buffer?

How can I write an Emacs Lisp function to find all hrefs in an HTML file and extract all of the links?
Input:
<html>
<a href="http://www.stackoverflow.com" _target="_blank">StackOverFlow&lt/a>
<h1>Emacs Lisp</h1>
<a href="http://news.ycombinator.com" _target="_blank">Hacker News&lt/a>
</html>
Output:
http://www.stackoverflow.com|StackOverFlow
http://news.ycombinator.com|Hacker News
I've seen the re-search-forward function mentioned several times during my search. Here's what I think that I need to do based on what I've read so far.
(defun extra-urls (file)
...
(setq buffer (...
(while
(re-search-forward "http://" nil t)
(when (match-string 0)
...
))
I took Heinzi's solution and came up with the final solution that I needed. I can now take a list of files, extract all URL's and titles, and place the results in one output buffer.
(defun extract-urls (fname)
"Extract HTML href url's,titles to buffer 'new-urls.csv' in | separated format."
(setq in-buf (set-buffer (find-file fname))); Save for clean up
(beginning-of-buffer); Need to do this in case the buffer is already open
(setq u1 '())
(while
(re-search-forward "^.*<a href=\"\\([^\"]+\\)\"[^>]+>\\([^<]+\\)</a>" nil t)
(when (match-string 0) ; Got a match
(setq url (match-string 1) ) ; URL
(setq title (match-string 2) ) ; Title
(setq u1 (cons (concat url "|" title "\n") u1)) ; Build the list of URLs
)
)
(kill-buffer in-buf) ; Don't leave a mess of buffers
(progn
(with-current-buffer (get-buffer-create "new-urls.csv"); Send results to new buffer
(mapcar 'insert u1))
(switch-to-buffer "new-urls.csv"); Finally, show the new buffer
)
)
;; Create a list of files to process
;;
(mapcar 'extract-urls '(
"/tmp/foo.html"
"/tmp/bar.html"
))
If there is at most one link per line and you don't mind some very ugly regular expression hacking, run the following code on your buffer:
(defun getlinks ()
(beginning-of-buffer)
(replace-regexp "^.*<a href=\"\\([^\"]+\\)\"[^>]+>\\([^<]+\\)</a>.*$" "LINK:\\1|\\2")
(beginning-of-buffer)
(replace-regexp "^\\([^L]\\|\\(L[^I]\\)\\|\\(LI[^N]\\)\\|\\(LIN[^K]\\)\\).*$" "")
(beginning-of-buffer)
(replace-regexp "
+" "
")
(beginning-of-buffer)
(replace-regexp "^LINK:\\(.*\\)$" "\\1")
)
It replaces all links with LINK:url|description, deletes all lines containing anything else, deletes empty lines, and finally removes the "LINK:".
Detailed HOWTO: (1) Correct the bug in your example html file by replacing <href with <a href, (2) copy the above function into Emacs scratch, (3) hit C-x C-e after the final ")" to load the function, (4) load your example HTML file, (5) execute the function with M-: (getlinks).
Note that the linebreaks in the third replace-regexp are important. Don't indent those two lines.
You can use the 'xml library, examples of using the parser are found here. To parse your particular file, the following does what you want:
(defun my-grab-html (file)
(interactive "fHtml file: ")
(let ((res (car (xml-parse-file file)))) ; 'car because xml-parse-file returns a list of nodes
(mapc (lambda (n)
(when (consp n) ; don't operate on the whitespace, xml preserves whitespace
(let ((link (cdr (assq 'href (xml-node-attributes n)))))
(when link
(insert link)
(insert "|")
(insert (car (xml-node-children n))) ;# grab the text for the link
(insert "\n")))))
(xml-node-children res))))
This does not recursively parse the HTML to find all the links, but it should get you started in the direction of the general solution.

Resources