Posts

Showing posts from September, 2017

DOWNLOAD PUBLIC FOLDER IMAGES IN RAILS

Download Public Folder Images in Rails <a href="/images/myw3schoolsimage.jpg" download="w3logo">     <img border="0" src="/images/myw3schoolsimage.jpg" alt="W3Schools" width="104" height="142"> </a> WE CAN FOLLOW :- http://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_a_download2

GET THE SYSTEM BROWSER PRIVATE IP WHEN CLICK ON ANY LINK USING JAVASCRIPT

WHEN WE CLICK ON ANY LINK THEN HAVE TO GET THE MACHINE IP , WHICH CLICK IS CLIKED FROM WHICH IP ADDRESS OR WHICH MACHINE. (I mean, if i click on facebook with my system then we want to get my ip , at what time i have click on facebook from which machine or IP ).  FOR GETTING THE PARTICULAR MACHINE IP , WE CAN USE THIS FOR THAT . WE CAN EASILY FIND THE IP ADDRESS. <a href="https://www.flipkart.com" target="_blank" onclick= "myMethod()" >Flipkart</a> <script type="text/javascript">     //get the IP addresses associated with an account     function getIPs(callback){         var ip_dups = {};         //compatibility for firefox and chrome         var RTCPeerConnection = window.RTCPeerConnection           || window.mozRTCPeerConnection           || window.webkitRTCPeerConnection;         var useWebKit = !!window.webkitRTCPeerConnection;         //bypass naive webrtc blocking using an iframe         if(!RTCPeerConnection){      

SEARCHING USING AJAX IN RAILS

Search any entry from Database using ajax Routes        get 'search' Controller        def search           @companies = Company.search(params[:search].split("=").last)           respond_to :js       end Model        def self.search(search)           if search                 Company.where("name LIKE '%#{search}%'")           else                 Company.all           end       end index.html.erb :-       <%= text_field_tag :search, "", class: "search_companies" %>       <tbody class="company_tbody_content">            <%= render 'index_content' %>       </tbody>       <script type="text/javascript">            $(".search_companies").keyup(function() {                $.ajax({                   url: '/super_admin/companies/search',                   data: {search: $(this).serialize()}                });            });       </script>

INVALID MULTIBYTE CHAR (US-ASCII)

I was playing with Couchbase and plain Ruby in my Terminal. Then I got the error message: invalid multibyte char (US-ASCII) or Message from application: /www/pro_edgudri_lv/app/models/plans_modification.rb:7: invalid multibyte char (US-ASCII) /www/pro_edgudri_lv/app/models/plans_modification.rb:7: invalid multibyte char (US-ASCII) /www/pro_edgudri_lv/app/models/plans_modification.rb:7: syntax error, unexpected $end, expecting keyword_end ..._change, :message => "nevar būt tukšs" ...                               ^ (SyntaxError) If you got this error, you know that this is a result of having special chars. To fix this, you have to add a ‘magic comment’ in the script. Here is a step-by-step instruction how to solve this problem: 1. Open your file 2. go to the VERY FIRST line of your code 3. write the following at the top of your file #!/bin/env ruby # encoding: utf-8 Example :- payment_controller.rb:- # encoding: utf-8 class PaymentsCont