NoMachine

NoMachine technology revolutionizes the way users access their computing resources across the Internet by making remote access to desktops and applications as easy and widespread as Web browsing.

form_tag and form_for

they have different syntax, the former uses select_tag, field_text_tag, all ends with “_tag”

the latter, just f.select, f.field_text

form_for is for creating forms for one specific object/Model. It is less flexible, but saves you some typing as you don’t have to pass the model name in the element helpers over and over again.

form_tag (as all *_tag helpers) are not bound to that limitation. You could create a totally customized form that uopdates 2 1/2 different Models at the same time

check if two files are the same

These are ways to calculate a unique hash value for a file; so instead of comparing two files to check if they are the same, we can compare the codes/hash value; And we don’t need to store files, we only need to store the codes.

 

  • MD5

md5 = Digest::MD5.hexdigest(File.read('path_to_file'))

sum filename1 filename2

and then compare the numbers

Calculate a CRC32:

require 'digest/crc32'

Digest::CRC32.hexdigest('hello')
# => "3610a686"

Calculate a CRC32 of a file:

Digest::CRC32.file('README.md')
# => #<Digest::CRC32: 127ad531>