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.
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.
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
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 >:((
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!Why does main have to return int, why can't it be a void?
int main(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.
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.
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.
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
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".
At 1/12/14 12:34 PM, Diki wrote:At 1/12/14 12:14 PM, egg82 wrote: stuffstuff that makes me sad
So I guess this is what my semester will be looking like...looks incredibly fun guys, can't wait.
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
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).
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
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.
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
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.
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
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.
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?
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
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".
At 1/13/14 02:34 PM, PSvils wrote: I don't understand though...if you're already using AIR......then why not use AIR for the auto-update as well?
Do you know how much sense that makes? Too much.
At 1/13/14 02:34 PM, PSvils wrote: I don't understand though...if you're already using AIR......then why not use AIR for the auto-update as well?
Because AIR is relatively slow and has its own problems.
I actually went back to that and ported the code over from the C# program to AIR yesterday and finished up some bugs today.
The problem i'm facing now is the application freezes quite a lot because accessing files in AIR is quite slow.
To counteract that, I used Workers (yay, multithreading)
except now I can't seem to get that to work.
public class Main extends Sprite {
//vars
private var worker:Worker;
private var fromWorker:MessageChannel;
//constructor
public function Main():void {
if (Worker.current.isPrimordial) {
//new StateEngine(this, new InitState());
worker = WorkerDomain.current.createWorker(this.loaderInfo.bytes, true);
fromWorker = worker.createMessageChannel(Worker.current);
worker.setSharedProperty("fromWorker", fromWorker);
fromWorker.addEventListener(Event.CHANNEL_MESSAGE, onWorkerChannelMessage);
worker.addEventListener(Event.WORKER_STATE, onWorkerState);
worker.start();
} else {
//do {
(Worker.current.getSharedProperty("fromWorker") as MessageChannel).send("here");
//} while (true);
}
}
//public
//private
private function onWorkerState(e:Event):void {
trace(worker.state);
}
private function onWorkerChannelMessage(e:Event):void {
var receive:String = fromWorker.receive();
trace("info");
trace(receive);
}
}
you would think that would work just fine (in fact, it was copied almost directly from an example on Workers) but for some ungodly reason nothing is being sent from the worker and i'm ripping my hair out trying to figure out why.
Apparently there's a bug in 11.7 that prevents messages from being sent through the MessageChannel class?
though i'm using AIR 3.8, it might be using 11.7 to run. Christ, I don't know. I'm about to just give up and say "download the damn files yourself"
Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P
At 1/13/14 03:25 PM, egg82 wrote: The problem i'm facing now is the application freezes quite a lot because accessing files in AIR is quite slow.
To counteract that, I used Workers (yay, multithreading)
except now I can't seem to get that to work.
http://jacksondunstan.com/. Start at nov 25. Might be useful, this is pretty much the only documentation of a few features since adobe hasn't updated their docs in forever (beta docs have few descriptions).
At 1/13/14 03:54 PM, MSGhero wrote: http://jacksondunstan.com/. Start at nov 25. Might be useful, this is pretty much the only documentation of a few features since adobe hasn't updated their docs in forever (beta docs have few descriptions).
Once again I basically copy/pasted the code and it still doesn't seem to work, even after upping to AIR 3.... 9?
Whatever, latest version.
I dunno, maybe it's FlashDevelop?
Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P
At 1/13/14 11:27 PM, egg82 wrote: I dunno, maybe it's FlashDevelop?
Probably not. If you copy adobe's example line for line without changing anything (no more "basically" copy pasting) and export to 11.4+ (excluding 11.7 maybe), it should work. If it doesn't, you broke it. If it does, try going to AIR and setting giveAppPrivileges to true.
And check Worker.isSupported.
At 1/13/14 11:59 PM, MSGhero wrote: Probably not. If you copy adobe's example line for line without changing anything (no more "basically" copy pasting) and export to 11.4+ (excluding 11.7 maybe), it should work. If it doesn't, you broke it. If it does, try going to AIR and setting giveAppPrivileges to true.
Created a new blank AS3 project, copy/pasted Adobe's examples and JacksonDunstan's examples to the letter, all 11.4-11.9
Still nothing.
And check Worker.isSupported.
Checked both Worker and WorkerDomain, both true
Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P
At 1/14/14 12:24 AM, egg82 wrote: Still nothing.
Now here's a puzzle:
Compiling in Release mode works just fine except that it crashes after closing
Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P
And a triple-post because I actually started doing research on this.
http://www.flashdevelop.org/community/viewtopic.php?f=6&t=10668
http://www.flashdevelop.org/community/viewtopic.php?f=13&t=9870
blah. That was almost the entirety of my day gone >:(
Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P