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
w00tz0r
Aug 10, 2006

I'm just so god damn happy.

Cyril Sneer posted:

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.

How do you mean "triple the size of your array"? You can always just put the window handles into a struct.

Adbot
ADBOT LOVES YOU

deptstoremook
Jan 12, 2004
my mom got scared and said "you're moving with your Aunt and Uncle in Bel-Air!"
Hi guys,

I was doing computer science in school before I switched to English, and now I've been working on a computer-based poem with my girlfriend that has me thinking about doing a project of my own.

I would like to make a program which generates poems in various forms (blank verse, different meters, different time periods, etc.); I think figuring out how to make a kind of "grammar" will be fun, as will playing with different variables for the final product; it also seems that nobody has done this kind of thing before, apart from a few rudimentary examples on the internet.

My plan was to make an indexed matrix of words with these pieces of information associated: part of speech, length in syllables, stresses, year first attested. Alternate syllabification and rhyme sound might be things to think about for the future.

So I have two questions: first, is this matrix/table going to be the best way to access the information in a random way, or is there a better data structure I slept through in my CS class?

second, and this is really the important part, does anyone know where I can find a dictionary file that would actually have all this data in an parsable form? I know that there are dictionary files with lists of words for spell checking and various other questionable things, but what I'm really looking for is a dictionary file with full lexicon entries. I would be immensely grateful for any leads.

tef
May 30, 2004

-> some l-system crap ->
use prolog.


(seriously)

(well, not entirely seriously)


Handling grammars and generation thereof is pretty easy. There is also princeton wordnet which I think might be helpful

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb
Anybody know of a simple tool I can use to record/playback mouse & keyboard input?

Munkeymon
Aug 14, 2003

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



fletcher posted:

Anybody know of a simple tool I can use to record/playback mouse & keyboard input?

How simple? The first thing that comes to my mind is AutoHotKey, but it's a clunky interpreted language.

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb

Munkeymon posted:

How simple? The first thing that comes to my mind is AutoHotKey, but it's a clunky interpreted language.

Yeah that came up when I was googling around for something but I didn't like the sound of it.

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
fletcher: If you aren't averse to Java, you could probably toss something together with the AWT Robot for playing stuff back. It's kind of a nifty class that most people never realize is available.

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb

Internet Janitor posted:

fletcher: If you aren't averse to Java, you could probably toss something together with the AWT Robot for playing stuff back. It's kind of a nifty class that most people never realize is available.

Definitely not averse to Java, this looks like it will work great for what I need, thank you for the link. I remember reading about this in the pokerbot thread and totally forgot about it.

edit: yep this is awesome

fletcher fucked around with this message at 02:39 on Jul 1, 2010

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
Great! Glad I could help. :)

Ah, the joys of an extensive standard library.

Shaocaholica
Oct 29, 2002

Fig. 5E
whats the fastest way to get a file count with python similar to the output of this shell command:

