Wednesday, March 4, 2015

keep first 4 characters of email address and replace the rest with * in java code

String s = "msdgsalasdasdehi@gmail.com";
int atIndex = s.indexOf("@");
String localPart = String.format("%-" + atIndex + "s", s.substring(0, 4)).replaceAll("\\s", "*");
String domainPart = s.substring(atIndex);
System.out.println(localPart + domainPart);

Tuesday, February 17, 2015

Set debian to boot on shell

edit below file:
/etc/default/grub
$sudo vi /etc/default/grub

1 - find the following line and comment it out:
        GRUB_CMDLINE_LINUX_DEFAULT="quiet"

2- find the following line:
        GRUB_CMDLINE_LINUX=""
and change it to:
        GRUB_CMDLINE_LINUX="text"
if the line is not present you can  add it to the file.

3- Uncomment the following line:
GRUB_TERMINAL=console
if the line is not present you can  add it to the file.

4- Save the file and run:
$update-grub

i found it here:
ask.xmodulo.com/boot-into-command-line-ubuntu-debian.html