Be a Supporter!

The Flash 'Reg' Lounge

  • 2,188,634 Views
  • 64,672 Replies
New Topic Respond to this Topic
kkots
kkots
  • Member since: Apr. 16, 2013
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to The Flash 'Reg' Lounge 2014-01-10 13:20:05 Reply

At 1/10/14 12:29 PM, Diki wrote: Ahh, okay. I get what you're doing now. That actually makes things quite easy, since you can just use some esoteric punctuation as the delimiter instead of the comma.

That's exactly the idea. Although you interpreted it a bit wrong. I work with only 3 different kinds of arrays: the first kind may contain only numbers. The second kind may contain nulls, numbers and nested arrays. The third kind contains only strings. And all these arrays are written in a .AS file (in a plain text file) that I am parsing. The .AS file is actually working code which is supposed to be compiled by Flash, so I must not replace commas with grave accent.
In the file, I need to find the character from which every array starts, and find the character on which the array ends. Then I need to cut out space in between start and end (the array's brackets) and apply RegExp on it.
The array which contains strings will have

delimiter="\",\"";

And the text file will look like

array1=["Prepare to meet your ancestors!","What \"ancestors\" are you talking about, huh?","string3","etc"];
array2=[1,null,[1,2,3],7,null,null];

So I'll need to first find where array1 starts and ends, then cut out a piece of it and use RegExp on it

var start:uint=textFile.indexOf("[");
var end:uint=textFile.indexOf("]",start);
var piece:String=textFile.substring(start+2,end-1);
//piece will look something like
Prepare to meet your ancestors!","What \"ancestors\" are you talking about, huh?","string3","etc
//the delimiter is ","
var result:Array=piece.split("\",\"");

oops, I accidentally did it without using RegExp.

I could do that. It's been a couple years since I've written AS3, so I would need a quick refresher on the syntax, but I might end up writing another tutorial for that thread. Who knows?

Well, your code with tacos

trace("TACOS blah blah 42 woop FOO BAR ding dong".match(/[a-z0-9]+/g));

works in ActionScript 3 without any modifications.
But the tutorial would be more about explaining how RegExp works, what are its limitation, strong points, etc. To test it out in AS3 match and trace are good.

egg82
egg82
  • Member since: Jun. 24, 2006
  • Offline.
Forum Stats
Member
Level 05
Game Developer
Response to The Flash 'Reg' Lounge 2014-01-10 13:36:52 Reply

actually, now i'm having problems with regex. It doesn't make sense to me that this doesn't work, i'm not sure what i'm doing wrong :/

been using RegExr's replace method to parse out all the groups

regex: ^(?:.*?)(?:[\.|//]*)(.*?)$

list of crap:
../../../me/test/blah.txt
/../../../me/test/blah.txt
./../../../me/test/blah.txt
/./../../../me/test/blah.txt
../me/test/blah.txt
/../me/test/blah.txt
./../me/test/blah.txt
/./../me/test/blah.txt
/me/test/blah.txt
me/test/blah.txt
/./me/test/blah.txt
./me/test/blah.txt
=
t../../../me/test/blah.txt
t/../../../me/test/blah.txt
t./../../../me/test/blah.txt
t/./../../../me/test/blah.txt
t../me/test/blah.txt
t/../me/test/blah.txt
t./../me/test/blah.txt
t/./../me/test/blah.txt
t/me/test/blah.txt
tme/test/blah.txt
t/./me/test/blah.txt
t./me/test/blah.txt

in all cases, group[1] should be in the format:
me/test/blah.txt

basically i'm trying to strip out any ../ or ./ from the string


Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P

BBS Signature
Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to The Flash 'Reg' Lounge 2014-01-10 13:51:22 Reply

Because you're not escaping the period/elipse, which is part of the regular expression syntax:

"./../../../me/test/blah.txt".replace(/\.?\.\//g,"");
Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to The Flash 'Reg' Lounge 2014-01-10 13:58:35 Reply

At 1/10/14 01:20 PM, kkots wrote: var start:uint=textFile.indexOf("[");
var end:uint=textFile.indexOf("]",start);
var piece:String=textFile.substring(start+2,end-1);
//piece will look something like
Prepare to meet your ancestors!","What \"ancestors\" are you talking about, huh?","string3","etc
//the delimiter is ","
var result:Array=piece.split("\",\"");

Problem with that is if you use it on an array that contains an array your end position will return the index of the first ] bracket that it finds, which will be the closing bracket for the nested array, despite you using the opening bracket of the non-nested array (if that makes sense).

One way you could do it is to parse it in reverse (i.e. pull out the nested array first), which could be done by finding the index position of the last [ bracket, and the index position of the first ] bracket, which will be your nested array.

I'm also a little bit pre-occupied at the moment, so I can't really go into more depth than that, but I won't be busy in about 2 hours from now.

At 1/10/14 01:20 PM, kkots wrote: Well, your code with tacos

trace("TACOS blah blah 42 woop FOO BAR ding dong".match(/[a-z0-9]+/g));

works in ActionScript 3 without any modifications.

That's because I JavaScript and ActionScript are both dialects of , so it's common for code to be interchangeable between the languages. I also like to give practical examples of AS3 features, so that's what I would need to brush up on AS3 syntax for.

egg82
egg82
  • Member since: Jun. 24, 2006
  • Offline.
Forum Stats
Member
Level 05
Game Developer
Response to The Flash 'Reg' Lounge 2014-01-10 13:59:29 Reply

At 1/10/14 01:51 PM, Diki wrote: Because you're not escaping the period/elipse, which is part of the regular expression syntax:

I thought I was?

^(?:.*?) - should match whatever's at the beginning of the string that's not a . or / literal
(?:[\.|//]*) - should match all . or / literals
(.*?)$ - should match everything else at the end of the string, which is what I want

yours seems to work fine, thanks, I'm just not quite sure what I did wrong.


Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P

BBS Signature
Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to The Flash 'Reg' Lounge 2014-01-10 14:08:07 Reply

At 1/10/14 01:59 PM, egg82 wrote: I thought I was?

You were, I'm just a meat-head and can't read. :)

Anyway the actual reason it wasn't working is because of the end anchor that you included. If you remove it your regex works just fine. Off the top of my head I can't see precisely why the end anchor is making that happen, but once I'm not busy I can look into it. It's probably something quite simple.

kkots
kkots
  • Member since: Apr. 16, 2013
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to The Flash 'Reg' Lounge 2014-01-10 15:02:25 Reply

At 1/10/14 02:08 PM, Diki wrote: Anyway the actual reason it wasn't working is because of the end anchor that you included.

Maybe http://www.regular-expressions.info/anchors.html
It says some languages have ^ and $ refer to start and end of the string.
And it also mentions some multiline mode which needs to be turned on using \m
Just blindly poking at things

TheNavigat
TheNavigat
  • Member since: Mar. 2, 2013
  • Offline.
Forum Stats
Member
Level 04
Programmer
Response to The Flash 'Reg' Lounge 2014-01-11 10:35:39 Reply

Not done yet, apparently, but here.

The Flash 'Reg' Lounge


Nav.. I'm the Nav!

Sam
Sam
  • Member since: Oct. 1, 2005
  • Offline.
Forum Stats
Moderator
Level 19
Programmer
Response to The Flash 'Reg' Lounge 2014-01-11 11:30:27 Reply

At 1/11/14 10:35 AM, TheNavigat wrote: Not done yet, apparently, but here.

Looking very nice.

ACCOUNT DELETION.
Does anybody else think there should be a law in place that means websites have to have an account deletion button in a clear place that actually deletes the account? I've had "deactivated" accounts, and the website emails me out of the blue. Really bothers me.

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to The Flash 'Reg' Lounge 2014-01-11 13:00:04 Reply

At 1/11/14 11:30 AM, Sam wrote: ACCOUNT DELETION.
Does anybody else think there should be a law in place that means websites have to have an account deletion button in a clear place that actually deletes the account? I've had "deactivated" accounts, and the website emails me out of the blue. Really bothers me.

If you meant that to be taken literally: god, no. Not only would it be a complete waste of resources (e.g. tax payer money) to prosecute offenders, it would also set an absurd president.

However if you only meant that as hyperbole then I agree. I would love to be able to delete the Google+ account that Google decided I should have, but I can't.

egg82
egg82
  • Member since: Jun. 24, 2006
  • Offline.
Forum Stats
Member
Level 05
Game Developer
Response to The Flash 'Reg' Lounge 2014-01-12 01:29:52 Reply

several hours of headaches and errors later, I got my C code to compile!

#include <stdio.h>
#include <stdbool.h>
#include "fileDownloader.h"

int main(void) {
    do {
	puts("blargh");
    } while (true);
    
    return 0;
}

can I just say: "Fuck C"?


Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P

BBS Signature
kkots
kkots
  • Member since: Apr. 16, 2013
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to The Flash 'Reg' Lounge 2014-01-12 03:56:20 Reply

At 1/12/14 01:29 AM, egg82 wrote: several hours of headaches and errors later, I got my C code to compile!
int main(void) {

Why does main have to return int, why can't it be a void?
Does it even matter what it returns?
What a dumb language >:((

slugrail
slugrail
  • Member since: Sep. 1, 2013
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to The Flash 'Reg' Lounge 2014-01-12 04:30:58 Reply

At 1/12/14 01:29 AM, egg82 wrote: several hours of headaches and errors later, I got my C code to compile!

#include <stdio.h>
#include <stdbool.h>
#include "fileDownloader.h"

int main(void) {
do {
puts("blargh");
} while (true);

return 0;
}

can I just say: "Fuck C"?

LOL you haven't even scrapped the surface of the bizarre things you can do and write!

At 1/12/14 03:56 AM, kkots wrote:
At 1/12/14 01:29 AM, egg82 wrote: several hours of headaches and errors later, I got my C code to compile!
int main(void) {
Why does main have to return int, why can't it be a void?
Does it even matter what it returns?
What a dumb language >:((

Because UNIX, return code and 0 and this 'dumb' language is the forefather of runtimes like Java and Flash so no, it is not a dumb language unless you'd rather be writing in assembly.

PSvils
PSvils
  • Member since: Feb. 3, 2010
  • Offline.
Forum Stats
Member
Level 01
Game Developer
Response to The Flash 'Reg' Lounge 2014-01-12 04:54:40 Reply

At 1/12/14 01:29 AM, egg82 wrote: #include <stdio.h>
#include <stdbool.h>
#include "fileDownloader.h"

int main(void) {
do {
puts("blargh");
} while (true);

return 0;
}

I don't understand what's bizarre or weird or hard about getting that code to run...?

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to The Flash 'Reg' Lounge 2014-01-12 07:55:52 Reply

At 1/12/14 03:56 AM, kkots wrote: Why does main have to return int, why can't it be a void?
Does it even matter what it returns?

Because the return value of the main function determines if the application was successful. In other words, if main() does not return 0 that means that an error occurred.

At 1/12/14 03:56 AM, kkots wrote: What a dumb language >:((

C is one of the most well-designed languages around. It is not dumb.

At 1/12/14 04:54 AM, PSvils wrote: I don't understand what's bizarre or weird or hard about getting that code to run...?

I'm with you on that one.

And if you're learning C and having difficulty why don't you post over in the programming forum? I know both C and C++, so I can help you out if you're struggling.

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to The Flash 'Reg' Lounge 2014-01-12 08:25:27 Reply

And hell if you want a real C-induced headache you can try to remove the memory leaks from this basic linked list that I whipped up:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct Node {
    struct Node* next;
    struct Node* prev;
    struct Node* data;
};

typedef struct Node Node;
typedef struct Node* PNode;

typedef struct {
    PNode head;
    PNode tail;
} List, *PList;

PList list_init() {
    PList result = malloc(sizeof(List));
    memset(result, 0, sizeof(List));

    return result;
}

PNode node_init(void* data, size_t size) {
    PNode result = malloc(sizeof(Node));
    memset(result, 0, sizeof(Node));

    result->data = malloc(size);
    memcpy(result->data, data, size);

    return result;
}

void list_push_front(PList list, void* data, size_t size) {
    if (list->head == NULL) {
        list->head = node_init(data, size);
        list->tail = list->head;
    } else {
        list->head->prev = node_init(data, size);
        list->head->prev->next = list->head;
        list->head = list->head->prev;
    }
}

void list_push_back(PList list, void* data, size_t size) {
    if (list->head == NULL) {
        list->head = node_init(data, size);
        list->tail = list->head;
    } else {
        list->tail->next = node_init(data, size);
        list->tail->next->prev = list->tail;
        list->tail = list->tail->next;
    }
}

int main(int argc, char** argv) {
    PList list = list_init();
    int data;

    data = 1;
    list_push_back(list, &data, sizeof(data));

    data = 2;
    list_push_back(list, &data, sizeof(data));

    data = 3;
    list_push_front(list, &data, sizeof(data));

    data = 4;
    list_push_front(list, &data, sizeof(data));

    for (PNode ptr = list->head; ptr; ptr = ptr->next) {
        printf("%d\n", *ptr->data);
    }

    return 0;
}

To prove it does in fact work here's it running on Codepad. Had to change the for loop slightly, though, because Codepad doesn't use the C99 standard.

egg82
egg82
  • Member since: Jun. 24, 2006
  • Offline.
Forum Stats
Member
Level 05
Game Developer
Response to The Flash 'Reg' Lounge 2014-01-12 12:14:25 Reply

At 1/12/14 07:55 AM, Diki wrote:
At 1/12/14 04:54 AM, PSvils wrote: I don't understand what's bizarre or weird or hard about getting that code to run...?
I'm with you on that one.

Because filedownloader.h/c uses libcurl and I had external library folders and such because linkage, then found out the dlls don't copy and it was all a nightmare.

And if you're learning C and having difficulty why don't you post over in the programming forum? I know both C and C++, so I can help you out if you're struggling.

Not learning, per-se, but refreshing my memory by creating a distributable, cross-platform package that scans a directory, hashes all files in that directory, then checks those hashes against sources online and downloads mismatches. It's very slightly more complicated than that, but overall it's a pretty simple program that should, in theory, run cross-platform. I just have zero idea how to compile for anything but Windows yet.


Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P

BBS Signature
Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to The Flash 'Reg' Lounge 2014-01-12 12:34:13 Reply

At 1/12/14 12:14 PM, egg82 wrote: Because filedownloader.h/c uses libcurl and I had external library folders and such because linkage, then found out the dlls don't copy and it was all a nightmare.

Ahhh, okay. I thought you just meant the little loop in your main() was the trouble. Linking LIBs and/or DLLs can be a pain in the ass, yes.

At 1/12/14 12:14 PM, egg82 wrote: Not learning, per-se, but refreshing my memory by creating a distributable, cross-platform package that scans a directory, hashes all files in that directory, then checks those hashes against sources online and downloads mismatches. It's very slightly more complicated than that, but overall it's a pretty simple program that should, in theory, run cross-platform.

Any particular reason you chose to do in C? Doing that in C++ would be a lot easier because you could use the std::string class. Not that there is anything wrong with doing it in C.

But so long as you're not using any vendor-specific features it will be cross-platform. Given that it's C, and written for a CLI, I would be surprised if you were.

At 1/12/14 12:14 PM, egg82 wrote: I just have zero idea how to compile for anything but Windows yet.

GCC is pretty easy to use, and you can get it running on Windows with MinGW. For example, if you wanted to compile my linked list code with GCC you would just need to do this:

gcc main.c -o main -std=c99

Which can be plopped into command prompt.

And if you were to use C++ you just need to use G++ instead (and not the C standard, of course).

P.S.
Not to go all grammar-Nazi on you but "per se" isn't a compound word, and the way you used it doesn't make sense. It means "in and of itself" not "that is to say".

MSGhero
MSGhero
  • Member since: Dec. 15, 2010
  • Offline.
Forum Stats
Supporter
Level 16
Game Developer
Response to The Flash 'Reg' Lounge 2014-01-12 12:55:00 Reply

At 1/12/14 12:34 PM, Diki wrote:
At 1/12/14 12:14 PM, egg82 wrote: stuff
stuff that makes me sad

So I guess this is what my semester will be looking like...looks incredibly fun guys, can't wait.

egg82
egg82
  • Member since: Jun. 24, 2006
  • Offline.
Forum Stats
Member
Level 05
Game Developer
Response to The Flash 'Reg' Lounge 2014-01-12 13:09:48 Reply

At 1/12/14 12:34 PM, Diki wrote: Ahhh, okay. I thought you just meant the little loop in your main() was the trouble. Linking LIBs and/or DLLs can be a pain in the ass, yes.

I'm spoiled by NuGet :P

At 1/12/14 12:14 PM, egg82 wrote:
Any particular reason you chose to do in C? Doing that in C++ would be a lot easier because you could use the std::string class. Not that there is anything wrong with doing it in C.

Mostly because I figured C++ probably didn't run on quite as many OSes as C, unless I'm wrong and I'm just breaking my head open against C for nothing. Quite possible.

GCC is pretty easy to use, and you can get it running on Windows with MinGW. For example, if you wanted to compile my linked list code with GCC you would just need to do this:

Yeah, i'm using MinGW to compile for debugging and such, I just don't know how to compile for Mac or Linux or even if I do. What I want to be able to do is use another program to call this program automagically on any OS

P.S.
Not to go all grammar-Nazi on you but "per se" isn't a compound word, and the way you used it doesn't make sense. It means "in and of itself" not "that is to say".

That is something I did not know. Could have sworn it was compound xD


Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P

BBS Signature
Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to The Flash 'Reg' Lounge 2014-01-12 13:34:09 Reply

At 1/12/14 01:09 PM, egg82 wrote: Mostly because I figured C++ probably didn't run on quite as many OSes as C, unless I'm wrong and I'm just breaking my head open against C for nothing. Quite possible.

C++ doesn't "run" on anything. It has to be compiled into an executable, and G++ can do that for any operating system that you can name. If memory serves me right G++ is available on most Linux distros out of the box, but even if it's not installing G++ isn't hard. I wouldn't be surprised if it's also available on OSX out of the box as well.

So, yeah, you have been making things harder for yourself for no reason. You can also use the C++11 standard to make things even easier.

At 1/12/14 01:09 PM, egg82 wrote: Yeah, i'm using MinGW to compile for debugging and such, I just don't know how to compile for Mac or Linux or even if I do. What I want to be able to do is use another program to call this program automagically on any OS

If you've been compiling your code with GCC via MinGW then you know how to compile on Linux and OSX. There isn't any difference between how you do it with MinGW and how you would do it on an operating system that natively supports GCC and G++.

At 1/12/14 01:09 PM, egg82 wrote: That is something I did not know. Could have sworn it was compound xD

Nah, it's a Latin expression, and Latin doesn't have any concept of compound words (at least not in the way English has compound words).

egg82
egg82
  • Member since: Jun. 24, 2006
  • Offline.
Forum Stats
Member
Level 05
Game Developer
Response to The Flash 'Reg' Lounge 2014-01-12 14:18:04 Reply

At 1/12/14 01:34 PM, Diki wrote: C++ doesn't "run" on anything. It has to be compiled into an executable, and G++ can do that for any operating system that you can name. If memory serves me right G++ is available on most Linux distros out of the box, but even if it's not installing G++ isn't hard. I wouldn't be surprised if it's also available on OSX out of the box as well.

So, yeah, you have been making things harder for yourself for no reason. You can also use the C++11 standard to make things even easier.

And I can use Boost, as well, which is basically like having NuGet.
Also, yeah, compiled languages and such :P

If you've been compiling your code with GCC via MinGW then you know how to compile on Linux and OSX. There isn't any difference between how you do it with MinGW and how you would do it on an operating system that natively supports GCC and G++.

Wouldn't the application need to compile on the target box? I mean, I can't just compile with g++ on MinGW on my Windows machine and expect it to double-click-and-run just fine on Mac or Linux. At least I'm pretty damn sure that's not how it works.

So, yeah. I'm a bit confused.


Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P

BBS Signature
Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to The Flash 'Reg' Lounge 2014-01-12 14:24:36 Reply

At 1/12/14 02:18 PM, egg82 wrote: Wouldn't the application need to compile on the target box?

Yes. You would need to do that if you were using C as well.

At 1/12/14 02:18 PM, egg82 wrote: I mean, I can't just compile with g++ on MinGW on my Windows machine and expect it to double-click-and-run just fine on Mac or Linux. At least I'm pretty damn sure that's not how it works.

I just meant the GCC/G++ syntax is identical. Using my linked list code as an example again, if you wanted to compile it on Windows via MinGW, Linux, or OSX the command will always be the exact same:

gcc main.c -o main -std=c99

The only thing that will be different is the file extension of the output file.

egg82
egg82
  • Member since: Jun. 24, 2006
  • Offline.
Forum Stats
Member
Level 05
Game Developer
Response to The Flash 'Reg' Lounge 2014-01-12 14:27:52 Reply

At 1/12/14 02:24 PM, Diki wrote:
At 1/12/14 02:18 PM, egg82 wrote: Wouldn't the application need to compile on the target box?
Yes. You would need to do that if you were using C as well.

Yeah, I'm just trying to figure out how I would make those whole thing a single double-click process for the end-user.

I just meant the GCC/G++ syntax is identical. Using my linked list code as an example again, if you wanted to compile it on Windows via MinGW, Linux, or OSX the command will always be the exact same:

gcc main.c -o main -std=c99

The only thing that will be different is the file extension of the output file.

ah, awesome. So, if I wanted to compile my code for Win, Mac, and Linux on my current Win system without switching OSes and compiling on the different systems, what would I do? I'm sure there's a way. Maybe.


Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P

BBS Signature
Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to The Flash 'Reg' Lounge 2014-01-12 16:15:11 Reply

At 1/12/14 02:27 PM, egg82 wrote: ah, awesome. So, if I wanted to compile my code for Win, Mac, and Linux on my current Win system without switching OSes and compiling on the different systems, what would I do? I'm sure there's a way. Maybe.

There isn't. The closest that you could get would be to run a virtual machine on your Windows computer, and use that to run Linux and/or OSX, and compile from there.

If you want to have a one-compile-and-go type application then you will need to use an application that itself runs on a virtual machine. The only language I know of that is in wide-spread use that can do that is Java, but that will require the user to have Java installed, and not everyone does (I don't, for example, because it's a huge security risk).

Another solution would be to instead use a high-level language such as Python or Ruby, as they won't require any compilation, so you could just use a batch script of sorts to run the application.

You might be able to compile the application once and have it run on both Linux and OSX, but no way in hell will that work for Windows as well. Microsoft doesn't like open-source technologies, or using anything that they didn't make, which is why they have their own C/C++ compiler (and it sucks).

Building/running code on Unix-based operating systems (e.g. Linux and OSX) is easy-peasy, so you could just let the end-user do that their self, and only compile the Windows versions for Windows users.

Long story short: there's no quick and easy way to get your thing to work on Windows, Linux and OSX together if you're using C/C++. They are just too low-level of languages, so it comes with the territory.

egg82
egg82
  • Member since: Jun. 24, 2006
  • Offline.
Forum Stats
Member
Level 05
Game Developer
Response to The Flash 'Reg' Lounge 2014-01-12 16:48:16 Reply

At 1/12/14 04:15 PM, Diki wrote: The closest that you could get would be to run a virtual machine on your Windows computer, and use that to run Linux and/or OSX, and compile from there.

And if I happen to run an Ubuntu VM and compiled the source on that as well, I assume I would get a Windows and Linux binary that I could then call from the launcher (depending on the OS, which is simple enough to check)?


Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P

BBS Signature
Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to The Flash 'Reg' Lounge 2014-01-12 16:58:44 Reply

By the way, egg, I talked to some other people and figured out why your regex wasn't working before. Just like I said it was something very simple. When you were doing:

^(?:.*?)(?:[\.|//]*)(.*?)$

The $ anchor was forcing (.*?) to match everything after the ./ and ../ parts. (.*?) is non-greedy, which means it will match as few characters as possible (including matching zero characters). But since you included the $ anchor (.*?) has no choice but to match everything up to the end of the string.

And in retrospect I don't know why I didn't figure that out on my own. Chalk it up to a brain fart.

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to The Flash 'Reg' Lounge 2014-01-12 17:03:01 Reply

At 1/12/14 04:48 PM, egg82 wrote: And if I happen to run an Ubuntu VM and compiled the source on that as well, I assume I would get a Windows and Linux binary that I could then call from the launcher (depending on the OS, which is simple enough to check)?

I don't understand what you're asking. I was following you up to "could then call from the launcher". To which launcher are you referring?

egg82
egg82
  • Member since: Jun. 24, 2006
  • Offline.
Forum Stats
Member
Level 05
Game Developer
Response to The Flash 'Reg' Lounge 2014-01-12 17:16:59 Reply

At 1/12/14 05:03 PM, Diki wrote: I don't understand what you're asking. I was following you up to "could then call from the launcher". To which launcher are you referring?

oh, yeah, sorry. Game launcher that auto-updates. This C++ program is the auto-update bit, where it scans a given directory, hashes the files in that directory, and checks an online source to grab any missing or updated files.

The launcher (AIR program, pretty much finished) calls this program. I already created this C++ program in C# but didn't want to rely on Linux users having Mono so i'm porting it.

At 1/12/14 04:58 PM, Diki wrote: The $ anchor was forcing (.*?) to match everything after the ./ and ../ parts. (.*?) is non-greedy, which means it will match as few characters as possible (including matching zero characters). But since you included the $ anchor (.*?) has no choice but to match everything up to the end of the string.

but shouldn't it have not matched everything before that because of the previous two groups?


Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P

BBS Signature
Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to The Flash 'Reg' Lounge 2014-01-12 17:56:07 Reply

At 1/12/14 05:16 PM, egg82 wrote: oh, yeah, sorry. Game launcher that auto-updates. This C++ program is the auto-update bit, where it scans a given directory, hashes the files in that directory, and checks an online source to grab any missing or updated files.

The launcher (AIR program, pretty much finished) calls this program. I already created this C++ program in C# but didn't want to rely on Linux users having Mono so i'm porting it.

That would work then. However, sounds like using a high-level language would be the better route. You wouldn't need to worry about compiling anything or changing any code.

At 1/12/14 05:16 PM, egg82 wrote: but shouldn't it have not matched everything before that because of the previous two groups?

Without the $ anchor, yes. Because you included it this is what happens:

- From the start of the string match any characters an unlimited number of times, as few times as possible, up to an ellipse or a forward slash.
- After the ellipses and forward slashes match any characters an unlimited number of times, as few times as possible, up to the end of the string.

The key part being "up to the end of the string".