Youtubeからmp3に変換するPythonスクリプト

Youtubeからmp3に変換するPythonスクリプトをネットを参考に作成したのでメモ。 youtube_dlはpipでインストール。 ffmpegもDLが必要。 他にもyoutube-mp3-downloaderというモジュールも見つかったがどうなのだろう? mp4をDLして、変換はFreemake video conv…

VS2010ビルドエラー

.NET Framework 4.5.1をインストールしたら、VisualStudio2010のC++で以下のビルドエラーが出た。 >LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt.NET 4.5.1をアンインストールして、VS2010を修復したら治った。…

HPの引っ越し

自分のHPを以下に引っ越しした。 さくらインターネットは解約予定。 http://www.geocities.jp/morchin33/

C++11のVS2010への対応

C++

https://sites.google.com/site/cpprefjp/implementation-status cpprefjpに対応状況まとまっているが、std::array、std::for_each、std::tupleを調べてみた。 結果として、VS2010に対応していた! これで色々出来そう。 #include <iostream> #include <array> #include <tuple> int </tuple></array></iostream>…

Harlan

GPU

http://wired.jp/2013/07/05/gpu-programming-language/ https://github.com/eholk/harlan GPUのDSL言語。なぜか、文法はSchemeベースらしい。あと、対応OSが、今のところ、MacとLinuxしかない。Windowsはいつになるのだ? GPU言語の流行りは分からないが、…

ライブラリ作成メモ

gcc

foo.dllの作成。 > set path=C:\MinGW_x64\x86_64-w64-mingw32\lib;%path% > g++ -shared -static-libgcc -std=c++11 *.cpp -o foo.dll a.exeの作成 > g++ -static-libgcc -std=c++11 -I. foo.dll main.cpp VCと同様に、gccでもlibを作成してリンクすると思…

メモ

cvs

cvs操作のメモ。 rollback cvs update -p -r リビジョン file > file diff cvs diff -r 旧リビジョン -r 新リビジョン file log cvs log file

メモ(pycを作成させない方法)

Python3.2から__pycache__というディレクトリにバージョン付きで作成されるらしい。 色々と勉強不足になってきた。 http://d.hatena.ne.jp/itasuke/20111215/pyc_file

ctypesでC言語側の配列データを取得する方法

参考 http://stackoverflow.com/questions/4213095/python-and-ctypes-how-to-correctly-pass-pointer-to-pointer-into-dll // c_hoge.cpp #include "c_hoge.h" #include <stdlib.h> static int numData = 0; static float* arData = NULL; void getArrayData(float** </stdlib.h>…

QStringとstd::wstringの変換

http://stackoverflow.com/questions/5625884/conversion-of-stdwstring-to-qstring-throws-linker-error /*! Convert a QString to an std::wstring */ std::wstring qToStdWString(const QString &str) { #ifdef _MSC_VER return std::wstring((const wcha…

メモ

20世紀を変えた10のアルゴリズム http://top-10-algorithms.sl-jp.com/

mini-Python

mini-Python http://www.logos.ic.i.u-tokyo.ac.jp/lectures/enshu2007/index.php?%B9%D6%B5%C1%BB%F1%CE%C1 Pythonの簡易版を作る資料らしい。 あとで勉強する予定。

ExcelのPythonプラグイン

ExcelでVBAの代わりにPythonで操作出来るらしい。 とりあえず、DataNitroを試すつもり。 DataNitro https://datanitro.com/index.html Pyvot http://pytools.codeplex.com/ Pyxll http://pyxll.com/#

CAtlMapでユーザー定義型

C++

以下、CAtlMapでキーにユーザ定義型を使用する方法。 Traitsの場合。 Traitsを使用しない場合は、DWORD()をオーバーロードしてハッシュ関数を定義する。 #include <atlcoll.h> class Node { public: long nid; float xyz[3]; Node() : nid(0) {} Node(long nid) : nid(n</atlcoll.h>…

拡張モジュール作成 (1)

http://owa.as.wakwak.ne.jp/zope/docs/Python/BindingC/ を参考にWindows版のビルドを試した。 // hello.cpp int add(int x, int y) { return x + y; } void out(const char* adrs, const char* name) { printf("こんにちは、私は %s の %s です。\n", adrs…

64bitアプリ

C++

64bitプログラミングで気をつけること http://d.hatena.ne.jp/shikaku/20091124/p1 ユーザ領域のメモリは、8TBか。今後、8EB(エクサバイト)まで使えるようになるのだろうか。結局、OSによって制限されるみたい。

Pythonの組み込み

今さらながら、C++にPythonを簡単に組み込めることに気がついた。 Pythonでexecfile('hoge.py')を呼び出すだけのexeを作成し、C++側では、exeを実行するだけで良い。 もちろん、もっと汎用化したければ、hoge.pyを引数のパラメータで、変更出来るようにした…

メモ

任意軸周りの回転 http://www21.atwiki.jp/opengl/pages/144.html

メモ

C++

LPWSTR型変数にCString文字列を渡す方法。 http://ameblo.jp/sogoh/entry-10863597869.html CString cs; LPWSTR lpwstr = const_cast<LPTSTR>(static_cast<LPCTSTR>(cs));</lpctstr></lptstr>

PythonのReportLabのソースをpy2exeでexe化する際のメモ

setup.pyのsetup()のoptionsでpackagesを指定する必要がある。 # coding: cp932 # setup.py from distutils.core import setup import py2exe packages=[ 'reportlab', 'reportlab.graphics.charts', 'reportlab.graphics.samples', 'reportlab.graphics.wid…

Tython

http://d.hatena.ne.jp/gongoZ/20110514/1305372647 Tythonは、XBOXのKinectを利用したインターフェース。これは非常に面白い。将来的には、OSもこのようなインターフェースになると思うが、自作プリポストにもぜひ取り入れたい。

3D文字列のサンプル

以下サンプル。以下のサイトのgl_test4.lzhを参考にした。 http://www2.ocn.ne.jp/~inu_inu/opengl/main.htm #include <stdafx.h> #include <windows.h> #include <GL/gl.h> #include <GL/glu.h> #include "wglfont.h" GBUN* create_3d_font(HDC hdc, char* str) { GBUN* bun; LOGFONT logfont; HFONT</gl/glu.h></gl/gl.h></windows.h></stdafx.h>…

OpenGLでの文字列の表示

基本的に、2通りある。 1) Bitmapで文字を表示する (wglUseFontBitmaps()を使用) 2) 3D文字で表示する (wglUseFontOutlines()を使用) 1)は一度フォントを作成したら拡大縮小が出来ない。 2)はglScalef()で拡大縮小が可能。 しかし、2)は厚みを持った3次元文…

OpenGLでの文字列の描画

以下の2通りある。 wglUseFontBitmaps wglUseFontOutlines 以下の例はうまく動かせなかった。さらに調査するつもり。 http://support.microsoft.com/kb/131024/ja

std::stringに関するメモ

C++

メンバ関数 http://diary.overlasting.net/2011-02-16-1.html

文字列に関するメモ

C++

http://victreal.com/Junk/_T/index.html 後で読む。

CStringに関するメモ

C++

メンバ関数 http://www.page.sannet.ne.jp/mtoga/lang/cv/bih-m_11.htm http://hanbeeonline.web.fc2.com/MFC_Tips/CString.htm http://typea.info/tips/wiki.cgi?page=MFC+CString http://www.kab-studio.biz/Programing/PragmaTwice/Main/222.html

Pythonのリスト

C++

Pythonのリストは、Cで配列で実装されている。C++でこれをやるには以下などがある。 std::vector (STL) CArray (MFC) std::vectorが一番速かったので、これを使うことにする。 CArrayでサイズ指定しても遅かったし、リンクリストのCListなどもやはり遅かった…

C++11のVS2010対応状況

C++

C++11の機能で、どこまでVS2010で対応しているか少し調べた。 以下対応しているもの。 ラムダ式 std::shared_ptr std::unordered_map 以下対応していないもの。 コンテナの初期化 (vector v = {1,2,3];) foreach メンバー初期化子 以下、ラムダ式の例(注:MF…

CMapのサンプル

C++

FEMで使う場合、ユーザー定義クラスとハッシュを組み合わせる必要がある。友人からサンプルをもらったので、メモしておく。 私は、FemNode2が気に入ったので、そちらを流用することにする。 #pragma once #include "stdafx.h" class FemNode { public: int i…