Data Science Pipeline

Learning Data Science can be grueling and overwhelming sometimes. When I feel too overwhelmed it’s time to draw a picture. This my current overview of what a data scientist has to do:

Joint account for couples

Living single

As long as you are single or in a partnership with no common household everything is easy money wise: you spend your money,
your partner spends his or her money. Done!

But wait! What happens, when you eat in a restaurant together? Do you split the bill or do you pay this time and your partner will pay
the next time? What happens when your partner just earns less than you do? Or the other way around?
Do you pay two times in a row and then your partner will take his/her turn? Pretty dull, huh?

Moving in together

Say you are in a long term relationship and you finally make the move and move in together.
In terms of money it gets even more complicated: you pay rent, fill your fridge together, use you cars together.
How do you split it up now? “You pay the rent and I pay the gas? You pay the insurance and I the pay for the food?”
Or do you split the rent and wire it half and half to the landlord?
How do you keep track of the overall splitting thing? Do you write it down? What happens when you have to drive more or gas gets expensive?

Joint Account

Continue reading “Joint account for couples”

My all time favorite books

This is a list of my favorite books. I’ve sorted them in the order of much I feel influenced by them and how they impacted my life.

Atomic Habit – James Clear

If there was one and only one book I could take with me on a lonely island this would be the one. It is such a good read!

James Clear does an awesome job in explaining how tiny changes in habits can lead to great results.

Main takeaways: Habit stacking, Rule of 1%

Atomic Habits on Amazon

Continue reading “My all time favorite books”

Sound and music with pygame

pip install pygame

Sound

import pygame

if __name__ == '__main__':
    pygame.mixer.init()
    sound = pygame.mixer.Sound("./sound.wav")
    channel = sound.play()
    while channel.get_busy():
        pygame.time.wait(100)
        print("Playing...")
    print("Finished.")

 

Music

import pygame

if __name__ == '__main__':
    pygame.mixer.init()
    pygame.mixer.music.load("./sound.mp3")
    pygame.mixer.music.play()
    while pygame.mixer.music.get_busy():
        pygame.time.wait(100)  # ms
        print("Playing...")
    print("Finished.")

Getting Location Info in Android

Manifest

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

Activity

 

public static final int REQUEST_CODE = 123;
LocationManager mLocationManager; 
LocationListener mLocationListener;
@Override
protected void onResume(){
    super.onResume();
    getCurrentLocation();
}
private void getCurrentLocation() {
    Log.d("Clima", "getWeatherForCurrentLocation");
    mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    mLocationListener = new LocationListener() {
        @Override
        public void onLocationChanged(Location location) {
            Log.d("Clima", "onLocationChanged");
            String longitude = String.valueOf(location.getLongitude());
            String latitude = String.valueOf(location.getLatitude());
            Log.d("Clima", "longitude is: " +longitude);
            Log.d("Clima","latitude is: " + latitude);
        }

        @Override
        public void onStatusChanged(String s, int i, Bundle bundle) {

        }

        @Override
        public void onProviderEnabled(String s) {

        }

        @Override
        public void onProviderDisabled(String s) {

        }
    };
    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
            && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_CODE);
        return;
    }
    mLocationManager.requestLocationUpdates(LOCAION_PROVIDER, MIN_TIME, MIN_DISTANCE, mLocationListener);
}

 

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    Log.d("Clima", "onRequestPermissionsResult");
    if (requestCode == REQUEST_CODE) {
        if(grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED){
            getCurrentLocation();
        }
    }
}