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
pseudorandom name
May 6, 2007

pokeyman posted:

No, it just doesn't do so automatically. It doesn't stop you from doing so if you feel you must.

My understanding is that the disclaimers in copyrighted software works because either a) you agree to the disclaimer of warranty or b) you aren't allowed to use the software. Public domain doesn't have a copyright, so you can't control its use.

Adbot
ADBOT LOVES YOU

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

pseudorandom name posted:

My understanding is that the disclaimers in copyrighted software works because either a) you agree to the disclaimer of warranty or b) you aren't allowed to use the software. Public domain doesn't have a copyright, so you can't control its use.

Well, IANAL, but my understanding is that implied warranties and copyright are orthogonal. Placing a work into the public domain literally means abandoning the copyright you hold on that work.

Scaevolus
Apr 16, 2007

Have any open-source licenses been tested in court? I was under the impression that there are almost no precedents for them.

pseudorandom name
May 6, 2007

pokeyman posted:

Well, IANAL, but my understanding is that implied warranties and copyright are orthogonal. Placing a work into the public domain literally means abandoning the copyright you hold on that work.

I actually asked an IP lawyer, and his response was "yes. wait. public domain. maybe? let me think."

The More You Know.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

The King of Swag posted:

The Apple docs flat out say that exception handling is faked using setjmp() and longjmp() and thus is subject to any limitations associated with those functions. Part of the problem is that you're confusing the NextStep library (exceptions require the use of NSException) with the ObjC runtime. Now, the latest versions of the runtime do natively support exceptions, but if I understand the gcc documentation correctly, they're still broken down into setjmp.h trickery during compile-time.

The exceptions situation is complicated. As was already mentioned, on x86-64 ObjC exceptions are lowered to unwind tables, which cannot be simulated in C. On i386 they're lowered to setjmp/longjmp, which are actually an absurdly brittle way of implementing exceptions; llvm-gcc uses one set of terrible hacks to make things less brittle, including some things which aren't portable C, and clang uses another, including some different things which aren't portable C. On ARM (on iOS), both ObjC and C++ exceptions use a cross-breed unwinder involving unwind tables and setjmp-like compiler intrinsics, which is actually the closest to portable C any of this gets.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

rjmccall posted:

The exceptions situation is complicated.

No kidding. So I'm curious, given the hoops being jumped through: are exceptions useful in Objective-C?

The only time I've ever seen them used in application-level code is as a general "catch everything and display an error instead of just crashing and maybe try to save a document first". If that's left out, exceptions tend to either cause a crash or leave applications in an inconsistent state and you probably should've just crashed anyway. And this doesn't even work 100% when you're calling library code that doesn't bother with exceptions.

Apple's docs say to use exceptions for programming errors only (and this is sometimes done, e.g. using key-value observing on property that can't be found in the object), but this seems to be more typically handled with assertions or return codes. For example, many Foundation methods return nil (and NSError as needed).

So are exceptions actually used as infrequently as I think? And if so, is that because they're so complicated, brittle, and/or non-portable? This is starting to sound like C++.

MrMoo
Sep 14, 2000

Scaevolus posted:

Have any open-source licenses been tested in court? I was under the impression that there are almost no precedents for them.

GPL has many times, the anti-Tivo clauses in GPL 3 might hit court soon though.

http://gpl-violations.org/index.html
http://infinityoverzero.com/bbox/

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

pokeyman posted:

No kidding. So I'm curious, given the hoops being jumped through: are exceptions useful in Objective-C?

They're not all that unportable; it's mostly that performance varies a lot between platforms, and that they don't interoperate with C++ exceptions on i386. If you're willing to overlook the latter — and you really should be, because Apple hasn't shipped a non-64bit-capable machine in years — and you don't use a gratuitous number of @try/catches, then there's no ObjC-specific reason to avoid them, other than the fact that the APIs don't throw them on normal error conditions. That said, I am not convinced that exceptions are ever really useful enough as a language feature to justify the burden.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

rjmccall posted:

That said, I am not convinced that exceptions are ever really useful enough as a language feature to justify the burden.

Not that I know anything but I'm with you. Thanks for sharing.

Jam2
Jan 15, 2008

With Energy For Mayhem
How do I fix this error? I have gcc 4.2.1 installed.

unable to execute gcc-4.0: No such file or directory

error: command 'gcc-4.0' failed with exit status 1

Looking in my /usr/bin/, I do not have gcc-4.0 installed. What next?

Jam2 fucked around with this message at 10:22 on Apr 21, 2011

pseudorandom name
May 6, 2007

Figure out what is insisting on using "gcc-4.0" instead of "gcc", and change it.

covener
Jan 10, 2004

You know, for kids!

Jam2 posted:

How do I fix this error? I have gcc 4.2.1 installed.

unable to execute gcc-4.0: No such file or directory

error: command 'gcc-4.0' failed with exit status 1

Looking in my /usr/bin/, I do not have gcc-4.0 installed. What next?

Make sure you don't have environment variable "CC" set to gcc-4.0. Just unset it, and find the dot-file it was set in, rather than replacing the value.

Jam2
Jan 15, 2008

With Energy For Mayhem

pseudorandom name posted:

Figure out what is insisting on using "gcc-4.0" instead of "gcc", and change it.

Thanks, very helpful. (not) In case you haven't realized, I have no idea what I'm doing.

covener posted:

Make sure you don't have environment variable "CC" set to gcc-4.0. Just unset it, and find the dot-file it was set in, rather than replacing the value.

cc is set to i686-apple-darwin10-llvm-gcc-4.2. I tried symlinking gcc-4.0 to gcc-4.2 and it got past the original error but now breaks later down in the chain as it tries to build the package in gcc-4.2.

pseudorandom name
May 6, 2007

Jam2 posted:

Thanks, very helpful. (not) In case you haven't realized, I have no idea what I'm doing.

But you do know how to search through files, right?

The King of Swag
Nov 10, 2005

To escape the closure,
is to become the God of Swag.
Here's one for you Win32 API guys.

I'm in the process of writing the Windows portion of my cross-platform input handling class, and I've come to the point where I need to differentiate between left and right handed keys. Shift, Control, etc. all work fine, but Alt works as if it's toggling the state of the keys.

In other words, if I type LALT RALT x 3, I'll get LALT LALT RALT RALT, but LALT LALT RALT RALT x 3, will produce LALT RALT x 3, and I have no idea what's going on, as I'm handling it in the way suggested by the docs. I've also checked the low-bit to see if it really is being toggled, but it always returns FALSE.

code:
case VK_MENU:
{
     short rightOptionKey = GetKeyState(VK_RMENU);

    // HIWORD checks the high order bit, which the docs say checks if the key is up or down.
    // LOWORD would check if the key is toggled.
    if (HIWORD(rightOptionKey))
    {
        return DFRightOptionKey;
    }
    else
    {
        return DFLeftOptionKey;
    }
}

nielsm
Jun 1, 2009



If this is in a WM_KEYDOWN handler, try checking the 24th bit of lParam instead. As far as I can tell it should also distinguish between left/right hand keys.

code:
switch (wParam) {
    case VK_MENU:
    {
        int is_right = lParam & 0x10000;
        ...
    }
}

The King of Swag
Nov 10, 2005

To escape the closure,
is to become the God of Swag.

nielsm posted:

If this is in a WM_KEYDOWN handler, try checking the 24th bit of lParam instead. As far as I can tell it should also distinguish between left/right hand keys.

code:
switch (wParam) {
    case VK_MENU:
    {
        int is_right = lParam & 0x10000;
        ...
    }
}

I should have mentioned it in my original post, but I've also tried that before and it produces the same results as my current implementation. As does the bit-shift method ((lParam >> 24) & 1)

Jam2
Jan 15, 2008

With Energy For Mayhem

quote:

