Monthly Archives: March 2015

“System program problem detected” – Ubuntu

Disabling error-reporting is not a desirable solution!

Ubuntu has an error reporting system called apport which tries to catch all program crashes in the background and report them to help the developers.

It seems that after a dist-upgrade there are stuck some reports that are tried to be resubmitted somehow, but disabling apport is not a desirable solution.

Remove old crash-reports

Open a terminal and remove all old crash-reports that might exist in the crash-report directory:

After a reboot the popups are gone.

If you don’t want to reboot, you can close all open popups with:

(Any further new pop-ups still should be investigated. If you want to see the details,
look in /var/crash/ for any new reports)

Ref : http://askubuntu.com/a/369297

 

IMDB movie search with Ionic and Angular JS

Ionic-training-banner

Ionic is a beautiful, open source front-end SDK for developing hybrid mobile apps with HTML5. ( from ionic website)

AngularJS is a JavaScript framework. It can be added to an HTML page with a <script> tag. AngularJS extends HTML attributes with Directives, and binds data to HTML with Expressions. ( From w3schools )

The IMDB movie search application

In this application we will accept movie name from user and send it to movie api. We will use The Open Movie Database (which is unofficial imdb api) to fetch movie details.

In this tutorial we will be using Ionic Card Showcase to show movie poster and other details like year of release, genre, actors etc. To fetch the movie information we will user Angular JS Factory.

Following is the codepen for this application

See the Pen Imdb Movie Search by Devendra Verma (@devendraverma) on CodePen.

Resize image in Laravel

To re size image in laravel we will use a library called Intervention.

Intervention Image is an open source PHP image handling and manipulation library. It provides an easier and expressive way to create, edit, and compose images and supports currently the two most common image processing libraries GD Library and Imagick. ( from their website)

So lets start with installation, the easiest way to install intervention is through composer. So run the following command in your terminal inside your application folder

composer require intervention/image

If it asks for specify version to be installed, add current stable version for this I will enter  2.1.2 (which is latest version at the time of writing this post) .

After you have installed Intervention Image, open your Laravel config file config/app.php and add the following lines.

In the $providers array add the service providers for this package.

‘Intervention\Image\ImageServiceProvider’

Add the facade of this package to the $aliases array.

‘Image’ => ‘Intervention\Image\Facades\Image’

Now the Image Class will be auto-loaded by Laravel.

Now we are done with the installation part, lets create a route to test our image re sizing.

// usage inside a laravel route

Route::get(‘/’, function() {

$img = Image::make(‘foo.jpg’)->resize(300, 200);

return $img->response(‘jpg’);

});

This will resize the provided image into 300 * 200 jpeg image. There some other options also, lets see them.

// To resize only the width of the image
$img->resize(300, null);

// To resize only the height of the image

$img->resize(null, 200);

// To resize the image to a width of 300 and constrain aspect ratio (auto height)
$img->resize(300, null, function ($constraint) {
$constraint->aspectRatio();
});

// To resize the image to a height of 200 and constrain aspect ratio (auto width)
$img->resize(null, 200, function ($constraint) {
$constraint->aspectRatio();
});

Besides image resize, intervention provides whole lot of functions to perform image manipulation. No matter if you want to create image thumbnails, watermarks or format large image files Intervention Image helps you to manage every task in an easy way with as little lines of code as possible.