っていうところでいささかはまった話です。
なにやら以下のように書く必要があるようです。
$scope.$apply(function () { $scoep.anyProperty = 'hogehoge'; });$applyの引数には式を文字列としても渡せるみたいです。
$scope.$apply(function () { $scoep.anyProperty = 'hogehoge'; });$applyの引数には式を文字列としても渡せるみたいです。
var file = input.files[0]; var name = file.name; var reader = new FileReader(); reader.onloadend = function (e) { var data = e.target.result; if (!data) { return ; } socket.emit('upload', { name : name, data : data}); }; reader.readAsDataURL(file);
var imgStructure = img.split(','); var base64 = imgStructure[1]; fs.writeFile( './public/' + name, new Buffer(base64, 'base64'), function (err) { console.log(err); } );
socket.emit('notify', {url : publicUrl});
socket.on('notify', function (data) { console.log(data); $('#image001').attr('src', data.url); });
pod 'NSRails'
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. [NSRConfig defaultConfig].appURL = @"http://localhost:3000"; return YES; }
rails new nsrails_test_server rails g scaffold user name:string email:string passwd:string created_at:datetime updated_at:datetime
protect_from_forgery with: :null_session
#import "NSRails.h" @interface JpPluscNSRailsTestUser : NSRRemoteObject @property (nonatomic, strong) NSString* name; @property (nonatomic, strong) NSString* email; @property (nonatomic, strong) NSString* passwd; @property (nonatomic, strong) NSString* gender; @end
+ (NSString *) remoteModelName { return @"user"; } + (NSString *) remoteControllerName { return @"users"; } @end
//オブジェクト作成、永続化 user = [[JpPluscNSRailsTestUser alloc] init]; user.name = self.aName.text; user.email = self.aEmail.text; user.passwd = self.aPasswd.text; [user remoteCreateAsync:^(NSError *error) { if (error != nil) { NSLog(@"%@", error); } }]; //取得 [JpPluscNSRailsTestUser remoteAllAsync:^(NSArray *allRemote, NSError *error) { NSMutableArray *indexPaths = [NSMutableArray array]; NSInteger size = [allRemote count]; //画面レンダリングなど... }];
//Gravity.Leftのnumeric表現は3 textView.setGravity(Gravity.LEFT); final int gravityValue = textView.getGravity(); //gravityValue に3を期待するが実際は51が帰ってくる //正しくは以下のように水平、垂直方向両方の指定をする textView.setGravity(Gravity.LEFT|Gravity.TOP); //もしくはgetGravityした値に対して任意の方向のマスクをかけると垂直、水平方向のみの値が取得できる final int horizontalGravityValue = textView.getGravity & Gravity.HORIZONTAL_GRAVITY_MASK; //水平方向の値指定のみ取得 final int verticalGravityValue = textView.getGravity & Gravity.VERTICAL_GRAVITY_MASK; //垂直方向の値指定のみ取得
private static final BACKGROUND; private static final BORDER; static { BACKGROUND = new Paint(); BACKGROUND.setColor(Color.argb(192, 255, 0, 0)); BORDER = new Paint(); BORDER.setStyle(Paint.Style.STROKE); BACKGROUND.setColor(Color.WHITE); } @Override protected void onDraw(Canvas c) { super.onDraw(c); c.drawRect(0, 0, c.getWidth(), c.getHeight(), BACKGROUND); c.drawRect(0, 0, c.getWidth(), c.getHeight(), BORDER); }
@Override protected void onDraw(Canvas c) { super.onDraw(c); c.drawRect(0, 0, c.getWidth(), c.getHeight(), BACKGROUND); c.drawRect(1, 1, c.getWidth()-1, c.getHeight()-1, BORDER); }
if (aPerson != null) { if (aShop != null) { if (dvd != null ) { if (aShop.isKnowingPersonAsMember(aPerson.getId()) { DatingSlip datingSlip = null; if (aDvd.isXrated()) { if(aPerson.isAdult()) { datingSlip = aShop.lend(aPerson, aDvd); } else { throw new PermissionDeniedException(); } } else { datingSlip = aShop.lend(aPerson, aDvd); } aShop.addDatingSlip(datingSlip); } else { throw new PermissionDeniedException(); } } else { throw new NoSuchDvdException(); } } else { throw new IllegalArgumentException(); } } else { throw new IllegalArgumentException(); }
if (aPerson == null || aShop == null) { throw new IllegalArgumentException(); } if (aDvd == null) { throw new NoSuchDvdException(); } if (aShop.isKnowingPersonAsMember(aPerson.getId()) { throw new PermissionDeniedException(); } if (aDvd.isXrated() && !aPersion.isAdult()) throw new PermissionDeniedException(); } DatingSlip datingSlip = aShop.lend(aPerson, aDvd); aShop.addDatingSlip(datingSlip);
my $hoge; $hoge += $_ foreach (@huga); return $hoge if ($hoge % 2 == 0);
my $hoge; foreach (@huga) { $hoge += $_; } if ($hoge % 2 == 0) { return $hoge; }
my @even_score = grep { $_ % 2 == 0 } map { $_->score } grep { not $_->is_viewer($viewer) }@user_score;JSとかのmap, grepは大丈夫なのですが、perlのmap, grepはそれがつながっている場合、前半の処理が後続のmap, grepの結果に依存するため、一度読んでいる箇所からmap, grepのチェーンが終わるところに飛びそこから逆に読み進めていく事となるせいで、読む流れが途切れてしまいます。こちらもステップ数が増えてでも1つの処理毎に一時変数に値を取って書くのが良いと思います。
my @other = grep { not $_->is_viewer($viewer) } @user_score; my @value = map { $_->score } @huga; my @even_score = grep { $_ % 2 == 0 } @value;