I have a number of scripts written in Python 2.6 that can be run arbitrarily. I would like to have a single central script that collects the output and displays it in a single log.
Ideally it would satisfy these requirements:
Every script sends its messages to the same "receiver" for display.
If the receiver is not running when the first script tries to send a message, it is started.
The receiver can also be launched and ended manually. (Though if ended, it will restart if another script tries to send a message.)
The scripts can be run in any order, even simultaneously.
Runs on Windows. Multiplatform is better, but at least it needs to work on Windows.
I've come across some hints:
os.pipe()
multiprocess
Occupying a port
mutex
From those pieces, I think I could cobble something together. Just wondering if there is an obviously 'right' way of doing this, or if I could learn from anyone's mistakes.
<form enctype="multipart/form-data" method="post" action="mailto:[email protected]" accept-charset="UTF-8">
Is there a problem if mails are sent this way .. i wanna avoid using PHP codes..
Actually I have some download link on my website something like "http://www.example.com/somesong.mp3". Now when user click on this link they get somesong.mp3 but I want to change it before they download. I found many scripts that made it possible but didn't get exact right script. Because I want that when the user clicks on download link the file downloading should be started just after the click with the new file name as I want to use.
But in all the scripts which I downloaded, first the php processing starts for a few minute (I think it depends on the file size) and then rename it. Is there a way to direct force the file in header with new file name.
Thanks.
Hi
I am looking to return a PDF from a webservice call. (ATM, a custom proxy is required at the client-side)
AFAICS, there are 2 ways of doing it
a) Return the link to a web-accessible location
b) Encode the PDF and include it in the XML
In my circumstance, a) will require 2 trips from the client, the first to get the path and the second to get the file.
However, wrt b), this link (http://www.coderanch.com/t/279020/Streams/java/wrting-bytearray-xml-file#1283263) suggests that it isn't a good idea to encode a PDF, though without explanation.
I'd be grateful if someone would offer recommendations of the above (and potentially, other alternatives).
Many thx
Simon
hi,
in my application i am using to send mail with attachments i write the code like this
Using System.Net.Mail;
MailMessage mail = new MailMessage();
mail.Body = "<html><body><b> Name Of The Job Seeker: " + txtName.Text + "<br><br>" + "The Mail ID:" + txtEmail.Text + "<br><br>" + " The Mobile Number: " + txtmobile.Text + "<br><br>" + "Position For Applied: " + txtPostionAppl.Text + "<br><br>" + "Description " + txtdescript.Text + "<br><br></b></body></html>";
mail.From = new MailAddress ( txtEmail.Text);
mail.To .Add (new MailAddress ( mailid));
mail.Priority = MailPriority.High;
FileUpload1.PostedFile.SaveAs("~/Resume/" + FileUpload1.FileName);
mail.Attachments.Add(filenme);
SmtpMail sm = new SmtpMail();
sm.Send(mail);
it is giving error at attachment like mail.Attachemts.Add(filena)
like this
'System.Collections.ObjectModel.Collection.Add(System.Net.Mail.Attachment)' has some invalid arguments.
I'm planning to release a new app in the future.
I have a custom logging function which logs some application data (not crashes) into a file (location manager state, app foreground-background transitions, main actions...). These logs helped me a lot to debug problems which were app-related, but not causing a crash. Until now these were in the documents directory (shared in iTunes) and the testers sent them to me after they saw some incorrect behaviors, however I don't want to share them anymore because this directory contains the app's database too.
I'd like to obtain these logs even when the app will be on App Store, but I don't know how this should be done. As I wrote, it is a new app and even after the test phase may exist minor bugs. I know that the users can report problems in iTunes or on the Dev site, but without a detailed scenario or log it is really hard to correct a bug. Should I make some kind of in-app bug report functionality (even if this creates a wrong user impression) ? How is this usually handled ?
Thanks
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
So on a PHP page (page 1) I have some HTML, including :
<form action="create_subject.php" method="post" >
Which goes to a processing page (page 2) containing MySQL which will be executed if there aren't any errors. If there are (checked by validation on the processing page (page 2)) or aren't, certain variables are set, including this one for if it's successful :
if (mysql_affected_rows() == 1){
$success = 1;
redirect_to("new_subject.php");
}
However, how would I include $success into the URL without putting it in as :
redirect_to("new_subject.php?success=1");
I can't do this as I need to do if statements, and it's only PHP on "page 2" so I can't do an if statement inside
redirect_to("new_subject.php");
I know I could do
...
} else {
redirect_to("new_subject.php?success=1");
}
But this would seem mundane and non-semantic especially as I have several variables to proccess.
I just wanted to develop one web application which allows users to send an SMS to any mobile free of charge . I searched on the net and found many codes and articles and through those articles i came to know that for that kind of application, i required either of the
following things:
Web service (Third party web services that are free but not working or not delivering the sms)
GSM Modem ( I don't have any idea about this)
SMS Gateway ( I don't have any idea about plz suggest me a idea
I want to send a tweet from Android.I have executed the following code.But I am not bale to send any tweets.Avtually the button I created is not working.Can anybody tel me wats the prob?
This is my code..
package samplecode.sampleapp.sampletwidgitpublicintent;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.os.Bundle;
public class TwidgitPublicIntent extends Activity implements OnClickListener {
private static final int TWIDGIT_REQUEST_CODE = 2564;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
((Button)findViewById(R.id.tweet_button)).setOnClickListener(this);
((Button)findViewById(R.id.mention_button)).setOnClickListener(this);
((Button)findViewById(R.id.retweet_button)).setOnClickListener(this);
((Button)findViewById(R.id.message_button)).setOnClickListener(this);
}
public void onClick(View v) {
switch(v.getId()) {
case R.id.tweet_button:
// Standard tweet
Intent tIntent = new Intent("com.disretrospect.twidgit.TWEET");
tIntent.putExtra("com.disretrospect.twidgit.extras.MESSAGE", "_message_in_here_");
try {
this.startActivityForResult(tIntent, TWIDGIT_REQUEST_CODE);
} catch (ActivityNotFoundException e) {
// If Twidgit is not installed
}
break;
case R.id.mention_button:
// Mention
Intent mIntent = new Intent("com.disretrospect.twidgit.MENTION");
mIntent.putExtra("com.disretrospect.twidgit.extras.TO", "_username_to_xmention_");
mIntent.putExtra("com.disretrospect.twidgit.extras.MESSAGE", "_message_in_here_");
try {
this.startActivityForResult(mIntent, TWIDGIT_REQUEST_CODE);
} catch (ActivityNotFoundException e) {
// If Twidgit is not installed
}
break;
case R.id.retweet_button:
// Retweet a tweet
Intent rtIntent = new Intent("com.disretrospect.twidgit.RETWEET");
rtIntent.putExtra("com.disretrospect.twidgit.extras.MESSAGE", "_message_in_here_");
rtIntent.putExtra("com.disretrospect.twidgit.extras.VIA", "_original_author_of_tweet_name_");
try {
this.startActivityForResult(rtIntent, TWIDGIT_REQUEST_CODE);
} catch (ActivityNotFoundException e) {
// If Twidgit is not installed
}
break;
case R.id.message_button:
// Send DM
Intent dmIntent = new Intent("com.disretrospect.twidgit.DIRECT_MESSAGE");
dmIntent.putExtra("com.disretrospect.twidgit.extras.TO", "_username_to_send_dm_to_");
dmIntent.putExtra("com.disretrospect.twidgit.extras.MESSAGE", "_message_in_here_");
try {
this.startActivityForResult(dmIntent, TWIDGIT_REQUEST_CODE);
} catch (ActivityNotFoundException e) {
// If Twidgit is not installed
}
break;
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// Check result code
if(resultCode == Activity.RESULT_OK) {
// Check requestCode
switch(requestCode) {
case TWIDGIT_REQUEST_CODE:
// Handle successful return
break;
}
} else if(resultCode == Activity.RESULT_CANCELED){
// Handle canceled activity
}
}
}
hi,
Using j2me i need to send a jpeg Image to a server using Socket Communication...can anyone send me a sample code for my application.
Thnks in Advance
Deva
I'm using the Acquia stack on my localhost (running Vista) and am trying unsuccessfully to send emails. I want to send them via Gmail, and have tried all sorts of settings in the php.ini file. There are no error messages, but no email is delivered. I've gotten no response on the Acquia forum, so I was hoping someone here might be able to help. Thanks very much.
I want to a Java ME application that transfers any SMS received to a PC using bluetooth. The PC can then direct the Java ME application via bluetooth to send a response SMS. Is there library available for this architecture or I have to design it myself?
Is this approach correct or a better one exists? I want to use bluetooth as then I will not have dependency on the cable.
var http = false;
// Creates xmlhttp object
if (navigator.appName == "Microsoft Internet Explorer") {
http = new ActiveXObject("Microsoft.XMLHTTP");
} else {
http = new XMLHttpRequest();
}
http.onreadystatechange = function() {
if (http.readyState == 4) {
alert(http.responseText);
}
}
// Functions to calculate optimum layout etc.
function compute() {
var statusSpan = document.getElementById("cwStatus");
document.getElementById("fader").style.display = "";
document.getElementById("computingWait").style.display = "";
statusSpan.innerHTML = "<b>Status:</b> Realigning sattelites"
http.open("GET", "alg.aspx?cr=8&cc=7&sq=3,3", true);
http.send(null);
}
This code sort of works, but the querystring data isn't being passed through. It keeps returning an ASPX error page which only happens when there is no querystring data.
Thanks for any help
Hi,
I'm taking shots in the dark here. I'd like to create a web service where eventually I send an SMS by using my own hardware. I'm not sure what I need in order to send an SMS myself. I don't want to use any of the existing SMS send services out there, I need to be able to send these SMS myself.
It looks like there's one opensource project in particular that deals with this, "Kannel":
http://www.kannel.org/
what I don't understand is, do I need to get a GSM modem to be able to send SMS? Do SMS gateways (like Kannel) eventually need to get to a GSM modem to send messages, or is there some other hardware you need to be able to actually send the messages?
Thanks
It takes around a couple of seconds for my app to execute the code to send an email right now on a test server with nothing much else running. Not sure if this is typical/expected. I'm also using the php framework Kohana's email helper and not php's mail directly out of convenience if that matters. Is it always just better to schedule a cron job to send emails every 5 min or so? Or should I be able to send emails immediately and I'm just not doing something right?
What the script does is insert a row into the db and notifies the relevant group that the row was created. The groups are usually < 20 people so I just do a loop calling Kohana's email helper each time for each member of the group.
In my framework, I make a number of calls to session_write_close().
Let's assume that a session has been initiated with a user agent. The following code...
foreach($i = 0; $i < 3; $i++) {
session_start();
session_write_close();
}
...will send the following request header to the browser:
Set-Cookie PHPSESSID=bv4d0n31vj2otb8mjtr59ln322; path=/
PHPSESSID=bv4d0n31vj2otb8mjtr59ln322; path=/
There should be no Set-Cookie header because, as I stipulated, the session cookie has already been created on the user's end. But every call to session_write_close() after the first one in the script above will result in PHP instructing the browser to set the current session again.
This is not breaking my app or anything, but it is annoying. Does anyone have any insight into preventing PHP from re-setting the cookie with each subsequent call to session_write_close?
EDIT
The problem seems to be that with every subsequent call to session_start(), PHP re-sets the session cookie to its own SID and sends a Set-Cookie response header. But why??
Here is my form:
<form id="register" enctype="multipart/form-data">
<input type="text" name="first_name" placeholder="First Name" id="first_name" />
<input type="text" name="last_name" placeholder="Last Name" id="last_name" />
<input type="text" name="input_email" placeholder="Confirm your email" id="input_email" class="loginEmail" />
<input type="password" name="input_password" placeholder="Password" id="input_password" class="loginPassword" />
<input type="password" name="repeat_password" placeholder="Repeat password" id="repeat_password" class="loginPassword" />
<input type="file" name="image_file" id="image_file" />
<div class="logControl">
<div class="memory"></div>
<input type="submit" name="submit" value="Register" class="buttonM bBlue" id="register_submit"/>
<div class="clear"></div>
</div>
<p><h3>Or click <a href="login.html">here</a> to login</h3></p>
</form>
Here is jquery call that I make:
function WCFJSON() {
$(".memory").html('<img src="images/elements/loaders/7s.gif" />');
Data = new FormData($('form')[0]);
$.ajax({
type: 'POST', //GET or POST or PUT or DELETE verb
url: "WCFService/Service.svc/Register", // Location of the service
data: Data, //Data sent to server
async:false,
cache:false,
contentType: false, // content type sent to server
dataType: DataType, //Expected data format from server
processdata: false, //True or False
success: function(msg) {//On Successfull service call
...
},
error: ...// When Service call fails
});
}
$(document).ready(function(){
$("#register").submit(function(){
$('#input_password').val(CryptoJS.MD5($('#input_password').val()));
$('#repeat_password').val(CryptoJS.MD5($('#repeat_password').val()));
WCFJSON();
return false;
});
});
Now when I submit the form , page refreshes with get elements in the url. But if I remove the file input from the form, jquery works fine.
I have a script that generates a csv file using the following code:
header('Content-type: text/csv');
header('Content-Disposition: attachment; filename="'.date("Ymdhis").'.csv"');
print $content;
The $content variable simply contains lines with fields separated by commas and then finalised with ."\n"; to generate a new line.
When I open the file in csv it looks fine however, when I try to use the file to import into an external program (MYOB) it does not recognise the End Of Line (\n) character and assumes one long line of text.
When I view the contents of the file in notepad, the end of line character (\n) is a small rectangle box which looks like the character code 0x7F.
If I open the file and re-save it in excel, it removes this character and replaces it with a proper end of line character and I can import the file.
What character do I need to be generating in PHP so that notepad recognises it as a valid End Of Line character? (\n) obviously doesn't do the job.
I need to send an email in asp.net but I need sender appears like "MySiteName" without [email protected] need to send an email in asp.net but I need sender appears like "MySiteName" without [email protected]
Hello Community,
I need to send data from an Air application, using a certificate.
This certificate is to be provided by the user through a USB Key.
I've got a lot of questions regarding this.
Is it possible to do what I'm looking for?
If yes, is it possible to do that only with the Flex/Air sdk or should I use Java or some other language to load the certificate?
Would anyone have a link where I can learn some more about this? I've been looking through the web, but haven't really found anything useful...
Thanks for any help you can provide.
Regards.
BS_C3
I am running Symfony 1.3.2 on Ubuntu. I need to write a batch script that can:
Access the database using the ORM
Send email(s)
IIRC, this was in a previous cookback, but I thing that was for an earlier version of Symfony (the API may have changed since).
Does anyone know how I may access the database via the ORM layer in a batch script and also how to send out email(s) in a batch script?