new blog : How to install MongoDB on Ubuntu?
http://www.infotechvedas.com/blogs/blog-how-to-install-mongodb.php?blog=How-to-install-MongoDB-on-Ubuntu
Info Tech Vedas - PHP 5.5 quiz, mock test, php zend certification exam, blog list
LAMP technology
Linux, Apache, MySQL, PHP example...
Monday, January 26, 2015
Monday, October 13, 2014
Install Android Studio on Debian/Ubuntu 14.04 Linux
My web site : Info Tech Vedas
Install Android Studio on Debian/Ubuntu 14.04 LTS
Step 1: Install Android Studio
To add the PPA and install Android Studio in Debian/Ubuntu, use the following commands:
$ sudo add-apt-repository ppa:paolorotolo/android-studio
$ sudo apt-get update
$ sudo apt-get install android-studio
Step 2: To Run Android Studio
Search Android Studio on Ubuntu home search area click to run.
Note: Before running Android Studio, you need to install Java 1.8.0
http://readlamp.blogspot.in/2014/09/install-oracle-java-on-debianubuntu.html
Monday, September 29, 2014
Install Oracle Java on Debian/Ubuntu 14.04 Linux
My web site : Info Tech Vedas
Install Android Studio on Debian/Ubuntu 14.04 LTS
Step 1: Install Android Studio
To add the PPA and install Android Studio in Debian/Ubuntu, use the following commands:
$ sudo add-apt-repository ppa:paolorotolo/android-studio
$ sudo apt-get update
$ sudo apt-get install android-studio
Step 2: To Run Android Studio
Search Android Studio on Ubuntu home search area click to run.
Note: Before running Android Studio, you need to install Java 1.8.0
http://readlamp.blogspot.in/2014/09/install-oracle-java-on-debianubuntu.html
Wednesday, September 17, 2014
Linux, MySQL - Technical Help dailys uses and commands, list of frameworks
My web site : Info Tech Vedas
These commands are tested on Linux - Ubuntu, Debian
Change TimeZone on Linux: sudo dpkg-reconfigure tzdataFinding out latest created/modified files
This for 4 hours = 240 minutes
--------------------------------
find . -type f -name '*' -mmin -240
This for files for 2 days
--------------------------------
find . -type f -name '*' -mtime -2
Mounting external drives:
ls /sys/block/
ls /sys/dev
fdisk -l /dev/sda7
fdisk -l /dev/sda6
grep sda5 /proc/partitions
sudo fdisk -l
sudo mkdir externaldrv
sudo mount -t ntfs-3g /dev/sda5 /media/externaldrv
Find and replace in files:
find . -type f -print0 | xargs -0 sed -i 's/10.25.45.254/localhost/g'
MySQL updating column with auto serial numbers:
-------------------------------------
SET @redemption=0;
update tableName set redemption=(@redemption:=@redemption+1);
MySQL export database from command line:
-------------------------------------
mysqldump -u {root} -p{123456} {databaseName} > {databaseName.sql}
Reading MySQL dir:
----------------------------
sudo -u mysql ls -ltr mysql
sudo
-u mysql -s
Open Source:
Audio Player:
http://www.schillmania.com/projects/soundmanager2/
Nagios:
scp check_mysql_health root@198.61.233.52:/usr/lib/nagios/plugins/
scp check_mysql_health root@198.61.233.52:/usr/lib/nagios/plugins/
Graphs and Charts:
http://www.chartjs.org/docs/
http://www.jqplot.com/
http://dygraphs.com
http://www.rgraph.net
Flash Chart:
http://teethgrinder.co.uk
PHP vs Node.js
http://www.quora.com/What-are-the-pros-and-cons-of-PHP-versus-Node-js
https://thomashunter.name/blog/php-vs-nodejs
Java Framework:
http://zeroturnaround.com/rebellabs/top-4-java-web-frameworks-revealed-real-life-usage-data-of-spring-mvc-vaadin-gwt-and-jsf/
http://zeroturnaround.com/rebellabs/java-tools-and-technologies-landscape-for-2014/
Compare technology:
http://vschart.com/compare/postgresql/vs/apache-cassandra/vs/mysql
http://vschart.com/compare/play-framework/vs/zend-framework/vs/django-framework
RDBMS vs NoSQL:
http://www.datastax.com/relational-database-to-nosql
Tutorial help links:
GIT http://www.vogella.com/tutorials/Git/article.html
Tutorial help Node
https://www.youtube.com/watch?v=Lgk3gAt9tsE
http://www.jqplot.com/
http://dygraphs.com
http://www.rgraph.net
Flash Chart:
http://teethgrinder.co.uk
PHP vs Node.js
http://www.quora.com/What-are-the-pros-and-cons-of-PHP-versus-Node-js
https://thomashunter.name/blog/php-vs-nodejs
Java Framework:
http://zeroturnaround.com/rebellabs/top-4-java-web-frameworks-revealed-real-life-usage-data-of-spring-mvc-vaadin-gwt-and-jsf/
http://zeroturnaround.com/rebellabs/java-tools-and-technologies-landscape-for-2014/
Compare technology:
http://vschart.com/compare/postgresql/vs/apache-cassandra/vs/mysql
http://vschart.com/compare/play-framework/vs/zend-framework/vs/django-framework
RDBMS vs NoSQL:
http://www.datastax.com/relational-database-to-nosql
Tutorial help links:
GIT http://www.vogella.com/tutorials/Git/article.html
Tutorial help Node
https://www.youtube.com/watch?v=Lgk3gAt9tsE
Sunday, March 9, 2014
Conversion of Local DateTime to GMT DateTime and vice-versa
My web site : Info Tech Vedas
Purpose of this example to solve the problem for GMT DATE TIME and LOCAL DATE TIME i.e. Conversion of Local DateTime to GMT DateTime and vice-versa
Download from Git URL : https://github.com/infotechvedas/localdatetimetogmtdatetime.git
1. Create one database
set database/user/password into "includes/config.php"
2. Extract the folder put into folder where it can be accessible to the browser
3. hit url in browser see some existing example on home page
4. to add new row click on the add link
I am passing timezoneoffset from add form and current date time
Processing timezoneoffset as in array format:
because we need conversion from number i.e. (+5.50) to time as 05:30, sign will be +
if timezone offset number is in negative i.e. (-5.50) as 05:30 sign will be -
I have written this function in "library/general-function.php"
convertTimezoneOffsetToTime(timezoneoffset);
getGMTtoLocalTime($aTimeZoneOffset, $gmtDateTime);
getLocalTimeToGMT($aTimeZoneOffset, $currentDateTime);
For this example its required timezoneoffset, otherwise it won't work.
timezoneoffset will get on browser from JavaScript, its varies from country to country.
You must read these files to understand the code:
1. js/membership-script.js --- getting timezoneoffset
2. library/general-function.php ---- calculating timezoneoffset, getting local date time to GMT date Time, GMT to local date time, php date to MySQL date, MySQL to local date time
3. membership.php --- adding processing timezoneoffset, local date time to GMT date time
4. index.php --- showing added data processing timezoneoffset, GMT date time to local date time
5. add.php --- showing add form
My contact details are as follows:
Email: dhananjayksharma@gmail.com or infotechvedas.yahoo.co.in
Blog: http://readlamp.blogspot.com/
WebSite: www.infotechvedas.com -- coming soon
Skype id: dksitv
Purpose of this example to solve the problem for GMT DATE TIME and LOCAL DATE TIME i.e. Conversion of Local DateTime to GMT DateTime and vice-versa
Download from Git URL : https://github.com/infotechvedas/localdatetimetogmtdatetime.git
1. Create one database
set database/user/password into "includes/config.php"
2. Extract the folder put into folder where it can be accessible to the browser
3. hit url in browser see some existing example on home page
4. to add new row click on the add link
I am passing timezoneoffset from add form and current date time
Processing timezoneoffset as in array format:
because we need conversion from number i.e. (+5.50) to time as 05:30, sign will be +
if timezone offset number is in negative i.e. (-5.50) as 05:30 sign will be -
I have written this function in "library/general-function.php"
convertTimezoneOffsetToTime(timezoneoffset);
getGMTtoLocalTime($aTimeZoneOffset, $gmtDateTime);
getLocalTimeToGMT($aTimeZoneOffset, $currentDateTime);
For this example its required timezoneoffset, otherwise it won't work.
timezoneoffset will get on browser from JavaScript, its varies from country to country.
You must read these files to understand the code:
1. js/membership-script.js --- getting timezoneoffset
2. library/general-function.php ---- calculating timezoneoffset, getting local date time to GMT date Time, GMT to local date time, php date to MySQL date, MySQL to local date time
3. membership.php --- adding processing timezoneoffset, local date time to GMT date time
4. index.php --- showing added data processing timezoneoffset, GMT date time to local date time
5. add.php --- showing add form
My contact details are as follows:
Email: dhananjayksharma@gmail.com or infotechvedas.yahoo.co.in
Blog: http://readlamp.blogspot.com/
WebSite: www.infotechvedas.com -- coming soon
Skype id: dksitv
Monday, March 3, 2014
MySQL Remote Database server connecting from Client server
My web site : Info Tech Vedas
1. Remote database server
Example IP address:
Public : 190.60.200.50
Private : 10.100.79.5
Create user access for Client server ‘Private IP: 10.100.69.7’
create user root@'10.100.69.7' IDENTIFIED BY 'testpass';
GRANT ALL ON *.* to root@'10.100.69.7' IDENTIFIED BY 'testpass';
FLUSH PRIVILEGES;
Open mysql conf file and find out “bind-address” comment this line save and exit
vim /etc/mysql/my.cnf
# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1
Restart MySQL server using command:
sudo /etc/init.d/mysql restart
2. Client server
Example IP address:
Public : 160.70.100.61
Private : 10.100.69.7
Connecting MySQL Remote server using “Private IP 10.100.79.5”:
mysql -h 10.100.79.5 -u root -ptestpass
Note: Above command is tested on Ubuntu, Fedora and Debian linux.
1. Remote database server
Example IP address:
Public : 190.60.200.50
Private : 10.100.79.5
Create user access for Client server ‘Private IP: 10.100.69.7’
create user root@'10.100.69.7' IDENTIFIED BY 'testpass';
GRANT ALL ON *.* to root@'10.100.69.7' IDENTIFIED BY 'testpass';
FLUSH PRIVILEGES;
Open mysql conf file and find out “bind-address” comment this line save and exit
vim /etc/mysql/my.cnf
# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1
Restart MySQL server using command:
sudo /etc/init.d/mysql restart
2. Client server
Example IP address:
Public : 160.70.100.61
Private : 10.100.69.7
Connecting MySQL Remote server using “Private IP 10.100.79.5”:
mysql -h 10.100.79.5 -u root -ptestpass
Note: Above command is tested on Ubuntu, Fedora and Debian linux.
Wednesday, February 19, 2014
Calculating week of the year for given N week ago from Current week in PHP
My web site : Info Tech Vedas
/*
This is function has written to get (N) weeks ago start date of week and end date of the week
Note: Required PHP version 5.3 or greater
Current Date : 19-Feb-2014
Input : Start Date / End Date of Current week(201408), week with - (2014-08) current : 2014-02-16,2014-02-22
Expected Output : Start Date / End Date of week(201403), week with - (2014-03) 5 ago: 2014-01-12,2014-01-18
Result :
Array(
[currentweek] => 08
[currentdate] => 08, 2014-02-19, 3
[startdateofcurrentweek] => 2014-02-16
[enddateofcurrentweek] => 2014-02-22
[weekago] => 201403
[startdateofagoweek] => 2014-01-12
[enddateofagoweek] => 2014-01-18)
*/
$iWeeksAgo = 5;// need weeks ago
$sWeekDayStartOn = 0;// 0 - Sunday, 1 - Monday, 2 - Tuesday
$aWeeksDetails = getWeekDetails($iWeeksAgo, $sWeekDayStartOn);
print_r($aWeeksDetails);
die('end of line of getWeekDetails ');
function getWeekDetails($iWeeksAgo, $sWeekDayStartOn){
$date = new DateTime();
$sCurrentDate = $date->format('W, Y-m-d, w');
#echo 'Current Date (Week of the year, YYYY-MM-DD, day of week ): ' . $sCurrentDate . "\n";
$iWeekOfTheYear = $date->format('W');// Week of the Year i.e. 19-Feb-2014 = 08
$iDayOfWeek = $date->format('w');// day of week for the current month i.e. 19-Feb-2014 = 4
$iDayOfMonth = $date->format('d'); // date of the month i.e. 19-Feb-2014 = 19
$iNoDaysAdd = 6;// number of days adding to get last date of the week i.e. 19-Feb-2014 + 6 days = 25-Feb-2014
$date->sub(new DateInterval("P{$iDayOfWeek}D"));// getting start date of the week
$sStartDateOfWeek = $date->format('Y-m-d');// getting start date of the week
$date->add(new DateInterval("P{$iNoDaysAdd}D"));// getting end date of the week
$sEndDateOfWeek = $date->format('Y-m-d');// getting end date of the week
$iWeekOfTheYearWeek = (string) $date->format('YW');//week of the year
$iWeekOfTheYearWeekWithPeriod = (string) $date->format('Y-W');//week of the year with year
//To check uncomment
#echo "Start Date / End Date of Current week($iWeekOfTheYearWeek), week with - ($iWeekOfTheYearWeekWithPeriod) : " . $sStartDateOfWeek . ',' . $sEndDateOfWeek . "\n";
$iDaysAgo = ($iWeeksAgo*7) + $iNoDaysAdd + $sWeekDayStartOn;// getting 4 weeks ago i.e. no. of days to substract
$date->sub(new DateInterval("P{$iDaysAgo}D"));// getting 4 weeks ago i.e. no. of days to substract
$sStartDateOfWeekAgo = $date->format('Y-m-d');// getting 4 weeks ago start date i.e. 19-Jan-2014
$date->add(new DateInterval("P{$iNoDaysAdd}D")); // getting 4 weeks ago end date i.e. 25-Jan-2014
$sEndDateOfWeekAgo = $date->format('Y-m-d');// getting 4 weeks ago start date i.e. 25-Jan-2014
$iProccessedWeekAgoOfTheYear = (string) $date->format('YW');//ago week of the year
$iProccessedWeekOfTheYearWeekAgo = (string) $date->format('YW');//ago week of the year with year
$iProccessedWeekOfTheYearWeekWithPeriodAgo = (string) $date->format('Y-W');//ago week of the year with year
//To check uncomment
#echo "Start Date / End Date of week($iProccessedWeekOfTheYearWeekAgo), week with - ($iProccessedWeekOfTheYearWeekWithPeriodAgo) ago: " . $sStartDateOfWeekAgo . ',' . $sEndDateOfWeekAgo . "\n";
$aWeeksDetails = array ('weeksago' => $iWeeksAgo, 'currentweek' => $iWeekOfTheYear, 'currentdate' => $sCurrentDate, 'startdateofcurrentweek' => $sStartDateOfWeek, 'enddateofcurrentweek' => $sEndDateOfWeek,
'weekagoyearweek' => $iProccessedWeekAgoOfTheYear, 'startdateofagoweek' => $sStartDateOfWeekAgo, 'enddateofagoweek' => $sEndDateOfWeekAgo);
return $aWeeksDetails;
}
?>
/*
This is function has written to get (N) weeks ago start date of week and end date of the week
Note: Required PHP version 5.3 or greater
Current Date : 19-Feb-2014
Input : Start Date / End Date of Current week(201408), week with - (2014-08) current : 2014-02-16,2014-02-22
Expected Output : Start Date / End Date of week(201403), week with - (2014-03) 5 ago: 2014-01-12,2014-01-18
Result :
Array(
[currentweek] => 08
[currentdate] => 08, 2014-02-19, 3
[startdateofcurrentweek] => 2014-02-16
[enddateofcurrentweek] => 2014-02-22
[weekago] => 201403
[startdateofagoweek] => 2014-01-12
[enddateofagoweek] => 2014-01-18)
*/
$iWeeksAgo = 5;// need weeks ago
$sWeekDayStartOn = 0;// 0 - Sunday, 1 - Monday, 2 - Tuesday
$aWeeksDetails = getWeekDetails($iWeeksAgo, $sWeekDayStartOn);
print_r($aWeeksDetails);
die('end of line of getWeekDetails ');
function getWeekDetails($iWeeksAgo, $sWeekDayStartOn){
$date = new DateTime();
$sCurrentDate = $date->format('W, Y-m-d, w');
#echo 'Current Date (Week of the year, YYYY-MM-DD, day of week ): ' . $sCurrentDate . "\n";
$iWeekOfTheYear = $date->format('W');// Week of the Year i.e. 19-Feb-2014 = 08
$iDayOfWeek = $date->format('w');// day of week for the current month i.e. 19-Feb-2014 = 4
$iDayOfMonth = $date->format('d'); // date of the month i.e. 19-Feb-2014 = 19
$iNoDaysAdd = 6;// number of days adding to get last date of the week i.e. 19-Feb-2014 + 6 days = 25-Feb-2014
$date->sub(new DateInterval("P{$iDayOfWeek}D"));// getting start date of the week
$sStartDateOfWeek = $date->format('Y-m-d');// getting start date of the week
$date->add(new DateInterval("P{$iNoDaysAdd}D"));// getting end date of the week
$sEndDateOfWeek = $date->format('Y-m-d');// getting end date of the week
$iWeekOfTheYearWeek = (string) $date->format('YW');//week of the year
$iWeekOfTheYearWeekWithPeriod = (string) $date->format('Y-W');//week of the year with year
//To check uncomment
#echo "Start Date / End Date of Current week($iWeekOfTheYearWeek), week with - ($iWeekOfTheYearWeekWithPeriod) : " . $sStartDateOfWeek . ',' . $sEndDateOfWeek . "\n";
$iDaysAgo = ($iWeeksAgo*7) + $iNoDaysAdd + $sWeekDayStartOn;// getting 4 weeks ago i.e. no. of days to substract
$date->sub(new DateInterval("P{$iDaysAgo}D"));// getting 4 weeks ago i.e. no. of days to substract
$sStartDateOfWeekAgo = $date->format('Y-m-d');// getting 4 weeks ago start date i.e. 19-Jan-2014
$date->add(new DateInterval("P{$iNoDaysAdd}D")); // getting 4 weeks ago end date i.e. 25-Jan-2014
$sEndDateOfWeekAgo = $date->format('Y-m-d');// getting 4 weeks ago start date i.e. 25-Jan-2014
$iProccessedWeekAgoOfTheYear = (string) $date->format('YW');//ago week of the year
$iProccessedWeekOfTheYearWeekAgo = (string) $date->format('YW');//ago week of the year with year
$iProccessedWeekOfTheYearWeekWithPeriodAgo = (string) $date->format('Y-W');//ago week of the year with year
//To check uncomment
#echo "Start Date / End Date of week($iProccessedWeekOfTheYearWeekAgo), week with - ($iProccessedWeekOfTheYearWeekWithPeriodAgo) ago: " . $sStartDateOfWeekAgo . ',' . $sEndDateOfWeekAgo . "\n";
$aWeeksDetails = array ('weeksago' => $iWeeksAgo, 'currentweek' => $iWeekOfTheYear, 'currentdate' => $sCurrentDate, 'startdateofcurrentweek' => $sStartDateOfWeek, 'enddateofcurrentweek' => $sEndDateOfWeek,
'weekagoyearweek' => $iProccessedWeekAgoOfTheYear, 'startdateofagoweek' => $sStartDateOfWeekAgo, 'enddateofagoweek' => $sEndDateOfWeekAgo);
return $aWeeksDetails;
}
?>
Subscribe to:
Posts (Atom)