Parent element’s height is larger than child element’s height [duplicate]

This question already has an answer here:

  • Get rid of space underneath inline-block image [duplicate]

    2 answers
  • Image inside div has extra space below the image

    9 answers
  • Inline block adding bottom space

    3 answers

I have only one inline-block element in the parent block element. The child element have height 95px but parent element have 97px height. I can’t solve this.

This problem appears in Chrome, Edge and Firefox too.

Here is codepen: https://codepen.io/michalchovanec/pen/mGagYy

Parent have red background.

All topic

buildToolsVersion is not specified

I’m getting “Error: buildToolsVersion is not specified”
I’ve seen many people get this error but it has either been due to buildtooslversion not being specified in the module build.gradle or apply plugin being in the top level.

Top level build.gradle

    buildscript {
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:2.2.0'
            classpath 'com.google.gms:google-services:3.0.0'
        }
    }
    allprojects {
        repositories {
            jcenter()
        }
    }

    dependencies {
    }

Module build.gradle

    apply plugin: 'com.android.application'

    android {
        compileSdkVersion 28
        buildToolsVersion "28.0.2"

        defaultConfig {
            applicationId "com.tst.test_app"
            minSdkVersion 9
            targetSdkVersion 28
        }
    }

    dependencies {
        compile project(':test_app_lib')
        compile 'com.google.android.gms:play-services-ads:9.6.1'
        compile 'com.firebase:firebase-client-android:2.3.1'
        compile 'com.google.firebase:firebase-core:9.6.0'
    }

    apply plugin: 'com.google.gms.google-services'

It’s been a year since I touched this code. I previously built ok. I updated android studio and SDKs and switch to target SDK28. That’s pretty much all I changed.

All topic

Python – How to add an input error message

In Python, I have code where I only want the input to be a number and I want there to be an error message if the user inputs a string(words). How do I do that?

All topic

String in function call treated differently than string defined in function – strange error

I am trying to make a function that can edit the dom on click, that I can pass different elements into, too reduce duplicate code. However when i pass an id in as string in a function it will not grab the dom element. However if I use the same text in a string declared in the function it will. I have tried console logging the output and using that same string defined by me, in the dom request and that works however variable defined in the function prototype do not it seens unexplainable to me.

e.x will work var x = document.getElementById(‘button1’).style.display=”block”;

but var x = document.getElementById(str1).style.display=”block”; will not, where str is taken from funtion header, even tho str console.logs(“button1”);
however if i declare a variable r = “button1″ inside the function
var x = document.getElementById(r).style.display=”block”; – this will work
why are string passed into the function treated differently

example fiddle illustrating the problem
https://jsfiddle.net/peacefulgoldfish/wpvyu5fr/20/

html




  
  
  
  
  
  


  

    

  
  

  






All topic

How to add links to the individual records in the to_csv method in rails 5 so absolute urls are printed in the csv export?

I’m working on a project in rails and recently watched this great gorails.com episode on exporting data as CSV (https://gorails.com/episodes/export-to-csv). I can get it to work, but I really want to get the absolute url of each of the “tasks” so in the CSV export it would show in each row as a 4th column the link to the “task” eg: “localhost:3000/tasks/1” “localhost:3000/tasks/2” etc. Something like “task_url” as the column header

I haven’t found any resource online that helps with this. Any thoughts on how to do this in the most efficient way? Thank you for the help! Here is the working code:

def self.to_csv
    attributes = %w{id task_name task_description}
    CSV.generate(headers: true) do |csv|
    csv << attributes
        all.each do |task|
          csv << attributes.map{ |attr| task.send(attr) }
        end
    end
end

And I would like to do something like this (emphasis added around task_url):

def self.to_csv
    #need to declare what task_url is here
    attributes = %w{id task_name task_description **task_url**}
    CSV.generate(headers: true) do |csv|
    csv << attributes
        all.each do |task|
          csv << attributes.map{ |attr| task.send(attr) }
        end
    end
end

All topic

How to avoid RxJs subscribe callback hell?

I’m using Angular RxJs subscribe to make a HttpClient call and then make another call using the values from the first one. In this case, there’s a call to get address object, and then i make a call using this object. Like this:

@Injectable()
export class AddressService {
  constructor(private http: HttpClient) { }

  getById(addressId: string, userId: string) {
    return this.http.get(BACKEND_URL + 'getAddressById/' + [addressId, userId]);
  }
}
  
export class AddressModalComponent implements OnInit {
  constructor(private alertService: AlertService, private addressService: AddressService,           @Inject(MAT_DIALOG_DATA) public data: any, private dropdownService: DropdownService)

  ngOnInit() {
    this.addressService.getById(this.data.id, this.data.userId)
        .subscribe(
          (address: Address) => {
            this.dropdownService.getCidadesBrByEstado(address.name)
              .subscribe((cities: BrCity[]) => {
                this.cities = cities;
                this.address = address;
              },
              error => console.log(error));
          }, error => { this.alertService.error(error);
          }
        );
    }
  }
}

I’m trying to avoid multiple Subscribes, there is many like this in my code. I need an Async/Await approach like Node.js promises, but using Observables at component level. I’m not very familiar with RxJs commands… is there a better way to make many calls with just one subscribe and catch?

All topic

Mocking out with Sinon.js a dependency to be injected

Having the following balanceRepository.js file.

module.exports = function(){
this.getBalance = (accountId)=>{
    throw 'NotImplementedException';
};};

And the service transactionService.js file.

module.exports = function(balanceRepo){
this.isTransactionAllowed = (amount, accountId)=>{
    const balance = balanceRepo.getBalance(accountId);
    return amount <= balance;
};};

I would like to unit test that when we call transactionService.isTransactionAllowed, it will call internally to balanceRepository.getBalance. I was expecting the following code to work.

let BalanceRepository = require('../balanceRepository');
let TransactionService = require('../transactionService');

let should = require('should');
let sinon = require('sinon');

describe('transaction service', ()=>{
   let fakeBalanceRepo = sinon.spy(BalanceRepository);
   let transactionSrv = new TransactionService(fakeBalanceRepo);

   transactionSrv.isTransactionAllowed(100, 987654321);

   it('should call getBalance', ()=>{
      fakeBalanceRepo.getBalance.should.be.called();
});});

I create a spy of the class BalanceRepository. I inject that spy object to my real implementation of TransactionService. Then, I assert that the getBalance method is called on the spy. It makes sense to me but it is not working!!

How can I inject a fake and assert that one of its methods was called?

All topic

Independence of functions of exponential random variables

Suppose that $X$ and $Y$ are independent random variables with Exponential$(1)$ distribution. How can it be shown that
$$
frac{X}{X+Y}
$$
and
$$X+Y$$
are independent?

All topic

Need help with university linear algebra question

Find the vector form of the equation of the line in the set of real numbers that passes through
P = (5, −4)
and is parallel to the line with general equation
5x − 2y = 4.

Above is the question i am struggling with and any help would be appreciated, Im not sure how to use the general equation to help me find the line i need in vector form.

All topic

Determine the domain where the inverse of $f(x) = 2x^2 + 8x – 7$ is a function.

Determine the domain where the inverse of $f(x) = 2x^2 + 8x – 7$ is a function.

  1. So, I started off switching the $y$- (the $f(x)$) and $x$-value, like so:

    $x = 2y^2 + 8y – 7$?

  2. Then, I plugged these values into the quadratic formula, getting:

    $$f^{-1}(x) = frac{-8 pm sqrt{120}}{4}$$

First off, is the inverse written correctly (this problem is different from the others I worked on)? And second, since I have a ($pm$) sign, does that mean there will be two different domains?

All topic