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
gnatalie
Jul 1, 2003

blasting women into space
luigi thirty i did a "proper" mvvm version of your blackjack game without all the image stuff. have fun.

Adbot
ADBOT LOVES YOU

Fuck them
Jan 21, 2011

and their bullshit
:yotj:

BONGHITZ posted:

if only i could do things without having to learn how to do those things, that would be really nice

yes learn how to do asp.net forms when I could instead do anything else

lol

but yeah realpost that "I don't know this thing yet" feeling sucks

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

holy poo poo I didn't know you could put a camel in commit messages like that

duck.exe
Apr 14, 2012

Nap Ghost
how the gently caress does a* work? i've looked at a bunch of tutorials on it and it still doesn't make any sense :iiam:

Bloody
Mar 3, 2013

do you understand djikstra's?
http://en.wikipedia.org/wiki/A*

zeekner
Jul 14, 2007

if you just look at wikipedia it won't make much sense, you should check out one of the simpler game implementations. it's pretty easy to use a* to do path-finding on 2d grids, and that gives you a practical case for the heuristic and should be pretty easy to comprehend.

this looks like a decent breakdown: http://www.policyalmanac.org/games/aStarTutorial.htm

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

DukeDuke posted:

how the gently caress does a* work? i've looked at a bunch of tutorials on it and it still doesn't make any sense :iiam:

its less confusing once you actually write an implementation. just try to write it once and then you'll realize it's actually pretty simple

Luigi Thirty
Apr 30, 2006

Emergency confection port.


wow nice team foundation server error when i load it in visual studio...

also thanks this is v helpful

Malcolm XML
Aug 8, 2009

I always knew it would end like this.
http://www.redblobgames.com/pathfinding/a-star/introduction.html

Luigi Thirty
Apr 30, 2006

Emergency confection port.

well i have a wpf book recommendation so is c# in depth good too

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
judging by your blackjack thingummy, you'd be better off with Essential C# 5.0. i think there's a lot of foundational material you're probably missing

coffeetable fucked around with this message at 19:49 on Jul 30, 2014

Luigi Thirty
Apr 30, 2006

Emergency confection port.

let me tell you about my extensive experience in p-langs and how that knowledge applies to real world things outside of college

FamDav
Mar 29, 2008

MeramJert posted:

its less confusing once you actually write an implementation. just try to write it once and then you'll realize it's actually pretty simple

the short version is that for depth first search when i visit a new node i put its unvisited neighbors on a stack and work off the stack. for breadth first search i put unvisited neighbors in a queue and work off that. for a* i put unvisited neighbors in a heap that is sorted by my guess* about that point being in the shortest path and work off that.

my guess is how far it is from start to this point plus how far i think it is from that point to the end

FamDav fucked around with this message at 20:48 on Jul 30, 2014

FamDav
Mar 29, 2008
also admissable heuristic really just means your guess is never worse than reality,

Shaggar
Apr 26, 2006

Luigi Thirty posted:

let me tell you about my extensive experience in p-langs and how that knowledge applies to real world things outside of college

people in college are literally children so no matter how many times you tell them how things will work when they become adults, they refuse to believe it

Luigi Thirty
Apr 30, 2006

Emergency confection port.

Shaggar posted:

people in college are literally children so no matter how many times you tell them how things will work when they become adults, they refuse to believe it

i typed "shaggar was right" into google and the top result was a blogspot named Incarnating Abyssinian Hitlers through music

coffeetable posted:

judging by your blackjack thingummy, you'd be better off with Essential C# 5.0. i think there's a lot of foundational material you're probably missing

wow and it's only 27 dollars on amazon

Bloody
Mar 3, 2013

i got http://pastebin.com/RE96mWFU

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

Luigi Thirty posted:

i typed "shaggar was right" into google and the top result was a blogspot named Incarnating Abyssinian Hitlers through music


wow and it's only 27 dollars on amazon

http://libgen.org/

Corla Plankun
May 8, 2007

improve the lives of everyone

Luigi Thirty posted:

let me tell you about my extensive experience in p-langs and how that knowledge applies to real world things outside of college

literally every job i have had since high school has been made better by automating the stupid office crap everyone has to do all the time

and plangs make that super easy

Luigi Thirty
Apr 30, 2006

Emergency confection port.

i dont think thats legal timb

CISADMIN PRIVILEGE
Aug 15, 2004

optimized multichannel
campaigns to drive
demand and increase
brand engagement
across web, mobile,
and social touchpoints,
bitch!
:yaycloud::smithcloud:
I'm trying to normalize a table where each row contains 3 delimited strings with hundreds on entries in each. I've got a split string function which works well and the following function works but feels like idiot SQL to me because I'm making 3 temp tables with an identity and joining them all for the return table. Is there a simple solution?



code:
CREATE FUNCTION [dbo].[ShittyCreateTempTable]
(
   @STR_InputAcct NVARCHAR(15)
)
RETURNS @FinalTable table
(
ACCTNO VARCHAR(10),
F_Period VARCHAR(10),
Pos Int,
CR_AMT VARCHAR(10),
DR_AMT VARCHAR(10)
)

AS BEGIN
Declare @STR_TestPer NVARCHAR(MAX);
Declare @STR_TestCR NVARCHAR(MAX);
Declare @STR_TestDR NVARCHAR(MAX);
Declare @STR_ACCTNO VARCHAR(10);

DECLARE @TempTable table
(
Pos Int NOT NULL IDENTITY(1,1),
F_Period VARCHAR(10)
)

DECLARE @TempTableCR table
(
Pos Int NOT NULL IDENTITY(1,1),
CR_AMT VARCHAR(10)
)
DECLARE @TempTableDR table
(
Pos Int NOT NULL IDENTITY(1,1),
DR_AMT VARCHAR(10)
)


SELECT 
@STR_TestPer = [FISCAL_PER],
@STR_TestCR = [CR_AMT],
@STR_TestDR = [DB_AMT], 
@STR_ACCTNO = [ACCTNO]
	
FROM [V_TEST].[dbo].[GL_CHART_1] WHERE ACCTNO = @STR_InputAcct

Insert into @TempTable (F_Period)
Select Item FROM dbo.SplitStrings(@STR_TestPer, '^') as F_Period
Insert into @TempTableCR (CR_AMT)
Select Item FROM dbo.SplitStrings(@STR_TestCR, '^') as CR_AMT
Insert into @TempTableDR (DR_AMT)
Select Item FROM dbo.SplitStrings(@STR_TestDR, '^') as DR_AMT

Insert into @FinalTable (ACCTNO,Pos,F_Period,CR_AMT,DR_AMT)
Select 
@STR_ACCTNO,
per.Pos, per.F_Period, cr.CR_AMT, dr.DR_AMT 
From @TempTable per INNER JOIN @TempTableCR cr
	ON per.Pos = cr.Pos JOIN @TempTableDR dr 
	ON dr.Pos = cr.Pos

RETURN

MrMoo
Sep 14, 2000

It's idiot schema already, just do whatever to fix it.

Depends how frequently the data updates, one could leave the intermediate tables permanently in place and use triggers to update.

You could always stuff temporary tables behind a materialized view, unless its SQL Server and you probably have to fake it anyway.

CISADMIN PRIVILEGE
Aug 15, 2004

optimized multichannel
campaigns to drive
demand and increase
brand engagement
across web, mobile,
and social touchpoints,
bitch!
:yaycloud::smithcloud:
it's more of I want to know the right way. it's for data conversion so it only needs a couple of runs anyway, so in this case efficiency doesn't matter. it just feels like I'm doing something ugly where there should be a tidier approach.

Luigi Thirty
Apr 30, 2006

Emergency confection port.

ah databases something i do know abo--:stare: what the hell is that schema

CISADMIN PRIVILEGE
Aug 15, 2004

optimized multichannel
campaigns to drive
demand and increase
brand engagement
across web, mobile,
and social touchpoints,
bitch!
:yaycloud::smithcloud:

Luigi Thirty posted:

ah databases something i do know abo--:stare: what the hell is that schema

for some reason the author of this abomination decided just put GL accounts with one row each and concatenate the credits / debits in caret delimited strings.

Luigi Thirty
Apr 30, 2006

Emergency confection port.

do... do they still work there

Shaggar
Apr 26, 2006

CISADMIN PRIVILEGE posted:

