Computing volume … estimating cycle freq

Moderator: Mike Everman

Ghrey
Posts: 286
Joined: Fri Feb 15, 2008 8:41 am
Antipspambot question: 125
Location: Studio City, California
Contact:

Re: Computing volume … estimating cycle freq

Post by Ghrey » Sat Nov 28, 2009 7:50 am

I do have wine BUT just double clicking gave no response. SO . . .

I opened the Terminal window Dragged and dropped. Which gave me the filename/path I then hit return.

It ran.

It should be noted that I had the .exe on the desk top.


Odd what?


Virtual PC handles it fine on my Mac, Runs to spec.
In the process of moving, from the glorified phone booth we had to the house we have.

No real time to work on jets, more space, no time.

Life still complicated.

tufty
Posts: 887
Joined: Wed Dec 24, 2003 12:12 pm
Antipspambot question: 0
Location: France
Contact:

Re: Computing volume … estimating cycle freq

Post by tufty » Sat Nov 28, 2009 2:02 pm

Ghrey wrote:I opened the Terminal window Dragged and dropped. Which gave me the filename/path I then hit return.

It ran.
Linux Unified Kernel installed? Or has wine somehow managed to get a hook into the kernel to handle pe/coff executables?

In either case, this would scare the crap out of me. Running windows executables without having to manually do something opens the door for running all sorts of stuff you don't want running.

WebPilot
Posts: 3716
Joined: Tue Dec 07, 2004 6:51 pm
Antipspambot question: 0
Location: 41d 1' N 80d 22' W

Re: Computing volume … estimating cycle freq

Post by WebPilot » Sat Nov 28, 2009 7:53 pm

 It's interesting that wine is run at the command prompt for a windows executeable, without typing it.

 I'm aware of the situation now, but it's no big concern to me. I'm not going to worry myself to death about it to the point where I can't get anything done. If something is running I don't wish to run, I'll use kill or the Force Quit Button.

WARNING: If you run wine under *NIX, you take the the chance of running a windows virus. If you're too worried about it, uninstall it or don't install it. It's that simple.

 I plan to continue to write software for both platforms. As some protection against passing along a virus to µSoft windows users, I've installed

   Image
Ghrey wrote:Virtual PC handles it fine on my Mac, Runs to spec.
 Thanks for this. I've touched the big three OSes.

PS ... and thanks, Ghrey, for the tip about dragging and dropping the file name to the command line.
Image

tufty
Posts: 887
Joined: Wed Dec 24, 2003 12:12 pm
Antipspambot question: 0
Location: France
Contact:

Re: Computing volume … estimating cycle freq

Post by tufty » Sun Nov 29, 2009 3:30 pm

WebPilot wrote:
Ghrey wrote:Virtual PC handles it fine on my Mac, Runs to spec.
 Thanks for this. I've touched the big three OSes.
Why not 4? Or 5? After all, Wine runs on FreeBSD / NetBSD fine. How about 6? Solaris? Yup. Ummm - hold on for a second. You've touched one, and only one, of the "big 3" - For OSX, Virtual PC, VirtualBox, Parallels, Bochs, QEmu, VMWare and the like all provide virtual machines and require an actual 100% legit (*ahem*) Windows install, you can't claim that this is even close to "running on the Mac", any more than I can claim my latest bit of OSX software runs under Windows "because you can always run it under PearPC, or dual boot using a hooky Hackintosh install". The majority of these also require a specific hardware platform (intel macs only need apply) as well, and have major constraints as to the type of hardware that can be attained. Even Wine (or Darwine, for OSX) isn't really "portability", it's about having an application layer in place to sorta kinda emulate Windows, and will *only* run on a specific subset of architectures . If you'd managed to touch Linux, I'd be able to run the app on my router over an SSL connection. Or under FreeBSD. Wine works on FreeBSD, right? Not on my Sparc64 machine, it doesn't, and that's not exactly short of horsepower.

If you'd provided source code, of course, you could have claimed to have touched all the major operating systems, and the majority of minor ones.

Not that I'm taking exception to how you've chosen to distribute this - that's entirely your choice - but emulation / virtualisation of Windows doesn't count as platform independence.

WebPilot
Posts: 3716
Joined: Tue Dec 07, 2004 6:51 pm
Antipspambot question: 0
Location: 41d 1' N 80d 22' W

Re: Computing volume … estimating cycle freq

Post by WebPilot » Sun Nov 29, 2009 5:43 pm

 I think the majority of the forum members here use Windows, a few % Mac and very few are *nix. With wine, this program seems to run on *NIX; at least on Ubuntu which as I've read you don't like. To me, those are the only three I'm worried about in order to get a working program to the masses. Before I made the major switch to Ubuntu, I didn't even care if it worked on anything but µSoft OSes.

 You never posted you got it to work on your OS. Fear of wine? Disdain for µSoft products?

 As far as giving away the source code, I could in this case. But why should I have all the fun and do the work for you?
Image

tufty
Posts: 887
Joined: Wed Dec 24, 2003 12:12 pm
Antipspambot question: 0
Location: France
Contact:

Re: Computing volume … estimating cycle freq

Post by tufty » Sun Nov 29, 2009 8:39 pm

WebPilot wrote:As far as giving away the source code, I could in this case. But why should I have all the fun and do the work for you?
I already have your sourcecode. Or, at least, something approximating it, which compiles to a functionally equivalent program (even down to the copyright notice) on any platform that has a standard C library. Working out how I went about getting that is left as an exercise to the reader :)

Personally, I run Macs on the desktop (both PowerPC and Intel), have a FreeBSD / Sparc64 server here, and a few devices running linux. None of these will run windows applications out of the box without an additional emulation or virtualisation layer, some won't ever be able to do so, and even for those that do, results differ based on the platform.

Oddly, yes, I do have a disdain for the vast majority of MS's products.

For a rant, click here.

WebPilot
Posts: 3716
Joined: Tue Dec 07, 2004 6:51 pm
Antipspambot question: 0
Location: 41d 1' N 80d 22' W

Re: Computing volume … estimating cycle freq

Post by WebPilot » Mon Nov 30, 2009 6:31 pm

 Where was I? I was going to make another point.

 Hmmmm. Well, it will occur to me again.
Image

WebPilot
Posts: 3716
Joined: Tue Dec 07, 2004 6:51 pm
Antipspambot question: 0
Location: 41d 1' N 80d 22' W

Re: Computing volume … estimating cycle freq

Post by WebPilot » Tue Dec 01, 2009 9:49 pm


 The crux of this program is exemplified by the following few lines in BASIC.

Code: Select all

 1 REM 
10 flag$="y" 
20 while flag$ = "y" OR flag$ = "Y"
30 print "flag is ", flag$
35 input "continue? Type Y or N ";flag$
40 wend
Image

WebPilot
Posts: 3716
Joined: Tue Dec 07, 2004 6:51 pm
Antipspambot question: 0
Location: 41d 1' N 80d 22' W

Re: Computing volume … estimating cycle freq

Post by WebPilot » Wed Dec 02, 2009 1:31 am


 This is the above snippet's corresponding flow chart. I did it in antiquated ASCII art.

Code: Select all

            -------
           ( Start )
            -------
               |
               |
          ------------
         | Initialize |
         |            |
         | flag$ = y  |
         |            |
          ------------
               |
               |
  ------------->o
|    	       |
|              |
|         --------------
|        /	          /
|       / print flag$ /
|      /	          /
|      --------------
|              |
|   	        |
|         --------------
|        /	          /
|       / input flag$ /
|      /	          /
|      --------------
|              |
|              |
|              |
|             / \
|           /-   -\
|         /-       -\
|       /-           -\
|     /-   Is Flag$    -\
|   /-                   -\
 ---       equal to
Yes \-                   -/
      \-    Y or y?    -/
        \-           -/
          \-       -/
            \-   -/
              \ /
               |
               | No
               |
            -------
           ( Stop  )
            -------

Image

WebPilot
Posts: 3716
Joined: Tue Dec 07, 2004 6:51 pm
Antipspambot question: 0
Location: 41d 1' N 80d 22' W

Re: Computing volume … estimating cycle freq

Post by WebPilot » Wed Dec 02, 2009 5:28 pm

 This is much prettier and perhaps easier to understand.

Image

 Notice that I've basically REM'ed line 30 here.
Image

WebPilot
Posts: 3716
Joined: Tue Dec 07, 2004 6:51 pm
Antipspambot question: 0
Location: 41d 1' N 80d 22' W

