Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
zootm
Aug 8, 2006

We used to be better friends.
That kind of relationship is referred to as "many-to-many" but I'm not sure what a data structure that implements it would be called. I've only ever seen this sort of thing in persistence libraries modelling the same thing in a database, but they don't tend to use a specialised structure. With one-to-one multiplicity this would be a "bidirectional map", but that's not what you've done here. Essentially you're just holding a list of graph edges with a specialised interface to it, as far as I can tell?

Edit: That last one basically answered itself. I think the data structure you've made is probably pretty much a graph data structure, and you could implement your interface with an adjacency list or an adjacency matrix pretty well. The interface just looked kinda strange :). Since you differentiate left and right I guess you're essentially representing a directed graph as well.

zootm fucked around with this message at 10:32 on Feb 23, 2008

Adbot
ADBOT LOVES YOU

zootm
Aug 8, 2006

We used to be better friends.

Professor Science posted:

isn't tenenbaum basically a source walkthrough of minix, though? that seems kind of silly.
I don't think it is. I seem to recall it gives a pretty detailed overview of the construction of various popular kernels.

zootm
Aug 8, 2006

We used to be better friends.

csammis posted:

An empty list isn't null in Java, it's just empty. size() == 0.
It's usually completely irrelevant, but it looks a little nicer to use "list.isEmpty()" rather than "list.size() == 0".

zootm
Aug 8, 2006

We used to be better friends.
Perl tends to be the standard, yeah. I see a lot of scripts written in Ruby, of all things, these days too though, and Python support is pretty ubiquitous these days so that may be a good choice. Use whichever one you like so long as you know it's available to you.

zootm
Aug 8, 2006

We used to be better friends.
The Commons Collections library also has a MultiMap object which does this sort of thing, but it doesn't seem to use generics. I did also find this library which refactors them to use generics though.

zootm
Aug 8, 2006

We used to be better friends.

MEAT TREAT posted:

WTF does the ^ character mean? Is it supposed to be a better *?
I'm not very experienced with this, but I think it's a pointer to a managed object.

zootm
Aug 8, 2006

We used to be better friends.

fletcher posted:

You could also probably do it in javascript, but it will be painful.
To be fair, with jQuery it is one function call.

zootm
Aug 8, 2006

We used to be better friends.

Mustach posted:

That wording makes it sound like an object has a reference per member method, but I'm sure that Java implements it as one reference to a table of all member methods.
This may well be right but considering the extent of the runtime optimisations of which the JVM is capable it's often best to avoid reasoning based on these high-level views of implementation.

zootm
Aug 8, 2006

We used to be better friends.

N.Z.'s Champion posted:

So unpacking tuples works in Python, but can this be done in PHP?
Apparently this works:
code:
list($a,$b) = array($b,$a);
This is probably just as inefficient as it looks, though. Just use the drat temporary variable, it's the only good excuse to use the variable name temp and you should revel in that.

zootm
Aug 8, 2006

We used to be better friends.

Z-Bo posted:

What is the difference between a Perl regular expression and a regular expression? I tried Googling, but the only interesting thing I found is that two regular expression matching engines can differ based upon their matching technique, backtracking or DFA (interesting but not pertinent).
On a more theoretical level, Perl regexes can actually define more than the set of regular languages, which means "regular expression" is something of a misnomer, as well as meaning that Perl regexes cannot, in general, be expressed as DFAs.

zootm
Aug 8, 2006

We used to be better friends.

Fly posted:

There have got to be older editions for sale at a quarter of that price.
Well there's what appears to the same edition of the same book on a linked page anyway.

zootm
Aug 8, 2006

We used to be better friends.

Randomosity posted:

It's just a stupid stylistic thing, but I'm curious how it's done.
In C, at least, if you print out "\r" it'll move you back to the beginning of the current line and let you type over it again. I think.

Edit: One-liner to show it in Ruby:
code:
(1..100).each { |i| print( "\r#{i}% done." ); sleep( 0.1 ) }

zootm fucked around with this message at 18:25 on Jan 9, 2009

zootm
Aug 8, 2006

We used to be better friends.

sund posted:

I do this in python by accessing the stdout stream directly and sending it '\b' characters.
Yeah, \b moves back one character whereas \r moves to the beginning of the current line.

zootm
Aug 8, 2006

We used to be better friends.

That Turkey Story posted:

This is not guaranteed to be portable, so use at your own risk.
The \r, the \b, or both? I've never actually used either so someone who knows about this would be appreciated.

zootm
Aug 8, 2006

We used to be better friends.
Oh yeah, now you mention it I knew that. Hmm.

zootm
Aug 8, 2006

We used to be better friends.
So good I posted it twice apparently.

zootm fucked around with this message at 11:56 on Jan 14, 2009

zootm
Aug 8, 2006

We used to be better friends.

IntoTheNihil posted:

Sorry to spam up this thread with even more questions but I've recently discovered how huge the Java market really is. Even around my city there's multiple high paying jobs for Java programmers. Can anyone tell me the pros and cons of the language and some general learning info? I messed with it a bit before and even though people say it's simple I couldn't grasp much.
I think you should probably note that although there's a lot of Java work around, a large amount of it is tedious grunt work that will eat your soul. This is the consequence of Java being big in 'enterprise', and can apply to other things too, notably .NET.

That said if you can deal with that and dig to find what you want (or dream of sleeping on a bed of money) it's not a terrible language to learn. Follow the tutorial as people have said, direct questions to the Java thread on here.

Incidentally I do think that everyone should learn more than one language, but I think that C++ is only the best language at teaching you C++. For other concepts there's almost certainly a better choice which will teach you it in a clearer way.

zootm
Aug 8, 2006

We used to be better friends.
On Linux I think Video4Linux is used, which I've used before and wasn't particularly painful. Apparently GStreamer wraps it which might be a more useful abstraction though.

If you feel like using Java for a cross-platform style thing, JMF supports video capture and a whole host of other nonsense. I have a vague recollection of it being one of those frameworks that takes a little work to grasp its design but being pretty easy to use beyond that.

zootm fucked around with this message at 01:47 on Jan 17, 2009

zootm
Aug 8, 2006

We used to be better friends.
Does nesting single quotes work like that?

zootm
Aug 8, 2006

We used to be better friends.

tef posted:

Alternatively, if there are similar pieces of software for ci that suck a lot less I'd be interested too
Hudson is a drat sight better, and if you can stomach Maven it's apparently not too hard to write your own extensions either. CruiseControl is pretty horrid, yeah.

zootm
Aug 8, 2006

We used to be better friends.
Agreeing with the Python suggestion. The JDK is larger than 20MB if I recall and to use it effectively you really need an IDE, which can be in the hundreds of megs.

zootm
Aug 8, 2006

We used to be better friends.
Your label is LABLE1 (E and L wrong way around) and your jump is to LABEL1 (E and L correct way around). I have no idea what the semantics are when you tell it to jump to a label that doesn't exist so don't know if that's your problem, though.

zootm
Aug 8, 2006

We used to be better friends.
Anal-retentive post time.

ShoulderDaemon posted:

Instead of "dynamic typing", say the language has "value typing" - types are attached to individual values at runtime.
I think that "dynamic typing" is actually correct here; I've not heard of "value typing", but "dynamic" (or sometimes "latent") is the term you see in use. It's not ambiguous. "Typing" is a bit confusing, as is pointed out in Types and Programming Languages:

quote:

Terms like "dynamically typed" are arguably misnomers and should probably be replaced by "dynamically checked," but the usage is standard.
As alluded to here, "dynamically checked" is probably the best choice of words if you want to avoid ambiguity here.

ShoulderDaemon posted:

Instead of "static typing", say the language has "name typing" - types are attached to names and variables at compile time.
Name typing is probably a bad name to use, because it's easily confused with "nominal types", one of the means of defining type systems. It's more common in languages that are actually in common use, but "structural types" (where one only needs to have the correct type signature in order to be considered a subtype) are more popular in academic languages. Again, I think that "static" is pretty standard and unambiguous, although "statically checked" might be a better way of putting it.

ShoulderDaemon posted:

Instead of "weak typing", say the language has "implicit type conversions" - expressions of a certain type may be used as if they had a different type, and the compiler will silently convert.
The important thing about this is that "weak" is an ambiguous term. The other thing that people sometimes mean when they refer to "weak" type systems is actual untyped systems, where the system will blindly use the value they are given as though it had the memory structure of the type they were expecting, whether or not that is the case. This is the case with C (albeit not always) and assembly-level languages. Where it's accompanied with some checking (as in C), the term used tends to be "unsafe", to contrast with dynamically- or statically-typed languages which will always (regardless of their checking scheme) detect a type error either at run- or compile-time. When it's not, I think that "untyped" probably applies.

ShoulderDaemon" posted:

Instead of "strong typing", say the language has "explicit type conversions" or "no type conversions" - types are immutable, and must be converted by the programmer's direction.
I think given the other terms mentioned here, the term "strong" really should not be used at all. In particular there are languages with implicit type conversions which are as "strongly" typed as any other language - in particular Scala has a whole implicit type conversion mechanism that is programmer-controlled, but is as statically checked and safe as it would be without it.

I don't intend to be picky, I just don't want bad terms replaced with more rarely-used or unusual terms. Your post is an excellent description of the difficulties in classifying type systems.

zootm
Aug 8, 2006

We used to be better friends.

ShoulderDaemon posted:

That's fair; I mostly see the terms in the works of mathematicians rather than computer scientists, describing the model checkers they've built for some logic language. For anyone working in CS I suppose sticking with the established names will avoid confusion.
That makes sense, yeah. I think those terms make more sense outside of the world of programming languages and and their runtimes.

Adbot
ADBOT LOVES YOU

zootm
Aug 8, 2006

We used to be better friends.
Blogger can't do syntax highlighting out of the box but it would be relatively simple to include a reference to google-code-prettify or use GitHub's Gist embedding for code snippets.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply