Skip navigation

a post in progress

The purpose of this post is to accumulate references / links to how to get started in 99 programming languages. The objective is a one-stop post that I can refer to in the future to remember how to set up a given programming language environment.

  • C or C++

    Ubuntu:

    apt-get install gcc
    apt-get install build-essentials
    
    if not working, then be sure to
    apt-get update
    first
    
    #include 
    int main()
    {
      // this is a comment.
      printf("Hello, world") ;
      return 0 ;
    }
    
  • php

    download it
    this was a good tutorial, but is since taken offline. basically the lines you need to add to httpd.conf are:

    # location of the .dll
    LoadModule php5_module "C:/Program Files/Apache Software Foundation/Apache2.2/php/php5apache2_2.dll"
    
    # location of the ini directory where php.ini sits
    PHPIniDir "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/php/"
    
    # definition of the mime-type:  ADD to the  section:
    <IfModule mime_module>
      AddType application/x-httpd-php .php
    </IfModule>
    

    And that’s it. Other things I like to do to PHP.ini when first setting up are:

    • change error_reporting to E_ALL by setting error_reporting = E_ALL
    • turn on the $_ENV array by setting variables_order = "GPCES"
  • perl.

    Get it from activestate.
    you need to edit httpd.conf again to let apache know that anything accessed via a url like:

    http://localhost/cgi-bin/scriptname

    IS a script that needs to be executed/run, and NOT just some static html or image or content file that can be straight delivered.

    So you set up this “ScriptAlias” setting:

    
        # GENERAL FORMAT OF AN ALIAS:
        # Alias /webpath /full/filesystem/path
    
    
        # Example of an alias:
        Alias /special-docs C:\specialDocs\
        # above rule means that any requests for
        # http://localhost/special-docs/document.doc
        # would actually map down to a request on
        # the computer hard disk for
        # C:\specialDocs\document.doc
        # so, this ALIAS defines basically a second
        # document root, in a sense... a folder
        # from which apache will serve documents
        # out of OTHER THAN htdocs.
    
        # now, for a scriptalias:
        ScriptAlias /cgi-bin/ "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin/"
        # this says anything accessed
        # via http://localhost/cgi-bin/WHATEVER.SCRIPT
        # should really be looked up as a SCRIPT TO RUN
        # that is stored on the hard disk at
        # C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/WHATEVER.SCRIPT
    
        # So, you DON'T store perl scripts in htdocs!  You store them IN THE CGI-BIN
        # FOLDER AS DEFINED HERE.  It could be C:/cgi-bin.  Apache doesn't care.
    
        # Now, allow execution of CGI scripts
        # IN the directory you just specified.
        <Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin/">
          AllowOverride None
          Options +ExecCGI
          Order allow,deny
          Allow from all
        </Directory>
    
        # FINALLY, a handler
        AddHandler cgi-script .cgi .pl .py
        # so ALL these file extensions (.cgi, .pl or .py)
        # are handled as CGI scripts.
    

    BUT YOU AIN’T DONE YET!!

    If you try to run your perl scripts, you might see errors like:

    
    [Fri Dec 26 13:32:15 2008] [error] [client xx.yy.80.55] (13)Permission denied: exec of '/var/cgi-bin/run.pl' failed
    [Fri Dec 26 13:32:15 2008] [error] [client xx.yy.80.55] Premature end of script headers: run.pl
    
    

    Now, before you turn into this guy, go to /usr/lib/apache2/ and RENAME suexec to something like suexec.disabled. No time to explain, here’s why.

  • python. get it from python.org. More to come…
  • haskell

    try this

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: