I faced this error SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed when I try to implement the following: JSON.parse(open(“http://api……”).read). I found the solution to fix this SSL error right from Windows, here is how :  Download or click here to view into C:Ruby200-x64cacert.pem Go to your Computer -> Advanced Settings -> Environment Variables […]

The code : default_scope :order => ‘title’and this following error occurs : Support for calling #default_scope without a block is removed. For example instead of `default_scope where(color: ‘red’)`, please use `default_scope { where(color: ‘red’) }`. (Alternatively you can just redefine self.default_scope.) In order to fix this error, change your code to the following :  default_scope  { […]

Run rake db:seed and it generates the output:  rake db:seed –trace **Invoke db:seed (first_time)**Execute db:seed **Invoke db:abort_if_pending_migrations (first_time)**Invoke environment (first_time)**Execute environment **Invoke db:load_config (first_time)**Execute db:load_config **Execute db:abort_if_pending_migrations The reason for this problem is that the query is blocked by the validation of your model. Unfortunately, it won’t be displayed on the console output. In order […]

Source code :

class Product < ActiveRecord::Base

validates :title, :description, :image_url, :presence => true
validates :price, :numericality => {:greater_than_or_equal_to => 0.01}
validates :title, :uniqueness => true
validates :image_url, :format => {
:with => %r{.(gif|jpg|png)$}i,
:message => ‘must be a URL for GIF, JPG or PNG image.’
}
end

Continue reading

  • Setup Digital server, Nginx host rails, apache2 host PHPMYADMIN
  • Update gem:
    gem install rubygems-update
    update_rubygems
    gem update --system

    (if not work, try gem update `gem outdated | cut -d ' ' -f 1`)

  • Throw an exception manually :raise ....
  • Handle Photo and Album (kylehuynhphotography.com): click here
  • Clear the assets
    rake assets:clobber (remove /home/rails/tmp/cache/assets)
    rake assets:clean
  • Check the error log in kylehuynhphotography.com:
    cat /var/log/nginx/access.log
  • Validate string field is unique

validates :title, :uniqueness => true

  • Validating image url format as png, jpeg or gif

validates :image_url, :format => {
:with => %r{A.(gif|jpg|png)/z}i,
:message => ‘must be a URL for GIF, JPG or PNG image.’
}

Continue reading

First of all, run this command with oldname is the attribute that you like to change and newname is the attribute you like to replace rails g migration change_oldname_to_newname Look for the file ….. in ….. and modify like the following class change_oldname_to_newname <ActiveRecord::Migration def change rename_column :table_name,:old_column,:new_column endend Save the changes and update these […]

  • Start Rails server by$ rails server 
  • This error appears : 

=> Booting WEBrick=> Rails 4.1.4 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (–binding option)
=> Ctrl-C to shutdown server
Exiting
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tzinfo-1.2.1/lib/tzinfo/data_source.rb:182:in `rescue in create_default_data_sou
rce’: No source of timezone data could be found. (TZInfo::DataSourceNotFound)
Please refer to http://tzinfo.github.io/datasourcenotfound for help resolving this error.
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tzinfo-1.2.1/lib/tzinfo/data_source.rb:179:in `create_default_data_
source’
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tzinfo-1.2.1/lib/tzinfo/data_source.rb:40:in `block in get’
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tzinfo-1.2.1/lib/tzinfo/data_source.rb:39:in `synchronize’
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tzinfo-1.2.1/lib/tzinfo/data_source.rb:39:in `get’
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tzinfo-1.2.1/lib/tzinfo/timezone.rb:629:in `data_source’
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tzinfo-1.2.1/lib/tzinfo/timezone.rb:92:in `get’
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tzinfo-1.2.1/lib/tzinfo/timezone_proxy.rb:67:in `real_timezone’
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tzinfo-1.2.1/lib/tzinfo/timezone_proxy.rb:30:in `period_for_utc’
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tzinfo-1.2.1/lib/tzinfo/timezone.rb:549:in `current_period’

Here is solution: 

Continue reading

  • First of all, download factory image for your nexus device from here
  • Step 1: Download the ADB/Fastboot files and the USB drivers for Windows based PC first.
    • Extract the contents of the ADB/Faew folder called ‘google’ on your desktop. Extract and transfer the contents of the factory image inside this folder as well. The list of files will include a ZIP file containing the codename of your Android device, two files with “flash-all” names, and a bootloader image file. All the extracted contents of the factory image should be inside the same folder as the ADB and Fastboot file, otherwise you will get a file not found error.
    • Make sure to install the ADB drivers as well if you are running a Windows based PC.
  • Continue reading

    Here is how: To disallow comments in all posts and pages, do the following steps, this applies to new posts that you will publish from now on Settings >> Discussion >> uncheck “Allow people to post comments on new articles” But what about all of existing posts and page, here is how to disable comments from […]

    Sometimes you happen to change your remote server settings which you use for git. Then you try to pull and push with git and get the following error:  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now […]

    Pick a directory to download the openssl files Download openssl wget https://www.openssl.org/source/openssl-1.0.1g.tar.gz Unzip the openssl package: tar -zxf openssl-1.0.1g.tar.gzcd openssl-1.0.1g./configmakemake testmake install Check openssl versio after installation : openssl version If it shows old version do the steps below. mv /usr/bin/openssl /root/ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl Check the version again:  openssl version

    Open xampp/conf/extra/httpd-xampp.conf and look for and adding: <LocationMatch “^/(?i:(?:xampp|licenses|phpmyadmin|webalizer|server-status|server-info))”> Order deny,allow #Deny from all Allow from ::1 127.0.0.0/8 Allow from ::1 xxx.xxx.x.xxx (the computer’s IP address)    ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var</LocationMatch> Finally, type the IP address of the computer with xampp in the address bar.   OR For testing purpose, you only have to turn off firewall by /etc/init.d/iptables […]

    • First of all, search all UNREAD email in your gmail account by enter the “l:unread” or l:^u in Search box like this:

    gmailexample

    Continue reading

    Download Java API from here. Extract the zip file in your local directory. From ecliplse –> Window –> Preferences –> Java –> “Installed JREs” select available JRE (jre6 C:Program Files (x86)Javajre6 for instance) and click Edit. Select all the “JRE System libraries” using Shift key. Click “Javadoc Location” Change “Javadoc location path:” from “http://download.oracle.com/javase/7/docs/api/” to […]

    Here is detail of the error : Counting objects: 8, done. Delta compression using 2 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (5/5), 1.37 KiB, done. Total 5 (delta 2), reused 0 (delta 0) error: insufficient permission for adding an object to repository database ./objects fatal: failed to write object error: unpack-objects exited […]

    Full detail of the error you may encounter when you try to run Xampp in the computer that have VMWare installed:  Port 443 in use by “”C:Program Files (x86)VMwareVMware Workstationvmware-hostd.exe” -u “C:ProgramDataVMwarehostdconfig.xml”” with PID 2612! Apache WILL NOT start without the configured ports free! You need to uninstall/disable/reconfigure the blocking application or reconfigure Apache and the […]

    /bin (and /sbin) were intended for programs that needed to be on a small / partition before the larger /usr, etc. partitions were mounted. These days, it mostly serves as a standard location for key programs like /bin/sh, although the original intent may still be relevant for e.g. installations on small embedded devices. /sbin, as […]

    This installation are full and complete installation for latest release of ffmpeg/mplayer/x264 and other module on 28-12-2009 and tested working on Centos 5.3 x86_64 or rhel server, below installation work for major media script.

    Edit the /etc/ld.so.conf file and add the following lines

    Continue reading

    Make sure you accomplised complete installation of XAMPP, If not, please visit this tutorial (Windows | Linux | Mac OSX).

    Open /opt/lampp/lampp restart/httpd-xampp.conf in an editor. Then, look for <LocationMatch> </LocationMatch>, comment the “Deny from all” statement.

    <LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
    Order deny,allow
    #Deny from all
    Allow from ::1 127.0.0.0/8
    fc00::/7 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16
    fe80::/10 169.254.0.0/16

    ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
    </LocationMatch>

     Reset Xampp with /opt/lampp/lampp restart

    Continue reading