Bort

1

votes
1

answer
37

views

Determining which monitor the cursor is in via AutoHotKey. Monitor bottom value is wrong

I want to be able to determine which monitor the cursor is in. Ideally this would be a dynamic solution for any number/configuration of monitors. I thought it would be simple to just read the boundaries of each monitor and test if the cursor is within said boundaries. CoordMode, Mouse, Screen GetMo...
Bort
1

votes
1

answer
1.8k

views

Disable Fn+F4 with AutoHotKey using time

I want to use AutoHotKey to disable Alt+F4 when they are pressed within 0.05 seconds of each other. Otherwise, I'd like it to work as normal. Explanation: My Lenovo Yoga 2 Pro has alternate functions for the function keys. For example: 'F3' is mapped to volume+, 'F4' is mapped to 'close active windo...
Bort
1

votes
2

answer
71

views

How can it be detected when the mouse cursor leaves the webpage if the cursor doesn't touch the edge?

I'm looking for a non-JQuery solution for a seemingly simple task: Detecting when the mouse has left the page. BUT, standard methods using: document.onmouseleave //or document.onmouseout will only work if the mouse leaves the page via the edge. That means it will fail if the mouse leaves by crossin...
Bort
1

votes
3

answer
82

views

Do single/double quotes make a difference if nothing is escaped?

As I see it, both 'mars%22%3A%22' and 'mars%22%3A%22' are equivalent, as nothing is being escaped. I have been creating a javscript bookmarklet for some time now. At one point, it stopped working when pasted as-is into a bookmark in Chrome. I discovered a solution after much guess-and-check: A pair...
Bort
1

votes
1

answer
38

views

Nesting a SUM and a MEAN in an aggregate to get means of scores per group

I can't find a dataset similar to my problem so I changed the dataset Iris (dataset in R) to look similar - it's close enough! data = iris data$type = gl(5,30,150,labels=c('group1','group2','group3','group4','group5')) data$ID = gl(30,5,150) Then I used the following code xtabs(Sepal.Length ~ Speci...
k BORT
1

votes
2

answer
1.5k

views

how to profile java application using visualVM?

My boss wants me to profile our product application to see if we can get some improvement with regard to memory usage. When I profile the memory, I get this: What's the meaning of the last column ('Generations')? How can I analysis the application using this information?
Bort
1

votes
2

answer
3.5k

views

Cannot invoke add on the array type

I have been given some code to tinker with, which is a prisoners dilema game are initially the players were set with this piece of code into an array. IPDPlayer[] currentPlayers = { new RandomPlayer(), new TFTPlayer(), new TFTPlayer(), new TFTPlayer(), new CoopPlayer(), new CoopPlayer(), new Coo...
Bort
1

votes
1

answer
27

views

Running “<” command between two different directories

I'm working a small JS project and trying to get a script to run, which compiles some source files that are written in our own 'language x'. To run the compiler normally you would use the command ./a.out < source.x And it would print out success or compilation errors etc. In the case now, I'm trying...
Bort
1

votes
2

answer
45

views

R cumulative sum of one variable while another variable tracks “cutoff”

Please excuse the strangeness of my question. this was the most logical way to frame it. Really, I don't care about flowers. What ultimately I'd like to do, is find the sum of the sepal lengths of iris flowers that are over each 'critical value' of petal width / petal length. Consider the following...
k BORT
1

votes
1

answer
3k

views

Scala + Play -> Type mismatch; found : anorm.RowParser Required: anorm.ResultSetParser[Option[models.User]]

SOLUTION: I could not figure our how to return the non-exists for of Option[User] so in the case of not user found I create a dummy user object and reason on it from the controller (feels awful but working...): from Application.scala val loginForm = Form( tuple( 'email' -> text, 'password' -> text...
bort
1

votes
1

answer
43

views

Gap between forecast and actual data in ggplot

I am trying to plot some data, fitted values and forecasts on a nice ggplot format but when I plot my data the way I think should work I get a gap between the real data and the forecast. The gap is meaningless but it would be nice if it was gone. Some R code you can use to recreate my problem is: li...
k BORT
1

votes
1

answer
3.5k

views

PowerMock expectNew how to specify the type of the parameters

When I use PowerMock to mock the constructor,I want to specify the type of the paremeters. I use the method PowerMock.expectNew(Class type, Class[] parameterTypes, Object... arguments) If I want to specify the String type, what shoud I fill in the parameterTypes?
Bort
1

votes
2

answer
1.4k

views

How to test Protected method

If the class's constructor is protected, when I do the test case, what can i do to construct an object using EasyMock or PowerMock.this is my source code : protected TibOperationProxy(SAPApplication sdkApp, String classRef, String getOperationName, String rpcRef, SAPReqRespImpl sapClient) throws M...
Bort
2

votes
1

answer
33

views

Is it possible to return data from webage to main server

This may be a (and probably is) dumb question but I have been trying to set up a server that will work with http and websockets. I would like the result of a button press to change a value within the server which can then be sent across a websocket. This is my main server code: var express = require...
Bort
5

votes
2

answer
2.5k

views

How can I remove ONLY leading and trailing spaces while leaving spaces in between words alone with an excel formula?

In excel, TRIM() will remove all spaces before and after text, while also removing any duplicate spaces in between words. Is there a formula or combination thereof that will do the same as TRIM() but leave spaces between words as-is? In the following example, I'm looking for a formula that will acco...
Bort
6

votes
3

answer
564

views

What does Queue<T> actually implement

While attempting to implement my own Queue by wrapping the generic Queue, I noticed that Queue implements ICollection. However, the method signature of ICollection.CopyTo is as follows void CopyTo( Array array, int index) Whereas the method signature of the generic Queue.CopyTo is public void Copy...
Bort
2

votes
1

answer
5.6k

views

Jasper Report - Detail won't print on first page

I have a report set up with a Title band and a Detail band containing a table. There is no spacing between these two bands. When I view/print the report, the Detail band begins printing at the top of page 2, and page 1 is left with a large blank space between the header and the footer. How can I get...
Bort
6

votes
1

answer
1.6k

views

Listview virtualization and deselecting all items

In my application I have a listview with an item container style bound to the IsSelected property on my view model. I have also set up an inputbinding on the listview to handle selecting all items in the list programatically, since the default does not work due to the virtualizing stack panel. This...
Bort
2

votes
1

answer
333

views

swig with openmp and python, does swig -threads need extra GIL handling?

I have my C library interfaced with swig. I can compile it with my setup.py. Here the extension section: surf_int_lib = Extension('_surf_int_lib', ['surf_int_lib.i', 'surf_int_lib.c'], include_dirs=[numpy_include], extra_compile_args=['-fopenmp'], extra_link_args=['-lgomp'], swig_opts=['-threads'] )...
Bort
4

votes
2

answer
519

views

Gitlab CI shell on windows only runs before_script

My CI runner will only run a single line. I'm trying to run npm install prior to eslint. However, if I add npm install to the before_script section, then only npm install runs and the build reports success without ever actually running eslint. Are multiple commands not supported on a windows shell r...
Bort
1

votes
1

answer
280

views

Python server is sending truncated images over TCP

I have a simple server on my Windows PC written in python that reads files from a directory and then sends the file to the client via TCP. Files like HTML and Javascript are received by the client correctly (sent and original file match). The issue is that image data is truncated. Oddly, different...
Bort
2

votes
1

answer
193

views

Initialization method for slice type fails to initialize

I try to implement an initialization method for my own type. However after calling the method the variable is unchanged in main(). I probably haven't fully understood how slices work, here is my example code package main import 'fmt' type test [][]float64 func (p *test) init(m, n int){ tmp := *p tmp...
Bort
1

votes
2

answer
4.9k

views

Avoiding “redefinition of typedef” warnings when defining structs

I'm defining some structs which reference eachother, and typedef'ing the structs before using them, so each struct is 'aware' of the others (was getting compilation errors without this). Not sure if this is necessary, or correct. Now when compiling with gcc, I'm getting 'redefinition of typedef' wa...
Bort
2

votes
1

answer
473

views

How to create a replace operation with sequelize.js?

Using sequelize.js with express.js. I need to replace an existing instance of a model with a new instance. I want the new instance to be validated prior to saving the replacement in order to make sure all required fields are present. However, validate() does not work as I would expect. In the follo...
Bort
2

votes
1

answer
475

views

Can a collection be modified by another thread during ToList() [duplicate]

This question already has an answer here: Are IEnumerable Linq methods thread-safe? 2 answers class Sample { private List _list; public List List { get { return _list.Select(p => p + p).Where(q => q % 2 == 0).ToList(); } } public void Add(int n) { _list.Add(n); } public void Remove(int n) { _lis...
Bort
2

votes
2

answer
69

views

Build an object from an elements data-* attributes

Given an element like: jQuery data() will return the object you expect: {answer: 42, question: '?'} However, jQuery plugins also get added to the internal cache for the element, and will be included with the data: {answer: 42, question: '?', somePlugin: Plugin} I would like to create an object out o...
Bort
14

votes
3

answer
4.4k

views

Publish / Subscribe pattern in SQL

Background: We have a large (15+ million) table of items which is updated frequently throughout the day (average 300K daily changes). Pending changes are stored in a staging table, and a job runs throughout the day to read changes from this table, make the updates, and mark the changes as processed...
Bort
2

votes
3

answer
2.2k

views

Space between parent nodes of a TreeView

I have a TreeView where parent and child nodes are bound to the same object type. What I want to do is have extra space, or create some other way to separate, only the top level nodes. For example, if it looks like this normally: A B C F D E I want it to look like this: A B C F (space here) D E Bel...
Bort
5

votes
0

answer
75

views

Press an “@” and drop-down a ComboBox. [C#] [closed]

First of all sorry if this is repeated, but I didn't find anything yet about that. Is it possible in C# to press a specific key on a TextBox, in this case '@', and dropdown a list of names? It's the same thing that FB and Whatsapp does now. In order to save time, if you press @, appears a list of pe...
Miguel Bort
2

votes
2

answer
978

views

How to Mock “this”

when I test a class's constructor there is an sentence like: SAPPublisherSvc server = new SAPPublisherSvc(sdkApp, this, curInt, factory, tidHandler); I want to use PowerMock.expectNew(), but what can I fill to instead of the parameter this.
Bort
3

votes
1

answer
135

views

Return a vector of known size without additional wrapper?

I am just stuck on a trivial problem with SWIG and numpy. I have a specialized matrix (n,k) vector (k) product in C which I want to interface to numpy. So I always know the shape of the output vector (n) before the multiplication. Currently, the C function allocates the memory and returns a double*...
Bort
4

votes
1

answer
4k

views

LWJGL: failed to load a library

Have been trying to work with 'lwjgl' on linux and am running into an issue when I run my compiled code from the terminal. I am using the stable release of lwjgl 3. I downloaded the lwjgl.jar from the website and run the command javac -cp lwjgl.jar: Main.java which compiles the code fine. Then I run...
Bort
4

votes
4

answer
79

views

Is this definition of “static” variables incorrect, misleading, or neither?

According to https://www.learn-c.org/en/Static: By default, variables are local to the scope in which they are defined. Variables can be declared as static to increase their scope up to file containing them. As a result, these variables can be accessed anywhere inside a file. Two code examples are p...
Bort
3

votes
1

answer
87

views

Stubs in Matlab Toolbox Testing

As a follow up to my previous question, I run into a new obstacle: how to generate stubs for functions in a toolbox? I found Andy Campbell's solution for the non toolbox case. This does not work in my case because Matlab complains: package directories are not allowed in MATLAB path in Pathfixtures!...
Bort
4

votes
2

answer
103

views

Assigning a double to a struct

I stumbled upon something the other day in the code of a colleague and I want to understand how/why this works. He uses a struct like this struct my_struct { my_struct(){ /* default constructor*/}; my_struct(char c){ /*some special constructor*/}; // other stuff my_struct& operator=(const my_struct...
Bort
2

votes
1

answer
558

views

Load page with anchor centered - Browser scrolling to top after document ready event?

When a page loads with an anchor (fragment) in the url, instead of the default behavior of scrolling so the anchored element is at the top of the screen, I want it centered. The following does what I want: var $targetDiv = $(window.location.hash); if ($targetDiv) { var $window = $(window); $window...
Bort
1

votes
1

answer
181

views

Command on 'Parent' ContextMenu

I'm creating a context menu in code behind with a submenu. I want the top level menu item to act as a command when pressed, but when I add child menu items, the command behavior seems to be taken over by the expanding behavior. How can I remedy this? MenuItem item = new MenuItem(); item.Command =...
Bort
7

votes
2

answer
507

views

Megaparsec: Not able to parse arithmetic string

I'm working on a small parser using Megaparsec and trying to parse arithmetic. -- Arithmetic expressions data Aexp = N Num | V Var | Mult Aexp Aexp | Add Aexp Aexp | Sub Aexp Aexp deriving (Show, Eq, Read) arithParser :: Parser Aexp arithParser = V strParser N numParser Mult arithParser
Bort
5

votes
5

answer
2k

views

Recursively check for atoms in a list

I am attempting to write a small recursive program that tests a list and returns t if every element is an atom. The problem I am having is that when the function receives an empty list, it returns t instead of the desired result of nil. I cannot come up with a way to have it return nil for an init...
Bort