svn Locking Cheat Sheet

Posted by admin, Sun Jun 29 10:09:00 UTC 2008


svn update

Run from the top of the project in order to work in a holistic manner.

This gets you the newest version before you try to lock the file.

Locking will fail unless you already have the newest version.

svn lock doc/tasks.xls -m "Marking another task M42 done."

This locks the file.

svn commit -m "Marked M42 done." doc/tasks.xls

Note that commit releases your lock!

svn unlock doc/tasks.xls

unlock is for those times you need to release the lock without committing

svn info svn://bendyco.de/musicians_connect/trunk/musicians_connect/doc/tasks.xls

shows who has the file locked & their comment.

svn info doc/tasks.xls only shows your locally cached information, and will thus miss the other person’s locks.

svn status -u doc/tasks.xls

Will show an ‘O’ status if tasks.xls is locked by “other”.

svn unlock --force svn://bendyco.de/musicians_connect/trunk/musicians_connect/doc/tasks.xls

Unlocks the file if the other person accidentally left it locked.

If you need to do this, definitely email the other person.

This isn’t so bad though, it just leaves the second person with a merge conflict to resolve & merge conflicts are pretty easy to learn to deal with.

svn lock --force doc/tasks.xls

Unlocks the file as above, but also locks it for yourself in a single, atomic operation.

Administration

svn propset svn:needs-lock true tasks.xls

Sets the svn:needs-lock property for the non-text file that needs locking. The svn client will then try to use permissions to keep users from altering the file without locking it first.

1228 comments | Filed Under: Cheat Sheets Home | Tags: locking subversion svn

Learning Ruby & Rails Resources

Posted by stephen, Sun Mar 23 15:54:00 UTC 2008

Here are some good, and interesting resources for learning Ruby and Rails. I was just going to send an email to a co-worker with this information, but decided the information would serve more efficiently as a blog entry where it can grow over time, be maintained and re-used.

Learning Ruby

Learning Rails

Any book that has a PDF option is definitely worth considering. PDF’s are extremely portable, allow you to receive errata fixes and may give a discount for buying the next edition when it is released.

8 comments | Filed Under: Home Rails | Tags: Books Rails ruby Ruby Tutorials

How To Run Rails1.2.6 Despite Having Rails2.0.x Installed

Posted by stephen, Sat Jan 05 23:30:00 UTC 2008

In order to run a rails app in Rails 1.2.6 despite having Rails2.0.x installed, just run this from within the application folder:

rake rails:freeze:edge TAG=rel_1-2-6

That will put Rails 1.2.6 in your vendor directory and your project will use that by default.


When the above command is run, you will get an error regarding ActiveResource.

I was able to determine that ActiveResource was the last gem it tried to freeze and it appears OK to simply ignore this error.

You could edit the code that bombed to remove reference to ActiveResource, but that could have bad consequences when you later try to freeze to a Rails2.x version.

10 comments | Filed Under: Home Rails Working Notes | Tags: freeze Rails

Quick Article Writing Howto

Posted by stephen, Sat Jan 05 19:09:00 UTC 2008

Adding an Article

  1. Go to http://boydcountyconnections.com/admin, http://kukibear.com/admin, http://shereeandpaulsadventures.com/admin.
  2. Click on the “Articles” tab.
  3. If the “Title” and “Write your article” fields are not present and blank, then click on the “Create new article” link
  4. Type your article’s title in the “Title” field
  5. Type the body of your article in the “Write your article” field. You may want to convince me to write an article on how to format your article next.
  6. Click the “Add an excerpt” link that sits right next to to “Write your article”. This will cause a new “Excerpt” field to appear.
  7. Write a quick and simple summary, teaser, or executive summary in the Excerpt field. Basically this excerpt will appear next to your article title whenever the reader is looking at a list of blog articles you have written.
  8. Select which sections your article shows up in by checking section checkboxes in the “Publish in these sections” area in the column to the right of your article.
  9. Enter some tags in the “Tags” field underneath “Write your article”. Tags are basically key words or phrases that your readers can browse, click on, and see a list of all articles “tagged” with that keyword. For example, if your article is about selling Chilean empanadas and swedish tea rings at a bake sale to raise money for global warming, and how Al Gore was there and bought them all, then your tags might be: “global warming, charity, Al Gore, bake sale, empanadas, swedish tea rings, chilean food, swedish food”

Saving

You can (and should!) save intermittently before you are finished without fear of readers seeing your rough draft, or incomplete thoughts simply by keeping the “Save as Draft?” checkbox checked for all saves until you are ready to save with it unchecked for others to read.

You save the first time by clicking on the “Save Article” button.

For all subsequent saves, you have a choice:
“Apply Changes” saves a new version as part of the version history, allowing you to see versions of your article, or even roll back changes.
“Save without Revision” saves your current version by overwriting the previous version.

If you are unsure which button to push, then choose “Apply Changes”. Keeping a version history is pretty harmless, and is occassionally very useful.

As soon as you have saved with “Save as Draft?” unchecked, the article is visible to the world.

Since your blog is new, send some emails to anyone who would be interested in reading and commenting on what you wrote.

3232 comments | Filed Under: Family Domains Home | Tags: family domains howto mephisto textile

Reducing Memory Swapping on 256MB VPS

Posted by stephen, Fri Jan 04 22:35:00 UTC 2008

Since my VPS at slicehost is currently only 256MB my naive rails stack was causing swapping. I’m looking into reducing the memory usage of some of the components running on the slice before starting to pay more.

Here are my working notes:

Some work with free and top quickly showed me that mysql was using a significant portion of the available memory, and kicking a practically idle slice into using some of the swap space.

Before looking at free and top, I had been suspecting that the swap usage was the result of uploading images that were simply very large. This might still kick us over into swap usage. I’ll have to check, but first things first – mysql was crossing the line while idle!

Emergent Properties had a blog entry titled Optimizing Apache and MySQL for Low Memory Usage, Part 2 where mysql configuration settings is well explained. For now, I’m going to start by adjusting only The Key Buffer.

Running show status in mysql after using my sites for a while revealed the following information about use of the key buffer:

Key_blocks_not_flushed 0
Key_blocks_unused 13396
Key_blocks_used 3
Key_read_requests 27
Key_reads 30
Key_write_requests 57
Key_writes 30

3 Key_blocks_used out of 13399 total key blocks would appear to show I can safely lower this number.

For now, I’m going to change the following entries in /etc/mysql/my.conf:

key_buffer = 8M # instead of 16M
max_allowed_packet = 8M # instead of 16M
query_cache_size = 8M # instead of 16M

I also tried uncommenting skip-innodb in the same file, but when I did so and restarted mysqld, this broke my POP passwords that are stored encrypted in the database. Since a comment in the file says: ”# You might want to disable InnoDB to shrink the mysqld process by circa 100MB”, I then tried reducing the InnoDB memory usage as follows:

  1. Set buffer pool size to 50-80% of your computer’s memory
    innodb_buffer_pool_size=35M
    innodb_additional_mem_pool_size=5M

These InnoDB changes caused mysqld to use more memory than before, so I backed them out.


Next I looked into mongrel memory usage. I quickly came to think that mongrel memory usage is really your rails app memory usage.

Here are a list of mephisto memory usage links:

Here’s a slicehost specific article on reducing mysql memory usage.

Following all the changes except for skip-innodb saved just 9 MB. Also turning off innodb saved most of the memory usage.

Again, it looks like InnoDB is the primary culprit.


Next morning – this is what I did:

  • uncommented skip-innodb in /etc/mysql/mysql.cnf
  • sudo mysqldump—all-databases > ~/mysql.dump
  • cp ~/mysql.dump ~/mysql.altered
  • vi ~/mysql.altered
    • replaced instances of ENGINE=InnoDB with ENGINE=MyISAM. Be careful, there was one line of mysql help content that should not be changed.
    • added SET AUTOCOMMIT = 0;
      SET FOREIGN_KEY_CHECKS=0;
      to the top of the file.
    • added SET FOREIGN_KEY_CHECKS = 1;
      COMMIT;
      SET AUTOCOMMIT = 1;
      to the bottom of the file.
  • sudo mysql -u -p < ~/mysql.altered | tee /tmp/x
  • sudo /etc/init.d/mysql restart
  • I also stepped down to a single mongrel_rails instance serving mephisto

Before reboot, I had been as high as using 106M of swap space.

After reboot, before causing activity, I’m using all by 2M of my regular RAM, but none of the swap space

After causing some mild mephist activity, it’s still the same. No swap space being used!

W00t!


Current free reading:

stephen@bendycodeslice:~$ free
             total       used       free     shared    buffers     cached
Mem:           254        251          3          0          3         66
-/+ buffers/cache:        181         73
Swap:          511          0        511

Current top output:

top - 10:08:17 up 22 min,  2 users,  load average: 0.00, 0.01, 0.06
Tasks:  83 total,   2 running,  81 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni, 99.8%id,  0.0%wa,  0.0%hi,  0.0%si,  0.2%st
Mem:    260864k total,   258016k used,     2848k free,     4056k buffers
Swap:   524280k total,        0k used,   524280k free,    66664k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND           
 2014 root      16   0  157m  56m 3116 S    0 22.2   0:04.62 mongrel_rails      
 1908 clamav    25   0 92804  44m  572 S    0 17.5   3:20.42 clamd              
 1801 amavis    18   0 89964  33m 1704 S    0 13.2   0:00.01 amavisd-new        
 1802 amavis    18   0 89964  33m 1684 S    0 13.2   0:00.00 amavisd-new        
 1787 amavis    16   0 88980  34m 2256 S    0 13.4   0:00.03 amavisd-new        
 2194 root      18   0 63620  980  348 S    0  0.4   0:00.00 svnserve           
 2186 root      16   0 61460 3188 2432 S    0  1.2   0:00.00 dovecot-auth       
 2193 root      16   0 57284 3312 2568 S    0  1.3   0:00.00 dovecot-auth       
 1851 mysql     16   0 49112 6592 4752 S    0  2.5   0:00.07 mysqld             
 2225 root      15   0 48276 2616 2080 S    0  1.0   0:00.01 sshd               

1842 comments | Filed Under: Home Site Administration Working Notes | Tags: free ImageScience InnoDB memory usage mephisto mongrel mysql RMagick slicehost swap top

This Site Is Still Experimental

Posted by stephen, Fri Jan 04 21:11:00 UTC 2008

Please note that my usage of this site is still very focused on playing with the tools, not the content.

Currently, I’m playing with looking at the ramifications of configuring the different pieces to use less memory, and seeing how that works out, before simply increasing the size of my slice at slicehost.

10 comments | Filed Under: Home Site Administration | Tags: slicehost

Multi Site Mephisto

Posted by stephen, Tue Dec 25 18:56:00 UTC 2007

It seems a little slow, but we’ll see. Perhaps I mucked with some setting in order to debug it earlier today. I’ll have to go back and check…

Gio is writing her first blog entry for her blog right now.

We had to go with her second choice for a theme. beautiful-day didn’t work right away, and I didn’t have time to look into it yet.

For my Dad, I was thinking there was a choice between red and blue in the lucid theme. Perhaps there was a setting in one of the layout files..

0 comments | Filed Under: Family Domains Home Site Administration | Tags: dad gio mephisto

Christmas Presents

Posted by stephen, Mon Dec 24 15:04:00 UTC 2007

As a Christmas present, I’m giving family members a domain name of their choice, a blog server and a photo gallery.

I’m looking a tableau and gullery as the photo galleries, and Mephisto as the blog engine.

As I’m writing this, Mephisto is up and running in single site mode behind nginx.

Next steps:

  • multi site serving
  • making sure mephisto keeps running after a reboot
  • adding ssl in front of nginx
  • getting alternate themes working in Mephisto

10 comments | Filed Under: Family Domains Home Site Administration | Tags: gullery mephisto nginx virtual hosts