In [ ]:
Author: Yue-Wen FANG
Contact: fyuewen@gmail.com
Revision history: created in 11th, January, at Kyoto
In Ubuntun, it's quite easy to install xcrysden. First, sudo apt-get install xorg openbox; second, sudo apt-get install xcrysden
However, in mac, it's a bit more comlicated.
In mac os, we need install xQuartz (to set xQuartz as the default x11 system, we have to logout and login mac again) to get a x11 system, in addition, you need install xcode.
Then download and install MacPorts: https://www.macports.org/install.php
Then use command 'xcode-select --install' and 'xcodebuild -license'
Finally, "port install xcrysden +x11"
Now, it's ready to go...
Date: 20180614
Recently, I ploted a 3D energy profile using Wolfram Mathematica 11 for one of my research papers. For 3D figures, Mathematica cannot export vector PDF. To further retouch my figure, I exported the rastered PDF from Mathematica, and imported it into Inkscape (I used Inkscape in a Windows system). After adding some text and labels to the figure, I found the 3D colored part in the figure will be vanished if I exported it into PDF from Inkscape.
To solve this problem, I installed Gapplin, and opend the svg file which is the native format for Inkscape, this software can export it into tif, pdf and png with high quality. When output format is png, the solution can be tunned. When output is pdf, the figure will be vector-like
Date: 20180615
Press Command+Space and type Terminal and press enter/return key.
Run in Terminal app:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null ; brew install caskroom/cask/brew-cask 2> /dev/null
and press enter/return key. If the screen prompts you to enter a password, please enter your Mac's user password to continue. When you type the password, it won't be displayed on screen, but the system would accept it. So just type your password and press ENTER/RETURN key. Then wait for the command to finish.
brew cask install inkscape
Note that XQuarts should be installed before installing inkscape.
It may take seceral minitues for lauching Inkscape on Mac for the first time because of the caching fonts from the computer.
There are some filters available in Inkscape which can speed up complicated tasks.
For instance, i wanted to remove white background of an image to make it transparent. I used the following method / filter in Inkscape.
Select the image object.
For versions < 0.91 Go to Filters -> Transparency Utlities -> Light Eraser For version 0.91 Go to Filters > Fill & Transparency > Light Eraser
I know two methods to install julia
brew update
brew tap staticfloat/julia
brew install julia
Just download the official dmg (see https://julialang.org/downloads/), and install it as other applications in mac os.
Install youtube-dl from its github page. Use the command "youtube-dl URL" to download the requested video.
Please read Gfortran for MacOSX 10.10 (Yosemite) to 10.13 (High Sierra) systems
Xcode is needed, then download gfortra dmg file, install it.
I installed it by following it, but got errors: I don't understand 'm' flag
The solution is here:
$ cd /opt/local/bin
$ sudo mv ./as ./as-broken
$ sudo ln -s /usr/bin/as ./as
For me, when using python 3.6, or python 3.7 or python 2.7, I alwalys got this warning when open python scripts using vim. I have used the latest vim version: Patch 8.1.0201 of vim, and I also have following settings in my .vimrc file:
if has('python3') && !has('patch-8.1.201') silent! python3 1 endif
I couldn't remove this warning as others: see https://github.com/vim/vim/issues/3117
I got a workaround by: let g:pymode = 0 setlocal complete+=t setlocal formatoptions-=t "if v:version > 702 && !&relativenumber " setlocal number "endif setlocal nowrap setlocal textwidth=79 setlocal commentstring=#%s setlocal define=^\s*$def\\\\|class$
About the usage of let g:pymode, plese see https://github.com/python-mode/python-mode/issues/356
Firstly, let's build a virtual environment:
conda create --name myenv python=3 Secondly, activate the environment named 'myenv', and update the conda via:
conda update -n base conda Thirdly,
brew install vtk --with-python3 --without-python Finally,
conda install -c anaconda mayavi
An example code to generate the animation:
(the orginal source code of this example comes from the official website)
In [ ]:
#!/usr/bin/env python3
from mayavi import mlab
from tvtk.tools import visual
from vtk.util import colors as color
# Create a figure
f = mlab.figure(size=(500,500))
# Tell visual to use this as the viewer.
visual.set_viewer(f)
# A silly visualization.
mlab.test_plot3d()
# Even sillier animation.
b1 = visual.box()
b2 = visual.box(x=4., color=color.red)
b3 = visual.box(x=-4, color=color.red)
b1.v = 5.0
@mlab.show
@mlab.animate(delay=250)
def anim():
"""Animate the b1 box."""
while 1:
b1.x = b1.x + b1.v*0.1
if b1.x > 2.5 or b1.x < -2.5:
b1.v = -b1.v
yield
# Run the animation.
anim()
I didn't test this library named smtplib very carefully, howevery, I believe it can work. I will come back to visit it at a proper time.
Ref: https://patrickfuller.github.io/texting-from-your-server-in-python/
Run in Terminal app: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
brew install povray
Ref: http://macappstore.org/povray/
You can use the command "$which povray" to check where the povray is.
In my mac, the povray is in:
/usr/local/bin/povray
and the corresponding include files are in:
/usr/local/Cellar/povray/3.7.0.8_1/share/povray-3.7/include
Since macOS Sierra, the menu Security & Privacy only display two options, i.e. 1) App Store 2) App Store and identified developers.
However, install some softwares may require higher authority, we hence need allow the apps from anywhere.
For example, the installation of 'Art Of Illusion 3.0.3' requires this enabled. If you don't allow the Apps to be from anywhere, the mac will remind you that this source package is damaged (however, it's wrong, see: http://www.artofillusion.org/downloads)
Here is the method of enable it:
Quit out of System Preferences
Open the Terminal app from the /Applications/Utilities/ folder and then enter the following command syntax: sudo spctl --master-disable
Hit return and authenticate with an admin password
Relaunch System Preferences and go to “Security & Privacy” and the “General” tab
You will now see the “Anywhere” option under ‘Allow apps downloaded from:’ Gatekeeper options
Then you can install the applications.
Howver, I recommend disabling it after installation to make macOS safe: sudo spctl --master-enable
Ref: http://osxdaily.com/2016/09/27/allow-apps-from-anywhere-macos-gatekeeper/
XCrySDen has been ported on macports by David Strubbe. It can be installed using following steps.
https://www.macports.org/install.php
sudo port install xcrysden +x11 (Note that this step requies Xcode command line tool, see section 20)
export XCRYSDEN_TOPDIR=/opt/local/share/xcrysden-1.5.60 export XCRYSDEN_SCRATCH=/tmp
xcrysden
Method 1. We can install xcode first, and then install Xcode command line from the preferences.
Method 2 (highly recommend): MacPorts users who do not wish to install the very large Xcode suite can install GCC via "Command Line Tools for Xcode" from https://developer.apple.com/downloads/index.action
Ref: http://dm5ms.blogspot.com/2015/10/using-sansserif-fonts-in-latexit.html
Open preferences of LateXiT, and create a new configuration. Copy the following content to the "Preambles"
In [ ]:
\documentclass[10pt]{article}
\usepackage[usenames]{color} %used for font color
\usepackage{amssymb} %maths
\usepackage{amsmath} %maths
\usepackage[utf8]{inputenc} %useful to type directly diacritic characters
\usepackage{helvet}
\usepackage{sfmath}
\renewcommand*{\familydefault}{\sfdefault}\usepackage[usenames,dvipsnames]{xcolor}
\let\originalleft\left
\let\originalright\right
\renewcommand{\left}{\mathopen{}\mathclose\bgroup\originalleft}
\renewcommand{\right}{\aftergroup\egroup\originalright}