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
Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

MALE SHOEGAZE posted:

gently caress mongo

Adbot
ADBOT LOVES YOU

JewKiller 3000
Nov 28, 2006

by Lowtax

Sapozhnik posted:

that is a lie btw nobody is productive in c++

what the gently caress is even the point of c++

it feels like some sort of programmer dick measuring contest that got really out of hand

there are two important axioms of c++:
1. every language feature the committee can think of shall be included
2. the runtime cost of any language feature shall be as minimal as possible, preferably zero
the rest of the language follows

JewKiller 3000
Nov 28, 2006

by Lowtax
c++ is not poorly thought out, it is very well thought out in great detail by experts, but it sucks because of those goals

Slurps Mad Rips
Jan 25, 2009

Bwaltow!

JewKiller 3000 posted:

c++ is not poorly thought out, it is very well thought out in great detail by experts, but it sucks because of those goals

As an example: The reason we're getting co_yield and not yield as a keyword is because Solaris has a system call named "yield". Additionally, many agricultural businesses have code where "yield" is a variable name

Luigi Thirty
Apr 30, 2006

Emergency confection port.

https://twitter.com/LuigiThirty/status/874354614061158400

Sapozhnik
Jan 2, 2005

Nap Ghost

Slurps Mad Rips posted:

As an example: The reason we're getting co_yield and not yield as a keyword is because Solaris has a system call named "yield". Additionally, many agricultural businesses have code where "yield" is a variable name

Or they could add a reserved word _Yield (every symbol starting with an underscore followed by a capital letter or another underscore is reserved for the language impl) from the namespace they actually do own and then add a header called <coroutine> (header names with no period in them are reserved) that #defines it to yield, but I guess that would be the smart thing to do

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
just make it a keyword that stops being a keyword if there is some other thing named "yield" in scope

you already need to know what names are in scope to parse the language correctly, so it's not a huge burden

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

Jabor posted:

just make it a keyword that stops being a keyword if there is some other thing named "yield" in scope

you already need to know what names are in scope to parse the language correctly, so it's not a huge burden

private String clazz;

JewKiller 3000
Nov 28, 2006

by Lowtax

Jabor posted:

just make it a keyword that stops being a keyword if there is some other thing named "yield" in scope

you already need to know what names are in scope to parse the language correctly, so it's not a huge burden

please tell me you don't design languages

PIZZA.BAT
Nov 12, 2016


:cheers:


MALE SHOEGAZE posted:

gently caress mongo

agreed. use marklogic

Luigi Thirty
Apr 30, 2006

Emergency confection port.

carry on then posted:

private String clazz;

NO

anyway yessss it works, back-face culling and flat shading (with light projected from the center of the camera) baked into DrawTriangle() lol. they need to be split out from there but oh well

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

JewKiller 3000 posted:

please tell me you don't design languages

if your language is already definitely parseable then it's a horrible idea yeah

but you already need to know what names are in scope and what they represent in order to figure out what
code:

butt * hole;
means, so for c++ specifically it's not so bad

Brain Candy
May 18, 2006

JewKiller 3000 posted:

please tell me you don't design languages

i propose they use 'yield () -> val'

uncle w benefits
Nov 1, 2010

hi, it's me, your uncle
This thread is a fascinating journey into The Computer Language

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
I'm trying to grep a string

"[info] 17.21.0-11-38poopbutt-SNAPSHOT"

i'm doing

code:
sbt project version | grep "\[info]\"
and there are no matches

doing
code:
sbt project version | grep "[info]" # or grep \[info\]
does character matches on i, n, f, and o

i want to match all of "[info]" including the brackets

wtf is going on?? i've had a bit to drink but this seems totally wrong

DONT THREAD ON ME fucked around with this message at 01:49 on Jun 14, 2017

Bloody
Mar 3, 2013

what about \[info\]

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Bloody posted:

what about \[info\]

my post was wrong i updated

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
god dammit nevermind; sbt colorizes things which i can tell because i am looking at the colorized output

CPColin
Sep 9, 2003

Big ol' smile.
Did it work with double backslashes?

There Will Be Penalty
May 18, 2002

Makes a great pet!
any of the following should work:

code:
grep -F '[info]'
grep '\[info\]'
grep "\\[info\\]"

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
it was the colors, ya'll

CPColin
Sep 9, 2003

Big ol' smile.
wow racist

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

CPColin posted:

wow racist

proud member of the gnu klux klan

Shaggar
Apr 26, 2006

MALE SHOEGAZE posted:

god dammit nevermind; sbt colorizes things which i can tell because i am looking at the colorized output
why in the hell would you use sbt, let alone at a command prompt?

Soricidus
Oct 21, 2010
freedom-hating statist shill

MALE SHOEGAZE posted:

god dammit nevermind; sbt colorizes things which i can tell because i am looking at the colorized output

... it colorizes things when it's not printing to a tty?

a bad program

qhat
Jul 6, 2015


Shaggar posted:

why in the hell would you use sbt, let alone at a command prompt?

Understandably, using a command prompt on windows is absolute hell

aardvaard
Mar 4, 2013

you belong in the bog of eternal stench

qhat posted:

Understandably, using a command prompt on windows is absolute hell

actually it's just win+r "cmd"

Powerful Two-Hander
Mar 10, 2004

Mods please change my name to "Tooter Skeleton" TIA.


MALE SHOEGAZE posted:

proud member of the gnu klux klan

:eyepop:

NihilCredo
Jun 6, 2011

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

CommunistPancake posted:

actually it's just win+x "p"

compuserved
Mar 20, 2006

Nap Ghost

Soricidus posted:

... it colorizes things when it's not printing to a tty?

a bad program

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man

qhat posted:

Understandably, using a command prompt on windows is absolute hell

powers hell is dogs hit

Shaggar
Apr 26, 2006

qhat posted:

Understandably, using a command prompt on windows is absolute hell

any command prompt is hell but hes clearly using a Linux which has the worst command prompt

30 TO 50 FERAL HOG
Mar 2, 2005



so im bad at sql sserver

code:
DECLARE @return int

	SELECT  TOP 1
			@return = PIN + 1
	FROM    [dbo].[Product] OuterSearch
	WHERE   [OuterSearch].[Category_ID] = @ID
			AND
			NOT EXISTS
			(
			SELECT  NULL
			FROM    [dbo].[Product] InnerSearch 
			WHERE   [InnerSearch].[Category_ID] = @ID
					AND
					[InnerSearch].[PIN] = [OuterSearch].[PIN] + 1
			)
	ORDER BY
			PIN

	RETURN ISNULL(@return, 1)
basically im trying to find the first "gap" in the PIN column for a given Category ID, it works great except if the first available PIN is 1

so for example

[1, 2, 3, 5, 6, 7, 8]

will return 4, which is correct

[] (no results)

will return 1 thanks to the "ISNULL(@return, 1)", which is correct

and

[2, 3, 4, 5, 6, 7, 8]

will return 9, which is wrong. it should return a 1

could someone please tell me exactly in what way i am an idiot?

gonadic io
Feb 16, 2011

>>=
quick terrible programmer question: i'm working with a db that defines a (read-only) date as 3 ints (year, month, day). I cannot change this fact.

i would like to define inequalities on this type that don't require complex functions that gently caress with indexing/optimisers like 'concat', or 'date' to actual parse. i would like to just do inequalities on the ints.

I am assuming that all dates are valid i.e. month is never above 12, and none of the fields are 0 or below.

What I have, that works is (in scala):
code:
    case class Date(year: Int, month: Int, day: Int)
    
    def lt(a: Date, b: Date): Boolean = 
        a.year < b.year || 
            (a.year == b.year &&
                (a.month < b.month ||
                    (a.month == b.month && a.day < b.day) ))
But I can't figure out a way to simplify this, is there a way or am I going to have to copy/paste this into every query?

Mao Zedong Thot
Oct 16, 2008


why wouldn't you just parse the date?

jony neuemonic
Nov 13, 2009

Phobeste posted:

powers hell is dogs hit

i don't mind it, the shell is fine and the language has warts but it's still way nicer than bash scripting. what don't you like about it?

FamDav
Mar 29, 2008

BiohazrD posted:

so im bad at sql sserver

code:

DECLARE @return int

	SELECT  TOP 1
			@return = PIN + 1
	FROM    [dbo].[Product] OuterSearch
	WHERE   [OuterSearch].[Category_ID] = @ID
			AND
			NOT EXISTS
			(
			SELECT  NULL
			FROM    [dbo].[Product] InnerSearch 
			WHERE   [InnerSearch].[Category_ID] = @ID
					AND
					[InnerSearch].[PIN] = [OuterSearch].[PIN] + 1
			)
	ORDER BY
			PIN

	RETURN ISNULL(@return, 1)

basically im trying to find the first "gap" in the PIN column for a given Category ID, it works great except if the first available PIN is 1

so for example

[1, 2, 3, 5, 6, 7, 8]

will return 4, which is correct

[] (no results)

will return 1 thanks to the "ISNULL(@return, 1)", which is correct

and

[2, 3, 4, 5, 6, 7, 8]

will return 9, which is wrong. it should return a 1

could someone please tell me exactly in what way i am an idiot?

not looking at your code but from your test cases your sql returns the smallest pin+1 where pin is in your set and pin+1 isnt so you should probably add a 0

ultravoices
May 10, 2004

You are about to embark on a great journey. Are you ready, my friend?

gonadic io posted:

quick terrible programmer question: i'm working with a db that defines a (read-only) date as 3 ints (year, month, day). I cannot change this fact.

i would like to define inequalities on this type that don't require complex functions that gently caress with indexing/optimisers like 'concat', or 'date' to actual parse. i would like to just do inequalities on the ints.

i would feed the ints to a datetime object and check for inequality that way.

this is probably wrong.

FamDav
Mar 29, 2008

gonadic io posted:

quick terrible programmer question: i'm working with a db that defines a (read-only) date as 3 ints (year, month, day). I cannot change this fact.

i would like to define inequalities on this type that don't require complex functions that gently caress with indexing/optimisers like 'concat', or 'date' to actual parse. i would like to just do inequalities on the ints.

I am assuming that all dates are valid i.e. month is never above 12, and none of the fields are 0 or below.

What I have, that works is (in scala):
code:

    case class Date(year: Int, month: Int, day: Int)
    
    def lt(a: Date, b: Date): Boolean = 
        a.year < b.year || 
            (a.year == b.year &&
                (a.month < b.month ||
                    (a.month == b.month && a.day < b.day) ))

But I can't figure out a way to simplify this, is there a way or am I going to have to copy/paste this into every query?

can you not do (a.year, a.month, a.day) < (b.year, b.month, b.day)? that should work in MySQL

alternatively you could compare a.year*366+a.month*31+a.day

Adbot
ADBOT LOVES YOU

Shaggar
Apr 26, 2006

ultravoices posted:

i would feed the ints to a datetime object and check for inequality that way.

this is probably wrong.

nope, that's correct. use your language's datetime instead of creating your own. alternatively, convert to a datetime in your proc before returning.

  • Locked thread