Skip to content

Instantly share code, notes, and snippets.

@iwazer
iwazer / waiting_for_table_metadata_lock.md
Created September 27, 2021 07:30
MySQLオンラインDDLのWaiting for table metadata lockについて

オンラインDDLのWaiting for table metadata lockについて

(1) トランザクション中に対象のテーブルをSELECT
A: begin;
A: select * from target_table where id=1;

(2) 対象のテーブルにオンラインDDLを実行
B: CREATE INDEX a_target_table_index ON target_table  (field1, field2);
@iwazer
iwazer / gist:1164184
Created August 23, 2011 02:28
JavaScriptで文字列の反転
var s = 'this is string.';
console.log(s.split("").reverse().join(""));
[alias]
lg = log --graph --decorate --oneline --abbrev --relative-date --topo-order
lga = log --graph --decorate --oneline --abbrev --relative-date --topo-order --all
log --graph --date=short --pretty='%C(yellow)%h%Creset %C(cyan bold)%d%Creset %s %Cgreen[%cd]%Creset' --decorate --all
$ rake preload=true
/Users/e-iwazawa/Develop/github/motioncv-test/vendor/opencv/motioncv.gemspec:2: warning: already initialized constant VERSION
Create ./app/_preload_.rb
+ /Library/RubyMotion/data/ios/7.0/BridgeSupport/AVFoundation.bridgesupport
+ /Library/RubyMotion/data/ios/7.0/BridgeSupport/AssetsLibrary.bridgesupport
+ /Library/RubyMotion/data/ios/7.0/BridgeSupport/CoreGraphics.bridgesupport
+ /Library/RubyMotion/data/ios/7.0/BridgeSupport/Foundation.bridgesupport
+ /Library/RubyMotion/data/ios/7.0/BridgeSupport/UIKit.bridgesupport
+ ./vendor/opencv/framework/opencv2.framework/opencv2.framework.bridgesupport
Build ./build/iPhoneSimulator-7.0-Development

こういうモデルで

ActiveRecord::Schema.define(version: 20130922022806) do

  create_table "models", force: true do |t|
    t.string   "field1"
    t.string   "field2"
    t.datetime "created_at"
 t.datetime "updated_at"
#
# This Snippet may do to be able to refer all definitions of libraries
# from RubyMotion REPL, when You paste this Snippet on bottommost of
# your RubyMotion Rakefile. But it is very slow...
#
# Usage:
# rake preload=true # generate preload source file before build simulator
#
# rake preload:clean # delete preload source file
#

RubyMotionのREPLで全ての定数とClassを参照可能にする拡張(案)

Rakefileに何らかの定義を書くかや起動オプションの指定で、全てのBridgeSupportファイルの定数やクラスなどを参照実行するプログラムがコンパイルされて、REPLから見えるようになるモードがあると便利そうだ。

  1. Path: /Library/RubyMotion/data/[ios|osx]/[version]/BridgeSupport/[framework].bridgesupport
  2. Rakefileに定義されているFrameworkのBridgeSupportファイルを読み込む
  • デフォルトで定義されてる3つ
  • 追加されているFramework
  • vendor/**/*.bridgesupport
app.vendor_project('vendor/opencv2.framework', :static,
products: ['opencv2'],
source_files: ['Headers/imgproc/imgproc_c.h', 'Headers/imgproc/types_c.h',
'Headers/motion/MotionCV.h', 'Headers/motion/MotionMat.h'],
force_load: false
)
# -*- coding: utf-8 -*-
Motion::Project::App.setup do |app|
:
app.frameworks += ['AVFoundation','AssetsLibrary']
app.libs += ['-lc++']
:
app.vendor_project('vendor/opencv2.framework', :static,
products: ['opencv2'],
force_load: false
#import <Foundation/Foundation.h>
@interface MotionMat : NSObject
- (id)init;
- (id)initWithRows:(int)rows cols:(int)cols channels:(int)channels;
- (unsigned char *)data;
- (size_t)stepWithIndex:(int)index;
- (size_t)elemSize;