{"id":6875,"date":"2014-05-08T00:27:41","date_gmt":"2014-05-08T00:27:41","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/05\/08\/ruby-on-railsactiverecordblogsruntime-errordeclarative-authorizationrelated-issues-collection-of-common-programming-errors\/"},"modified":"2014-05-08T00:27:41","modified_gmt":"2014-05-08T00:27:41","slug":"ruby-on-railsactiverecordblogsruntime-errordeclarative-authorizationrelated-issues-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/05\/08\/ruby-on-railsactiverecordblogsruntime-errordeclarative-authorizationrelated-issues-collection-of-common-programming-errors\/","title":{"rendered":"ruby-on-rails,activerecord,blogs,runtime-error,declarative-authorizationRelated issues-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/2cb10012e7ca5f591156020bcf969c6a?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nDuncan<br \/>\nruby-on-rails apache passenger compatibility ruby-1.9.3<br \/>\nI am trying to set up my Rails app on Apache. I am using Passenger to load my Rails App. It seems like Passenger does not support the new Ruby hash format x: y but supports the old one \ud83d\ude21 =&gt; y. The Ruby version I am using is 1.9.3This is the error message I get:categories_controller.rb:12: syntax error, unexpected &#8216;:&#8217;, expecting &#8216;}&#8217; format.json { render json: @categories } categories_controller.rb:23: syntax error, unexpected &#8216;:&#8217;, expecting &#8216;}&#8217; format.json { render json: @category } categorie<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/4d60393d3a209758604a92a77b00f3e7?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nHayk Saakian<br \/>\nruby-on-rails heroku mongoid delayed-job<br \/>\nI&#8217;m using delayed_job to create large numbers of jobs, nearly all at one time, to be done at a later time, if the number of jobs gets too high, after a certain amount of time, every job is cleared from the queue regardless of it&#8217;s state.the following rails project illustrates this issue: https:\/\/github.com\/hayksaakian\/taskbreakerto recreate the issue, create several tasks (say 5 to 15), each with around 100 goals (from the web interface, or console)then in console attempt to do these tasks with:<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/33bf71deb4a0c2deadf82f0e3b4e8659?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nBearish_Boring_dude<br \/>\nruby-on-rails ruby<br \/>\nif (ax_response = OpenID::AX::FetchResponse.from_success_response openid_response)The above line if i remove the ( ) paranthesis it throws a syntax error ..Unexpected tIdentifier . Why ?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/42ce858cc45b93046b6aabe59547243d?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nOded Harth<br \/>\nruby-on-rails heroku<br \/>\nI got this error:syntax error, unexpected kEND, expecting $endWhat&#8217;s the difference between kEND and $end ?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/1e6c3380cae022590d9aa07b94cbb2c4?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nDeon Heunis<br \/>\nruby-on-rails ruby ruby-on-rails-3<br \/>\nThe following code results in an errorExample 1if params[:id] == &#8216;2&#8217; || params.has_key? :idabort(&#8216;params id = 2 or nothing&#8217;) endsyntax error, unexpected tSYMBEG, expecting keyword_then or &#8216;;&#8217; or &#8216;\\n&#8217; if params[:id] == &#8216;2&#8217; || params.has_key? :idHowever, switching the conditional statements || adding parentheses works 100%.Example 2if params.has_key? :id || params[:id] == &#8216;2&#8217; abort(&#8216;params id = 2 or nothing&#8217;) endExample 3if (params[:id] == &#8216;2&#8217;) || (params.has_key? :id)abort(&#8216;params id = 2 or nothi<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/f03492fe63c2f4572938253c71e878fc?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nZiu<br \/>\nruby-on-rails<br \/>\nI am trying to complete the signup part,but every time i try to signup at the site the server would show the information that the database had rollback. And i do can&#8217;t find the new user in the db file.Started POST &#8220;\/users&#8221; for 127.0.0.1 at 2014-03-12 17:09:50 +0800 Processing by UsersController#create as HTML Parameters: {&#8220;utf8&#8243;=&gt;&#8221;?&#8221;, &#8220;authenticity_token&#8221;=&gt;&#8221;CkaL2ZiNW8FWXRjPawShiNhQGmP+EHDMgSBbSyihE5E=&#8221;, &#8220;user&#8221;=&gt;{&#8220;name&#8221;=&gt;&#8221;foo1&#8221;, &#8220;email&#8221;=&gt;&#8221;foo@foobar.org&#8221;, &#8220;password&#8221;=&gt;&#8221;[F<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/graph.facebook.com\/596026232\/picture?type=large\" \/><br \/>\nTaylor Mitchell<br \/>\nruby-on-rails ruby<br \/>\nI am trying to make my users have a profile id when they create their account so I can create a profile page based on id. I do not want them to have a username. The problem is when I created a user it worked just fine, however when I edit the user information which is what I use on the profile page it gives me the error&#8230;syntax error, unexpected tSYMBEG, expecting keyword_do or &#8216;{&#8216; or &#8216;(&#8216; before_save :create_unique_profile_idThey sign up using email and passwords and when they go to edit they h<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/e59139637373113b3fd32854f2f37064?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nEdward Casta\u00f1o<br \/>\nruby-on-rails ruby-on-rails-3 syntax-error<br \/>\nI am new to programming and teaching myself RoR. I am using http:\/\/ruby.railstutorial.org as my first guide. I thought I was doing well, then a seemingly simple issue came up that even after several reads of good post on stack related to this topic I still can&#8217;t fix it. I would appreciate it if someone could kindly point out the issue\/s I have within my code.Thank you.I am getting this error.C:\/Sites\/rails_projects\/sample_app\/app\/controllers\/users_controller.rb:23: syntax error, unexpected $end,<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/c00b72c08727d75edc5888b11a7760ff?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJean-R\u00e9my Revy<br \/>\nruby-on-rails unexpectendoffile<br \/>\ni&#8217;m just started making blog via RoR, using blog-from-scratch guide and i&#8217;ve got some unexpected content on my index page. Here is the picture: http:\/\/i.minus.com\/ibpnYRmlPv7IW3.png Some hash-like string under the title is that unexpected thing.index_page code:&lt;h1&gt;Recent posts&lt;\/h1&gt; &lt;table&gt;&lt;tr&gt;&lt;th&gt;Title&lt;\/th&gt;&lt;th&gt;Text&lt;\/th&gt;&lt;\/tr&gt;&lt;%= @posts.each do |post| %&gt;&lt;tr&gt;&lt;td style=&#8221;border: solid 2px;&#8221;&gt;&lt;%= post.title %&gt;&lt;\/td&gt;&lt;t<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/4e8a69f94a055d7599b7e4b2d9f6d5e7?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nkrishnareddy<br \/>\nruby-on-rails json httpwebrequest<br \/>\nI am sending below json data as a param from body of posterzip='{&#8220;zipcode&#8221;:&#8221;501234&#8243;,&#8221;cityname&#8221;:&#8221;hyd&#8221;,&#8221;countyname&#8221; : &#8220;Poweshiek&#8221;,&#8221;statename&#8221; : &#8220;Iowa&#8221;}&#8217;&amp;Accept=application%2FjsonI am getting error&#8217;MultiJson::DecodeError`enter code here`743: unexpected token at &#8216;zip='{&#8220;zipcode&#8221;:&#8221;501234&#8243;,&#8221;cityname&#8221;:&#8221;hyd&#8221;,&#8221;countyname&#8221; : &#8220;Poweshiek&#8221;,&#8221;statename&#8221; : &#8220;Iowa&#8221;}&#8217;&amp;Accept=application%2Fjson&#8217;Rails.root: e:\/rails\/vivadesi&#8217; bel<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/a16f6d01214879396b722974c0a27ce2?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nkolosy<br \/>\nmysql activerecord jruby<br \/>\nthis happens when i deploy my app to glassfish as a war:[#|2011-06-24T17:11:40.903-0500|INFO|glassfish3.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=135;_ThreadName=Thread-1;|PWC1412: WebModule[null] ServletContext.log():\/!\\ FAILSAFE \/!\\ Fri Jun 24 17:11:40 -0500 2011Status: 500 Internal Server Erroryield called out of block\/home\/glassfish\/glassfish\/domains\/domain1\/applications\/trainer-web\/WEB-INF\/gems\/gems\/activerecord-jdbc-adapter-1.1.2\/lib\/arjdbc\/jdbc\/connection.r<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/538bd3553b7540f411a84101e4cbf294?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nGal Ben-Haim<br \/>\nmysql ruby-on-rails-3 activerecord<br \/>\nI&#8217;m changing my Rails 3.2 app from Postgres to Mysql,I have a model with default_scope :order =&gt; &#8216;posts.created_at DESC&#8217;if i query for posts with IDs between with the following code:Post.find(:all, :conditions =&gt; [&#8216;id &gt;= ? AND id &lt;= ?&#8217;, min_id.to_i, max_id.to_i]) if min_id &amp;&amp; max_idI get wrong ordered results (because multiple rows have the same created_at time), for example: if post1 was created by code before post2 but they have the same created_at timestamp I would expect the<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/d56e8ad656ebfa19e9ef4c7daa9fd447?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nLee<br \/>\nruby-on-rails activerecord inheritance super destroy<br \/>\nI have a Commentable class that inherits from ActiveRecord::Base and an Event class that inherits from Commentables.I have overwritten the destroy methods in both of these classes, and Event.distroy calls super. However, some unexpected things happen. Specifically, the Event&#8217;s has_and_belongs_to_many associations are deleted. I think this is happening because some modules are getting included between the Commentables and the Event class, but not sure if there is a way to stop this.Here&#8217;s the sim<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/c59485bbb7519d953f38b118bbf63c14?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nesilver<br \/>\nruby-on-rails json serialization activerecord<br \/>\nRuby on Rails adds the &#8220;as_json&#8221; method to many common classes, which turns ActiveRecord objects into hash objects that can then be sent to a JSON serializer. Recently I encountered a bug in my code related to this method and it&#8217;s treatment of boolean values.I can summarize the bug very concisely:{&#8220;foo&#8221; =&gt; true}.as_jsonI would expect this method to return an identical hash. Instead, it returns{&#8220;foo&#8221; =&gt; &#8220;true&#8221;}This appears to be by design, as per line 157 in encoding.rbAS_JSON = ActiveSuppo<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/3fa9c404fb2bf9aef66e0482b331bf39?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nNox<br \/>\nruby-on-rails activerecord cancan<br \/>\nI&#8217;m setting up a working application on a new environment, and after running &#8216;bundle install&#8217; I try to launch an application. And I get a following error:ActionView::Template::Error (compile error D:\/Dev_apps\/Ruby187\/lib\/ruby\/gems\/1.8\/gems\/activerecord-3.1.0.rc5\/lib\/active_record\/attribute_methods\/read.rb:85: syntax error, unexpected kEND D:\/Dev_apps\/Ruby187\/lib\/ruby\/gems\/1.8\/gems\/activerecord-3.1.0.rc5\/lib\/active_record\/attribute_methods\/read.rb:87: syntax error, unexpected $end, expecting kEND<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/ece932c97301b42dd341e8ca378657b1?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nleonel<br \/>\nruby-on-rails ruby activerecord<br \/>\nI have this query but it&#8217;s not giving me the expected results: User.all(:conditions =&gt; [&#8220;company_id == ? AND role_id == ? OR role_id == ? OR role_id == ?&#8221;, X, 1,2,3 ])It&#8217;s supposed to mean: Get all the users with X company_id AND their roles can be either 1 or 2 or 3.So it can be either of those roles, but ALL of those users have to be from THAT company_id.<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/36410bc698c05fe9cc30bca18d8e96ed?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMatt Mazur<br \/>\nruby-on-rails-3 activerecord<br \/>\nMy Rails 3 app has a UserAction object that I use to store information about actions taken on my site.I&#8217;m trying to filter the results so that I only get ones where the data attribute is set to a specific value, but for some reason it always returns an empty array.Here&#8217;s an example from the console showing the first record, a query that returns it based on the &#8216;action&#8217; attribute, and the one that&#8217;s not working for the &#8216;data&#8217; attribute:&gt; UserAction.first UserAction Load (39.6ms) SELECT &#8220;user_<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/71c4d5acc036fb3fb4e07ada2c667da5?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nkdavie<br \/>\nruby-on-rails activerecord associations has-one<br \/>\nI have a has_one association for a location on a company entity:class Location &lt; ActiveRecord::Baseattr_accessible :city, :country, :postal_code, :state endclass Company &lt; ActiveRecord::Basehas_one :headquarters, :class_name =&gt; &#8220;Location&#8221; endThe underlying schema for the company entity contains a location_id attribute. I expect I should be able to access a company&#8217;s headquarters location info like so:Company.find(12345).headquartersHowever, this results in an exception:SELECT &#8220;locations<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/92382fcf9ab5f83cc3b083da2d5323e7?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\najw<br \/>\nruby-on-rails ruby activerecord rake<br \/>\nWhen I run the rake task &#8220;test:functionals&#8221; for my RoR app, it produces this error: &gt;rake test:functionalsrake aborted! C:\/Ruby192\/lib\/ruby\/gems\/1.9.1\/gems\/activerecord-3.2.9\/lib\/active_record\/transactions.rb:380: syntax error, unexpec ted keyword_end, expecting $endTasks: TOP =&gt; test:functionals =&gt; test:prepare =&gt; db:test:prepare =&gt; db:abort_if_pending_migrations =&gt; db:load_conf igI have checked my code for syntax errors. Why would transactions.rb have a syntax error?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/1d8005b6b5d04a8b2d89ef09acbd03b9?s=32&amp;d=identicon&amp;r=PG&amp;f=1\" \/><br \/>\nfct<br \/>\nactiverecord ruby-on-rails-3.2 globalize3<br \/>\nI have complex Model query with globalized fields, containing:1) scalar-fields: select(&#8220;field1, field3, joined1.field1, count(1), &#8230;&#8221;)2) inner joins: joins(:book =&gt;[{:article =&gt; :writer}, &#8230; ])3) where: where(&#8220;writer.name like ?&#8221;, &#8220;%#{name}%&#8221;)4) group-by: group(&#8220;field1, field3, &#8230; &#8220;)5) order-by: order(&#8220;count(1) desc&#8221;)This query works but show me a lot of problems: n+1 queries, retrieve unrequested fields (globalize fields on join i18n), unaccepted clauses in select as count(1), always retriev<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/e65c9c797913ad33f7a4723a0fd9c4b3?s=32&amp;d=identicon&amp;r=PG&amp;f=1\" \/><br \/>\nuser2821643<br \/>\nphp mysql blogs<br \/>\nHello I am working on making a blog php script and I cant get it to work. I keep getting a error.If it is useful I am using Microsoft WebMatrix 3. &lt;?php Print &#8220;&lt;div class=&#8221;&#8221;post&#8221;&#8221;&gt;&lt;h2 class=&#8221;&#8221;title&#8221;&#8221;&gt;&lt;a href=&#8221;&#8221;#&#8221;&#8221;&gt;&#8221; .$info[&#8216;title&#8217;] .&#8221;&lt;\/a&gt;&lt;\/h2&gt;&lt;p class=&#8221;&#8221;meta&#8221;&#8221;&gt;Posted by &lt;a href=&#8221;&#8221;#&#8221;&#8221;&gt;&#8221; .$info[&#8216;name&#8217;] .&#8221;&lt;\/a&gt;&#8221;.$info[&#8216;date&#8217;] .&#8221;&lt;div class=&#8221;&#8221;entry&#8221;&#8221;&gt;&lt;p&gt;&#8221;.$info[&#8216;post&#8217;]&#8221;&lt;\/p&gt;&lt;\/div&gt;&lt;\/div&gt;&#8221;; ?&gt;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/72be9b30e3be07021c29c7ba3d13e0ed?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nYannis Rizos<br \/>\nblogs wordpress<br \/>\nI work for a small company where I maintain a number of project all at once. I would like to create a blog and note software changes\/update so that I can keep track of things. Plus it will also serve as help tool for other if they need help. I would like to install something locally on my machine or network, either ASP or PHP is fine. Which software would you recommend? Is it good idea, bad idea? Has anyone done it? I have worked with wordpress and I like it but I am afraid it is not best for co<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/b106e82d6bb824e8cb3056954bc8e8f7?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nSuresh Pattu<br \/>\njavascript jquery json wordpress blogs<br \/>\nI am trying to Display Latest Post Outside of WordPress with JSON and jQuery I followed the steps which are given in this blog post. But is not working for me. Here is the blog post linki tried Here it is not workingit shows Uncaught SyntaxError: *Unexpected token &lt; blog.rangde.org\/api\/get_recent_posts\/?count=1&amp;page=0&amp;callback=jQuery17206551494831219316_1338883023819&amp;_=1338883023833:3*<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/658cede29dcda2473475de8e9b35c51b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMr C<br \/>\njavascript html css comments blogs<br \/>\nBlog URL: http:\/\/theforeigntwo.blogspot.com.auURL of concern: http:\/\/theforeigntwo.blogspot.com.au\/2012\/07\/steve-nash-post.html?showComment=1344125682577#c3764506429069823377In the comments, there is a second &#8220;Reply&#8221; button at the bottom, filling about 400px, and an &#8220;Add comment&#8221; button about the same size, which I would like to remove. The &#8220;Add comment&#8221; button seems redundant since there is already a comment form in place &#8211; it loads a larger comment form when clicked.I&#8217;m not sure on which co<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/d86ac1744ece33045f04f05c9fc8900d?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nVieenay<br \/>\nruby-on-rails ruby blogs<br \/>\nI am trying to get user who edits article in blog. I am able to get user who create article but got stuck while getting user who edits it. I tried with &lt;%= @aritcle_update_user.username unless @article.user.nil? %&gt; putting it in articles\/show.html.erb(basically I am trying to show editing user on show page of articles). I have put this def update@article = Article.find(params[:id])if @article.update_attributes(params[:article])flash.notice = &#8220;Article &#8216;#{@article.title}&#8217; Updated!&#8221;redirect_<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/5f32c963399531a8230d0e33e74d4841?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nRajesh<br \/>\nruby-on-rails activerecord blogs runtime-error declarative-authorization<br \/>\nI am trying to configure declarative authorization to my rails blog app. After doing all as required, I did rails s to start the server. I have got stuck with the following error.rails s \/var\/lib\/gems\/1.8\/gems\/activerecord-3.2.9\/lib\/active_record\/dynamic_matchers.rb:50:in `method_missing&#8217;: undefined local variable or method `scopes&#8217; for ActiveRecord::Base:Class (NameError)from \/var\/lib\/gems\/1.8\/gems\/declarative_authorization-0.5.2\/lib\/declarative_authorization\/in_model.rb:37:in `included&#8217;from \/v<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/981b46396a22bf5a8190506fe892b3b5?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAhmad Alfy<br \/>\nphp joomla blogs addthis custom-url<br \/>\nI&#8217;ve overwritten the &#8220;blog.php&#8221;, for Category Blog to put the AddThis social media sharing plugin at the bottom of each article. Working on joomla 3.0The Category blog layout displays many articles per page. By default AddThis uses your current page to share\/like\/tweet\/etc.My add this code looks like this:&lt;div class=&#8221;article-sharing&#8221;&gt;&lt;!&#8211; AddThis Button BEGIN &#8211;&gt;&lt;div class=&#8221;addthis_toolbox addthis_default_style&#8221;&gt;&lt;a class=&#8221;addthis_button_facebook_like&#8221; fb:like:layout=&#8221;button_<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/e2739e980505533b4ada49fb3e4c27b9?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\ntinku<br \/>\nfacebook login localhost blogs<br \/>\nError obtained is An error occurred, please try again laterI created new facebook app and go the APP ID. I entered domain name as blogspot.in and redirect URL as my blogI then used the below code from&lt;div id=&#8221;fb-root&#8221;&gt;&lt;\/div&gt;&lt;script&gt;window.fbAsyncInit = function() {FB.init({appId : &#8216;YOUR_APP_ID&#8217;,status : true, cookie : true,xfbml : true,oauth : true,});};(function(d){var js, id = &#8216;facebook-jssdk&#8217;; if (d.getElementById(id)) {return;}js = d.createElement(&#8216;sc<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/8026e876f3320b9bceca5dc0c828d142?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMoayad Mardini<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/0a9f7b97008dae533d117853f06bd6c0?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nwebmaster alex l<br \/>\njavascript blogs word-count<br \/>\nI have a div with an ID &#8220;shortblogpost&#8221;. I would like to count up to 27th word then stop and add &#8220;&#8230;&#8221; at the end.I was trying the following code. Problem, Its counting letters and not words. I think its using jQuery and not strait up JavaScript?I need to use JavaScript for various server reasons only&lt;script type=&#8221;text\/javascript&#8221;&gt; var limit = 100,text = $(&#8216;div.shortblogpost&#8217;).text().split(\/\\s+\/),word,letter_count = 0,trunc = &#8221;,i = 0;while (i &lt; text.len<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/45c5d8af57b09ce0ded95be90bf0a5ad?s=32&amp;d=identicon&amp;r=PG&amp;f=1\" \/><br \/>\nuser12920<br \/>\nphp runtime-error<br \/>\nParse error: syntax error, unexpected &#8216;Pre&#8217; (T_STRING), expecting &#8216;,&#8217; or &#8216;;&#8217; in your code on line 719719: if (get_the_author_meta(&#8216;Pre-Rolls&#8217;) != &#8216;0&#8217;) { echo get_the_author_meta(&#8216;Pre-Rolls&#8217;); }I dont see where I&#8217;m missing a , or ;?Does it not like the &#8220;-&#8221; in Pre-Rolls? Is that the problem?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/ace1d2b201790e83a06dab6de776c4b7?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nPupil<br \/>\nmatlab optimization constraints limit runtime-error<br \/>\nI am using lower limit and upper limit in the fminbnd function according to the legit domain values of my coefficients as following:[x,fval,exitflag] = fminbnd(@(x) minimize_me(sill, x(1), x(2), x(3), cov), [x1l x2l x3l], [x1u x2u x3u], opts);Where the [x1l x2l x3l] and [x1u x2u x3u] are the vectors representing the lower limit and upper limit for the optimized coefficients. The domain of my problem is given as following:0&lt;=x1l&lt;=5 0&lt;=x1u&lt;=50&lt;=x2l&lt;=5 0&lt;=x2u&lt;=50&lt;=x3l&lt;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/dS5Ah.jpg?s=32&amp;g=1\" \/><br \/>\nVed<br \/>\njavascript dom runtime-error appendchild<br \/>\nI am getting runtime JS error like : &#8220;Unexpected call to method or property&#8221;. Here is the code :var comboInput = document.getElementById(&#8220;Combo&#8221;);var option1 = document.createElement(&#8220;option&#8221;);option1.value = &#8220;-1&#8221;;option1.innerHTML = &#8220;&#8211;Select&#8211;&#8220;;comboInput.appendChild(option1); \/\/At this line debugger breaks and\/\/ throws the above errorI gone through some of similar questions on SO about this issue but still not getting the solution.Please help.. Thanks in adv&#8230;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/37c86a2279b5aa71e0a5ec13a5586f1e?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMaddy<br \/>\njava list arraylist runtime-error<br \/>\nI have the following code in java, which takes in input from the user. It is basically a simple database system.ArrayList&lt;String&gt; commands = new ArrayList&lt;String&gt;(); ArrayList&lt;ArrayList&lt;String&gt;&gt; blocks = new ArrayList&lt;ArrayList&lt;String&gt;&gt;(); ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;();System.out.println(&#8220;Enter the transaction commands.\\n&#8221;);Scanner scan = new Scanner(System.in);while(!(line = scan.nextLine()).toLowerCase().equals(&#8220;end&#8221;)) {command<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/7c5af35114e9950224be38bb326dda6d?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nThe Starfox<br \/>\nandroid android-activity android-service runtime-error<br \/>\nIm getting an &#8220;java.lang.IllegalAccessError class ref in preverified class resolved to unexpected implementation&#8221; error when I push a button that starts a method in MainActivity which is supposed to start a new Activity. What can I do to fix this? This is my first attempt to make an android application, so ill need step by step instructions :)Also I havent been able to test if it works yet, but if you notice anything wrong with my AugiActivity service implementation or the local broadcast impl<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/nZEUQ.png?s=32&amp;g=1\" \/><br \/>\nPeeHaa<br \/>\nphp runtime-error<br \/>\nam new to oops in php. this is my first oops program. this program is so basic(form program) but i can&#8217;t figure out what is tat i have to do. Sorry if this is a newbe question, but I am new at this. am getting the error as Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in \/ni.class.php on line 34 line34 :$str=$ab-&gt;startform(&#8216;#&#8217;,&#8217;post&#8217;,&#8217;myform&#8217;).&#8221;.&lt;?phpclass ni{function startForm($action=&#8217;#&#8217;,$method=&#8217;post&#8217;,$id=NULL){$str=&#8221;&lt;form&gt;&lt;action =\\&#8221;$action\\&#8221; method=\\&#8221;$<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/0c0c7661bfeb8e58ecc07fb88c433469?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nThe Phoenix<br \/>\nwindows-7 laptop troubleshooting asus runtime-error<br \/>\nHere is one for you to sink your \u201cteeth\u201d into! All my Window 7 Troubleshooters will not run. They all come up with error code 0x80070003 which Fix It indicates is a runtime error as I have it. I have an Asus K53E-BBR21 laptop with an I5 CPU @2450. It is basically standard hardware and software equipment with an added 4 Gig of Ram for a total of 8 Gig Ram.I have cold rebooted and still no improvement. I have noted that other programs like Asus Vibe 2 will not boot or boot and shut down at start<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/fb739ca4f29b63cd15f103501aa9d82f?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nramcha<br \/>\nc data-structures runtime-error tournament<br \/>\nI am trying to implement a simple tournament in C.#include &lt;stdio.h&gt;int main(void) {int tourn[100], n, i;printf(&#8220;Give n:&#8221;);scanf(&#8220;%d&#8221;, &amp;n);printf(&#8220;\\n n = %d \\n&#8221;, n);for(i = n; i &lt;= (2*n)-1; i++)scanf(&#8220;%d&#8221;, &amp;tourn[i]);build(tourn, n);printf(&#8220;\\n Max = %d \\n&#8221;,tourn[1]);printf(&#8220;\\n Next Max = %d \\n&#8221;,nextmax(tourn, n));}void build(int tourn[], int n) {int i;for(i = 2*n-2; i &gt; 1; i = i-2)tourn[i\/2] = max(tourn[i], tourn[i+1]);} int nextmax(int tourn[],int n) {int i = 2;int next;nex<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/f09067f319ab59616926ba35e866fa70?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nl19<br \/>\nperl sed runtime-error<br \/>\nI&#8217;ve got file.txt which looks like this:C00010018;1;17\/10\/2013;17:00;18;920;113;NONE C00010019;1;18\/10\/2013;17:00;18;920;0;NONE C00010020;1;19\/10\/2013;19:00;18;920;0;NONEAnd I&#8217;m trying to do two things:Select the lines that have $id_play as 2nd field. Replace ; with &#8211; on those lines.My attempt:#!\/usr\/bin\/perl$id_play=3; $input=&#8221;.\/file.txt&#8221;; $result = `sed s@^\\([^;]*\\);$id_play;\\([^;]*\\);\\([^;]*\\);\\([^;]*\\);\\([^;]*\\);\\([^;]*\\)\\$@\\1-$id_play-\\2-\\3-\\4-\\5-\\6@g $input`;And I&#8217;m getting this error:sh:<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/b1a5c24fd4221b2b7d7cdcd49bee913b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\n00101010 10101010<br \/>\nc# visual-studio-2010 visual-studio error-handling runtime-error<br \/>\nI have a ErrorRecorder App, which prints the error report out and asks if the user wants to send that report to me. Then, I have the main app. If an error occurs, It writes the error report to a file and asks ErrorRecorder to open that file to show user the error report.So I am catching most of my errors using Try\/Catch. However, what if an error occurs that was completely unexpected and it shuts down my program.Is there like an Global\/Override method or something of that kind, that tells the pr<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/5f32c963399531a8230d0e33e74d4841?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nRajesh<br \/>\nruby-on-rails activerecord blogs runtime-error declarative-authorization<br \/>\nI am trying to configure declarative authorization to my rails blog app. After doing all as required, I did rails s to start the server. I have got stuck with the following error.rails s \/var\/lib\/gems\/1.8\/gems\/activerecord-3.2.9\/lib\/active_record\/dynamic_matchers.rb:50:in `method_missing&#8217;: undefined local variable or method `scopes&#8217; for ActiveRecord::Base:Class (NameError)from \/var\/lib\/gems\/1.8\/gems\/declarative_authorization-0.5.2\/lib\/declarative_authorization\/in_model.rb:37:in `included&#8217;from \/v<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/344b390380142a0b3b7da627b8638199?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAndr\u00e9s<br \/>\nruby-on-rails-3.2 declarative-authorization<br \/>\nI&#8217;m tracking the activities with a model:class Activity &lt; ActiveRecord::Basebelongs_to :model, polymorphic: true&#8230; endAn the idea is the user can read one activity only if he can read the model (polymorphic). This is what I made:has_permission_on :activities, to: :read doif_permitted_to :read, :model, context: :milestones # or&#8230;if_permitted_to :read, :model, context: :tasks endBut when I tried in console:Activity.with_permissions_to(:read)I get:NoMethodError: undefined method `length&#8217; for<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/0140c747b563458f7baa2dfdcbb0a0e6?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nlulalala<br \/>\nruby-on-rails-3 declarative-authorization rails-cells<br \/>\nusing the gems cells and declarative_authorization (along with Devise) and I&#8217;m trying to figure out how to include the permitted_to? into the cell templates. So far I&#8217;ve added this to my cells Cell (the Devise one works for it&#8217;s helpers):class SidebarCell &lt; Cell::Railsinclude Devise::Controllers::Helpershelper_method :current_userinclude Authorization::AuthorizationHelperhelper_method :permitted_to?def display(args)@object = args[:object]@notice = args[:notice]@alert = args[:alert]renderenden<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/de9a3a0d866baded15bb89953a0d8060?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nSteven Ou<br \/>\nruby-on-rails bundler declarative-authorization<br \/>\nI&#8217;m running bundler with rails 2.3.4.I&#8217;m trying to get declarative_authorization to work (I added it to my Gemfile). The error I&#8217;m getting is undefined local variable or method &#8216;filter_resource_access&#8217;.I&#8217;m guessing this means that declarative_authorization isn&#8217;t loading? Since I&#8217;m using bundler I don&#8217;t have a config.gem line for it in environment.rb. If I add it in, though, it throws an error trying to start the server: Uninitialized constant Authorization.Not too sure what to do&#8230; Help would b<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/59f475bf2dfe594c642b65b80587b385?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJamal Abdul Nasir<br \/>\nruby-on-rails declarative-authorization<br \/>\ni am using declarative_authorization&#8230; when i try to access current_user, it gives me the error undefined local variable or method `current_user&#8217;&#8230; can anyone help me out..?thnx&#8230;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/f34e08da1ca2435f663356b93912dd1f?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAntarr Byrd<br \/>\nruby-on-rails declarative-authorization<br \/>\nI keep getting that error when trying to access any of my views. I&#8217;m trying to setup Declaritive Authorization.class User &lt; ActiveRecord::Baseacts_as_authentic do |c|c.login_field = :usernameendROLES = %w[admin moderator subscriber]has_and_belongs_to_many :channelshas_many :channel_modsnamed_scope :with_role, lambda { |role| {:conditions =&gt; &#8220;roles_mask &amp; #{2**ROLES.index(role.to_s)} &gt; 0 &#8220;} }def role_symbolsrole.map do |role|role.name.underscore.to_symendenddef roles=(roles) self.r<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/x6tCV.jpg?s=32&amp;g=1\" \/><br \/>\nLance Roberts<br \/>\nruby-on-rails ruby roles declarative-authorization<br \/>\nI&#8217;m getting the following error in my deployed Rails 2.3.5 application:NoMethodError (undefined method `to_sym&#8217; for nil:NilClass):My local testing install of the application, which uses Sqlite, doesn&#8217;t get the error, but my deployed app running Mysql does. The only other difference between the two is I&#8217;m running Ruby 1.8.7 on my local machine and 1.8.6 on my deployment server.I&#8217;ve included the code from User.rb and the error log below. I set this up following the Declarative Authorization and<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/f34e08da1ca2435f663356b93912dd1f?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAntarr Byrd<br \/>\nruby-on-rails authlogic declarative-authorization<br \/>\nI get this error when trying to register a new user.NoMethodError (undefined method save&#8217; for nil:NilClass):app\/controllers\/users_controller.rb:49:increate&#8217;app\/controllers\/users_controller.rb:48:in `create&#8217;class UsersController &lt; ApplicationControllerbefore_filter :require_no_user, :only =&gt; [:new, :create]before_filter :require_user, :only =&gt; [:show, :edit, :update]#filter_resource_accessdef index@users = User.allrespond_to do |format|format.html # index.html.erbformat.xml { render :xm<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n<p>I discovery a place to host code\u3001demo\u3001 blog and websites.<br \/>\nSite access is fast but not money<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.m5zn.com\/newuploads\/2014\/01\/30\/jpg\/e7da807964b1fff.jpg\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Duncan ruby-on-rails apache passenger compatibility ruby-1.9.3 I am trying to set up my Rails app on Apache. I am using Passenger to load my Rails App. It seems like Passenger does not support the new Ruby hash format x: y but supports the old one \ud83d\ude21 =&gt; y. The Ruby version I am using is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6875","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6875","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6875"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6875\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6875"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6875"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6875"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}