Search Results

Search found 7 results on 1 pages for 'pmarcoen'.

Page 1/1 | 1 

  • Perl: catch error without die

    - by Pmarcoen
    I'm playing around with error handling and got a little problem. I connect with a database using the DBI module. I do my own error handling by using a subroutine that I call upon an error. I can catch my own dies and handle them just fine but when my database connection fails, the DBI module apparently prints out it's own die : DBI connect(...) failed: ORA-12154: TNS:could not resolve the connect identifier specified (DBD ERROR: OCIServerAttach) at ... How would I go about catching this ? I tried using $SIG{DIE} like so : local $SIG{__DIE__} = sub { my $e = shift; print "Error: " .$e; }; This is on the bottom of my main file, in this file I also call the connect subroutine that is available in a module of my own. I also tried putting this piece of code on the bottom of my module but it still prints the error without the "Error:" in front of it.

    Read the article

  • Jquery getJSON to external PHP page

    - by Pmarcoen
    I've been trying to make an ajax request to an external server. I've learned so far that I need to use getJSON to do this because of security reasons ? Now, I can't seem to make a simple call to an external page. I've tried to simplify it down as much as I can but it's still not working. I have 2 files, test.html & test.php my test.html makes a call like this, to localhost for testing : $.getJSON("http://localhost/OutVoice/services/test.php", function(json){ alert("JSON Data: " + json); }); and I want my test.php to return a simple 'test' : $results = "test"; echo json_encode($results); I'm probably making some incredible rookie mistake but I can't seem to figure it out. Also, if this works, how can I send data to my test.php page, like you would do like test.php?id=15 ? The test.html page is calling the test.php page on localhost, same directory I don't get any errors, just no alert ..

    Read the article

  • Which language to learn

    - by Pmarcoen
    I am fresh out of college, I'm pretty skilled in weblanguages like PHP, Perl, Javascript (JQuery). I have some basic skills in java, experienced c++ a little. People have been telling me c# is a good way to go because a lot of companies look for .NET developers. What would be a good next move for me ?

    Read the article

  • SQL: join within same table with different 'where' clause

    - by Pmarcoen
    Ok, so the problem I'm facing is this, I have a table with 3 columns : ID, Key and Value. ID | Key | Value ================ 1 | 1 | ab 1 | 2 | cd 1 | 3 | ef 2 | 1 | gh 2 | 2 | ij 2 | 3 | kl Now I want to select the value of Keys 1 & 3 for all IDs, the return should be like this ID | 1 | 2 ================ 1 | ab | ef 2 | gh | kl So per ID 1 row containing the Values for Keys 1 & 3. I tried using 'join' but since I need to use multiple where clauses I can't figure out how to get this to work ..

    Read the article

  • In Perl, how can I wait for threads to end in parallel?

    - by Pmarcoen
    I have a Perl script that launches 2 threads,one for each processor. I need it to wait for a thread to end, if one thread ends a new one is spawned. It seems that the join method blocks the rest of the program, therefore the second thread can't end until everything the first thread does is done which sort of defeats its purpose. I tried the is_joinable method but that doesn't seem to do it either. Here is some of my code : use threads; use threads::shared; @file_list = @ARGV; #Our file list $nofiles = $#file_list + 1; #Real number of files $currfile = 1; #Current number of file to process my %MSG : shared; #shared hash $thr0 = threads->new(\&process, shift(@file_list)); $currfile++; $thr1 = threads->new(\&process, shift(@file_list)); $currfile++; while(1){ if ($thr0->is_joinable()) { $thr0->join; #check if there are files left to process if($currfile <= $nofiles){ $thr0 = threads->new(\&process, shift(@file_list)); $currfile++; } } if ($thr1->is_joinable()) { $thr1->join; #check if there are files left to process if($currfile <= $nofiles){ $thr1 = threads->new(\&process, shift(@file_list)); $currfile++; } } } sub process{ print "Opening $currfile of $nofiles\n"; #do some stuff if(some condition){ lock(%MSG); #write stuff to hash } print "Closing $currfile of $nofiles\n"; } The output of this is : Opening 1 of 4 Opening 2 of 4 Closing 1 of 4 Opening 3 of 4 Closing 3 of 4 Opening 4 of 4 Closing 2 of 4 Closing 4 of 4

    Read the article

  • Perl: reference to subroutine in external .pm file

    - by Pmarcoen
    I'm having some trouble figuring out how to make a reference to a subroutine in an external .pm file. Right now, I'm doing this : External file package settingsGeneral; sub printScreen { print $_[0]; } Main use settingsGeneral; my $printScreen = settingsGeneral::printScreen; &$printScreen("test"); but this result into an error: Can't use string ("1") as a subroutine ref while "strict refs" in use

    Read the article

  • Perl: print back to beginning of line

    - by Pmarcoen
    Okay, so what I'm trying to do is print out a percentage complete to my command line, now, I would like this to simply 'update' the number shown on the screen. So somehow go back to the beginning of the line and change it. For example the windows relog.exe command-line utility (which can convert a .blg file to a .csv file) does this. If you run it, it will display a percentage complete. Now this is probably written in C++. I don't know if this is possible in perl as well ?

    Read the article

1