This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- mssql 2000 | |
SELECT db_name(dbid), * | |
FROM master.dbo.sysaltfiles | |
ORDER BY size DESC | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- mssql 2005 and above (untested) | |
SELECT db_name(database_id) database_name, * | |
FROM sys.master_files | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# before the work-around | |
class Widget | |
end | |
# after the work-around | |
require 'base64' | |
class Widget | |
# override the rails attribute (getter) | |
def name | |
Base64::decode64(self[:name]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CreateWidgets < ActiveRecord::Migration | |
def self.up | |
create_table :widgets do |t| | |
t.string :name, :limit => 255, :null => false | |
t.timestamps | |
end | |
end | |
def self.down | |
drop_table :widgets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this worked as expected on mysql | |
# on postgresql it created a new widget with id of 0 | |
def some_method | |
widget = Widget.find_or_initialize_by_id(params[:widget_id]) | |
# ... | |
end | |
# workaround code for postgresql | |
def some_method | |
widget = Widget.find_or_initialize_by_id(params[:widget_id]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
directory="/home/YOUR_USER_NAME/projects/YOUR_PROJECT_DIR/trunk" | |
command="script/server" | |
title_dev="Dev_Trunk" | |
title_running="Running_Trunk" | |
profile2="P2" | |
firefox_profile="p2" | |
clear | |
echo "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ln -s /home/YOUR_USER_NAME/scripts/launch_YOUR_PROJECT.sh launch_YOUR_PROJECT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXEC dbo.sp_help_job @execution_status = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
helper :all # include all helpers, all the time | |
# ... | |
rescue_from Exception, :with => :handler_exception | |
# ... | |
def handler_exception(exception) | |
if request.xhr? then | |
message = "Error: #{exception.class.to_s}" | |
message += " in #{request.parameters['controller'].camelize}Controller" if request.parameters['controller'] |
OlderNewer