usf-wifi-35-92:imaging-1.1.7 BOSX$ python setup.py build_ext -i
running build_ext
--- using frameworks at /System/Library/Frameworks
building '_imaging' extension
creating build
creating build/temp.macosx-10.3-fat-2.7
creating build/temp.macosx-10.3-fat-2.7/libImaging
gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3 -DHAVE_LIBJPEG -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -I/usr/local/include/freetype2 -IlibImaging -I/Library/Frameworks/Python.framework/Versions/2.7/include -I/usr/local/include -I/usr/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _imaging.c -o build/temp.macosx-10.3-fat-2.7/_imaging.o
_imaging.c:3017: warning: initialization from incompatible pointer type
_imaging.c:3077: warning: initialization from incompatible pointer type
/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed
Installed assemblers are:
/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64
/usr/bin/../libexec/gcc/darwin/i386/as for architecture i386
In file included from /usr/include/architecture/i386/math.h:626,
from /usr/include/math.h:28,
from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pyport.h:312,
from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:58,
from _imaging.c:75:
/usr/include/AvailabilityMacros.h:108:14: warning: #warning Building for Intel with Mac OS X Deployment Target < 10.4 is invalid.
_imaging.c:3017: warning: initialization from incompatible pointer type
_imaging.c:3077: warning: initialization from incompatible pointer type
lipo: can't open input file: /var/folders/q2/q2ZBUrfEEfe2CotAoIUFsk+++TI/-Tmp-//ccOllyOf.out (No such file or directory)
error: command 'gcc-4.0' failed with exit status 1
usf-wifi-35-92:imaging-1.1.7 BOSX$

Why _imaging.c:3017: warning: initialization from incompatible pointer type?

The King of Swag
Nov 10, 2005

To escape the closure,
is to become the God of Swag.

The King of Swag posted:

I should have mentioned it in my original post, but I've also tried that before and it produces the same results as my current implementation. As does the bit-shift method ((lParam >> 24) & 1)

Ok, I've half-solved it. Turns out that Alt gets funky because Alt activates the window menu; this is fixed by using WS_POPUP instead of WS_OVERLAPPEDWINDOW, but that's only a viable solution for fullscreen mode, and I'd like to have Alt a viable key in windowed mode.

Is there a way to disable the window menu without resorting to WS_POPUP?

nielsm
Jun 1, 2009



The King of Swag posted:

Ok, I've half-solved it. Turns out that Alt gets funky because Alt activates the window menu; this is fixed by using WS_POPUP instead of WS_OVERLAPPEDWINDOW, but that's only a viable solution for fullscreen mode, and I'd like to have Alt a viable key in windowed mode.

Is there a way to disable the window menu without resorting to WS_POPUP?

Are you swallowing the WM_KEYDOWN and WM_KEYUP messages (i.e. returning 0) or are you passing any at all to DefWindowProc()? I believe that if you swallow all keyboard input and don't let DefWindowProc() see it, you shouldn't get any of the menu behaviour. This of course assumes you're writing something like a game that doesn't use standard user interface.
Also try skipping TranslateMessage() in your message loop, although I don't think that matters for this.

The King of Swag
Nov 10, 2005

To escape the closure,
is to become the God of Swag.

nielsm posted:

Are you swallowing the WM_KEYDOWN and WM_KEYUP messages (i.e. returning 0) or are you passing any at all to DefWindowProc()? I believe that if you swallow all keyboard input and don't let DefWindowProc() see it, you shouldn't get any of the menu behaviour. This of course assumes you're writing something like a game that doesn't use standard user interface.
Also try skipping TranslateMessage() in your message loop, although I don't think that matters for this.

This fixed it; thanks for the help.

rolleyes
Nov 16, 2006

Sometimes you have to roll the hard... two?

Jam2 posted:

Why _imaging.c:3017: warning: initialization from incompatible pointer type?

You'll need to show us line 3017 of _imaging.c (and surrounding lines) to have any hope of getting an answer. I probably couldn't help even with that, but someone else might be able to pick it up. Also, it sounds like your deployment target is not set correctly:

quote:

/usr/include/AvailabilityMacros.h:108:14: warning: #warning Building for Intel with Mac OS X Deployment Target < 10.4 is invalid.

The reason for this is that OS X 10.4 was the first version to support Intel processors, so targetting less than 10.4 on an Intel platform doesn't make sense.


edit:
Also your build didn't fail because of the pointer warnings (warnings don't fail the build by default), it failed because of:

