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
wheres my arm
Feb 1, 2008

I'm trying to recreate a CSS layout I saw on themeforest.com, just as a project to help me learn CSS. I've got all of my divs set up in my index.html, but no CSS business yet, so currently they're all just lined up vertically.

So, my question is, what specifically causes divs to go where they do? How does a sidebar get onto the left side of the page (or the pagewrap/container); how does a footer stick to the bottom?

I've gone through many tutorials that teach this sort of thing, and the assholes who make them always make the same mistake. They do their whole stylesheet at once, without explaining what anything does.

"aaaaaand, I'm just going to set my margin-top to .4 em, and margin left to 400 pixels, and float this div to the left, and..."

I'm not learning anything by scrambling to type in all of the margin, padding, and float values that these people use verbatim, so I'd just like to know specifically what the process is for arranging divs around on a page.

Adbot
ADBOT LOVES YOU

Zombywuf
Mar 29, 2008

Basically the CSS properties display, position and float decide where an item goes on the page. If display = block (divs will be this by default) they will be placed below any existing block elements if display = inline it will be displayed inline (for example the b, strong, and span elements are inline by default). Position determines whether the above rules are ignore or modified, basically if you want something to stay in the same place use position = fixed. And then cry when you want it to work in IE. Float = (left|right) makes sidebars on the left and right sides.

It's probably best just to play around and see what stuff does, and at the same time read up on the CSS box model.

Sleeper354
Mar 24, 2008
I have a question related to threading. I'm taking a class where its a pretty big chunk. I want to know the difference between the following:

Condition Variable
Lock
Semaphore

From my understanding (my most recent one from observing) is that a condition variable is just that a variable, a Lock is a condition variable, and a Semaphore is a combination of the previous two. However, this definition has changed several times. I understand how they work, but I'm having trouble distinguishing them.

narbsy
Jun 2, 2007

Sleeper354 posted:

I have a question related to threading. I'm taking a class where its a pretty big chunk. I want to know the difference between the following:

Condition Variable
Lock
Semaphore

From my understanding (my most recent one from observing) is that a condition variable is just that a variable, a Lock is a condition variable, and a Semaphore is a combination of the previous two. However, this definition has changed several times. I understand how they work, but I'm having trouble distinguishing them.

A condition variable is more than just a variable. There are two methods defined for these guys - wait, and notify (sometimes notifyAll). When something is wait()ing for a condition variable, it's thread is blocked and it will wait() until the end of time, or it is notify()ed that the resource the condition variable is protecting is available.

By a Lock, I'll guess you mean a mutex. A mutex allows one and only one thing to access a resource at a time. If a thread asks the mutex to lock for it, the mutex waits until it has been unlocked first, and then resumes execution for the thread.

A semaphore is similar to a mutex, but can model more than one resource. A good example for this is like a bathroom with multiple stalls; a semaphore models this excellently. It keeps a queue of those who have locked it with P(), and a count of how many resources are available currently. A resource is released with V(), and another thread given access (as P() blocks).


I'm not the most coherent, so let me know if this doesn't make sense.

Blightie
Dec 27, 2004
I need some help, I'm not going to pretend this isn't for an assignment but I am struggling to find any useful information despite days of research.

I have an unknown algorithm that is either shell sort (with knuth's h values) or sedgewicks median of three quicksort. Empirical analysis to find whats what.

So far, sorted data runs the fastest. A few unique keys run at basically the exact same speed. Random data runs slightly slower.

Now heres the confusing part. Reverse ordered data runs ultra slow.
Say: 10000 samples, random = .1568s, rev = 9.06s and 100000 samples, random = 1.9s, reverse = 907.565s (data is fine, tested with the rest of the algorithms that I had to identify).
I think median of three quicksort should not have such horrible performance for reverse ordered data, but should shell sort degenerate so horribly?

jamal jenkins
Dec 18, 2007

by The Finn

Blightie posted:

I need some help, I'm not going to pretend this isn't for an assignment but I am struggling to find any useful information despite days of research.

I have an unknown algorithm that is either shell sort (with knuth's h values) or sedgewicks median of three quicksort. Empirical analysis to find whats what.

So far, sorted data runs the fastest. A few unique keys run at basically the exact same speed. Random data runs slightly slower.

Now heres the confusing part. Reverse ordered data runs ultra slow.
Say: 10000 samples, random = .1568s, rev = 9.06s and 100000 samples, random = 1.9s, reverse = 907.565s (data is fine, tested with the rest of the algorithms that I had to identify).
I think median of three quicksort should not have such horrible performance for reverse ordered data, but should shell sort degenerate so horribly?

I always found that quicksort is exceptionally prone to bugs when coding it from scratch. The inner loop is highly optimized, so make sure there's no mistakes. Follow your textbook example closely unless you understand the algorithm backwards and forwards.

My question: Is there a way to parse a webpage before I view it in order to rearrange the elements the way I'd like? Perhaps with a greasemonkey script? For example, look at the SA forums page. Is there a relatively simple way to change which forum is at the top? I can take care of the coding aspect if you can point me into the right direction.

hey mom its 420
May 12, 2007

Hey, it's me again. I have implemented an AVL tree, a hash table and a trie for storing words. The source is here. I've also implemented a function that calculates the Levenshtein distance (similarity) of two words.

Now the last thing I have to implement here is that given a word W and a number k, I have to find the k most similar words to W. I have to implement this for each of the three data structures.

The naive and most obvious way of doing that is just to iterate over every word in the data structure and determine how similar it is to W. Then, sort those based on their similarity to W and return the top k results. If we assume the time complexity for determining the similarity of two words to be O(1), then the time complexity for finding the k most similar words is O(n) + M, where M is the time complexity for the sort, so in the end that's just M.

Do you think there's any way I can leverage the data structures to get better time complexity for that operation? For the hash table, well, obviously not, but for the AVL tree and trie I suspect there might be a way but I can't think of anything.

Vanadium
Jan 8, 2005

jamal jenkins posted:

My question: Is there a way to parse a webpage before I view it in order to rearrange the elements the way I'd like? Perhaps with a greasemonkey script? For example, look at the SA forums page. Is there a relatively simple way to change which forum is at the top? I can take care of the coding aspect if you can point me into the right direction.

Greasemonkey can do that, but it will only run your script on the page after it has finished loading. If you need it earlier, you would need to use some proxy gadget like mousehole.

Munkeymon
Aug 14, 2003

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



Blightie posted:

should shell sort degenerate so horribly?

Yes, but median-of-three implementation of QuickSort should protect it against degenerating into N2 time when it is passed a sorted list of any kind (pre-sorted, reverse sorted, 'almost' sorted).

Edit: see here: http://www.petebecker.com/js/js200101.html for examples of median-of-three protecting QS from pathalogical cases.

TSDK
Nov 24, 2003

I got a wooden uploading this one

StumblyWumbly posted:

Where can I find info about how Linker scripts work?

To give some background: I'm writing a program for a microprocessor, not much of an OS. I need the entire program stored in flash but run from RAM. I can do this easily for functions I've written, but the compiler adds in functions like memcpy and __divsf3 (handles floating point division), and I'd like all that run out of RAM as well.

Any thoughts?
A good few of the linkers I've used that use linker scripts follow the (arcane and horrible) format used by ld:
http://sourceware.org/binutils/docs/ld/index.html
Might be worth having a look through to see if it's similar.

Sir Sidney Poitier
Aug 14, 2006

My favourite actor


How does one immediately append a variable to some text in an mIRC script? I'm trying to make an alias for banning IP ranges. I have a situation where I frequently need to ban the first 3 octets of an IP so I want to be able to type /ban 123.45.67 and have it output /mode #channel +b *!*@123.45.67.*

code:
/ban {
  /mode #channel +b *!*@$$1.*
}
Obviously doesn't work. Does anyone know how I can accomplish this?

hexadecimal
Nov 23, 2008

by Fragmaster
I have a Second Life related question.

How can I detect more than 16 avatars using llSensor? I tried having 2 objects with the script to sense avatars around me, but they seem to be returning same ones, and are limited to 16, even though there are more avatars around. I use PI as the arc parameter. Maybe I should make it smaller and have the object rotate?

tef
May 30, 2004

-> some l-system crap ->

Munkeymon posted:

Yes, but median-of-three implementation of QuickSort should protect it against degenerating into N2 time when it is passed a sorted list of any kind (pre-sorted, reverse sorted, 'almost' sorted).

If you're interested in this sort of thing, 'Engineering a Sort Function' by Mcilroy and Bentley is a good read:

http://www.enseignement.polytechnique.fr/informatique/profs/Luc.Maranget/421/09/bentley93engineering.pdf

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Sleeper354 posted:

I have a question related to threading. I'm taking a class where its a pretty big chunk. I want to know the difference between the following:

Condition Variable
Lock
Semaphore

From my understanding (my most recent one from observing) is that a condition variable is just that a variable, a Lock is a condition variable, and a Semaphore is a combination of the previous two. However, this definition has changed several times. I understand how they work, but I'm having trouble distinguishing them.

Locks, in their most basic form, support two operations: acquire and release. Acquiring a lock prevents other threads from acquiring the lock; hence, if different parts of the program follow the protocol of always acquiring a lock before continuing, the lock guarantees that only one thread can execute any of those parts at once. When you're done with the lock, you have to explicitly release it to permit other threads to acquire it again. This is also known as a mutual-exclusion lock, hence "mutex".

Locks may or may not be: blocking (if you request a lock, your thread stops executing until the lock is available), recursive (a single thread can safely acquire the lock multiple times), multi-mode (the lock can be held in more than one way; some ways may have weaker exclusion guarantees), transferable (from thread to thread), fair (a thread requesting the lock is guaranteed to eventually acquire the lock).

Semaphores are essentially just atomic counters; they can be implemented very efficiently on most hardware. The classic operations are increment (V, which always succeeds immediately) and decrement (P, which blocks until the value is positive before decrementing). Semaphores are directly useful for throttling the number of threads using some resource; this, in turn, means you can use them to implement locks.

Semaphores may or may not be: fair (blocking threads are guaranteed to be woken), bounded (there's a meaningful upper limit on the count: zero-one semaphores are a special case, and are essentially non-recursive mutexes).

Condition variables are basically a way to wait for something to happen. Threads wait on the condition, which causes them to block until another thread signals (a.k.a. notifies) the condition, which then wakes a single waiting thread.

Condition variables may or may not be: broadcasting (they support a "signal all" operation which wakes all blocked threads), "lossless" (i.e. they accumulate extra signals, which are then automatically consumed by threads that try to wait), fair (i.e. threads get woken in the order they waited), Hoare-style (the woken thread begins to run immediately; very powerful on cooperatively-multitasked systems), associated with a lock (which must be held when waiting or notifying, is automatically released during waiting, and is automatically re-acquired after wake-up).

Blightie
Dec 27, 2004
Thanks guys. Interestingly I found this (http://www.dcs.gla.ac.uk/~alice/DSA/lectures06-07/quicksort_examples.pdf) which has a way of making a worst case permutation for median of three quicksort. You've probably seen something like this but thought I might share anyway.

Frohike999
Oct 23, 2003
I'm moving from Delphi 7 to C# very soon at work, and have a question on accessing data. From what I've read, if you want to access the value that is selected on a datagrid for example, you would access it through the grid component (hopefully I'm explaining this right).

To me it seems like you would want to access the datasource the grid is connected to to grab this value, not the actual grid itself. Is there another way to access this value, or does everyone go through the grid?

J. Elliot Razorledgeball
Jan 28, 2005
I have an httpd.conf set up to rewrite everything on my site all nice like, and it works perfectly. However there's one specific URL that I would like to have no rules run on, so I need to have it so if Apache finds this URL it immediately exits out of doing any other rewrites and just serves the page. As I understand it, I can use [L] to force it to drop out of doing other rewrites, but I can't seem to write the rule correctly.

Other Door
Apr 17, 2005

quitters never win, winners never quit, but those who never win AND never quit are called leafs fans. GO SENS GO
I'm trying to create an online database similar to a spreadsheet I've been using. Here's how it works:

-I enter in anywhere from 4-6 independent pieces of data (e.g. 43, 61, 72, 9)
-The computer then creates index cards using combinations of 3 (so, if I had 5 pieces of data, the computer would create 10 different index cards for the different combinations)
-calculations are performed on the index cards based on the data, and a result is output on the cards
-the result from the cards would then be added to a running total, which would be viewable on a separate card

Example:

4 pieces of data: 2, 5, 9, 0
therefore, 4 combinations: 2-5-9, 2-5-0, 2-9-0, 5-9-0
therefore, 4 index cards (each with those numbers)
the numbers on each card are added to obtain the sums: 16, 7, 11, 14
sums 1 and 2 are added to the running total, while sums 2 and 3 are subtracted
suppose the running total started at 0, therefore the total would be -2

This is a very simple example, and I would want to conduct much more complex calculations on the data sets, but I think this gives an idea of what I'm trying to accomplish.

I'm not sure where to start with this. I have some experience with C++ and Java, and I can use HTML ok. I've been using an excel sheet for this, and doing the combs myself by copying and pasting, but it's quite time-consuming and not intuitive at all. I would like to have this online so I could view it from any computer, which is an important feature.

Thank you in advance.

ndb
Aug 25, 2005

I had an idea for a program, but I have an easy question about an assumption I made first, and I'm not quite sure how to Google it.

Essentially, my assumption is that, in least in Windows, when you click a file that's of an associated type (for instance, you click an *.mp3 and that loads up WinAmp), Windows (or whatever) launches the program with the file's path as an argument (so Windows launches WinAmp and passes C:\Music\foobar.mp3 as an argument to WinAmp).

Is this true, or is it more complicated then that?

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I have some MySQL database questions I feel kind of bad putting in its own thread since I imagine they're still beginners questions, and I'm not sure if it's really something for SH/SC. Maybe if there was a megathread for that stuff, I'd be there.

1. Say I have a table made of stock data like 'symbol, closing date, closing price.' A has redundant values if taken by itself, though each row in the table is unique to each other. How can I list out only the unique values in the symbol column?

2. I wrote a Perl script to import a ton of old stock data; it's the current NYSE listings to 1985, wherever possible. I think it'll be a few million of lines, and it inserts each one one-at-a-time using the mysql command-line interface. I think that's a big problem and I wonder how I can bulk up the upload, given it's in a CSV file format.
2b. After starting around 12:00 midnight, I got 1.5% through the set by 7:30AM. The system hadn't locked, and I saw the script blip through the data set of one more symbol before I yanked it. My system clock was set to around 12:30AM. I'm using the MySQL bundled with Ubuntu 8.10 without any configuration changes. What are some basic steps I can do to make this upload work? I can try to run again overnight to determine if it's scaling issue or what.

If you think this isn't really the right place, I guess I can start a "Rocko's SQL questions megathread" since there might be more of this.

csammis
Aug 26, 2003

Mental Institution

Clock Explosion posted:

I had an idea for a program, but I have an easy question about an assumption I made first, and I'm not quite sure how to Google it.

Essentially, my assumption is that, in least in Windows, when you click a file that's of an associated type (for instance, you click an *.mp3 and that loads up WinAmp), Windows (or whatever) launches the program with the file's path as an argument (so Windows launches WinAmp and passes C:\Music\foobar.mp3 as an argument to WinAmp).

Is this true, or is it more complicated then that?

That's generally true. When a program wants to open a certain file type, its installation program writes a value in the registry that indicates the file extension and how Windows should invoke the program to open it.

Search the registry using regedit for ".mp3" and do some exploring, you'll see how it's set up.

Avenging Dentist
Oct 1, 2005

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

csammis posted:

That's generally true. When a program wants to open a certain file type, its installation program writes a value in the registry that indicates the file extension and how Windows should invoke the program to open it.

Search the registry using regedit for ".mp3" and do some exploring, you'll see how it's set up.

Or just look here: http://msdn.microsoft.com/en-us/library/bb776870(VS.85).aspx

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Rocko Bonaparte posted:

I have some MySQL database questions I feel kind of bad putting in its own thread since I imagine they're still beginners questions, and I'm not sure if it's really something for SH/SC. Maybe if there was a megathread for that stuff, I'd be there.

SQL/databases megathread

Factor Mystic
Mar 20, 2006

Baby's First Post-Apocalyptic Fiction

Clock Explosion posted:

I had an idea for a program, but I have an easy question about an assumption I made first, and I'm not quite sure how to Google it.

Essentially, my assumption is that, in least in Windows, when you click a file that's of an associated type (for instance, you click an *.mp3 and that loads up WinAmp), Windows (or whatever) launches the program with the file's path as an argument (so Windows launches WinAmp and passes C:\Music\foobar.mp3 as an argument to WinAmp).

Is this true, or is it more complicated then that?

Basically true but in reality it's substantially more complicated. I wrote a program that lets you manage associations.

When you click something, explorer looks to HKCR\<extension> to get the ProgID of the associated program. For instance, VLC.mp3 is the ProgID on my machine for files with a .mp3 extension. Next, explorer checks HKCR\<ProgID> for information on the program. Why not store that information directly in the extension key? Because the ProgID key essentially stores all the information for a particular file type, and many extensions can have the same file type (eg, .txt and .log are both type "txtfile"). The ProgID key is where a lot of file type metadata such as context menu items (verbs and commands), the icon for the file type, etc.

That's the basics. However, there are a lot of things to keep in mind when editing this stuff manually. For instance, HKCR is a view (in the MVC sense) of the HKLM\Software\Classes and HKCU\Software\Classes, with writes redirected to HKLM\Software\Classes. Since this tree stores system defaults, that means writes to HKCR require administrative privileges. HKCU stores per-user settings, which have a greater precedence over system defaults when building the view.

Also, the \Software\SystemFileAssociations key contains keys that contain information on each Percieved Type (text/image/system ...etc), which have their own position in the precedence tree for files of that Percieved Type. Additionally, the \Software\SystemFileAssociations key has per-extension information.

There's also HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts (I think thats the key, it changed in Windows 7 and I don't have an older version here to double check) which contains extension keys for Default Programs associations like you see for registered programs in Windows Set Program Access and Defaults.

Depending on how in-depth your program is going to be, you'll need to build the precedence tree yourself to determine what info explorer will display for any particular file type, and also have fun abstracting all this for users in a way that doesn't make your UI too complex.

Feel free to PM me if you want to continue discussing this.

ndb
Aug 25, 2005

I think my biggest confusion is simply this: I understand that I have to register a file type for the object - but what determines how the file is going to be open? Is that something that the programmer has to handle, or is that something that's dealt with in the registry?

I've found that for *.mp3s, WMP is the default program, but it didn't give me the knowledge of what it actually does with that *.mp3 file I clicked.

I have a suspicion it involves Shell Extensions, but the only one that the MSDN article that Avenging Dentist mentioned was for drag and drop operations.

EDIT: I'm also understanding what you are saying Factor Mystic, and would PM you, but I don't have platinum...yet.

ndb fucked around with this message at 01:52 on Dec 19, 2008

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh
When you doubleclick a file it just executes the command specified in the "open" verb for the extension.

jeremiah johnson
Nov 3, 2007
I'd like to write a program to solve cryptograms what would be the best language thats free and available on Linux to do this.

csammis
Aug 26, 2003

Mental Institution

jeremiah johnson posted:

I'd like to write a program to solve cryptograms what would be the best language thats free and available on Linux to do this.

That's a really bad question. Every mainstream language is free, and the only one I can think of that isn't "available on Linux" is VB6 which isn't free anyway and is old.

jeremiah johnson
Nov 3, 2007

csammis posted:

That's a really bad question. Every mainstream language is free, and the only one I can think of that isn't "available on Linux" is VB6 which isn't free anyway and is old.

Ok then let me rephrase:

I would like to make a program that could solve cryptograms what would be a good language to use?

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

jeremiah johnson posted:

I would like to make a program that could solve cryptograms what would be a good language to use?

I've seen a few different things labelled as "cryptograms", so an example might help here. But most simple cryptographic puzzles rely heaving on text manipulation rather than bit manipulation, so Perl is probably as good a choice as anything.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

rjmccall posted:

SQL/databases megathread
Hah--name it something I wouldn't find when trying to search for it. OK I'm flocking over to there.

jeremiah johnson
Nov 3, 2007
I'm thinking of this kind http://www.rinkworks.com/brainfood/p/crypts1.shtml.

csammis
Aug 26, 2003

Mental Institution

jeremiah johnson posted:

I'm thinking of this kind http://www.rinkworks.com/brainfood/p/crypts1.shtml.

Your program's biggest problem is going to be recognizing when the phrase has been decoded into English. Find a language or a library that will make that part work well, and use that. I don't know of any off the top of my head but that's the place to start looking.


e: What programming languages have you used before, anything? It was such a strangely phrased question I'm not sure if you've had any prior programming experience :shobon:

e2: \/\/\/ :fry:

csammis fucked around with this message at 03:52 on Dec 19, 2008

shrughes
Oct 11, 2008

(call/cc call/cc)
Use Python, because it doesn't require any punctuation.

jeremiah johnson
Nov 3, 2007

csammis posted:

Your program's biggest problem is going to be recognizing when the phrase has been decoded into English. Find a language or a library that will make that part work well, and use that. I don't know of any off the top of my head but that's the place to start looking.


e: What programming languages have you used before, anything? It was such a strangely phrased question I'm not sure if you've had any prior programming experience :shobon:


I took a basic VB course in high school a couple years ago. Since then I've used php a little. Any time I've had an idea for a little program I've wanted to write I've been able to do it but I wanted to make sure I didn't spend days trying to make this and then find out the language I chose was ill suited for it.

Factor Mystic
Mar 20, 2006

Baby's First Post-Apocalyptic Fiction

Clock Explosion posted:

I think my biggest confusion is simply this: I understand that I have to register a file type for the object - but what determines how the file is going to be open? Is that something that the programmer has to handle, or is that something that's dealt with in the registry?

I've found that for *.mp3s, WMP is the default program, but it didn't give me the knowledge of what it actually does with that *.mp3 file I clicked.

I have a suspicion it involves Shell Extensions, but the only one that the MSDN article that Avenging Dentist mentioned was for drag and drop operations.

EDIT: I'm also understanding what you are saying Factor Mystic, and would PM you, but I don't have platinum...yet.

The default action when you double click a file is it's open verb, which, if you just need to read it, is available in HKCR\Classes\<ProgID>\shell\open\command default value. If you need to edit an existing value, it becomes a bit more complex. If you're creating your own progid, it's simpler because you write your progid key, then set the progid value of the extension key. Double easy because you can do it in all HKCU\Software\Classes which doesn't need administrative privileges.

You shouldn't have to mess with shell extensions unless I have misunderstood your goals.

Default Programs, aka Set Program Access and Default, aka SPAD is the exception to all rules. Those ProgId's are stored in HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\<ext>\UserChoice (I checked this time :v: ) and have the highest precedence for getting association information. You'll need to break the extension out of SPAD's control (by deleting that key- it's safe to do this) and allowing association precedence fall to the next level, which is whatever HKCR says.

Hit me up on AIM or grab me in #cobol or something, or email, I know how frustrating backtracking all over msdn for this stuff can be.

Ensign Expendable
Nov 11, 2008

Lager beer is proof that god loves us
Pillbug
Could someone explain dynamic programming to me? I understand the whole concept of reusing previous calculations, and the "largest continuous sum in an array" example everyone seems to give makes sense, but none of the larger problems do.

arkiteKt
Jan 2, 2006

I am an obese homosexual who uses a scooter!
Browsers being stupid cunts with javascript form submit problem
I have a problem where I need a form to be submitted by an HTML form Option control, but trying to manage this across the three browsers - FF / IE7 / Safari is a loving bitch right now.

With this code:

<form>
<select name="theID" id="select" onchange="document.postform.submit();">
<option>...</option>
<option>...</option>
</select>
</form>

I do NOT have a submit button in there interfering with poo poo.

Firefox and IE7 don't work when the first option is clicked, because there is no change. Safari just doesn't work at all. Firefox works if I put onclick on the option itself, but that's not really proper.

I really don't want a submit button because it's a huge inconvenience if the user accidentally hits it, since the space where I'd have both a dropdown + button is somewhat small. Just a single dropdown is fuckin' smooth, except it's not working at all.

I tried using jQuery + AJAX to bind to .click() but even that doesn't work across all browsers. Is there any universal code to make this work? Googling turns up a few different ideas but none of the solutions actually seem to work.

arkiteKt fucked around with this message at 06:37 on Dec 19, 2008

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Ensign Expendable posted:

Could someone explain dynamic programming to me? I understand the whole concept of reusing previous calculations, and the "largest continuous sum in an array" example everyone seems to give makes sense, but none of the larger problems do.

Dynamic programming is very straightforward. First off, it only applies to problems where the solution to a problem can be expressed in terms of the solutions of slightly smaller problems. You then solve the problem "bottom up": resolve the smallest problems first, remember their answers, and then keep using those to answer the next-smallest problems. So the key is to find some way to state the solution to the whole problem in terms of the solutions to smaller problems.

Adbot
ADBOT LOVES YOU

Avenging Dentist
Oct 1, 2005

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

arkiteKt posted:

Browsers being stupid cunts with javascript form submit problem

The problem is not browsers. It is you. Usually you want a "null" option so that selecting something actually requires a change.

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