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
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 always amazed at how bad most people are at programming and software design. then i remember that it's a horrible thankless job that no one should ever do and they're probably bored, it gets in the way of their internet posting job, and they want to kill themselves but it pays the bills.

Adbot
ADBOT LOVES YOU

CISADMIN PRIVILEGE
Aug 15, 2004

optimized multichannel
campaigns to drive
demand and increase
brand engagement
across web, mobile,
and social touchpoints,
bitch!
:yaycloud::smithcloud:
this guy with comp sci degree once spent a year writing a relatively simple time and billing system for the company i worked for. he was supposed to be being supervised by his former employer a very expensive consultant, who had all kinds of high end clients. dude quit a few days before his project was due to be completed, so my boss asked me to tidy it up so we could have it ready to run the next day.

i sat down and within an hour of reading his code i figured it was unsalvageable for a whole bunch of reasons. after playing it all night i was sure it was useless. i told my boss and he talked to the consultant. the consultant said we could fix it, and him being far more experienced i figured i would just take direction from him. i wrote all the classes and functions to do the poo poo, he wanted to do from scratch, he umm tried to do something till 6 weeks later he told my boss we had to start again. fortunately the poo poo i'd written was generic enough as to fit in anywhere.

The consultant billed us an obscene amount for a pretty lovely system and rehired the idiot to work for his firm, albeit doing something where he could do less damage.

I don't even want to start on the project I'm on now.

CISADMIN PRIVILEGE
Aug 15, 2004

optimized multichannel
campaigns to drive
demand and increase
brand engagement
across web, mobile,
and social touchpoints,
bitch!
:yaycloud::smithcloud:
don't get me wrong i kind of like my life most of the time, and having done some really hard and horrible manual labour jobs i'd take my job any day, but if i could go back in time i would have studied harder and become a cult leader or something.

CISADMIN PRIVILEGE
Aug 15, 2004

optimized multichannel
campaigns to drive
demand and increase
brand engagement
across web, mobile,
and social touchpoints,
bitch!
:yaycloud::smithcloud:
like you know how they talk about people graduating from highschool and not being able to read. that programmer was the programming equivalent. i'm a pretty poo poo programmer but give me access to google and i'll figure out how to make something work, and spend a bit of time figuring out which is not the most horrible way to do what i want to do.

CISADMIN PRIVILEGE
Aug 15, 2004

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

Martytoof posted:

Be an adult baby

CISADMIN PRIVILEGE
Aug 15, 2004

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

gucci void main posted:

nothing you learn in college involving c++ is actually of use hth

also lol 12k, even in eurodollars

sulk you didn't go to college and by your own admission you are doing terrible a you first real programming job, so from what i can tell nothing you have to say is actually of use. hth.

you also apparently think australia is part of europe.

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 think i want to start a project to access data in this horrible industry specific XML format from a horrible Web Service and dump it into a sql db. I'm back and forth between java and c# but i'm think c# because who am i kidding everyone uses windows, i'd like to make it not terrible what's a good starting point for learning c#. (i've done development before but it was a long time ago.)

CISADMIN PRIVILEGE
Aug 15, 2004

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

Nomnom Cookie posted:

idk does your company do c# normally? bc otherwise java is better. users shouldn't be allowed to run code anyway

manning books are p good imo but if you still remember a programming then u can probably get by on the msdn reference

it comes down to needing to get a good handle on .net stuff, knowing MSSQL pretty well already and already having a full msdn sub. i'll be writing it to fulfill a pretty specific internal role, but want to do it generic enough i can open source it if it doesn't suck.

CISADMIN PRIVILEGE
Aug 15, 2004

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

Bloody posted:

read a thing about linq and become a happy

linq seems cool, but still gotta connect to the horrible servers and get the ugly xml then i can use linq to make it play nice in the internal db.

CISADMIN PRIVILEGE
Aug 15, 2004

optimized multichannel
campaigns to drive
demand and increase
brand engagement
across web, mobile,
and social touchpoints,
bitch!
:yaycloud::smithcloud:
no i'm pretty sure i'm a terrible programmer now.

i'm an excellent debugger though.

CISADMIN PRIVILEGE
Aug 15, 2004

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

~Coxy posted:

google earth enterprise support is loving atrocious
slowly gotten slightly better over the least year but not really

All of the major map players are loving horrible to deal with on the enterprise scale, like getting a license to transfer x,y coords geocoded with bing maps, to another provider which also uses bing maps on an enterprise scale should be relatively simple when both parties pay 100K to 1M a year in license fees to the same company right? no it's a 6 month process. I had an issue open with Bing/Navteq where an entire inhabited island (pop 350) which was several miles long wasn't appearing on their map (you could clearly see it with sat view) it took them just shy of two years to resolve.

CISADMIN PRIVILEGE
Aug 15, 2004

optimized multichannel
campaigns to drive
demand and increase
brand engagement
across web, mobile,
and social touchpoints,
bitch!
:yaycloud::smithcloud:
more dope growing hippies, but at the same time it's 28 square mile inhabited island in a first world country.

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 woke with a start, bathed in cold perspiration. I was in my cubicle, at work. The last thing I remembered, I'd been going through the morning emails. Last night had been busy: patching the servers, plugging the latest security holes with bits of chewed bubble-gum, the usual routine.

OK, I shouldn't have dozed off, but I suppose that the effect of last night's cheap bourbon had begun to kick in. I'm only an occasional drinker, the kind of guy who goes out for a beer, and occasionally wakes a few days later in Saigon with a full beard.

As I pulled myself back to full wakefulness, my nerves tingled, sensing some evil presence, perhaps in the cubicle, veiled by the shadows. I glanced at my screen and then I noticed it.

"What's this? A new database? Where did that come from?"

I recoiled instinctively, as if a great cobra sat coiled on the keyboard. Dark forces seemed to be stirring. I shook my head.

"My nerves must be out of order!" I told myself. After all, what's the harm in a new database. I'll just keep a weather eye on the server and it'll be fine.

The phone rang. It was the SAN Admin, Mildred. She cut short the usual pleasantries, never a good sign. "How's the boy? What 'cha doin to my disks?" she hissed, as if I was personally doing her wrong.

Hell, it must be that new database. I played dumb. "I don't know what you're talking about Mildred. Which server is having trouble?" I tried to sound nonchalant, but my voice came out as a nervous squeak; the disks were her girls and they weren't happy.

"There are massive reads and writes going on. My girls are rattling like mice."

"I don't know, Mildred. There was a new app released last night, maybe that's it."

"Well, ya better find out, and fast. Don't you guys have any monitoring?"

Mildred knows how to make a guy feel small. "We're working on it," I lied, smooth as a grifter running twenties on a barman.

I put my feet on the floor, swabbed the back of my neck, and pulled the keyboard towards me. That poison snake of a database was bugging me. I did what I always do, go and shake down the historic records in the cache to see what falls out:


code:
SELECT	SUBSTRING(dest.text, (deqs.statement_start_offset / 2) + 1,
			(CASE WHEN (deqs.statement_end_offset = -1)
			      THEN LEN(dest.text) * 2
			      ELSE deqs.statement_end_offset
			 END - deqs.statement_start_offset) / 2 + 1), -- the query statement in the batch
					
		deqs.execution_count,
		deqs.total_elapsed_time,
		deqs.total_logical_reads,
		deqs.total_logical_writes,
		deqs.total_physical_reads,
		deqs.total_worker_time,
		deqs.min_elapsed_time,
		deqs.min_logical_reads,
		deqs.min_logical_writes,
		deqs.min_physical_reads,
		deqs.min_worker_time
		
FROM	sys.dm_exec_query_stats AS deqs
		CROSS APPLY sys.dm_exec_query_plan(deqs.plan_handle) AS deqp
		CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest
		
ORDER BY deqs.execution_count DESC;
							
 
I pulled out the text of one the queries:
 SELECT OrgID 
 ,OfficeID 
 ,StartDate 
 ,EndDate 
 ,OtherID 
 FROM SpecialList 
 WHERE OfficeID = 42; 
Whoa! What the heck is this app doing? This was lowest-common denominator T-SQL of the worst kind. Who writes queries like that? It's almost as if a machine was...and then it hit me like a lead slap to the back of the head. Didn't I hear someone in the lunchroom talking free and loose about the latest ORM?

Used with skill, Object Relational Mapping software is a great way to build the data access layer of an application. In careless hands, though, it's deadly. If these queries had Thompsons, there would have been blood all over the server room floor.

I wondered if they'd walked into the N+1 trap? I looked at another couple of queries...and there it was, like a great fat spider in the center of its malignant web:
code:
SELECT col1 
 ,col2 
 ,col3 
 FROM Table1 
 INNER JOIN Table2 
 ON Table1.ChildID = Table2.OtherID 
 WHERE tabl2.ParentID IN (@p1,@p2,@p3...@p99) 
There were more versions of all the queries with varying number of parameters of varying size. This particular query had a minimum run time of 900ms. It had been called 1,138 times in the last hour. What we had here was a bad dose of unparameterized, ad-hoc queries, causing every query to be compiled separately and placing untold CPU and memory stress on Millie's poor girls. No wonder she wasn't smiling.

I had better check the tables too. Just as I feared. Clustered indexes and logical constraints were conspicuous only by their absence. If you're using a relational storage engine, you have to work within its rules, and this object-oriented approach to tables was breaking as many rules as it could find.

I was clearly on a path to the Developers' Den, but I wasn't going alone this time. I called Mildred back.

"We're going to talk to the Dev Lead?" she asked in a voice quieter than I knew her capable of. A strange rattling noise echoed down the line, eerily reminiscent of her beaten-down disk drives. Her teeth were chattering with a nameless dread.


The Developers' Den

I met Mildred in the corridor, which had a smell of old carpet and furniture oil and the drab anonymity of a thousand shabby lives. Her smile was as faint as a fat lady's at a fireman's ball. The only way in to the Developers' Den was through a little sliding door that let those inside see who was trying to enter their space. It slid open a fraction, revealing a pair of eyes regarding us suspiciously.

"We need to talk about the data access layer for your new application."

"Who are you, the DBA? I thought you quit. Or maybe that was the guy before. It's a pity what happened to him…after he complained about our last application."

How could I forget? "Look, we just need to talk to the Dev Lead for a few minutes. I'm sure we can sort this out."

"He's busy. Just do what you usually do. Put a few indexes in the database."

I sighed. Why do devs think an index is the answer to all their problems?

"An index ain't going to cut it this time..." He was already sliding the door closed. "I hear you guys also have a few Access apps that need a lot of healing. Good luck with that!"

It was desperate but it got him where he lived. The door slid back open to reveal a face with as much expression as a cut of round steak and a similar complexion. The smell of old pizza and Nerf washed over us. Keyboards clattered away on a hundred laptops and desktops. There was a lot of forking, pulling, and merging going on in here, interrupted by an occasional piercing scream, as someone attempted a rebase. He led us to one of the Dev Lead's assistants.

"The DBA? I thought you quit," he sneered.

"Rumors of my demise seem to be exaggerated. Listen, your new app is beating on our database like a heavyweight contender smacking a palooka around the ring in a fixed fight."

"That's a real pity. Sounds like you need a few sticking plasters, or indexes as you like to call them." This guy had all the charisma of a plastic cup.

I counted ceiling tiles for a minute then leaned over his desk, knocking a Lego Millennium Falcon off its stand.

"No. An index won't help this time. This is a real code problem. And unless you want to spend the rest of your very short career putting in daily security requests for access to your dev database, get me to the Dev Lead! Now!"

Keyboards quieted all around the room. I heard mumbling and pointing and the phrase "...thought he quit...".

The developer fumbled with the Millennium Falcon, accidentally breaking off a missile launcher, before giving up and looking at me again. I hadn't known him long but I could tell that thinking was always going to be a bother to him.

"OK. Your funeral."

He grabbed his phone. The response was quick. "He's down in Conference Room C. It's just...". We didn't wait to find out more.

Conference Room C

Anger and frustration can carry a man far, but on nearing the Dev Lead's inner sanctum I took stock. Maybe the devs were right; an index or three might prop things up well enough. Forced parameterization might just help too. I glanced at Mildred. The look in her eyes told me I couldn't let her girls down. It was time to stop compromising.

I shouldered on into Conference Room C. Around the room, little notes colored green and blue and pink fluttered faintly in the gentle breeze of the air conditioner. Don't let the pretty colors fool you; each of those pretty notes will become real code that can crush a database with one gentle waft of its bat-like wings.

We walked in, as inconspicuous as a tarantula on a slice of angel food. And there sat the Dev Lead, fingers flying across the keyboard while one of his flunkies watched.

"...and that will fix the object inheritance problem you were hitting. Now get out before I put you in charge of maintaining the source control and bug-tracking systems for the next project."

The flunky stumbled into us as he tried to leave. The Dev Lead glanced up. He smiled, as stiff as a frozen fish, and glanced to either side of the door.

That's when I noticed the code-droppers standing there, hulking, menacing developers, wearing Star Wars t-shirts and each with a paw full of pizza. I tried to ignore them as the Dev Lead started to speak.

"Ah, Joe Deebeeay. I heard you quit. Who is that with you? Mildred from the SAN team. Darling, come in and sit here next to me."

Mildred edged nervously around the conference table and perched herself right next to the Dev Lead. Suddenly my side of the table felt like the loneliest place in the world.

"What can I do for the database team?" He beamed magnanimously at Mildred, but his eyes were like steel when they turned on me, and his voice as cool as a cafeteria dinner.

Gulp. "The application that was installed last night, it's causing major problems with the database and the disks. I did a little investigation and it looks like you guys introduced an ORM for the data access layer."

At the mention of the ORM, his brow furrowed. Suddenly, I was a particularly large rattlesnake and he had his gun ready.

"Look, you know, I'm not going to have this 'ORMs are awful' conversation again."

I took a chance and interrupted, "Of course not. ORMs are extremely useful tools that..." I choked on my own words for a second "...facilitate the speed of software delivery. No question. Keep using the ORM."

The Dev Lead's jaw was hanging open and one of his code-droppers dropped his pizza on the floor. It bought me the time I needed.

"The problem is not the ORM; just a few small mistakes in the way it was implemented. The database that it created is a direct copy of the objects in the code. Your guys turned ORM into OOM and that's the issue."

He breathed softly, twisted one large hand around his knee and looked down at it. I took it as an excuse to go on.

"There are some places where this direct object storage works well and others where we need to adjust the storage to be a little more...relational. After that, we drop a few clustered indexes in the appropriate places and we're almost home and dry."

At the mention of indexes, there was an audible sigh of relief and the tension in the room lifted. Finally, I was acting like a proper DBA again. It seemed like as good a time as any to drop the bombshell.

"Of course, to make this work, we'll have to adjust some of the code to use stored procedures."

The final two words came out in a strangled whisper, about as welcome as a dead rat in the punch bowl at a classy dinner party.

The two code-droppers closed in menacingly, "Thanks for the advice. Now, here's some for you and your stored procedures..."

My time was almost up. "We'd only need to do this in one or two places. We could use your generated code for most of the CREATE, UPDATE, and DELETE queries, and those READ queries where it made sense. That's what the ORM does best. In other places, we'd just substitute straight T-SQL for the batch-mode processing that T-SQL is good at."

The Dev Lead lurched to his feet, practically knocking Mildred off her perch. My next words, possibly my last, came out in a frantic rush.

"Look, it's not as if this is premature optimization. Mildred and her girls, uh, I mean disks, are dying out there! This would eliminate the N+1 problem and many of the other issues with passing in hundreds of parameters."

By this time, the Dev Lead was round my side of the table. Suddenly, I missed feeling lonely. His outstretched arm appeared to be heading for my throat but at the last second diverted and went around my shoulder.

"You crazy kid!" I was older than he was, but decided not to argue the point.

He turned to a code-dropper, "Can you believe the brass on this kid? He walks in here and tells us how to run our show?" He paused, and then laughed. "I love it!" That was all that the muscle needed to hear and they joined in the laughter.

"OK, let's see what we can do, together, to save Mildred's girls."

Mildred managed a weak smile. We made plans for further meetings to establish mechanisms of communication between the teams and start the process of identifying the worst performing code. We turned to leave, but the Dev Lead had a parting shot.

"Oh, and Joe, I'll book a time for us to have a quiet word about those Access apps that are giving us trouble. It looks like the Access team might need a new member for a week or two."

I managed a weak smile too.

The Fix?

Mildred and I finally made it out of the Developers' Den. I had a full schedule of appointments and a lot to explain to the Fat Man. Mildred was grinning from ear to ear but then noticed the look on my face, "What's the matter, Joe? Apart from your impending stint in the Access asylum, we got everything we wanted."

"I dunno, Mildred. Time eats away at all good things, and some time real soon the devs are going to update that app, and their ORM will start messing again with the database. Your girls ain't safe yet."

The smile vanished from her face.

"Plus, once there's data in place, we can't just let the ORM create, drop, and alter tables, right in production. The Fat Man won't like it. He's funny that way."

CISADMIN PRIVILEGE
Aug 15, 2004

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

gucci void main posted:

its gonna be in the context of android programming because gently caress web apps, but theres a lotta oop concepts you dont/shouldnt really use in plangs even if you can technically write w/them in "oop" style and i wanna get better at it

i like oo very much because it made sense immediately.

CISADMIN PRIVILEGE
Aug 15, 2004

optimized multichannel
campaigns to drive
demand and increase
brand engagement
across web, mobile,
and social touchpoints,
bitch!
:yaycloud::smithcloud:
metric time for sure bring in the 10 unit day

CISADMIN PRIVILEGE
Aug 15, 2004

optimized multichannel
campaigns to drive
demand and increase
brand engagement
across web, mobile,
and social touchpoints,
bitch!
:yaycloud::smithcloud:
humans aren't computers?

CISADMIN PRIVILEGE
Aug 15, 2004

optimized multichannel
campaigns to drive
demand and increase
brand engagement
across web, mobile,
and social touchpoints,
bitch!
:yaycloud::smithcloud:
how would we know what time the bars closed?

CISADMIN PRIVILEGE
Aug 15, 2004

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

prefect posted:

i'm thinking people would get mad if noon came around and the sun wasn't somewhere in the general overhead area

we could rotate one zone to the west every year so that once every 24 years your noon would be correct.

CISADMIN PRIVILEGE
Aug 15, 2004

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

PleasingFungus posted:

code:
class CUnit ... {
    #include "header_1.h"
    #include "header_2.h"
    #include "header_3.h"
    #include "header_4.h" //each of these headers is several hundred lines long
};

gunit

CISADMIN PRIVILEGE
Aug 15, 2004

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

Brain Candy posted:

most programmers are assholes. all programmers are terrible. :ssh:

i'm a terrible programmer, thankfully it's not really a big part of my job, what sometimes astounds me is how terrible most people who get paid to be programmers are at programming.

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

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.

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.

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.

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.

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.

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 figure out the best way construct a search based on a web search form that searches a number of descriptive fields in a relatively well normalized sql server product database (Each non numerical form field is tied to its own lookup) How do I construct the search queries to return relevance ranked results. Preferably with weights assignable to each field (by me not the person doing the searching)

The search form would have options for things like price range, colour, style, features. As well as a keyword search which would search both simple fields and a plain text field.

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 seems that maybe the best solution would be to concatenate all non numerical data to a hidden text field then full text earch that then search the numerical data and then count the number of matches for the numerical information and order the results based on that. I don't know how that would perform on a national site that gets millions of visitors a day though.

Adbot
ADBOT LOVES YOU

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:

write a proc w/ all the possible search parameters. make them optional parameters

write a big ol' select w/ a pile of left joins to the tables containing the criteria.
in ur where clause (or in the joins) filter on (leftJoinedTable.criteria=@searchCriteria || @searchCriteria is null) this way if the criteria is given, you search on it otherwise you ignore it.

weight the results in the order by

option (recompile) to prevent it from optimizing the proc w/ the first set of parameters entered.

This is basically what I want, but how terribly will that perform? Will magical background optimization mean it actually works relatively well?

Performance wise would I be better off just converting any that is textable to text and having a big search text field (It would be 2K chars max) then searching that using full text search with relevancy?


Shaggar posted:

altho that search will return only things that match. if you want to weight on match count then its probably gonna be gross

fortunately match count won't be an issue, in fact we specifically wouldn't want that.

  • Locked thread