I'm trying to normalize a table where each row contains 3 delimited strings with hundreds on entries in each. I've got a split string function which works well and the following function works but feels like idiot SQL to me because I'm making 3 temp tables with an identity and joining them all for the return table. Is there a simple solution?



code:
CREATE FUNCTION [dbo].[ShittyCreateTempTable]
(
   @STR_InputAcct NVARCHAR(15)
)
RETURNS @FinalTable table
(
ACCTNO VARCHAR(10),
F_Period VARCHAR(10),
Pos Int,
CR_AMT VARCHAR(10),
DR_AMT VARCHAR(10)
)

AS BEGIN
Declare @STR_TestPer NVARCHAR(MAX);
Declare @STR_TestCR NVARCHAR(MAX);
Declare @STR_TestDR NVARCHAR(MAX);
Declare @STR_ACCTNO VARCHAR(10);

DECLARE @TempTable table
(
Pos Int NOT NULL IDENTITY(1,1),
F_Period VARCHAR(10)
)

DECLARE @TempTableCR table
(
Pos Int NOT NULL IDENTITY(1,1),
CR_AMT VARCHAR(10)
)
DECLARE @TempTableDR table
(
Pos Int NOT NULL IDENTITY(1,1),
DR_AMT VARCHAR(10)
)


SELECT 
@STR_TestPer = [FISCAL_PER],
@STR_TestCR = [CR_AMT],
@STR_TestDR = [DB_AMT], 
@STR_ACCTNO = [ACCTNO]
	
FROM [V_TEST].[dbo].[GL_CHART_1] WHERE ACCTNO = @STR_InputAcct

Insert into @TempTable (F_Period)
Select Item FROM dbo.SplitStrings(@STR_TestPer, '^') as F_Period
Insert into @TempTableCR (CR_AMT)
Select Item FROM dbo.SplitStrings(@STR_TestCR, '^') as CR_AMT
Insert into @TempTableDR (DR_AMT)
Select Item FROM dbo.SplitStrings(@STR_TestDR, '^') as DR_AMT

Insert into @FinalTable (ACCTNO,Pos,F_Period,CR_AMT,DR_AMT)
Select 
@STR_ACCTNO,
per.Pos, per.F_Period, cr.CR_AMT, dr.DR_AMT 
From @TempTable per INNER JOIN @TempTableCR cr
	ON per.Pos = cr.Pos JOIN @TempTableDR dr 
	ON dr.Pos = cr.Pos

RETURN

I don't think you really need the temp tables but maybe im not totally getting the entire problem.

SQL code:
Insert into @FinalTable
(
	ACCTNO
	,Pos
	,F_Period
	,CR_AMT
	,DR_AMT
)
Select 
	@STR_ACCTNO
	,per.Pos
	,per.F_Period
	,cr.CR_AMT
	,dr.DR_AMT 
From 
	dbo.SplitStrings(@STR_TestPer, '^') per 
	INNER JOIN dbo.SplitStrings(@STR_TestCR, '^') cr
		ON per.Pos = cr.Pos
	INNER JOIN dbo.SplitStrings(@STR_TestDR, '^') dr 
		ON dr.Pos = cr.Pos

there isn't gonna be a great solution to that kind of hosed up data, but doing it with a table value function like that is probably the most "correct". lots of people would throw that poo poo into excel or write an external program to do it. as long as it works and you're only doing it once to normalize the data and all new data goes into the normalized table then it really doesn't matter that much.

CISADMIN PRIVILEGE
Aug 15, 2004

optimized multichannel
campaigns to drive
demand and increase
brand engagement
across web, mobile,
and social touchpoints,
bitch!
:yaycloud::smithcloud:

Luigi Thirty posted:

do... do they still work there

"they" is the author of a member database system for organizations which at one time had thousands of customers including some you've heard of. the poo poo is a result of an sql conversion upgrade from some dumbass flat file mainframe thing.

dude sold his company to a huge company for a shitload of money, who then several years later gave it back to him.

I don't have access to the application code and the only person who does that i know personally is a mediocre programmer at best (not to mention the code is c++ so if the SQL is that much of an abomination i don't actually want to see it)

CISADMIN PRIVILEGE
Aug 15, 2004

optimized multichannel
campaigns to drive
demand and increase
brand engagement
across web, mobile,
and social touchpoints,
bitch!
:yaycloud::smithcloud:

Shaggar posted:

I don't think you really need the temp tables but maybe im not totally getting the entire problem.

SQL code:
Insert into @FinalTable
(
	ACCTNO
	,Pos
	,F_Period
	,CR_AMT
	,DR_AMT
)
Select 
	@STR_ACCTNO
	,per.Pos
	,per.F_Period
	,cr.CR_AMT
	,dr.DR_AMT 
From 
	dbo.SplitStrings(@STR_TestPer, '^') per 
	INNER JOIN dbo.SplitStrings(@STR_TestCR, '^') cr
		ON per.Pos = cr.Pos
	INNER JOIN dbo.SplitStrings(@STR_TestDR, '^') dr 
		ON dr.Pos = cr.Pos

there isn't gonna be a great solution to that kind of hosed up data, but doing it with a table value function like that is probably the most "correct". lots of people would throw that poo poo into excel or write an external program to do it. as long as it works and you're only doing it once to normalize the data and all new data goes into the normalized table then it really doesn't matter that much.

thanks i'll try that tomorrow.

Shaggar
Apr 26, 2006
idk if that stuff I wrote is right. maybe you can use an unpivot or something too. also a merge so you can run it over and over w/out duplicating data and stuff. w/e.

its a pretty good exercise tho cause bad data is gonna happen and its nice to know how to fix it.

Shaggar
Apr 26, 2006
or maybe a cross apply? like

SQL code:

	SELECT
		f.ACCTNO AS AccountNumber
		,per.Item
	FROM FROM 
		[V_TEST].[dbo].[GL_CHART_1] f
	CROSS APPLY
		dbo.SplitStrings(f.FISCAL_PER, '^') per 	

that would give you a nice list of AccountNumber, FiscalPeriod but idk what you'd do next on the db_amt to keep them in order. maybe i'll think about this more tomorrow.

CISADMIN PRIVILEGE
Aug 15, 2004

optimized multichannel
campaigns to drive
demand and increase
brand engagement
across web, mobile,
and social touchpoints,
bitch!
:yaycloud::smithcloud:

Shaggar posted:

or maybe a cross apply? like

SQL code:

	SELECT
		f.ACCTNO AS AccountNumber
		,per.Item
	FROM FROM 
		[V_TEST].[dbo].[GL_CHART_1] f
	CROSS APPLY
		dbo.SplitStrings(f.FISCAL_PER, '^') per 	

that would give you a nice list of AccountNumber, FiscalPeriod but idk what you'd do next on the db_amt to keep them in order. maybe i'll think about this more tomorrow.

i use cross apply on the return value from the function above in order to create a final table with |ACCTNO|FISCAL_PER|DR|CR| so that the table can be keyed on ACCTNO and FISCAL_PER for sensible queries. Then I normalized out all of the other account details. (if account type, header account etc) the results are financially sound it's just my function above feels like it could be done much better which I think you did in your previous post.

Shaggar
Apr 26, 2006
rad

CISADMIN PRIVILEGE
Aug 15, 2004

optimized multichannel
campaigns to drive
demand and increase
brand engagement
across web, mobile,
and social touchpoints,
bitch!
:yaycloud::smithcloud:
i just hate it when I know there's a better way to write a query, but the fact i don't do this poo poo every day makes it hard for me to figure out.

Shaggar
Apr 26, 2006
yeah sql code smell is really strong.

Malcolm XML
Aug 8, 2009

I always knew it would end like this.

Corla Plankun posted:

literally every job i have had since high school has been made better by automating the stupid office crap everyone has to do all the time

and plangs make that super easy

exceldna loving owns so hard

f# in excel :hellyeah:

ConanTheLibrarian
Aug 13, 2004


dis buch is late
Fallen Rib
huh well looks like everyone finally learned to program good

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
congrats all

CPColin
Sep 9, 2003

Big ol' smile.
don't ask the users of my company's website.

Adbot
ADBOT LOVES YOU

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

CPColin posted:

don't ask the users of my company's website.

asking as user for their opinion on a product they use and continue to use is like asking a beaten spouse their opinion of their spouse

  • Locked thread