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

digital-entropy posted:

With Javascript, is there anyway to set document.location.hash without appending an item to the browser's recent history? We have a Flex app at work and I want to let users bookmark/deep-link pages by setting the fragment each time they change the view.

The fragment sets correctly, but the user can then toggle through the recent hashes by using back/forward. I don't plan on picking up those change events so I'd rather the hash changes not append history items.

No.

Adbot
ADBOT LOVES YOU

pseudorandom name
May 6, 2007

tef posted:

Couldn't you do something horrible with scrollTo or similar?

He's not using hashes to scroll to specific locations, he's using them so deep linking works with his Flash app, but he doesn't want to bother making the back/forward buttons work and people like him are the reason the rest of us hate Flash.

pseudorandom name
May 6, 2007

digital-entropy posted:

The reason I'm attempting to do it this way is that a coworker put app-specific back/forward buttons in and at some point they do need to be stripped out but that's going to be a bigger endeavor than simply working around it for now.

Believe me, I'd rather just use the browser back/forward work but it isn't something I am currently able to do.

But thanks for being a smartass and bothering to inquire why I might be stuck doing things a particular way. People like you are the reason the rest of us hate the internet.

Sorry man; but every time I use a Flash app with a UI that almost but not quite behaves like a real UI it drives me nuts.

pseudorandom name
May 6, 2007

Sweeper posted:

Say I have two computers next to each other. I have a client running on one and a server running on another. I want the client to display data from the server, is it possible to do this over usb? Am I pretty much stuck using the network for this type of thing? No serial cable is possible since the other computer is a laptop.

Buy a USB-to-serial adapter.

pseudorandom name
May 6, 2007

Dijkstracula posted:

Since there are no jmps in this program, there should only be one basic block, and that should only ever get executed once, so where the hell are these things coming from? :smith:

You probably know more about valgrind than me at this point because you're the one writing the plugin, but perhaps valgrind's decompiler/recompiler generates a bunch of extra basic blocks?

pseudorandom name
May 6, 2007

Vinterstum posted:

Famous? Quake I/II/III source code: http://www.idsoftware.com/business/techdownloads/

Doom 3 was the first C++ game engine from id Software.

pseudorandom name
May 6, 2007

Without any IPC, basically the only thing you can do is have the child process return an error code (main()'s return value, or exit()'s parameter).

pseudorandom name
May 6, 2007

Dijkstracula posted:

A stupid Linux internals question that I've not been able to find an answer to:

I'm porting a Valgrind tool to 64-bit Linux and the ia32 version had some magic constants corresponding to points in the 32 bit address space, ie:


38 /****************************** globals **************************************/
39
40 #define TEXT_SEG_BEGIN 0x08048000
41 #define HEAP_SEG_END 0x40000000
42 #define KERN_SEG_BEGIN 0xc0000000


Anybody know what the 64-bit equivilents are, or where I could look these up? Google is failing me, and poking through the enormous source tree isn't yielding any fruit.

None of those values are fixed and if your tool is hard-coding them, it is technically broken.

pseudorandom name
May 6, 2007

Dijkstracula posted:

Well, sure, but IIRC they're at least values that can only be changed during a kernel recompile, right? (now, this still doesn't address the original problem of how one can even query for these values)

TEXT_SEG_BEGIN is actually determined by the base address of the LOAD segment in the ELF program header, HEAP_SEG_END doesn't have any relation to reality at all (AFAIK), and, yes, KERN_SEG_BEGIN would require a kernel recompile.


edit: ok, so KERN_SEG_BASE is obviously PAGE_OFFSET (the offset into the virtual address space where the physical direct mapping starts), and HEAP_SEG_END is apparently supposed to be TASK_UNMAPPED_BASE, but TASK_UNMAPPED_BASE is only loosely related to the heap. It actually controls where the kernel starts looking for empty VM slots to map files via mmap(), so it is sort of an upper bound for where the sbrk() heap could be, except a) malloc will also mmap() anonymous memory for the heap outside of that region and b) if the kernel can't find an empty space in the VM above TASK_UNMAPPED_BASE, it'll search anywhere, including the supposed heap.

pseudorandom name fucked around with this message at 09:15 on Jun 4, 2010

pseudorandom name
May 6, 2007

Avenging Dentist posted:

What version of GCC? As I recall, before they started working on C++0x support, they didn't do this. Since you have to do this for C++0x, it's obviously going to be the standard going forward.

Both clang 2.7 and gcc 4.4 do it now.

A random gcc dev I just asked says that gcc has been folding floats since real.c was added in 1993 or so.

pseudorandom name
May 6, 2007

tractor fanatic posted:

This is a problem I'm kind of curious about :

If you had a computer that had the locations of all the stars in the galaxy, and then gave it a random picture of the sky from some point within the galaxy, what would the time complexity be for triangulating its exact position, if there are N stars in the galaxy, and K stars in the picture?

This would get easier if your star database had size and spectra information for all the stars and your 'picture' was good enough quality to include the spectra.

pseudorandom name
May 6, 2007

Yes.

The GPL states that derivatives of a work licensed under the GPL must also be licensed under the GPL, and it is commonly believed that simply using a GPLed library is sufficient to be a derivative work*. But ask your lawyer.

* The exception to this would be a GPLed work that implements an unoriginal library interface, in which case your work could just as easily use a different implementation of the same interface and thus isn't tied enough to the GPLed work to be a derivative. But ask your lawyer.



As to your second question, if the thief is smart enough, you generally can't, but people dumb enough to use code without obeying the license generally aren't smart enough to remove easily recognizable strings like the SCM keywords and assertion failure messages and whatnot.

pseudorandom name fucked around with this message at 20:02 on Sep 9, 2010

pseudorandom name
May 6, 2007

Otto Skorzeny posted:

