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
The March Hare
Oct 15, 2006

Je rêve d'un
Wayne's World 3
Buglord
If I were to try to make a 'goon auth' system for a website (Like the one on awful yearbook that basically does the following "what is your user id? Here's a randomly generated 20 character code put it in the location field of your profile. [script checks profile if it is there] OK you are a goon, carry on. [if it is not there] try again or get out." How would I go about doing this? I assume its all php. I don't need a full blown script for it I just need to know how it is done. If I have been unclear please ask me to clarify anything.

http://www.awfulyearbook.net/register for reference I want it to be like that.

Adbot
ADBOT LOVES YOU

poopiehead
Oct 6, 2004

Just pull in the profile page and search for the string in what you get back. Haven't done php in a long time but I think you can use fopen. The url to use is like

http://forums.somethingawful.com/member.php?action=getinfo&username=poopiehead

Dominoes
Sep 20, 2007

I'm making a web page, but the table borders are somewhat stylized by default. I don't mind the look, but it looks weird colered, and I would prefer to be able to use a 1 pixel colored border if I can. How do I do it? This seems like something that should be obvious (and the default setting :/) border="1" doesn't work.

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh
This should probably help you play around with styles to get something you like: http://www.somacon.com/p141.php

hey mom its 420
May 12, 2007

I'm doing something for my physics class and it involves a particle in a box problem in 3 dimensions. I have a function that generates further quantum states based on a starting state and a depth.
code:
def quantum_states(start, depth):
    if depth > 0:
        yield start
        for i, x in enumerate(start):
            start_list = list(start)
            start_list[i] += 1
            for state in quantum_states(tuple(start_list), depth-1):
                yield state
So an example of its usage would be
code:
>>> list(quantum_states((1,1,1),2))
[(1, 1, 1), (2, 1, 1), (1, 2, 1), (1, 1, 2)]
>>> list(quantum_states((1,1,1),3))
[(1, 1, 1), (2, 1, 1), (3, 1, 1), (2, 2, 1), (2, 1, 2), 
(1, 2, 1), (2, 2, 1), (1, 3, 1), (1, 2, 2), (1, 1, 2), (2, 1, 2), (1, 2, 2), (1, 1, 3)]
It works as it is, but you have to supply it a depth it's going to traverse. It works much like depth first traversal in a tree.
What I'd like it to do is to generate an unlimited amount of states, not just the amount that is inferred from depth. However, if I change it to this
code:
def quantum_states(start):
    yield start
    for i, x in enumerate(start):
        start_list = list(start)
        start_list[i] += 1
        for state in quantum_states(tuple(start_list)):
            yield state
and then try to get the first 10 states, I get this
code:
>>> list(x for x,_ in zip(quantum_states((1,1,1)), xrange(10)))
[(1, 1, 1), (2, 1, 1), (3, 1, 1), (4, 1, 1), (5, 1, 1), (6, 1, 1), 
(7, 1, 1), (8, 1, 1), (9, 1, 1), (10, 1, 1)]
Which makes sense, because without an edge condition, it just keeps going along the left branch forever. And that doesn't produce very useful results.

So how could I modify this so that it gives me an infinite sequence but doesn't just keep going along the left branch?

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

Bonus posted:

So how could I modify this so that it gives me an infinite sequence but doesn't just keep going along the left branch?

What you want in Haskell would be along the lines of:
code:
qstates s = s : concat [ [ (a+1,b,c), (a,b+1,c), (a,b,c+1) ] | (a,b,c) <- qstates s ]
So, by converting to explicit iterators for Python, we wind up with something like:
code:
def quantum_states( start ):
  yield start
  for state in quantum_states( start ):
    for i, x in enumerate( state ):
      l = list( state )
      l[i] += 1
      yield tuple( l )
(completely untested, because I don't like Python)

In Haskell, this code works well because the optimizer does the right thing and builds a cycle in the intermediate graph. I kind of doubt Python is going to be that smart, so you might want to build a wrapper that memoizes an appropriate window in order to avoid going linear in stack frames. Whether or not this is worth it depends largely on how expensive the continuations wind up being.

ShoulderDaemon fucked around with this message at 17:32 on Apr 7, 2008

hey mom its 420
May 12, 2007

Thanks man, both those pieces of code work great!
I'm gonna write this thing in Haskell too, just for the heck of it.

Dr.Zeppelin
Dec 5, 2003

PHP/IIS/Windows XP

I wrote a simple script in PHP to upload a file with the eventual intent to store it in MySQL as a blob. The script retrieved the file successfully with no error code but the copy was still unsuccessful:

code:
$uploaddir = 'C:\\Inetpub\\wwwroot\\uploads\\\';
$uploadfile = $uploaddir.basename($_FILES['binFile']['name']);
$tempfile = $_FILES['binFile']['tmp_name'];

if (move_uploaded_file($tempfile,$uploadfile))
{  echo "upload successful<br>";  }
else
{  echo "upload unsuccessful<br>"; }
Because print_r($_FILES) shows no error and all of the paths to be correct, I suspect it's a permissions issue. How do I grant PHP (or IIS) the permission to write the file to and/or copy it from C:\WINDOWS\Temp to the uploads directory? Alternatively, if it's not a permissions issue, what is it?

Edit: question withdrawn, Internet Guest account needed write permission to temp directory and destination directory

Dr.Zeppelin fucked around with this message at 18:45 on Apr 8, 2008

Jam2
Jan 15, 2008

With Energy For Mayhem
What's the most efficient operating system for a web server?

I'm running AssetNow CMS on Coldfusion. My current OS is Windows Server 2003 on a shared server.

I'm moving to a dedicated server that I can call my own, and I'm looking for the best solution.

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

Jam2 posted:

What's the most efficient operating system for a web server?

The most meaningful definition of "efficient" is strongly dominated by maintainence overhead, so the answer is "whatever operating system you are most familiar with and takes the least hassle to run the software you are already using."

Operating systems do have different scheduling and memory behaviour, but the differences are going to be overwhelmed by even minor hardware changes like adding RAM. Unless you are in a situation where you need extremely high runtime or will be constantly running at close to 100% load, you shouldn't care. If you are in such a situation, then the solution needs to be finely and particularly tuned to your requirements.

Jam2
Jan 15, 2008

With Energy For Mayhem

ShoulderDaemon posted:

The most meaningful definition of "efficient" is strongly dominated by maintainence overhead, so the answer is "whatever operating system you are most familiar with and takes the least hassle to run the software you are already using."

Operating systems do have different scheduling and memory behaviour, but the differences are going to be overwhelmed by even minor hardware changes like adding RAM. Unless you are in a situation where you need extremely high runtime or will be constantly running at close to 100% load, you shouldn't care. If you are in such a situation, then the solution needs to be finely and particularly tuned to your requirements.

We will be streaming audio to thousands of concurrent listeners 24/7. I am just wondering what will handle the load the best.

I'm thinking it's best to stick with Windows Server 2003 simply for Windows Media Services.

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

Jam2 posted:

We will be streaming audio to thousands of concurrent listeners 24/7. I am just wondering what will handle the load the best.

I'm thinking it's best to stick with Windows Server 2003 simply for Windows Media Services.

If you are streaming the same audio source to all those clients, then it's hugely unlikely that the scheduling and cache differences between operating systems will be observable. If there are many different sources, then the Linux scheduling and pagecache might perform better, but adding RAM to a Windows-based server would overwhelm the difference. CPU usage is going to be comparable across the board.

It sounds like Windows Server 2003 already has the software and working environment you are used to, and has tools that will work well for your case, so it's obviously the right thing to use. Any money you "saved" over a year by switching platforms would be lost in added wages for programmer and administrator time in less than a week (probably less than a day if you're anything more than a 3-man shop), and migrating would almost certainly take much longer than that.

clockwork automaton
May 2, 2007

You've probably never heard of them.

Fun Shoe
Is there a way to check if a read in string from fscanf() contains a newline in C? I know it ignores whitespace characters which presumably includes newlines, I just am looking for a way to tell if it has encountered and ignored these characters.

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

clockwork automaton posted:

Is there a way to check if a read in string from fscanf() contains a newline in C? I know it ignores whitespace characters which presumably includes newlines, I just am looking for a way to tell if it has encountered and ignored these characters.

This probably isn't what you want to hear, but fscanf is a really terrible lexer, and when you get to the point of caring if a newline or something is present in the input, you should really consider moving to a lexer generated by lex or some other tool.

clockwork automaton
May 2, 2007

You've probably never heard of them.

Fun Shoe

ShoulderDaemon posted:

This probably isn't what you want to hear, but fscanf is a really terrible lexer, and when you get to the point of caring if a newline or something is present in the input, you should really consider moving to a lexer generated by lex or some other tool.

Actually, that's perfectly fine. The way I figure it there is an easier way to do what I am doing, I'm just being stubborn and not seeing it.

Plastic Jesus
Aug 26, 2006

I'm cranky most of the time.

clockwork automaton posted:

Actually, that's perfectly fine. The way I figure it there is an easier way to do what I am doing, I'm just being stubborn and not seeing it.

Can't you just do strchr('\n') (or strstr("\r\n") on windows)?




Ohhhhhhhhh. I misread. Then, yes, seconding the idea that you may be approaching the problem wrong.
vvvvvvvvvvvvvvv

Plastic Jesus fucked around with this message at 17:50 on Apr 9, 2008

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Plastic Jesus posted:

Can't you just do strchr('\n') (or strstr("\r\n") on windows)?

No the problem is that when you use scanf it removes the endline characters from the string.

NotAok
Dec 29, 2003
Whoops, sorry, moving this to the .net thread. Thanks for the Fusion suggestion.

NotAok fucked around with this message at 18:33 on Apr 9, 2008

csammis
Aug 26, 2003

Mental Institution

NotAok posted:

I've been able to successfully load these by just using the assembly class, but I used the easier LoadFile method. This method may be what's tripping me up here.

Yup. Read up on Fusion to understand the semantics of how and where the Framework will look for an assembly to load using the Load() methods vs. LoadFile(). Also, make sure that the DLL's you're loading are valid .NET Assemblies, because I seriously doubt twain_32.dll is .NET :)

edit: Also, the .NET Megathread is where this question belongs

clockwork automaton
May 2, 2007

You've probably never heard of them.

Fun Shoe

Plastic Jesus posted:

Can't you just do strchr('\n') (or strstr("\r\n") on windows)?




Ohhhhhhhhh. I misread. Then, yes, seconding the idea that you may be approaching the problem wrong.
vvvvvvvvvvvvvvv

This was indeed true, I went back and rethought my logic. Each of the lines I was looking for was prefaced with a character to mark what the line did, so I just looked for those when I was reading in. The results are quite cool actually as I was reading in OBJ files.

more falafel please
Feb 26, 2005

forums poster

clockwork automaton posted:

This was indeed true, I went back and rethought my logic. Each of the lines I was looking for was prefaced with a character to mark what the line did, so I just looked for those when I was reading in. The results are quite cool actually as I was reading in OBJ files.



That is a lot of polys.

clockwork automaton
May 2, 2007

You've probably never heard of them.

Fun Shoe

more falafel please posted:

That is a lot of polys.

Yeah, that was my test mesh to make sure I could handle that many. The final meshes I will use wont have nearly that many. It takes way too long to read in something that massive.

Diatribe
Sep 29, 2004
Hi. Not sure if I'm in the right place but here goes:

I'm looking for a program that can auto-refresh a webpage until it finds a 'buy now' button. It should then add the item to a shopping cart and stop. I want to use it for artworks that get released online at a certain time. It's very popular so hitting f5 repeatedly is not enough usually.

Does anyone have an idea if this sort of program exists or otherwise how difficult it would be to write? Thanks.

tef
May 30, 2004

-> some l-system crap ->
What you are looking for is called 'Sniping software'

Diatribe
Sep 29, 2004

tef posted:

What you are looking for is called 'Sniping software'
Isn't that usually specific to bid-based sites like ebay?

edit: great, thanks for your help

Diatribe fucked around with this message at 11:05 on Apr 10, 2008

tef
May 30, 2004

-> some l-system crap ->
It is a pretty similar mode of operation: Refresh until conditions are met, then execute an action.

Another thing would be to look at macros for web browsers.

two_beer_bishes
Jun 27, 2004
I want to put together a site that will allow me to track fuel economy and maintenance for my car. I would like it to have separate pages for fuel and maintenance and also a couple other car-related costs I want to track, but I want to keep the databases separate from each other (hopefully that makes it less complicated). I want the page to show the data in a spreadsheet type format and at the top of the page it'll have an entry form for the date/#of gal/$per gal/etc... Would PHP work best for something like this? Also, at some point I would like to be able to update this from my cellphone. If the site is lightweight enough I could just pull it up using the built in browser, so I don't think I'd need any extra coding.

Scaevolus
Apr 16, 2007

two_beer_bishes posted:

I want to put together a site that will allow me to track fuel economy and maintenance for my car. I would like it to have separate pages for fuel and maintenance and also a couple other car-related costs I want to track, but I want to keep the databases separate from each other (hopefully that makes it less complicated). I want the page to show the data in a spreadsheet type format and at the top of the page it'll have an entry form for the date/#of gal/$per gal/etc... Would PHP work best for something like this? Also, at some point I would like to be able to update this from my cellphone. If the site is lightweight enough I could just pull it up using the built in browser, so I don't think I'd need any extra coding.

Have you looked at Google AppEngine? (Python/Django)

Scaevolus fucked around with this message at 20:43 on Apr 12, 2008

more falafel please
Feb 26, 2005

forums poster

two_beer_bishes posted:

I want to put together a site that will allow me to track fuel economy and maintenance for my car. I would like it to have separate pages for fuel and maintenance and also a couple other car-related costs I want to track, but I want to keep the databases separate from each other (hopefully that makes it less complicated). I want the page to show the data in a spreadsheet type format and at the top of the page it'll have an entry form for the date/#of gal/$per gal/etc... Would PHP work best for something like this? Also, at some point I would like to be able to update this from my cellphone. If the site is lightweight enough I could just pull it up using the built in browser, so I don't think I'd need any extra coding.

Honestly, why not use Excel or Google Docs for this? It's really a spreadsheet kind of app.

two_beer_bishes
Jun 27, 2004
Thanks to both of you, I had no idea that existed!

nbv4
Aug 21, 2002

by Duchess Gummybuns
Is there an easy way to debug javascript on IE? My site works fine in mozilla browsers, but literally none of the javascript functions work in IE. All IE gives me is a vague "invalid argument" type error which makes it hard to figure out whats wrong.

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb

nbv4 posted:

Is there an easy way to debug javascript on IE? My site works fine in mozilla browsers, but literally none of the javascript functions work in IE. All IE gives me is a vague "invalid argument" type error which makes it hard to figure out whats wrong.

IE8 has a development mode that is like a lovely version of Firebug. You can also emulate IE7 with it.

nbv4
Aug 21, 2002

by Duchess Gummybuns

fletcher posted:

IE8 has a development mode that is like a lovely version of Firebug. You can also emulate IE7 with it.

Is the the only way? How do people debug JavaScript from within a UNIX environment?

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh
Does anyone in the world actually do web development exclusively in UNIX?

Also, have you seen http://www.code101.com/Code101/DisplayArticle.aspx?cid=67 ?

nbv4
Aug 21, 2002

by Duchess Gummybuns

Avenging Dentist posted:

Does anyone in the world actually do web development exclusively in UNIX?

Also, have you seen http://www.jonathanboutelle.com/mt/archives/2006/01/howto_debug_jav.html ?

I do all my programing in Ubuntu. Every few days I'll load my stuff onto my laptop which runs XP too see how it looks, which is kind of a pain.

I came across that script debugger, but I'm not about to pay hundreds of dollars to buy Office, just for that one tiny application.

csammis
Aug 26, 2003

Mental Institution
The Web Development Megathread has some words about web development too. Maybe too many words? :raise:

Avenging Dentist
Oct 1, 2005

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

nbv4 posted:

I do all my programing in Ubuntu. Every few days I'll load my stuff onto my laptop which runs XP too see how it looks, which is kind of a pain.

I came across that script debugger, but I'm not about to pay hundreds of dollars to buy Office, just for that one tiny application.

I pasted the wrong link originally. I edited my post above to the right one. I'm still confused as to why you think there should be a way to debug Javascript in Internet Explorer in Linux of all things, though...

Why not just run a Windows VM?

Filburt Shellbach
Nov 6, 2007

Apni tackat say tujay aaj mitta juu gaa!

Avenging Dentist posted:

Does anyone in the world actually do web development exclusively in UNIX?

Of course. Firebug is godly.

Avenging Dentist
Oct 1, 2005

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

Sartak posted:

Of course. Firebug is godly.

That's fine if you're developing for a single browser.

Adbot
ADBOT LOVES YOU

Zombywuf
Mar 29, 2008

ORLY

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