I'm not sure what I did, but all of the sudden, I am getting a bunch of errors when I perform various operations in Aquamacs. For example, when I try to open a C file, I get the error "File mode specification error: (wrong-type-argument number-or-marker-p nil)". If I turn on the debugger, I get the following stack trace:
Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
define-abbrev([## 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 else 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...] "else" "else" c-electric-continued-statement 0 t)
apply(define-abbrev [## 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 else 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...] ("else" "else" c-electric-continued-statement 0 t))
byte-code("\302\303\304 #\305\"#\207" [table defs apply define-abbrev append (t)] 6)
c-define-abbrev-table(c-mode-abbrev-table (("else" "else" c-electric-continued-statement 0) ("while" "while" c-electric-continued-statement 0)) "Abbreviation table used in c-mode buffers.")
c-mode()
set-auto-mode-0(c-mode nil)
set-auto-mode()
normal-mode(t)
after-find-file(nil t)
find-file-noselect-1(#<buffer EventLog.h> "~/repositories/ghc/rts/eventlog/EventLog.h" nil nil "~/repositories/ghc/rts/eventlog/EventLog.h" (12100462 16777218))
find-file-noselect("~/.cabal/../repositories/ghc/rts/eventlog/EventLog.h" nil nil t)
find-file("~/.cabal/../repositories/ghc/rts/eventlog/EventLog.h" t)
call-interactively(find-file nil nil)
command-execute(find-file)
Anyone have any ideas as to what might be going on here?
OK, so I have no idea what happened, but I was able to fix it by doing a (very) clean reinstall. I first deleted the application folder, and then did a recursive find for any Aquamacs folder in the file system.
find . -regex "Aquamacs.*" -maxdepth 5
was able to give me a listing of all such files. There are a bunch of cached preference directories that do not get deleted when the application is uninstalled. I first tried using App Cleaner, which wasn't able to get all of these. After I deleted every Aquamacs related directory, and reinstalled, it worked just fine.
Related
This function is confusing to use, and it always gives me an error:
To RESHAPE the number of elements must not change.
That's my code:
im=im2col(zeros(300,300),[3 3]);
im(:,9)=ones(9,1);
im=col2im(im,[3 3],[300 300]);
Basically, this code just gets the block at index 6, replaces it with ones, and reassembles it back into the original image. What's wrong with this code?
It seems you want to create distinct blocks from your input array, change single blocks, and rearrange them. (Your target size is the same as your input array size.) So, you must use the distinct parameter in both, im2col as well as col2im:
blk_size = [3, 3];
im = zeros(9, 9)
temp = im2col(im, blk_size, 'distinct');
temp(:, 3) = ones(prod(blk_size), 1);
im2 = col2im(temp, [3 3], size(im), 'distinct')
Output:
im =
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
im2 =
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
1 1 1 0 0 0 0 0 0
1 1 1 0 0 0 0 0 0
1 1 1 0 0 0 0 0 0
When using im2col with the sliding parameter, which is also the default, if no parameter is set at all, there'll be a lot more columns in the result than can be rearranged to the input array size, cf. the Tips section on im2col.
Hope that helps!
I am trying to dump an old database back into my system, but a weird error occurs.
When I login to 'postgres' database (psql posgtgres) the files would load, and the data would be also inserted,
CREATE TABLE
ALTER TABLE
but when I login to the database I created(psql EXAMPLE), it says
syntax error near "1"
Here is the part of the file that fails when I'm logged in to 'EXAMPLE' database :
...f92, f93, f94) FROM stdin;
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Please note that it is exactly the same file, and it was not edited before I connected to 'EXAMPLE' database.
Thank you in advance
EDIT:
Here is the copy command that gives the error.
COPY mmm_a1_0912_vorskla_02c (shot_num, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59, f60, f61, f62, f63, f64, f65, f66, f67, f68, f69, f70, f71, f72, f73, f74, f75, f76, f77, f78, f79, f80, f81, f82, f83, f84, f85, f86, f87, f88, f89, f90, f91, f92, f93, f94) FROM stdin;
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
EDIT#2
FIXED:
Actually I initially assumed that every database you create will have a 'public' schema by default. My newly created database didn't. That was the issue.
I have the following input file
-------------------------------------
--- A-TKE spectrum (post-neutron)---
-------------------------------------
2-dim. array: (A = 73 To 162 Step 1) (E = 122 To 198 Step 1)
(The data are written according to the loop structure specified above.
The last loop is the inner-most one. Line breaks are not related to the data structure!
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 1 0 0 2 0 0 1 0 0 0 0
</A_TKE>
</Results>
This file is part of a bigger file, which contains more number block similar to the above one.
What I want to do is print in a seperate file the numbers that are within the file. As a first try, I thought "Let's print what is between two patters". The START pattern will be --- A-TKE spectrum (post-neutron)--- and the END pattern will </A_TKE>
I used
awk '/--- A-TKE spectrum (post-neutron)---/{flag=1;next}/</A_TKE>/{flag=0}flag{print}' input
To my surprise nothing is printed on the screen. Any idea on why is this happening?
I would also like to now if I can substitue next with a number that will correspond to the line that I want to print after the given pattern.
In perl (because whilst you start with awk, this is tagged as perl too):
perl -ne 'print if m/post-neutron/...m/A_TKE/' input
Which will do what your thingy was trying to.
It works by using the range operator - which is a perl construct which tests if the current file is between two markers.
And the fact that perl can run inline in the same way as awk or sed. -ne says "wrap this code in a while loop" that iterates a line at a time. (e.g. as sed/awk/grep do by default).
Otherwise ... it depends a little on what else is in your file. Because from the sample you gave - the only lines starting with a number are the ones you want. So:
perl -ne 'print if m/^\s*\d+\s*\d+/'
(Or combine the two tests:
perl -ne 'print if m/post-neutron/...m/A_TKE/ and m/^\s*\d+\s*\d+/'
Which will output anything between the two text markers that has number-space-number at the start of line.
Your awk script is almost there. I'd build it like this:
awk '
/<\/A_TKE>/ {exit}
flag && NF==50 {print}
/--- A-TKE spectrum .post-neutron.---/ {flag=1}
' input
You could optimize it of course, but just looking at the logic of it, the idea is that you need do no further processing once you hit your end marker .. and you only want to start printing AFTER your start marker.
Note that I've replaced the brackets in your start marker with dots, since brackets are interpreted as PART OF THE REGULAR EXPRESSION. I believe you may be considering these simple strings to search for, but they are regex.
Some working ideas
Awk can print between two matching lines with this simple command:
awk '/PATTERN1/,/PATTERN2/' file.txt
If you want more control over what happens when the lines are found, you can use the flag approach.
awk '/A-TKE/{f=1;for (i=0;i<7;i++){getline}}/A_TKE/{f=0}f' file.txt
Adjust i<7 to specify how many lines you would like to skip.
Also, in this particular case, you can exploit the fact that you have 50 fields of numbers, which is unlikely to occur anywhere else in the file. Thus, you could also get the numbers of interest out with:
awk 'NF>40' file.txt
NF is a special awk variable that stores the number of fields (columns) in the current record (line).
Why your approach does not work
Your approach does not work, because everything that is between // in awk is treated as a regular expression. In your case you have several - and () in the string, which are not escaped, and thus assume their special meaning and therefore the expression you typed never matches, thus the flag is never set to 1 and awk does not print a line.
Try this simple sed command
sed -n '/A-TKE/,/<\/A_TKE>/p' FileName
If you want to extract rows with just numbers
awk 'NF && !/[a-zA-Z\-]+/' input.file
will generate
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 1 0 0 2 0 0 1 0 0 0 0
with patterns and smart counters you can write it as
awk '/\/A_TKE/{exit}
f&&s&&s--{next}
f&&NF{print}
/A-TKE spectrum/{f=1;s=7}' input.file
fine tune patterns as you like.
I have problem with this code (i reduced it before posting)
epsilon=0.60; t=-3.0; n=11; E=+0.34; I=eye(n,n); eta=1.0e-10;
DB = gallery('tridiag',t*ones(1,n-1),epsilon*ones(1,n),t*ones(1,n-1));
ODB1 = sparse(1:n,1:n,t*heaviside((-1).^(2:n+1)));
ODB2 = sparse(1:n,1:n,t*heaviside((-1).^(1:n)));
a=(E*I-DB)\ODB2';b=(E*I-DB)\ODB1;
p0=(E*I-DB)\ODB1';q0=(E*I-DB)\ODB2;
%initial
p=(I-a*q0-b*p0)\(a*p0);q=(I-a*q0-b*p0)\(b*q0);
tmp1=p; tmp2=q;
while norm([p q]) > 1.0e-8
A=(1+eta*1i)*I-p*q-q*p; (1)
x=A\I; (2)
p=x*p*p; q=x*q*q; (3)
%p=((1+eta*1i)*I-p*q-q*p)\(p*p); (4)
%q=((1+eta*1i)*I-p*q-q*p)\(q*q); (5)
tmp1=tmp1+tmp2*p;
tmp2=tmp2*q;
end
Matlab shows an error on RCOND if i replace (1-3) lines by (4-5). So what's difference between them? Can i trust the result?
Your matrix p*p is:
ans =
39.2012 0 -28.3944 0 10.1201 0 10.6411 0 -28.4320 0 38.6426
16.3606 0 -11.9292 0 4.3186 0 4.4104 0 -11.9335 0 16.2645
-28.3944 0 20.9268 0 -7.6333 0 -7.6709 0 20.8517 0 -28.4320
-28.2897 0 20.6792 0 -7.5188 0 -7.6149 0 20.6748 0 -28.1980
10.1201 0 -7.6333 0 3.1358 0 2.5773 0 -7.6709 0 10.6411
32.6084 0 -23.8794 0 8.7457 0 8.7457 0 -23.8794 0 32.6084
10.6411 0 -7.6709 0 2.5773 0 3.1358 0 -7.6333 0 10.1201
-28.1980 0 20.6748 0 -7.6149 0 -7.5188 0 20.6792 0 -28.2897
-28.4320 0 20.8517 0 -7.6709 0 -7.6333 0 20.9268 0 -28.3944
16.2645 0 -11.9335 0 4.4104 0 4.3186 0 -11.9292 0 16.3606
38.6426 0 -28.4320 0 10.6411 0 10.1201 0 -28.3944 0 39.2012
on the first run. its reciprocal condition number (something like condition number but scaled to 1-0 range) , rcon(p*p) is equal to zero, meaning its unsolvable algebraically.
I do not know what your matrices mean, but you can not solve the system you proposed in your code with the values of this equation.
I want to run a video in matlab but I got some problems while doing so. I tried to run the video while using 'load' and then 'implay'. But I got this problem. My movie file is a textfile which constains mostly of zeros, arranged diagonally.
When I load this file in matlab I get different values. Here a snippet:
0 0 0 0 0 0 0 0 0 0 0
0 0 -5 0 0 -5.00097609500000 0 0 0 0 0
0 0 -10 0 0 -10.0019423800000 0 0 0 0 0
0 0 -15 0 0 -15.0028988550000 0 0 0 0 0
0 0 -20 0 0 -20.0038455200000 0 0 0 0 0
0 0 -25 0 0 -25.0047823750000 0 0 0 0 0
0 0 -30 0 0 -30.0057094200000 0 0 0 0 0
0 0 -35 0 0 -35.0066266550000 0 0 0 0 0
0 0 -40 0 0 -40.0075340800000 0 0 0 0 0
0 0 -45 0 0 -45.0084316950000 0 0 0 0 0
I dont know why I get a mat.file with different values and why my movie does not run. I wanted to upload the original textfile but this not possible.
When I try to run I receive following message: There is not enough memory to open 'filename' in the Editor.
I hope you guys can help me!