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
N.Z.'s Champion
Jun 8, 2003

Yam Slacker
This is a bit of a weird question but what programming languages use :: (double colon) as part of their syntax and for what? Info on any language would be appreciated, particularly if the syntax has different uses. :)

(I've tried searching google but then google doesn't like non-alphanumeric searches)


The only ones I know are C++ and PHP,
C++ seems to use it for member functions and scope resolution. I don't understand how the compiler knows the difference -- how is that?
PHP uses it for public static functions

Are member functions the same as public static functions?

Update (the following day) sorry, I can't post an explanation yet but I will soon. I know this sounds weird but there's a good reason. I'll post in this thread with an update later (I suppose if you want to be notified send me a PM or an email on what-the-hell-is-the-double-colon-about@holloway.co.nz )

N.Z.'s Champion fucked around with this message at 00:17 on Mar 5, 2008

Adbot
ADBOT LOVES YOU

N.Z.'s Champion
Jun 8, 2003

Yam Slacker

ShoulderDaemon posted:

And you have got to explain why you're asking this question.

:siren: I can now reveal that :siren:

N.Z.'s Champion posted:

This is a bit of a weird question but what programming languages use :: (double colon) as part of their syntax and for what?

This was about Microsoft's push for OOXML approval at the ISO and a particularly dumb part of the specification that required implementors to implement Microsoft OLE2 with particular method calls that contained :: (double colon) within them.

Within the specification there's Part 4: 3.18.49 ST_OleUpdate (OLE Update Types) which is used by Part 4: 3.3.1.59 oleObject (Embedded Object). This part of OOXML remains as it was in ECMA-376 so you can read the description here on OpenISO.org. It requires implementors to call "IOleObject::Update" or "IOleLink::Update" as method calls (which are the MS Windows OLE method calls) which effectively limits the implementation programming language as :: (double colon) means different things in different languages and may be unusable in some.

This made it into a report I wrote for Standards NZ on OOXML so thanks for your help everyone (especially ShoulderDaemon, tef and 6174 :) )

(Oh and psssst goons... it's me. I'm da Matthew Holloway in the op)

N.Z.'s Champion fucked around with this message at 23:03 on Mar 25, 2008

N.Z.'s Champion
Jun 8, 2003

Yam Slacker
This is probably a stupid question but lets say that I've got variables A and B... is there a way to swap their values without using a third variable (Eg, C = A, A = B, B = C) and without meddling with pointers?

I guess I was just wondering whether there's some syntax for this that I was unaware of, perhaps in a single expression.

(in Python, PHP, whatever)

N.Z.'s Champion
Jun 8, 2003

Yam Slacker

Ugg boots posted:

is this a loving joke?

fake edit: this has to be a loving joke.

Nope, serious, and I'm sure it's a stupid question (I'm pretty tired). Is there a way of doing it in a single expression?

N.Z.'s Champion
Jun 8, 2003

Yam Slacker

Avenging Dentist posted:

Dude, someone showed how to do it like 5 posts up.

gently caress, sorry folks :(

So unpacking tuples works in Python, but can this be done in PHP?

N.Z.'s Champion
Jun 8, 2003

Yam Slacker

Scaevolus posted:

Do you guys go to the same school?

Heh, I was just looking at a min/max check where the user was giving the values in the wrong order and so I wanted to swap them if A > B. It's a coincidence and I wasn't following this thread. Sorry everyone for the derail. I'm a loving idiot.

N.Z.'s Champion fucked around with this message at 23:28 on Aug 25, 2008

N.Z.'s Champion
Jun 8, 2003

Yam Slacker

Ugg boots posted:

Also, why is everyone afraid of these mysterious "temporary variables"?

I guess it just sounds like an easy optimisation that could result in shorter/clearer code. Is it not?

N.Z.'s Champion
Jun 8, 2003

Yam Slacker
I'm not a clever illegible hacks kind of programmer, and I'm already well convinced about the value of readable code.

The Python unpacking technique seems to be better in almost all ways though. That's the kind of thing I was after, thanks :)

N.Z.'s Champion fucked around with this message at 00:49 on Aug 26, 2008

N.Z.'s Champion
Jun 8, 2003

Yam Slacker
This is probably a moronic question but there's someone I know who wants to migrate a REALBASIC project to something more modern (because they're having problems finding developers, libraries, community). Rather than starting from scratch I guess they should modularise their code as a library, perhaps exposing interfaces in COM or .Net?

It's just that I can't find any way out of realbasic, or any way to compile to something else. I'm hesitant to recommend a rewrite but what would you suggest?

N.Z.'s Champion
Jun 8, 2003

Yam Slacker
I've got a database like this,
code:
id | date | amount | calculated_balance
1  | 2006 | 4      | 4
2  | 2006 | 4      | 8
3  | 2007 | 5      | 13
4  | 2008 | 10     | 23
5  | 2009 | -4     | 19
6  | 2010 | 7      | 26
But if I change the initial balance to 10 (which is stored in another table) then I'd like to recalculate it,
code:
id | date | amount | calculated_balance
1  | 2006 | 4      | 14
2  | 2006 | 4      | 18
3  | 2007 | 5      | 23
4  | 2008 | 10     | 33
5  | 2009 | -4     | 29
6  | 2010 | 7      | 36
So short of going through each row and manually totaling it with sum() is there a better way? Is there a way to sum it upon select? The database is MySQL.

(this is just a personal spending tracker, it's not an important app, so hacks are welcome)

N.Z.'s Champion
Jun 8, 2003

Yam Slacker

Psychorider posted:

Should have posted in the SQL thread but here's your answer anyway:
Whoops, and thanks - that looks like a good approach :)

N.Z.'s Champion
Jun 8, 2003

Yam Slacker
Is there a library that will let me read a PDF or SVG and let me know the X/Y/width/height coordinates of everything in it? E.g. something that will resolve nested transformation matrices, font sizes and kerning and other font metrics, or any other layout aspects of the format.

I guess I'm looking for a PDF renderer with an API where I can query where it's putting things on the page. Does such a thing exist?

N.Z.'s Champion fucked around with this message at 02:46 on Dec 1, 2010

Adbot
ADBOT LOVES YOU

N.Z.'s Champion
Jun 8, 2003

Yam Slacker

Nahrix posted:

The problem I'm having is that the actual information is brought up with a javascript.ModalPopupOpen function, and I have no idea how to page scrape that data.
It looks like the modal dialog just embeds a iframe at this url with a sequential user id so you could iterate through that and bypass the javascript. I'm a little uneasy about scraping people's details like that (privacy laws being what they are) but I guess if it's online a search engine could index it anyway... ah well.

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