|
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:
Thanks!
|
# ? Jun 11, 2010 16:37 |
|
|
# ? May 14, 2024 00:41 |
|
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:
|
# ? Jun 11, 2010 18:30 |
|
LittleBob posted:At the risk of sounding , can anyone help me with 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.
|
# ? Jun 11, 2010 19:09 |
|
LittleBob posted:It's still this: 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.
|
# ? Jun 11, 2010 19:43 |
|
Why bother with those?code:
|
# ? Jun 11, 2010 19:46 |
|
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 |
# ? Jun 11, 2010 21:33 |
|
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 |
# ? Jun 12, 2010 09:57 |
|
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.
|
# ? Jun 12, 2010 11:33 |
|
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. 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".
|
# ? Jun 12, 2010 11:50 |
|
coffeetable posted:Oops, my mistake. You're right, should've been "on all inputs". If you figure out the answer, please post it. I also feel pretty dumb for not being able to get it.
|
# ? Jun 12, 2010 13:07 |
|
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 |
# ? Jun 12, 2010 21:58 |
|
coffeetable posted:Oops, my mistake. You're right, should've been "on all inputs". 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?
|
# ? Jun 12, 2010 23:55 |
|
rjmccall posted:It's not totally trivial. I do think you're persistently confusing yourself about inputs, though. 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 |
# ? Jun 13, 2010 07:41 |
|
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 |
# ? Jun 16, 2010 04:46 |
|
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.
|
# ? Jun 16, 2010 05:53 |
|
shrughes posted:Yes. My question was dumb. The canonical example of a visitor pattern IS evaluation. Wooooops.
|
# ? Jun 16, 2010 06:02 |
|
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.
|
# ? Jun 16, 2010 08:18 |
|
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: 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.
|
# ? Jun 16, 2010 08:21 |
|
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:
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.
|
# ? Jun 16, 2010 08:30 |
|
Because it might help you, here's how I'd do rock paper scissors:code:
|
# ? Jun 16, 2010 08:45 |
|
systran posted:if action1 == 'attack' and action2 == 'attack': This is why significant whitespace sucks.
|
# ? Jun 16, 2010 22:01 |
|
floWenoL posted:This is why significant whitespace sucks. Because people are bad at using [code] tags?
|
# ? Jun 16, 2010 22:29 |
|
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
|
# ? Jun 17, 2010 11:50 |
|
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?
|
# ? Jun 18, 2010 12:47 |
|
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?
|
# ? Jun 18, 2010 20:51 |
|
Working yes, readable probably not. f2c is basically just a compiler that outputs C instead of assembly or machine code.
|
# ? Jun 18, 2010 20:55 |
|
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 My model looks like: code:
(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 |
# ? Jun 22, 2010 17:15 |
|
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!
|
# ? Jun 25, 2010 14:46 |
|
Helmet Jap posted:Hey guys, I am really stupid with anything below html level, so bare with my ignorance... 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).
|
# ? Jun 25, 2010 15:40 |
|
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.
|
# ? Jun 25, 2010 21:10 |
|
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.
|
# ? Jun 27, 2010 16:56 |
|
Cyril Sneer posted:Looking into it, it seems double clicking isn't a defined windows message.
|
# ? Jun 27, 2010 17:13 |
|
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?
|
# ? Jun 28, 2010 06:12 |
|
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 |
# ? Jun 28, 2010 07:21 |
|
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
|
# ? Jun 28, 2010 16:51 |
|
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. This sounds like it would work in terms of triggering the appropriate behavior, but I'm not seeing how this would stop the animation
|
# ? Jun 28, 2010 18:24 |
|
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.).
|
# ? Jun 28, 2010 18:35 |
|
defmacro posted:Here are some resources: 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.
|
# ? Jun 28, 2010 21:48 |
|
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.
|
# ? Jun 28, 2010 23:16 |
|
|
# ? May 14, 2024 00:41 |
|
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.
|
# ? Jun 29, 2010 06:22 |