• Web Dev Questions That Don't Need Their Own Thread v4
    5,001 replies, posted
[QUOTE=Matoking;42044120]I installed Xcache (currently it's getting 142 hits per second), optimized queries and database tables and it seems to have become considerably faster, so the issue might have not been completely related to MySQL. I'm still kind of new to this, so any tips on improving web server performance would be appreciated. I'm currently using Apache HTTP Server but I've also heard lighttpd mentioned a few times; is it any faster?[/QUOTE] Use Nginx, it's probably the best web server in terms of performance.
Can I take my normal php scripts and drop them from apache into nginx without problems?
[QUOTE=KmartSqrl;42034686]Out of curiosity, why not? Have you spent a significant amount of time using it?[/QUOTE] I intended to write a sentence or two but now realise that I've written a bit more than that, hopefully someone will find this interesting/useful. [B]I'm in two minds over it.[/B] It certainly makes you a better coder if you come from something like PHP which will let you write absolute drivel and it will work, but that in itself doesn't mean much - having become a better coder you can then write a well structured PHP, python etc. app using the rails conventions. Part of me loves the "magic" that it provides in the way it abstracts databases, models etc. but then part of me has grown to not trust the "magic" (It's fine when it works - which it almost always does - but when it doesn't it can be a bloody pain). [B]It could scale better IMO.[/B] RoR doesn't support concurrent connections properly (Rails 4 is threadsafe by default so hopefully this will change in the future) which means to scale you have to chuck processes at it - consider the following stack: A single instance with one ruby process running. Each request consumes a few database calls, and a few requests do something even more blocking like fetching an external webpage (this should really be done in a worker). As requests come in they are handled serially, until the previous one is complete the next one is queued. When you need to scale a naive person might upgrade the instance (faster CPU), upgrading the instance will not actually give much more capacity as the CPU isn't being fully utilized as it is (majority of the response time will be the other blocking things - database calls etc.), they then might start new instances (and configure a load balancer) but this, whilst successfully solving the problem, is not the best way to do it as you now just have more instances that aren't fully utilizing the available CPU. The way you *should* do it is to use Nginx (or equivalent) to spawn multiple RoR processes and share requests between them (each process can only handle requests serially but collectively they can now handle in parallel). Don't get me wrong - ruby's performance is good so it's not a big issue, but it means you have a large memory overhead (when compared to a truly threaded solution) as each process has it's own imports and ruby loaded into it. In python you *can* (I don't want to give python too much credit here - it isn't as easy as it should be), set up a single instance that processes requests concurrently by spawning threads that share the same import memory. Hopefully, with the release of Rails 4, developers will start writing threadsafe code so this will go away but currently writing threadsafe Ruby code is more of a burden than writing threadsafe python code (you have to be doing some pretty wacky things in python before your code isn't threadsafe). This is one thing that appengine does semi-well (it does it very well, but has an extremely stupid limit) - it handles the concurrent requests for you (you declare the WSGI compatible module for handling requests and it will spawn a new thread for each request). Unfortunately App Engine limits you to 8 concurrent requests per instance (this was deemed a "safe" number so if you have a well written app then you can actually handle much much more than that before hitting memory or CPU limits even on the smallest instance size), I am told by a Google Engineer that they are currently working on changing it to a more intelligent system based on memory and CPU usage (with optional manual configuration) but IMO this should have been implemented originally. [editline]1st September 2013[/editline] [QUOTE=Stonecycle;42035075]I'm completely clueless on source control. Zero experience besides knowing there's Git and Mercurial. This might be a subjective question, but which would generally be better? Can't get a straight answer from searching. What exactly is source control used for?[/QUOTE] Most people prefer git (disclaimer: I'm pretty sure this is an accurate statement but it is based upon no actual information). ## Some basics Github is not git, github is a service that uses git (there are others) and provides additional features to make it easier to work with open source projects. ## Source control is used for (not an exhaustive list): ### Collaboration Without some system then it would be very very hard for different people to work on the same project. Shared folder? But then what if you want to work at home for a bit and then when you come back someone has changed it - you would accidentally overwrite their changes. Also very useful for open source (where people without write access can contribute) - github takes this even further by optimising workflows (pull requests etc.). ### Backup What happens if you break the code? Without source control then you would have to keep making backups. This means that if you break the code (and can't quickly fix it) you will have to revert back to a backup which means all the good changes since the backup will be lost. With source control, every change that you "commit" is stored so you can return to any previous point in the project's history. ### Branching What if you are working towards a new feature and then you get a bug report for a small bug. You can't just fix it and push out the new code because it would include the half-finished new feature. Source control let's you create a "branch" to work on the new feature whilst still letting you make patches to the "master" branch, then when the feature is finished you can merge it back into "master". ## Some source control related nice stuff ### Testing It is easy to setup something like Travis to run your tests every time you commit so you can see if you have broken the build without running the tests manually. This is very powerful for pull requests - when someone submits a pull request then Travis will automatically test the merged code against your tests. [editline]1st September 2013[/editline] Forgot this isn't markdown - oh well, CBA to change it now;
[QUOTE=01271;42045071]Can I take my normal php scripts and drop them from apache into nginx without problems?[/QUOTE] Yeah, they'll work exactly the same as on Apache. What you might need to do is make a few changes in the Nginx configuration, but that shouldn't be too difficult.
[QUOTE=01271;42045071]Can I take my normal php scripts and drop them from apache into nginx without problems?[/QUOTE] Absolutely, the issue is with .htaccess files. You have to convert the rules in there into NGINX rules.
[del] Does anyone know a music player with library? For example you put all the songs in the folder, the player reads the songs filename and you search from that. Something in the design of Spotify etc. [/del]
[QUOTE=SweFox*;42050480]Does anyone know a music player with library? For example you put all the songs in the folder, the player reads the songs filename and you search from that. Something in the design of Spotify etc.[/QUOTE] wouldn't be too hard to make one im a little tired right now but tomorrow morning I can work on it?
[QUOTE=RidingKeys;42050531]wouldn't be too hard to make one im a little tired right now but tomorrow morning I can work on it?[/QUOTE] Hey that would be absolutely awesome.
Yo dudes, I'm stepping up my game from web design and I'm planning on learning a back-end game. I know PHP is terrible, so what should I start with? Ruby or Python? I know both are nice languages and I wouldn't mind one being a little easier than the other, but I want to learn something that will serve me good.
[QUOTE=Cowabanga;42051896]Yo dudes, I'm stepping up my game from web design and I'm planning on learning a back-end game. I know PHP is terrible, so what should I start with? Ruby or Python? I know both are nice languages and I wouldn't mind one being a little easier than the other, but I want to learn something that will serve me good.[/QUOTE] Python might be too much effort for web. Where in Ruby has RoR
[QUOTE=Killervalon;42051940]Python might be too much effort for web. Where in Ruby has RoR[/QUOTE] So Ruby is the way to go, yeah?
[t]http://i.imgur.com/C7G3aHQ.png[/t] So I have these boxes, and when you click one of them a box is supposed to slide down from below one of them with some data from a database. I just have no idea how I am supposed to do that, and it kinda bothers me The ID of each box is an ID each car has. (It looks a bit odd, but that isn't something to worry about for now.)
Hey, visiting from the programming subforum. I'm looking to make a website to showcase some of the programs I've made for my resume. I made a draft of what I want the site to look like in photoshop, but I've never created a site before and was looking for somewhere to start. My draft looks like this: [thumb]https://dl.dropboxusercontent.com/u/7958512/draft1.png[/thumb] So I was wondering can I do this with just html/css? How difficult does it look to make? Do you have a series of tutorials that I could watch that include topics like shapes, how to layout sections of the site like how the main area takes up 90% and the sidebar takes up 10%, and how to embed youtube videos and such into the site? Thanks for any help.
[QUOTE=Killervalon;42051940]Python might be too much effort for web. Where in Ruby has RoR[/QUOTE] This is simply untrue. Ruby has Rails and Sinatra where as Python has Django and Flask. [editline]2nd September 2013[/editline] Both languages are perfectly web suitable. I would suggest looking through some random repos on Github and seeing which you personally like the best.
[QUOTE=Zwolf11;42053745]Hey, visiting from the programming subforum. I'm looking to make a website to showcase some of the programs I've made for my resume. I made a draft of what I want the site to look like in photoshop, but I've never created a site before and was looking for somewhere to start. My draft looks like this: [thumb]https://dl.dropboxusercontent.com/u/7958512/draft1.png[/thumb] So I was wondering can I do this with just html/css? How difficult does it look to make? Do you have a series of tutorials that I could watch that include topics like shapes, how to layout sections of the site like how the main area takes up 90% and the sidebar takes up 10%, and how to embed youtube videos and such into the site? Thanks for any help.[/QUOTE] You can do that with just HTML and CSS but there are quite a few improvements that could be made before I'd show that to a potential employer. The font isn't the best and rounded corners don't look that professional. You'll probably want something a little more simple.
[QUOTE=jetboy;42053862]This is simply untrue. Ruby has Rails and Sinatra where as Python has Django and Flask. [editline]2nd September 2013[/editline] Both languages are perfectly web suitable. I would suggest looking through some random repos on Github and seeing which you personally like the best.[/QUOTE] Python seems nice but I'm seeing lots of people here recommending Ruby. I'll do what you said and decide.
Are there any alternatives to no-ip that any of you could recommend? I want to have static access to my virtual machine server but I dont really like the limitations no-ip has on free accounts
[QUOTE=SweFox*;42050562]Hey that would be absolutely awesome.[/QUOTE] You could probably actually do it pretty simply yourself if you know a thing or two about jquery [url]http://www.createjs.com/#!/SoundJS[/url] [editline]2nd September 2013[/editline] I'd probably do it entirely for you but i'm playing League of Legends and doing college courses atm :/
Warning: mkdir(): Permission denied in /usr/share/nginx/html/tf2eg_files/update.php on line 14 Changed from apache to nginx but the shitty nginx permissions are preventing anything from working. How do I make nginx able to do what it needs to?
[QUOTE=01271;42059581]Warning: mkdir(): Permission denied in /usr/share/nginx/html/tf2eg_files/update.php on line 14 Changed from apache to nginx but the shitty nginx permissions are preventing anything from working. How do I make nginx able to do what it needs to?[/QUOTE] How had you configured Apache? In my setup it has no raised permissions, so you can sandbox it by only changing permissions in directories where you would expect it to be able to write.
[QUOTE=01271;42059581]Warning: mkdir(): Permission denied in /usr/share/nginx/html/tf2eg_files/update.php on line 14 Changed from apache to nginx but the shitty nginx permissions are preventing anything from working. How do I make nginx able to do what it needs to?[/QUOTE] Make sure that nginx has write permission to "/usr/share/nginx/html/tf2eg_files/", usually you just need to let www-users or www write there.
[QUOTE=gokiyono;42052125][t]http://i.imgur.com/C7G3aHQ.png[/t] So I have these boxes, and when you click one of them a box is supposed to slide down from below one of them with some data from a database. I just have no idea how I am supposed to do that, and it kinda bothers me The ID of each box is an ID each car has. (It looks a bit odd, but that isn't something to worry about for now.)[/QUOTE] [QUOTE=me;42062144][CODE] $("#"+carID).after(carCommentValues); [/CODE] What I am trying to do, is I want the stuff in carCommentValues to fade in after a div named something like FF1C2D. How is that possible?[/QUOTE] Alright, I managed to [URL="http://pastebin.com/z5xnbbFy"]fix[/URL] it... I think I need some sleep
[QUOTE=Killervalon;42051940]Python might be too much effort for web. Where in Ruby has RoR[/QUOTE] Flask for python is very good, it is very different to rails (unopinionated) Edit: Should read other comments before replying in future (this was already said, and in a better way)
I would need a icon font with a [URL="http://chelramsey.com/wp-content/uploads/2013/07/Twitch-tv-logo.png"]Twitch icon[/URL] in it. Every icon font I checked has all the "social media" I need except Twitch. Would anyone know of one ?
[QUOTE=01271;42043778][url]http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=[/url] $APIKey &steamids=76561198013370444,76561198042622888,76561198008891417,&format=json Takes up to 100 profiles as arguments.[/QUOTE] Perfect ;D
Dear everyone: What is your go-to CMS at the moment? Regards, Me
[QUOTE=saming;42065339]I would need a icon font with a [URL="http://chelramsey.com/wp-content/uploads/2013/07/Twitch-tv-logo.png"]Twitch icon[/URL] in it. Every icon font I checked has all the "social media" I need except Twitch. Would anyone know of one ?[/QUOTE] Why not just use the twitch logo as an <img> tag?
[QUOTE=gokiyono;42073123]Why not just use the twitch logo as an <img> tag?[/QUOTE] I am doing color transitions [URL="http://saming.free.fr/"]like here[/URL], which is greatly simplified by the use of icon fonts. Plain pictures have to be played with (opacity, multiple images...).
[QUOTE=saming;42073414]I am doing color transitions [URL="http://saming.free.fr/"]like here[/URL], which is greatly simplified by the use of icon fonts. Plain pictures have to be played with (opacity, multiple images...).[/QUOTE] [IMG]http://saming.free.fr/icons/folder.gif[/IMG][IMG]http://saming.free.fr/icons/image2.gif[/IMG] These are the only icons I see?
[QUOTE=Vietnow;42069353]Dear everyone: What is your go-to CMS at the moment? Regards, Me[/QUOTE] [url=http://anchorcms.com/]Anchor CMS[/url]
Sorry, you need to Log In to post a reply to this thread.