Just Tried My First Program

Working on new editor enhancements?
oldefoxx
Enthusiast
Enthusiast
Posts: 532
Joined: Fri Jul 25, 2003 11:24 pm

Just Tried My First Program

Post by oldefoxx »

Which worked, by the way. But after a compile, I could not get the Editor to do anything. I could not edit what was in the source file, add more lines, even get the keyboard to respond.

I looked through the Menu Items, and found nothing to help me get the Editor going again. So what is going on here?

I do like the fact that the Editor does not force me to save a trial program before it is able to compile and run it. My approach to programming is to stop after adding some code, test it by compiling it to see if if is complete as it is, then go on from there. An Editor that just stops editing after a compile is something I've never run up against before.
has-been wanna-be (You may not agree with what I say, but it will make you think).
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Just Tried My First Program

Post by IdeasVacuum »

Could be a myriad of things but the most likely culprit would be your Anti Virus/Anti Malware App, especially if it is Microsoft's Security Essentials.

http://www.purebasic.fr/english/viewtop ... Essentials
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
skywalk
Addict
Addict
Posts: 3997
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Just Tried My First Program

Post by skywalk »

Never experienced that before on Windows.
Make sure there is not a blocking dialog box hidden somewhere.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: Just Tried My First Program

Post by Josh »

Ähm, 293 posts and you tried your first program?

Did you stop your program with the stop button in the toolbar? :mrgreen:
sorry for my bad english
oldefoxx
Enthusiast
Enthusiast
Posts: 532
Joined: Fri Jul 25, 2003 11:24 pm

Re: Just Tried My First Program

Post by oldefoxx »

I don't know if I have much excuse for not turning my hand to programming with
PureBasic before. Back when I got it, I had no experience with object programing,
and was pretty deep into using PowerBasic at the time. Then I suffered a head
injury and it took 3 months before I could return home, and I had problems with
coordinating my hand and finger movements, and it was over three years before
I even tried another program. I did a few in PowerBasic, but decided it was time
to really tackle HotBasic, which I also had. HotBasic was interesting. Still is, in
fact, but for reasons I won't get into, I decided to park it and move on to, would
you believe it, PureBasic!

That decision was not that long ago. In person, I don't chat, but turn me loose on
a forum, and I do quite a bit of it. It's a matter of just letting myself go. I've tried
a few blogs, but who's got time to ferret out blogs and read them? If I wanted to
say something that might benefit others, forums were a better choice. The various
topics were there before you, so just take your pick.

I'm on facebook, but I never spend time there. I like the technical stuff much more
than the idle chit-chat that places like that pull out of you.
has-been wanna-be (You may not agree with what I say, but it will make you think).
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Just Tried My First Program

Post by IdeasVacuum »

Well, you certainly get us all thinking, which is of course a good thing. :mrgreen:
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
oldefoxx
Enthusiast
Enthusiast
Posts: 532
Joined: Fri Jul 25, 2003 11:24 pm

Re: Just Tried My First Program

Post by oldefoxx »

Thanks, my approach appeals to some, but others don't care for it and come right out
and make a point of saying so. That's fine. There's room for everyone.

I still run into a problem with the Editor not wanting to do anything more at some points,
but I think I know what that is. If I make a mistake in my coding, a window is suppose to
pop up and report the error. I caught that the window had opened, but that it was buried
under the editor. I clicked on it on the task bar, got it to the fore, clicked on the button,
and matters resumed. Have to get use to checking for that.

I don't see a stop button on the Editor's toolbar, but there is a close icon, which wipes out
the tab and contents currently at the fore in the editor. I've got a lot of grayed-out icons
showing up, and I don't know what they tie to or what I am currently missing that needs to
be there for them to show up as well.

It's a small measure of progress, I guess, About enough for today anyway.
has-been wanna-be (You may not agree with what I say, but it will make you think).
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: Just Tried My First Program

Post by Josh »

foxx, you are writing much and slowly you grow up to my personal english trainer. but its hard for me to follow all your chains of thought and i don't check all. so, i know, you are on facebook and other important things, but i'm not sure, is your problem solved?
sorry for my bad english
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: Just Tried My First Program

Post by c4s »

Normally the IDE gets "disabled" as long as your program is running or there was a compiler error message... that's why a lot of icons are grayed out.
If your program doesn't stop ans you want to go back coding, just force to stop the compiled program using the "X" toolbar icon.
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
oldefoxx
Enthusiast
Enthusiast
Posts: 532
Joined: Fri Jul 25, 2003 11:24 pm

Re: Just Tried My First Program

Post by oldefoxx »

Problems rarely end, and there is no end to problems, so let's just say that I make strides on occasion,
often with the help of others. I know very little of PureBasic at the moment, but example programs
have a way of helping. So does taking time to read portions of the Help file system. For instance,
I learned that pointers always have a leading *, which is part of the name, and that to address a label
means putting ? in front of the label name. But I did not see immediately how to put those two facts
together so that I could have effectively a *address = ?label. With programming, it is rarely that simple.

And the problem that always stops you is to be told that something will go this way, only to find out when
you try it yourself that it doesn't. It goes a different way. Then you are usually down to two choices:
(1) Find an example program that does something like you what to do and see how it does it, or (2) ask
others to tell you either what you were doing wrong or how they would do it.

I learned a bit about object programming while diddling with HotBasic. There are hundreds of associated
example files, but finding the one that comes close to what you want to do is a real challenge. So I wrote
a search program to make it easier. I wrote it in HotBasic, as a way of making sure I was still learning
as I went. Most search programs only search for one word, one term, or one group of characters. I wrote
mine to search for multiple words, terms, or groups of characters, thereby narrowing my search results.

My immediate problem is that ProcedureReturn by itself is suppose to return what is in EAX. But what is
in EAX is not what I get back. Instead, I always get a zero result. I've got a query on another thread as to
why that was happening. Must be something I am doing wrong again.
has-been wanna-be (You may not agree with what I say, but it will make you think).
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Just Tried My First Program

Post by IdeasVacuum »

You seem to be fixated by Assembly oldefoxx :) That's not really what PB is about, but you can have a lot of fun getting it to work the way you want. I just took a look at the HotBasic Website - certainly a bit different to PB (the website itself is far from the norm too). Looks like nothing much has happened with HotBasic since 2007, which seems a shame.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
oldefoxx
Enthusiast
Enthusiast
Posts: 532
Joined: Fri Jul 25, 2003 11:24 pm

Re: Just Tried My First Program

Post by oldefoxx »

I actually don't do that much with assembler code, but if I intend to use it, I want to make
sure I get it right. Actually, my involvement with assembler was to add a capability to
HotBasic that wasn't in the language itself. and to bypass some functions that I saw as
being too ... well, too needy I guess, as far as memory, writing, and other aspects were
concerned. Then I found out that it was not handling assembler right, and I was trying to
find a way around that as well. My intent got pretty deep there, and so right away, I want
those issues resolved, and they are getting there.

Take copying a substring back into a source string for instance. You might want to do this
if you just changed the substring to upper case, because it is a keyword, or to lower case
because it is not. This is just an example. Now suppose you had the pointer to the substring
in register esi, and a pointer plus an offset for the source string in the edi register, and the
length of the substring in ecx. You could simply do a rep movsb, and it is done.

But moving bytes at a time may not be the most efficient way. What if you decided to avail
yourself of any ability to move by words, or even by double words? It's not hard. You might
do something like this:

Code: Select all

    shr ecx,1
    jnc skip1
    movsb
skip1:
   shr ecx,1
   jnc skip2
   movsw
skip2:
   jecxz skip3
   rep movsd
skip3:
Now what this does is move, at most, one byte. Then move, at most, one word.
Any remaining moves (copies really), will be double words. But with HotBasic, there
is a problem. It does not properly distinguish between movsw and movsd. The only
safe move with it is movsb, or rep movsb in this case, escept that it does not know
what rep is either. If you were going to try this in HotBasic, you would have to insert
a prefix manually at an important point like this:

Code: Select all

    shr ecx,1
    jnc skip1
    movsb
skip1:
   shr ecx,1
   jnc skip2
   db 66h
   movsw
skip2:
   jecxz skip3
skip2a:
   movsd
   dec ecx
   jnz skip2a
skip3:
So it can be done, in some cases. But you have to remember to do this everywhere that
you run up against a limitation like this. And suppose that it gets fixed at some point?
That now movsw comes with its own 66h prefix in HotBasic? Then to prevent existing
code from effected if recompiled, you might have to consider using this:
db 66h
movsd

in place of :
db 66h
movsw

all because movsw is not properly encoded on its own. Makes you rethink whether you should
stick with that language or not, and I decided to just move on.

Since one of you has visited www,hotbasic.org and found a rather unusual site before you, all
pink, white, and black with lots crambed into each page, I admit it gives you cause to wonder
what you are about to get yourself into. Learning even how to download HotBasic is sort of a
challenge, or how to install it, or go back and get updates. And for the best experience, you
really need to get a number of third party tools, these all being free, but you have to learn
about then, source them, download them, and get them set up so that you can mae use of them.

