<?xml version='1.0' encoding='utf-8' ?>

<rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/' xmlns:atom10='http://www.w3.org/2005/Atom'>
<channel>
  <title>Dreamwidth Development Training</title>
  <link>https://dw-dev-training.dreamwidth.org/</link>
  <description>Dreamwidth Development Training - Dreamwidth Studios</description>
  <lastBuildDate>Fri, 15 Oct 2010 21:08:21 GMT</lastBuildDate>
  <generator>LiveJournal / Dreamwidth Studios</generator>
  <lj:journal>dw_dev_training</lj:journal>
  <lj:journaltype>community</lj:journaltype>
  <image>
    <url>https://v2.dreamwidth.org/92798/30813</url>
    <title>Dreamwidth Development Training</title>
    <link>https://dw-dev-training.dreamwidth.org/</link>
    <width>100</width>
    <height>100</height>
  </image>

<item>
  <guid isPermaLink='true'>https://dw-dev-training.dreamwidth.org/24419.html</guid>
  <pubDate>Fri, 15 Oct 2010 21:08:21 GMT</pubDate>
  <title>SQL data constraints.</title>
  <link>https://dw-dev-training.dreamwidth.org/24419.html</link>
  <description>Posted by: &lt;span lj:user=&apos;tyggerjai&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://tyggerjai.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://tyggerjai.dreamwidth.org/&apos;&gt;&lt;b&gt;tyggerjai&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;One of the fields in the db user table is set to only accept certain values. I need to add an acceptable value, preferably without dropping the entire table and rebuilding it. Any hints? There&apos;s probably an alter command....&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=dw_dev_training&amp;ditemid=24419&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://dw-dev-training.dreamwidth.org/24419.html</comments>
  <category>sql</category>
  <category>database</category>
  <lj:security>public</lj:security>
  <lj:poster>tyggerjai</lj:poster>
  <lj:reply-count>4</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://dw-dev-training.dreamwidth.org/23103.html</guid>
  <pubDate>Sun, 25 Jul 2010 09:08:27 GMT</pubDate>
  <title>Writing to the database through a Perl script in Dreamwidth, placeholders</title>
  <link>https://dw-dev-training.dreamwidth.org/23103.html</link>
  <description>Posted by: &lt;span lj:user=&apos;anarres&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://anarres.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://anarres.dreamwidth.org/&apos;&gt;&lt;b&gt;anarres&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In Dreamwidth you can interact with the database using Perl&apos;s DBI module, but with a few Dreamwidth-specific methods layered on top. I&apos;ve been trying to figure out how to write new rows to a database table. After looking at some other Dreamwidth scripts to see how it&apos;s done, I wrote the following script (which doesn&apos;t work):&lt;br /&gt;&lt;br /&gt;# -------------------- ~/dw/bin/dev/test.pl ----------------------------&lt;br /&gt;#!/usr/bin/perl&lt;br /&gt;&lt;br /&gt;use lib &quot;$ENV{LJHOME}/cgi-bin&quot;;&lt;br /&gt;require &apos;ljlib.pl&apos;;&lt;br /&gt;use strict;&lt;br /&gt;use warnings;&lt;br /&gt;&lt;br /&gt;my $cart = {&lt;br /&gt;    authcode =&amp;gt; &apos;blahblahblahblah&apos;,&lt;br /&gt;    userid =&amp;gt; 12,&lt;br /&gt;    cartid =&amp;gt; 33,&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;my $dbh = LJ::get_db_writer() or return undef;&lt;br /&gt;&lt;br /&gt;$dbh-&amp;gt;do(&lt;br /&gt;    q{INSERT INTO payments (userid, cartid) VALUES ( ?, ?)},&lt;br /&gt;      $cart-&amp;gt;{userid}, $cart-&amp;gt;{cartid} &lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;die &quot;Database error: &quot; . $dbh-&amp;gt;errstr . &quot;\n&quot; if $dbh-&amp;gt;err;&lt;br /&gt;# ---------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;The question marks are SQL placeholders, which prevent SQL injection attacks. &lt;br /&gt;&lt;br /&gt;When I ran this I got the error: &apos;DBI::db=HASH(0x426eff0)-&amp;gt;do(...): attribute parameter &apos;12&apos; is not a hash ref at test.pl line 22.&apos;&lt;br /&gt;&lt;br /&gt;It seemed to be complaining that $cart-&amp;gt;{userid} is not a hash ref. I had no idea why it would want a hash ref there, but I bemusedly decided to give it what it wanted, and replaced&lt;br /&gt;&lt;br /&gt;          $cart-&amp;gt;{userid}, $cart-&amp;gt;{cartid} &lt;br /&gt;&lt;br /&gt;with:&lt;br /&gt;&lt;br /&gt;          $cart, $cart&lt;br /&gt;&lt;br /&gt;Running the script again gave an SQL error instead of a Perl error: &apos;Database error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near &apos;)&apos; at line 2&apos;.&lt;br /&gt;&lt;br /&gt;So it seems like giving it a hash ref is the right thing to do, but I&apos;m giving it the wrong kind of hash ref. I&apos;m completely confused: what&apos;s the right syntax for inserting a row into the database?&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=dw_dev_training&amp;ditemid=23103&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://dw-dev-training.dreamwidth.org/23103.html</comments>
  <category>sql</category>
  <category>perl</category>
  <category>dbi</category>
  <category>database</category>
  <lj:security>public</lj:security>
  <lj:poster>anarres</lj:poster>
  <lj:reply-count>5</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://dw-dev-training.dreamwidth.org/16615.html</guid>
  <pubDate>Fri, 22 Jan 2010 18:38:04 GMT</pubDate>
  <title>Security and web programming</title>
  <link>https://dw-dev-training.dreamwidth.org/16615.html</link>
  <description>Posted by: &lt;span lj:user=&apos;pauamma&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://pauamma.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://pauamma.dreamwidth.org/&apos;&gt;&lt;b&gt;pauamma&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This is a good cover of common programming (or program design) mistakes that can cause security problems: &lt;a href=&quot;http://www.smashingmagazine.com/2010/01/14/web-security-primer-are-you-part-of-the-problem/&quot;&gt;http://www.smashingmagazine.com/2010/01/14/web-security-primer-are-you-part-of-the-problem/&lt;/a&gt; (it uses PHP in its examples, but you should be able to get the gist of it even if you&apos;re not familiar with the language)&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=dw_dev_training&amp;ditemid=16615&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://dw-dev-training.dreamwidth.org/16615.html</comments>
  <category>errors</category>
  <category>sql</category>
  <category>security</category>
  <category>design</category>
  <lj:security>public</lj:security>
  <lj:poster>pauamma</lj:poster>
  <lj:reply-count>3</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://dw-dev-training.dreamwidth.org/8964.html</guid>
  <pubDate>Sun, 23 Aug 2009 05:50:29 GMT</pubDate>
  <title>a guide to update-db-general.pl</title>
  <link>https://dw-dev-training.dreamwidth.org/8964.html</link>
  <description>Posted by: &lt;span lj:user=&apos;kareila&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://kareila.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://kareila.dreamwidth.org/&apos;&gt;&lt;b&gt;kareila&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://wiki.dwscoalition.org/notes/Adding_and_Removing_Database_Tables&quot;&gt;http://wiki.dwscoalition.org/notes/Adding_and_Removing_Database_Tables&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=dw_dev_training&amp;ditemid=8964&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://dw-dev-training.dreamwidth.org/8964.html</comments>
  <category>beginner guide</category>
  <category>tutorial: database</category>
  <category>wiki</category>
  <category>sql</category>
  <lj:security>public</lj:security>
  <lj:poster>kareila</lj:poster>
  <lj:reply-count>3</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://dw-dev-training.dreamwidth.org/6609.html</guid>
  <pubDate>Mon, 03 Aug 2009 04:39:03 GMT</pubDate>
  <title>Kareila&apos;s intro to database design</title>
  <link>https://dw-dev-training.dreamwidth.org/6609.html</link>
  <description>Posted by: &lt;span lj:user=&apos;kareila&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://kareila.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://kareila.dreamwidth.org/&apos;&gt;&lt;b&gt;kareila&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&apos;white-space: nowrap;&apos;&gt;&lt;a href=&apos;https://denise.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user_staff.png&apos; alt=&apos;[staff profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://denise.dreamwidth.org/&apos;&gt;&lt;b&gt;denise&lt;/b&gt;&lt;/a&gt;&lt;/span&gt; sez:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;i&gt;I&apos;d really like to see someone&apos;s thought processes while implementing something big/major that relies on working with DB stuff: what&apos;s the best practice bits that we just won&apos;t think about because we don&apos;t know enough? What sort of stuff should we do just because that&apos;s the best way to do it? Etc.&lt;/i&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;I am not a professional database designer, but I&apos;ve read a few books and learned my way around MySQL, so I&apos;ll try to share my thoughts by way of the spec I&apos;ve implemented for &lt;a href=&quot;http://bugs.dwscoalition.org/show_bug.cgi?id=215&quot;&gt;Bug 215: Implement v-gifts&lt;/a&gt;.  Fair warning: although &lt;a href=&quot;http://bugs.dwscoalition.org/attachment.cgi?id=1849&quot;&gt;that spec&lt;/a&gt; has benefited from one round of peer review, it hasn&apos;t been approved yet, so it &lt;s&gt;might&lt;/s&gt; will change again.&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;cut-wrapper&quot;&gt;&lt;span style=&quot;display: none;&quot; id=&quot;span-cuttag___1&quot; class=&quot;cuttag&quot;&gt;&lt;/span&gt;&lt;b class=&quot;cut-open&quot;&gt;(&amp;nbsp;&lt;/b&gt;&lt;b class=&quot;cut-text&quot;&gt;&lt;a href=&quot;https://dw-dev-training.dreamwidth.org/6609.html#cutid1&quot;&gt;Read more...&lt;/a&gt;&lt;/b&gt;&lt;b class=&quot;cut-close&quot;&gt;&amp;nbsp;)&lt;/b&gt;&lt;/span&gt;&lt;div style=&quot;display: none;&quot; id=&quot;div-cuttag___1&quot; aria-live=&quot;assertive&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=dw_dev_training&amp;ditemid=6609&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://dw-dev-training.dreamwidth.org/6609.html</comments>
  <category>sql</category>
  <category>beginner guide</category>
  <lj:security>public</lj:security>
  <lj:poster>kareila</lj:poster>
  <lj:reply-count>16</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://dw-dev-training.dreamwidth.org/5565.html</guid>
  <pubDate>Wed, 29 Jul 2009 13:13:01 GMT</pubDate>
  <title>Hello</title>
  <link>https://dw-dev-training.dreamwidth.org/5565.html</link>
  <description>Posted by: &lt;span lj:user=&apos;aphenine&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://aphenine.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://aphenine.dreamwidth.org/&apos;&gt;&lt;b&gt;aphenine&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Hello everybody!&lt;br /&gt;&lt;br /&gt;I got a dreamhack account a few days ago and I&apos;m trying to get my head around the Dreamwidth code base, in the hopes that I can contribute something.  I just thought I&apos;d introduce myself.  I was also going to ask a question, but someone lovely and unexpectedly answered it on LJ.  *grin*&lt;br /&gt;&lt;br /&gt;I&apos;ve never coded in Perl before, so it&apos;s a bit of a learning curve for me.  However, I have web coded in PHP before and I&apos;ve used MySQL before and I have also used *Nix environments before, so I&apos;m not starting totally from scratch.&lt;br /&gt;&lt;br /&gt;I think the dominant reason I signed up for a dreamhack account was that I kept looking at DW and thinking &quot;if it was simple, I could change that&quot;.  In the end, my curiosity got the better of me and I just had to find out if it really was simple or not.  Since then, I&apos;ve been far too amused sitting in the MySQL console pulling up a test comment and post directly from the database.  SELECT * FROM logtext2; has not lost its power to make me squee for the last few minutes.  But, a question.  No, two questions.  Why log for posts?  And why talk for comments?  &lt;br /&gt;&lt;br /&gt;So far the only thing I&apos;ve really contributed is an entry in the Dreamhack wiki giving an overview of some of the database tables.  It&apos;s found &lt;a href=&quot;http://wiki.dwscoalition.org/notes/Dev_Database_Table_Overview&quot;&gt;here&lt;/a&gt;.  It was in the wanted list and I thought, hey, what the hell.&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=dw_dev_training&amp;ditemid=5565&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://dw-dev-training.dreamwidth.org/5565.html</comments>
  <category>sql</category>
  <category>wiki</category>
  <category>introduction</category>
  <lj:security>public</lj:security>
  <lj:poster>aphenine</lj:poster>
  <lj:reply-count>11</lj:reply-count>
</item>
</channel>
</rss>