quote:

lipo: can't open input file: /var/folders/q2/q2ZBUrfEEfe2CotAoIUFsk+++TI/-Tmp-//ccOllyOf.out (No such file or directory)

I don't know enough about OS X development and GCC to know what this is all about though.

rolleyes fucked around with this message at 11:36 on Apr 22, 2011

nielsm
Jun 1, 2009



Jam2 posted:

Why _imaging.c:3017: warning: initialization from incompatible pointer type?

As rolleyes points out, that isn't the reason the build fails.

The reason the build fails seems to be that the setup_site module doesn't know how to call the C compiler properly and in other ways sets up a wrong build environment. I tried digging a bit in the PIL sources and its setup.py but didn't find anything conclusive for why it fails.
It seems that the compiler is told to build a fat binary with both PPC and x86 code in it, but your machine doesn't have an assembler for PPC installed so it fails to generate the PPC code, and then the lipo program fails because the PPC binary is missing. (Lipo is the program used on OS X to combine multiple single-platform binaries into one multi-platform fat binary.)

As for those pointer warnings, maybe the code was written against an earlier Python API version, that's my best bet. Assuming it's the 1.1.7 release version of PIL, those two lines are in static initialisers for function tables for custom types.

IShallRiseAgain
Sep 12, 2008

Well ain't that precious?

I'm writing a custom system call for ubuntu and I can't locate what file the code for the open() system call is in the source.

pseudorandom name
May 6, 2007

The kernel implementation is in linux/fs/open.c, the userspace stub is generated from glibc/sysdeps/unix/syscalls.list

pr0metheus
Dec 5, 2010

IShallRiseAgain posted:

I'm writing a custom system call for ubuntu and I can't locate what file the code for the open() system call is in the source.

You can use grep or find commands to recursively search for patterns inside many text files or file names. You could use it to find such things in code base :)

IShallRiseAgain
Sep 12, 2008

Well ain't that precious?

Thanks for the help.
-Edit Nevermind about the other thing, found it on my own.

IShallRiseAgain fucked around with this message at 21:27 on Apr 23, 2011

Awkward Davies
Sep 3, 2009
Grimey Drawer
Is there anyone here who could help with the logic of writing a sketch that creates a fractal like pattern in response to music (in Processing)?

pr0metheus
Dec 5, 2010

Awkward Davies posted:

Is there anyone here who could help with the logic of writing a sketch that creates a fractal like pattern in response to music (in Processing)?

What kind of fractal do you want and how many parameters are you extracting form music?

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I have an XML schema question. I have an element with two attributes whose rules change together. Look at this example for what I mean:

[code]
<xs:element name="stuff">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="type" type="myDataType" use="required"/>
<xs:attribute name="value" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>

Let's say that the custom type "myDataType" is an enumeration of strings describing variable types like int, float, or string. The situation is that I'd like to adapt the rules for the value attribute so that depending on the given type, it can validate the value more strictly. So if the data type the user gives is "int" then I was hoping to validate that the value field is indeed an integer rather than something else like a float or a string. Is there a way to do this?

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


Rocko Bonaparte posted:

I have an XML schema question. I have an element with two attributes whose rules change together. Look at this example for what I mean:

[code]
<xs:element name="stuff">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="type" type="myDataType" use="required"/>
<xs:attribute name="value" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>

Let's say that the custom type "myDataType" is an enumeration of strings describing variable types like int, float, or string. The situation is that I'd like to adapt the rules for the value attribute so that depending on the given type, it can validate the value more strictly. So if the data type the user gives is "int" then I was hoping to validate that the value field is indeed an integer rather than something else like a float or a string. Is there a way to do this?

Regular expressions. I guarantee you that there are a hundred examples of exactly what you want to do out there.

Awkward Davies
Sep 3, 2009
Grimey Drawer

pr0metheus posted:

What kind of fractal do you want and how many parameters are you extracting form music?

I figured out the major roadblock that prompted me to post that.

I'm attempting to use the rules for a modified koch curve to create a fractal based on music. I'm using the BeatDetect function from the minim library to trigger 90 degree turns. I don't think its ultimately going to work out, because BeatDetect is not particularly exact, but I'm trying.

