This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List all installed versions of java. | |
/usr/libexec/java_home -V | |
Matching Java Virtual Machines (10): | |
20.0.2 (x86_64) "Oracle Corporation" - "Java SE 20.0.2" /Library/Java/JavaVirtualMachines/jdk-20.jdk/Contents/Home | |
20.0.1 (x86_64) "Oracle Corporation" - "OpenJDK 20.0.1" /Library/Java/JavaVirtualMachines/jdk-20.0.1.jdk/Contents/Home | |
19.0.1 (x86_64) "Oracle Corporation" - "OpenJDK 19.0.1" /Library/Java/JavaVirtualMachines/jdk-19.0.1.jdk/Contents/Home | |
17.0.9 (x86_64) "Oracle Corporation" - "Java SE 17.0.9" /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home | |
11.0.19 (x86_64) "Oracle Corporation" - "Java SE 11.0.19" /Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home | |
11.0.14 (x86_64) "Oracle Corporation" - "Java SE 11.0.14" /Library/Java/JavaVirtualMachines/jdk-11.0.14.jdk/Contents/Home | |
1.8.381.09 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rails 5.1+ | |
Ruby 2.7 | |
In .rspec file in project folder(app1), addd the below lines | |
--colour | |
--format html | |
--out rspec_results.html | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ERROR 1267 (HY000): Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '<>' | |
Database: MySQl | |
Rails application with ruby 2.5.7 and Rails 5.1. | |
Use case: While importing database from multiple .sql files into test db via rake tasks the collation_database parameter is giving issues. | |
The .sql files contains seed data which is inserted successfully. | |
While running rspec cases to update a given table, the error related to mix of collations is thrown in rspec logs. | |
To resolve this issue, changes were done in database.yml file. below line was added to force the db import with specific encoding. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
require 'httparty' | |
require 'byebug' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
def self.add_methods(name) | |
send(:define_method, name) { | |
puts "you have create a new method and output will be displayed" | |
} | |
end | |
end | |
String.add_methods("log_msg") | |
puts "str1".log_msg.inspect | |
#define_method is a private method on the class. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Employee | |
attr_accessor :emp_id, :emp_name, :emp_designation, :emp_department | |
def assign_attributes(emp_data) | |
emp_data.each do |k,v| | |
self.send("#{k}=", v) | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Employee | |
attr_accessor :emp_id, :emp_name, :emp_designation, :emp_department | |
end | |
emp_data = { emp_id: 1, emp_name: "Employee1", emp_designation: "Level1", emp_department: "Manufacturing"} | |
emp_obj = Employee.new | |
emp_obj.emp_id = emp_data[:emp_id] | |
emp_obj.emp_name = emp_data[:emp_name] | |
emp_obj.emp_designation = emp_data[:emp_designation] | |
emp_obj.emp_department = emp_data[:emp_department] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Force file syncronization and lock writes | |
mongo admin --eval "printjson(db.fsyncLock())" | |
#Above line can be commented in case of large databases as it stops write operations while making a db dump for proper sync. | |
MONGODUMP_PATH="/usr/bin/mongodump" | |
MONGO_HOST="10.0.0.51" | |
MONGO_PORT="27017" | |
MONGO_DATABASE="cv_appcloud_btoc" | |
MONGO_SAVE="/home/vol/expin-dump/" | |
TIMESTAMP=`date +%F-%H%M` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Using gem aws-sdk for a ror application for uploading images to s3 | |
Uploading images to a fixed bucket with different folders for each object or application. | |
The s3 keeps a limitation on the number of buckets creattion whereas there is no | |
limitation for content inside a bucket. | |
This code will upload image for a user to s3 using aws-sdk gem. The bucket and the image uploaded are made public | |
so that the images uploaded are directly accessible. The input it takes is the image complete path | |
where it is present, folder in which it should be uploaded and user_id for whom it should | |
be uploaded. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://sourcebits.basecamphq.com/projects/8128969-success-profiler/todo_items/145021887/comments |
NewerOlder