[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 264: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 326: mysqli_free_result(): Couldn't fetch mysqli_result
Pete's QBASIC Site Discuss QBasic, Freebasic, QB64 and more 2008-02-07T17:53:04-05:00 http://petesqbsite.com/phpBB3/app.php/feed/topic/2586 2008-02-07T17:48:16-05:00 2008-02-07T17:48:16-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=16574#p16574 <![CDATA[binair to bits]]>
Grtz

Statistics: Posted by Seb McClouth — Thu Feb 07, 2008 5:48 pm


]]>
2008-02-07T17:53:04-05:00 2008-02-07T17:43:53-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=16573#p16573 <![CDATA[binair to bits]]>
http://www.petesqbsite.com/forum/viewtopic.php?t=1830

Also, a more simple but less universal (than the one in the other post I linked to) code to determine the bits of a number...

Code:

'Inputs: YourNum% - The number to turn into binary.'Outputs: Bin$ - The number in binary, formatted as a string.DO  MaxBit% = MaxBit% + 1LOOP UNTIL 2 ^ MaxBit% > YourNum%'Remove the part above and replace the MaxBit% below if you already'know the highest bit your program will have, or if you can only take'certain bits (ie, up to 16)FOR A = 0 TO MaxBit%  Bin$ = LTRIM$(RTRIM$(STR$(ABS(((2 ^ A) AND YourNum%) > 0)))) + Bin$NEXT A

Statistics: Posted by Patz QuickBASIC Creations — Thu Feb 07, 2008 5:43 pm


]]>
2008-02-07T17:26:50-05:00 2008-02-07T17:26:50-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=16571#p16571 <![CDATA[binair to bits]]>
I'm gonna try the code later. But it looks just like the thing I need!!

Statistics: Posted by Seb McClouth — Thu Feb 07, 2008 5:26 pm


]]>
2008-02-07T14:54:09-05:00 2008-02-07T14:54:09-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=16570#p16570 <![CDATA[Conversions]]>

Code:

SUB Dec2BinCOLOR 14: LOCATE 2, 30: PRINT "Decimal to Binary"COLOR 10: LOCATE 5, 20: INPUT "Enter a decimal number: ", num&DOremain = num& MOD 2    'remainder is used for binary resultnum& = num& \ 2           'discard any remainder with integer divisionBin$ = LTRIM$(STR$(remain)) 'make string numberBinary$ = Bin$ + Binary$    'add remainder to binary numberLOOP UNTIL num& = 0COLOR 11: LOCATE 10, 30: PRINT "Binary number = "; Binary$  'binary resultEND SUB
You can convert decimal values to any other base number system using the base number. The binary result shows which bits are on as 1's.

Ted

Statistics: Posted by burger2227 — Thu Feb 07, 2008 2:54 pm


]]>
2008-02-06T12:23:30-05:00 2008-02-06T12:23:30-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=16566#p16566 <![CDATA[binair to bits]]>

Code:

FOR a = 0 TO 20  'I'm assuming for the test we only need 20 bits   If temp1 AND 2^a THEN 'as Ted told me to test, I'm testing here if it goes       temp$ = "1"+ temp$ 'Why did I assume again this has to be one?       temp2 = temp2 + (temp1 AND 2 ^ a) 'to test if temp2 = temp1 then      IF temp2 = temp1 THEN EXIT FOR        'we leave the for-next-thing ELSE      temp$ = "0" + temp$ END IF NEXT
simple exits the for-next if the calculated bits are the same as the input. So if we have 500 for example we have 9 bits, 200 for example 8 bits, if I'm not mistaken.

I'm not sure weither I could use XOR for that matter. But I do now understand now 32 bits = 4294967296, etc.

That's for that insight.

But I'll keep your code in mind, might need it for someother thing in QBinux. Thx Patz.

Statistics: Posted by Seb McClouth — Wed Feb 06, 2008 12:23 pm


]]>
2008-02-05T23:56:53-05:00 2008-02-05T23:56:53-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=16564#p16564 <![CDATA[binair to bits]]>

Code:

YourValue% XOR 16
should give you what you're looking for. That's saying if you pull out the 4 bits you needed into the YourValue%, that is.

Statistics: Posted by Patz QuickBASIC Creations — Tue Feb 05, 2008 11:56 pm


]]>
2008-02-05T15:07:39-05:00 2008-02-05T15:07:39-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=16563#p16563 <![CDATA[binair to bits]]>
Due to some Linux stuff I was again in need of the binary to bit.
It was for the ~ (complementary stuff).
If you don't know what this is:
e.g. we have 8 in 4 bit => 1000, when doing the ~action, it becomes 0111, because it simple changes 1 to 0 and 0 to 1.

Maybe you already know how to do this but here's the code I came up with. I know it looks very noobish but atleast it seems to work. And the fact that I choose for a certain amount of bugs might not be correct.

Code:

temp1 = 500 'we gonna complementair 500 in this example.temp$ = ""temp2 = 0mirrortemp$ = ""temp3 = 0compltemp$ = ""mirrorcompltemp$ =""temp4 = 0FOR a = 0 TO 20  'I'm assuming for the test we only need 20 bits  If temp1 AND 2^a THEN 'as Ted told me to test, I'm testing here if it goes      temp$ = "1"+ temp$ 'Why did I assume again this has to be one?      temp2 = temp2 + (temp1 AND 2 ^ a) 'to test if temp2 = temp1 then     IF temp2 = temp1 THEN EXIT FOr        'we leave the for-next-thingELSE     temp$ = "0" + temp$END IFNEXT'The above code gives us the bits for temp1FOR a = 1 to len (temp$)mirrortemp$ = MID$(temp$, a, 1) + mirrortemp$  'mirror the bit from temp$ for checkNEXT'from here I'm lost in remarks, but it works.FOR a = 1 TO LEN(mirrortemp$)IF MID$(mirrortemp$, a, 1) = "1" THEN  IF a = 1 THEN    temp3 = temp3 + 1  ELSE    temp3 = temp3 + 2 ^ (a-1)  END IFEND IFNEXTIF temp3 = temp1 THEN 'compare temp3 and temp1FOR a = 1 TO LEN(temp$)   IF MID$(temp$, a, 1) = "0" THEN      compltemp$ = compltemp$ + "1"   ELSEIF MID$(temp$, a, 1) = "1" THEN      compltemp$ = compltemp$ + "0"   END IFNEXTFOR A = 1 to LEN(compltemp$)mirrorcompltemp$ = mid$(compltemp$, a, 1) + mirrorcompltemp$NEXTFOR a = 1 to LEN(mirrorcompltemp$)IF MID$(mirrorcompltemp$, a, 1) = "1" THEN   IF a = 1 THEN      temp4 = temp4 + 1   ELSE      temp4 = temp4 + 2 ^ (a-1)   END IFEND NEXT
So, is there an easier way? Or should this do the trick.

Statistics: Posted by Seb McClouth — Tue Feb 05, 2008 3:07 pm


]]>
2008-02-05T14:47:29-05:00 2008-02-05T14:47:29-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=16562#p16562 <![CDATA[AHA]]>
Ted

Statistics: Posted by burger2227 — Tue Feb 05, 2008 2:47 pm


]]>
2008-02-05T14:20:41-05:00 2008-02-05T14:20:41-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=16561#p16561 <![CDATA[binair to bits]]> Statistics: Posted by Nodtveidt — Tue Feb 05, 2008 2:20 pm


]]>
2008-02-05T13:40:51-05:00 2008-02-05T13:40:51-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=16560#p16560 <![CDATA[binair to bits]]> Statistics: Posted by Seb McClouth — Tue Feb 05, 2008 1:40 pm


]]>
2008-02-05T11:03:57-05:00 2008-02-05T11:03:57-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=16559#p16559 <![CDATA[Thanks! I'll try your information tomorrow.]]>
The above is meant only as "an instruction for better living", and is not meant to offend. Hope you understand.

Statistics: Posted by Ralph — Tue Feb 05, 2008 11:03 am


]]>
2008-02-05T05:40:10-05:00 2008-02-05T05:40:10-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=16558#p16558 <![CDATA[binair to bits]]> Statistics: Posted by Seb McClouth — Tue Feb 05, 2008 5:40 am


]]>
2008-02-05T05:28:16-05:00 2008-02-05T05:28:16-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=16557#p16557 <![CDATA[OK Seb]]>
But Nod ought to stick with his crayons and quit messing with adults. Why don't you just stick to the FB forum and perhaps learn something? Make another childish game or something Nod. Your Avitar goes from STFU to "We are family" LOL. Grow up man! You gotta be over 18 by now.....

Yeah BDZ, you were right on that one. Seems when I get pissy here, good ole Nod comes around to pull my BLEEP.

Ted

PS: Are you BLIND NOD? Read the line below for cryin out loud!

Statistics: Posted by burger2227 — Tue Feb 05, 2008 5:28 am


]]>
2008-02-05T01:06:50-05:00 2008-02-05T01:06:50-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=16554#p16554 <![CDATA[Re: Hum de dumb]]>
It appears that Sebby has better things to do than reply to our posts.

So I won't bother with that dude no more!

Ted
Hey Teddy

Soz about not replying but I'm extremly busing. I'm working full time.
I'm responsible for a family (that includes a wife and a baby girl). I also have to go to school for the job, one day a week.
The job involves irregulars hours so also irregular sleeping. And the irregular free time that I have I spend in working on QBinux

I did read the post and gave the codes a try.

If I don't reply doesn't mean I don't appreciate the work your guys doing.
Because I do and it helps a lot.

Thx for what your guys did and are doing this far!

Seb

Statistics: Posted by Seb McClouth — Tue Feb 05, 2008 1:06 am


]]>
2008-02-05T00:05:30-05:00 2008-02-05T00:05:30-05:00 http://petesqbsite.com/phpBB3/viewtopic.php?p=16553#p16553 <![CDATA[binair to bits]]> Statistics: Posted by Nodtveidt — Tue Feb 05, 2008 12:05 am


]]>