Questions tagged [masking]

Force user input to conform to given rules.

Input masking restricts inputs for a given UI element without actually performing validation. Instead of collecting and validating user input, the masking approach restricts the inputs that a user can make in the first place.

An example of this would be a text field that is set to accept telephone numbers from a given country: instead of collecting digits and letters, and then validating them against the format, an input-masked field will only allow digits to be input, and will only accept them in an order that forms a valid input.

When dealing with arrays / matrices 'masking' means to ignoring certain parts of the array an only use the unmasked elements for further calculations.

1153 questions
240
votes
18 answers

Password masking console application

I tried the following code... string pass = ""; Console.Write("Enter your password: "); ConsoleKeyInfo key; do { key = Console.ReadKey(true); // Backspace Should Not Work if (key.Key != ConsoleKey.Backspace) { pass +=…
Mohammad Nadeem
  • 9,134
  • 14
  • 56
  • 82
86
votes
5 answers

Using CSS, can you apply a gradient mask to fade to the background over text?

I have a full screen fixed background image. I would like the text in my scrolling div to fade out at the top, presumably by applying a gradient mask to the background at only the top part of the div. I'm interested in having the text look like it…
aviemet
  • 1,463
  • 1
  • 15
  • 19
83
votes
9 answers

Remove White Background from an Image and Make It Transparent

We're trying to do the following in Mathematica - RMagick remove white background from image and make it transparent. But with actual photos it ends up looking lousy (like having a halo around the image). Here's what we've tried so…
dreeves
  • 26,430
  • 45
  • 154
  • 229
83
votes
4 answers

Masking(crop) image in frame

Having a rich UI application in which I want to show image with complex shape like this Now what I want is to crop my image as per Mask image, Actually image is coming dynamic and can be imported from Camera or Gallery(square or rectangle shape)…
Mohammed Azharuddin Shaikh
  • 41,633
  • 14
  • 96
  • 115
68
votes
16 answers

Hide password input on terminal

I want to mask my password while writing it with *. I use Linux GCC for this code. I know one solution is to use getch() function like this #include int main() { char c,password[10]; int i; while( (c=getch())!= '\n');{ …
Hit's
  • 1,009
  • 4
  • 12
  • 18
52
votes
5 answers

Masking password input from the console : Java

How to mask a password from console input? I'm using Java 6. I've tried using console.readPassword(), but it wouldn't work. A full example might help me actually. Here's my code: import java.io.BufferedReader; import java.io.Console; import…
New Start
  • 1,401
  • 5
  • 21
  • 29
48
votes
2 answers

Writing robust R code: namespaces, masking and using the `::` operator

Short version For those that don't want to read through my "case", this is the essence: What is the recommended way of minimizing the chances of new packages breaking existing code, i.e. of making the code you write as robust as possible? What is…
Rappster
  • 12,762
  • 7
  • 71
  • 120
44
votes
6 answers

What is the purpose of "int mask = ~0;"?

I saw the following line of code here in C. int mask = ~0; I have printed the value of mask in C and C++. It always prints -1. So I do have some questions: Why assigning value ~0 to the mask variable? What is the purpose of ~0? Can we use -1…
Jayesh
  • 4,755
  • 9
  • 32
  • 62
39
votes
4 answers

How do I mask a loss function in Keras with the TensorFlow backend?

I am trying to implement a sequence-to-sequence task using LSTM by Keras with the TensorFlow backend. The inputs are English sentences with variable lengths. To construct a dataset with 2-D shape [batch_number, max_sentence_length], I add EOF at the…
Shuaaai
  • 403
  • 1
  • 4
  • 8
37
votes
6 answers

Python: Elegant and efficient ways to mask a list

Example: from __future__ import division import numpy as np n = 8 """masking lists""" lst = range(n) print lst # the mask (filter) msk = [(el>3) and (el<=6) for el in lst] print msk # use of the mask print [lst[i] for i in xrange(len(lst)) if…
Developer
  • 8,258
  • 8
  • 49
  • 58
31
votes
5 answers

Easiest way to mask characters in HTML(5) text input

Does HTML5 have any kind of text field masking or do I still have to trap onkeydown etc.? jbabey is right--"masking" as in blocking certain illegal characters, not hiding what's typed. The best (as in simplest and most reliable) way I've found is to…
devios1
  • 36,899
  • 45
  • 162
  • 260
29
votes
8 answers

Mask an EditText with Phone Number Format NaN like in PhoneNumberUtils

I want to make user inputted phone number in an editText to dynamically change format every time the user inputs a number. That is, when user inputs up to 4 digits, like 7144, the editText shows "714-4". I would like the editText to be dynamically…
eunique0216
  • 875
  • 1
  • 16
  • 28
29
votes
9 answers

iOS invert mask in drawRect

With the code below, I am successfully masking part of my drawing, but it's the inverse of what I want masked. This masks the inner portion of the drawing, where I would like to mask the outer portion. Is there a simple way to invert this…
OWolf
  • 5,012
  • 15
  • 58
  • 93
27
votes
6 answers

How to mask a UIView

I'm working on an app where I draw a UIView via code and I fill it with a UIColor. Next thing I want to load a mask.png file (no transparency, just black and white) and mask the UIView to change its visual appearance. Any idea how to do this?
Thomas Joos
  • 2,451
  • 5
  • 26
  • 30
24
votes
6 answers

Dart how to add commas to a string number

I'm trying to adapt this: Insert commas into number string to work in dart, but no luck. either one of these don't work: print("1000200".replaceAllMapped(new RegExp(r'/(\d)(?=(\d{3})+$)'), (match m) => "${m},")); print("1000300".replaceAll(new…
Alex L.
  • 416
  • 1
  • 4
  • 14
1
2 3
76 77