Wikipedia:Reference desk/Archives/Computing/2011 August 5

From Wikipedia, the free encyclopedia
Computing desk
< August 4 << Jul | August | Sep >> August 6 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


August 5[edit]

convert jpg to text[edit]

hi. how do I convert a jpg file to a numeric matrix? Actually I want three numeric matrices, one for red, one for green, and one for blue. Googling didn't help. I want an open source solution if possible. thanks, Robinh (talk) 08:54, 5 August 2011 (UTC)[reply]

What do you mean by a "numeric matrix"? Do you want a text file with the r values, expressed as, say decimals? -- Finlay McWalterTalk 11:09, 5 August 2011 (UTC)[reply]
This would be an easy program to write. Open the picture. Start at position 0,0 and move through to position W,H where W is the width and H is the height. Store the red, green, and blue value for each pixel. Done. You can do it with a graphics converter. When I have a chance, I will look up the image format which just stores the RGB values for each pixel (PBX is stuck it my head, but that isn't it). With that, you can open the jpg and save it in that format. Then, you just have to move the numbers around to organize them how you like. -- kainaw 12:44, 5 August 2011 (UTC)[reply]
You're probably thinking of Netpbm format. -- Finlay McWalterTalk 12:48, 5 August 2011 (UTC)[reply]
Yes. It is the PBM format. Open the jpg. Save it as PBM and you have a text file you can scan. -- kainaw 13:44, 5 August 2011 (UTC)[reply]
It is easy to do this from a coding perspective, but we'd need to know what language you're doing this in to give you any specific advice. Most languages of any importance already have graphical libraries for them that allow you to arbitrarily get the pixel values of many image formats. --Mr.98 (talk) 14:03, 5 August 2011 (UTC)[reply]
GNU Octave can load and convert JPG files using the imread function, which produces three matrices (R,G,B).. In some recent releases, though, the image-processing utilities have been buggy. ImageMagick can also covert JPG to PBM file format. Bear in mind that JPG files are not matrices of pixel values. They are compressed bitstreams of macroblocks of luma/chroma data. If you don't already know what this means, read our article on JPEG. You may actually want to stick to a simpler file type, such as BMP, PNG, or TIFF. For JPEG, you must learn about color space conversion, in addition to lossy compression, because a JPEG image is NOT a matrix of RGB values - it must be converted to one using a decompression and colorspace conversion algorithm. As mentioned above, a software library exists in almost every common language to decompress JPEG and render it into RGB , but this process is sort of more steps than you might expect. Nimur (talk) 14:42, 5 August 2011 (UTC)[reply]
The corollary to WP:WHAAOE, of course, is "every article needs a controversy section." But, this is a real one: I've seen so many different commercial and opensource implementations of JPEG 422 to RGB conversion... and I have seen the mysterious "travelling chroma" ghosts.... A word to the wise: if you aren't sure how your JPEG was produced, use caution poking at its RGB raster. The RGB values are "one possible representation" of the data. The more you convert, the more you will (possibly) drift your colorspace (depending on whether your colorconversion is adjoint-identical to the one used to create the file). Again, note that this is entirely orthogonal to lost data due to JPEG quantization-truncating compression. Nimur (talk) 15:01, 5 August 2011 (UTC)[reply]
Some comments:
1) I agree with the previous comments on using the ImageMagick command suite to do the conversion.
2) Be sure to specify "-compress none" as the output method, if you want it to be human-readable. However, be warned that these files are huge in such a format (around 4X the size of other uncompressed images), so expect several MB. A 1920 × 1600 screen shot converted in this way is around 17.5 MB.
3) I believe the actual command will be:
convert -compress none test.jpg test.ppm
(Note that the output extension is "ppm", not "pbm".)
4) See the documentation on the convert command here: [1].
5) The first 3 lines of the output file contain header info, with line 1 being the type of netpbm file created, line 2 being the image width and height in pixels, and line 3 being the maximum value allowed for R, G or B (usually 255, but not always). The remainder starts with the R, G, B values for the first pixel, then the 2nd pixel, etc. There's a space between each value, but no other dividers, like between pixels, or image lines. Line breaks are added periodically, possibly in the middle of a pixel (like the R value on one line, then the G and B values on the next).
6) Here's some sample output:
P3
1920 1200
255
206 200 226 222 196 221 237 196 214 245 214 212 211 205 183 211 218 184
211 215 182 204 198 172 211 212 194 190 215 196 192 226 212 191 206 203
  .
  .
  .
StuRat (talk) 23:06, 5 August 2011 (UTC)[reply]
(OP). Thanks guys. The ppm format is exactly what I am looking for. I can use "save as" from (eg) gimp or google picasa and save in ppm format, then read it into R. Great!
Resolved
Robinh (talk) 08:00, 7 August 2011 (UTC)[reply]

Dueling monitors[edit]

I'm trying to set up a dual-monitor system, and hitting a weird roadblock.

I have an LG W2053TX. It has a DVI port in the back of it. I've hooked the DVI port to a DVI cable, which then goes to a DVI-to-HDMI adapter, which then goes into the back of the graphics card (an AMD Radeon HD 6570).

What's irritating is that the monitor does not seem to detect or know what to do with the signal it's getting. It stays black. If I cycle through the input sources, it eventually says "DIGITAL POWER SAVING MODE" and then kind of turns itself off.

Now what I find perplexing is that the computer (running Windows 7) can detect that a monitor is plugged in. It doesn't know what kind of monitor and doesn't know its correct resolution, but it thinks there is an extra monitor there.

I've tried installing all of the drivers and monitor managers and other junk from the LG website, but nothing seems to help. What am I overlooking? It's been awhile since I've messed with Windows drivers and I've not used Windows 7 much — am I forgetting something? What's the step-by-step way to get this stupid monitor to work correctly with this converter? It works fine with a raw DVI signal, but the setup requires using this DVI-to-HDMI converter (the DVI port on the graphics card is taken up by the other monitor I'm using, which can only use VGA, so a DVI-to-VGA is necessary).

Everything I've read online says that a DVI monitor should have no problem parsing an HDMI signal. The converter may be an "active" one, I don't really know how to tell them from a passive one other than the appearance, and it looks more like an active one than a passive one. But I don't know. Would that affect anything? I'm totally befuddled. --Mr.98 (talk) 14:35, 5 August 2011 (UTC)[reply]

One possible workaround is to use a DVI 1-to-2 splitter, like this one: [2]. I am assuming you want the same image to appear on both screens, though. Is this correct ? StuRat (talk) 22:47, 5 August 2011 (UTC)[reply]
Did you click the thing that says "Extend my desktop to this monitor"? If not, windows won't send any signal to that monitor, and it will eventually go into power-save mode like you described. APL (talk) 01:32, 6 August 2011 (UTC)[reply]
No, I don't want the same image to appear on both screens, I want it extended (one big desktop). So a splitter is out of the question, I believe? I have done the "extend" setting (I've tried all of the settings, honestly, just to see if I could get a signal there). Windows thinks it is sending a signal to that monitor. I think the monitor just isn't receiving it. --Mr.98 (talk) 13:15, 6 August 2011 (UTC)[reply]
You are correct, a splitter won't help, in your case. Just to clarify the problem, have you ever gotten any usable output from the HDMI port on your computer's graphics card ? Also, have you tried booting the computer first, with the cables connected, and also booting the TV first, with cables connected and the computer already set to extend desktop to 2nd monitor ? StuRat (talk) 16:11, 6 August 2011 (UTC)[reply]
I don't have any way to test the HDMI output (no other HDMI devices). On Monday I'll try rebooting again. --Mr.98 (talk) 19:26, 6 August 2011 (UTC)[reply]
I would try booting without any other devices connected. If you don't see any display while booting (i.e. before Windows starts) without any (edit: I mean other of course) devices connected, most likely fooling around with Windows won't help. If Windows is not seeing the resolution etc, it sounds like it's not getting the Extended display identification data. This may cause problems setting up the display properly and may also indicate a fault either in the monitor (if it works with the DVi port native then probably not) or the cable or the converter. BTW you must have passive adapter, I'm pretty sure there no such thing there's such thing as an active HDMI to DVI (or vice versa), perhaps you're thinking of Display Port. Also since neither DVI or HDMI provide any significant power source, I'm pretty sure an active adapter will need to be connected to some external power source like USB or a DC adapter. Nil Einne (talk) 10:46, 8 August 2011 (UTC)[reply]
Rebooting didn't do anything. I also tried rebooting with nothing else attached — no change in things. Blah. I'll see if my IT people have another adapter we can try. --Mr.98 (talk) 13:25, 8 August 2011 (UTC)[reply]
Our IT guy ended up swapping out the cables, designating the HDMI-to-DVI monitor as the primary one, and THEN rebooting, and one or more of those steps seems to have fixed it, shockingly. --Mr.98 (talk) 18:41, 9 August 2011 (UTC)[reply]
Too bad you don't which one, in case the problem recurs. StuRat (talk) 02:12, 10 August 2011 (UTC)[reply]
Resolved

Can't save my Tiddlywiki[edit]

I've been usign a Tiddlywiki successfully for a few years until today. All of a sudden I can't save my changes; I get the error message "Failed to save main Tiddlywiki file. Changes have not been saved." A separate Tiddlywiki that I use does not display this problem.

The details:

  • Firefox 5.0
  • Windows 7 (64-bit)
  • I'm not sure how to find the version # on my tiddly. The particular tiddly I'm having problems with contains a sort productivity management system called mGSD (mGSD 3.1.7 beta).