I'm not here to promote HotBasic or denounce it, as it has promise and can be quite useful. You
just have to learn your way around it, like anything else. There is a free version if you want to
try it out. But from what I've seen of PureBasic so far, I think being here with it is probably good
enough for most purposes. And probably better at doing games, videos, sound, and a number of
other things. So look if you want, try if it suits you, but to go full version will cost you.
has-been wanna-be (You may not agree with what I say, but it will make you think).
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: Just Tried My First Program

Post by Josh »

oldefoxx wrote:And the problem that always stops you is to be told that something will go this way, only to find out when you try it yourself that it doesn't. It goes a different way. Then you are usually down to two choices:
(1) Find an example program that does something like you what to do and see how it does it, or (2) ask others to tell you either what you were doing wrong or how they would do it.
oldefoxx wrote:My immediate problem is that ProcedureReturn by itself is suppose to return what is in EAX. But what is in EAX is not what I get back. Instead, I always get a zero result. I've got a query on another thread as to why that was happening. Must be something I am doing wrong again.
The problem, that always stops you, is the blocker in your brain and the name of this blocker is assembly. You are not able two write and execute a simple 'Hello World' program and always babbling about assembly. You don't need assembly, maybe in HotBasic, but not in Purebasic. Make a reset to your brain and forgot all you know about assembly for a minimum of one year, maybe better for you, forget the existing of assembly forever. And the next, forgot pointers for the first time.

Again: YOU don't need assembly.

Start like the most other newbies with a 'Hello World'. Enlarge your program with some gadgets. Learn how the ide is working an learn what is a eventloop. Make a simple program with a gui like a calculator an you will learn how to develop a program in basic. Learn by doing and don't try to learn basic by theorize.

P.S.: You don't need to write a program to find more then one keywords. There is a lot of solutions on the web. One of this solutions is called google.
sorry for my bad english
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Just Tried My First Program

Post by IdeasVacuum »

Code: Select all

;Take copying a substring back into a source string for instance. You might want to do this
;if you just changed the substring To upper Case, because it is a keyword, Or To lower Case
;because it is not.

      sSourceString.s = "Keyword Not"
         sSubString.s = StringField(sSourceString,1," ")

Debug    sSubString

              ReplaceString(sSourceString, sSubString, UCase(sSubString), #PB_String_InPlace, 1)

Debug sSourceString

End
Edit: was sSourceString = ReplaceString(sSourceString, sSubString, UCase(sSubString), #PB_String_InPlace, 1)
When using #PB_String_InPlace, the result of the function should be ignored.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
oldefoxx
Enthusiast
Enthusiast
Posts: 532
Joined: Fri Jul 25, 2003 11:24 pm

Re: Just Tried My First Program

Post by oldefoxx »

Ho hum. Another strong opinion voiced in opposition to my own thoughts on the subject.
If I listened to every opinion so voiced, I would live my life huddled in a corner somewhere.

Still, you have a right to say what you feel. I have to respect that.

And you offer your own approach to resolving the problem stated, but as I tried to point out,
mine was just an example of what and why you might want to do it. Here is another example,
of replace all the "BCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" characters
with a capital "A", and all the digits "012345678" with the digit "9" Let's say you were doing
this to a copy of the original line, not the original line itself. But why do this? Well, look at
some of the possible patterns that may show up

AAA 9, 9999
99/9/9999
99/99/9999
(999) 999-9999
999-99-9999
99-99-9999
AAAAAAA, AAAA A.
AAAA A. AAAAAAA

Now these are just patterns of digits, letters, and certain other symbols. But some of the
patterns might seem familiar. And if you have changed text to a succession of patterns, it can
be easier to find relationships by first looking for those patterns. You might even decide to
preserve the case related to letters as well, just in case that proves a benefit later.

Would it be easier to create such patterns with something like PureBasic, or would it work out
that assembler would help? That is something some programmers ask themselves, and others
find that they are too limited to make that choice. The argument that assembler is always
better, or that coding in the higher level language is always better, neither really holds sway
unless you really understand the differences involved. My programming days began with
machine language coding in binary and octal, later in hex, moving to assembler, then finally
to Fortran IV, Jovial, and COBOL. Later I picked up on BASIC and REXX, a bit of C and C++,
and I am back to BASIC again, this time with PureBasic after some time with HotBasic

I say this, not to brag, because I've worked computers and computer systems for better than
half a century, and your challenge to just get away from assembly is virtually meaningless to me..
has-been wanna-be (You may not agree with what I say, but it will make you think).
Post Reply