• Welcome to Valhalla Legends Archive.
 
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - shadypalm88

#1
Hi, guys. I'm racking my brain trying to figure out a generic way to do what the following Python code does for lists of three lists. I could just be stressed out and lacking sleep, but I don't see a good way!

possibles = ['ABCDE', '12345', 'XYZ']

def compute_paths(lst):
paths = []

for a in lst[0]:
for b in lst[1]:
for c in lst[2]:
paths.append([a, b, c])

return paths

for path in compute_paths(possibles):
print ''.join(path)


This correctly outputs:
A1X
A1Y
A1Z
A2X
A2Y
...
E4Y
E4Z
E5X
E5Y
E5Z


but I need to do it for any complexity. Thoughts?
#2
Yoni's Math Forum / Problem for Yoni
November 12, 2006, 12:16 AM
How many numbers of n digits exist if the sum of all digits is s?
#3
Battle.net Bot Development / Re: BNCSutil 1.3.1
September 06, 2006, 08:39 AM
Quote from: Stealth on September 05, 2006, 10:14 PM
If nobody with more experience steps up, I'll build it. I got your previous version's code compiling in Dev-C++ shortly before you released this update, or, if you have a VC++ project file I can use that instead.
That's what the vc7_build and vc8_build folders contain in the source distribution.  (Visual C++ 7 build and Visual C++ 8 build.)  There is a file in 1.3.0+ packages called README-Windows.txt that may be valuable.
#4
Battle.net Bot Development / Re: BNCSutil 1.3.1
September 05, 2006, 09:28 PM
Quote from: shadypalm88 on September 04, 2006, 01:13 AMI leave for college (first year!) on Tuesday.  I probably won't have access to a machine capable of building BNCSutil, and even if they are available on campus, I'm not enrolled in any CS classes for this term so they may not be available to me personally.

If there's any one who would like to take over maintaining the project, I'll grant Subversion write access and optionally access to the web site.

Quote from: shadypalm88 on September 04, 2006, 06:34 PMmpqNumber <= 0 should be mpqNumber < 0.  I'll fix it.
Well, I committed the one character fix to Subversion, but, it's Tuesday, I didn't rebuild the project, I've left now, and I'm not going back until late November.  This is the part where the white knight emerges.
#5
Battle.net Bot Development / Re: BNCSutil 1.3.1
September 04, 2006, 06:34 PM
Quote from: replaced on September 04, 2006, 04:54 PM
U need to release 1.3.2 ASAP, because it dont suport IX86VER0!
Sure enough, you're right.  I got a little overzealous with my operators:

if (!formula || !files || numFiles == 0 || mpqNumber <= 0 || !checksum) {
bncsutil_debug_message("error: checkRevision() parameter sanity check "
"failed");
return 0;
}
Of course mpqNumber <= 0 should be mpqNumber < 0.  I'll fix it.
#6
Battle.net Bot Development / BNCSutil 1.3.1
September 04, 2006, 01:13 AM
BNCSutil 1.3.1 primarily fixes a memory leak related to the new revision check file padding.

Other changes were made to the way file mapping is handled and to the way the initial seed values for revision checks are implemented.  These changes have not been thoroughly tested.  I was able to shoehorn the latest DLL build onto a StealthBot and log in using StarCraft.

Unlike my last statement about no longer intending to maintain this code, this one is rooted in necessity as well as desire.  I leave for college (first year!) on Tuesday.  I probably won't have access to a machine capable of building BNCSutil, and even if they are available on campus, I'm not enrolled in any CS classes for this term so they may not be available to me personally.

If there's any one who would like to take over maintaining the project, I'll grant Subversion write access and optionally access to the web site.
#7
Battle.net Bot Development / Re: BNCSutil 1.3
September 02, 2006, 05:38 PM
I have posted the source, including a link to the new Subversion repository, on the download page.  The *NIX build scripts are still broken; maybe someone with more knowledge in that area can fix it up.
#8
This is a conversation I started with a friend of mine who wanted to learn more about Battle.net programming.  I'll post it here in case someone wants to see if I'm oversimplifying and giving false information, or if someone else might possibly get use of it.  :P

Eric: just what do you know about sending data across the Internet?
Gabe: you send and receive packets
Gabe: it's like talking
Gabe: packets contain information in them
Gabe: maybe you would be better off to ask me specific questions.. i probably know more
Eric: no that's really good enough
Eric: ok
Eric: right then
Eric: yeah, talking is actually a good metaphor
Eric: I'll try that for a while
Eric: network programming is based on layers
Eric: really there are only two that you need to know about, unless you're writing an operating system
Eric: the application layer
Eric: and the "shit I don't need to really understand" layer
Gabe: do you understand that layer?
Eric: really there are more layers, I understand parts of some
Eric: the voodoo layer
Eric: is like
Eric: your ears and vocal cords
Eric: really this includes your network card and the basic Internet protocols (TCP, UDP, IP) that carry your message across
Eric: you don't need to know how they work in order to use them
Gabe: yeh
Eric: the application layer, then
Eric: would be human languages
Eric: it's this that actually carries your message
Eric: your data
Gabe: yeh
Eric: weirdly enough you can group the common human languages into two basic groups
Eric: European and Asian languages
Eric: I say weirdly because you can group protocols (app layer) into two basic groups too
Eric: text and binary
Eric: European languages are easy
Eric: you don't have to worry about your tone of voice when you say a word
Eric: and the writing system is very simple
Eric: 26 letters (in the Latin alphabet) and accent marks
Eric: even if you don't really know the language
Eric: if you know another European language
Eric: you can look at the words and kind of figure out how to say them
Eric: and some are cognates
Eric: like if you see the
Eric: French word
Eric: interresant
Eric: you can figure out that it means interesting
Eric: these are the text based protocols
Gabe: binary however.. is difficult
Eric: here's a pretty basic HTTP request
Eric: GET /index.php HTTP/1.1
User-Agent: Mozilla Firefox
Host: www.bnetweb.com
Eric: you can figure out that this is getting the page index.php from www.bnetweb.com
Eric: and that I'm using Firefox
Eric: the response, and the boundary between HTTP's talk and the actual page body
Eric: is also very easy to figure out
Eric: even if you've never worked with HTTP before
Eric: and I certainly didn't need to pull up
Eric: "HTTPDocs"
Eric: to come up with that example
Gabe: lol
Eric: just like I don't need a dictionary at all times to speak English or French
Eric: now those Asian languages on the other hand
Eric: say, Mandarin
Eric: many rants have been written about why they suck
Eric: in both the traditional (hong kong, taiwan) and simplified (mainland China) chinese writing systems
Eric: every goddamn word has its own symbol
Eric: worse, there is really no good connection between
Eric: the symbol
Eric: and how the word is actually pronounced
Eric: even native speakers will sometimes completely forget how to write a fairly common word
Eric: like knee
Eric: it's crazy and I'm never going anywhere near it... I value my sanity too much
Eric: these kind of equate to binary protocols
Eric: first of all you can't read them directly at all
Eric: you need to use a hex dump
Eric: the meaning of the packets aren't obvious just by looking at it
Eric: I mean, FF 50 24 00 ...
Eric: what the fuck is that?!
Gabe: yeh
Eric: Battle.net obviously is a binary protocl
Eric: luckily for you
Eric: the task of figuring out what FF 50 24 00 ... is
Eric: has already been done
Gabe: how did they do that.. btw
Gabe: just guess?
Gabe: and keep guessing..
Eric: a combination of educated guesses
Eric: and disassembling the games
Eric: now
Eric: you could say that there's a kind of grammar
Eric: that applies to the messages used on battle.net
Eric: each packet is like a sentence
Gabe: yeh
Eric: it expresses a complete thought
Eric: but it's a very limited and very rigid grammar
Eric: there are only certain sentences you can say that are valid
Eric: you have to have those parts of a sentence in exactly the same order
Eric: or Battle.net will tell you to fuck off
Gabe: that would be
Eric: each sentence/packet starts the same way
Gabe: the logon sequence
Gabe: right?
Eric: nope
Eric: that's just the rule for each packet
Eric: no matter what
Gabe: oh.. you mean which dword to send first
Eric: I'll get to the order they're said/sent in a bit
Gabe: etc..?
Eric: yes
Gabe: ok
Eric: now each sentence/packet starts the same way: with a header
Eric: first there's the byte 0xFF (255)
Eric: with a little stretch of the imagination
Eric: this is like a period/question mark/etc at the end of a sentence, only b.net puts it at the beginning
Eric: in English you need the period at the end to know where the sentence ends
Eric: but since you can only send certain packets of a rigid format to Battle.net
Eric: it's not necessary
Eric: the end is self-evident
Eric: this is a double-check
Eric: if where battle.net expects a new packet to start
Eric: the next byte is _not_ 0xFF
Eric: it knows that something got messed up somewhere
Eric: and it should bail out
Eric: make sense?
Gabe: yes
Eric: ok
Eric: the next byte is the packet ID
Eric: it identifies what this sentence is
Eric: whether it's going to say
Eric: "here's my username and password"
Eric: or "here's a message I'm sending to people in my channel"
Eric: battle.net doesn't use grammar like an actual spoken language
Eric: or even like a text-based protocol
Eric: the ID is the only thing that explains to the server and the client
Eric: how the rest of the packet (the "payload") should be interpreted
Eric: ok?
Gabe: yeh
Eric: the ID is followed by the length of the packet
Eric: this is needed so that you can wait
Eric: until you've received the entire thing
Eric: before you start going through it
Eric: after that is the payload: whatever else this particular packet needs to contain
Eric: (which could be nothing at all)
Gabe: yeh
Gabe: that's what the Keepalive is
Gabe: right?
Gabe: null
Eric: yeah
Eric: that has an empty payload
Gabe: it's just to tell them that you're still there
Eric: actually
Eric: SID_NULL (0x00) is for YOU to see if the SERVER is still there
Eric: if it fails to send, you know you've been disconnected
Eric: b.net servers totally ignore it
Gabe: yeh
Eric: but anyway
Eric: there are certain types of information that get sent back and forth between your bot and Battle.net
Eric: and this is where the human language metaphor stops being relevant
Eric: basically there are numbers
Eric: and there are strings
Gabe: numbers as in bytes and words and dwords
Gabe: and all that good stuff
Eric: correct
Eric: b.net uses three different sizes of numbers at different types
Eric: either a single byte, or what people call a WORD (two bytes), or what people call a DWORD (four bytes)
Eric: (DWORD = Double word)
Gabe: yeh
Gabe: i remember that
Eric: this convention is adopted from how the Microsoft Windows API's refer to numbers of those sizes
Eric: as far as I know, they're not used much outside battle.net, so watch out
Eric: (the terms for them, not bytes/words/dwords themselves)
Eric: anyway
Eric: and then there are strings
Eric: (text)
Eric: the problem with sending text
Eric: (and admittedly it's a simple problem)
Eric: has to do with length
Eric: each byte, word, and dword takes up the same number of bytes
Eric: no matter what number they're holding
Eric: be it 12 or 12,345
Eric: but obviously
Eric: not all strings will
Eric: k?
Gabe: yeh
Eric: the first common solution
Eric: is to include, say
Eric: a WORD
Eric: before each string
Eric: giving its length
Eric: the second is to use a null byte at the end of each string to indicate where the end is
Eric: (called a "null terminator")
Eric: b.net uses null terminators
Eric: you keep scanning through the payload until you hit a null byte
Eric: and when you do, you stop
Eric: that's all there is to it
Gabe: yeh
Eric: now, your problem is that you wanted to write a packet buffer, and reader too, I think
Eric: although the real problem is actually that you need it done in Visual Basic 6
Gabe: i have class at 5:45 :-\
Eric: well go to it
Eric: lol
Gabe: i feel like skipping it lol
Gabe: you're not in the moods to teach too often
Gabe: :-P
Eric: lol
Eric: I'll finish this later
#9
Battle.net Bot Development / BNCSutil 1.3
August 24, 2006, 07:25 PM
Well, my old project BNCSutil came up to me whimpering like a little puppy the other day, crying, "I don't work anymore!  Please fix me!"  It was so pitiful I couldn't say no.

Behold: BNCSutil 1.3.0.  The highest version number ever!

What's new?  The revision check code was updated to work with Blizzard's recent changes, and I finally noticed that the VB function to check the library version didin't work, and fixed that as well.

I'll post the source code as soon as I patch up the build system, or, if I never get around to it, whenever someone asks for it.
#10
Quote from: MyStiCaL on August 24, 2006, 04:34 PM
btw, thanks Eric!
Aww, you're welcome.

I am posting this link here so that I don't lose it again; without it I can't build GMP on Windows, rendering BNCSutil mostly useless.
GMP and MPFR for Visual Studio 2005
#11
I'll just pop in to say that I will be showing my baby one last bit of love and updating it for this new bit of cleverness from Blizzard.  Probably today, as a matter of fact.
#12
Visual Basic Programming / HTTPRequest
July 06, 2006, 01:05 PM
I recently worked on a project where I needed to make HTTP requests without really adding any extra external dependencies.  That requirement and my curiosity about HTTP created the HTTPRequest library.  Maybe someone here will find it useful.  It implements everything I needed, including

  • Chunked transfer encoding
  • Cookies
  • HTTP basic authentication
  • Redirection
  • Submitting forms and arbitrary POST data
  • Control over request headers
  • HTTP proxies
Internally it uses Winsock controls, but this is an implementation detail that you don't really have to worry about aside from making sure it is installed.

HTTPRequest 1.2
#13
Battle.net Bot Development / BNCSutil 1.2
May 29, 2006, 06:37 PM
I basically finished up a new BNCSutil release, version 1.2.0, but lost interest and never finished documenting it.  The changes I can remember:

- It is no longer necessary to make a call to kd_init(); BNCSutil will do it automatically the first time kd_create() is called.
- New debugging features (dumps debugging text to stdout on *NIX and a console window on Windows)
- A C++ wrapper for the NLS functions
- A new experimental build system for *NIX (I got tired of struggling with automake/conf)
- Fixed an embarringly-long-standing bug (that I see someone finally came across) that caused "(null)" to appear in the EXE info string
- Code cleanup by standardizing around a simple internal API for file access

The NLS wrapper class includes functions that allocate and return their buffers instead of forcing the caller to allocate buffers; these buffers are freed when the NLS object is destroyed.  The debugging console is visible in the updated VB example app.

I don't intend to further maintain or update the library.
#14
Quote from: Shout on May 19, 2006, 08:43 AM
Did you try setting the BIOS to try 'other boot devices'?
No such option.  It only lets me set the boot priority on the ones it recognizes.
#15
I recently bought an SATA controller card and new SATA hard drive to replace my old IDE drive when it died.  But my BIOS doesn't seem to recognize them as bootable devices.  It recognizes the TFTP boot agent on my network card, so this kind of thing must be possible... but how do I get it to see the drive?