recentpopularlog in
« earlier   later »
What the Supreme Court Says About Sitting Out the National Anthem - Rolling Stone
Other parts of the opinion are worth noting as well. The Court did not ignore the fact that the pledge incites deep emotions, especially during wartime (when the case was decided). To the justices, that just meant that the students' free speech rights mattered even more: "Freedom to differ is not limited to things that do not matter much. That would be a mere shadow of freedom. The test of its substance is the right to differ as to things that touch the heart of the existing order."

The Court also explained that true patriots welcome dissent and protest, even when it touches the flag. To the Court, true patriots recognize that the U.S. is strong enough to appeal to people on its own, without mandates from above: "To believe that patriotism will not flourish if patriotic ceremonies are voluntary and spontaneous, instead of a compulsory routine, is to make an unflattering estimate of the appeal of our institutions to free minds."
patriotism  protest  freespeech 
october 2017
New Sentences: From ‘Twin Peaks,’ by Mark Frost and David Lynch - The New York Times | https://www.nytimes.com/
Cram the stilted clarity of a dictionary into the human mouth, and things turn giddy and unreal. (Comedy writers do this often: One classic Mitch Hedberg joke, about being handed a receipt for the purchase of a single doughnut, peaks with the perfectly apt word ‘‘documentation.’’) It focuses the attention and makes the world feel uncannily well-ordered, as though everything around you is part of some grand mechanism worth observing closely. Which is precisely what this show — with its languid pace, baffling dialogue and strange visual choreography — seems to want from you, too.
twinpeaks 
october 2017
‘Twin Peaks’ Season 3, Episode 16: Doppelgängers and Dancers - The New York Times | https://www.nytimes.com/
That said, I can’t pretend it wasn’t incredibly satisfying to see Mr. MacLachlan this week as the real Cooper, snapping out of a coma in the hospital and proclaiming “I am the F.B.I.!” as the “Twin Peaks” theme song swelled. With two episodes left, mysteries galore are still left to be solved. Finally, Coop is back on the case.
twinpeaks  thereturn  review 
october 2017
Authentication log · User Settings · GitLab | https://tfwebdev.research.cchmc.org/
GitLab defaults its time zone to UTC. It has a global timezone configuration parameter in /etc/gitlab/gitlab.rb.

To update, add the time zone that best applies to your location. Here are two examples:

gitlab_rails['time_zone'] = 'America/New_York'

or

gitlab_rails['time_zone'] = 'Europe/Brussels'

After you added this field, reconfigure and restart:

gitlab-ctl reconfigure
gitlab-ctl restart
timezone  gitlab  configfile  solution 
october 2017
python - Understanding TypeError: got multiple values for keyword argument - Stack Overflow | https://stackoverflow.com/
What happened in my case was that I created a Click group and used the '@click.pass_context' decorator, but I forgot to accept the context (as the first argument) in the subcommands.

It actually had nothing to do with whatever's in this SO thread.
python  flask  click  errormessage  sortof  solution 
october 2017
Why isn’t there a switch or case statement in Python? - Design and History FAQ — Python 2.7.14 documentation | https://docs.python.org/
You can do this easily enough with a sequence of if... elif... elif... else. There have been some proposals for switch statement syntax, but there is no consensus (yet) on whether and how to do range tests. See PEP 275 for complete details and the current status.

For cases where you need to choose from a very large number of possibilities, you can create a dictionary mapping case values to functions to call. For example:

def function_1(...):
...

functions = {'a': function_1,
'b': function_2,
'c': self.method_1, ...}

func = functions[value]
func()

For calling methods on objects, you can simplify yet further by using the getattr() built-in to retrieve methods with a particular name:

def visit_a(self, ...):
...
...

def dispatch(self, value):
method_name = 'visit_' + str(value)
method = getattr(self, method_name)
method()

