paul paul

13806 questions
1

votes
1

answer
101

views

Importing lists from another file

Currently I am programming something that uses lists. These lists are quite large and I was wondering if I can put them in a separate python file. Then import them. For example List1 = [] List1.append("Blah") List1.append("Blah1") List1.append("Blah2") List1.append("Blah3") I'd like to have that lis...
7

votes
1

answer
52

views

Why is fancy assignment slower than fancy lookup?

I'm currently trying to get a better understanding of memory related performance issues. I read somewhere that memory locality is more important for reading than for writing, because in the former case the CPU has to actually wait for the data whereas in the latter case it can just ship them out and...
Paul Panzer
1

votes
2

answer
977

views

Cannot close xe:dialog on XPages with client side validation

I have an xe:dialog which includes Dojo Form controls to input several values and create a new document when saved. All values are required and I an using a combination of xe:djValidationTextBox, xe:djTimeTextBox, xe:djComboBox and others to input the values and perform the client-side validation....
1

votes
1

answer
138

views

Handle blockwise writing to a file in C

I'm currently on a project what has to handle writing of large number of bytes to a file. I use the low-level C function write(int, const void *, size_t). To handle lots of bytes at once, I split the data into blocks of the block size that's given by the system: struct stat b_stat; stat("/", &b_stat...
Paul Warkentin
1

votes
2

answer
3.5k

views

How to find the most frequently repeated number in Array?

I know there are similar questions like this one. But here's a trick. Let's assume that we have this array: int[] list = {1, 2, 3, 1, 0, 0, 0, 5, 6, 1569, 1, 2, 3, 2, 1569, 3}; System.out.println("Most repeated value is: " + ???); /* Now As you can see 0's, 1's, 2's and 3's has the same frequenc...
Les Paul
1

votes
1

answer
1.5k

views

PDO SQLite cannot update record: “database is locked”

I'm struggling with this all day. I've read numerous posts, tried all suggestions but nothing works. This is my PHP code: try { $db = new PDO('sqlite:test.db'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $result = $db->query('SELECT * FROM v_test'); foreach ($result as $row) { ech...
Paul Meems
1

votes
2

answer
737

views

Is there a library function to check if a MAC address is multicast?

I know that I can use the netaddr module to check if an IP address is multicast like so: netaddr.IPAddress("192.168.1.1").is_multicast() Before I go ahead and write my own, is there a comparable function for the various formats of MAC addresses? For instance: 0123.4567.89ab
Paul
1

votes
2

answer
37

views

jQuery disabling a function

On my website I use Bootstrap and have a navigation menu with a dropdown. Now I added some JS code to have the dropdown menu open on hover. $(function() { $("li.dropdown").hover( function(){ $(this).addClass('open') }, function(){ $(this).removeClass('open') } ); }); }, I also use enquire to on...
Paul
1

votes
2

answer
1.1k

views

Dynamic property name concatenation

I'm looking for an easy way to assign to a variable depending on the value of another variable. device.slot2_clipList[clipNumber] = singleClipDetails; what I'm trying to do is: replace the "2" with another variable, so that i can run the same operation while just changing the var slotNumber, and wri...
Paul Schneider
1

votes
1

answer
1.5k

views

Send listboxfor to controller

I have a form in my view that contains a listbox. The user adds values to the listbox. When the user pushes the 'submit' button I want all the values in the listbox to be placed in my models property that is a List. Here is the Listbox in my view: @Html.ListBoxFor(m => m.Ingredients, new List(), new...
0

votes
1

answer
27

views

Giving eval the correct context

In Angular my eval() is not working in the correct context. I just want to test it with something simple like eval('console.log(this.sharedservice.var1)'); but says Cannot read property 'sharedservice' of undefined, so it doesn't know what this is. When I try to do (0, eval)(script); which solves th...
Paul Kruger
0

votes
0

answer
3

views

Styling an TCustomControl descendant results in gray background labels

In a following control I use TLabel as up and down buttons. When I choose "Cobalt XEMedia" as a default project style, these labels are drawn with a gray background. "Windows", "Cobalt XEMedia" and "Obsidian": Please help to draw the background of the label with the same color as the form, as depict...
Paul
1

votes
1

answer
99

views

What does the exception “ArgumentError: a promise has already been chained” mean, and how do I debug it?

I'm going a little nuts working with Volt at the moment. The moment I try to do something a bit more complicated I end up getting the exception "ArgumentError: a promise has already been chained" in the browser console. The stack trace doesn't point to anything I can interpret as useful. That does t...
Paul Leader
-1

votes
5

answer
25

views

Add dictionary values stored in variable to the list python3

I am new to python. I want to add the dictionary (keys and values) to the list continuously. The list already contains some dictionary values. It should be added next to it. Any suggestions please... Here's the code: from datetime import datetime fields = {'a': 'steven', 'b': 'kumar'} timestamp = da...
Paul Steven
13

votes
4

answer
799

views

Is there an elegant way to convert a Map<P, Optional<Q>> to a sparse Map<P, Q>?

Is there an elegant way to convert a Map to a sparse Map ? This should work, but it's a bit meh: Map map = ...; Map map2 = map.entrySet() .stream().filter(e -> e.getValue().isPresent()) .collect(Collectors.toMap(e -> e.getKey(), e->e.getValue().get()));
Paul Janssens
0

votes
0

answer
5

views

How to change multiple file names in the same format with git on Windows 10?

I have hundreds of files called tutorial_xx.cpp, where xx is a number from 1 to 99. I reached the three-digit mark, and now I have to change all the file numbers so that I can keep track of chronological order. I was thinking that, if I can add a 0 between tutorial_ and xx.cpp I could achieve this,...
K. Paul
0

votes
0

answer
20

views

Add custom fields to JSON file based on user input from YAML file - Python3

I am new to Python. I am having the one YAML file and I am accessing it with a Python file. In YAML file, there is fields option. In YAML file, User can set variables with values. The Python file reads the variables with values and then adds it to the JSON file. Note that the variables and values ca...
Paul Steven
1

votes
1

answer
1.7k

views

SphinxQL MATCH - how to use?

Explain to me please, what's the MATCH() operator in SphinxQL - how to use it? Sorry if my question is stupid for somebody, but I really couldn't find any normal explanation in the Web of this. For example, I have this request: SELECT tid FROM message WHERE MATCH('test'); What does it mean? Thanks.
Paul Basenko
1

votes
1

answer
52

views

How to pass canvas to pdf without deforming

I'm working with react and openlayers, a framework for maps of different types (vectors, wms, etc). The problem I have is that with my code to capture the canvas and pass it to pdf (through the library jsPDF) the image shown in the pdf is shown deformed, stretched ... that is, the same dimensions an...
Javi Les Paul
-2

votes
1

answer
25

views

Computer-Specific NullReferenceException when Instantiating Object EliteDangerousAPI [duplicate]

This question already has an answer here: What is a NullReferenceException, and how do I fix it? 31 answers I'm attempting to use the API provided by https://github.com/EliteAPI/EliteAPI, and have created a simple application as per the example provided on . This was working exactly as expected yes...
Paul Draper
1

votes
1

answer
29

views

await queue.put(item) onto a asyncio.Queue does not seem to release control of the event loop

In this simple producer/consumer example it is as if the await queue.put(item) does not release the event loop to allow the consumer to run until it finished. This results in the producer putting all it's items onto the queue and only then the consumer gets to take them off. Is that expected? I get...
Paul O
0

votes
1

answer
13

views

Is there an efficient way to count dots in cells?

I have graphs of sets of points like:- There are up to 1 million points on each graph. You can see that the points are scattered over a grid of cells, each sized 200 x 100 units. So there are 35 cells shown. Is there an efficient way to count how many points there are in each cell? The brute force a...
Paul Uszak
1

votes
1

answer
16

views

TypeError: a bytes-like object is required, not 'int' python3

I am writing a contents to JSON file. It works great in Python2 . But it fails in Python3 due to the introduction of Bytes concept. So to make it work, i converted str to bytes and converted successfully. After that, i checked the type and it was in bytes. Now python3 shows me a error again even it...
Paul Steven
1

votes
0

answer
16

views

Flutter --launch hangs now when it used to work. How to delete the device and re-create?

It's worked for a few months, but flutter emulator --launch My_Device_Name no longer completes. It just hangs on on a white background with a circular google-esque busy pointer (and no words). Obviously I need to flutter emulator --delete My_Device_Name then My_Device_Name emulator --create --name M...
paul_h
1

votes
3

answer
271

views

Clicking a node in the Sitecore tree makes all other nodes disappear

I'm encountered a weird issue with new Sitecore user accounts. I set their permissions correctly, giving them access to read, write, create, etc the content items/folders they need and the Media Library. When they user logs in and clicks any of the 5 nodes in the tree (or their children) the Sitecor...
Paul
1

votes
1

answer
309

views

Default service descriptions can not be modified as part of upgrade set EnableDefaultServicesUpgrade to true

I am trying to upgrade my Service Fabric application via Visual Studio. I ended up having to use the diff package approach to ensure that only the services I change are in the upgrade. I did this via a command file which removed the non-required files. Now I have walked into another error which is a...
Paul
0

votes
0

answer
6

views

Page.ClientScript.RegisterStartupScript alert with html format

i'm trying to give some sort of notification on an asp.net webpage. i thought Page.ClientScript.RegisterStartupScript alert('...') would fit i found dozens of ways to implement it and give simple messages back Page.ClientScript.RegisterStartupScript(this.GetType(), "scriptkey", "alert('" + "text...
Paul Pascher
1

votes
2

answer
137

views

Array Splice always delete an item from last?

I am facing a problem in deleting item from an array. Array splice supposed to work but its not working like I want. Its always delete the item from last. I am using Vue.js . I am pushing item dynamically to an array. But after click remove its delete from the last. why I am facing this. I am attach...
Kapil Paul
1

votes
1

answer
53

views

Service Fabric Application with Entity Framework?

I started learning Service Fabric applications, and little confused about stateful Reliable Services. In stateful Reliable Services state means the data to be stored in the tables in our normal database applications or something else? Is it possible to use EF with stateful Reliable Services ? How...
Jo Paul
1

votes
1

answer
23

views

IDbConnection.BeginTransaction on GUI thread, using async/await, causing dead-lock with multiple calls

I'm having an issue, which I fully understand, but am struggling to solve. I have an event loop that uses async/await. I use async/await on all database operations, with continuations all landing all the same single thread that is running the event loop. I also need to use transactions, which during...
Paul Knopf
1

votes
3

answer
40

views

How to pick specific columns Pandas dataframe when checking against NaN

I have a pandas dataframe in Python that looks something like AccountID_x AccountId AmountCD_x AmountDOC_x AmountDoc_x 1 NaN 4001001copa 52.53 52.53 NaN 2 NaN 4001001copa 52.53 52.53 NaN 3 4001001copa...
Paul Cavacas
1

votes
3

answer
1.1k

views

latitude & longitude as coordinates adequate for point in polygon algorithm

Given a database of long/lat coordinates representing targets and a series of lat/long representing the bounding coordinates of polygons representing "zones". Using a simple ray casting algorithm is it safe to treat the lat/long as cartesian coordinates for determining if the target is within the zo...
Paul Alexander
1

votes
0

answer
8

views

Problems with ThreadPool.apply_async() inside docker container

I have a class that performs a multi-threaded copy and MD5 checksum hash. The general flow for a single file copy goes like this: load the read buffer, start the loop copy the read buffer to the destination buffer start a new thread to read the next block of data start a new thread to hash the bytes...
Paul Jacobs
-1

votes
4

answer
37

views

fit “break IF condition” statement into one line

I want to write a statement that breaks out of a for-loop if a certain condition is fulfilled, but in one line. I know that this works: for val in "string": if val == "i": break print(val) and I know that this works: value_when_true if condition else value_when_false but when I run this piece of cod...
Dominique Paul
1

votes
1

answer
730

views

Default value for AngularJS ng-style

I must be missing something with the syntax, but how can I have a default background color if the scope variable is unpopulated? The following doesn't work for me: ng-style="{('backgroundColor':button.color || '#FF6600')}" However, this syntax works elsewhere: {{button.label || 'Some Text'}} What...
Paul Erdos
-1

votes
0

answer
16

views

how to get ubuntu machine id using python

I want the get the machine id from my system by using python code. My machine id is stored in "/var/lib/dbus/machine-id" . The machine id was "556b837c93cd4b8dbd3a1c01f468d9f5" How to get the number from the file and assign it to a variable using python. Any code suggestions..
Paul Steven
0

votes
2

answer
34

views

How to iterate through a list and use .isdigit to verify if a list of strings is made up of only digits or not

Write a function that takes, as an argument, a list, identified by the variable aList. If the list only contains elements containing digits (either as strings as integers), return the string formed by concatenating all of the elements in the list (see the example that follows). Otherwise, return a s...
Paul D
1

votes
3

answer
5.2k

views

How to override parent containers width property in CSS [duplicate]

This question already has an answer here: Is there are way to make a child DIV's width wider than the parent DIV using CSS? 12 answers I am having trouble overriding the parent's width within my CSS. Essentially, I have a parent and a child div like: .parent{ width: 768px; background-color: red...
William Paul
1

votes
2

answer
574

views

How do i notify a chef execute resource that require a parameter

I am trying to notify the below execute resource from within a remote_file resource and need to pass application name. How do i do it? execute "rm -rf /opt/app/#{application['name']}.zip" do action: nothing end
Basil Paul
0

votes
3

answer
21

views

SQL count from 2 tables with true/false

I have 2 tables: Table1: Key,Brand,Type,European,RefNr Table2: Key,Owner,Address,RefNr The RefNr in both tables is the unique identifier and European in Table1 is a True/False field. My question is how do I do a count of all owners with an European car?
Paul Zelluf

View additional