Publish and Subscribe / Process / Store
- Kafka uses ZooKeeper as a distributed backend.
| // Create new configuration that specifies the error correction | |
| Map<EncodeHintType, ErrorCorrectionLevel> hints = new HashMap<EncodeHintType, ErrorCorrectionLevel>(); | |
| hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H); | |
| QRCodeWriter writer = new QRCodeWriter(); | |
| BitMatrix bitMatrix = null; | |
| ByteArrayOutputStream baos = new ByteArrayOutputStream(); | |
| try { | |
| // Create a qr code with the url as content and a size of 250x250 px |
| # Backup | |
| docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
| # Restore | |
| cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
| import java.io.ByteArrayInputStream; | |
| import java.io.File; | |
| import java.io.FileInputStream; | |
| import java.io.FileNotFoundException; | |
| import java.io.FileOutputStream; | |
| import java.io.IOException; | |
| import java.io.InputStream; | |
| import java.io.OutputStream; | |
| import java.io.UnsupportedEncodingException; |
| // Find the View that shows the numbers category | |
| TextView numbers = (TextView) findViewById(R.id.numbers); | |
| // Set a click listener on that View | |
| numbers.setOnClickListener(new View.OnClickListener() { | |
| // The code in this method will be executed when the numbers View is clicked on. | |
| @Override | |
| public void onClick(View view) { | |
| Intent numbersIntent = new Intent(MainActivity.this, NumbersActivity.class); | |
| startActivity(numbersIntent); |
| import org.junit.Test; | |
| import org.junit.runner.RunWith; | |
| import org.master.Application; | |
| import org.springframework.beans.factory.annotation.Value; | |
| import org.springframework.boot.test.IntegrationTest; | |
| import org.springframework.boot.test.SpringApplicationConfiguration; | |
| import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; | |
| import org.springframework.security.oauth2.client.DefaultOAuth2ClientContext; | |
| import org.springframework.security.oauth2.client.OAuth2RestTemplate; | |
| import org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails; |
| package demo; | |
| import java.io.Serializable; | |
| import java.util.ArrayList; | |
| import java.util.Collection; | |
| import java.util.Collections; | |
| import java.util.HashMap; | |
| import java.util.HashSet; | |
| import java.util.LinkedHashMap; | |
| import java.util.List; |
It is a common scenario that we often forget out database password. When we try to log in to our mysql DB, we face the following error message. If we use a password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
If we don't use a password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Riverpod or Bloc