It’s suggested that you use a prefix for the method names, such as visit_ in this example. Without such a prefix, if values are coming from an untrusted source, an attacker would be able to call any method on your object.
python  language  syntax  newbie  faq  butwhy 
october 2017
Python join: why is it string.join(list) instead of list.join(string)? - Stack Overflow
From the comments:
For easy memory and understanding, '"string".join(list)' declares that you are joining a list and converting to a string. It's result oriented. – Yumi Tada Dec 4 '17 at 12:26

It's because any iterable can be joined, not just lists, but the result and the "joiner" are always strings.

E.G:

import urllib2
print '\n############\n'.join(
urllib2.urlopen('http://data.stackexchange.com/users/7095'))
python  strings  lists  syntax  butwhy  solution 
october 2017
The Rolling Stones & Eddie Vedder - Wild Horses - Live OFFICIAL - YouTube | https://www.youtube.com/
Does eddie vedder do a tune with every single band ever? Swear to god I was having my rice crispies the other day and that fucker pops up and helps me finish them
music  video  forthecomments 
october 2017
autocompletion - set completeopt=noinsert fails - Vi and Vim Stack Exchange | https://vi.stackexchange.com/
The noinsert option became available with Vim version 7.4.775. Your Vim on the raspberry pi is (probably) older. You can check with :version.
vim  autocomplete  errormessage  centos6  solution 
october 2017
Programmatically creating variables in Python - Stack Overflow | https://stackoverflow.com/
I guess the deal is, you can modify 'globals()' in a module, and that's guaranteed by the language spec to be safe, but modifying 'locals()' isn't.
python  metaprogramming  reference 
october 2017
[10.10] [OS X] Finder extensions spams console system log · Issue #3782 · owncloud/client · GitHub
FYI in my case Box Sync was causing this. Even while the Box Sync app was not running, nor was its' client icon visible in the Mac bar.

Killing the Box Sync Extension within Activity Monitor stopped the log spamming.
mac  osx  finder  errormessage  logging  box  syncclient  cloudstorage  sortof  solution 
october 2017
macos - How to find offending Finder Extension? - Ask Different | https://apple.stackexchange.com/


I found the offenders in my case (plural, for several apps were using this plugin), using a ps -axe | grep FinderSyncExt .

Before removing the apps using it from my /Applications folder, I decided to kill each of the processes using a killall -9 FinderSyncExt.
mac  osx  finder  console  errormessage  logging  solution 
october 2017
Why I Spell it Hawai‘i and not Hawaii, and Why You Should, Too | BlondVoyage | http://www.blondvoyage.com/
From the comments:
You may know how to spell Hawai‘i in Hawaiian, but not ‘okina. The ‘okina is the left single quotation mark (U+2018), but everytime you write ‘okina you use the right single quotation mark (U2019). Also, according to the USBGN, the official spelling of the state is Hawaii. This can't be changed by simply spelling it with the ‘okina, which was developed in the 1980's. So actually, when you're referring to the state, it is still spelled Hawaii.
hawaii  hawaiian  okina  forthecomments 
september 2017
Python jinja2 shorthand conditional - Stack Overflow | https://stackoverflow.com/
Yes, it's possible to use inline if-expressions:

{{ 'Update' if files else 'Continue' }}
flask  jinja  templates  conditional  ternary  webdevel  solution 
september 2017
python - Flask-SQLalchemy update a row's information - Stack Overflow | https://stackoverflow.com/
How to do a SQL "UPDATE" with Flask-SQLAlchemy:
Retrieve an object using the tutorial shown in the Flask-SQLAlchemy documentation. Once you have the entity that you want to change, change the entity itself. Then, db.session.commit().

For example:

admin = User.query.filter_by(username='admin').first()
admin.email = 'my_new_email@example.com'
db.session.commit()

user = User.query.get(5)
user.name = 'New Name'
db.session.commit()

