Difference between revisions of "Developer Tips"

From Dreamwidth Notes
Jump to: navigation, search
m (better English)
 
(One intermediate revision by one other user not shown)
Line 57: Line 57:
 
There are some oddities to the ways static text are handled, due to the [[:Category: Translation|translation]] system. See [[English-stripping]] for details: in short, when changing the value of a string in a '''.text''' file, you also need to change the string ''name''.
 
There are some oddities to the ways static text are handled, due to the [[:Category: Translation|translation]] system. See [[English-stripping]] for details: in short, when changing the value of a string in a '''.text''' file, you also need to change the string ''name''.
  
== Receiving mail notifications on DreamHack ==
+
== Receiving mail notifications on a Dreamhack ==
  
By default mail service on you DreamHack server is turned off. The most simple way to read you mail notification is to read it from mail queue: <code>~/dw/var/taskqueue/dw-task-sendemail</code>. It is <code>base64</code>-encoded. You should use <code>base64 -d</code> to decode it.
+
By default, the mail service on your Dreamhack server is turned off. The simplest way to read the mail notifications generated by the site is to examine its mail queue directly: <code>~/dw/var/taskqueue/dw-task-sendemail</code>. The data is base64-encoded, so you should use <code>base64 -d</code> to decode it.
  
You can also use following command to print most recent notification mail on console:
+
For example, the following command will print the most recent notification mail to the console:
  
 
<source lang=bash>
 
<source lang=bash>
Line 67: Line 67:
 
</source>
 
</source>
  
== Confirming e-mail and creating community on DreamHack==
+
== Confirming email and creating communities on a Dreamhack ==
  
To create community on a DreamHack, you have to have a confirmed e-mail address. Since e-mail service is not configured on DreamHack by default, you can't receive confirmation e-mail in normal way. But you can read it from DW' mail pool as described [[Developer_Tips#Receiving_mail_notifications_on_DreamHack|above]]. Then you will be able to create community.  
+
To create a community on a Dreamhack, you have to have a confirmed email address. Since the mail service on your Dreamhack is not configured, the confirmation email generated by the site will not be delivered as one would expect. However, you can read it directly from the mail queue as described [[Developer_Tips#Receiving_mail_notifications_on_a_Dreamhack|above]]. Once you have retrieved the confirmation link from the unsent message, then you will be able to proceed with creating a community or any other site features that require an account's email address to be confirmed.
  
<hr>
 
  
 +
<br><br><hr>
 
{{MoreInfo}}
 
{{MoreInfo}}
  
 
[[Category: Development]]
 
[[Category: Development]]

Latest revision as of 15:48, 4 November 2022

Showing Whitespace

Dreamwidth does not want tabs or trailing whitespace, as per the Dev Programming Guidelines. These two tips can help you check out your patch before submission for these flaws.

In vim, you can show whitespace with the command

:set list

You can also use cat -et.

Error Messages

In .bml files, if you get an error message with a line number, the line numbering starts from the beginning of the code block, not from the beginning of the file.

The Daily Snapshot

Even if you don't use a Dreamhack for your development, the Dreamhack service can still help, because one of the Dreamhacks on the service is special - it's a live, always-running daily snapshot of the Dreamwidth code which is automatically reinstalled each day at 12:30am GMT. If you ever need to test something on a clean installation of the code, and don't require SSH access, you can use the Daily Snapshot at:

http://www.daily.hack.dreamwidth.net/

Feel free to make whatever changes you like; the 'hack is automatically reinstalled each day, so none of your changes will last long. (Similarly, if you find that someone else has messed with the installation enough for it to be unuseable for your purpose, you can simply wait a day and it'll be back to normal.)

Some notes about the service:

  • Invite codes are turned off. You can create a new account by clicking "Create Account" in the Create menu.
  • The password for the 'system' account is 'system'. Please don't change this unless you're testing something specifically related to that. (If you are, then be aware that the password, like everything else, will revert back to 'system' on the next reinstall.)
  • If the Daily Snapshot is ever down, check if it's just after 12:30am GMT. If so, it's probably in the middle of reinstalling - try again in a few minutes. Otherwise, there's either a bug in the codebase that's preventing Apache from starting, or something about the installation has changed that [info]mark hasn't adjusted the Dreamhack installation script for. Let him know. :)

Otherwise, go wild. :)

Saving Keystrokes

Most editors have ways of autocompleting the things you commonly need to type, either built-in or via plugins. One of the more well-known plugins is Emmet, aka Zen Coding. It's available for almost any editor, and is designed to let you enter complicated HTML or CSS expressions with a minimal number of keystrokes. For instance, entering this:

ul.img-list>li*3>a>img

...and then hitting the Zen Coding "expand" key combo gives you this:

<ul class="img-list">
    <li>
        <a href=""><img src="" alt="" /></a>
    </li>
    <li>
        <a href=""><img src="" alt="" /></a>
    </li>
    <li>
        <a href=""><img src="" alt="" /></a>
    </li>
</ul>

Working with text strings

There are some oddities to the ways static text are handled, due to the translation system. See English-stripping for details: in short, when changing the value of a string in a .text file, you also need to change the string name.

Receiving mail notifications on a Dreamhack

By default, the mail service on your Dreamhack server is turned off. The simplest way to read the mail notifications generated by the site is to examine its mail queue directly: ~/dw/var/taskqueue/dw-task-sendemail. The data is base64-encoded, so you should use base64 -d to decode it.

For example, the following command will print the most recent notification mail to the console:

cd ~/dw/var/taskqueue/dw-task-sendemail; base64 -d `ls -t | head -n1`

Confirming email and creating communities on a Dreamhack

To create a community on a Dreamhack, you have to have a confirmed email address. Since the mail service on your Dreamhack is not configured, the confirmation email generated by the site will not be delivered as one would expect. However, you can read it directly from the mail queue as described above. Once you have retrieved the confirmation link from the unsent message, then you will be able to proceed with creating a community or any other site features that require an account's email address to be confirmed.





This article could really use expansion. If you have information to add, please edit this page!