Now it's finally possible to silence iPhones in shul (or church or whatever)!
- Settings / Focus / Do Not Disturb / Add Schedule or Automation / Location
- enter something to identify your shul, e.g. part of the name
- select the right one
- touch Done
Mostly tech stuff
Now it's finally possible to silence iPhones in shul (or church or whatever)!
When working with verbose logs, you want to suppress uninteresting lines.
So, wouldn't it be cool if you could select two lines, and vim would hide all lines that are similar to them.
1237 boring is blah, all good
1238 boring is foo, all good
1238 WARNING
1240 boring is blah, again
When the user selects the first two lines above, vim would hide lines matching the pattern \d+ boring is \w+, all good.
It'd need the ability to unhide the next or previous line.
We could also get fancy, and support generalizing previous patterns. In the example above, you could later choose the fourth line, and vim would amend the previous pattern to \d+ boring is \w+, [ a-z]*. We'd have to document some decisions about how general to be, e.g. it's not obvious above that we should use \d+ instead of 123\d.
Closest existing thing I could find: https://www.vim.org/scripts/script.php?script_id=2302
It's useful to be able to synchronize scrolling through two files, especially for comparing two files that have too many intraline differences.
Vim supports this, with this annoying incantation:
vim -O oneFile anotherFile -c "windo set scrollbind" -c "windo set scrollopt+=hor" -c "windo set nowrap" -c "windo set cursorbind"
Switch between the windows with: ctrl-w ctrl-w
Nowrap is useful because otherwise different sized lines don't display nicely.
Other annoying things:
Toki Pona is a supremely simple constructed language. It's a real Newspeak (from Orwell's 1984), but for good and not evil.
It's very cool. Unfortunately nobody seems to seriously use it for international collaboration. (Apparently this is called auxlang, and obviously English right now is it.)
I was initially grumpy about the "pre-verb" part of speech, but now I believe it's consistent with the general rule that a word modifies its preceding word. For example, a noun precedes its adjectives, and a verb precedes its adverb. So: mi ken pali == I can work. mi wile e ken pali == I want the ability to work.
Nullaway is the currently most practical solution to the billion dollar mistake.
Its @Initializer annotation is one of its practical features; if an object is not expected to be used until one of its methods in executed, that method can be annotated. Then fields can still be statically guaranteed to be non-null if they are initialized in that method, even if they are not initialized earlier.
Nullaway does not, however, statically guarantee that @Initializer methods are actually executed. Therefore, it's better to initialize non-nullable fields in a constructor.
Projectional Editing is programming that goes beyond simple text entry. Notable projects are Lamdu and Jetbrain's MPS and to some extent Intellij itself.
Historically, programmers have been reluctant to stray too far from textual programming. A good compromise approach is to represent language features both textually and graphically. For example, the exponents in LegibleMathematics are both superscripted and ^ prefixed.
We could support the property of always keeping the program valid, and still give the feel of textual editing:
void f() {
if (foo) {bar();baz();}
qux();
quux();}
void f() {if (foo) {bar();g();}qux();quux();}void g() {baz();}
And of course select the new function name g so that it can be easily changed. And some pastes would be illegal, e.g. pasting qux(); quux() in place of foo.
So, this "always valid" approach is very nice for refactoring. Its main benefit however is to enable powerful live coding, e.g. devcards.
Since the rise of github, most teams build software using a pull request workflow. Therefore the local "master" branch is a bit of a gotcha. You can commit to it, but that will only ever cause you grief. That is, you'll forget about those commits, and they'll eventually cause a conflict, and you'll get something mysteriously broken when you just want "master". Fix it with this:
git branch -D master
git branch master origin/master
And actually consider not having a local master at all, and always using origin/master instead.
IPython is a good UNIX shell replacement, for those who want an interactive shell with a better programming language.
You can use unadorned shell commands, file globbing, and pipes, as well as regular python.
Regular shell: ls *.py | grep -v foo
Regular python: for x in range(3): print(x)
There is special syntax for running shell commands to be easily used by python code...
Shell in python: my_python_var1 = !ls #only for assigning variables
Python in shell: ls $my_python_var2
For anybody pining for python2: print "foo" #works!
Also works for any outermost python function: dir enumerate(list())
But unfortunately doesn't currently work with other code: for x in range(3):
print x
For some reason, the maintainers are no longer publishing a profile for this stuff, so you can use the following to get up and running:
pip install ipython
def mode(l):
max = None
count = {}
for x in l:
if x not in count:
count[x] = 0
count[x] += 1
if not max or count[x] > count[max]:
max = x
return max
@ensure("result must occur at least as frequently as any member",
lambda a, r: all((a.l.count(r) >= a.l.count(x) for x in a.l)))
from hypothesis import given
from hypothesis.strategies import lists, integers, text
from dpcontracts import require, ensure
@given(lists(text()))
def test_mode(l):
mode(l)
pip3 install hypothesis dpcontracts pytestPrograms must be written for people to read, and only incidentally for machines to execute.― Harold Abelson
public interface Observer<T, V> {
default V beforeChange(T t) {
return null;
};
void afterChange(T t, V v);
}
Which may be wired simply by:YourEntity entity = new YourEntityImpl(); entity = new YourEntityObservable(entity, yourObserver);You could implement this observable decorator manually. It’s kind of boring, so you could instead generate it using something like the linked project above.