write(2) has the signature (int fd, char *buf, size_t count) and writes up to count bytes from buf to fd, so I thought this would work fine. What am I doing wrong :(

For starters, you're using the 32-bit system call interface from a 64-bit process and I'm surprised that works at all.

pseudorandom name
May 6, 2007

Yes, you should be using the 64-bit system call interface.

pseudorandom name
May 6, 2007

Even if he did mean "side" instead of "size", master and slave USB connectors are differently shaped specifically to prevent you from connecting host-to-host or device-to-device..

pseudorandom name
May 6, 2007

Congratulations, you've just badly reimplemented Lisp exceptions.

pseudorandom name
May 6, 2007

nielsm posted:

Sort them by start time. (O(n log n))

Then for each job, if the start time is smaller than the end time of the previous, those two conflict. (O(n))

O(n log n) + O(n) = O(n log n)

start: 1
end: 5

start: 2
end: 3

start: 4
end: 6

pseudorandom name
May 6, 2007

The question was "Does this specific job conflict with any other job in this set?" not "Does at least one job in this set conflict with another job?"

pseudorandom name
May 6, 2007

If the auto-updater downloads an update.exe, runs it, and then exits, update.exe can replace the auto-updater in addition to the main executable.

pseudorandom name
May 6, 2007

Ask your lawyer.

pseudorandom name
May 6, 2007

You'd be better off using your database's native GIS functionality, if it has it.

PostgreSQL has PostGIS, MySQL has Spatial Extensions, Oracle has Oracle Spatial, DB2 has DB2 Spatial Extender, SQL Server has ... something, etc.

pseudorandom name
May 6, 2007

The King of Swag posted:

Objective-C I would argue is the closest "C-like" language, in fact you can't call it "C-like" as it's actually just a superset of C. All the magic that goes on is contained within the Obj-C runtime library. When compiled, ObjC code is turned into strict C before being fully compiled into object files.

Objective C has exceptions now, so it isn't a strict superset of C.

pseudorandom name
May 6, 2007

pokeyman posted:

Alright, I'll bite: show me an example of C code that can't be compiled by an Objective-C compiler due to Objective-C exceptions.
I'm assuming you meant "show me an example of Objective C code that can't be compiled to C due to exceptions", because that's what we were talking about.

foo.cpp:
code:
#include <iostream>
using namespace std;

extern "C" void stuff();

int main(int argc, char* argv[])
{
	try {
		stuff();
	} catch(...) {
		cout << "stuff threw!" << endl;
	}

	return 0;
}
bar.m:
code:
#import <Foundation/NSString.h>
#import <Foundation/NSException.h>

void stuff()
{
	NSException *e = [NSException
		exceptionWithName: @"TestException"
		reason: @"This is a test exception"
		userInfo: nil];
	@throw e;
}
And, yes, you can fake exceptions using setjmp() and longjmp(), but the C++ runtime doesn't, so in order to interoperate with C++, you have to generate the .eh_frame data, and there's no way to do that from C.

pseudorandom name fucked around with this message at 05:54 on Apr 17, 2011

pseudorandom name
May 6, 2007

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.
And the Apple docs go on to say that 64-bit binaries use the table-based zero cost exception handling mechanism, which doesn't use setjmp()/longjmp() at all. On Linux, 32-bit and 64-bit Objective C and Objective C++ binaries always use the table-based zero cast EH system.

The King of Swag posted:

No, he meant what he typed. ObjC being a superset of C means it encompasses C in its entirety and thus there is no functional C code that won't compile properly in ObjC. This is in contrast to C++ which builds from C, but is not a superset of C, as C will not necessarily compile correctly under C++.

Edit: Just want to add that ObjC by its nature has to be broken into valid C before final compilation into object files, because there isn't actually an ObjC compiler. Both gcc and LLVM are C compilers that use flags to link the ObjC runtime and to optimize for ObjC memory usage patterns, but they can still only compile C code (Apple's LLVM implementation may have some weird exceptions, I'm not sure).

I was responding to your comment that

The King of Swag posted:

All the magic that goes on is contained within the Obj-C runtime library. When compiled, ObjC code is turned into strict C before being fully compiled into object files.
which is blatantly wrong; the C, C++, Objective C and Objective C++ frontends in clang and gcc are all separate entities and at no point are any of the other source languages transformed into C before being compiled, the compilers understand each of the languages natively.

(gcc actually goes to the extent of having entirely separate binaries for each of the source languages, called cc1, cc1plus, cc1obj, and cc1objplus, respectively. clang has a single binary that can operate in the different modes as necessary. But there's no cfront nonsense anywhere.)

pseudorandom name
May 6, 2007

pokeyman posted:

Public domain bitches.

(See also: CC0)

Public domain doesn't let you disclaim any liability.

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.

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.

pseudorandom name
May 6, 2007

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

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?

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

pseudorandom name
May 6, 2007

A good start, but perhaps it could be made into a more generalized solution with templates?

pseudorandom name
May 6, 2007

I come here expecting people's minds being blown by Duff's Device, and instead it is some kind of retarded formatting style argument. :(

pseudorandom name
May 6, 2007

Otto Skorzeny posted:

It isn't quite duff's device that's being presented here, although it is a very close cousin

Oh, I know that, but Duff's Device is the only thing related to loop unrolling that I could think of that would result in an explosion of posting.

pseudorandom name
May 6, 2007

Yeah, just keep pretending urgent data doesn't exist.

Unless you're implementing Telnet.

e:fb

pseudorandom name
May 6, 2007

Wine ripped off the entire Win32 API, so you should probably be fine.

But ask your lawyer.

pseudorandom name
May 6, 2007

OneEightHundred posted:

- You didn't use ENTER, which means LEAVE will attempt to restore a stack state that was never stored and ruin everything

ENTER and LEAVE don't have to be paired. (And in fact never are in modern code, ENTER is microcoded, while LEAVE is a real instruction.)

pseudorandom name
May 6, 2007

Well, yeah, LEAVE obviously expects a specific stack layout. But you don't have to produce that using ENTER. And nobody does, because ENTER is terrible. OTOH, LEAVE isn't, and the general rule of x86 assembly programming is to use the fewest instructions possible (i.e. take advantage of the complex addressing modes, use the instructions that do multiple things, etc.).

pseudorandom name
May 6, 2007

Sorry, I'm out of date, everybody microcodes LEAVE now. Never use it.

pseudorandom name
May 6, 2007

The ones that aren't listed as "microcoded" in AMD's optimization manual.

Adbot
ADBOT LOVES YOU

pseudorandom name
May 6, 2007

There's the clear disadvantage that you've broken accessibility.

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