Cartooney crab holding drink
[personal profile] pauamma
It's time for another question thread!

The rules:

- You may ask any dev-related question you have in a comment. (It doesn't even need to be about Dreamwidth, although if it involves a language/library/framework/database Dreamwidth doesn't use, you will probably get answers pointing that out and suggesting a better place to ask.)
- You may also answer any question, using the guidelines given in To Answer, Or Not To Answer.
Drawing: little girl peeking through blinds.
[personal profile] ninetydegrees
I've been getting mail from http://bugs.dwscoalition.org/ late for a few days. Like 24 hours later. Does anyone else have the same problem?

Edit: mystery solved.

Hooks

Dec. 3rd, 2011 05:32 pm
Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome
[staff profile] denise
This came up in the previous questions post, and it's confusing enough that I thought I'd bring it up to a top-level post: hooks, and what to do if you see something in there that uses one but you can't figure out where the hook is.

LiveJournal uses a lot of hooks to pull ljcom (their equivalent of dw-nonfree) data into livejournal (their equivalent of dw-free) without hardcoding ljcom-specific things into livejournal. You'll see them called like this:

LJ::Hooks::run_hook( "hook_name" );


(sometimes with some other parameters added, or as a variable assignment). Some of them are also used in dreamwidth code: sometimes the hooks that were already defined in the code were useful for our purposes, or we wanted to do the same kind of thing with dw-nonfree code that was being done with ljcom code -- you'll find those in cgi-bin/DW/Hooks. I'd say probably about 90% of the hooks that are tied into the code aren't actually defined in either dw-free or dw-nonfree, though, because we just haven't needed them yet.

So, if you see a hook defined in the code, but you grep the code and nothing turns up for the hook name except the line that calls it -- it's probably an old ljcom hook that we haven't started using yet. You can look at ljcom's cgi-bin/LJ/Hooks directory, if you really are curious about what the hook is meant to do, but since ljcom is not free software, you can't and shouldn't copy the hook directly.
Cartooney crab holding drink
[personal profile] pauamma
It's time for another question thread!

The rules:

- You may ask any dev-related question you have in a comment. (It doesn't even need to be about Dreamwidth, although if it involves a language/library/framework/database Dreamwidth doesn't use, you will probably get answers pointing that out and suggesting a better place to ask.)
- You may also answer any question, using the guidelines given in To Answer, Or Not To Answer.
A velociraptor mauling a programmer at their computer because they used a GOTO statement.
[personal profile] delladea
I've just begin the process of setting up my Dreamhack config according to the wiki. I've gotten to the point of updating my code to the latest version (as described in Dev Maintenance) and creating several test accounts.

No matter which account I'm logged into or what privs that account has, I cannot run console commands at all. Not even commands available to all accounts like ban-set. Every command gives an error message "There is no such command '<command-name>'." At this point, I haven't messed with any of the existing code.

How do I fix this?

Edit: Underscores! I was using dashes instead of underscores in the console commands and my brain didn't catch that. Solved. :D
Drawing: a girl's pale face, with a large yellow and green stripe over her right eye.
[personal profile] ninetydegrees
/htdocs/manage/profile/index.bml seems to have arbitrary character limits for some of the external usernames you can have in the 'Connect' section of the profile.

Skype, Delicious and Twitter have 40 but usernames can't be over 32, 32 and 15 characters respectively.

Last.fm has 255 but it's actually 15 for usernames and 60 for groups.

Is there a reason for this?

Also, Gizmo is now Gizmo5, which is no longer supported. Should it be kept anyway?
Segfault.
[personal profile] kjwcode
Hello, folks!

For those who don't know me, my name's kj (yes, that's what I go by in off-line life, too -- blame my mom!) and I do a bit of code review here and there. Well, did a bit. Recently I've been encouraged to do more of it, and I'm certainly up to it.

One of the things I really like about Dreamwidth is the welcoming nature of the project. Both old coders new to the project and new coders in general are welcomed with open arms, and frankly, there's just not enough of that these days. Being a new coder in general is especially hard because it's hard to tell if you're going in the right direction, and waiting a long time for someone to look over your work, test it, give feedback, and put it up for commit can really slow one down when you're learning. Uncertainty is possibly the most difficult part of learning.

One way I'd like to help with that is to pay extra-special attention to the needs of newer coders and other people (who are, like me) new to the project. If you'd like me to review your code, feel free to ask; via e-mail, in IRC (#dreamwidth-dev on Freenode), or by Cc:ing me specifically on the bug, and I'll get to it as soon as I'm able. I can't make any promises on wait time (I've got a day job, a fiancée, a teenager, and a dog!), but I'll do my best to make it happen as soon as I can.
Cartooney crab holding drink
[personal profile] pauamma
It's time for another question thread!

The rules:

- You may ask any dev-related question you have in a comment. (It doesn't even need to be about Dreamwidth, although if it involves a language/library/framework/database Dreamwidth doesn't use, you will probably get answers pointing that out and suggesting a better place to ask.)
- You may also answer any question, using the guidelines given in To Answer, Or Not To Answer.
"There are only two mistakes one can make along the road to truth: not going all the way and not starting"
[personal profile] v_angelique
I'm kind of terrified that this question has been asked and I'm going to have bananas thrown at me, but I couldn't find it and I'm feeling discouraged on my second try at the great hulking thing which is Understanding Dreamwidth Development. So if this is repetitive, please point me at the appropriate post and pardon me.

I assigned myself a minor effort bug that looked do-able, namely a request to add a give access link to the e-mail that goes out when a new person has subscribed to you. The problem is, I can't for the life of me find the code that deals with e-mail notifications. I tried the trick that's described in the wiki where you can search for a term, but I didn't find what I was looking for. Nor was I able to browse the code. So I'm pretty stuck. Would anyone be willing to at least give me a directory to start from for looking for this file? Once I find it, I feel pretty comfortable I can handle the coding end. I'm just so used to downloading entire sites to my machine via FTP, editing in TextWrangler, and re-uploading to the server that this Terminal/nano thing has me spooked.
Cartooney crab holding drink
[personal profile] pauamma
I just came across To Answer, Or Not To Answer. The gist of it is: someone asked "Should I answer a perl question when I'm not sure of the answer or when I can only answer part of the question?" and got overwhelming "yes" answers (and very good suggestions on how to handle uncertainty), because even if your answer doesn't help the person asking, researching your answer (and thinking about the question) may well help you. So as an experiment, I'd like to try something similar in this entry:

- You may ask any dev-related question you have in a comment. (It doesn't even need to be about Dreamwidth, although if it involves a language/library/framework/database Dreamwidth doesn't use, you will probably get answers pointing that out and suggesting a better place to ask.)
- You may also answer any question, using the guidelines given in the discussion I linked to above.

If this works, I'll try to make it a regular feature of this community. (How often should it happen?)
"PERL!"
[personal profile] kareila
http://bugs.dwscoalition.org/show_bug.cgi?id=2159

First problem: how to generate the image.

No idea. How do comment counts do it?

To answer that question, I will load the dw-free change history into
my text editor to find the relevant code. A [site community profile] changelog search might also
work for this.

(All commands assume execution at the top level of dw-free.)

hg log -v -r 1: | bbedit

Looks like the relevant file is htdocs/tools/commentcount.bml, according
to the original bugfix from Allen. But that file isn't there! Searching
further, it becomes apparent that Dre moved this to a controller in the
course of her crusade to slay BML.

bbedit cgi-bin/DW/Controller/CommentCount.pm

Not much code! Most of it is using Image::Magick methods. The only
non-obvious parameter is the size of the image - how big should it be
for our text? We will have to use trial and error.

What should our arguments be? Comment count uses user and ditemid, the
necessary information to figure out which entry is referenced. For our
image, we should only need the text of the invite code itself.

Hmm. Since we only have two states to communicate, used and available,
maybe instead of using dynamic text like comment count does, we should
use icons - perhaps a green check mark for available, a red stop sign
for used. This has the advantage of not requiring the viewer to
understand English.

open htdocs/img/silk/site/tick.png
open htdocs/img/silk/comments/delete.png

Those are pretty close! Let's see if we can figure out how to return
those images as responses, instead of using Image::Magick. I think the
best way to do this is to redirect the request to the URL of the image,
and use HTTP headers to tell the browser how long to cache it.

Once an invite code is used, it will never revert to being unused. We may
be able to reduce the computation needed for this feature by extending the
cache period once the code activation is detected. On second thought, though,
this may not be true for promo codes, and our tool will work for those too.

Time to decide on the name of our controller and the site URL that will be
used to point to the dynamic image. Once we make those decisions, the new
controller can be written and tested independent of any other work that needs
to be done for this bug. We'll also need to consult DW::InviteCodes for the
function that tells us whether a code has already been used or not.

The actual code as described above doesn't take long to write. Unfortunately,
the name of the source image is advertised to the end user because we used
a redirect. But since the images are intended to be embedded in a page,
the redirection shouldn't be obvious in normal use conditions.

You can read through the resulting patch here:
http://bugs.dwscoalition.org/attachment.cgi?id=5472

Let me know if anything I wrote needs further explanation. :)
Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome
[staff profile] denise
For the wiki, I'd like to build a list of "things we have learned where to look for" -- like, "I want to change this thing. Where in the code would i find it?"

Some examples of what I mean, quick 'cause my brain's melting:

text string on page $foo --> in $foo.text or in ~/bin/upgrading/en.dat
styles --> ~/bin/upgrading/s2layers
all the routines that make html controls --> ~/cgi-bin/htmlcontrols.pl
control strip --> ~/cgi-bin/weblib.pl

Stuff like that! What should be on that list?
Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome
[staff profile] denise
In the past, some people have done walkthroughs of their process for fixing and testing bugs. I personally find them really helpful, and I hope that my own walkthroughs have been reasonably helpful in turn!

This month I'd like to ask you all to consider writing a walkthrough for at least one bug you patch. Even if you're an absolute beginner, even if you got totally lost while working on the bug, even if you think you did it all wrong and nobody could possibly learn from you, please consider doing a writeup anyway.

The reason for this is: there are tons of different styles and approaches. How you approach fixing a bug is incredibly individualist, and depends on a lot of things including your experience level, your comfort level, the way your brain works, the kinds of things you find logical and reasonable, and sometimes even who's around in irc or in this community when you ask!

Because none of us are exactly alike, our beginner documentation can address some of the approaches, but not all of them. If your brain works really differently from the way mine does, for instance, you'll approach a problem totally differently. And Nell Newbie who comes in next month may think more like you do than I do, and might find your walkthrough more helpful than mine.

If you made mistakes, meanwhile, don't worry about that, or think that it reflects badly on you. First off, nobody gets things 100% right on the first try every time -- that's why we have code review. Second, showing people with less thorough self-confidence, or who are frightened that they will do something wrong or break DW or something, that everybody makes mistakes and making mistakes is something we expect as part of the learning process, will do a lot of good. (I can't count the number of times newcomers to programming, not just newcomers to DW development, have told me that seeing me making visible and common mistakes helped them have the courage to get started!)

So, for the month of September, for every bug-patching walkthrough (similar to the ones already in the comm) I will give either one month of paid time (to an account of your choice) or 30 DW points (the equivalent cost). The walkthrough does have to be for a bug you patched, or are in the process of patching -- no walking through a bug you haven't taken, or don't plan on patching, but just want to write up as an interesting theoretical exercise. (I'm most interested in seeing your actual workflow, with your actual pitfalls and false starts and moments where it all clicked together.) The patch does not need to have been reviewed yet -- like your high school math teacher might've told you, this isn't about whether you got the answer right, it's showing your work for how you got the answer.

And please be sure to use the 'walkthrough' tag when you post it!
Dreamwidth: Dream wide, dream deep
[personal profile] rb
I have been poking around at bug 3893 because it looked really simple, but in doing so I realised that it needs skills I don't have (i.e.: being able to use a graphics editor!) so I can't complete it. But it did take a fair bit of poking around to discover that the file that needs to be edited seems to be $LJHOME/htdocs/stc/fck/editor/plugins/livejournal/ljuser.gif.

I'm wondering if I should toss a comment on the bug in bugzilla saying "Hey I think that this is the file that needs editing" or whether I should just leave it alone.

The thing that makes me most nervous about putting things on Bugzilla is every time I do something it shows me this huge list of email addresses and says it's notified them all. I don't want to interrupt important hacking just to make a comment about something. I especially don'tt want to do that when my comment might be (a) wrong, (b) irrelevant, or (c) totally obvious and therefore redundant to anybody else who's likely to try and hack at it!

Posting to communities or IRC or IM is heaps easier because I know that's not going to totally spam people and it'll just be easily ignored by anybody who isn't interested. Can somebody point me in the right direction?

I hate that I'm so overawed and intimidated by this hacking stuff - I know both [staff profile] denise and [staff profile] fu and a bunch of other coders have reassured me that I don't need to be but for some reason it's this huge enormous psychological hurdle where I am feeling almost paralysed with terror :(
Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome
[staff profile] denise
Stanford is putting its Intro to Databases course online, free, from 10 Oct to 12 Dec (cute, guys, really cute, even if .01% of your audience would get it... )

They're also offering Machine Learning and Intro to AI.
Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome
[staff profile] denise
(Can you tell I've been coding lately? Like the last four posts here have been from me ...)

I was talking with [personal profile] rb this evening about useful scripts I have put together for my dreamhack -- some of which I came up with myself, and some of which I stole from other people, such as [staff profile] mark -- and figured it would be a good idea to post them and ask everybody else to post their own useful scripts!

(If you want to install these to your own 'hack, put them in ~/bin and then chmod +x filename to make them executable.)

my scripts, and what they do )

So, what other useful scripts do you have?
Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome
[staff profile] denise
...like me, and have spent time tearing your hair out over "Global symbol $foo requires strict checking"-type errors and have occasionally been reduced to finding sections of code that do something like what you want to and copying them, I come bearing tutorials:

Coping with Scoping

It made so much suddenly make sense.

Profile

The stylised 'd', with the word 'dev' above, and the word 'training' at the side, representing the dw_dev_training comm.
Dreamwidth Development Training

January 2012

S M T W T F S
123 4567
891011121314
15161718192021
22232425262728
293031    

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Style:
[personal profile] branchandroot
Resources:
On the Down Low

Expand Cut Tags

No cut tags
Page generated Jan. 28th, 2012 09:46 pm
Powered by Dreamwidth Studios