mysql,ruby,ruby-on-rails-3,osxView the original page-Collection of common programming errors

UnKnown Error

  • mjb
    c# mysql out-of-memory stringbuilder 2014-2-16 23:05:58
    I need to append lots of string in a loop and this will create a very long string. 1GB should be long enough to store the string, therefore I do this:var sb = new StringBuilder(1024 * 1024 * 1024);but receives this error’System.OutOfMemoryException’ was thrownany advice to append long strings?I’m writing a backup tools for MySQL database. The tools will export data from database and write into a text file. The data contains BLOB and TEXT data type. So, will expect very long string.This is the c

  • pierre
    c# mysql database entity-framework connection 2014-2-16 9:50:18
    I use EntityFramework in a project to connect to a Mysql database. The provider is Devart Dot.connect.This application needs to connect to a database using connexion parameters given by the user at runtime. This includes of course the Mysql Database name.I used the EntityConnectionStringBuiler and EntityConnection classes to build-up and store the custom connexion parameters. The problem is that even with such given parameters, the application always connect to the database named when designing

  • Anu
    php mysql 2014-2-16 8:43:48
    I am trying to create a view from another view from php and im not getting any error but it simple does not create a view. I can manually create view from another in the mysql console but not from php. Any idea where I am going wrong?function createTransaction_file($db,$file_id){$sql = “CREATE VIEW transaction_file AS SELECT context,transaction_type,starttime,stoptime,stoptime – starttime AS runtime,correlator,parent_correlator,iteration FROM transactions WHERE file_id =” . $file_id . ” ORDER BY

  • Leo
    mysql cakephp 2014-2-16 1:25:33
    I have a datamodel, let’s say: invoices (m:n) invoice_items and currently I store the invoice total, calculated in PHP by totalling invoice_items, in a column in invoices. I don’t like storing derived data as it paves the way for errors later.How can I create a logical column in the invoices table in MySql? Is this something I would be better handling in the PHP (in this case CakePHP)?

  • Anthony P.
    mysql 2014-2-15 16:47:31
    First and foremost, I do understand that MySQL is used for databases, and can be used to update content on a website. What I don’t understand is how you actually are able to get MySQl to change the content on a site automatically, or if it is even possible. I really am a beginner so sorry if this question comes comes as noobish. I really don’t understand the concept of MYSQL all that much, as I don’t understand how websites are able to change the content on their main page daily using MYSQL,

  • Jonathan
    php mysql database database-design mysqli 2014-2-15 16:14:47
    I’m learning PHP and MySQL and I’m creating a movies website for learning purposes.I want to insert variables and arrays containing movie info into a database but in different tables.This is what I have right now:include(‘inc/connection.php’); $conn = dbConnect();// create SQL $sql = ‘INSERT INTO movies (movieid, title, year, runtime, plot)VALUES(?, ?, ?, ?, ?)’;// initialize prepared statement $stmt = $conn->stmt_init(); if ($stmt->prepare($sql)) {// bind parameters and execute statment$s

  • skowron-line
    java mysql jdbc 2014-2-15 10:57:46
    why every time, everyone import (or this is not import)Class.forName(“com.mysql.jdbc.Driver”).newInstance();And when I import com.mysql.jdbc.Driver;It display Notice he import com.mysql.jdbc.Driver is never usedWhat is the different between this two ??

  • Dennis Kioko
    php mysql 2014-2-15 10:02:56
    I am using a MySQL INNER JOIN statement which returns various results for one distinct record in the main table from the joins, similar to My query is SELECT cl.*, dep.dept_name FROM epapers.clientelle cl INNER JOIN epapers.dept_staff_users depu ON depu.user_id=cl.user_id INNER JOIN epapers.dept dep ON dep.dept_id=depu.dept_id group by cl.user_id ORDER BY cl.user_name ASC, I would like to

  • Imrul
    php mysql database database-connection 2014-2-15 8:11:08
    Is it better to close the connection after each query is executed or put the connection as is it, then php will automatically close that connection. Which one is better and why?

  • BCT
    mysql grails 2014-2-15 4:32:24
    i am getting following error while connecting to mysql i have copied mysql-connector-java-5.1.22-bin.jar to lib folder in my application| Error 2012-11-26 16:14:16,981 [localhost-startStop-1] ERROR context.GrailsContextLoader – Error executing bootstraps: Error creating bean with name ‘transactionManagerPostProcessor’: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘transactionManager’: Cannot resolve ref

  • Dmitry D
    ruby 2014-2-17 2:47:41
    Need help for beginner(training purpose). For example, I have method custom_uniq and want it to work just like standard .uniq ([1, 2, 1, 3, 3].uniq >> [1,2,3])def custom_uniq(arr) new_arr = []arr.each do |elem|new_arr << elem if new_arr.include?(elem) == falseend new_arr endSo, what particular part should I modify to insert working method right into Class?class Arraydef custom_uniq?????????????????end end arr = [1,2,3,1,3,4,5,77] arr.custom_uniq >> [1,2,3,4,5,77]

  • devth
    ruby-on-rails ruby 2014-2-17 1:12:47
    It looks like this issue will be solved in Rails 4: but until then, I’m wondering how to eager-load modules/classes in my /lib.In IRB it appears that they are loaded on-demand the first time I try to access:Foo::Bar.constants => []Foo::Bar::Service => Foo::Bar::ServiceFoo::Bar.constants => [:ServiceBase, :Service]I have several other classes in that module, and my code depends on being able to look them up using Fo

  • nbucciarelli
    ruby-on-rails ruby ruby-on-rails-3 omniauth 2014-2-17 0:54:18
    Using OmniAuth, Rails 3.1.0.rc2, mysql2, ruby 1.9.2.p0. I still get this when redirecting back to my site. /auth/failure?message=invalid_responseOmniauth.rbRails.application.config.middleware.use OmniAuth::Builder doprovider :twitter, ‘XXXXX’, ‘XXXXXXXXXXXXX’I’ve checked the keys 100x and they are correct. Still getting the invalid response. Any of the questions I see don’t seem to work.Any help would be greatly appreciated!Thanks. [:If any new information is needed, just ask.

  • Nick Craver
    ruby-on-rails ruby gem spree 2014-2-16 16:49:16
    I am new to ruby on rails. I installed ruby and gems both on my ubuntu 10.10 system. My rails -v is 3.0.5 and gem -v is 1.3.7. As my requirement I installed bundler and after that when I installed spree by the command gem install spree I got the following error message:ERROR: Error installing spree:spree_core requires will_paginate (= 3.0.pre2, runtime)I googled many hours but didn’t find any good result. So please help me.I am really a newbie in Rails.

  • Doc
    ruby methods syntax 2014-2-16 8:24:52
    My code has a # symbol in the class_eval section. This is foreign to me, what does it mean?class Classdef attr_accessor_with_history(attr_name)attr_name = attr_name.to_s # make sure it’s a stringattr_reader attr_name # create the attribute’s getterattr_reader attr_name+”_history” # create bar_history getterclass_eval %Q{ def #{attr_name}=(attr_name) @#{attr_name} = attr_name @#{attr_name}_history = [nil] if @#{attr_name}_history.nil? @#{attr_name}_history << attr_name end }end end

  • dave paola
    ruby compiler rubinius 2014-2-16 5:09:30
    I’m attempting to (for fun and profit) add the ability to inspect objects in ruby and discover their source code. Not the generated bytecode, and not some decompiled version of the internal representation, but the actual source that was parsed to create that object.I was up quite late learning about Rubinius, and while I don’t have my head around it yet fully, I think I’ve made some progress.I’m having trouble figuring out how to do this, though. My first approach was to simply add another insta

  • Sergio Tulentsev
    ruby-on-rails ruby models 2014-2-16 3:57:21
    New to rails. I’m having trouble understanding why I use score > 50 and not @score > 50 i nthe following example? Doesn’t the @ sign imply an instance variable, which is what I should use in classes? Where is the class getting the score variable from? I was under the impression that it would be considered local if it’s not prefixed with an @ ?class HighScore < ActiveRecord::Baseattr_accessible :game, :scorevalidate :verify_inputsdef verify_inputs# Why is this line not @score > 50??if

  • marclar
    c# ruby ironruby 2014-2-16 0:07:12
    I’d like to use a RubyGem in my C# application.I’ve downloaded IronRuby, but I’m not sure how to get up and running. Their download includes ir.exe, and it includes some DLLs such as IronRuby.dll.Once IronRuby.dll is referenced in my .NET project, how do I expose the objects and methods of an *.rb file to my C# code?Thanks very much,Michael

  • Chris
    ruby hashtable symbols 2014-2-15 18:21:07
    I have written some Ruby code to import the Google n-gram data into a hash table, mapping word unigrams to their respective counts. I’m using symbols as opposed to strings for the keys. I’ve been running this code on a linux box for a while now with no problems. Running it on my Mac this morning yielded a symbol table overflow runtime error after loading about 2 million key-value pairs. I don’t understand what is causing this error. Anyone have suggestions on what might be the cause? I’m r

  • gg_s
    ruby-on-rails ruby bundler 2014-2-15 17:21:26
    I am a Rails newbie and trying to follow guide. I am using:gem 2.0.3 bundler 1.3.5 rails 3.2.13 ruby 2.0.0-p195 When I perform bundle update or bundle install after editing the Gemfile, I get the following errors:roberts-imac-6:first_app bobbaird001$ bundle update **Gemfile syntax error:** roberts-imac-6:first_app bobbaird001$ bundle install **Gemfile syntax error:**Here is the Gemfile (I have removed the rows that are commented out)source ‘’gem ‘rai

  • nbucciarelli
    ruby-on-rails ruby ruby-on-rails-3 omniauth 2014-2-17 0:54:18
    Using OmniAuth, Rails 3.1.0.rc2, mysql2, ruby 1.9.2.p0. I still get this when redirecting back to my site. /auth/failure?message=invalid_responseOmniauth.rbRails.application.config.middleware.use OmniAuth::Builder doprovider :twitter, ‘XXXXX’, ‘XXXXXXXXXXXXX’I’ve checked the keys 100x and they are correct. Still getting the invalid response. Any of the questions I see don’t seem to work.Any help would be greatly appreciated!Thanks. [:If any new information is needed, just ask.

  • Alex Neth
    ruby-on-rails ruby-on-rails-3 2014-2-16 20:47:16
    Rails 3.0 is a serious dog. I’ve been developing on Rails for 5 years, and it’s never been slower to startup. In particular, tests take forever to bootstrap on a top notch MacBook with SSD, so iteration cycles suffer severely. I need to read an article every time I start a test. It’s insane and not “agile”. I might as well be compiling.This is the major motivation for me to finally move on from Rails – when I have the chance.If anyone has a solution, please offer it. I know many people suffer f

  • Shpigford
    ruby-on-rails ruby-on-rails-3 refactoring dry 2014-2-16 7:08:46
    I have the following two methods for a Number model.def tracknumber = sanitize(tracking)case determine_type(number)when ‘UPS’tracker = ups.track(:tracking_number => number)self.carrier = Carrier.where(:name => ‘UPS’).firstself.service = tracker.service_typeself.destination_country = tracker.destination_countryself.destination_state = tracker.destination_stateself.destination_city = tracker.destination_cityself.origin_country = tracker.origin_countrys

  • bloudermilk
    ruby-on-rails ruby ruby-on-rails-3 gem 2014-2-14 18:27:10
    I am developing a gem for Rails 3 that consists of two main components. The first is a rails generator that adds some new files/folders to a rails project. The second is a runtime environment that loads all the aforementioned files (some ruby classes that use my DSL) as well as a portion of the default Rails stack. Essentially it’s everything you’d expect to be able to access in rails c, sans routing, controllers, helpers and views. What is the proper way to load a Rails environment, except for

  • pablo89
    ruby-on-rails-3 coffeescript passenger 2014-2-14 13:58:02
    Im using Ruby 1.9.3p0, Rails 3.1.2 with Apache and Passenger in Production. When I try to make a remote function, it throws me this error:ActionView::MissingTemplate (Missing template video/loadVideo, application/loadVideo with {:handlers=>[:erb, :builder], :formats=>[:js, “application/ecmascript”, “application/x- ecmascript”, :html, :text, :js, :css, :ics, :csv, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json], :locale=>[:en, :en]}. Searched inAs you can see, there

  • Richard
    ruby-on-rails ruby ruby-on-rails-3 rubygems 2014-2-14 4:17:31
    I have these groups in my Gemfile:group :development, :test dogem ‘sqlite3’ end group :production dogem ‘mysql’ endThe development machine does not have MySQL installed, which is why I have only listed MySQL in the production group. But when I try to run Rails on the development machine I get this:$> RAILS_ENV=development ./script/rails Could not find gem ‘mysql (>= 0, runtime)’ in any of the gem sources listed in your Gemfile.Obviously I could fix this by installing MySQL, but I would l

  • Andrew
    ruby-on-rails validation ruby-on-rails-3 model runtime-error 2014-2-14 2:31:20
    I’m working on a project in Rails 3 where I need to create an empty record, save it to the database without validation (because it’s empty), and then allow the users to edit this record in order to complete it, and validate from then on out.Now I’ve run into a pretty basic problem: I can’t seem to save a model without validating it under any circumstances.I’ve tried the following in the console:model = # Returns RuntimeError: Called id for nil, which would mistakenly

  • Andrew Arrow
    ruby-on-rails ruby ruby-on-rails-3 mixins monkeypatching 2014-2-12 20:08:56
    If you are a new developer to a large (very large!) rails app it can be really difficult to trace through the flow of what is calling what, where a method is defined, and how to ‘grok’ how the whole thing works.What are best practices for how to find information like:I’m in class Foo and it calls a method bar but there is no def bar in the file. It must be mixed in or a concern or monkey patched etc. in somehow. What are steps 1, 2, 3 for where to look? I don’t see anything obvious at the top

  • rails_has_elegance
    ruby-on-rails-3 amazon-ec2 sunspot sunspot-rails sunspot-solr 2014-2-12 10:50:58
    I think sunspot is super awesome, but I feel like in all the screencasts and descriptions the way to set it up in a production environment is not covered that much. I’d say I’m still fairly new to rails at all, I’ve deployed my app to amazon ec2 with rubber and so far everything works fine, however, I don’t know a starting point of how to set up sunspot for my app. The rake sunspot:solr:start task is only for development, so how would I approach this in production? Would I create a new instance

  • scientiffic
    ruby-on-rails-3 heroku 2014-2-11 22:08:57
    I know there are a lot of these questions on Github (I’ve looked through all of them), but none of the answers have worked for me.I am getting the error “Could not find libv8- in any of the sources” when I try “git push heroku master.” I specify the version of libv8 in my Gemfile (with gem “libv8”, “~>”), and I think this is reflected in my Gemfile.lock (“libv8 (”). I don’t understand why it’s looking for version when I’ve specified I made sur

  • Habfast
    osx bash shell unix version 2014-2-16 16:08:47
    I’m being very confused by the following happening in my terminal:my-computer:~$ which java /usr/bin/javamy-computer:~$ java -version java version “1.6.0_65” Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609) Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)my-computer:~$ sudo su Password:my-computer:/Users/paulhabfast$ which java /usr/bin/javamy-computer:/Users/paulhabfast$ java -version java version “1.7.0_45” Java(TM) SE Runtime Environment (build 1.7.0_45-b18)

  • Dan Dyer
    java osx swing x11 2014-2-16 15:26:16
    I would really like to be able to run our test suite on Xvfb so that swing windows don’t keep popping up in the way of my work. Unfortunately I cannot seem to find a way to get the java runtime to use the display specified in the DISPLAY environment variable. I suppose this is because the Mac JDK is hardwired to use the (non-X-based) Mac display.I can’t find any switches for the java command that say to use X either.Thanks in advance for any help you can give! Matt

  • Dummy Code
    java osx ubuntu 2014-2-16 13:25:17
    I have a class that calls methods from another class. I compiled and ran it on Ubuntu 13.04 and it runs fine. On OSX 10.8.4, I get the following output:Exception in thread “main” java.lang.NoSuchMethodError: Complex.equals(LComplex;)Zat ComplexTester.main( tried running it in Eclipse, Netbeans and terminal and I get the same output. Any help would be greatly appreciated.Complexpublic class Complex {private double real;private double imaginary;/*** * @param real the real pa

  • Thomi
    c++ debugging osx memory-leaks malloc 2014-2-16 9:45:23
    I want to use the MallocDebug app to find some memory leaks in my app. I’m running Mac OS X 10.6.2. Whenever I try and following the instructions listed in this guide, I get the following error:dyld: could not load inserted library: /usr/lib/libMallocDebug.A.dylibTrace/BPT trapI have verified that the .dylib file exists, and I get the same error no matter which app I try and run (it’s not limited to my application). Several others have reported this problem as well, but so far no one has found a

  • Neelam Sharma
    osx javafx executable-jar 2014-2-16 9:05:11
    I am running Mac OS X 10.7.5 on VMware player.I have installed these on my system -I have jdk-7u12-ea-bin-b07-macosx-x86_64-27_dec_2012.dmg jre-7u10-macosx-x64.dmg netbeans-7.2.1-ml-javase-macosx.dmgI have set java Java Home pointing to java 1.7. On command prompt it showing version as -Java(TM) SE Runtime Environment (build 1.7.0_12-ea-b07)Java HotSpot(TM) 64-Bit Server VM (build 24.0-b28, mixed mode)Whenener I am trying to run a jar file created from my JavaFX application. It throw this fatal

  • Mike2012
    osx cocoa sandbox codesign nsopenpanel 2014-2-16 6:52:03
    I am currently trying to sandbox my app and I have been running into some strange issues with the NSOpenPanel. I am currently getting the following error when I try to display my NSOpenPanel:Error: Objective-C runtime exception: -[NSRemoteOpenPanel orderFront:]: unrecognized selector sent to instance 0x16a1630I have read some other posts that explain that when you enable sandboxing the OS will use an NSRemoteOpenPanel instead of an NSOpenPanel and that this class may not directly inherit from

  • Robert Lauriston
    java osx maven conflict 2014-2-15 22:44:29
    This is the output from java -version:java version “1.7.0_25” Java(TM) SE Runtime Environment (build 1.7.0_25-b15) Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)This is the output from mvn -version:Java version: 1.6.0_51, vendor: Apple Inc. Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home Default locale: en_US, platform encoding: MacRoman OS name: “mac os x”, version: “10.8.4”, arch: “x86_64”, family: “mac”How do I force Maven to use 1.7?

  • genpfault
    osx opengl osx-lion opengl-3 2014-2-15 22:33:36
    I’m writing a mac application that draws some of its UI on NSOpenGLView using OpenGL with legacy profile.My app is targeted to OS X 10.7 and later.If I migrate to OpenGL 3.2, would it prevent some users with Lion to run it, or every Mac with Lion supports OpenGL 3.2 anyway?

  • alf
    java osx apple java-7 openjdk 2014-2-15 16:52:27
    Hi guys : I’ve seen some increased traffic about java 7 lately, however suns sight isn’t clear on wether there do or do not exist java 7 versions that are running in production environments. Also, I’ve seen that there is the open jdk 7 resources are available, but i havent been able to find a download… So – am I just behind the times here with my Java SE 6 ? What is the release date for java 7 and where is the ideal place to get updates on it ? Im talking about the JDK here. And if it is av

  • PeeHaa
    osx cocoa icons 2014-2-15 11:28:21
    I want to change the application icon when a button is pressed, or when the app is in a particular state (updating data for example). But I can’t find the way to do it.For example the Steam icon, that when an update is downloading or uploading data have a line of points added to the normal icon of Steam.I’ve searched but can not find the way to go.For example in the case of the Steam icon, and added these lines, superimposing two PNG, the upper transparent background??Is it possible to complete