Web Dev Questions That Don't Need Their Own Thread v4
5,001 replies, posted
[QUOTE=TrinityX;42618999]Removed the HR's above and below the image, optimized some code, removed some unneccesary code, restyled some things, aaand i fixed it.
Protip: Don't use images for anything other than logos and images :v:
[T]http://s24.postimg.org/s2sj3gyv9/fixed_it.png[/T][/QUOTE]
I love the way you've tried to match the logo with the font. Nice use of faded background and shadows. Looks nice!
[QUOTE=benbb;42629369]I love the way you've tried to match the logo with the font. Nice use of faded background and shadows. Looks nice![/QUOTE]
FYI I only edited it a bit, Dinonid made the original, but thanks anyway :smile:
[QUOTE=Chizbang;42624935]I have this Javascript script which grabs an XML file via AJAX and puts the XML data into a var named xmlData like so:
[CODE]
$(document).ready(function(){
var xmlStuffs;
$.ajax({
url: 'http://192.168.0.7/xml/bugs.xml',
type: 'GET',
dataType: "xml",
success:function(data){
xmlStuffs = $(this);
console.log($('<xml>').append(xmlStuffs).html());
}
});
});
[/CODE]
What I really wanna do is print all the XML data in its raw form. Just every single line of the xml file logged to the console, but for some reason when I do what i do above, it does not do a thing.
Any ideas?[/QUOTE]
[code]$(document).ready(function(){
$.ajax({
url: 'http://192.168.0.7/xml/bugs.xml',
type: 'GET',
success:function(data){
console.log(data);
}
});
});[/code]
:wink:
Man I feel stupid :D Thanks man
Need a hand with coffeescript
I am trying to make a function that lists all properties of an object
[code]
showProps = (obj) ->
result = ""
result+= String(i+ ' = ' + obj[i] + '\n') for i in obj when obj.hasOwnProperty(i)
return result
O = {A:1}
alert showProps O
[/code]
Why does the function return nothing?
[QUOTE=MuffinZerg;42631624]Need a hand with coffeescript
I am trying to make a function that lists all properties of an object
[code]
showProps = (obj) ->
result = ""
result+= String(i+ ' = ' + obj[i] + '\n') for i in obj when obj.hasOwnProperty(i)
return result
O = {A:1}
alert showProps O
[/code]
Why does the function return nothing?[/QUOTE]
Pretty sure the
[code]
alert showProps O
[/code]
is interpreted as
[code]
alert(showProps, O)
[/code]
[QUOTE=commander204;42631655]Pretty sure the
[code]
alert showProps O
[/code]
is interpreted as
[code]
alert(showProps, O)
[/code][/QUOTE]
According to the parser on the official web site, the code is interpreted to
[code]
var O, showProps;
showProps = function(obj) {
var i, result, _i, _len;
result = "";
for (_i = 0, _len = obj.length; _i < _len; _i++) {
i = obj[_i];
if (obj.hasOwnProperty(i)) {
result += String(i + ' = ' + obj[i] + '\n');
}
}
return result;
};
O = {
A: 1
};
alert(showProps(O));
[/code]
[editline]24th October 2013[/editline]
I am absolutely sure the function showProps doesn't return anything and all attempts to alert something from inside the loop result in nothing.
Riddle me this FP.
How would I go about finding a with in percent that I got in pixels & the other way around, because it affects the users screen size regardless, doesn't it? What's the math behind this?
[QUOTE=Moofy;42632286]Riddle me this FP.
How would I go about finding a with in percent that I got in pixels & the other way around, because it affects the users screen size regardless, doesn't it? What's the math behind this?[/QUOTE]
Width in % = (px width of element / px width of container) * 100
Width in px = px width of container * (% width of element / 100)
Container can be the window or the parent of the element that you're trying to calculate widths for, just depends on what you're trying to do.
[QUOTE=KmartSqrl;42632963]Width in % = (px width of element / px width of container) * 100
Width in px = px width of container * (% width of element / 100)
Container can be the window or the parent of the element that you're trying to calculate widths for, just depends on what you're trying to do.[/QUOTE]
What I'm trying to do is for example I got a simple div with a width of 122px or something and I want to find the exact same width but in percent. But wouldn't different size windows affect it / screen sizes?
[QUOTE=benbb;42629369]I love the way you've tried to match the logo with the font. Nice use of faded background and shadows. Looks nice![/QUOTE]
Thanks! The website we are currently using for the site just isn't very good ([url]http://ninosondaniels.com/[/url]) so I've been working on one. TrinityX really improved the overall look of the site. I took his advice and he managed to teach me something.
[t]http://i.imgur.com/Fr19YJw.png[/t]
'news' cells are supposed to float together, but when they're uneven in size, this massive gap happens. There's enough room and no margins around to stop it from happening, any help would be great :(
[QUOTE=Xenoyia v2;42634787][t]http://i.imgur.com/Fr19YJw.png[/t]
'news' cells are supposed to float together, but when they're uneven in size, this massive gap happens. There's enough room and no margins around to stop it from happening, any help would be great :([/QUOTE]
Are you using the [URL="http://nicolasgallagher.com/micro-clearfix-hack/"]clearfix hack[/URL]?
is the html LAYER tag something real? is my web dev teacher mental?
[QUOTE=Kwaq;42651778]is the html LAYER tag something real? is my web dev teacher mental?[/QUOTE]
Was. [url=https://en.wikipedia.org/wiki/Layer_%28HTML_tag%29]And it's specific to Netscape 4.[/url] So yes, I would say he's mental.
I feel VERY dirty knowing that I can only do jQuery stuff and no raw Javascript, I want to dig deeper into vanilla JS. Can anyone recommend me a good place to start learning it? Most places I've tried were crap.
Can't wrap my head around longpolling.
[QUOTE=Cowabanga;42652124]I feel VERY dirty knowing that I can only do jQuery stuff and no raw Javascript, I want to dig deeper into vanilla JS. Can anyone recommend me a good place to start learning it? Most places I've tried were crap.[/QUOTE]
I rated you disagree because you shouldn't feel dirty about it.
Codeacademy has some nice tutorials on it.
[QUOTE=littlefoot;42652295]Can't wrap my head around longpolling.[/QUOTE]
Long polling is fairly simple.
Basically you need a script that when requested sits in a loop checking for something, when that check passes it returns the data. and then you repeat the process .
This is a good 5 minute tutorial video
[url]http://www.screenr.com/SNH[/url]
Its not a complete solution though, but it will give you a decent base to work from
[QUOTE=Spero78;42652478]Long polling is fairly simple.
Basically you need a script that when requested sits in a loop checking for something, when that check passes it returns the data. and then you repeat the process .
This is a good 5 minute tutorial video
[url]http://www.screenr.com/SNH[/url]
Its not a complete solution though, but it will give you a decent base to work from[/QUOTE]
Thanks that actually helped a ton, managed to get it working.
[QUOTE=gokiyono;42652471]I rated you disagree because you shouldn't feel dirty about it.
Codeacademy has some nice tutorials on it.[/QUOTE]
Codeacademy isn't the thing for me. I finished their javascript, python and ruby tutorials and I felt like I learned nothing.
[editline]26th October 2013[/editline]
I'm the sort of guy who reads a book/watches a tutorial then applies what he learned on a local file.
[editline]26th October 2013[/editline]
Besides the reason I want to learn raw js is to have a go at stuff like WebGL and userscripts.
[QUOTE=Cowabanga;42652124]I feel VERY dirty knowing that I can only do jQuery stuff and no raw Javascript, I want to dig deeper into vanilla JS. Can anyone recommend me a good place to start learning it? Most places I've tried were crap.[/QUOTE]
[url]http://coding.smashingmagazine.com/2013/10/06/inside-the-box-with-vanilla-javascript/[/url]
[url]https://developer.mozilla.org/en-US/docs/Web/JavaScript[/url]
Well, it's not exactly a single place to learn, but it's a good idea to learn regular JS. Personally, I "vowed" not to use libraries like jQuery because of reasons like this.
[editline]GL[/editline]
Protip: Be careful on what WebGL things you check out. You may break something.
[t]http://i.imgur.com/4SDSsa5.png[/t]
[QUOTE=Cowabanga;42653188]Codeacademy isn't the thing for me. I finished their javascript, python and ruby tutorials and I felt like I learned nothing.
[editline]26th October 2013[/editline]
I'm the sort of guy who reads a book/watches a tutorial then applies what he learned on a local file.
[editline]26th October 2013[/editline]
Besides the reason I want to learn raw js is to have a go at stuff like WebGL and userscripts.[/QUOTE]
I can understand that.
(For userscripts you could always do [CODE]var load,execute,loadAndExecute;load=function(a,b,c){var d;d=document.createElement("script"),d.setAttribute("src",a),b!=null&&d.addEventListener("load",b),c!=null&&d.addEventListener("error",c),document.body.appendChild(d);return d},execute=function(a){var b,c;typeof a=="function"?b="("+a+")();":b=a,c=document.createElement("script"),c.textContent=b,document.body.appendChild(c);return c},loadAndExecute=function(a,b){return load(a,function(){return execute(b)})};
loadAndExecute("//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js", function() {
$('selector').stuff();
});[/CODE])
[editline]26th October 2013[/editline]
[QUOTE=Stonecycle;42653543][url]http://coding.smashingmagazine.com/2013/10/06/inside-the-box-with-vanilla-javascript/[/url]
[url]https://developer.mozilla.org/en-US/docs/Web/JavaScript[/url]
Well, it's not exactly a single place to learn, but it's a good idea to learn regular JS. Personally, I "vowed" not to use libraries like jQuery because of reasons like this.[/QUOTE]
That sounds like a lot of work that could be spend on making your site even better...
Codeacademy seems like a good idea until you try it. You go throught tutorials, doing what you are told. You feel like learning by practice. But as soon as you try to make something outside of codeacademy you will feel how empty your head is.
-snip, i fixed it myself-
Hi
I created a text box in html using form but for some reasons the text is in the middle.
The text should start at the top but I don't know what to do.
If anyone can help it will be great.
[img]https://dl.dropboxusercontent.com/u/16648713/example.png[/img]
[QUOTE=BoowmanTech;42657450]Hi
I created a text box in html using form but for some reasons the text is in the middle.
The text should start at the top but I don't know what to do.
If anyone can help it will be great.[/QUOTE]
Are you using a <textarea> ?
[QUOTE=DaMastez;42657897]Are you using a <textarea> ?[/QUOTE]
No, I am using.
[code]<input type="text" name="message" id="messagebar" />[/code]
[editline]27th October 2013[/editline]
Thanks, I used textarea and it's working.
How does bootstrap actually work? Like how do you implement it into your own website?
I personally don't need it.. but I think learning it would be good if its for mobile devices etc, it just seems like a clusterfuck to implement into a website already built..
I must have misunderstood something with jQuery, I tried fading in something some seconds after (we're speaking literally just as the page has been loaded) - So I just set up a simple file trying to make sure it would work, I guessed it to fade when document was .ready but that doesn't seem to solve the problem :v:
[code]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<h1>Facepunch</h1>
</body>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
$(document).ready(function(){
$("h1").fadeIn("slow");
});
</script>
</html>
[/code]
Code above was something quick, the H1 represents anything really. But for this purpose let's just say it was the H1. What exactly am I doing wrong?
Sorry, you need to Log In to post a reply to this thread.