JQuery-UI and Bootstrap Conflicts - jquery-ui

I have a Rails 3.2.5 app that is using Twitter Bootstrap. I am trying to use the JQuery UI datepicker. I have Googled this for days looking for a solution and can't find anything. I have a text field in a Rails view that I am trying to use with the JQuery datepicker. However, when I click in the text field, nothing happens.
In my Rails view, I have a simple text_field_tag like so:
<%= text_field_tag 'andrew' %>
In my associated CoffeeScript file:
$ ->
$('#andrew').datepicker
In the Chrome Developer Tools JavaScript Console, I see this error:
Uncaught TypeError: Object [object Object] has no method 'datepicker'
Now I have determined there is a conflict between JQuery-UI and Bootstrap. In that same JavaScript console, I can do this:
jQuery.noConflict();
and I get
function (a,b){return new e.fn.init(a,b,h)}
Then I can type:
$('andrew'.datepicker();
And I get:
[<input id="andrew" name="andrew" type="text" class="hasDatepicker">]
After this, when I go over to the browser window, clicking in the text field brings up the datepicker calendar just like I want it to.
So how do I get this to work in my code? That is, I am manually resolving the conflict in the JavaScript Console but I can't get it to work just through my code.

It looks like I have this one solved after much pain. I created a new project and slowly, methodically moved over pieces of my application to the new app. I finally uncovered a directory that was only in my project with the problem described above.
There was a 'public/assets' directory with the contents below. I don't recall creating this directory or putting these files in that directory. Renaming the directory to something different caused my JQuery-UI datepicker to work properly in conjunction with Twitter Bootstrap.
Here are the contents of public/assets:
-rw-r--r-- 1 andrunix staff 83360 Sep 3 18:01 application 6fc1172d858485077bbecdb82b96399a.css
-rw-r--r-- 1 andrunix staff 13546 Sep 3 18:01 application-6fc1172d858485077bbecdb82b96399a.css.gz
-rw-r--r-- 1 andrunix staff 100616 Sep 3 18:01 application-990a4cf0df42934fcc4c14aaf88b7ced.js
-rw-r--r-- 1 andrunix staff 35448 Sep 3 18:01 application-990a4cf0df42934fcc4c14aaf88b7ced.js.gz
-rw-r--r-- 1 andrunix staff 83294 Sep 3 18:01 application.css
-rw-r--r-- 1 andrunix staff 13484 Sep 3 18:01 application.css.gz
-rw-r--r-- 1 andrunix staff 100618 Sep 6 20:26 application.js
-rw-r--r-- 1 andrunix staff 35448 Sep 3 18:01 application.js.gz
-rw-r--r-- 1 andrunix staff 13826 Aug 30 17:42 glyphicons-halflings-f6675c325532ec11a984d58e172b8e2a.png
-rw-r--r-- 1 andrunix staff 8777 Aug 30 17:42 glyphicons-halflings-white-13553a5bf21ae3cc374006592488ec64.png
-rw-r--r-- 1 andrunix staff 8777 Aug 30 17:42 glyphicons-halflings-white.png
-rw-r--r-- 1 andrunix staff 13826 Aug 30 17:42 glyphicons-halflings.png
-rw-r--r-- 1 andrunix staff 368 Sep 5 15:00 manifest.yml
-rw-r--r-- 1 andrunix staff 6646 Aug 10 19:57 rails-be8732dac73d845ac5b142c8fb5f9fb0.png
-rw-r--r-- 1 andrunix staff 6646 Aug 10 19:57 rails.png
If anyone knows how this got created, that would put my mind at ease. Thanks!
Andrew

Related

How to setup Jenkins Xcode plugin for workspaces?

I am green to the iOS app development space. I need to setup a build in Jenkins for a new Swift application I built. As part of that, I used Cocoapods to manage dependencies which in turn, meant I now had a workspace instead of a simple project.
I'm now trying to build this application as part of our pipepline and have hit the following error:
FATAL: Since there are multiple projects in the workspace, you must be specify the location of the target project as Xcode Project File.
Build step 'Xcode' marked build as failure
Finished: FAILURE
The root of my project looks as follows:
$ ls -la
total 32
drwxr-xr-x 14 mcbint staff 448 15 Jan 15:16 .
drwxr-xr-x 3 mcbint staff 96 15 Jan 14:33 ..
drwxr-xr-x 13 mcbint staff 416 16 Jan 11:11 .git
-rw-r--r-- 1 mcbint staff 108 15 Jan 14:56 .gitignore
-rw-r--r-- 1 mcbint staff 501 15 Jan 14:56 Podfile
-rw-r--r-- 1 mcbint staff 379 15 Jan 14:56 Podfile.lock
drwxr-xr-x 9 mcbint staff 288 15 Jan 15:16 Pods
-rw-r--r-- 1 mcbint staff 666 15 Jan 14:56 README.md
drwxr-xr-x 10 mcbint staff 320 15 Jan 14:56 mcb-phoneagent-ios
drwxr-xr-x 5 mcbint staff 160 15 Jan 15:16 mcb-phoneagent-ios.xcodeproj
drwxr-xr-x 4 mcbint staff 128 15 Jan 14:56 mcb-phoneagent-ios.xcworkspace
drwxr-xr-x 4 mcbint staff 128 15 Jan 14:56 mcb-phoneagent-iosTests
drwxr-xr-x 4 mcbint staff 128 15 Jan 14:56 mcb-phoneagent-iosUITests
drwxr-xr-x 2 mcbint staff 64 15 Jan 15:07 test-reports
I have setup the project in xcode as follows:
On my development machine I can successfully build the application with the command:
xcodebuild -workspace mcb-phoneagent-ios.xcworkspace -scheme mcb-phoneagent-ios
Does anybody see anything I've setup incorrectly?
This is how I resolved this issue when i ran into it:
Make sure that you have your scheme container set to the workspace (not the project. This can be checked in Xcode in Product -> Scheme -> Manage Schemes, then look in the column titled "Container")
confirm that the xcshareddata is in the workspace directory that Jenkins is using.
In Jenkins Under the General build settings of the Xcode there is a "Settings" button
click on it and find the Xcode schema file text box.
Fill that box in with the name of the xcsheme file you want to use for the given workspace that was entered as the Xcode Workspace file (in your case I'm guessing it would be mcb-phoneagent-ios).
Since you use Cocopod, you need to use the *.xcworkspace file, not the *.workspace,
and from personal experience much easier to archive and use *.app files with jenkins instead of letting it to build for u the projects

Rails 4 SQLite3::ReadOnlyException: attempt to write a readonly database

I keep receiving the error SQLite3::ReadOnlyException: attempt to write a readonly database: UPDATE "users" SET "current_sign_in_at" = ?, "sign_in_count" = ?, "updated_at" = ? WHERE "users"."id" = ? when trying to sign into my Rails 4 app which uses the devise gem.
I figured it has something to do with permissions on the dev db so checked out the permissions of the dir first, it has a + tacked onto the end which after some googling still couldn't figure out what it's doing.
-rw-r--r-- 1 a36971 staff 2.1K 24 Jan 20:16 Gemfile
-rw-r--r-- 1 a36971 staff 5.7K 24 Jan 20:16 Gemfile.lock
-rw-r--r-- 1 a36971 staff 47B 7 Jan 22:31 README.md
-rw-r--r--+ 1 root staff 249B 7 Jan 19:57 Rakefile
drwxr-xr-x+ 8 root staff 272B 7 Jan 19:57 app/
drwxr-xr-x+ 7 root staff 238B 7 Jan 19:57 bin/
drwxr-xr-x+ 13 root staff 442B 22 Jan 20:14 config/
-rw-r--r--+ 1 root staff 153B 7 Jan 19:57 config.ru
drwxr-xr-x+ 8 root staff 272B 26 Jan 10:28 db/
drwxr-xr-x+ 4 root staff 136B 7 Jan 19:57 lib/
drwxr-xr-x+ 5 root staff 170B 8 Jan 15:51 log/
drwxr-xr-x+ 7 root staff 238B 7 Jan 19:57 public/
drwxr-xr-x 7 a36971 staff 238B 17 Jan 22:38 spec/
drwxr-xr-x+ 9 root staff 306B 7 Jan 19:57 test/
drwxr-xr-x+ 6 root staff 204B 7 Jan 20:19 tmp/
drwxr-xr-x+ 3 root staff 102B 7 Jan 19:57 vendor/
After cd ing into the db dir you can see there's nothing wrong with the permissions on the db itself:
-rw-r--r-- 1 a36971 staff 44K 26 Jan 09:30 development.sqlite3
drwxr-xr-x 5 a36971 staff 170B 22 Jan 20:14 migrate/
-rw-r--r-- 1 a36971 staff 2.2K 22 Jan 20:14 schema.rb
-rw-r--r-- 1 a36971 staff 1.2K 25 Jan 23:22 seeds.rb
-rw-r--r-- 1 a36971 staff 44K 26 Jan 09:23 test.sqlite3
So my questions are:
a) why is it unable to write to the db when there doesn't appear to be anything wrong with the permissions themselves
b) what does the + mean on mac os?
a) why is it unable to write to the db when there doesn't appear to be anything wrong with the permissions themselves
My best guess is that the db/ directory is owned by the root user, whereas the db/*.sqlite3 files are owned by user a36971. It may be necessary for the db/ directory to also be owned by user a36971.
Try changing the owner from root to a36971 for the db directory:
sudo chown a36971 db
b) what does the + mean on mac os?
+ sign means there are additional permission details not displayed by the default output from ls -l. Try running ls -le to see the details (source: http://tech.enekochan.com/en/2014/05/29/plus-and-at-symbols-listing-file-permissions-in-mac-os-x/).
Got the same error after running rails db:reset
Restarting the local server fixed my problem

idlj parameter invalid argument -td mac?

Im trying to follow a tutorial to do a CORBA assignment.
project
-Client/HelloClient.java
-Server/HelloServer.java
-Hello.idl
I do the first step, trying to compile the IDL (from the project root), and it fails.
$ idlj –td Client –fclient Hello.idl
com.sun.tools.corba.se.idl.InvalidArgument: Invalid argument: –td.
java version "1.8.0_11"
$ ls -l
total 16
drwxr-xr-x 3 juliusskye staff 102 Oct 28 20:14 Client
-rw-r-----# 1 juliusskye staff 85 Oct 28 17:49 Hello.idl
drwxr-xr-x 3 juliusskye staff 102 Oct 28 17:52 Server
-rw-r--r-- 1 juliusskye staff 425 Oct 29 13:45 idljintro.iml
drwxr-xr-x 2 juliusskye staff 68 Oct 29 13:45 src
I found this which says CORBA has problems parsing paths with / in front. But mine doesn't have a /
apparently the Lecturer's instructions were wrong or outdated or the compiler is not fully working but compilation of all files is achieved by
idlj -fall hello.idl

Heroku Pushing My Rails app as Play

I have a rails app called MBAToolbox. When I enter the directory and type "play", I get the following:
This is not a play application!
That's good! Now I type rails c and I am entered into the rails command line. Clearly this is a rails app. But when I type 'heroku create' and push 'git push heroku master', heroku tries to deploy this as a 'play' app?
I saw on their site that Heroku states:
Heroku Play framework support will be applied to applications that
match:
*/conf/application.conf in any directory except for the modules directory
, when determining to use Play.
I don't have that. My directory is as follows:
drwxr-xr-x 21 admin staff 714 Mar 22 00:20 .
drwxr-xr-x 26 admin staff 884 Mar 21 21:39 ..
-rw-r--r--# 1 admin staff 6148 Mar 21 23:37 .DS_Store
-rw-r--r-- 1 admin staff 430 Mar 21 21:39 .gitignore
drwxr-xr-x 12 admin staff 408 Mar 22 00:22 .idea
-rw-r--r-- 1 admin staff 935 Mar 21 22:38 Gemfile
-rw-r--r-- 1 admin staff 3884 Mar 21 22:38 Gemfile.lock
-rw-r--r-- 1 admin staff 9208 Mar 21 21:39 README.rdoc
-rw-r--r-- 1 admin staff 275 Mar 21 21:39 Rakefile
drwxr-xr-x 9 admin staff 306 Mar 21 21:57 app
drwxr-xr-x 10 admin staff 340 Mar 21 21:56 config
-rw-r--r-- 1 admin staff 160 Mar 21 21:39 config.ru
drwxr-xr-x 6 admin staff 204 Mar 22 00:06 db
drwxr-xr-x 3 admin staff 102 Mar 21 21:39 doc
drwxr-xr-x 5 admin staff 170 Mar 21 21:48 lib
drwxr-xr-x 4 admin staff 136 Mar 21 21:39 log
drwxr-xr-x 9 admin staff 306 Mar 21 23:37 public
drwxr-xr-x 3 admin staff 102 Mar 21 21:39 script
drwxr-xr-x 8 admin staff 272 Mar 21 21:39 test
drwxr-xr-x 6 admin staff 204 Mar 21 21:53 tmp
drwxr-xr-x 4 admin staff 136 Mar 21 21:39 vendor
Thoughts?
This article on the Heroku dev site covers both ends of this. It has a pointer to the actual source of the Play buildpack, so you can read the code that figures out which buildpack to use. You can also explicitly pick the Rails buildpack instead.

