Tuesday, August 30, 2022

Google Drive access from Google Colab

 import pandas as pd



from google.colab import drive
drive.mount('/content/drive')

data= pd.read_csv('/content/drive/MyDrive/DataScience/Content/kidney_disease.csv')
data.head()

Monday, August 24, 2015

Context Menu in Jquery

 contextMenu.js
contextMenu.css


$.contextMenu({
    selector: '#tblAmendGrid tr:gt(0)',
    callback: function (key, options) {
        switch (key) {
            case 'Delete':
                deleteAmendmentInfo($(this).children('td:eq(0)').text());
                break;
        }
    },
    items: {
        "Delete": { name: "Delete", icon: "edit" }
    }

});

Wednesday, June 17, 2015

design pattern

http://www.oodesign.com/
https://sourcemaking.com/design_patterns

Friday, June 5, 2015

Datediff in sql in hour minute second

insert into [DBL_Group].[dbo].[tblGmMachineZeroHour]( fldDate,                  fldOrderNo,     fldUnit,   [fldLine], fldMachineName, fldMachineQty,fldReasonKey,fldFrom,   [fldTo],   fldTotalTime,[fldReason])
SELECT
     Cast( fldDate  as Date),  [fldOrderNo],   [fldUnit],    [fldLine],[fldMachineName],[fldMachineQty],[fldReasonKey], [StartProblem],[Confirmation],
     CAST(DATEADD(MINUTE,DATEDIFF(MINUTE,[StartProblem],[Confirmation]),'1900-01-01 00:00:00.000') AS Datetime)   ,
    
     [fldReason]   
    
  FROM [DBL_Group].[dbo].[tblGmMachineZeroHourTest]   where [StartProblem] is not null and  [Confirmation] is not null
  and  DATEDIFF(Day,[StartProblem],[Confirmation])<1 and fldReasonKey is not null

Tuesday, May 26, 2015

Uploading Image to Server using jquery c#

    $("#avatarUpload").on('change', function () {

        previewFile();
    });

    var imgBase64;
    function previewFile(evt) {
        // var preview = document.querySelector('#<%=Avatar.ClientID %>');
       // var files = evt.target.file;
        var preview = document.getElementById('avatarImg');
        //$('#avatarImg');
      //  var file = document.querySelector('#avatarUpload').files[0];
        var input = document.getElementById('avatarUpload');
        var dv = document.getElementById('showImg');
        var file = input.files[0];
        console.log(file);
        var reader = new FileReader();

        reader.onloadend = function () {
            preview.src = reader.result;
            dv.value = reader.result;
            imgBase64 = reader.result;
            imgBase64 = imgBase64.replace('data:image/png;base64,', '');
            imgBase64 = imgBase64.replace('data:image/gif;base64,', '');
           // console.log(btoa(reader.result))
        }

        if (file) {
           // alert('file found');
             reader.readAsDataURL(file);
           // reader.readAsArrayBuffer(file)

           // reader.readAsBinaryString(file);
        } else {
            preview.src = "";
        }
    }



       // var image = document.getElementById("avatarImg").toDataURL("image/png");
     var   image = imgBase64.replace('data:image/jpeg;base64,', '');

        $.ajax({
            type: "POST",
            url: base + "TPWL/InsertImage",
            dataType: "JSON",
            data: JSON.stringify({ "obj": image }),
            contentType: "application/json;charset=utf-8",
            success: function (data) {
                console.log(data);
                if (data.ResultID != '-1') {
                    $("#spInfo").html('<strong style="color:green">' + data.Message + '</strong>');
                    $("#tblDetails tr:gt(0)").remove();
                    if (data.obj != null) {
                        AppenHeadData(data.obj.OrderHead);
                        AppendDetailsTable(data.obj.OrderDetailsDetails)
                    }
                }
                else {
                    $("#spInfo").html('<strong style="color:red">' + data.Message + '</strong>');
                }


            },
            error: function (a, b, c) {
                alert(a + '..' + c.statusCode);
                // alert(a.statusText);
            }

        });


    });


<div style=" text-align:center;">
    <input id="avatarUpload" type="file" name="files[]" accept="image/*" />
    <img width="60" height="60" src="123.jpg" id="avatarImg" />

    <input type="button"  value="Image Upload" id="tbnImgUpload"/>

    <textarea id="showImg"></textarea>
</div>

Friday, April 24, 2015

Tuesday, March 3, 2015

Adding Genymotion in Android Studio

1)Go to Setting in android studion, then go to Plugin ,serach for Genymotion,Choose Download and Instal
2) Restatrt Android Studio, You will see Android ICON