inTimeHHMM = inTime.split(":");
outTimeHHMM = outTime.split(":");
var today = new Date();
var dateInTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), inTimeHHMM[0], inTimeHHMM[1], 0);
var dateOutTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), outTimeHHMM[0], outTimeHHMM[1], 0);
if(dateInTime<=dateOutTime){
}else{
dateOutTime.setDate(dateOutTime.getDate() + 1);
}
var diff =(dateOutTime.getTime() - dateInTime.getTime()) / 1000;
diff /= 60;
workingMinutes = Math.abs(Math.round(diff));
Sunday, 11 June 2017
Javascript - In time and out time difference
Monday, 10 April 2017
Daterangepicker set min time
Date.prototype.addHours = function(h) {
this.setTime(this.getTime() + (h*60*60*1000));
return this;
}
var currDate = new Date().addHours(5); // 5 is the hours
$('#fromDate').daterangepicker({
minDate: currDate,
timePicker: true,
singleDatePicker: true,
timePickerIncrement: 1,
format: 'DD/MM/YYYY hh:mm A'
});
Thursday, 23 February 2017
jQuery validation - IP address
/*
ValidIpAddressRegex = "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$";
ValidHostnameRegex = "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$";
*/
$.validator.addMethod('ipChecking', function(value) {
//var ip = "^(?:(?:25[0-5]2[0-4][0-9][01]?[0-9][0-9]?)\.){3}" +"(?:25[0-5]2[0-4][0-9][01]?[0-9][0-9]?)$";
validIpAddressRegex = "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$";
ipCheckFlag = true;
ipLists = value.split(',');
for(ip=0; ip<ipLists.length; ip++){
if(!ipLists[ip].trim().match(validIpAddressRegex)){
ipCheckFlag = false;
}
}
return ipCheckFlag;
});
Monday, 19 December 2016
PHP Array to stdClass Array – stdClass Object
<?php
$_TestAry = $this->_TestModel->getTestData();
$_TestAry = $this->_TestModel->getTestData();
if( isset($_TestAry) && !empty($_TestAry) && count($_TestAry) > 0){
$_TestAry[count(_TestAry)+1] = new StdClass;
// avoid warning creating default object from empty value $_TestAry[count(_TestAry)+1]->id = 11; $_TestAry[count(_TestAry)+1]->name = 'Jayakumar'; } ?>
Wednesday, 30 November 2016
Moto E first generation wifi, bluetooth, sound and calls not working
This is what I found from this link: http://forum.xda-developers.com/moto-e/help/network-wifi-bluetooth-t3117010
Flash stock rom via fastboot: Ensure your phone's battery is atleast 50% charged. Just charge your phone for 45 mins,ead if yor phones seems dead. You DONT need to unlock bootloader for flashing official firmwares
- Download and install Motorola device manager
- Download and extract adb_fastboot.zip to any folder on your pc
- Download Stock 5.1 rom file for your device model [thanks to lost101] and extract its contents to the same folder where you have adb_fastboot files
- Reboot your phone to 'bootloader mode'. To do this turn of your phone completely. Hold volume down button and then press and hold power button. Release power button after 4-6 seconds and then release volume down button. Your phone is now in bootloader mode.
- Connect your phone to pc via a reliable usb cable. Look at your phone screen. It should say 'USB connected'.
- Now go to the folder where you have extracted all the files. Holding down shift key, Right click on any point on white screen. Then click on 'open command window here' from the menu that appears. Command Prompt will open now
- On command prompt type Code: fastboot devices and check if it is detecting your device.
- Now run the following commands in the given sequence
Code:
mfastboot flash partition gpt.bin
mfastboot flash motoboot motoboot.img
mfastboot flash logo logo.bin
mfastboot flash boot boot.img
mfastboot flash recovery recovery.img
mfastboot.exe flash system system.img_sparsechunk.0
mfastboot.exe flash system system.img_sparsechunk.1
mfastboot.exe flash system system.img_sparsechunk.2
mfastboot.exe flash system system.img_sparsechunk.3
mfastboot flash modem NON-HLOS.bin
mfastboot erase modemst1
mfastboot erase modemst2
mfastboot flash fsg fsg.mbn
mfastboot erase cache
mfastboot erase userdata
fastboot reboot
Proceed to each command after you get success message on command. If file name of system.img_sparsechunk is different then change the command accordingly. Just ensure to flash all system.img_sparsechunk files. Your phone may take 10-20 mins to turn on the first time. Dont panic this is normal. If it takes more time then power it off by holding power button till it turns off. Power it on after it cools down.
How to detect Safari, Chrome, IE, Firefox and Opera browser?
// Opera 8.0+
var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
// Firefox 1.0+
var isFirefox = typeof InstallTrigger !== 'undefined';
// At least Safari 3+: "[object HTMLElementConstructor]"
var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
// Internet Explorer 6-11
var isIE = /*@cc_on!@*/false || !!document.documentMode;
// Edge 20+
var isEdge = !isIE && !!window.StyleMedia;
// Chrome 1+
var isChrome = !!window.chrome && !!window.chrome.webstore;
// Blink engine detection
var isBlink = (isChrome || isOpera) && !!window.CSS;
var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
// Firefox 1.0+
var isFirefox = typeof InstallTrigger !== 'undefined';
// At least Safari 3+: "[object HTMLElementConstructor]"
var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
// Internet Explorer 6-11
var isIE = /*@cc_on!@*/false || !!document.documentMode;
// Edge 20+
var isEdge = !isIE && !!window.StyleMedia;
// Chrome 1+
var isChrome = !!window.chrome && !!window.chrome.webstore;
// Blink engine detection
var isBlink = (isChrome || isOpera) && !!window.CSS;
Wednesday, 24 August 2016
Codeigniter group by multiple columns
$this->db->group_by()
Permits you to write the GROUP BY portion of your query:
You can also pass an array of multiple values as well:
Permits you to write the GROUP BY portion of your query:
$this->db->group_by("title"); // Produces: GROUP BY title
$this->db->group_by(array("title", "date")); // Produces: GROUP BY title, date
Subscribe to:
Posts (Atom)
Git merge branch to another branch
$ git checkout develop $ git pull $ git checkout test-branch $ git merge develop $ git push
-
/* ValidIpAddressRegex = "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$...
-
You need to take an integer input and then draw the pattern according to it. Say for example if you enter 5 then, the pattern should be like...
-
w3schools.com freecodecamp.org sololearn.com upskillcourses.com programiz.com ...