Web Dev Questions That Don't Need Their Own Thread v4
5,001 replies, posted
[QUOTE=P1raten;43358749]
Also, just a general tip since I can see that you are making a lot of functions; if you're not planning on re-using them then there's not really any point in having them. I can't say that I know if it affects the load time at all by using functions but personally I never use functions, not named one at least in javascript.
.[/QUOTE]
The functions he's creating will not noticeably affect load times; also they are being used in multiple places to prevent code duplication. Additionally they are better organised this way and much easier to test individual components.
@saming I'm not able to reproduce your crash in Chrome (31) or Firefox (26).
I don't know where else to post this... its just a thought.
I want a website where I enter my location, tell it how much money I have. Then searches taxi's airplane's boat's train's etc and sees how far I can get from my location for that amount of money
[QUOTE=lkymky;43360717]I don't know where else to post this... its just a thought.
I want a website where I enter my location, tell it how much money I have. Then searches taxi's airplane's boat's train's etc and sees how far I can get from my location for that amount of money[/QUOTE]
The location is easy and you can do it almost automatically, you could do it with html5 geolocation but I recommend user interaction with the help of Google Maps API.
The "search" part would be easy if could just find the closest airport/train station but for for that you will have to collect as many information as possible (and probably put it in a database) and work with API's. Even then you will miss something so I recommend starting with something you can get a lot of information like airplanes or even trains. (I don't know on the other countries but in mine collecting this info is fairly easy because it doesn't change much)
Via jQuery, I'm trying to make it so when I press the left or right button it would slide to the respective side, switch out the main image and the thumbnails to another item entry (the image collection) in my database, and then slide in from the other side. What is the best way to go ahead and code this?
Here's what I got so far:
[IMG]https://dl.dropboxusercontent.com/u/7856270/website.jpg[/IMG]
Hello again !
I found the solution to my problem so I'll post here so that people with the same problem can be helped in the future.
[QUOTE=saming;43358613]I'm aware that loading all the images at once is a big part of the problem, and I'm trying to move away from that, but I think that my coding style is deeply flawed; I'm just too unexperienced at the moment to see where I went wrong.[/QUOTE]
I [B]really[/B] didn't think that loading [B]full[/B] images for thumbnails could be that problematic. The thing is that by creating a small server-side script to generate and write the thumbnails once, there was no more memory explosion. Here's the [URL="http://pastebin.com/hGb3HZk6"]PHP script[/URL] for anyone interested !
[QUOTE=P1raten;43358749]Your modest library can be replaced with jQuery entirely.[/QUOTE]
Well that I'm sure of, but I'd much prefer to make my own Javascript code to learn on my own.
I'll use jQuery when I'll be tired of writing the same function over and over again.
What is a good library for user session management, preferably one that includes 'remember me' settings and something that denies user log in attempts for x amount of time.
I am reviewing over this [url=http://stackoverflow.com/questions/549/the-definitive-guide-to-form-based-website-authentication#477579]Stack Overflow[/url] page without finding any useable libraries. A few other sources as well, but none that use MySQLi.
So right now I'm left towards the end of my project without a solid authentication process and no SSL certificate.
Happy new years, ya'll!
[QUOTE=Epiclulz762;43375363]What is a good library for user session management, preferably one that includes 'remember me' settings and something that denies user log in attempts for x amount of time.
I am reviewing over this [url=http://stackoverflow.com/questions/549/the-definitive-guide-to-form-based-website-authentication#477579]Stack Overflow[/url] page without finding any useable libraries. A few other sources as well, but none that use MySQLi.
So right now I'm left towards the end of my project without a solid authentication process and no SSL certificate.
Happy new years, ya'll![/QUOTE]
Is it really necessary to use a libary to do those things?
Well I'm hoping for a modular solution that I can confidently use in future projects, I've already written code for this process but if there is a library out there that anyone knows of or uses then I'd prefer their solution.
The problem is that admin_content doesn't change height based on the content.
HTML Code
[code]
<div id="admin_content">
<div id="main_left">
</div><!-- End Main Left -->
<div id="main_right">
</div><!-- End Main Right -->
</div><!-- End Admin Content -->
[/code]
CSS Code
[code]
#admin_content {
width: 960px;
height: auto;
margin-left: auto;
margin-right: auto;
background-color: #DCDCDC;
border: 1px solid #afafaf;
}
#main_left {
height: auto;
width: 200px;
margin-top: 20px;
margin-left: 20px;
margin-right: 20px;
position: absolute;
float: left;
}
#main_right {
width: 600px;
height: 600px;
margin-left: 240px;
margin-top: 20px;
position: absolute;
float: left;
}
[/code]
Your positions are absolute
[editline]2nd January 2014[/editline]
And youre using float
Didn't realized that affects it. I removed position and it still doesn't work.
[code]
#admin_content {
background-color: #DCDCDC;
width: 960px;
height: auto;
margin-left: auto;
margin-right: auto;
border: 1px solid #afafaf;
}
#main_left {
height: auto;
width: 200px;
margin-top: 20px;
margin-left: 20px;
float: left;
margin-right: 20px;
background-color: #C4C4C4;
}
#main_right {
width: 700px;
height: 600px;
float: left;
margin-top: 20px;
background-color: #C4C4C4;
margin-right: 10px;
}
[/code]
Float is also affecting it. use
display: inline-block
instead.
I replaced float with display but now I can't change position.
[url=http://i.imgur.com/uCpoNzq.png][img]http://i.imgur.com/uCpoNzql.png[/img][/url]
[QUOTE=jung3o;43391153]Your positions are absolute
[editline]2nd January 2014[/editline]
And youre using float[/QUOTE]
Sorry, what's wrong with float if he is using a two-column layout?
[editline]2nd January 2014[/editline]
Also AFAIK you dont need [B]height: auto;[/B] - it makes it auto if you don't define it. But maybe it's good to have it there. ¯\_(ツ)_/¯
Sounds like it just needs clearfixing.
[QUOTE=BoowmanTech;43391451]I replaced float with display but now I can't change position.
[url=http://i.imgur.com/uCpoNzq.png][img]http://i.imgur.com/uCpoNzql.png[/img][/url][/QUOTE]
now just do
vertical-align:top
[editline]2nd January 2014[/editline]
[QUOTE=Moofy;43391524]Sorry, what's wrong with float if he is using a two-column layout?[/QUOTE]
it's a huge pain to design with.
Thanks vertical-align: top; fixed it.
Why's jQuery so popular? Sometimes I see someone asking a small interactivity question and people just throw jQuery snippets left and right. Isn't it better to use real JavaScript instead?
[editline]e[/editline]
I guess it being as large as a of a moderately-sized image is a plus. 32KB, it says.
Basically when I go on the website it looks like this.
If I change the page or reload it's fixed, but if I close it and open it again it's fucked up again.
[b]Wrong[/b]
[url=http://i.imgur.com/0dVYie2.png][img]http://i.imgur.com/0dVYie2l.png[/img][/url]
[b]Fixed[/b]
[url=http://i.imgur.com/nYKRTjL.png][img]http://i.imgur.com/nYKRTjLl.png[/img][/url]
[QUOTE=BoowmanTech;43395559]Basically when I go on the website it looks like this.
If I change the page or reload it's fixed, but if I close it and open it again it's fucked up again.[/QUOTE]
Clear your browser cache.
[QUOTE=Stonecycle;43394838]Why's jQuery so popular? Sometimes I see someone asking a small interactivity question and people just throw jQuery snippets left and right. Isn't it better to use real JavaScript instead?
[editline]e[/editline]
I guess it being as large as a of a moderately-sized image is a plus. 32KB, it says.[/QUOTE]
Because it means less code. jQuery simplifies animation, AJAX, selecting elements from the DOM etc.
One benefit in the past was not having to worry about browser compatibility but modern browsers are much more consistent now.
If you include jQuery from a popular CDN, chances are that the user's browser has already downloaded and cached it.
[QUOTE=TrinityX;43395613]Clear your browser cache.[/QUOTE]
That didn't fixed it
[QUOTE=CBastard;43396106]Because it means less code. jQuery simplifies animation, AJAX, selecting elements from the DOM etc.
One benefit in the past was not having to worry about browser compatibility but modern browsers are much more consistent now.[/QUOTE]
I can understand the "Yay! Less code!" argument, but in cases of a field where mobile users are said to be growing with little to no battery improvements, does using such a library use noticeably more processor power or is the lightweightedness part of that solution too?
[QUOTE=Stonecycle;43396264]I can understand the "Yay! Less code!" argument, but in cases of a field where mobile users are said to be growing with little to no battery improvements, does using such a library use noticeably more processor power or is the lightweightedness part of that solution too?[/QUOTE]
While battery life isn't improving, mobile devices are getting faster. Yes jQuery uses more processing power than optimised native javascript but the difference is not that significant and will continue to become less so in future.
It's the same trade off you get with any programming language, there is always a performance hit when you abstract upwards into higher level languages but in return you get portability and easier and quicker development. An extreme example of this is the difference between writing code in assembly language to run directly on the hardware and writing code in a compiled language like C above it.
Is it possible to get from the date column only Jan 02 2014?
I want to output on the screen the date from mysql but I only need Jan 02 2014.
[url=http://i.imgur.com/5naAvZW.png][img]http://i.imgur.com/5naAvZWl.png[/img][/url]
[QUOTE=BoowmanTech;43397575]Is it possible to get from the date column only Jan 02 2014?
I want to output on the screen the date from mysql but I only need Jan 02 2014.
[url=http://i.imgur.com/5naAvZW.png][img]http://i.imgur.com/5naAvZWl.png[/img][/url][/QUOTE]
SELECT [url=http://www.w3schools.com/sql/func_date_format.asp]DATE_FORMAT[/url](date, "%Y-%m-%d"); ?
[QUOTE=Stonecycle;43396264]I can understand the "Yay! Less code!" argument, but in cases of a field where mobile users are said to be growing with little to no battery improvements, does using such a library use noticeably more processor power or is the lightweightedness part of that solution too?[/QUOTE]
Either way you'll have to write or use a library for your DOM manipulation and AJAX, because unless it's like a one page site or something along those lines, you'll end up investing far too much time getting these things done.
You could strip it down and extend upon something like Sizzle (jQuery's DOM selection library) to do this, but it's up to you really.
I'm actually learning to write pure JavaScript at the moment, purely because the thing about jQuery is it's very easy to forget that you're actually using JavaScript. Writing JavaScript and building these things yourself is a real beast compared to just using a library like jQuery. It's very fun however, I would reccomend it.
[url]http://www.almost-there.org/new/squares.php[/url]
How do I make these things flexbox wrap to the next line, and have them wrap up or down according to browser width respectively?
[QUOTE=jung3o;43391831]it's a huge pain to design with.[/QUOTE]
Are you serious? That's what we learn to do in school. :suicide:
[QUOTE=Moofy;43402839]Are you serious? That's what we learn to do in school. :suicide:[/QUOTE]
Yeah, but be skeptical about some of the stuff you learn at the basic course.
We had to learn stuff like mysql_* and actionscript.
Sorry, you need to Log In to post a reply to this thread.