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
Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Flat Daddy posted:

the people that chose mongo for us were contractors whomst my team replaced, so I just have to be mad at the absentee leads and architects who let a team of contractors start this pile of poo poo.

thank god we're past 1.0 release and can actually rip up this rotting garbage. first to go is the monstrous angular+jquery SPA frontend with some of the worst code I've seen in my life. who knew switch (true) {} was a pattern???

switch (true)???? lmao get outta here *googles* dear god.

Adbot
ADBOT LOVES YOU

NihilCredo
Jun 6, 2011

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

JewKiller 3000 posted:

sup nerds i just wrote a query that has 3 ctes and uses an inner join, a left join, a right join, and two full joins :getin:

sup. yesterday i joined two recursive ctes together, using a concatenated column to prevent infinite loops

then i threw most of it away

Flat Daddy
Dec 3, 2014

by Nyc_Tattoo

Powaqoatse posted:

switch (true)???? lmao get outta here *googles* dear god.

the best part is every case checks the same variable like

code:
switch (true) {
case foo == 0: ...
    break;
case foo == 1: ...
    break;
  //etc
}

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
code:
// I'll be dead by this time, deal with it
queryEndDate = LocalDate.of(2099, 1, 1);

Arcteryx Anarchist
Sep 15, 2007

Fun Shoe
an honest comment

JewKiller 3000
Nov 28, 2006

by Lowtax

NihilCredo posted:

sup. yesterday i joined two recursive ctes together, using a concatenated column to prevent infinite loops

then i threw most of it away

awwww yeah that's the stuff :jackbud:

hifi
Jul 25, 2012

MononcQc posted:

So I'm toying with TUN/TAP devices in FreeBSD along with some custom software in the hopes of writing what is essentially a tiny ethernet firewall that simulates bad network connections.

I've got two working setups:

code:
Making a VM (in virtualbox) fail:

em1 <-+-> tap1 <---> [soft firewall] <---> tap0 <-+-> tap2 <==> VM <==> [driver]
      |                                           |
   bridge1                                     bridge0


Hardware Device (em1 connects to one edge device, and em0 to another one):

em1 <-+-> tap1 <---> [soft firewall] <---> tap0 <-+-> em0
      |                                           |
   bridge1                                     bridge0
This works fine in both cases, where I can inject random packet drops, corruption, delays or blocking, or simulate slow and/or asymmetric networks on failures. The problem I have is I somehow can't manage to make it work with local software, that I really wish I could.

I.e. I'd want to be able to make program A bind to an address on em1, and program B bind to an address on em0, and then get to tell the OS "make the traffic for these go through bridge0 and bridge1", but it appears the OS kind of hard-registers routes for those and always makes them go through the loopback interface, which bypasses my thing. Also all the loving FreeBSD networking resources online are about people trying to set up OpenVPN or something :(

that doesn't make sense but it's been a while since i used freebsd. you can try strace? or ktrace? to check what it's doing. what about stuff like nginx where you specify what ip to listen on?

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

lancemantis posted:

an honest comment

i wrote it

Elysiume
Aug 13, 2009

Alone, she fights.

Powaqoatse posted:

switch (true)???? lmao get outta here *googles* dear god.
this is incredible. if anyone doesn't want to google it, this works and alerts beta:
code:
var a = false, b = true;
switch (true) {
case(a):
    alert("alpha");
    break;
case(b):
    alert("beta");
    break;
default:
    alert("neither");
}

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

:kiss:

Arcsech
Aug 5, 2008

Elysiume posted:

this is incredible. if anyone doesn't want to google it, this works and alerts beta:
code:
var a = false, b = true;
switch (true) {
case(a):
    alert("alpha");
    break;
case(b):
    alert("beta");
    break;
default:
    alert("neither");
}

:wtc:

why would you do this

MononcQc
May 29, 2007

hifi posted:

that doesn't make sense but it's been a while since i used freebsd. you can try strace? or ktrace? to check what it's doing. what about stuff like nginx where you specify what ip to listen on?

Yeah that's the thing I'm doing; specifying binding on IPs. But it just goes and sounds like there's this magic loopback interface that if you go local -> local it just plops it on there and doesn't give a gently caress. I'm possibly doing something wrong and I'll have to reboot and try with no external interface at all from the ground up.

redleader
Aug 18, 2005

Engage according to operational parameters
i dreamt about writing a right join and then getting called on it in code review. my dreams suck

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?

cinci zoo sniper posted:

ive literally been assigned these two tasks, but it takes time and le mongo cant wait. worst case scenario, ill just make like 50 fake joins for most logical structure deviations and throw a "sorry not sorry" comment somewhere

is there some kind of flatmap mechanism you can use to reduce the structure to a linear array of dictionaries with enough applications?

if not it doesn't seem hard to write (if you can make things conditional on type)

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?

cinci zoo sniper posted:

god i wish it was xml, or i had realistic shot at converting json blobs to xml

oh I bet you could write some generic code to transliterate the JSON to XML, then you could apply the XPath to the XML, then you could transliterate the resulting XML to JSON





I'm full of ideas

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?

MononcQc posted:

So I'm toying with TUN/TAP devices in FreeBSD along with some custom software in the hopes of writing what is essentially a tiny ethernet firewall that simulates bad network connections.

if you have a Mac install Xcode and use the Network Link Conditioner to do this simulation

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?

Elysiume posted:

this is incredible. if anyone doesn't want to google it, this works and alerts beta:
code:
var a = false, b = true;
switch (true) {
case(a):
    alert("alpha");
    break;
case(b):
    alert("beta");
    break;
default:
    alert("neither");
}

what about file not found???

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

eschaton posted:

what about file not found???

check errno

VikingofRock
Aug 24, 2008




Arcsech posted:

:wtc:

why would you do this

I kinda get it, if you want to avoid a super long if-else chain. It's sort of like lisp's cond, except way hackier.

Personally I would go for the if-else chain though. Good god.

JawnV6
Jul 4, 2004

So hot ...
it's not even an if-else, it's just a chain of if's. a match doesn't preclude further matches

switch should, by my sensibilities at least, generate an indirect branch to the right case

There Will Be Penalty
May 18, 2002

Makes a great pet!

JawnV6 posted:

it's not even an if-else, it's just a chain of if's. a match doesn't preclude further matches

switch should, by my sensibilities at least, generate an indirect branch to the right case

i thought it was an if-else (really, if-elseif-else) pattern because the stuff under case(b) doesn't get executed if case(a) is truthy or am i missing something? still shameful.

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?

wrong

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?

JawnV6 posted:

it's not even an if-else, it's just a chain of if's. a match doesn't preclude further matches

switch should, by my sensibilities at least, generate an indirect branch to the right case

they obviously need to be introduced to the for-case paradigm

Zemyla
Aug 6, 2008

I'll take her off your hands. Pleasure doing business with you!

Flat Daddy posted:

the people that chose mongo for us were contractors whomst my team replaced, so I just have to be mad at the absentee leads and architects who let a team of contractors start this pile of poo poo.

thank god we're past 1.0 release and can actually rip up this rotting garbage. first to go is the monstrous angular+jquery SPA frontend with some of the worst code I've seen in my life. who knew switch (true) {} was a pattern???

I am seriously glad that you can't pull that switch (true) bullshit in Haskell. The behavior of case statements is well-defined there, and has no fallthrough and is all just pattern matching.

Elysiume
Aug 13, 2009

Alone, she fights.

There Will Be Penalty posted:

i thought it was an if-else (really, if-elseif-else) pattern because the stuff under case(b) doesn't get executed if case(a) is truthy or am i missing something? still shameful.
mine's an if-elif-else because it has breaks. you could do a weird structure like
code:
switch (true) {
case a:
    console.log("a");
case b:
    console.log("a || b");
    break;
case c:
    console.log("c && !(a || b)");
default:
    console.log("!(a || b)")
}
which would be equivalent to
code:
if (a) {
    console.log("a");
}
if (a || b) {
    console.log("a || b");
} else {
    if (c) {
        console.log("c && !(a || b)");
    }
    console.log("!(a || b)");
}
(among a couple other configurations, including a series of ifs on what's in the string literals)
(also by "you could do" I mean "nobody should ever do")

Elysiume fucked around with this message at 06:31 on Sep 1, 2017

Arcteryx Anarchist
Sep 15, 2007

Fun Shoe
its been a long time since I've used a switch statement

Workaday Wizard
Oct 23, 2009

by Pragmatica
so is jetty-maven-plugin supposed to ignore my jetty.xml ports or something? when i run jetty it ignores all of this and runs the server on 0.0.0.0:8080 exclusively. i cannot connect on 7777 even though the xml file gets ran. where is the plugin getting 0.0.0.0:8080 from? how can i remove that?

here is my jetty.xml
XML code:
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
<Configure id="MyServer" class="org.eclipse.jetty.server.Server">
    <Call name="addConnector">
        <Arg>
            <New class="org.eclipse.jetty.server.ServerConnector">
                <Arg><Ref refid="MyServer"/></Arg>
                <Set name="port">7777</Set>
            </New>
        </Arg>
    </Call>
    <Get class="java.lang.System" name="out">
        <Call name="println">
            <Arg>I swear to god I ran!!!!</Arg>
        </Call>
    </Get>
</Configure>
and here is my pom.xml
XML code:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 [url]http://maven.apache.org/xsd/maven-4.0.0.xsd[/url]">
    <modelVersion>4.0.0</modelVersion>

    <groupId>pos.yos</groupId>
    <artifactId>bithc</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <properties>
        <jettyVersion>9.4.7.RC0</jettyVersion>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>${jettyVersion}</version>
                <configuration>
                    <jettyXml>jetty.xml</jettyXml>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>4.0.0</version>
        </dependency>
    </dependencies>

</project>

Notorious b.s.d.
Jan 25, 2003

by Reene

Shinku ABOOKEN posted:

so is jetty-maven-plugin supposed to ignore my jetty.xml ports or something?
yes

i don't believe jetty-maven-plugin is supposed to be scraping anything out of your jetty.xml or other resources in the jar

Shinku ABOOKEN posted:

when i run jetty it ignores all of this and runs the server on 0.0.0.0:8080 exclusively. i cannot connect on 7777 even though the xml file gets ran. where is the plugin getting 0.0.0.0:8080 from? how can i remove that?
you either need to configure the ports in the plugin configuration, or you can use maven's execute plugin to run an application that starts jetty normally

Shaggar
Apr 26, 2006
it looks ok, but maybe try changing the configuration id from "MyServer" to "Server". The plugin may be using its own internal config and then adding yours which is adding a new server instead of modifying the one the plugin created.

Some good examples on how to configure the plugin here

Workaday Wizard
Oct 23, 2009

by Pragmatica

Shaggar posted:

try changing the configuration id from "MyServer" to "Server"

thats was it. thanks all.

MononcQc
May 29, 2007

I am about to sign a contract to get propertesting.com published with pragmatic programmers :toot:

my homie dhall
Dec 9, 2010

honey, oh please, it's just a machine

MononcQc posted:

I am about to sign a contract to get propertesting.com published with pragmatic programmers :toot:

:toot:

jony neuemonic
Nov 13, 2009

MononcQc posted:

I am about to sign a contract to get propertesting.com published with pragmatic programmers :toot:

heck yes.

HoboMan
Nov 4, 2010

ok so i added swashbuckle to my other api and i get a 404 trying to go to localhost:69420/swagger

i tried searching around and can't find anything

Flat Daddy
Dec 3, 2014

by Nyc_Tattoo

HoboMan posted:

ok so i added swashbuckle to my other api and i get a 404 trying to go to localhost:69420/swagger

i tried searching around and can't find anything

ooh I just added swashbuckle to something yesterday.


I didn't get a 404 tho so I can't help you with that sry

NihilCredo
Jun 6, 2011

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

can't help you either, sorry, i only did hello world with swashbuckle but didn't have that problem.

i'll post https://github.com/RSuter/NSwag for people interested, though. not as elegant as swashbuckle but more powerful in some ways (eg. autogenerate whole clients)


in actually somewhat related news:

i'm working on a thing that uses (a) swagger (b) dotnet and (c) open sores. so it's possible that https://www.newtonsoft.com/jsonschema (not to be confused with the serialization library everyone knows) may be useful for said thing. (i say 'possible' because swagger schemas and json schemas are slightly different, because web developers hate communication, but whatever.)

problem is, this json.net schema library has a weird license. in addition to regular commercial licenses, it's available under the scary AGPL for open sores projects, but limited into utter uselessness - max 10 schema generations / hour.

which confuses me. if it's under the AGPL, what's the point of adding a limitation like that? if I want to use it for an AGPL project, can't I just fork it from github and comment out the limiting code? (I checked, it's trivial)? I guess it could be considered a dick move towards the guy who maintains for free the single most popular .net library, but you're giving away your own work for free too so i'd say it's a wash. or is there some caveat under which it's a license violation to remove the limitation?

skimothy milkerson
Nov 19, 2006

skipping 700 posts to say thanks hoogle

thoogle

aardvaard
Mar 4, 2013

you belong in the bog of eternal stench

NihilCredo posted:

can't help you either, sorry, i only did hello world with swashbuckle but didn't have that problem.

i'll post https://github.com/RSuter/NSwag for people interested, though. not as elegant as swashbuckle but more powerful in some ways (eg. autogenerate whole clients)


in actually somewhat related news:

i'm working on a thing that uses (a) swagger (b) dotnet and (c) open sores. so it's possible that https://www.newtonsoft.com/jsonschema (not to be confused with the serialization library everyone knows) may be useful for said thing. (i say 'possible' because swagger schemas and json schemas are slightly different, because web developers hate communication, but whatever.)

problem is, this json.net schema library has a weird license. in addition to regular commercial licenses, it's available under the scary AGPL for open sores projects, but limited into utter uselessness - max 10 schema generations / hour.

which confuses me. if it's under the AGPL, what's the point of adding a limitation like that? if I want to use it for an AGPL project, can't I just fork it from github and comment out the limiting code? (I checked, it's trivial)? I guess it could be considered a dick move towards the guy who maintains for free the single most popular .net library, but you're giving away your own work for free too so i'd say it's a wash. or is there some caveat under which it's a license violation to remove the limitation?

if the limitation is part of the license, then yes. it's not "true" AGPL but you can totally say "this project is AGPL with the addition that you don't bypass this limitation."

Notorious b.s.d.
Jan 25, 2003

by Reene

NihilCredo posted:

i'm working on a thing that uses (a) swagger (b) dotnet and (c) open sores. so it's possible that https://www.newtonsoft.com/jsonschema (not to be confused with the serialization library everyone knows) may be useful for said thing. (i say 'possible' because swagger schemas and json schemas are slightly different, because web developers hate communication, but whatever.)

problem is, this json.net schema library has a weird license. in addition to regular commercial licenses, it's available under the scary AGPL for open sores projects, but limited into utter uselessness - max 10 schema generations / hour.

which confuses me. if it's under the AGPL, what's the point of adding a limitation like that? if I want to use it for an AGPL project, can't I just fork it from github and comment out the limiting code? (I checked, it's trivial)? I guess it could be considered a dick move towards the guy who maintains for free the single most popular .net library, but you're giving away your own work for free too so i'd say it's a wash. or is there some caveat under which it's a license violation to remove the limitation?

learn java, because the .net ecosystem sucks poo poo

Adbot
ADBOT LOVES YOU

NihilCredo
Jun 6, 2011

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

CommunistPancake posted:

if the limitation is part of the license, then yes. it's not "true" AGPL but you can totally say "this project is AGPL with the addition that you don't bypass this limitation."

it doesn't appear to actually be part of the license though:

https://github.com/JamesNK/Newtonsoft.Json.Schema/blob/master/LICENSE.md posted:

# Json.NET Schema

Copyright (c) 2014 Newtonsoft

This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published by the
Free Software Foundation, either version 3 of the License, see
http://www.gnu.org/licenses/agpl-3.0.html.

This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.


## Commercial License

In addition to this license, Json.NET Schema is offered under a commercial license.

  • Locked thread