Status:

@Bittle
...

Bio

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

Recent Comments

67

Posts

1

times favorited

0

comments

General Information

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

Activity

  • 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...

  • 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...

  • 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...

  • Importing database using Sequel Pro

    Make sure to access your server via SSH before continuing. To execute SQL code in the server run mysql We need a new user to access the database. We can create one by running GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password'; DON'T COPY PASTE THE ABOVE ...

  • 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...

  • Installing Composer in Digital Ocean droplet

    FTP into droplet with FileZilla before proceeding. To install composer in our droplet we have to download the composer.phar file . Scroll down to "Manual Download" and click the latest version to start the download. Note where the file downloads (mine downloaded to my desktop). Make sur...

  • 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...

  • 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 ...

  • 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...

  • 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...

  • 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 apt-get install software-properties-common sudo add-apt-repository universe sudo add-apt-repository ppa:certbot/certbot sudo apt-get update sudo apt-get inst...

  • 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