Saturday, May 3, 2014

How to remove index.php from CodeIgniter URL in Ubuntu

[caption id="attachment_979" align="aligncenter" width="225"]Codeigniter CodeIgniter[/caption]

 

In application/config/config.php change:
$config['index_page']='index.php';

to:
$config['index_page']='';

 

Create or modify .htaccess in project root with following content.
# Customized error messages.
ErrorDocument 404 /index.php
# Set the default handler.
DirectoryIndex index.php
# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
</IfModule>

Also allow overriding htaccess in your apache
/etc/apache2/sites-available/default

and edit the file & change to
AllowOverrideAll

and

Restart Apache

 
sudo /etc/init.d/apache2 reload

or:
sudo service apache2 reload

or:
sudo /etc/init.d/httpd reload

Thursday, May 1, 2014

How to Install PhoneGap in Ubuntu

[caption id="attachment_975" align="aligncenter" width="599"]PhoneGap PhoneGap[/caption]

 

1. First, check you’ve got Java and Ant installed – you’ll need those later:
sudo apt-get install default-jre
sudo apt-get install default-jdk
sudo apt-get install ant

2. Install npm
sudo apt-get install npm

3. Get the latest nodejs (by installing ‘n’ and running that):
sudo npm update npm -g
sudo npm install n -g
sudo n stable

4. Now install phonegap itself
sudo npm install -g phonegap

5. Download the Android sdk from http://developer.android.com/sdk/index.html, put it somewhere sensible and unpack it:
sudo mv ~/Downloads/adt-bundle-linux-x86-20130917.zip /opt/
cd /opt
sudo unzip adt-bundle-linux-x86-20130917.zip
sudo chmod -R 777 /opt/adt-bundle-linux-x86-20130917

6. Update PATH in ~/.bashrc to include the phonegap tools:
# Add android sdk
PATH=$PATH:/opt/adt-bundle-linux-x86-20130917/sdk/platform-tools:/opt/adt-bundle-linux-x86-20130917/sdk/tools

and then ‘source ~/.bashrc’ to make sure you’ve got the new path setup.

7. Create a phonegap app (I use a “projects” subdirectoy):
cd ~/projects
phonegap create my-app
cd my-app

8. Before you run the app, you’ll need to set up an emulator – run the android tool:
android

9. You may need to select a target (e.g. “Android 4.2.2 (API 17)”), and click the “Install 8 packages..” button (may need several clicks to accept all the licences)

Now setup and start an emulator – in the ‘android’ util, go to Tools -> Manage AVDs, go to the “Device Definitions”, select a device, and use the “Create AVD” button to create a new AVD. Then use the “Start..” button to start the AVD (it may take a surprisingly long time to start fully).

Run the app:
phonegap local run android

You should see the app compile and install on the emulator.

You can do the compile and install steps separately:
phonegap local build android
phonegap install android

10. Add plugins
Optional Step
phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-media.git

 

Original tutorial found at
http://julianhigman.com/blog/2013/10/17/notes-on-setting-up-phonegap-on-ubuntu-for-android-app-development/

How to enable CORS in Laravel 5

https://www.youtube.com/watch?v=PozYTvmgcVE 1. Add middleware php artisan make:middleware Cors return $next($request) ->header('Acces...