Web Dev Questions That Don't Need Their Own Thread v4
5,001 replies, posted
[QUOTE=Moofy;44028784]It doesn't happen anymore I think though it adds some default margin or something:
[URL]http://jsfiddle.net/gH74N/[/URL]
Adding the font-size: 0; removes that margin but then I end up with my EM problem:
[URL]http://jsfiddle.net/gH74N/1/[/URL][/QUOTE]
It's actually not a margin, it's a small space.
That is why font-size:0; "fixes" it.
Adding a comment between the divs
[code]
<body>
<div class="box1"></div><!--
--><div class="box2"></div>
<body>
[/code]
should fix it.
Or you can just put the two divs on the same line, comments look messy to me
font-size:0 doesn't appear to be reliable cross-browser, negative margins aren't reliable either.
Looks like the least bad way to do it while still retaining readable HTML is to drop the closing > to the next line.
[code]
<ul>
<li>content</li
><li>content</li
><li>content</li
><li>content</li>
</ul>
[/code]
Which is still pretty ugly.
Ugh, why can't we just have inline-block elements without this bullshit.
[IMG]http://i.imgur.com/8osy1bM.gif[/IMG]
A bit hacky solution, but this works perfectly. [url]http://jsfiddle.net/gH74N/6/[/url]
Added a margin on every .box div except for the first one.
[QUOTE=TrinityX;44030238]A bit hacky solution, but this works perfectly. [url]http://jsfiddle.net/gH74N/6/[/url]
Added a margin on every .box div except for the first one.[/QUOTE]
The problem with this is that if the font size is different the gap is different.
[url]http://jsfiddle.net/gH74N/7/[/url]
[QUOTE=TrinityX;44030238]A bit hacky solution, but this works perfectly. [url]http://jsfiddle.net/gH74N/6/[/url]
Added a margin on every .box div except for the first one.[/QUOTE]
[code]
*{
margin:0;
padding:0;
}
[/code]
Seems to work too
In JQuery I append 4 divs which have inputs inside of them of which have a prefix and a unique number at the end like so: (sorry ofor the disgusting mess that is my code)
[code]
for(var i = 0; i < 2; i++){
var count = i;
var div = "<div id='remrow' align='center' identity='"+ count +"'><label id='title1'>Warn #" + count + "</label><br/><input type='text' placeholder=' below' value='"+ json[i].minthresh +"' id='below"+ count +"'/><div id='succ"+ count +"' style='width:120px; height:30px;'></div><input type='text' placeholder='above' value='"+ json[i].maxthresh +"' id='max"+ count +"'/> </div>";
$("#reminders").append(div);
$('#reminders').addClass('animated fadeInUp');
}
[/code]
Below the appended div, theres a save all button which will save all the inputs values into their own tables and then the tables will be (eventually) POST to a PHP script. This PHP script will take the tables and save them into an SQL database for retrieval at a later date.
Heres where the problems begin. The save all button then calls a method which is supposed to filter out all the #below*numberhere* and #above*numberhere* numbers and put them into a table to POST off.
So I use JQueries filter function like so: (just to test it)
[code]
function subClick(){
$('div[id^="below"]').filter(
function(){
console.log("this is a test");
});
}
[/code]
For some reason, nothing outputs in the console at all.
[QUOTE=gokiyono;44030906][code]
*{
margin:0;
padding:0;
}
[/code]
Seems to work too[/QUOTE]
Already have that in there
[QUOTE=Chizbang;44031308]In JQuery I append 4 divs which have inputs inside of them of which have a prefix and a unique number at the end like so: (sorry ofor the disgusting mess that is my code)
[code]
for(var i = 0; i < 2; i++){
var count = i;
var div = "<div id='remrow' align='center' identity='"+ count +"'><label id='title1'>Warn #" + count + "</label><br/><input type='text' placeholder=' below' value='"+ json[i].minthresh +"' id='below"+ count +"'/><div id='succ"+ count +"' style='width:120px; height:30px;'></div><input type='text' placeholder='above' value='"+ json[i].maxthresh +"' id='max"+ count +"'/> </div>";
$("#reminders").append(div);
$('#reminders').addClass('animated fadeInUp');
}
[/code]
Below the appended div, theres a save all button which will save all the inputs values into their own tables and then the tables will be (eventually) POST to a PHP script. This PHP script will take the tables and save them into an SQL database for retrieval at a later date.
Heres where the problems begin. The save all button then calls a method which is supposed to filter out all the #below*numberhere* and #above*numberhere* numbers and put them into a table to POST off.
So I use JQueries filter function like so: (just to test it)
[code]
function subClick(){
$('div[id^="below"]').filter(
function(){
console.log("this is a test");
});
}
[/code]
For some reason, nothing outputs in the console at all.[/QUOTE]
I think you messed up the dom.
I much prefer to handle appending/inserting/updateing elements by editing the dom.
var myNewDiv = parent.appendChild(document.createElement('div'));
myNewDiv.innerHTML = 'I'm a div';
It's much nicer, you can even write a function which you feed the element type, the id, class and innerHTML for much much easier inserting stuff.
This method is also miles better for adding events and stuff to your item and makes dataset's much easier to work with.
Just don't have stuff like
myNewDiv.myCustomProperty = 'test';
Expando properties cause memory leaks.
Instead use
myNewDiv.dataset.myCustomName_index = 1;
arrayOfStuff = [{}, {}, {}];
This way you can have functions and stuff saved to the element. When you remove the element be sure to remove the object from the arrayOfStuff.
[QUOTE=mdeceiver79;44032059]I think you messed up the dom.
I much prefer to handle appending/inserting/updateing elements by editing the dom.
var myNewDiv = parent.appendChild(document.createElement('div'));
myNewDiv.innerHTML = 'I'm a div';
It's much nicer, you can even write a function which you feed the element type, the id, class and innerHTML for much much easier inserting stuff.[/QUOTE]
Yeah, I suppose your right. Reckon it might solve my problem?
How well do RoR and/or node work on the Raspberry Pi?
I'm planning on building something similar to Raspcontrol, but I'm bored of PHP. I realise this way it's not as...plug and play (for lack of a better phrase) where you just shove a folder in there and point Apache at it, which is probably what you'd want from an RPi admin panel. I'd just like to learn something other than PHP -- understanding MVC sounds like it could come in handy.
I'm having font rendering problems, I think the problem soley lies with the fact that if you order a woff font a certain way in chrome, it causes the problem.
I think the source of my font-rendering issues is because I actually load certain file types before others.
I've done some reading and I can't get a straight answer on this though.
Can someone give me a straight answer (from experience) on what file types to order and when.
Like EOT, TTF, WOFF, SVG or SVG, EOT, TTF, WOFF etc
Or if this isn't the problem, explain to me what is actually happening here.
[code]
@font-face {
font-family: 'neoSans';
src:url('fonts/NeoSans-Light.eot');
src:url('fonts/NeoSans-Light.eot?#iefix') format('embedded-opentype'),
url('fonts/NeoSans-Light.ttf') format('truetype'),
url('fonts/NeoSans-Light.woff') format('woff'),
url('fonts/NeoSans-Light.svg') format('svg');
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
[/code]
I've noticed I only have font rendering issues in chrome, and older versions of Firefox
IE is too inconsistent to give a determinate statement on whether or not the fonts work.
Define "rendering issues"
I assume he means "font looks like shit not anti aliased correctly"
Try truetype after the woff.
[editline]25th February 2014[/editline]
Also Chrome on windows uses the windows font renderer, it's not very good, not even later versions of Internet Explorer use it. I think there was some news about the Chrome devs using DirectWrite in an upcoming version.
[editline]25th February 2014[/editline]
There is a setting for it in chrome://flags/ in Chrome 33 so it looks like it's coming soon.
I'm having the same problem, this is otf:
[img]http://puu.sh/7aj5X.png[/img]
vs woff:
[img]http://puu.sh/7aj5w.png[/img]
it's not the end of the world but it's enough to affect readability
Is there any way to use websockets for pushing content to the client using php without a wrapper like node.js or a daemon?
[QUOTE=TrinityX;44047480]Is there any way to use websockets for pushing content to the client using php without a wrapper like node.js or a daemon?[/QUOTE]
PHP only runs for a given request, so you're going to need to find a way to daemonize it at the very least.
I would just plain not do the websocket part with PHP if I were you though. There's lots of languages and frameworks that will handle it a lot better, so there's no reason to create extra work for yourself by picking a screwdriver to bang in a nail.
[QUOTE=KmartSqrl;44048087]PHP only runs for a given request, so you're going to need to find a way to daemonize it at the very least.
I would just plain not do the websocket part with PHP if I were you though. There's lots of languages and frameworks that will handle it a lot better, so there's no reason to create extra work for yourself by picking a screwdriver to bang in a nail.[/QUOTE]
I decided to go for a combination of php and node.js, thanks for the help.
On, [URL]http://htmldog.com/reference/htmltags/a/[/URL], what does [QUOTE]Note: An anchor (a point in a page where a link can jump to) does not need to be defined with the a tag. Applying the id attribute to any tag will achieve this.[/QUOTE] mean?
I understand that you can set an anchor to an ID as such: [code]<a href="#content">Link to a page anchor</a>[/code]
It is saying "an anchor tag doesn't need to defined using the "a" tag..? "
I'm sure if someone is able to post a quick code snippet I'll understand.
[QUOTE=Proclivitas;44053143]It is saying an anchor tag doesn't need to defined using the "a" tag?[/QUOTE]
Yes. It means you don't need to use an a tag to define or access a page anchor.
[QUOTE=Proclivitas;44053143]On, [URL]http://htmldog.com/reference/htmltags/a/[/URL], what does mean?
I understand that you can set an anchor to an ID as such: [code]<a href="#content">Link to a page anchor</a>[/code]
It is saying "an anchor tag doesn't need to defined using the "a" tag..? "
I'm sure if someone is able to post a quick code snippet I'll understand.[/QUOTE]
For example
[code]<span id="test">Hello</span>[/code]
can be linked to with
[code]<a href="#test">Goodbye</span>[/code]
Would you use MySQLi or PDO and why? (With PHP)
Because I wonder which one I should use in the future.
[QUOTE=dexon;44055618]Would you use MySQLi or PDO and why? (With PHP)
Because I wonder which one I should use in the future.[/QUOTE]
I prefer PDO. I don't know, it's easy to do things with it.
Although, I have tried a few times MySQLi too, and I haven't found a lot of changes between them.
Plus, the only upside PDO has over MySQLI is driver compatibility. If you're not worried about that (just using MySQL, by example) you could just choose the name you like the most.
(hehe... pedo... fart in spanish... hehe.)
[QUOTE=Coment;44055834]I prefer PDO. I don't know, it's easy to do things with it.
Although, I have tried a few times MySQLi too, and I haven't found a lot of changes between them.
Plus, the only upside PDO has over MySQLI is driver compatibility. If you're not worried about that (just using MySQL, by example) you could just choose the name you like the most.
(hehe... pedo... fart in spanish... hehe.)[/QUOTE]
Ok, thanks ;)
Is Webplus x7 a place to start making a website simply? or does anyone know any other programs that are drag and drop, can't be bothered with code right now.
[QUOTE=lowlifeuk777;44060488]Is Webplus x7 a place to start making a website simply? or does anyone know any other programs that are drag and drop, can't be bothered with code right now.[/QUOTE]
[url]https://sites.google.com/[/url] ?
and [url]https://www.google.com/webdesigner/[/url]
[QUOTE=dexon;44055618]Would you use MySQLi or PDO and why? (With PHP)
Because I wonder which one I should use in the future.[/QUOTE]
As far as I know MySQi is a bit faster. (Not really too much.)
PDO does support several other databases and named statements.
[QUOTE=lowlifeuk777;44060488]Is Webplus x7 a place to start making a website simply? or does anyone know any other programs that are drag and drop, can't be bothered with code right now.[/QUOTE]
You could try a WYSIWYG editor but I don't know what the best ones are. I tried Dreamweaver but I found it really cluttered and the website renderer was shit
Sorry, you need to Log In to post a reply to this thread.