Syntax changes for Laravel 4

basic routes

Route::get('users/{id}'), function($id) {
	var_dump(“user with the id of $id”);
});

master page within a controller

>> routes

Route::get('/', 'HomeController@index');

>> controller

class HomeController extends BaseController {
	protected @layout = 'master';

	public function index()
	{
		$this->layout->content = View::make('home.index');
	}
}

>> views

- master.blade.php

:
<body>
	@yield('content')
</body>
:

- home/index.blade.php

@section('content')

hello

@stop

master page within a view

>> routes

Route::get('/', 'HomeController@index');

>> routes

class HomeController extends BaseController {
	public function index()
	{
		return View::make('home.index');
	}
}

>> views

- master.blade.php

:
<body>
	@yield('content')
</body>
:

- home/index.blade.php

@extends('maser');

@section('content')

hello

@stop

Laravel 4 Beta 5 installation and configuration

1. composer installation

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

2. L4 installation

wget https://github.com/laravel/laravel/archive/develop.zip

unzip develop.zip

composer version issue (optional)

/usr/local/bin/composer self-update

composer install

mcrypt issue (optional for MAMP Pro on Mac OSX)

mv /usr/bin/php /usr/bin/php.bak
ln -s /Applications/MAMP/bin/php/php5.3.6/bin/php /usr/bin/php

php artisan key:generate

chmod -R a+w ~/Sites/(domain.name)/app/storage

iOS push notification

A friendly reminder for setting up iOS push notification

http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-p…

http://www.raywenderlich.com/3525/apple-push-notification-services-tutorial-p…

 

Everything’s well written in the 1st part of the raywenderlich’s tutorial. One thing you may have to do is removing the passphrase from the PEM format of private key. To do that, refer the step 9 in the following tutorial.

Apple UI Artworks extractor

If you’ve ever wanted to take advantage of the actual images that UIKit itself uses to compose the standard Apple iPhone UI elements, you can pull them off with UIKit Artwork Extractor. Holy moly! No need to searching around the Web anymore!

https://github.com/0xced/UIKit-Artwork-Extractor

 

A proper way to set a Grouped UITableView with your custom background image

After playing it around, I figured this out.

 

- (void)viewDidLoad

{

[super viewDidLoad];

//

// a proper way to set a Grouped UITableView with your custom background image

//

self.tableView.backgroundView = nil;

self.parentViewController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"commonBg.png"]];

}

 

Hope someone would find this useful.

an interesting way of passing data between VCs under Navigation Controller

not with delegation. but with navigation controller. interesting.

 

http://stackoverflow.com/questions/13551778/unwind-segue-with-navigation-back-button

 

the difference between these 2

RootViewController *rootViewController = (RootViewController *)[navigationController topViewController];

RootViewController *rootViewController = (RootViewController *)[navigationController.viewControllers objectAtIndex:0];

topViewController of a navigation controller represents the view controller at the top of the stack. Index 0 is the bottom. topViewController is the object at index 0 only when one view controller is on the stack. If you have more than one, it is not the same. I am guessing that it is the case as it’s crashing because the topViewController doesn’t know how to respond to messages intended for aRootViewController instance.

how to use the ObjectiveC port of ZXing Library

available at https://github.com/TheLevelUp/ZXingObjC

Getting Started in the readme.md didn’t work so I had to do the following steps to make it work.

  • copy the whole folders into your working project’s sub-folder.
  • and drag/add ZXingObjC.xcodeproj file to “<your working project>”.
  • make sure tick `create folder references for any added folders` option when prompted.
  • then, go to your project’s Target > Build Phases
  • under Target Dependencies, add ZXingObjC-iOS (ZXingObjC)
  • under Link Binary With Libraries, add libZXingObjC-iOS.a
  • under the same category, add the following 6 frameworks
    1. AVFoundation.framework
    2. CoreGraphics.framework
    3. CoreMedia.framework
    4. CoreVideo.framework
    5. ImageIO.framework
    6. QuartzCore.framework

hope this saves your day.