|
covener posted:not so sure what you're expecting, but here's 3 things to play with Just trying to save myself the trouble of navigating to my USB drive every time I want to test some python. (cd /*** && gnome-terminal) did it just fine, thanks buddy.
|
# ? Jan 7, 2010 05:39 |
|
|
# ? Jun 7, 2024 12:39 |
|
Have a (probably amateur) question about C++: When I run the code below with test input: input posted:123456 I get output: output posted:!123456! I of course am of the opinion that the first is not a palindrome while the second is. Any reason why this isn't working? code:
|
# ? Jan 7, 2010 06:53 |
|
FamDav posted:I of course am of the opinion that the first is not a palindrome while the second is. Any reason why this isn't working? The strings compare different, so they're different. They do print the same, however, which implies that they differ only in some unprintable character, which is very likely to be '\0'. The code does not modify input except using library routines, so the difference must be that revput has extra characters in it. How many characters are you adding to it?
|
# ? Jan 7, 2010 07:17 |
|
FamDav posted:I of course am of the opinion that the first is not a palindrome while the second is. Any reason why this isn't working? Here's some output from gdb...maybe this will help you get off on the right foot Dijkstracula fucked around with this message at 07:42 on Jan 7, 2010 |
# ? Jan 7, 2010 07:18 |
|
Ah, thanks to both of you I figured out that I was create a string with an extra undefined space at the beginning. Once I fixed that, everything flowed.
|
# ? Jan 7, 2010 08:42 |
|
Is there a generic name for a system that... Has a model or computes some sort of ideal number/goal... And then as you add/subtract certain constraints, the system adapts and continues to advise or warn you that your constraints make the desired projection improbable... Expert systems?
|
# ? Jan 8, 2010 20:44 |
|
Prolog?
|
# ? Jan 9, 2010 01:49 |
|
Triple Tech posted:Is there a generic name for a system that... Has a model or computes some sort of ideal number/goal... And then as you add/subtract certain constraints, the system adapts and continues to advise or warn you that your constraints make the desired projection improbable... "Computing some sort of ideal number/goal" sounds like you mean optimization; linear programming is a common subfield. Finding solutions given a guess (the previous solution) which you believe to be "nearby" the correct solution in some space is "local search". You may also want to look into constraint satisfaction and satisfiability, and general NP-complete solver techniques. But your question is so incredibly vague that it's hard to give you any better pointers than that.
|
# ? Jan 9, 2010 02:05 |
|
Does anybody know how to exclude anything STL related from doxygen's collaboration diagrams output? I tried adding std and std::vector to exclude symbols but its not working
|
# ? Jan 9, 2010 21:07 |
|
This could apply to any number of spaces like Warcraft specs or poker or more specifically stock portfolios... So if I have a model for the ideal balanced portfolio given no constraints, the system is like fine, do this. But what if we add some parameters like I am unwilling to target large losses, but I want huge returns, and I want to include this in my portfolio because someone gave me a hot tip. So then the computer will go beep bop and spit something else out. Or, it will tell you something like asking for a low-risk high-yield simulation is like 3% likely to happen. A recommendation engine?
|
# ? Jan 9, 2010 21:16 |
|
Economic simulations and other decisions-made-over-time-with-incomplete-information fields are typically built using techniques from game theory and control theory. It's a well-studied area, but I think what you're asking for is beyond the current state of the art. Poker is shockingly hard to model in the real world, especially when you admit the possibility of player collusion. It uses game theory, but doesn't share as much as you'd think with economic modeling. Modeling item specs in Warcraft would seem to be a straightforward optimization problem; not really the same problem domain at all. If you want software that can do all of that, you probably want Hard AI.
|
# ? Jan 9, 2010 21:28 |
|
ShoulderDaemon posted:Modeling item specs in Warcraft would seem to be a straightforward optimization problem; not really the same problem domain at all. Or you could try the Google approach and mine a gigantic number of decisions made by humans based on varying values of your parameter set for patterns and trends, but that's not really feasible for one man and especially one man in his spare time.
|
# ? Jan 10, 2010 18:16 |
|
After reading this http://www.venge.net/graydon/talks/mkc/html/mgp00001.html presentation, I'm tempted to try ocaml again. Does anyone have any recommendations for books or tutorials? Edit: it seems like this book an introduction to objective caml might be a good start, as well as http://www.ocaml-tutorial.org/ I'm still open to a nice book I can leaf through. tef fucked around with this message at 15:48 on Jan 11, 2010 |
# ? Jan 11, 2010 15:24 |
|
Apologies if this is too specific to go here, but this seems like a good place. I am trying to make a script that will download my school's course availability page and notify me if a class I want has a spot open up. The problem for me is getting the page onto my computer in the first place. There is a javascript function that occours when I click on a course that brings me to the page that shows open seats, but I cannot simply download that page, as it will not have any variables passed to it. There is a form that I can submit where when I enter in the course's unique ID, I will be returned with a page that I want to download and parse with a bash script. That page is: http://catsweb.txstate.edu/app/inq-open-classes Inspecting the page, I find the basic HTML form code code:
code:
I am really unsure how to phrase the question, so I apologize if I have been unclear, but I am just looking for a way to either automatically click the submit button on the modified form, or some cool wget hack I don't know of to pass form variables.
|
# ? Jan 12, 2010 00:47 |
|
Richard M Nixon posted:post form and scrape I did something similar using Python and a library called BeautifulSoup. I understand there might be more effective libraries now, but here's what I did. code:
code:
|
# ? Jan 12, 2010 02:42 |
|
pokeyman posted:Making soup with codes That looks incredibly useful, I can't believe there is a toolset for doing just this. I'll check it out. Thanks, goon! Edit: gently caress me, your avatar is creepy.
|
# ? Jan 12, 2010 03:00 |
|
I am attempting to implement a linked list. I've tried to write a recursive version, because recursion rules. I think the print_list method works, so I'm guessing I am adding a node to my list incorrectly. The code should just add a node to an empty list and accept an input value (an int), then print that value. (ie printing the node.) Complete code:code:
causticfluids fucked around with this message at 06:39 on Jan 12, 2010 |
# ? Jan 12, 2010 05:22 |
|
causticfluids posted:Code Think about how assignment works when you're dealing with pointers, and what new and delete (especially delete) do with the arguments they're given. Giving specific fixes is pointless but this will get you in the right direction hopefully. Good luck
|
# ? Jan 12, 2010 06:13 |
|
Whoas! Major typo with the delete start. I'll nix the whole thing. I think what my problem is, is that I can't delete temp in add_tail because it removes the object in memory and not just the pointer. Edit: Solved. I see! I didn't even think about the fact that I would need the memory address of the original pointer! Geez. code:
causticfluids fucked around with this message at 07:00 on Jan 12, 2010 |
# ? Jan 12, 2010 06:39 |
|
causticfluids posted:Whoas! Major typo with the delete start. I'll nix the whole thing. I think what my problem is, is that I can't delete temp in add_tail because it removes the object in memory and not just the pointer.
|
# ? Jan 12, 2010 06:57 |
|
Richard M Nixon posted:That looks incredibly useful, I can't believe there is a toolset for doing just this. I'll check it out. Thanks, goon! lxml is better at parsing tag soup HTML (yes I know it sounds like it shouldn't). It also lets you run xpaths with regexes, such as tr[rx:match(., 'foo.*bar').
|
# ? Jan 12, 2010 11:02 |
|
Zombywuf posted:lxml is better at parsing tag soup HTML (yes I know it sounds like it shouldn't). It also lets you run xpaths with regexes, such as tr[rx:match(., 'foo.*bar'). If it's just for personal fun, beautiful soup suffices, but you can get better results with lxml in terms of speed and output. Also, pycurl is scarily better than urllib2. BeautifulSoup can be a bit clunky to use sometimes, and slow. However, if you're used to some css selectors, there is an lxml wrapper called pyquery: http://pyquery.org/
|
# ? Jan 12, 2010 12:15 |
|
tef posted:BeautifulSoup can be a bit clunky to use sometimes, and slow. And doesn't always parse as you'd expect.
|
# ? Jan 12, 2010 14:40 |
|
This one has been annoying me for the last couple hours. I'm sure there is a simple answer, but I am just not seeing it.code:
code:
code:
Any ideas? Something blindly obvious I'm missing?
|
# ? Jan 13, 2010 03:53 |
|
BizzyLimpkits posted:Any ideas? Something blindly obvious I'm missing? What is sizeof(1 << i)? (When you can answer this, you have achieved enlightment.)
|
# ? Jan 13, 2010 03:57 |
|
God I hate/love coding.
|
# ? Jan 13, 2010 04:14 |
|
Silly complexity question, is the worst-case cost of merging n sorted lists (each of size O(1) ) into a single sorted list O(n log n)? Obviously this can be done in O(n log n) time by running your favourite O(n log n) sorting algorithm, but I wanted to double-check that I wasn't being stupid and overlooking some better way. DoctorTristan fucked around with this message at 20:55 on Jan 13, 2010 |
# ? Jan 13, 2010 20:38 |
|
Suppose we're merging N sorted lists of size K. Concatenating them and then re-sorting takes time O(NK log(NK)). Recursively pairwise merging takes T(N,K) = N/2*2K + T(N/2,2K), which is O(NK log(N)). There's an obvious limitative result here. Singleton lists are trivially sorted, so if you could merge N sorted lists of size O(1) in time faster than O(N log(N)), you could sort anything faster than O(N log(N)). rjmccall fucked around with this message at 21:34 on Jan 13, 2010 |
# ? Jan 13, 2010 21:30 |
|
Once you lay it out like that it's obvious. Thanks.
|
# ? Jan 13, 2010 22:03 |
I'm looking for an algorithm or the formal name of this problem. I've tried googleing for permutations of 'point cloud similarity'. Given n sets, each with any number of points and a starting set m, select the set which is 'closest' to m. This is as much a computer vision thing as a computational geometry one. I'm not sure it's a problem that has been solved, as it's drat close to shape similarity, but pointers would be appreciated.
|
|
# ? Jan 14, 2010 02:36 |
|
Jo posted:I'm looking for an algorithm or the formal name of this problem. I've tried googleing for permutations of 'point cloud similarity'. Given n sets, each with any number of points and a starting set m, select the set which is 'closest' to m. You just calculate your "closeness-error" function for each set, and select the minimum? It's O(n*f) where f is the complexity of your error function. Or are you trying to decide which error function to use?
|
# ? Jan 14, 2010 03:11 |
ShoulderDaemon posted:You just calculate your "closeness-error" function for each set, and select the minimum? It's O(n*f) where f is the complexity of your error function. If I have three sets of points as described below: pre:(a) (b) (c) o o o o o o o o o o o o o o o o o o o o o o o o o o o I'm looking for a metric for determining closeness like this, or (more likely) the formal name for the problem.
|
|
# ? Jan 14, 2010 03:22 |
|
Jo posted:I'm looking for a metric for determining closeness like this, or (more likely) the formal name for the problem. If you just want scale-invariant error, then you can do something like calculate for each point in a set the distance to each other point in that set, but store those distances divided by the average distance. Compare sets by sum-of-error comparison on the sets of normalized distances. That gives you decent scale-invariance and rotation-invariance. It's expensive though; O(n^2) to classify a single n-feature set. In image recognition, you'd have distinguished features that you can attempt to pair up in a comparison; with two distinguished pairs, you can trivially arrive at a transformation to apply to one of the sets so that you get a "best possible" comparison between those two sets. If you can't agree on the distinguished pairs, you'd probably use some heuristic to sort likely distinguished pairs, then try several candidate comparisons and choose the best, but that again moves you to the very-expensive domain. Finally, you can do some trivial scaling correction by just taking the convex hull of each set and prescaling so their areas and centers are all the same; that won't give you any rotation invariance at all, but it will give you reasonably cheap scaling if it's easy for you to get hulls. But really, the question of what makes two sets "similar" is highly application-specific and something you need to answer yourself. It sounds like you haven't formalized for yourself what makes two sets more or less similar very well, and that's why you're having problems. You probably won't find a lot of well-known error functions that aren't trivial, because most recognition algorithms each have their own highly-specific idea of similarity that isn't very portable; users are expected to choose the recognition algorithm that best recognizes their particular features. If you have an informal idea of similarity but you don't have a good formal model, you might be able to get away with local search, GA, or neural network error functions so that you can train a recognizer that provides the error scores you want. But that's going to be a lot of work and you're likely to wind up with a somewhat glitchy error function.
|
# ? Jan 14, 2010 03:41 |
|
A possible metric (but it's late so take a with a pinch of salt): If you have a number of transformations/deformations ranging from general (zooming, rotations, affine transformations) affecting all points, and more individual actions (moving a specific point). Each with an appropriate cost (e.g. cost being inversely proportional to the amount point affected), you could use a* search or similar to work towards the smallest set of transformations between two point sets. edit: what he said.
|
# ? Jan 14, 2010 03:44 |
ShoulderDaemon posted:If you just want scale-invariant error, then you can do something like calculate for each point in a set the distance to each other point in that set, but store those distances divided by the average distance. Compare sets by sum-of-error comparison on the sets of normalized distances. That gives you decent scale-invariance and rotation-invariance. It's expensive though; O(n^2) to classify a single n-feature set. Yes! Excellent idea. This is a good starting point. ShoulderDaemon posted:But really, the question of what makes two sets "similar" is highly application-specific and something you need to answer yourself. It sounds like you haven't formalized for yourself what makes two sets more or less similar very well, and that's why you're having problems. You probably won't find a lot of well-known error functions that aren't trivial, because most recognition algorithms each have their own highly-specific idea of similarity that isn't very portable; users are expected to choose the recognition algorithm that best recognizes their particular features. I'm not sure that similarity can be formalized in the larger sense. If anything, the point-level comparison is a simplification of contour correlation. I'll try these and file a trip report. Thanks for the input. tef posted:A possible metric (but it's late so take a with a pinch of salt): And this.
|
|
# ? Jan 14, 2010 04:45 |
|
I'm trying to make an editor. I'm planning on lexing the whole buffer in order to do syntax highlighting, brace matching and whatever. When the user types into the editor, I obviously don't want to rescan the entire document, but how do I know what I need to rescan? Here I obviously only need to rescan the tokens surrounding the cursor(#) (which has just typed the letter t: code:
code:
|
# ? Jan 15, 2010 21:02 |
|
C# question.. Sorry, this is a stupid question but it is bugging me and I didn't see a C# megathread to ask this and my programming experiance is AutoIt and a little python . From my searching it seems it could be instantiating an object but I'm unsure of it.. and how it works.code:
|
# ? Jan 16, 2010 23:00 |
|
I don't know what kind of object WebRequest.Create() returns, but it's being cast to an HttpWebRequest object by the (HttpWebRequest) bit, which is in turn assigned to the reference "request".
|
# ? Jan 16, 2010 23:21 |
|
Danith posted:C# question.. Sorry, this is a stupid question but it is bugging me and I didn't see a C# megathread to ask this and my programming experiance is AutoIt and a little python . From my searching it seems it could be instantiating an object but I'm unsure of it.. and how it works. WebRequest is an abstract class, and the Create method could return an object of a type other than an HttpWebRequest object (say you passed in an FTP address to Create). In this case you know it's going to be HTTP, so the code treats it as one. Otherwise you'd have to check what was returned and handle each case accordingly. The benefit of treating the returned object as an HttpWebRequest instead of a generic WebRequest? Compare the members of each: http://msdn.microsoft.com/en-us/library/system.net.webrequest_members.aspx http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest_members.aspx
|
# ? Jan 16, 2010 23:41 |
|
|
# ? Jun 7, 2024 12:39 |
|
sund posted:Python isn't strongly typed like C# so your first problem might be understanding the typing system. Python is strongly typed. The word you're looking for is "statically".
|
# ? Jan 17, 2010 02:03 |