Flask-SQLAlchemy is based on SQLAlchemy, so be sure to check out the SQLAlchemy Docs as well.
flask  sqlalchemy  sql  dammitbrain  webdevel  solution 
september 2017
Larry Ellison Bought an Island in Hawaii. Now What? - The New York Times | https://www.nytimes.com/
I asked Maly if he had doubts about going to work for Pulama. Yes, initially, he said. “And I have to tell you, sometimes I question my ability to be a good assessor of people’s integrity.” But he pressed company executives, and they assured him that they were committed to protecting the island’s cultural resources. “I have to believe that,” he told me. “We have to.” He explained that, when he was a newcomer to Lanai, people could have viewed him with the same mistrust some felt toward Ellison. Instead, they welcomed him. “I was blessed that some of the oldest families on Lanai took aloha for me, and taught me their language and shared their histories. It gave me my whole life,” Maly said. “I realize that we can always be cynical, and question motives,” he added. “But it’s also just a junk way to live.”
oracle  lanai  hawaii  technoutopia  aloha  pūlama 
september 2017
mysql - Using backticks around field names - Stack Overflow | https://stackoverflow.com/
It looks like backticks are used for quoting identifiers (column names) rather than string literals (stuff you'd want to save in the database).

Problem is, not ANSI-SQL compliant.
sql  mysql  syntax  dammitbrain  newbie  reference  solution 
september 2017
BashGuide/Practices - Greg's Wiki | http://mywiki.wooledge.org/
<code class="language-bash">for number in $(seq 1 10); do</code>

For the love of god and all that is holy, do not use seq to count.

Bash is able enough to do the counting for you. You do not need to spawn an external application (especially a single-platform one) to do some counting and then pass that application's output to Bash for word splitting. Learn the syntax of for already!

In general, C-style for loops are the best method for implementing a counter for ((i=1; i<=10; i++)).

If you actually wanted a stream of numbers separated by newlines as test input, consider printf '%d\n' {1..10}. You can also loop over the result of a sequence expansion if the range is constant, but the shell needs to expand the full list into memory before processing the loop body. This method can be wasteful and is less versatile than other arithmetic loops.

<code class="language-bash">i=`expr $i + 1`</code>

expr is a relic of ancient Rome. Do not wield it.

It was used in scripts written for shells with very limited capabilities. You're basically spawning a new process, calling another C program to do some math for you and return the result as a string to bash. Bash can do all this itself and so much faster, more reliably (no numbers->string->number conversions) and in all, better.

You should use this in Bash: let i++ or ((i++))

Even POSIX sh can do arithmetic: i=$(($i+1)). It only lacks the ++ operator and the ((...)) command (it has only the $((...)) substitution).
bash  shellscripting  debugging  bestpractices  reference 
september 2017
BashFAQ/053 - Greg's Wiki | http://mywiki.wooledge.org/
I have a fancy prompt with colors, and now bash doesn't seem to know how wide my terminal is. Lines wrap around incorrectly.
You must put \[ and \] around any non-printing escape sequences in your prompt. Thus:
<code class="language-bash">fancy_prompt() {
local blue=$(tput setaf 4)
local purple=$(tput setaf 5)
local reset=$(tput sgr0)
PS1="\[$blue\]\h:\[$purple\]\w\[$reset\]\\$ "
}</code>

Without the \[ \], bash will think the bytes which constitute the escape sequences for the color codes will actually take up space on the screen, so bash won't be able to know where the cursor actually is.
bash  ps1  promptstring  colors  fuckina 
september 2017
Use groff to easily create PDF pages - Mac OS X Hints | http://hints.macworld.com/
Can I make groff produce PS output with monospaced fonts?

Update (20171218): Yup. Use the "C" (Courier) font, like this:

<code class="language-bash">
# fonts are in /usr/share/groff/<ver>/font/devps
# don't put 'R' ("regular" I guess) or 'B' or 'I' on the end, just "C"
# the files can be viewed with 'less' to discern what their "proper" name is
groff -mandoc -f C -Tps $(man -w manpage) > manpage.ps
</code>

(Careful, '-l' sends it straight to the printer.)

From the comments:
As someone who has been using *roff since about 1976 (first roff, under V6 UNIX, then nroff/troff, then ditroff, then MKS/SoftQuad sqroff, then groff under BSDI and FreeBSD and now under MacOS/X), it warms my heart to see that the program continues to live on and have value.

One of the most useful features in the *roff family is the set of filters that exist for it. These are aimed at tables (tbl), equations (eqn), figures (pic), graphs (grap), and references (refer). There are also macro packages that may have value to some other than -mom and -man, such as -ms, which is probably the oldest, widely-used package, and -me, which was designed for typesetting dissertations. Finally, for those who are inclined towards programming, it can be very useful to use make(1) to manage all the pieces, filtering, and transformations in a longer groff document.

There are weaknesses with *roff in today's environment, chiefly the fact that it doesn't directly support output formats that are currently portable, such as .rtf and .pdf (you can get to .pdf from .ps as in the hint and also in various other ways, but the current .rtf translators are unacceptable). The problem is that some journals require either .doc or .rtf for manuscripts. However, there are other output formats that are supported, see groff(1).
groff  typesetting  unix  manual  manpages  mac  osx  tipsandtricks  solution  fuckina 
september 2017
bash - How to detect if my shell script is running through a pipe? - Stack Overflow | https://stackoverflow.com/
In a pure POSIX shell,

if [ -t 1 ] ; then echo terminal; else echo "not a terminal"; fi

returns "terminal", because the output is sent to your terminal, whereas

(if [ -t 1 ] ; then echo terminal; else echo "not a terminal"; fi) | cat

returns "not a terminal", because the output of the parenthetic is piped to cat.
shellscripting  bash  posix  pipes  tipsandtricks  solution 
september 2017
The magic behind configure, make, make install | https://robots.thoughtbot.com/
aclocal # Set up an m4 environment
autoconf # Generate configure from configure.ac
automake --add-missing # Generate Makefile.in from Makefile.am
./configure # Generate Makefile from Makefile.in
make distcheck # Use Makefile to build and test a tarball to distribute
automake  autotools  unix  build  toolchain  newbie  reference  solution 
september 2017
power - How to enable hibernate option in menu? [Loki] - elementary OS Stack Exchange
Is this "S3" or "S4" sleep? Anyway, this worked:
On my Dell XPS 9350, hibernate works just fine with elementary OS (via 'sudo systemctl hibernate').


whereas setting the power button to "Hibernate" didn't (on an HP EliteDesk 800 G1 SFF)
elementaryos  loki  hibernate  powermanagement  annoyance  sortof  solution 
september 2017
GitHub - zealdocs/zeal: Offline documentation browser inspired by Dash - https://github.com/
I needed these packages to build Zeal 0.4.0 an Ubuntu 16.04 system (elementaryOS Loki):

libarchive-dev libsqlite3-dev qt5-default libxcb-keysyms1-dev libqt5x11extras5-dev libqt5webkit5-dev qtbase5-dev

The 'qt5-default' may have only been required because I'd installed qmake-qt4 to build KeePassX 0.4.4 right before this.
documentation  webdevel  devel  linux  qt  qt5  build  fromsource  howto  alternativeto  dash 
september 2017
Diodon Team in Launchpad
AppIndicator support works in elementaryOS Loki. Seems to have a privacy setting to ignore input from applications like clipboard managers (seems to use Zeitgeist's settings; see https://esite.ch/2014/08/why-does-diodon-not-save-anything-to-the-clipboard-history/)

See also: https://esite.ch/tag/diodon/
vala  clipboardmanager  clipboard  history  linux  solution  utility  software 
september 2017
« earlier      later »
per page:    204080120160

Copy this bookmark:





to read