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
Nomnom Cookie
Aug 30, 2009



ComradeCosmobot posted:

never mind that you have to carry around pointers with every data element which you don't have to do with a vector and a pointer to the top of said "stack"

then you only have to worry about reallocating a vector if your stack grows too large

same goes for queues if you can tolerate a hard cap on the number of items in the queue just loop over the spaces in the vector to save the pointers and keep cache locality on the items in your queue

i mean, it's not like your call stack is implemented as a linked list

it actually is though if you have frame pointers

Adbot
ADBOT LOVES YOU

Nomnom Cookie
Aug 30, 2009



Arcsech posted:

what implementation is significantly better for a pure stack (ie one that only implements push and pop and is never accessed in the middle) than a linked list

are you loving serious. are you so loving clueless that you made this post

gently caress

Nomnom Cookie
Aug 30, 2009



USSMICHELLEBACHMAN posted:

as an interloper in the terrible programmer thread the impetus is on you to explain why someone might be a bad programmer and help them out a little in a nice way. this kind of posting is contrary to the spirit of the thread

sorry. sorry, arcsech. i was mic fitting pretty bad when i wrote that

Nomnom Cookie
Aug 30, 2009



Eat a brick

Nomnom Cookie
Aug 30, 2009



USSMICHELLEBACHMAN posted:

what's a frame and follow up what's a frame pointer?

http://duartes.org/gustavo/blog/post/journey-to-the-stack/

lots of good poo poo on that blog

also http://www.akkadia.org/drepper/cpumemory.pdf

not super related but deffo good poo poo

Nomnom Cookie
Aug 30, 2009



BONGHITZ posted:

so, what is the best way to implement a stack?

an array. use arrays for as many things as possible. random reads from RAM are slow as hell compared to sequential. every L2 cache miss is a traffic jam on the 8-lane freeway that's a modern cpu's execution pipeline :iiaca:

Nomnom Cookie
Aug 30, 2009



Luigi Thirty posted:

dearest yospos is it a good sign when you send your resume to a local company on craigslist at 9pm and one of their engineering managers sends you an email an hour later saying that your resume is interesting and they want to talk to you

i think they make surgery recording systems or something

it means your resume didn't have to go through HR first. thats good i guess. also the guy thinks your resume is interesting. that deffo a good sign

Nomnom Cookie
Aug 30, 2009



Bloody posted:

if you good at 1 lang learning another lang is easy
because he love workin or happens to have checked he mail
wasnt it like a craigslist posting? doesnt strike me as a high-traffic recruitment tool
probably not

unless theyre real small they have hr, theres a lot of work in labor law compliance once you have big company things like a bunch of benefits and jackasses making hiring/firing decisions

Nomnom Cookie
Aug 30, 2009



AlsoD posted:

then there's the typeclass related ones which mostly just take the form of "no instance of <typeclass> arising from the literal <literal>". typeclasses are essentially OO's interfaces

i've had terrible problems decoding XMonad type errors. afaict its because some XMonad contribs require language extensions. some inscrutable poo poo about typeclass instances related to type variables in the instance declaration iirc. w/e i copied the extension directives from the example config and it worked

Nomnom Cookie
Aug 30, 2009



Shaggar posted:

so a lil bit about lambdas. lambda syntax in c# is basically just shorthand for writing a function. in the case of x=>!String.IsNullOrWhitespace(x) that is the equivalent of writing

C# code:
delegate(String x)
{
	return !String.IsNullOrWhitespace(x)
}
so what is a delegate? Delegates are what separates c# from the uncivilized heathens of dynamic garbolangs. delegates are sort of like function pointers but way better because they are type safe.

So lets go back to select. What the heck are we actually doing inside those parenthesis?? Well its like all other methods. we are passing an argument to Select, but it just so happens to be a function instead of an object!!! what the gently caress? that is weird!

if you look closer in vs you will see the type parameter in intellesense for the previous select example is Select(Func<string,bool> predicate) . Func is a generic delegate in c# and u'll see it all the time. Func represents a pointer to a method that takes in a parameter of type String and returns a value of type bool.

So something like this:
C# code:

bool NotNullOrWhitespace(String s)
{
	return !String.IsNullOrWhitespace(s)
}
Would match that signature. We could pass NotNullOrWhitespace directly into the select like this

C# code:
	IEnumerable<String> nonEmptyStrings = listOfStrings.Where(NotNullOrWhitespace);
Since linq is expecting a method that matches the signature Func<string,bool> it accepts this and compiles because we are being type safe!!! if you were to add or remove parameters to NotNullOrWhitespace it would not compile because it does match the signature of func<string,bool> and the compiler would not have any idea what u are doing!

We can also do something like this
C# code:

private Func<String,bool> notNullOrWhitespace =  x=> !String.IsNullOrWhitespace(x); 

public whateverSomeMethod()
{
//do whatever
	IEnumerable<String> nonEmptyStrings = listOfStrings.Where(notNullOrWhitespace );
//do more whatever
}

public whateverSomeOtherMethod()
{
//do something different but still want to filter strings
	IEnumerable<String> nonEmptyStrings = listOfStrings.Where(notNullOrWhitespace );
//do more whatever
}

Now we have a reusable function for NotIsNullOrWhiteSpace!!! This is really stupid and you will never find anyone who actually does that tho. Its just to demonstrate that u can assign delegates to variables or fields (as in this example) and then pass them off to methods like they were just regular old parameters.

function pointers are type safe to the extent that anything is type safe in C. the big honkin difference is that delegates can have state and the compiler leverages this to provide simple syntax for poo poo thats a huge pita in C. ofc every language feature can be emulated by a sufficiently determined C programmer which is why callbacks almost always have an extra void* for passing state

Nomnom Cookie
Aug 30, 2009



ShadowHawk posted:

YOSPOS I have tried to "not learn" Javascript like 4 times now using various x-to-javascript translators and they're all inadequate and now I'm learning Javascript from scratch and all the tutorials act like I want to learn baby's first programming language

it's like C except everything is shittier except it has anonymous functions and lexical scope

Nomnom Cookie
Aug 30, 2009



my stepdads beer posted:

whats a good spring mvc tutorial the ones on spring.io want me to build a rest service or consume some soap

i learned spring mvc from the spring manual and that was ok. if you're already familiar with spring, the only thing you need to understand is @RequestMapping. not that there isn't a lot more to spring mvc, and if you learn it my way you'll come back to your early projects and cringe, but if you understand @RequestMapping you can do a thing with spring mvc and pick up the rest as you go

Nomnom Cookie
Aug 30, 2009



Notorious b.s.d. posted:

also no matter what you do, even if it's fpm, build your package in a clean chroot.

unwitting contamination from the host system is like the #1 way to gently caress up an rpm. there are shitloads of ways to do it. configure/make scripts are really drat good at finding the host's libraries and depending on them.

automagic dependency selection is the devil's build script

Nomnom Cookie
Aug 30, 2009



Notorious b.s.d. posted:

your life will be much easier if you abandon this line of inquiry, and go find a specfile or SRPM written by someone else. "shortcuts" to packaging almost always make life worse rather than better.

specfiles kinda suck and getting started with rpm packaging definitely sucks. but theres no part of a specfile with a reasonable cross-distro default. you just gotta bite the bullet and write the specfile. i imagine its much the same with debs

Nomnom Cookie
Aug 30, 2009



it makes prototypes work properly, right? if you call [1, 2, 3].each() the method is found on Array.prototype but this will be the literal array

and non-var variables are actually properties on window so that's where that comes from

what i want to know is what happens if you do this:

JavaScript code:
window.a = "butts";
function obj() {
    this.a = 1
    this.make = function () {
        return function () {
            return this.a 
        }
    }
}

var o = new obj(); 
var g = o.make();
g()

Nomnom Cookie
Aug 30, 2009



Dessert Rose posted:

let me just ask a question about what happens when you do a thing in a programming language which is implemented by the thing I'm using to ask the question

just loving type it into the console and see

no i'd really rather someone else do it

Nomnom Cookie
Aug 30, 2009



tef posted:

well it's been a long while since i looked at java, so my memory is hazy, and it was off topic

but java didn't have dynamic dispatch originally, so i didn't think it right to lump it with the rubys and the smalltalks. under the scenes the jvm is doing lookup with fully qualified method names, although invoke dynamic confuses things a bit. and method handles.

there really isn't a meta object protocol, or a notion of sending a message, or symbols in Java, and in java you can access the attributes of an instance. it's sorta sorta structural, except that java doesn't really have functions yet*, so you don't have the whole x = obj.f; x() thing.

whatever. it wasn't really relevant to explaining the accidental? design around javascript's methods that sorta act like functions, and dynamic this.

i mean, who knows. the whole everything is bound to window by default was probably some quick hack to make a feature work. or functions were added first before prototypes were. i mean who knows what brendan eich was doing. iirc prototypes were included as a gently caress java.


* or whatever project coin and poo poo is happening

gonna have to nit you here and point out that the jvm deffo does do dynamic dispatch, that's the point of invokevirtual vs invokespecial. but it doesn't do late binding

Nomnom Cookie
Aug 30, 2009



tef posted:

- share nothing, but oh no ~latency~ from copying poo poo who cares, get it working first and then try and build a broken locking version

or just avoid the copies and declare "hell be upon ye who shall modify thy messages after ye send"

Nomnom Cookie
Aug 30, 2009



maven schemas are documented, editing poms in intellij is fuckin sw8

Nomnom Cookie
Aug 30, 2009



Notorious b.s.d. posted:

at some point i realized i am a terrible programmer. threads and locking are where monsters dwell.

the only times i use concurrency OR parallelism is when a library does it for me. e.g. dispatching tasks to threadpools, handling http requests in threads.

if i ever invoke a locking primitive or spawn a thread by hand the hair rises on the back of my neck.

handling synchronization myself has only ever led to pain and regret. if it seems like a threadpool wont handle my concurrency needs, generally the best thing is to reshape my problem until it will

Nomnom Cookie
Aug 30, 2009



Luigi Thirty posted:

shockingly, company that wants to hire people who know c# doesn't want to hire me because i don't know c#

they said they'd be glad to talk to me again after their current project is over though!!! in november lol

i'm still really depressed because it's the only tech job that's interviewed me within 40 miles

we totally are just looking for smart, motivated people who can learn what they need to do the job

oh wait after we interviewed you 4 times we realized that this would mean you don't already know everything you need to know to do the job. no thanks

Nomnom Cookie
Aug 30, 2009



is there a good resource on making web pages that arent retarded. because i have to do a web at work and it's retarded and i'm retarded and i can feel the tech debt piling up. today i committed some JS that works but i don't know why and i dont care enough to figure it out. someone tell me how to make webs the right way

and i have to use php so telling me to use razor and knockoutjs isnt gonna fly

Nomnom Cookie
Aug 30, 2009



the php is actually going ok and the retardedness on the server is mostly under control. but i have to add features to a jquery form thing with tables and inline css everywhere. it was written by an intern if that helps to understand the problem i'm facing. it's like the idiot child of 1995 and single page webapps

so

how do i make it sane. preferably doing as little work as possible

Nomnom Cookie
Aug 30, 2009



Socracheese posted:

no you dont get it, thats exactly how php webdev plays out. you could i guess import your work into some php content management system but literally every single one is garbage and it sounds like you'd lose or be forced to rewrite a lot of your stuff at this point.

lmao, tables and inline css.

the only fix is a rope and a sturdy rafter

i was hoping for something more reassuring like "use angularjs it will totally fix everything"

Nomnom Cookie
Aug 30, 2009



USSMICHELLEBACHMAN posted:

you either a) rip everything out and start over or b) add more tables, jquery, and inline css until it does what it's supposed to and let the next person worry about it.

i'm going with b but the team has reached consensus that i'm the sme on this pile of poo poo. more like no one else will admit to knowledge of php or js. the next person is overwhelmingly likely to be me, or me walking someone through making the changes they need

the problem is by now it's an iceberg page where 90% of the elements are display: none and just about every time a user clicks some JS runs and alters the set of visible elements

surely there's a better way

Nomnom Cookie
Aug 30, 2009



EAT THE EGGS RICOLA posted:

help i can't get my boss to use version control what do i do our files are all saved with "backups" named like form.html, formgood.html, formold.html, formbak.html, formbak2.html

on a production server

you can even access the old versions by going to that url

dd if=/dev/null of=/dev/sda bs=512

oh poo poo boss everything's hosed, if only we'd used subversion

Nomnom Cookie
Aug 30, 2009



azure duh

Nomnom Cookie
Aug 30, 2009



gently caress them posted:

I keep emitting xml when I want JSON. I've decorated everything and edited my web config.

WCF doesn't like me today.

I'm stuck in a meeting the rest of the day.

Damnit.

keep searching stack overflow i'm sure you'll come up with something

Nomnom Cookie
Aug 30, 2009



Squinty Applebottom posted:

In this moment, I am euphoric. Not because of any phony god's blessing. But because I am using clustered index seeks.

whats the use case for a clustered index, i've never run into a situation where seeks to fetch rows were a big part of execution time. table scans, big problem

Nomnom Cookie
Aug 30, 2009



gently caress them posted:

I thought you were just Java but ok let's try some .NET

I tried decorating with WebInvoke setting the method, request format, response format, and uritemplate.

I also went through the litany of settings in webconfig.

dunno man i just put jackson on the classpath, annotate the controller class with @RestController, and return pojos from my controller methods

a little config fuckery is required if i want to ensure clients only ever get json cause spring likes to autodetect the poo poo out of everything and it'll probably produce csv if you don't tell it not to. but that's a cross i just have to bear

i found all this out by reading the docs and the source. like maybe do find usages on webinvoke and see how MVC is processing it & deciding what format to send the response

Nomnom Cookie
Aug 30, 2009



Squinty Applebottom posted:

clustered indexes determine the physical order in which your data is stored on the hard drive. your databases are tiny babby databases if a proper clustered index isn't a concern

maybe if you have a where clause with a high match rate then a clustered index will help? what im saying is that ime 99% of queries either select <1k rows or table scan. table scan might be because of missing index or it might be because theres no where clause.

what im trying to envision is a scenario where a regular index isnt good enough and a clustered index will give a significant perf boost

Nomnom Cookie
Aug 30, 2009



Squinty Applebottom posted:

you need info for resourceid = 509 out of 1 billion

clustered indexes will be orders of magnitude more performant, especially if you start joining on resourceid between tables

well either way you have to do an index lookup. with a clustered index now you have your data. with a regular index you have to do up to one more seek to get the row from the block cache. it will help if you do a super ridiculous amount of primary key lookups and have a low hit rate on the block cache. this isn't something i've ever run into, that's all

Nomnom Cookie
Aug 30, 2009



gently caress them posted:

I wasn't doing MVC.

I was trying to work with a old .NET 2.0 forms thing. Sr Dev doesn't do MVC and nobody else there does either. Then again right now he's the ONLY other programmer. By the way, I've read the documentation, and stack overflow, and none of it worked. I built, rebuilt, cleaned, checked assemblies, restarted VS, restarted my machine, did all the voodoo I can think of, and welp nope.

I busted out fiddler, went through the motions, kept seeing my poo poo wrapped up in xml. POST, GET, content type, all that poo poo.

No CSV though, lol.

I'm just going to do it in loving MVC, because I've done this in MVC before. Goddamn. I did this exact loving thing all day thoughtlessly.

I know there's SOME config thing somewhere, and I was wondering if anyone else had ran into this, but I guess everyone would rather just assume "pee pee doo doo lazy/bad/lazybad programmer" because we're all bitter loving goons.


w-wat about hash j-joins??

is there weed

what i'm suggesting is to step through ASP.NET with a debugger as it builds the response. or does MS not let you see the source lol

Nomnom Cookie
Aug 30, 2009



so like return a poco and let asp.net turn it into json

Nomnom Cookie
Aug 30, 2009



i'm getting this sense that you're reading posts entirely different from the ones i've written. and also that you're drunk

Nomnom Cookie
Aug 30, 2009



c++ has features that copy data automatically, and features to avoid automatically copying data. c++ programmers decide what mix of features to employ when writing a program and believe that this constitutes reasoning about performance

Nomnom Cookie
Aug 30, 2009



tef posted:

(yep, there's a lot of crud there but it advocates building systems out of a component architecture, but a radically simpler one based around binary streams between chunks)

the loose coupling part of The Unix Philosophy* is good. the fetishizing of byte streams and the utopian ideal of a single namespace with identical semantics for all members, not so good. i think the useful principle you can extract from that is to use the dumbest transport which will get the job done

* haven't read the book, just going by the rantings of kooks on LWN and reddit

Nomnom Cookie
Aug 30, 2009



except that jax-rs is a thing and free

Adbot
ADBOT LOVES YOU

Nomnom Cookie
Aug 30, 2009



the only bad thing about jmx is its so old it uses rmi

  • Locked thread