Category: Programming

Python3 with MySQL database

If you don’t already have MySQL installed, install it with the following commands (mac only): Run the following commands to start or stop mysql. Start MySQL before proceeding: To see…

Java file I/O

Java provides a number of classes and methods that allow to read and write files. In Java all files are byte-oriented. Two of the most often-used stream classes are FileInputStream…

Setting up src dynamically

Suppose you need to call some JavaScript code on your page such as: However, the somecode.js is different based on other parameters on your page. So you would need to…

What is JavaScript Full Stack

Full-stack is a complete JavaScript solution which involves JavaScript on both client-side and server-side. There are many full-stack solutions but MEAN stack is the most widely used solution. There are…

Splitting strings in Java

Java’s split function packs a powerful punch. You can use it to split string on characters, symbols, substrings, a collection of symbols, or even regular expressions. public class SplitString {…

PHP require() vs include()

PHP provides four functions which enable you to insert code from other files. include() require() include_once() require_once() All four can take a local file or URL as input. None of…

PHP date arithmetic

strtotime() function can be used for date arithmetic. Following are some examples: Get next date Prints Get previous month Prints Go back 5 years Prints

Converting string to date in PHP

Converting strings to dates in PHP requires the use of two functions. strtotime function converts the string to an epoch timestamp. date function converts the timestamp to the desirable date…