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
ChickenOfTomorrow
Nov 11, 2012

god damn it, you've got to be kind

snype

Adbot
ADBOT LOVES YOU

Valeyard
Mar 30, 2012


Grimey Drawer

suffix posted:

i made this helpful visualization and you sunk my battleship




5

JewKiller 3000
Nov 28, 2006

by Lowtax

suffix posted:

i made this helpful visualization and you sunk my battleship




what a post

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...

suffix posted:

i made this helpful visualization and you sunk my battleship




holy poo poo

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

suffix posted:

i made this helpful visualization and you sunk my battleship




:geno:

Moist von Lipwig
Oct 28, 2006

by FactsAreUseless
Tortured By Flan

Share Bear posted:

i make apps* for a living

*appetizers


bonus comedy points: i cannot edit the source or have it run locally, i am doing it live, and firefox's and chrome's debugger doesn't allow in place editing (chrome does have live JS editing, but that also does not really work)

how are you hooking the element that you're injecting HTML into?

gonadic io
Feb 16, 2011

>>=
what's good java style for a small self-contained program?
code:
class Butt {
    private int params;

    public static void main () {
        Butt problemButt = new Butt(poo poo);
        problemButt.buttStuff();
    }

    public Butt (int _params) {
        params = _params;
    }

    private void buttStuff () {
        // idk do some poo poo with 'params'
    }
}
vs main being inside a class Main or something completely separate to Butt

vs just making Butt's members be parameters to buttStuff which should be static instead

or these are all poo poo and i should be doing something completely different?

Shaggar
Apr 26, 2006
that's fine. it doesn't really matter if its just a toy program like that. you could do it as a static method for sure, but might as well make it a class in case you want to add internal state or something.

gonadic io
Feb 16, 2011

>>=
cool, thanks. currently busy spending 20 lines reimplementing pairs including overriding equals and hashcode, thanks java. thava.

gonadic io
Feb 16, 2011

>>=
how many times do you think this code (or a slightly better variation of it) has been written throughout history? at least I don't need to make mine polymorphic which makes things easier

titaniumone
Jun 10, 2001

LARD LORD posted:

how are you honking the element that you're injecting HTML into?

Nomnom Cookie
Aug 30, 2009



AlsoD posted:

what's good java style for a small self-contained program?
code:
class Butt {
    private int params;

    public static void main () {
        Butt problemButt = new Butt(poo poo);
        problemButt.buttStuff();
    }

    public Butt (int _params) {
        params = _params;
    }

    private void buttStuff () {
        // idk do some poo poo with 'params'
    }
}
vs main being inside a class Main or something completely separate to Butt

vs just making Butt's members be parameters to buttStuff which should be static instead

or these are all poo poo and i should be doing something completely different?

just do whatever. if you do the wrong thing you'll regret it later and then you'll know not to do it

The Leck
Feb 27, 2001

USSMICHELLEBACHMAN posted:

i did (started) the stanford one and he'd just have some data and you'd run your algorithm on that data and paste in the output

pretty easy to cheese i guess but really if you're cheating at a free course that you wont get any sort of certification or acknowledgement for, you're cheating yourself.
stanford one was neat and i enjoyed it + felt like i learned a lot.

Careful Drums
Oct 30, 2007

by FactsAreUseless

Kevin Mitnick P.E. posted:

just do whatever. if you do the wrong thing you'll regret it later and then you'll know not to do it

learntocode.txt

I think this is for real the only way to know how to code anything

Share Bear
Apr 27, 2004

LARD LORD posted:

how are you hooking the element that you're injecting HTML into?

It's from some other js; i've dumped and diffed the objects after they were hooked when it works and doesnt work, and they are the same; is there a more subtle reason they wouldn't be?

diff objects meaning: taking the watch expression on the object at the time of the breakpoint where it works, expanding it, copying it into a text editor, and doing the same for the second breakpoint where it fails, then running diff against the two files

js dev!!!!!

Share Bear fucked around with this message at 21:35 on Jun 18, 2014

Nomnom Cookie
Aug 30, 2009



Careful Drums posted:

learntocode.txt

I think this is for real the only way to know how to code anything

learntoanything.txt

do something->gently caress it up->figure out why you hosed it up->do it better, its the fundamental loop of procedural learning

Valeyard
Mar 30, 2012


Grimey Drawer
my problems is i sometimes do something too infrequently that when it comes time to do it again, i think back and cant remember how i done it the first time

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Valeyard posted:

ive had similar problems before and cant remember exactly why it wasnt being assigned properly, but here is a line ive used before which is failry similar and i know it works, if it helps

code:
$(this).find(".whatever")[0].innerHTML=$(this).find(".whatever")[0].innerHTML.replace(x, y)

I have no idea how to develop in javascript i can write the code alright but to debug i just open up the console and start typing until i manually create whatever state im trying to test. That and console.log every thing

SavageMessiah
Jan 28, 2009

Emotionally drained and spookified

Toilet Rascal

AlsoD posted:

cool, thanks. currently busy spending 20 lines reimplementing pairs including overriding equals and hashcode, thanks java. thava.

psst

hey kid

git a load a dis

http://projectlombok.org/

Brain Candy
May 18, 2006

AlsoD posted:

how many times do you think this code (or a slightly better variation of it) has been written throughout history? at least I don't need to make mine polymorphic which makes things easier

the fact that you didn't spend that time looking for a less stupid thing to do means you correctly valued your time, hth

gonadic io
Feb 16, 2011

>>=
yeah let me just install a new ide to use their library

or wait maybe use the functionality from java.util.Map.Entry which is pretty much exactly what I'd want although the hash implementation is key.hash() ^ value.hash() so i'd still have to overwrite that

why is Map.Entry specialised and hidden away when it's very general and could be in the standard library? java!

SavageMessiah
Jan 28, 2009

Emotionally drained and spookified

Toilet Rascal

AlsoD posted:

yeah let me just install a new ide to use their library

wtf are you talking about

gonadic io
Feb 16, 2011

>>=

SavageMessiah posted:

wtf are you talking about

oh i misread it, works with netbeans and eclipse (only).

Brain Candy
May 18, 2006

since you are using an ide, use google to find the magic spell that implements hashcode+equals by value :jerkbag:

SavageMessiah
Jan 28, 2009

Emotionally drained and spookified

Toilet Rascal

AlsoD posted:

oh i misread it, works with netbeans and eclipse (only).

oh look what's this

http://plugins.jetbrains.com/plugin/6317

for the only ide that matters

and for wierdo clowns that don't use an ide for java it works just with javac too :toot:

Shaggar
Apr 26, 2006
in eclipse you can right click and then generate source and then equals/hashcode. it doesn't work w/ every class but most pojos it should be fine for. if u wanna be incredibly lazy i think commons-lang or something has a thing where you can just do like

Java code:
public boolean equals(Object obj) 
{
	return imalazyshit.doEqualsForMe(obj,this);
}

Shaggar
Apr 26, 2006
there was a thing in project lobmock that i didn't like but i dont remember what it was.

SavageMessiah
Jan 28, 2009

Emotionally drained and spookified

Toilet Rascal
I dunno I just like my having my tostring and getters and poo poo without my classes being cluttered up with generated garbage. I suppose code folding sorta solves that too though.

At work we honestly don't use much of lombok aside from @Data but that's the important part IMHO, a lot of the rest is a little too magical.

especially val jfc

Shaggar
Apr 26, 2006
i agree tho if eclipse is gonna have its own common method generator you should be able to mark the class as needing it and have eclipse auto (re)generate it as needed and leave it folded by default.

Nomnom Cookie
Aug 30, 2009



pair isn't in std lib because you're supposed to make pojos i assume

heres what you do

reference the class, quick-fix generate it. add ur fields public final. quick-fix generate a constructor that sets the fields

bam pojo. private final w/getters is only a little more work so you can do that if ur a fag

Nomnom Cookie
Aug 30, 2009



btw shaggar. you said jaxb is good. my experience has been that shaggar is right about java stuff so i tried it

the problem is

jaxb is poo poo. its so bad that i'm pretty sure when people say they hate xml they actually mean jaxb or related oxm poo poo

Bloody
Mar 3, 2013

hi tpsz/h. i am a terrible programmer.

a thing i do a lot of is farting around with raw binary files with toy programs. currently i use c# for this, but are there any even easier options? lotta these higher level languages seem to really really dislike byte/bit janitoring. i want like c-strength bit-janitoring but with modern file i/o and com port i/o and yknow that sort of poo poo

like i said c# is p dece at this so i dont care too much but is there anything better?

Shaggar
Apr 26, 2006

Kevin Mitnick P.E. posted:

btw shaggar. you said jaxb is good. my experience has been that shaggar is right about java stuff so i tried it

the problem is

jaxb is poo poo. its so bad that i'm pretty sure when people say they hate xml they actually mean jaxb or related oxm poo poo

what are you doing wrong? jaxb works fine

more like dICK
Feb 15, 2010

This is inevitable.

Bloody posted:

hi tpsz/h. i am a terrible programmer.

a thing i do a lot of is farting around with raw binary files with toy programs. currently i use c# for this, but are there any even easier options? lotta these higher level languages seem to really really dislike byte/bit janitoring. i want like c-strength bit-janitoring but with modern file i/o and com port i/o and yknow that sort of poo poo

like i said c# is p dece at this so i dont care too much but is there anything better?

Erlang/Elixir bit janitoring is very pleasant but very slow.

Nomnom Cookie
Aug 30, 2009



Shaggar posted:

what are you doing wrong? jaxb works fine

i wrote a schema and generated classes from it. the classes are poo poo. also jaxb is a dick about namespaces. i want a serialization format thats pleasant for both humans and computers and jaxb is completely failing at the pleasant for humans part

coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY

Kevin Mitnick P.E. posted:

i wrote a schema and generated classes from it. the classes are poo poo. also jaxb is a dick about namespaces. i want a serialization format thats pleasant for both humans and computers and jaxb is completely failing at the pleasant for humans part
gigo

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Kevin Mitnick P.E. posted:

i wrote a schema and generated classes from it. the classes are poo poo. also jaxb is a dick about namespaces. i want a serialization format thats pleasant for both humans and computers and jaxb is completely failing at the pleasant for humans part

Try protobuf it works great for machines and humans. Basically you create .proto files which are the equivalent of an xsd and generates code, it has bindings for java, python and c by default. There are 3rd party binding for other languages as well if you need them.

Here's the language guide for defining the .proto files https://developers.google.com/protocol-buffers/docs/proto



I have it all mavenized using this config: http://pastebin.com/vP28qJLB

The java bindings let you target two runtimes, so I optimize for SPEED on the server and for the LITE_RUNTIME on the android clients. With that config I can just drop .proto files in src/main/proto and maven will compile it just like the jaxb stuff. Each protobuf file has this header defined in the beginning
code:
option optimize_for = ${proto.optimize_for};
The only thing you need to do externally with my config is download the protoc compiler and have it somewhere on your path.
https://code.google.com/p/protobuf/downloads/list

Janitor Prime fucked around with this message at 20:04 on Jun 20, 2014

Shaggar
Apr 26, 2006
nah don't use google abandonware. just fix your schema or maybe do code first instead.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
It's way leaner than than SOAP on iOS and Android which is a big requirement for us. I've gone whole hog and made a Spring HttpMessageConverter that lets me receive protobuf objects from the clients using regular Controllers and Spring MVC. Also it might not be getting many updates, but it's stable as hell.

Adbot
ADBOT LOVES YOU

Bloody
Mar 3, 2013

protobufs are good

  • Locked thread