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
ShimaTetsuo
Sep 9, 2001

Maximus Quietus

gonadic io posted:

god VBA is such a piece of poo poo

some of the students today wrote stuff like "Dim range As Range". fair enough. not the best name but whatever. now however because vba is sometimes case-sensitive and sometimes case-insensitive, and the auto-correct is insensitive, Range will correct to range. range is not a valid type but Range is. this will cause an error because it expected a type where there's a variable name.

this will continue to happen even if you rename the range variable to something else, auto-correct remembers

this will continue to happen even after closing and reopening excel.

if multiple capitalizations of a keyword / variable name exist in a project, the occurence in the first module (alphabetically) changes all the others to match. Its a lot of fun if you're the special kind of retard who uses VBA with a bespoke source code export excel addin so you can use source control and then suddenly all your files are modified.

Adbot
ADBOT LOVES YOU

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Notorious b.s.d. posted:

i was always told not to rely on finalizers in java, because they might not run

what is up with your code that you require certain finalization

that is still good advice in swift, which like pretty much every other language doesn't guarantee finalization during program exit. also, as subjunctive says, the exact moment of finalization is still hard to predict when the object's life has been at all complicated

but immediate reclamation is really important to us, not just for performance, but because we're a hybrid-managed environment. in many languages, all memory is managed by the language implementation; at most, you have some class with a c pointer in some private native field whose value is never ever exposed to the language. swift, like objc, and like a few other languages, does not have this property, because by design we sit right on top of c and can directly interoperate with it. if a managed object ever owns an unmanaged pointer, guess what, you have a serious problem, because memory management generally assumes that you can manage allocations separately, and so it will happily reclaim objects that own unmanaged pointers that you're still working with

this was one of the serious problems with objc gc. a lot of objc classes own unmanaged memory, e.g. NSString owning a character buffer, because it's more efficient and because they were written that way twenty years ago. imagine some method on NSString that just pulls the character buffer out of the string object, then starts working with it to, i dunno, count the grapheme clusters or something. on x86-64, self is passed in %rdi. if the compiler spills that to the stack, you don't have a bug. if the compiler loads the buffer pointer into %rax, you don't have a bug. if the compiler loads the buffer pointer into %rdi, and that was the last reference to the object, and there happens to be a gc at exactly the wrong time, guess what, you have a bug. good luck reproducing that

once you find the bug, there's a lot of things you can do; i think c# programmers have a similar problem when they're heavily pinvoking and can use "using" for it maybe? the problem is finding it at all

so having an implementation model that makes finalization more predictable, even if it's not exactly fully predictable, makes it far more likely that these problems show up in development and testing

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band
say you're building an all-in-one jar with maven. can you add something to the pom so that you get an additional maven goal to execute the jar after it's been built?

distortion park
Apr 25, 2011


gonadic io posted:

god VBA is such a piece of poo poo

some of the students today wrote stuff like "Dim range As Range". fair enough. not the best name but whatever. now however because vba is sometimes case-sensitive and sometimes case-insensitive, and the auto-correct is insensitive, Range will correct to range. range is not a valid type but Range is. this will cause an error because it expected a type where there's a variable name.

this will continue to happen even if you rename the range variable to something else, auto-correct remembers

this will continue to happen even after closing and reopening excel.

You know that there is a template in visual studio for a vsto project so that you can write everything in c#?

distortion park
Apr 25, 2011


The excel api is still utter garbage though, check out msoTriState

hobbesmaster
Jan 28, 2008

pointsofdata posted:

The excel api is still utter garbage though, check out msoTriState

only microsoft could come up with a tristate with the states true, false and unsupported

Shaggar
Apr 26, 2006

prefect posted:

say you're building an all-in-one jar with maven. can you add something to the pom so that you get an additional maven goal to execute the jar after it's been built?

you can run multiple phases and goals in order ex: clean package install would clean ur build dir, build and package the project, and then install it in your local cache. so if your execute goal is exec:jar, you might could do clean package exec:jar.

alternatively if you want it to always execute the jar after a certain phase (u probably don't want this) in the pom in the plugin definition for the execute plugin you'd have something like

XML code:
<executions>
	<execution>
		<goals>
			<goal>exec</goal>
		</goals>
		<phase>package</phase>
	</execution>
</executions>
would run the exec goal on the plugin after each package phase. However, if you're doing this for test reasons this kind of thing probably belongs in a test phase.

more info: http://maven.apache.org/guides/mini/guide-configuring-plugins.html#Configuring_Build_Plugins

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band

Shaggar posted:

you can run multiple phases and goals in order ex: clean package install would clean ur build dir, build and package the project, and then install it in your local cache. so if your execute goal is exec:jar, you might could do clean package exec:jar.

this is the kind of behavior i want. "exec" isn't one of the standard lifecycle goals -- am i correct in thinking it comes from the exec maven plugin?

bucketmouse
Aug 16, 2004

we con-trol the ho-ri-zon-tal
we con-trol the verrr-ti-cal
crosspost from the bitcoin thread for a completely different sort of terrible programmer

https://github.com/c-darwin/dcoin/search?utf8=%E2%9C%93&q=mongoloid

Aleksei Vasiliev posted:

$lng['race_1'] = 'Mongoloid';
$lng['race_2'] = 'Europid';
$lng['race_3'] = 'Negroid';

:eyepop:

gonadic io
Feb 16, 2011

>>=

pointsofdata posted:

You know that there is a template in visual studio for a vsto project so that you can write everything in c#?

that's good to know. however in this case i don't have any say over the content of the course I just answer questions in labs and mark cws. I suppose i could start telling students "in c# you could do it easily" whenever they asked me why their VBA code wasn't working but there's already enough shaggars in this world

Bloody
Mar 3, 2013

gonadic io posted:

that's good to know. however in this case i don't have any say over the content of the course I just answer questions in labs and mark cws. I suppose i could start telling students "in c# you could do it easily" whenever they asked me why their VBA code wasn't working but there's already enough shaggars in this world

shaggars++;

Shaggar
Apr 26, 2006

prefect posted:

this is the kind of behavior i want. "exec" isn't one of the standard lifecycle goals -- am i correct in thinking it comes from the exec maven plugin?

yes exec is probably a plugin/goal.

so there are phases and goals. the phases are set in stone and they're the common ones you see like clean build package install, etc... They are part of the maven build lifecycle. http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

Goals are tasks achieved by specific plugins. When you use goals manually you usually specify pluginname:goalname like tomcat:deploy would be the deploy goal of the tomcat plugin.

Plugins can also be configured to automatically execute goals as part of certain phases. That's the executions section

Plugins can also specify phases that they want to bind to internally so you don't have to attach them yourself. for example, the maven compiler plugin automatically binds its compile goals to the compile lifecycle. This is why your stuff gets compiled without you specifying any custom executions.

if you're using the codehaus exec plugin then exec:exec is the exec goal of the exec plugin.

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS
jfc i surrender

please opsworks just stop hurting me i can't take it anymore

Brain Candy
May 18, 2006

prefect posted:

this is the kind of behavior i want. "exec" isn't one of the standard lifecycle goals -- am i correct in thinking it comes from the exec maven plugin?

what are you trying to do? there's probably a better way than exec

PleasureKevin
Jan 2, 2011

today i had one of my most productive days*. we ran out of half-caff coffee so i had to drink dark roast. i was coding like a fiend.

for some reason requests on the web front-end have not been going through and yet they end up actually working on the back end.

so obviously there's been a bug introduced since the last time i completely recoded that controller. i imagine it has to have something to do with the fact it's extremely slow, taking a whole 9 seconds to do one thing with just 1 user on the site. maybe it's just timing out?

it can't hurt to rip out the current middle ware and replace it with one that a guy on stack overflow said i should use months ago in a totally unrelated question. one of those "why are you using that when you could use this?" remarks.

so i do that, but the new super-fast middleware demands i use jQuery. and i have to use dumb jQuery stuff like .each(). and you can't use promises because as the developer says on github "the jQuery implementation of promises sucks anyway."

so i end up writing about 5 functions just to deal with that mess whereas i had two before. and i began writing each function sure that i had already forgotten or never understood what i was writing the last one to do. but somehow i couldn't stop typing and it actually worked.

and when all was said and done it took a full 2 seconds longer when processing the same 8 lady gaga pictures as before. so i saved it as something like "loving-hell-this-poo poo-is-slower-than-before-controller.js" and reverted to the old one.

* read: busywork

now i'm drinking, sorry echi

Marzzle
Dec 1, 2004

Bursting with flavor

Brain Candy posted:

101 multithreading : don't let threads touch except where they are explicitly allowed. pick the one or two places to exchange info and touch nothing else
102 multithreading : don't use threads explicitly. fumbling around in the "compile->run->check" cycle does not make threaded code that consistently works.

in your case you want to use SwingWorkers as the threads. there's a tutorial, go read it

e: all the GC chat tricked me into thinking this was the other thread

ehh i am not sure that I am using swingworkers since it's a javafx slider. i know pretty little about both java and swing but i was under the impression that it would deal with threads so joe-java-writer can whip up some fancy UI without having to stumble through the pitfalls of becoming a good programmer.

mostly just wanted to get the 'pos take on javafx and complain about being stuck in the badprogrammermatrix

Marzzle
Dec 1, 2004

Bursting with flavor

neo... follow the goto statement...
i take another hit of computer duster as i fumble for the usb drive the client came for.

i warn "that''s some pretty hardcore poo poo man"

"everyone said you were the best"

i wrote hack.pl the other day, every line terminated with a semicolon nice it'll probably run

things probably gotta run if you wanna max out your rep in the cyberbiz

the dusters starting to take effect, my limbs are starting to go numb and i start to feel higher than an arcade accountants postfix stack

"you wanna party big boy?"
the client's girl asks
i probably shouldn't, i got a big day tomorrow presenting a paradigm breaking new node.js overhaul to the boss... until i see the tattoo on her back

code:
IF i!=0 THEN goto i
pretty slick code, wish i had thought of it first. then i remember the stuff that freaky vinylpunk chick was telling me the other day "follow the goto statement"

this is it, the nagging doubts about reality are all gonna come to an end

i pick up the can of duster again and take a deep inhale, that accountants arcade gets a hundred extra nooblet birthday parties toppin' up his stack

"most excellent"

i leave with the duo into the tv static night, baseline and duster pumping in my head

Marzzle fucked around with this message at 08:53 on Mar 5, 2015

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band

Shaggar posted:

yes exec is probably a plugin/goal.

so there are phases and goals. the phases are set in stone and they're the common ones you see like clean build package install, etc... They are part of the maven build lifecycle. http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

Goals are tasks achieved by specific plugins. When you use goals manually you usually specify pluginname:goalname like tomcat:deploy would be the deploy goal of the tomcat plugin.

Plugins can also be configured to automatically execute goals as part of certain phases. That's the executions section

Plugins can also specify phases that they want to bind to internally so you don't have to attach them yourself. for example, the maven compiler plugin automatically binds its compile goals to the compile lifecycle. This is why your stuff gets compiled without you specifying any custom executions.

if you're using the codehaus exec plugin then exec:exec is the exec goal of the exec plugin.

thanks for the excellent explanation; i will probably be copy/pasting this to a co-worker :tipshat:

Brain Candy posted:

what are you trying to do? there's probably a better way than exec

there's a guy building an executable jar. he wants a super-simple way to be able to say "maven, build this jar and then run it, so i can see what it does"

Brain Candy
May 18, 2006

prefect posted:

thanks for the excellent explanation; i will probably be copy/pasting this to a co-worker :tipshat:


there's a guy building an executable jar. he wants a super-simple way to be able to say "maven, build this jar and then run it, so i can see what it does"

okay i guess i'm just used to horrible things lurking behind that sort of question :ohdear:

Brain Candy
May 18, 2006

Marzzle posted:

ehh i am not sure that I am using swingworkers since it's a javafx slider. i know pretty little about both java and swing but i was under the impression that it would deal with threads so joe-java-writer can whip up some fancy UI without having to stumble through the pitfalls of becoming a good programmer.

mostly just wanted to get the 'pos take on javafx and complain about being stuck in the badprogrammermatrix

eh, well, you aren't :blush:
http://fxexperience.com/2011/07/worker-threading-in-javafx-2-0/

but, well, the other things still apply. java makes the programmer do most of the thread management so you can't really herp-derp through it unless you are following a tutorial with a specific case

Bloody
Mar 3, 2013

use c#, c# threads are good & easy

Brain Candy
May 18, 2006

threads are at best the least bad option and i don't care what language you are talking about

leftist heap
Feb 28, 2013

Fun Shoe
lol, Angular 2.0 will be targeting TypeScript now instead of their own AtScript. probably a good move in the end, but good god google's add is hilariously add

Valeyard
Mar 30, 2012


Grimey Drawer
so ive got an interesting coursework that is to implement a really basic system temperature conversion system using message passing, we get to use java with akka, scala with akka or erlang

im gonna give scala/akka a go but holy piss is this annoying to even setup a blank project

triple sulk
Sep 17, 2014



that's because scala and to a greater extent sbt are garbage

you could have used erlang or elixir and probably had it done already

leftist heap
Feb 28, 2013

Fun Shoe
also don't use threads in java. use something in java.util.concurrent instead. i don't really think slider change listeners should be kicking off threads or executors or whatever but if it's just a small throwaway project then who cares.

Notorious b.s.d.
Jan 25, 2003

by Reene

triple sulk posted:

that's because scala and to a greater extent sbt are garbage

you could have used erlang or elixir and probably had it done already

sulk you change language opinions every time you change jobs

you're like a walking, talking copy of "7 languages in 7 weeks"

Notorious b.s.d.
Jan 25, 2003

by Reene

Valeyard posted:

so ive got an interesting coursework that is to implement a really basic system temperature conversion system using message passing, we get to use java with akka, scala with akka or erlang

im gonna give scala/akka a go but holy piss is this annoying to even setup a blank project

sbt is really bad

if you don't have time to fight sbt, either use maven or let intelliJ set up the project for you

leftist heap
Feb 28, 2013

Fun Shoe

Valeyard posted:

so ive got an interesting coursework that is to implement a really basic system temperature conversion system using message passing, we get to use java with akka, scala with akka or erlang

im gonna give scala/akka a go but holy piss is this annoying to even setup a blank project

lol, wouldn't this have been utterly trivial with erlang? it's literally hello world for erlang.

Valeyard
Mar 30, 2012


Grimey Drawer
the only issue i have with erlang is...so the sy stem needs to have 5 actors. 2xsensors, 1xconverter, 1xclock and 1xprinter and they are all supposed to pass messages between them

so the clock actor sends a message every 1 second to both of the sensors. but how does it know the PID of the sensor? is it ok to just spawn all these actor processes and then use the register function to name them all and make them accessable everywhere?

MononcQc
May 29, 2007

Valeyard posted:

the only issue i have with erlang is...so the sy stem needs to have 5 actors. 2xsensors, 1xconverter, 1xclock and 1xprinter and they are all supposed to pass messages between them

so the clock actor sends a message every 1 second to both of the sensors. but how does it know the PID of the sensor? is it ok to just spawn all these actor processes and then use the register function to name them all and make them accessable everywhere?

Hello.

Registering is the easiest mechanism. Register processes and off you go. This is generally the easy way out. You have a print actor, a clock actor, a converter actor, and two standalone sensors that talk to them.

A different way is to have a 'control plane'. It's a bit like a coordinator that goes and starts all processes independently and pass them to each other. It could, for example, start the clock, printer, and converter, and only keep their references as a pid. The control plane then starts the two sensors passing them the pids to each of the service ({ClockPid, PrintPid, ConvertPid}). The control plane then leaves and lets the system go, or optionally hangs around, linking itself to all processes so that if anyone fails, they all get taken down. The advantage of this approach is that nothing has a name, so you can start as many sensor systems as you'd like.

You can also try to mix up the approaches together -- have a clock, print and converter processes registered, but have the sensors started by a control plane.

In all cases, it's good to have that kind of control plane (read: supervisor) if only because it lets you know in which order things are booted -- you don't want the sensors to ask the converter for work when the converter hasn't been setup yet, for example.

In practice though, you'd convert temperatures in a function and use the VM's timer mechanisms rather than trying to implement them yourself, and would end up with 1 actor per sensor maybe.

tef
May 30, 2004

-> some l-system crap ->

Brain Candy posted:

101 multithreading : don't let threads touch except where they are explicitly allowed. pick the one or two places to exchange info and touch nothing else
102 multithreading : don't use threads explicitly. fumbling around in the "compile->run->check" cycle does not make threaded code that consistently works.

in your case you want to use SwingWorkers as the threads. there's a tutorial, go read it

e: all the GC chat tricked me into thinking this was the other thread

a quick guide to concurrency

lesson one: it is really hard, so do the simplest thing that could work. usually this means not being concurrent

lesson two: it's easy to run two things at the same time if they don't talk to each other much. background workers and threads are a good fit here.

lesson three: using locks to build thread safe code is like using malloc to get memory safety. it's much easier to copy things between threads than share them, especially when it comes to managing lifetimes.

lesson four: atomic operations are nice, like counters, compare and swap, but are just as treacherous as locks when you compose them.

lesson five: if you need transactions, you probably need a database.

lesson six: all of the above things will produce working, but slow code. you will want to write that before optimising it using more specialised concurrency operations.

Bloody
Mar 3, 2013

concurrency:
if(embarrassingly parallel): not too bad!
else: dehumanize

Notorious b.s.d.
Jan 25, 2003

by Reene
dehumanize yourself race and condition face to

leftist heap
Feb 28, 2013

Fun Shoe
more like dehumanize yo

pseudorandom name
May 6, 2007

dehumanize yourself and face to Segmentation fault (core dumped)

Valeyard
Mar 30, 2012


Grimey Drawer

MononcQc posted:

Hello.

Registering is the easiest mechanism. Register processes and off you go. This is generally the easy way out. You have a print actor, a clock actor, a converter actor, and two standalone sensors that talk to them.

A different way is to have a 'control plane'. It's a bit like a coordinator that goes and starts all processes independently and pass them to each other. It could, for example, start the clock, printer, and converter, and only keep their references as a pid. The control plane then starts the two sensors passing them the pids to each of the service ({ClockPid, PrintPid, ConvertPid}). The control plane then leaves and lets the system go, or optionally hangs around, linking itself to all processes so that if anyone fails, they all get taken down. The advantage of this approach is that nothing has a name, so you can start as many sensor systems as you'd like.

You can also try to mix up the approaches together -- have a clock, print and converter processes registered, but have the sensors started by a control plane.

In all cases, it's good to have that kind of control plane (read: supervisor) if only because it lets you know in which order things are booted -- you don't want the sensors to ask the converter for work when the converter hasn't been setup yet, for example.

In practice though, you'd convert temperatures in a function and use the VM's timer mechanisms rather than trying to implement them yourself, and would end up with 1 actor per sensor maybe.

thank you!

that actually all makes sense. just now I have everything registered but I think once this is working I will look into having some kind of control pane for the sensors :tipshat:

'ST
Jul 24, 2003

"The world has nothing to fear from military ambition in our Government."
i have wanted to do a hobby project for a while and i decided recently that i would set up the data model and database first.

i've done a lot of database stuff at home and at work, but i haven't worked at a place that has a really good data setup.

what are some best practices for:
- versioning database code and procedures
- setting up migrations with upgrades and downgrades
- keeping application versions and database versions in sync or at least compatible

thank you.

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison
i thought i hated selenium but i spent a bit browsing through this custom selenium driver we're using and i think i just hate the guy who wrote it

Adbot
ADBOT LOVES YOU

leftist heap
Feb 28, 2013

Fun Shoe

'ST posted:

i have wanted to do a hobby project for a while and i decided recently that i would set up the data model and database first.

i've done a lot of database stuff at home and at work, but i haven't worked at a place that has a really good data setup.

what are some best practices for:
- versioning database code and procedures
- setting up migrations with upgrades and downgrades
- keeping application versions and database versions in sync or at least compatible

thank you.

lol if you need a databse

  • Locked thread