edit: if you know of a better BeatDetect class out there, by all means let me know :D

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

Don't know if it answers all your questions but this is probably a good place to start:
http://www.geisswerks.com/ryan/FAQS/articles.html

Was the first hit in google for "how to make fractal based music visualization plugin". Sounds like you might want to add open source or -winamp to it.

pr0metheus
Dec 5, 2010

Awkward Davies posted:

I figured out the major roadblock that prompted me to post that.

I'm attempting to use the rules for a modified koch curve to create a fractal based on music. I'm using the BeatDetect function from the minim library to trigger 90 degree turns. I don't think its ultimately going to work out, because BeatDetect is not particularly exact, but I'm trying.

edit: if you know of a better BeatDetect class out there, by all means let me know :D

You could use pitch to vary angle continuously :)

Awkward Davies
Sep 3, 2009
Grimey Drawer

Scaramouche posted:

Don't know if it answers all your questions but this is probably a good place to start:
http://www.geisswerks.com/ryan/FAQS/articles.html

Was the first hit in google for "how to make fractal based music visualization plugin". Sounds like you might want to add open source or -winamp to it.

Thanks for the help, but that's a little past my skills range. Processing is my first language, and I've only been using it for a short time. I appreciate the research though :)


pr0metheus posted:

You could use pitch to vary angle continuously :)

Yeah, I'd like the interaction to be a bit more obvious, which is why I set it to the beat. I've just got some fine tuning of the BeatDetection and the object to do.

Orzo
Sep 3, 2004

IT! IT is confusing! Say your goddamn pronouns!
Crosspost from c++ thread since nobody answered there:

I am looking for a good resource that will teach me C++ from beginner to advanced. I haven't touched or even read C++ since college 6 years ago, I consider myself an expert at C#, but I would really like to learn C++ again. Does anyone have any favorite resources (online free tutorials are a plus, books are fine too)?

tef
May 30, 2004

-> some l-system crap ->

Orzo posted:

Crosspost from c++ thread since nobody answered there:

I am looking for a good resource that will teach me C++ from beginner to advanced. I haven't touched or even read C++ since college 6 years ago, I consider myself an expert at C#, but I would really like to learn C++ again. Does anyone have any favorite resources (online free tutorials are a plus, books are fine too)?

did you try the first post of the thread you abandoned?

http://forums.somethingawful.com/showthread.php?threadid=2773485#post339777574

it has links to online resources and recommended books

Orzo
Sep 3, 2004

IT! IT is confusing! Say your goddamn pronouns!
Yes, I read the opening post I just thought someone might have a more precise suggestion for someone who knows C# inside and out. I guess I'm looking for an approach that assumes the reader knows how programming works but at the same time starts from step 1 on the C++ language.

spiritual bypass
Feb 19, 2008

Grimey Drawer
Step-by-step tutorials for new languages don't seem too useful for people who already know programming generally. Maybe you could try a "hello world" just to get your environment straight and then look for some recipes for elementary data structures and I/O?

Adbot
ADBOT LOVES YOU

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

rt4 posted:

Step-by-step tutorials for new languages don't seem too useful for people who already know programming generally. Maybe you could try a "hello world" just to get your environment straight and then look for some recipes for elementary data structures and I/O?

Agree. If you're already full up on another language you don't need a backgrounder in programming, you need to be aware of the differences from what you know to what you need to know. Unfortunately no one really makes a reference like that since it'd be of such limited appeal, so the best way is to usually take up a project and run with it finding out what the differences are.

One thing to suggest though is before even getting into data types and I/O though is compiler specifics, because that is going to be the one area where your experience with C# is going to be sharply divided from C++. For that I'd pick up a basic C++ manual/tutorial of some kind and read the compiler (basic operation, optimizations, data conversion assumptions, make files, etc.) section end to end, and then once you know how that shakes out, start up a project of some kind.

If you want to see some examples of how compiler assumptions and modes can go wacky just read up the Coding Horrors thread, there's usually something every 5 pages or so ANSI C/C++ related.

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