dearn44

1

votes
0

answer
28

views

Compute annual rate using a DataFrame and pct_change()

I have a column inside a DataFrame that I want to use in order to perform the operation: n = step/12 step = 3 t1 = step - 1 pd.DataFrame(100*((df[t1+step::step]['Column'].values / df[t1:-t1:step]['Column'].values)**(1/n) - 1)) A possible set of values for the column of interest could be: >>> df['Col...
dearn44
1

votes
0

answer
36

views

Load data from CSV using DataLoader

I have a .csv file with the following format: x1, x2, y, x3, x4 05 05 0 00 12 01 09 1 00 17 ... 13 24 0 01 00 I have created the following class that will help me load my data with a DataLoader, so as to shuffle it and read it in batches as well as apply any possible transformations that...
dearn44
1

votes
1

answer
356

views

What does this Delphi code means? (From the customlistbox example) [closed]

I was looking at all the examples shipped with RAD Studio xe6 when I came across the custom listbox example located at Object Pascal > FireMonkey Desktop > CustomListBox Trying to play with it and see what modifications I could do, I decided that it I wanted to create a for loop that would get the...
dearn44
1

votes
1

answer
543

views

Qt Connection to DB2

As a test I tried connecting to a DB2 server using the QODBC driver. I did this by creating a DSN and then providing the needed data such as hostname and the rest. But what if I want to run my app in another computer. Is there another way to connect to a DB2 database, because as I see it this would...
dearn44
1

votes
1

answer
587

views

QSqlQueryModel complains that my database is not open

I am trying to use QSqlQueryModel in order to retrieve some values from my database like such: QSqlDatabase db = QSqlDatabase::addDatabase('QPSQL', 'test1'); db.setHostName(Vars::strDbHost); db.setDatabaseName(Vars::strDbName); db.setPort(Vars::strDbPort); db.setUserName(Vars::strDbUsername); db.set...
dearn44
1

votes
1

answer
47

views

At each time keep only one section visible in my table

I am experimenting with this table created with Angular. As you can see it has each element divided into separate groups that you can toggle on or off. What I want to achieve is have only one group visible at all times, so when I toggle a group, the open one will close leaving only that selected gro...
dearn44
1

votes
1

answer
442

views

If condition inside my route provider

In my $routeProvider I have something like this, $routeProvider.when('/person/:name/:label', { ... What I want to do is add a special case that will help me display a different template if :name, for example, equal with 'John'. What I tried was using something like this: $routeProvider.when('/person...
dearn44
1

votes
1

answer
31

views

Search functionality for multiple fields using sql

I have a table that holds user data. It looks something like this: ID Name Surname Age 1 Alice Moore 23 2 David Moore 45 If working with only one field, lets say Name, which I have to use for my search key then I could simply do something like this: Select * from Users where Name Like '% Al %...
dearn44
1

votes
1

answer
96

views

uniVocity parsers to handle two files

I am using uniVocity in order to parse two different files. For every line of the first file I need to iterate through file 2 in order to make some comparisons. RowListProcessor rowProcessor = new RowListProcessor(); CsvParserSettings settings = new CsvParserSettings(); settings.setRowProcessor(rowP...
dearn44
1

votes
1

answer
250

views

Using zeromq.js to communicate from a nodejs app with a python backend

I have a python program that will accept a ZeroMQ REQ Requester and provide a number of functionalities, based on the given code. So if a client sends a code 02, python will return back a memory statistics, 03 a CPU statistics and so on. The client is created with nodejs and zeromq.js, in order to...
dearn44
1

votes
1

answer
1.2k

views

Delphi, Handles in TPanel objects

I was reading the source code for tmplayer and MPUI, both media players that use MPlayer as a backend to play media files in Delphi and I noticed here as well as in other older codes that I tried to experiment with that I can't use Form1.Rectangle1.Handle or as it is in this example for tmp layer t...
dearn44
1

votes
2

answer
105

views

Using QtScript outside my main form

I am using Qt5, and trying to learn on how to make an application scriptable. For this I created a main window that contains some text edits, labels, etc. I then added an option called 'script console' to that forms' menu in order for me to open a second form containing just a text edit and a butto...
dearn44
1

votes
1

answer
146

views

Cursor won't change for my QGraphicsView

I have created my own widget based on QGraphicsView. I did this in order to re-implement some mouse events as such: void Workspace::mouseMoveEvent(QMouseEvent *event) { qDebug() x()).arg(event->y())); QGraphicsView::mouseMoveEvent(event); } as well as install an event filter bool Workspace::eventF...
dearn44
1

votes
2

answer
554

views

Display data in a table by grouping them horizontally

I have some data that has the following format: [name:'Name1', speed:'Val1', color:'Val2'] [name:'Name2', speed:'Val4', color:'Val5'] [name:'Name3', speed:'Val6', color:'Val7'] That I want to display in a table like this: |Name1|Name2|Name3| ______|_____|______ speed |Val1 |Val4 |Val6 color |Val2 |V...
dearn44
1

votes
1

answer
468

views

No output coming from log4net

I am trying to use log4net by following a few tutorials and reading the plethora of posts about people having problems with it, since I can not make it work properly. I have this part right on top of my .config file I added this line on my AssemblyInfo file [assembly: log4net.Config.XmlConfigurator(...
dearn44
5

votes
1

answer
42

views

Create a group of streamers and publishers

I have a number of nodes that will use a secondary service to be informed about the address of each other. I want to be able to publish information so as all the other nodes can hear it. Using an XPUB socket is not an option I would want to go with here as I want this system to be distributed. What...
dearn44
1

votes
2

answer
161

views

Error with casting value returned by sql query

I have the following query string sql = 'IF NOT EXISTS(SELECT testId from TestData where [email protected]) ' + 'Insert INTO TestData (testId, jsonString) VALUES(@testId, @jsonstring) ' + 'else ' + 'UPDATE TestData SET [email protected] WHERE [email protected] ' + 'SELECT CAST(scope_identity() AS int...
dearn44
1

votes
2

answer
299

views

Cannot access closed stream error when trying to send data from my WCF service

On my service I am trying to create and return a MemoryStream like this: // Write data. MemoryStream memoryStream = new MemoryStream(); using (StreamWriter txtwriter = new StreamWriter(memoryStream, System.Text.Encoding.UTF8)) { string tempString = 'Test'; txtwriter.Write(tempString); txtwriter...
dearn44
1

votes
3

answer
55

views

Invalid CORS request for PUT with AngularJS

I have a mapping in my Spring application that looks like this: @PutMapping(path='/test/{id}') public @ResponseBody Shop putTest(@PathVariable('id') long id, @RequestBody User user { .... When trying to call this endpoint with Angular by doing: $http({ method: 'PUT', url: 'https://localhost:8000/api...
dearn44
1

votes
1

answer
66

views

Read a file and save to a list

I have a file of the form: 3 1 2 3 4 5 4 5 6 1 6 2 4 6 7 The first line identifies the lines that will follow. Those lines in turn are just a series of numbers. I need to save this into a list that might look like this: N = 3, Teams = [line(1, 2, 3, 4, 5), line(4, 5, 6), line(1, 6, 2, 4, 6, 7)]. Wha...
dearn44
1

votes
1

answer
49

views

Deal with negative values resulting from my nn model

I have a simple nn model that looks like this class TestRNN(nn.Module): def __init__(self, batch_size, n_steps, n_inputs, n_neurons, n_outputs): super(TestRNN, self).__init__() ... self.basic_rnn = nn.RNN(self.n_inputs, self.n_neurons) self.FC = nn.Linear(self.n_neurons, self.n_outputs) def forward(...
dearn44
2

votes
3

answer
18

views

Get values from a smaller DataFrame with a specified step

Supposing I have the two DataFrames shown below: dd = pd.DataFrame([1,0, 3, 0, 5]) 0 0 1 1 0 2 3 3 0 4 5 and df = pd.DataFrame([2,4]) 0 0 2 1 4 How can I broadcast the values of df into dd with step = 2 so I end up with 0 0 1 1 2 2 3 3 4 4 5
dearn44
0

votes
2

answer
16

views

Correctly converting a NumPy array to a PyTorch tensor running on the gpu

I have initialized my weights using torch.zeros(1, self.batch_size, self.n_neurons, dtype=torch.float32, device=device) where device is 'cuda:o'. I have also created a model that has a simple RNN basic_rnn = nn.RNN(self.n_inputs, self.n_neurons) out, hidden = basic_rnn(X, hidden) X is my input that...
dearn44
1

votes
2

answer
120

views

How to model user transactions for DB storage in a small chat app? [closed]

I am trying to develop my own simple chat app using Qt5. Some Context What I have until now is a simple server that will receive any messages from users (that are using the corresponding client) and store them in a database, together with a from, to and iseRead field. Then the clients regularly ask...
dearn44
1

votes
1

answer
851

views

How to rotate an element on both axes with different angle values

If you need to rotate an element in QML in order to achieve a sort of 3d flip effect then you can do transform: Rotation { origin.x: 30; origin.y: 30; axis { x: 0; y: 1; z: 0 } angle: 24 } How can I achieve the same thing but this time rotate both x and y with different angle values?
dearn44
1

votes
3

answer
4.6k

views

Allow only one radio button to be selected from multiple groups of checkboxes

I have a number of account items. I am displaying these in a list doing something like and for every such item i display three radio buttons in a group, holding values like admin user moderator Right now a user can select a value for each group of radio buttons, but what I want to do is have only...
dearn44
1

votes
1

answer
152

views

Angular wont update view even after $apply was used

I am including an html file using inside my main page using inside this script there is a list showing some documents. {{document.name | limitTo: 20 }}{{document.name.length > 20 ? '...' : ''}} {{document.name}} At some point using a button that is inside another template, is included in pretty muc...
dearn44
5

votes
3

answer
1.5k

views

Remove border outline that appears after I click an element on my page

Every time I click an item in my page a black line appears showing the items boundaries. Is there a way to not have this line shown at all? Edit after Solution What I called a border trail is actually an outline used for easier accessibility (for example when using Tab to move around) and should act...
dearn44
4

votes
2

answer
41

views

Read a file using Stream and keep track of the current index

I am reading a large file as such: try (Stream stream = Files.lines(Paths.get(fileName))) { stream.skip(1).forEach(Main::parseLine); } catch (IOException e) { e.printStackTrace(); } where parse line looks like this: private static void parseLine(String line) { System.out.println(line); } what I woul...
dearn44
5

votes
1

answer
80

views

Find viable combination from a list of preferences

I have an object that looks like this: a - ['A', 'B', 'C'] b - ['A', 'B', 'C'] c - ['A', 'B', 'C', 'D'] d - ['A', 'B', 'C', 'D'] each one of the keys has a number of available options as denoted by the list (e.g. a can choose between A, B, C and so on). I want to find a combination of pairs that wil...
dearn44
1

votes
2

answer
568

views

Iterate through all public methods of a class

Is it possible to iterate and print the names of all the functions that I have created in my application while using qt5? For example lets say that I have created my own class (myClass) that contains two public slots int add(int a, int b); int mul(int a, int b); What I want is later at some point to...
dearn44
1

votes
2

answer
2k

views

Is it possible to use ng-if with a service value?

I have the following service that holds some random data .service('dataSrvc', [function() { var accountData = { accounts: [ { 'id': 1, 'title': 'Account A', 'selected': true }, ... When displaying this data in a list, I want to add an icon if lets say the id for this item equals to 1. I tried using...
dearn44
1

votes
2

answer
88

views

Get custom object T in list List<T> based on key

I have a list of what I call Actions that looks like this public class Actions { public string Type { get; set; } public string Observations { get; set; } public Actions( string type, string observations) { Type = type; observations= type; } } That I later on use in a List like List data= new List()...
dearn44
1

votes
2

answer
157

views

Issue with what a function returns in my WFC service and Client

I am defining a number of functions in my client, as an example [OperationContract] List GetObject(string id); When trying to call this function from my interface if I try: List result = cvs.GetObject(5); I get an error, instead what I must do is CustomObject[] result = cvs.GetObject(5); One other e...
dearn44
3

votes
2

answer
3.1k

views

Radiobutton wont react to ng-change directive

This question is linked to this. While trying to experiment with the suggestions on these answers, I ran into some trouble. What I tried to do is do the same thing but using the official angular material example as can be seen below: Apple Banana Mango 'use strict'; angular .module('radioDemo1', ['...
dearn44
2

votes
1

answer
739

views

I would like to use the span slider from Qxt without having to install it. Is this possible?

I stumbled across a widget that provides you with a slider with two handles so you can select a range between an upper and lower limit. I would like to use it without having to install all of Qxt though, since I am pretty sure this is the only thing that I need. How can I deal with qxt_p() in order...
dearn44
2

votes
2

answer
28

views

Read a variable that is placed inside my models file, in another file

In my models file I have this class User(models.Model): USER_TYPE_CHOICES = ( ('USER', ( (TYPE1, 'type 1'), (TYPE2, 'type 2'), ) ), ... What I want to do is be able to access these values from my forms.py file, where I have type = forms.CharField(label='Type', widget=forms.Select(choices=USER_TYPE...
dearn44
2

votes
1

answer
41

views

Empty result while creating a csv file

I have an array with keys and values that I want to email as an attachment in csv form. What I am trying is this: ... $mail->addStringAttachment(create_csv($dataCSV), 'test.csv', $encoding = 'base64', $type = 'text/csv', $disposition = 'attachment'); ... and below that, I declare my create_csv funct...
dearn44
2

votes
2

answer
108

views

Drop-shadow is interrupted by invisible borders

I am making a simple button using the code below Item { id: menuButton width: 124 height: 124 Rectangle { id: menuButtonIcon x: parent.width - 75 y: parent.height - 80 color: '#C02A25' width: 60 height: 60 radius: width * 0.5 antialiasing: true } DropShadow { id: menuButtonIconShadow source: menuBut...
dearn44
3

votes
2

answer
127

views

Pair bad players with good players while retaining ballance

I have a number of players that are split into two groups, good players and bad players. Each player is defined by a an arithmetic value and a possible group could be this one: bad players A 13 B 6 C 9 D 2 good players X 25 Y 16 Z 17 K 10 Pairing a good player with a bad player will cause him to be...
dearn44

View additional