How to get remote file size

get remote file size
Standard

Many time before we download a file from remote server, we need to know the size of the file, and there’s a couple way to get remote file size from http server, here they are:

  • curl, bash

    get remote file size using curl

    get remote file size using curl

  • PHP

    Screen Shot 2016-02-19 at 8.36.56 AM

    get remote file size PHP code

    and  the running result

    get remote file size PHP

    get remote file size PHP

  • ┬áRuby

    get remote file size ruby

    get remote file size ruby

 

simple way to get remote file size eh ? any suggestion please comment

Yosemite Nokogiri install: libxml2 version 2.6.21 or later is required!

1910798
Standard

Upgrade to Yosemite lately, but it broke couple ruby nokogiri gem when i need to install it. it show error says below

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/endy/.rbenv/versions/1.9.3-p194/bin/ruby -r ./siteconf20150303-5535-61o6gc.rb extconf.rb

then how to resolve this ?, override system library using brew version. Run this command on terminal

brew install libxml2
ls -l /usr/local/opt/libxml*
lrwxr-xr-x  1 endy  admin  23 Nov 28 03:55 /usr/local/opt/libxml2 -> ../Cellar/libxml2/2.9.2
bundle config build.nokogiri "--use-system-libraries --with-xml2-include=/usr/local/opt/libxml2/include/libxml2"
gem install nokogiri
Building native extensions.  This could take a while...
Successfully installed nokogiri-1.6.6.2
Parsing documentation for nokogiri-1.6.6.2
Installing ri documentation for nokogiri-1.6.6.2
Done installing documentation for nokogiri after 4 seconds
1 gem installed
endy $ gem list nokogiri

*** LOCAL GEMS ***

nokogiri (1.6.6.2, 1.6.5, 1.6.3.1)

semoga bermanfaat