98 Archived Topics

Remove Filter
Member Avatar for phorce

I'm having the following difficultly: I have a table `rates` which contains the follow: -> id -> rate_from -> rate_to -> price A `user` can have many rates, and for an example: between 0 - 10 hours the `user` charges `10.00` an hour between 10 - 100 hours the `user` …

Member Avatar for diafol
0
387
Member Avatar for phorce

Assume that I have a vector: x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] What I need to do is split this vector into block sizes of `blocksize` with an `overlap` `blocksize = 4` `overlap = 2` The result, would be a …

Member Avatar for vmanes
0
187
Member Avatar for phorce

I don't know why I'm having such a problem with this, basically, I want to have a Queue that is constantly running during the program called "Worker" this then works, however, every 10 seconds or so.. Another method called "Process" comes in and processes the data. Let's assume the following, …

Member Avatar for woooee
0
271
Member Avatar for phorce

I have two threads, and, I want one thread to run for 10 seconds, and then have this thread stop, whilst another thread executes and then the first thread starts up again; this process is repeated. So e.g. from threading import Thread import sys import time class Worker(Thread): Listened = …

Member Avatar for Gribouillis
0
11K
Member Avatar for phorce

I believe there is a function which returns the max value for a double, however, I do not need this. I'm converting the following function: public void StaticCompress(short[] samples, float param) { for (int i = 0; i < samples.Length; i++) { int sign = (samples[i] < 0) ? -1 …

Member Avatar for mike_2000_17
0
8K
Member Avatar for phorce

I might be a bit tired, but why does the following not work? class Signal { public: Signal() { } protected: std::vector<double> data; }; class Something : public Signal { public: Something() { data.resize(100); } }; class Parser : public Signal { public: Parser() { std::cout << this->data.size(); } }; …

Member Avatar for iamthwee
0
153
Member Avatar for phorce

I basically have two classes: `Signal` and `Parser` they both have differences, however, they each share the data that `Signal` has. I want to incorperate Method Chaining into the class, so my classes (at the moment look like the following): class Signal { Signal() { } Signal& Parse() { return …

Member Avatar for mike_2000_17
0
189
Member Avatar for phorce

I'm working on a project that generates roughly between 13x512 values in which I compare at run-time. So the program outflow will be sort of as follows: - Program executes - Extracts (1) 12x512 - Extracts (2) 12x512 - Compares (1) to (2) - Extract (3) - Compares (3) to …

Member Avatar for Moschops
0
234
Member Avatar for phorce

I'm attempting to implement the Factory Pattern. I have a class called "Window" which has a class member function which determines which object is being called and then assigns the particular object pointer. I have written the following code: class Hamming { public: Hamming() { } Hamming(int theSize) { // …

Member Avatar for deceptikon
0
190
Member Avatar for phorce

Sorry if this is hard to understand what I'm trying to do here, but, I do not know how to approach this. I am using method overloading in my constructors of a class, and I have multiple "Window" functions which are all classes that can be used and I need …

Member Avatar for mike_2000_17
0
295
Member Avatar for phorce

Hello, I am having a few problems when trying to execute the a Makefile that will *hopefully* create a static library that I can use for future use. Here is my code below: #----------------------------------------------------------------------------- # Usage of make file #----------------------------------------------------------------------------- # Clean operation: # make -f MakeClient clean # # …

Member Avatar for mike_2000_17
0
787
Member Avatar for phorce

So basically, I'm working on a project that can require both arrays and vectors to be passed through in order to calculate the final outcome. Now, I'm using the constructor to calculate the values and I need to know whether or not it is possible to change the datatype of …

Member Avatar for vijayan121
0
201
Member Avatar for phorce

I have not visited PHP/MYSQLI for some time now, and, need some guidance on the following problem: I'm trying to retrive all the data from the given week and just in that week. My table looks like the following: id int(11) type varchar(255) week datetime And as a test data …

Member Avatar for phorce
0
187
Member Avatar for phorce

Hello, I have a question. I'm not sure I am using the right terms or anything here, but, I have seen people develop their "projects" (classes etc..) and then creating a .dll file (or .lib) and then importing the files when they need them. But I cannot seem to get …

Member Avatar for phorce
0
359
Member Avatar for phorce

Hey, I have a function in C that I am trying to convert over to C++. I have done everything, apart from this line: memcpy(mel[i],&temp[melstart[i]],mellength[i]*sizeof(double)); I need a way of copying the elements in temp[melstart[i]] over to a vector of doubles.. Here is the C code: void Setup_Mel(int fft_size, int …

Member Avatar for mike_2000_17
0
173
Member Avatar for phorce

Hello, So basically, I am trying to create a system based on the Singleton Pattern and I'm confused. If I have an Animal class, as well as a Cat class which is derived from Animal and then using a Singleton class will create a single object of which-ever class has …

Member Avatar for L7Sqr
0
228
Member Avatar for phorce

Hey, I might be having a blonde moment but here goes.. I'm trying to split a massive 1D vector into blocks at different places (If that makes sense), it should basically go like this: 0 201 401 601 801 .. .. .., 57201 2 202 402 602 .. .. .. …

Member Avatar for L7Sqr
0
2K
Member Avatar for phorce

Hello, having a weird problem and wondering if someone can help me.. Basically, I'm trying to read in a .wav file, and I have read in the header information and that's all fine, it's just the data.. Here is the code: bool Wav::readHeader(ifstream &file) { file.read(this->chunkId, 4); file.read(reinterpret_cast<char*>(&this->chunkSize), 4); file.read(this->format, …

Member Avatar for Ancient Dragon
0
236
Member Avatar for phorce

Hello, I'm just wondering whether or not, it is possible to get the vector Dimensions without them being set? Basically, I'm converting some matlab code and there's a function size(VECTOR) which get's the dimentions of the vector being passed. For example: #include <iostream> #include <vector> using namespace std; int main(int …

Member Avatar for WaltP
0
126
Member Avatar for phorce

Hello, I'm trying to read the header information of a .wav file and I'm kind of stuck. Basically, the header information is located at different offsets in the file. So for example: (0-4) = ChunkID (4-8) = ChunkSize (8-12) = Format .. .. .. .. .. .. From this: https://ccrma.stanford.edu/courses/422/projects/WaveFormat/ …

Member Avatar for np complete
0
280
Member Avatar for phorce

Hello, wondering if someone can help me. I'm working with a .wav file, and, I need to collect the header information. The header contains (roughly, 20 bits/bytes) before the actual data. And, each of this data is contained at different locations in the file. I need to read a particular …

Member Avatar for phorce
0
179
Member Avatar for phorce

Hello, I'm trying to write the Cooley Turkey algorithm for an FFT. Now, The algorithm works well, but, only for 2 numbers - Nothing else. For example, I have used an online FFT calculated, entered the same data and got the same results. Here is the code for the algorithm: …

0
126
Member Avatar for phorce

Hello, I'm wondering if anyone knows if there is a specific way or a library that allows me to read in an audio file in which I can then manipulate and get the different frequencies? I'm basically trying to make an application that uses an FFT for the audio signals …

Member Avatar for Banfa
0
302
Member Avatar for phorce

Hello, wondering if someone can help me quickly.. Basically, I have created a array to store all the data in a text file. The pointer of the array is sent to a function, which then populates it. Here is the code: void Data(char* theData) { ifstream txtFile(inputFile.c_str()); if(!txtFile.is_open()) { cerr …

Member Avatar for Ancient Dragon
0
161
Member Avatar for phorce

Hello, I'm trying to develop an algorithm/program that calculates the distance between two points. These values are stored inside a 1D array, which, acts as a 2D array (I think you know what I mean!) The values are: 150 50 15 20 The calculation should therefore be: d = √(150 …

Member Avatar for phorce
0
209
Member Avatar for phorce

Hello, I'm building an application in PHP and when outputting HTML tags, it shows the tags.. So for example: <?php echo "<b>Hello world</b>"; ?> I would expect Hello world to be in bold.. But no, I get: <b>Hello world</b> as the output Any ideas please?

Member Avatar for phorce
0
69
Member Avatar for phorce

Hello, I'm having a weird problem with some PHP when outputting some HTML. For example: echo "<h1>There are errors!</h1>"; foreach($errors AS $error) { echo $error . '\n'; } exit(); I want the output to actually show the text in H1 style, however the output is like this: <h1>There are errors!</h1> …

Member Avatar for broj1
0
94
Member Avatar for phorce

Hello, I'm trying to convert some code from BASIC to C++.. But, I'm stuck on a particular part.. REM CREATE A MATRIX C WITH (COS(DN) , -SIN(DN)) : DIM C(NE, NS, 2) FOR N = 0 TO NE / 2 FOR E = 0 TO NE - 1 DC = …

Member Avatar for phorce
0
166
Member Avatar for phorce

Hello, I'm currently working on a project that basically reads some text and then performs basic Lexical Analysis on the text. I'm having a slight problem with overloading methods. So for example, I have a method that can read in the words from a txt file and another method which …

Member Avatar for phorce
0
187
Member Avatar for phorce

Hello, I'm looking for some advice (NOT CODING) on a project I'm hoping to start.. Basically, I'm hoping to develop some shell commands that work a tiny bit like Github (if you are familular with it).. The language that I want to use is C++.. Could anyone offer any advice …

Member Avatar for Schol-R-LEA
0
136
Member Avatar for phorce

Hello, I'm going to be working on Lexical Analysis, but, both in Words / Characters as well as Integer values. The application will also allow input from both Text files, as well as passing the data through arrays, or variables. The Numeric analysis will be different from the Lexical Analysis …

Member Avatar for phorce
0
103
Member Avatar for phorce

Hello, I'm working on an image-gallery type application and I have got the images to work, in that the gallery works and the image changes at the particular interval. BUT, I need a way to stop the images changing when you mouse over the event. Here is what I have …

Member Avatar for Sahil89
0
101
Member Avatar for phorce

Hello, Quick question.. I'm trying to get the mean of a matrix (vector) now before I created a function that did it but I thought that it isn't really an effective way of coding. I've been looking at the accumulate function online and wanted to ask if this would work: …

Member Avatar for Banfa
0
143
Member Avatar for phorce

Hello, I have this matrix: 0 0 1 0 0 0 1 0 1 1 1 0 0 1 0 0 and I need to print out the block with the coords: (2,1) so in this case: 1 0 1 0 I have tried this: for(int i=minRow; (i < 2); …

Member Avatar for rajenpandit
0
103
Member Avatar for phorce

Hello, I'm trying to determine where a small matrix would fit inside a big matrix.. But, the small matrix is not in the big matrix so I need to see how simular they are.. The one with the lowest value, is the best fit.. So my difference function is this: …

Member Avatar for Lerner
0
160
Member Avatar for phorce

This may sound really noobish, and I'm probably missing something really stupid.. But, I'm trying to calculate the differences between matrices, and the one with the smallest value (result) is the matching number.. But, for some reason my algorithm seems to be missing the smallest number and I can't figure …

Member Avatar for rubberman
0
115
Member Avatar for phorce

Hello, I have been reading an article on comparing data, and have been given this code: for(i = 0; i < matrix1W; i++) { for(j = 0; j < matrix2H; j++) { diffSum += abs(matrix2->pData[(row+j)*backW+(col+i)] - marix1->pData[j*matrix2+i]); } } Now it works when using arrays, but, I'm using vectors, is …

0
302
Member Avatar for phorce

Hello, I have 2 vectors, and I'm trying to search/scan the first vector for the second vector. Let's say I have this vector/Matrix: M1 = 0 1 1 0 0 1 1 1 1 0 1 1 0 0 0 1 M2 = 0 1 0 1 Then I will …

Member Avatar for histrungalot
0
178
Member Avatar for phorce

Hello, I'm having trouble with something.. I have a vector of doubles and I need to convert the vector to an unsigned char so then I can write the contents to a text file. I can do this when reading the data from a text file, just not from a …

Member Avatar for m4ster_r0shi
0
136
Member Avatar for phorce

Hello, I'm trying to split a matrix (512x512) into blocks of (16x16).. Now I have managed to complete this for a small matrix (4x4) but when I try to implement it using the 512x512 it fails and doesn't produce enough blocks for the entire matrix. Here is the code on …

Member Avatar for histrungalot
0
202
Member Avatar for phorce

Hey, I'm doing a project and on the last little piece. It involved taking 2 matrices, splitting them into blocks and then checking whether the blocks are simular or not. If the blocks wasn't simular, then swap them /or/ create a new Matrix that holds the values of the second …

Member Avatar for histrungalot
0
105
Member Avatar for phorce

Hello, I need to store the cooridants of a vector, for example: If the vector was: 0 1 0 1 0 0 1 0 1 0 0 1 1 1 1 0 0 0 0 0 And this vector is then split into blocks, I need to store the the …

Member Avatar for Labdabeta
0
141
Member Avatar for phorce

Hello, Wondering if you can help me.. I have a variable, that each time needs to multiply by 2 (I know, it sounds simple.. I'm probably being an idiot) but it works like this: LOOP 1 offsetX = 0; offsetY = 0; LOOP 2 offsetX = 2; offsetY = 0 …

Member Avatar for phorce
0
118
Member Avatar for phorce

Hello, I'm currently studying and sometime soon will have to do a final year project (which runs through the year).. Now I've been looking at stuff om image recognition and although it interests me I want to do some kind of signals or signalling. My idea is to capture the …

0
71
Member Avatar for phorce

Hello I need some help, I'm trying to output something to a text file (.htm) which will then display the data that is being generated in the C# program.. Now the problem is, whenever I try to replace something, it doesn't work. Just replaces it with "System.Char[]" Here is the …

Member Avatar for thines01
0
128
Member Avatar for phorce

Hello, I have two paragraphs on my page and I need to draw a line between them. Now, I currently store the positions of the two paragraphs inside a database and I have access to them, I just don't know what to do from here. Some people have suggested I …

Member Avatar for vsmash
0
141
Member Avatar for phorce

Hello, I have a major problem with a Correlation algorithm I'm trying to implement.. Basically, when I have two small matices: Matrix 1: 0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 0 0 1 1 1 0 0 0 0 1 1 1 …

Member Avatar for phorce
0
94
Member Avatar for phorce

Hello, I have 2 massive matrix's and I need to compare one matrix with another.. Now, I have come up with a solution that takes a 5x5 block of the matrix1 and compares it with a 5x5 block of matrix2, this happens until the end of both matrix's.. I'm confused …

Member Avatar for phorce
0
117
Member Avatar for phorce

Hello, I need some help please.. I need to write a recursive predicate in Prolog that subtracts two numbers until number 2 is higher than the result. I have completed the logic in C++: [code] #include <iostream> using namespace std; int mod3(int a, int b) { int intResult = a-b; …

Member Avatar for phorce
0
171
Member Avatar for phorce

Hello I'm making an application that reads a series of values from a text file and then converts it to a bitmap image. Currently, I'm using arrays, but, deciding on a particular length is annoying. I have been reading a few tutorials and i've read a lot about using vectors, …

Member Avatar for mrnutty
0
87

The End.