The only possibly relevant recent change - I use Outlook for my work e- mail; this morning an IT staff migrated my mail from servers owned by my employer, to some Microsoft could servers. I don't know any details of what was involved in this.

ike9898 (talk) 16:48, 5 August 2011 (UTC)[reply]

Make sure Firefox has permission to write to the html file, and that the file isn't in use by another process. Both things might be preventing Firefox from writing to the file. If that doesn't work, you could try going File -> Save As in Firefox and try to save your wiki under a different filename. This should save any changes you've made to the new file, so at least you won't lose your work. AvrillirvA (talk) 18:50, 6 August 2011 (UTC)[reply]

Extensible compilers & languages, compiler-compilers, metaprogramming, extensible syntax, domain specific languages, language-oriented programming[edit]

I'm very confused. Do any of them mean the same thing as the other? Are any of them related? --Melab±1 19:55, 5 August 2011 (UTC)[reply]

Some are very much related, some only remotely. Did you try articles such as extensible programming, compiler-compiler, etc - just type your terms to Wikipedia's search box at the top of this page. 88.112.59.31 (talk) 20:12, 5 August 2011 (UTC)[reply]

FORTRAN[edit]

So I have some code that I downloaded written in FORTRAN to process some data. Working on a Ubuntu 11.04 machine, I tried g95, f77, and f95 compilers and they all tell me there are errors in the code (they give me different errors). For example, one of the errors from f95 is that "ACCESS specifier in OPEN statement has invalid value 'TRANSPARENT'". f77 prints out a bunch of warnings about inconsistent called sequences and aborts compilation. g95 complains about other syntax errors. The site is ancient and the code is at least ten years old. My question is, is there anyway to find out exactly which version of FORTRAN it is written in? Are these compilers backwards compatible? Any other compilers you guys recommend I should try? Or could it be some obscure spin-off of FORTRAN? I am pretty sure the code itself is fine (whatever it is written in) because others in the past have used it to do research. I am brand new to both LINUX and FORTRAN and don't know much about them. If it would help I can also upload the source code. Its only 330 lines including a LOT of comments. Thanks! 128.138.138.122 (talk) 20:14, 5 August 2011 (UTC)[reply]

My knowledge of Fortran is very out of date but historically input and output from disk was always problematic between versions. It looks to me that your program may have been written in Lahey Fortran[3] where access=transparent is a nonstandard extension. gfortran may the way to go but frankly my suggestion is to mug up on enough Fortran to understand the mathematical logic being used (with luck you may be able to treat it as pseudocode) and then write your own code from scratch using a language you are familiar with. The Lahey article gives advice for porting (but in the "wrong" direction) and suggests to me the input read following the OPEN statement may be from a disk file created using a different programming language.Thincat (talk) 22:21, 5 August 2011 (UTC)[reply]
Fortran programmer here. I agree that it sounds like the code was written using non-standard extensions. If you can provide the source code and any input required, I'll take a look. It might be easier to just rewrite the non-standard parts, provided I can figure out what they did, than start from scratch. StuRat (talk) 22:41, 5 August 2011 (UTC)[reply]

OP here. Here is the source code in FORTRAN. If you'd like a pair of sample input files, I can provide those too. Thanks! 174.29.65.10 (talk) 03:24, 6 August 2011 (UTC)[reply]

Extended content
      PROGRAM EPHEMER
C     THIS PROGRAM STRIPS OUT AND DISPLAYS DATA FROM THE CRRES HEADER
C     AND EPHEMERIS FILES 
C     LAST UPDATE 10-8-92
      INTEGER*2 ICONV,PRSCR,PRFLE,JPAUZ,NHED,NEPH,IOPEN1,IOPEN3,IOPEN4
      INTEGER*4 KTIM1,KTIM2,IHDR(60)
      DIMENSION EPHM(60),DATHED(28)
C     IHDR HOLDS THE HEADER RECORD FROM ONE ORBIT OF DATA, EPHM HOLDS 
C     ONE SET OF PACKED EPHEMERIS DATA (1 OR 5 MINUTE INTERVALS)
C     WE DON'T REALLY NEED THESE FOR THE DPU57 STRIPOUT
      CHARACTER*30 EPHFIL,HEDFIL,DATFIL,FILNAM
      CHARACTER*1 ANS
      CHARACTER*3 CSV,EPH,HED,BIN
      DATA CSV,EPH,HED,BIN/'CSV','EPH','HED','BIN'/

C     FILE CONVENTIONS:
C     UNIT 1     EPHEMERIS
C     UNIT 3     OUTPUT DATA FILE
C     UNIT 4     HEADER FILE

      DATA NEPH,NHED/1,4/
      CALL TIMER(KTIM1)                      !FOR TIMING PURPOSES


      VER=1.01
      WRITE(*,1000)VER
1000  FORMAT(///,25X,'CRRES EPHEMERIS PROGRAM VER. ',F4.2,///)

      print*,' This version of ephemer requires EORs in th .EPH file'
C     OPEN THE FILES
C     GET THE INPUT DATA FILE NAME
      IOPEN1=0
      IOPEN3=0
      IOPEN4=0
      PRINT*,' INPUT FILE NAME?   '
      READ(*,1004)FILNAM
1004  FORMAT(A)
C     GET THE HEADER FILE
      HEDFIL=FILNAM
      CALL SUFIX(HEDFIL,HED)
      CALLOPENOLD(HEDFIL,NHED,IOPEN4)
      IF(IOPEN4.EQ.1)CALL READHED(NHED,DATHED,IOPEN4)

C     GET THE EPHEMERIS FILE
      EPHFIL=FILNAM
      CALL SUFIX(EPHFIL,EPH)
      CALLOPENOLD(EPHFIL,NEPH,IOPEN1)
      ATIME=-1.
      BTIME=150000.

C     GET THE OUTPUT DATA FILE NAME
150   PRINT*,' WRITE OUTPUT TO THE SCREEN (1), FILE (2), OR BOTH (3)   '
      READ(*,1011)ICONV
      PRSCR=0
      PRFLE=0
      JPAUZ=1
      IF(ICONV.LT.1.OR.ICONV.GT.3.)GO TO 150
      IF(ICONV.EQ.1)PRSCR=1
      IF(ICONV.GE.2)PRFLE=1
      IF(ICONV.EQ.2)JPAUZ=2
      IF(ICONV.EQ.3)PRSCR=1
      IF(PRSCR.EQ.1)PRINT,' PAUSE DISPLAY BETWEEN FRAMES? (YES=1,NO=2) '
1011  FORMAT(I1)
      IF(PRSCR.EQ.1)READ(*,1011)JPAUZ
      IF(PRFLE.EQ.0)GO TO 1029
      PRINT*,' DO YOU WANT THE PLOT FORMAT FILE? (Y,N)   '
      CALL PAUZ(ANS)
      IF(ANS.EQ.'Y'.OR.ANS.EQ.'y')PRFLE=2
      PRINT*,' OUTPUT FILE NAME?   '
      READ(*,1004)DATFIL
      IF(PRFLE.EQ.2)THEN
        CALLSUFIX(DATFIL,CSV)
        OPEN(UNIT=3,FILE=DATFIL,STATUS='NEW',FORM='FORMATTED')
      ELSE
        CALL SUFIX(DATFIL,BIN)
        OPEN(UNIT=3,FILE=DATFIL,STATUS='NEW',FORM='UNFORMATTED')
      ENDIF
      IOPEN3=1

1029  IPAUSE=0
      IF(PRSCR.EQ.0)WRITE(*,1988)
1988  FORMAT(3X,'UT      ALT    LAT   LONG     B      L     B0',/)
1     CALL READEPH(IHDR,ATIME,BTIME,EPHM,IFLG)
      IF(IFLG.EQ.1)GO TO 50
      IF(EPHM(12).LT.0.)EPHM(12)=EPHM(12)+360.
      IF(PRSCR.EQ.1)WRITE(*,2)EPHM(2),EPHM(10),EPHM(11),EPHM(12),
     1 EPHM(24),EPHM(35),EPHM(36)
      IF(PRSCR.EQ.0)WRITE(*,222)EPHM(2),EPHM(10),EPHM(11),EPHM(12),
     1 EPHM(24),EPHM(35),EPHM(36)
2     FORMAT(1X,F7.0,1X,F6.0,1X,F6.2,1X,F6.2,1X,F7.1,1X,F5.2,1X,F7.1)
222   FORMAT('+',F7.0,1X,F6.0,1X,F6.2,1X,F6.2,1X,F7.1,1X,F5.2,1X,F7.1)

      IF(JPAUZ.EQ.2)GO TO 17
      IPAUSE=IPAUSE+1
      IF (IPAUSE.LT.20)GO TO 17
      CALL PAUZ(ANS)
      IPAUSE=0
17    IF(PRFLE.EQ.2)WRITE(3,3)EPHM(2),EPHM(10),EPHM(11),EPHM(12),
     1 EPHM(24),EPHM(35),EPHM(36)
3     FORMAT(F7.0,',',F6.0,',',F6.2,',',F6.2,',',F7.1,',',F5.2,',',F7.1)
      IF(PRFLE.EQ.1)WRITE(3)EPHM(1),EPHM(2),EPHM(10),EPHM(11),EPHM(12),
     1 EPHM(14),EPHM(24),EPHM(28),EPHM(30),EPHM(35),EPHM(36)
      GO TO 1
50    WRITE(*,1012)
1012  FORMAT(' JOB COMPLETED')
70    CALL TIMER(KTIM2)
      TME=.01*FLOAT(KTIM2-KTIM1)
      PRINT*,' ELAPSED TIME = ',TME
      IF(IOPEN1.EQ.1)CLOSE(UNIT=1)
      IF(IOPEN3.EQ.1)CLOSE(UNIT=3)
      IF(IOPEN4.EQ.1)CLOSE(UNIT=4)
      STOP
      END


      SUBROUTINE SWAP4(IN,IOUT)
      LOGICAL*1 IN(4),IOUT(4)
      IOUT(1)=IN(4)
      IOUT(2)=IN(3)
      IOUT(3)=IN(2)
      IOUT(4)=IN(1)
      RETURN
      ENTRY SWAP2
      IOUT(1)=IN(2)
      IOUT(2)=IN(1)
      RETURN
      END


      SUBROUTINE PAUZ(ANS)
      CHARACTER*1 ANS
      READ(*,1)ANS
1     FORMAT(A)
      RETURN
      END


      SUBROUTINE SUFIX(NAME,INC)
      CHARACTER*1 NAME(51),INC(3),INC1
      DATA INC1/'.'/
      DO 1 I=1,51
      IF(NAME(I).EQ.'.')GOTO4
1     IF(NAME(I).EQ.' ')GOTO3
      WRITE(*,2)NAME
2     FORMAT(' ***** ERROR ***** ERROR ***** ERROR *****',//,
     1 A,//,' exceeds the limit on file names (50 characters)')
      STOP
3     NAME(I)=INC1
4     NAME(I+1)=INC(1)
      NAME(I+2)=INC(2)
      NAME(I+3)=INC(3)
      RETURN
      END


      SUBROUTINE READEPH(JATA,T1,T2,DATA,IFLAG)
      INTEGER*4 JATA(60),ICON,ITMP
      INTEGER*2 IFLAG,INDFYL,IEOR
      DIMENSION DATA(60),FACTOR(60)
      DATA INDFYL/0/
      DATA FACTOR/1.,.001,3*.0001,3*1.E-7,2*.0001,2*1.0E-6,
     1 3*1.E-7,2*1.E-6,1.E-7,1.E-6,2*1.E-7,1.E-6,1.E-7,4*.0001,
     2 1.E-7,6*1.E-6,1.E-7,.0001,2*1.E-6,.0001,2*1.E-6,.0001,6*1.,
     3 1.E-6,8*.0001,3*1./
C     1 JULIAN DATE (DAYS)
C     2 UT, Milliseconds
C     3 X, ECI, km
C     4 Y, ECI, km
C     5 Z, ECI, km
C     6 VX, ECI, km/SEC
C     7 VY, ECI, km/SEC
C     8 VZ, ECI, km/SEC
C     9 RADIUS, EARTH CENTER TO SATELLITE, km
C    10 Altitude, km
C    11 Latitude, Deg
C    12 Longitude, Deg
C    13 Velocity, km/sec
C    14 Local Time, hr
C    15 Radius, Mag, EMR (6371.2 km)
C    16 Latitude. Mag, Deg
C    17 Longitude, Mag, Deg
C    18 Radius, SM, EMR
C    19 Latitude, SM, Deg
C    20 Local Time, SM, hr
C    21 Radius, GSM, EMR
C    22 Latitude, GSM, Deg
C    23 Local Time, GSM, hr
C    24 B, nT
C    25 BX, ECI, nT
C    26 BY, ECI, nT
C    27 BZ, ECI, nT
C    28 Mag Local Time, hr
C    29 Solar Zenith Angle, Deg
C    30 Invariant Latitude, Deg
C    31 B100N latitude, Deg
C    32 B100N longitude, Deg
C    33 B100S latitude, Deg
C    34 B100S longitude, Deg
C    35 L-shell, EMR
C    36 Bmin, nT
C    37 Bmin Latitude, Deg
C    38 Bmin Longitude, Deg
C    39 Bmin Altitude, km
C    40 Bconj Latitude, Deg
C    41 Bconj Longitude, Deg
C    42 Bconj Altitude, km
C    43 X Sun Position, ECI, km
C    44 Y Sun Position, ECI, km
C    45 Z Sun Position, ECI, km
C    46 X Moon Position, ECI, km
C    47 Y Moon Position, ECI, km
C    48 Z Moon Position, ECI, km
C    49 Right Ascension of Greenwich
C    50 B100N, nT
C    51 B100S, nT
C    52 Mx dipole moment, ECI, nT
C    53 My dipole moment, ECI, nT
C    54 Mz dipole moment, ECI, nT
C    55 Dx dipole offset, ECI, nT
C    56 Dy dipole offset, ECI, nT
C    57 Dz dipole offset, ECI, nT
C    58 Vacant
C    59 Vacant
C    60 Vacant
C    

      IF(INDFYL.EQ.1.AND.IFLAG.EQ.1)RETURN
      ICON=2**30
      IFLAG=0
1     READ(UNIT=1,END=1000)JATA
      READ(UNIT=1,END=1000)IEOR
      CALL SWAP4(JATA(2),ITMP)
      TIME=.001*FLOAT(ITMP-ICON)
      IF(TIME.LT.(T1-60.))GO TO 1
      IF(TIME.GT.(T2+300.))RETURN
      DO 2 I=1,57
      CALL SWAP4(JATA(I),ITMP)
2     DATA(I)=FLOAT(ITMP-ICON)*FACTOR(I)
      RETURN
1000  WRITE(*,1001)
1001  FORMAT(' HIT THE END OF THE EPHEMERIS FILE',/,
     1 ' PROCESSING OF EPHEMERIS STOPPED')
      IFLAG=1
      INDFYL=1
      RETURN
      END

      SUBROUTINE OPENOLD(FILNAM,NUNIT,NOPEN)
      CHARACTER*30 FILNAM
      CHARACTER*1 ANS
      INTEGER*2 NUNIT,NOPEN
      INTEGER*4 LEN,NLEN
      LOGICAL OPEND,EXST
1     INQUIRE(FILE=FILNAM,EXIST=EXST,OPENED=OPEND)
      IF(EXST)GOTO5
      NOPEN=0
      WRITE(*,2)CHARNB(FILNAM)
2     FORMAT(' FILE ',A,' DOES NOT EXIST',/,' DO YOU NEED IT? (Y,N)')
      CALL PAUZ(ANS)
      IF(ANS.EQ.'N'.OR.ANS.EQ.'n')RETURN
      WRITE(*,3)
3     FORMAT(' ENTER FILE NAME, INCLUDING FULL PATH',/)
      READ(*,4)FILNAM
4     FORMAT(A)
      GO TO 1
5     IF(OPEND)GO TO 6
      OPEN (UNIT=NUNIT,FILE=FILNAM,STATUS='OLD',ACCESS='TRANSPARENT',
     1 FORM='UNFORMATTED')
      NOPEN=1
C     GET THE FILE LENGTH IN BYTES
6     INQUIRE(FILE=FILNAM,FLEN=LEN)
      NLEN=LEN/512
      WRITE(*,7)CHARNB(FILNAM),LEN,NLEN
7     FORMAT(' FILE ',A,' IS ',I8,' BYTES (',I5,'+ SECTORS) LONG')
      RETURN
      END

      SUBROUTINE READHED(NHED,DATHED,IOPEN)
      INTEGER*2 IOPEN,NHED
      INTEGER*4 JATA(30)
      LOGICAL*1 KATA(120)
      DIMENSION DATHED(28)
      IF(IOPEN.EQ.0)RETURN
5     READ(UNIT=NHED,END=1000)KATA
      IGG=1
      DO 20 IG=1,30
      CALL SWAP4(KATA(IGG),JATA(IG))
20    IGG=IGG+4
      DO 21 I=1,28
21    DATHED(I)=FLOAT(JATA(I))
      DATHED(7)=.001*DATHED(7)
      DATHED(8)=.001*DATHED(8)
      DATHED(9)=.001*DATHED(9)
      DATHED(15)=.001*DATHED(15)
      DATHED(16)=.001*DATHED(16)
      DATHED(17)=.001*DATHED(17)
      DATHED(18)=.001*DATHED(18)
      DATHED(19)=.001*DATHED(19)
      DATHED(20)=.001*DATHED(20)
      DATHED(21)=.001*DATHED(21)
      DATHED(22)=.001*DATHED(22)
      DATHED(24)=.001*DATHED(24)
      DATHED(26)=.001*DATHED(26)
      DATHED(28)=.001*DATHED(28)
C
      WRITE(*,100)(JATA(I),I=1,6),(DATHED(J),J=7,9),(JATA(K),K=10,14)
100   FORMAT(' Vehicle ID    =    ',I9,20X,'Experiment ID =    ',I9,/,
     1 ' Orbit Number  =    ',I9,20X,'Julian Date   =    ',I9,/,
     2 ' Year          =    ',I9,20X,'Day of Year   =    ',I9,/,
     3 ' UT Start of Data = ',F9.3,20X,'UT End of Data =   ',F9.3,/,
     4 ' UT First Perigee = ',F9.3,20X,'VTCW at Start =     ',Z8,/,
     5 ' VTCW at End   =     ',Z8,20X,'Agency Tape Date = ',I9,/,
     6 ' Missing Maj Frames ',I9,20X,'Filled Minor Frms  ',I9,/)

      WRITE(*,101)(DATHED(J),J=15,22),JATA(23),DATHED(24),JATA(25),
     1 DATHED(26),JATA(27),DATHED(28)
101   FORMAT(' Penumbra Start =   ',F9.3,20X,
     1 'Penumbra Stop =    ',F9.3,/,
     2 ' Umbra Start   =    ',F9.3,20X,'Umbra Stop    =    ',F9.3,/,
     3 ' Penumbra Start =   ',F9.3,20X,'Penumbra Stop =    ',F9.3,/,
     4 ' Umbra Start   =    ',F9.3,20X,'Umbra Stop    =    ',F9.3,/,
     5 ' VTCW',10X,'=     ',Z8,20X,'UT',12X,'=    ',F9.3,/,
     6 ' VTCW',10X,'=     ',Z8,20X,'UT',12X,'=    ',F9.3,/,
     7 ' VTCW',10X,'=     ',Z8,20X,'UT',12X,'=    ',F9.3,/)
      GO TO 1001
1000  PRINT*,' ERROR IN READING THE HEADER FILE'
1001  IOPEN=0
      CLOSE(UNIT=NHED)
      RETURN
      END
I'll not even attempt to offer a solution to your problem, but I can't help but comment that programming languages have improved over the years... AndyTheGrump (talk) 03:56, 6 August 2011 (UTC)[reply]
Are you daring to suggest that the skills I learnt in 1967 are no longer bleeding edge? (I still have a copy of my first program. It solved quadratic equations.) HiLo48 (talk) 04:01, 6 August 2011 (UTC) [reply]
I don't go back quite that far (BBC Basic was my first programming language), but I can see the advantages of actually moving beyond the palaeolithic stage of coding. In the good old days, you spent hours writing a program to do something simple, only to discover it didn't work. Nowadays you can write programs to do much more complex things, and get exactly the same result ;-) AndyTheGrump (talk) 04:16, 6 August 2011 (UTC)[reply]


Yes, please provide the input files. If they aren't too long, you can just put them as text here (like you did with the source code).
OK, I was able to get it to compile, using GFortran, with 3 fixes:
1) Removed the ACCESS='TRANSPARENT' clause.
2) Removed the FLEN clause.
3) Fixed one print statement.
I'm not sure if just removing those 2 clauses is OK, though; we might need to find another way to do the same thing. On a successful compile I got warnings that two functions weren't found. One is TIMER, which seems to get the CPU time. There are other ways to do this, or we could just disable the CPU time calcs. The other is CHARNB, which appears to just format the print of the file name. We can leave the name unformatted or print it in another way. So, with these changes it should run. StuRat (talk) 04:08, 6 August 2011 (UTC)[reply]
Regarding the ACCESS='TRANSPARENT' Lahey extension. Here's what it does, according to the link provided above:

Converting unformatted files with LF90 or LF95 usually involves opening the file using the specifier ACCESS="TRANSPARENT" (a nonstandard Lahey extension), which allows the file to be read a byte at a time with no assumptions about headers or record delimiters. This allows one to have the same degree of control as when handling files in the C language.

I believe GFortran uses the FGETC function to accomplish the same thing: [4]. StuRat (talk) 04:18, 6 August 2011 (UTC)[reply]
Regarding the FLEN specifier in the INQUIRE statement, that extension appears to return the length, in bytes, of the file [5]. I don't know of an easy way to do that in GFortran. One option would be to append an EOF character to the end of the file, and read until that point. This is relatively simple, provided there is some character we can use which won't appear in the bulk of the program. Another option is to read until we get an EOF error, and catch that. This can be a bit messy, as I recall. StuRat (talk) 04:38, 6 August 2011 (UTC)[reply]
Regarding the TIMER function, the CPU_TIME function [6] appears to be standard Fortran to do the same thing, although it returns a real number, versus hundredths of a second returned as an integer in the TIMER function. A minor change to the code will adjust for this. StuRat (talk) 04:50, 6 August 2011 (UTC)[reply]

Here is the link to the input files. There are two of them in there. One is the header file and the other is the ephemeris file to which the code refers. They are both in binary and I don't know if it matters but I have good reason to believe that the developer was working on a little endian system.174.29.65.10 (talk) 06:03, 6 August 2011 (UTC)[reply]

Those seem to be packed into a single RAR file. I'm on Windows XP, and don't have a way to unpack those. Could you upload each file separately (so hopefully they won't be packed into a RAR file) ? What are the names and extensions of the two files ? StuRat (talk) 06:48, 6 August 2011 (UTC)[reply]

This is the cr0006.hed header file and this is the cr0006.eph ephemeris file. The extensions are just a label because both files are just binaries.174.29.65.10 (talk) 07:39, 6 August 2011 (UTC)[reply]

OK, I will take a look and see what I can come up with. BTW, I see this all deals with the orbits of satellites. May I ask where you work ? StuRat (talk) 16:08, 6 August 2011 (UTC)[reply]
I got it to compile and link, but am getting run-time errors. Here's my output:
Extended content


                         CRRES EPHEMERIS PROGRAM VER. 1.01


  This version of ephemer requires EORs in th .EPH file
  INPUT FILE NAME?
cr0006.eph
 FILE cr0006.HED                     IS    53241 BYTES (  103+ SECTORS) LONG
 Vehicle ID    =            0                    Experiment ID =            0
 Orbit Number  =            0                    Julian Date   =            0
 Year          =            0                    Day of Year   =     50856192
 UT Start of Data =     0.000                    UT End of Data =       0.000
 UT First Perigee =     0.000                    VTCW at Start =            0
 VTCW at End   =            0                    Agency Tape Date =         0
 Missing Maj Frames         0                    Filled Minor Frms          0
 Penumbra Start =   *********                    Penumbra Stop =    *********
 Umbra Start   =        0.000                    Umbra Stop    =        0.000
 Penumbra Start =       0.000                    Penumbra Stop =        0.000
 Umbra Start   =        0.000                    Umbra Stop    =        0.000
 VTCW          =            0                    UT            =        0.000
 VTCW          =            0                    UT            =        0.000
 VTCW          =            0                    UT            =        0.000 
 FILE cr0006.EPH                     IS    53241 BYTES (  103+ SECTORS) LONG
  WRITE OUTPUT TO THE SCREEN (1), FILE (2), OR BOTH (3)
3
  PAUSE DISPLAY BETWEEN FRAMES? (YES=1,NO=2)
1
  DO YOU WANT THE PLOT FORMAT FILE? (Y,N)
y
  OUTPUT FILE NAME?
cr0006.out
At line 231 of file wikiref.f (unit = 1, file = 'cr0006.EPH')
Fortran runtime error: Read past ENDFILE record
I suspect that it's not actually reading from the file, yet, because of all those zeros. It would help to know what the output should look like, though, and what the input data looks like (in human-readable form). StuRat (talk) 17:42, 6 August 2011 (UTC)[reply]

Well I have no idea what the input should look like. Its just binary data (probably raw data from the satellite) but I don't know the format. You can probably deduce that from the FORTRAN code. The output I think should be tables of single precision numbers (probably with 60 rows or something like how it says in the comments). The output should be various magnetic field and particle measurements along with longitude, latitude, and altitude where the measurements were taken.174.29.65.10 (talk) 21:39, 6 August 2011 (UTC)[reply]

Right, but I need the specific output expected for this data file, to know if it's working properly. Right now all I get is a bunch of zeros, for the most part, so that's probably wrong, but even if I get a bunch of random looking numbers, that could still be right or wrong, how can I tell ? StuRat (talk) 22:06, 6 August 2011 (UTC)[reply]
Ok, since this section will soon be archived, let's continue this discussion on my talk page. StuRat (talk) 02:59, 9 August 2011 (UTC)[reply]

My computer has gone mute[edit]

My laptop was running very slow, so I did a system restore, deleted some programs I rarely use from add/remove programs, and updated my symantic virus protection...in that exact order. Everything works great, except now there is no audio. I've checked all the volume controls, system tools and anything else related to audio. Nothing. What could I have possibly done to disable the audio? Any idea how I can fix this? Quinn BEAUTIFUL DAY 20:37, 5 August 2011 (UTC)[reply]

Reinstall audio device driver? ¦ Reisio (talk) 23:51, 5 August 2011 (UTC)[reply]

Yeah, sounds great, but how? Quinn BEAUTIFUL DAY 00:02, 6 August 2011 (UTC)[reply]

If it's a preassembled computer like a Dell or an HP or something like that, go to the manufacturer's website look up your model, download the driver/s and install them. ¦ Reisio (talk) 00:19, 6 August 2011 (UTC)[reply]
Ok, so I went to Toshiba and updated my driver. I get something called the Driver Detective, which runs, then wants me to enter a credit card. I stopped at that point. Quinn BEAUTIFUL DAY 01:31, 6 August 2011 (UTC)[reply]
Go to toshiba.com, click on "Services and Support" → "Consumer Products" → "Laptops, Multimedia Notebooks, & Accessories" → "Tech Support". That brings you here. Now choose your model number. Is that where you downloaded that program that wants your credit card number? I hope not. -- BenRG (talk) 02:27, 6 August 2011 (UTC)[reply]
OK that worked! Brilliant! Thanks! Quinn BEAUTIFUL DAY 04:25, 6 August 2011 (UTC)[reply]