Web Dev Questions That Don't Need Their Own Thread v4
5,001 replies, posted
[QUOTE=Svenskunganka;41850883]Why not just do it with PHP with a for or foreach?
[CODE]
foreach ($array as $value) {
echo '<select>' . $value . '</select>';
}
[/CODE]
I don't quite understand how your array looks like but you could probably do it with Javascript aswell.
Here's the equivalent code but in Javascript:
[CODE]
var counter=0;
for (counter=0; counter<array.length; counter++)
document.write("<select>" + array[counter] + "</select>");
[/CODE][/QUOTE]
The idea is that it's cached on a user's computer.
My current php implementation has to send the 1000 select options to the user's browser on load.
[QUOTE=01271;41850986]The idea is that it's cached on a user's computer.
My current php implementation has to send the 1000 select options to the user's browser on load.[/QUOTE]
A 1000 select values isn't as expensive as you think. I'm guessing you extract the array from a database?
Although I don't really understand why you want a [B]thousand[/B] select options...
[QUOTE=Svenskunganka;41851161]A 1000 select values isn't as expensive as you think. I'm guessing you extract the array from a database?
Although I don't really understand why you want a [B]thousand[/B] select options...[/QUOTE]
I agree with this. Maybe it would be better to just have a textbox with autocompletion or something.
[QUOTE=eternalflamez;41851367]I agree with this. Maybe it would be better to just have a textbox with autocompletion or something.[/QUOTE]
That would be alot better, altough I would just go with a search function as I believe this is all about a user selecting another user.
[QUOTE=Cowabanga;41850927]Anyone know of a good cheap VPS provider that has either Xen (preferred) or KVM? Ramnode is way too expensive to me.[/QUOTE]
If you want to pay less you'll have to use an OpenVZ provider. RamNode is pretty much on-par as far as price goes.
[QUOTE=jetboy;41851578]If you want to pay less you'll have to use an OpenVZ provider. RamNode is pretty much on-par as far as price goes.[/QUOTE]
Well shit.
[QUOTE]If you want to pay less you'll have to use an OpenVZ provider. RamNode is pretty much on-par as far as price goes.[/QUOTE]
I agree with this. Use an OpenVZ provider. It's cheap.
[QUOTE=Kimbra;41853863]I agree with this. Use an OpenVZ provider. It's cheap.[/QUOTE]
Hi, welcome to Facepunch. We have ratings for a reason.
Also I said I WANTED a Kvm/Xen provider for a reason. I use Windows.
My friend is rewriting his php Oldschool Runescape tracker in Rails but we're both a bit stuck on the storing of datapoints. A row has to contain a timestamp and 24 pairs of numbers (skill xp and skill rank). Currently in his php site he converts the numbers to 8 hex digits then concats the strings to make 2 cols instead of 48. He also needs to be able to sort by individual numbers from those strings which he can do right now with substrings.
How would you guys suggest he store his data with activerecord? The method he's using for the php site seems kind of hacky but he doesn't want 49 col tables. It's very important that he be able to sort by xp or rank for every skill while keeping them all in one record.
To see how the site works, click here: [url]http://duk.im/tracker/[/url]
Currently I'm using IIS for my webserver and I know how much of a hog it is. I was thinking of switching to something like WAMP. But seeing how intergrated to the OS IIS is, is it a wise move to get rid of IIS in favor of WAMP?
[editline]16th August 2013[/editline]
Also anyone got any experience with ViLayer? Their VPSs seem to be priced reasonably.
I've heard Vilayer has the worlds worst support
[QUOTE=sambooo;41855090]My friend is rewriting his php Oldschool Runescape tracker in Rails but we're both a bit stuck on the storing of datapoints. A row has to contain a timestamp and 24 pairs of numbers (skill xp and skill rank). Currently in his php site he converts the numbers to 8 hex digits then concats the strings to make 2 cols instead of 48. He also needs to be able to sort by individual numbers from those strings which he can do right now with substrings.
How would you guys suggest he store his data with activerecord? The method he's using for the php site seems kind of hacky but he doesn't want 49 col tables. It's very important that he be able to sort by xp or rank for every skill while keeping them all in one record.
To see how the site works, click here: [url]http://duk.im/tracker/[/url][/QUOTE]
If he wants to sort by all of them he should have a column for all of them. If these pairs of numbers are always the same they could be broken out in to their own model and that could hold a reference back to the row that holds the timestamp. So it would look like this: (not real code)
[CODE]
RowWithTimestamp(id, timestamp)
SkillThing(skill_xp, skill_rank, row_with_timestamp_id)
[/CODE]
Then when you want to pull the row data you just grab the row and then grab all the associate SkillThings and sort by whatever you want to sort by.
Generally if you have repeated DB columns like that you are doing something wrong and they should either be a serialized field (if you don't ever need to search/sort on them and you know you won't) or a model of their own.
[editline]16th August 2013[/editline]
[QUOTE=Cowabanga;41861633]Currently I'm using IIS for my webserver and I know how much of a hog it is. I was thinking of switching to something like WAMP. But seeing how intergrated to the OS IIS is, is it a wise move to get rid of IIS in favor of WAMP?
[editline]16th August 2013[/editline]
Also anyone got any experience with ViLayer? Their VPSs seem to be priced reasonably.[/QUOTE]
WAMP is [B]not[/B] suitable to be used for anything other than a local dev server. You shouldn't expose it to the internet because it's not made for that.
Is there any particular reason you're using windows? If you're not using .NET for web stuff you should probably just run your server on Linux of some sort. It'll be cheaper.
If I'm following correctly, you're saying he should have a table filled with tracker updates that are just pairs of player/update ids, then have tables for each of the 24 skills with the update id and rank/xp pair? Or perhaps a single table with all skills and a column that has the skill id in it?
[QUOTE=KmartSqrl;41862374]Is there any particular reason you're using windows? If you're not using .NET for web stuff you should probably just run your server on Linux of some sort. It'll be cheaper.[/QUOTE]
Gameservers, also I kinda enjoy using the VPS using remote connection.
[QUOTE=Cowabanga;41864095]Gameservers, also I kinda enjoy using the VPS using remote connection.[/QUOTE]
Most gameservers nowadays works for linux aswell. The only gameserver I know about that doesn't support Linux is Arma 2. I suggest you to use linux as it's alot more lightweight than Windows
[QUOTE=Svenskunganka;41869446]Most gameservers nowadays works for linux aswell. The only gameserver I know about that doesn't support Linux is Arma 2. I suggest you to use linux as it's alot more lightweight than Windows[/QUOTE]
Eh I like remote desktop and Windows is serving me fine for now.
If remote desktop desktop is the only thing holding you back you could just install a DE such as Openbox and use VNC.
I'm not trying to force you one way or another, but usually the only legitimate reason to use Windows in the web environment is to host Windows-specific applications. Otherwise Linux is always a better choice.
[QUOTE=Cowabanga;41870230]Eh I like remote desktop and Windows is serving me fine for now.[/QUOTE]
If you want to run a serious web server, install something like Arch Linux and use Nginx.
[QUOTE=Sharpshooter;41874724]If you want to run a serious web server, install something like Arch Linux and use Nginx.[/QUOTE]
Red Hat (CentOS) + nginx or LiteSpeed
[QUOTE=andersonmat;41874903]Red Hat (CentOS) + nginx or LiteSpeed[/QUOTE]
any distro intended for servers + nginx or LiteSpeed or even Lighty.
[QUOTE=AndrewPH;41875551]any distro intended for servers + nginx or LiteSpeed or even Lighty.[/QUOTE]
I've never really had a problem with Debian and Apache2 to be honest. I know there's better out there but it does the job for me.
[QUOTE=Sharpshooter;41874724]If you want to run a serious web server, install something like Arch Linux and use Nginx.[/QUOTE]
It's nothing really serious. It's just a few gameservers and my primarly static website.
If I were to run a serious webserver I'd get a seperate VPS that runs Linux, yeah.
[QUOTE=Cowabanga;41861633]Currently I'm using IIS for my webserver and I know how much of a hog it is. I was thinking of switching to something like WAMP. But seeing how intergrated to the OS IIS is, is it a wise move to get rid of IIS in favor of WAMP?
[editline]16th August 2013[/editline]
Also anyone got any experience with ViLayer? Their VPSs seem to be priced reasonably.[/QUOTE]
Use Nginx, not Apache.
[QUOTE=Dorkslayz;41880454]Use Nginx, not Apache.[/QUOTE]
so I can actually get rid of IIS not just for development reasons?
[QUOTE=Dorkslayz;41880454]Use Nginx, not Apache.[/QUOTE]
hurr durr nginx is faster on my 64mb vps out of the box so it must be better!
Also, the windows port of nginx sucks. Most webservers ports to Windows do.
oh okay
[QUOTE=Cowabanga;41879114]It's nothing really serious. It's just a few gameservers and my primarly static website.
If I were to run a serious webserver I'd get a seperate VPS that runs Linux, yeah.[/QUOTE]
If it's static then just run Apache as a service
[QUOTE=compwhizii;41881092]If it's static then just run Apache as a service[/QUOTE]
I said primarly, as in for the most part, I use a small php script that loads pages straight to the main page instead of iframing them.
[QUOTE=compwhizii;41881076]hurr durr nginx is faster on my 64mb vps out of the box so it must be better!.[/QUOTE]
I have yet to see an Apache configuration that can serve requests faster than Nginx.
[QUOTE=Cowabanga;41881003]so I can actually get rid of IIS not just for development reasons?[/QUOTE]
Yes, get rid of IIS unless you need all of it's advanced features.
Sorry, you need to Log In to post a reply to this thread.