Democratic Underground Latest Greatest Lobby Journals Search Options Help Login
Google

I finally got my head around multi-dimensional arrays

Printer-friendly format Printer-friendly format
Printer-friendly format Email this thread to a friend
Printer-friendly format Bookmark this thread
This topic is archived.
Home » Discuss » The DU Lounge Donate to DU
 
DS1 Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 04:02 PM
Original message
I finally got my head around multi-dimensional arrays
*sniffle*

I've been avoiding them years.

Now I might have to start calling myself a programmer. I want to crack a beer, but there's still 90 minutes of work left, and I should practice more anyway.


Yes, this is geek speak.


:toast:
Printer Friendly | Permalink |  | Top
billyskank Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 04:04 PM
Response to Original message
1. Very good.
But you can only start calling yourself a programmer once you have written your first recursive program.

This is a rule I just made up on the spot myself. ;)

:hi:
Printer Friendly | Permalink |  | Top
 
redqueen Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 04:19 PM
Response to Reply #1
5. "This is a rule I just made up on the spot myself."
:rofl:



Congrats, DS1, on your milestone. :toast:
Printer Friendly | Permalink |  | Top
 
SOteric Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 04:13 PM
Response to Original message
2. *Beer Vibes*
I look forward to the details.
Printer Friendly | Permalink |  | Top
 
DS1 Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 04:20 PM
Response to Reply #2
6. In a world. Where one man and his Microsnot Notepad
can generate giant access lists a mere seconds...
Printer Friendly | Permalink |  | Top
 
motely36 Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 04:15 PM
Response to Original message
3. Yeah...gotta love arrays
:toast:
Printer Friendly | Permalink |  | Top
 
billyskank Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 04:20 PM
Response to Reply #3
7. Especially when combined with structs.
Struct (record) + array = table!

With pointers and structs, I feel I can organise the whole world! :)
Printer Friendly | Permalink |  | Top
 
DS1 Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 04:20 PM
Response to Reply #3
8. I've always let a RAD IDE do the dirty work
this time I had to go it alone
Printer Friendly | Permalink |  | Top
 
billyskank Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 04:22 PM
Response to Reply #8
11. That's the other thing.
Use IDEs to make your life easier for yourself, but understanding yourself the process by which you can accomplish that which the IDE makes easier, that is the doorway to The Tao.

http://www.canonical.org/~kragen/tao-of-programming.html
Printer Friendly | Permalink |  | Top
 
DS1 Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 08:03 PM
Response to Reply #11
19. great link
sad and inspiring at the same time. Such is the Tao
Printer Friendly | Permalink |  | Top
 
Dangerously Amused Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 04:18 PM
Response to Original message
4. Multi-dimensional arrays. Hmm. Does that involve time travel, or math? Or both?


Either way, I'd be screwn.


But here's to your accomplishment anyway (whatever the hell it is):


:toast:


Printer Friendly | Permalink |  | Top
 
DS1 Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 04:21 PM
Response to Reply #4
9. Well, it did make most of the afternoon disappear
:crazy:
Printer Friendly | Permalink |  | Top
 
Symarip Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 04:22 PM
Response to Original message
10. I remember when I was programming in Authorware
And we had to base our navigation on multiple arrays. It took me six months before I really understood just what the hell I was doing.

Cheers.
Printer Friendly | Permalink |  | Top
 
DS1 Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 04:24 PM
Response to Reply #10
12. heh, thanks
they look so logical when someone else has already written them :7
Printer Friendly | Permalink |  | Top
 
Symarip Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 04:27 PM
Response to Reply #12
13. It's weird
Because it's one of the few area's in programming in my experiences where you actually have to create it in order to learn from it. If someone else has made the array, you can just work around it and you really don't have a full grasp of what it really does (or can do, for that matter).
Printer Friendly | Permalink |  | Top
 
mainegreen Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 05:15 PM
Response to Original message
14. Just now? You'd hate my code.
I'm legendary for my use of multidimensional arrays. Want to filter, sort, and reduce to unique values a strange set of data? Use an n-dimensional array with data as the keys and recursively sort! No need to think!

I just got done with a datagrid component that uses an array to store multiple states, datasets, definitions, event listeners, and validators in one big-ass multidimensional array. It's like XML without the clutter (or the self-documenting features).

Seriously though, one of the big strengths of PHP is the way it handles arrays. Powerful. Hella powerful. Most languages can't even come close. Of course, PHP's entire datastate is really just one big-ass array ('cause that's basically what the symbol table is).

print_r($GLOBALS) and there it is.

Congrats! It's fun mastering something you know you should know. I just buckled down last week and *really* learned regex. I felt more 'legitimate' after that.
Printer Friendly | Permalink |  | Top
 
DS1 Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 05:27 PM
Response to Reply #14
16. hah
regex whipped my ass earlier this week.

