[Solved] I’m getting an IndentationError. How do I fix it?

Why does indentation matter? In Python, indentation is used to delimit blocks of code. This is different from many other languages that use curly braces {} to delimit blocks such as Java, Javascript, and C. Because of this, Python users must pay close attention to when and how they indent their code because whitespace matters. … Read more

[Solved] Lists, conditionals and loops don’t give the result expected [closed]

This line: i = word.find(letter) always finds the first occurrence of letter in word, and this line: start = indeces.index(i) always finds the first occurrence of i in indeces. Then, this line: index=word.find(letter,start) includes start, so just finds the same letter straight away! The only way to make your current code work would be to … Read more

[Solved] Function should clean data to half the size, instead it enlarges it by an order of magnitude

When you merge your dataframes, you are doing a join on values that are not unique. When you are joining all these dataframes together, you are getting many matches. As you add more and more currencies you are getting something similar to a Cartesian product rather than a join. In the snippet below, I added … Read more

[Solved] C++ while loop resetting variables?

Moving the line stringstream aa; just before the line aa << b; solves the problem for me. This is perhaps caused by use of aa both as an input stream as well as output stream. Not sure of the details. Update Here’s your program with a bit of error checking code thrown in. #include <iostream> … Read more

[Solved] How can I load an image in Android? [closed]

You’ll need to add the image as a resource to the project, and then build an ImageView that uses that image resource. Check out the details at http://developer.android.com/guide/topics/graphics/2d-graphics.html solved How can I load an image in Android? [closed]

[Solved] How to capture value OOPS & Generic [closed]

While looking at your code, why would one want to read class specific properties in a generic method? The only solutions i see is to use Reflection, or create an abstract base class with a before save method and call that method in de Save() method. Add a generic type constraint to the DBObject class … Read more

[Solved] C and C++ : data file with error “Expected unqualified-id” [closed]

OP here. These are the steps I took to resolve my issue, based on the last edit of my question: With the separate files, as given in my question, the error was Expected identifier in mscmix_dat.c. Per @LightnessRacesinOrbit’s suggestion, I consolidated the multiple main.cpp, msclib.h, msclib.c, and mscmix_dat.c files into two files: main.cpp and msclib.c, … Read more

[Solved] Segmentation Fault calling a member function [closed]

a1 is an uninitialized pointer. It does not point anywhere. Using it causes undefined behaviour. You can only dereference pointers that point to valid objects. In your sample code there is actually no way to create a saa since it has protected constructors. You would have to derive a class from saa, create an instance … Read more

[Solved] Cannot turn into embed [closed]

You seem to be confused as to how to create embeds. const Discord = require(‘discord.js’); const bot = new Discord.Client(); bot.on(“message”, async (msg) => { const exampleEmbed = new Discord.MessageEmbed() //embeds are part of the `Discord` object defined above .setColor(‘#0099ff’) .setTitle(‘Some title’) .setURL(‘https://discord.js.org/’) .setAuthor(‘Some name’, ‘https://i.imgur.com/wSTFkRM.png’, ‘https://discord.js.org’) .setDescription(‘Some description here’) .setThumbnail(‘https://i.imgur.com/wSTFkRM.png’) .addFields( { name: ‘Regular … Read more

[Solved] split double quoted string into array in javascript [closed]

Many ways to do it Quick and dirty with split and filter out the empties var string = ‘”abc””xyz””123″‘ var result = string.split(‘”‘).filter(Boolean); console.log(result); Splitting with slice var string = ‘”abc””xyz””123″‘ var result = string.slice(1, string.length -1).split(‘””‘); console.log(result); A regular expression var string = ‘”abc””xyz””123″‘ var result = string.match(/[^”]+/g) console.log(result); solved split double quoted string … Read more

[Solved] Can u please tell me if their is any difference between the codes. And if their is, Then what is the reason behind it? [closed]

Code one has className=”cards__items__img”, code two has className=”cards__item__img”. Code one has className=”cards__items__link”, code two has className=”cards__item__link”. Items is plural on first code and singular on second. Reason? I don’t know but the first code is very poorly formatted. 1 solved Can u please tell me if their is any difference between the codes. And if … Read more