Search Results

Search found 770 results on 31 pages for 'ar mailer'.

Page 2/31 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • php mailer char-coding problem

    - by Holian
    Hello! I try to use Phpmailer to send registration, activation..etc mail to users... require("class.phpmailer.php"); $mail -> charSet = "UTF-8"; $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = "smtp.mydomain.org"; $mail->From = "[email protected]"; $mail->SMTPAuth = true; $mail->Username ="username"; $mail->Password="passw"; //$mail->FromName = $header; $mail->FromName = mb_convert_encoding($header, "UTF-8", "auto"); $mail->AddAddress($emladd); $mail->AddAddress("[email protected]"); $mail->AddBCC('[email protected]', 'firstadd'); $mail->Subject = $sub; $mail->Body = $message; $mail->WordWrap = 50; if(!$mail->Send()) { echo 'Message was not sent.'; echo 'Mailer error: ' . $mail->ErrorInfo; } The $message is contain latin characters. Unfortunatelly all webmail (gmail, webmail.mydomain.org, emailaddress.domain.xx) use different coding. How can i force to use UTF-8 coding to show my mail exactly same on all mailbox? I try to convert the mail header width mb_convert_encoding(), but with no luck. Thank you.

    Read the article

  • Help with PHP mailer script

    - by Chris
    Hi there, I'm clueless when it comes to PHP and have a script that emails the contents of a form. The trouble is it only sends me the comment when I want it to also send the name and email address that is captured. Anyone know how I can adjust this script to do this? A million thanks in advance! <?php error_reporting(E_NOTICE); function valid_email($str) { return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE; } if($_POST['name']!='' && $_POST['email']!='' && valid_email($_POST['email'])==TRUE && strlen($_POST['comment'])>1) { $to = "[email protected]"; $headers = 'From: '.$_POST['email'].''. "\r\n" . 'Reply-To: '.$_POST['email'].'' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $subject = "Contact Form"; $message = htmlspecialchars($_POST['comment']); if(mail($to, $subject, $message, $headers)) { echo 1; //SUCCESS } else { echo 2; //FAILURE - server failure } } else { echo 3; //FAILURE - not valid email } ?>

    Read the article

  • combining two select statements to return one result

    - by DalivDali
    I need to combine the results for two select queries from two view tables, from which I am performing calculations. Perhaps there is an easier way to perform a query using if...else - any pointers? Essentially I need to divide everything by 'ar.time_ratio' under the condition in sql query 1, and ignore that for query 2. SELECT gs.traffic_date, gs.domain_group, gs.clicks/ar.time_ratio as 'Scaled_clicks', gs.visitors/ar.time_ratio as 'scaled_visitors', gs.revenue/ar.time_ratio as 'scaled_revenue', (gs.revenue/gs.clicks)/ar.time_ratio as 'scaled_average_cpc', (gs.clicks)/(gs.visitors)/ar.time_ratio as 'scaled_ctr', gs.average_rpm/ar.time_ratio as 'scaled_rpm', (((gs.revenue)/(gs.visitors))/ar.time_ratio)*1000 as "Ecpm" FROM group_stats gs, v_active_ratio ar WHERE ar.group_id=gs.domain_group and SELECT gs.traffic_date, gs.domain_group, gs.clicks, gs.visitors, gs.revenue, (gs.revenue/gs.clicks) as 'average_cpc', (gs.clicks)/(gs.visitors) as 'average_ctr', gs.average_rpm, ((gs.revenue)/(gs.visitors))*1000 as "Ecpm" FROM group_stats gs, v_active_ratio ar where not ar.group_id=gs.domain_group

    Read the article

  • Webcast: Oracle Loans Overview - Features, Demonstration & Data Model

    - by Annemarie Provisero
    Webcast: Oracle Loans Overview - Features, Demonstration & Data ModelDate:  November 13, 2013 at 10 am ET, 9 am CT, 8 am MT, 7 am PTCome learn about Oracle Loans features & data model.  This one-hour session is recommended for technical and functional users who use or are planning to use Oracle Loans.Topics will include:     Definition and feature summary     Key business concepts for Oracle Loans     Direct Loans demonstration     Introduction to the Loans data model Bring your questions! For more details on how to register, see Doc ID 1590843.1.  Remember that you can access a full listing of all future webcasts as well as replays from Doc ID 7409661.1.

    Read the article

  • Announcing Oracle Receivables Generic Data Fix (GDF) for Refunds

    - by user793553
    Here's the first of what will be a series of Generic Data Fixes (GDF) to be released by Receivables Development. Generic Data Fix (GDF) are created by development to fix data issues caused by bugs/issues in the application code.  Other Generic Data Fix benefits/features include: Developed for bugs that can cause data issues. Provides a SELECT script that uses an identification/signature query to identify and report all data affected by issue/condition caused by a bug. Allow customers to view and modify what will be fixed. Provides a separate FIX script to fix the data reported by the SELECT script. The FIX script creates backup tables for the data that is fixed/updated. Available on My Oracle Support for download In Release 12, when creating a refund by either of the following methods: Applied a receipt to the Refund activity - which creates an Invoice in Payables Or you went directly into Payables to create a refund for an open Credit Memo in Receivables The Invoice in Payables that is associated to the refund is cancelled, the corresponding refund application or credit memo in Receivables is not properly re-instated. For the receipt application, it still remains applied to the Refund whereas this should be automatically unapplied. For the credit memo, it stays closed instead of getting re-opened. Doc ID 761993.1 includes the patch to make sure this doesn’t happen in the future as well as a GDF script to fix the current data (Script name: ar_std_refund_unapp.sql).  Download the script and run in READ_ONLY_MODE to identify 'refund' applications with this problem. Stay tuned for more GDF scripts coming soon...

    Read the article

  • Tax Deducted At Source (TDS) for India Localizations

    - by LuciaC
    Do you have questions about TDS (Tax deducted at source) for India Localizations or want to know the latest information about this functionality? See Doc ID 1546099.1 TDS Tax Deduction at Source for India - Master Troubleshooting Guide. The document includes sections with the following information: Documentation and Setup of Tax Deduction at Source – this section contains a presentation with the configuration steps for the TDS feature Resolving errors – this section contains recommended patches and documents with solutions for specific errors Frequently asked questions  – See also our new FAQ Doc ID 1549522.1 for frequently asked questions about TDS.

    Read the article

  • piecing together a jquery form mailer

    - by Joel
    Hi guys, My newbieness is shining through here...I managed to piece together a form mailer that works great, but now I need to add two more fields, and I'm at a loss as to how to do it. Over the months, I have commented out some things I didn't need, but now I'm stuck. I borrowed from this tutorial to make the original form: http://trevordavis.net/blog/tutorial/ajax-forms-with-jquery/ But then I cannibalized it to make an email signup form for a newsletter, so the fields I need are: recipient email (me-hard coded in) senders email address subject (hardcoded in) first name and city in the body of the message For my form, I have this: <div> <?php include('verify.php'); ?> <form action="index_success.php" method="post" id="sendEmail" class="email"> <h3 class="register2">Newsletter Signup:</h3> <ul class="forms email"> <li class="name"><label for="yourName">Name: </label> <input type="text" name="yourName" class="info" id="yourName" value=" " /><br> </li> <li class="city"><label for="yourCity">City: </label> <input type="text" name="yourCity" class="info" id="yourCity" value=" " /><br> </li> <li class="email"><label for="emailFrom">Email: </label> <input type="text" name="emailFrom" class="info" id="emailFrom" value="<?= $_POST['emailFrom']; ?>" /> <?php if(isset($emailFromError)) echo '<span class="error">'.$emailFromError.'</span>'; ?> </li> <li class="buttons email"> <button type="submit" id="submit">Send</button> <input type="hidden" name="submitted" id="submitted" value="true" /> </li> </ul> </form> </div> emailcontact.js: $(document).ready(function(){ $("#submit").click(function(){ $(".error").hide(); var hasError = false; var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; var emailFromVal = $("#emailFrom").val(); if(emailFromVal == '') { $("#emailFrom").after('<span class="error">You forgot to enter the email address to send from.</span>'); hasError = true; } else if(!emailReg.test(emailFromVal)) { $("#emailFrom").after('<span class="error">Enter a valid email address to send from.</span>'); hasError = true; } var subjectVal = $("#subject").val(); if(subjectVal == '') { $("#subject").after('<span class="error">You forgot to enter your name.</span>'); hasError = true; } var messageVal = $("#message").val(); if(messageVal == '') { $("#message").after('<span class="error">You forgot to enter your city.</span>'); hasError = true; } if(hasError == false) { $(this).hide(); $("#sendEmail li.buttons").append('<img src="/wp-content/themes/default/images/template/loading.gif" alt="Loading" id="loading" />'); $.post("/includes/sendemail.php", //emailTo: emailToVal, { emailFrom: emailFromVal, subject: subjectVal, message: messageVal }, function(data){ $("#sendEmail").slideUp("normal", function() { $("#sendEmail").before('<h3 class="register2">Success!</h3><p class="emailbox">You are on the Newsletter email list.</p>'); }); } ); } return false; }); }); sendmail.php: <?php $mailTo = $_POST['emailTo']; $mailFrom = $_POST['emailFrom']; $subject = $_POST['yourName']; $message = $_POST['yourCity']; mail('[email protected]','Rattletree Newsletter', 'Name='.$subject. ' City='.$message, "From: ".$mailFrom); ?> Thanks for any help! I'm going crosseyed trying to figure this one out.

    Read the article

  • Sorting/Paginating/Filtering Complex Multi-AR Object Tables in Rails

    - by Matt Rogish
    I have a complex table pulled from a multi-ActiveRecord object array. This listing is a combined display of all of a particular user's "favorite" items (songs, messages, blog postings, whatever). Each of these items is a full-fledged AR object. My goal is to present the user with a simplified search, sort, and pagination interface. The user need not know that the Song has a singer, and that the Message has an author -- to the end user both entries in the table will be displayed as "User". Thus, the search box will simply be a dropdown list asking them which to search on (User name, created at, etc.). Internally, I would need to convert that to the appropriate object search, combine the results, and display. I can, separately, do pagination (mislav will_paginate), sorting, and filtering, but together I'm having some problems combining them. For example, if I paginate the combined list of items, the pagination plugin handles it just fine. It is not efficient since the pagination is happening in the app vs. the DB, but let's assume the intended use-case would indicate the vast majority of the users will have less than 30 favorited items and all other behavior, server capabilities, etc. indicates this will not be a bottleneck. However, if I wish to sort the list I cannot sort it via the pagination plugin because it relies on the assumption that the result set is derived from a single SQL query, and also that the field name is consistent throughout. Thus, I must sort the merged array via ruby, e.g. @items.sort_by{ |i| i.whatever } But, since the items do not share common names, I must first interrogate the object and then call the correct sort by. For example, if the user wishes to sort by user name, if the sorted object is a message, I sort by author but if the object is a song, I sort by singer. This is all very gross and feels quite un-ruby-like. This same problem comes into play with the filter. If the user filters on the "parent item" (the message's thread, the song's album), I must translate that to the appropriate collection object method. Also gross. This is not the exact set-up but is close enough. Note that this is a legacy app so changing it is quite difficult, although not impossible. Also, yes there is some DRY that can be done, but don't focus on the style or elegance of the following code. Style/elegance of the SOLUTION is important, however! :D models: class User < ActiveRecord::Base ... has_and_belongs_to_many :favorite_messages, :class_name => "Message" has_and_belongs_to_many :favorite_songs, :class_name => "Song" has_many :authored_messages, :class_name => "Message" has_many :sung_songs, :class_name => "Song" end class Message < ActiveRecord::Base has_and_belongs_to_many :favorite_messages belongs_to :author, :class_name => "User" belongs_to :thread end class Song < ActiveRecord::Base has_and_belongs_to_many :favorite_songs belongs_to :singer, :class_name => "User" belongs_to :album end controller: def show u = User.find 123 @items = Array.new @items << u.favorite_messages @items << u.favorite_songs # etc. etc. @items.flatten! @items = @items.sort_by{ |i| i.created_at } @items = @items.paginate :page => params[:page], :per_page => 20 end def search # Assume user is searching for username like 'Bob' u = User.find 123 @items = Array.new @items << u.favorite_messages.find( :all, :conditions => "LOWER( author ) LIKE LOWER('%bob%')" ) @items << u.favorite_songs.find( :all, :conditions => "LOWER( singer ) LIKE ... " ) # etc. etc. @items.flatten! @items = @items.sort_by{ |i| determine appropriate sorting based on user selection } @items = @items.paginate :page => params[:page], :per_page => 20 end view: #index.html.erb ... <table> <tr> <th>Title (sort ASC/DESC links)</th> <th>Created By (sort ASC/DESC links))</th> <th>Collection Title (sort ASC/DESC links)</th> <th>Created At (sort ASC/DESC links)</th> </tr> <% @items.each |item| do %> <%= render { :partial => "message", :locals => item } if item.is_a? Message %> <%= render { :partial => "song", :locals => item } if item.is_a? Song %> <%end%> ... </table> #message.html.erb # shorthand, not real ruby print out message title, author name, thread title, message created at #song.html.erb # shorthand print out song title, singer name, album title, song created at

    Read the article

  • Need help with Swift mailer with Kohana wrapper

    - by alex
    My current code is this $swift = email::connect(); $swift->setSubject('hello') ->setFrom(array('[email protected]' => 'Alex')) ->setTo(array('[email protected]' => 'Alex')) ->setBody('hello') ->attach(Swift_Attachment::fromPath(DOCROOT . 'assets/attachments/instructions.pdf')); $swift->send(); The email::connect() returns an instance of SwiftMailer. As per these docs, it would seem that it should work. However, I get an error Fatal error: Call to undefined method Swift_Mailer::setSubject() in /home/user/public_html/application/classes/controller/properties.php on line 45 I've seen that email::connect() does exactly what the example code in the docs does. That is include the correct file return an instance of the library What am I doing wrong? Thanks

    Read the article

  • Computer Vision and AR libraries availabe for Android?!?!?

    - by Arturo
    Hello I am starting out as an Android Developer, and I would like to know if there are any Computer vision libraries or Augmented Reality libraries for the Android SDK , as I am planning to use these libraries for a mobile app. I have read that if I download the NDK, I might be able to "import/use" the C openCV, and ARtoolkit libraries, but I am wondering if this is possible, or if there is a better and easier way of using these tools. Android apps are programmed in Java, yet OpenCV & ARtoolkit use C/C++, any way to use these libraries?!? Thank you!

    Read the article

  • Swift Mailer Error

    - by Selom
    Hi, Im using the following code to send a message: try { require_once "lib/Swift.php"; require_once "lib/Swift/Connection/SMTP.php"; $smtp =& new Swift_Connection_SMTP("mail.somedomain.net", 587); $smtp->setUsername("username"); $smtp->setpassword("password"); $swift =& new Swift($smtp); //Create the sender from the details we've been given $sender =& new Swift_Address($email, $name); $message =& new Swift_Message("message title"); $message->attach(new Swift_Message_Part("Hello")); //Try sending the email $sent = $swift->send($message, "$myEmail", $sender); //Disconnect from SMTP, we're done $swift->disconnect(); if($sent) { print 'sent'; } else { print 'not sent'; } } catch (Exception $e) { echo"$e"; } The issue is that it is working fine on my local server (which my xampp server) but not working when the file is uploaded on the real server. It throwing this error: 'The SMTP connection failed to start [mail.somedomain.net:587]: fsockopen returned Error Number 110 and Error String 'Connection timed out'' Please what should I do to correct this error. Thanks for reading

    Read the article

  • Prawn PDF with Rails mailer?

    - by Danny McClelland
    Hi Everyone, I have successfully created an email that sends on creation of a Kase, but now I need to attach a PDF that is created on the fly by Prawn and Prawno. Basically when you visit a kase such as application.com/kase/1 you just append the URL with .pdf i.e. application.com/kase/1. I spent ages getting the PDF to work and look how I wanted, but I can't figure out how to add the PDF to an auto sending email - mainly because I cannot work out how to give it a link as it's auto generated. Has anyone ever managed to get this to work? Thanks, Danny

    Read the article

  • Action Mailer Confirmation Emails - Ruby on Rails...

    - by bgadoci
    I have successfully installed the Clearance Gem from ThoughtBot. Clearance sends a confirmation email upon a new sign_up and suggests adding: config.action_mailer.default_url_options = { :host => 'localhost:3000' } to your /environments/test.rb and development.rb. I have tried this and also config.action_mailer.default_url_options = { :host => '127.0.0.1', :port => 3000 } But can't seem to get rails to send the email. As I am new to both Ruby and Rails, I am wondering if there is some step/config that ThoughtBot is assuming I have already done to send emails. What am I doing wrong/missing? UPDATE: Just added notifier.rb class Notifier < ActionMailer::Base recipients recipient.email_address_with_name bcc ["[email protected]"] from "[email protected]" subject "New account information" body :account => recipient end end

    Read the article

  • Rails AR validates_uniqueness_of against polymorphic relationship

    - by aaronrussell
    Is it posible to validate the uniqueness of a child model's attribute scoped against a polymorphic relationship? For example I have a model called field that belongs to fieldable: class Field < ActiveRecord::Base belongs_to :fieldable, :polymorphic => :true validates_uniqueness_of :name, :scope => :fieldable_id end I have several other models (Pages, Items) which have many Fields. So what I want is to validate the uniqueness of the field name against the parent model, but the problem is that occasionally a Page and an Item share the same ID number, causing the validations to fail when they shouldn't. Am I just doing this wrong or is there a better way to do this?

    Read the article

  • User Mailer Failing

    - by Trevor Nederlof
    I have setup a process in my User model to send a bunch of @users to a mailing script, user_mailer.rb I am using the http://postageapp.com app to send out emails. The users are getting to the User_mailer but I am getting an error from there. Can anyone please point me in the right direction. User Model: class User < ActiveRecord::Base acts_as_authentic def self.mail_out weekday = Date.today.strftime('%A').downcase @users = find(:all, :conditions => {"#{weekday}sub".to_sym => 't'}) UserMailer.deliver_mail_out(@users) end end User_mailer.rb class UserMailer < ActionMailer::Base def mail_out(users) @recipients = { } users.each do |user| @recipients[user.email] = { :zipcode => user.zipcode } end from "[email protected]" subject "Check out the trailer of the day!" body :user => user end end mail_out.html.erb {{zipcode}}, Please check out the trailer of the day at http://www.dailytrailer.net Thank you! -- The DailyTrailer.net Team User db schema create_table "users", :force => true do |t| t.string "email" t.date "birthday" t.string "gender" t.string "zipcode" t.datetime "created_at" t.datetime "updated_at" t.string "crypted_password" t.string "password_salt" t.string "persistence_token" t.string "mondaysub", :default => "f", :null => false t.string "tuesdaysub", :default => "f", :null => false t.string "wednesdaysub", :default => "f", :null => false t.string "thursdaysub", :default => "f", :null => false t.string "fridaysub", :default => "f", :null => false t.string "saturdaysub", :default => "f", :null => false t.string "sundaysub", :default => "f", :null => false end Error: /var/lib/gems/1.8/gems/rails-2.3.5/lib/commands/runner.rb:48: undefined method `name' for #<User:0xb6e8ae48> (NoMethodError) from /home/tnederlof/Dropbox/Ruby/daily_trailer/app/models/user_mailer.rb:5:in `mail_out' from /home/tnederlof/Dropbox/Ruby/daily_trailer/app/models/user_mailer.rb:4:in `each' from /home/tnederlof/Dropbox/Ruby/daily_trailer/app/models/user_mailer.rb:4:in `mail_out' from /home/tnederlof/.gem/ruby/1.8/gems/actionmailer-2.3.5/lib/action_mailer/base.rb:459:in `__send__' from /home/tnederlof/.gem/ruby/1.8/gems/actionmailer-2.3.5/lib/action_mailer/base.rb:459:in `create!' from /home/tnederlof/.gem/ruby/1.8/gems/actionmailer-2.3.5/lib/action_mailer/base.rb:452:in `initialize' from /home/tnederlof/.gem/ruby/1.8/gems/actionmailer-2.3.5/lib/action_mailer/base.rb:395:in `new' from /home/tnederlof/.gem/ruby/1.8/gems/actionmailer-2.3.5/lib/action_mailer/base.rb:395:in `method_missing' from /home/tnederlof/Dropbox/Ruby/daily_trailer/app/models/user.rb:13:in `mail_out' from (eval):1 from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `eval' from /var/lib/gems/1.8/gems/rails-2.3.5/lib/commands/runner.rb:48 from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require' from script/runner:3

    Read the article

  • symfony 1.4 adding a BCC recipient to mailer

    - by Matt
    I know with swift directly you can create a Recipient_List and do -addBcc() . How would i do this same thing in the context of symfony 1.4 $message = $this->getMailer()->compose(); $message->setSubject(sfConfig::get('app_email_welcome_subject')); $message->setTo($user->getUsername()); $message->setFrom(sfConfig::get('app_email_from'));

    Read the article

  • Mailer issue, PHP values do not change

    - by Roland
    I have a script that runs once every month and send out stats to clients, now the stats are displayed in normal text and in the shape of a Pie Graph, now if I run the script mannually from the command line all info on the graphs are correct, but when the cron job executes the script the values for the first client are displaying on the graphs of all clients. but the text is correct. I'm using domDocument to build the HTML and PHPMailer to send out the email with the Graphs embedded into the mail also use pChart to generate the Graph My code that generates the PIE graph is below include_once "pChart.1.26e/pChart/pData.class"; include_once "pChart.1.26e/pChart/pChart.class"; // Dataset definition unset($DataSet); $DataSet = new pData; $DataSet->AddPoint(array($data['total_clicks'],$remaining),"Serie1"); if($remaining < 0){ $DataSet->AddPoint(array("Clicks delivered todate","Clicks remaining = 0"),"Serie2"); }else{ $DataSet->AddPoint(array("Clicks delivered todate","Clicks remaining"),"Serie2"); } $DataSet->AddAllSeries(); $DataSet->SetAbsciseLabelSerie("Serie2"); // Initialise the graph $pie = new pChart(492,292); $pie->drawBackground(255,255,254); $pie->LineWidth = 1.1; $pie->Values = 2; // $pie->drawRoundedRectangle(5,5,375,195,5,230,230,230); //$pie->drawRectangle(0,0,480,288,169,169,169); $pie->drawRectangle(5,5,487,287,169,169,169); $pie->loadColorPalette('pChart.1.26e/color/tones-3.txt',','); // Draw the pie chart $pie->setFontProperties("pChart.1.26e/Fonts/calibrib.ttf",18); $pie->drawTitle(140,33,"Campaign Overview",0,0,0); $pie->setFontProperties("pChart.1.26e/Fonts/calibrib.ttf",11); $pie->drawTitle(343,125,"Total clicks : ".$total_clicks,0,0,0); $pie->setFontProperties("pChart.1.26e/Fonts/calibri.ttf",10); if($remaining < 0){ $pie->setFontProperties("pChart.1.26e/Fonts/calibrib.ttf",10); $pie->drawTitle(260,250,"Campaign over-delivered by ".substr($remaining,1)." clicks",205,53,53); $pie->setFontProperties("pChart.1.26e/Fonts/calibri.ttf",10); } $pie->drawPieLegend(328,140,$DataSet->GetData(),$DataSet->GetDataDescription(),255,255,255); $pie->drawPieGraph($DataSet->GetData(),$DataSet->GetDataDescription(),170,150,130,PIE_VALUE,FALSE,50,30,0); $pie->Render("generated/3dpie.png"); unset($pie); unset($DataSet); $mail->AddEmbeddedImage("/var/www/html/stats/generated/3dpie.png","5"); I just can't understand why this only happens when the cronjob runs?

    Read the article

  • ActiveRecord Logic Challenge - Smart Ways to Use AR Timestamp

    - by keruilin
    My question is somewhat specific to my app's issue, but the answer should be instructive in terms of use cases for association logic and the record timestamp. I have an NBA pick 'em game where I want to award badges for picking x number of games in a row correctly -- 10, 20, 30. Here are the models, attributes, and associations in-play: User id Pick id result # (values can be 'W', 'L', 'T', or nil. nil means hasn't resolved yet.) resolved # (values can be true, false, or nil.) game_time created_at *Note: There are cases where a pick's result field and resolved field will always be nil. Perhaps the game was cancelled. Badge id Award id user_id badge_id created_at User has many awards. User has many picks. Pick belongs to user. Badge has many awards. Award belongs to user. Award belongs to badge. One of the important rules here to capture in the code is that while a user can be awarded multiple streak badges (e.g., a user can win multiple 10-streak badges), the user CAN'T be awarded another badge for consecutive winning picks that were previously granted an award badge. One way to think of this is that all the dates of the winning picks must come after the date that the streak badge was awarded. For example, let's pretend that a user made 13 winning picks from May 5 to May 8, with the 10th winning pick occurring on May 7, and the last 3 on May 8. The user would be awarded a 10-streak badge on May 7. Now if the user makes another winning pick on May 9, the code must recognize that the user only has a streak of 4 winning picks, not 14, because the user already received an award for the first 10. Now let's assume that the user makes 6 more winning picks. In this case, the code must recognize that all winning picks since May 5 are eligible for a 20-streak badge award, and make the award. Another important rule is that when looking at a winning streak, we don't care about the game time, but rather when the pick was made (created_at). For example, let's say that Team A plays Team B on Sat. And Team C plays Team D on Sun. If the user picks Team C to beat Team D on Thurs, and Team A to beat Team C on Fri, and Team A wins on Sat, but Team C loses on Sun, then the user has a losing streak of 1. So when must the streak-check kick-in? As soon as a pick is a win. If it's a loss or tie, no point in checking. One more note: if the pick is not resolved (false) and the result is nil, that means the game was postponed and must be factored out. With all that said, what is the most efficient, effective and lean way to determine whether a user has a 10-, 20- or 30-win streak?

    Read the article

  • action mailer gem and tlsmail gem not working in heroku after GIT PUSH HEROKU

    - by user163352
    I'm using heroku as my host..It was working fine. Then I installed action_mailer_tls and tlsmail. Then I comitted it and pushed it heroku.. After that I got error in myapp.heroku.com. The error is /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require': no such file to load -- smtp_tls (MissingSourceFile) from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:158:in require' from /disk1/home/slugs/154378_e47562d_b59c/mnt/config/initializers/smtp_gmail.rb:3 from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:147:inload_without_new_constant_marking' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:147:in load' from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/initializer.rb:622:inload_application_initializers' from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/initializer.rb:621:in each' from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/initializer.rb:621:inload_application_initializers' ... 19 levels... from /usr/local/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:in instance_eval' from /usr/local/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:ininitialize' from /home/heroku_rack/heroku.ru:1:in `new' from /home/heroku_rack/heroku.ru:1 Do I need to push the gems..If so I tried git add .gems It also gives fatal error. any suggestion would be greatly appreciated.

    Read the article

  • Ruby mailer is coming up with an EOFError

    - by Deadder
    I am getting an EOFError (End Of File Error) on this code in my controller. The block where the error appears is at the end of the line that says UserMailer.deliver_message( I am unaware as to how to fix this, I have been stuck for about 2 months and this site was suggested. Please help. def contact @title= "Contact Us" if request.post? @message= Message.new(params[:contact]) if @message.valid? UserMailer.deliver_message( :message => @message ) flash[:notice] = "Thank you for contacting us" redirect_to contact_url end end end Here is the message file: <%= @mail.name %> has sent feedback or a question: Message: <%= @mail.body %> From: <%= @mail.email %> And here is the UserMailer class UserMailer < ActionMailer::Base def message(mail) subject 'Feedback/Questions' recipients 'Email@email' from 'webmaster' body mail end end

    Read the article

  • PHP mailer containing HTML not showing correctly

    - by kielie
    Hi guys, here is some code I've been working on, basically I need to set up a auto e-mail that gets sent to a user after they fill in a form, which at the moment it is doing, but the HTML is not displaying as it should inside of the email client. I checked in Gmail, Outlook and Mac mail and none of them display the HTML correctly. Here is the code <?php session_start(); $_SESSION['name'] = $_POST['name']; $name = $_SESSION['name']; $email_1 = $_POST['email_1']; $email_2 = $_POST['email_2']; $email_3 = $_POST['email_3']; $email_4 = $_POST['email_4']; $id_num = $_POST['id_num']; $tel = $_POST['tel']; $email = $_POST['email']; //sets the current date $curDate = date("Y-m-d"); // Example require_once("mailclass/htmlMimeMail.php"); $mail = new htmlMimeMail(); $mail->setSubject("Your submission to MyWebsite!"); $mail->setFrom("MyWebsite <[email protected]>"); $mail->setFrom("MyWebsite <[email protected]>"); $email_address = $email_1 . "," . $email_2 . "," . $email_3 ."," . $email_4 ; $mail->setBcc($email_address); $day = " <body style="'background: #000000; color: #FFFFFF;'"> <div style="'background-image: url(http://www.website.com/images/mailerbg.jpg); width: 900px; height: 839px; margin: 0 auto;'"> <div style="'width: 620px; height: 280px; position: relative; top: 155px; left: 25px;'"> <h1><br>your friend $name<br><br><br></h1> </div> </div> </body>"; $mail->setHTML($day); $result = $mail->send(array()); ?> The code is pretty messy, from me screwing around with it so much, but basically none of the HTML shows up as it should in the email client once the message arrives at it's destination, how can I get it to display as a proper HTML page inside of the mail client? I am assuming that my escaping is not done correctly, which is why nothing is showing as it should? Thanx in advance!

    Read the article

  • How to specify multiple values in where with AR query interface in rails3

    - by wkhatch
    Per section 2.2 of rails guide on Active Record query interface here: which seems to indicate that I can pass a string specifying the condition(s), then an array of values that should be substituted at some point while the arel is being built. So I've got a statement that generates my conditions string, which can be a varying number of attributes chained together with either AND or OR between them, and I pass in an array as the second arg to the where method, and I get: ActiveRecord::PreparedStatementInvalid: wrong number of bind variables (1 for 5) which leads me to believe I'm doing this incorrectly. However, I'm not finding anything on how to do it correctly. To restate the problem another way, I need to pass in a string to the where method such as "table.attribute = ? AND table.attribute1 = ? OR table.attribute1 = ?" with an unknown number of these conditions anded or ored together, and then pass something, what I thought would be an array as the second argument that would be used to substitute the values in the first argument conditions string. Is this the correct approach, or, I'm just missing some other huge concept somewhere and I'm coming at this all wrong? I'd think that somehow, this has to be possible, short of just generating a raw sql string.

    Read the article

  • 64-bit Archives Needed

    - by user9154181
    A little over a year ago, we received a question from someone who was trying to build software on Solaris. He was getting errors from the ar command when creating an archive. At that time, the ar command on Solaris was a 32-bit command. There was more than 2GB of data, and the ar command was hitting the file size limit for a 32-bit process that doesn't use the largefile APIs. Even in 2011, 2GB is a very large amount of code, so we had not heard this one before. Most of our toolchain was extended to handle 64-bit sized data back in the 1990's, but archives were not changed, presumably because there was no perceived need for it. Since then of course, programs have continued to get larger, and in 2010, the time had finally come to investigate the issue and find a way to provide for larger archives. As part of that process, I had to do a deep dive into the archive format, and also do some Unix archeology. I'm going to record what I learned here, to document what Solaris does, and in the hope that it might help someone else trying to solve the same problem for their platform. Archive Format Details Archives are hardly cutting edge technology. They are still used of course, but their basic form hasn't changed in decades. Other than to fix a bug, which is rare, we don't tend to touch that code much. The archive file format is described in /usr/include/ar.h, and I won't repeat the details here. Instead, here is a rough overview of the archive file format, implemented by System V Release 4 (SVR4) Unix systems such as Solaris: Every archive starts with a "magic number". This is a sequence of 8 characters: "!<arch>\n". The magic number is followed by 1 or more members. A member starts with a fixed header, defined by the ar_hdr structure in/usr/include/ar.h. Immediately following the header comes the data for the member. Members must be padded at the end with newline characters so that they have even length. The requirement to pad members to an even length is a dead giveaway as to the age of the archive format. It tells you that this format dates from the 1970's, and more specifically from the era of 16-bit systems such as the PDP-11 that Unix was originally developed on. A 32-bit system would have required 4 bytes, and 64-bit systems such as we use today would probably have required 8 bytes. 2 byte alignment is a poor choice for ELF object archive members. 32-bit objects require 4 byte alignment, and 64-bit objects require 64-bit alignment. The link-editor uses mmap() to process archives, and if the members have the wrong alignment, we have to slide (copy) them to the correct alignment before we can access the ELF data structures inside. The archive format requires 2 byte padding, but it doesn't prohibit more. The Solaris ar command takes advantage of this, and pads ELF object members to 8 byte boundaries. Anything else is padded to 2 as required by the format. The archive header (ar_hdr) represents all numeric values using an ASCII text representation rather than as binary integers. This means that an archive that contains only text members can be viewed using tools such as cat, more, or a text editor. The original designers of this format clearly thought that archives would be used for many file types, and not just for objects. Things didn't turn out that way of course — nearly all archives contain relocatable objects for a single operating system and machine, and are used primarily as input to the link-editor (ld). Archives can have special members that are created by the ar command rather than being supplied by the user. These special members are all distinguished by having a name that starts with the slash (/) character. This is an unambiguous marker that says that the user could not have supplied it. The reason for this is that regular archive members are given the plain name of the file that was inserted to create them, and any path components are stripped off. Slash is the delimiter character used by Unix to separate path components, and as such cannot occur within a plain file name. The ar command hides the special members from you when you list the contents of an archive, so most users don't know that they exist. There are only two possible special members: A symbol table that maps ELF symbols to the object archive member that provides it, and a string table used to hold member names that exceed 15 characters. The '/' convention for tagging special members provides room for adding more such members should the need arise. As I will discuss below, we took advantage of this fact to add an alternate 64-bit symbol table special member which is used in archives that are larger than 4GB. When an archive contains ELF object members, the ar command builds a special archive member known as the symbol table that maps all ELF symbols in the object to the archive member that provides it. The link-editor uses this symbol table to determine which symbols are provided by the objects in that archive. If an archive has a symbol table, it will always be the first member in the archive, immediately following the magic number. Unlike member headers, symbol tables do use binary integers to represent offsets. These integers are always stored in big-endian format, even on a little endian host such as x86. The archive header (ar_hdr) provides 15 characters for representing the member name. If any member has a name that is longer than this, then the real name is written into a special archive member called the string table, and the member's name field instead contains a slash (/) character followed by a decimal representation of the offset of the real name within the string table. The string table is required to precede all normal archive members, so it will be the second member if the archive contains a symbol table, and the first member otherwise. The archive format is not designed to make finding a given member easy. Such operations move through the archive from front to back examining each member in turn, and run in O(n) time. This would be bad if archives were commonly used in that manner, but in general, they are not. Typically, the ar command is used to build an new archive from scratch, inserting all the objects in one operation, and then the link-editor accesses the members in the archive in constant time by using the offsets provided by the symbol table. Both of these operations are reasonably efficient. However, listing the contents of a large archive with the ar command can be rather slow. Factors That Limit Solaris Archive Size As is often the case, there was more than one limiting factor preventing Solaris archives from growing beyond the 32-bit limits of 2GB (32-bit signed) and 4GB (32-bit unsigned). These limits are listed in the order they are hit as archive size grows, so the earlier ones mask those that follow. The original Solaris archive file format can handle sizes up to 4GB without issue. However, the ar command was delivered as a 32-bit executable that did not use the largefile APIs. As such, the ar command itself could not create a file larger than 2GB. One can solve this by building ar with the largefile APIs which would allow it to reach 4GB, but a simpler and better answer is to deliver a 64-bit ar, which has the ability to scale well past 4GB. Symbol table offsets are stored as 32-bit big-endian binary integers, which limits the maximum archive size to 4GB. To get around this limit requires a different symbol table format, or an extension mechanism to the current one, similar in nature to the way member names longer than 15 characters are handled in member headers. The size field in the archive member header (ar_hdr) is an ASCII string capable of representing a 32-bit unsigned value. This places a 4GB size limit on the size of any individual member in an archive. In considering format extensions to get past these limits, it is important to remember that very few archives will require the ability to scale past 4GB for many years. The old format, while no beauty, continues to be sufficient for its purpose. This argues for a backward compatible fix that allows newer versions of Solaris to produce archives that are compatible with older versions of the system unless the size of the archive exceeds 4GB. Archive Format Differences Among Unix Variants While considering how to extend Solaris archives to scale to 64-bits, I wanted to know how similar archives from other Unix systems are to those produced by Solaris, and whether they had already solved the 64-bit issue. I've successfully moved archives between different Unix systems before with good luck, so I knew that there was some commonality. If it turned out that there was already a viable defacto standard for 64-bit archives, it would obviously be better to adopt that rather than invent something new. The archive file format is not formally standardized. However, the ar command and archive format were part of the original Unix from Bell Labs. Other systems started with that format, extending it in various often incompatible ways, but usually with the same common shared core. Most of these systems use the same magic number to identify their archives, despite the fact that their archives are not always fully compatible with each other. It is often true that archives can be copied between different Unix variants, and if the member names are short enough, the ar command from one system can often read archives produced on another. In practice, it is rare to find an archive containing anything other than objects for a single operating system and machine type. Such an archive is only of use on the type of system that created it, and is only used on that system. This is probably why cross platform compatibility of archives between Unix variants has never been an issue. Otherwise, the use of the same magic number in archives with incompatible formats would be a problem. I was able to find information for a number of Unix variants, described below. These can be divided roughly into three tribes, SVR4 Unix, BSD Unix, and IBM AIX. Solaris is a SVR4 Unix, and its archives are completely compatible with those from the other members of that group (GNU/Linux, HP-UX, and SGI IRIX). AIX AIX is an exception to rule that Unix archive formats are all based on the original Bell labs Unix format. It appears that AIX supports 2 formats (small and big), both of which differ in fundamental ways from other Unix systems: These formats use a different magic number than the standard one used by Solaris and other Unix variants. They include support for removing archive members from a file without reallocating the file, marking dead areas as unused, and reusing them when new archive items are inserted. They have a special table of contents member (File Member Header) which lets you find out everything that's in the archive without having to actually traverse the entire file. Their symbol table members are quite similar to those from other systems though. Their member headers are doubly linked, containing offsets to both the previous and next members. Of the Unix systems described here, AIX has the only format I saw that will have reasonable insert/delete performance for really large archives. Everyone else has O(n) performance, and are going to be slow to use with large archives. BSD BSD has gone through 4 versions of archive format, which are described in their manpage. They use the same member header as SVR4, but their symbol table format is different, and their scheme for long member names puts the name directly after the member header rather than into a string table. GNU/Linux The GNU toolchain uses the SVR4 format, and is compatible with Solaris. HP-UX HP-UX seems to follow the SVR4 model, and is compatible with Solaris. IRIX IRIX has 32 and 64-bit archives. The 32-bit format is the standard SVR4 format, and is compatible with Solaris. The 64-bit format is the same, except that the symbol table uses 64-bit integers. IRIX assumes that an archive contains objects of a single ELFCLASS/MACHINE, and any archive containing ELFCLASS64 objects receives a 64-bit symbol table. Although they only use it for 64-bit objects, nothing in the archive format limits it to ELFCLASS64. It would be perfectly valid to produce a 64-bit symbol table in an archive containing 32-bit objects, text files, or anything else. Tru64 Unix (Digital/Compaq/HP) Tru64 Unix uses a format much like ours, but their symbol table is a hash table, making specific symbol lookup much faster. The Solaris link-editor uses archives by examining the entire symbol table looking for unsatisfied symbols for the link, and not by looking up individual symbols, so there would be no benefit to Solaris from such a hash table. The Tru64 ld must use a different approach in which the hash table pays off for them. Widening the existing SVR4 archive symbol tables rather than inventing something new is the simplest path forward. There is ample precedent for this approach in the ELF world. When ELF was extended to support 64-bit objects, the approach was largely to take the existing data structures, and define 64-bit versions of them. We called the old set ELF32, and the new set ELF64. My guess is that there was no need to widen the archive format at that time, but had there been, it seems obvious that this is how it would have been done. The Implementation of 64-bit Solaris Archives As mentioned earlier, there was no desire to improve the fundamental nature of archives. They have always had O(n) insert/delete behavior, and for the most part it hasn't mattered. AIX made efforts to improve this, but those efforts did not find widespread adoption. For the purposes of link-editing, which is essentially the only thing that archives are used for, the existing format is adequate, and issues of backward compatibility trump the desire to do something technically better. Widening the existing symbol table format to 64-bits is therefore the obvious way to proceed. For Solaris 11, I implemented that, and I also updated the ar command so that a 64-bit version is run by default. This eliminates the 2 most significant limits to archive size, leaving only the limit on an individual archive member. We only generate a 64-bit symbol table if the archive exceeds 4GB, or when the new -S option to the ar command is used. This maximizes backward compatibility, as an archive produced by Solaris 11 is highly likely to be less than 4GB in size, and will therefore employ the same format understood by older versions of the system. The main reason for the existence of the -S option is to allow us to test the 64-bit format without having to construct huge archives to do so. I don't believe it will find much use outside of that. Other than the new ability to create and use extremely large archives, this change is largely invisible to the end user. When reading an archive, the ar command will transparently accept either form of symbol table. Similarly, the ELF library (libelf) has been updated to understand either format. Users of libelf (such as the link-editor ld) do not need to be modified to use the new format, because these changes are encapsulated behind the existing functions provided by libelf. As mentioned above, this work did not lift the limit on the maximum size of an individual archive member. That limit remains fixed at 4GB for now. This is not because we think objects will never get that large, for the history of computing says otherwise. Rather, this is based on an estimation that single relocatable objects of that size will not appear for a decade or two. A lot can change in that time, and it is better not to overengineer things by writing code that will sit and rot for years without being used. It is not too soon however to have a plan for that eventuality. When the time comes when this limit needs to be lifted, I believe that there is a simple solution that is consistent with the existing format. The archive member header size field is an ASCII string, like the name, and as such, the overflow scheme used for long names can also be used to handle the size. The size string would be placed into the archive string table, and its offset in the string table would then be written into the archive header size field using the same format "/ddd" used for overflowed names.

    Read the article

  • How to delete all mail in solaris

    - by conandor
    I have bunch of mails in my solaris account 107 letters found in /var/mail/icinga, 1 scheduled for deletion, 0 newly arrived 107 d 2886 MAILER-DAEMON Fri Jun 11 00:39:39 2010 > 106 2895 MAILER-DAEMON Fri Jun 11 00:13:02 2010 105 2890 MAILER-DAEMON Fri Jun 11 00:10:05 2010 104 2888 MAILER-DAEMON Tue May 18 15:13:34 2010 103 2874 MAILER-DAEMON Tue May 18 14:58:29 2010 102 2874 MAILER-DAEMON Tue May 18 14:28:34 2010 Any idea how can i delete all of them with 1 command line instead of line by line?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >