Just had to show off...

Discussion in 'Software' started by Robster12, Jun 20, 2004.

  1. Robster12

    Robster12 The Horse Whisperer

    I won't do this again, promise.
    I just had to show off the first proggy I wrote. Its an exercise in the C lang book that I got. Even though its a "baby" program, I had to work with the syntax a little, LOL.
    Hope it formats ok on this board:

    /* second_exer5.1.c
    This is a very rough attempt to get this Centigrade to Fahrenheit conversion
    thingy to work. */

    #include<stdio.h>

    char line[25]; /* data input line (will be used to store degrees Centigrade) */
    float centigrade; /* degrees Centigrade (input) */
    float fahrenheit; /* degrees Fahrenheit (output) */

    main()
    {
    /* I added a newline to this printf statement: */
    printf("Enter a pure number for temperature in Centigrade and hit Enter: \n");

    /* Now, to get the input from the user */
    fgets(line, sizeof(line), stdin);
    sscanf(line, "%f", &centigrade);

    /* here is a printf statement to make sure that we are good up to this point */
    printf("## after sscanf, centigrade = %f \n" , centigrade);

    /* now we try to do the calculation to convert Centigrade to Fahrenheit */
    fahrenheit = ((9.0 / 5.0) * centigrade) + 32;

    /* give the output (fahrenheit) to the screen */
    printf("Fahrenheit = %f \n", fahrenheit);


    return 0;

    }
     
  2. NeoNemesis

    NeoNemesis Moutharrhea

    lol that was my first program also. What book are you reading?
     
  3. Robster12

    Robster12 The Horse Whisperer

    I haven't had time of late, but I will start again...
    hehe
    Oh, and I have a need for the skills now, to make a program to record work done as a function of time for the MajorGeeks Folding@Home team!

    Here's my book:
    http://www.oreilly.com/catalog/pcp3/
     
  4. NeoNemesis

    NeoNemesis Moutharrhea

    oh, i am still reading more on C++ for Dummies. Which is a great book. as you can see, i am programming c++, but for the stuff im learning, its practically the same thing as c.
     
  5. Anon-15281db623

    Anon-15281db623 Anonymized

    I cant wait for you to finish! Start crackin!

    :cool:

    cooked
     
  6. Robster12

    Robster12 The Horse Whisperer

    Haha!
    Well, I'm doing all by hand, kind of right now. But, I did manage to write a bash shell script that will read some files into gnuplot. The output is the same, I just want to make a little "front end thingy" (for lack of knowing what to call it) for myself, to make the work easier, and to practice.

    BTW, here is the main script for the gnuplot...
    For me this is an accomplishment, guys....
    hehe



    # fold_plot_script.p
    # This is the first script that I have written for the Folding At Home data
    # to be run through the gnuplot program.


    set title "Work Done as a function of time for the Folding At Home"
    set xlabel "Time (days)"
    set ylabel "Work done (score)"
    set grid
    set key left
    set xdata time
    set timefmt "%Y-%m-%d"
    plot "date_format3.txt" using 1:2 title 'robstr' w linespoints, \
    "date_format3.txt" using 1:3 title 'mgrist' w linespoints, \
    "date_format3.txt" using 1:4 title 'schism' w linespoints, \
    "date_format3.txt" using 1:5 title 'rond36' w linespoints, \
    "date_format3.txt" using 1:6 title 'Bluesman' w linespoints, \
    "extended.txt" using 1:2 title 'Goldfish' w linespoints, \
    "extended.txt" using 1:3 title 'OverCooked' w linespoints, \
    "extended.txt" using 1:4 title 'fingerbanger' w linespoints, \
    "extended.txt" using 1:5 title 'RadioFool' w linespoints
     
  7. Robster12

    Robster12 The Horse Whisperer

    Here is the output of the above script (with the data files) through gnuplot:
     

    Attached Files:

  8. goldfish

    goldfish Lt. Sushi.DC

    front end thingy = GUI,

    and you can use the
    Code:
     tags to format code :) 
    
    That program... now you need to develop further it so that if I put "arrrghh" into it, it wouldnt crash, and also have it calculate it the other way around as well :)
    
    Try doing some maths programs too... likes some geometry programs.  One of my first Win32 programs was a program to calculate the area of a triangle, given the length of the sides. 
    
    That graphs lookin good :D Now all you need to do is have it make the graph, export it to a JPG file and upload it to some webspace... so we can have some real-time stats :D
     
  9. Robster12

    Robster12 The Horse Whisperer

    No, I meant, I want to write a bash script or a C program that will ask me say...
    "What day is today...." Then I will enter the date.
    Then it will ask me...
    "What score does ...<such-and-such folding team member> have for today...
    And I will enter the score...
    And then the program (or script) will format the data to a file that is suitable to run through gnuplot.

    The next step would of course be to modify it to run gnuplot automatically.

    Now as far as....
    goes....


    What? Remember, I'm a little baby geek. I can only take baby geek steps....


    :)
     
  10. goldfish

    goldfish Lt. Sushi.DC

    Oh right! so front-end thingy : a console wrapper for another program!

    What I was trying to say...

    Find out how to create a JPG using gnuPlot (a command line parameter maybe?), and have it save it somewhere, like a temp directory or somthing. You might need to have it output a BMP of the plot, and then convert it to JPEG.

    Then, have the script/program upload that image to some webspace via FTP. so... if we had www.majorgeeks.com/dcing (hint hint Tim and/or Jim;) ) there would be a file www.majorgeeks.com/dcing/teamstats.jpg, which is updated by your machine. So that means you just have to type in some numbers, press a button and hey presto, the online stats are updated! :D

    Obviously, the final stage of this would be to have a program that runs on the server using a cron job which makes a plot and automatically updates the image file using the stats from stanford, requiring no intervention from you, or needing your machine to be turned on.

    I'm using EM to monitor my F@H clients, and it takes a screencap for each machine every time it completes a frame, and uploads it to my server. So that means you can look at www.goldfishsbowl.co.uk/folding and see what my rigs are up to.. to their nearest frame. Same principle, except the data is from a different source :)
     
  11. Robster12

    Robster12 The Horse Whisperer

    Console wrapper for a program.
    Yes.
    This is all great, Goldfish!
    Just the kind of thing that I am interested in doing.

    I took the Linux+ certification test today, for what its worth (I know, people make fun of certs)

    Now that that is out of the way, I can concentrate a little more on coding and scripting. But, I am so new at it that it may take some time.

    As far as web hosting, I am allotted space on my ISP's server, so that I can put it there first, and update it from my dial-up, oh, say, once a day or so...

    Yes, I need to make a web page for this.

    I just now looked at yours. Its very well done! I like it!

    :p ;) :) :) :) :) :) :) :) :) :)
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds