So, while going about my documenting of core2 the other day, I realized abruptly I had an obsession, and it was to write a function forcing the username under the userpic so I could stop having to write out the three div classes the latest one takes.

Okay, see, this has been a week of documentation adventures.

Hi, welcome to my geek! You may see a lot of this.



The thing is, I like organizing things. That's why I like coding. It's soothing and zen-inducing and it relaxes me. So I said I'd start working on the hierarchy tables for core2 and break down the layout pages so they didn't look like a special dark hell.

So that was like, early this week. I got Core 2 source, opened it, and started top to bottom taking it apart to organize it in a way that made it easier for the user (ie, me) to see a property in a simple function that's stuffed into a method of a class that's tossed into a layout with divs everywhere. I thought it would take a day or two to take everything apart, a day or two to put it in order, then I'd put it up and start adding explanations and documentation.

I greatly underestimated core2.

I made a folder, then started changing file names thematically, because I ran into two problems.

1.) The way I wanted to organize it was utterly, completely impossible.

2.) Hey, did you see how long that thing is? Weirdly, I did too and I still thought it would only take a day or two.

To give a bit more context, I currently have about eighty separate txt files for this split by class, function, and relationships. Yeah. I have no idea what I was thinking.

After a couple of days of thinking, I started just putting up things to see how they looked, and that's when I figured out how I wanted to organize it. The problem came up, however, when I realized that while I could understand what was going on, explaining it would be--unusual.

So this is going interestingly. It's incredibly fun, but it's also something I can't start working on unless I don't want to do anything else for the night, because once I start, I don't really--stop. For like, the bathroom.

We'll call this documentation farr.

Anyway, the current format is pretty much thus:

Hierarchy

First, a breakdown of Page:print() by function--this is the layout of your page. It's the one with HTML at the top. Then a breakdown of Page::print_entry(), which are the basis all the page entries. I was going to add the one that does the layout of comments--yes, that is separate, go figure--but I'm not entirely convinced these two should be on the same page yet, and there are several variations of the comments that probably need to go together.

This is where I came upon the problem I'd thought I could put off or give to someone else--that every function is made up of smaller functions, and those smaller functions are made up of properties and if statements. I can read them fine. But--example.

print_time function--that seems easy, right? It prints date and time on your DW. I thought, okay, lets follow thsi one back to its source.

Print Time Functions

You see how I was mildly disturbed. And I still need someone to explain how to use properties to set the type of time you want--short, medium, or long. I know it can be done. But even using the set function, I cannot figure out how. Which is why I coded mine directly onto the function.

Anyway, this isn't--let me repeat--isn't complete, nor does it explain anything really yet. Mostly, right now I'm organizing the information and trying to find the best way to introduce whoever reads it to what is going on. I learn by doing, literally, which means before I explain what anything does, I have to feel comfortable using it. And that means not only breaking it down, but being able to take it apart and write my own functions using it. I've found in general if I can't use it, there is no way I can make sense of it.

I have to admit, it's a lot easier to learn something like this. Granted, it's confusing, but I feel my sense of accomplishment when I work out how to set print_time from attributes and not go near the function at all will be spectacular.



Now my evening triumph--writing a function that works! You would think this wouldn't have taken as long as it did, but well, there you go.



First off, in my defense, I didn't know to prefix the function name with lay_ and two, I really didn't get the complex relationship between classes and functions until I was pulling apart core2 and realized that print_time appeared in three separate classes. Why, I wondered, would you do that? As it turns out, because print_time in User class and print_time in EntryLite are totally different.

I'd go into the horror that was realizing I couldn't easily mix and match functions from different classes, but we'll save that for another day when I'm not still flushed with triumph.

After a couple of days of frustration, I contacted [profile] avelah and isabeau, both of whom gave me clues to what was wrong--the class problem above, one, and two, the lay thing. And then, finally, after hours of frustration, I realized I'd declared incorrectly and then, boom.

So if anyone can use it, a quick and easy way to stack userpic on top of username, even with short names, which let me tell you, was kind of driving me nuts.

This can only be added to layout layers. I put my functions just below the layerinfo.

Function:
function Entry::lay_print_name_stack()
{
"""
    <div class=eidentity>""";
    """<div class="rightid">""";
    $this->print_userpic();
    """</div>""";
    """<div class="rightid">""";
    $this->print_poster();
    """</div>""";
    """</div>""";
}

This goes in Page::print_entry():

$e->lay_print_name_stack();


The CSS:


.eidentity {
    float:right;
    text-align:right;
    width: 150px;
    }
.rightid{
    float:right;
    text-align:right;
    width:150px;
    }	


For context, this is what I'm using on my flist with this:

"""<div class="eheader">""";
	 $e->lay_print_name_stack();
             """<div class="subject">""";
                $e->print_metatypes();
                $e->print_subject();
             """</div>""";
             """<div class="datetime">""";
                $e->print_time("long", "short");
             """</div>""";
"""</div>""";


To the left is subject, then date beneath it, and the far right is the userpic and username. Basically, I'm remaking my LJ flist style, as it is easy for me to read and follow along. Slowly.
ratcreature: Tech-Voodoo: RatCreature waves a dead chicken over a computer. (voodoo)

From: [personal profile] ratcreature Date: 2009-05-09 09:32 am (UTC)
Like 90% of this entry blurred for me in a "gah, code!" reaction (I mean, I can program a little bit, I just don't enjoy it much), but maybe you should just join the DW styles team. They make things easier for you, and in turn you could help them out by helping to make pretty styles?
brownbetty: (Default)

From: [personal profile] brownbetty Date: 2009-05-09 04:39 pm (UTC)
Oh my god, you are an amazing and sexy person.

Seriously, I now grasp perl 200% better.

I mean, my knowledge of perl is pretty miniscule, but you have expanded it!
brownbetty: (Default)

From: [personal profile] brownbetty Date: 2009-05-10 02:44 am (UTC)
Umm, it's either so you can reuse method names, or so that you don't have to load too many methods into memory. Or both. Would be my guess.

But python does this with classes, too, sort of. You should try python. It's so lovely, really. It's like learning Spanish after trying to learn French. Suddenly everything's easy.
brownbetty: (Default)

From: [personal profile] brownbetty Date: 2009-05-10 02:50 am (UTC)
No, no, the Archive is using Ruby. I never got the hang of Ruby.

Profile

seperis: (Default)
seperis

Tags

Quotes

  • If you don't send me feedback, I will sob uncontrollably for hours on end, until finally, in a fit of depression, I slash my wrists and bleed out on the bathroom floor. My death will be on your heads. Murderers
    . -- Unknown, on feedback
    BTS List
  • That's why he goes bad, you know -- all the good people hit him on the head or try to shoot him and constantly mistrust him, while there's this vast cohort of minions saying, We wouldn't hurt you, Lex, and we'll give you power and greatness and oh so much sex...
    Wow. That was scary. Lex is like Jesus in the desert.
    -- pricklyelf, on why Lex goes bad
    LJ
  • Obi-Wan has a sort of desperate, pathetic patience in this movie. You can just see it in his eyes: "My padawan is a psychopath, and no one will believe me; I'm barely keeping him under control and expect to wake up any night now to find him standing over my bed with a knife!"
    -- Teague, reviewing "Star Wars: Attack of the Clones"
    LJ
  • Beth: god, why do i have so many beads?
    Jenn: Because you are an addict.
    Jenn: There are twelve step programs for this.
    Beth: i dunno they'd work, might have to go straight for the electroshock.
    Jenn: I'm not sure that helps with bead addiction.
    Beth: i was thinking more to demagnitize my credit card.
    -- hwmitzy and seperis, on bead addiction
    AIM, 12/24/2003
  • I could rape a goat and it will DIE PRETTIER than they write.
    -- anonymous, on terrible writing
    AIM, 2/17/2004
  • In medical billing there is a diagnosis code for someone who commits suicide by sea anenemoe.
    -- silverkyst, on wtf
    AIM, 3/25/2004
  • Anonymous: sorry. i just wanted to tell you how much i liked you. i'd like to take this to a higher level if you're willing
    Eleveninches: By higher level I hope you mean email.
    -- eleveninches and anonymous, on things that are disturbing
    LJ, 4/2/2004
  • silverkyst: I need to not be taking molecular genetics.
    silverkyst: though, as a sidenote, I did learn how to eviscerate a fruit fly larvae by pulling it's mouth out by it's mouthparts today.
    silverkyst: I'm just nowhere near competent in the subject material to be taking it.
    Jenn: I'd like to thank you for that image.
    -- silverkyst and seperis, on more wtf
    AIM, 1/25/2005
  • You know, if obi-wan had just disciplined the boy *properly* we wouldn't be having these problems. Can't you just see yoda? "Take him in hand, you must. The true Force, you must show him."
    -- Issaro, on spanking Anakin in his formative years
    LJ, 3/15/2005
  • Aside from the fact that one person should never go near another with a penis, a bottle of body wash, and a hopeful expression...
    -- Summerfling, on shower sex
    LJ, 7/22/2005
  • It's weird, after you get used to the affection you get from a rabbit, it's like any other BDSM relationship. Only without the sex and hot chicks in leather corsets wielding floggers. You'll grow to like it.
    -- revelininsanity, on my relationship with my rabbit
    LJ, 2/7/2006
  • Smudged upon the near horizon, lapine shadows in the mist. Like a doomsday vision from Watership Down, the bunny intervention approaches.
    -- cpt_untouchable, on my addition of The Fourth Bunny
    LJ, 4/13/2006
  • Rule 3. Chemistry is kind of like bondage. Some people like it, some people like reading about or watching other people doing it, and a large number of people's reaction to actually doing the serious stuff is to recoil in horror.
    -- deadlychameleon, on class
    LJ, 9/1/2007
  • If imitation is the sincerest form of flattery, then Fan Fiction is John Cusack standing outside your house with a boombox.
    -- JRDSkinner, on fanfiction
    Twitter
  • I will unashamedly and unapologetically celebrate the joy and the warmth and the creativity of a community of people sharing something positive and beautiful and connective and if you don’t like it you are most welcome to very fuck off.
    -- Michael Sheen, on Good Omens fanfic
    Twitter
    , 6/19/2019
  • Adding for Mastodon.
    -- Jenn, traceback
    Fosstodon
    , 11/6/2022

Credit

November 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 2022
Page generated Jun. 2nd, 2025 07:53 pm
Powered by Dreamwidth Studios