Status:

@Bittle
...

Bio

Creator of this site, PHP developer, Aszend Digital LLC Developer, and open source enthusiast. Happy to have you here.

Recent Comments

83

Posts

1

times favorited

0

comments

General Information

User Name Bittle
Email bittlemau5@gmail.com
Member Since 07/22/2018

Activity

  • MySQL Docker Container

    Create Docker Container docker run -p 13306:3306 --name mysql-docker-local-kodeCentral -eMYSQL_ROOT_PASSWORD=password -d mysql:latest name = mysql-docker-local-kodeCentral host = 127.0.0.1 port = 13306 on local machine links to port 3306 in docker container password = password Connect t...

  • Pattern Sequence

    Problem: Devise an algorithm to draw the following squares when N = 0, 1, 2, 3, 4, 5. Then generate your algorithm by observing the pattern: Sample output: n = 5: rbrrbr rrbrr brrb rbr rr b n = 4: rrbrr brrb rbr rr b n = 0: b Solution: We notice that the pattern follows a d...

  • Installing PHPMyAdmin in DigitalOcean

    Getting Started: Install packages sudo apt update sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl When prompted "Configuring phpmyadmin" Press SPACEBAR , then TAB , then ENTER . When prompted "Configuring phpmyadmin" again Press TAB , then ENTER Enab...

  • Connecting URL with droplet

    Make sure that you went over the previous posts that explain how to buy a URL from namecheap , and how to create a droplet from DigitalOcean before continuing. To link your namecheap URL you must add the Digital Ocean nameservers to namecheap. Log into your namecheap account and go to your p...

  • Installing Composer in Digital Ocean droplet

    Install the common PHP extensions: sudo apt update sudo apt install openssl php-common php-curl php-json php-mbstring php-mysql php-xml php-zip Installing Composer manually with APT: sudo apt install composer

  • PHPMyAdmin with Homestead

    SSH into the Homestead vagrant box vagrant ssh Then cd into /home/vagrant/ cd /home/vagrant/ Get the .zip file from phpmyadmin.net/downloads by right clicking on the green "download v.v.v" (top right) button and copying the link. I have the 5.0.4 version. Use wget to download the zip in...

  • Common Errors in Laravel Development

    Error: "Route [ school_information-inline-create-save ] not defined.'... WHEN CREATING A inline-create ROUTE Solution: Make sure your code is correct. Example code: CRUD::field('school_information_id')->type('relationship') ->model('App\Models\SchoolInformation') ->ajax(false)-&g...

  • Backpack for Laravel

    > composer update > composer require backpack/crud:"4.1.*" > composer require backpack/generators --dev > composer require laracasts/generators --dev > sudo bash update.sh > php artisan backpack:install > php artisan backpack:crud OBJECT      OBJ...

  • Environment Setup

    PHP Windows: Download the ZIP file for PHP7.3 Extract to a folder called "PHP7" in your C: drive Go to Control panel -> System variables Add a System path variable called "PHP7" with the path "C:\PHP7" If you see an application error, download the VC++ 2015 update If you are...

  • Convert DOCX in Laravel using LibreOffice

    Supported conversion formats include: pptx => pdf ppt => pdf pdf => pdf docx => pdf, odt, html doc => pdf, odt, html xlsx => pdf xls => pdf png => pdf jpg => pdf jpeg => pdf Dependencies First install LibreOffice in your Linux server: sudo apt-get insta...

  • SSL Certificate

    We will use lets-encrypt for a free SSL Certificate. If you've been following along with these posts then just run sudo apt-get update sudo snap install core; sudo snap refresh core sudo snap install --classic certbot sudo certbot --apache but if you have done something different then go to l...

  • Accessing your Digital Ocean droplet via SSH

    To access the server via SSH you need the droplet's ip address Open your terminal and cd into the directory where your private and public SSH keys are located. Once you're there run ssh -i key_name root@ip_address keyname = your private key name (key without .pub extension) ip_addres...

  • Common Errors in Website Hosting

    SSH Errors Error: Permissions 0644 for 'key' are too open. It is required that your private key files are NOT accessible by others. This private key will be ignored. Load key "key": bad permissions Permission denied (publickey). Solution: Change permissions of your key: chmod 400 keyna...

  • Routing and rewriting

    Change the web root from /html/ to /public/ (for laravel): edit 000-default.config: sudo nano /etc/apache2/sites-enabled/000-default.conf change all /html/ to /public/ If the app only works through url.com/index.php/route (with index.php) make sure to allow override: sudo nano /etc/a...

  • Important DBeaver Features

    The three DBeaver features I use most are: importing databases, exporting databases, and using ER-Diagrams. Importing Database If this is a new database make sure to create it. Once created you should see something like this (the tables section is empty): Once you create the d...

  • Minimum Steps for Boundary (Tiles)

    Problem: Suppose there is a colored marble floor in block format which has 2 colors: White Orange You have been asked to stand on any specific block, and you can travel through adjacent (left, right, up & down) white blocks only. Write a program to find the length of the minimum steps ...

  • String mirror equality

    Question: Write a boolean recursive function receive two strings and checks if one is reflection of the other Examples: Strings are one mirror of the other: "abcd" "dcba" "$" "$" "" "" (empty string) Strings are not mirror one to the other: "axcd" "dcba" Write ma...

  • All elements greater than its neighbors

    Question: Write function receive a matrix  Checks for each number in the matrix whether its value is larger than all its neighbors (Neighbors of an number are the numbers adjacent to it, Up, down right, left, diagonals) The function will print the numbers in the matrix that large...

  • Alternately Sorted

    Question: A logical recursive function should be written that gets a list of integers and checks whether the members with equal indicators are arranged in descending order, and the members with odd indexes are sorted in ascending order. To test the functionality, write an initial function that ...

  • Section Text Chain Compression

    Part 1: Enter a section chain to compress: kkkpppppaaaaaaabttttttttttt The compressed string is: k3p5a7b1t11 Part 2: Enter a compressed string: b1k2g14 The restored string is: bkkgggggggggggggg if __name__ == '__main__': ''' PART 1 A chain of letters: aabccc ->...

  • Creating a project

    Time to create a Laravel project! First cd into your projects folder (the folder where your Laravel projects will live). Open your terminal and run the following command: composer create-project --prefer-dist laravel/laravel project-name cd into created project folder cd project-name Do...

  • Creating LAMP WebSocket server with Rachet

    We will be working in a LAMP server in DigitalOcean with a URL. Proceed only if you know how to access your files via ssh and sftp. First, get SSL in your server . SSH into your droplet/server and run the following command: sudo a2enmod proxy_http Download https://github.com/gabri...

  • Simple Echo Bot

    Before starting we need to contact @BotFather to receive a bot token. Library We have to install Ruben's library in able to communicate with Telegram servers easily. You can install TelegramBots library with different methods: Using Maven: <dependency>  <groupId>org...

  • Saving Game Data

    We are going to use SQLite JDBC because it's simple to set up. Download the latest .jar file and import it. We have one game so far, so we need to create a game table that holds usernames and scores. SQL Create game table: String sql = "CREATE TABLE IF NOT EXISTS games (" + " usern...

  • Image Guess Game

    Let's create our first game already! First of all, we need to respect Telegram's servers, so we will not send files. We will tell Telegram where the pictures are located (url) and the API will take care of sending them. This is lightweight on both the server and our storage. To send photos we creat...

  • Chat Games Setup

    Let's make group chat games! To distinguish each group we use the update.getMessage().getChatId() function since each chat has a unique id. So let's start off with the basics: We need an object to hold data about the progress of the current game, and each chat must have its own object. We will ac...

  • Logging

    How about printing something instead of seeing an empty console? I got you! We need the code from the previous example to start off: KodeCentralBot.java import org.telegram.telegrambots.bots.TelegramLongPollingBot; import org.telegram.telegrambots.meta.api.methods.send.SendMessage; import org...

  • Find Number of Triangles With The Same Perimeter

    Problem Given a perimeter p, find the number of triangles that have sides a, b, and c that add up to p. Make sure to not repeat triangles, e.g 0, 0, 9 = 9, 0, 0 (same triangle but flipped). Solution For a faster run time, and to avoid duplicates, sort the sides from smallest to greatest (9, 5...

  • Honest goblins are easy to find

    Problem At Hogwarts a new shipment of n goblins has arrived, To be of any use, a goblin must be completely truthful (never lies). Unfortunately, not all of the n goblins in the shipment are truth tellers. Only some are truth-tellers, and some are deceivers. It is your task to design an algorithm t...

  • Creating a droplet in Digital Ocean

    Now that you have bought a url from namecheap.com we need to create a server to host our files. First go to DigitalOcean.com and create an account if you don't already have one. Then create a new droplet (top right corner) Click "Marketplace" and LAMP on VV.VV Choose a plan ...

  • Make a Java Program to Differentiate Simple Equations

    Problem Make a java program to differentiate simple equations such as -5x^3+3x^2+5x-7.5x = -5x^3+3x^2-2.5x^1 => -15x^2+6x^12-2.5x^0 Solution First format the string to make it workable (e.g., make -x into -1x and +x into +1x). Then split the input into tokens such as -5x^3, -3x^2, etc. After ...

  • School Marks

    Problem Write a java method based program that uses and 2×2 array marks to store CAT 1 out of 10 CAT 2 out of 20 end main exam out of 70 marks for 8 course units of a student at the university Array subject to store unit name and units code the marks are randomly generated The unit name and c...

  • Phase 2

    Problem Pass one will read each line of the source file, and begin the process of translating it to object code. (Note: it will be to your advantage to have a separate procedure handle reading, and perhaps tokenizing, the source file.) Among other things, this pass will create the symbol table. At...

  • Field Trip Room Capacity Problem!

    Problem A high school decided to go on a field trip for two nights and three days. There are three types of rooms in the hotel where students can stay. The capacity of the room (the number of beds in the room) are given, and it is assumed that the number of rooms are unlimited. The students are as...

  • Ant Maze

    Problem There is a two-dimensional n by m grid space. This grid is (0,0) lower left and (n, m) upper right as shown below: There is an ant on the coordinates (i, j) in this space. (i=1 and j=4 in the example). The ant begins to move at a constant speed in the right upper 45 ° direction. The...

  • Phase 1

    Problem Make a computer simulator written in C. Recognize the commands from a few characters ("dir" = "directory") and alert the user when the program requires parameters, or doesn't require parameters and some were given. The program should use outside libraries, and commands, such as strtok are ...

  • Setting up Google reCAPTCHA with the Slim 3 Framework and Ajax

    Purpose Hate getting spam to your email from your contact form? Yeah, me too. Let's stop these bots with some good Google CAPTCHA! An example of this can be found in the contact form of this website . Getting keys Go to https://www.google.com/recaptcha/admin to get version 2 of reCAPTCHA o...

  • Theater Sitting in Spiral

    Problem In a theater, Seats are arranged in the N by M grid. The number of each seat is indicated by the coordinates of the corresponding grid. For example, when N = 3 and M = 5, the seats are like below. Many people stand in waiting lines to enter this venue. The waiting people receive the ...

  • Draggable list with propel, slim, and ajax

    Problem : Make a program that has draggable <li> objects, that when dragged changes its state in the database. Solution : Your database needs an attribute to sort by, I will do this with placement_index Make sure you include draggable.js, and jquery (ajax comes with the...

  • Dynamic Sitemap with Slim 3 Framework

    What is a Sitemap? Think about your website as a house, and each link inside your website as a room. The Sitemap is a blueprint of your website and Google is the inspector. We need to let Google know what links are important inside the website since pages are also ranked (not just websites)....

  • Gloves in the dark!

    Problem There are 20 gloves in a drawer: 5 pairs of black gloves, 3 pairs of white, and 2 pairs of red. You select the gloves in the dark and can only check them after a selection has been made. What is the smallest number of gloves you need to select to guarantee getting the following? At ...

  • Java Variables

    What are Variables? Variables can be either primitive or reference. We can use variables as instance variables (object state), local variables (variables declared in methods), arguments (values sent to a method when calling it), and as return types (values sent back to the caller of the method). ...

  • Composer

    Overview Composer is an application-level package manager for the PHP programming language that provides a standard format for managing dependencies of PHP software and required libraries. Installation Download the latest composer.phar file from the download page (scroll to the bott...

  • Introduction to Java Objects

    What is an Object? Java objects are representations of real world objects. When thinking about objects note states and behaviors. For example, a Cat has different states and behaviors. Cat states: Color Weight Breed Cat behaviors: Eat Meow Nag What an object can do we call methods, wh...

  • Java Basics

    Comparison operators The main comparison operators include < (less than) > (Greater than) == (equal to) Pre and Post Increment/Decrement Operator the shortcut for adding or subtracting 1 from a variable: x ++ ; // same as x = x + 1; x -- ; // same as x = x - 1; The place of t...

  • Code Structure

    The main components Java has 3 main components: source files, components, and methods! What goes in a Source File? A source code file has the .java extension and holds one class definition. What Goes in a Class? A class can have one or several methods. What Goes in a Me...

  • HashMap vs HashSet vs HashTable in java

    HashMap Implements Map interface uses put method to store key-value pairs Doesn't allow duplicate keys but values can be duplicated Maximum of one NULL key but any number of NULL values Internally uses an array HashSet Implements Set interface uses add method to store only unique obj...

  • Setting up your Java Development Environment

    The JDK includes tools for compiling and running java code. An IDE contains useful features, such as code compilation and debugging, organization of project files, and nice visual interfaces. Install the JDK Follow these steps to download and install the JDK: Go to Java SE Downloads and cl...

  • Introduction to java

    About this tutorial This java tutorial is meant for Software Developers new to Java. This tutorial will guide you through all the java fundamentals and quiz you on your progress throughout your readings. This tutorial begins by showing instructions for setting up a development environment ...

  • Introduction to Java Telegram Bot Tutorial

    Hello everyone! Welcome to this Java Telegram Bot Tutorial. While going through this tutorial you will learn how to Initialize your first project Respond to messages Code text based games Fetch data from online API's Use a local SQL db to store game information And much more! I assume y...

  • Binary Search

    Binary Search is used to search through sorted lists very rapidly. Algorithm: Grab the middle element (let it be mid) if mid = element you are looking for -> done if mid < key -> check the right side if mid > key -> check the left side repeat steps 2 to 4 until start and end...

  • Most Recurrent Number in List using HashMap

    Problem: Find the most recurrent number in the list, then print the value and times it was repeated. Examples: input: {1, 3, 3} output: KEY = 3, REPEATED = 2 input: {1, 2, 3, 1, 4, 5, 6, 4, 3, 4, 4, 4, 4, 9, 8, 6, 8, 7} output: KEY = 4, REPEATED = 6 Solution (in java): ...

  • Quick Sort

    Quicksort is a divide and conquer algorithm. Quicksort first divides a large array into two smaller sub-arrays: the low elements and the high elements. Quicksort can then recursively sort the sub-arrays. Quicksort is an O(nlogn) runtime sorting algorithm, and can be faster than Mergesort and Hea...

  • Heap Sort

    Heapsort can be thought of as an improved Selectionsort : it divides the input into a sorted and an unsorted region, and it iteratively shrinks the unsorted region by extracting the largest element and moving that to the sorted region. The improvement consists of the use of a heap data structure r...

  • Bubble Sort

    Bubble Sort is one of the easiest sorts to implement, but is too slow for real world use. Bubble Sort is a simple sorting algorithm that repeatedly steps through the list, compares adjacent pairs and swaps them if they are in the wrong order. This algorithm is named for the way smaller (or larger) ...

  • Merge Sort

    Merge sort is an O(nlogn) runtime sorting algorithm. O(nlogn) is the fastest sorting time when sorting comparable objects. Merge sort is a divide and conquer algorithm since it breaks down the problem into smaller subproblems and solves the larger problem that way. Algorithm: Divide the...

  • Selection Sort

    Selection sort is an intuitive sort that most of us use day to day. For example, want to sort a stack of papers? You find the paper that has a last name that starts with an A, and keep incrementing until it's sorted. In this case we're going to use java to sort an array of integers.The algorithm ru...

  • Transferring files with FileZilla

    FTP into droplet with FileZilla before proceeding. Make sure to never transfer the vendor folder as it can be extremely large. Drag and drop folder items into /var/www (html folder should be part of items you drop in) and then SSH into server if you haven't done so already. Chan...

  • Connecting FileZilla to Digital Ocean droplet

    First we need to install filezilla . Once installed we need to import the private SSH key to connect with the droplet. Open settings and find SFTP. Click "Add key file..." Select your private key file (without .pub extension) Click "OK" Once your private key is imported conne...

  • Buying URL at Namecheap

    Go to namecheap.com and search desired URL, I will buy petandfeed.com Press the "add to cart" button and then view cart If it asks you to create an account or log in do so. Now confirm your order Enter your payment information, and press continue Review your ...

  • Website Hosting Introduction

    If you're here you've already created a beautiful website and want to show the world. Keep reading to find out how to Buy a URL Link URL to Digital Ocean servers Use software (such as composer) in the server Import and export databases SSH into server Transfer files in and out of the server...

  • Directories

    Overview The directory structure that all projects must follow for readability and consistency. Structure explanation app directory: contains the slim controllers and the views controllers directory: Slim route organization (not necessary for small projects) views directory: all ...

  • Alphanumeric input of 25 length

    Problem Write a program that will accept 25 alphanumeric characters. Accept the input 5 characters at a time and output them in all uppercase separated by a hyphen. Example output: ASDFA-ASDFW-234AS-ALSDF-ASDFQ Solution Check that the input is alphanumeric and of length 5 using th...

  • XAMPP

    Overview XAMPP is a completely free, easy to install Apache distribution containing MariaDB, PHP, and Perl. The XAMPP open source package has been set up to be incredibly easy to install and to use. Installation Download and install XAMPP . Once XAMPP installs open manager.app, which...

  • Maximum number

    Problem: Given an array of numbers, arrange them in a way that yields the largest value. For example, if the given numbers are {154, 546, 548, 60}, the arrangement 6054854654 gives the largest value. Input: First line contains an integer N , Next line contains N integers separated by space. ...

  • Adding a submenu in swing

    Problem: Create a submenu for a menu bar like shown below Solution: Adding a submenu to a menu bar can be achieved by first creating another JMenu, adding MenuItems to it, and then adding that JMenu to the main JMenu. In this case, We are going to create a JMenu for Find, and add "F...

  • Wall tiles without division or multiplication

    Problem: We must calculate how many tiles we need to cover a wall without using multiplication or division. For example: WallLength: 540 (user input) WallHeight:240 (user input) TileLength: 60 (user input) TileHeight:40 (user input) Row: 9 (prog - output) Column: 6 (prog Output) ...

  • Accumulated sum using swing

    Problem: Calculate the sum of the current input with the sum of past inputs. You may have: JLabel: "Enter an integer" JTextField: for accepting user input JLabel: "Accumulated sum is" JTextField (non-editable): for displaying the accumulated sum The program shall accumulate the number...

  • Create a 16 digit random number generator in Java

    Problem: Create a 16 digit random number generator in Java Solution: This can be easily achieved by using ThreadLocalRandom by declaring the bounds equal to the smallest and largest 16 digit numbers. private static void random() { /* return a random long of 16 length */ ...

  • Website Development Introduction

    This "cookbook" is a roadmap which helps Aszend programmers create nice web applications. It's called a cookbook since it has all the ingredients to create software from the ground up, like cooking a cake from scratch. You will learn how to set up XAMPP, which installs MySQL, MariaDB, and comes wit...

  • Split date string into separate variables c++

    Problem We have the following string input "mm/dd/yyyy" (a date) and we want to split it into its own variables for month, date and year. Solution One way to do this is to split at every / and keep splitting until the end, and then parse the current split with atoi (string to int conv...

  • Propel

    Overview Propel is a free, open-source object-relational mapping toolkit written in PHP. It is also an integral part of the PHP framework Symfony and was the default ORM up to, and including version 1.2. Important Propel commands vendor/bin/propel init Initialize propel installation...

  • Slim

    Overview Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs. At its core, Slim is a dispatcher that receives an HTTP request, invokes an appropriate callback routine, and returns an HTTP response. That's it. Getting started Create ...

  • phpMyAdmin

    Overview phpMyAdmin is a free and open source administration tool for MySQL and MariaDB Creating a database using phpMyAdmin Turn on your server and open http://localhost (select your project folder) and http://localhost/phpmyadmin . Create your new database and populate with the d...

  • Github

    Overview GitHub is a web-based hosting service for version control using git. It is mostly used for computer code. It offers all of the distributed version control and source code management functionality of Git as well as adding its own features. Installation To install git on your m...

  • Set up Atom

    Overview Atom is a rich open-source text editor which is developer friendly and customizable. Download and plugins Atom can be downloaded from the official website . Once you download atom open your atom preferences and choose install to install packages. The basic packages are...

  • Summing the sum

    Problem Ishaan was playing with numbers. He knew how to calculate the sum of numbers. He defined a function for his use which calculates the twice sum of first N natural numbers as sum(N). But being curious, he modified his function to calculate something more complex. He defined his functi...

  • Partitioning into two contiguous element subarrays with equal sums

    Problem Given an array of n positive integers. Find a minimum positive element to be added to one of the indexes in the array such that it can be partitioned into two contiguous sub arrays of equal sums. Output the minimum element to be added and the position where it is to be added. If multip...

  • Dependencies

    Overview All dependencies will be downloaded with composer, since its easy, fast, and clean. Getting started To download the dependencies make sure you have your directory structure setup already, as shown here . Go inside your composer.json file and modify it to download all depende...

  • Dynamic Programming Algorithm for the Traveling Salesperson

    Problem Using the java programming language, write a program to implement the Dynamic Programming Algorithm for the Traveling Salesperson. Solution import java.util.InputMismatchException; import java.util.Scanner; import java.util.Stack; public class TravelingSalesmanNearestNeighbo...

  • Simple Android Web View

    Question asked through contact form: I want to develop a WebView android app with android studio but facing problems. The question isn't very specific, so I will just make a simple WebView that starts up here (kodecentral.com). First make sure that you have android studio up and running, ...

  • Reverse number

    Problem: Given the number N, print reverse of number N. Note: do not print leading zeros in output. For example N = 100, Reverse will be 1, not 001 input: input contains a single integer N. Output: print reverse of integer N. Constraints: 1<=N<=10_000 Solution: First reverse the int...

  • Gift distance

    Problem: You are on your way to find the gifts. All the gifts lie in your path in a straight line at prime numbers and your house is at 0. Given your current position find the closest gift to your position, and calculate the distance between your current position and gift and tell the distance. ...

  • Status:

    @ Bittle
    ...

    Bio

    Creator of this site, PHP developer, Aszend Digital LLC Developer, and open source enthusiast. Happy to have you here.

Search Here