Skip to content

Instantly share code, notes, and snippets.

View juniorcesarabreu's full-sized avatar
🏠
Working from home

Júnior César Abreu juniorcesarabreu

🏠
Working from home
View GitHub Profile
@juniorcesarabreu
juniorcesarabreu / sharing-folder-windows-macos-vmware.md
Created March 30, 2020 22:16
Sharing a folder between windows and mac os x on vmware

You need to follow this procedure in order to share files between Windows 7 and Mac OS X on VMWare :

  1. Go in your virtual machine settings and select 'Options' tab.
  2. Click on 'Folder Sharing' and tick 'Always enabled'.
  3. Click on 'Add' button and select a folder you want to share.
  4. Confirm virtual machine settings.
  5. From 'System preferences' on Mac OS X, select 'Sharing'.
  6. Make sure that 'File Sharing' is enabled.
  7. From top menu bar, select 'Go' and 'Computer'.
  8. You will now see a folder named '/'. This is your shared folder between Windows 7 and Mac OS X.
@juniorcesarabreu
juniorcesarabreu / read-complete-file-without-using-loop-in-java.java
Created February 21, 2020 22:16
read complete file without using loop in java
File file = new File("a.txt");
FileInputStream fis = new FileInputStream(file);
byte[] data = new byte[(int) file.length()];
fis.read(data);
fis.close();
String str = new String(data, "UTF-8");
// https://stackoverflow.com/questions/14169661/read-complete-file-without-using-loop-in-java
@juniorcesarabreu
juniorcesarabreu / bitmapFromDrawable.android.java
Created January 24, 2020 12:16
Bitmap from VectorDrawable
public static Bitmap getBitmapFromVectorDrawable(Context context, int drawableId) {
Drawable drawable = ContextCompat.getDrawable(context, drawableId);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
drawable = (DrawableCompat.wrap(drawable)).mutate();
}
Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(),
drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
// Gets a handle to the clipboard service.
ClipboardManager clipboard = (ClipboardManager)
getSystemService(Context.CLIPBOARD_SERVICE);
// Creates a new text clip to put on the clipboard
ClipData clip = ClipData.newPlainText("Área", textViewArea.getText());
// Set the clipboard's primary clip.
if (clipboard != null) {
clipboard.setPrimaryClip(clip);
<EditText android:digits="1234567890.," android:inputType="numberDecimal" />
package br.com.revija.cadastroimobiliario.controller.components;
/**
* Created by Júnior César Abreu <juniorcesarabreu<em>live.com> on 12/10/2017.
*/
import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.AttributeSet;
public class Text extends DrawinObject {
@Type
private static final String type = Type.TEXT;
private Paint paintText;
private Paint paintInput;
private Paint.FontMetrics fm;
private float startX, startY;
@juniorcesarabreu
juniorcesarabreu / navigationBarColor.android.md
Created May 17, 2019 23:26
Change Navigation Bar Color in Android

It can be done inside styles.xml using

<item name="android:navigationBarColor">@color/theme_color</item>

or

window.setNavigationBarColor(@ColorInt int color)
@juniorcesarabreu
juniorcesarabreu / mudando-senha-padrão-mysql.md
Created January 23, 2019 18:46
Mudando a senha padrão do MySQL

Mudando a senha padrão do MySQL

Após a instalação do MySQL (se você não fizer nada), o usuário padrão será o root e a senha será vazia… E isso não é nada seguro, mesmo quando se desenvolve localmente… Hoje vou ensinar como mudar essa senha tanto no Windows quanto no Linux.

Mudando a senha do root no Windows

@juniorcesarabreu
juniorcesarabreu / MultipleDevicesOverTCP.md
Last active January 23, 2019 19:01 — forked from teocci/MultipleDevicesOverTCP.md
How to connect multiple Android devices with ADB over TCP

How to connect multiple Android devices with ADB over TCP

From your device, if it is rooted

According to a post on xda-developers, you can enable ADB over Wi-Fi from the device with the commands:

su
setprop service.adb.tcp.port 5555
stop adbd