Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Jim Smithe

Greenhorn
+ Follow
since Mar 22, 2018
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jim Smithe


I think I got it. I had to create a new project and just do it again. For some reason that worked even though they both look the same. I create a win32 console application.
1 year ago
yes and the code is from the video found here talking about creating pointers.
https://www.youtube.com/watch?v=mw1qsMieK5c
Looks like that guy in youtube video uses something other than Visual studio to.
Its is a direct copy and paste from my project.
Unfortunatly I really need it to work in Visual Studio. All my work is in that
1 year ago
I have the following simple code in C.

#include <stdio.h>
int main()
{
int x = 7;
printf("x is %d\n",x);
x = 14;
printf("x is %d\n", x);
int *aptr = &x;
}


As soon as I add the line       int *aptr = &x;     I get missing ';' before 'type' when I try to compile. Why would that happen? Everything looks fine and compiles fine except when I add that new line. What I am doing should work.
Iam using Visual Studio Professional 2012

thanks
1 year ago
question concerning how to print 7 items out of an array with python

This is what I want-The first item out of the array of 7 gets its own line

3.2345
1.2134, 2.2134, 3.2134, 5.1134, 7.1134, 3.1134


Iam using this python code

np.savetxt(test.out', np.column_stack([D, X, Y, Z, A, B, C]), fmt=%1.4f', delimeter=', ')

This is what I get in my text file

3.2345 1.2134, 2.2134, 3.2134, 5.1134, 7.1134, 3.1134

Do you know what I need to do to make the first item seperate out from the other 6 items?
Ultimately I want it to look like this in the text file.

3.2345
1.2137, 2.2134, 3.2134, 5.1134, 7.1134, 3.1133
3.2345
1.2134, 2.2134, 2.2134, 5.1134, 7.1134, 3.1134
3.2345
1.2134, 2.2136, 3.2134, 5.0134, 7.1134, 3.1135
3.1345
1.2134, 2.2134, 3.2134, 5.1134, 4.1134, 2.1134
3.2345
1.1134, 1.2134, 3.2134, 5.1134, 7.1134, 3.1134
thank you.
1 year ago
A FORTRAN 4 program was written this way for 7049 computer when creating a new record.I am dealing with 36 bit words.
WRITE(8)  NTYPE,  NREC,  MM,  NN, ...plus 3 other items separated by commas not mentioned because unrelated to question, to equal 8
resulted in a binary file that looks like this when written as octals:
000511000000 000000000001 000000000001 000000000005 000000000200 ...plus 3 other 36bit words displayed as octals to equal 8 not mentioned because unrelated to question.  The last 4 words when converted to decimal are 1,1,5 and 128 which was expected. The first word is the mystery.

Now the Question:
Why might WRITE(8) generate a "000511000000"  in the beginning of a new record?
When I convert it to a decimal or just 000101001001000000 it seems to have no particular significance.
To those who understand fortran do you know what "000511000000" might mean at the start of creating a new record when looked at in the binary or in this case octal?  Maybe its just a marker of some type thats common? If so are their other marker types I should know about when examining binary files?
thanks
1 year ago
I attached to this message what the numbers should look like in the beginning. I have converted these octal numbers to the data so I know the numbers are correct. Problem is
this is only a sample of what is in the beginning of the binary file. The binary file is filled with more data. If I get a dump I think I should be able to get more clarity
of what is in the entire binary file.
If you knew how to do a dump in python that would help me as well but looking for answer in fortran if you know that. Dump using C could also be useful.
1 year ago
Hello,
How do I do an octal dump of a binary file with fortran 95?
I dont know anything about the binary file except I should recognize the octal values
when I see them.

thanks
1 year ago
I found this python code below from this link and was trying to get it to work. Its simple derivative calculator.
https://medium.com/@jamesetaylor/create-a-derivative-calculator-in-python-72ee7bc734a4

The answer should show up as 4. Can someone tell me why it wont work? I am completely new
to python. I created it in Notepad plus and am running from Windows 7 command prompt.
I get no errors but the answer does not show up. Anyone now why? thank you

#--------------begin code-------------
#import math package to allow for more function arguments
from math import*


def f(x):
#type your function after return
return x**2

#For instance f(2) = 4

def derive(function,value):
h = 0.00000000001
top = function(value + h) - function(value)
bottom = h
slope = top / bottom
# Returns the slope to the third decimal
return float("%.3f" % slope)


derive(f, 2)

#---------------end code--------------
1 year ago
You are right Paul. I cant be sure if there are any characters in the data. It could all be numbers.
However I want to know all possibilities just in case. I am kind of hoping there are at least some characters at the top of columns of data to guide me in understanding
some of what the numbers mean that may be listed underneath. ..but like you say No guarantees.
Ya its old NASA data.
I am trying to decode a binary file -data from 1967. They used 6 bit back then on the IBM 7094 mainframe.
For letters and symbols the First 2 bits were "zone bits", which I am still trying to understand, and the next 4 bits were the usual based on 8 4 2 1

After that the next popular model was IBM 360 which then started using 8 bit. Extended BCD.
Anybody know where I can find all the 6 bit binary representations for the letters and other symbols? up to 64 available including the numbers. Not 8 bit binaries but 6 bit

For Example: I know letters A = 110001 I=111001
K=100010 M= 100100 R= 101001 and V= 010011
but thats all I can find.
https://en.wikipedia.org/wiki/BCD_(character_encoding)
shows me some tables but they dont make sense to me.
thanks
What version of Visual Studio or VC was used to compile python 3.6.5  ?

I understand Python 2.7.3 is compiled with VC9.0 so I am wondering about Pyton 3.6.5 which is download from Python.org website.

thanks
2 years ago
Hello,

I am programming in C
I have the following declared. Each is a 3d vector.

Double refine1[3];
Double refine2[3];
Double refine3[3];
Double refine4[3];
Double refine5[3];
Double refine6[3];

How could I declare the same thing but only put these in an array?
A friend of mine says I need to do use:     typedef struts    but from what i read on internet I dont understand how it works at all for my case.
I am a nooby to C
Any help appreciated.
Thank you
2 years ago