• Questions That Don't Need Their Own Thread v3
    4,068 replies, posted
  • Why is Apache ignoring half my directives? I'm using a Debian 6.0 box with LAMP and I'm configuring the server via apache2.conf. It seems to ignore any .htaccess files I use, even if I use <Directory /var/www> AllowOverride All </Directory> I want to disable script execution in a particular directory, so I looked it up and people suggested using AddHandler cgi {extensions} and then Options -ExecCGI. I can't remember what exactly it was but it didn't work. I've tried everything to stop even just PHP from executing and it's totally ignored by the server. RemoveHandler, AddType text/html php and plenty of other things. This doesn't work in both apache2.conf and .htaccess. Why is Apache ignoring me? [editline]3rd May 2012[/editline] Turns out it's because I don't fully understand how the configuration system works. Last time I used Apache was a while back and I only had the option of editing httpd.conf. Looks like there's a "sites-enabled" folder with a configuration which overrides the prior one and already has directory options in it. [editline]3rd May 2012[/editline] .htaccess works now but I still can't disable script execution in this direction. None of the AddHandler tricks work.
  • [QUOTE=StinkyJoe;35810756]SQL injection ahoy. [php] <?php $pdo = new PDO('mysql:host=localhost;dbname=dbname', 'user', 'password'); $query = $pdo->prepare('SELECT * FROM table_name WHERE id=?'); if( !$query->execute(array($id)) ) echo 'shit broke, yo'; ?> ... <? foreach($query->fetchAll(PDO::FETCH_OBJ) as $country): ?> <option value="<?= $country->name ?>"><?= $country->name ?></option> <? endforeach ?> [/php][/QUOTE] Thanks, that could come in handy some time. He couldn't get the code to work though, and is doing it manually...
  • Completely retarded question, I feel like I'm overlooking something obvious. I'm just trying to change the look of links in my styles.css. Basically just make it so there's no underline, the text is black, and that it goes bold when you hover over it. This is what I have: [code] a:link: color:#000; background-color:#CCC; text-decoration:none; font-weight:none; a:visited: color:#000; background-color:#CCC; text-decoration:none; font-weight:none; a:hover: color:#000; background-color:#CCC; text-decoration:none; font-weight:bold; font-size:100%; a:active: color:#000; background-color:#CCC; text-decoration:none; font-weight:none; [/code] I need to know where exactly to place it in the CSS document, nothing seems to be working. I tried placing it in the specific id, under html, body, and even in desperation put it in *{ } brackets.
  • [QUOTE=FKop_Dragon;35812291]Completely retarded question, I feel like I'm overlooking something obvious. I'm just trying to change the look of links in my styles.css. Basically just make it so there's no underline, the text is black, and that it goes bold when you hover over it. This is what I have: -code- I need to know where exactly to place it in the CSS document, nothing seems to be working. I tried placing it in the specific id, under html, body, and even in desperation put it in *{ } brackets.[/QUOTE] I didn't know you were allowed to specify stuff like that? I always thought it was something like [code] a:hover { color:#000; background-color:#CCC; } [/code] etc... Other than that, shouldn't you just give the standard properties to just "a" and then under that, the a:hover, where you put !important behind the "font-weight:bold" property, like so: [code] a { color:#000; background-color:#CCC; text-decoration:none; font-weight:none; } a:hover { font-weight:bold !important; } [/code] Correct me if I'm wrong though, guys.
  • [code] a:link { color:#000; background-color:#CCC; text-decoration:none; font-weight:none; } a:visited{ color:#000; background-color:#CCC; text-decoration:none; font-weight:none; } a:hover{ color:#000; background-color:#CCC; text-decoration:none; font-weight:bold; font-size:100%; } a:active{ color:#000; background-color:#CCC; text-decoration:none; font-weight:none; } [/code]
  • [QUOTE=parket;35809557]Uh I need a little help with a problem of mine I'm having - I need to make one very long image scroll across the screen and loop. The problem is for a countryside + clouds moving gradually. There's a few possible solutions I've found but none work well on IE which is a must =/[/QUOTE] If you set both layers to be absolutely positioned within a container with overflow: hidden;, you could animate the left properties to slide them left or right. Looping is an issue, but you'd just have to have the last 100px or so just be copied from the start of the issue (The exact amount required would depend on the width of the browser window)
  • Is there any possible way to be able to pull a full list of the files that a client is going to download when connecting to a server in Gmod? (That the loading screen page can access, sv_loadingurl)
  • [QUOTE=TheDecryptor;35815080]If you set both layers to be absolutely positioned within a container with overflow: hidden;, you could animate the left properties to slide them left or right. Looping is an issue, but you'd just have to have the last 100px or so just be copied from the start of the issue (The exact amount required would depend on the width of the browser window)[/QUOTE] Another solution is to make a div with the class clouds position it at the top of the page with width: 100% then give it the cloud background with repeat set to repeat-x. Then all you need to do is increase the background position x and then there's no need to reset the loop. [url]http://jsfiddle.net/5VC5w/[/url]
  • That'd work too. You could also use CSS Transforms to do it, that gives the benefit of being hardware accelerated in Firefox and Safari. And CSS Animation would give you the same result, without ever having to write any JS. Edit: [CODE]@-moz-keyframes clouds { from { background-position: 300px 0px; } to { background-position: 0px 0px; } } body { background: url('http://www.webweaver.nu/clipart/img/web/backgrounds/space-sky/cartoon-clouds.jpg') repeat-x; -moz-animation-duration: 3s; -moz-animation-name: clouds; -moz-animation-iteration-count: infinite; -moz-animation-timing-function: linear; }[/CODE] Obviously also use the -webkit- and unprefixed variants too, etc.
  • Nice! I just noticed backgroundPositionX isn't available in Firefox so I've updated my method to work with backgroundPosition. Simple fix. [url]http://jsfiddle.net/5VC5w/2/[/url]
  • How do I make sure a domain I purchased points to the website on my host. I always purchased domains at the same time as hosts and both at the same host and it all went pretty much automatically. Client wanted to have a .nl domain and lithium hosting doesn't offer that so I got it at domein-registreren.nl. Then I purchased shared hosting at lithium with the option "I will use my existing domain and update my nameservers". I then went to the controlpanel at domein-registreren.nl and changed the nameservers to the ones I got from the host. I know it takes some time before it works but I'm not sure I did everything I need to do. So did I miss something?
  • That sounds about right. Make sure you add the domain name to your hosting CP so it sets up a folder for it and everything.
  • [QUOTE=jaybuz;35820692]That sounds about right. Make sure you add the domain name to your hosting CP so it sets up a folder for it and everything.[/QUOTE] Isn't that automatically? I mean I access cpanel at mydomain.nl/cpanel it would only be logical if it did that.
  • What kind of a workflow would you suggest for large projects with a few developers? A local test environment for everyone, from which changes are committed to a repository, from which they are uploaded to the production environment?
  • Get a github organization set up, have everyone work locally on their own forks and merge code to your main repo, have a staging server set up that pulls code from one branch on your main repo that everyone integrates their changes in to and have your production server pull code from a different branch. Set up the production server and staging server so that they are as identical as possible and test the fuck out of everything (preferably automatically) before you merge any changes in the staging branch in to the production branch. Bonus points if you completely automate your deployment process and your server setup/configuration.
  • [QUOTE=KmartSqrl;35823919]Get a github organization set up, have everyone work locally on their own forks and merge code to your main repo, have a staging server set up that pulls code from one branch on your main repo that everyone integrates their changes in to and have your production server pull code from a different branch. Set up the production server and staging server so that they are as identical as possible and test the fuck out of everything (preferably automatically) before you merge any changes in the staging branch in to the production branch. Bonus points if you completely automate your deployment process and your server setup/configuration.[/QUOTE] I'm tempted to do that just because a automated setup would be awesome, probablly useful for a couple of my projects too.
  • [QUOTE=jaybuz;35820291]Nice! I just noticed backgroundPositionX isn't available in Firefox so I've updated my method to work with backgroundPosition. Simple fix. [url]http://jsfiddle.net/5VC5w/2/[/url][/QUOTE] Thanks man, appreciated!
  • I used to try to make websites but that phase died a long time ago. Anyway, I was wondering if any of you know a template I could buy for a website which revolves around voting (Vote up entries, vote down, top 10...) and so on? Any ideas?
  • I did, I searched vote and rate and I didn't get any things with a vote up/thumbs up system
  • I've been working on a project which is basically a submission form, you fill it out with stuff you want for example in a game and then it converts that to code. Now here's where I'm stuck, the code is rather finicky so for example to add ammo it's something like forEach [1,2]; and you would get two magazines and this can go all the way up to twelve. Would there be a better method to doing this than what's below? I've only recently got back into PHP and what I know is gradually coming back to me but anything regarding optimization or saving space I'm absolutely hopeless at. I need to somehow loop a comma and a value incrementing up to the value in the variable if it's over or exactly two but I've not got a clue how I would go about doing that. [code]if($primary_mags == 2) { $primary_mags = "1,2"; }; if($primary_mags == 3) { $primary_mags = "1,2,3"; };[/code]
  • [php]<?php $primary_mags = implode(',', range(1, $primary_mags));[/php] That snippet looks like ArmAs SQF. While slightly more verbose, a for or a for from loop might be better.
  • A loop might be better. [code] $primary_mag_str = '2'; for($i = 2; $i &lt; $primary_mags ; $i++) { $primary_mag_str .= ', '.. $i; } [/code]
  • [QUOTE=jaybuz;35861676]A loop might be better. [code] $primary_mag_str = '2'; for($i = 2; $i < $primary_mags ; $i++) { $primary_mag_str .= ', '.. $i; } [/code][/QUOTE] "might be"? It appears to be faster for large values, but ever so slightly slower for low values. Not that it really matters.
  • [QUOTE=swift and shift;35862355]implode(range(1, $whatever), ",");[/QUOTE] [quote]implode() can, for historical reasons, accept its parameters in either order. For consistency with explode(), however, it may be less confusing to use the documented order of arguments.[/quote] That is implode($glue, $pieces)
  • Say I have a form which is Edit Address Details and I want it to have two buttons, Submit and Delete. Submit will submit the changes made to the form to a database. Delete will delete the address from the database. I am wondering how you can have two seperate action="" for the form. I've tried using javascript like below but it doesn't work. [CODE]<script language="javascript"> function deladdress(){ document.form1.action="deleteDelivery.php"; } </script>[/CODE] [CODE] <input type="submit" value="Submit Changes" name="submit" /> <input type="submit" value="Delete" name="delete" onclick="deladdress()"/> [/CODE] Essentially I want the Submit button to act as normal and go through the action= in the form but I want the Delete button to go to a different page (deleteAddress.php) whilst also POSTing what was in the form. EDIT: Nevermind figured it out!
  • [QUOTE=itsbth;35862487]That is implode($glue, $pieces)[/QUOTE] i didn't bother looking up the order because PHP will take either. <3 PHP
  • computers are fast now, but why is tables bad then? sorry, I really need to know (if this was said already then again) why tables are so bad. I was reading [url]http://www.flownet.com/ron/css-rant.html[/url]
  • [QUOTE=jung3o;35868131]computers are fast now, but why is tables bad then? sorry, I really need to know (if this was said already then again) why tables are so bad. I was reading [url]http://www.flownet.com/ron/css-rant.html[/url][/QUOTE] Because of the whole idea of separating presentation and content. The CSS file(s) should have full control of the page's design, but with tables (which are not, by the way, even meant for layouts, but data tables instead) you lose that, unless you override the table's and its elements' "display" property, but let's not do that.