find . -name /*.jpg | wc -l

I just need to recursively count the number of a certain type of file by file extension. Are there any python modules that would do this faster than capturing the output of that shell command?

yippee cahier
Mar 28, 2005

http://docs.python.org/library/os.html#os.walk

The guys in the python thread would be able to make you a one line generator statement.

Annoying Jerk
Feb 19, 2004
I'm attempting to implement an algorithm that does the following:

Given a set of N points in 2D space, defined by their Cartesian coordinates, generate a circle around each point such that each circle is disjoint from every other circle, and each circle has a radius as large as possible.

Is there a name for this algorithm? My current brute force implementation is inefficient, and is bogging down the rest of my program. Any help in the right direction would be appreciated.

Bonus: here's a picture of my current implementation

baquerd
Jul 2, 2007

by FactsAreUseless
This looks like it may be what you want (what is your current algorithm anyway?):

http://blog.blackpepper.co.uk/finding-nearest-points-of-interest/

Edit: your problem is not well defined, there are multiple solutions in terms of "largest" circles by the way.

baquerd fucked around with this message at 07:29 on Jul 1, 2010

Annoying Jerk
Feb 19, 2004

baquerd posted:

This looks like it may be what you want (what is your current algorithm anyway?):

http://blog.blackpepper.co.uk/finding-nearest-points-of-interest/

Edit: your problem is not well defined, there are multiple solutions in terms of "largest" circles by the way.

Thank you for the link. My current algorithm is a mash of for and if loops that barely gets the job done, but works as a starting point for the program utilizing it.

Essentially, I would like to maximize the radius of each circle while maintaining the property that all circles are disjoint. Circles with small radii are bad. So if two points p and q share a minimum distance (the closest neighbor to p is q and the closest neighbor to q is p), then the radius for each circle centered around p and q should have radius equal to |p-q|/2. This is roughly what I mean by largest.

After thinking about your last statement for a bit, I realize I need to come up with a more rigorous mathematical statement for my problem. I'll attempt to post this when I actually write it. I'm not in computer science so this is all a nice challenge.

baquerd
Jul 2, 2007

by FactsAreUseless

Boom posted:

Essentially, I would like to maximize the radius of each circle while maintaining the property that all circles are disjoint. Circles with small radii are bad. So if two points p and q share a minimum distance (the closest neighbor to p is q and the closest neighbor to q is p), then the radius for each circle centered around p and q should have radius equal to |p-q|/2. This is roughly what I mean by largest.

Not to split hairs, but your current algorithm does not appear to do this. Look at (0.1, 0.7), (0.6, 0.7), and (0.6, 0.9) for examples. It may be partially a resolution problem on some of the other issues I'm seeing though.

Annoying Jerk
Feb 19, 2004

baquerd posted:

Not to split hairs, but your current algorithm does not appear to do this. Look at (0.1, 0.7), (0.6, 0.7), and (0.6, 0.9) for examples. It may be partially a resolution problem on some of the other issues I'm seeing though.

You are correct. My current implementation is more of a proof of concept, and the picture does not accurately reflect my desired algorithm. Originally I wanted to protect each point with a circle, and just have each circle disjoint from every other circle. Now I want to maximize the radius of each circle, according to the rough idea in my last post, while keeping each disjoint.

Annoying Jerk fucked around with this message at 08:53 on Jul 1, 2010

deptstoremook
Jan 12, 2004
my mom got scared and said "you're moving with your Aunt and Uncle in Bel-Air!"

tef posted:

use prolog.


(seriously)

(well, not entirely seriously)


Handling grammars and generation thereof is pretty easy. There is also princeton wordnet which I think might be helpful

The Prolog language looks useful for my project; is this a thing which I could implement into a C++ or Java application, or would I end up writing the whole thing in Prolog?

Also, wordnet looks nice for an indexed list of words and parts of speech, but it doesn't contain any information on syllabification or year of origin (which I wouldn't expect from that project). I suppose I could make another application which would search an online dictionary and parse that information into a database, but I'm not really sure how to start a thing like that.

Shaocaholica
Oct 29, 2002

Fig. 5E
To maximize the diameter of the circles, I would think you'd want to generate the smallest circle first and then the next smallest and so on based on a sorted list of neighbor point distances. That should maximize the circle diameter where:

r_first_point = r_second_point = smallest_distance_of_all_points/2
...
if r_closest_neighbor != 0:
r_next_point = distance_to_closest_neighbor- r_closest_neighbor
else
r_next_point = distance_to_closest_neighbor/2

O(n^2) to get distances sorted
O(n) to calculate the optimal radii


eh..sounds like thats exactly what you have already.

Shaocaholica fucked around with this message at 18:44 on Jul 1, 2010

shrughes
Oct 11, 2008

(call/cc call/cc)

Shaocaholica posted:

To maximize the diameter of the circles, I would think you'd want to generate the smallest circle first and then the next smallest and so on based on a sorted list of neighbor point distances. That should maximize the circle diameter where:

No, it won't. (I don't see why you think it should.) It won't maximize circle diameter (since when was that the goal?) and it won't minimize circle area or hit other extrema of reasonability.



Edit: I'd say the goal should either to maximize the sum of f(r_i) for each radius r_1, ..., r_n, where f is a strictly increasing, concave down function, or it should be to minimize the sum of g(r_i), where g is a strictly increasing, concave up function.

For example, you could maximize the sum of the square roots of the radii, or you could minimize the total area of the circles.

I think minimizing the total area of the circles is the best bet.

Edit:

With points at (0,0), (1,0), and (2,0), do you want three equal circles of radius 1/2? Minimizing area would give the inner circle a radius of 1/3, while maximizing the square root of radius would give the inner circle a radius of 1/5.

shrughes fucked around with this message at 19:13 on Jul 1, 2010

BigRedDot
Mar 6, 2008

Without giving this more than half a moments thought, I wonder if you couldn't just create a voronoi tesselation, and inscribe the largest circle possible, centered on the point, in each cell.

baquerd
Jul 2, 2007

by FactsAreUseless

BigRedDot posted:

Without giving this more than half a moments thought, I wonder if you couldn't just create a voronoi tesselation, and inscribe the largest circle possible, centered on the point, in each cell.

50 geek points for "voronoi tesselation", but -5 for misspelling it. It seems like it should work though.

BigRedDot
Mar 6, 2008

baquerd posted:

50 geek points for "voronoi tesselation", but -5 for misspelling it. It seems like it should work though.
I wonder what my lifetime accumulation of points (from any context) is.

edit: also it could has just been fat-fingered..... BUT I WILL NEVER REVEAL THIS SECRET. *dramatic half-diminished chord*

BigRedDot fucked around with this message at 21:01 on Jul 1, 2010

Shaocaholica
Oct 29, 2002

Fig. 5E

shrughes posted:

No, it won't. (I don't see why you think it should.) It won't maximize circle diameter (since when was that the goal?)

Because the OP said it was the goal?

shrughes
Oct 11, 2008

(call/cc call/cc)

Shaocaholica posted:

Because the OP said it was the goal?

No.

Eggnogium
Jun 1, 2010

Never give an inch! Hnnnghhhhhh!

shrughes posted:

No.

I can't wait to hear your important, subtle distinction between

quote:

each circle has a radius as large as possible
and

quote:

maximize the diameter of the circles

shrughes
Oct 11, 2008

(call/cc call/cc)

Eggnogium posted:

I can't wait to hear your important, subtle distinction between

and

As the OP said, "Circles with small radii are bad."

POKEMAN SAM
Jul 8, 2004

shrughes posted:

As the OP said, "Circles with small radii are bad."

So what would be the least bad?

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...

Ugg boots posted:

So what would be the least bad?

Which is worse: two circles with radii of 1, and one circle with a radius of 20; or two circles with radii of 5, and one with radius 10?

I was trying to be sarcastic but it turns out it's a legitimate question because he hasn't really defined the problem very well. I think the first one is worse for him, though - that's how I interpret it.

tef
May 30, 2004

-> some l-system crap ->

deptstoremook posted:

The Prolog language looks useful for my project; is this a thing which I could implement into a C++ or Java application, or would I end up writing the whole thing in Prolog?

CafeProlog, or if you're feeling mad, you can write a webservice in swi-prolog and glue it that way into c++ or java.

I think that yap or swi-prolog have some integration, so I'd look at those.


quote:

Also, wordnet looks nice for an indexed list of words and parts of speech, but it doesn't contain any information on syllabification or year of origin (which I wouldn't expect from that project). I suppose I could make another application which would search an online dictionary and parse that information into a database, but I'm not really sure how to start a thing like that.


I used TeX's hyphen algorithm as a cheating way to work out syllables.


In reality you might get a lot futher with NLTK in python

tef fucked around with this message at 11:54 on Jul 2, 2010

tef
May 30, 2004

-> some l-system crap ->

BigRedDot posted:

Without giving this more than half a moments thought, I wonder if you couldn't just create a voronoi tesselation, and inscribe the largest circle possible, centered on the point, in each cell.

I was thinking that you could do something akin to http://en.wikipedia.org/wiki/Fortune's_algorithm, i.e sweep through the plane from right to left, growing the circles as you go. I'm not sure it would be optimal, but I think it would be reasonably efficient.

The other trick would be to throw the problem at a constraint system and solve it.

Inverse square
Jan 21, 2008
Ah but you see I was an 06 lurker
What's a good, free, entry-level IDE for C++? I've been using Visual Studio 8 for a while and I spend significantly more time working out what the hell it wants me to do than I spend writing code. It's as much my fault as its but I just can't frikkin go on any more.

All I'm really looking for is simple multi-file control and library installation. Thanks in advance.

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"

Inverse square posted:

What's a good, free, entry-level IDE for C++? I've been using Visual Studio 8 for a while and I spend significantly more time working out what the hell it wants me to do than I spend writing code. It's as much my fault as its but I just can't frikkin go on any more.

All I'm really looking for is simple multi-file control and library installation. Thanks in advance.

I'm teaching an intro to C++ class starting tomorrow so I had been wondering the same thing and I came to the conclusion that there isn't really a good one that's both easy to use for beginners and cross-platform.

Historically we just used Visual Studio in the course but I'm going with Eclipse because I expect a lot more students will be using Macs than in past years, and I wanted to keep them all in the same environment as much as possible, so I wasn't going to split them between VS and Xcode. (Plus, we wrote a cool Eclipse plug-in that lets them submit their code to our autograder and get immediate feedback.) But Eclipse isn't really any better than Visual Studio with regard to intro-user adoption. I'm sure it's worse in some ways too.

Just suck it up now and learn Visual Studio early. You'll greatly benefit from it later.

spiritual bypass
Feb 19, 2008

Grimey Drawer

Inverse square posted:

What's a good, free, entry-level IDE for C++? I've been using Visual Studio 8 for a while and I spend significantly more time working out what the hell it wants me to do than I spend writing code. It's as much my fault as its but I just can't frikkin go on any more.

All I'm really looking for is simple multi-file control and library installation. Thanks in advance.

I don't know about library installation, but as long as you set your paths correctly NetBeans does a great job with C++.

FlyingDodo
Jan 22, 2005
Not Extinct
Speaking of c++ and visual studio, I'm using it (2008 express edition). I haven't used multiple projects in the same solution before and I'm wondering if I am going about it the right way. I am splitting the current one project and will have several, making each part into its own library. They compile to a .lib and will be used in other projects within the same solution. Do I just link the .lib files and do a #include like using any other static library?

Vinterstum
Jul 30, 2003

FlyingDodo posted:

Speaking of c++ and visual studio, I'm using it (2008 express edition). I haven't used multiple projects in the same solution before and I'm wondering if I am going about it the right way. I am splitting the current one project and will have several, making each part into its own library. They compile to a .lib and will be used in other projects within the same solution. Do I just link the .lib files and do a #include like using any other static library?

Configure each project (other than your main executable one) to output a static library (General prefs, or something), and then set up the dependencies between the projects. That'll do the linking part automatically.

nesbit37
Dec 12, 2003
Emperor of Rome
(500 BC - 500 AD)
I am starting to work with MySQL a lot more yet am still pretty unfamiliar with it. Can someone please recommend me any resources, books, sites, etc. that are particularly good for someone learning to use MySQL and tools like Navicat more or less on their own through some trial and error?

Strong Sauce
Jul 2, 2003

You know I am not really your father.





I've been working on a project for my company that involves graphing CPU data that is pulled from an Oracle database. The problem I've been having is that the CPU data is grabbed every minute and I need to be able to display a wide range of data (anywhere from 1 hour to the last 3 years etc).

The problem is a lot of the data consists of low CPU usage followed by a few minutes of high spiking CPU usage. I'm not sure exactly how to graph this over a wider range. For example if I wanted to graph 2 weeks worth of CPU data and I want it to display the areas where there were high usage spikes it seems it would be difficult to display by averaging out the points or using decimation. Does anyone have any suggestions about what kind of algorithm/formula I can use to reduce the number of points I have to graph while maintaining data regarding CPU usage spikes?

BigRedDot
Mar 6, 2008

Strong Sauce posted:

Does anyone have any suggestions about what kind of algorithm/formula I can use to reduce the number of points I have to graph while maintaining data regarding CPU usage spikes?
Peak pick, don't average.

PDP-1
Oct 12, 2004

It's a beautiful day in the neighborhood.

Strong Sauce posted:

Does anyone have any suggestions about what kind of algorithm/formula I can use to reduce the number of points I have to graph while maintaining data regarding CPU usage spikes?
Scan through the original dataset and only keep pairs of neighboring points where abs(point1.y - point2.y)>thresholdValue. This should preserve the spikes but remove almost all of the boring flat parts.

Adbot
ADBOT LOVES YOU

Modern Pragmatist
Aug 20, 2008
I have several sets of images representing dynamic information of a 3D volume. Essentially, several acquisitions of 4D data. I want to use a datatype to organize this data that allows me to navigate through the dataset in either the location, or time dimensions. I am imagining some sort of a linked list where each node has methods similar to: NextLocation, PrevLocation, NextTimePoint, PrevTimePoint, NextAcquisition, PrevAcquisition

Another issue is that the acquisitions may have different numbers of time points and locations (e.g. calling NextLocation from a particular node where t = 20 may exceed the length of the NextLocation which is only has 10 time points).

I am asking this in the general questions thread because I'm just trying to wrap my head around possible ways to organize this data. It really seems like there has to be a simple way to do this and it's just escaping me at the moment.

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