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
Count Thrashula
Jun 1, 2003

Death is nothing compared to vindication.
Buglord
I'm working on a web interface for a SQL table that keeps track of hot network ports in my building. Really simple: the SQL table is two columns: "port" and "hot" (varchar/bit), and my web interface is set up in ASP.NET to display the information via <asp:DataList> with a Label and CheckBox control for each record.

ANYWAY, here's my trouble: I'm setting a submit button to update SQL records via the checkboxes on the page. I'm having trouble figuring out how to iterate through the checkboxes.

I've got
code:
    Protected Sub buttonSubmit_Click(ByVal sender As Object, ByVal e As EventArgs) Handles buttonSubmit.Click

Dim myConnection As SqlConnection
Dim myCommand As SqlCommand

myConnection = New SqlConnection("SERVER=***;DATABASE=***;TRUSTED_CONNECTION=TRUE;")
myCommand = New SqlCommand("UPDATE dbo.patchDiagramC115 SET (Hot=@hotCheck) WHERE (Port=@portLabel)")

myConnection.Open()
...and plan on adding a For Each loop to go through each DataList entry on the page and then myCommand.ExecuteNonQuery() for each one, but... I'm kind of stuck. I'm new to ASP.NET; can anyone point me in the right directin?

Thanks!

Adbot
ADBOT LOVES YOU

SimpleCoax
Aug 7, 2003

TV is the thing this year.
Hair Elf
I'm not very familiar with Fortran. I have some code fragments of something I'm trying to implement in Matlab. I've read about the colons in array in Fortran, but I'm still a little blurry. Can somebody tell me what these Fortran statements are really doing and maybe some equivalent Matlab statements? I'm an idiot.

code:
c Fortran Stuff...

rho=w_n(:,1)
.
.
.
F(:,:,1)=rho*u
.
.
.
Is w_n a 2D array? Doesn't that make rho 1D in that first statement then? Shouldn't rho's size agree with F? F is a 2D grid with 6 variables for each grid point so it is a 3D array. Shouldn't rho be 2D in that second statement? Can u be either a scalar or an array of F's size here? I don't have the code with the definitions.

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

LittleBob posted:

At the risk of sounding :filez:, can anyone help me with this?

I'm trying to set this up for someone to use as a .sh:

code:
#!/bin/bash

for f in `ls`
do
	mktorrent -p -a "http://1.com" "$f" 
done
When they run it, they get

: command not foundsh: line 2:
'home/Susan/mktorrent.sh: line 4: syntax error near unexpected token `do
'home/Susan/mktorrent.sh: line 4: `do

How do I fix this?

I'm guessing you're trying to run a script that has DOS line endings instead of UNIX line endings. The complaint about a command not found on line 2 is something of a giveaway; bash is trying to run a command named control-M (which is an invisible character used in DOS line endings) and can't find it. Similarly, instead of saying unexpected token `do' it's saying `do(jump to beginning of line)' which is further evidence of control-Ms.

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

LittleBob posted:

It's still this:

Susan@ns211627:~/OCR$ sh ~/mktorrent.sh
: command not foundsh: line 2:
'home/Susan/mktorrent.sh: line 4: syntax error near unexpected token `do
'home/Susan/mktorrent.sh: line 4: `do

1) Why are you calling it with sh instead of just executing it? Wouldn't that make it run in sh instead of bash?
2) Why are you even using shell scripting? Honestly, if you have a hard time with shell scripting, that's the time to load up Perl or Python instead.

ToxicFrog
Apr 26, 2008


Why bother with those?

code:
find . -depth 1 -type f -exec mktorrent -p -a [url]http://foo.com/[/url] {} ';'

Rusty Kettle
Apr 10, 2005
Ultima! Ahmmm-bing!
Okay, I am going to try plan b in installing some sort of MPI implementation that supports fortran on my mac. I have installed MacPorts, and am attempting to install OpenMP using MacPorts with the +gcc45 variant, which apparently enables mpi-f77 and mpi-f90. I hoped this overrides the default OSX openMPI configuration that has fortran disabled for some reason. Unfortunately, attempting to compile a simple fortran MPI program gives me "Unfortunately, this installation of Open MPI was not compiled with Fortran 77 support." This suggests that the MacPorts installation did not enable fortran support.

How do I enable fortran support in OpenMPI?

EDIT: Alright, I figured out that MacPorts tosses a new binary into a new directory (/opt/local/bin). Hopefully this should have the new binary macports installed with the enabled fortran. How would I go about pointing the mpif77 command to this binary rather than the default? Furthermore, it turns out that MacPorts automatically altered my .profile to point to this new directory. However, when I use the ompi_info command, it is telling me that I am using the older version (built in 2007) that is in the /usr directory, not the newer (built today) that is in the /opt directory.

I am getting angry at my computer...

Rusty Kettle fucked around with this message at 23:01 on Jun 11, 2010

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

shrughes posted:

I have no idea what you want to do with diagonalization. Instead, you should show that if L is decidable, then a decider for L could be used to solve the halting problem.

Ok I've been thinking it over for a few days and I've made no progress on how to construct the reduction. I'm utterly stuck on a way to convert "no this machine on this input does not halt in 100|x|^2 + 200 steps" to "no this machine does not halt on this input". Are there any hints you could give me?

coffeetable fucked around with this message at 09:59 on Jun 12, 2010

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

coffeetable posted:

Ok I've been thinking it over for a few days and I've made no progress on how to construct the reduction. I'm utterly stuck on a way to convert "no this machine on this input does not halt in 100|x|^2 + 200 steps" to "no this machine does not halt on this input". Are there any hints you could give me?

You're misquoting the problem in a very important way. The set of all (M,x) such that M halts on x within 100|x|^2 + 200 steps is decidable, because you can just simulate M on x for 100|x|^2 + 200 steps and see whether it halted. The set of all machines M such that M halts on all inputs x within 100|x|^2 + 200 steps is not decidable.

So the basic structure of your answer will be: given a machine M and input x, make a machine M' such that if M' halts on all inputs x' within 100|x'|^2 + 200 steps, it tells you something about whether M halts on x.

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

rjmccall posted:

You're misquoting the problem in a very important way. The set of all (M,x) such that M halts on x within 100|x|^2 + 200 steps is decidable, because you can just simulate M on x for 100|x|^2 + 200 steps and see whether it halted. The set of all machines M such that M halts on all inputs x within 100|x|^2 + 200 steps is not decidable.

So the basic structure of your answer will be: given a machine M and input x, make a machine M' such that if M' halts on all inputs x' within 100|x'|^2 + 200 steps, it tells you something about whether M halts on x.

Oops, my mistake. You're right, should've been "on all inputs".

I understand what the reduction should do, and if FTIME(M) is the machine that decides whether M halts on all inputs within f(|x|) = 100|x|^2 + 200 steps then I can see how to build a M' using FTIME(M) that decides whether M(x) halts in f(|x|) steps.

If the question was to find a M' using FTIME that accepts halting M(x) I could see how to do that too, but what I'm stuck on is how to build one that also rejects M(x) that do not halt.

That aside, thanks for the patience. I get the feeling that this is a trivial problem that I'm just stubbornly not "getting".

raminasi
Jan 25, 2005

a last drink with no ice

coffeetable posted:

Oops, my mistake. You're right, should've been "on all inputs".

I understand what the reduction should do, and if FTIME(M) is the machine that decides whether M halts on all inputs within f(|x|) = 100|x|^2 + 200 steps then I can see how to build a M' using FTIME(M) that decides whether M(x) halts in f(|x|) steps.

If the question was to find a M' using FTIME that accepts halting M(x) I could see how to do that too, but what I'm stuck on is how to build one that also rejects M(x) that do not halt.

That aside, thanks for the patience. I get the feeling that this is a trivial problem that I'm just stubbornly not "getting".

If you figure out the answer, please post it. I also feel pretty dumb for not being able to get it.

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

GrumpyDoctor posted:

If you figure out the answer, please post it. I also feel pretty dumb for not being able to get it.

If you'd like some context, it's the first problem (on p11) of this chapter of Arora

coffeetable fucked around with this message at 22:03 on Jun 12, 2010

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

coffeetable posted:

Oops, my mistake. You're right, should've been "on all inputs".

I understand what the reduction should do, and if FTIME(M) is the machine that decides whether M halts on all inputs within f(|x|) = 100|x|^2 + 200 steps then I can see how to build a M' using FTIME(M) that decides whether M(x) halts in f(|x|) steps.

If the question was to find a M' using FTIME that accepts halting M(x) I could see how to do that too, but what I'm stuck on is how to build one that also rejects M(x) that do not halt.

That aside, thanks for the patience. I get the feeling that this is a trivial problem that I'm just stubbornly not "getting".

It's not totally trivial. I do think you're persistently confusing yourself about inputs, though.

Again, remember that M' receives an arbitrary input (call it y) that has nothing to do with x. To be able to say something about M(x), M' is obviously going to do some sort of simulation of M on x. In theory you could simulate M on y, knowing that for some y, y = x; but as you've already realized, knowing whether this halts in time F(|x|) doesn't let you decide whether it halts in arbitrary time.

Suppose that M' just ignored y and simulated M on x. What would FTIME(M') mean here? How can you change M' so that it answers a less trivial statement? What is the definition of halting?

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

rjmccall posted:

It's not totally trivial. I do think you're persistently confusing yourself about inputs, though.

Again, remember that M' receives an arbitrary input (call it y) that has nothing to do with x. To be able to say something about M(x), M' is obviously going to do some sort of simulation of M on x. In theory you could simulate M on y, knowing that for some y, y = x; but as you've already realized, knowing whether this halts in time F(|x|) doesn't let you decide whether it halts in arbitrary time.

Suppose that M' just ignored y and simulated M on x. What would FTIME(M') mean here? How can you change M' so that it answers a less trivial statement? What is the definition of halting?

Oh holy poo poo. I have spent literally a week thinking this thing over and there's an elation in finally understanding. Thank you :).

GrumpyDoctor, the solution's spoilered below. rjmmcall's post gives you everything you need though, so if you've got the time spare you should be able to crack it pretty quickly:

Machine:
The machine HALT(M,x) first constructs a M' that on input y simulates M(x) for F(y) steps. If M(x) halts within those F(y) steps, M' enters an infinite loop, and if it doesn't then M' simply halts.

Having done all this, HALT(M,x) evaluates FTIME(M') and returns the negation of its output.


Explanation:
This works because if M(x) halts - say after k steps - then there is some y' such that F(y') > k. So for this y', M(x) will be simulated to completion and M'(y') will enter an infinite loop. So M'(y') will run for more than F(y) steps. So FTIME(M') will return 0 and HALT(M,x) outputs 1.

If M(x) doesn't halt, then M'(y) will always halt within F(y) steps - so FTIME(y) returns 1 and HALT(M,x) outputs 0.

As the halting problem is undecidable, we have a proof by contradiction that FTIME can't exist.


e: Realised I didn't take into account simulation overhead, but the idea remains the same. If M(x) halts after k steps, we need to wait k c' log(|x|) steps for it to halt, where c' is contingent on M and the simulation you're using.

coffeetable fucked around with this message at 08:37 on Jun 13, 2010

MagneticWombats
Aug 19, 2004
JUMP!
A bit scrubby- let's say I had an AST for a programming language and I was trying to be really OOPy. Would using the visitor pattern (I know what you guys think of patterns) be anywhere near a good way to implement multiple evaluation strategies? As in, one visitor per strategy? If not, what's a better idea? The other alternative I see is to have a class with member functions that are overloaded perhaps for each sort of node within the AST. Perhaps there is a clever (or if that's the case more orthodox OOP manner) of doing something useful to an AST.

Perhaps more concretely, let's say I was trying to take http://okmij.org/ftp/Haskell/Lambda_calc.lhs and translate it to C++. Perhaps because Haskell isn't exactly the closest language to C++, it seems as if a visitor is exactly the wrong way to do it. But even just aping it with a bunch of functions would seem unidiomatic since the Haskell relies a lot on multiple dispatch apparently.

MagneticWombats fucked around with this message at 05:38 on Jun 16, 2010

shrughes
Oct 11, 2008

(call/cc call/cc)

MagneticWombats posted:

A bit scrubby- let's say I had an AST for a programming language and I was trying to be really OOPy. Would using the visitor pattern (I know what you guys think of patterns) be anywhere near a good way to implement multiple evaluation strategies?

Yes.

MagneticWombats
Aug 19, 2004
JUMP!

shrughes posted:

Yes.

My question was dumb. The canonical example of a visitor pattern IS evaluation. Wooooops.

angel opportunity
Sep 7, 2004

Total Eclipse of the Heart
I just started learning Python/programming last night, and I'm trying to make a basic two player text based game that resembles rock paper scissors (I'm just doing this for practice). Each player is asked what they will do out of four choices, and after both players have entered their choice the program displays the result of the fight. I got the program to work how I want it to, but as I was writing it I got the feeling that I was doing things "the long way". I'll show you the beginnings of some of my if statements to show you what I mean:

if action1 == 'attack' and action2 == 'attack':
roll1 = random.randint(1, 12)
roll2 = random.randint(1, 12)

if action1 == 'charge' and action2 == 'attack':
roll1 = random.randint(1, 12)
if roll1 > 6:
playerTwoHealth = playerTwoHealth - 2

Basically I am having to enter in every possible combination of actions (which is a lot), I'm guessing I can somehow do something that would trim this down a lot and be more elegant. Also the forums killed my indentations, just pretend there are indentations after all the if instances.

Jonnty
Aug 2, 2007

The enemy has become a flaming star!

systran posted:

I just started learning Python/programming last night, and I'm trying to make a basic two player text based game that resembles rock paper scissors (I'm just doing this for practice). Each player is asked what they will do out of four choices, and after both players have entered their choice the program displays the result of the fight. I got the program to work how I want it to, but as I was writing it I got the feeling that I was doing things "the long way". I'll show you the beginnings of some of my if statements to show you what I mean:

if action1 == 'attack' and action2 == 'attack':
roll1 = random.randint(1, 12)
roll2 = random.randint(1, 12)

if action1 == 'charge' and action2 == 'attack':
roll1 = random.randint(1, 12)
if roll1 > 6:
playerTwoHealth = playerTwoHealth - 2

Basically I am having to enter in every possible combination of actions (which is a lot), I'm guessing I can somehow do something that would trim this down a lot and be more elegant.

It's hard to know what shortcuts you can take when we don't have a full idea of what your program's doing. We're not (that) scared of walls of code! Post the whole set of if statements (and possibly more) and use code tags too.

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender
If you've got 4 choices for action, then you've got to code at least 10 interactions: 1-1, 1-2, 1-3, 1-4, 2-2, 2-3, 2-4, 3-3, 3-4, 4-4. That's better than 16, but not by a whole lot.

Then you'd do something like this: (pseudocode)
code:
Given action1, action2
Choose minAction = min( action1, action2 )
Choose maxAction = max( action1, action2 )
If action1 == minAction
  Then (minPlayer, maxPlayer) = (1, 2)
  Else (minPlayer, maxPlayer) = (2, 1)
Switch (minAction, maxAction)
  When (1, 1):
    roll1 = rand(1, 12)
    roll2 = rand(1, 12)
    ...
  When (1, 2):
    roll = rand(1, 12)
    If roll > 6 Then
      maxPlayer.health -= 2
  When (1, 3): ...
  When (1, 4): ...
  When (2, 2): ...
  When (2, 3): ...
  When (2, 4): ...
  When (3, 3): ...
  When (3, 4): ...
  When (4, 4): ...
That'll save you some coding, but if you're just learning programming it may not be worth the added confusion.

It's possible that your rules allow you to eliminate more cases than I've shown here, but I can't know that without seeing more of your code.

Jonnty
Aug 2, 2007

The enemy has become a flaming star!

Because it might help you, here's how I'd do rock paper scissors:

code:
def winner(p1, p2):
  """Assumes p1 and p2 are not the same and are in the options tuple

  Returns winning option""

  options = ("rock", "paper", "scissors") #each beats item to left; wraps around
  if options.index(p1) == (options.index(p2) + 1) % 3:
    return p1 #player one wins as p1 to left of p2
  else:
    return p2 #can't be a draw, so player 2 wins

floWenoL
Oct 23, 2002

systran posted:

if action1 == 'attack' and action2 == 'attack':
roll1 = random.randint(1, 12)
roll2 = random.randint(1, 12)

if action1 == 'charge' and action2 == 'attack':
roll1 = random.randint(1, 12)
if roll1 > 6:
playerTwoHealth = playerTwoHealth - 2

This is why significant whitespace sucks.

No Safe Word
Feb 26, 2005

floWenoL posted:

This is why significant whitespace sucks.

Because people are bad at using [code] tags?

Kempy
Dec 15, 2009

systran posted:

Basically I am having to enter in every possible combination of actions (which is a lot), I'm guessing I can somehow do something that would trim this down a lot and be more elegant. Also the forums killed my indentations, just pretend there are indentations after all the if instances.

I know you're trying to shorten your codes actual logic and the ways you're going about it, but a quick tip is:

Instead of writing, say, variable = variable - 2, you can just do variable -= 2. Shortens the line of code at least ;)

Flu Roo
Apr 13, 2010

Let's talk SharePoint/Visual studio for a sec. I'm a 10+ year network janitor with no development chops, and in the last couple months have really gained some traction with SPS/MOSS. I want more granular control over workflows and tasks. It seems to me like I've outgrown share point designer and its lovely workflow templates.

I'm stuck on something really stupid and Google hasn't been kind to me: How the hell do I connect the wires so I can write workflows in visual studio 2010 without installing it directly on my production share point server? Anyone got a link to a walk-through?

I know I can install the .dll's on my machine and it'll let me code workflows, but I want F5 submission functionality so I can drop them directly on my MOSS. No dev server here, my company is cheap.

Is this something easy to do or am I thinking backwards?

Rusty Kettle
Apr 10, 2005
Ultima! Ahmmm-bing!
After a bit of googling, I am a bit confused on the implementation of f2c. Would I be able to just call this function on my fortran code, and have working, readable C code as an output? That would be ideal, but I don't think it works like that. Could anyone here give a newbie answer to what f2c actually does?

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Working yes, readable probably not. f2c is basically just a compiler that outputs C instead of assembly or machine code.

clockwork automaton
May 2, 2007

You've probably never heard of them.

Fun Shoe
Trying to use file_column in RoR (ruby 1.8.5 and rails 2.1.1)and constantly getting the following error when I goto myserver.com\things\

quote:

NoMethodError in ThingsController#index

undefined method `file_column' for #Class:<Class:0xb7990108>

My model looks like:
code:
class Thing < ActiveRecord::Base
        file_column :audio
end
and I added a varchar(255) column to the table named audio.


(and then I read about 20 pages of google search somehow not able to find my solution)

So what noobish mistake did I make? Because I figure it's gotta be something simple that I am not seeing here.


My solution: So, I stopped using file_column by the suggestion of the people in the #rubyonrails channel (it's apparently old as crap and unmaintained?) on freenode and started using Paperclip.

clockwork automaton fucked around with this message at 18:23 on Jun 22, 2010

Helmet Jap
Dec 25, 2004

Noeeee!
Jappu Trappuu!
Hey guys, I am really stupid with anything below html level, so bare with my ignorance...

We are trying trouble running the sqlsrv_connect() command. its throwing an error saying that the user could not login. I dont know how to configure it to allow this.

environment
OS and Services: IIS and MS SQL Express 2008 R2 on the same box.
enabled features: SQL express was installed with all default features. We enabled TCP/IP, named pipes and shared memory. IIS is pretty standard, but we downloaded the correct php dll's and configured the php.ini file correctly.

Thanks in advance!

yatagan
Aug 31, 2009

by Ozma

Helmet Jap posted:

Hey guys, I am really stupid with anything below html level, so bare with my ignorance...

We are trying trouble running the sqlsrv_connect() command. its throwing an error saying that the user could not login. I dont know how to configure it to allow this.

environment
OS and Services: IIS and MS SQL Express 2008 R2 on the same box.
enabled features: SQL express was installed with all default features. We enabled TCP/IP, named pipes and shared memory. IIS is pretty standard, but we downloaded the correct php dll's and configured the php.ini file correctly.

Thanks in advance!

You don't want to see bare programmers.

That said, you want to post your code you're using to connect (after double checking your server, user, and pass are set up correctly - also remember to mask those when you post here).

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

Has anyone done any work around pluralization and synonyms as it relates to search keywords? I'm wondering if there are any readily available synonym dictionaries or thesauri out there that can be used for matching, that would handle plurals properly such Dress versus Dresses or Pants versus Pantses. We can make up some rules as well (such as if *s,*ses then -s and so on) but it obviously won't catch all cases. Maybe even a list of exceptions if anyone's come across one.

Cyril Sneer
Aug 8, 2004

Life would be simple in the forest except for Cyril Sneer. And his life would be simple except for The Raccoons.
I've got a win32 API (implemented in C++) question that I'm hoping someone can answer.

Take a look at this graphic here:

http://www.blankadventure.com/stuff/SA/window.jpg

The user should be able to single-click those boxes and drag them around. Double-clicking should pop up a dialog with various settings. I thought about using a button control, but I can't figure how to make it respond to double-clicking or how to suppress the buttondown animation.

I thought of using a picturebox control, as that will give me an appropriate rectangle, but this is cumbersome as I'd then have to implement additional controls for the text labels, and I still don't know how to capture a double-click event.

Looking into it, it seems double clicking isn't a defined windows message. I'm guessing I'll have to write all my own processing, but I'm hoping to avoid that if at all possible.

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.

Cyril Sneer posted:

Looking into it, it seems double clicking isn't a defined windows message.
It is. There are also ones for the middle and right buttons.

Cyril Sneer
Aug 8, 2004

Life would be simple in the forest except for Cyril Sneer. And his life would be simple except for The Raccoons.

Mustach posted:

It is. There are also ones for the middle and right buttons.

Ah, well thats good. Any idea on how I can stop that "buttondown" animation?

HFX
Nov 29, 2004

Cyril Sneer posted:

Ah, well thats good. Any idea on how I can stop that "buttondown" animation?

Use button down by default, if you get a double click at the same coordinates as the original button down, then switch to the popup. At least that is how I think I used to handle such behavior. It has been a while (>6 years). You could wait a moment before allowing movement in case you are getting the original button down followed by a double click.

Edit: I think VS.NET was just rolling out when I last did serious Windows programming.

HFX fucked around with this message at 07:25 on Jun 28, 2010

defmacro
Sep 27, 2005
cacio e ping pong

Scaramouche posted:

Has anyone done any work around pluralization and synonyms as it relates to search keywords? I'm wondering if there are any readily available synonym dictionaries or thesauri out there that can be used for matching, that would handle plurals properly such Dress versus Dresses or Pants versus Pantses. We can make up some rules as well (such as if *s,*ses then -s and so on) but it obviously won't catch all cases. Maybe even a list of exceptions if anyone's come across one.

Here are some resources:

nifty web-based pluralizer
paper on the issue
rules for irregular plurals

Cyril Sneer
Aug 8, 2004

Life would be simple in the forest except for Cyril Sneer. And his life would be simple except for The Raccoons.

HFX posted:

Use button down by default, if you get a double click at the same coordinates as the original button down, then switch to the popup. At least that is how I think I used to handle such behavior. It has been a while (>6 years). You could wait a moment before allowing movement in case you are getting the original button down followed by a double click.

Edit: I think VS.NET was just rolling out when I last did serious Windows programming.

This sounds like it would work in terms of triggering the appropriate behavior, but I'm not seeing how this would stop the animation

csammis
Aug 26, 2003

Mental Institution

Cyril Sneer posted:

This sounds like it would work in terms of triggering the appropriate behavior, but I'm not seeing how this would stop the animation

The real answer is that you shouldn't use a control whose behavior is completely defined by single-click semantics for a double-click operation. Implement the rectangles as STATIC controls and draw whatever you need to on there (labels, borders, background colors, etc.).

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!


Thanks for the references. I've passed them on to the programmer working on it, hopefully they'll help him. I was more looking for shortcuts since sometimes these guys see the 'hard' solution as elegant and I'm more of a 'get-r-done' kind of guy.

defmacro
Sep 27, 2005
cacio e ping pong

Scaramouche posted:

Thanks for the references. I've passed them on to the programmer working on it, hopefully they'll help him. I was more looking for shortcuts since sometimes these guys see the 'hard' solution as elegant and I'm more of a 'get-r-done' kind of guy.

There are pre-fab'd stemmers (like Porter) that have rules to turn plural words into word stems. You may be able to use one of these to check against the special cases to ensure your code is working properly. Aside from googling around for code fragments, this your best "get-r-done" bet. It's certainly gross though and in all honesty, probably won't work too well.

Adbot
ADBOT LOVES YOU

Cyril Sneer
Aug 8, 2004

Life would be simple in the forest except for Cyril Sneer. And his life would be simple except for The Raccoons.

csammis posted:

The real answer is that you shouldn't use a control whose behavior is completely defined by single-click semantics for a double-click operation. Implement the rectangles as STATIC controls and draw whatever you need to on there (labels, borders, background colors, etc.).

Oh, I agree, its never good practice to co-opt a standarized behaviour. Its just that button controls come so close to the functionality I need.

Doing it the way you suggest will triple the size of my array (since I'll now have to keep track of a static rectangle, and two static text controls). Not really a big deal, but again, if the button control could just be tweaked a bit it makes everything work out nice.

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