Search Results

Search found 21430 results on 858 pages for 'message digest'.

Page 89/858 | < Previous Page | 85 86 87 88 89 90 91 92 93 94 95 96  | Next Page >

  • django customizing form labels

    - by Henri
    I have a problem in customizing labels in a Django form This is the form code in file contact_form.py: from django import forms class ContactForm(forms.Form): def __init__(self, subject_label="Subject", message_label="Message", email_label="Your email", cc_myself_label="Cc myself", *args, **kwargs): super(ContactForm, self).__init__(*args, **kwargs) self.fields['subject'].label = subject_label self.fields['message'].label = message_label self.fields['email'].label = email_label self.fields['cc_myself'].label = cc_myself_label subject = forms.CharField(widget=forms.TextInput(attrs={'size':'60'})) message = forms.CharField(widget=forms.Textarea(attrs={'rows':15, 'cols':80})) email = forms.EmailField(widget=forms.TextInput(attrs={'size':'60'})) cc_myself = forms.BooleanField(required=False) The view I am using this in looks like: def contact(request, product_id=None): . . . if request.method == 'POST': form = contact_form.ContactForm(request.POST) if form.is_valid(): . . else: form = contact_form.ContactForm( subject_label = "Subject", message_label = "Your Message", email_label = "Your email", cc_myself_label = "Cc myself") The strings used for initializing the labels will eventually be strings dependent on the language, i.e. English, Dutch, French etc. When I test the form the email is not sent and instead of the redirect-page the form returns with: <QueryDict: {u'cc_myself': [u'on'], u'message': [u'message body'], u'email':[u'[email protected]'], u'subject': [u'test message']}>: where the subject label was before. This is obviously a dictionary representing the form fields and their contents. When I change the file contact_form.py into: from django import forms class ContactForm(forms.Form): """ def __init__(self, subject_label="Subject", message_label="Message", email_label="Your email", cc_myself_label="Cc myself", *args, **kwargs): super(ContactForm, self).__init__(*args, **kwargs) self.fields['subject'].label = subject_label self.fields['message'].label = message_label self.fields['email'].label = email_label self.fields['cc_myself'].label = cc_myself_label """ subject = forms.CharField(widget=forms.TextInput(attrs={'size':'60'})) message = forms.CharField(widget=forms.Textarea(attrs={'rows':15, 'cols':80})) email = forms.EmailField(widget=forms.TextInput(attrs={'size':'60'})) cc_myself = forms.BooleanField(required=False) i.e. disabling the initialization then everything works. The form data is sent by email and the redirect page shows up. So obviously something the the init code isn't right. But what? I would really appreciate some help.

    Read the article

  • When running PowerShell script as a scheduled task some Exchange 2010 database properties are null

    - by barophobia
    Hello, I've written a script that intends to retrieve the DatabaseSize of a database from Exchange 2010. I created a new AD user for this script to run under as a scheduled task. I gave this user admin rights to the Exchange Organization (as a last resort during my testing) and local admin rights on the Exchange machine. When I run this script manually by starting powershell (with runas /noprofile /user:domain\user powershell) everything works fine. All the database properties are available. When I run the script as a scheduled task a lot of the properties are null including the one I want: DatabaseSize. I've also tried running the script as the domain admin account with the same results. There must be something different in the two contexts but I can't figure out what it is. My script: Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 Write-EventLog 'Windows PowerShell' -source PowerShell -eventid 100 -message "Starting script" $databases = get-mailboxdatabase -status if($databases -ne $null) { Write-EventLog 'Windows PowerShell' -source PowerShell -eventid 100 -message "Object created" $databasesize_text = $databases.databasesize.tomb().tostring() if($databasesize_text -ne $null) { $output = "echo "+$databasesize_text+":ok" Write-EventLog 'Windows PowerShell' -source PowerShell -eventid 100 -message "Path check" if(test-path "\\mon-01\prtgsensors\EXE\") { Write-EventLog 'Windows PowerShell' -source PowerShell -eventid 100 -message "Path valid" Set-Content \\mon-01\prtgsensors\EXE\ex-05_db_size.bat -value $output } Write-EventLog 'Windows PowerShell' -source PowerShell -eventid 100 -message "Exiting program" } else { Write-EventLog 'Windows PowerShell' -source PowerShell -eventid 100 -message "databasesize_text is empty. nothing to do" } } else { Write-EventLog 'Windows PowerShell' -source PowerShell -eventid 100 -message "object not created. nothing to do" } exit 0

    Read the article

  • How to avoid using this in a contructor

    - by Paralife
    I have this situation: interface MessageListener { void onMessageReceipt(Message message); } class MessageReceiver { MessageListener listener; public MessageReceiver(MessageListener listener, other arguments...) { this.listener = listener; } loop() { Message message = nextMessage(); listener.onMessageReceipt(message); } } and I want to avoid the following pattern: (Using the this in the Client constructor) class Client implements MessageListener { MessageReceiver receiver; MessageSender sender; public Client(...) { receiver = new MessageReceiver(this, other arguments...); sender = new Sender(...); } . . . @Override public void onMessageReceipt(Message message) { if(Message.isGood()) sender.send("Congrtulations"); else sender.send("Boooooooo"); } } The reason why i need the above functionality is because i want to call the sender inside the onMessageReceipt() function, for example to send a reply. But I dont want to pass the sender into a listener, so the only way I can think of is containing the sender in a class that implements the listener, hence the above resulting Client implementation. Is there a way to achive this without the use of 'this' in the constructor? It feels bizare and i dont like it, since i am passing myself to an object(MessageReceiver) before I am fully constructed. On the other hand, the MessageReceiver is not passed from outside, it is constructed inside, but does this 'purifies' the bizarre pattern? I am seeking for an alternative or an assurance of some kind that this is safe, or situations on which it might backfire on me.

    Read the article

  • How to avoid using this in a constructor

    - by Paralife
    I have this situation: interface MessageListener { void onMessageReceipt(Message message); } class MessageReceiver { MessageListener listener; public MessageReceiver(MessageListener listener, other arguments...) { this.listener = listener; } loop() { Message message = nextMessage(); listener.onMessageReceipt(message); } } and I want to avoid the following pattern: (Using the this in the Client constructor) class Client implements MessageListener { MessageReceiver receiver; MessageSender sender; public Client(...) { receiver = new MessageReceiver(this, other arguments...); sender = new Sender(...); } . . . @Override public void onMessageReceipt(Message message) { if(Message.isGood()) sender.send("Congrtulations"); else sender.send("Boooooooo"); } } The reason why i need the above functionality is because i want to call the sender inside the onMessageReceipt() function, for example to send a reply. But I dont want to pass the sender into a listener, so the only way I can think of is containing the sender in a class that implements the listener, hence the above resulting Client implementation. Is there a way to achive this without the use of 'this' in the constructor? It feels bizare and i dont like it, since i am passing myself to an object(MessageReceiver) before I am fully constructed. On the other hand, the MessageReceiver is not passed from outside, it is constructed inside, but does this 'purifies' the bizarre pattern? I am seeking for an alternative or an assurance of some kind that this is safe, or situations on which it might backfire on me.

    Read the article

  • .net c# cannot find img resources when open with exe

    - by okuryazar
    Hello, My exe processes text documents and I want to be able to right click on documents, select open with and point to my exe file. I can double click on my exe and choose a file to process with OpenFileDialog and it works fine. However, when I do open with, I get FileNotFound error. Here is the error log: System.IO.FileNotFoundException: attention.jpg at System.Drawing.Image.FromFile(String filename, Boolean useEmbeddedColorManagement) at System.Drawing.Image.FromFile(String filename) at ImzaDogrulamaUygulamasi.frmCertificate.FillTreeView() in D:\VSS\SOURCE\VS2008\EGA\ImzaDogrulamaUygulamasi\ImzaDogrulamaUygulamasi\frmCertificate.cs:line 76 at ImzaDogrulamaUygulamasi.frmCertificate.Form2_Load(Object sender, EventArgs e) in D:\VSS\SOURCE\VS2008\EGA\ImzaDogrulamaUygulamasi\ImzaDogrulamaUygulamasi\frmCertificate.cs:line 244 at System.Windows.Forms.Form.OnLoad(EventArgs e) at System.Windows.Forms.Form.OnCreateControl() at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) at System.Windows.Forms.Control.CreateControl() at System.Windows.Forms.Control.WmShowWindow(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.Form.WmShowWindow(Message& m) at System.Windows.Forms.Form.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) and this is how I add my images in my code, all resources are in the same directory with the exe file: ImageList myImageList = new ImageList(); myImageList.Images.Add(Image.FromFile("attention.jpg")); myImageList.Images.Add(Image.FromFile("sandglass.jpg")); myImageList.Images.Add(Image.FromFile("11.JPG")); myImageList.Images.Add(Image.FromFile("checkGif.jpg")); treeView1.ImageList = myImageList; Any help is much appreciated. Thanks

    Read the article

  • WCF Callback Contract InvalidOperationException: Collection has been modified

    - by mrlane
    We are using a WCF service with a Callback contract. Communication is Asynchronous. The service contract is defined as: [ServiceContract(Namespace = "Silverlight", CallbackContract = typeof(ISessionClient),SessionMode = SessionMode.Allowed)] public interface ISessionService With a method: [OperationContract(IsOneWay = true)] void Send(Message message); The callback contract is defined as [ServiceContract] public interface ISessionClient With methods: [OperationContract(IsOneWay = true, AsyncPattern = true)] IAsyncResult BeginSend(Message message, AsyncCallback callback, object state); void EndSend(IAsyncResult result); The implementation of BeginSend and EndSend in the callback channel are as follows: public void Send(ActionMessage actionMessage) { Message message = Message.CreateMessage(_messageVersion, CommsSettings.SOAPActionReceive, actionMessage, _messageSerializer); lock (LO_backChannel) { try { _backChannel.BeginSend(message, OnSendComplete, null); } catch (Exception ex) { _hasFaulted = true; } } } private void OnSendComplete(IAsyncResult asyncResult) { lock (LO_backChannel) { try { _backChannel.EndSend(asyncResult); } catch (Exception ex) { _hasFaulted = true; } } } We are getting an InvalidOperationException: "Collection has been modified" on _backChannel.EndSend(asyncResult) seemingly randomly, and we are really out of ideas about what is causing this. I understand what the exception means, and that concurrency issues are a common cause of such exceptions (hence the locks), but it really doesn't make any sense to me in this situation. The clients of our service are Silverlight 3.0 clients using PollingDuplexHttpBinding which is the only binding available for Silverlight. We have been running fine for ages, but recently have been doing a lot of data binding, and this is when the issues started. Any help with this is appreciated as I am personally stumped at this time.

    Read the article

  • Sending multi-part email from Google App Engine using Spring's JavaMailSender fails

    - by hleinone
    It works without the multi-part (modified from the example in Spring documentation): final MimeMessagePreparator preparator = new MimeMessagePreparator() { public void prepare(final MimeMessage mimeMessage) throws Exception { final MimeMessageHelper message = new MimeMessageHelper( mimeMessage); message.setTo(toAddress); message.setFrom(fromAddress); message.setSubject(subject); final String htmlText = FreeMarkerTemplateUtils .processTemplateIntoString(configuration .getTemplate(htmlTemplate), model); message.setText(htmlText, true); } }; mailSender.send(preparator); But once I change it to: final MimeMessagePreparator preparator = new MimeMessagePreparator() { public void prepare(final MimeMessage mimeMessage) throws Exception { final MimeMessageHelper message = new MimeMessageHelper( mimeMessage, true); ... message.setText(plainText, htmlText); } }; mailSender.send(preparator); I get: Failed message 1: javax.mail.MessagingException: Converting attachment data failed at com.google.appengine.api.mail.stdimpl.GMTransport.sendMessage(GMTransport.java:231) at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:402) ... This is especially difficult since the GMTransport is proprietary Google class and no sources are available, which would make it a bit easier to debug. Anyone have any ideas what to try next? My bean config, for helping you to help me: <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl" p:username="${mail.username}" p:password="${mail.password}" p:protocol="gm" />

    Read the article

  • How to find specific/local files via CMake

    - by Andreas Romeyke
    Hello, I have a problem with a locally installed library. In my project there is the xmlrpc++0.7-library: myproject/ +-- xmlrpc++0.7/ +-- src/ I want that CMake fallbacks using the local xmlrpc++0.7 directory if not found otherwise. Two problems, the first one, find_path() or find_library() does not work with local dir. I used a workaround testing if variables processed by find_xxx() are empty or not. If empty I set them manually. The cmake generates the Makefile without errors now. But if I want to compile the project via make, the c++ compiler returns "error: XmlRpc.h: file not found". The file XmlRpc.h lies in myproject/xmlrpc++0.7/src and if I compile all them manually it works fine. Here is my CMakeLists.txt. I am very happy if anyone could me point to the right solution to use cmake under conditions described above. --- CMakeLists.txt --- project(webservice_tesseract) cmake_minimum_required(VERSION 2.6) set(CMAKE_INCLUDE_CURRENT_DIR ON) # find tesseract find_path(TESSERACT_INCLUDE_DIR tesseract/tesseractmain.h /opt/local/include /usr/local/include /usr/include ) find_library(TESSERACT_LIBRARY_DIR NAMES tesseract_main PATHS /opt/local/lib/ /usr/local/lib/ /usr/lib ) message(STATUS "looked for tesseract library.") message(STATUS "Include file detected: [${TESSERACT_INCLUDE_DIR}].") message(STATUS "Lib file detected: [${TESSERACT_LIBRARY_DIR}].") add_library(tesseract STATIC IMPORTED) set_property(TARGET tesseract PROPERTY IMPORTED_LOCATION ${TESSERACT_LIBRARY_DIR}/libtesseractmain.a ) #find xmlrpc++ message(STATUS "cmake home dir: [${CMAKE_HOME_DIRECTORY}].") set(LOCAL_XMLRPCPLUSPLUS ${CMAKE_HOME_DIRECTORY}/xmlrpc0.7++/) message(STATUS "xmlrpc++ local dir: [${LOCAL_XMLRPCPLUSPLUS}].") find_path(XMLRPCPLUSPLUS_INCLUDE_DIR XmlRpcServer.h ${LOCAL_XMLRPCPLUSPLUS}src /opt/local/include /usr/local/include /usr/include ) find_library(XMLRPCPLUSPLUS_LIBRARY_DIR NAMES XmlRpc PATHS ${LOCAL_XMLRPCPLUSPLUS} /opt/local/lib/ /usr/local/lib/ /usr/lib/ ) # next lines are an ugly workaround because cmake find_xxx() does not find local stuff if (XMLRPCPLUSPLUS_INCLUDE_DIR) else (XMLRPCPLUSPLUS_INCLUDE_DIR) set(XMLRPCPLUSPLUS_INCLUDE_DIR ${LOCAL_XMLRPCPLUSPLUS}src) endif (XMLRPCPLUSPLUS_INCLUDE_DIR) if (XMLRPCPLUSPLUS_LIBRARY_DIR) else (XMLRPCPLUSPLUS_LIBRARY_DIR) set(XMLRPCPLUSPLUS_LIBRARY_DIR ${LOCAL_XMLRPCPLUSPLUS}) endif (XMLRPCPLUSPLUS_LIBRARY_DIR) message(STATUS "looked for xmlrpc++ library.") message(STATUS "Include file detected: [${XMLRPCPLUSPLUS_INCLUDE_DIR}].") message(STATUS "Lib file detected: [${XMLRPCPLUSPLUS_LIBRARY_DIR}].") add_library(xmlrpc STATIC IMPORTED) set_property(TARGET xmlrpc PROPERTY IMPORTED_LOCATION ${XMLRPCPLUSPLUS_LIBRARY_DIR}/libXmlRpc.a ) #### link together include_directories(${XMLRPCPLUSPLUS_INCLUDE_DIR} ${TESSERACT_INCLUDE_DIR}) link_directories(${XMLRPCPLUSPLUS_LIBRARY_DIR} ${TESSERACT_LIBRARY_DIR}) add_library(simpleocr STATIC simple_ocr.cpp) add_executable(webservice_tesseract webservice.cpp) target_link_libraries(webservice_tesseract xmlrpc tesseract simpleocr)

    Read the article

  • Handling Errors in PHP

    - by Mike
    I have a custom class that, when called, will redirect to a page and send a 'message_type' and 'message' variable via GET. When the page opens it checks for these variables and displays a 'success', 'warning', or 'error' message depending on the 'message_type' variable. I made it so the user thinks they stay on the same page. It also allows for other variables to be passed along with the message. Is this good practice, or should I just start using exceptions? Example: //Call a static function that will redirect to a page, with an error message RedirectWithMessage::go('somepage.php', MessageType::ERROR, 'Error message here.'); The following checkMessage() function is an include file: function checkMessage() { if((isset($_GET['message_type']) && strlen($_GET['message_type'])) && (isset($_GET['message']) && strlen($_GET['message_type']))) { DisplayMessage::display($_GET['message_type'], $_GET['message']); return true; } return false; } On the page that is redirected to, call checkMessage(); //If a message is received, display it. If not, do nothing checkMessage(); I know this might be vague, and I can supply more code if necessary. I guess the issue is that I don't have much experience using exceptions, but I think they seem cumbersome (writing try-catch blocks everywhere). Please let me know if I am making this more difficult for myself or if there is a better solution. Thanks! Mike

    Read the article

  • How do I find the object with the oldest updated_at column in RJS?

    - by user284194
    Hello, I'm trying to remove the object with the oldest updated_at value when the rjs is executed. page.insert_html :top, :messages, :partial => @message page[@message].visual_effect :grow page[:message_form].reset Message.old_messages.each do |m| page.remove(m.id) end page.delay(1) do page.select('.message').last.visual_effect :fade end I'm using .last in there right now, but I have a periodically_call_remote in the view that continually updates and runs the rjs above. The line: page.select('.message').last.visual_effect :fade seems to only execute the first time because after the message that is "last" fades away there's nothing recognized as "last" anymore so I figure instead of calling .last I could find the object that has the oldest updated_at time stamp and just remove that instead. I'm thinking that I probably cannot do this using page.select since it only calls on css elements. And therefore I probably don't have access to the updated_at values in the Message model. Does anyone have a suggestion on how to accomplish removing the oldest message with rjs? The messages are already automatically removed in the model as new messages are created. But I want them to fade automatically when the RJS refreshes the element.

    Read the article

  • Append to a webpage in javascript

    - by Lily
    What I want to do is that: a webpage with continuously updating content. (In my case is updating every 2s) New content is appended to the old one instead of overwriting the old one. Here is the code I have: var msg_list = new Array( "<message>Hello, Clare</message>", "<message>Hello,Lily</message>", "<message>Hello, Kevin</message>", "<message>Hello, Bill</message>" ); var number = 0; function send_msg() { document.write(number + " " + msg_list[number%4]+'<br/>'); number = number + 1; } var my_interval = setInterval('send_msg()', 2000); However, in both IE and Firefox, only one line is printed out, and the page will not be updated anymore. Interestingly in Chrome, the lines being printed out continuously, which is what I am looking for. I know that document.write() is called when the page is loaded according to this. So it's definitely not the way to update the webpage continuously. What will be the best way to achieve what I want to do? Totally newbie in Javascript. Thank you. Lily

    Read the article

  • MySQL: Request to select the last 10 send/received messages to/by different users

    - by Yako malin
    I want to select the 10 last messages you received OR you sent TO different users. For example the results must be shown like that: 1. John1 - last message received 04/17/10 3:12 2. Thomy - last message sent 04/16/10 1:26 3. Pamela - last message received 04/12/10 3:51 4. Freddy - last message received 03/28/10 9:00 5. Jack - last message sent 03/20/10 4:53 6. Tom - last message received 02/01/10 7:41 ..... Table looks like: CREATE TABLE `messages` ( `id` int(11) NOT NULL AUTO_INCREMENT, `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `sender` int(11) DEFAULT NULL, `receiver` int(11) DEFAULT NULL, `content` text ) I think Facebook (and the iPhone) use this solution. When you go to your mail box, you have the last messages received/sent grouped by Users (friends). So I will take an example. If I have theses messages (THEY ARE ORDERED YET): **Mike** **Tom** **Pam** Mike Mike **John** John Pam **Steve** **Bobby** Steve Steve Bobby Only Message with ** should be returned because they are the LAST messages I sent/received By User. In fact I want the last message of EACH discussion. What is the solution?

    Read the article

  • I trying to backreference using the sed command

    - by Paul
    I am relative new to shell scripting and sed. I need to substitute a pattern, globably, but I also need to remember (or save) part of the pattern and use it later in the same substitute command. The saved pattern will be varible, so I need to use a wild card. For example, input message=trt:GetAudioSourcesRequest/> and I want to end up with something like input message=trt:GetAudioSourcesRequest PAUL/GetAudioSourcesRequest/> but the function string "GetAudioSourcesRequest" will change (in length also) throughtout the file, so I need a wild card, e.g. sed -i "s/input message=trt:<wild card in here>/>/input message=trt:<print wild card> PAUL/<print wild card>/> I have managed to get the following command to nearly do what I want but it is too rigid. It only stores a 4 syllable pattern so if I have a function name such as GetProfileRequest, this doesn't work echo "input message=\"trt:GetAudioSourcesRequest\"/>" | sed 's/input message=\"trt:\([A-Z][a-z]*\)\([A-Z][a-z]*\)\([A-Z][a-z]*\)\([A-Z][a-z]*\).*/input message=\"trt:\1\2\3\4\ PAUL\/\1\2\3\4"\/\>/g' This outputs input message="trt:GetAudioSourcesRequest PAUL/GetAudioSourcesRequest"/> Which is ok but when I use GetProfileRequest this doesn't. I have come accross \W and [^[:alnum:]] or [[:alnum:]] but I don't how to use them Thanks in advance.

    Read the article

  • Using KnockoutJs templates with jQuery

    - by balteo
    I would like to end up with the following HTML in the DOM using jQuery and KnockoutJs templates: <div class="messageToAndFromOtherMember" id="13"> <span>the message</span> <span>2012-12-02 14:05:45.0</span> </div> I have started writing my KO template as follows: <div class="messageToAndFromOtherMember" data-bind="attr:{ id: messageId}"> <span data-bind="text: message"></span> <span data-bind="text: sendDateFmted"></span> </div> Upon a successful ajax request, the following js is executed: var messageViewModel = { message: response.message, sendDateFmted: response.sendDateFmted, messageId: response.messageId }; ko.applyBindings(messageViewModel); Now I am not sure how and where to actually do the binding: since my message does not exist before the ajax request is complete and I can have as several messages... Can anyone please suggest a solution? EDIT: I have added this to the html page: <div data-bind="template: { name: 'message-template', data: messageViewModel }"></div> I now get the following js error: Uncaught Error: Unable to parse bindings. Message: ReferenceError: $messageViewModel is not defined; Bindings value: template: { name: 'message-template', data: messageViewModel }

    Read the article

  • Javamail doesn't send a mail

    - by Jose Hdez
    I am developing a Java application and I am using Javamail to send a mail. My code is the following: Properties props = new Properties(); props.put("mail.smtp.host", "diana.cartif.es"); props.put("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.port", "465"); Session session = Session.getDefaultInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("alerts","pass"); } }); Message message = new MimeMessage(session); message.setFrom(new InternetAddress("[email protected]")); message.setRecipients(Message.RecipientType.TO,InternetAddress.parse("[email protected]")); message.setSubject("Testing Subject"); message.setText("Dear Mail Crawler," +"\n\n No spam to my email, please!"); Transport.send(message); However when I execute this code it throws an Exception: javax.mail.MessagingException: Could not connect to SMTP host: diana.cartif.es, port: 465, response: -1 at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1960) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:642) at javax.mail.Service.connect(Service.java:317) at javax.mail.Service.connect(Service.java:176) at javax.mail.Service.connect(Service.java:125) at javax.mail.Transport.send0(Transport.java:194) at javax.mail.Transport.send(Transport.java:124) at com.cartif.data.MainConnection.getFTPConnection(MainConnection.java:106) at com.cartif.main.Main.connectToServer(Main.java:72) at com.cartif.main.Main.main(Main.java:60) Data to connect is right because I checked it in my Mail Server. Could someone help me please? Thanks!

    Read the article

  • Using JavaMail to send a mail containing Unicode characters

    - by NoozNooz42
    I'm successfully sending emails through GMail's SMTP servers using the following piece of code: Properties props = new Properties(); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.port", "465"); props.put("mail.smtp.ssl", "true"); props.put("mail.smtp.starttls.enable","true"); props.put("mail.smtp.timeout", "5000"); props.put("mail.smtp.connectiontimeout", "5000"); // Do NOT use Session.getDefaultInstance but Session.getInstance // See: http://forums.sun.com/thread.jspa?threadID=5301696 final Session session = Session.getInstance( props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication( USER, PWD ); } }); try { final Message message = new MimeMessage(session); message.setFrom( new InternetAddress( USER ) ); message.setRecipients( Message.RecipientType.TO, InternetAddress.parse( TO ) ); message.setSubject( emailSubject ); message.setText( emailContent ); Transport.send(message); emailSent = true; } catch ( final MessagingException e ) { e.printStackTrace(); } where emailContent is a String that does contain Unicode characters (like the euro symbol). When the email arrives (in another GMail account), the euro symbol has been converted to the ASCII '?' question mark. I don't know much about emails: can email use any character encoding? What should I modify in the code above so that an encoding allowing Unicode characters is used?

    Read the article

  • How to start/stop/restart jQuery animation

    - by Emin
    I have the following function that when I call displays a message to the user for a certain amount of time (5 secs in my case). During this "period" if I call the function again to display another message, practically it should hide, then re-appear with the new message for another 5 seconds. What happens with my code below, I call the function to display the message. Then, lets say on the 4th second, I call it again to display another message, the new message is displayed for 1 second. I need to somehow -reset- the time but can't figure out how. Tried stopping the animation, checking if the element was visible and hiding it if it was, and many other things. I believe the solution is a simple chaining issue but can't get it right. So any help would be appreciated! function display_message(msgType, message) { var elem = $('#ur_messagebox'); switch (msgType) { case 'confirm': elem.addClass('msg_confirm'); break; case 'error': elem.addClass('msg_error'); break; } elem.html(message); elem.show().delay(5000).fadeOut(1000); } thanks in advance...

    Read the article

  • object.valid? returns false but object.errors.full_messages is empty

    - by user549563
    Hello I'm confuse about objects that I can't save, simplified model is class Subscription < ActiveRecord::base belongs_to :user, :class_name => "User", :foreign_key => "user_id" has_many :transactions, :class_name => "SubscriptionTransaction" validates_presence_of :first_name, :message => "ne peut être vide" validates_presence_of :last_name, :message => "ne peut être vide" validates_presence_of :card_number, :message => "ne peut être vide" validates_presence_of :card_verification, :message => "ne peut être vide" validates_presence_of :card_type, :message => "ne peut être vide" validates_presence_of :card_expires_on, :message => "ne peut être vide" attr_accessor :card_number, :card_verification validate_on_create :validate_card def validate_card unless credit_card.valid? credit_card.errors.full_messages.each do |message| errors.add_to_base message end end end def credit_card @credit_card ||= ActiveMerchant::Billing::CreditCard.new( :type => card_type, :number => card_number, :verification_value => card_verification, :month => card_expires_on.month, :year => card_expires_on.year, :first_name => first_name, :last_name => last_name ) end end and in my subscription_controller if subscription.save # do something else debugger # means breakpoint where i try subscription.errors.full_messages # do something else end I tried to use ruby-debug for this adding a breakpoint before. And subscription.valid? return false which explains that ActiveRecord doesn't allow the save method. Unfortunately i can't know why the object is invalid. subscription.errors.full_messages # => [] I'm stucked, if you have any idea, thank you.

    Read the article

  • Response as mail attachment

    - by el ninho
    using (MemoryStream stream = new MemoryStream()) { compositeLink.PrintingSystem.ExportToPdf(stream); Response.Clear(); Response.Buffer = false; Response.AppendHeader("Content-Type", "application/pdf"); Response.AppendHeader("Content-Transfer-Encoding", "binary"); Response.AppendHeader("Content-Disposition", "attachment; filename=test.pdf"); Response.BinaryWrite(stream.GetBuffer()); Response.End(); } I got this working fine. Next step is to send this pdf file to mail, as attachment using (MemoryStream stream = new MemoryStream()) { compositeLink.PrintingSystem.ExportToPdf(stream); Response.Clear(); Response.Buffer = false; Response.AppendHeader("Content-Type", "application/pdf"); Response.AppendHeader("Content-Transfer-Encoding", "binary"); Response.AppendHeader("Content-Disposition", "attachment; filename=test.pdf"); Response.BinaryWrite(stream.GetBuffer()); System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(); message.To.Add("[email protected]"); message.Subject = "Subject"; message.From = new System.Net.Mail.MailAddress("[email protected]"); message.Body = "Body"; message.Attachments.Add(Response.BinaryWrite(stream.GetBuffer())); System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("192.168.100.100"); smtp.Send(message); Response.End(); } I have problem with this line: message.Attachments.Add(Response.BinaryWrite(stream.GetBuffer())); Any help how to get this to work? Thanks

    Read the article

  • Duplicate forwarded messages in Blackberry when using BIS

    - by Avery Payne
    Our Setup External email arrives at a Postfix server, is scanned, and then forwarded via settings in transport (using the RELAY:[{ip-address}] for a given address) to an Exchange 2007 server. Some users are on Exchange, but a few are still on the Postfix server (they will be moved in the near future). IMAPS is provided for external connections via Dovecot; in-house, IMAP is provided for the Gateway and native MAPI is used for Exchange/Outlook. Blackberries are connected via BIS, which uses Dovecot as a reverse-proxy IMAPS service to connect to Exchange (when the mailbox exists on Exchange, otherwise it connects to the mailbox on the gateway). The Issue We have a user that, when they forward an email on their Outlook client, they get a duplicate of the original message on their Blackberry. When I say duplicate, I mean that they have a copy of the forwarded version of the message (i.e. their version of the message that they obtained hitting the forward button), and a copy of the original message that shows up at the same time. The expected behavior is to just see the forwarded message, not the forwarded message and a 2nd copy of the original message. We've only seen this with Outlook users that also have a Blackberry. Other IMAP clients, such as OS X Mail or Thunderbird, do not exhibit this behavior when connecting to the Exchange server; forwarded messages work as expected. The Questions what is causing this to happen? why does it only affect Outlook/Blackberry setups, and not TBird/Blackberry or OSX-Mail/Blackberry? how do we get it to stop, before people go insane and never forward messages again?

    Read the article

  • PHP contact form, am I doing it wrong?

    - by decimal
    I'm learning PHP and I'm trying to write a simple email script. I have a function (checkEmpty) to check if all the forms are filled in and if the email adress is valid (isEmailValid). I'm not sure how to return true checkEmpty funciton. Here's my code: When the submit button is clicked: if (isset($_POST['submit'])) { //INSERT FORM VALUES INTO AN ARRAY $field = array ('name' => $_POST['name'], 'email' => $_POST['email'], 'message' => $_POST['message']); //CONVERT ARRAY KEYS TO VARIABLE NAMES extract ($field); checkEmpty($name, $email, $message); function checkEmpty($name, $email, $message) { global $name_error; global $mail_error; global $message_error; //CHECK IF NAME FIELD IS EMPTY if (isset($name) === true && empty($name) === true) { $name_error = "<span class='error_text'>* Please enter your name</span>"; } //CHECK IF EMAIL IS EMPTY if (isset($email) === true && empty($email) === true) { $mail_error = "<span class='error_text'>* Please enter your email address</span>"; //AND IF IT ISN'T EMPTY CHECK IF IT IS A VALID ONE } elseif (!isValidEmail($email)) { $mail_error = "<span class='error_text'> * Please enter a valid email</span>"; } //CHECK IF MESSAGE IS EMPTY if (isset($message) === true && empty($message) === true) { $message_error = "<span class='error_text'>* Please enter your message</span>"; } } // This function tests whether the email address is valid function isValidEmail($email){ $pattern = "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"; if (eregi($pattern, $email)) { return true; } else { return false; } } I know I shouldn't be using globals in the function, I don't know an alternative. The error messages are display beside each form element.

    Read the article

  • Are there any shortcuts/easier(VB) style way for raising events in C#?

    - by Eric
    Example in VB I have a worker class Public Class worker Public Event EventNumber1(ByVal messages As Dictionary(Of Integer, String)) Public Event EventNumber2(ByVal message As String) Public Sub CallEventNumber1() Dim dict As New Dictionary(Of Integer, String) dict.Add(1, "EventNumber1 First message") dict.Add(2, "EventNumber1 Second message") RaiseEvent EventNumber1(dict) End Sub Public Sub CallEventNumber2() RaiseEvent EventNumber2("I am an EventNumber2 Message") End Sub End Class and wire them up in another class with AddHandler _worker.EventNumber1, AddressOf EventNumber1Handler AddHandler _worker.EventNumber2, AddressOf EventNumber2Handler and in C# the worker class class Worker { public delegate void EventNumber1Handler(Dictionary<int, string> messages); public delegate void EventNumber2Handler(string message); public event EventNumber1Handler EventNumber1; public event EventNumber2Handler EventNumber2; public void CallEventNumber1() { Dictionary<int, string> dict = new Dictionary<int, string>(); dict.Add(1, "EventNumber1 First message"); dict.Add(2, "EventNumber1 Second message"); if (EventNumber1 != null) EventNumber1(dict); } public void CallEventNumber2() { if (EventNumber2 != null) EventNumber2("I am an EventNumber2 Message"); } } and wire that up with worker.EventNumber1 += new Worker.EventNumber1Handler(worker_EventNumber1); worker.EventNumber2 += new Worker.EventNumber2Handler(worker_EventNumber2); So I guess my question is do I always need to add the delegate along with the event in c#? Is there any new syntax for c# 3.0/4.0? Regards _Eric

    Read the article

  • show a particular div until content is loaded into another div from xml file in phonegap webservice

    - by Balu
    I am doing a webservice in phonegap.Here the application fetch values from a xml file in remote server when user search particular keyword and load the content to a div in my application.Here my problem is I want to show toast message like "loading..." or "progressing..." till the content is loaded into the div of application.I have created a toast message.But I dont know how to hide the toast message after the content is loaded since the time for fetching values from xml file is different for different keywords. The div to which content is loaded is <ul class="searchresults"></ul>.and my toast function is function toast(sMessage){ var container = $(document.createElement("div")); container.addClass("loading"); var message = $(document.createElement("div")); message.addClass("message"); message.text(sMessage); message.appendTo(container); container.appendTo(document.body); container.delay(150).fadeIn("slow", function() { if ($(".searchresults").html().length > 0) { //$(this).remove(); $(this).delay(500).fadeOut("slow", function() { $(this).remove(); }); } }); } Can anyone help me suggesting some ideas.Thanks in advance.

    Read the article

  • help configuring a mail server for use with mail.jar and activation.jar

    - by bobbyblue
    im trying to work with the below code: import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import javax.mail.*; import javax.mail.internet.*; // important import javax.mail.event.*; // important import java.net.*; import java.util.*; public class servletmail extends HttpServlet { public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException { PrintWriter out=response.getWriter(); response.setContentType("text/html"); try { Properties props=new Properties(); props.put("mail.smtp.host","localhost"); // 'localhost' for testing Session session1 = Session.getDefaultInstance(props,null); String s1 = request.getParameter("text1"); //sender (from) String s2 = request.getParameter("text2"); String s3 = request.getParameter("text3"); String s4 = request.getParameter("area1"); Message message =new MimeMessage(session1); message.setFrom(new InternetAddress(s1)); message.setRecipients (Message.RecipientType.TO,InternetAddress.parse(s2,false)); message.setSubject(s3); message.setText(s4); Transport.send(message); out.println("mail has been sent"); } catch(Exception ex) { System.out.println("ERROR....."+ex); } } } im using mail.jar and activation.jar but i cant understand how shouls i configure it with a mail server which mail server should i use will i be able to send an email using above what are the requirements a mail server? how should i configure it

    Read the article

  • sending specific data into a collection partial

    - by mikeglaz
    I have a User class with a has_many :messages and a Message class which belongs_to :user. In the Message controller's show action has the corresponding view: <% if @messages.any? %> <ol class="microposts"> <%= render partial: 'shared/message', collection: @messages %> </ol> <% end %> And the shared/_message.html.erb template looks like this: <li id="<%= message.id %>"> <span class="content"><%= message.body %></span> <% user_id = message.from %> <% user = User.find(user_id) %> From: <%= user.name %> </li> I feel like the following two lines should be done in the Messages controller from what I read in tutorials on Rails: <% user_id = message.from %> <% user = User.find(user_id) %> But how would I pass each message's corresponding from value (which stores user.id) into the partial? thanks, mike

    Read the article

< Previous Page | 85 86 87 88 89 90 91 92 93 94 95 96  | Next Page >