Embarrassingly basic computer stuff that you cannot do

Message Bookmarked
Bookmark Removed
Not all messages are displayed: show all messages (90 of them)

that's fighting talk...

a question (not a trick question, just something i did last week and wondered if there was a better way):

say i have some things and i want them like this (bear with, might take a while to get this right)


one: one
two: two
three: three
four: four

note colos lining up

i don't know how many lines there'll be before i start and some of the values can be quite long, long enough to wrap onto a second line (in which case i'd like the right hand side to be at the top of the box:


five: a long line
that wraps

how to do that in css?

spacecadet, i thought cpan did all that for you. or is cpan the problem?

koogs, Tuesday, 1 February 2011 17:06 (thirteen years ago) link

(ooh, data lined up ok, but mis-typed 'colons')

koogs, Tuesday, 1 February 2011 17:07 (thirteen years ago) link

eventually ime you get the css browser quirks down and pre-emptively work around them

how to do that in css?

dude if you want your content to be tabled use a table, thats what its for. they weren't meant for graphical layout imo

but you can do what your talking about w/ divs easily imo. "five:" goes in one div, floated left, "a long line that wraps" goes in another div floated left. they both have fixed widths. then wrap both of those in another div to act as the row container

am0n, Tuesday, 1 February 2011 17:14 (thirteen years ago) link

if they have fixed widths, they can't resize depending on content size like you can with tables -- maybe make a javascript function
that calculates the max character length of the left column and use it to dynamically resize the left column divs?

Philip Nunez, Tuesday, 1 February 2011 17:22 (thirteen years ago) link

but he said long values would wrap to a 2nd line, fixed width would take care of that. in this case a table would be prob be more forgiving width-wise, but if one of the values contains a long string of characters with no space that is wider than the div/cell its going to break it either way

am0n, Tuesday, 1 February 2011 17:30 (thirteen years ago) link

use shorter numbers imo

ice cr?m, Tuesday, 1 February 2011 17:36 (thirteen years ago) link

> if they have fixed widths, they can't resize depending on content size like you can with tables

deal-breaker right there 8(

it's machine generated output and i hate writing code that writes code - way too many \\\\\\\\s

koogs, Tuesday, 1 February 2011 17:37 (thirteen years ago) link

eventually ime you get the css browser quirks down and pre-emptively work around them

ok but that's a bit different from saying css is as easy as tables.

hoisin crispy mubaduck (ledge), Tuesday, 1 February 2011 17:37 (thirteen years ago) link

hm... what if you generated a canvas object that replaced the bullet in a bullet list, and that canvas object dynamically showed the appropriate left hand column value?

Philip Nunez, Tuesday, 1 February 2011 17:42 (thirteen years ago) link

are u guys using wysiwyg editors that write the tables for u

am0n, Tuesday, 1 February 2011 17:43 (thirteen years ago) link

koogs, cpan is the problem. If I'm using ActivePerl on Windows, its gui package manager offers a selection of ActiveState-approved modules and generally works first time, but most of the modules I want aren't in their repository.

ActivePerl's text-mode cpan I usually (but not always) have very little luck with, which I had put down to the modules just not working in Windows. I also have problems installing them on my Debian box, but I put that down to not being super-clueful about Linux things.

But now there is Strawberry Perl, which is the Windows Perl of choice for ex-Unix users, who cite being able to install modules which previously didn't work under Windows as evidence #1 for this, and I'm still having trouble, even after a clean ActivePerl-less install, or with the portable version which launches a console supposedly with the correct environment variables set. Oh well.

cellular nekomata (a passing spacecadet), Tuesday, 1 February 2011 18:19 (thirteen years ago) link

Onto the other thing: css is (err, are?) nice and all, but people get a bit silly about not using a table ever, even when, y'know, they have a table of data. Overkill.

(though the last time I did any major web development was in the late Netscape era, when people were already hyping css up as the only way to do anything and tables as evil, even though css wasn't very well implemented in any browser yet, never mind getting the same stylesheet to look the same in more than one browser - this has kind of put me off a bit)

cellular nekomata (a passing spacecadet), Tuesday, 1 February 2011 18:20 (thirteen years ago) link

Onto the other thing: css is (err, are?) nice and all, but people get a bit silly about not using a table ever, even when, y'know, they have a table of data. Overkill.

i think maybe there was a couple of years when this was true among the worst kind of zealous convert, but it's pretty much gone now right?

caek, Tuesday, 1 February 2011 18:21 (thirteen years ago) link

if anyone even thinks abt tabular data i kill them jus fyi

ice cr?m, Tuesday, 1 February 2011 18:23 (thirteen years ago) link

*kills colleagues*

caek, Tuesday, 1 February 2011 18:25 (thirteen years ago) link

css, that's where i'm a viking!

Philip Nunez, Tuesday, 1 February 2011 18:26 (thirteen years ago) link

i think maybe there was a couple of years when this was true among the worst kind of zealous convert, but it's pretty much gone now right?

― caek, Tuesday, February 1, 2011 1:21 PM

meet the new kind of zealous convert

Whoever says CSS is easier to use than table-based HTML needs to be raped until they die.

― Mr. Snrub, Saturday, January 15, 2011 6:58 PM

am0n, Tuesday, 1 February 2011 18:30 (thirteen years ago) link

this is java servlet looking up filesystem information and printing it to screen so trivial to slap a table around the whole thing and a row around each key value pair. could use divs and spans, i guess and the alligned colons is really just a nicety.

the css zen garden thing is probably out of date now but they advocated css over using tables for layout, in fact they advocated (iirc) not constraining much at all - start specifying pixels and columns and it'll break the first time someone with bad eyesight hits the magnifier. just don't worry about it - it's hypertext, not a newspaper, let things be fluid and reflow if they want to. be water, my friend.

koogs, Tuesday, 1 February 2011 18:40 (thirteen years ago) link

Here's one: not making typos. I spent yesterday suffering through a 50+ minute long build process multiple times because I apparently can't type or read code very well (fortunately there weren't any bugs once I got the damned thing to compile, otherwise ugh)

Indolence Mission (DJP), Tuesday, 1 February 2011 20:30 (thirteen years ago) link

i cant build a computer out of sand :(

ice cr?m, Wednesday, 9 February 2011 21:29 (thirteen years ago) link

That's easy. You dope.

Les centimètres énigmatiques (snoball), Wednesday, 9 February 2011 23:50 (thirteen years ago) link

Isn't there a Temptations song about that?

James Tipitina, Jr. (James Redd and the Blecchs), Friday, 11 February 2011 03:57 (thirteen years ago) link

three months pass...

If I never again had to deal with web servers or third party libraries or building and deploying applications or any of that crap that isn't actually coding, i would be a happy happier man.

England's banh mi army (ledge), Tuesday, 17 May 2011 14:40 (twelve years ago) link

three weeks pass...

I don't get XML.

No, I mean, I get the basic structure of XML data, I get that it is a neat but inefficient cross-platform standard that should theoretically be easy to parse, but it's had all these extra layers of complications put on top like namespaces and DTDs and XSLT until it isn't easy to parse any more and you have to use a 3rd-party library that does it properly rather than trusting your code, and I don't even know what all this stuff is or what it does or why I want it.

But I'm going to have to learn, because our new database churns out giant bloated xml and xsl files with thousands of empty tags in where I used to just get a plain old CSV out of the old database.

sambal dalek (a passing spacecadet), Thursday, 9 June 2011 12:42 (twelve years ago) link

namespaces - yeah

dtds - well they came first, it's an sgml thing and xml is an sgml. but on the whole you don't need to bother with them

xslt - my favourite language for transforming xml to xml. pretty easy to get the basic hang of, hidden depths.

ledge, Thursday, 9 June 2011 12:48 (twelve years ago) link

xml is an sgml

xml is a subset of sgml, i mean, probably.

ledge, Thursday, 9 June 2011 12:48 (twelve years ago) link

Can you recommend a good book/website for learning the basics of xslt?

I thought I knew what a DTD was from my long-gone html monkey days, but it turns out that a DTD to an html monkey is "that thing you copy the link to off the w3c site so its validator gives you a nice green tick" and a DTD to me now is "one of the files you can't find and which may not exist anyway that your XML editor (which you don't even know how to work anyway) shouts at you repeatedly about"

sambal dalek (a passing spacecadet), Thursday, 9 June 2011 13:05 (twelve years ago) link

unless your xml actually has a dtd and absolutely needs to be valid, just use a text editor maaaaaaan. one with decent syntax highlighting (editplus!!!) should inform you of most well-formedness errors.

xslt, i normally go to the horses mouth http://www.w3.org/TR/xslt or the xslt faq http://www.dpawson.co.uk/xsl/sect2/sect21.html - might not be so helpful if you're starting from scratch though, i dunno i'm sure o'reilly will have something to help you out.

ledge, Thursday, 9 June 2011 13:10 (twelve years ago) link

Ah, I didn't know (though maybe I should've) that it was covered on w3.org. That looks helpful, thanks. And if it isn't, at least I'll have more idea of what I need from a book...

(adds EditPlus to the list of text editors to try now that I can't persuade someone else to pay for UltraEdit for me and TextPad keeps crashing)

sambal dalek (a passing spacecadet), Thursday, 9 June 2011 13:22 (twelve years ago) link

(<oblig vim mention>)

koogs, Thursday, 9 June 2011 14:59 (twelve years ago) link

if you can't use vim then that should go on this list too

caek, Thursday, 9 June 2011 15:01 (twelve years ago) link

"i can't use vim"

*awkward*

caek, Thursday, 9 June 2011 15:01 (twelve years ago) link

(vim is terrible at xml, especially large files with no newlines as the syntax highlighting makes the machine grind to a halt. there is a plugin that adds functionality like auto tag completion but it breaks other vim functionality (iirc the . repeats half of the last tag completion command or the paste buffer gets dirtied, something like that))

koogs, Thursday, 9 June 2011 15:16 (twelve years ago) link

but yes, xslt is almost fun. and often frustrating, especially if you are anal about whitespace in the output file

koogs, Thursday, 9 June 2011 15:17 (twelve years ago) link

vim: install snipmate and supertab = sorted.

caek, Thursday, 9 June 2011 16:00 (twelve years ago) link


You must be logged in to post. Please either login here, or if you are not registered, you may register here.