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
Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...
just don't put any actual business logic in them if you ever want to scale

Adbot
ADBOT LOVES YOU

Shaggar
Apr 26, 2006

Luigi Thirty posted:

don't do it sulk the results will be worse than the DNA that makes up your dog

BONGHITZ
Jan 1, 1970

what is a good thing to do for a database, i know nothing and dont want to read very much

AWWNAW
Dec 30, 2008

generally you want to update to the latest version and perform regular backups

Luigi Thirty
Apr 30, 2006

Emergency confection port.

make sure you install mysql and never update it

Shaggar
Apr 26, 2006

BONGHITZ posted:

what is a good thing to do for a database, i know nothing and dont want to read very much

Microsoft SQLServer is the best one

MeruFM
Jul 27, 2010

Shaggar posted:

nononononononononono

how much could a visual db creator gently caress up? It's not like a wysiwyg web editor making GBS threads out unmaintainable markup.

ORMs are much worse just because sql is flexible enough that generated sql just turns into slow garbage

Luigi Thirty
Apr 30, 2006

Emergency confection port.

MeruFM posted:

how much could a visual db creator gently caress up?

Microsoft

Shaggar
Apr 26, 2006
assuming you're using the VS data tools and not EF's model designer, they work ok but are not as good as doing it in SSMS. The UI functionality is just not as good and you end up modifying a bunch of the definitions by hand. You can do it if you want but im not a fan. if you're using ef's model designer than just kill yourself

More importantly db design in visual studio is generally done as part of an application solution which encourages you to think of the database project as ThisApplicationsDatabaseProject which is stupid for a couple of reasons.
1) nobody ever writes db schemas that are only used by a single application in a single solution. It just doesn't happen. poo poo always grows and more stuff gets added and pretty soon your db project wont match whats in the database and it will make it a pain in the dick to manage.
2) it encourages the idea of your application controlling the data model which is always terrible. That way lies orms, poor performance, and schema refactoring

What would make a shitload of sense would be to have sql server manage a pseudo-solution that you could connect to from visual studio (with databases as projects) so you could work on the schema from visual studio and use things like source control to handle schema updates or the publish tool to move schema changes between environments. I actually talked to a dude who worked on VS and he had no idea that people don't always do one db per application. he could not understand the need for handling schema at a server level instead of an external, unsynchronized solution level.

it made me really mad.

gonadic io
Feb 16, 2011

>>=

FamDav posted:

the frustrating part about c++ and c is that things can get needlessly tricky for no good reason.

if you want to help me out with a haskell question, i was thinking about writing a haskell implementation of our service interface for work. what i'd like is for the service to be a monad transformer so the actual service calls have to run in IO, but you could then mock services if you wanted to test code. So there would be something like a "NameService" monad which also implemented getName, and then you would have the NameServiceIO and NameServiceMock implementations of it.

does this all sound right so far? am i going off the rails?

yeah I think you're right. For implementing NameServiceMock, look into free monads which are good for this sort of thing. check out http://www.reddit.com/r/haskell/comments/swffy/why_do_we_not_define_io_as_a_free_monad/ for more info - basically you make an ADT (called NameServiceF) with an option for each "IO" action you want to implement. and then something of type Free NameserviceF is a monad that collects the tree(?) of actions in a giant data structure which you then parse or interpret however you want

So all your functions would be of the form
code:
foo :: NameServiceMonad m => Butt -> m Fart
foo = ...
and then you can freely run it in real IO or fake IO whenever. did that make sense?

FamDav
Mar 29, 2008

AlsoD posted:

yeah I think you're right. For implementing NameServiceMock, look into free monads which are good for this sort of thing. check out http://www.reddit.com/r/haskell/comments/swffy/why_do_we_not_define_io_as_a_free_monad/ for more info - basically you make an ADT (called NameServiceF) with an option for each "IO" action you want to implement. and then something of type Free NameserviceF is a monad that collects the tree(?) of actions in a giant data structure which you then parse or interpret however you want

So all your functions would be of the form
code:
foo :: NameServiceMonad m => Butt -> m Fart
foo = ...
and then you can freely run it in real IO or fake IO whenever. did that make sense?

it makes enough sense for me to try this out.

i was actually thinking about free monads because they would give me the structure without the decision of how to resolve.

this will be a fun project that maybe a couple dozen people would enjoy and be ignored by the rest of my company. so a microcosm of haskell in real life.

Luigi Thirty
Apr 30, 2006

Emergency confection port.

FamDav posted:

haskell in real life.

I don't think this exists

Workaday Wizard
Oct 23, 2009

by Pragmatica
yo

how do i do this but in java
C code:
function hello()
{
	Double myDouble = null;

	// the observer takes a reference to the variable
	Observer observer = new Observer(&myDouble);

	// check if the variable myDouble is null. in this case yes
	print(observer.isNull()); // true

	// change the value of myDouble and check for null again. this time its not
	myDouble = new Double(5.0);
	print(observer.isNull()); // false
}
is it even possible?

how would the constructor of Observer look like?

Workaday Wizard
Oct 23, 2009

by Pragmatica
I ended up replacing myDouble with an instance of the Variable class below. myDouble itself will now always != null, but the value it contain (getValue()) may be null
Java code:
public class Variable
{
	private Object value;
	
	public Variable(Object value)
	{
		this.value = value;
	}

	public Object getValue()
	{
		return value;
	}

	public void setValue(Object value)
	{
		this.value = value;
	}
	
	@Override
	public String toString()
	{
		return "Variable<"+value.toString()+">";
	}
}
is there an alternative way?

i am fine with this and my problem is solved btw

Workaday Wizard fucked around with this message at 14:08 on Oct 15, 2014

Shaggar
Apr 26, 2006

Shinku ABOOKEN posted:

yo

how do i do this but in java
C code:
function hello()
{
	Double myDouble = null;

	// the observer takes a reference to the variable
	Observer observer = new Observer(&myDouble);

	// check if the variable myDouble is null. in this case yes
	print(observer.isNull()); // true

	// change the value of myDouble and check for null again. this time its not
	myDouble = new Double(5.0);
	print(observer.isNull()); // false
}
is it even possible?

how would the constructor of Observer look like?

idk what this is supposed to do for you but change &myDouble to myDouble and print to System.out.println and it should work. the constructor would be setting an internal field of type Double or maybe Object to the value passed into the constructor and then isnull just does the null check. why you wouldn't just do myDouble==null or use double instead so its never null, I have no idea.

Shaggar
Apr 26, 2006
like really what are you doing cause it doesn't make any sense and your variable class makes even less sense.

gonadic io
Feb 16, 2011

>>=
i'm glad somebody else is thinking that too

Workaday Wizard
Oct 23, 2009

by Pragmatica
sorry for the incoherent post above

what i wanted was basically C++ style reference variables. i want other objects to be able to see the current value stored in the variable at any time.

the problem is solved btw (i used a wrapper object).

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
There are reasons to want to use out or ref parameters, but Java doesn't have native support for them the way C# does. For that reason I'd recommend redesigning your code so that they aren't necessary. (Like, maybe return the new value instead?)

At the very least, your Variable class should use generics:

Java code:
public class Variable<T>
{
    private T value;
    
    public Variable(T value)
    {
        this.value = value;
    }

    public T getValue()
    {
        return value;
    }

    public void setValue(T value)
    {
        this.value = value;
    }
    
    @Override
    public String toString()
    {
        return "Variable<"+value.toString()+">";
    }
}
That said, like 99% of the time I've ever wanted something like this it's involved anonymous functions, and I've usually just used Atomic* because it already does what I want. I wouldn't stick it in a method signature though.

Shaggar
Apr 26, 2006

Shinku ABOOKEN posted:

sorry for the incoherent post above

what i wanted was basically C++ style reference variables. i want other objects to be able to see the current value stored in the variable at any time.

the problem is solved btw (i used a wrapper object).

I still don't understand.

Squinty Applebottom
Jan 1, 2013

Shaggar posted:

nononononononononono

you can take the dev out of ruby on rails, but you can't take RoR out of the dev

MeruFM
Jul 27, 2010

Shinku ABOOKEN posted:

sorry for the incoherent post above

what i wanted was basically C++ style reference variables. i want other objects to be able to see the current value stored in the variable at any time.

the problem is solved btw (i used a wrapper object).

you can make that externally visible variable "public"
or use a getter

Brain Candy
May 18, 2006

MeruFM posted:

you can make that externally visible variable "public"
or use a getter

doin' it wrong, the post

Brain Candy
May 18, 2006

Shinku ABOOKEN posted:

what i wanted was basically C++ style

you'll be happier if you pretend you don't know c++

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

Brain Candy posted:

you'll be happier if you pretend you don't know anything

syntaxrigger
Jul 7, 2011

Actually you owe me 6! But who's countin?


Can confirm is true

bobbilljim
May 29, 2013

this christmas feels like the very first christmas to me
:shittydog::shittydog::shittydog:
some of us dont need to pretend :downs:

z0rlandi viSSer
Nov 5, 2013

BONGHITZ posted:

what is a good thing to do for a database, i know nothing and dont want to read very much

Access

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
filemaker

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
or as i call it, smilemaker, because it's so easy to use it will make you smile

MeruFM
Jul 27, 2010

Brain Candy posted:

doin' it wrong, the post

please tell why

Brain Candy
May 18, 2006

crimes against encapsulation, third degree greybeardism, and wish granting

first, getters mean you've made some dumb data object. in this context why wouldn't you just make a dumb data object for the return type. not that those are great either

second, public state is that nightmare where you crystalize your initial assumptions forever. getting it perfect the first time is p. loving hard

third, its an x-y problem

Bloody
Mar 3, 2013

whats wrong with dumb data objects

Brain Candy
May 18, 2006

they're fine in c

but if you start writing them all the time you make your java into c and none of your poo poo can be modularized or rewritten without hacking at all your ShitINeedToReturn3 blobs

Shaggar
Apr 26, 2006

Brain Candy posted:

you'll be happier if you pretend you don't know c++

Luigi Thirty
Apr 30, 2006

Emergency confection port.

wish you'd solve your x-y problem and z your way out of this thread

Stringent
Dec 22, 2004


image text goes here

Luigi Thirty posted:

wish you'd solve your x-y problem and z your way out of this thread

:golfclap:

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.

Squinty Applebottom
Jan 1, 2013

CISADMIN PRIVILEGE posted:

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.

where color like '%' + search + '%' or
style like '%' + search + '%' or
features like '%' + search + '%'

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:
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.

  • Locked thread