Board Logo
« Basic coding »

Welcome Guest. Please Login or Register.
Dec 12th, 2017, 10:08am


Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Please use the forums Search feature before asking.
Please post code using the code box described in Format Your Messages.
This will keep indentation, separate it better form the message and prevent gibberish.
If the code is too long for one post or additional files are needed, upload a ZIP archive to the Just BASIC Files Archive Site.

« Previous Topic | Next Topic »
Pages: 1 2 3 4  Notify Send Topic Print
 veryhotthread  Author  Topic: Basic coding  (Read 2104 times)
tenochtitlanuk ( John F)
Full Member
ImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 428
xx Re: Basic coding
« Reply #30 on: Jul 1st, 2017, 3:48pm »

I nearly suggested that an ordinary text editor would work in this case!

BUT
The plaintext IS there at the end of the image in my post. Two famous cries to bring on the revolution. Hope MI5, CIA, KGB & Mossad haven't looked- or I'll be on some countries' black lists.

You'll find my earlier example of this technique on my website- Steganography
User IP Logged

Visit my LB/JB pages at http://www.diga.me.uk/index.html
I use XP and Ubuntu Linux on old machines!
bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1229
xx Re: Basic coding
« Reply #31 on: Jul 2nd, 2017, 08:34am »

on Jul 1st, 2017, 3:48pm, tenochtitlanuk ( John F) wrote:
I nearly suggested that an ordinary text editor would work in this case!

BUT
The plaintext IS there at the end of the image in my post. Two famous cries to bring on the revolution. Hope MI5, CIA, KGB & Mossad haven't looked- or I'll be on some countries' black lists.

You'll find my earlier example of this technique on my website- Steganography


Here is my last line in Notepad:
Code:
\n.8{…~›-6a'0nXeŒ€¬‘§fn’ƒ®»¸á 

Maybe CIA or MS has the rest?
User IP Logged

B+
oxcart
New Member
Image


member is offline

Avatar




PM


Posts: 13
xx Individual Listbox Fonts.
« Reply #32 on: Jul 3rd, 2017, 06:43am »

http://webpages.charter.net/lwagner905/Listbox%20Fonts.JPG

I want to use a font to line up code in one of 4 listboxes in a dialog_fs window. The other 3 are fine like this but will stretch out all the info so you can't see age and sex if you change to say consolas or courier_new. It will be a huge questionably successful rewrite to do it another way.

Can I use different fonts for different listboxes in the same window?
User IP Logged

Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3142
xx Re: Basic coding
« Reply #33 on: Jul 3rd, 2017, 07:25am »

Yes, you can use fonts in listboxes, you can also pick sensible values for the length of the displayed data if space is tight.

Remember, click on Home, choose an appropriate board like Novice then click on Start New Thread. That way you can keep your questions in an appropriate thread and this thread on topic. So if you have another question start a new thread.

Code:
open "Overall" for append as #op

     Dim Bib(1000),First$(1000),Last$(1000),Age(1000),Sex$(1000),BFLAS$(1000),FLAS$(1000), FirstL$(1000)
     Dim AC$(700), DJ$(700), KO$(500), PZ$(700), RE$(500), XX$(700) ,L25$(700), PersFact(700)
     for i = 1 to 25 :L25$(i) = " -" : next i

     RE$(1) = "Results"

     DATA "1", Bob, Smith, "11", M, 2, Ann, Bird,   22, F, 3, Mark, Four,  33, M, 4, Nita, Dial, 44, F, 5, Bill, Dunn, 55, M
     DATA 6, Tia, Lyons, 66, F, 7, Bart, Jones, 77, M, 8, Della, Wynn, 88, F, 9, Dan, Biggs, 99, M

    For index = 1 to 9
    Read a, b$, c$, d, e$
    Bib(index) = a: btemp$ = right$("0000" + str$(a),3) + " "
    First$(index) = b$ : ftemp$ = left$(First$(index)+"         ",8) + " "
    Last$(index) = c$  : ltemp$ = left$(Last$(index) + "               ",10) : FirstL$(index) = First$(index) + Last$(index)
    Age(index) = d  : agtemp$ = right$("    " + str$(d),3)
    Sex$(index) = trim$(upper$(e$))
    BFLAS$(index) = btemp$ + ftemp$ + ltemp$ + agtemp$ + " " + Sex$(index)
    next index
    BFLAS$(10) = ""
     i = 0
    prereg = 10
    quarter = int(10 / 3) + 1
    'Assign runners to alphabet ranges
    [jumpup]
    i = i + 1
    if i > quarter goto [nextphase]
    a$ = left$(First$(i),1)
    ac = ac + 1: AC$(ac) = BFLAS$(i)                 : top1$ = First$(i)
    if i = 1 then top1a$ = First$(i) : top2a$ = First$(i + quarter) : top3a$ = First$(i + 2 * quarter) : top4a$ = First$(i + 3 * quarter)
    dj = dj + 1: DJ$(dj) = BFLAS$(i + quarter)       : top2$ = First$(i + quarter)
    ko = ko + 1: KO$(ko) = BFLAS$(i + 2 * quarter)   : top3$ = First$(i + 2 * quarter)
    goto [jumpup]
    [nextphase]

      NoCard$ = "999 No Card 99 M"

    for i = 1 to 2
    xxctr = xxctr + 1
    XX$(i) = NoCard$
    next i

    ' Set up windows
    WindowWidth  = DisplayWidth
    WindowHeight = DisplayHeight
    UpperLeftx   = 1
    UpperLefty   = 1
    WideA = 330 : WideBCD = 330 : WideE = 330
    LB = WideA : LC = LB + WideA :LD = LC + WideA : LE = 4* WideA
    ColoHI = 850 :NoHi = 150

    listbox #1.pickre, L25$(),[topick] ,   1,   1,  345, 990
     listbox #1.pickac, AC$(),[getac] ,   345,   1,  325, 990
      listbox #1.pickdj, DJ$(),[getdj] ,   670,   1,  325, 990
       listbox #1.pickko, KO$(),[getko] ,   995,   1,  325, 990
        listbox #1.pick25, RE$(),[getre],    1320,   1, 330, 790
         listbox #1.pickxx, XX$(),[getxx],    1320, 790, 330, 200

    topline$ = "Overall Order etc"

    open topline$ for window as #1
#1.pickac "font consolas 14"
#1.pickko "font consolas 14"

    'print #1, " font consolas 14"
    #1.pickac "singleclickselect [getac]"
     #1.pickdj "singleclickselect [getdj]"
      #1.pickko "singleclickselect [getko]"
         #1.pick25 "singleclickselect [get25]"
           #1.pickxx "singleclickselect [getxx]"

     'open textbox to add runners
    WindowWidth = 495 : WindowHeight = 85
    UpperLeftX = 300
    UpperLeftY = 750
    textbox #hndl.txt, 8, 8, 320, 40
    button #hndl.default, "   ", [firstn], LR, 170, 10
    button #hndl.help, "Award",[sofar], UL,340, 10
    open "Bib First Last Age Sex (Place) or Add Time (23.25)   Click 'X' to Do Results --->" for dialog as #hndl
    print #hndl.txt, "!font consolas 14"
    print #hndl.txt, "!setfocus"

      [topick]

    [clearskip]
    cls
    close #op
    'kill "Overall.txt"
    open "Overall.txt" for output as #op

    print "Awards Printout"

    for i = 1 to fincount
    print RE$(i)
    print #op, RE$(i)
    next i

    print #hndl.txt, "!setfocus"

    for k = 1 to 40
    L25ctr = fincount - k + 1
    if L25ctr < 1 then L25$(k) = "" : goto [ljump]
    L25$(k) = RE$(L25ctr)
    [ljump]
    next k

    print #1.pick25, "reload"
     print #1.pickre, "reload"
    fincount = fincount + 1

    print #hndl, "trapclose [quit]"
    print #1, "trapclose [quit]"
    wait

    [getac]
    acctr = acctr + 1
    print #1.pickac, "selectionindex? indexer"
    findex$ = right$("   " + str$(fincount) + " ",4)
    RE$(fincount) = findex$ + AC$(indexer)
    AC$(indexer) = ""
        acleft = ac - acctr + 1
        for i = 1 to acleft
        ' If runner has been selected, replace "" runner with next place
        if AC$(i) = "" then outflag = 1
        if outflag = 1 then AC$(i) = AC$(i + 1)
        next i
        outflag = 0
        indexer = 0
     AC$(acleft) = ""
     print #1.pickac, "selectindex indexer"
     print #1.pickac, "reload"
     goto [topick]

    [getdj]
    djctr = djctr + 1
    print #1.pickdj, "selectionindex? indexer"
    findex$ = right$("   " + str$(fincount) + " ",4)
    RE$(fincount) = findex$ + DJ$(indexer)
        DJ$(indexer) = ""
        djleft = dj - djctr + 1
        for i = 1 to djleft
        ' If runner has been selected, replace "" runner with next place
        if DJ$(i) = "" then outflag = 1
        if outflag = 1 then DJ$(i) = DJ$(i + 1)
        next i
        outflag = 0  : indexer = 0
    print #1.pickdj, "selectindex indexer"
    print #1.pickdj, "reload"
    goto [topick]

    [getko]
    koctr = koctr + 1
    print #1.pickko, "selectionindex? indexer"
    findex$ = right$("   " + str$(fincount) + " ",4)
    RE$(fincount) = findex$ + KO$(indexer)
        KO$(indexer) = ""
        koleft = ko - koctr + 1

       for i = 1 to koleft
       ' If runner has been selected, replace "" runner with next place
        if KO$(i) = "" then outflag = 1
        if outflag = 1 then KO$(i) = KO$(i + 1)
       next i

        outflag = 0  : indexer = 0
    print #1.pickko, "selectindex indexer"
    print #1.pickko, "reload"
    goto [topick]

    ' *********************************   REMOVE RUNNERS FROM RESULTS / SELECTED ARRAY  **************************
    [get25]
    print #1.pick25, "selectionindex? indexer"
    outnot$ = RE$(indexer)

    'Is this an extra click (place only) - yes, we are only treating a symptom here
    goodflag = 1
    kik$ = mid$(outnot$,6,1)
    if asc(kik$) = 0 then goodflag = 0
    if goodflag = 0 then goto [kikpass]

    ' Increment count of removed runners
    xxctr = xxctr + 1
    XX$(xxctr) = right$(RE$(indexer),34)

    [kikpass] goodflag = 0
     for i = 1 to fincount
     if i = indexer then outflag = 1 : goto [skipflip]
      if outflag <> 1 then goto [skipflip]
     l = len(RE$(i)) - 3
    REtemp$ = right$(RE$(i),l)
     RE$(i - 1) = right$("   " + str$(i-1),3) + REtemp$
    [skipflip]
    next i
    skipflip = 0
    RE$(fincount-1) = ""
    fincount = fincount - 2
    outflag = 0

     print #1.pick25, "selectindex indexer"
     print #1.pickre, "selectindex indexer"
     print #1.pickxx, "reload"
     goto [topick]

    [getxx]
      print #1.pickxx, "selectionindex? indexer"
     findex$ = right$("   " + str$(fincount), 3)
    RE$(fincount) = findex$ + " " + XX$(indexer)

     if indexer < 3 then goto [nocardskip]
     for i = 1 to xxctr
    if i = indexer then XX$(i) = XX$(i + 1) : outflag = 1 : goto [skipone]
    if outflag = 1 then XX$(i) = XX$(i + 1)
    [skipone]
    next i

    xxctr = xxctr - 1
    [nocardskip]
    outflag = 0
    print #1.pickxx, "selectindex indexer"
    print #1.pickxx, "reload"

    goto [topick]

    [quit] close #1  : close #hndl : close #op : print "goto results"

    ' *****************************************      ADD, REMOVE & INSERT RUNNERS     ****************************
        ' Add runner and fix cap issues here
        [firstn]

        print #hndl.txt, "!contents?"
        input #hndl.txt, ADD$
        ADD$ = trim$(ADD$)
        print #hndl.txt, ""

         i = 0 :  bibtemp = val(left$(ADD$,3))
        [topalphacheck]
        if i = len(ADD$) then goto [checkingdone]
        i = i + 1
        achk$ = mid$(ADD$,i,1)
         if asc(achk$) > 57 then goto [huntjump]
        goto [topalphacheck]
        [checkingdone]

         bibtemp = val(ADD$)

          bibfound = 0 : bibhunt = 0
        while bibfound = o
        bibhunt = bibhunt + 1
        if bibhunt > index then fincount = fincount - 1 : goto [topick]
        if val(left$(BFLAS$(bibhunt),3)) = bibtemp then bibfound = 1
        wend

         gosub [bibdupcheck]
        [huntjump]
        a$ = WORD$(ADD$,1)
         BibAdd$ = a$
          a$ = WORD$(ADD$,2)
          gosub [firstfix]
          FNadd$ = a$
           a$ = WORD$(ADD$,3)
            gosub [firstfix]
            LNadd$ = a$
             AGadd$ = WORD$(ADD$,4)
               SXadd$ = Upper$(WORD$(ADD$,5))

         PSchg = val(WORD$(ADD$,6))

        ftemp$ = left$(FNadd$ + "          ",10)
         ltemp$ = left$(LNadd$ + "               ",15)
          agtemp$ = right$("   " + AGadd$,3)

        Added$ = BibAdd$ + " " +ftemp$ + ltemp$ + agtemp$ + " " + SXadd$ 
        TI = TI + 1
        TypeIn$(TI) = Added$
        addflag = 1

         findex$ = right$("   " + str$(fincount), 3)
        RE$(fincount) = findex$ + " " + Added$

        'Routine to insert runner
        if PSchg = 0 then goto [nochg]

         for i = fincount to 1 step -1
          if i < PSchg then goto [skipchng]
          if i <> PSchg then goto [shifter]
         findex$ = right$("   " + str$(i),3)
         Insert$ = findex$ + " " + Added$
         RE$(i) = Insert$ : goto [skipchng]
         [shifter]
         l = len(RE$(i-1)) - 3
         REtemp$ = right$(RE$(i - 1),l)
          RE$(i) = right$("   " + str$(i),3) + REtemp$
        [skipchng]
        next i

        cls
        [nochg]
        print #1.pickre, "reload"
        PSchg = 0
        [sofar]
        print "Output text file of awards."

        goto [topick]


 
User IP Logged

rtr
Member in Training
ImageImage


member is offline

Avatar




PM


Posts: 40
xx Re: Basic coding
« Reply #34 on: Jul 3rd, 2017, 07:56am »

on Jul 2nd, 2017, 08:34am, bplus wrote:
Here is my last line in Notepad ... Maybe CIA or MS has the rest?

It depends on how you save the image. If you use 'Save picture as' on the forum (in MS Edge anyway) you don't get John's original file, which is why you don't see the hidden text. If however you save it directly from John's site you do. The very end of the file reads "I despair of the so-called leaders of the 21st Century world. The time of a new revolution comes! Aux armes citoyens! No pasaran!"

This shows a weakness (or perhaps a strength depending on your point of view) of his steganography technique: it's possible to corrupt the vital information 'accidentally' by processing the image in a way that would normally be insignificant. Even a 'lossless' image compression technique may destroy it, because the simplistic method John used to implant the message might result in some characters ending up in 'padding' bytes or unused 'alpha' bytes that aren't actually part of the image at all.

There are some techniques for incorporating textual information in a picture using a kind of invisible 'watermark' that survives common image processing methods. These are sometimes used to embed Copyright and other ownership information in case of illegitimate use, but also have steganographic applications.

It's a little known fact that for many years analog BBC television transmissions carried an invisible digital watermark, which would have made it possible to identify the source of an illegal recording.
« Last Edit: Jul 3rd, 2017, 08:10am by rtr » User IP Logged

tsh73
JB-Supporter


member is offline

Avatar




PM

Gender: Male
Posts: 3629
xx Re: Basic coding
« Reply #35 on: Jul 3rd, 2017, 08:15am »

Thanks Richard
That expains it.
I remeber seeing plain text in the end of file - but now I had troubles seeng that again.
(after changing save procedure (actually I selected "open in another window" but it got saved) I see these lines again).

As for plain text "tenochtitlanuk" at position 1000 in the file - I believe short greyish horisontal line 40 pixels from left, 1 line from bottom is that information.
User IP Logged

Q: "And if I took your codes and compile them, and sell them for a profit"?
A: Go ahead. I had my share of good then I coded it for fun, if you can make better use of it - please do.
(enjoying JB 1.01 on WinXP, netbook and desktop)
tsh73
JB-Supporter


member is offline

Avatar




PM

Gender: Male
Posts: 3629
xx Re: Basic coding
« Reply #36 on: Jul 3rd, 2017, 08:18am »

Quote:
Maybe CIA or MS has the rest?

Aren't you aware?
Bush hid the facts!
User IP Logged

Q: "And if I took your codes and compile them, and sell them for a profit"?
A: Go ahead. I had my share of good then I coded it for fun, if you can make better use of it - please do.
(enjoying JB 1.01 on WinXP, netbook and desktop)
bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1229
xx Re: Basic coding
« Reply #37 on: Jul 3rd, 2017, 1:17pm »

Thanks Richard, hope your summer is going well.

Thanks tsh73, I was not aware of bug.

Isn't the bug name for making up stuff? Trumping?

eg "The charges were trumped up."
User IP Logged

B+
tenochtitlanuk ( John F)
Full Member
ImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 428
xx Re: Basic coding
« Reply #38 on: Jul 4th, 2017, 2:49pm »

I've been offline for a few days.

Of course to use my technique 'for real', as in the webpage I referred to, I'd have been embedding text in a way that is harder to see. And yes I am aware of the more subtle ways to embed in images that are lossless and had always wondered about the BBC....

I deliberately left it as plain text, and put one example at a place it can be detected visually if you know where in the image to look.
I wasn't aware Edge saves image after apparently trying to 'correct' them. It's a bit naughty to describe an action as 'save' if it actually means 'save as what we think you intended'. Not what the FOSS community likes I'd guess. Do any other programs alter saved files in this way? I'd have expected a notice saying 'this does not appear to be a valid bmp file' rather than over-riding the original file...

I hardly ever use MS although having had to replace my laptop I got a second-hand one with the latest W10 on so at least I knew what Edge is! But I'd be sending any image as an attachment anyway or putting it on my website as an image, not part of an html open webpage.

Glad some people enjoyed this little rambling thread...
User IP Logged

Visit my LB/JB pages at http://www.diga.me.uk/index.html
I use XP and Ubuntu Linux on old machines!
bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1229
xx Re: Basic coding
« Reply #39 on: Jul 5th, 2017, 11:37am »

Code:
Glad some people enjoyed this little rambling thread... 


Hey John,

In the states we enjoy rambling so much we had a car named after the activity! ;)

Hi All!

Here is another kind of code from a puzzle book I got from library:
Code:
 ONE
 ONE
 ONE
 ONE
----
 TEN 


Looks like bad math unless you know the digit for each letter code.

The book is loaded with similar type puzzles and it's due in 2 weeks.

I figure the only way to solve them all in that short time is with a little help from JB.

Any ideas?
User IP Logged

B+
Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3142
xx Re: Basic coding
« Reply #40 on: Jul 5th, 2017, 1:57pm »

T=7 O=1 8=N 2=E

Perhaps a new thread for each disparate puzzle?

The trick would be how to mimic the mind and code an analytic solution.

And how to lead students and beginners to even contemplate solving such a puzzle?
User IP Logged

tenochtitlanuk ( John F)
Full Member
ImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 428
xx Re: Basic coding
« Reply #41 on: Jul 5th, 2017, 2:02pm »

Apart from the trivial ( all letters represent zero! ) there are I think four solutions of which your's, Rod, is one.
Four nested loops find them in short order. Will post code if no 'beginners' give it a go!
User IP Logged

Visit my LB/JB pages at http://www.diga.me.uk/index.html
I use XP and Ubuntu Linux on old machines!
bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1229
xx Re: Basic coding
« Reply #42 on: Jul 5th, 2017, 3:25pm »

