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.
 
  • Locked thread
FamDav
Mar 29, 2008
if i did it i would use smalltalk so i could pass a few messages before i went

Adbot
ADBOT LOVES YOU

FamDav
Mar 29, 2008

VanillaKid posted:

Simon Peyton Jones :swoon:

i would put on a first date with spj.

FamDav
Mar 29, 2008

Socracheese posted:

im coding c for the first time in a while for a class and its p cool that you get to be so explicit with ur bits and stuff but hoooo boy its a pain in the rear end to do stuff that would take 5 seconds in python

I started putting in a bunch of #define things to all the boilerplate stuff like for loops and traversing linked lists and then I realized I'm basically re-inventing lovely python

if youre going to do that you might as well use something like cello and just go crazy with type classes.

a c preprocessor with additional syntax for type classes would be p cool, actually.

FamDav
Mar 29, 2008
i think that's the function from which he got the array's problem though

FamDav
Mar 29, 2008

Zlodo posted:

you surely meant

for( auto&& thing : myList )

ftfy (which is interesting because in other cases universal references will not do lifetime extension correctly like with an xvalue)

FamDav
Mar 29, 2008
c++ has

lvalue
rvalue
xvalue
prvalue
glvalue

can you tell me what each one is

FamDav
Mar 29, 2008
if you gay boys want to hear some c++ threading knowledge i guess lusten to this

http://channel9.msdn.com/Shows/Going+Deep/C-and-Beyond-2012-Herb-Sutter-Concurrency-and-Parallelism

FamDav
Mar 29, 2008

Bloody posted:

c thread s: implemented some simple boost::threading in my thing. compiles but needs testing. gently caress thread pools, i keep track of my threads in a vector and throw out used ones when they're done. when each thread will be running for at least ten minutes of 100% cpu work i don't care about whatever that overhead might be.

now i have to think about how i get my program output out of these threads

gently caress

do you not have a c++11 enabled compiler or what

just split up your work, push back async calls to your work into a vector of futures, then wait on every future.

FamDav
Mar 29, 2008

Nomnom Cookie posted:

futures are dumb use promises

one of the rare blatantly wrong and uninformed posts in the pos

FamDav
Mar 29, 2008
heres the basic outline of your code if you would just stop being ridiculous and use c++11

code:

vector<future<result>> results;

for (some iterable that splits up work)
{
	results.push_back(async([=] { code for a particular thread to run; }));
}

for ( auto&& r : results) r.wait() // so i can make sure all of my tasks have completed

// do stuff with results

FamDav
Mar 29, 2008

MrMoo posted:

They asked yesterday what is 224? I blasphemed and opened up Windows Calculator ...

Unfortunately I worked out two ways to calculate it in my head afterwards.

1000000000000000000000000

FamDav
Mar 29, 2008

coffeetable posted:

out of interest how long has it historically taken to for production languages to Do A Thing Right once a niche academic lang has done it

Lisp has lambdas and is from 1958. C++ got them last year.

FamDav
Mar 29, 2008

gucci void main posted:

"lambdas are unnecessary"

Make like a hitler clone and go to Brazil

FamDav
Mar 29, 2008

JewKiller 3000 posted:

if you can't define the function swap so that the assert passes, your language does not have pass by reference

You can write a swap for non-primitives in java

EDIT: which jives totes mcgotes with your statement, but still

FamDav fucked around with this message at 07:18 on Sep 24, 2013

FamDav
Mar 29, 2008

Notorious b.s.d. posted:

nope you can't

the references you change will only be your local ones, because java is always pass by value at all times.

c# permits pass by name ("out" parameters), but java does not

are you telling me that this mostly java

code:

class MyClass
{
	public int x;
}

void swap(MyClass a, MyClass b)
{
	int tmp = a.x;
	a.x = b.x;
	b.x = tmp;
}
doesn't swap the contents of a and b

FamDav
Mar 29, 2008

Doc Block posted:

this x1000

[object pleaseDoAThingWith:[SomeClass objectWithFile:filename]];

is so much better than C++.

I always chuckle when C++ programmers complain about objective C's use of square brackets while C++ code looks like someone just randomly mashed the angle bracket, colon, and underscore keys on their keyboard.

sorry did you stroke out mid post because wtf is that poo poo

FamDav
Mar 29, 2008
yeah but stallman is a double human being soooooooooo

FamDav
Mar 29, 2008

Aatrek posted:

Come 'round here, I've got good stuff. is weird looking, but fun.

FamDav
Mar 29, 2008

gucci void main posted:

ive just recently been thinking about playing around with django again since i could have case for doing so, but i'm not sure how much enjoyment i'd get of it. i haven't touched it or python in well over a year and a half at this point

anyone else notice how the poo poo tier types talk about "playing around" with things while the pro tier types just do poo poo

FamDav
Mar 29, 2008

Shaggar posted:

all man style, hard tabs only

plz dont post my favorite dubstep genre in this thread

FamDav
Mar 29, 2008
elixir blows erlang blows your mom blows

FamDav
Mar 29, 2008
coffee table do you have a job yet

FamDav
Mar 29, 2008
you either got const strings or const bitches

or something like that

FamDav
Mar 29, 2008
also always postpend const

char const * const supremacy

FamDav
Mar 29, 2008

AlsoD posted:

presumably this is a 20 year old argument but 'char* file_name' seems to make so much more sense than anything else to me. you have the type (pointer to char) and then the name. then you have stuff like 'int *p1, *p2' as opposed to 'int* p1, p2' as it should be imo. being a pointer is a property of the type, not the name!

but then, as established, i am a terrible and novice c programmer

AlsoD was right

FamDav
Mar 29, 2008
c was designed by a guy who wrote ed

FamDav
Mar 29, 2008

coffeetable posted:

amen

all my work today has been writing data visualization code so i can work out where this thing is going off the rails

this is actually cool and we built something at old work to visualize searches to see when it was making GBS threads the bed.

it was really cool when you could see it broke and just defaulted to a bfs. pretty patterns dawg.

FamDav
Mar 29, 2008

coffeetable posted:

just finished up a day of learning javascript

jfc :stare: how is the internet still even working when it's running on this poo poo

uhh my internet runs on c++, java, and oddly maybe some prolog every once in a blue moon.

i imagine when im hitting some startups poo poo there might even be a little erlang in there.

FamDav
Mar 29, 2008
that's because js is a poo poo language where you implicitly take references to local mutable values and the only way to construct copies is through function scoping like a goddamn dog.

FamDav
Mar 29, 2008
learn a hashmap/table/whatever so you can say "well if i just used a hashmap intsead it'd be faster but then i'd use more space i dunno man what do you want from me let me suck your dick ill do it no dont act gay about it just let me do it come on man slap that dick in my hand yeah feels good dont it poo poo look at it squirm all warm and poo poo no dont worry im cool yo you got any disesase tho"

FamDav
Mar 29, 2008
dont make it weird

FamDav
Mar 29, 2008
isnt the right answer "how dare you speak to me you cj" and go back to coding up your bespoke runtime configuration system for c based around xml macros

FamDav
Mar 29, 2008

Innocent Bystander posted:

a guy asks for a algorithm book and cormen doesn't even get brought up?

also, I got asked this question at two different shops: Find the intersection between two strings (in C). What is its runtime? If I gave an O(n) solution, they would ask me to give a O(n^2) solution, if I gave an O(n^2) solution they asked me to do it in O(n). hth

you mean where the prefix of one is the suffix of the other? or like can a string be a substring of another.

FamDav
Mar 29, 2008

Innocent Bystander posted:

ah yes, that was a bit vague

it was find the set of characters found in string 1 and in string 2. return it! (exclamation was my emphasis)

are you talking longest common subsequence or are actually the set of characters.

FamDav
Mar 29, 2008

Innocent Bystander posted:

the set, not longest common subsequence. its not a hard problem. can you find longest common subsequence in O(n)?

no which is what had me confused.

you can find it in n^2 with extra space

FamDav
Mar 29, 2008

Awia posted:

so i want to write some sort of image filter thing to make images look like the original gameboy screen which had a weird 2 bit monochrome swamp green display
the trouble being i#ve no idea how to start going about this

like, i think i can convert an image to 2 bit monochrome easy enough its just the weird green colour thats im not sure about
also the gameboy has small gaps between its pixels i dont even know how to go about doing, a graphics shader maybe?

for 2 bit monochrome, you want to threshold on pixel color.

for spacing, you probably first want to down sample the image then set like every nth row and column of pixels to off, or you could space everything out.

FamDav
Mar 29, 2008
droopy code be like droopy pussy

touched by too many people and STANKY

FamDav
Mar 29, 2008
coffeetable when are you gonna start interviewing

move to seattle its the only way

FamDav
Mar 29, 2008

Dessert Rose posted:

i can't decide whether it's my boobs or the T in my title that causes people to just dismiss everything i'm saying but it's extremely irritating

i dunno most of the fat dudes ive worked with have been effective

Adbot
ADBOT LOVES YOU

FamDav
Mar 29, 2008
i have to imagine every time i run across a test on a model which goes

code:
assertNull(model.getThing());
model.setThing(aThing);
assertEquals(aThing, model.getThing());
that intelliclipse auto-generated this because serious man what a waste of loving space.

you should ideally structure your code so that the IO bits can be tested against real services and then the rest can retrieve mocked data. MYSPB (Make Your poo poo Pure Brah).

  • Locked thread