I don't have any references in my head ;) this line just told me "I DONT WORK" *hehe*
Printable View
I don't have any references in my head ;) this line just told me "I DONT WORK" *hehe*
This code doesn't make much sense:
>edited: I forgot to remove an unneccesary comment.<Code:Property Get adh(data() As Byte, length As Long, Optional offset As Long) As String
Dim a() As Byte, y&, x&
ssize(a) = length * 3 'you're assigning a value to a function
For x = offset To offset + length - 1 'if offset isn't used when the function is called this may produce
'unexpected results
a(y) = data(x) \ 16 + 48
If a(y) > 57 Then a(y) = a(y) + 7
y = y + 1 'y isn't assigned a starting value
a(y) = (data(x) And 15) + 48
If a(y) > 57 Then a(y) = a(y) + 7
y = y + 1
a(y) = 32
y = y + 1
Next x
adh = StrConv(a, vbUnicode)
End Property
Code:Property Get Adh(Data() As Byte, Length As Long, Optional Offset As Long = 0) As String
Dim A As Long
Dim B As Long
Dim Temp() As Byte
'Allocate memory
sSize(Temp) = Length * 3 'Still think that doesn't work...
For A = Offset To Offset + (Length - 1)
'Convert hiBits
Temp(B) = CByte(Data(A) \ 16) + 48
If Temp(B) > 57 Then Temp(B) = Temp(B) + 7
'Convert loBits
B = B + 1
Temp(B) = CByte(Data(A) And 15) + 48
If Temp(B) > 57 Then Temp(B) = Temp(B) + 7
'A space between them
Temp(B + 1) = 32
B = B + 2
Next
'Return string
Adh = StrConv(Temp, vbUnicode)
End Property
'Code improved by vBulletin Tool (Save as...)
Active and Fox 3 points ;) and dennis actually gets a point for bringing up some issues
Active:
a is temporarily storage for hex string yep
ssize resizes 3 times the length yep
Hex digits start from 48 (0) and skip from 57 to 64 and continue from A (65) yep
32 is space yep
Strconv converts a byte array to string yep
Fox:
Allocate memory, yep 3 times length, everyone can see taht
Convert hibits, lobits, yep. That is to the hex digits. the bases 256 is divisible with 16 and furthermore 2 hex digits represent a byte.
vb adds implicitely Cbyte() but fox may have a point to show it's there, in c++ you have to do type casts explicitely.
I'm a bit sceptic if this is a improvement, depends how vb handles the values you pass as expression and stuff, but on the other hand if you remove a B=B+1 then you might just have a speed gain.Quote:
Temp(B + 1) = 32
B = B + 2
also nicer code :)
Dennis:
Ssize is a property get/let so if you assign a value property let will handle the left side expression as the last parameter passed.Quote:
'you're assigning a value to a function
too used to c++? ok vb doesn't need you to set starting values, they are automatically set to 0.Quote:
'if offset isn't used when the function is called this may produce
'unexpected results
and
'y isn't assigned a starting value
when offset is omited it is 0 therefore for loop will start from 0 and loop length -1 times
a(y) = 32 a space character is assigned as a delimeter for the hex string
I said 'whats the use of
before I fully realized y was being incremented.
And.... yes.. I'm used to C++.... VB sucks.. it does too much for you... it's bad practice to use a variable without manually assigning a value... and VB just lets you do it..... as well as using a variable without declaring it.... :o
Yes, "Vb is bad" and got it's bad reputation for allowing programmers to do that, however vb has it's advantages of being a RAD tool, even for professional programmers.
True.. I do not like VB at all... but I didn't feel like modifying some VB code I had to work in C++... so the other day.. I made something in VB..... :eek:
it is a program that modifies the httpd.conf file(for apache server) to use your current IP.
I totally agree with that, Kedaman.
Heh, I need some coffee!
I'm Clueless on the original topic!
As to the VB is Bad statement,
Its not VB thats bad, its Bad Programmers that make people think VB is bad!
;)
There are no bad programmers, there's just bad ;) btw how come you bring this up now, because I happen to be around?
Nope! Thats just serendipity!
I was searching for "Combination AND Recursion" and this popped up. It was an interesting read, a bit Over My head, so I decided to bump it.
You just happened to be flying by when it was launched!
:D
-Lou
skimming trough it myself i'd have to say I can hardly comprehend myself. Fire away if you have any questions btw :)
I don't know if this happens to any of you, but sometimes when I'm going back through my code in old projects - I'm like how the ****ing hell did I do that ?
Like, the code's so complicated, or its such a cool approach to doing something, I just wonder how I came up with it...
happens to me all the time...;)Quote:
Originally posted by plenderj
I don't know if this happens to any of you, but sometimes when I'm going back through my code in old projects - I'm like how the ****ing hell did I do that ?
Like, the code's so complicated, or its such a cool approach to doing something, I just wonder how I came up with it...
whenever i browse old projects to get bits of ideas for my new projects, i get surprised with some of my code (esp. my projects in C++). and then ill end up asking myself... I did this? :confused:
naming convention my arse, i haven't passed a single parameter to single dirty vb function for years and i assure you it wont happen
whenever i see a glimse of my own code i'm filled with disgust :D
nope. nothing to do with naked conventions or VB (ok that incorporates some filthy experience initself), but generally you feel like you're going to throw up any second. That tells you how totally worthless you've been ;)
thats a gross understatement :p
depends what you mean with can, i mean you can't do pretty much anything with VB.
And how's the mortgage coming along ? ;)Quote:
Originally posted by Wokawidget
You can do most things. It just requires complex API code...
VB was developed for small-medium DB office applications, well that's what it's best at producing anyways. It does it's job 110%...and it pays my morgage :D
Woka
Anyway badger, there's no point in arguing anything with kedaman - there really isn't. It'll do your head in! :D
pfff.. complex API code, as if calling dynamic link liberaries that were written in C++ in the first place was something. The range of apps writable in VB is extremely minimal and specified so you haven't seen any actual projects if you perimeter it with small-mediumQuote:
Originally posted by Wokawidget
You can do most things. It just requires complex API code...
VB was developed for small-medium DB office applications, well that's what it's best at producing anyways. It does it's job 110%...and it pays my morgage :D
Woka
Darn! I HATE cliffhangers!Quote:
Originally posted by kedaman
pfff.. complex API code, as if calling dynamic link liberaries that were written in C++ in the first place was something. The range of apps writable in VB is extremely minimal and specified so you haven't seen any actual projects if you perimeter it with small-medium to be continued...
:p
Haven't seen anybody about that narcolepsy yet, ehh Keda?Quote:
Originally posted by kedaman
pfff.. complex API code, as if calling dynamic link liberaries that were written in C++ in the first place was something. The range of apps writable in VB is extremely minimal and specified so you haven't seen any actual projects if you perimeter it with small-medium thud!
:D
Oh sorry, I just got bored :rolleyes:Quote:
Originally posted by NotLKH
Haven't seen anybody about that narcolepsy yet, ehh Keda?
:D
..scale in your personal preferences, and it'd suprise me if you could find it even slightly useful out of given narrow application.. and you don't want to hear me mention bloatware, you just don't!
that just hurts too much... third party controls?! Yeah like everything programming is about has to do with a slick and easy to use GUI, sounds like poetry to me, or makeup. I'm going to throw up.Quote:
The only limitations I have come across is the simple fact that windows controls don't have much functionality that a user requires, but this can be overcome by purchasing 3rd party controls...
Ad hoc ad hoc and use libraries, friggin advertising outright equivalent to commercialising collectors cards. Ohh it is is so complicated, and all that, yeah riiiight! "decent" VB developers *shakes head*Quote:
I am just confused at how someone can say the VB isn't good enough to write the majority of applications...it's maybe a tad more complicated at attempting certain things, like MultiThreading, but this can easily be overcome by any half decent VB developer who knows how use subclassing and ActiveX EXEs.
Since when am I advocating C++ here? :rolleyes: In my dictionary complicated is a bad word, very bad. And ffs stop assuming what I know of VB.Quote:
yes, C++ is a more complicated, in depth and well rounded language, I'll give you that.
I have found that people who use the arguments you have, don't know how to fully program in VB, or use the "Well, it's only 3 lines of code in C++ and it's 1ms faster"...
I'm aware of that problem. VB is like a cake decoration knife.Quote:
They are different packages used for different things...
Would you use a machette to open a letter??? No, you would use a letter knife...yea, a letter knife won't chop a tree down, or skin a rhino, but that doesn't make it crap
AFAIK that was one of those adhoc methods i had to take cause of VB's disabilities, I can't comment further on it without reading the thread and i'm not going to do that.
well stop with that insufficient metonymization or i'll have jamie kill you, its insulting. Even though i don't care for what i have posted here two and half years ago, i just checked my third post, read it please. My vb has certainly got rusty but at least don't go assume i've said something I haven't. Nevertheless I'm aware of all its limitations.
you're not even reading my posts, so just cut it out
I haven't looked at any of the responses, but i looked at the function for about 3 minutes and then a picture developed of what was happening. I've seen that functions hold their value; static seems redundant. Maybe it isn't
Actually the code is used to delete members of forums that dig up old threads and don't read them properly :)
For future referance, the Preview Reply button is on your other right.Quote:
Originally posted by dafhi
Maybe it isn't
:wave:
-Lou