on Jul 5th, 2017, 1:57pm, Rod wrote:
T=7 O=1 8=N 2=E

Perhaps a new thread for each disparate puzzle?

The trick would be how to mimic the mind and code an analytic solution.

And how to lead students and beginners to even contemplate solving such a puzzle?


Hi Rod,

cheesy your solution is correct of course. I am laughing because I WAS trying to start a code puzzle to get novice level people thinking how they would solve it by hand and then, THEN! try to code that starting with pseudo code.

But all these genius's jump in and... well kind of short circuit the process. wink

As you say, "The trick would be how to mimic the mind and code an analytic solution."

Yes! absolutely! But there is another trick, how to get a conversation going.

Oh well, as you say, I will try again in separate thread. Sorry, I am new to this business of engaging people with coding problems. So I flop around like a dying fish for awhile. laugh


Hi John,

shocked 4 solutions!?!
You do realize that T is suppose to stand for only one digit?

I think people would be interested in the process of going from doing something by hand to doing it with code. A challenge to put into words but diagrams or a chalkboard would help.
« Last Edit: Jul 5th, 2017, 3:28pm by bplus » User IP Logged

B+
tsh73
JB-Supporter


member is offline

Avatar




PM

Gender: Male
Posts: 3629
xx Re: Basic coding
« Reply #43 on: Jul 5th, 2017, 3:38pm »

Indeed computers are too fast today wink
4 nested loops fly like a breeze.
4 solutions it not to request all digits different
2 if digits different
(and Rod's only one reasonable, second is,... well, no one normally would write it this way)
« Last Edit: Jul 5th, 2017, 3:38pm by tsh73 » User IP Logged

Q: "And if I took your codes and compile them, and sell them for a profit"?
A: Go ahead. I had my share of good then I coded it for fun, if you can make better use of it - please do.
(enjoying JB 1.01 on WinXP, netbook and desktop)
bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1229
xx Re: Basic coding
« Reply #44 on: Jul 5th, 2017, 4:07pm »

Wait a second... the jig is not up yet, no one has shown their code yet! grin

tsh73, are you saying the O or T might equal E or N or as John said they all could equal 0.

I read the problem as implying all the letters have different number values and T is one digit.

I haven't even attempted to code the thing yet!

I only just solved by hand this one particular problem this morning.

How did I do it, by hand?

Well first I noticed NE of ONE was reverse of EN of TEN, so I started looking for numbers multiplied by 4 that have a last digit the same as another number multiplied by 4.

last digit of y = 4 times x and last digit x = y times 4.
turns out that only works for even numbers (I think)
4*2 = 8
4*8 = 32, 32 ends in 2

4*4 = 16
4*6 = 24, 24 ends in 4
but both 4 and 6 have carry over problems, they are out!

For that to work, the digits in the 1's column have to be single but the carry over in the tens column wouldn't effect the EN NE reverse pairing.

So E = 2 and N = 8 plug in and see what T turns out to be.

But can we make a pseudo code from that? Ha! wink
Not particularly suitable yet for pseudo code let alone code.

Maybe have to take a step back from this one particular problem?

Append: Oh I see! John and tsh73 are fans of brute force! grin
« Last Edit: Jul 5th, 2017, 4:15pm by bplus » User IP Logged

B+
Pages: 1 2 3 4  Notify Send Topic Print
« Previous Topic | Next Topic »

Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls