I am having table in psql it has one field as integer array data type.
From rails application I was not able to insert value in that filed.
Example:
Need to add multiple userid in the name field.
create table users(name integer[],id serial);
a=10
obj-User.new
obj.name='{a}' # this inserting value as a.
obj.name='{#{a} }' # this giving error.
If anyone faced...
User Profile
Collapse
-
How to insert values into array data type field (psql)
-
It was not working as per expected. I have used database.yml file with specifying 2 schemas. -
How to insert special characters in psql?
I am having a file, that have to be inserted into db in text data type field. I am facing issue when the file having special characters like ( ,),. Kindly check the attached file for example.
Insert query only I have used.
Example:
...Code:obj=PGconn.connect(host,port'','',dbname,username,password") input="Last Cron Entry is = #50 23 * * * /ProActive/bin/Logparser_NORTEL.pl -f /Zivah/Station/CTIServer/Nortel/logs/api_`date
Last edited by Niheel; Dec 14 '10, 09:20 PM. -
How to get gpg command output in rails?
scenario:
---------
Need to upload the gpg encrypted file.
Get that file and do decryption and store the output in a file
Then extract that file and get the actual output
Problem:
-----------
If I execute that command via command line, it was executed successfully. But via system command it was not running. The decrypted output will have control character. I think due to that... -
How to use 2 schema at a same time?
I want to use two schema in single rails application, for that how to specify the schema name in model. Tried with following, it was not working.
set_table_name "schemaname.tab lename"
schema names:
1. addressbook
2. schedule
Need to fetch the details from addressboook schema and have to get some data from user and need to store it in a 'schedule' schema with all details. -
sum() not working
Yes, absolutely .. I forgot .. now it is working fine.. Any way thanks...Leave a comment:
-
ssh problem in ruby
yes. I can login with ssh by entering password.Leave a comment:
-
sum() is not working
Hi,
I am having database in debian os. In that sum() giving expected output.
I have changed my database from debian to lenny. In that sum() is not available. It shows the following error. Can any one help me to solve this ?
user => SELECT cmp_id ,sum(*) as count from schedules group by cmp_id;
ERROR: function sum() does not exist
LINE 1: SELECT cmp_id ,sum(*) as count from schedules group by cmp_i...... -
Could you able to understand my question?
In sendmail function, there is no option to attach file. U can configure the file attachment details properly. How will you embed this ?Leave a comment:
-
It is sending mail properly with text message. It is not attach the file. In that program no syntax specified to attach mail.I have already tried this example. Any other simplest example ???Leave a comment:
-
Sending an email with attachment file
The following program will send the mail with specified attachment file.Need to give the absolute path of the file.
require "rubygems"
require "ruport"
require "ruport/util"
r = Ruport::Report. new
r.add_mailer :default,
:host => "192.168.1. 1",
:address => "xxxx@bksys.co. in"
r.send_to("xxxx @bksys.co.in")... -
How to attach file in an e-mail using ruby?
I have the following code, it is sending text message. I want to attach a file. How to do that?
require 'net/smtp' # plain mail
smtpclient = Net::SMTP::new( '192.168.1.1' ) # create new object to send mail
the_email="From : ruby_using_smtp @webdevel.co.in \nTo:xxxx@bksys .co.in\nSubject :Birthday \n\n"+"This is for demo" #Frame a mail
smtpclient.star t # start the mail process
smtpclient.send mail(the_email,... -
-
What is the Difference between DSA and RSA?
I have two servers. I want to do ssh between two servers with out asking password. One is having RSA and another one is having DSA. I am having all control of one server only ( which is having RSA key). How to solve this issue? -
ajax scaffold
I have created rails application using ajax scaffold. It is easy for CRUD operation. If I use independent table its working perfectly. I have used two tables, which is referring another table. I need to show the parent table value in child table view.
For example:
User table: id,no,name,mark s
Dept table: id,userid,dept name, dept no
In 'Dept' table view ,I need to show the username . It is showing the id of... -
How to run command in another/remote host?
I need to run a command in remote host, I tried the following but I got error. Kindly solve this,
#!/usr/bin/env ruby
require 'rubygems'
require 'net/ssh'
HOST = '192.168.1.113'
USER = 'username'
PASS = 'password'
Net::SSH.start( HOST, USER, :password => PASS ) do|ssh|
ssh.exec('ls')
end
Error:
/usr/lib/ruby/1.8/net/ssh/session.rb:132: in... -
Replication of tables
I am having two DB in postgres. Need proper exapmple for 'rubyrep' tool , to replicate all the tables in A database to B data base.
My sync.conf file is,
-----------------------
RR::Initializer ::run do |config|
config.left = {
:adapter => 'postgresql',
:database => 'savithri',
:username => 'savithri',
:password => 'savithri',
... -
Using 'source' we can acheive teh including of files in shell script.
Example:
filename: config
var=260
filename: a.sh
when we run the a.sh file, we can get the 'var' value as, 250..Code:source config echo $var
Leave a comment:
-
ssh & scp using ruby code
require 'rubygems'
require 'net/ssh'
require 'net/sftp'
Net::SSH.start( '192.168.1.32', 'test', 'test') do |ssh|
ssh.sftp.connec t do |sftp|
dir=sftp.opendi r("/home/delivery_team/Plan\ of\ work")
for item in sftp.readdir(di r)
if not (item.filename == "." or item.filename == "..")
source = sftp.open("/home/user1/work/Plan\... -
Include files in shell script.
I have one configuration file. It will be used by perl and shell script. From perl using 'require' I have included the configuration file. Using require, include statement I tried in shell script , but it was not working.
How to include a file and read value from that file using shell script?
No activity results to display
Show More
Leave a comment: