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.
 
  • Post
  • Reply
ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

Too Poetic posted:

This might be more of a math question but it's beyond me. I'm not even sure if it's possible.

Basically I'm trying to find a solution to a combination.

Like let's say theres an item that raises the value of another item when used in several different categories but not all of them. There are several items and I'm trying to figure out in what quantity and which combination they would need to be used to reach a certain final value.

Like

Base 0, 0, 0, 0
Item 1 5, 0, 5, 0
Item 2 0, 5, 5, 0

and I'd be trying to get a final value of something like
10, 5, 15, 0

I hope that's clear enough. If someone could even point me in the right direction I'd be quite grateful.

Start by building a program that finds solutions for just the first category. Then add checks for the later categories one by one.

Adbot
ADBOT LOVES YOU

butt dickus
Jul 7, 2007

top ten juiced up coaches
and the top ten juiced up players
Regular expressions (PCRE) question.
Let's say I have a string like RRRABABABFF and the amount of ABs varies, but should always be AB and not BA or AA or AB or anything like that. Is there a way to match it without enclosing the AB in parens?
/R+(AB)+F+/ matches properly, but captures the match which is unnecessary.
/R+[AB]+F+/ will match properly, but will also match any number of As or Bs.

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

Doctor rear end in a top hat posted:

Regular expressions (PCRE) question.
Let's say I have a string like RRRABABABFF and the amount of ABs varies, but should always be AB and not BA or AA or AB or anything like that. Is there a way to match it without enclosing the AB in parens?
/R+(AB)+F+/ matches properly, but captures the match which is unnecessary.
/R+[AB]+F+/ will match properly, but will also match any number of As or Bs.
If this is PCRE, you can say not to capture the match with /R+(?:AB)+F+/

(search for clustering in perlre)

butt dickus
Jul 7, 2007

top ten juiced up coaches
and the top ten juiced up players
Works perfectly, thanks. That's been bugging me for a while.

The Glumslinger
Sep 24, 2008

Coach Nagy, you want me to throw to WHAT side of the field?


Hair Elf
SO I've tried to search online and failed to find what I was looking for, however I found a name for it. I'm trying to implement an algorithm that takes in n strings and finds the longest common substring for all n.

My google searching has only found implementations that examine only 2 strings at a time. I have already attempted to use this type of algorithm and it doesn't work. Using my current method, lets say I look at three strings:
SAF-Mendo Offs
SAF-N Mendocin
SAF-N Coast Of

From visual inspection, one would expect to get "SAF-". However, I instead get 'N'. From my algorithm, after the first comparison, I get out "Mendo". I then compare that result to the next string and receive 'N'.

I was wondering if anyone knew a good generalized algorithm or where I could find one.

Modern Pragmatist
Aug 20, 2008

crazylakerfan posted:

SO I've tried to search online and failed to find what I was looking for, however I found a name for it. I'm trying to implement an algorithm that takes in n strings and finds the longest common substring for all n.

My google searching has only found implementations that examine only 2 strings at a time. I have already attempted to use this type of algorithm and it doesn't work. Using my current method, lets say I look at three strings:
SAF-Mendo Offs
SAF-N Mendocin
SAF-N Coast Of

From visual inspection, one would expect to get "SAF-". However, I instead get 'N'. From my algorithm, after the first comparison, I get out "Mendo". I then compare that result to the next string and receive 'N'.

I was wondering if anyone knew a good generalized algorithm or where I could find one.

Summary:

quote:

- I found an algorithm (but won't tell you its name)
- My implementation of said algorithm doesn't work (but i'm not going to give you any details on my implementation)
- Help

Maybe I'm just being picky, but it would be useful if you told us the algorithm you are using and what you did to modify it and possibly your thought process.

Eggnogium
Jun 1, 2010

Never give an inch! Hnnnghhhhhh!

crazylakerfan posted:

SO I've tried to search online and failed to find what I was looking for, however I found a name for it. I'm trying to implement an algorithm that takes in n strings and finds the longest common substring for all n.

My google searching has only found implementations that examine only 2 strings at a time. I have already attempted to use this type of algorithm and it doesn't work. Using my current method, lets say I look at three strings:
SAF-Mendo Offs
SAF-N Mendocin
SAF-N Coast Of

From visual inspection, one would expect to get "SAF-". However, I instead get 'N'. From my algorithm, after the first comparison, I get out "Mendo". I then compare that result to the next string and receive 'N'.

I was wondering if anyone knew a good generalized algorithm or where I could find one.

You basically have to perform the dynamic programming approach but extend your table to higher dimensions.

http://en.wikipedia.org/wiki/Longest_common_substring_problem#Dynamic_programming

Edit: Actually I take that back, the suffix tree approach on the same page seems much more effecient. I hadn't heard of it until now.

Eggnogium fucked around with this message at 00:46 on Jul 28, 2010

Liquid Chicken
Jan 25, 2005

GOOP
Does anyone remember how to program simple BASIC?

I want to write a short program that allows one to input two numbers, i.e. 14356 and 14992 and it will print out a list of all the numbers from the first number to the second number. It sounds really simple, but my 17 year old self forgot BASIC sometime around 1989. Any help will be appreciated.

Painless
Jan 9, 2005

Turn ons: frogs, small mammals, piles of compost
Turn offs: large birds, pitchforks
See you at the beach!

Liquid Chicken posted:

Does anyone remember how to program simple BASIC?

I want to write a short program that allows one to input two numbers, i.e. 14356 and 14992 and it will print out a list of all the numbers from the first number to the second number. It sounds really simple, but my 17 year old self forgot BASIC sometime around 1989. Any help will be appreciated.

code:
10 INPUT a
20 INPUT b
30 FOR i = a TO b
40 PRINT i
50 NEXT
seems to do it (there's a javascript-based interpreter in http://www.calormen.com/applesoft/ ). It's something like 20 years for me too.

Lamb-Blaster 4000
Sep 20, 2007

can someone recommend me some kind of structured system for managing documentation for multiple projects? I've seen wikis used before like here http://wiki.slideshowpro.net/SSPfl/UG-UserGuide, and I know Adobe has a product (help robot? help bot? robohelp?) for structuring documentation. But I'd like something pretty turn key and preferably free.

suggestions?

Google kept seriving me results for 'document management software', which, while I do need one of those, was not what Im looking for today. The only relevant result was opendocman.com, which at the time of posting was down.

Suggestions?

edit: turns out robo help is for making knowledgebases and framemaker is for making documentation...

Liquid Chicken
Jan 25, 2005

GOOP

Painless posted:

code:
10 INPUT a
20 INPUT b
30 FOR i = a TO b
40 PRINT i
50 NEXT
seems to do it (there's a javascript-based interpreter in http://www.calormen.com/applesoft/ ). It's something like 20 years for me too.

Thank you!!!!!! I'm using Just Basic which I found for free and the closest thing to ye olde basic of my ancient Kaypro PC. I'll be able to tweak that little program to create template lists for Ebay and Delcampe which I'll just copy and paste into a word processing program and play Mad Libs to fill in item specifics. The numbers relate to item numbers which are also used for photo links since I host my own. I sell things all philatelic and can tweak the program template as needed. To do it straight with Turbo Lister will drive one mad (awkward) and too easy to make errors. Again thanks! I was trying silly goto routines that made never ending crazy lists.

Modern Pragmatist
Aug 20, 2008

Liquid Chicken posted:

Thank you!!!!!! I'm using Just Basic which I found for free and the closest thing to ye olde basic of my ancient Kaypro PC. I'll be able to tweak that little program to create template lists for Ebay and Delcampe which I'll just copy and paste into a word processing program and play Mad Libs to fill in item specifics. The numbers relate to item numbers which are also used for photo links since I host my own. I sell things all philatelic and can tweak the program template as needed. To do it straight with Turbo Lister will drive one mad (awkward) and too easy to make errors. Again thanks! I was trying silly goto routines that made never ending crazy lists.

Just curious why you chose to use BASIC.

Liquid Chicken
Jan 25, 2005

GOOP

Modern Pragmatist posted:

Just curious why you chose to use BASIC.

Because it's simple, quick and free. I have no other use for it except to make my templates and I've never used any other form of computer programming software.

tripwire
Nov 19, 2004

        ghost flow

Liquid Chicken posted:

Because it's simple, quick and free. I have no other use for it except to make my templates and I've never used any other form of computer programming software.
I thought you were interested in basic itself for some reason. If you just want a language thats simple quick and free you can do much better. Or put another way, its hard to do much worse than basic.

Doing anything more advanced than printing out a range of integers is going to be 10 times more headaches in basic than modern scripting languages like perl or python.

Liquid Chicken
Jan 25, 2005

GOOP

tripwire posted:

I thought you were interested in basic itself for some reason. If you just want a language thats simple quick and free you can do much better. Or put another way, its hard to do much worse than basic.

Doing anything more advanced than printing out a range of integers is going to be 10 times more headaches in basic than modern scripting languages like perl or python.

Nah, that little 5 line program does exactly what I want and it's done. I'm not a programmer. I just want to create a list of my templates to sell stamps for ebay.

Mandals
Aug 31, 2004

Isn't it pretty to think so.
Err, I'm not sure if this question has already been asked, but, generally speaking, if one were to consider getting into programming, is it a good idea to get an MS degree in computer science? Or is it better to get into it via certifications and job-training?

Painless
Jan 9, 2005

Turn ons: frogs, small mammals, piles of compost
Turn offs: large birds, pitchforks
See you at the beach!
I.. had no idea someone would seriously use BASIC for anything today :psyduck: Good thing that it worked, I guess

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Lamb-Blaster 4000 posted:

can someone recommend me some kind of structured system for managing documentation for multiple projects? I've seen wikis used before like here http://wiki.slideshowpro.net/SSPfl/UG-UserGuide, and I know Adobe has a product (help robot? help bot? robohelp?) for structuring documentation. But I'd like something pretty turn key and preferably free.

We use http://www.dokuwiki.org/ here where I work. It's not bad for creating stuff as you go along, but I don't know how good it would be at managing existing documentation.

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

Mandals posted:

Err, I'm not sure if this question has already been asked, but, generally speaking, if one were to consider getting into programming, is it a good idea to get an MS degree in computer science? Or is it better to get into it via certifications and job-training?
I don't really know how to answer this, because my answer to both parts is simultaneously "yes and no".

If you want to "get into programming", grad school certainly isn't the way to do it. Sure, you can look at undergraduate CS programs, and if you were to continue on to get a M.Sc., there are certain jobs that will open up and/or treat the years you spent getting the second degree as job experience, but going back for a master's isn't the typical case for most software developers.

Programming certifications are uniformly poo poo, but, even if you've got a degree in CS, on-the-job training is a huge part of becoming a seasoned developer. There's a big disconnect from industry and school that you can only really bridge by getting experience.

That said, the best programmers I know are those who, by and large, learned on their own. This doesn't mean they didn't go to school or learn anything on the job as well, but they're the ones who were perpetually working on side projects, contributing to open source projects, and whatnot. (And, really, you don't know whether it's something you'll actually enjoy until you've put some time into it anyway, so before you run off to university to major in CS you've got no reason not to pick up a Python book or something yourself)

Lamb-Blaster 4000
Sep 20, 2007

Munkeymon posted:

We use http://www.dokuwiki.org/ here where I work. It's not bad for creating stuff as you go along, but I don't know how good it would be at managing existing documentation.

Awesome, thanks, I dont have much, if any documentation (which is why Im looking for a system), so that wont be a worry.

update: I installed it and wrote a page, super easy, just what I needed!

Lamb-Blaster 4000 fucked around with this message at 20:05 on Jul 29, 2010

Eggnogium
Jun 1, 2010

Never give an inch! Hnnnghhhhhh!
Anybody know much about the windows command prompt?

I need to extract the name of the last folder in a UNC. Basically, I have an environment variable that specifies a full UNC path, for example "\\foo\bar\duh" and I need to save "duh" into another environment variable. The length of the UNC is potentially variable, I just always need the last folder. Is there a way to do this, preferably in a single line?

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

Lamb-Blaster 4000 posted:

can someone recommend me some kind of structured system for managing documentation for multiple projects? I've seen wikis used before like here http://wiki.slideshowpro.net/SSPfl/UG-UserGuide, and I know Adobe has a product (help robot? help bot? robohelp?) for structuring documentation. But I'd like something pretty turn key and preferably free.

suggestions?

Google kept seriving me results for 'document management software', which, while I do need one of those, was not what Im looking for today. The only relevant result was opendocman.com, which at the time of posting was down.

Suggestions?

edit: turns out robo help is for making knowledgebases and framemaker is for making documentation...

SHARE.POINT

Lamb-Blaster 4000
Sep 20, 2007

shoulda mentioned I need a free solution

Claeaus
Mar 29, 2010
I'm making a raytracer and want to expand from just spheres to different primitives. So I'd like a superclass called Mesh and the subclasses like Sphere, Cube, Plane etc.

At the moment I have a vector<Mesh> theMeshes and have added a Sphere object to it with theMeshes.push_back(Sphere() ). But when I try to access variables from the Sphere object in the vector the compiler tells me it's a Mesh and that it doesn't have the variables I'm trying to access.

I tried googling but only found people talking about virtual functions but I want specific variables for the different subclasses, like spheres have a radius while cubes and planes doesn't.

Here's what I'm trying to accomplish in pseudo code:
code:
for each object in the vector
 if the object==sphere
  Do ray-sphere intersection
 if the object==plane
  Do ray-plane intersection
 if the object==cube
  Do ray-cube intersection

Zombywuf
Mar 29, 2008

Claeaus posted:

Here's what I'm trying to accomplish in pseudo code:
code:
for each object in the vector
 if the object==sphere
  Do ray-sphere intersection
 if the object==plane
  Do ray-plane intersection
 if the object==cube
  Do ray-cube intersection

Do intersection should be a method in the Mesh interface, with each subclass providing its own implementation. So the inner loop would just be object->do_intersection(line).

Claeaus
Mar 29, 2010
Ok, I've changed it so that I now have:
code:
vector<Mesh> theMeshes;
theMeshes.push_back(Sphere() );

for(int i=0;i<theMeshes.size();i++)
  theMeshes.at(i).checkIntersection(s,d,distances,pos)
But it goes into the Mesh class and not the Sphere subclass.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
Google "object slicing". Your vector contains copies of the Mesh subobject of everything you try to insert into it. You would get a diagnostic about this if you'd properly made Mesh an abstract class by having checkIntersection be a pure virtual method.

Only references and pointers to objects can be polymorphic (i.e. can refer to objects of dynamic type different from their static type). You can't make a vector of references, so that leaves pointers; theVector should be a vector<Mesh*> or something similar.

Claeaus
Mar 29, 2010
vector<Mesh*> seems to be working, thanks guys!

Zombywuf
Mar 29, 2008

With checkIntersection being marked as virtual in the Mesh class. This is what virtual does, it allows you to delegate behaviours to subclasses.

edit: nm, seems you've got it.

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

Lamb-Blaster 4000 posted:

shoulda mentioned I need a free solution

That's okay, I was kidding. Letting SharePoint into your environment is like being a bank manager and being coerced by your mother to let your crack addicted just out of jail cousin to sleep over in your bank vault.

Fitret
Mar 25, 2003

We are rolling for the King of All Cosmos!
Is it possible to have XML schema as follows:

code:
<base>
    <add name="blah" />
    <remove name="foo" />
    <add name="zebra" />
    <remove name="zoo" />
</base>
I can't find any XML collection that will let me put the tags in whatever order I want (sequence would force either the adds or the removes to come first), have as many as I want (all forces min of 0 and max of 1), and still keep a strict schema (any would allow for tags I didn't define).

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
Fitret: I forget the precise XSD syntax for it, but it sounds like you want a choice- something like

code:
<choice minOccurs="0" maxOccurs="unbounded">
  <element type="add"/>
  <element type="remove"/>
</choice>

Fitret
Mar 25, 2003

We are rolling for the King of All Cosmos!

Internet Janitor posted:

Fitret: I forget the precise XSD syntax for it, but it sounds like you want a choice- something like

code:
<choice minOccurs="0" maxOccurs="unbounded">
  <element type="add"/>
  <element type="remove"/>
</choice>

The documentation implies that choice means I could only do "add" or "remove" but not both. However, you are correct and this works - thank you!

Henry Black
Jun 27, 2004

If she's not making this face, you're not doing it right.
Fun Shoe
How do I escape a variable in a shell script? I'm using "$4" for a file name, but some of the file names have spaces etc in. How can I make the output for use in the command line either escaped or in quotes?

Top Bunk Wanker
Jan 31, 2005

Top Trump Anger
I took some classes on Visual C++ back in 2006, and just recently, I decided to pick up the Visual C++ Express Edition just to putz around with, and I found out that instead of being the C++ I actually learned, it defaults to some kind of mutant "managed C++/CLI" language if I want to make a forms application. Is there a way to turn it back to normal C++?

Vanadium
Jan 8, 2005

Well, Forms is a .net thing and C++/CLI is the extension that lets C++ talk to .net things directly. I guess you will have to tell visual studio you want to make a winapi project or something stupid instead.

Mustach
Mar 2, 2003

In this long line, there's been some real strange genes. You've got 'em all, with some extras thrown in.

LittleBob posted:

How do I escape a variable in a shell script? I'm using "$4" for a file name, but some of the file names have spaces etc in. How can I make the output for use in the command line either escaped or in quotes?
Which shell?

Honeymoon posted:

I took some classes on Visual C++ back in 2006, and just recently, I decided to pick up the Visual C++ Express Edition just to putz around with, and I found out that instead of being the C++ I actually learned, it defaults to some kind of mutant "managed C++/CLI" language if I want to make a forms application. Is there a way to turn it back to normal C++?
Windows Forms is a .NET library; you have to use a .NET language to use it. If you want pure C++, you have to create a "Win32 Project" and use the Windows API (or non-Microsoft libraries) or an "MFC Application" and use MFC (everybody hates MFC and so will you).

Henry Black
Jun 27, 2004

If she's not making this face, you're not doing it right.
Fun Shoe

Mustach posted:

Which shell?

Bash

ToxicFrog
Apr 26, 2008


Doublequotes.

code:
$ file="a file with spaces"; echo -n "unquoted: "; ls $file; echo -n "quoted: "; ls "$file"
unquoted: ls: cannot access a: No such file or directory
ls: cannot access file: No such file or directory
ls: cannot access with: No such file or directory
ls: cannot access spaces: No such file or directory
quoted: a file with spaces

Adbot
ADBOT LOVES YOU

Reo
Apr 11, 2003

That'll do, Carlos.
That'll do.


Bah. I can't think of the term for this kind of chart to look one up. I know I've seen interactive versions before, it's a tag-similarity kind of thing. Didn't really know where else to ask.



The idea being that as you move from one node to another, nodes similar to that one pop up and you can just keep on navigating like that.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply