Wednesday, 31 May 2017

Disposable e-Mail

Definition 


So what is disposable email ? Disposable is more like act as a temporary email or fake email to send and receive from website or other person that have an email account. However disposable email were not meant to keep longer and after not being used your temporary email will be disposed. Heres the trick, when you need to register account in order to download external software you can use disposable email to keep away from reaching their newsletter and other advertisement that were automatically applied when you register an account from their website. 

Here the list of disposable email that you can use :

1. temp-mail.org
2. guerrillamail.com
3. getnada.com
4. mailinator.com
5. throwawaymail.com
6. mytemp.email

MARC21 Library Standards

Library of Congress
What is Marc record ? A Marc record is a MAchine-Readable Cataloging record
Machine-readable means that a computer, can read and interpret the data in a record. The following pages will explain why this is important and how it is made possible.
Cataloging records come in two types: 1) Bibliographic records, which contain information about a book, serial, sound recording, videorecording, etc., and 2) Authority records, which contain standardized forms for names, titles, and subjects that are used on bibliographic records and provide cross references in catalogs

Call number: The librarian uses a Dewey Decimal or Library of Congress classification schedule to select the call number for an item. The purpose of the call number is to place items on the same subject together on the same shelf in the library. Most items are sub-arranged alphabetically by author. The second part of the call number usually represents the author's name, facilitating this sub arrangement. In other words, it is a system of numbers Dewey Decimal  used to mark and arrange mostly non-fiction books

Installing Fuji Xerox DocuPrint 215 fw Printer ( Wireless )

Wireless Connection


Step by Step installation wireless connection:

1. Press button "system"
2. Now choose "admin menu"
3. Find option "network"
4. Choose "wireless setup"
5. Select access  ( your own wifi )
6. Then, enter phrase password of your wifi
7. Press "Ok"

Now Configure TCP/IP :




















However in step 6 , you can setup your own manual IP as long does not conflict with other hardware IP address by pressing "OK" . Then change your IP Address like "192.168.0.90" for static address.

Reference :

http://www.fujixeroxprinters.com.hk/downloads/uploaded/CM215_UserGuide_Sec_c3b3.pdf

Thursday, 18 May 2017

Topic 19 - Using Dropdown Helper

In some extend , we might use multidropdown for our input which generally passing array values , type , name and manymore. Heres how we do it in laravel. Starting form create widget and respective helper and then call them using Laravel expression { ! Form::classhelper !! }

Widget Layout 

<select name = {{$name}} {{ $type }} class="{!! $class !!} select2" {!! $extra !!} style="width:100%">

    @if(is_array($option))
        @foreach($option as $id => $key)
            @if(is_array($key))
                <optgroup label="{{ $id }}">
                    @foreach($key as $optid => $opt)
                        <option value="{{ $optid }}" {!! (!empty($value) && in_array($optid, $value)) ? 'selected' : '' !!}>{{ $opt }}</option>
                    @endforeach
                </optgroup>
            @else
                <option value="{{ $id }}" {!! (!empty($value) && in_array($id, $value)) ? 'selected' : '' !!}>{{ $key }}</option>
            @endif
        @endforeach
    @else
        <option value=""></option>
        @foreach($option as $option)
            <option value="{{ $option->id }}" {!! (!empty($value) && in_array($option->id, $value)) ? 'selected' : '' !!}>{{ $option->name }}</option>
        @endforeach
    @endif
</select>

Class Helper

public static function multiDropdown($name = 'dropdown', $option = array(), $value = array(), $additional = ''){
        $classmsg = "form-control";
        $additional = Forms::additional($additional, $classmsg);
        $data = array(
            'name' => $name,
            'option' => $option,
            'value' => (!empty($value) && !is_array($value)) ? array($value) : $value,
            'extra' => $additional['extra'],
            'class' => $additional['class'],
            'type' => 'multiple'
        );

        return view('widget.form_dropdown')->with($data);
    }



Form View

<div class="form-group">
    <label class="col-lg-2 control-label">Course</label>
    <div class="col-lg-10">
        {!! Form::MultiDropdown('course[]',$course,'') !!}
    </div>
  </div>


Controller 

public function store(Request $request)
    {
      $catalogue = new Catalogue;
      $purchase = date('Y-m-d', strtotime($request["date_purchase"]));
      $request["date_purchase"] = $purchase;
      // $catalogueid = $request['catalogueid'];
      //
      $request['subject'] = implode(',',$request->input('subject'));
      $request['course'] = implode(',',$request->input('course'));
      $catalogue->insert($request->except('_token'));


      \Session::flash('alert-success', 'Cataloge Successfully Added');
      return redirect(route('catalogue.index'));
    }

Accessing rules ( 3 method ) 

Method 1 - By Controller 

  public function edit($id)
    {
      $typeselection = array(
        '' => '',
        '1' => 'Book',
        '2' => 'Journal',
        '3' => 'Dissertation'
      );

     $data = array(
            'breadcrumb' => array('Library', 'Catalogue','Update'),
            'content' => 'library.catalogue.form',
            'title' => 'Update Catalogoue',
            'type_selection' => $typeselection,
            'type' => 2,
        );
      return view('layouts.template')->with($data);
    }
then ,  call by writing this :

{{$item_status[$catalogue->item_status]}}


Method 2 - By Model

  public function getStatusNameAttribute()
    {
      if ($this->item_status == '1') {
        return 'On Shelf';
      }
      else if ($this->item_status == '2') {
        return 'Lost';
      }
      else if ($this->item_status == '3') {
        return 'Damage';
      }
    }

then ,  call by writing this :

{{$catalogue->StatusName}}

Method 3 - By Repository



Friday, 12 May 2017

Topic 18 - Laravel SoftDeletes


What is soft delete?

Soft delete often use to hold value or record that user might delete and restore back when needed (involve database and crud ). Soft delete require Illuminate\Database\Eloquent\SoftDeletes and declared on a model. Here is our example that might help you:

Model View 

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Catalogue extends Model
{
  /**
   * The attributes that are mass assignable.
   *
   * @var array
   */

   use softDeletes;

    protected $fillable = array('id','type','status');

    protected $dates = ['deleted_at'];

}

Controller 

  public function destroy($id)
  {
    $alumni = Alumni::findOrFail($id);
    $alumni->deleted();
  }

Soft delete will not remove permanently your record instead 'deleted_at' will tell you the timestamp of your record has been deleted and thus hide the record from showing it to the user .

Reference


http://stackoverflow.com/questions/22426165/laravel-soft-delete-posts

Possible Ways of Naming Route

Calling by giving snake case

Route::resource('patron_profile','Setting\Library\PatronProfileController');
route('patron_profile.index');


Calling by giving an alias


Route::resource('profile','Setting\Library\PatronProfileController',[
          'as' => 'patron'
        ]);
route('patron.profile.index');




Thursday, 11 May 2017

Laravel Query Log - Check Query & Array Pass

Enable Query Log

Laravel can optionally log in memory all queries that have been run for the current request. Be aware that in some cases, such as when inserting a large number of rows, this can cause the application to use excess memory. To enable the log, you may use the enableQueryLog( ) method:

\DB::enableQueryLog();
        Alumni::with('alumni_careers')->findOrFail($id);
        $result = \DB::getQueryLog();
        dump($result);


With the code above , we can check wether the alumni table has relationship with alumni_careers table as define in model class. The output will be like below :