2013-01-01から1年間の記事一覧

c/c++ 変数のサイズを表示する。(sizeof演算子)

#include <stdio.h> int main(void){ printf("char : %d\n", sizeof(char)); printf("short int : %d\n", sizeof(short int)); printf("int : %d\n", sizeof(int)); printf("long int : %d\n", sizeof(long int)); printf("float : %d\n", sizeof(float)); printf("do</stdio.h>…

c/c++ コマンドライン引数の取得

c c++

int main(int argc, char *argv[]) { int i; printf("文字列の個数 %d\n",argc); for( i=0; i

EclipseでAndroid開発時に、R.javaが自動作成されない。[Android-SDK-Manager]

Eclipseをごにょごにょ触っていたら、いつの間にかR.javaが自動作成されなくなってしまったようです。 [Projet] -> [Clean]したらエラーが発生して コンパイルが出来なくなってしまいました・・・(汗 環境: Mac OS Lion ・ Eclipse 4.2 JUNO 原因を考えて…

Macの隠しファイルや隠しフォルダを表示する[Mac]

mac

ターミナルを起動し、以下を入力。 defaults write com.apple.finder AppleShowAllFiles -boolean true Finderを再起動します。 killall Finder 元に戻すには以下。 defaults delete com.apple.finder AppleShowAllFiles killall Finder

オーディオ出力を下部スピーカーで鳴らす[XCode][iPhone]

iPhone の開発において、録音しながら音を再生するアプリを作成した際のメモ。 iPhoneの内蔵スピーカは2つ存在するんですね。 通話する際、耳が当たる箇所 端末下部 何もしないと「1」から音が再生されてしまうようなので、この音を「2」の端末下部のスピ…

ファイル別にARCの設定を行なう[Xcode]

1.プロジェクト設定画面 ->「Build Phases」タブを開く 2.ARCを無効にしたいファイルを選択してエンターキーを押す 3.-fno-objc-arcと入力する

UserAgentの取得と変更 [Xcode]

//webviewからUserAgentを取得 UIWebView * webView = [[[UIWebView alloc] initWithFrame:CGRectZero] autorelease]; NSString * userAgent = [webView stringByEvaluatingJavaScriptFromString:@"navigator.userAgent"]; //UserAgentの変更( " Add Test UI…

AndroidのプロジェクトをEclipseでコピー

AndroidのプロジェクトをEclipseでコピーする際の手順 1.Eclipseのパッケージ・エクスプローラーで、プロジェクトをコピー、ペーストする。 2.プロジェクト名を好きな名前に変える。 パッケージ・エクスプローラーでコピーしたプロジェクトを選び、「リ…

時間と秒数

メモ。 1秒 1分 60秒 1時間 60分 3600秒 1日 24時間 1440分 86400秒 1年 365日 8760時間 525600分 31536000秒 1週間 604800秒 1ヶ月 30日 2592000秒 31日 2678400秒

Android アプリから外部ブラウザ起動

※intentを使用する String uri_str; Uri uri = Uri.parse(uri_str); Intent i = new Intent(Intent.ACTION_VIEW, uri); startActivity(i);

Android WebViewのPOSTとGET

WebViewを開くときにPOSTとGETを使い分ける。■GET WebView webview = new WebView(this); WebSettings set = webview.getSettings(); set.setUserAgentString(_userAgent); webview.loadUrl("任意のURL"); setContentView(webview); ■POST WebView webview =…

Apache すべてのデータをダンプする(mod_dumpio)

ApacheのログにPOSTされたデータも含めてログ表示させたい用件があったのでメモ。 参考URL: http://httpd.apache.org/docs/2.2/ja/mod/mod_dumpio.html#dumpiologlevel httpd.confに以下を追加。 LoadModule dumpio_module modules/mod_dumpio.so DumpIOInpu…

cakePHP2.3.4 インストールメモ

ダウンロード http://cakephp.jp/ cakephp-2.3.4.zipをダウンロード。 解凍、インストール $ cd /var/www/ $ unzip cakephp-2.3.4.zip $ mv cakephp-2.3.4 cakephp apacheの設定 # /etc/httpd/conf/httpd.conf <VirtualHost *:80> ServerAdmin admin@localhost DocumentRoot /v</virtualhost>…

UIIDの取得(Objective-C)

■UIID -インストール毎ID、Unique Installation Identiferが公開されている。(MITライセンス) --https://github.com/akisute/UIApplication-UIID ※iOS4.3以降 UIID取得方法 [[UIApplication sharedApplication] uniqueInstallationIdentifier];

MySQLデータベースコピー

mysqldumpコマンドを使用する # mysqldump source_db | mysql destination_db ※ユーザー名とパスワードを指定するには以下。 # mysqldump -u USER -p PASSWORD source_db | mysql destination_db

CakePHPでVirtual Host

NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot "D:/xampp/htdocs" ServerName localhost.example.com </VirtualHost> <VirtualHost *:80> DocumentRoot "D:/xampp/htdocs/○○○/app/○○○" ServerName test-srv.hoge.com <Directory "D:/xampp/htdocs/○○○/app/○○○"> Options Indexes FollowSymLinks Includes ExecCGI …</directory></virtualhost>

画面の幅と高さを取得する(Objective-C)

//取得変数定義 CGFloat disp_w; CGFloat disp_h //画面の幅、高さを取得 CGRect r = [[UIScreen mainScreen] bounds]; disp_w = r.size.width; disp_h = r.size.height; //表示 NSLog(@"disp_w:%f", disp_w); NSLog(@"disp_h:%f", disp_h); ■補足 //ステー…

ラベルの外観(枠、角丸、色)を変更する。(Objective-C)

UILabel* label;label.layer.borderColor = [UIColor blueColor].CGColor;label.layer.borderWidth = 2.0;label.layer.cornerRadius = 8; layer.borderColor:テキストフォーム外枠の色 layer.borderWidth:テキストフォーム外枠の太さ layer.cornerRadius:丸…

数値型と文字列の変換(Objective-C)

数値型から文字列への変換NSString *text;text = [NSString stringWithFormat:@"%d",10]; float x = 1.2345f; // 小数点以下2桁まで NSString *str1 = [NSString stringWithFormat:@"%.2f", x]; // 1.23 // 3桁 NSString *str2 = [NSString stringWithFormat…

UUIDの生成(Objective-C)

- (NSString*) getUUID { //UUIDの生成 CFUUIDRef uuidObj = CFUUIDCreate(nil); NSString *uuidString = (NSString*)CFUUIDCreateString(nil, uuidObj); CFRelease(uuidObj); return [uuidString autorelease]; }