Posts

An error occurred while installing rmagick (5.2.0), and Bundler cannot continue.

To see why this extension failed to compile, please check the mkmf.log which can be found here:   /Users/apple/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/extensions/arm64-darwin-22/2.7.0/rmagick-5.2.0/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /Users/apple/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/rmagick-5.2.0 for inspection. Results logged to /Users/apple/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/extensions/arm64-darwin-22/2.7.0/rmagick-5.2.0/gem_make.out An error occurred while installing rmagick (5.2.0), and Bundler cannot continue. Make sure that `gem install rmagick -v '5.2.0' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile:   rmagick The fix is very simple. Do the following brew uninstall imagemagick brew install imagemagick@6 export PATH="/usr/local/opt/imagemagick@6/bin:$PATH" brew link --force imagemagick@6 gem install rmagick This should do it!

pgloader not copying data from mysql 8 to postgresql

  Database is already created in Postgres. pgloader mysql: / / user :password @localhost / mydb postgresql: / / user :password @localhost / mydb You can also use a load file to make the tables public after import. Add this to a file (e.g load_file.load): LOAD DATABASE FROM mysql: / / root:mysql @localhost / from_db_name INTO postgresql: / / localhost / to_db_name ALTER schema 'to_db_name' rename to 'public' ; And run: $ pgloader load_file.load

Bootstrap Select Picker append add new item if search not exist

  <select class = "selectpicker" data-live-search= "true" id= "branch" multiple> < option > B.Tech </ option > < option > M.Tech </ option > < option > Ph.D </ option > </select> jQuery script $( '.selectpicker' ). selectpicker ({ noneResultsText : 'No result found <button class="btn btn-dark" onclick=(add_opt(this))>Add new option</button>' }); function add_opt ( event ){ var value = $(event). parents ( 'div' ). siblings ( '.bs-searchbox' ). find ( 'input' ). val (); $(event). parents ( 'div' ). siblings ( '.selectpicker' ). append ($( "<option></option>" ). text (value)). val (value); $( '.selectpicker' ). selectpicker ( 'refresh' ); }

Fix Health status on aws Elastic Beanstalk is red

Image
Solution 1: For someone that may come across this as I did, I found the solution to be   setting up the Health Check endpoint of the ELB target group to an actual URL on my website that returned an HTTP 200 code . On the EC2 dashboard, under Load Balancing -> Target Groups, go to the tab Health Checks and edit the path to a path in your site that returns an 200 code. Solution 2: Change the health check's "Success codes" setting from  200  to  200,301 View image - EC2 -> Load Balancing -> Target Groups

Validate Google access token?

  For user check, just post get the access token as accessToken and post it and get the response https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=accessToken you can try in address bar in browsers too, use httppost and response in java also response will be like { "issued_to": "xxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com", "audience": "xxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com", "user_id": "xxxxxxxxxxxxxxxxxxxxxxx", "scope": "https://www.googleapis.com/auth/userinfo.profile https://gdata.youtube.com", "expires_in": 3340, "access_type": "offline" } The scope is the given permission of the accessToken. you can check the scope ids in  this link Update:  New API post as below https://oauth2.googleapis.com/tokeninfo?id_token=XYZ123 Response will be as { // These six fields are

Javascript key codes

Key Code Key 0 That key has no keycode 3 break 8 backspace / delete 9 tab 12 clear 13 enter 16 shift 17 ctrl 18 alt 19 pause/break 20 caps lock 21 hangul 25 hanja 27 escape 28 conversion 29 non-conversion 32 spacebar 33 page up 34 page down 35 end 36 home 37 left arrow 38 up arrow 39 right arrow 40 down arrow 41 select 42 print 43 execute 44 Print Screen 45 insert 46 delete 47 help 48 0 49 1 50 2 51 3 52 4 53 5 54 6 55 7 56 8 57 9 58 : 59 semicolon (firefox), equals 60 < 61 equals (firefox) 63 ß 64 @ (firefox) 65 a 66 b 67 c 68 d 69 e 70 f 71 g 72 h 73 i 74 j 75 k 76 l 77 m 78 n 79 o 80 p 81 q 82 r 83 s 84 t 85 u 86 v 87 w 88 x 89 y 90 z 91 Windows Key / Left ⌘ / Chromebook Search key 92 right window key 93 Windows Menu / Right ⌘ 95 sleep 96 numpad 0 97 numpad 1 98 numpad 2 99 numpad 3 100 numpad 4 101 numpad 5 102 numpad 6 103 numpad 7 104 numpad 8

Run react-native with emulator

List Emulator Devices:   emulator -list-avds Example:  Pixel_2_API_28 Run app with emulator: emulator @{device_name} & react-native run-android Example:  emulator @{Pixel_2_API_28} & react-native run-android

Deploy Reatjs app on Heroku

1. React JS app npm install -g create-react-app create-react-app my-app cd my-app git init heroku create -b https://github.com/mars/create-react-app-buildpack.git git add . git commit -m "react-create-app on Heroku" git push heroku master heroku open OR if you already have app created then add  mars/create-react-app then set heroku buildpacks:set mars/create-react-app 2. If following error coming then set bundle path:  ls: cannot access '/app/build/static/js/*.js': No such file or directory 2019-12-23T07:49:22.901124+00:00 app[web.1]: Error injecting runtime env: bundle not found '/app/build/static/js/*.js'. See: https://github.com/mars/create-react-app-buildpack/blob/master/README.md#user-content-custom-bundle-location heroku config:set JS_RUNTIME_TARGET_BUNDLE='/app/dist/*.js' Make sure your bundle into directory /app/dist OR if you have your bundle into other directory then set other directory pa

Add Android devices in n file trasfer mode and set USB

For android connect the cellphone in file trasfer mode and set USB debugging mode under developer options add the device to your linux machine  lsusb  list the usb devices connected and shows something like Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 005: ID 04ca:3010 Lite-On Technology Corp. Bus 001 Device 003: ID 04f2:b483 Chicony Electronics Co., Ltd Bus 001 Device 002: ID 04f3:0235 Elan Microelectronics Corp. Bus 001 Device 008: ID *12d1:107e* Huawei Technologies Co., Ltd. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub after this run  echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666", GROUP="plugdev"' | sudo tee /etc/udev/rules.d/51-android-usb.rules  Finally start the app on your device  ract-native run-android

Add CORS to Nginx on AWS Elastic Beanstalk

Image
Apache Add the following block to your  .htaccess  file: <FilesMatch ".(eot|otf|ttf|woff|woff2)"> Header always set Access-Control-Allow-Origin "*" </FilesMatch> Nginx Add the following location block to your virtual host file (usually within the server directive) and reload Nginx: location ~* \.(eot|otf|ttf|woff|woff2)$ { add_header Access-Control-Allow-Origin *; } Invalidate CloudFront Distribution Once the changes have been made you will need to  invalidate the CloudFront cache  with a path of “/*”. Integrating to CloudFront service It’s simple to config and use CloudFront (a CDN service) for Rails app.  Just one thing from my experience, regarding to CORS issue on EB when your CSS want get loading font files or font-awesome. Because EB run your app with Nginx server serve public static files, then work around would be overwriting web server config in Nginx with  add_header Access-Control-Allow-Origin ‘*’  by crea