dave dave

1

votes
1

answer
1.4k

views

plot gebco data in python basemap

I have downloaded some gebco bathymetry data as a netCDF file. I would like to plot it with python-basemap. I have tried, import netCDF4 from mpl_toolkits.basemap import Basemap # Load data dataset = netCDF4.Dataset('/home/david/Desktop/GEBCO/gebco_08_-30_45_5_65.nc') # Extract variables x = dataset...
Dave
1

votes
2

answer
1.3k

views

compareTo() method in java (Student ids)

Learning java and having trouble with the compareTo method. I tried google but it was not much help for what i need.What i need is // compareTo public int compareTo(Student other) // is defined in the Comparable Interface // and should compare the student ID's (they are positive integers). // Must...
dave
1

votes
1

answer
127

views

android Switch not toggling programmatically

I am trying to toggle a switch back to the off state programmatically, however I am running into a problem. I have tried using both myswitch.setischecked(false) and myswitch.toggle and they both leave the switch on the current state but change the background from blue to grey, so android thinks the...
dave
1

votes
1

answer
240

views

Caesar decoder in ARM Assembly

As it said in the title, my objective is to write a program in C and ARM assembly that decodes a string by shifting the byte value of each character by a certain amount. The "space" character isn't shifted, instead just copied over to the resulting string. The process ends when the null-terminator i...
Dave
1

votes
1

answer
327

views

Is possible to encode WebSocket messages?

Is possible to encode or obfuscate or something else, what Im sending via websockets? Example message: var msg = { type: "message", data: { message: "Hello world!" } } I need to send this message as unreadable and at server-side I need decode it back to readable version. I want block it from chrome...
Dave
1

votes
1

answer
356

views

Django - Private messaging conversation view

I have built a very basic private messaging module for my Django project. I have a Message model which consists of: sender (Foreign key to the member model) recipient (Foreign key to the member model) message date (Datetime of which the message was created) Now my issue is i would like to create a n...
Dave
1

votes
1

answer
885

views

PyQt: Setting focus on QlineEdit widget

I am trying to put together a simple widget where the focus is automatically put to a QLineEdit widget (It is for a barcode scanner input, and I don't want the end users to have to click in the widget). The relevant code looks like this: from qtmodern import styles, windows from qtpy import QtGui, Q...
Dave Reid
0

votes
0

answer
15

views

EF Core cannot find connection string

I have followed all the tutorials here on stack and online but still I am having issues in EF 2.1 core I am trying to view my context in a view. public List GetAllActivityHeader() { var optionsBuilder = new DbContextOptionsBuilder(); using (var db = new ActivtyTrackerDBContext(optionsBuilder.Options...
Dave
3

votes
3

answer
42

views

Declaring method return type Task<int> without async keyword

In what situation would you return a Task without using async in the method signature? I've got such a method in the below code but am having trouble understanding what's going on. Why does my example code below not execute past any of the await statements? ie. why do Console.WriteLine("4)"); and Co...
Backwards_Dave
1

votes
1

answer
422

views

Deleting Tree-Nodes in a SQL table without a cursor

I have a tree of strings stored in a sql table, this is the definition for the table. CREATE TABLE [FileTree] ( [ID] INT NOT NULL, [Name] VARCHAR (MAX) NOT NULL, [ParentID] INT NULL, [UserID] VARCHAR (MAX) NOT NULL ); And I have a recursive delete procedure for delet...
Dave Demirkhanyan
0

votes
2

answer
20

views

Does anyone know how you can add a Title to a .csv file with Oracle?

I have some .csv files I'm outputting to email for reporting purposes. I'm happy with that. BUT, I want to make the reports a bit more readable by adding a "Title" This is just an example of the column structure currently... i'd like to add something before all this that has "Title" create or replac...
Dave
0

votes
0

answer
4

views

How to reboot from SDCARD from command line with S5P6818 based board?

Is it possible to boot Android Linux from the command line so that it loads from the SDCARD instead of the eMMC? I have uploaded the new firmware to the SDCARD and need to reboot the board so that it loads from the SDCARD and then installs the software. Normally I would do this by holding down the B...
Dave McLaughlin
1

votes
1

answer
41

views

How to allow space in function parameter?

How can the following code work correctly for each of the parameters to equal true when there is a white space between two words with the following line? custom = detector.CustomObjects(cell phone=True, car=True) This is from the ImageAI library and below is the example: """ There are 80 possible o...
Dave
0

votes
0

answer
3

views

What is the Firebase RefBuilder.onOperation<T> method?

I am wondering what the onOperation method of functions.database.RefBuilder is for as I can not find any information about it in the documentation.
Dave
0

votes
0

answer
6

views

Citrix MDX Toolkit and Android ConstraintLayout

I have an corporate app that I usually wrap for SecureHub distribution using the MDX Toolkit. Recently I changed one of my layouts to use a ConstraintLayout instead of another RelativeLayout inside the ScrollView. The layout hierarchy is as follows: ...some stuff.. .... more Stuff The app is success...
Dave
2

votes
1

answer
96

views

sparklyr - Including null values in an Apache Spark Join

The question Including null values in an Apache Spark Join has answers for Scala, PySpark and SparkR, but not for sparklyr. I've been unable to figure out how to have inner_join in sparklyr treat null values in a join column as equal. Does anyone know how this can be done in sparklyr?
Dave Kincaid
1

votes
1

answer
5.7k

views

How can I get the path to a file in Windows 10?

I frequently need to copy the file path of an object in Windows, so that I can paste it into a tool like the command line or Powershell. How can I quickly do this, without having to go to an object's properties and copying the path from there?
Dave Voyles - MSFT
1

votes
1

answer
548

views

HttpRequestMessage.CreateErrorResponse() Doesn't Exist

I was just reading about web API model validation and it has this example, however the example code provided below won't compile because CreateErrorResponse() doesn't exist in HttpRequestMessage. Does anyone know why? public class ValidateModelAttribute : ActionFilterAttribute { public override void...
Backwards_Dave
2

votes
0

answer
11

views

Read requests per 100 seconds per user - not affecting Firebase Functions

I am trying to limit number of function invocations per user for Firebase Cloud Functions in the Google Cloud Platform. I am not sure if I understand what the Read requests per 100 seconds per user setting is as I have changed it down to 1 from 500 and a user can still make as many calls as he/she w...
Dave
1

votes
3

answer
4.7k

views

How to handle cookie expiration in asp.net core

I would like to know how to properly handle the fact that the cookie expired? Is it possible to execute a custom action ? What I would like to achieve is that when the cookie is expired is to take few informations out of the current cookie at redirect to a action parametrise by this information. Is...
Dave
1

votes
1

answer
287

views

How to extract a parameter from a URL using a regex pattern

I’m having trouble with a matching expression. I want to extract the "code" parameter from a link I extracted using Nokogiri, so I tried: event_id = a.attr("href").match(/\?code=(\d+)/)[1] Unfortunately what is extracted is the entire query string: ?code=768140119 What is the proper way to just...
Dave
1

votes
2

answer
3.9k

views

Convert blob to image file

I am trying to convert an image file captured from an input type=file element without success. Below is my javascript code var img = document.getElementById('myimage'); var file = document.querySelector('input[type=file]').files[0]; var reader = new FileReader(); reader.addEventListener("load", fun...
Dave
1

votes
1

answer
2.9k

views

best place to fetch data before rendering in react

I would like to know where I should fetch my data in the react life cycle. I tried to put my data in the the componentDidMount()and componenWillMount() but without succes... componentWillMount(){ // this fetch the data from back-end set a store state with the payload this.props.fetchUser(); this.se...
Dave_888
1

votes
1

answer
41

views

Most optimal gremlin query for getting all related vertices

I need to get all the vertices related by any number of relationships to the starting vertex. I have a working query, but it starts to slow significantly after a few hundred edges and the complexity of the graph. Is there any more efficient way of getting the related vertices? g.V(id) .emit() .repea...
Dave Zabriskie
1

votes
1

answer
30

views

How to disable libx264 stderr output?

I'm writing a library that uses the ffmpeg library interface (libavcodec, libavformat, libavutil, etc.) to manipulate some video. Part of this involves some encoding for which I'm using libx264. Everything works great but libx264 writes output to stderr, for example: [libx264 @ 0x62cbc0] using cpu c...
Dave
1

votes
2

answer
74

views

Dynamic Type in TypeScript

How can I dynamically assign a type to a generic class based on the type variable's property? For example interface EntityErrors { [p in keyof T]?: string; // How can I make "string" dynamic? It needs to be a string for primitives (id, name), and an array of strings for the `teachers` array. // I'...
Dave
1

votes
2

answer
55

views

How can I create a table with a unique name and then insert data from another table into that table, preferably using a single trigger

I want to have an empty table, when someone inserts data into it, I then want that table to be immediately copied to a unique table name and then the original table truncated in readiness for the same thing to happen again. I've tried doing this with a trigger that then executes a procedure, and I'v...
Dave
1

votes
1

answer
28

views

How to deploy templates to different schema databases?

I have staging and final databases, both currently sharing a schemas database. We're using TDE, where some templates apply to staging and some to final. Can ml-gradle deploy some templates to one schemas database and others to a second?
Dave Cassel
1

votes
1

answer
42

views

How do I do date math in a Django ORM query?

I'm using Django with Python 3.7. I have teh below model ... class Article(models.Model): ... title = models.TextField(null=False) created_on = models.DateTimeField(default=datetime.now) I would like to write a Django ORM query where I find all articles that are older than 5 minutes. But I'm not s...
Dave
1

votes
2

answer
46

views

How do I write a Django ORM query for the reverse relationship in a one-to-many relationship?

I'm using Django and Python 3.7. I have the following two models in my models.py file ... class Article(models.Model): created_on = models.DateTimeField(default=datetime.now) ... class ArticleStat(models.Model): article = models.ForeignKey(Article, on_delete=models.CASCADE, ) elapsed_time_in_second...
Dave
1

votes
3

answer
7.5k

views

Using .bind (mootools) with onClick event

I have the code (inside one object) onclick: this._addX.bind(this) and then inside another object onclick: this._addY.bind(this) Now, _addX() and _addY are nearly identical, except they both end up calling (on the click event) a function with different argument values, say _addX calls foo('x') and _...
Dave
1

votes
2

answer
1.6k

views

Intercept close button in Qt console app

I am writing a console server in Qt. I have to run a function when the app is closing however I tried connection to QCoreApplication's aboutToQuit signal but it doesn't get emitted when I press the x on the top of the console. What is a good multiplatform way to run a function just as the console ap...
Dave
0

votes
2

answer
18

views

Using print with open=

I'm trying to print the below code to a file. Looking through stack overflow I found the file=open code but it does not seem to be writing to a file. PS. I haven't created the file yet print("Average Grade " + str(average), "At least 70% " + str(Grade1), "60% - 69% " + str(Grade2), "50% - 59% " +...
Dave Irwin
1

votes
2

answer
1.3k

views

What is the recommended way to initialise a MongoDB database and user for a Sails.js application?

I am exploring writing a Sails.js application that talks to a mongodb data store. I've got it all working just fine but I'd like to be able to add some sort of initialisation process that runs at the npm install point that runs analogously to rake admin:create in the Rails world. I'm guessing that...
Dave Sag
1

votes
4

answer
237

views

How do I inspect this element or find this Javascript code?

On this page: http://www.sysaway.com/account/login if you type in some garbage into the email address and click 'Login' you see the following message: I'm trying to find the code responsible for that little popup window with the exclamation mark and the error message (I need to translate it using Ja...
Dave Hilditch
12

votes
2

answer
597

views

Template (.tpp) file include guards

When writing templated classes, I like to move the implementation into a different file (myclass.tpp) and include it at the bottom of the main header (myclass.hpp). My Question is: do I need include guards in the .tpp file or is it sufficient to have them in the .hpp file? Example code: myclass.hpp...
dave
0

votes
1

answer
13

views

jQuery toggle resetting immediately after complete

I have some elements I want to automatically hide (display: none) when the page is small, and automatically show (display: block) when the page is large. I have this working with bootstrap4, and it looks like this: Categories However, I'd also like users to be able to reopen the list when it's hidd...
Dave
1

votes
1

answer
592

views

Is using MVC WebGrid Bad Practice

A junior developer on my team just created a screen using an MVC Helper called WebGrid. My first reaction was a classic NO! to anything that sounded like Grid / bound tech. As he demo'd the functionality, it wasn't bad, though it did use ?sort=Title type of syntax which bothers me generally. He als...
Dave Alperovich
1

votes
3

answer
120

views

Div that fills width of screen inside Centered Div

Is this possible? I have Div2 specifically positioned inside Div1. The only thing now is I would like Div2 to span the width of the entire screen, instead of just spanning the width of Div1. |----------------------------------------------------------| | Browser...
Dave
1

votes
3

answer
3k

views

Setting the default JFileChooser directory to a relative path from JAR location

Just a quick summary of what I'm hoping to do: I currently have a Swing application on a shared folder in my home network (personal use only, so convenience trumps best practices in this case). This application is a map editor, which I use from a couple different computers in the house, and would a...
Dave H

View additional