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
also

*tussles johny's hair, tells him he's a good lil boy*

Adbot
ADBOT LOVES YOU

Brain Candy
May 18, 2006

Cybernetic Vermin posted:

entirely meaningless clutter carrying the possibility that one of the 30,000 copies of the line is wrong somewhere (one obvious case being that the wrong class is sent and things don't get filtered as expected)

i looked in FindBugs and I was kinda surprised not to find something that just checked this for you

Barnyard Protein posted:

you could do this to avoid the wrong class thing

code:
Logger logger = Logger.getLogger(this.getClass().getName());

can't use it in static methods & slow as balls depending on impl

e: always hitting a lock

bobbilljim
May 29, 2013

this christmas feels like the very first christmas to me
:shittydog::shittydog::shittydog:

Brain Candy posted:

i looked in FindBugs and I was kinda surprised not to find something that just checked this for you


can't use it in static methods & slow as balls depending on impl

e: always hitting a lock

i usualyl get my IDE to generate logger.gtelogger(x.class) where x is the class ofc

Brain Candy
May 18, 2006

Brain Candy posted:

i looked in FindBugs and I was kinda surprised not to find something that just checked this for you


can't use it in static methods & slow as balls depending on impl

e: always hitting a lock

also deceptive as hell if you use concrete inheritance, not that that is usually a great idea anyway

PokeJoe
Aug 24, 2004

hail cgatan


im gonna finish my class real soon and want to take one on data structures next. anyone know of any good free ones

Soricidus
Oct 21, 2010
freedom-hating statist shill

PokeJoe posted:

im gonna finish my class real soon and want to take one on data structures next. anyone know of any good free ones

hash tables are good

gonadic io
Feb 16, 2011

>>=
freed data structures are the least interesting ones

hobbesmaster
Jan 28, 2008

Necc0 posted:

lol at caring about source code size ityool 2015

microcontrollers in debug builds

Valeyard
Mar 30, 2012


Grimey Drawer
do many microcontrollers use java?

Jerry Bindle
May 16, 2003
idk if any mcu's use java, but a debug build will have additional stuff in it like symbol information which is taken from the source code. in the case of PICs there is also an additional debug executive which takes up more space. although the debug executive is placed in test memory so thats not a big deal i guess.

bobbilljim
May 29, 2013

this christmas feels like the very first christmas to me
:shittydog::shittydog::shittydog:

Valeyard posted:

do many microcontrollers use java?

there are some recent micros designed to use java bytecode, i dont think teh idea really took off though but i dont know for sure

bobbilljim
May 29, 2013

this christmas feels like the very first christmas to me
:shittydog::shittydog::shittydog:
in terms of runnign java on embedded platforms though, it is very common

Hed
Mar 31, 2004

Fun Shoe

Corla Plankun posted:

python-pcyopg2 wants me to put a plaintext password in my python script to connect to a database

whats the best way to not do that

This is from way back but I've done something like this in the past:

Python code:
def get_env_setting(setting):
    """ Get the environment setting or return exception"""
    try:
        return os.environ[setting]
    except KeyError:
        error_msg = "Set the %s env variable" % setting
        raise Exception(error_msg)

# then later...
DB_PASSWORD = get_env_setting('DB_PASSWORD')
This way you don't ever check passwords into CM. If an attacker can read your environment anyway then you've already lost. Bonus points for subclassing Exception into a more useful error.

Hed
Mar 31, 2004

Fun Shoe

Valeyard posted:

do many microcontrollers use java?

J2UCE

Cybernetic Vermin
Apr 18, 2005

the old argument for java on microcontrollers was that bytecode is a lot more compact than most "natural" assemblers for higher-level tasks. don't know if any of that movement survives though, would like to think that forth has a foothold in that niche still

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

e: nm, brain failure

fritz
Jul 26, 2003

Cybernetic Vermin posted:

the old argument for java on microcontrollers was that bytecode is a lot more compact than most "natural" assemblers for higher-level tasks. don't know if any of that movement survives though, would like to think that forth has a foothold in that niche still

basically all of the interface into our hardware is done thru forth, i try to just use the scripts that other people write to do it for me

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
lol go doesn't have an exponentiation operator and the standard library only implements float exponentiation

like rolling your own isn't hard but uh...

Bloody
Mar 3, 2013

bobbilljim posted:

there are some recent micros designed to use java bytecode, i dont think teh idea really took off though but i dont know for sure

iirc they wound up running native java slower than running a jvm lol

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

Hed posted:

This is from way back but I've done something like this in the past:

Python code:
def get_env_setting(setting):
    """ Get the environment setting or return exception"""
    try:
        return os.environ[setting]
    except KeyError:
        error_msg = "Set the %s env variable" % setting
        raise Exception(error_msg)

# then later...
DB_PASSWORD = get_env_setting('DB_PASSWORD')
This way you don't ever check passwords into CM. If an attacker can read your environment anyway then you've already lost. Bonus points for subclassing Exception into a more useful error.

Yeah, this is the way I do it. Any instance specific settings go into a config.env file, that I can even isolate to just the run with:

code:

#!/bin/bash

export $(cat config.env)
exec ./run_my_dumb_application

I dunno if there's a better way to do go about it, but hey, every programming lang has ways to get environment variables so no matter how a web framework or library implements their config, there's probably a way for me to get those environment variables in there.

The config.env is just a simple line of environment variables:

code:

FOO=thing
BAR=anotherthing

Maluco Marinero fucked around with this message at 05:51 on Feb 23, 2015

bobbilljim
May 29, 2013

this christmas feels like the very first christmas to me
:shittydog::shittydog::shittydog:

Bloody posted:

iirc they wound up running native java slower than running a jvm lol

:stonkhat: sounds about right

b0lt
Apr 29, 2005

Bloody posted:

iirc they wound up running native java slower than running a jvm lol

iirc jazelle support is still mandatory in armv8 (defnitely is in armv7)


except the only instructions required to be implemented are "enter jazelle mode" and "get me the gently caress out of jazelle mode"

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

Bloody posted:

iirc they wound up running native java slower than running a jvm lol

like the JavaStations that were a microSPARC

Jesus gently caress just give me a microSPARC (with SunOS 4.1.3 please) and leave this Java poo poo at the doorstep

only plus about the JVM is server-side ubiquity, .war deployment is the only reason WebObjects 5 was a good idea

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

fritz posted:

basically all of the interface into our hardware is done thru forth, i try to just use the scripts that other people write to do it for me

just build an LLVM back-end targeting your forth dialect, then you can use clang

The Leck
Feb 27, 2001

FamDav posted:

i just annotate my classes with @Log

same but my posts

brap
Aug 23, 2004

Grimey Drawer

MALE SHOEGAZE posted:

lol go doesn't have an exponentiation operator and the standard library only implements float exponentiation

like rolling your own isn't hard but uh...

go is such a worthless language

Necc0
Jun 30, 2005

by exmarx
Broken Cake
this is fun: in my system we have transactions that can have line items that are listed off in sequence ie: 1, 2, 3, etc. apparently there's no central component that handles this and in all the hundreds of different ways transactions can turn into other types of a transaction they're all generated on their own in their own unique snowflake way. turns out some programmer decided he didn't want to go through the effort of numbering these line items and instead used our global sequencing class meant for the database to number them so instead of 1, 2, 3 it's 23009876, 23009888, 23009912, etc. because at least those are guaranteed to be unique, right?

b0lt
Apr 29, 2005

MALE SHOEGAZE posted:

lol go doesn't have an exponentiation operator and the standard library only implements float exponentiation

like rolling your own isn't hard but uh...

this is like the most trivial complaint about a language that is filled with idiocies

there are plenty of languages that are the same (c, java, everything descended from the two). the only languages i can think of that have exponentiation operators are either plangs or greybeard poo poo like ada and fortran

int fit in doubles and long long fits in long double anyway

Soricidus
Oct 21, 2010
freedom-hating statist shill
rethink your life choices if you ever have to exponentiate anything other than 2 anyway, or at least stop trying to do math in integers and/or in a language that was not designed for math

bobbilljim
May 29, 2013

this christmas feels like the very first christmas to me
:shittydog::shittydog::shittydog:

Soricidus posted:

rethink your life choices if you ever have to exponentiate anything other than 2 anyway, or at least stop trying to do math in integers and/or in a language that was not designed for math

this, literally "language X is no good because it doesn;t have an operator for something i will never use"

hobbesmaster
Jan 28, 2008

bobbilljim posted:

this, literally "language X is no good because it doesn;t have an operator for something i will never use"

what would the operator be anyways, ^ is xor eor

distortion park
Apr 25, 2011


hobbesmaster posted:

what would the operator be anyways, ^ is xor eor

**

b0lt
Apr 29, 2005

the multiply by result of pointer dereference operator

bobbilljim
May 29, 2013

this christmas feels like the very first christmas to me
:shittydog::shittydog::shittydog:

b0lt posted:

the double pointer dereference operator

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

b0lt posted:

this is like the most trivial complaint about a language that is filled with idiocies

there are plenty of languages that are the same (c, java, everything descended from the two). the only languages i can think of that have exponentiation operators are either plangs or greybeard poo poo like ada and fortran

int fit in doubles and long long fits in long double anyway

yeah i dont really care and wouldn't have noticed except i was using it for project euler

it's just funny since it's a language that literally bills itself as 'a plang but with static typing and maybe a little bit fast'

the standard library is just very anemic for something that's supposed to be a sane alternative to ruby and python.

the syntax is nice and goroutines are cool and i like interfaces and getting out of class hell. but if they want to be popular with ruby people it should provide more hand holding

DONT THREAD ON ME fucked around with this message at 23:53 on Feb 23, 2015

zeekner
Jul 14, 2007

MALE SHOEGAZE posted:

yeah i dont really care and wouldn't have noticed except i was using it for project euler

it's just funny since it's a language that literally bills itself as 'a plang but with static typing and maybe a little bit fast'

the standard library is just very anemic for something that's supposed to be a sane alternative to ruby and python.

does it really bill itself like that? cause it feels more like a c-lang with the edges rounded

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Uncomfortable Gaze posted:

does it really bill itself like that? cause it feels more like a c-lang with the edges rounded

https://www.youtube.com/watch?v=5kj5ApnhPAE

loving bbcode go to 8 minutes

or 11 minutes if you just want to hear rob pike say it outright

i like the language a lot so far but i've only used it for like 3 hours

DONT THREAD ON ME fucked around with this message at 23:58 on Feb 23, 2015

zeekner
Jul 14, 2007

MALE SHOEGAZE posted:


loving bbcode go to 8 minutes

or 11 minutes if you just want to hear rob pike say it outright

i like the language a lot so far but i've only used it for like 3 hours

yea, I definitely think he's being disingenuous when he compares it to python. i've only used go for a few toy projects, but everything i've seen feels like a simplified take on a systems lang and nothing like a plang

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Uncomfortable Gaze posted:

yea, I definitely think he's being disingenuous when he compares it to python. i've only used go for a few toy projects, but everything i've seen feels like a simplified take on a systems lang and nothing like a plang

I mean, it's maybe somewhere in between? It's certainly not nearly as painful as C or C++. At least in terms of syntax. I haven't used it enough to be aware of any hidden horrors.

Adbot
ADBOT LOVES YOU

Bloody
Mar 3, 2013

c is a beautiful language

  • Locked thread