Menus

Wednesday, 27 December 2017

How to format pen drive in Ubuntu



Graphical Method

Open Disks program 



Then choose your device from left. 
Click more options button and click onformat as below:







Command-Line

How to format pen drive in ubuntu any version.


Open the Terminal (Ctrl + Alt + T)

fdisk -l

umount /dev/sdc*

mkfs.vfat /dev/sdc*




Thank You


Thursday, 14 December 2017

How to completely uninstall android studio in ubuntu


Open Terminal

Ctrl + Alt + T

sudo su  //login to superuser

Run the following commands in the terminal:
rm -Rf /Applications/Android\ Studio.app  
rm -Rf ~/Library/Preferences/AndroidStudio*  
rm -Rf ~/Library/Preferences/com.google.android.*  
rm -Rf ~/Library/Preferences/com.android.*  
rm -Rf ~/Library/Application\ Support/AndroidStudio*  
rm -Rf ~/Library/Logs/AndroidStudio*  
rm -Rf ~/Library/Caches/AndroidStudio*  
rm -Rf ~/.AndroidStudio*  
rm -Rf ~/.gradle  
rm -Rf ~/.android  
rm -Rf ~/Library/Android*  
rm -Rf /usr/local/var/lib/android-sdk/  
rm -Rf ~/.AndroidStudio*  
To delete all projects:
rm -Rf ~/AndroidStudioProjects  

Uninstall Android Studio











Monday, 11 December 2017

Yii2 CheckBox

LIKE | COMMENT | SHARE | SUBSCRIBE
LIKE | COMMENT | SHARE | SUBSCRIBE

Yii2 - Display checkbox for boolean database field on active form


<?= $form->field($model, 'mon')->checkBox(['selected' => $model->mon])?>

Change Label


<?= $form->field($model, 'mon')->checkBox(['label'=> 'Monday',  'selected' => $model->mon])?>



Required Checkbox

Add this code your rules function on model class

           [['mon''], 'compare',
                'compareValue' => true,
                'operator' => '==',
                'message' => "Check to Continue",
                'when' => function ($data) {
                    return $data->mon== 1;
                }
            ],



Example

Model class

<?php

namespace backend\modules\test\models;

use Yii;

/**
 * This is the model class for table "studentsdetails".
 *
 * @property integer $id
 * @property string $name
 * @property string $address
 * @property integer $isverified
 */
class Studentsdetails extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'studentsdetails';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['name', 'isverified'], 'required'],
            [['isverified'], 'integer'],
            [['name'], 'string', 'max' => 300],
            [['address'], 'string', 'max' => 500],
         
            [['isverified'], 'compare',
                'compareValue' => true,
                'operator' => '==',
                'message' => "Check to Continue",
                'when' => function ($data) {
                    return $data->isverified== 1;
                }
            ],

         
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'name' => 'Name',
            'address' => 'Address',
            'isverified' => 'Isverified',
        ];
    }
}

View file
_form.php

<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model backend\modules\test\models\Studentsdetails */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="studentsdetails-form">

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'address')->textInput(['maxlength' => true]) ?>

 
    <?= $form->field($model, 'isverified')->checkBox(['selected' => $model->isverified])?>
 
 
    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>

Sunday, 10 December 2017

MySql Boolean Data type field create


MySql BOOLEAN or TINYINT


MySQL provides BOOLEAN or BOOL as the synonym of TINYINT(1).

Example 1
Create job table  with boolean data type.



After save job table structure.



Example 2


CREATE TABLE tasks (
    id INT PRIMARY KEY AUTO_INCREMENT,
    title VARCHAR(255) NOT NULL,
    completed BOOLEAN
)


Thursday, 7 December 2017

Javascript Tutorials


Convert DD-MM-YYYY to YYYY-MM-DD format using Javascript



var date = "03-11-2014"; 
var newdate = date.split("-").reverse().join("-");



Javascript add number of days to today's date?



   var dd = 07-12-2017
   var x = 30; //days for add 

   var newdate = dd.split("-").reverse().join("-");   //date convert yyyy-mm-dd
   var someDate = new Date(newdate);
   someDate.setDate(someDate.getDate() + x); //number  of days to add, e.x. x days
   var dateFormated = someDate.toISOString().substr(0,10);     
          
   var vdate = dateFormated.split("-").reverse().join("-");   //date convert to dd-mm-yyyy  
 
 




Sunday, 26 November 2017

VB.NET DataGridView Tutorials





Adding checkbox column to DataGridView


  Dim AddColumn As New DataGridViewCheckBoxColumn

  With AddColumn
    .HeaderText = "ColumnName"
    .Name = "Column Name that will be displayed"
    .Width = 80
  End With

  dgAdmin.Columns.Insert(1, AddColumn)


datagridview column header checkbox


Public Class search


Private col As DataGridViewCheckBoxColumn

Private chkBox As CheckBox


Private Sub search_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load



col = New DataGridViewCheckBoxColumn()
col.Name = "select"
col.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
dgcourse.Columns.Insert(0, col)

chkBox = New CheckBox()
Dim rect As Rectangle = dgcourse.GetCellDisplayRectangle(0, -1, True)
chkBox.Size = New Size(18, 18)
chkBox.Location = rect.Location
AddHandler chkBox.CheckedChanged, AddressOf chkBox_CheckedChanged

dgcourse.Controls.Add(chkBox)



End Sub


Private Sub chkBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
'checkbox value change 
For i As Integer = 0 To dgcourse.Rows.Count - 1
dgcourse(0, i).Value = chkBox.Checked
Next


End Sub



End Class



DataGridView - how to hide the “new” row?



Click on datagridview and change properties AllowUserToAddRows set as false.


Programmatically,
myGrid.AllowUserToAddRows = False


Read the checked rows in a datagridview


For i = 0 To dgcourse.Rows.Count - 1

   If dgcourse.Rows(i).Cells("select").Value Then
      'dgcourse.Item(1, i).Value 
    End If


Next i


Delete row in datagridview

DataGridView1.Rows.Remove(DataGridView1.Rows(x))

Make one column set as editable

Datagridview Readonly Property set as True - all columns are not editable.


dataGridView1.Columns("ColumnName").ReadOnly = false;