deb http://archive.ubuntu.com/ubuntu/ hardy main restricted universe
deb-src http://archive.ubuntu.com/ubuntu/ hardy main restricted universe
в файл /etc/apt/sources.list
далее как обычно sudo apt-get install mc
Программирование, .net, ruby, rails
deb http://archive.ubuntu.com/ubuntu/ hardy main restricted universe
deb-src http://archive.ubuntu.com/ubuntu/ hardy main restricted universe
export RUBYOPT=rubygems
sudo apt-get -y install build-essential
tar zxvf ndiswrapper-1.52.tar.gz
cd ndis*
sudo make uninstall
sudo make
sudo make install
sudo ndiswrapper -i bcmwl5.inf
sudo modprobe ndiswrapper
Content-type: multipart/form-data, boundary=AaB03x
--AaB03x
content-disposition: form-data; name="parameter_name"
Parameter value
--AaB03x
content-disposition: form-data; name="name"; filename="file_name"
Content-Type: text/plain (зависит от типа файла)
... содержание файла ...
--AaB03x--
require 'net/http'
class MultipartPostRequest
#
# url = URI.parse('http://test.com/path')
# post = MultipartPostRequest.create(url,
# { :file => File.open(filename), :filename => filename })
# res = Net::HTTP.start(url.host, url.port) do |http|
# http.request(post)
# end
#
def self.create(uri, pars)
post = Net::HTTP::Post.new(uri.path)
boundary = (rand*1000000000).to_i.to_s
post.set_content_type("multipart/form-data", {:boundary => boundary})
body = ""
pars.each do |key, value|
body << "--#{boundary}\r\n"
append_post_parameter(body, key, value)
end
body << "--#{boundary}--"
post.content_length = body.length
post.body = body
return post
end
def self.append_post_parameter(body, key, value)
if value.class == File
body << "Content-disposition: form-data; name=\"#{key}\";\
filename=\"#{File.basename(value.path)}\"\r\n"
body << "Content-type: application\r\n"
body << "Content-Transfer-Encoding: binary\r\n\r\n"
body << value.binmode.read
body << "\r\n"
else
body << "Content-disposition: form-data; name=\"#{key}\"\r\n\r\n"
body << "#{value}\r\n"
end
end
end
uri = URI.parse('http://test.com/path')
post = MultipartPostRequest.create(uri,
{ :file => File.open(filename), :another => "parameter" })
res = Net::HTTP.start(uri.host, uri.port) do |http|
http.request(post)
end
content = File.open("filename").read
File.size("c:\\bg.png") # => 15096
File.open("c:\\bg.png").read.length # => 4002
File.open("c:\\bg.png").binmode.read.length # => 15096