I'm fairly self-taught with all this, but I'm looking forward to banging my way down the hallway to enlightenment!
Printer Friendly | Permalink |  | Top
 
mainegreen Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 07:18 PM
Response to Reply #16
18. Ain't nothing wrong with self taught.
That's what I am, as well as half the people at my office.
Printer Friendly | Permalink |  | Top
 
Anonymous-Thoughts Donating Member (6 posts) Send PM | Profile | Ignore Thu Dec-11-08 05:26 PM
Response to Original message
15. Array of Arrays!
It is actually pretty simple. It is just an array of arrays!

Here is a basic algorithm for a multi-dimensional array:

Arr x = ( 1 => "a", 2 => "b" )
Arr y = ( 1 => "c", 2 => "d" )
Arr z = ( 1 => "e", 2 => "f" )

Arr w = ( 1 => x, 2 => y, 3 => z )

Array w now has the arrays x, y, and z in it; thus, it is a multi-dimensional array.

w<1><1> == "a"
w<1><2> == "b"
w<2><1> == "c"
...
w<3><2> == "f"
Printer Friendly | Permalink |  | Top
 
DS1 Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 05:28 PM
Response to Reply #15
17. Yes
but ~using~ them with something useful was the hurdle :)
Printer Friendly | Permalink |  | Top
 
LynzM Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 09:13 PM
Response to Original message
20. Cool!
Congrats! :D
Printer Friendly | Permalink |  | Top
 
DS1 Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 10:12 PM
Response to Reply #20
22. Thanks!
It's good to get beyond that, and move on, I'm excited to get to the next part!
Printer Friendly | Permalink |  | Top
 
flvegan Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 09:19 PM
Response to Original message
21. My college dorm Residential Advisor (RA) wasn't multi-dimensional.
Wait...what are you talking about?
Printer Friendly | Permalink |  | Top
 
DS1 Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 10:13 PM
Response to Reply #21
23. What did you think of "Thriller"?
And for people reading, I don't mean the Michael Jackson video
Printer Friendly | Permalink |  | Top
 
flvegan Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 10:22 PM
Response to Reply #23
24. Loved it.
Edited on Thu Dec-11-08 10:23 PM by flvegan
It's tough to take Jezza without interruption for that long, but oh my God. It was the review of that cabrio Zonda that convinced me that the Pagani is indeed, the best car in the world.

The review of the Alfa whateverthehellitwas was pretty funny.

on edit: much thanks again.
Printer Friendly | Permalink |  | Top
 
Ptah Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 10:24 PM
Response to Original message
25. Is that like having bees in your head?
:shrug:

Printer Friendly | Permalink |  | Top
 
DS1 Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 10:31 PM
Response to Reply #25
26. It's like conquering a hornet's nest you've always avoided
Edited on Thu Dec-11-08 10:33 PM by DS1
but then your grandkids show up, and you've got to get it done. You get stung a lot, but better you than them.

edit: And the next time the Queen shows up, she'll be all like, I'd better not mess with this douchebag. :D
Printer Friendly | Permalink |  | Top
 
Ptah Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 11:27 PM
Response to Reply #26
27. So, you could give me time and oven temperature to heat treat this piece?
It needs to be at 900 deg F for fifteen minutes and then oil quenched.

Printer Friendly | Permalink |  | Top
 
DarkTirade Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Dec-11-08 11:30 PM
Response to Original message
28. I don't know if I've ever used more than 3 dimensional ones myself.
Hell, first time I ever did anything with graphics I didn't even use 2 dimensional ones, just one dimensional ones. This was back when I was still using PASCAL. :P
Printer Friendly | Permalink |  | Top
 
MilesColtrane Donating Member (1000+ posts) Send PM | Profile | Ignore Fri Dec-12-08 12:59 AM
Response to Original message
29. Could you beat Spock at 3D chess?
Printer Friendly | Permalink |  | Top
 
DU AdBot (1000+ posts) Click to send private message to this author Click to view 
this author's profile Click to add 
this author to your buddy list Click to add 
this author to your Ignore list Thu Mar 13th 2025, 05:24 PM
Response to Original message
Advertisements [?]
 Top

Home » Discuss » The DU Lounge Donate to DU

Powered by DCForum+ Version 1.1 Copyright 1997-2002 DCScripts.com
Software has been extensively modified by the DU administrators


Important Notices: By participating on this discussion board, visitors agree to abide by the rules outlined on our Rules page. Messages posted on the Democratic Underground Discussion Forums are the opinions of the individuals who post them, and do not necessarily represent the opinions of Democratic Underground, LLC.

Home  |  Discussion Forums  |  Journals |  Store  |  Donate

About DU  |  Contact Us  |  Privacy Policy

Got a message for Democratic Underground? Click here to send us a message.

© 2001 - 2011 Democratic Underground, LLC