Hi, I have two tables as employee id int primary key, purchase_order_product int, bundle int fabric_bundles id int primary key, purchase_order_product int, bundle int, quantity I want to make assciation between employee and fabric_bundles via purchase_order_product and bundle

Member Avatar
Member Avatar
+0 forum 3

I have a MySQL table with a string-based primary key. I created it with an ActiveRecord::Migration as follows: create_table( "icd9s", id: false) do |t| t.string "ICD9Code", limit: 7, null: false t.string "ShortDescription", limit: 128, null: false t.string "LongDescription", limit: 255, null: false end add_index(:icd9s, :ICD9Code, unique: true) Then I went into MySQL and flagged "ICD9Code" as primary. When I dumped the schema, I got this: create_table "icd9s", primary_key: "ICD9Code", force: :cascade do |t| t.string "ShortDescription", limit: 128, null: false t.string "LongDescription", limit: 255, null: false end add_index "icd9s", ["ICD9Code"], name: "index_icd9s_on_ICD9Code", unique: true, using: :btree Here's my problem - the …

Member Avatar
+0 forum 0

How can I convert this Ruby Gem to PHP? token = "your_nypl_api_token" client = NyplRepo::Client.new(token) ``` ``` token = "your_nypl_api_token" options = {:debug => true, :server_url => "http://api.repo.nypl.org/api/v1"} client = client = NyplRepo::Client.new(token, options) Also url = "http://api.repo.nypl.org/api/v1/items/8568ccd0-c614-012f-1d74-58d385a7bc34.xml" uri = URI.parse(url) http = Net::HTTP.new(uri.host, uri.port) headers = { "Authorization" => "Token token=XXXXXX" } request = Net::HTTP::Get.new(uri.request_uri, headers) response = http.request(request) @response = response.body @response = response.body Regards

Member Avatar
Member Avatar
+0 forum 19

Personally I think Python is better then ruby because it runs on the Django framwork and it can do more. But I wanted some debate from ruby devs so bring it on!!

Member Avatar
Member Avatar
-2 forum 4

I'm trying to write a search enigne. Nothing fancy like google or so, just a simple one for educational purposes. I have done a little research and I know that Google uses Python, Java and C++. I on the other hand know C++, PHP, some Java and C# and even less Python. I see that Ruby on Rails have a lot of heat for some reason. I am willing to know a new language and framework as long as it isn't to difficult. I want something fast, rather portable, easy to maintain and update. I have made a few web …

Member Avatar
Member Avatar
+0 forum 1

I'm attemping to clone and install a Ruby application from github. I have it cloned, and am trying to run the "bundle install" command, but it failed the first time because of an issue with Rake. I installed it manually using "gem install rake -v '10.1.1'". That command was sucessful, but, when I tried to run "bundle install" again, it failed with the same error. The command line is copied below. I'm just starting out with Ruby. I have tried installing several applications and given up because of this same failure, actually, but just gave up figuring it wasn't my …

Member Avatar
Member Avatar
+0 forum 1

Hello daniweb community i'm new here and glad to join this amazing website. Well want I need to understand is how I learn to become a competent computer science major and learn to write code very well. I have always had a knack for this and I love it alot but i'm lost on where I should start. At the moment im learning ruby and have been messing around with RoR. So what language should I learn first? I already know that computer science is more about how it works and algorithms and ETC. I want to go into my …

Member Avatar
Member Avatar
+0 forum 6

There is `text label` on a webpage, and I am trying to click on that to open a pop-up window,but not getting opened. here is the `HTML` code: <td width="40%"> <div id="EmpId.outline"> <input type="hidden" name="EmpId" value="" id="popupEmpId"> <input type="text" name="EmpCode" value="" readonly="readonly" class="textMedium250" id="popupEmpCode" autocomplete="off"> <a href="#f2"><label onclick="checkForPopup('EmpPopupDiv','Select a Emp',640,true,refreshConditionOptions);"> + Search for a Emp</label> </a> </div> </td> I have to click on the field `+ Search for a Emp`, but could not do that.

Member Avatar
Member Avatar
+0 forum 3

Hello, anyone can help me with parsing an html table data to be saved directly in an excel file from the same parsing app?

Member Avatar
Member Avatar
+0 forum 4

Hey guys. Im designing a web app with rails for storing and analysing college students' marks. Ive come up with a database design like this: ![First](/attachments/large/3/First.png "First") Now IM not sure how to set the associations. Can you please help me? And is the design ok?

Member Avatar
Member Avatar
+0 forum 2

Hello, anyone can help me with how to build a simple user registration form using Rails from scratch, with the fields Login Name, Name, Address and Password (encrypted)? I will be using MySQL to host the database. I've already created the new project using: rails new reg_form, now what next??

Member Avatar
Member Avatar
+0 forum 2

after pulling my hair out with this one, I'm afraid I'm going to have to turn the knowledge of those much wiser.....again! ok so here's the problem, I am following the following two railscasts: [deploying to a vps](http://railscasts.com/episodes/335-deploying-to-a-vps?autoplay=true) [asset pipeline in production](http://railscasts.com/episodes/341-asset-pipeline-in-production?autoplay=true) My setup: Ubuntu Server 12.04 nginx unicorn ruby 1.9.3p125 rails 3.2.2 Ad far as I can tell everything has been followed to a T (or Tea or maybe a Tee, I've never seen this phrase written down before). The site is now running on my server but the stylesheet and javascript files are not loaded. it seems to …

Member Avatar
Member Avatar
+0 forum 5

Hello, anyone can help me with the conversion of single quotes in a string to double quotes? Am new to Ruby programming and still learning around on how to use it properly. I have an example in Delphi, which I want to make compatible with Ruby: function ReplaceSingleQuote(AText: String): String; begin Result := ''; if Length(AText) = 0 then Exit; Result := StringReplace(AText, '''', '''''', [rfReplaceAll]); end;

Member Avatar
Member Avatar
+0 forum 2

ok, so here's the deal. Going over the Rails tutorial. We're running a testing environment to make sure that the things we want showing up on our pages are making it. Doing this using pages_controller_spec.rb file. And this is one of three arguments that we passed: [ICODE]describe "GET 'home'" do it "returns http success" do get 'home' response.should be_success end it "should have the right title" do get 'home' response.should has_selector("title", :content => "Ruby on Rails Tutorial Sample App | Home") end[/ICODE] All three tests are the same. When I run rspec spec/ from the command line (I'm using windows …

Member Avatar
Member Avatar
+0 forum 1

Hi im starting to learn programming and I'm stuck in this [CODE] puts "enter as much words as you like and i will sort them" words = [] while true words.push gets.chomp if words.last == "" words.delete(words.last) break end end sorted = [] def sort unsorted, sorted, num, var while true if unsorted[num] < unsorted[var] var = var + 1 if var + 1 == unsorted.length sorted.push unsorted[num] unsorted[num].delete var = 1 end else ya = unsorted[num] unsorted[num].delete unsorted.push ya var = 1 end break if unsorted == "" end end puts sort [words], [sorted], 0, 1 [/CODE] in line …

Member Avatar
Member Avatar
+0 forum 10

[CODE] a=gets.to_i b=gets.to_i [/CODE] this code gets input like this 2 2 but in c++ std::cin will get input after space or \n So how do I make ruby get input like std::cin I am new to ruby and can not find the answer on google so help would be appreciated thanks

Member Avatar
Member Avatar
+0 forum 2

Ok, I'm using the Head First Rails book, which sadly, was written in 2009. So, the API has changed drastically. I am trying to manually configure a route to make the controller find my show page. The route the book tells me to type [ICODE] map.connect '/ads/:id', :controller=>'ads', :action=>'show' [/ICODE] But this is obviously not working. How would I rewrite this line of code to make it properly conform to the new API? Thanks in advance.

Member Avatar
+0 forum 0

Hi everybody, in my database, am trying to print the value of total and then add it to the price, i was able to fetch the value of total but when i tried to add it to to price so as to get value of sum in this line of code [CODE] sum = price + %s, row[0] puts "sum" [/CODE] nothing happens. where am i supposed to perform the operations, is outside the loop. below is the code, any help please [CODE] #!/Ruby19/bin/ruby require 'cgi' cgi = CGI.new puts cgi.header require "dbi" price = '100' begin # connect to …

Member Avatar
Member Avatar
+0 forum 2

Hello Everyone, I`m a PHP developer, These days I`m thinking seriously about learning ruby , but I`m not sure if it gonna add to my knowledge , so i have few questions about it and hope that a ruby specialist will answer me 1- Do I need to learn ruby to become more professional web developer? 2- What ruby can do while php can not do? 3- does it offer more features and capabilities over php? 4- does it need deep learning curve? thank you very much

Member Avatar
Member Avatar
+0 forum 3

Hi I'm trying to make a friend request feature like in a social networking site and I've been getting this Unknown Attribute error whenever I try to request a friendship with an another user. [url]http://s1042.photobucket.com/albums/b429/Kevin_Tang/?action=view&current=unknown_atrribute.png[/url] And this is the code of the friendship controller. [CODE]class FriendshipController < ApplicationController def req @user = User.logged_in(session) @friend = User.find_by_screen_name(params[:id]) unless @friend.nil? if Friendship.request(@user, @friend) flash[:notice] = "Friendship with #{@friend.full_name} requested" else flash[:notice] = "Friendship with #{@friend.full_name} cannot be requested" end end redirect_to :controller => :user, :action => :index end def accept @user = User.logged_in(session) @friend = User.find_by_screen_name(params[:id]) unless @friend.nil? if Friendship.accept(@user, @friend) flash[:notice] …

Member Avatar
Member Avatar
+0 forum 1

Hello everybody I have a question: is it possible to compile ruby files into bytecode. Does ruby have something like .pyc files? I found some discussions online about generating .exe's from ruby files, but what I want to know if it is possible to compile .rb files just like you compile .py files. Thanks

Member Avatar
Member Avatar
+0 forum 4

Hi All I am looking for a new language to learn and add to my language set that already contains PHP & C# in much depth. Ruby is one language i was thinking of learning. Can you guys please give me practical uses and/or applications that use/may use Ruby. I believe knowing this before learning it will surely give me some inspiration and direction when i begin my Ruby lessons. Thanks.

Member Avatar
Member Avatar
+0 forum 2

What is the best IDE that I should use to make a program using Ruby Language? And where can I download it for free? I'm self studying. :)

Member Avatar
Member Avatar
+1 forum 5

Hi I have my initialise constructor, why won't my function to_hash work ? [CODE]def initialize(msg) @original_msg = msg.strip.delete(' ') s = ["|","^"] @chunked_msg = @original_msg.split(s[0]) @msg_hash.self.to_hash end def to_hash @chunked_msg.each do |x| s = x.split("=") @msg_hash[s[0]] = s[1] end return @msg_hash end[/CODE]

Member Avatar
Member Avatar
+0 forum 1

Hello, I use Ruby with Sinatra in my application and I need to store a big data (exceeding 4K) in my session or somewhere secude on the server because I do some API calls and I refer to that data very often and that's why I need it stored. The problem is Sinatra dropped my session content because of exceeding 4K data: [CODE][B]Warning! Rack::Session::Cookie data size exceeds 4K. Content dropped.[/B][/CODE] I don't know what to do: - is there a way of enlarging the maximum capacity of session cookie? although I don't want to get huge cookies. - is there …

Member Avatar
Member Avatar
+0 forum 1

problem with this code: [CODE]parseIcmPage url, '<ul id="topListFilter"', '<div id="footer">' def parseIcmPage(url, start_point, end_point) data = getHtmlPage url s = data.index(start_point) e = data.index(end_point, s) len = e-s list_str = data.index[s, len] puts list_str, '\n' end[/CODE] [CODE]icm.rb:42: warning: don't put space before argument parentheses ./util.rb:121:in `index': wrong number of arguments (0 for 1) (ArgumentError) from ./util.rb:121:in `parseIcmPage' from icm.rb:42[/CODE] not sure why i am getting argumenterror. As can be seen i am passing '<ul id="topListFilter"' as argument 1.

Member Avatar
Member Avatar
+0 forum 1

Hi. I'm just trying out Ruby on Rails, and I'm trying to create some application that takes a hostname from the user and then checks if it is connectible through Net::SSH and if it is, it should check if a file is present. Quite simple, and I also almost reached goal. But I can't seem to implement what should happen if Net::SSH.start fails? I just get a big Rails error page with param dumps and stuff, but actually I'd just like to do a [I]render :text => 'Hey couldn't connect dewd'[/I] or something. How is that doable? Do I have …

Member Avatar
Member Avatar
+0 forum 6

I'm definitely a noob to rails so sorry if this is trivial. I have tables with associations on them. The associations are supposed to add methods to my models like model.others and model.others= and so on but when I try to use them I get errors like the following. NoMethodError: undefined method `states' for #<Ad:0x2c8a88c> from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/attribute_methods.rb:260:in `method_missing' from (irb):4 I've followed the execution in the debugger and all that the method_missing seems to do is generate setters, getters and ? for the fields in the table, it doesn't seem to generate or look for any of the methods that …

Member Avatar
Member Avatar
+0 forum 1

I'm working on comp. science 101 work and I have 4 methods left to do which I can't figure out and I've been trying for hours. Very elementary but difficult for smoeone new to computers and Ruby. For example: I need to write a method called 'diff' which accepts 2 parameters and returns the difference between the two, (but withoutputs) ...I can only figure out using puts.

Member Avatar
Member Avatar
+0 forum 1

I do php coding for some time and want to learn something new. After some researsh I ended up with 2 languages/frameworks but I can't choose between them. I'm a python programmer so python Django might be easier to start with. But I don't know a well-known website which is made with Django, while there are a lot of sites using ruby (twitter,wakoopa,...) They say python is faster, but ruby has better javascript/Ajax implementation What should I choose? What do you use? (probably ruby cause I post this on the ruby forum)

Member Avatar
Member Avatar
+0 forum 3

The End.