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
Mustach
Mar 2, 2003

In this long line, there's been some real strange genes. You've got 'em all, with some extras thrown in.
If you choose make, don't use recursive make. Everybody (including autoconf) does it, but it sucks in almost every way. Incomplete dependency graphs, slower builds, etc. The only benefit is that you don't have to type "pushd $project_root" before typing "make".

mr_jim posted:

Either way, it's worth it to avoid using Makefiles.
Seriously. "B-b-b-b-b-b-but make comes with everyone's systems!" needs to go away. Oh no, I have to install a tool to build something, my life's over.

Adbot
ADBOT LOVES YOU

Scaevolus
Apr 16, 2007

Dijkstracula posted:

Scons looks neat; the next time I start a larger project I'll think about using it. If it handles building shared libraries sensibly in a platform-independent way, I'll be thrilled.

Depending on your definition of "larger", Scons may be a bad idea.

Mustach
Mar 2, 2003

In this long line, there's been some real strange genes. You've got 'em all, with some extras thrown in.
Well, that's pretty gross. It would have been nice if he posted his SConstruct and compared the overhead with make's, though.

mr_jim
Oct 30, 2006

OUT OF THE DARK

I'm wondering if his shell script scanned the input files for file dependencies, or if that information was hard-coded. That would explain at least some of the difference.

Edit: Looking at the mailing list, it looks like all the "overhead" is in building and using a dependency graph. It's not surprising that a shell script would be faster when doing an initial build. Scons might have a bit of an edge for partial builds.

mr_jim fucked around with this message at 03:37 on May 11, 2010

An Outland Dish
Jul 26, 2009

by Tiny Fistpump
Nevermind, I'm an idiot newbie that doesn't know how to read.

An Outland Dish fucked around with this message at 06:03 on May 12, 2010

LLJKSiLk
Jul 7, 2005

by Athanatos
Okay, I've got invalid characters cropping up in some programs which causes some of them to crash when processing data.

I've got two examples of the same data, one created in notepad, the other in notepad++. The notepad one is the one that looks screwed up with the invalid character on the end. Both of them have it - the notepad++ just handles it correctly.

http://www.yourfilelink.com/get.php?fid=545372 (notepad)
http://www.yourfilelink.com/get.php?fid=545373 (notepad++)

Is there some way to process this file prior to kicking off my batch program to remove the invalid character? It happens at least once per 1250 records that come in where someone fucks up a street address.

litghost
May 26, 2004
Builder

SiLk-2k5 posted:

Okay, I've got invalid characters cropping up in some programs which causes some of them to crash when processing data.

I've got two examples of the same data, one created in notepad, the other in notepad++. The notepad one is the one that looks screwed up with the invalid character on the end. Both of them have it - the notepad++ just handles it correctly.

http://www.yourfilelink.com/get.php?fid=545372 (notepad)
http://www.yourfilelink.com/get.php?fid=545373 (notepad++)

Is there some way to process this file prior to kicking off my batch program to remove the invalid character? It happens at least once per 1250 records that come in where someone fucks up a street address.

The problem is line endings. More specifically, np[invalid].txt has only LF (ie UNIX style), while np++[invalid].txt has CR-LF (ie Windows style). You can see this by showing all symbols in NP++ View->Show Symbol->Show all characters.

At least that is the only difference I see.

LLJKSiLk
Jul 7, 2005

by Athanatos
I took a look at this. What is happening is that when reading in the data it is throwing a line feed and loving up the file output. Any good way (C++/etc.?) to read in a string and replace the LF character?

Flamadiddle
May 9, 2004

You should be able to knock up a script in any language fairly quickly to replace Char(13)(?) with nothing....

tef
May 30, 2004

-> some l-system crap ->

SiLk-2k5 posted:

I took a look at this. What is happening is that when reading in the data it is throwing a line feed and loving up the file output. Any good way (C++/etc.?) to read in a string and replace the LF character?

dos2unix

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Based on the previous discussions on make environment I decided to go with scons since I'm planning to embed Python in my project anyways, so I might as well use it to build everything too. I think I still have some organizational issues for how to lay out source in a project and then put together the build environment for it.

Let's say I have some subdirectories under my project's master source directory: sources/X, sources/Y, sources/Z. The division was organizational, although some of the code refers to code in other folders. As I am hacking around I want to be build small test programs from pieces of each, and then there's the big final program that chews everything up together.

How should I approach this? I assume I would have build files in each subdirectory; then I replicate a lot of header and library paths. Is there a way with scons to include some basic project settings in one spot? Now let's say everything I really need to build X, Y, Z is all sorted out in their build files through whatever mechanism. How should the master project refer to them? Should I just invoke the build tool on each subdirectory's build file in turn?

Consider for a moment that there's a technical problem here for sure, but I am wondering if I am even approaching this in a good, elegant manner. It's possible I could start throwing a lot of source files and directories at this, so I wanted to get the organization of the build environment correct before it becomes a huge mess.

Edit: For those that haven't played with scons... if you know Python it's pretty easy to bullshit it to build stuff. Of course that can be a bad thing . . .

Rocko Bonaparte fucked around with this message at 04:19 on May 13, 2010

mr_jim
Oct 30, 2006

OUT OF THE DARK

Rocko Bonaparte posted:

Based on the previous discussions on make environment I decided to go with scons since I'm planning to embed Python in my project anyways, so I might as well use it to build everything too. I think I still have some organizational issues for how to lay out source in a project and then put together the build environment for it.

Let's say I have some subdirectories under my project's master source directory: sources/X, sources/Y, sources/Z. The division was organizational, although some of the code refers to code in other folders. As I am hacking around I want to be build small test programs from pieces of each, and then there's the big final program that chews everything up together.

How should I approach this? I assume I would have build files in each subdirectory; then I replicate a lot of header and library paths. Is there a way with scons to include some basic project settings in one spot? Now let's say everything I really need to build X, Y, Z is all sorted out in their build files through whatever mechanism. How should the master project refer to them? Should I just invoke the build tool on each subdirectory's build file in turn?

Consider for a moment that there's a technical problem here for sure, but I am wondering if I am even approaching this in a good, elegant manner. It's possible I could start throwing a lot of source files and directories at this, so I wanted to get the organization of the build environment correct before it becomes a huge mess.

Edit: For those that haven't played with scons... if you know Python it's pretty easy to bullshit it to build stuff. Of course that can be a bad thing . . .


Check the chapter on Hierarchical Builds in the Scons user manual. Basically, you'll have one SConstruct file in the project's root directory, and then a SConscript file in each subdirectory. The SConstruct file will call each of the SConscript files, which will do the actual building in each subdirectory. As for sharing environment settings, there's a section on that as well.

CapnAndy
Feb 27, 2004

Some teeth long for ripping, gleaming wet from black dog gums. So you keep your eyes closed at the end. You don't want to see such a mouth up close. before the bite, before its oblivion in the goring of your soft parts, the speckled lips will curl back in a whinny of excitement. You just know it.
I'm using C# .NET, and I'm just curious -- is there any way to set up a function where the variables being passed in are optional without setting up a bunch of overloads? Writing out function(), function(a), function(b), function(a,b) isn't bad, but if I've got like five variables that's, what, two dozen overloads to let users pass in whatever combination they want? I don't wanna do that, it's a pain in the rear end.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
C# 4.0 adds optional and named arguments for exactly that reason.

Mr.Hotkeys
Dec 27, 2008

you're just thinking too much

CapnAndy posted:

I'm using C# .NET, and I'm just curious -- is there any way to set up a function where the variables being passed in are optional without setting up a bunch of overloads? Writing out function(), function(a), function(b), function(a,b) isn't bad, but if I've got like five variables that's, what, two dozen overloads to let users pass in whatever combination they want? I don't wanna do that, it's a pain in the rear end.
You can do stuff like this:

public void SomeFunc(int a, bool y = false, string n = "")

a would need to be passed no matter what, but y and n could be ignored and these default values would be used. You could also pass them all. However, you cannot skip over y and pass something for n, you have to pass something for every parameter leading up to the one you want to pass for unless you use a named parameter, whereby in passing the value you prefix the value with the name of the variable in the function to which you are attempting to pass the value. Oh, and you can't have an optional parameter come before a required one.

The following calls would be okay:
SomeFunc(1);
SomeFunc(1, true);
SomeFunc(1, true, "string");
SomeFunc(1, n: "string");


http://weblogs.asp.net/podwysocki/archive/2008/10/28/named-and-optional-arguments-in-c-4-0.aspx

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh
I wonder how they handle overload resolution for that (I wonder because I want to do the same thing in my babby language).

Mr.Hotkeys
Dec 27, 2008

you're just thinking too much

Avenging Dentist posted:

I wonder how they handle overload resolution for that (I wonder because I want to do the same thing in my babby language).

Say we have three method declarations:

void SomeFunc(int a) {}
void SomeFunc(int a, int b =4) {}
void SomeFunc(int a, int b = 4, int c = 10) {}


Calling SomeFunc(5) will call the first because the compiler goes for whichever one the given parameter list fits that doesn't have optional parameters.

MSDN posted:

If two candidates are judged to be equally good, preference goes to a candidate that does not have optional parameters for which arguments were omitted in the call. This is a consequence of a general preference in overload resolution for candidates that have fewer parameters.
If we call SomeFunc(5, 10) it'll go for the second.

Now, if there is not definition for void SomeFunc(int a) and just the latter two, calling SomeFunc(5) will throw a compile-time error.

Ziir
Nov 20, 2004

by Ozmaugh
What's "better," programming on a Linux or OSX box?

My undergrad research professor/adviser loves Mac and everything about it, and I'm about to start graduate school and and my graduate research. Right now I have a Dell laptop with both Windows 7 and Ubuntu on it (switching over to Ubuntu for programming purposes), but my sister was thinking about getting the new MacBook Pros that just came out so she's selling her older MBP (came out last year).

I don't need a new laptop but I really do like how small and light MBPs are and if my research adviser, a professor who does the same research that I am getting into, prefers a Mac over a Linux box then there's got to be a reason right? The languages I'll be using would be Fortan and C.

Edit: Computing power isn't that big of a deal because everything that requires a lot of processing power would be offloaded to a dedicated computer in the lab or a cluster.

raminasi
Jan 25, 2005

a last drink with no ice
Does anyone know how to define a method for a record type in F#? The language reference says it's possible but doesn't say how and I can't figure the syntax out.

yippee cahier
Mar 28, 2005

Ziir posted:

What's "better," programming on a Linux or OSX box?

My undergrad research professor/adviser loves Mac and everything about it, and I'm about to start graduate school and and my graduate research. Right now I have a Dell laptop with both Windows 7 and Ubuntu on it (switching over to Ubuntu for programming purposes), but my sister was thinking about getting the new MacBook Pros that just came out so she's selling her older MBP (came out last year).

I don't need a new laptop but I really do like how small and light MBPs are and if my research adviser, a professor who does the same research that I am getting into, prefers a Mac over a Linux box then there's got to be a reason right? The languages I'll be using would be Fortan and C.

Edit: Computing power isn't that big of a deal because everything that requires a lot of processing power would be offloaded to a dedicated computer in the lab or a cluster.

I presume you'll be using GCC? Runs fine on both platforms. What do you feel the most comfortable editing text files on?

shrughes
Oct 11, 2008

(call/cc call/cc)

Ziir posted:

What's "better," programming on a Linux or OSX box?

My undergrad research professor/adviser loves Mac and everything about it, and I'm about to start graduate school and and my graduate research. Right now I have a Dell laptop with both Windows 7 and Ubuntu on it (switching over to Ubuntu for programming purposes), but my sister was thinking about getting the new MacBook Pros that just came out so she's selling her older MBP (came out last year).

I don't need a new laptop but I really do like how small and light MBPs are and if my research adviser, a professor who does the same research that I am getting into, prefers a Mac over a Linux box then there's got to be a reason right? The languages I'll be using would be Fortan and C.

Edit: Computing power isn't that big of a deal because everything that requires a lot of processing power would be offloaded to a dedicated computer in the lab or a cluster.

Unless you want to deal with B.S. like wondering why OpenGL won't work on your hardware or why wireless or other crap just don't work, or if you don't like shittily made software, or if you like your browser to run fast, or if you hate freedom or feel the need to express your femininity through your computer and have a lot of extra money to spend, get a Mac. Otherwise get a Thinkpad, install Debian, GHC, XMonad, and bask in the freedom.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Ziir posted:

What's "better," programming on a Linux or OSX box?

My undergrad research professor/adviser loves Mac and everything about it, and I'm about to start graduate school and and my graduate research. Right now I have a Dell laptop with both Windows 7 and Ubuntu on it (switching over to Ubuntu for programming purposes), but my sister was thinking about getting the new MacBook Pros that just came out so she's selling her older MBP (came out last year).

I don't need a new laptop but I really do like how small and light MBPs are and if my research adviser, a professor who does the same research that I am getting into, prefers a Mac over a Linux box then there's got to be a reason right? The languages I'll be using would be Fortan and C.

Edit: Computing power isn't that big of a deal because everything that requires a lot of processing power would be offloaded to a dedicated computer in the lab or a cluster.

I wouldn't assume that your advisor has a good reason to prefer one over the other, you should decide yourself. But if you have the same setup as your advisor, that will probably make working together easier. And never underestimate the benefit of having someone familiar with a new OS nearby to help with the little things. Both of those reasons are great ones to guide you.

shrughes
Oct 11, 2008

(call/cc call/cc)
Seriously, programming on a Mac is way better than programming on Linux. There's one target that everybody's worrying worry about, and poo poo generally just _works_.

Personally I'm only willing to write software on my new Ben Nanonote with its copyleft hardware because anything else would be unethical :V

Ziir
Nov 20, 2004

by Ozmaugh

shrughes posted:

Seriously, programming on a Mac is way better than programming on Linux.

Could you please elaborate?

shrughes
Oct 11, 2008

(call/cc call/cc)

Ziir posted:

Could you please elaborate?

There's one target that everybody's worrying worry about, and poo poo generally just _works_.

bitprophet
Jul 22, 2004
Taco Defender

Ziir posted:

Could you please elaborate?

The OS X platform is significantly more homogenous than the Linux/PC world, which for better or worse means that both development for it and use of it is going to be less fraught with problems (at the cost of choice/openness).

That's not to say that Linux these days is somehow bad for either of those things, but there's no way that an open source ecosystem targeting a myriad of possible hardware/software configurations is going to exhibit the same level of polish and ease of development/use as one produced by a single company targeting its own, comparatively tiny number of hardware and software configs.

In my experience, what it boils down to is your opinion of Apple's policies and/or the level of your desire to control the software you're using. For a lot of open source developers over the last 5-10 years, the "don't have to gently caress with anything to make things just work" aspect of OS X combined with the fact that its underlayer is a fairly traditional Unix has made it the ideal platform. The only software I've ever seen that is Linux exclusive is, as you might imagine, related to the Linux kernel itself.

(Apple's apparently-totally-awesome set of APIs for native application dev is also a major draw, even moreso nowadays with all the mobile junk going on. And even with the strides Ubuntu has made in OSS usability, it's still not quite there yet.)


Which is all just a :words: or :goonsay: way of expanding on what shrughes is saying.

Ziir
Nov 20, 2004

by Ozmaugh
What text editors do you guys use with your Macs? I really like Notepad++ for Windows and I'm starting to get the hang on Vim on Linux.

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh
You guys are all terrible at advice. Notice where he says:

Ziir posted:

Edit: Computing power isn't that big of a deal because everything that requires a lot of processing power would be offloaded to a dedicated computer in the lab or a cluster.

If you think it's likely that you'll be programming stuff that gets put on a cluster, use whatever OS the cluster uses (or as close to it as possible). Do you really want to deal with weird compiler issues because of Apple's customized (and frequently outdated) version of GCC?

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

I use MacVim for most things. XCode is kind of a piece, especially if you're coming from a real IDE like VS, so a traditional editor will serve you best IMO.

Avenging Dentist posted:

If you think it's likely that you'll be programming stuff that gets put on a cluster, use whatever OS the cluster uses (or as close to it as possible). Do you really want to deal with weird compiler issues because of Apple's customized (and frequently outdated) version of GCC?
Yeah, I noticed this, but I've never had any issues porting code I've developed on my Mac to a Linux cluster so I didn't comment on it.

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

Dijkstracula posted:

Yeah, I noticed this, but I've never had any issues porting code I've developed on my Mac to a Linux cluster so I didn't comment on it.

We regularly have issues making stuff work on Linux and Mac at my job. Usually because Mac does some bizarre thing like making CC point to gcc instead of g++.

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

Avenging Dentist posted:

We regularly have issues making stuff work on Linux and Mac at my job.
Maybe you should offer me a high-paying consulting position then :colbert:

edit: ah, I was only doing Fortran or vanilla C work, so I wouldn't have enountered the g++ issue.

Dijkstracula fucked around with this message at 19:20 on May 15, 2010

bitprophet
Jul 22, 2004
Taco Defender

Avenging Dentist posted:

If you think it's likely that you'll be programming stuff that gets put on a cluster, use whatever OS the cluster uses (or as close to it as possible). Do you really want to deal with weird compiler issues because of Apple's customized (and frequently outdated) version of GCC?

Yea, I didn't read very closely. I do usually recommend people develop on their target platform when possible, it just makes the most sense. On the other hand, depending on exactly what's going on, a Mac may still be the best workstation platform and you can just use VMs for more easily targeting the deploy environment. Best of both worlds.


Ziir posted:

What text editors do you guys use with your Macs? I really like Notepad++ for Windows and I'm starting to get the hang on Vim on Linux.

I use Vim (not MacVim...terminal vim) on my Mac, but I'm a weirdo who likes the fact that his editor behaves 100% the same regardless of whether his terminal is open to a local tty or a remote one.

Most Mac-using developers I know or know of, use Vim or Emacs (either native or console versions) or TextMate, which is not free but is pretty darn tootin' for the price. (Just...don't try opening any large files in it. :laugh:)

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
Ziir: I'm a big fan of TextWrangler- it's free and highly customizable.

Mustach
Mar 2, 2003

In this long line, there's been some real strange genes. You've got 'em all, with some extras thrown in.
He could use SSH and SSHFS so that he can edit with his local machine's tools & compile on the servers. Or if he's going to end up using vim, then there's little reason to do anything but SSH into the university's servers and do all development on them.

Foran
Apr 19, 2008

Garry's Mod is an Art
I'm trying to make a small utility for the new 2010 version of Dwarf Fortress, and I'm having a problem, namely:

I need to find the pattern between memory addresses for each dwarf on the embark screen, so if I have more than 7 dwarves, I can easily find each new dwarf in memory and be able to edit it.

I'm not sure if I said that correctly, but eh.

e: Right now I'm using a basic memory editor to find each address for each dwarf

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Avenging Dentist posted:

We regularly have issues making stuff work on Linux and Mac at my job. Usually because Mac does some bizarre thing like making CC point to gcc instead of g++.

CC is supposed to point to gcc instead of g++; CXX is the variable for the system C++ compiler. This is not some crazy Mac thing; this is the regular defined behavior of make going back N years. What crazy make environment are you using that makes CC a C++ compiler by default?

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh
I don't mean the environment variables, I mean the commands. CC the command, when it exists, should be a symlink to the system C++ compiler. Though I guess this has to do with case-insensitive filesystems on Mac?

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Avenging Dentist posted:

I don't mean the environment variables, I mean the commands. CC the command, when it exists, should be a symlink to the system C++ compiler. Though I guess this has to do with case-insensitive filesystems on Mac?

Yeah, that convention is clearly unsupportable on case-insensitive filesystems. I'll admit to never having heard of it before, but apparently it's common among the stately old commercial UNIX vendors.

I can see why that would be annoying for a build system that's trying to autodetect the system C++ compiler.

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip
I'm pretty sure it's related to the old convention of having .c files be C source and .C files be C++ source, hence the cc and CC commands. Due to the melee in which it was initially developed and spread, C++ has a broad range of file types associated with it:

code:

.C
.cc
.cpp
.cxx



headers:

.H
.h
.hpp

Adbot
ADBOT LOVES YOU

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

rjmccall posted:

Yeah, that convention is clearly unsupportable on case-insensitive filesystems. I'll admit to never having heard of it before, but apparently it's common among the stately old commercial UNIX vendors.

Welcome to autotools. :(

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