send

Android, How to send HTML email and force Android to send it through G-Mail not other applications?

别来无恙 提交于 2019-11-28 21:23:36
I want to send email through my application. I need to send HTML based email just through G-Mail. I found following solutions that each of them has pros and cons. 1) Using Intent (Intent.ACTION_SEND). This is very simple way and I can see my body in HTML format but the problem is when I click on "Send email" button, so many applications like Facebook and Google+ pop up which are useless and I shouldn't show it in that list. This is its code: String html = "<!DOCTYPE html><html><body><a href=\"http://www.w3schools.com\" target=\"_blank\">Visit W3Schools.com!</a>" + "<p>If you set the target

Linux Socket: How to detect disconnected network in a client program?

与世无争的帅哥 提交于 2019-11-28 20:37:02
问题 I am debugging a c based linux socket program. As all the examples available in websites, I applied the following structure: sockfd= socket(AF_INET, SOCK_STREAM, 0); connect(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)); send_bytes = send(sockfd, sock_buff, (size_t)buff_bytes, MSG_DONTWAIT); I can detect the disconnection when the remove server closes its server program. But if I unplug the ethernet cable, the send function still return positive values rather than -1. How can I

How sendmsg works?

余生颓废 提交于 2019-11-28 16:35:31
As you know sendmsg has this declaration: int sendmsg(int s, const struct msghdr *msg, int flags); and msghdr structure has this form: struct msghdr { void * msg_name; /* optional address */ socklen_t msg_namelen; /* size of address */ struct iovec * msg_iov; /* scatter/gather array */ size_t msg_iovlen; /* # elements in msg_iov */ void * msg_control; /* ancillary data, see below */ socklen_t msg_controllen; /* ancillary data buffer len */ int msg_flags; /* flags on received message */ }; As you see msghdr has an array of buffer, iovec and has buffer count msg_iovlen. What I wonder is that how

Sending data via AJAX

孤人 提交于 2019-11-28 12:51:54
i have a build a javascript which does following: Get content via ajax->php->sql and show it on index.php after clicking the content there will be shown new content. Now I want to have a function which sends data after content is clicked to a php which will do something in in the db. How can i create a function which will send data? Thank you! This is my code which shows content: <script id="source" language="javascript" type="text/javascript"> function laden(){ $(function() { $.ajax({ `usr_id` url: 'content/get.php', dataType: 'json', success: function(data) { var id = data[0]; var name =

Send binary file in HTTP response using C sockets

一曲冷凌霜 提交于 2019-11-28 10:17:10
I`m trying to send a binary file (png image) in http response. FILE *file; char *buffer; int fileLen; //Open file file = fopen("1.png", "rb"); if (!file) { return; } //Get file length fseek(file, 0, SEEK_END); fileLen=ftell(file); fseek(file, 0, SEEK_SET); //Allocate memory buffer=(char *)malloc(fileLen+1); if (!buffer) { fprintf(stderr, "Memory error!"); fclose(file); return; } //Read file contents into buffer fread(buffer, fileLen, 1, file); fclose(file); //free(buffer); char header[102400]; sprintf(header, "HTTP/1.1 200 OK\n" "Date: Thu, 19 Feb 2009 12:27:04 GMT\n" "Server: Apache/2.2.3\n"

How to send data from fragment to fragment within same fragment activity?

六月ゝ 毕业季﹏ 提交于 2019-11-28 10:10:29
问题 I have a container in which there are two fragments my 1st fragment is working good now I want to send it to 2nd fragment. This is my 1st Fragment private class LoadLink extends AsyncTask<String, Void, String[]> { @Override protected String[] doInBackground(String... params) { Document document = null; try { document = Jsoup.connect(params[0].toString()).timeout(10 * 1000).userAgent("Mozilla").get(); download = document.getElementsByClass("actions").first().select("a").attr("href").toString()

How can I send an SMS from Java? [closed]

最后都变了- 提交于 2019-11-28 10:02:25
I wanted to send SMS to particular mobile from a Web application and receive his reply and view to a web application only. Is it possible to create using Java technology? Few URLS to go through, http://opensmpp.logica.com/ http://smslib.org/ I recommend SMSLIB The best way to achieve this is to use an SMS gateway. An SMS gateway encapsulates the technicalities of interfacing with SMS carrier medium on one hand and on other hand it provides an interface for application level protocols like http, SMTP, ftp etc. to interact with it. For example, you can have a web application talking to the SMS

Intent.ACTION_SEND Whatsapp

痴心易碎 提交于 2019-11-28 08:18:56
问题 Im trying to share a mp3 file through whatsapp. It works perfectly with other apps like gmail, but it dosent works on whatsapp. Can anyone help me? Do I need to add some putExtra()? Here's my code: public void shareWithFriends(int id) { Intent share = new Intent(Intent.ACTION_SEND); share.setType("audio/mp3"); //share.putExtra(Intent.EXTRA_SUBJECT,"subject"); //Uri uri = Uri.parse("android.resource://com.igs.pokemonsoundboard/" + id); Uri uri = Uri.parse("android.resource://com.igs

Send email with python

半世苍凉 提交于 2019-11-28 05:02:41
问题 I am trying to create a simple python script which sends an email. I used this following code: import subprocess params = {'from': 'from@example.com', 'to': 'to@example.com', 'subject': 'Message subject'} message = '''From: %(from)s To: %(to)s Subject: %(subject)s Message body ''' % params sendmail = subprocess.Popen(['/usr/share/sendmail', params['to']]) sendmail.communicate(message) But i recive the following error message when i try to run it: Traceback (most recent call last): File "/home

Sending picture in Android (Socket Programming)

▼魔方 西西 提交于 2019-11-28 02:26:43
I'm trying to Receive Picture on my Android phone From Server using socket programming. I use this code but in.read() in fourth line always return -1 how can i fix this problem? Client Code: try { x = new byte[picLength2]; int current = 0; int byteRead = in.read(x, 0, x.length); current = byteRead; do { byteRead = in.read(x, current, (x.length - current)); if (byteRead >0) { current += byteRead; } } while (byteRead > -1); }catch (IOException e){ e.printStackTrace(); } Server Code: try { File myFile = new File("C:/onlinegame/null.jpg"); mybytearray = new byte [(int)myFile.length()];