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
HoboMan
Nov 4, 2010

Shaggar posted:

typescript is inferior to c# and still involves javascript at some point

i keep finding bugs in js libraries' type definitions.

Adbot
ADBOT LOVES YOU

HoboMan
Nov 4, 2010


im this test:

cinci zoo sniper
Mar 15, 2013




before i start, let me say that i clearly am biased in favour of python here

any pitches for a comparison of use of R and python in prod? basically i may need to put forth an argument against R and prod, but i am not sure if i have all the right bases covered as for why

the project itself is an internal web dashboard with bunch of pages with interactive plots that should update itself once per hour, or on user's click of update button. an update of a page is comprised of fetching new numbers from sql and executing trivial stats script on them. there are no infrastructure requirements for integration with ldap or oauth or ad or something.

the two and a half men options:

1) R Shiny (bad imho, pure R-stan, although boss has used it in prod for similar purpose aeons ago)
1a) R Shiny with plot.ly (well, at least something, battle-tested interactive web plots)
2) Dash with plot.ly (Shiny for Python from people who know tf they are doing (plot.ly authors))

in cases 1 and 1a deployment happens through homebrew webserver with god knows loving what and why and R integrations. drawbacks on free edition:

1) no scaling or process persistence
2) community-written db drivers

in case 2 deployment, it's a standard python framework for web apps with all that the consequences. bundle consists of flask, plot.ly, and react.js, and is simplified for analysts. im not even sure what are the specific drawbacks here, it just a regular web app that we can throw into one of our aws things or just on-premises. it also has its own db drivers.

with that said, semi lang-specific things id hold against r compared to python in prod:

1) its slow (analysts are writing, not professional r developers)
2) its really bad with error handling, reporting, and poo poo (again, analysts are writing)
3) we wont be able to find a person to maintain or optimise it (in that specific job location, remote is not an option), whereas getting a competent python dude would be easy
4) its bad about lots of data (lovely gc, memory management)
5) the shiny thing doesn't seem to be nowhere near as battle-tested as plot.ly, flask, or react
6) S3/S4 poo poo
7) lots of other archaic idiocy

anything else? am i elbow deep in my rear end trying to ban r from prod?

motedek
Oct 9, 2012
sounds right. R sucks to deploy.

NihilCredo
Jun 6, 2011

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

Shaggar posted:

typescript is inferior to c# and still involves javascript at some point

you would probably like bridge.net. doesn't fix the latter but it does the former

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer
When I did typescript I still ended up having to cast poo poo to any enough that the type safety of the language wasn't that helpful.

MrMoo
Sep 14, 2000

Sapozhnik posted:

why aren't you using babel

async await is only a special case of bidirectional messaging which is what my app primarily utilises. The hurdles I am jumping through are animation frame for scheduling at the start of a display frame, and idle callback for after a frame has painted but before the next frame starts.

If you start with a dataurl it needs to be converted to a Response an async process ~2ms, convert to a Blob, another ~2ms async process, then into an ImageBitmap which I blit onto an offscreen WebGL texture then finally push into the view. Now punt the ImageBitmap processing into a separate thread as it takes too long. Basically take each pipeline stage and execute in the idle frame time and then only at the end synchronise to the start of a frame and update the display.

suffix
Jul 27, 2013

Wheeee!

Sweevo posted:

:doh:

in that case maybe:

code:
switch(true)
{
    case (varname & 0b111000):
    case (varname & 0b011100):
    case (varname & 0b001110):
    case (varname & 0b000111):
    case (varname & 0b100011):
    case (varname & 0b110001):
        <code for match goes here>
        break;
    default:
        <code for non-match goes here>
}

this just tests if any bits are set at all, you'd need (varname & 0b111000) == 0b111000, etc.

the fancy bit solution is
code:
fn threebits(n: u8) -> bool {
    let rot1 = (n<<1) | (n>>5);
    let rot2 = (n<<2) | (n>>4);
    n & rot1 & rot2 & 0x3f != 0
}
e actualyl you don't need the last 0x3f if the input is valid

gonadic io
Feb 16, 2011

>>=

suffix posted:

this just tests if any bits are set at all, you'd need (varname & 0b111000) == 0b111000, etc.

the fancy bit solution is
code:
fn threebits(n: u8) -> bool {
    let rot1 = (n<<1) | (n>>5);
    let rot2 = (n<<2) | (n>>4);
    n & rot1 & rot2 & 0x3f != 0
}
e actualyl you don't need the last 0x3f if the input is valid

i love it

Sapozhnik
Jan 2, 2005

Nap Ghost
it is almost 9 pm and i have spent three hours trying to figure out why chrome is refusing to open a websocket connection and just silently going "teehee ;-) *fartz* *The WebSocket handshake was cancelled*"

a flash of recollection from what Git tells me was October 2015 reminded me that Content-Security-Policy is a thing that exists

i feel the need to learn at least three new spoken languages so that i may weave a tapestry of profanity rich enough to do justice to my rage right now

MrMoo
Sep 14, 2000

That's pretty terrible, for a while now you must assume some work is required to access almost anything other than images from a different domain in a browser. You don't explicitly mention but you certainly wouldn't see a CSP error from a non-browser websocket client.

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

motedek posted:

sounds right. R sucks to deploy.

I never even met anyone who wrote R applications, they're all about writing individual scripts to help them in some study/analysis and that sounds alright in my book

cinci zoo sniper
Mar 15, 2013




Symbolic Butt posted:

I never even met anyone who wrote R applications, they're all about writing individual scripts to help them in some study/analysis and that sounds alright in my book

we have one guy in our company, and boss had some on her last job. r is very much ok for scripts and analysis stuff, it's a scripting language made for that

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

lol at “deploying” r

Mao Zedong Thot
Oct 16, 2008


ctps: discovered staging environment uses a forked and very divergent version of production environment configuration for this (extremely critical and fundamental) widgetserver

so instead of making 1 extremely dangerous change and testing it on staging and then deploying it to production, i now have to make 1 extremely dangerous change for staging which doesn't tell me anything about the other extremely dangerous change i'm making to production lol :cool:

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
shutupandshipit

cinci zoo sniper
Mar 15, 2013




c r in prod s: im making a python demo to see if 6 week deadline is doable

feedmegin
Jul 30, 2008

Sapozhnik posted:

x11 is an async rpc protocol for bitmapped rendering that also provides an event stream

x servers do not host any application logic

Well, sort of - it has stuff for bitmaps and sending them to/from the server, but it's actually closer in layer of abstraction to GDI - there are X commands to draw lines, rectangles, render text, all that sort of stuff. It's not quite as dumb as pushing a bitmap (though more and more that's how modern UI toolkits have used it, partly because server and client are nearly always on the same machine these days and partly because it's hard to make modern fancy looking UIs using the basic X rendering primitives). Still not a good place to put the network communication though, really you want your whole high level UI toolkit (line edits, labels, combo boxes, layout managers) running on the server side.

quote:

display postscript i guess in some old incarnations runs imperative code on the renderer side of things but even then it's an immediate-mode rendering api.

react is a tree of stateful thunks. there is a scene graph and there is absolutely client-side intelligence involved.

A better comparison is actually NeWS from back in the day. Also PostScript based, but your UI toolkit (equivalent of gtk or Qt) was written in PostScript, ran in the display server, and your app could run arbitrary PostScript there too. It was Sun proprietary and so X killed it, which is a shame because I could see it going a whole other direction once the Internet hit big.

motedek
Oct 9, 2012

Symbolic Butt posted:

I never even met anyone who wrote R applications, they're all about writing individual scripts to help them in some study/analysis and that sounds alright in my book

it's great for that until executives get confused and want to make them into "products" and don't want to hire real developers

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
what’s a fun offline coding challenge that i can do in around 10 hours while im on a plane?

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

MALE SHOEGAZE posted:

what’s a fun offline coding challenge that i can do in around 10 hours while im on a plane?

I enjoyed Raytracer In One Weekend but it’s not really a challenge.

I don’t know C++ though, maybe it’s more boring if you do.

jesus WEP
Oct 17, 2004


forums rewrite imo

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

Fart app.

cinci zoo sniper
Mar 15, 2013




can someone chew for me what in practice is flask and where it fits in my 10 year old concept "lets install something apache and then slam it up with php files" of webserver "administration"

VikingofRock
Aug 24, 2008




St Evan Echoes posted:

forums rewrite imo

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

cinci zoo sniper posted:

can someone chew for me what in practice is flask and where it fits in my 10 year old concept "lets install something apache and then slam it up with php files" of webserver "administration"
A framework for small web apps and ~~microservices~~, if I recall correctly. Basically you just run it and reverse proxy from a real webserver.

Also, sorry about the PHP.

cinci zoo sniper
Mar 15, 2013




John Big Booty posted:

A framework for small web apps and ~~microservices~~, if I recall correctly. Basically you just run it and reverse proxy from a real webserver.

Also, sorry about the PHP.
nah that was in the bygone age of popularity of private mmo shards in latvia when i last had to do something with php, it's just that my understanding of web systems hasn't moved much since then

although our workplace does apparently exactly that, it all started as a mysql+php trashfire with understandable consequences

oh and yeah ty, so the microservice thing is basically like a self-contained baby webserver

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

cinci zoo sniper posted:

oh and yeah ty, so the microservice thing is basically like a self-contained baby webserver
The code runs on top of any number of smaller servers that implement the WSGI standard (https://wsgi.readthedocs.io/en/latest/) Most similar frameworks have one bundled in, but you rarely want to use them for production.

You can run it directly on 80, but it's usually better to proxy it.

Sapozhnik
Jan 2, 2005

Nap Ghost
in the beginning there were static web servers

then people wanted to do dynamic things on the web so people added cgi capabilities to static web servers

then people noticed that serving dynamic requests from separate processes that were spawned once per request was hella slow

very smart man rasmus lehrdorf saw this state of affairs, and decided that the problem was the "separate processes" bit instead of the "spawned once per request bit" so he wrote a shittastic script interpreter and embedded it inside the static web server apache. also somewhere around this time mod_perl was created to do something similar as a hack to make unmodified perl scripts (because why would you use a lang other than perl) think they were running in a separate process whereas they were actually running in a shared interpreter inside the apache web server (because why would you use a web server other than apache)

people were very smart in 1998

also somewhere around this time sun decided that they should stick their oar in, after seeing what a tremendous success java applets were they created the "servlet" standard. this was a novel scheme where you actually had your web applications running as long-running processes, and the best tool for managing these long-running processes was uhh your operating system, same as any other processes a "web servlet container" process. since the requests were now being handled out of process you now needed a way to carry http requests received by the static web server to these long running processes that also dealt with http things, so the obvious choice of protocol for that was uhh literally just http are you stupid lmao some weird lovely proprietary http-like transport because reasons

2001 was the year of the galaxy brain in java land. i think there was also a lot of excitement about xml




anyway yeah these days you just have separate script interpreters that accept plain old http requests on high ports on localhost. although php is still huffing glue like usual so you have this thing called php_fpm where it uses the "fastcgi" protocol instead of literally just loving http aargh.

but for the most part, in the modern small-brain world, the typical solution is that you set up your static web server to face the outside world. it handles logging, ssl, and static content serving. urls corresponding to dynamic resources get pattern-matched and sent to your application server processes using http reverse proxying.

nginx is a fashionable static web server because it's built around async io and its really fast!!! but apache is perfectly fine too and nginx vs apache is more a question of fashion than anything terribly meaningful.

tef
May 30, 2004

-> some l-system crap ->
try reading wikipedia sometime, might learn something

cinci zoo sniper
Mar 15, 2013




John Big Booty posted:

The code runs on top of any number of smaller servers that implement the WSGI standard (https://wsgi.readthedocs.io/en/latest/) Most similar frameworks have one bundled in, but you rarely want to use them for production.

You can run it directly on 80, but it's usually better to proxy it.

oic (kinda). ill leave that a devops headache, i just need to get a flask-based dashboard ( https://plot.ly/dash/ ) running for internal use

cinci zoo sniper
Mar 15, 2013




Sapozhnik posted:

in the beginning there were static web servers

then people wanted to do dynamic things on the web so people added cgi capabilities to static web servers

then people noticed that serving dynamic requests from separate processes that were spawned once per request was hella slow

very smart man rasmus lehrdorf saw this state of affairs, and decided that the problem was the "separate processes" bit instead of the "spawned once per request bit" so he wrote a shittastic script interpreter and embedded it inside the static web server apache. also somewhere around this time mod_perl was created to do something similar as a hack to make unmodified perl scripts (because why would you use a lang other than perl) think they were running in a separate process whereas they were actually running in a shared interpreter inside the apache web server (because why would you use a web server other than apache)

people were very smart in 1998

also somewhere around this time sun decided that they should stick their oar in, after seeing what a tremendous success java applets were they created the "servlet" standard. this was a novel scheme where you actually had your web applications running as long-running processes, and the best tool for managing these long-running processes was uhh your operating system, same as any other processes a "web servlet container" process. since the requests were now being handled out of process you now needed a way to carry http requests received by the static web server to these long running processes that also dealt with http things, so the obvious choice of protocol for that was uhh literally just http are you stupid lmao some weird lovely proprietary http-like transport because reasons

2001 was the year of the galaxy brain in java land. i think there was also a lot of excitement about xml




anyway yeah these days you just have separate script interpreters that accept plain old http requests on high ports on localhost. although php is still huffing glue like usual so you have this thing called php_fpm where it uses the "fastcgi" protocol instead of literally just loving http aargh.

but for the most part, in the modern small-brain world, the typical solution is that you set up your static web server to face the outside world. it handles logging, ssl, and static content serving. urls corresponding to dynamic resources get pattern-matched and sent to your application server processes using http reverse proxying.

nginx is a fashionable static web server because it's built around async io and its really fast!!! but apache is perfectly fine too and nginx vs apache is more a question of fashion than anything terribly meaningful.

this is seriously cool, thanks!

cinci zoo sniper
Mar 15, 2013




tef posted:

try reading wikipedia sometime, might learn something

sounds like im in the right place then

cinci zoo sniper
Mar 15, 2013




unrelated java question about chitchat im having elsewhere

public static void main(String args[ ])

this declares main

public static void main(final String[] args) throws Exception

this seeming declares main too

1) arguments cant be altered
2) it is supposed to throw exception it never does, e.g. if inside method there is throw OtherException everything still happens ignoring this

what i saw somewhere is that throws Exception is supposed to help with stack traces in some way, could anyone briefly comment on this?

CPColin
Sep 9, 2003

Big ol' smile.
1) The final keyword doesn't change the signature of the method in Java. As for the brackets, Java lets you put them either after the type or after the name when declaring arrays. It's pretty dumb.
2) That just means "might throw java.lang.Exception (or something that extends it)." It doesn't mean "will throw Exception" and has no effect on stack traces.

cinci zoo sniper
Mar 15, 2013




CPColin posted:

1) The final keyword doesn't change the signature of the method in Java. As for the brackets, Java lets you put them either after the type or after the name when declaring arrays. It's pretty dumb.
2) That just means "might throw java.lang.Exception (or something that extends it)." It doesn't mean "will throw Exception" and has no effect on stack traces.

i see. Richard's answer there then is some bollocks i take it?

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
throws Exception is useful if you have code in there that throws a checked exception. if you dont have throws Exception, and you invoke code that throws a checked exception, you need to wrap it with try/catch.

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
also i always make all method parameters final because that was the input to the function and it shouldn't change

CPColin
Sep 9, 2003

Big ol' smile.

cinci zoo sniper posted:

i see. Richard's answer there then is some bollocks i take it?

Yeah, his answer has a vague smell of cargo culting.

"The args are declared final because technically they should not be altered." The "technically" in that sentence is bogus. If you want to give your variables a general air of immutability, fine, declare stuff final. Otherwise, there's no inherent harm in having non-final method parameters, aside from confusing a newbie programmer when he tries to reassign a method parameter and the value isn't reflected in the calling code. Declaring an array final can give a false sense of security, anyway, because the individual elements can still be reassigned.

"You should usually specify that main throws Exception so that stack traces can be echoed to console easily without needing to do e.printStackTrace() etc." It sounds like Richard got tired of wrapping everything his main() methods call in try/catch blocks that just print a stack trace and now prefers letting everything bubble out. That's fine, but there's really no need to add "throws Exception" until something actually needs it. It's also more desirable to be specific about what might actually be thrown, in my preferred style. Some people absolutely hate checked exceptions in Java and just declare "throws Exception" every time. They write bad libraries that I hate.

"I personally think it's a bit of a mistake in Java that arrays can sometimes be declared in that manner." :agreed:

Adbot
ADBOT LOVES YOU

cinci zoo sniper
Mar 15, 2013




CPColin posted:

Yeah, his answer has a vague smell of cargo culting.

"The args are declared final because technically they should not be altered." The "technically" in that sentence is bogus. If you want to give your variables a general air of immutability, fine, declare stuff final. Otherwise, there's no inherent harm in having non-final method parameters, aside from confusing a newbie programmer when he tries to reassign a method parameter and the value isn't reflected in the calling code. Declaring an array final can give a false sense of security, anyway, because the individual elements can still be reassigned.

"You should usually specify that main throws Exception so that stack traces can be echoed to console easily without needing to do e.printStackTrace() etc." It sounds like Richard got tired of wrapping everything his main() methods call in try/catch blocks that just print a stack trace and now prefers letting everything bubble out. That's fine, but there's really no need to add "throws Exception" until something actually needs it. It's also more desirable to be specific about what might actually be thrown, in my preferred style. Some people absolutely hate checked exceptions in Java and just declare "throws Exception" every time. They write bad libraries that I hate.

"I personally think it's a bit of a mistake in Java that arrays can sometimes be declared in that manner." :agreed:

thanks for detailed explanation!

  • Locked thread