This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//For connecting the database | |
$link = mysqli_connect("localhost","root","", "practise"); | |
if (!$link) { | |
echo "Error: Unable to connect to MySQL." . PHP_EOL; | |
echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL; | |
echo "Debugging error: " . mysqli_connect_error() . PHP_EOL; | |
exit; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<link rel="stylesheet" type="text/css" href="css/bootstrap.css"> | |
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"> | |
<link rel="stylesheet" type="text/css" href="css/bootstap-theme.css"> | |
<link rel="stylesheet" type="text/css" href="css/bootstrap-theme.min.css"> | |
</head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//For connecting the database--> | |
$link = mysqli_connect("localhost","root","", "practise"); | |
if (!$link) { | |
die("Connection failed: " . mysql_error()); | |
}else{ | |
mysqli_select_db ($link, 'practise') or die ("Could not select database."); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A utility class to convert date type from java.util.Date to Long and vice versa. This needs to be | |
* done to store/read the date into/from SQLite database. | |
*/ | |
public class DateTypeConverter { | |
public static Date toDate(Long timestamp) { | |
return timestamp == null ? null : new Date(timestamp); | |
} | |
public static Long toTimestamp(Date date) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//For connecting the database--> | |
$link = mysqli_connect("localhost","root","", "practise"); | |
if (!$link) { | |
die("Connection failed: " . mysql_error()); | |
}else{ | |
mysqli_select_db ($link, 'practise') or die ("Could not select database."); | |
} | |
//Start session |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
E.g. for 50% white you'd use #80FFFFFF | |
100% — FF | |
95% — F2 | |
90% — E6 | |
85% — D9 | |
80% — CC | |
75% — BF | |
70% — B3 | |
65% — A6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context; | |
import android.net.ConnectivityManager; | |
import android.net.NetworkInfo; | |
public class NetworkHelper { | |
public static final boolean hasNetworkAccess(Context context){ | |
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); | |
try { | |
NetworkInfo networkInfo = cm.getActiveNetworkInfo(); | |
return networkInfo != null && networkInfo.isConnectedOrConnecting(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun Long.getFriendlyTime(): String { | |
val dateTime = Date(this * 1000) | |
val sb = StringBuffer() | |
val current = Calendar.getInstance().time | |
var diffInSeconds = ((current.time - dateTime.time) / 1000).toInt() | |
val sec = if (diffInSeconds >= 60) (diffInSeconds % 60) else diffInSeconds | |
diffInSeconds /= 60 | |
val min = if (diffInSeconds >= 60) (diffInSeconds % 60) else diffInSeconds | |
diffInSeconds /= 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ls -dl ~/files | |
drwx------ 9 root root 4096 2009-04-06 15:56 files | |
$ sudo chown grunt547:grunt547 ~/files | |
[sudo] password for grunt547: | |
$ chmod 755 ~/files | |
$ ls -dl ~/files | |
drwxr-xr-x 9 grunt547 grunt547 4096 2009-04-06 15:56 files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Java code to demonstrate Builder Pattern | |
// Server Side Code | |
final class Student { | |
// final instance fields | |
private final int id; | |
private final String name; | |
private final String address; |