Wednesday, 2 December 2015
Change Page URL without Refreshing Page
Hello! I am Subbiah P and this is my web technologies blog. My specialities are PHP, Asp.net, jQuery, and CMS web application development. I do accept paid work. Write to me to start working on your dream project . I am Working as Web developer in Peace Soft Technologies
Monday, 30 November 2015
Add MyqlData Using Package Manager Console
1. Open Package Manager Console
View->Other Window-> Package Manager Console
Type :
PM> Install-Pacakge MySql.Data
PM> Install-Package EntityFramework
Then go to web.config add the following line after the tag
invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
the app.confing should be like this
name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
Hello! I am Subbiah P and this is my web technologies blog. My specialities are PHP, Asp.net, jQuery, and CMS web application development. I do accept paid work. Write to me to start working on your dream project . I am Working as Web developer in Peace Soft Technologies
Saturday, 21 November 2015
Social Share Button on Right Side
CSS
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.share-btn-wrp {
list-style: none;
display: block;
margin: 0px;
padding: 0px;
width: 32px;
left: 0px;
position: fixed;
}
.share-btn-wrp .button-wrap{
text-indent:-100000px;
width:32px;
height: 32px;
cursor:pointer;
transition: width 0.1s ease-in-out;
}
.share-btn-wrp > .facebook{
background: url(images/share-icons.png) no-repeat -42px 0px;
}
.share-btn-wrp > .facebook:hover{
background: url(images/share-icons.png) no-repeat -4px -0px;
width:38px;
}
.share-btn-wrp > .twitter{
background: url(images/share-icons.png) no-repeat -42px -34px;
}
.share-btn-wrp > .twitter:hover{
background: url(images/share-icons.png) no-repeat -4px -34px;
width:38px;
}
.share-btn-wrp > .digg{
background: url(images/share-icons.png) no-repeat -42px -68px;
}
.share-btn-wrp > .digg:hover{
background: url(images/share-icons.png) no-repeat -4px -68px;
width:38px;
}
.share-btn-wrp > .stumbleupon{
background: url(images/share-icons.png) no-repeat -42px -102px;
}
.share-btn-wrp > .stumbleupon:hover{
background: url(images/share-icons.png) no-repeat -4px -102px;
width:38px;
}
.share-btn-wrp > .delicious{
background: url(images/share-icons.png) no-repeat -42px -136px;
}
.share-btn-wrp > .delicious:hover{
background: url(images/share-icons.png) no-repeat -4px -136px;
width:38px;
}
.share-btn-wrp > .gplus{
background: url(images/share-icons.png) no-repeat -42px -170px;
}
.share-btn-wrp > .gplus:hover{
background: url(images/share-icons.png) no-repeat -4px -170px;
width:38px;
}
.share-btn-wrp > .email{
background: url(images/share-icons.png) no-repeat -42px -408px;
}
.share-btn-wrp > .email:hover{
background: url(images/share-icons.png) no-repeat -4px -408px;
width:38px;
}
@media all and (max-width: 699px) {
.share-btn-wrp{
width: 100%;
text-align: center;
position: fixed;
bottom: 1px;
}
.share-btn-wrp .button-wrap {
display: inline-block;
margin-left: -2px;
margin-right: -2px;
}
}
JavaScript
HTML
Hello! I am Subbiah P and this is my web technologies blog. My specialities are PHP, Asp.net, jQuery, and CMS web application development. I do accept paid work. Write to me to start working on your dream project . I am Working as Web developer in Peace Soft Technologies
Truncate All tables in mysql
Truncate all tables in mysql using one comment
SELECT CONCAT('truncate table ',table_name,';')
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'table_name'
AND TABLE_TYPE = 'BASE TABLE';
truncate table table2;
truncate table table3;
truncate table table4;
truncate table table5;
Copy the Comment & paste to the SQL editor and run the comment....
Hello! I am Subbiah P and this is my web technologies blog. My specialities are PHP, Asp.net, jQuery, and CMS web application development. I do accept paid work. Write to me to start working on your dream project . I am Working as Web developer in Peace Soft Technologies
Friday, 20 November 2015
Sublime Text 3 Activation Key
Go to Help ->Enter License->
Copy the below key with Begin License to End License and paste it to the area..
enjoy..!
KEY
===========================================================
—– BEGIN LICENSE —–
J2TeaM
2 User License
EA7E-940282
45CB0D8F 09100037 7D1056EB A1DDC1A2
39C102C5 DF8D0BF0 FC3B1A94 4F2892B4
0AEE61BA 65758D3B 2EED551F A3E3478C
C1C0E04E CA4E4541 1FC1A2C1 3F5FB6DB
CFDA1551 51B05B5D 2D3C8CFE FA8B4285
051750E3 22D1422A 7AE3A8A1 3B4188AC
346372DA 37AA8ABA 6EB30E41 781BC81F
B5CA66E3 A09DBD3A 3FE85BBD 69893DBD
—— END LICENSE ——
Hello! I am Subbiah P and this is my web technologies blog. My specialities are PHP, Asp.net, jQuery, and CMS web application development. I do accept paid work. Write to me to start working on your dream project . I am Working as Web developer in Peace Soft Technologies
Sublime Text 3 PHP Auto Completion Package
Key Bindings
| OS X | Windows | Linux | Description |
|---|---|---|---|
| Ctrl+Space | Ctrl+Space | Alt+/ | Activate completions |
Installation
Package Control installation
- Install Package Control.
- From inside Sublime Text, open Package Control's Command Pallet: Ctrl+Shift+P (Windows, Linux) or Cmd+Shift+P on Mac.
- Type
install packageand hit Return. A list of available packages will be displayed. - Type
PHP Completions Kitand hit Return. The package will be downloaded to the appropriate directory. - Restart Sublime Text to complete installation. The features listed above should now be available.
Hello! I am Subbiah P and this is my web technologies blog. My specialities are PHP, Asp.net, jQuery, and CMS web application development. I do accept paid work. Write to me to start working on your dream project . I am Working as Web developer in Peace Soft Technologies
Sublime Text Package Console Install
INSTALLATION
Simple
SUBLIM TEXT 3
Manual
- Click the Preferences > Browse Packages… menu
- Browse up a folder and then into the Installed Packages/ folder
- Download Package Control.sublime-package and copy it into theInstalled Packages/ directory
- Restart Sublime Text
Hello! I am Subbiah P and this is my web technologies blog. My specialities are PHP, Asp.net, jQuery, and CMS web application development. I do accept paid work. Write to me to start working on your dream project . I am Working as Web developer in Peace Soft Technologies
Wednesday, 18 November 2015
Load Month Name in PHP And Set default name in option list
<select name="month" id="month" class="form-control"">
<?php
for ($m=1; $m<=12; $m++) { $month = date('F', mktime(0,0,0,$m, 1, date('Y')));
if(date('m')==$m){
?>
<option value="<?php echo $month; ?>" selected="selected"><?php echo $month; ?></option>
<?php
}
else{
?>
<option value="<?php echo $month; ?>"><?php echo $month; ?></option>
<?php }
}?>
</select>
Hello! I am Subbiah P and this is my web technologies blog. My specialities are PHP, Asp.net, jQuery, and CMS web application development. I do accept paid work. Write to me to start working on your dream project . I am Working as Web developer in Peace Soft Technologies
HTML Sticky Header
HTML
===========================
<div class="container">
<div class="cover-photo-container">Please scroll</div>
<div class="small-box"></div>
<div class="small-box"></div>
<div class="small-box"></div>
<div class="small-box"></div>
<div class="clear">
<div>
<div class="sticky-header">This needs to be fixed when hits top of screen</div>
</div>
==================================
CSS
=====================================
body {
margin:0px;
padding:0px;
}
.clear {
clear:both;
}
.container {
height:2000px;
}
.cover-photo-container {
width:700px;
height: 100px;
margin-bottom: 20px;
background-color:red;
}
.small-box {
width:163px;
height:100px;
border:1px solid blue;
float:left;
}
.sticky-header {
width:700px;
height:50px;
background:orange;
}
.fixed{
position: fixed;
top: 0px;
}
}
================================================
SCRIPT
=============================================
var offset = $( ".sticky-header" ).offset();
var sticky = document.getElementById("sticky-header")
$(window).scroll(function() {
if ( $('body').scrollTop() > offset.top){
$('.sticky-header').addClass('fixed');
} else {
$('.sticky-header').removeClass('fixed');
}
});
Hello! I am Subbiah P and this is my web technologies blog. My specialities are PHP, Asp.net, jQuery, and CMS web application development. I do accept paid work. Write to me to start working on your dream project . I am Working as Web developer in Peace Soft Technologies
ORDER BY MONTH (string) FIELD IN MYSQL
//======================ORDER BY MONTH (string) FIELD IN DB ==============================//
Solution :1
===================================
SELECT * FROM `articles` where journal_id='1' ORDER BY
CASE `month`
WHEN 'January' THEN 1
WHEN 'February' THEN 2
WHEN 'March' THEN 3
WHEN 'April' THEN 4
WHEN 'May' THEN 5
WHEN 'June' THEN 6
WHEN 'July' THEN 7
WHEN 'August' THEN 8
WHEN 'September' THEN 9
WHEN 'October' THEN 10
WHEN 'November' THEN 11
WHEN 'December' THEN 12
ELSE 0 END;
=======================================
Solution : 2
============================================
SELECT * FROM `articles` where journal_id='1' ORDER BY FIELD(month,'January','Feburary','March','May','June','July','August','September','October','November','December') DESC,year DESC,volume DESC,issue DESC;
=====================================
Hello! I am Subbiah P and this is my web technologies blog. My specialities are PHP, Asp.net, jQuery, and CMS web application development. I do accept paid work. Write to me to start working on your dream project . I am Working as Web developer in Peace Soft Technologies
PHP Simple Email Content
$to = 'tofriend@mail.com';
$from = 'aneh@trinityblog.in';
$subject = 'Hi this is formatted email';
//create main body of mail
$body = '<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body style="margin:0px; padding:0px; background:#f7f7f7;">
<div style="display:block; margin:auto; width:750px;background:#373737;">
<div style="display:block; width:750px; margin:auto;">
<span style="color:#fff;padding:5px 10px;display:block;font-size:22px;">trinityblog</span>
</div>
</div>
<div style="width:750px; margin: auto; background:#fff; min-height: 100px;">
<div style="text-align: left;display: block;width: 500px;padding: 50px; padding-bottom:30px;font-size: 14px;color: #666; margin:auto;">
<div style="color:inherit;display:block;width:100%;margin:10px 0;line-height:24px;font-size:18px;color:#333">Hi,</div>
<div style="color:inherit;display:block;width:100%;margin:10px 0;line-height:24px">Thank you for visiting us..<span style="color:#111;font-weight:600;display:block;">This is an example that how we formatted our email in php.</span>
</div>
</div>
<div style="border-top:solid 1px #ddd; text-align:left;font-size:14px;color:#888;padding-top:5px;padding-bottom:2px;padding-left:10px;">© TrinityBlog.in</div>
</div>
</body>
</html>';
/* Main code here */
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: Welcome to TrinityBlog.in <$from>\r\n";
$sendmail = mail($to, $subject, $body, $headers);
?>
Hello! I am Subbiah P and this is my web technologies blog. My specialities are PHP, Asp.net, jQuery, and CMS web application development. I do accept paid work. Write to me to start working on your dream project . I am Working as Web developer in Peace Soft Technologies
Display Comments in Hierarchy using PHP
require 'config/connect.php';
$result="";
$aut_qry=mysqli_query($con,"select * from tblcomments where status=1 and parent='$pid'");
//$result = '';
while($aut_row=mysqli_fetch_array($aut_qry,MYSQL_ASSOC)){
$result=$result.$aut_row['comment'].'<br>';
}
//$result=$result.'</select>';
return $result;
}
function get_comment(){
require 'config/connect.php';
$result="";
$aut_qry=mysqli_query($con,"select * from tblcomments where status=1 and parent=''");
//$result = '';
while($aut_row=mysqli_fetch_array($aut_qry,MYSQL_ASSOC)){
$result=$result.$aut_row['comment'].'<br>';
$result=$result.'  '.get_child($aut_row['id']);
}
//$result=$result.'</select>';
return $result;
}
Hello! I am Subbiah P and this is my web technologies blog. My specialities are PHP, Asp.net, jQuery, and CMS web application development. I do accept paid work. Write to me to start working on your dream project . I am Working as Web developer in Peace Soft Technologies
PHP CSV File Export
<?php $conn = mysql_connect("localhost","root",""); mysql_select_db("phppot_examples",$conn); $query = "SELECT * FROM toy"; $result = mysql_query($query); $num_column = mysql_num_fields($result); $csv_header = ''; for($i=0;$i<$num_column;$i++) { $csv_header .= '"' . mysql_field_name($result,$i) . '",'; } $csv_header .= "\n"; $csv_row =''; while($row = mysql_fetch_row($result)) { for($i=0;$i<$num_column;$i++) { $csv_row .= '"' . $row[$i] . '",'; } $csv_row .= "\n"; } /* Download as CSV File */ header('Content-type: application/csv'); header('Content-Disposition: attachment; filename=toy_csv.csv'); echo $csv_header . $csv_row; exit; ?>
Hello! I am Subbiah P and this is my web technologies blog. My specialities are PHP, Asp.net, jQuery, and CMS web application development. I do accept paid work. Write to me to start working on your dream project . I am Working as Web developer in Peace Soft Technologies
Responsive Social Share Button
<html> <head> <TITLE>Responsive Social Share Buttons</TITLE> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <h1>Responsive Social Share Buttons</h1> <div id="share-box"> <div class="btnShare btnFacebook"><img src="facebook.png" class="icon-share"><span class="txt-share">Facebook</span></div> <div class="btnShare btnTwitter"><img src="twitter.png" class="icon-share"><span class="txt-share">Twitter</span></div> <div class="btnShare btnGoogle"><img src="google-plus.png" class="icon-share"><span class="txt-share">Google</span></div> </div> <div class="txt-content"> <p>Few days before we have seen about responsive web design for designing a login form that adapts various screen sizes. In this tutorial, we are going to adapt responsive social share buttons for various device view port.</p> <p>In this example we are showing either social share icons or text based on the media screen width. We are also managing position of the buttons to be adapted within the device screen.</p> <p>The HTML code will contain group of social share icons in a DIV container. This container's position is controlled by the style sheet with various device screen by using medial queries.</p> </div> </body> </html>
Hello! I am Subbiah P and this is my web technologies blog. My specialities are PHP, Asp.net, jQuery, and CMS web application development. I do accept paid work. Write to me to start working on your dream project . I am Working as Web developer in Peace Soft Technologies
Calculating Hours Difference in PHP
HTML Datetime Input
<form id="frmDate" action="" method="post"> <div> <label style="padding-top:20px;">Start Date</label><br/> <input type="text" name="startdate" value="<?php if(!empty($_POST["startdate"])) { echo $_POST["startdate"]; } ?>" class="demoInputBox"> </div> <div> <label>End Date</label> <span id="userEmail-info" class="info"></span><br> <input type="text" name="enddate" value="<?php if(!empty($_POST["startdate"])) { echo $_POST["enddate"]; } ?>" class="demoInputBox"> </div> <div> <input type="submit" name="submit" value="Find Difference" class="btnAction"> </div> </form>
PHP Function to Calculate Hours Difference
<?php
function differenceInHours($startdate,$enddate){
$starttimestamp = strtotime($startdate);
$endtimestamp = strtotime($enddate);
$difference = abs($endtimestamp - $starttimestamp)/3600;
return $difference;
}
if(!empty($_POST["submit"])) {
$hours_difference = differenceInHours($_POST["startdate"],$_POST["enddate"]);
$message = "The Difference is " . $hours_difference . " hours";
}
?>
Hello! I am Subbiah P and this is my web technologies blog. My specialities are PHP, Asp.net, jQuery, and CMS web application development. I do accept paid work. Write to me to start working on your dream project . I am Working as Web developer in Peace Soft Technologies
FPDF PDF Generation from MySQL using PHP
<?php require_once("dbcontroller.php"); $db_handle = new DBController(); $result = $db_handle->runQuery("SELECT * FROM toy"); $header = $db_handle->runQuery("SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA`='blog_samples' AND `TABLE_NAME`='toy'"); require('fpdf/fpdf.php'); $pdf = new FPDF(); $pdf->AddPage(); $pdf->SetFont('Arial','B',12); foreach($header as $heading) { foreach($heading as $column_heading) $pdf->Cell(90,12,$column_heading,1); } foreach($result as $row) { $pdf->SetFont('Arial','',12); $pdf->Ln(); foreach($row as $column) $pdf->Cell(90,12,$column,1); } $pdf->Output(); ?>
Hello! I am Subbiah P and this is my web technologies blog. My specialities are PHP, Asp.net, jQuery, and CMS web application development. I do accept paid work. Write to me to start working on your dream project . I am Working as Web developer in Peace Soft Technologies