phorce 131 Posting Whiz in Training Featured Poster

It looks like your problem is here:

**header("Location:Login_page.html");**

remove the astrix's .. Also, don't use mysql_* functions. Your query is also unsafe.

phorce 131 Posting Whiz in Training Featured Poster

Is it th 256 or the 512 model? I know some distros do not seem to like the 512mb for some strange reason. I've never heard of this problem though, you may want to install another distro or re-install the current distro you have if you haven't done any serious work with it yet:

Check here!

Sorry I couldn't be more help. Hope you get this solved though

phorce 131 Posting Whiz in Training Featured Poster

Sorry, which distro is this?

I assume that you're working with a Raspberry Pi? But, I have never heard of this distribution.

phorce 131 Posting Whiz in Training Featured Poster

This might sound like a stupid question, but, do you need to include all the .h files? For example, if I'm working on this example:

Person.h

class Person {

  public:

    // public

 protected:

   // protected

}; 
Teacher.h
class Teacher : public Person {

  public:

    // public

  protected:

  // protected
}; 

and in main.cpp I just #include "Teacher.h" but where my project is, I still need to have.. Person.h and Teacher.h?

I thought it would be possible to have a generic class: Application.h for example, where I could include all the methods that I needed, this doesn't seem to work.

Sorry for basic question!

phorce 131 Posting Whiz in Training Featured Poster

Thanks for this, really helped me and I can now finally start building my library.

Quick question though -

I understand the differences between (.lib and .dll) BUT how difficult would it be to have a .lib and a .dll file so I can work with both Linux/Unix and Windows? So in theory, if my library was called "HelloWorld" I could have: "HelloWorld.lib" -- linux and "HelloWorld.dll" - Windows

Thanks :)

phorce 131 Posting Whiz in Training Featured Poster

basic numerical methods (like FFT).

I wouldn't call an FFT "basic numerical methods" when I studied CS I was told not to go anywhere near such methods because they were not taught, and only one person in our University knew what they were. However, I was determined to understand the mathematics behind them. It depends on the programmer, I mean, you may see concepts such as FFT's basic because of your knowlege and experience and, of course, your academic background.

Well, an FFT algorithm can be written and thoroughly tested within at most a few days, by a competent programmer, that is.

Ok, so a year was a bit of an exaggeration on my part so I apologise for that. ;)!

I agree with the points you make, however, it depends on where you get taught as well, right? For example, some Colleges/Universities have lecturers that are just focused on researching and not teaching and often give their students the advice:

"Go Google it" ->

"Google is your best friend" ->

etc..

They do not specifically ask for code to be written from scratch (which is bad!) and most of the time, do not ask you to follow a structure like pseudocode. Which is why in my opinion we now have this idea where it is just second-nature to google the type of algorithm that they need and then submit it, or, post it on a forum. Which is why, when they come to having interviews, …

phorce 131 Posting Whiz in Training Featured Poster

The worst is when the only skill that people develop during a programming course is their skills at finding code on the web and disguising it as their own. At some point, it gets to the point that they even believe that they did it themselves.

I agree, to some extent. However, sometimes "people/students" are encouraged to use code that has already been written. For example, in my undergrads I had to develop an algorith that used an FFT (Fast Fourier Transform) and it would be impossible/not pratical for me to write my own because:

1) I wasn't improving, editing or adding to the algorithm
2) I didn't have enough time to test my algorithms (in-depth) because that would require my whole year.

I agree that a lot of people come onto forums specifically asking you to do their homework, and, it's usually people who are in higher education and have the choice whether or not to do programming and I get the impression that some people just don't enjoy programming, yet study it? (Has it got some "magic" attraction that I dont/didn't know about?).

phorce 131 Posting Whiz in Training Featured Poster

@PriteshP23 How do you expect SESSION to work, when you initialise a session, but, don't actually define anything as a session?

phorce 131 Posting Whiz in Training Featured Poster

The way you're doing it is very bad, very, very bad.

1) You should only let people have access to the api if they have a 'key' (at the moment anyone can access it)

2) You need a way to encrypt the 'password' if not, it's plaintext.

phorce 131 Posting Whiz in Training Featured Poster

@PriteshP23 - We have our own lives, and, we choose to help people. It is rude (and probably against the rules) to demand you want your code looking at and fixing. You haven't even told us what is going wrong (What are the error messages? If any..)

NOTE: We don't have your server, nor access to your database and we are not compilers / intepreters that can just read through your code and process it. TELL US what is going wrong with the code.

