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



Pie Colony posted:

c++14 thankfully

seconding that you need to find resources targeted at c++11 at a minimum. stackoverflow probably has a list of poo poo to read

templates are a big thing in c++ and trying to understand them from a c or java perspective will fail. those are my main languages as well and if I needed to be actually good at c++ i'd get a book on templates

Adbot
ADBOT LOVES YOU

Ciaphas
Nov 20, 2005

> BEWARE, COWARD :ovr:


do you still have to do dumb workarounds with template impls and header files to make compiling and linking work properly, or has that been fixed since C++11/as build systems have improved, too

i remember something like either putting implementation(s) in the header file (which i'd rather do anyway organizationally, tbh; C# has made me hate .h files) OR you have to include the .cpp file from the bottom of the .h or something

Nomnom Cookie
Aug 30, 2009



Ciaphas posted:

do you still have to do dumb workarounds with template impls and header files to make compiling and linking work properly, or has that been fixed since C++11/as build systems have improved, too

i remember something like either putting implementation(s) in the header file (which i'd rather do anyway organizationally, tbh; C# has made me hate .h files) OR you have to include the .cpp file from the bottom of the .h or something

c++ is supposed to get modules eventually but millenials killed it. at least i assume we have succeeded by now cause that post is from a year ago. sorry

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
looking for jobs again. thinking about trying to go for a small corp to hopefully weather the recession.

also just thinking about trying to find the most money i can to milk it.


either way i'm trying to find a job where i dont need to kill myself and can just do my job and be happy. feeling good about it. my mental state has improved significantly.

gonadic io
Feb 16, 2011

>>=
looks like 2019 is the new year of the job!!!

cinci zoo sniper
Mar 15, 2013




DONT THREAD ON ME posted:

looking for jobs again. thinking about trying to go for a small corp to hopefully weather the recession.

also just thinking about trying to find the most money i can to milk it.


either way i'm trying to find a job where i dont need to kill myself and can just do my job and be happy. feeling good about it. my mental state has improved significantly.

the most money to milk and feeling good about your company seem to be polar opposites. like, i don’t think i could find a better paying gig right now, by a mile, but i primarily work on payday loans

cinci zoo sniper
Mar 15, 2013




thankfully i forgot my moral compass at parent’s home

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
kinda thinking about getting into ios dev.

pros:
1. maybe more interesting than web dev:
- more constraints (battery, etc). i'd like more experience with caring about performance beyond io.
- i get to reason about a single runtime. i've only had to think about the runtime of a webserver and that gets boring after a while.

2. lots of crossover with my current skillset, since designing a backend for a native client is really not all that different from an http/js client.

3. pay seems good.

4. swift is rad.

cons:

1. i'm really not a heavy or advanced user of mobile devices.

2. i don't care about apps.

3. ???

thoughts?

cinci zoo sniper
Mar 15, 2013




what’s the proportion of swift shops vs whatever is the react native of current year

CRIP EATIN BREAD
Jun 24, 2002

Hey stop worrying bout my acting bitch, and worry about your WACK ass music. In the mean time... Eat a hot bowl of Dicks! Ice T



Soiled Meat
using anything but the native toolkit on a mobile platform is a surefire way to make the worst product possible

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

Ciaphas posted:

do you still have to do dumb workarounds with template impls and header files to make compiling and linking work properly, or has that been fixed since C++11/as build systems have improved, too

i remember something like either putting implementation(s) in the header file (which i'd rather do anyway organizationally, tbh; C# has made me hate .h files) OR you have to include the .cpp file from the bottom of the .h or something

completely separating template interfaces and implementations has been tried (the "export" keyword) and unanimously rejected by all compiler writers for being extremely hard to implement and making C++ incompatible with conventional linkers. exactly one vendor implemented it and even they advocated for the removal of the feature from the standard

that said, some separation is still possible, and the right way depends on what's the reason for the separation

binary compatibility/ABI stability? "flatten" the ABI as a set of virtual classes and plain functions, possibly even extern "C" functions. lots of C++ libraries do this including all C++ runtime libraries. as a bonus, it can minimize code size explosion, for example in STLPort (an old compiler-independent implementation of the standard c++ library) all specializations of set and map were funneled through a single common R/B tree implementation written in C

reducing (although not minimizing) build times and code duplication? explicitly instantiate your templates for the most common sets of parameters. the explicit instantiations can then even be exported and imported from dlls (as always, it helps to think of templates as compile-time functions that generate perfectly standard C++ classes/functions that you could write yourself manually)

separation of interface and implementation? only the "flattening" idiom guarantees it. explicit instantiation can do it, at the cost of making not explicitly instantiated specializations unavailable - i.e. you have to know in advance all types your templates will be used with. it's not even that bad!

turd.h:
C++ code:
// interface-only in the header
template<class T>
struct turd {
	static T shunt();
};
turd.cpp:
C++ code:
#include "turd.h"

// implementation in the source file
template<class T> T turd<T>::shunt() {
	return T(sizeof(T));
}

// ... at a cost: only int and long turds can be shunted. other values for T
// will cause unresolved symbol errors at link time
template struct turd<int>;
template struct turd<long>;

// the two lines above are the aforementioned "explicit instantiation". think of
// it as explicitly calling the template as a function, to generate its output
// (classes turd<int> and turd<long>) at a specific place in the code. give
// [url]https://cppinsights.io[/url] a try to get a better idea of how template
// instantiation (and other "magic" c++ features) works
main.cpp:
C++ code:
#include <iostream>
#include "turd.h"

int main() {
	std::cout << turd<int>::shunt() << std::endl;
	std::cout << turd<long>::shunt() << std::endl;

	// compiles fine (interface is available) but fails to link (implementation isn't):
	// std::cout << turd<double>::shunt() << std::endl;
}
you may not like the fact that the build won't fail until linking in case you use an unimplemented specialization. you can fix that too, in a kinda gross way:

turd.h:
C++ code:
// turd<T> is now outright undefined unless specified otherwise
template<class> struct turd;

// how do we specify otherwise? by specializing turd<T> for specific values of T
template<> struct turd<int>;
template<> struct turd<long>;

// however, each specialization must be separately defined, which means code
// duplication. we'll use an old-fashioned code sharing feature:
namespace impl {
	// inheritance! impl::turd<T> takes the place of turd<T> as the definition
	// of the interface. specializations of turd<T> can inherit impl::turd<T> to
	// inherit both interface and generic implementation
	template<class T> struct turd {
		static T shunt();
	};

	// just like we explicitly instantiated turd<T> before, we now explicitly
	// instantiate impl::turd<T>
	extern template struct turd<int>;
	extern template struct turd<long>;
}

// finally, we define the turd<T> specializations declared above, as child
// classes of impl::turd<T>
template<> struct turd<int> : impl::turd<int> {};
template<> struct turd<long> : impl::turd<long> {};
turd.cpp:
C++ code:
#include "turd.h"

namespace impl {
	// just like before, except under the impl:: namespace
	template<class T> T turd<T>::shunt() {
		return T(sizeof(T));
	}

	template struct turd<int>;
	template struct turd<long>;
}
with this new version of the code, turd<double>::shunt() fails to compile, because turd<double> is an undefined type. there's still some duplication, but consider that in real-world code, the generic shunt() method is going to be much bigger, and the turd class is going to have many more methods

finally, if your goal is to completely hide the implementation of a template, forget about it. it's been rejected as a misuse of c++ and between that and the "export" tragedy, it's probably never going to be considered as a feature again

e: including the cpp from the .h is kinda pointless and equivalent to just leaving the implementation in the .h file

hackbunny fucked around with this message at 23:23 on Dec 17, 2018

Ciaphas
Nov 20, 2005

> BEWARE, COWARD :ovr:


lot of cool info, thanks

i've long forgotten: even outside of templates, why do we even care about keeping the implementation and interface in separate files? i never understood the benefit when i was learning and i frankly kinda hate doing it after being in C# land for so long

(e) i'm willing to accept "because that's how the language and compiler standards are historically put together, sorry" but i still don't see the actual code benefit :shrug:
e: nevermind, kinda remembered over the course of hours. little slow today

Ciaphas fucked around with this message at 01:20 on Dec 18, 2018

AggressivelyStupid
Jan 9, 2012

Pie Colony posted:

all of my programming opinions are for sale

Stringent
Dec 22, 2004

The internet is the universal sewer.

DONT THREAD ON ME posted:

kinda thinking about getting into ios dev.

pros:
1. maybe more interesting than web dev:
- more constraints (battery, etc). i'd like more experience with caring about performance beyond io.
- i get to reason about a single runtime. i've only had to think about the runtime of a webserver and that gets boring after a while.

2. lots of crossover with my current skillset, since designing a backend for a native client is really not all that different from an http/js client.

3. pay seems good.

4. swift is rad.

cons:

1. i'm really not a heavy or advanced user of mobile devices.

2. i don't care about apps.

3. ???

thoughts?

i transitioned from doing web backend in python to iOS a couple years ago, and i've been very happy with the switch.
by far the biggest learning curve for me was the uikit api and autolayout, the networking and storage stuff has been wonderful to work on especially since the Codable protocols came out.

VikingofRock
Aug 24, 2008





This is a really good post with a lot of neat tricks I hadn't seen before. Thanks!

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
c tp s: rewriting a SQL lateral join in python

cinci zoo sniper
Mar 15, 2013




TheFluff posted:

c tp s: rewriting a SQL lateral join in python

congrats on your for loop

redleader
Aug 18, 2005

Engage according to operational parameters

CRIP EATIN BREAD posted:

using anything but the native toolkit on a mobile platform is a surefire way to make the worst product possible

yeah op, use react native or xamarin or html/css/js in a webview

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE

cinci zoo sniper posted:

congrats on your for loop

i got away without it, managed to sell the team on the pure sql solution because everyone agreed that the python version was actually less readable/maintainable (lack of familiarity with lateral joins and maintainability concerns was the argument for not using the pure sql solution in the first place)

Corla Plankun
May 8, 2007

improve the lives of everyone
is it possible to post about the context of that lateral join or is it too hard to talk generally about without doxxing your job?

thats one of those things that i kinda know of but have never had to use or even consider using so i don't know what the good applications of it are

cinci zoo sniper
Mar 15, 2013




Corla Plankun posted:

is it possible to post about the context of that lateral join or is it too hard to talk generally about without doxxing your job?

thats one of those things that i kinda know of but have never had to use or even consider using so i don't know what the good applications of it are

laterals are useful well, for doing an operation per row, as it says on the tin. a common use case for me is to, say

table a with N entities of A per X

table b with M entities of B per X

here I use later to select all a.N-5 entities and join them up with the most recent B as of each N-5

CRIP EATIN BREAD
Jun 24, 2002

Hey stop worrying bout my acting bitch, and worry about your WACK ass music. In the mean time... Eat a hot bowl of Dicks! Ice T



Soiled Meat
yeah one of the things I use a lot is to grab the N latest entries of satellite messages from X devices in a table, and lateral joins are by far the fastest way to do it without changing the schema.

postgres owns

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

can i call myself an architect yet?

code:
public class Butt {

// ...

+     public Dictionary<string, DataTable> OtherQueriesIRanSinceIWasAlreadyDoingARemoteCallAnyway { get; set } = new Dictionary<string, DataTable>

}

// meanwhile, elsewhere...
public DataTable DoAVeryExpensiveRemoteCallToRunASimpleQuery() {

     string query = ComposeQuery(...);

+   // optimization!
+   if(myButt.OtherQueriesIRanSinceIWasAlreadyDoingARemoteCallAnyway.ContainsKey(query)) {
+        return myButt.OtherQueriesIRanSinceIWasAlreadyDoingARemoteCallAnyway[query]
+   }

     return DoAnExpensiveRemoteCallToRunThisQuery()    

animist
Aug 28, 2018

NihilCredo posted:

can i call myself an architect yet?

google cache invalidation. you'll thank me later :smuggo:

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man

Arcsech posted:

what

1) that’s not what they said and
2) you can’t do that in Java/Kotlin anyway. you CAN mix them in the same project, but not the same file.

there’s a button in IntelliJ to auto convert a java file into a Kotlin file, which is what they were referring to. it’s not bad because Kotlin is basically java with some extra syntax sugar

oh whoops misunderstood sorry

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

animist posted:

google cache invalidation. you'll thank me later :smuggo:

oh i have that, it's called alt-f4

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Phobeste posted:

oh whoops misunderstood sorry

:tipshat:

animist
Aug 28, 2018

NihilCredo posted:

oh i have that, it's called alt-f4

ah yes, the "snowpiercer" approach to software development

Ciaphas
Nov 20, 2005

> BEWARE, COWARD :ovr:


CRIP EATIN BREAD posted:

yeah one of the things I use a lot is to grab the N latest entries of satellite messages from X devices in a table, and lateral joins are by far the fastest way to do it without changing the schema.

postgres owns

oh loving lordy

again i'd have killed for this feature at work, stupid ancient (11g) version of ora

gonadic io
Feb 16, 2011

>>=
Coworker unironically suggesting that our app's exception handling should "learn" which exceptions are fatal and which aren't, as well as which exceptions are temporary in nature (it should continue to process) and which are permanently fatal (it should restart itself)

Plorkyeran
Mar 22, 2007

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

cinci zoo sniper posted:

what’s the proportion of swift shops vs whatever is the react native of current year

100% of the shops you actually want to work at are swift shops

there’s basically two categories of companies that use react native/xamarin/etc:

1. fad chasing fart huffers
2. companies with zero budget for the app who are looking for the cheapest option regardless of quality

cinci zoo sniper
Mar 15, 2013




speaking of swift, ill be doing failed attempt to code at home #27 sometime next spring and i think ill try swift this time

Ciaphas
Nov 20, 2005

> BEWARE, COWARD :ovr:


i should probably do some at home toys/projects at least so i don't feel like I'm rusting again

boo @ "working" at home, though!

cinci zoo sniper
Mar 15, 2013




Ciaphas posted:

i should probably do some at home toys/projects at least so i don't feel like I'm rusting again

boo @ "working" at home, though!

i mean, i love reading this and pl thread and hacker news etc even when its like hackbunny's 69th 800 word post in a thread about some subtleties of windows 95 gui radio menu api due to attempted kernel level mitigation of impact of gamma rays hitting the cpu, but i struggle to find it engaging to actually code something up at home, code or not

cinci zoo sniper
Mar 15, 2013




i am extremely motivated, however, to reason about or contemplate coding at home :thunk:

Ciaphas
Nov 20, 2005

> BEWARE, COWARD :ovr:


cinci zoo sniper posted:

i mean, i love reading this and pl thread and hacker news etc even when its like hackbunny's 69th 800 word post in a thread about some subtleties of windows 95 gui radio menu api due to attempted kernel level mitigation of impact of gamma rays hitting the cpu, but i struggle to find it engaging to actually code something up at home, code or not

usually i'm kind of the same at home as I am at work--i'll dawdle along slowly but eventually--long as I can focus--something will click and I'll get eight hours of ok-to-good code done in like three

then go eat a slice of pizza or something out of starvation usually

Powerful Two-Hander
Mar 10, 2004

Mods please change my name to "Tooter Skeleton" TIA.


our (ex) offshore dev's ghost continues to haunt our codebase, today there was an issue where records bypassed the checks applied before changing state and guess what, turns out that rather than use the standard methods or procedures that embed all the logical checks they had

* written the whole servers side methods by copy and pasting from other methods so there were unused or irrelevant variables everywhere

*data tables everywhere. why store a list of concrete objects when you can store an anonymous data blob and manually cast every value when you need it? the casting code was c&p'd 3 separate times

*passed every single loving thing from the controller to the view via Viewbag or user session with illuminating names like "path" (there were no paths used...)

* loaded posted files into the user session as objects then never used them ever again

*wrote a new set of database functions and procs that copy and pasted from the existing ones but also hosed it up. These immediately became out of date so don't handle any case added since. they also took every input as a comma separated string of up to 8000 characters (inexplicably checked for length <7500 elsewhere) because loops are hard apparently.

*rather than use the existing update procs just yolo'd in direct table updates which bypassed the rest of the checks and hosed up more data

*this is my favourite: performed every single logical test by returning a magic string from the db and checking its value, not even just "true" or whatever but poo poo like if(caniDoIt = "yes you can go ahead")

it takes loving effort to be this bad and I wish I was a moron so I wouldn't care

gonadic io
Feb 16, 2011

>>=

Powerful Two-Hander posted:

*this is my favourite: performed every single logical test by returning a magic string from the db and checking its value, not even just "true" or whatever but poo poo like if(caniDoIt = "yes you can go ahead")

absolutely loving genius

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Powerful Two-Hander posted:

if(caniDoIt = "yes you can go ahead")

fuckin lol

Adbot
ADBOT LOVES YOU

redleader
Aug 18, 2005

Engage according to operational parameters

Powerful Two-Hander posted:

if(caniDoIt = "yes you can go ahead")

gonna steal this

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