Web Dev Questions That Don't Need Their Own Thread v4
5,001 replies, posted
[QUOTE=ENG.jonny;43748443]My CSS now looks like:
[code]
#Content {
width: 900px;
margin-right: auto;
margin-left: auto;
background:url(content/images/content.jpg);
padding-left:25px;
padding-right:25px;
padding-bottom:25px;
}
[/code]
and nothing different has happened..[/QUOTE]
Just letting you know but you can group your margin and padding properties into a single property with:
[code]
margin: top right bottom left;
padding: top right bottom left;
[/code]
or:
[code]
margin: top&bottom right&left;
padding: top&bottom right&left;
[/code]
or:
[code]
margin: top right&left bottom;
padding: top right&left bottom;
[/code]
or:
[code]
margin: top&right&left⊥
padding: top&right&left⊥
[/code]
Obviously just replace the text with the pixel amount e.g:
[code]
margin: 10px auto 5px;
padding: 0 100px 20px 50px;
[/code]
[QUOTE=supersnail11;43739449]I love CentOS. I tried using Debian on my VPS a while ago and it was impossible for me to use. That's just personal preference though.[/QUOTE]
And is now Red Hat Community Edition which is awesome.
[QUOTE=Lizart;43721961][code]
$i=0;
foreach($_POST as $value){
if(!empty($value)){
$i++;
}
}
if($i===25){
echo "all forms are valid";
}
[/code]
this should work but i havent tested it.[/QUOTE]
It works for the most part but it's including the submit button.
[QUOTE=SammySung;43758099]It works for the most part but it's including the submit button.[/QUOTE]
[code]
foreach($_POST as $key => $value){
if($key == 'submit'):
continue;
endif;
[/code]
You can check weather or not it is the submit button
-snip - bad reading
[QUOTE=gokiyono;43758441][code]
foreach($_POST as $key => $value){
if($key == 'submit'):
continue;
endif;
[/code]
You can check weather or not it is the submit button[/QUOTE]
I ended up just minusing one from the end value of i.
Further question though, this time about MySQL.
I need some help using count but with multiple conditions. For example, a table of mine has participantid, questionid, correct fields. If the answer they give is right, then the "correct" field is set to 2. How can I count how many times each participant ID got a correct answer?
how is it set? You make a new row each time they answer, you sum all the 2 on the correct field, you only store it once, you store all the times on another column...?
[QUOTE=Coment;43758878]how is it set? You make a new row each time they answer, you sum all the 2 on the correct field, you only store it once, you store all the times on another column...?[/QUOTE]
If incorrect, it get set to 1.
[QUOTE=SammySung;43758888]If incorrect, it get set to 1.[/QUOTE]
[code]
SELECT COUNT(*) as correct FROM table WHERE participantid='$userid' AND correctfield='2'
[/code]
if i understand you correctly something like the above should do the trick
[QUOTE=SammySung;43758851]I ended up just minusing one from the end value of i.
Further question though, this time about MySQL.
I need some help using count but with multiple conditions. For example, a table of mine has participantid, questionid, correct fields. If the answer they give is right, then the "correct" field is set to 2. How can I count how many times each participant ID got a correct answer?[/QUOTE]
This is actually a really bad way to make sure that all required fields are present, you should do something like this instead, it's a lot more flexible down the road, easier to update and easier to see what's happening at a glance.
[code]
<?php
function are_post_params_present($fields)
{
foreach ($fields as $field_name) {
if (empty($_POST[$field_name])) {
return false;
}
}
return true;
}
$required_fields = ['name', 'email'];
$is_valid = are_post_params_present($required_fields);
?>
[/code]
This is a sketch how I would want my portfolio to look.
I know it's bad but I just want to know what people think because maybe it doesn't look that bad.
[URL=http://i.imgur.com/swo1aD4.png][IMG]http://i.imgur.com/swo1aD4.png[/IMG][/URL]
[QUOTE=BoowmanTech;43762526]This is a sketch how I would want my portfolio to look.
I know it's bad but I just want to know what people think because maybe it doesn't look that bad.
[URL=http://i.imgur.com/swo1aD4.png][IMG]http://i.imgur.com/swo1aD4.png[/IMG][/URL][/QUOTE]
In my opinion it looks really weird, would reconsider the design. Sorry.
[QUOTE=BoowmanTech;43762526]I know it's bad but I just want to know what people think because maybe it doesn't look that bad.[/QUOTE]
Silly way to look at it. If you don't like [B][I]your own portfolio[/I][/B], there's no point in keeping it.
Also, I'd align all the letters to the middle, like the P R F L O ones.
[QUOTE=Moofy;43762884]In my opinion it looks really weird, would reconsider the design. Sorry.[/QUOTE]
I agree with you but it's so hard to come up with an idea. I already finished 2 design and I didn't like neither one of them.
[editline]2nd February 2014[/editline]
[QUOTE=Coment;43763054]Silly way to look at it. If you don't like [B][I]your own portfolio[/I][/B], there's no point in keeping it.
Also, I'd align all the letters to the middle, like the P R F L O ones.[/QUOTE]
So you are saying something like this ?
I know it's not aligned perfectly, that's because I made it in paint.
[URL=http://i.imgur.com/OSCjRwe.png][IMG]http://i.imgur.com/OSCjRwe.png[/IMG][/URL]
It looks very childish and amateur.
[QUOTE=BoowmanTech;43763182]I agree with you but it's so hard to come up with an idea. I already finished 2 design and I didn't like neither one of them.
[editline]2nd February 2014[/editline]
So you are saying something like this ?
I know it's not aligned perfectly, that's because I made it in paint.
[URL=http://i.imgur.com/OSCjRwe.png][IMG]http://i.imgur.com/OSCjRwe.png[/IMG][/URL][/QUOTE]
This is really weird to look at. Especially the diagonal line (where colors change).
This looks artsy, but not like something someone I would hire create.
[QUOTE=MuffinZerg;43763322]This is really weird to look at. Especially the diagonal line (where colors change).
This looks artsy, but not like something someone I would hire create.[/QUOTE]
Basically the letters with top red should be behind but "Moofy" said it look wired, what if it would have the same color ?
Have you actually done any websites to warrant your own portfolio? If so I would love to see their design.
[QUOTE=Two-Bit;43768403]Have you actually done any websites to warrant your own portfolio? If so I would love to see their design.[/QUOTE]
In case you were talking to me.
For my actual portfolio there is only one.
I don't really like the design so I gave up.
[URL=http://imgur.com/dOVlREb][IMG]http://i.imgur.com/dOVlREbs.png[/IMG][/URL]
I've got this one which started as my portfolio but in the end I realized that I was just teaching myself different things(like how to make a login system)
[URL=http://imgur.com/X0KraZi][IMG]http://i.imgur.com/X0KraZis.png[/IMG][/URL]
This one is not my portfolio, it's a website we had to do for college.
[URL=http://imgur.com/eSoc2i4][IMG]http://i.imgur.com/eSoc2i4s.png[/IMG][/URL]
[QUOTE=BoowmanTech;43763624]Basically the letters with top red should be behind but "Moofy" said it look wired, what if it would have the same color ?[/QUOTE]
I said it looked weird "BoowmanTech" :v:
but maybe one colour, and don't collide it with the content, it looks simpler and greater that way.
[editline]3rd February 2014[/editline]
Also leads me to a question {less} or Sass?
[QUOTE=Moofy;43769422]Also leads me to a question {less} or Sass?[/QUOTE]
Stylus
I think what I hate most about these compilers is that my syntax highlighting is gone :suicide:
[IMG]http://i59.tinypic.com/wqoarc.png[/IMG]
[URL="https://github.com/danro/LESS-sublime"]Fixed[/URL]
[IMG]http://i58.tinypic.com/21d0w1g.png[/IMG]
[QUOTE=KmartSqrl;43761816]This is actually a really bad way to make sure that all required fields are present, you should do something like this instead, it's a lot more flexible down the road, easier to update and easier to see what's happening at a glance.
[code]
<?php
function are_post_params_present($fields)
{
foreach ($fields as $field_name) {
if (empty($_POST[$field_name])) {
return false;
}
}
return true;
}
$required_fields = ['name', 'email'];
$is_valid = are_post_params_present($required_fields);
?>
[/code][/QUOTE]
Cheers. Last question if anyone could help me out. I'm printing a mysql table, then I would like to have a checkbox field on every row that you'd tick to delete that entry from the database. I took a stab at it trying this:
$number is the amount of questions generated on the page
[code]
$i = 1;
while($i <= $number) {
if(isset($_POST[$i])) {
echo $_POST[$i];
$DeleteThisQuestion = "DELETE from questions where questionid = $_POST[$i]";
$Delete = mysqli_query($DBConnect, $DeleteThisQuestion)
Or die("Failed to delete question");
}
}[/code]
Anyone know a website where you can send free txt in the UK as part of a business? Like a service that doesn't have 'this sms was sent from *website*.com' at the end?
I don't know about other countries but basically every carrier in the US has an e-mail address you can use to send texts to people, but obviously you have to know their carrier. No cost to you, only to them to receive the text (assuming they don't have texting.)
[QUOTE=Moofy;43769422]Also leads me to a question {less} or Sass?[/QUOTE]
I prefer Sass, it has some more features. I recommend using Sass with the Compass framework integration, it makes busting out common attributes really simple and quick.
Hosting my own webserver. What server software should I use? Its OS is Windows Server 2012. Apache is basically the only name that rings bells in my head relating to webservers, but I've heard bad stuff about Apache too. Should I grab something like IIS instead?
What's a good portable http web server thing to use at college to get around the thing in chrome where assets cannot be loaded locally? It needs to run without admin privileges and I don't need MySQL or PHP, although it doesn't matter if those come with it!
EasyPHP crashed when I tried it and ZWAMP required admin perms so I'm a little stuck!
[code]
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=
HOME=/
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,$
# | | | | |
# * * * * * user-name command to be executed
*/10 * * * * /usr/bin/php /cron/mongoUpdate.php
[/code]
what am I doing wrong? The file and folder are both 777 permissions but it doesn't run at all.
I've got engineX, php-fpm and this is a file that I can run via "php /cron mongoUpdate.php" command in my terminal.
[QUOTE=Moofy;43769422]Also leads me to a question {less} or Sass?[/QUOTE]
SCSS (sass)
Sorry, you need to Log In to post a reply to this thread.