Quiz per Android e Countries per Iphone sono due esempi:
Quiz per Android

Ora su sellmyapp.com
Sorgenti, linguaggi, best practice, suggerimenti, sul mondo della programmazione e non solo

public static void SendMailMessage(string mailSender, string obj, string msg,
string recipients, string smtpserver)
{
try {
MailMessage mailMessage = new MailMessage();
MailAddress sender = new MailAddress(mailSender);
foreach (string email in recipients.Split(",".ToCharArray()))
{
mailMessage.To.Add(email);
}
mailMessage.From = sender;
mailMessage.Subject = obj;
mailMessage.Body = msg;
SmtpClient server = new SmtpClient(smtpserver);
server.Send(mailMessage);
mailMessage.Dispose();
server = null;
}
catch (Exception e)
{
//some code here
}
}
try
{
using (ZipFile zip = new ZipFile())
{
zip.ParallelDeflateThreshold = -1;
zip.AddFile("c:\test1.doc", ""); //example file
zip.AddFile("c:\test2.txt", ""); //example file
//....other files
zip.Save("c:\dirzip\test_zip.zip"); //example dir and file
}
}
catch (ZipException e)
{
//some code here
}
StreamReader reader = new StreamReader(File.OpenRead("c:\test.txt"));
try
{
while (!reader.EndOfStream)
{
var line = reader.ReadLine();
}
}
catch (Exception ex)
{
//code here
}
finally
{
reader.Close();
}
//using System.Data.OracleClient;
private static void testConnectionDB()
{
OracleConnection conn = new OracleConnection(oraConn);
int intRecord = 0;
string str1="Florence";
string str2="Italy";
try
{
conn.Open();
OracleCommand cmd = conn.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select count(*) as numAuthors from Authors where field1 =:strField1 and field2 =:strField2";
cmd.Parameters.AddWithValue("strField1", str1);
cmd.Parameters.AddWithValue("strField2", str2);
intRecord = Convert.ToInt32(cmd.ExecuteScalar());
}
catch (Exception ex)
{
log.Error(ex.Message);
}
finally
{
cmd.Dispose();
if (conn.State != ConnectionState.Closed)
{
conn.Close();
}
}
$pdo = Database::connect();
$idArticle=$_POST["idart"];
$query = "SELECT Image FROM Table WHERE Id=?";
try{
$pdo_statement = $pdo->prepare($query);
$pdo_statement->bindParam(1,$idArticle );
$pdo_statement->execute();
$num = $pdo_statement->rowCount();
if ($num) {
$row = $pdo_statement->fetch(PDO::FETCH_ASSOC);
if($row['Image']!=null){
$image = imagecreatefromstring($row['Image']);
$w = imagesx($image);
$h = imagesy($image);
//resize image
$ratio=0.5;
$larg = $w/$ratio;
$alt = $h/$ratio;
$image = imagescale($image, $larg, $alt);
ob_start();
//rotate image
$transp = imagecolorallocatealpha($image,0,0,0,127 );
$image = imagerotate($image, 90, $transp, 1);
imagejpeg($image);
$contents = ob_get_contents();
ob_end_clean();
imagedestroy($image);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "UPDATE Table set Image=? WHERE Id=?";
$pdo = $pdo->prepare($sql);
$pdo->bindParam(1, $contents, PDO::PARAM_LOB);
$pdo->bindParam(2, $idArticle);
$pdo->execute();
echo " img src='data:image/jpeg;base64,".base64_encode($contents)."' / ";
}
}else{
return null;
}
}catch(PDOException $e)
{
echo $e->getMessage();
}
Database::disconnect();
public class ServiceExample : System.Web.Services.WebService
{
private delegate string AsyncMethodCallerCreateZip(string idArticle, out string outResult);
[WebMethod(Description = "An example")]
public string FirstElaboration(string idArticle)
{
try
{
//Async call
AsyncMethodCallerCreateZip caller = new AsyncMethodCallerCreateZip(CreateZip);
IAsyncResult result = caller.BeginInvoke(idArticle, out outResult, null, null);
//wait response
//result.AsyncWaitHandle.WaitOne();
//string returnValue = caller.EndInvoke(out outResult, result);
//result.AsyncWaitHandle.Close();
//return returnValue;
return "OK";
}
catch (Exception ex)
{
return "KO";
}
}
public string CreateZip(string idArticle, out string outResp)
{
//code here
return outResp;
}
}