phorce 131 Posting Whiz in Training Featured Poster
$query="SELECT post,link from pagination ORDER BY id DESC
LIMIY $pageLimit,".PAGE_PER_NO;

Needs to be:

$query="SELECT post,link from pagination ORDER BY id DESC
LIMIT $pageLimit,".PAGE_PER_NO;

Should work :)

Please don't use mysql_* commands, they're being depreciated.

phorce 131 Posting Whiz in Training Featured Poster

What doesn't "work" you need be more specific!

Questions / points:

1) Does this even execute?

$CON // connection works

2) Don't use mysql_* these commands are being depreciated.

3) Where do you set the sessions? For example:

<?php
    session_start();
    $_SESSION['Phorce'] = "Phorce";


    echo "User: " . $_SESSION['Phorce'];

    session_destroy();

    echo "User: " . $_SESSION['Phorce'];

4) In "logout.php" if you want to destroy a session, why are you creating a new session just to destroy it? You create the session at the beginning of your script.

phorce 131 Posting Whiz in Training Featured Poster

I worte this program a while ago it uses functions however, it should give you the correct algorithm you are looking for:

#include <iostream>
#include <cmath>

using namespace std;

double Distance(int x1, int y1, int x2, int y2)
{
    return sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
}

int main(int argc, char *argv[]) {

    int coord[2*2] = {20, 20,
                      40, 30};

    cout << Distance(coord[0], coord[1], coord[2], coord[3]) << endl;

}

@vmanes is right, the algorithm I gave was wrong (in the first instance) so apologies for this.

elfatih01 commented: very good +0
phorce 131 Posting Whiz in Training Featured Poster

Are you sure you're using the right operator here:

distance = sqrt((c-a)^2+(d-b)^2)

Wouldn't it just be better to do:

float distance2 = (a*a) + (c * c); // square 
distance = sqrt(distance2); // find the square root
cout << "The distance between the two points : "<< distance;

20, 20

40, 30

= 31.6228

Seems right?

rikkie commented: Quick response with good guidance. Thanks! +0
phorce 131 Posting Whiz in Training Featured Poster

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 my head around it.. So for example:

class Test {

    public: 

        Test();
        Test(int theVar)
        {
            var = theVar;
            cout << "You entered: " << this->var;

        }

    private:

        int var;
};

If I had the class above and wanted to export it as a .dll and then import like this:

#include "myClass.dll/.lib"

int main()
{
   // object initialise 

}

How would I do this? Or, could anyone suggest tutorials which may help me?

BTW: I'm using GCC on a mac. (I think it's different in you can't create/import .dll's instead it's .lib).

Any suggestions would be greatly appriciated.

phorce 131 Posting Whiz in Training Featured Poster

I don't understand what you mean by 'Automatic eject'?

phorce 131 Posting Whiz in Training Featured Poster

Coda was alright, until they released Coda 2.

I use Sublime Text 2 - Great editor :)

phorce 131 Posting Whiz in Training Featured Poster

Your problem looks like this:

You cannot have your text fields with id's such as "1", "2", "3", "4" etc..

You need to pass them as an array, so in your html just have values[] this implies that there is an array of fields.

You can then pass this array into a function to calculate the values.

Hope this makes sense.

phorce 131 Posting Whiz in Training Featured Poster

This isn't tested.. But I think this is what you mean..

<?php

    function display($x)
    {
        $sum = (int) 0;
        foreach($x as $xs)
        {
            $sum += $xs;
        }

        return $sum;
    }

    if(!isset($_POST['submitted']))
    {
        echo '<form method="post" action="">';
        for($i=0; ($i < 10); $i++)
        {
            echo '<input type="text" name="values[]" id="textfield" /><br />';
        }
        echo '<input type="submit" name="button2" id="button2" value="ADD" />';
        echo '<input type="hidden" name="submitted" value="TRUE">';
    }else{

        $values = $_POST['values']; 

        echo display($values);  
    }


?>
phorce 131 Posting Whiz in Training Featured Poster

Are there multiple text fields for the values?

Or, are the values entered like:

1234567

OR

1, 2, 3, 4, 5, 6, 7

phorce 131 Posting Whiz in Training Featured Poster

Something like that. I am also thinking of some kind of psychological exam.

What do you mean by this? I don't get it. As far as I'm aware, whenever I have "enrolled" at a University / College, it's just to confirm that they have the correct details for me, and, that I want to carry out the course.. I didn't have to submit any grades, nor do a psychological exam.

phorce 131 Posting Whiz in Training Featured Poster

Hey,

Could you please tell us what features that you have already implemented (or planning)? From here we can then advise you on what else you could implement. Or a brief descrption of your proposal.

Cheers

phorce 131 Posting Whiz in Training Featured Poster

@shivani1515

So any one can get me some ideas for it without use of any specific sdk or dlls

You need to understand how complex such a task would be, and since you're asking if it can be done with PHP I can only assume that you do not know.

Ok, so I don't know specifically (how the readers, read) however, if I had to give you a quick overview then you would have to:

1) Process an image of the finger print;
2) Take details of the finger print
3) Match it with the sample data (trained).

If you understand how to do these concepts in C# then YES you could probably have this interact with PHP. For example, you could build the interface so it interacts (i.e. If the (processes) above return true, then the user can be signed in, else (processes) return false - do not let any further action).

Complex solution to this problem, without the use of libraries. I don't understand why you would want to re-invent the wheel, especially with little experience in this field (And it is a complex field). Have you tried looking at some academic papers in this field? This might be useful and provide you with an algorithm in which you can work from.

phorce 131 Posting Whiz in Training Featured Poster

Hello,

I believe what you're doing here is wrong:

list.erase(std::unique(list.begin(), list.end(), list.end()));

It expects a function (boolean) rather than the end of the list (vector). In this case, you could try this:

bool compare (string i, string j) {
  return (i==j);
}



list.erase(std::unique(list.begin(), list.end(), compare);

Source: Click Here

phorce 131 Posting Whiz in Training Featured Poster

What Sort of program(s)? Be more specific

phorce 131 Posting Whiz in Training Featured Poster

What is this:

$p['username']

What are you trying to do here? I think you're getting confused. Where are you defining your class variables? Show these :)

phorce 131 Posting Whiz in Training Featured Poster

What is the problem?

We cannot help you, if you do not tell us what is wrong.

phorce 131 Posting Whiz in Training Featured Poster

Hello,

I don't want to look like I am following other forums, but, wouldn't it be a good idea for users (with a certain amount of rep) to have basic moderation tools, or, atleast the ability to edit posts by users and:

1) The person who posted can accept this edit

2) Other users can vote to say this edit was good

3) A moderator can accept the edit.

Just because I see this sometimes:

http://www.daniweb.com/software-development/cpp/threads/443078/matrix-multiplication

(I am not singling this user out, just a recent example) where the code isn't in code tags. It would be so much easier if users with a certain amount of rep can edit these articles, or, vote that they are closed - If they are not relevant or the question has already been asked and answered.

Thoughts, please?

phorce 131 Posting Whiz in Training Featured Poster

I'm not an expert in VB.net and I am not entirely sure on the nature of this question.

If you had let's say someone paid today, then you can do a calculation to check to see if someone has paid a month after this particular day. It would require basic calculations, i'm not sure how to do it in VB though, sorry.

The other solution maybe to have the details stored on a server (using mysql) and then having a cron job that ran every month, these results could then be parsed into the VB program.

phorce 131 Posting Whiz in Training Featured Poster

Hey thanks for the reply.

No, it didn't work! Gives this error:

MFCCexample.cpp:46: instantiated from here
/usr/include/c++/4.2.1/bits/stl_iterator_base_types.h:129: error: ‘double’ is not a class, struct, or union type

I even tried assigning it directly, I just get a segmentation fault. Any ideas?

phorce 131 Posting Whiz in Training Featured Poster

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 sample_rate) {
        int i,j,k,tap;
        double fmax;
        double dphi;
        double fsample;
        double freq;
        double temp[fft_size/2];

        fmax=2595*log10(8000.0f/700+1);
        dphi = fmax/17;
        freq = (double)sample_rate/fft_size;


        for (i=0; i<16; i++) {
                melstart[i]=fft_size/2;
                mellength[i]=0;
                memset(temp,0,sizeof(double)*fft_size/2);
                for (j=0; j<fft_size/2; j++) {
                        fsample = 2595*log10(freq*j/700 + 1);

                        if ((dphi*i <= fsample) && (fsample < dphi*(i+1))) temp[j] = (fsample-dphi*i)/(dphi*(i+1)-dphi*i);
                        if ((dphi*(i+1) <= fsample) && (fsample < dphi*(i+2))) temp[j] = (fsample-dphi*(i+2))/(dphi*(i+1)-dphi*(i+2));
                        if ((temp[j] != 0) && (melstart[i] > j)) melstart[i] = j;
                        if (temp[j] != 0) mellength[i]++;
                }

                mel[i] = malloc(sizeof(double)*mellength[i]);           
                memcpy(mel[i],&temp[melstart[i]],mellength[i]*sizeof(double));

                printf("%f\n", temp[melstart[i]]);
                for(k=0; (k < mellength[i]); k++)
                {
                    //printf("%f\n", mel[i][k]);
                }
//              for (k=0; k<mellength[i]; tap++,k++) printf("mel filter: %d, %d, %d, %f, %f\n",i,melstart[i]+k,tap,mel[i][k],(melstart[i]+k)*freq);
        }
}

And the C++ function I'm working on:

void setUp_Mel(int fft_size, int sample_rate, vector< vector< double > > &mel, int *melstart, int *mellength)
{
    double fmax;
    double dphi;
    double fsample;
    double freq;
    double temp[fft_size/2];

    fmax = 2595*log10(8000.0f/700+1);
    dphi = fmax / 17;
    freq = (double)sample_rate/fft_size;

      for(int i=0; (i < 16); i++)
      { 
           melstart[i]=fft_size/2;
           mellength[i]=0;
           memset(temp,0,sizeof(double)*fft_size/2);


          for(int j=0; (j < fft_size/2); j++)
          {
              fsample = 2595*log10(freq*j/700 + 1);

              if ((dphi*i <= fsample) && (fsample < dphi*(i+1))) temp[j] = (fsample-dphi*i)/(dphi*(i+1)-dphi*i);
                        if ((dphi*(i+1) <= fsample) && (fsample < dphi*(i+2))) temp[j] = (fsample-dphi*(i+2))/(dphi*(i+1)-dphi*(i+2)); …
phorce 131 Posting Whiz in Training Featured Poster

This is an introduction forum so probably not the best place to ask this question. You can ask this question in the "Networking" forum.

Is the router kicking out the same NAT IP for the Kindle and therefore when it tries to connect to the laptop, it kicks it off? Interesting. Have you run the recent update on the Kindle fire? I hear that people are having problems with the WIFI.

phorce 131 Posting Whiz in Training Featured Poster

I think this feature is more vb boards and wasn't implement in the new build. I don't think it's needed, personally, I find it annoying when people know you're online.. Sometimes I got: "You're online, I can see it but you're still not replying to m thread" awkward.

phorce 131 Posting Whiz in Training Featured Poster

Hey,

Try this:

<?php
  $node = node_load(arg(1));
  $type = $node->type;

  if(substr($_SERVER["REQUEST_URI"], 0, 13) == '/our-people')
  {
     return true;
  }else if(substr($_SERVER["REQUEST_URI"], 0, 13)) {
     return false;
}else{
  return in_array($type, array('3_column_interior_page', '3_column_faculty_bio_page'));
}
phorce 131 Posting Whiz in Training Featured Poster

Hello,

Yes this is possible - But, you need to be specific in what it is exactly you want to do, and, what language you want to do this in. Let's look at what you will need (IMO):

  • The router you have needs DHCP turns off.

  • The router needs to connect to the router that connects to the internet.

  • You need another device (external harddrive, or, a computer to connect the router to it).

  • You need to port forward 80 and 22 on the router BUT to the computer/hard drive that you have port- forwarded to.

You will now be given an IP address (internal: 182.169.0.0 -> external: 89.0.0.0 etc) in which you can type into a Web browser OR ssh into.

Now in terms of software, I don't think C++ is the best option for this (IMO).. Yes, I suppose you can make a good, solid FTP server BUT if you just want to use it then you might as well build something simple and yet effective in PHP etc. Obviously, you will need to have a web server running, but, this is not too complex at all. If I was doing this (in your position), I would go down the PHP route IMO but I may extend it to have a C++ interface in the future when I know more about this area.

Hope this helps :)

phorce 131 Posting Whiz in Training Featured Poster

First off:

void main( )

that's bad, you should use

int main()

This is also bad:

for (int x = i; x < 50; x++)

you shouldn't implicity hard-code these values, it should be the SIZE of the array and not 50 (even though your array length is 50) .. What if more values are added?

EDIT: Just re-read the function, my bad.

phorce 131 Posting Whiz in Training Featured Poster

I've done Image recognition before.. What I am trying to find out from you is that, does the image "corrupt" when you try to reconstruct it? Show me the code (if you know) where the image corrupts, i.e. I'm guessing you write the image data back to the file, correct?

phorce 131 Posting Whiz in Training Featured Poster

No problem :)!

Please mark this as solved, if you have any more questions feel free to ask / post! Good luck

phorce 131 Posting Whiz in Training Featured Poster

Yes, you can do.

Store the values inside an array, then send the reference (pointer) of this array to a function that checks to see if the value is unique. (You can even construct a temp array to store the unique values inside) then you can print these to a file.

phorce 131 Posting Whiz in Training Featured Poster

You can't pass the vector as an array.. Your problem is here:

void counter(vector<int> count[]);

Do this:

void counter(vector<int> &count); // sending reference

Also, you can't allocate memory for a vector like this:

vector<int> list[5];

Instead you can do this:

vector<int> list(5, 0); // size of 5, pushes back 0's

Here, the code:

#include <iostream>
#include <vector>

using namespace std;

void counter(vector<int> &count);

int main (){    
        vector<int> list(5, 0);
        counter(list);

        return 0;
}

void counter(vector<int> &count){
        int i, j=0;

        for(i = 0; i <= count.size(); i++){
                j++;
        }

        cout << "There are " << j << " elements.\n";
}

Hope this helps :)

