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
Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Zombywuf posted:

The output is 31 characters. No-one seems to be anywhere near that yet.
it's spaces, not tabs

Adbot
ADBOT LOVES YOU

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

GrumpyDoctor posted:

Just so I'm clear - there isn't any portable way to do what he's asking, right? I'm sure there are plenty of things that will work, but there's nothing that must work?

Well there's some dumb options:
code:
typedef struct examplestruct {
    char a;
    char b;
    char c;
    char d;
    char e;
    char f;
} examplestruct;

#define O(f) offsetof(examplestruct, f)
static size_t examplestruct_offsets[] = { O(a), O(b), O(c), O(d), O(e), O(f) };
#undef O

void dostuff() {
    examplestruct example;
    for (int i = 0; i < 6; ++i) {
        ((char *)&example)[examplestruct_offsets[i]] = foo();
    }
}

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
SaaS implies a b2b business model.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
the world would be a better place if probability/statistics was a mandatory class for everyone

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Neslepaks posted:

No, see, if I build the list and shuffle it before starting to pick, I'd have to store/persist the shuffled lists and I wanted to avoid that. But yeah, maybe it'll have to be that way.
I guess you could come up with a numbering scheme for the combinations so that you can just store a shuffled list of ints rather than a shuffled list of strings, or use a PRNG with a long enough period to avoid duplicates.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
There's a fairly obvious maximum font size of "the largest that will fit in the vertical space", which is trivially calculatable.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
If your SDK is for something run on the client and not a server, the GPL will probably work fine.

Non-commercial licenses aren't very popular for libraries as once you eliminate open source and commercial uses, you're mostly just left with toys.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

hieronymus posted:

Things I've noticed about unit testing in addition to previous comments:
1. It forces developers to use object oriented programming. If your 'design' isn't object-oriented, you're going to have a bitch of a time writing unit tests.

You've never used a functional programming language, have you?

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Clearly users is a view and friends is an aggregate column.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

baquerd posted:

Suppose we have n series of data points, for which each series can be graphed as a line. On this graph, a mouse pointer moves and in real time I need to detect whether the pointer is on top of a line. I have the happy constraint that across all series the x-axis coordinates are shared. That is to say that for any x-value for which I have data, all series will have such a data point.

This can be accomplished in O(n) by taking a first pass through any series to find the upper and lower x-axis values for the data points around the mouse pointer, then a second pass through each series to interpolate the y value of each series at the x-value of the pointer and selecting the closest one (you could get a better fit in O(n) with a third pass to ferret out the edge case with an extremely steep slope that would result closer line to the pointer but this is a good enough fit).

Just sort the data by x coordinate (if it isn't already) then do a binary search rather than a linear search?

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Oh, I misread that as n data points, not n series. Are you actually looking at drawing enough series on a single graph that interpolating between two points for each of them is even vaguely a concern? That sounds like a usability nightmare even if it is fast enough. I suppose if it's a massive graph that's pan and zoomable you might be able to get there.

One idea would be to use a quadtree rather than a grid of fixed size boxes for precomputing which series are potentially near each pixel.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
At the minimum it can cut down on wasted work by helping you find design problems before you start writing code.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

ToxicFrog posted:

Because otherwise the students in the co-op program will be unhireable (it's not like anyone actually uses Python in the real world, right?), and we don't have the budget to make C and Java addon courses for the co-op students rather making them the introductory courses for everyone. :pseudo:

No, seriously, that's the reasoning they give here.
I've actually seen co-op hirability used as an argument for teaching Scheme in the intro classes - the logic being that they'd had 100% placement for a few years, so the school should be focusing on getting the students good jobs rather than any job at all, and companies that like to see Scheme on a resume are probably better places to work.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Probably not. The icons aren't directly associated with a creating process, so there's no way to check if the process still exists without risking unswapping it if it does.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
How you divide the responsibilities is relatively unimportant as long as you actually do so and your division isn't completely insane.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
find recurs into subdirectories by default, so find . -size -13M -exec rm {} \; should be all you need to delete all files under 13 MB in the current directory and all subdirectories.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

ZanderZ posted:

Just a silly question, but when did they make it so you could ID/Class everything in HTML? Is it a 5 feature, or has it been like that for quite some time? The other day I was happily surprised that <li id="foobar"> actually worked when applying styles.
When id and class were first added in HTML 4. They never were specific to a subset of elements.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
It depends on the school. At mine the Masters program was basically a slightly more advanced version of the undergrad degree crammed into fewer years and was mostly targeted at people with an undergrad degree in a different field or from a terrible school, but I do know a few people who got Masters degrees in CS by dropping out of PhD programs.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Two of the four comments mention things that the code is not actually doing.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Goat Bastard posted:

Why? What specific thing are you trying to achieve?
Cheating or avoiding RSI in a game is the obvious thing.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
a year of low-volume mysql hosting should not cost more than an hour of your time

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Objective-C code:
int intParam = [[strparams objectAtIndex:index] intValue];
[params replaceObjectAtIndex:index withObject:[NSNumber numberWithInt:intParam]];

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Coca Koala posted:

You process the *, and it's an operator. So you pop everything on the stack, which means now you're looking at the +. The + is an operator of lower precedence than the *, so you cease popping items from the stack, enqueue the +, and push the * on the stack.
Step #3 is not worded very well. You stop popping once the top of the stack has lower precedence that the current operator, which in this case is true before you pop anything so you don't pop and enqueue the +.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

KNITS MY FEEDS posted:

For iPhone apps, if you have a developer account, you can register the UDIDs of the devices to authorize them for testing your app on. You have to format the phones though...
I didn't have to format my phone to add it to my developer account :confused:

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

oRenj9 posted:

This should probably go in the homework help thread, but I figured this one attracts more attention.

I'm using Dr Racket to do some development. I have this piece of code that should work, but it doesn't. It is throwing an error despite me using a perfectly legal command.

code:
(define (transpose list) 
  (map (lambda (n1 n2)
         (cons n1 n2))
       (car list)
       (cadr list)
  )
)

(transpose '((1 2) (3 4)))
Now, when I run this, I get an error message that says, "cons: second argument must be a list, but received 1 and 3." But, when I look at this, it says that "The cons function actually accepts any two values, not just a list for the second argument." That indicates that this method should work. What am I doing wrong?

I'm in Advanced Student mode, if that helps. I also tried replacing cons with list, but that resulted in a different error, something about requiring an expression after an open parenthesis.
The student languages are not Racket; there's a bunch of occasionally useful but mostly just confusing things that are forbidden in them, such as improper lists (i.e. cons with something other than a cons or empty in the second position). Naturally, the homework assignments never need or noticeably benefit from the forbidden things.

Your main problem is that you made a very poor choice when naming your function's argument.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
WCF makes SOAP relatively easy if you view the fact that it uses SOAP as an implementation detail that you never try to take advantage of in any way.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
If you want a really terrible job that isn't any easier to get or better paying than a decent job then learning COBOL is a good idea.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Discrete Math is a very broad category of topics and in practice the class is often basically Remedial Everything since a quarter simply isn't enough time to go into depth in any of them. There's a good chance you already know half of the things that the class will cover, but it won't be the same half as any of the other students.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Zhentar posted:

Virtual memory was added to Windows 3.0, in 1990, so you get a fair bit more than just one decade.
A decade ago you could still run out of virtual memory before running out of address space, though.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Jewel posted:

Because in most languages something like Class : ChildClass is pretty much only for inheritance, and having something completely out of brackets and just.. there, is weird. You're declaring a variable so why have it completely unlike every other variable declaration in all of c++, yet alone all other languages? :confused:
C# uses the exact same syntax for base class initialization. Most languages have no need for an equivalent to initializer lists because they don't support value semantics for objects.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
In general the only time you should store something you can calculate is if calculating it is too slow.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

biochemist posted:

and then for each dead pixel, you lose all of the starting positions north and west of the dead pixel by the width and height of the image (unless they go outside of X=0 or Y=0).
You also have to handle dead pixels which are fewer pixels than the image size apart.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

mobby_6kl posted:

Didn't we use to have a parsing thread or something like that?

I have some ugly generated SQL code with a bunch of nested switch statements which unnecessarily make a huge mess out of everything and make the code incomprehensible to humans. The final result is 1/0, but the rest of the monstrosity can look like this:

It seems like this can be usually simplified to something sensible like CASE WHEN FOO.BAR BETWEEN 2 AND 5000 THEN 1. I know enough not to use regexes here, but I have no background in parsing. Actual programming in C/Perl/Whatever isn't a problem. Any suggestions where to start to get this done in a reasonable amount of time?
tef is absolutely correct, but if fixing the generator is completely impossible, then I would be inclined to just make some very specifically targeted replacements with regexs (fixing the whitespace and using BETWEEN would be completely trivial there), and then reassessing if the end result is still worth putting a ton more effort into.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Mr. Crow posted:

Doing my first contract job, in general for contract work, is it unheard of for you to be able to use your own hardware and software (barring necessities) for the work or is it something common?
There's some exceptions, but in general the only time you don't use your own equipement as a contractor is if they're basically treating you as a FTE that's cheaper and easier to get rid of.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Install Visual Studio versions in release order or you might run into goofy installer issues. Otherwise I've had no problems with having 2008, 2010 and 2012 installed and switching between them regularly.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Mr. Crow posted:

More contractor-ish related questions...

How the hell do you afford all this software for your own use (primarily looking at VS, though maybe that's the outlier)? Do you get your clients to pay for it or something?

Keep in mind that software is a business expense, and therefore effectively half-price. Beyond that, the general answer is "charge enough money to be able to afford it".

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Delightfully insane covers is a longstanding tradition for CS textbooks.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Mr. Crow posted:

Like the '...' character Word adds, the 'smart quotes' characters, the em/en-dash characters etc. Basically having problems with content/designers copy+pasting from word and then some characters are being garbled in the web page.
There's two main steps. First, make sure the browser is sending UTF-8. Next, don't gently caress it up on your end. The first step can be done by ensuring that the form data can only be represented by a Unicode encoding (rails uses a hidden "utf8=✓" form field for this). The second step consists of finding what part of your application is loving things up, and fixing it.

Trying to fix corrupted data after the fact is nearly always the wrong approach.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Different working directory?

Adbot
ADBOT LOVES YOU

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Profile your code then make the slow parts faster.

Most appengine-specific optimizations are related to improving your use of the datastore, which generally doesn't directly effect your frontend instance costs much.

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