this guide will add 5.1 speaker simulation using headphone for foobar2k
the result isn't really perfect but it's noticeably increase surround effect and reduce sound inside head feels..
needed files:
- foobar2k http://www.foobar2000.org/download
- foo_input_dts http://www.foobar2000.org/components/view/foo_input_dts
- foo_channel_mixer http://skipyrich.com/wiki/Foobar2000:Channel_Mixer
- nvidia purevideo decoder http://www.nvidia.com/object/dvd_decoder_1.02-223-trial.html
step:
- install nvidia purevideo decoder, use the trial CC and activation code in the site
- install foobar
- copy foo_input_dts and foo_channel_mixer dll to [foobar installation folder]/components/
- run foobar, go to file, preferences, playback, DSP manager
- (optional) add resampler (PPHS) to active DSP, then configure it to 48000Hz Ultra mode
- add channel mixer
- configure channel mixer, general: output channels 6, check L C R RL RR, uncheck LFE, Stereo image width 1.00
- upmix: mode surround, mode surround, center 1.00, volume 2.00, all others 0.00
- add Dolby headphone, configure: dolbyhph.dll to C:\windows\system32\DolbyHph.dll
- (optional) add others DSP to the top of the list if you want, make sure channel mixer then dolby headphone is the last two on the list
other useful components:
- Skip silence
- foo_ui_columns (nice ui)
- foo_uie_lyrics (add lyric, need foo_ui_columns)
- foo_shutdown (auto shutdown/standby/hibernate)
- amip for foobar and amip configurator (add winamp like jump and now playing announce to messengers and irc)
original source: http://www.head-fi.org/forum/thread/447089/5-1-headphone-experience-foobar-configuration-for-all-stereo-music-files
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Minggu, 05 Desember 2010
Minggu, 21 November 2010
[shared] rails custom ajax helper for jquery
requirements:
- jrails plugin (https://github.com/aaronchi/jrails)
- working jquery.gritter or other js notification (http://boedesign.com/blog/2009/07/11/growl-for-jquery-gritter/)
- my jquery.extended_helper (http://code.google.com/p/jquery-extendedhelper)
installation:
- add these code in application_helper.rb
- add notification code in application.js (sample using jquery.gritter)
- jrails plugin (https://github.com/aaronchi/jrails)
- working jquery.gritter or other js notification (http://boedesign.com/blog/2009/07/11/growl-for-jquery-gritter/)
- my jquery.extended_helper (http://code.google.com/p/jquery-extendedhelper)
installation:
- add these code in application_helper.rb
# Adding additional options for ajax function # You can use thisElement to manipulate element that using the function (link/button/form) def custom_remote_function_options options options[:before] ||= "" options[:loading] ||= "" options[:complete] ||= "" options[:success] ||= "" options[:before] += "; var thisElement=this" options[:failure] ||= "; eval(request.responseText)" unless options[:loading_text].blank? options[:loading] += "; thisElement.notif = #{notification_loading(options[:loading_text])}" options[:complete] += "; #{notification_remove "thisElement.notif"}" end options end # Override rails remote_function using additional options def custom_remote_function options remote_function(custom_remote_function_options(options)).html_safe end # Override rails link_to_remote function using additional options # Disabling the link when ajax loading in progress to avoid double request def custom_link_to_remote name, options={}, html_options=nil options = custom_remote_function_options options options[:loading] += "; $(thisElement).setLink(false)" options[:complete] += "; $(thisElement).setLink(true)" link_to_remote name, options, html_options end # Override rails button_to_remote function using additional options # Disabling the button when ajax loading in progress to avoid double request def custom_button_to_remote name, options={}, html_options=nil options = custom_remote_function_options options options[:loading] += "; $(thisElement).setInput(false)" options[:complete] += "; $(thisElement).setInput(true)" button_to_remote name, options, html_options end # Adding additional options for ajax form # Add :unchange_default => true to prevent successful request changing default form fields value # Add :disable_link => true to disable all link inside form when loading in progress def custom_remote_form_options options options = custom_remote_function_options options options[:loading] += "; $(':input', thisElement).setInput(false);" options[:complete] += "; $(':input', thisElement).setInput(true);" unless options[:unchange_default] options[:success] += "; $(':input', thisElement).setDefault();" end if options[:disable_link] options[:loading] += "; $('a', thisElement).setLink(false);" options[:complete] += "; $('a', thisElement).setLink(true);" end options end # Override rails remote_form_for using additional options def custom_remote_form_for record_or_name_or_array, *args, &proc args.push custom_remote_form_options(args.extract_options!) remote_form_for record_or_name_or_array, *args, &proc end alias_method :custom_form_remote_for, :custom_remote_form_for # Override rails form_remote_tag using additional options def custom_form_remote_tag options={}, &block form_remote_tag custom_remote_form_options(options), &block end alias_method :custom_remote_form_tag, :custom_form_remote_tag def custom_button_to_remote name, value, options = {} button_to_remote name, value, custom_remote_form_options(options) end # Override rails submit_to_remote using additional options def custom_submit_to_remote(name, value, options = {}) submit_to_remote(name, value, custom_remote_form_options(options)) end def notification_info text, no_escape=false text.gsub!(/\n/, ' ') text = escape_javascript(text) unless no_escape "notificationInfo('#{text}')" end def notification_loading text, no_escape=false text.gsub!(/\n/, ' ') text = escape_javascript(text) unless no_escape "notificationLoading('#{text}')" end def notification_error text, no_escape=false text.gsub!(/\n/, ' ') text = escape_javascript(text) unless no_escape "notificationError('#{text}')" end def notification_remove notification "notificationRemove(#{notification})" end
- add notification code in application.js (sample using jquery.gritter)
function notificationInfo(text){
return $.gritter.add({text: text.replace(/\n/g, '
')});
}
function notificationError(text){
return $.gritter.add({text: '' + text.replace(/\n/g, '
') + '',time: 6000});
}
function notificationLoading(text){
return $.gritter.add({text: text.replace(/\n/g, '
'), image: '/images/gritter-loading.gif', sticky:true})
}
function notificationRemove(notification){
$.gritter.remove(notification);
}
rails http status code and symbol
Status Code | Status Message | Symbol |
---|---|---|
1xx Informational | ||
100 | Continue | :continue |
101 | Switching Protocols | :switching_protocols |
102 | Processing | :processing |
2xx Success | ||
200 | OK | :ok |
201 | Created | :created |
202 | Accepted | :accepted |
203 | Non-Authoritative Information | :non_authoritative_information |
204 | No Content | :no_content |
205 | Reset Content | :reset_content |
206 | Partial Content | :partial_content |
207 | Multi-Status | :multi_status |
226 | IM Used | :im_used |
3xx Redirection | ||
300 | Multiple Choices | :multiple_choices |
301 | Moved Permanently | :moved_permanently |
302 | Found | :found |
303 | See Other | :see_other |
304 | Not Modified | :not_modified |
305 | Use Proxy | :use_proxy |
307 | Temporary Redirect | :temporary_redirect |
4xx Client Error | ||
400 | Bad Request | :bad_request |
401 | Unauthorized | :unauthorized |
402 | Payment Required | :payment_required |
403 | Forbidden | :forbidden |
404 | Not Found | :not_found |
405 | Method Not Allowed | :method_not_allowed |
406 | Not Acceptable | :not_acceptable |
407 | Proxy Authentication Required | :proxy_authentication_required |
408 | Request Timeout | :request_timeout |
409 | Conflict | :conflict |
410 | Gone | :gone |
411 | Length Required | :length_required |
412 | Precondition Failed | :precondition_failed |
413 | Request Entity Too Large | :request_entity_too_large |
414 | Request-URI Too Long | :request_uri_too_long |
415 | Unsupported Media Type | :unsupported_media_type |
416 | Requested Range Not Satisfiable | :requested_range_not_satisfiable |
417 | Expectation Failed | :expectation_failed |
422 | Unprocessable Entity | :unprocessable_entity |
423 | Locked | :locked |
424 | Failed Dependency | :failed_dependency |
426 | Upgrade Required | :upgrade_required |
5xx Server Error | ||
500 | Internal Server Error | :internal_server_error |
501 | Not Implemented | :not_implemented |
502 | Bad Gateway | :bad_gateway |
503 | Service Unavailable | :service_unavailable |
504 | Gateway Timeout | :gateway_timeout |
505 | HTTP Version Not Supported | :http_version_not_supported |
507 | Insufficient Storage | :insufficient_storage |
510 | Not Extended | :not_extended |
source: http://www.codyfauser.com/2008/7/4/rails-http-status-code-to-symbol-mapping
Rabu, 17 November 2010
[shared] array/hash support for system_settings
https://github.com/realityforge/rails-system-settings
# system_settings/lib/system_setting.rb
class SystemSetting < ActiveRecord::Base
@@data = {}
validates_length_of :name, :in => 1..255
validates_uniqueness_of :name
serialize :value
def self.[](name)
name = name.to_s unless name.is_a? String
return @@data[name] unless @@data[name].nil?
p = SystemSetting.find_by_name(name)
@@data[name] = p ? p.value.freeze : nil
end
def self.[]=(name, value)
name = name.to_s unless name.is_a? String
p = SystemSetting.find_or_initialize_by_name(name)
@@data[name] = p.value = value
p.save!
p.value.freeze
end
end
[shared] Unsigned int support for migration
currently rails only allow signed int for migration, but for best practice it's better to use unsigned int for some cases
you can force migration to unsigned int by doing something like this
but that kinda ugly to see.
luckily rob anderton (thewebfellas.com) already created monkey patch to add unsigned support: http://thewebfellas.com/assets/2008/9/30/active_record_unsigned.rb
the patch will add :unsigned option in migration so you can do something like this:
furthermore the patch will make default table id and foreign key to unsigned int(11), but make sure to use t.references to create foreign key or simply use :unsigned => true
- for existing project this patch might break table relation because it will create unsigned int foreign key but the primary key might be signed int from old migration
- some plugin like role_requirement will generate migration that using t.integer for foreign key instead of t.references, you need to change this manually
- the patch will only change mysql adapter, so it will not work for other adapter
you can force migration to unsigned int by doing something like this
t.column :unsigned_value, "integer unsigned"
but that kinda ugly to see.
luckily rob anderton (thewebfellas.com) already created monkey patch to add unsigned support: http://thewebfellas.com/assets/2008/9/30/active_record_unsigned.rb
the patch will add :unsigned option in migration so you can do something like this:
t.integer :unsigned_value, :unsigned => true
furthermore the patch will make default table id and foreign key to unsigned int(11), but make sure to use t.references to create foreign key or simply use :unsigned => true
important things:
- for existing project this patch might break table relation because it will create unsigned int foreign key but the primary key might be signed int from old migration
- some plugin like role_requirement will generate migration that using t.integer for foreign key instead of t.references, you need to change this manually
- the patch will only change mysql adapter, so it will not work for other adapter
Langganan:
Postingan (Atom)