phorce 131 Posting Whiz in Training Featured Poster

Hey,

Is this to do with image recognition / Object recognition? Do you have any code to show, where it fails...?

phorce 131 Posting Whiz in Training Featured Poster

@<MICHAEL> If we're talking about "Layouts" etc.. Then usually you can copyright these, as, these have been designed by someone.. If you're talking about colour schemes then no, it's impossible IMO. You could have someone say "I own the colours in the order of BLUE, RED, PURPLE" but people have been using these on their products / mixing these colours for centuries. Get my point?

EDIT: There is also a massive Patent war going on between companies. Of course major companies will go after small companies via patents because they want full domination. It's when you get people like Google, Apple, Microsoft all battling, that's what causes problems, or, problems on a larger scale.

phorce 131 Posting Whiz in Training Featured Poster

This:

$ram02 = new $ram01();

Should be:

$ram02 = new ram01();

There are many ways. You could put the "high-low", "low-high" within a class method and have an object call it.. Looks more cleaner.

phorce 131 Posting Whiz in Training Featured Poster

Why are you not using a more Object Oriented approach?

phorce 131 Posting Whiz in Training Featured Poster

Are you allowed to sue someone for using the exact colors with similar logo design...

Logo, yes.

Colours, no. Imagine how hard that would be... You'd have to go all the way back in history to William Henry Perkin (1856) who discovered it.. There would be no way to get a Patent for any colours, even on colour schemes.

phorce 131 Posting Whiz in Training Featured Poster

Hey,

I don't think you can do this.. I'm guessing your database information is in the file, so therefore, the connection code needs to be there as well.

$connection = mysql_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD) or die('Oops connection error -> ' . mysql_error());
    mysql_select_db(DB_DATABASE, $connection) or die('Database error -> ' . mysql_error());

if these details are correct, you can then include/require/require_once the file and a connection to the database will be established WHICH will enable you to execute queries.. It doesn't know what DB_SERVER etc is/where it's stored.

EDIT: Can you post what is stored inside "connect_db", removing passwords etc.. =) Also, it's not a good idea to use mysql_* anymore as it's being depreciated.. Use mysqli_* etc..

phorce 131 Posting Whiz in Training Featured Poster

Hey,

so

$headers = @get_headers($url);

we will get the headers from the specific url, store it into an array..

Then we'll check to see what the first element and check the response.. If there isn't a response then we'll return false otherwise return true..

phorce 131 Posting Whiz in Training Featured Poster

I believe you can use LIKE...

SELECT username FROM users WHERE username LIKE 'John'
phorce 131 Posting Whiz in Training Featured Poster

But, if you need to enter an ID.. why are you entering 323 over 0900527??

I don't understand what it is you're trying to do!

Here, try this:

<?php

    function _checkFileExists($url)
    {
        $headers = @get_headers($url);
        if($headers[0] == 'HTTP/1.1 404 Not Found') {
            return false;
        }else{
            return true;

        }

    }

    $url = "http://www3.uic.edu.ph/images/100x102/";
    $id = "0900527.jpg";

    $res = $url . $id;

    if(_checkFileExists($res))
      echo 'It exists';
    else
     echo 'Sorry, it does not exist';
?>
phorce 131 Posting Whiz in Training Featured Poster
if(file_exists($complete))
{
    // true
}else{

  // false
}

EDIT: It doesn't look like "http://www3.uic.edu.ph/images/100x102/232.jpg" exists, or, you do not have permission.. Is this your School/College by any chance, and works for you when you sign into the service?