Re: Computing volume … estimating cycle freq

Post by WebPilot » Thu Dec 03, 2009 4:58 am


 I've added the main initialization, input, calculation and output, here.

Image

 Once coded, this program will be useful for determining overall length and volume.
Image

WebPilot
Posts: 3716
Joined: Tue Dec 07, 2004 6:51 pm
Antipspambot question: 0
Location: 41d 1' N 80d 22' W

Re: Computing volume … estimating cycle freq

Post by WebPilot » Thu Dec 03, 2009 7:13 pm


 It is a pain to create a flowchart, but it makes it a lot easier and quicker to program.

Code: Select all

  1 REM *************************************************
  2 REM Program to calculate volume of a pulsejet made up
  3 REM   of cylindrical and partial conical shapes
  4 REM *************************************************
  5 REM   written by Forrest Eckstein Dec 3, 2009 
  6 REM
  7 REM variables:
  8 REM  Cylinder: diaCyl,lenCyl,volCyl
  9 REM  Frustum of cone: diaFoc1,diaFoc2,lenFoc,volFoc
 10 REM  flag$ -> flag for main loop : pick -> volume shape identifier
 11 REM constants: pi (defined)
 12 REM 
 14 REM *************************************************
 16 REM
 18 REM initialize variables 
 20 flag$="y":volTOT=0.0:lenTOT=0.0:volCyl=0.0:volFoc=0.0
 22 REM define pi
 24 pi=4.0*atn(1.0) : REM print "Pi is "; pi
 25 REM
 26 while flag$ = "y" OR flag$ = "Y" : REM start of main loop
 27 REM print "flag is ", flag$
 28 REM
 30 REM initialize/reset variables in loop
 40 diaCyl=0.0:lenCyl=0.0:diaFoc1=0.0:diaFoc2=0.0:lenFoc=0.0
 45 volCyl=0.0:volFoc=0.0
 50 REM
 55 REM input shape and parameters
 60 input "Pick a shape: 1. cylinder or frustum of cone (press 1 or 2) ";pick
 70 if (pick=1) then
 85   input "cylinder diameter (inches)"; diaCyl
 90   input "cylinder length (inches)"; lenCyl
 93   volCyl=pi/4.0*diaCyl^2*lenCyl
 95 else
100   input "frustum of cone diameter 1 (inches)"; diaFoc1
105   input "frustum of cone diameter 2 (inches)"; diaFoc2
110   input "frustum of cone length (inches)"; lenFoc
120   volFoc=pi/3.0*lenFoc*(diaFoc1^2 + diaFoc1*diaFoc2 + diaFoc2^2)/4.0
140 end if
150 REM
160 REM update total volume and length
170 volTOT=volTOT+volCyl+volFoc
180 lenTOT=lenTOT+lenCyl+lenFoc
300 input "continue? Type Y or N ";flag$
310 wend
400 REM 
410 REM print output
415 print ""
420 print "Total composite length is"; lenTOT; " in"
430 print "Total composite volume is"; volTOT; " in³"
440 print ""
999 stop
Image

WebPilot
Posts: 3716
Joined: Tue Dec 07, 2004 6:51 pm
Antipspambot question: 0
Location: 41d 1' N 80d 22' W

Re: Computing volume … estimating cycle freq

Post by WebPilot » Fri Dec 04, 2009 6:45 pm


 The code passes the prior volume verification test.

Image
Image

PyroJoe
Posts: 1743
Joined: Wed Aug 29, 2007 5:44 pm
Antipspambot question: 125
Location: Texas

Re: Computing volume … estimating cycle freq

Post by PyroJoe » Fri Dec 04, 2009 9:01 pm

QBASIC ran it as well, put some spaces in to track the inputs easier.
Attachments
run1.JPG

WebPilot
Posts: 3716
Joined: Tue Dec 07, 2004 6:51 pm
Antipspambot question: 0
Location: 41d 1' N 80d 22' W

Re: Computing volume … estimating cycle freq

Post by WebPilot » Sat Dec 05, 2009 2:06 am


 Thanks; good to read and not surprised. The interpreter I use is similar to GWBasic. I use to use QBasic, too, back in my 386/486 days. However, I found trying to run QBasic code in the GWBasic interpreter didn't always work without rewrite.
Image

Post Reply