dura

0

votes
0

answer
3

views

How to set env variables to start jupyter-notebook from cmd in windows 10

I installed Jupyter under Windows 10 in cmd with 'python -m pip install jupyter' but can't call the notebook with 'jupyter notebook'. I already set env variables as follows: C:\Users...\AppData\Roaming\jupyter\runtime C:\Users...\AppData\Roaming\Python\Python37\Scripts\jupyter.exe Still doesn't work...
Dura
1

votes
1

answer
567

views

Getting nth-child of a variable full of li tags

I've got a variable, let's call it $listObjects. The data of it is as followed.... Data Here 1 Data Here 2 Data Here 3 Data Here 4 I have tried every way I can think of, and can't find out how to get the nth-child of the list tags. Is this possible? I basically want to use nth-child(3n) on the $list...
Josh Dura
1

votes
1

answer
216

views

How can min_by_key or max_by_key be used with references to a value created during iteration?

I have an iterator that maps over some values, creating tuples on the way. I need to get the maximum by one of the elements on the tuple (which is not Copy), but interior references are getting in the way (as was expected when it got stabilised). How can I make something like this work? // Not a Cop...
1

votes
3

answer
641

views

shell - faster alternative to “find”

I'm writing a shell script wich should output the oldest file in a directory. This directory is on a remote server and has (worst case) between 1000 and 1500 (temporary) files in it. I have no access to the server and I have no influence on how the files are stored. The server is connect through a s...
dura-zell
6

votes
3

answer
8.3k

views

Regular Expression for Parsing Hashtags in Java

Here is the Twitter message I am trying to parse (as you can see, some of these are not tags, just part of URLs): #anothertag Arrogance and bad PR http://www.adobe.com/index.html#anchor1. John Nack on &#Adobe: Information about Photoshop© CS3 on Snow Leopard #fail #design This regular expression...
Daniel Dura
5

votes
2

answer
7k

views

Refresh div using JQuery in Django while using the template system

I want to refresh a div tag in Django that contains temperature data. The data is fetched every 20 seconds. So far I have achieved this using these functions: function refresh() { $.ajax({ url: '{% url monitor-test %}', success: function(data) { $('#test').html(data); } }); }; $(function(){ refresh(...
dura
3

votes
1

answer
1.3k

views

Disable generation of metagen files in VS2010

When I build a C++/CLI project I get, among others, a file called 'proj.exe.metagen'. Deleting it does not impair the execution of the generated executable so I'd rather have it not generated unless there is a good reason to have it around. How can I disable generation of the metagen file?
32

votes
4

answer
6.5k

views

Ternary conditional and assignment operator precedence

I'm confused about direct assignment and ternary conditional operators precedence: #include int main(void) { int j, k; j = k = 0; (1 ? j : k) = 1; // first printf('%d %d\n', j, k); j = k = 0; 1 ? j : k = 1; // second printf('%d %d\n', j, k); return 0; } I would expect the output to be: 1 0 1 0 But i...
Jose Antonio Dura Olmos
2

votes
1

answer
75

views

Create a sequence in a complex type in XML and validate against a schema

How do I write various repetitions of the elements that are part of a sequence which is inside a complex type? I've got the following schema: Schema for Measurements data transmission I test the following XML against the previous schema: TestDoc Length false HEXADECIMAL 0 Height false DECIMAL 0 Gett...
2

votes
1

answer
2k

views

Refreshing table with Dajaxice in Django

I'm monitoring the temperature for different locations. I have the data stored in a model and have set my views.py, but I would like to refresh the table every 5 minutes. I'm new to ajax and dajaxice, how can I write the function so it displays in html? this is my views.py: def temperature(request):...
dura
6

votes
1

answer
2.3k

views

How to cause an exception on integer overflow? [duplicate]

This question already has an answer here: Throw exception on numeric overflow [duplicate] 1 answer If I divide by zero I get a java.lang.ArithmeticException, as in this example : int a = 3/0; I'd like to make it so that an integer overflow also causes an Exception. So the following program would th...
8

votes
3

answer
5.2k

views

HTTP 200 or 404 for empty list?

I know this is a fairly common question, but I haven't found an answer that satisfies me. I've been using django rest framework for a while now, but this is mostly irrelevant other than the example given. Its default behaviour is to return an HTTP 200 with an empty list resource when accessing a rou...
3

votes
1

answer
83

views

Run a repeated test reporting as different tests

I'd like to unit test a function with a set of different inputs and expected outputs. My function is irrelevant thus I'll instead use an example function which counts english words with the following candidate implementation : int countEnglishWords( const std::string& text ) { return 5; }; The follo...
4

votes
3

answer
1.4k

views

What is the advantage of using Spot Fleet Autoscaling instead of AutoScaling Groups with a Spot Price?

Recently Amazon AWS released Auto Scaling for Spot Fleets (https://aws.amazon.com/blogs/aws/new-auto-scaling-for-ec2-spot-fleets/). Auto Scaling groups already allowed you to set a Spot Price to get Spot Instances at a discount instead of Reserved Instances. As far as I could see Spot Fleets allow y...
Rubén Durá Tarí
1

votes
1

answer
725

views

Output of proc.communicate() does not format newlines in django python

I have a subprocess using communicate to get the output ans saving it to my database: p = Popen([str(pre_sync), '-avu', str(src), str(dest)], stdout=PIPE) syncoutput = p.communicate() check.log = syncoutput It all works fine, but the output from communicate looks like this: ('sending incremental fil...
dura
2

votes
1

answer
371

views

Why are Django signals removed without weak=False?

UPDATE The code posted below is perfectly fine. I just found the answer to my question: I was overwriting the handler with another one that used the same name on that module, so the weakref was being deleted... Others can use the code below to properly register signals according to the Django docume...
4

votes
3

answer
106

views

Why slowdown in this identical code?

I was trying to measure the time to execute this loop : for (boolean t : test) { if (!t) ++count; } And was getting inconsistent results. Eventually I have managed to get consistent results with the following code : public class Test { public static void main(String[] args) { int size = 100; boolean...
1

votes
0

answer
516

views

Generating NSAttributedString with NSHTMLTextDocumentType crash the app

We need to use NSHTMLTextDocumentType in a UITextView to display some rich text We implemented the new method in main thread and we are getting random errors in each run of the application. All the errors are the same kind of error, but with some small differences: Error 1: -[__NSCFString myView]:...
Dani Dura