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
kloa
Feb 14, 2007


Not so much programming but a learning question for a newbie.

I have Programming in Java and Database Systems (T-SQL) courses in the Fall, so I am reading up on Java currently. I am working my way up from simple I/O stuff and getting to the better stuff later on.

I was wondering if I should also try to incorporate T-SQL at the same time as I'm learning Java, or should I get through learning Java first, then after I get through the book on Java (http://math.hws.edu/javanotes/) go ahead and read up on T-SQL, most likely through the summer?

I was looking at the first few pages of a SQL beginners guide and it was talking about lists and tables fro the get go, which won't be covered for another 2 chapters or so in Java.

Adbot
ADBOT LOVES YOU

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
Lists and tables in SQL are conceptually different from lists and tables in Java — either very different (if you're talking about the Java widget classes) or somewhat different (if you're talking about the Java data structures).

I would recommend getting fairly comfortable with basic programming, data structures, and algorithms before starting with databases.

Spime Wrangler
Feb 23, 2003

Because we can.

I'm making the matlab -> python leap right now with a fairly complex program (i have not coded it in matlab, starting from scratch in python), not realizing I was going to have to completely re-learn how to think computer and design program.

Can anyone recommend a good way to get up to speed on OOP paradigms/design strategies/tools? I've done a bit of java UML WAAAAAY back in the day, and only once for a CS-101 class freshman year.

I've read the wiki page on Design Patterns, but that doesn't give me a whole lot to go off of. Please help. Keeping these classes straight and deciding what functionality goes where (and remembering where it is and why) is making my brain hurt.

If there is a specific pattern that would work particularly well for my problem, what would it be?

I'm simulating a production process by modeling workers on a factory floor as agents. I have a "master" class that holds all parts and agents in two dictionaries, and which advances the simulation time and handles agent task scheduling. Parts are built into assemblies by agents, and then passed on to the next agent in the process.

I keep thinking I should try and maintain functionality where it is in the physical system, but when I finally get down to it there are too many ways of doing things and I can't seem to settle on one way since I have no idea what is better.

I'm going to be doing a lot of this in the future for grad school... is it worth it to take a low-level software engineering course, or should I just man up and teach myself? Is there that much to know?

Spime Wrangler fucked around with this message at 04:40 on Apr 14, 2009

The Dissonant
Jul 24, 2008

Just another disposable hero.
I'm interested in doing some AI programming. Anyone know any websites that offer some good exercises for doing this kind of stuff?

wrok
Mar 24, 2006

by angerbotSD

Spime Wrangler posted:

I'm going to be doing a lot of this in the future for grad school... is it worth it to take a low-level software engineering course, or should I just man up and teach myself? Is there that much to know?

Good design solves a lot more problems than a good implementation does, so yes, it's certainly worth learning more about and probably worth taking a course.

It just so happens there's a pretty good tutorial/introduction to Stackless Python that models a factory/machine/parts simulation -- they have examples in both Stackless and non-Stackless Python, probably worth taking a look at:

http://members.verizon.net/olsongt/stackless/why_stackless.html#the-factory

Lamont Cranston
Sep 1, 2006

how do i shot foam

Spime Wrangler posted:

I'm making the matlab -> python leap right now with a fairly complex program (i have not coded it in matlab, starting from scratch in python), not realizing I was going to have to completely re-learn how to think computer and design program.

Can anyone recommend a good way to get up to speed on OOP paradigms/design strategies/tools? I've done a bit of java UML WAAAAAY back in the day, and only once for a CS-101 class freshman year.

I've read the wiki page on Design Patterns, but that doesn't give me a whole lot to go off of. Please help. Keeping these classes straight and deciding what functionality goes where (and remembering where it is and why) is making my brain hurt.

If there is a specific pattern that would work particularly well for my problem, what would it be?

I'm simulating a production process by modeling workers on a factory floor as agents. I have a "master" class that holds all parts and agents in two dictionaries, and which advances the simulation time and handles agent task scheduling. Parts are built into assemblies by agents, and then passed on to the next agent in the process.

I keep thinking I should try and maintain functionality where it is in the physical system, but when I finally get down to it there are too many ways of doing things and I can't seem to settle on one way since I have no idea what is better.

I'm going to be doing a lot of this in the future for grad school... is it worth it to take a low-level software engineering course, or should I just man up and teach myself? Is there that much to know?

As an aside, I'll say that while the design patterns are helpful, you want a good solid grounding in OO principles before you attempt to figure them out and begin using them. You want to avoid the trap of fitting the problem to the patterns and not the patterns to the problem.

Filburt Shellbach
Nov 6, 2007

Apni tackat say tujay aaj mitta juu gaa!

The Dissonant posted:

I'm interested in doing some AI programming. Anyone know any websites that offer some good exercises for doing this kind of stuff?

You're going to want to get a book. I highly recommend Russel and Norvig's AI: A Modern Approach.

Spime Wrangler
Feb 23, 2003

Because we can.

Awesome, thanks for the advice.

That stackless tutorial is loving awesome. I've been looking all over the place for something like that.

Solaron
Sep 6, 2007

Whatever the reason you're on Mars, I'm glad you're there, and I wish I was with you.
NM - used powershell instead!

Solaron fucked around with this message at 16:53 on Apr 16, 2009

Morpheus
Apr 18, 2008

My favourite little monsters
Okay, I have a question about dialog boxes: basically, how do I make one?

I'm making a game where, at forks in the road, a dialog box pops up to ask which way the player wants to go. Nothing too complicated, but apparently whenever I try to look up the basics of dialog boxes, all I can find are how to call them in various languages, not how to make them (I'm programming in C#, if that makes a difference). All I need to know is how to make a dialog box that can return to me a reply from the user.

Oh, I guess I should mention that I don't mean a true dialog box, ie where it's a separate window in itself. I just need a little box that pops up, in-application.

Morpheus fucked around with this message at 09:01 on Apr 19, 2009

baquerd
Jul 2, 2007

by FactsAreUseless
Google "C# dialog box"

Kerris
Jul 12, 2006
Don't you fucking dare compliment a woman's voice on the forums, you fucking creepy stalker.

The Dissonant posted:

I'm interested in doing some AI programming. Anyone know any websites that offer some good exercises for doing this kind of stuff?
If you don't mind Java, there's a free PDF for Practical Artificial Intelligence Programming in Java.

ignorant slut
Apr 27, 2008
subversion question:

is there a command that allows one to see commits per author in the repo?

csammis
Aug 26, 2003

Mental Institution

ignorant slut posted:

subversion question:

is there a command that allows one to see commits per author in the repo?

Version control megathread, which I am right now adding to the megathread list in the OP.

UR MR GAY
Oct 26, 2007
Edit: Whoops, would of been more appropriate to post this in the java questions thread.

UR MR GAY fucked around with this message at 07:02 on Apr 20, 2009

Bizarro Buddha
Feb 11, 2007
I'm working on an implementation of A* pathfinding on a Java platform on which "object/array instantiation are expensive" and there is no JIT, which may or may not be theoretical, the brief doesn't say.

I'm leaning towards using a binary heap to implement the priority queue, since it can be flattened into a single large array to reduce object instantiation (the pathfinding is on a 2D grid at most 128x128, so points can be encoded as integers.)

Obviously the complexity of insert, pop, and decrease_key are O(lg n) (where n is the size of the 2D grid) with a binary heap implementation, but I'm trying to work out if this can be optimised by partitioning the array into m "buckets" which can each only hold a certain range of integers, and order the buckets based on their lowest priority item. Then there would be at most n/m items in each bucket, and insertion would require one operations which is O(lg n/m) to insert the item into its bucket and one operation which is O(lg m) to reorder the buckets.

The problem I have is - is this actually a speedup? I would combine the costs of each step to make the whole algorithm O(lg m + lg n/m), but because (lg m + lg n/m) = (lg m(n/m) = (lg n), it seems like I would not actually save anything. Is this a problem with me calculating the complexity, or is the initial idea just worthless?

Edit: Well, floWenoL pointed out my dumb mistake on #cobol, which is that m is a constant factor.

Bizarro Buddha fucked around with this message at 10:00 on Apr 22, 2009

Vince McMahon
Dec 18, 2003
On a website I work on, users pay to download high resolution images. When they get to the download screen at the moment there are thumbnails for each image, and users right click and press "save target as" to download the high resolution image. However, some users click "save image as" instead and end up just getting the thumbnail. I was wondering if anyone knows of a more desirable way of doing this, to stop people getting the right version.

Originally we had a text link for each image, but it was a bit ugly. We'd prefer not to go back to that if possible.

Is there perhaps a way to force a redirect from the thumbnail to the high resolution image?

Filburt Shellbach
Nov 6, 2007

Apni tackat say tujay aaj mitta juu gaa!

Vince McMahon posted:

Is there perhaps a way to force a redirect from the thumbnail to the high resolution image?

No browser would request the thumbnail URI again, and that's such a specific need that I doubt any browser supports it.

Could you instead direct your users to click the thumbnail then save that image?

Vince McMahon
Dec 18, 2003

Sartak posted:

No browser would request the thumbnail URI again, and that's such a specific need that I doubt any browser supports it.

Could you instead direct your users to click the thumbnail then save that image?

I was thinking of a mod_rewrite type thing, but I don't know much about it.

At the moment we tell them to either click the thumbnail and save the page/picture, or right-click, save target as. We still end up with people doing the wrong thing though. I guess it's hard to tailor for every single user.

Your avatar just reminded me of that scene and now I'm having trouble stifling my laughter.

Munkeymon
Aug 14, 2003

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



You could replace the normal right-click menu with your own using Javascript. It probably wouldn't work on every browser, but should get most of your problem users taken care of that way.

Woah, that avatar change weirded me out for a second.

kaschei
Oct 25, 2005

Is there a good tool for replacing accented characters with their closest western equivalent? Replace all the accented versions of e with e, for instance. I can use Python, perl, lisp, Java, and maybe something else if necessary. Google found me Text::Undiacritic in CPAN but it gives bad output (Cám -> CA�m, dís -> dA�s).

It only needs to handle spanish and french accents (cedilles, diaereses, and the accents aigu/grave/circonflex) not crazy "lower letter thorn with stroke" or anything.

Vanadium
Jan 8, 2005

Vince McMahon posted:

However, some users click "save image as" instead and end up just getting the thumbnail.

Perhaps you can replace the thumbnail imgs with divs with the thumbnail as background image so that no "save image as" option appears to begin with?

Standish
May 21, 2001

kaschei posted:

Is there a good tool for replacing accented characters with their closest western equivalent?
iconv, with the //TRANSLIT flag.

kaschei
Oct 25, 2005

Standish posted:

iconv, with the //TRANSLIT flag.

Wow, I tried that before (not using the TRANSLIT flag) and it barfed on the first non-representable character and I gave up. I blame my school for not having man set up properly on the linux thin clients. Thanks a bunch.

L:ordSilent
Jul 28, 2004
stupid question:

Is it possible to make a program to access a website and do whatever it is that you do on that website without the site having an api? (im not sure if thats the best way to ask this..)

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb

L:ordSilent posted:

stupid question:

Is it possible to make a program to access a website and do whatever it is that you do on that website without the site having an api? (im not sure if thats the best way to ask this..)

Yea, typically this is possible to do. I've used cURL to do this. Google for things like "http post <language>" and you can find all kinds of examples in php, python, java, etc

fletcher fucked around with this message at 03:59 on Apr 23, 2009

tef
May 30, 2004

-> some l-system crap ->

kaschei posted:

Is there a good tool for replacing accented characters with their closest western equivalent?

In python here is a function unicodedata.normalize(form, unistr)

I can't recall the right argument off hand though.

Pweller
Jan 25, 2006

Whatever whateva.
nevermind figured out using much more elaborate methods heh....

Pweller fucked around with this message at 16:56 on Apr 23, 2009

astr0man
Feb 21, 2007

hollyeo deuroga
Can someone please explain the difference between verilog "<=" and "="?

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

astr0man posted:

Can someone please explain the difference between verilog "<=" and "="?

The "=" operator performs value propagation immediately. This means that if you have registers foo and bar, this code
code:
always @(posedge clock) begin
  foo = 1;
  bar = foo;
end
will set both registers to the value 1 after a single clock. The "<=" operator performs value propagation simultaneously at the end of a clock. This means that if you have registers foo and bar, this code
code:
always @(posedge clock) begin
  foo <= 1;
  bar <= foo;
end
will set the foo register to the value 1, and the bar register to the previous value of foo after a single clock. After a second clock, both registers would have the value 1.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

L:ordSilent posted:

Is it possible to make a program to access a website and do whatever it is that you do on that website without the site having an api? (im not sure if thats the best way to ask this..)

The brief answer is that yes, on some level it is always possible to write programs which exactly mimic a user's behavior on a website. This can be somewhat difficult and involved, depending on the technical characteristics of the site and what precisely you want to simulate. And, of course, if the website hasn't published any sort of API, then they've made no commitment to not change things around and totally screw over your attempt at automation — in fact, depending on the site, they might do this on purpose.

No Safe Word
Feb 26, 2005

L:ordSilent posted:

stupid question:

Is it possible to make a program to access a website and do whatever it is that you do on that website without the site having an api? (im not sure if thats the best way to ask this..)

Do you mean like client interaction (clicking on stuff, typing on stuff)? Or just pulling what data you get from certain URLs?

The former is way harder than the latter. The latter can be done with curl or the http facilities that tons of languages have.

For the former you need something like Selenium or Windmill or Watir.

tef
May 30, 2004

-> some l-system crap ->

L:ordSilent posted:

stupid question:

Is it possible to make a program to access a website and do whatever it is that you do on that website without the site having an api? (im not sure if thats the best way to ask this..)

I've done this for a living, it isn't fun.

One of the web unit testing frameworks will allow you to simulate user input, but it isn't good for heavy loads or fast requests.

barking frog
Mar 15, 2004

I'm writing a C# program and this will seem pretty basic, but I'm not sure on the "proper" control flow.

I want the program to start up in a screen saver type mode. Clicking opens up another small form, and hides the screen saver. The small form launches the main form, and then hides itself. Exiting the main form shows the screen saver form again.

So right now I have something like this:

ScreenSaverForm.cs
- Launch SmallForm.cs
- this.Hide()

SmallForm.cs
- Launch MainForm.cs
- this.Hide()

MainForm.cs
- on event FormClosing- ?

Of course I can pass the ScreenSaverForm reference to SmallForm, and then from SmallForm to MainForm, but this seems a bit messy. Actually the entire thing strikes me as sloppy. There should be some other way of doing this.

L:ordSilent
Jul 28, 2004

No Safe Word posted:

Do you mean like client interaction (clicking on stuff, typing on stuff)? Or just pulling what data you get from certain URLs?

The former is way harder than the latter. The latter can be done with curl or the http facilities that tons of languages have.

For the former you need something like Selenium or Windmill or Watir.

Its more of me trying to bypass accessing their website. Kind of like a twitter app minus the handy api. Im not sure how to explain it without going into detail.

csammis
Aug 26, 2003

Mental Institution

L:ordSilent posted:

Its more of me trying to bypass accessing their website. Kind of like a twitter app minus the handy api. Im not sure how to explain it without going into detail.

So go into detail. You haven't even explained whether you want to be able to send input to it or not, or just pull data.

L:ordSilent
Jul 28, 2004
I want to make it take my login info for the site, login, display what I want some of the things from my "home" screen and the ability to get to the part of the site where i make an entry and submit it.

Bhaal
Jul 13, 2001
I ain't going down alone
Dr. Infant, MD
That can all be done in the "easy" methods people were talking about. An example:

1. Send the login info with an HTTP POST via cURL.

2. Parse the data that you want returned on the homepage (which should be the result you get back from step 1. If not, just do a simple HTTP GET for the home page once curl has the session/cookie for authentication.)

3. Make another HTTP POST via cURL for entering other data. (again, using session/cookie data obtained from login).

Keep in mind that this is assuming the site uses "normal" methods of handling these transactions. For instance, you could do something like this with a site like amazon or stock forum software. If the site is doing the login/shopping/posting/whatever via pure javascript or flash or god knows what then there might be a problem. Odds are this won't apply to you, though.

http://curl.haxx.se

Bhaal fucked around with this message at 07:38 on Apr 25, 2009

Lamont Cranston
Sep 1, 2006

how do i shot foam
Not exactly a programming question per se, but what's a good introduction to functional programming? I see a lot of people in CoC talking about it, and it looks interesting. In my programming languages course in college, we touched very very lightly on Scheme and StandardML but nothing deep enough to really grasp the difference in paradigm.

Adbot
ADBOT LOVES YOU

tef
May 30, 2004

-> some l-system crap ->
If you can't decide which language to learn, flip a coin.

I would suggest using something not too astray from what you are used to (i.e a dynamicly typed functional language, before having fun with type inference).

SICP is a good text if you want to learn scheme, although large and dense. I am sure there are shorter texts. DrScheme is also a great IDE/Environment to learn in (so I am told).

Scheme is really geared towards learning to program and the documentation and tools available are mostly to that end.

Haskell, although useful is still the experimental stomping ground of new functional features. Monads can be understood, but that doesn't mean it will be straight forward using them well. (Haskell is also lazy).

ML or some of its dialects are eagerly evaluated, so it is a little more straight forward to reason about what the code is doing when, but it can make some things awkward.

If you're going to look at ml - ocaml or f# if you're on windows might be worth looking at too.

On the whole, I would say if you want to learn the most, read as much sicp as you can, and do exercises in scheme.

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