Search Results

Search found 9 results on 1 pages for 'atmorell'.

Page 1/1 | 1 

  • Rails, searchlogic choose categories with checkboxes

    - by atmorell
    Hello, I am useing searchlogic to search some paintings. Each painting belong to a single category. What I would like to do is add multiple checkboxes to my search form, so that users can mark multiple categories. (joined with or) Is this possible with searchlogic? The query I am looking for is something like this: SELECT * FROM paintings WHERE category LIKE "white" OR category LIKE "red"... f.check_box :category (white) f.check_box :category (black) f.check_box :category (red) f.check_box :category (green) etc.

    Read the article

  • Rails, gmail: howto get plain/text from body

    - by atmorell
    Hello, I am loading am email with IMAP and parsing it with mail. This works very well, however the mail.body.decoded field contains a lot of formatting. How do I dig out the plain/txt body of the email - ignore attachements, formatting etc. It works fine if I try with an email without html. source = imap.uid_fetch(uid, ['RFC822']).first.attr['RFC822'] mail = Mail.new(source) This body content looks like this: Mail::Body:0x7f36ed468270 @epilogue="", @boundary="_004_4C49171DCB8C4540844E69DD39FDD98Ffirm_", @encoding="7bit", @raw_source="--_004_4C49171DCB8C4540844E69DD39FDD98Ffirm_\r\nContent-Type: multipart/alternative;\r\n\tboundary=\"_000_4C49171DCB8C4540844E69DD39FDD98Ffirm_\"\r\n\r\n--_000_4C49171DCB8C4540844E69DD39FDD98Ffirm_\r\nContent-Type: text/plain; charset=\"iso-8859-1\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\ndasdsasda\r\n\r\n\r\n\r\nMed venlig hilsen / Med V=E4nlig H=E4lsning / Best Regards\r\r\nAsbj=F8rn Toke Morell. .\r\n+45 7020 0160\r\n+45 2152 0015\r\n[cid:[email protected]]\r\nhttp://www..dk\r\n\r\n\r\n--_000_4C49171DCB8C4540844E69DD39FDD98Ffirm_\r\nContent-Type: text/html; charset=\"iso-8859-1\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n<html>headheadbody style3D"word-wrap: break-word; -webkit-nbsp-mode:=\r\n space; -webkit-line-break: after-white-space; ">dasdsasda<br><div apple-co=\r\nntent-edited=3D"true">\r\n<span class=3D"Apple-style-span" style=3D"border-collapse: separate; color:=\r\n rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: norma=\r\nl; font-variant: normal; font-weight: normal; letter-spacing: normal; line-=\r\nheight: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transf=\r\norm: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-borde=\r\nr-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-te=\r\nxt-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-tex=\r\nt-stroke-width: 0px; "><span class=3D"Apple-style-span" style=3D"font-famil=\r\ny: Calibri, sans-serif; font-size: 15px; "><span class=3D"Apple-style-span"=\r\n style=3D"border-collapse: separate; color: rgb(0, 0, 0); font-family: Helv=\r\netica; font-size: medium; font-style: normal; font-variant: normal; font-we=\r\night: normal; letter-spacing: normal; line-height: normal; orphans: 2; text=\r\n-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-sp=\r\nacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical=\r\n-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-=\r\nadjust: auto; -webkit-text-stroke-width: 0px; "><span class=3D"Apple-style-=\r\nspan" style=3D"font-family: Calibri, sans-serif; font-size: 15px; "><div st=\r\nyle=3D"margin-top: 0cm; margin-right: 0cm; margin-bottom: 0.0001pt; margin-=\r\nleft: 0cm; font-size: 11pt; font-family: Calibri, sans-serif; "><font class=\r\n=3D"Apple-style-span" color=3D"#000080" face=3D"'Times New Roman', serif" s=\r\nize=3D"3"><span class=3D"Apple-style-span" style=3D"font-size: 13px; "><br =\r\nclass=3D"Apple-interchange-newline"><br></span></font></div><div style=3D"m=\r\nargin-top: 0cm; margin-right: 0cm; margin-bottom: 0.0001pt; margin-left: 0c=\r\nm; font-size: 11pt; font-family: Calibri, sans-serif; "><font class=3D"Appl=\r\ne-style-span" color=3D"#000080" face=3D"'Times New Roman', serif" size=3D"3=\r\n"><span class=3D"Apple-style-span" style=3D"font-size: 13px; "><br></span><=\r\n/font></div><div style=3D"margin-top: 0cm; margin-right: 0cm; margin-bottom=\r\n: 0.0001pt; margin-left: 0cm; font-size: 11pt; font-family: Calibri, sans-s=\r\nerif; "><span style=3D"font-size: 10pt; font-family: 'Times New Roman', ser=\r\nif; color: navy; ">Med venlig hilsen / Med V=E4nlig H=E4lsning / Best Regar=\r\nds&nbsp;<br>firm<br>Asbj=F8rn Toke Morell... This is the ony relevant from information from the body: 'ndasdsasda\r\n\r\n\r\n\r\nMed venlig hilsen / Med V=E4nlig H=E4lsning / Best Regards\r\r\nAsbj=F8rn Toke Morell' Any ideas?

    Read the article

  • Get used color names from image

    - by atmorell
    Hello, I would like to check what colors is present in a image. This will be stored in the database and used for a search form. (red=1, green=1, blue=0, yellow=1, black=1, white=1 etc.) img = Magick::Image.read('phosto-file.jpg').first img = img.quantize(10 h = img.color_histogram pp h {red=12815, green=18494, blue=15439, opacity=0=>13007, red=44662, green=47670, blue=51967, opacity=0=>18254, red=17608, green=43331, blue=48321, opacity=0=>11597, red=21105, green=25865, blue=39467, opacity=0=>10604, red=15125, green=36629, blue=22824, opacity=0=>10223, red=52102, green=42405, blue=10063, opacity=0=>12928, red=39043, green=28726, blue=40855, opacity=0=>7728, red=10410, green=8880, blue=7826, opacity=0=>13795, red=25484, green=25337, blue=24235, opacity=0=>7351, red=44485, green=12617, blue=11169, opacity=0=>14513} How do I convert the 10 values to color names? red, green, NOMATCH, yellow, black, white etc. Only need the rough color name - not LimeGreen but Green etc. Best regards. Asbjørn Morell

    Read the article

  • Customize jQuery.aptags plugin - mouseclick submit from dropdown list

    - by atmorell
    Hello, I am using jquery.autocomplete.js and jquery.apitags to select a few elements from a dropdown list. This works great, and I can select multiple elements etc. However the jquery-aptags plugin does only fire when enter is pressed. This might confuse some users if they use the mouse to click instead of the arrows/enter on the keyboard. I think this is the code inside jquery.aptags that submits the tag. // // Hook to the keypress event. // $(this).bind('keypress', { __c: __c }, function (e) { var c = ''; var i = 0; var v = $(this).val(); if (e.keyCode == 13) { e.stopPropagation(); e.preventDefault(); __createSpans(this, v, e.data.__c, true); } }); I am wondering if it is possible to call the method directly from a new event. $('.ac_results > ul > li').livequery(function() { $(this).bind('click', function() { $('#address_city').aptags({__createSpans}); }); }); Any thoughts?

    Read the article

  • Retactoring advanced has_many example

    - by atmorell
    Hello, My user model has three relations for the same message model, and is using raw SQL :/ Is there a better more rails way to achieve the same result? Could the foreign key be changed dynamically? e.g User.messages.sent (foreign key = author_id) and User.messages.received (foreign key = recipient ) I have been trying to move some of the logic into scopes in the message model, but the user.id is not available from the message model... Any thoughts? Table layout: create_table "messages", :force => true do |t| t.string "subject" t.text "body" t.datetime "created_at" t.datetime "updated_at" t.integer "author_id" t.integer "recipient_id" t.boolean "author_deleted", :default => false t.boolean "recipient_deleted", :default => false end This is my relations for my user model: has_many :messages_received, :foreign_key => "recipient_id", :class_name => "Message", :conditions => ['recipient_deleted = ?', false] has_many :messages_sent, :foreign_key => "author_id", :class_name => "Message", :conditions => ['author_deleted = ?', false] has_many :messages_deleted, :class_name => "Message", :finder_sql => 'SELECT * FROM Messages WHERE author_id = #{self.id} AND author_deleted = true OR recipient_id = #{self.id} AND recipient_deleted = true' Best regards. Asbjørn Morell

    Read the article

  • Customize jQuery.aptags plugin - mouseclick submit from .ac_results list

    - by atmorell
    Hello, I am using jquery.autocomplete.js and jquery.apitags to select a few elements from a div (.ac_results) This works great, and I can select multiple elements etc. However the jquery-aptags plugin does only fire when enter is pressed. This might confuse some users if they use the mouse to click instead of the arrows/enter on the keyboard. I think this is the code inside jquery.aptags that submits the tag. // // Hook to the keypress event. // $(this).bind('keypress', { __c: __c }, function (e) { var c = ''; var i = 0; var v = $(this).val(); if (e.keyCode == 13) { e.stopPropagation(); e.preventDefault(); __createSpans(this, v, e.data.__c, true); } }); I am wondering if it is possible to call the method directly from a new event. $('.ac_results > ul > li').livequery(function() { $(this).bind('click', function() { $('#address_city'). //how do I fire the "enter" event from here? }); }); Any thoughts?

    Read the article

  • Clean way to assign value unless empty

    - by atmorell
    Hello, I often need to assign a variable, if the source value is set. So far I have done it like this: filters[:red] = params[:search][:red] unless params[:search][:red].nil? This works but looks a bit clumsy. There must be a more DRY way of getting this result. Any suggestions? Best regards. Asbjørn Morell.

    Read the article

  • WYSIWYG editor that is intergrated with Ruby on Rails

    - by atmorell
    Hello, I have worked with Ruby on Rails for the last four years. So far I have used textmate for writing the code. This is working great as long as I don't need to do any decent presentation. I was wondering if there is any WYSIWYG editor out there that can intergrate with Rails. Something like Dreamweaver with the ability to browse Objects etc. If I have opened the _show.erb I create a div and selete @user.email. etc. Any suggestions?

    Read the article

1