Nov 12, 2018
How to read a file into a variable in shell?
https://stackoverflow.com/questions/7427262/how-to-read-a-file-into-a-variable-in-shell
1. make file name list
ls | grep .gz > file_name_list.txt
2. read file into shell variable & do 'for'
value=$(<file_name_list.txt)
for name in $value
do
/program_path/program -i /file_path/${name}
done
Nov 7, 2018
mount iso file in linux
https://askubuntu.com/questions/164227/how-to-mount-an-iso-file
- Create a directory to serve as the mount location:
sudo mkdir /mnt/iso
- Mount the ISO in the target directory:
sudo mount -o loop path/to/iso/file/YOUR_ISO_FILE.ISO /mnt/iso
- Unmount the ISO:
sudo umount /mnt/iso
Oct 29, 2018
tophat install error : except getopt.error, msg: SyntaxError: invalid syntax
http://seqanswers.com/forums/showthread.php?t=17514
Error :
File "./tophat", line 1003
except getopt.error, msg:
^
SyntaxError: invalid syntax
To solve :
edit tophat
#!/usr/bin/env python2
instead of
#!/usr/bin/env python
This error comes from the difference between python2 and python3.
check your path and version of python
Error :
File "./tophat", line 1003
except getopt.error, msg:
^
SyntaxError: invalid syntax
To solve :
edit tophat
#!/usr/bin/env python2
instead of
#!/usr/bin/env python
This error comes from the difference between python2 and python3.
check your path and version of python
Sep 18, 2018
python - List Comprehensions
python - List Comprehensions
https://docs.python.org/2/tutorial/datastructures.html#list-comprehensions
List comprehensions provide a concise way to create lists. Common applications are to make new lists where each element is the result of some operations applied to each member of another sequence or iterable, or to create a subsequence of those elements that satisfy a certain condition.
For example, assume we want to create a list of squares, like:
We can obtain the same result with:
This is also equivalent to
A list comprehension consists of brackets containing an expression followed by a
and it’s equivalent to:
https://docs.python.org/2/tutorial/datastructures.html#list-comprehensions
List comprehensions provide a concise way to create lists. Common applications are to make new lists where each element is the result of some operations applied to each member of another sequence or iterable, or to create a subsequence of those elements that satisfy a certain condition.
For example, assume we want to create a list of squares, like:
>>> squares = []
>>> for x in range(10):
... squares.append(x**2)
...
>>> squares
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
squares = [x**2 for x in range(10)]
squares = map(lambda x: x**2, range(10))
, but it’s more concise and readable.A list comprehension consists of brackets containing an expression followed by a
for
clause, then zero or more for
or if
clauses. The result will be a new list resulting from evaluating the expression in the context of the for
and if
clauses which follow it. For example, this listcomp combines the elements of two lists if they are not equal:>>> [(x, y) for x in [1,2,3] for y in [3,1,4] if x != y]
[(1, 3), (1, 4), (2, 3), (2, 1), (2, 4), (3, 1), (3, 4)]
>>> combs = []
>>> for x in [1,2,3]:
... for y in [3,1,4]:
... if x != y:
... combs.append((x, y))
...
>>> combs
[(1, 3), (1, 4), (2, 3), (2, 1), (2, 4), (3, 1), (3, 4)]
Sep 5, 2018
Aug 17, 2018
install R with --enable-R-shlib=yes [for shared library]
install R with --enable-R-shlib=yes [for shared library]
if you have pre-installed R and want to install new version of R,
you need to install new version of R with shared library to share library with old version
and run rstudio.
https://stackoverflow.com/questions/28096239/how-to-configure-r-3-1-2-with-enable-r-shlib
if you have pre-installed R and want to install new version of R,
you need to install new version of R with shared library to share library with old version
and run rstudio.
https://stackoverflow.com/questions/28096239/how-to-configure-r-3-1-2-with-enable-r-shlib
May 8, 2018
Qt: XKEYBOARD extension not present on the X server.
check details in
https://github.com/spyder-ide/spyder/issues/3713
From replies
athlonshi commented on 4 Jul 2017
For those using Exceed X Server, you may also need to change Xconfig setting. Go to Xconfig --> Settings --> Protocol... --> Extensions --> check XKEYBOARD and save the settings.Oreki47 commented on 6 Oct 2017
I'm using TightVNC with Ubuntu 14.04.It works on my machine with:
export XKB_DEFAULT_RULES=base
export QT_XKB_CONFIG_ROOT=/usr/share/X11/xkb
The set rules has to come first.
Subscribe to:
Posts (Atom)