I ran into errors when running tests for a Rails app using multiple databases. When testing, fixtures are automatically inserted into the primary database, and I was getting an error on an unused default fixture that was created when I built the model tied to the second database. Removing that fixture got my tests to pass...
More info here:
http://www.elctech.com/2007/3/8/using-and-testing-rails-with-multiple-databases
http://www.elctech.com/2007/5/30/using-and-testing-multiple-databases-in-rails-part-2
and on multiple databases in general:
http://wiki.rubyonrails.org/rails/pages/HowtoUseMultipleDatabases
http://wiki.rubyonrails.org/rails/pages/HowtoUseMultipleDatabasesWithFixtures
Tech Tidbits - Ruby, Ruby On Rails, Merb, .Net, Javascript, jQuery, Ajax, CSS...and other random bits and pieces.
Thursday, February 21, 2008
Tuesday, February 19, 2008
jQuery
I've been using the jQuery Javascript library a lot lately and it's definitely become my favorite library. (I've written four plugins in the last couple months to boot)
Here are a few links to useful jQuery resources.
jQuery: The Write Less, Do More, JavaScript Library
jQuery UI: Widgets, Components, and Interaction
Plugins - jQuery JavaScript Library
jQuery Blog
Learning jQuery
Visual jQuery
IBM developerWorks: Simplify Ajax development with jQuery
Here are a few links to useful jQuery resources.
jQuery: The Write Less, Do More, JavaScript Library
jQuery UI: Widgets, Components, and Interaction
Plugins - jQuery JavaScript Library
jQuery Blog
Learning jQuery
Visual jQuery
IBM developerWorks: Simplify Ajax development with jQuery
composite_primary_keys.gem
Ruby on Rails does not support composite primary keys and a legacy database I'm working with has lots of them...after a quick search I found this useful Gem:
Thursday, January 31, 2008
Wednesday, January 23, 2008
jQuery: Cookie Plugin
I've become a big fan of jQuery and have contributed two small plugins myself, so when it came time to switch to a library for cookie manipulation with Javascript (time to replace all that nasty inline JS code) my first choice was jQuery.
Not to be disappointed, I found that Klaus Hartl has written a very slim and useful Cookie Plugin for jQuery.
Here's a small page test using the jQuery Cookie plugin:
My jQuery cookie demo using jquery.cookie.js
Not to be disappointed, I found that Klaus Hartl has written a very slim and useful Cookie Plugin for jQuery.
Here's a small page test using the jQuery Cookie plugin:
<html>
<head>
<title>jquery cookie</title>
<script type="text/javascript" src="jquery-1.2.1.min.js"></script>
<script type="text/javascript" src="jquery.cookie.js"></script>
<script type="text/javascript">
$(function($) {
function displayMessage(msg) {
$('#message').html(msg).css({color: 'green'});
}
displayMessage('jQuery cookie plugin test');
$('#setSessionCookie').click(function() {
$.cookie('test', 'Hmmm, cookie');
displayMessage("Cookie 'test' has been set.");
});
$('#setCookie').click(function() {
$.cookie('test', 'Hmmm, cookie', { expires: 7 });
displayMessage("Cookie 'test' has been set and will expire in 7 days.");
});
$('#getCookie').click(function() {
displayMessage("The value of the cookie named 'test' is: " + $.cookie('test'));
});
$('#deleteCookie').click(function() {
$.cookie('test', null);
displayMessage("Cookie 'test' has been deleted.");
});
$('#testCookiesEnabled').click(function() {
$.cookie('testcookiesenabled', null);
$.cookie('testcookiesenabled', 'enabled');
if ($.cookie('testcookiesenabled')) {
displayMessage("Cookie: "+ $.cookie('testcookiesenabled'));
} else {
displayMessage("Cookies disabled");
$.cookie('testcookiesenabled', null);
}
});
});
</script>
</head>
<body>
<p><span id="message" style="forecolor: red;"></span>
<p><input type="button" id="testCookiesEnabled" value="Cookies enabled?"/></p>
<p><input type="button" id="setSessionCookie" value="Set session cookie"/></p>
<p><input type="button" id="setCookie" value="Set cookie expires in 7 days"/></p>
<p><input type="button" id="getCookie" value="Show cookie value"/></p>
<p><input type="button" id="deleteCookie" value="Delete the cookie"/></p>
</body>
</html>
My jQuery cookie demo using jquery.cookie.js
Monday, January 21, 2008
ASP.NET GridView - Header always bold
GridView uses a table and creates a <th> tag for the header, which will bold all the text generated by the GridView. Here's a simple solution:
Set a style:
And apply it to your GridView:
Set a style:
<style>
.GridViewHeaderStyle th {
font-weight: normal;
}
</style>
And apply it to your GridView:
<asp:GridView ID="grdSomeGrid" runat="server" CssClass="GridViewHeaderStyle">
...
</asp:GridView>
Subscribe to:
Posts (Atom)
About Me
- Doug Sparling
- Developer (Ruby on Rails, iOS), musician/composer, Buddhist, HSP, Vegan, Aspie.
Labels
- .NET (8)
- accordion (1)
- ActiveRecord (1)
- ajax (2)
- APT (1)
- apt-get (1)
- ASP (1)
- ASP.NET .NET (5)
- Audio (1)
- aws (1)
- Bash (1)
- bdd (1)
- C# (1)
- cache_fu (1)
- caching (1)
- DocBook (1)
- DOM (1)
- Eclipse (1)
- Excel (1)
- Firefox (1)
- gem (5)
- Gems (5)
- git (1)
- GridView (2)
- Hibernate (1)
- iBATIS (1)
- Java (9)
- javascript (9)
- javascript css (1)
- jQuery (4)
- jsspec (1)
- mdb2 (2)
- Merb (2)
- mongrel (2)
- mp3 (2)
- Music (2)
- MySQL (2)
- nginx (1)
- openssl (1)
- osx (3)
- pdocast (1)
- pear (2)
- Perl (7)
- php (5)
- plugin (2)
- podcast (1)
- prototype (1)
- REST (1)
- RMagick MacOSX (1)
- rspec (1)
- ruby (14)
- ruby on rails (21)
- RubyGems Merb (1)
- s3 (1)
- screencasts (1)
- scriptaculous (1)
- scriptrunner ruby rails erlang (1)
- Sortable (1)
- subversion (1)
- testing (1)
- testing erlang tsung (1)
- tomcat (1)
- ubuntu (2)
- WebSphere (1)
- will_paginate (1)