• Web Dev Questions That Don't Need Their Own Thread v4
    5,001 replies, posted
Noob question inbound. Aligning things vertically? I want something centered horizontally and vertically, however. I'm having a hard time doing this, any solution and simple explanation how it works will be very much appreciated! Yes I did google but all solutions I found didn't seem to work out that well for me, I have experience but this just knocks me out everytime!
[QUOTE=Moofy;41799198]Noob question inbound. Aligning things vertically? I want something centered horizontally and vertically, however. I'm having a hard time doing this, any solution and simple explanation how it works will be very much appreciated! Yes I did google but all solutions I found didn't seem to work out that well for me, I have experience but this just knocks me out everytime![/QUOTE] [URL="http://phrogz.net/css/vertical-align/"]This page[/URL] has helped me a lot in school Because I suck at CSS.
Sweet fucking jesus, why are all CSS measurements converted to px at a fixed 96ppi rather than being based on device pixel density? What's the point in even using any measure other than px if nobody converts between physically based measurements and pixels based on the actual physical measurement of a pixel? I mean 12pt is 12/72in*96ppi is 16px, that makes perfect sense But 12/72in*326ppi is ~54.3px, so you should render it at this size, and yet it renders it at 16px which is basically 4pt on this screen I've gotten around this by using em measurements, since those are relative to a default font size which is in fact not stupidly tiny, but it really makes no sense to my mind for a physical measurement not to translate to a physical size on the screen it's rendered to. I figured that was kind of the point entirely of having the different measurements available in CSS
CSS is being a complete pain again (unless I'm missing something here.) I want to align the gray label with the date in the same way the blue "#1" is on the right but I cannot get it to actually move. Can anyone lend me a hand? It's really pissing me off [url]http://snarlax.us/news/show/1[/url]
do you want it to be up beside the blue #1?
[QUOTE=KmartSqrl;41828966]do you want it to be up beside the blue #1?[/QUOTE] No, I want it at the bottom right like it is now but it should be respecting the padding its parent container has. The "#1" has no problem doing this so I can't figure out why the date does.
The pull-x helper class makes it float; use text-align.
[QUOTE=jetboy;41829006]The pull-x helper class makes it float; use text-align.[/QUOTE] won't that just make the label's text align to the right?
No. Regardless, an alternative solution would be to use margin-top with a negative value (still using pull-right).
Your container just needs a clear fix on it so that it is aware of the grey tag and can properly contain it.
I am offered a chance to under-cut a freelancer asking for ~$3000-4000 for a WordPress site with plugins. Without disclosing too much, how should I return a proposal if I know they'll take my service? I have an outline written and I plan to present it without any numbers so that I may negotiate... [editline]14th August 2013[/editline] I am not billing an hourly rate but would be billing on a milestone basis, these milestones are also listed in my outline.
So I developed this entire form creation and management tool on WAMP and then uploaded it to my server and everything broke. One of the things that broke stuff is something as simple as capitalization in file paths (eg. 'images/pic.png' vs 'IMAGES/pic.png'). Now I'm looking at my insert queries and it seems like they are broken for some strange reason which I can't seem to figure out. Here is what it looks like: [CODE] <?php session_start(); error_reporting(E_ALL); $host = 'localhost'; $dbname = 'database'; $user = 'username'; $pass = 'password'; try { $db = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch(PDOException $e) { echo($e->getMessage()); exit(); } foreach ($_SESSION['inputs']['name'] as $key => $inputName) { $inputID[$key] = mt_rand(1000000000, 9999999999); $sql = $db->prepare("INSERT INTO formsinput (InputName, InputType, InputOptions, InputID, FormID, Reference) VALUES (:InputName, :InputType, :InputOptions, :InputID, :FormID, :Reference)"); $sql->bindParam(':InputName', $_SESSION['inputs']['name'][$key], PDO::PARAM_STR, 25); $sql->bindParam(':InputType', $_SESSION['inputs']['type'][$key], PDO::PARAM_STR, 10); if (isset($_SESSION['options1'][$key])) { $options = serialize($_SESSION['options1'][$key]); $sql->bindParam(':InputOptions', $options, PDO::PARAM_STR, 100); } else { $options = 'none'; $sql->bindParam(':InputOptions', $options, PDO::PARAM_STR, 100); } $sql->bindParam(':InputID', $inputID[$key], PDO::PARAM_INT, 10); $sql->bindParam(':FormID', $formID, PDO::PARAM_INT, 10); $sql->bindParam(':Reference', $_SESSION['inputs']['reference'][$key], PDO::PARAM_STR, 25); if ($sql->execute()) { echo("<b>" . $_SESSION['inputs']['name'][$key] . ":</b> " . $inputID[$key] . "<br />"); } else { echo("Input Query Error"); } } ?> [/CODE] I am looping through each input (because the form is created dynamically, there are a set amount of default inputs, and the option to add more inputs on top of that) using the loop below: So I output the Input ID right before the query and everything is good and unique as it should be, the output looks like this (Input Name: Input ID) [IMG]http://silv3rfox.com/images/output.png[/IMG] but then when I go an look to see what was inserted, I get this: [IMG]http://silv3rfox.com/images/fuck.png[/IMG] All the same InputID even though I have just confirmed that the variables are different. And the weird part is it's [b]always[/b] the same ID number. Has anyone ever seen anything like this? The email field is being inserted for all 3 text inputs, and the Form ID is being inserted in the Entry ID column, however the birthday and date entered are being inserted perfectly fine. I can assure you the Entry ID is not the same as the Form ID, as I have echoed this out right before inserting ti and it is the correct value, so I'm not too sure why any of this is happening. It was all working perfectly on my WAMP server. Can anyone help me in any way? If you need more information or code, please just let me know! P.S. I apologize for my strange code indenting, I have a strange way of doing things.
[QUOTE=KmartSqrl;41831860]Your container just needs a clear fix on it so that it is aware of the grey tag and can properly contain it.[/QUOTE] Are you kidding me? Thank you so much! Looks almost perfect now, apparently the 'user' section isn't taking the full height of its container. Anyone fee like helping me out with that? [img]http://puu.sh/41X2o.png[/img] The section with the avatar and 'snarlax' text should go down completely. I'm guessing since the parent container doesn't have a set height it won't fill the enter height but there has to be a way around that, right? [url]http://snarlax.us/news/show/1[/url]
If anyone knows anything about my issue above, I would love them forever. I am dying over here! it makes no sense!
[QUOTE=Poo Monst3r;41835730]If anyone knows anything about my issue above, I would love them forever. I am dying over here! it makes no sense![/QUOTE] The number it's putting as the ID is the maximum number allowed by the int32 data type (2^32). Because the ID you've given it is larger it's rounding it down to that. I believe PHP will convert it to a larger integer size if possible, so the problem is [i]probably[/i] the data-type for the InputID Field in your database.
[QUOTE=SataniX;41835776]The number it's putting as the ID is the maximum number allowed by the int32 data type (2^32). Because the ID you've given it is larger it's rounding it down to that. I believe PHP will convert it to a larger integer size if possible, so the problem is [i]probably[/i] the data-type for the InputID Field in your database.[/QUOTE] You are absolutely right. Thank you so so so much! You rock
[QUOTE=Banana Lord.;41835531]Are you kidding me? Thank you so much! Looks almost perfect now, apparently the 'user' section isn't taking the full height of its container. Anyone fee like helping me out with that? [img]http://puu.sh/41X2o.png[/img] The section with the avatar and 'snarlax' text should go down completely. I'm guessing since the parent container doesn't have a set height it won't fill the enter height but there has to be a way around that, right? [url]http://snarlax.us/news/show/1[/url][/QUOTE] Float the main content area as well and add the border to that instead of the user section since it will probably be taller almost all the time (could set a min-height on it too). Getting two floated elements to always be the same height is an enormous pain in the ass and usually not really feasible, so you have to figure out ways to work around it.
Is RoR still the preferred framework? What is the preffered way of developing sites with it? IE Should I use gems where possible rather than say including the js/css files directly? Also is there any good blogging engine for RoR? I had a look at Type/Publify but it seems somewhat overkill for what I need, it seems like a wordpress clone in ruby
[QUOTE=Richy19;41837971]Is RoR still the preferred framework? What is the preffered way of developing sites with it? IE Should I use gems where possible rather than say including the js/css files directly? Also is there any good blogging engine for RoR? I had a look at Type/Publify but it seems somewhat overkill for what I need, it seems like a wordpress clone in ruby[/QUOTE] Depends on what kind of site you are building. I use RoR for everything I can, and you can pretty much do anything with it. Gems are awesome, but I don't use them for css/js libs unless it's stuff that provides an SCSS or SASS version through a gem like compass. They seem to not be update as frequently. If you want a really simple blog in RoR, roll your own. I haven't really done any blogs with it yet because everyone just wants to use wordpress, so I can't point you towards popular pre-built options.
Ahh, its just for a personal site/portfolio kinda thing. The js/css gem was for the twitter-bootstrap library as many guides have mentioned using the gem for it. Also I am looking at lithium hosting's shared option which it seems supports RoR, any thing against them? [editline]14th August 2013[/editline] Ohh, and for the development I want to just use the sqlite implementation, to not have to install mysql, but I wanted to use MySQL in production, is it just as simple as changing the db/... file?
[QUOTE=Richy19;41838451]Ahh, its just for a personal site/portfolio kinda thing. The js/css gem was for the twitter-bootstrap library as many guides have mentioned using the gem for it. Also I am looking at lithium hosting's shared option which it seems supports RoR, any thing against them? [editline]14th August 2013[/editline] Ohh, and for the development I want to just use the sqlite implementation, to not have to install mysql, but I wanted to use MySQL in production, is it just as simple as changing the db/... file?[/QUOTE] I wouldn't use shared hosting for rails, especially not cheap shared hosting. If you're not doing anything particularly heavy weight or high traffic you can usually get away with free hosting from heroku (they provide one web dyno for free and charge you beyond that, but one web dyno can take a decent amount of traffic) Don't use sqlite in dev if you're not using it on production. You should be using the same DB system so you don't run in to issues with differences between dev/production DBs. I use postgres in production whenever I can, for example, and it represents booleans differently than MySQL does, which would cause a lot of unnecessary headaches if I wasn't also running postgres on my dev box. You should always strive to have the highest dev/production environment parity that you can because it will make your life significantly easier.
[QUOTE=KmartSqrl;41838492]I wouldn't use shared hosting for rails, especially not cheap shared hosting. If you're not doing anything particularly heavy weight or high traffic you can usually get away with free hosting from heroku (they provide one web dyno for free and charge you beyond that, but one web dyno can take a decent amount of traffic)[/QUOTE] Any special reason not to use it with RoR? (Other than the general downsides to shared hosting)
[QUOTE=Richy19;41839030]Any special reason not to use it with RoR? (Other than the general downsides to shared hosting)[/QUOTE] RoR apps are always up and running and take a moderate amount of memory (as opposed to php where a new process spawns to handle each request, iirc). That isn't at all conducive to running on a shared host, so they will often spin down idle rails apps which will make the first request after a spin down take a few extra seconds as the app starts up. You [I]can[/I] get around it by using a monitoring service that will ping your server often enough to keep it always running (I use newrelic on heroku to do this because they spin free dynos down as well after they idle for a while). RoR deployment is also a little more involved than PHP (start/stop app server and potentially background job workers, asset pipleline precompilation, gem installation), and that makes me worried that the usual shared host issues have the ability to become a lot more pronounced when using RoR. It really is ideal to have as much control over your environment as possible.
Any idea what this is about? [code] run bundle install Fetching gem metadata from https://rubygems.org/........... Fetching gem metadata from https://rubygems.org/.. Resolving dependencies... Using rake (10.1.0) Using i18n (0.6.5) Using minitest (4.7.5) Using multi_json (1.7.9) Installing atomic (1.1.13) Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=C:/RailsInstaller/Ruby1.9.3/bin/ruby --with-atomic_reference-dir --without-atomic_reference-dir --with-atomic_reference-include --without-atomic_reference-include=${atomic_reference-dir}/include --with-atomic_reference-lib --without-atomic_reference-lib=${atomic_reference-dir}/lib C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:461:in `try_link0' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:712:in `try_run' from extconf.rb:24:in `<main>' Gem files will remain installed in C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/atomic-1.1.13 for inspection. Results logged to C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/atomic-1.1.13/ext/gem_make.out An error occurred while installing atomic (1.1.13), and Bundler cannot continue. Make sure that `gem install atomic -v '1.1.13'` succeeds before bundling. [/code]
It just means you're missing some libs or something that you need to install that gem (some gems have C extensions that they compile and install to do what they need to do). You'll have to find/check the mkmf.log file that it's talking about for full details
I'm trying to figure out the difference between MSSQL and MySQL. can anyone provide some major differences? like is one more secure than the other?
MSSQL requires a Windows server to run (as far as I know). MySQL (in my experience) is much more common and widely accepted.
how do I create a <select> with javascript? Specifically: I want to make a select from an array. Here's my array: { "name":"1", "name2":"2", "name3":"2", "name4":"4", ... "name100":"100", } How big of an array will the user's computer cache anyways? Also is there a way to link the array from a seperate file?
[QUOTE=01271;41849787]how do I create a <select> with javascript? Specifically: I want to make a select from an array. Here's my array: { "name":"1", "name2":"2", "name3":"2", "name4":"4", ... "name100":"100", } How big of an array will the user's computer cache anyways? Also is there a way to link the array from a seperate file?[/QUOTE] Why not just do it with PHP with a for or foreach? [CODE] foreach ($array as $value) { echo '<option>' . $value . '</option>'; } [/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("<option>" + array[counter] + "</option>"); [/CODE] For the last question, you can pass over the array from another page with a GET method in either PHP or Javascript with jQuery. Read more here: [URL="http://stackoverflow.com/questions/247483/http-get-request-in-javascript"]http://stackoverflow.com/questions/247483/http-get-request-in-javascript[/URL]
Anyone know of a good cheap VPS provider that has either Xen (preferred) or KVM? Ramnode is way too expensive to me.
Sorry, you need to Log In to post a reply to this thread.