Calaf

1

votes
3

answer
495

views

How can I upgrade pip inside a venv inside a Dockerfile?

While running $ sudo docker build -t myproj:tag . I am hit with the message You are using pip version 10.0.1, however version 18.0 is available. You should consider upgrading via the 'pip install --upgrade pip' command. and given recent occasional subtleties manifesting themselves with the error: '/...
Calaf
1

votes
1

answer
82

views

What is the difference between the commands `aws elasticbeanstalk` and `eb`?

The two commands aws elasticbeanstalk and eb appear to be alternative ways of doing the same things. They appear to have slightly different syntax, for example aws elasticbeanstalk create-environment but eb create. And yet the output of the help pages (aws elasticbeanstalk create-environment help an...
Calaf
1

votes
2

answer
36

views

Does Docker's EXPOSE not breach the supposed sandboxing?

I am missing a piece of the puzzle. Running a docker image (say on a Linux EC2 instance) through > sudo docker run -p 80:xyzw webapp_image:version makes the container reachable at port 80, which means (via EXPOSE xyzw in the Dockerfile) that the container has affected its host. Does that not contrad...
Calaf
1

votes
1

answer
47

views

Intentionally bringing flask down

To practice using supervisor keeping a flask server alive, I insert a sys.exit(): import sys from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): sys.exit() return 'Hello, World!' if __name__ == '__main__': app.run() Launching in either development through flask run or in...
Calaf
1

votes
1

answer
535

views

Alignment of P, UL, and TABLE using CSS 'padding-left' on any browser

In the html (with embedded css) below, the Ls, the Ts, and the Cs in 'Line', 'Title', and 'Cell' are aligned when displayed with Google Chrome, with Firefox, and with Safari. They are not aligned when displayed with Internet Explorer. On IE the Ts are indented farther than the rest. How can I modify...
Calaf
1

votes
1

answer
215

views

How can I avoid the offer to send a report to Apple when an assertion in my own unit-tests fails?

I frequently write programs consisting of nothing but assertions to test my code. While debugging, OSX tries to be helpful by asking whether I would like to 'Click Report to see more detailed information and send a report to Apple' whenever an assertion fails. Is there a way to disable this feature...
Calaf
1

votes
1

answer
97

views

Assignment operator on only one of two parents

Child has two parents: Foo and Bar. Foo does not allow copying. Bar does. How can Child use Bar's assignment operator to copy into Bar's subset of Child (while leaving Foo's subset intact)? To be more concrete: in the code below, how can Child refer to just Bar inside replace_bar()? (How would you m...
Calaf
1

votes
1

answer
279

views

Identifying the error in using a View constructor missing AttributeSet

As a beginning Android programmer who is not a beginning programmer, I am alarmed by the amount of time it took me until I realized that the crash was resulting from omitting to use the constructor taking AttributeSet as a second parameter and writing instead the following code for a custom view def...
Calaf
1

votes
1

answer
152

views

Keyboard scrolling with acceleration

One can easily map some key to scroll up. (defun up1() (interactive) (scroll-up 1)) (defun up2() (interactive) (scroll-up 2)) (global-set-key '\M-]' 'up2) I am looking instead for the following behavior. The first handful of scrolls would call up1() and the subsequent ones would call up2().
Calaf
1

votes
3

answer
420

views

Persistent colors in an emacs text buffer

After highlighting text in an emacs buffer using a regexp (1), it's easy enough to write the setting in the file (2), but I am missing a third step for persistence. (1) Set Doing M-s h r (highlight-regexp) and, say, \{.*\} followed by italic will highlight everything between curly braces in that sty...
Calaf
1

votes
2

answer
758

views

Access permissions during android file sharing

Why is it sufficient to openFileOutput() a file with mode MODE_WORLD_READABLE (as the manual says) to make a file readable by other apps (via a share Intent)? Even if the file is readable, doesn't the directory remain private (rwx------ rather than rwxrwxrwx)?
Calaf
1

votes
1

answer
477

views

Fitting images by specifying the new aspect ratio

Can ImageMagick's convert append white or black bars to maintain aspect ratio after specifying just the aspect ratio? More concretely Suppose I have a 2000x1000 widescope image and I would like to compute a new image that has an aspect ratio of 4:3 to fit, say a TV. I can do convert input.png -backg...
Calaf
1

votes
1

answer
83

views

One compile command per buffer, not directory

I am often editing foo.cpp and bar.cpp (or foo.tex and bar.tex) in one directory. During these edit sessions, I run make foo and make bar many times. At some point with Emacs 23, I needed to type make foo and make bar just once on the respective buffer. Any subsequent invocation of the compile comma...
Calaf
1

votes
1

answer
172

views

Scale the font size for an Emacs frame without changing the frame's dimensions

As this question illustrates, it is possible to increase the font size in an emacs frame, not just a buffer. Unfortunately, the solutions there also increase the size of the frame itself. Consider the following use case. A few people are sitting side-by-side. Once in a while, two or more get togethe...
Calaf
1

votes
3

answer
46

views

How can I debug my JavaScript code—in 2015?

This question was answered in 2009 by suggesting Firebug. But the 'Current stable: 2.0.7' 'Firebug for Firefox' is 'Compatible with: Firefox 30-37', and Firefox on OS X is at 40.0. Is the answer to this question in late 2015 still Firebug? Update: For the sake of desktop developers, if you're an exp...
Calaf
1

votes
1

answer
525

views

Labeling nodes in a networkx graph when nodes are objects

It's easy to label the nodes of a graph using networkx import networkx as nx import matplotlib.pyplot as plt G1 = nx.Graph() a = 'A' b = 'B' G1.add_nodes_from([a, b]) G1.add_edge(a, b) nx.draw_networkx(G1) # default with_labels=True plt.show() If the nodes are objects rather than strings, I understa...
Calaf
1

votes
2

answer
37

views

How can I avoid explicit decoding of content?

I understand that .encode('utf-8') is necessary. # -*- coding: utf-8 -*- import urllib2 url = u'https://fr.wikipedia.org/wiki/Nîmes' response = urllib2.urlopen(url.encode('utf-8')) content = response.read().decode('utf-8') print type(content) But how do I avoid the .decode('utf-8')? After all, the...
Calaf
1

votes
1

answer
53

views

Implementing an image viewer using CSS

The following code (jsfiddle) implements an image viewer in CSS Trains, Planes, Automobiles, and Boats html, body { background:#ddd; margin:0; padding:0; height:100%; } #foo { position:absolute; left:5%; width:60%; top:5%; height:80%; background:#dcc; } #bar { position:absolute; left:70%; width:25%;...
Calaf
1

votes
1

answer
156

views

How do I access a resource file in Xcode?

To access the resource file namefile from a program: I ostensibly just need to check the box 'target membership' to identify it as a resource file: but this box is disabled. What am I missing?
Calaf
1

votes
1

answer
123

views

Strikethrough in Emacs image mode

With a .emacs loading iimage-mode and adoc-mode: ;; Don't glare 200W in my eyes all day: (set-foreground-color 'white') (set-background-color 'black') ;; Use adoc as major mode for any file with the extension .adoc. (require 'adoc-mode) (setq auto-mode-alist (cons '('\\.adoc\\'' . adoc-mode) auto-mo...
Calaf
1

votes
2

answer
160

views

Are “Database URL” and “Database Instance” the same id?

While following this tutorial for deploying a simple Flask app to AWS RDS and ElasticBeanstalk, I am running into the error sqlalchemy.exc.OperationalError: (OperationalError) (2003, 'Can\'t connect to MySQL server on \'flasktest.kedfifydb8esbdk.us-east-1.rds.amazonaws.com\' ((1049, u'Unknown databa...
Calaf
1

votes
2

answer
104

views

How do I send an email through SES with temporary SES-specific credentials?

This page shows how to send an email using SES. The example works by reading the credentials from ~/.aws/credentials, which are the root (yet 'shared'??) credentials. The documentation advises in various places against using the root credentials. Acquiring temporary credentials using roles is menti...
Calaf
1

votes
1

answer
0

views

Does Flask-Login's `remember_me` override Flask's `permanent`?

Remember-me is a parameter flask_login.login_user(user, remember=False, duration=None, force=False, fresh=True) to login_user in Flask-Login. It makes it possible 'to remember the user after their session expires.' And yet with just Flask (and not Flask-Login) 'PERMANENT_SESSION_LIFETIME': datetime....
Calaf
1

votes
2

answer
0

views

a:hover affects text hyperlinks, but not img hyperlinks

My html file has something like and my css file has body { background: #FFF; } a:hover { background: #ABB; } img { background: #FFF; } This works fine for text hyperlinks. When hovering over a text hyperlink, the background color changes from FFF to ABB. But in this case the img is also a hyperlink,...
Calaf
1

votes
2

answer
64

views

Repeating TABs on subsequent lines in text files (but keeping TABs disabled for code)

I am editing a text file foo.txt using emacs. I press C-q TAB to insert a TAB character at the beginning of a line and then follow with a few characters. Once I press ENTER, emacs inserts eight spaces on the following line. How do I specify in my .emacs that I would like TABs to be repeated on subse...
Calaf
1

votes
1

answer
62

views

How to prevent substitution with two instances of C++ in an asciidoctor sentence?

If C++ appears just once in a sentence, asciidoctor parses the string just fine. If C++ appears twice, asciidoctor matches across bar in the example below. Various attempts at preventing substitutions do not work. How can one typeset C++ two or more times in a sentence using asciidoctor? . foo C++ ....
Calaf
1

votes
1

answer
66

views

Can sets in redis be deterministic?

I'm trying to get the best of both worlds. Using redis sets as well as having determinism. Is this possible? I'm storing a set using the usual commands: SADD myset 'foo' SADD myset 'bar' But then if I request an element to process SRANDMEMBER myset I'd like the element that is returned to be determi...
Calaf
1

votes
2

answer
1.1k

views

Incorrect canvas width value

So I thought that the code Log Canvas Width #canvas { background: #888888; width: 600px; height: 600px; } function draw() { var canvas = document.getElementById('canvas'), context = canvas.getContext('2d'); document.write(canvas.width); } Canvas not supported prints 300 rather than 600 because make...
Calaf
1

votes
1

answer
22

views

Why are (many) IAM perpetual identities any safer than the root identity?

The AWS documentation 'recommend[s] that you delete your root user access keys', and to 'not use the AWS account root user for your everyday tasks', because '[a]nyone who has the access key for your AWS account root user has unrestricted access to all the resources in your account.' But then an aut...
Calaf
0

votes
0

answer
3

views

Peak Analysis and Shirley background subtraction from Apache WeightedObservedPoints series

I've a list of XRD observations (around 4000 points) that I can convert in a function with a Fitting operation in Apache and I want to determinate the area under the peaks, as you can see in this picture: I want to calculate the gray area, so I can't integrate from a point to another. I have to det...
Calaf
1

votes
2

answer
81

views

Is there some weakness to the simpler approach of calling Activity.method() from DialogFragment, rather than setting up a listener?

After the user requests to delete a file (through a context menu), a DialogFragment is triggered to ask the user to confirm. If the user does confirm, the file is deleted by the calling Activity. There are at least two ways for doing this. The DialogFragment calls deleteFile(), a method in the Activ...
Calaf
1

votes
1

answer
868

views

How to include code excerpts using tags in asciidoc?

I can include the full Greet.java file public class Greet { public static void main(String[] args) { System.out.println('Hello World!'); } } from within the asciidoc file == Hello Java This is how one greets in Java: [source,java] .Greet.java ---- include::Greet.java ---- producing the documentation...
Calaf
1

votes
2

answer
66

views

Increased understanding of Unicode in Python (2.7)

I'm observing that in the program # -*- coding: utf-8 -*- words = ['artists', 'Künstler', '艺术家', 'Митець'] for word in words: print word, type(word) it is not absolutely necessary to fully qualify the strings as unicode strings: words = ['artist', u'Künstler', u'艺术家', u'Мите...
Calaf
2

votes
3

answer
5.3k

views

Placing two “float:right” images above one another

When I use text... with image1.svg containing and image2.svg the two SVG images are placed side-by-side despite the . Replacing these with does not help. How do I force the two images to be placed above one another? Needless to say, I would like to avoid building a composition of the two images.
Calaf
5

votes
0

answer
30

views

Git: How can I determine the filename where a given identifier was added or removed?

I find out that a certain CSS class .razmatazz is used in an HTML file, but this identifier is not in any of the present CSS files. That explains the incorrect presentation, which I've been 'kicking forward' for some time. I can find all the commits in which this identifier was either added or delet...
Calaf
1

votes
1

answer
977

views

Disable help when mouse hovers on modeline

When the mouse hovers on the modeline, a few lines of help appear (depending on the context). How do I disable this help? I would like to do so because (at least for Emacs 23 on OS X Lion), the help does not go away if I switch to another program without moving the mouse.
Calaf
18

votes
4

answer
2.7k

views

Inverse of M-q, an unfill-paragraph-function

Is there an inverse for M-q, some kind of unfill-paragraph-function? If I have undo data, then it's of course easy. What I am asking for is instead the ability to merge lines in a paragraph into a single long line, right after I have just read the file from disk. This would make it possible to then...
Calaf
1

votes
2

answer
3.6k

views

Simulating C++-typedefs in Java

Can typedef FooBar Bar; and the access to the type FooBar through the expression Foo::Bar in the code #include #include class FooBar {}; class FooBat {}; class Foo { public: typedef FooBar Bar; typedef FooBat Bat; }; int main() { if( typeid(Foo::Bar) == typeid(FooBar) && typeid(Foo::Bat) == typei...
Calaf
4

votes
1

answer
690

views

Emacs Scrolling Bug on OS X

Update This problem disappeared after upgrading from Mountain Lion to Mavericks, while also updating Emacs from 23.4 to 24.3. End-update With a .emacs file containing (set-foreground-color 'white') (set-background-color 'black') (setq mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control) . nil))) (...
Calaf
4

votes
2

answer
177

views

Centering RadioButton Views

The layout file results in the two RadioButtons splitting the horizontal space equally. That is good, but rather than having them flush to the left, I would like them to be centered. Why is android:gravity='center' not giving this effect? I have tried this question earlier with CheckBoxes, but the r...
Calaf

View additional