Resources for learning debugging

Learn Programming - Fri, 12/21/2018 - 11:47

I'm currently studying on break from school and feel okay in some of my abilities in java, however I really want to get better at debugging code. I know there are tons of websites that allow you to code problems and get better at problem solving, but are there any websites that have code that has bugs already in it that you have to go through and fix? and if there aren't any websites like that what are the ways that you learned to debug programs that I could start to practice to make myself proficient?

submitted by /u/HelplessProgrammer
[link] [comments]

Could not access Bitlocker encrypted flash drive, need advice on diagnostic techniques.

Learn Programming - Fri, 12/21/2018 - 11:21


Got myself a problem here.

I've encrypted USB thumb drive with Bitlocker on a Windows 10 RS 5 using my home PC, now at work I cannot access it on Win 10 14393 machine. Thing is password was accepted but filesystem is identified as Raw. And when I try to access it using a hex editor logical volume could not be red.
I was able to read fs at home in the evening without any errors.

What I am looking for is a way to determine what is preventing me from correctly accessing a filesystem. Excluded Anti-virus already by removing it.

I was able to access it on a Win 7 VM running on a VMware hypervisor. So flash drive probably fine as well as Bitlocker wrapper.

What would you use to to diagnose Volume access problems ?

submitted by /u/motoevgen
[link] [comments]

What should I learn after Python?

Learn Programming - Fri, 12/21/2018 - 11:21

Hello! I am currently and High-School student and a college student. I am doing due enrollment. This semester I took a computer science class and we learned some python, a tiny tiny bit of java and a little bit of HTML. This really got me interested in coding. I have been working on a few things in my free time. I don't think I am super good at python. Anyways, I was wondering what should I learn after python. I kinda wanna to get into game dev as a hobby and for an actual job (not saying that game dev is not an actual job), I think I just wanna be writing code.

submitted by /u/dewy413
[link] [comments]

D8 Blue/Green Deployments: What to do about the database?

Drupal - Open Source Content Platform - Fri, 12/21/2018 - 10:45

I am not sure if this is exactly the right place, but I thought I'd start here:

We currently have a Drupal8 site running within a Kubernetes cluster, with an external MySQL database as the backend. Our themes and modules are all present inside of a container. When we push a new container image, we:

  1. turn on maintenance mode
  2. push the image and restart pods
  3. wait for the pods to start up
  4. dial into the pod/container
  5. run any required drush commands
  6. turn off maintenance mode

This whole process takes anywhere between 10 minutes and hour, depending on what kind of changes are present in the latest image, during which the site is down, which isn't ideal. We've been looking at instead using blue/green deployments to minimize the amount of downtime for the site. Everything about blue/green deployments looks easy, with the exception of the database. I've done some preliminary searching on this topic, and most of the articles/blogs/stack overflow posts I've read on this state that they don't concern themselves with the database.

The thing is though, a major feature of our site is webform powered, so we need to ensure that any submissions are present in the database after the switch from blue to green.

Does anyone have any suggestions or advice on how to tackle this problem?

submitted by /u/MurderousMeatloaf
[link] [comments]

Can you give examples of spaghetti code and non-spaghetti code?

Learn Programming - Fri, 12/21/2018 - 10:43

I encounter the term "spaghetti code" quite a lot, but since I don't work with other people and only with my code, I lack the perspective needed to understand what is spaghetti code. Could you provide examples of spaghetti code and its opposite?

submitted by /u/BigBootyBear
[link] [comments]

Very noob question on Object-oriented programming for Python. How does the 'self' instance work?

Learn Programming - Fri, 12/21/2018 - 10:40

I'm trying to learn OOP by myself here and I understand most of the basics of it. I'm still not sure about the use of 'self' however.

take this very simple code I found from a site:

class Car:

def __init__(self, color, brand): self.color = color self.brand = brand self.noise = 'Vroom' def drive(self): print(self.noise)

carA = Car('red', 'Hyonda') carB = Car('blue', 'Toyota')

Why do you put a 'self.color = color and self.brand = brand and self.noise = 'Vroom' but there's no noise inside of def init(self, color, brand)? Shouldn't I be calling it def init(self, color, brand, noise)

submitted by /u/backerkv
[link] [comments]

How to modify the WhatsApp Sticker app official source code to load stickers from a particular folder in the phone storage? Official Source code:

Learn Programming - Fri, 12/21/2018 - 10:39

I am trying to build a WhatsApp sticker app in Android. The intention is to provide the downloaded stickers from the internet to add to WhatsApp. The official source code has minimal documentation & I am relatively new to Android.

submitted by /u/Adarshkl
[link] [comments]

[js] help with steps in function for setting buttons to active/not active

Learn Programming - Fri, 12/21/2018 - 10:31

On the page there are various buttons. Users can click multiple to set those button classes to active, but once they click the same button a second time, the active state needs to be removed. So multiple buttons can have the class active to indicate multiple have been chosen.

The buttons are all the same except for their id, which I have been trying to store into an array, though currently only the newest button from is being added. So only the first part of the if/else statement is being fired.

<button className="color_button" id="red" onClick={this.setActive}></button> <button className="color_button" id="green" onClick={this.setActive}></button> <button className="color_button" id="blue" onClick={this.setActive}></button> setActive = (e) => { var btnArr = []; const selectedButton ="button"); if (selectedButton.className.indexOf("active") === -1) { btnArr.push(; selectedButton.className += " active"; } else if (btnArr.includes( { var els = document.getElementsByClassName('active') function _removeClasses () { while (els[0]) {//as long as a button is still active els[0].classList.remove('active') } } selectedButton.addEventListener('click', _removeClasses) //remove from btnArr } }

Why are not all the clicked button ids added to the btnArr? I'm stuck testing this function out fully now because of this. Do you think this function encompasses the necessary steps for selecting/deselecting buttons?

submitted by /u/0n3PLUS
[link] [comments]

Final exercise, need some help

Learn Programming - Fri, 12/21/2018 - 10:28

Hello! In our uni, we had 2 exercises already, in C, one was lists and one was queues. Done. Now we have the last exercise, trees, and I'm so lost. I'm pasting it below:

Data structures

Academic Year 2018-2019

Purpose of the exercise

The purpose of this exercise is to implement the data structures

binary search tree and peak heap and use them in

subsequent verbal analysis of a set of texts. The words are contained

in the text set are entered into the search tree so that it is given

enabling the user to efficiently find them while maximizing the heap

is used to identify the most common words based on frequency

their appearance.

Program mode

The program accepts the name of a text file as an argument. The file

text must consist of a set of texts that are separated

between them with the word "#". Each text consists of an arbitrary multitude

words but each word has a maximum length of twenty characters. For convenience

you may think that the words are in Latin characters, separated

between them either with spaces or with a line change, and that one

capital letter differs from the corresponding small. (Optional

Your program may ignore additional parties, dots, and capitals

of the small ones.) Each text is given an id (id) defined

as the order in which the text appears in the file.

The program initially reads the words from the text file and inserts them

one by one in a binary search tree. If a word has already been entered in

tree because it appears in the current or previous text then simply

one meter increments the number of impressions.

Also, for each word there is a list of the texts that contain it

at least once. For example, if a word appears at 1 o , 4 o , and 7 o

text in sequence, the list should contain the numbers 1, 4, and 7. The

program stops reading words when it meets the word "eof" "that

is formed from the initials of the words "end" of "file".

Then the program expects the user a word that he / she does

he's looking at the tree. If the word does not exist, it prints a message

otherwise it prints its frequency and the list of which text it is

contain. The above procedure is repeated continuously with a new one

user's word until the word "#" is given.

At this point the program creates with all the words of the tree

search for a heap of maxima. The priority of each word is defined as

its number of appearances in all of the texts we call

frequency. Once the above pile is created, it is imported by the user

an integer value and the words with the maximum are deleted consecutively

Priority until the stack is to leave only words with frequency down

from the given value. (Note that the stack stores markers but for

description is easier to believe that contains words.) The words that

deleted from the stack are also deleted from the tree

search. Then the five largest word are printed

their frequency and frequency. But these five words do not

deleted from the search tree. (If the words of the heap are

fewer than six are deleted and all are printed.)

Finally, with inordinate intersection, all words in the search tree are displayed,

and then all data structures are destroyed and the program is destroyed


Program data structures

(a) Binary search tree

Implement a binary search tree using indexes. A

the tree node stores a string (one word), a list

integer implemented with pointers, the frequency of the word (an integer), and

the two markers on the left and right children. The tree should

supports the following features:

insertItem: element entry

searchItem: search for an item

d) eleteItem: delete element

printTree: print tree elements

d) estroyTree: tree destruction

The search binary tree is initially empty. When inserting one

element in the tree first we search if there is already a node with the same word

on the tree. (String comparison is based on lexicography

If not, then a new node is created for the element and

the members of the node are initialized. Otherwise, it simply enters into the relevant

list the id) of the current text provided that the same id does not exist

inserted earlier and rising by one word frequency. Function

deletion can be done either in a repetitive or retrospective fashion.

(Depending on how you choose, consult the appropriate one

course text.) The first three above functions of the search tree must be

are performed in time O (h) where h is the current height of the tree. In operation

printing, printing all of its data with inord er er. On

destruction of the tree, all its elements are deleted

with intersection of postord) er.

(b) Peak of maxima

The maximal stack must be implemented with a table with a number of positions as many

and the words of the search tree. Each table position in use must

to store a pointer to a search tree node in order to

we have access to its word and frequency, which also determines it

priority of the word. Observe by selecting a node indicator matrix

memory savings are achieved. Beware the pile must support

the following functions are mandatory with their typical execution time:

makeHeap: create a heap

fixDownHeap: heap correction down

maxHeap: return the maximum priority to the stack

d) eleteMaxHeap: delete the item with the highest priority

d) estroyHeap: heap destruction.

As I said, I'm lost. If someone can help me decrypt what I need to do, I'll be really thankful

submitted by /u/rayQuGR
[link] [comments]

Book/textbooks for CS fundamentals?

Learn Programming - Fri, 12/21/2018 - 10:06

Hi everyone, I am currently going the self-taught programming route. I don’t have a computer science degree, but am slowly getting better with coding. I see so many great resources for language syntax and project walkthroughs, but feel like I want a better foundation for computer science. I don’t mind reading at all, and like having books for reference if I’m working through something. Any recommendations for learning these topics?

submitted by /u/Jdlman
[link] [comments]

Paper suggestion for implementating RBAC

Learn Programming - Fri, 12/21/2018 - 09:56

I have been wanting to implement RBAC protocol for a while as an exercise. Are there any good resources to read about it? Research papers or even in-depth blog posts would do.

submitted by /u/fenster25
[link] [comments]