User Profile

Collapse

Profile Sidebar

Collapse
sixtyfootersdude
sixtyfootersdude
Last Activity: Nov 19 '09, 11:08 PM
Joined: Oct 4 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Problem solved.

    ARRRRRG. So stupid. Problem solved.

    When I was adding my hashes to the arrays I was adding references to references.

    Ie:

    I was doing:
    Code:
    			push(@input,/$hash);
    Instead of:
    Code:
    			push(@input,$hash);
    Stupid mistake. Thanks for reading.

    Jake
    See more | Go to post

    Leave a comment:


  • Printing array of references to hash maps (perl newbie)

    Good Morning!

    I am a perl newbie and I think that I am struggling with references.

    I have an array of references to hashes which I am trying to print. This is what I have:

    Code:
    	for(my $i=0; $i<@input; $i++){
    		my $hash = $input[$i];
    		print "$i: \n";
    		print "\t".'$hash = ';
    		print $hash;
    		print "\n\t".'${$hash} = ';
    ...
    See more | Go to post

  • sixtyfootersdude
    replied to print("@input") VS print(@input)
    in Perl
    OOOOOOOOOOOOOOO OO. Ok that makes sense. Thanks for the reply.

    Jake
    See more | Go to post

    Leave a comment:


  • sixtyfootersdude
    started a topic print("@input") VS print(@input)
    in Perl

    print("@input") VS print(@input)

    Good Morning!

    I am just starting to learn perl and I am somewhat mistifide about when I should do:

    Code:
    print("@input");
    and when I should do:

    Code:
    print(@input)
    Coming from Java I would do:

    Code:
    for(int i=0; i<array.length;i++){
      System.out.print(array[i]);
    System.out.println();
    I cannot figure out why the print with the quotations...
    See more | Go to post

  • THanks! I will investigate!
    See more | Go to post

    Leave a comment:


  • Forking? Calling unix commands from python

    Hey all!

    Just doing some tinkering with python. I am running mac os x and I am wondering how I can call unix commands from python. In C I think I would use a fork, although it has been sometime since I have used C so I am a little fuzzy on the syntax.

    I also want to use what the unix command returns.

    Example:

    Typed in the command line: python myProgram.py

    myProgram.py...
    See more | Go to post

  • Sorry this post is somewhat old but I have the same question. I understand why this is problematic. However I am uncertain how to do this better.

    Code:
    int & f()
    {
       int c=4;
       return c;
    }
    int main()
    {
        int b=f();
        cout<<b;
    }
    I think that I can do this however I am not sure what the implications would be:

    Code:
    int & f()
    ...
    See more | Go to post

    Leave a comment:


  • sixtyfootersdude
    replied to read in from file
    Ooops. The previous code does not detect EOF (well it does sometimes, just not not always...)

    Regardless, this code works:

    Code:
    # reads words from the input file
    def readWords():
    	jake = sys.stdin
    	listOfWords= jake.readlines()
    	listOfWords = [i[:-1] for i in listOfWords]
    	return listOfWords
    See more | Go to post

    Leave a comment:


  • sixtyfootersdude
    replied to read in from file
    Thanks bvdet .

    For anyone with a similar problem as me this is the way I ended up doing it:

    Code:
    def readWords():
    	while 1:
    		line = raw_input()
    		if line != "":
    			listOfWords.append(line);
    		else:
    			break
    #End read words method
    See more | Go to post

    Leave a comment:


  • sixtyfootersdude
    started a topic read in from file

    read in from file

    Hi all,

    trying to write a program that will read a file in like:

    python myprog < inputFile

    the program needs to store each line a an entry in a list.

    Code:
    li = []
    
    
    for i in range(0,9): #<- these must be the correct range.    
    	temp = raw_input("")
    	li.append(temp)

    This code works but you...
    See more | Go to post

  • sixtyfootersdude
    started a topic Input and IDLE

    Input and IDLE

    Howdy,

    New to python and have two quick questions.

    I need to write a program that is executed like:

    python myprogram < input.txt

    on the command line. I am uncertain how to do this. If anyone could give me a hint that would be super.

    Also on the form there has been some reference to IDLE. I know it is an IDE but not sure how to get it (on mac os x) or if it would...
    See more | Go to post

  • Done and thanks Smygis....
    See more | Go to post

    Leave a comment:


  • Python Compatability and Upgrading Python on Mac OS X

    Hey,

    My prof just out of the blue decided that we would teach ourselves python over the weekend.

    I am running Mac OS X Version 10.4.10 and Python version 2.3.5 came pre-installed on my machine. I have done a bit of looking around but found no good explanation of how to upgrade this. I know the marker will be using Python 2.5.1, will anything that I write in Python version 2.3.5 work on the later version? Or is NOT...
    See more | Go to post

  • AS3 is object oriented. I have never actually coded in AS2 but since it is not OOP it will be very differnt. I persionally prefer OOP (object oriented programming) but it is like comparing a snowmobile to a car. Very very differnt

    Jake...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...