JBoss based rails application cant find activerecord-jdbcmysql-adapter

I have a rails application deployed to jboss as a war packaged using warbler. The application has been working great for a while now.
I am looking to change the rails application so that rails, all gems and their dependencies are vendor'd. To that extent I have it working great and can boot the application locally using mongrel with no issues, and can also build the war with no issues
However when I deploy the war to jboss it fails to load the application successfully saying it cant find activerecord-jdbcmysql-adapter.
2010-10-26 14:20:23,281 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/lmd4]] (main) unable to create shared application instance
org.jruby.rack.RackInitializationException: Please install the jdbcmysql adapter: `gem install activerecord-jdbcmysql-adapter` (no such file to load -- active_record/connection_adapters/jdbcmysql_adapter)
This is what i have done so far:
Make sure config/warble.rb has an entry for activerecord-jdbcmysql-adapter
config.gems += ["activerecord-jdbcmysql-adapter", "jruby-openssl"]
Manually unpacked the war and confirmed the gems are present
WEB-INF/gems/gems
drwxrwxr-x 7 4096 Oct 26 14:14 activerecord-jdbc-adapter-1.0.2-java
drwxrwxr-x 3 4096 Oct 26 14:14 activerecord-jdbcmysql-adapter-1.0.2-java
drwxrwxr-x 3 4096 Oct 26 14:14 bouncy-castle-java-1.5.0145.2
drwxrwxr-x 3 4096 Oct 26 14:14 jdbc-mysql-5.0.4
drwxrwxr-x 4 4096 Oct 26 14:14 jruby-openssl-0.7.1
drwxrwxr-x 7 4096 Oct 26 14:14 rack-1.1.0
WEB-INF/vendor/gems
drwxrwxr-x 7 4096 Oct 26 14:14 activerecord-jdbc-adapter-1.0.2-java
drwxrwxr-x 3 4096 Oct 26 14:14 activerecord-jdbcmysql-adapter-1.0.2-java
drwxrwxr-x 3 4096 Oct 26 14:14 bouncy-castle-java-1.5.0145.2
drwxrwxr-x 5 4096 Oct 26 14:14 fastercsv-1.5.3
drwxrwxr-x 12 4096 Oct 26 14:14 hobo-1.0.1
drwxrwxr-x 7 4096 Oct 26 14:14 hobofields-1.0.1
drwxrwxr-x 4 4096 Oct 26 14:14 hobosupport-1.0.1
drwxrwxr-x 3 4096 Oct 26 14:14 jdbc-mysql-5.0.4
drwxrwxr-x 4 4096 Oct 26 14:14 jruby-openssl-0.7.1
drwxrwxr-x 4 4096 Oct 26 14:14 json-1.4.6-java
drwxrwxr-x 2 4096 Oct 26 14:14 json-jruby-1.4.6-java
drwxrwxr-x 7 4096 Oct 26 14:14 rack-1.1.0
drwxrwxr-x 4 4096 Oct 26 14:14 will_paginate-2.3.15
I dunno what could be causing this but if anyone has any ideas please share?
JBoss 5
Rails 2.3.10
JRuby 1.5
Thanks
Could be a JBoss/JRuby-Rack interaction issue. We've had some reports in the past of this not working due to JBoss' use of VFS in class and resource paths and URLs. You could be tripping on this as well.
Can you try the same war file in Tomcat 6 to isolate JBoss as part of the equation? Then please post a bug at http://kenai.com/jira/browse/JRUBY_RACK or http://bugs.jruby.org/.

Resources