Web Dev Questions That Don't Need Their Own Thread v4
5,001 replies, posted
[QUOTE=KinderBueno;46290500]As I said: I was never really into these long scrolling websites, so I always thought that any website that does animation while scrolling means parallax.
Sorry for misleading :rolleyes:[/QUOTE]
No need for a sorry or a rolleyes. I [I]did[/I] say it was a pedantic thing to point out when I did it.
Asking here too (asked in Programming section too) but I am really stuck and cornered, can't think of any other way to make this work:
I have index.php page, with login/password field. I want user to enter his details then it gets his ID from MySQL database and stores it in SESSION.
Then it redirects to website.com:3000 (node.js server) and then how do I retrieve that session variable?
Today I spent whole day trying things, and made Express to retrieve POST variables but then it fucked up so that was bad solution.
My side idea (last resort) is on PHP login: add user IP to MySQL table, and keep that table as currently online users, that way I will be able to see how many are online, and retrieve required data at any given time but that's also crap solution.
Any help?
Okay so I'm working on that website I mentioned before.
[url]http://people.rit.edu/cxs1466/jqparallax/[/url]
In firefox it runs great. No lag,everything is in the right spot.
In chrome it lags and the video gets plastered all over!
Hm fuck.
[editline]21st October 2014[/editline]
Okay the video seems fine now in chrome but the performance is still abhorrent relative to firefox.
[QUOTE=MadPro119;46299175]Okay so I'm working on that website I mentioned before.
[url]http://people.rit.edu/cxs1466/jqparallax/[/url]
In firefox it runs great. No lag,everything is in the right spot.
In chrome it lags and the video gets plastered all over!
Hm fuck.
[editline]21st October 2014[/editline]
Okay the video seems fine now in chrome but the performance is still abhorrent relative to firefox.[/QUOTE]
Looks good, few design things, the light blue background (with alpha property set) for me is hard to read because you can see background through it and it has white text.
Also, the video starts playing when you first visit the page, so when you eventually get to the bottom of the page, it's half way through.
Other than that, you got the parallax stuff done nicely.
[QUOTE=KinderBueno;46298971]Asking here too (asked in Programming section too) but I am really stuck and cornered, can't think of any other way to make this work:
I have index.php page, with login/password field. I want user to enter his details then it gets his ID from MySQL database and stores it in SESSION.
Then it redirects to website.com:3000 (node.js server) and then how do I retrieve that session variable?
Today I spent whole day trying things, and made Express to retrieve POST variables but then it fucked up so that was bad solution.
My side idea (last resort) is on PHP login: add user IP to MySQL table, and keep that table as currently online users, that way I will be able to see how many are online, and retrieve required data at any given time but that's also crap solution.
Any help?[/QUOTE]
session works like POST to retrieve information you've put in it. (array)
[code]
<php
session_start(); // make sure to have this when using sessions
$id = 1; // just a hardcoded integer
$_SESSION["userid"] = $id; // $id being the id of the user from your database
echo $_SESSION["userid"]; // Would output 1.
[/code]
Add this to see a pretty output of the array:
[code]
echo "<pre>",print_r($_SESSION),"</pre>";
die;
[/code]
This would answer the question, however I would not personally approach it this way. Personal preference.
Ok, I have worked with c# for a while, however when using c# to insert the following into a database I always get this problem and everything I have tried just.. does not fix it.
Does anyone know the proper way (in C#) to insert the properly formatted string into the database so when I pull it out the formatting is still there (of course with escaped characters).
[code]
This is a test string.
This is a new line
[/code]
It removes the \r\n in the line. I have tried escaping it, but nothing seems to fix it.
When I pull it out of the database it returns like such
[code]
This is a test string.This is a new line
[/code]
Have a close look what is stored into the database. It could be a problem with the insert statement (inserting odd data) or with displaying it (if you're outputting it as HTML, use <pre> to retain content text formatting).
[QUOTE=Khub;46301909]Have a close look what is stored into the database. It could be a problem with the insert statement (inserting odd data) or with displaying it (if you're outputting it as HTML, use <pre> to retain content text formatting).[/QUOTE]
Well. well. well.... I didn't think it would be something like that to fix it. That aggravates me.
Oh well.. Thanks for the help!
I feel stupid now....
[QUOTE=Moofy;46284431]Has anyone tried or currently using [URL="https://ghost.org/"]Ghost[/URL]?
I would like if someone could give some good thoughts about it, most of it I read on the interwebs is coming from people who are used to a fully packed CMS. I would prefer something lightweight to throw on my domain, and Ghost kind of seems like it but then again quite not. I am not a huge node.js expert so I am unsure if using Ghost is reliable.
From what I've heard the express dev left and as seeing Ghost uses express I am currently just waiting for it to collapse because the tools it uses does. :v:
Also would only install node.js just for that, so not sure if the lightweight really counts here. I tried looking at PHP solutions since that's standard to have, but really most of those solutions are not very good or bloated.[/QUOTE]
I was actually checking out Octopress before I took a break to catch up on FP shit. Instead of doing it Wordpress style where it loads your stuff dynamically from the database and generates the pages for the clients, Octopress takes your blog posts and your site design and generates static pages that you can then serve instead of dynamically generating all the content. Much faster and more efficient at the cost of dynamic delivery. Pretty easy to use, but you will need to install Ruby. You don't really need to know it though, Octopress just uses Ruby to generate the static HTML/CSS/JS pages which you then copy to the server: this is not a full fledged Rails installation or anything. A handfull of commands is all you need.
I can't really tell you exactly how to use it (I'm still working on it) but it seems easy enough.
- [URL="http://octopress.org/"]Octopress' website[/URL] (has instructions but they're a bit light)
- [URL="http://webdesign.tutsplus.com/tutorials/getting-started-with-octopress--webdesign-11442"]Guide I'm using atm[/URL]
I'm not sure if this is the solution you were looking for but it fit my bill at least.
[QUOTE=FlakAttack;46305576]Octopress stuff[/QUOTE]
So like Jekyll :v:
Still cool though, I'll probably take a look tomorrow once I've been at work.
[QUOTE=FlakAttack;46305576]I was actually checking out Octopress before I took a break to catch up on FP shit. Instead of doing it Wordpress style where it loads your stuff dynamically from the database and generates the pages for the clients, Octopress takes your blog posts and your site design and generates static pages that you can then serve instead of dynamically generating all the content. Much faster and more efficient at the cost of dynamic delivery. Pretty easy to use, but you will need to install Ruby. You don't really need to know it though, Octopress just uses Ruby to generate the static HTML/CSS/JS pages which you then copy to the server: this is not a full fledged Rails installation or anything. A handfull of commands is all you need.
I can't really tell you exactly how to use it (I'm still working on it) but it seems easy enough.
- [URL="http://octopress.org/"]Octopress' website[/URL] (has instructions but they're a bit light)
- [URL="http://webdesign.tutsplus.com/tutorials/getting-started-with-octopress--webdesign-11442"]Guide I'm using atm[/URL]
I'm not sure if this is the solution you were looking for but it fit my bill at least.[/QUOTE]
[url=https://staticsitegenerators.net/]Here's a huge list of everything remotely like that.[/url]
[QUOTE=Moofy;46309017]So like Jekyll :v:
Still cool though, I'll probably take a look tomorrow once I've been at work.[/QUOTE]
Yeah it's based on Jekyll, just built explicitly for developers. I've been finding it easier to set up too but that could just be me.
[QUOTE=AndrewPH;46309022][URL="https://staticsitegenerators.net/"]Here's a huge list of everything remotely like that.[/URL][/QUOTE]
I had actually checked out a few of these before deciding on Octopress. Nice to have the whole list in front of me though, will be useful in the future, thanks.
[QUOTE=FlakAttack;46310803]Yeah it's based on Jekyll, just built explicitly for developers. I've been finding it easier to set up too but that could just be me..[/QUOTE]
Jekyll seems easy too, and they're both Ruby.
I have no idea where to start with Ruby either, from what I've read RVM is probably the best option. Then from there it's just install Ruby Gems and I should be ready to go. :dance:
RVM, rbenv, or chruby are all good although charlie will probably get mad at you if you use anything other than chruby, I think
How do I vertically align some text inside a table cell?
[code]
td.nav {
font-family: "helveticaNeueLT Std", Arial, sans-serif;
font-size: 25px;
color: #FFF;
text-align: center;
vertical-align: middle;
}
td.nav a, td.nav a:visited {
display: inline-block;
height: 92px;;
width: 100%;
color: #FFF;
text-decoration: none;
}
td.nav a:hover, td.nav a:active, td.nav a:focus {
/*text-shadow: 0px 0px 5px #000;*/
color: #FFF;;
background-color: rgba(0,0,0,0.1);
}
[/code]
[code]
<table align="center" width="75%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="25%" height="90" class="nav"><a href="#">Home</a></td>
<td width="25%" class="nav"><a href="#">About</a></td>
<td width="25%" class="nav"><a href="#">Gallery</a></td>
<td width="25%" class="nav"><a href="#">Contact</a></td>
</tr>
</table>
[/code]
Produces:
[t]http://i.imgur.com/rnyN5AV.png[/t]
As you can see, the text is at the top.
[QUOTE=lope;46334404]How do I vertically align some text inside a table cell?
[code]
td.nav {
font-family: "helveticaNeueLT Std", Arial, sans-serif;
font-size: 25px;
color: #FFF;
text-align: center;
vertical-align: middle;
}
td.nav a, td.nav a:visited {
display: inline-block;
height: 92px;;
width: 100%;
color: #FFF;
text-decoration: none;
}
td.nav a:hover, td.nav a:active, td.nav a:focus {
/*text-shadow: 0px 0px 5px #000;*/
color: #FFF;;
background-color: rgba(0,0,0,0.1);
}
[/code]
[code]
<table align="center" width="75%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="25%" height="90" class="nav"><a href="#">Home</a></td>
<td width="25%" class="nav"><a href="#">About</a></td>
<td width="25%" class="nav"><a href="#">Gallery</a></td>
<td width="25%" class="nav"><a href="#">Contact</a></td>
</tr>
</table>
[/code]
Produces:
[t]http://i.imgur.com/rnyN5AV.png[/t]
As you can see, the text is at the top.[/QUOTE]
line-height.
[QUOTE=TrinityX;46334516]line-height.[/QUOTE]
Thank ya
[QUOTE=TrinityX;46334516]line-height.[/QUOTE]
Don't give bad advice like this.
Line height shouldn't be used to properly align stuff, and furthermore you should not use tables for anything other than table data.
For a navigation, look at floating and display along with padding.
Here's a simple navigation done the "proper" way: [URL]http://jsfiddle.net/9zg4soon/[/URL]
I'm not saying my way is the 100% only way to do this, but it's definitely a [B]lot[/B] better than tables, you should use something like this this @lope.
[QUOTE=Moofy;46336514]Don't give bad advice like this.
Line height shouldn't be used to properly align stuff, and furthermore you should not use tables for anything other than table data.
For a navigation, look at floating and display along with padding.
Here's a simple navigation done the "proper" way: [URL]http://jsfiddle.net/9zg4soon/[/URL]
I'm not saying my way is the 100% only way to do this, but it's definitely a [B]lot[/B] better than tables, you should use something like this this @lope.[/QUOTE]
In his case, line-height was the only CSS only way to do it.
[QUOTE=Moofy;46336514]Don't give bad advice like this.
Line height shouldn't be used to properly align stuff, and furthermore you should not use tables for anything other than table data.
For a navigation, look at floating and display along with padding.
Here's a simple navigation done the "proper" way: [URL]http://jsfiddle.net/9zg4soon/[/URL]
I'm not saying my way is the 100% only way to do this, but it's definitely a [B]lot[/B] better than tables, you should use something like this this @lope.[/QUOTE]
Now that I've done that the list is pushed to the left, instead of it stretching to 100% of the space after the logo. I know I could add a left margin to the ul, but I want it to stretch and shrink for smaller screens, like the table did.
[editline]26th October 2014[/editline]
Here's the page: [URL]http://scnggames.com/WebDesign/Preview/[/URL]
[del]Also the text-decoration: none doesn't work in the {nav ul li a} so I had to put it in the master a:link, also links are turning grey when active, and I have no idea why that's happening.[/del]
[QUOTE=lope;46339187]Now that I've done that the list is pushed to the left, instead of it stretching to 100% of the space after the logo. I know I could add a left margin to the ul, but I want it to stretch and shrink for smaller screens, like the table did.
[editline]26th October 2014[/editline]
Here's the page: [URL]http://scnggames.com/WebDesign/Preview/[/URL]
[del]Also the text-decoration: none doesn't work in the {nav ul li a} so I had to put it in the master a:link, also links are turning grey when active, and I have no idea why that's happening.[/del][/QUOTE]
I can't tell you specifically what to do, you can make some pretty cool CSS that calculates stuff for you. Flexbox I think? Don't know how compatible it is, but whatever you do; keep away form tables when designing. Use it to display tabular data only.
Here's an example, this only works with 3 menu items though, otherwise you need to do some math and figure out what percentage you need. [URL]http://jsfiddle.net/9zg4soon/1/[/URL]
EDIT: Noticed I forgot text-align on the menu items themselves, but you get me.
Best method for fuzzy searching Sql results via PDO?
[QUOTE=Neophyte;46343123]Best method for fuzzy searching Sql results via PDO?[/QUOTE]
Depends on what it needs to do, if it needs to be able to search multiple columns and support weighting here's an example. Note that the columns must be FULLTEXT indexed.
[code]
SELECT *,
MATCH(`title`) AGAINST ('twitter' IN BOOLEAN MODE) * 10 AS rel1,
MATCH(`summary`) AGAINST ('twitter' IN BOOLEAN MODE) * 3 AS rel2,
MATCH(`copy`) AGAINST ('twitter' IN BOOLEAN MODE) * 1 AS rel3
FROM news
WHERE MATCH (title, summary, copy) AGAINST ('twitter' IN BOOLEAN MODE)
ORDER BY (rel1)+(rel2)+(rel3) DESC;
[/code]
If by fuzzy you mean it has to search synonyms, common misspellings, different pluralities then things get much more complex and you're best off looking for a 3rd party library.
What are these type of backgrounds called and where can I find more?
[IMG_THUMB]http://i1-news.softpedia-static.com/images/news2/Ubuntu-13-04-Default-Wallpaper-Was-Revealed-Download-It-Now-2.jpg[/IMG_THUMB]
[IMG_THUMB]http://coderhire.com/assets/images/large_bg_bright.jpg[/IMG_THUMB]
[QUOTE=Moofy;46341091]I can't tell you specifically what to do, you can make some pretty cool CSS that calculates stuff for you. Flexbox I think? Don't know how compatible it is, but whatever you do; keep away form tables when designing. Use it to display tabular data only.
Here's an example, this only works with 3 menu items though, otherwise you need to do some math and figure out what percentage you need. [URL]http://jsfiddle.net/9zg4soon/1/[/URL]
EDIT: Noticed I forgot text-align on the menu items themselves, but you get me.[/QUOTE]
The logo is an image, so when it applies the padding to the image it doesn't fit the header at all. I can't overwrite it at all for some reason so I have no idea what to do.
[editline]27th October 2014[/editline]
[t]http://i.imgur.com/DgeT3SS.png[/t]
I want the CSS to resize the image to take up 100% of the <li> in the nav, and have no padding.
[QUOTE=lope;46345234]The logo is an image, so when it applies the padding to the image it doesn't fit the header at all. I can't overwrite it at all for some reason so I have no idea what to do.
[editline]27th October 2014[/editline]
[t]http://i.imgur.com/DgeT3SS.png[/t]
I want the CSS to resize the image to take up 100% of the <li> in the nav, and have no padding.[/QUOTE]
max-width
I got it to work by making the image not be a link and doing this:
[code]nav ul li img {
display: block;
width: 20%; //I have 5 items
height: 90px;
padding: 0px;
float: left;
box-sizing: border-box;
}
[/code]
But I would like to have the image be a link too.
[editline]27th October 2014[/editline]
[QUOTE=Cyberuben;46345296]max-width[/QUOTE]
The width is fine, it's 20% like everything else, and when I set max-height it just cuts off the bottom of the image.
[QUOTE=lope;46345302]I got it to work by making the image not be a link and doing this:
[code]nav ul li img {
display: block;
width: 20%; //I have 5 items
height: 90px;
padding: 0px;
float: left;
box-sizing: border-box;
}
[/code]
But I would like to have the image be a link too.
[editline]27th October 2014[/editline]
The width is fine, it's 20% like everything else, and when I set max-height it just cuts off the bottom of the image.[/QUOTE]
On the image:
max-height: 100%;
max-width: 100%;
[QUOTE=Cyberuben;46345359]On the image:
max-height: 100%;
max-width: 100%;[/QUOTE]
Thanks, I also had to add padding 0px to the <a> because I didn't realize the a tag was being modified by CSS, not the img tag.
[QUOTE=lope;46345426]Thanks, I also had to add padding 0px to the <a> because I didn't realize the a tag was being modified by CSS, not the img tag.[/QUOTE]
All browsers have their default styles. For example, in Chrome, lists have padding and margin.
Sorry, you need to Log In to post a reply to this thread.