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
Max Facetime
Apr 18, 2009

salted hash browns posted:

if it was ~~java~~ i would just serialize the object no probs

yeah seriously, just use GSON

I even customized it so that it can take json that has a value
code:
"TEXTURE_MIN_FILTER": "LINEAR"
and set it to a properly named java class field
code:
private String textureMinFilter;
automatically based on the levenshtein distances between the name and the names of fields in the class

Adbot
ADBOT LOVES YOU

Nomnom Cookie
Aug 30, 2009



tef posted:

although, here is a fun question

let's assume you have to use json for a format. (on the basis that for some reason, people love json, even though it is poo poo for what i'm about to ask, cos no-one ever got fired for using json).

how do you smuggle new data types into json?

one approach seems to be reserved attributes, '_links' for example, using leading underscores to mean 'hey, i'm being nasty'.

another is to use \/, as some library smuggles dates inside json by using "\/Date(.....)\/", relying that most encoders don't escape /.

personally, i'm tempted to use ascii control codes as the magic 'i am a terrible person' indicator, rather than relying on escaping magic, or underscores being sacred

so, if people want to do this terrible thing. what should they do?
is this a p-language thing? In java if I feel like getting fancy then Jackson will do the conversion for me but it knows the target type. If I understand you then I'd use a __types attr probably, eg
code:

{
    "author": "Nomnom Cookie",
    "quality": "poo poo",
    "timestamp": "22-10-2012T09:37:23Z",
    "__types": {
        "timestamp": "ISO8601"
    }
}

Jonnty
Aug 2, 2007

The enemy has become a flaming star!

Gazpacho posted:

given a linked list (forward links only) and unsigned integer return the node that far from the end.

my initial instinct would be to go through the list reversing every link, then tracing back undoing your work + remembering which one was the nth. O(n) but hacky...

e: actually that's probably worse than literally just looping through to count how many links there are then looping through to find the nth. never mind... :(

Shaggar
Apr 26, 2006

tef posted:

although, here is a fun question

let's assume you have to use json for a format. (on the basis that for some reason, people love json, even though it is poo poo for what i'm about to ask, cos no-one ever got fired for using json).

how do you smuggle new data types into json?

one approach seems to be reserved attributes, '_links' for example, using leading underscores to mean 'hey, i'm being nasty'.

another is to use \/, as some library smuggles dates inside json by using "\/Date(.....)\/", relying that most encoders don't escape /.

personally, i'm tempted to use ascii control codes as the magic 'i am a terrible person' indicator, rather than relying on escaping magic, or underscores being sacred

so, if people want to do this terrible thing. what should they do?

json is just unstructured text. it can be both whatever type the producer/consumer wants and not a type at all.

Shaggar
Apr 26, 2006
or if you're litterally just asking what tool to use to make it eaiser, then the answer is java (duh). json is still poo poo and you should be using xml w/ schema instead since anything not written by you will have a much easier time w/ serialization.

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror
why are you even worrying about that if java is so great. just put whatever you want into an array and pass it to java's json_encode()?

Zombywuf
Mar 29, 2008

tef posted:

so, if people want to do this terrible thing. what should they do?

Just explode everything out into objects.

JavaScript code:
timestamp = {
  year: 1999,
  month: 12,
  day: 31,
  type: "date"
};
with:
Python code:
if obj_dict.haskey("type"):
  return decode_as_type(obj_dict["type"], obj_dict)
else:
  return obj_dict
Or are you looking for efficiency? In which case do the same and gzip :-)

MononcQc
May 29, 2007

Zombywuf posted:

Just explode everything out into objects.

JavaScript code:
timestamp = {
  year: 1999,
  month: 12,
  day: 31,
  type: "date"
};
with:
Python code:
if obj_dict.haskey("type"):
  return decode_as_type(obj_dict["type"], obj_dict)
else:
  return obj_dict
Or are you looking for efficiency? In which case do the same and gzip :-)

but what calendar is that ?!

Socracheese
Oct 20, 2008

Tiny Bug Child posted:

just put whatever you want into an array and pass it to java's json_encode()?
yeah, maybe I'm missing the point of the question but when I have other data types I figure out a way to express them as a string and convert them back when I'm processing the json. I always know what data I'm expecting to send/recieve so I don't need prefixed variables to figure out what it is.

Shaggar
Apr 26, 2006

Zombywuf posted:

Just explode everything out into objects.

JavaScript code:
timestamp = {
  year: 1999,
  month: 12,
  day: 31,
  type: "date"
};
with:
Python code:
if obj_dict.haskey("type"):
  return decode_as_type(obj_dict["type"], obj_dict)
else:
  return obj_dict
Or are you looking for efficiency? In which case do the same and gzip :-)
theres no time in ur timestamp

JawnV6
Jul 4, 2004

So hot ...
drat kids can get through a serialization discussion without the word 'endian' getting tossed around

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

JawnV6 posted:

drat kids can get through a serialization discussion without the word 'endian' getting tossed around

yeah it's great, by using inefficient as hell decimal utf-8 encoding because it's 2012 and computing power is basically free

JawnV6
Jul 4, 2004

So hot ...

Cocoa Crispies posted:

yeah it's great, by using inefficient as hell decimal utf-8 encoding because it's 2012 and computing power is basically free

you sound like a node "programmer"

tef
May 30, 2004

-> some l-system crap ->

Cocoa Crispies posted:

yeah it's great, by using inefficient as hell decimal utf-8 encoding because it's 2012 and computing power is basically free

this and it is easier to gzip poo poo, rather than spend your time bitpacking if you want to get something small over the wire.

the other nice thing is that by using human bits, it's harder to gently caress up parsing.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

MononcQc posted:

but what calendar is that ?!

Julian. I'll be in my grave before I recognize the bastard child that is the Gregorian calendar.

MononcQc
May 29, 2007

rotor posted:

Julian. I'll be in my grave before I recognize the bastard child that is the Gregorian calendar.

Oy vey, the Jewish Calendar gets no love! And What about the French republican Calendar?!

JawnV6
Jul 4, 2004

So hot ...
i use the jouleian calendar

never know watt day it is

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

JawnV6 posted:

i use the jouleian calendar

never know watt day it is

erg, these puns are terrible.

tef
May 30, 2004

-> some l-system crap ->

rotor posted:

Julian. I'll be in my grave before I recognize the bastard child that is the Gregorian calendar.

pfft, calendars. real men use TAI epoch seconds. timezones, leap seconds, and the rest of the human garbage that is time can gently caress off.

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp
try the grey gorean calendar, every day is depressing and filled with whipcracks

Socracheese
Oct 20, 2008

I just use a chunk of plutonium for radiometric dating

i know what day it is by when i die from radiation poisioning

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

tef posted:

this and it is easier to gzip poo poo, rather than spend your time bitpacking if you want to get something small over the wire.

the other nice thing is that by using human bits, it's harder to gently caress up parsing.

if you do use binary: http://armstrongonsoftware.blogspot.com/2008/07/ubf-and-vm-opcocde-design.html

joe armstrong posted:

In fact the byte code for PLUS should be 43 in all byte coded VMs - there should be laws that make it a criminal offense for the opcode to be anything other than 43 - thus it is written - there will of course, be a problem with the opcode for TIMES - if you are familiar with your ASCII codes then you should understand why.

MononcQc
May 29, 2007

I wish UBF(1-3) caught on :3: It's a nifty little thing.

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug
hackers UBF

wolffenstein
Aug 2, 2002
 
Pork Pro
Learnable Programming by Bret Victor

How to make programming learnable with examples and Shaggar-esqe opinions.

MononcQc
May 29, 2007

That processor of yours should be very very hot and make them fans spin very fast.

MrMoo
Sep 14, 2000

tef posted:

let's assume you have to use json for a format. (on the basis that for some reason, people love json, even though it is poo poo for what i'm about to ask, cos no-one ever got fired for using json).

how do you smuggle new data types into json?

JSON schema is a thing and Google have a nice example.

Rufus Ping
Dec 27, 2006





I'm a Friend of Rodney Nano

wolffenstein posted:

Learnable Programming by Bret Victor

How to make programming learnable with examples and Shaggar-esqe opinions.

bret victor has a breathtakingly inflated opinion of his own importance and it bothers me slightly that people let him get away with it

the guy gave an hour long speech earlier this year in which he demonstrated some example programs hes written. this comprised half an hour of casually-scripted pseudo-spontaneous "oh i wonder what would happen if" moments designed to make using his software appear effortless and intuitive, followed by half an hour of thoughtfully spewing platitudes in order to elevate his computer programs into a fully fledged philosophy for living one's life

not content with this, he then, from his newly-erected visionary podium, without so much as a whiff of self awareness, compares himself to tesla and englebert, and suggests his personal life philosophy (wanting to improve software usability) is like 19th century feminist elizabeth cady stanton's desire to overcome social injustice



the mans a loving intellectual fraud and i wish people would stop cleaning his anus out with their tongues

Rufus Ping fucked around with this message at 01:22 on Oct 23, 2012

HORATIO HORNBLOWER
Sep 21, 2002

no ambition,
no talent,
no chance

AWWNAW posted:

I have to interview a developer tomorrow what sort of coding test should I give them

coding tests are stupid and a waste of time

ask real questions that require paragraph-length answers about concepts that are crucial to your business and or your project

not only will this reveal whether or not the individual actually understand those concepts--as opposed to is he or she merely able to poo poo out some crummy code on command--but it will also demonstrate whether the candidate posesses actual communication skills which are too often sorely lacking

best of all it saves everyone the indignity of trying to draw curly braces on a white board

and no trick google questions about light switches or escaping from a blender or you will surely burn in hell forever

Shaggar
Apr 26, 2006
if you need to ask specific development questions, ask real world ones and expect real world solutions. ex: Q: You have a csv file that you need to need to read and then load into a database. how do u do? A: grab a csv deserializer off of maven, use it to load the data into ur classes, spit the data into procs via mybatis. if they start writing code for a csv parser get up and leave.

Max Facetime
Apr 18, 2009

bret victor posted:

In his influental essay No Silver Bullet, Fred Brooks makes the case that software is inherently "invisible and unvisualizable", and points out the universal failure of so-called "visual programming" environments. I don't fault Fred Brooks for his mistake -- visual programming is indeed worthless. But that's because it visualizes the wrong thing.

Traditional visual environments visualize the code. They visualize static structure. But that's not what we need to understand. We need to understand what the code is doing.

holy lol

Max Facetime
Apr 18, 2009

herp derp, if only we could see what that terrible library is doing in the form of endless lists of numbers and abstract drawings then we all could be programmers

Nomnom Cookie
Aug 30, 2009



Csv parser is literally 20 lines of java. 40 if you hand code the dfa. Depending on some janky lib doesn't get you anything other than a headache when you need to parse something the lib won't.

wolffenstein
Aug 2, 2002
 
Pork Pro

Milkie Galore posted:

bret victor has a breathtakingly inflated opinion of his own importance and it bothers me slightly that people let him get away with it

the guy gave an hour long speech earlier this year in which he demonstrated some example programs hes written. this comprised half an hour of casually-scripted pseudo-spontaneous "oh i wonder what would happen if" moments designed to make using his software appear effortless and intuitive, followed by half an hour of thoughtfully spewing platitudes in order to elevate his computer programs into a fully fledged philosophy for living one's life

not content with this, he then, from his newly-erected visionary podium, without so much as a whiff of self awareness, compares himself to tesla and englebert, and suggests his personal life philosophy (wanting to improve software usability) is like 19th century feminist elizabeth cady stanton's desire to overcome social injustice



the mans a loving intellectual fraud and i wish people would stop cleaning his anus out with their tongues
Honestly I haven't heard of him before I saw this article. However I think despite his over-inflated ego, there's some worthwhile advice for teaching; advice I wish my teachers had taken. Hell I didn't learn about source control until my last semester of school (and on my own), and I wish freshman me knew about it.

Shaggar
Apr 26, 2006

Nomnom Cookie posted:

Csv parser is literally 20 lines of java. 40 if you hand code the dfa. Depending on some janky lib doesn't get you anything other than a headache when you need to parse something the lib won't.


wrong as heck. you're going to end up with something that suits your one need at the time before you move on to another project at which point you'll come back with another case that you missed in your first parser attempt. so you'll end up spending 10 times as long trying to hit all the edge cases and still not having something that works as well as an open sores that autists have spent the last couple of years maintaining and improving to the point that its gonna do everything you'll ever need and be bug free.

people who refuse to reuse code, even simple stuff, are the worst and cause all of the headaches.

tef
May 30, 2004

-> some l-system crap ->

Milkie Galore posted:

bret victor has a breathtakingly inflated opinion of his own importance and it bothers me slightly that people let him get away with it

i dunno, never met him.

quote:

the guy gave an hour long speech earlier this year in which he demonstrated some example programs hes written. this comprised half an hour of casually-scripted pseudo-spontaneous "oh i wonder what would happen if" moments designed to make using his software appear effortless and intuitive, followed by half an hour of thoughtfully spewing platitudes in order to elevate his computer programs into a fully fledged philosophy for living one's life

i dunno, he kinda said 'it's annoying when you can't see what you're doing, so let me make an example of what it might be like if you could'

quote:

not content with this, he then, from his newly-erected visionary podium, without so much as a whiff of self awareness, compares himself to tesla and englebert, and suggests his personal life philosophy (wanting to improve software usability) is like 19th century feminist elizabeth cady stanton's desire to overcome social injustice

i felt he was suggesting to the audience that they could strive to make changes in life rather than simply refining their craft. he also said 'i'm not saying I am these people', eh.


quote:

the mans a loving intellectual fraud and i wish people would stop cleaning his anus out with their tongues

i dunno, he seems to want to get people to try and change things rather than just refine their turd polishing.

then again, I kinda liked his earlier essay so i was already receptive to his ideas.

tef
May 30, 2004

-> some l-system crap ->

HORATIO HORNBLOWER posted:

coding tests are stupid and a waste of time

not as much as interviewing people who can't code for poo poo.

quote:

ask real questions that require paragraph-length answers about concepts that are crucial to your business and or your project

yep, but if you're asking these questions you kinda want to filter out people quickly.

quote:

and no trick google questions about light switches or escaping from a blender or you will surely burn in hell forever

yep.

tef
May 30, 2004

-> some l-system crap ->

Shaggar posted:

if you need to ask specific development questions, ask real world ones and expect real world solutions. ex: Q: You have a csv file that you need to need to read and then load into a database. how do u do? A: grab a csv deserializer off of maven, use it to load the data into ur classes, spit the data into procs via mybatis. if they start writing code for a csv parser get up and leave.

people have been trained to show they understand something by implementing it in an interview

you kinda have to ask a leading question if you want to get the 'of course i'd loving google it' answer

Jonnty
Aug 2, 2007

The enemy has become a flaming star!

Shaggar posted:

wrong as heck. you're going to end up with something that suits your one need at the time before you move on to another project at which point you'll come back with another case that you missed in your first parser attempt. so you'll end up spending 10 times as long trying to hit all the edge cases and still not having something that works as well as an open sores that autists have spent the last couple of years maintaining and improving to the point that its gonna do everything you'll ever need and be bug free.

people who refuse to reuse code, even simple stuff, are the worst and cause all of the headaches.

an entirely correct shaggar post?? i feel honoured to have witnessed this

Adbot
ADBOT LOVES YOU

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp

Shaggar posted:

if you need to ask specific development questions, ask real world ones and expect real world solutions. ex: Q: You have a csv file that you need to need to read and then load into a database. how do u do? A: grab a csv deserializer off of maven, use it to load the data into ur classes, spit the data into procs via mybatis. if they start writing code for a csv parser get up and leave.

like 9 lines of perl, dude

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