hasen's tech life

Twitter: @hasen

Xcode(Command Line Tools)のバージョンを切り替える.

# Xcodeのバージョンを切り替える.
$ sudo xcode-select -s /Applications/Xcode7.app/

# 確認
$ gcc --version

macOS SierraにPyCUDAをインストールした.

# macOS SierraにPyCUDAをインストールした.

$ pyenv global 3.5.2
$ pyenv rehash
# Cuda Toolkit
# https://developer.nvidia.com/cuda-toolkit
$ vi ~/.bashrc
## cuda
++ export PATH=/Developer/NVIDIA/CUDA-8.0/bin:$PATH
++ export CUDA_INC_DIR=/Developer/NVIDIA/CUDA-8.0/bin:$PATH
++ export DYLD_LIBRARY_PATH=/Developer/NVIDIA/CUDA-8.0/lib:$DYLD_LIBRARY_PATH
$ exec $SHELL -l

# System PreferencesでCUDAのアップデートを確認する

# ディバイス認識テスト
$ cd /Developer/NVIDIA/CUDA-8.0/samples/1_Utilities/deviceQuery
$ sudo make

# エラー対応
# http://qiita.com/K_A_Lab/items/8523db0c3de580c7cc97
# Command Line Tools (OS X 10.11) for Xcode 7.3.1をインストール
$ sudo xcode-select --switch /Library/Developer/CommandLineTools

$ sudo make
$ ./deviceQuery

$ cd /usr/local/src
$ git clone http://git.tiker.net/trees/pycuda.git
$ cd pycuda
$ python configure.py
$ vi siteconf.py
++ BOOST_INC_DIR = ['/usr/local/Cellar/boost/1.62.0/include']
++ BOOST_LIB_DIR = ['/usr/local/Cellar/boost/1.62.0/lib']
++ BOOST_COMPILER = 'gcc-7'
++ USE_SHIPPED_BOOST = True
++ BOOST_PYTHON_LIBNAME = ['boost_python-py35']
++ BOOST_THREAD_LIBNAME = ['boost_thread']
++ CUDA_TRACE = False
++ CUDA_ROOT = '/Developer/NVIDIA/CUDA-8.0'
++ CUDA_ENABLE_GL = False
++ CUDA_ENABLE_CURAND = True
++ CUDADRV_LIB_DIR = ['${CUDA_ROOT}/lib', '${CUDA_ROOT}/lib', '${CUDA_ROOT}/lib/stubs', '${CUDA_ROOT}/lib/stubs', '/usr/local/cuda/lib']
++ CUDADRV_LIBNAME = ['cuda']
++ CUDART_LIB_DIR = ['${CUDA_ROOT}/lib', '${CUDA_ROOT}/lib', '${CUDA_ROOT}/lib/stubs', '${CUDA_ROOT}/lib/stubs', '/usr/local/cuda/lib']
++ CUDART_LIBNAME = ['cudart']
++ CURAND_LIB_DIR = ['${CUDA_ROOT}/lib', '${CUDA_ROOT}/lib', '${CUDA_ROOT}/lib/stubs', '${CUDA_ROOT}/lib/stubs', '/usr/local/cuda/lib']
++ CURAND_LIBNAME = ['curand']
++ CXXFLAGS = ['-arch', 'x86_64', '-mmacosx-version-min=10.7', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk']
++ LDFLAGS = ['-F/Library/Frameworks', '-arch', 'x86_64', '-mmacosx-version-min=10.7', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk']
$ sudo make && sudo make install

# テスト
$ python
> import pycuda.autoinit

Swift3系対応で行なった修正メモ.

# Swift3系対応で行なった修正メモ.

> queryLimitedToLast has been renamed to queryLimited(toLast)
-- queryLimitedToLast(100)
++ queryLimited(toLast: 100)

> Type 'Any' has no subscript members
http://swift-labo.net/2016/10/02/117/
-- let text = snapshot.value!["text"] as! String
++ let snapshotValue = snapshot.value as! NSDictionary
++ let text = snapshotValue["text"] as! String

> Argument labels '(_:, diameter:)' do not match any available overloads
-- self.outgoingAvatar = JSQMessagesAvatarImageFactory.avatarImage(UIImage(named: "icon_default")!, diameter: 64)
++

> Use of unresolved identifier 'bubbleFactory'
-- let bubblefactory =
++ let bubbleFactory =

> Value of optional type 'JSQMessagesBubbleImageFactory?' not unwrapped; did you mean to use '!' or '?'?
-- self.outgoingBubble = bubbleFactory.outgoingMessagesBubbleImageWithColor(UIColor.jsq_messagesBubbleGreenColor())
++ self.incomingBubble = bubbleFactory?.incomingMessagesBubbleImage(with: UIColor.jsq_messageBubbleLightGray())

> Method does not override any method from its superclass
-- override func collectionView(_ collectionView: JSQMessagesCollectionView!, messageDataForItemAtIndexPath indexPath: NSIndexPath!) -> JSQMessageData! {
++ override func collectionView(_ collectionView: JSQMessagesCollectionView!, messageDataForItemAt indexPath: IndexPath!) -> JSQMessageData! {

> 'JSQMessagesBubbleImage!' is not convertible to 'JSQMessageData!'; did you mean to use 'as!' to force downcast?
-- return self.outgoingBubble
++ return self.outgoingBubble as! JSQMessageData!

> Missing argument label 'text:' in call
-- sendTextToDb(text)
++ sendTextToDb(text: text)

> 'unsafeAddress(of:)' is unavailable: Removed in Swift 3. Use Unmanaged.passUnretained(x).toOpaque() instead.
-- unsafeAddress(of: kCGImagePropertyGIFUnclampedDelayTime)
++ Unmanaged.passUnretained(kCGImagePropertyGIFUnclampedDelayTime).toOpaque()

> Switch must be exhaustive, consider adding a default clause
++ default:
++ return 0

-- Dictionary<String, String>
++ [String, String]

digコマンドの結果が画像のようになっている場合

# digコマンドの結果が画像のようになっている場合,
# ドメイン取得サービス(お名前.comとか)からの所有者確認メールが来ていないかチェックする.

f:id:hasen-fus:20170723121020p:plain

AWSのEC2でApacheのリダイレクトが効かないなと思ったら,以下の設定が異なっていたので変更した.

# AWSのEC2でApacheのリダイレクトが効かないなと思ったら,以下の設定が異なっていたので変更した.

$ vi /usr/etc/conf/httpd.conf
<Directory "/var/www">
-- AllowOverride All
++ AllowOverride None

<Directory "/var/www/html">
-- AllowOverride None
++ AllowOverride All