Search Results

Search found 11458 results on 459 pages for 'perl thread'.

Page 10/459 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Java Threading Concept Understanding

    - by Nirmal
    Hello All... Recently I have gone through with one simple threading program, which leads me some issues for the related concepts... My sample program code looks like : class NewThread implements Runnable { Thread t; NewThread() { t = new Thread(this, "Demo Thread"); System.out.println("Child thread: " + t); t.start(); // Start the thread } public void run() { try { for (int i = 5; i > 0; i--) { System.out.println("Child Thread: " + i); Thread.sleep(500); } } catch (InterruptedException e) { System.out.println("Child interrupted."); } System.out.println("Exiting child thread."); } } class ThreadDemo { public static void main(String args[]) { new NewThread(); // create a new thread try { for (int i = 5; i > 0; i--) { System.out.println("Main Thread: " + i); Thread.sleep(1000); } } catch (InterruptedException e) { System.out.println("Main thread interrupted."); } System.out.println("Main thread exiting."); } } Now this program giving me the output as follows : Child thread: Thread[Demo Thread,5,main] Main Thread: 5 Child Thread: 5 Child Thread: 4 Main Thread: 4 Child Thread: 3 Child Thread: 2 Main Thread: 3 Child Thread: 1 Exiting child thread. Main Thread: 2 Main Thread: 1 Main thread exiting. So, that's very much clear to me. But as soon as I am replacing the object creation code (calling of a NewThread class constructor) to as follows : NewThread nt = new NewThread(); // create a new thread the output becomes a bit varied like as follows : Child thread: Thread[Demo Thread,5,main] Main Thread: 5 Child Thread: 5 Child Thread: 4 Child Thread: 3 Main Thread: 4 Child Thread: 2 Child Thread: 1 Main Thread: 3 Exiting child thread. Main Thread: 2 Main Thread: 1 Main thread exiting. And some times it's giving me same output in both the cases. So, i am not getting the exact change in both the scenario. I would like to know that you the variation in the output is coming here ? Thanks in advance...

    Read the article

  • Directing stdout of system command in Perl to filehandle

    - by syker
    With the open command in Perl, you can use a filehandle. However I have trouble getting back the exit code with the open command in Perl. With the system command in Perl, I can get back the exit code of the program I'm running. However I want to just redirect the STDOUT to some filehandle (no stderr). Is that possible?

    Read the article

  • perl escaping \n or \t

    - by Michael
    I need to escape \n so on output I really get newline or tab $ perl -p -e 's/e/a/ge' now I want each e to be substituted with \n $ perl -p -e 's/e/\n/ge' but even \n gives me an error. this was a simplified example. In real script(makefile) I have substitute := perl -p -e 's/@([^@]+)@/defined $$ENV{$$1} ? $$ENV{$$1} : $$1/ge' and in target I have such a nice command $(substitute) $< > $@ and if the input file for perl contains \n at output I will see it literally... I want to have real newline.

    Read the article

  • Perl - Internal File (create and execute)

    - by drewrockshard
    I have a quick question about creating files with perl and executing them. I wanted to know if it was possible to generate a file using perl (I actually need a .bat script) and then execute this file internally to the program. I know I can create files, and I have with perl, however, I'm wanting to do this internally to the program. So, what I want it to do is actually create a batch script internally to the program (no file is actually written to the disk, everything remains in memory, or the perl program), and then once it completes the writing of the file, I'd like to be able to actually execute this file, and then discard the file it just wrote. I'm basically trying to have it create a batch script on the fly, so that I can just have output text files from the output of the script, rather than creating the batch script on disk, then executing it, and then deleting the batch file from disk when its done. Can this be done and how would I go about doing this? Regards, Drew

    Read the article

  • autehntication on gui application written on perl

    - by oren
    Its not specific perl question I am building a perl gui/wxperl application that connect to DB . I want my application to be a password protected i.e first the user should enter the user and password and then use the appication . what is the best secure method to store the password could someone provide an idea what is the best method to how should i store the user and the password and how should i retrieve them for authentication ? if possible could someone provide some perl code how to do this ?

    Read the article

  • Setting up a common perl/cpan environment

    - by zedoo
    Hi, so I'm having a lot of fun with Perl at home for some time now. How much more difficult do things get when you develop Perl modules (In my case it's mostly catalyst) in a team? How do we make sure we all got the same development environment (Perl/Module versions)? Simply by keeping up to date with CPAN? Do some teams setup their 'private' CPANs?

    Read the article

  • DBD::Advantage and 64-bit Perl - Always 6060

    - by WarheadsSE
    I realize that I am attempting to go beyond the "supported" behavior of the manf's released drivers for perl, after all they have only released it in package with x86 .so's. However, since I cannot use their package with x64 Perl on a RHEL 5.4 x86_64 box, and maintaining a seperate install of x86 perl just for this one package, I have made an attempt to get this puppy working thanks to released 64-bit .so's that accompany other driver packages for Advantage. What I have done to this point: download beta 10 DBI drivers, in 32 download beta 10 PHP extension (it contains 32 and x86_64) copy the required DLLs into the ads-lib location (eg /usr/local/ads/lib64) compile the Perl DBI driver with the path to the lib64's .so's Good compilation, good install, good use. The problem is that I always get : failed: [iAnywhere Solutions][Advantage SQL][ASA] Error 6060: Advantage Database Server not available on specified server. axServerConnect (SQL-HY000)(DBD: db_login/SQLConnect err=-1) Does anyone have any ideas? EDIT: fixed package name in post title

    Read the article

  • How to Insert a sub string to each line in perl

    - by Nano HE
    Hi, My code as below, How to remove the blank after add hello. to each lines. #!C:\Perl\bin\perl.exe use strict; use warnings; use Data::Dumper; my $fh = \*DATA; #my($line) = $_; while(my $line = <$fh>) { print "Hello.".$line; chomp($line); } __DATA__ Member Information id = 0 name = "tom" age = "20" Output: D:\learning\perl>test.pl Hello.Member Information Hello. id = 0 # i want to remove the blank between Hello. and id Hello. name = "tom" # same as above Hello. age = "20" # same D:\learning\perl>

    Read the article

  • perl program doesn't work in windows

    - by dexter
    i have written following in index.pl which is in=" C:\xampp\htdocs\perl "--folder #!/usr/bin/perl print "<html>"; print "<h2>PERL IT!</h2>"; print "this is some text that should get displyed in browser"; print "</html>"; when i type: http://localhost:88/perl/ the above HTML doesn't get displayed (i've tried in IE FF and chrome) what would be the reason?? i have xampp and apache2.2 installed in system (windows XP)

    Read the article

  • What is dmake actually doing when installing a new module?

    - by aj-sin-dhal
    I just mangaged to install the perl/Tk module after much struggle. I realise I don't understand what dmake or make etc is actually doing. I am using strawberry perl installed at C:\strawberry. Fisrt I unpacked the module to another directory and ran perl makefile.pl which worked fine. Then I tried dmake which did not work. I guess that will be obvious to people who know how this works. When I placed the module as a sub-directory of C:\strawberry I could run perl makefile.pl, dmake, dmake test and dmake install. My guess is that dmake install is adding some executable files to the interpreter and to work the module must be in a subdirectory. Is there any article anywhere that explains what it is doing in detail?

    Read the article

  • Advice on coding Perl to work like PHP

    - by user272273
    I am first and foremost a perl coder, but like many, also code in PHP for client work, especially web apps. I am finding that I am duplicating a lot of my projects in the two languages, but using different paradigms (e.g. for handling cgi input and session data) or functions. What I would like to do is start to code my Perl in a way which is structured more like PHP, so that I a) am keeping one paradigm in my head b) can more quickly port over scripts from one to the other Specifically, I am asking if people could advise how you might do the following in perl? 1) Reproduce the functionality of $_SESSION, $_GET etc. e.g. by wrapping up the param() method of CGI.pm, a session library? 2) Templating library that is similar to PHP I am used to mixing my code and HTML in the PHP convention. e.g. i <h1>HTML Code here</h1> <? print "Hello World\b"; ?> Can anybody advise on which perl templating engine (and possibly configuration) will allow me to code similarly? 3) PHP function library Anybody know of a library for perl which reproduces a lot of the php inbuilt functions?

    Read the article

  • Perl vs Python but with more style than normally

    - by user350571
    I'm learning perl and everytime I search for perl stuff in the internet I get some random page with people saying that perl should die because code written in it looks like a lesson in steganography. Then they say that python is clean and stuff like that. Now, I know that those comparisons are always stupid and made by fellows that feel that languages are a extension of their boring personality so, let me ask instead: can you give me the implementation of a widely known algorithm to deal with a data structure like red-black trees in both languages so I can compare?

    Read the article

  • .NET equivalent to Perl regular expressions

    - by r_honey
    I need to convert a Perl script to VB.NET. I have managed almost the entire conversion, but some Perl (seemingly simple) regex are causing an headache. Can someone suggest me .NET equivalent of the following perl regex: 1) $letter =~ s/Users //,; $letter =~ s/Mailboxes //,; if($letter =~ m/$first_char/i){ 2) unless($storegroup =~ /Recovery/ || $storegroup =~ /Users U V W X Y Z/ || $storegroup =~ /Users S T/ || $storegroup =~ /Users Q R/){ The regex look simple to me. I tried to wade through perl.org but understanding a langugae regex takes sometime and I need to complete the conversion quickly.

    Read the article

  • Perl equivalent to Java's "throws" clause

    - by Konerak
    Is there a way in Perl to declare that a method can throw an error (or die)? EDIT: What interests me the most is a way to get the compiler or IDE to tell me I have an unchecked exception somewhere in my code. I always loved how in Java, a method could handle an Exception and/or throw it. The method signature allows to put "throws MyException", so a good IDE/compiler would know that if you use said method somewhere in your code, you'd have to check for the Exception or declare your function to "throws" the Exception further. I'm unable to find something alike in Perl. A collegue of mine wrote a method which "dies" on incorrect input, but I forget to eval-if($@) it... offcourse the error was only discovered while a user was running the application. (offcourse I doubt if there is any existing IDE that could find these kind of things for Perl, but atleast perl -cw should be able to, no?)

    Read the article

  • Differences between Perl and PHP

    - by lok
    I'm planning to lern Perl 5 and as I have only used PHP until now, I wanted to know a bit about how the languages differ from each other. As PHP started out as a set of "Perl hacks" it has obviously cloned some of Perls features. What are the main differences in the syntax? Is it true that with Perl you have more options and ways to express something? Why is Perl not used for dynamic websites very often anymore? What made PHP gain more popularity than it?

    Read the article

  • Perl vs Python: implementation of algorithms to deal with advanced data structures

    - by user350571
    I'm learning perl and everytime I search for perl stuff in the internet I get some random page with people saying that perl should die because code written in it looks like a lesson in steganography. Then they say that python is clean and stuff like that. Now, I know that those comparisons are always stupid and made by fellows that feel that languages are a extension of their boring personality so, let me ask instead: can you give me the implementation of a widely known algorithm to deal with a data structure like red-black trees in both languages so I can compare?

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >