Jump to content

eggrock

Members
  • Posts

    36
  • Joined

  • Last visited

Everything posted by eggrock

  1. Interesting that 105 seems to be dead now. Coincidence? (kidding, not insinuating Anything. At. All.)
  2. Thanks Bruce. What is considered excessive for CPU/memory? These manipulate images up to 1280x1024 ([edit: reduced to 512x512 until I put throttling in]) and can make several passes. The longest it runs is a few seconds, (7 at most) but during that time it's doing nothing but math.
  3. 'scripts' I've got a couple of scripts I'm working on that can be CPU intensive. Left to itself Perl WILL suck up all available CPU resources, so I need to know whether or not I need to write in speedbumps for my scripts.
  4. Thanks for your reply David, I appreciate it.
  5. This wound up working; setTimeout does operate (or execute) in a global scope--which makes sense since it's an event--so the declaration/initialization of 'count' and 'delay' need to be external to the function as well, or else the local scope overrides the global scope and I get undefined values as a result. With everything in a global scope there's no need for looping with the exception of the recursive function call: >var newsitem = new Array(); var delay = 7000; var count = 0; newsitem[0] = "some news"; newsitem[1] = "more news"; function newsbar() { var newsmsg = "News: " + newsitem[count]; document.newsform.newsinput.value=newsmsg; count++; if(count >= newsitem.length) { count = 0; } news=setTimeout("newsbar()", delay); } That's still a bit unclear because the tutorials and explanations I've seen indicate that 'count = 0' is the same as 'var count = 0', so there must be a check for a predefined global before a local is created. [edit] And the results are here: http://up-nort.com/test/cfbtest1/index.html - Still playing around with layout, backgrounds and such but once the javascript is done it's all layout and server side (the latter is complete as well).
  6. Oops. Had totalchoice.com enabled, not totalchoicehosting.com... My bad.
  7. The 'add noise' filter in Photoshop can give you that effect but since the size of that pic is so small you won't get a very realistic effect. Not to mention that, after six years of owning Photoshop I'm still a complete n00b. This is an example; I didn't crop the background, just added noise and set to grayscale:
  8. One answer I got elsewhere was to change >news=setTimeout("newsbar(count, delay)", delay); to this >myCmd = 'newsbar(' + count + ', ' + delay + ')' news = setTimeout(myCmd, delay) And make count global, or at least external to the function call. With some other tweaks and messing around, count will start at 0, increment and then roll over back to 0 when it reaches the value of the total number of array elements. Exactly what I want. Trouble is, 'newsitem[count]' still doesn't display correctly; it doesn't change at all on the web page. So I guess what I'm really after is something that explains EXACTLY how Javascript handles variables and why you need to do this funky string concatenation to pass things along. The latter probably has to do with how quotes are handled. It doesn't act like I expect it to--you know, C, Perl, reverse Polish notation on HP calculators. I've been using W3 schools and code samples from various places but the documentation is far from complete.
  9. Using the following code, I expect to have varying bits of information placed on the page every few seconds: >function newsbar(count, delay) { var newsitem = new Array(); newsitem[0] = "some news"; newsitem[1] = "more news"; for (i=0;i<newsitem.length;i++) { if(count==i) { document.newsform.newsinput.value=newsitem[i]; count++; if(count>=newsitem.length) { count = 0; } news=setTimeout("newsbar(count, delay)", delay); } } } The script is called in the body tag, eg <body onload="newsbar(0, 5000);">, and placement is in a text input box (form name is 'newsform' and the input name is 'newsinput'. A couple problems: - Even though I pass '0' (as count) in the onload tag, array element 1 displays. This tells me that 'i' is being incremented differently than I'd expect; guessing as soon as 'i++' is encountered. Not a huge deal. - The big problem is, when setTimeout is used to call newsbar again, count (and probably delay) are undefined. I don't know what's going on there. Every example I see on the web is either passing a string to the function (which works in my case) or nothing at all. No actual variable values are passed so this has to be yet another feature *coughidiocycough* of Javascript, or maybe just a quirk of setTimeout or whatever, I dunno. For efficiency's sake I can probably initialize that array externally to the function but since I'm basically illiterate when it comes to Javascript I'm playing it safe for now. The rules in Javascript are so incomprehensible I'm willing to sacrifice elegance and efficiency in the name of functionality.
  10. Okay, here's a rough outline of a test page: Test Page If you View->Source you'll see a bunch of 'empty' <div> tags, eg: <div class="bgtopleft"></div> I put the CSS into it's own file for right now; all class 'bgtopleft' does is set an image at a certain point. The login form is in its own <div> and is also absolutely placed, as well as the score table at the bottom. The source & CSS is a rough draft; it's going to be dynamically generated eventually. Is that acceptible/efficient/preferred to set things this way?
  11. Would applying position/right/top to a <div> be good practice? The entire form will be in a particular area and other content in other areas. I didn't try to use the IMG BB tag, just entered the URL (and had the URL tag applied automatically.) But yes, hotlinking protection is on...
  12. Crap, thumbs don't work here. Grrr.. That image is only 17k.
  13. Yeah, that's odd. It's an image so there's probably some security setting or another that won't allow .png's to be opened directly. Try it without the BB code. [edit] Dunno the image size commands in BB so I didn't link it directly.
  14. No, the page can have that many boxes, checkboxes, radio buttons etc. on it. I guess that part doesn't matter since nothing's below it. For a vague idea of the layout (the login form will be in the far upper-right): up-nort.com/cfb/pics/themes/cfbm/bg.png Nevermind the colors, just playing.
  15. Yuck (the page is full of input boxes, sometimes hundreds).. but thanks.
  16. The problem is, those differences are going to add up and I'm not sure what the best method of keeping things aligned would be. Absolute positioning on <div> sections? If you like the box (thanks!), it's from a little script I've been playing around with. Feel free to experiment (but it'll break here and there since I'm still coding it. And I'm not doing error checking now so you can run into div/0 errors. http://up-nort.com/cgi-bin/test/boxBlend.cgi Use hex values (000000-FFFFFF) for everything but width/height parameters. 'Sub-box' is used to get partial shading effects on the borders.
  17. Example: http://up-nort.com/test/tctest.html - simple login form with a background image. Testing in Firefox & IE6. Some differences I've seen: IE uses bullets in password boxes and sizes them accordingly. Firefox uses asterisks so type="text" and type="password" display exactly the same. IE's input boxes are 1 pixel taller than Firefox's. IE spaces input boxes (or <p>?) farther apart than Firefox. IE's type="button" is wider (and I think taller) than Firefox's. So... How the heck do I get them to display the same? Specify width/height for everything on the page?
  18. Great, that's exactly what I needed to know about cookies. In the 'real' script I'm working on I can just set a variable based on which button is clicked and display results that way; next time the page loads it'll read the cookie data. But... Now I'd better examine the rest of the cookies to make sure I understand how they're being interpreted. Thank you!
  19. I have a test Perl script for cookies, very simple (and simplified a bit) that doesn't work properly: >use CGI qw(:standard); use CGI::Cookies; if(defined param("on")) # on button clicked { $c = new CGI::Cookie( -name => 'test', -value => 1, -domain => '.****', -path => '/cgi-bin', ); } elsif(defined param("off")) # off button { # set same variable/settings except value is '0' } print header(-cookie =>[$a]); # start html, head, title, body tags %cookie = fetch CGI::Cookie; if(defined $cookie{test}) { $c = $cookie{test}->value; # code for form with on|off submit button # the form POSTs back to this script } Here's how it works # script instance 1 (first page load) cookie value on PC: 0 (let's pretend) cookie value from fetch: 0 [i click the 'on' button & submit the form] # script instance 2 cookie value on PC: 1 cookie value from fetch: 0 (this is the problem) [i click the on button again] # script instance 3 both cookie and fetch are '1' So what's happening is, the cookie gets set and there's a (basically) immediate fetch which doesn't match with what I expect until the second time around. I'm baffled, any help will help.
  20. Thanks David, that's what I'm using right now.
  21. Thanks, but I'm more concerned about any possibility of people off the server being able to use some exploit or another to see the Perl code. In other words, is code itself secure from being seen by anyone external to the server; there's no exploit or hack that will allow people to see it...? (Barring errors on my part or other things like SQL injection etc.) Thanks for the welcome everybody. [edit] I guess that's more of an Apache & OS question than database security so if this needs to be moved feel free.
  22. So if I have a Perl script in my root (home) directory, I can have it open the connection to the DB and return the handle??? Would that be secure? Example (db_login.pm) >#!/usr/bin/perl use CGI::Carp qw(fatalsToBrowser); use DBI; sub db_open() { $dbh = DBI->connect("DBI:mysql:DB_NAME:localhost", "ID", "PASSWORD" or die "Database connect error: $DBI::errstr\n"; return $dbh; } 1; ----------------------- Something like that perhaps? The capitalized items (excluding 'DBI') would be hardcoded, or else stored in a file that could be read by the module to get the ID/password....?
×
×
  • Create New...