Change default table name of session active_record_store for rails 2.3.x.

October 19th, 2009

Just a little tip that can save some time. Before rails 2.3.x you should define the new table name like

CGI::Session::ActiveRecordStore::Session.set_table_name “new_table_name”

Now you have to define it like that

ActiveRecord::SessionStore::Session.set_table_name “new_table_name”

Off-Topic - LinkedIn import contacts.

August 20th, 2009

Hoje resolvi me cadastrar no LinkedIn, logo que o cadastro é realizado, o sistema pergunta se quer importar contatos de alguns lugares, incluindo sua lista de contatos do gmail. Normalmente acho esta opção uma mão na roda. Sendo assim, aceitei importar a lista de contatos do gmail. Abaixo está a tela do sistema neste ponto e meu entendimento quanto a utilização da mesma.

Na caixa grande do lado esquerdo estão todos os contatos do meu gmail, na caixa pequena do lado direito, segundo a seta verde, o link remove all e o botão Invite, estariam os usuário que seriam convidados. Sendo assim, cliquei no botão Invite e todos os meus contatos receberam um convite!!! Depois de alguns minutos, pela quantidade de emails que recebi de confirmação e mensagens instantâneas de pessoas perguntando do que se tratava o convite, tive certeza que convidei todos os meus contatos para o LinkedIn. Por todos, entende-se amigos, clientes, grupos de email que participo, namoradas, ex-namoradas, cachorros, periquitos e papagaios! Legal né? Só no trabalho houveram pessoas que receberam 6 emails de convite.

Peço desculpas a todos que receberam o convite indevidamente!

Author: murad Categories: Causos, Web 2.0 Tags:

Verify if the element exists before replace_html

July 5th, 2009

I tried many things before decide to extend the framework. But did not get stisfied with the avaliable solutions. So here it is.

Just put the code bellow in some initializer.

Author: murad Categories: rails Tags: , ,

Pequeno grande monitor…

April 23rd, 2009

Author: murad Categories: Ubuntu Tags:

Gitorious installation.

April 20th, 2009

I just create a script that will automatically install gitorious in a ubuntu server.

If you are having troubles installing it, you can try the script or take a look in what it does.

http://github.com/marcelomurad/rails-env-install/

Author: murad Categories: Ubuntu, rails Tags: , ,

Customise error fields

March 22nd, 2009

The default rails error message style is to insert a div with attribute class set to fieldWithErrors involving the form field.

That is how I’ve changed the default rails behaviour to inject css error class into the object.

Author: murad Categories: rails Tags:

RailsConf 2009 aí vou eu!

March 16th, 2009
Author: murad Categories: rails Tags:

How to configure MediaWiki to access Active Directory on Ubuntu

November 18th, 2008
  • sudo apt-get install php5-ldap;
  • Download LdapAuthentication.php and copy it to extensions directory;
  • edit LocalSettings.php

#LDAP Auth
require_once ‘extensions/LdapAuthentication.php’;

$wgAuth = new LdapAuthenticationPlugin();
$wgLDAPDomainNames = array(’{#DOMAINNAME#}’);
$wgLDAPServerNames = array(’{#DOMAINNAME#}’ => ‘{#domain_server_host#}’);
$wgLDAPSearchStrings = array(’{#DOMAINNAME#}’ => ‘{#DOMAINNAME#}\\USER-NAME’);
$wgLDAPEncryptionType = array(’{#DOMAINNAME#}’ => ‘clear’);
$wgLDAPUseLocal = false;
$wgMinimalPasswordLength = 1;
$wgLDAPBaseDNs = array(’{#DOMAINNAME#}’ => ‘{#BASEDN#}’);
$wgLDAPSearchAttributes = array(’{#DOMAINNAME#}’ => ’sAMAccountName’);

edit everything that is between {##}.

That is it.

Restart apache and test it.

Author: murad Categories: Ubuntu Tags:

How to use gem ruby_plsql with JRuby

October 4th, 2008

That is just the basic configuration. Hope that helps.

enviroment.rb

config.gem “ruby-plsql”, :lib => “ruby_plsql”

models/some_model.rb

require “ruby_plsql”

class SomeModel < ActiveRecord::Base

def persist

plsql.connection = ActiveRecord::Base.connection.

raw_connection.connection
appraisal_id = plsql.bra_customhr_eval_pk.create_appraisal(
:p_employee_number => self.appraisee.employee_number,
:p_appraisal_template_id =>  @avalTemplate[0].template_id,
:p_period_start_date => @avalTemplate[0].valid_from,
:p_period_end_date => @avalTemplate[0].valid_until,
:p_business_group_id => self.appraisee.business_group_id,

:p_appraisal_id => nil,
:p_object_version_number => nil)[:p_appraisal_id

end
end
Author: murad Categories: jruby Tags:

JRuby + JNDI + JBOSS + Oracle

July 18th, 2008

I finally got jndi with jboos to work in jruby on rails . Bellow is an example of files configuration.

I was getting the bellow error:

 javax.naming.NamingException has no valid JNDI binding

=====oracle-ds.xml=====
<?xml version=”1.0″ encoding=”ISO-8859-1″?>
<datasources>
<!– Início: Datasource Technip –>
<local-tx-datasource>
<jndi-name>simu3</jndi-name>
<connection-url>jdbc:oracle:thin:@xxx.xxx.xxx.xxx:1521:simu3</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>login</user-name>
<password>password</password>
<attribute name=”MinSize”>5</attribute>
<attribute name=”MaxSize”>20</attribute>
<attribute name=”BlockingTimeoutMillis”>5000</attribute>
<attribute name=”IdleTimeoutMinutes”>15</attribute>
<idle-timeout-minutes>5</idle-timeout-minutes>
</local-tx-datasource>
</datasources>

=====warble.rb=====
have to enable the line in warble.rb like this:
# Additional files/directories to include, above those in config.dirs
config.includes = FileList["jboss-web.xml"]

# JNDI data source name
config.webxml.jndi = “jdbc/simu3″

=====database.yml=====
production:
adapter: jdbc
jndi: “java:/simu3″
driver: oracle.jdbc.driver.OracleDriver

=====jboss-web.xml=====
<?xml version=”1.0″ encoding=”UTF-8″?>
<jboss-web>
<resource-ref>
<res-ref-name>jdbc/simu3</res-ref-name>
<jndi-name>java:/simu3</jndi-name>
</resource-ref>
</jboss-web>

The most important thing was the creation of jboss-web.xml

Author: murad Categories: jruby Tags: