Visualizzazione post con etichetta English Section. Mostra tutti i post
Visualizzazione post con etichetta English Section. Mostra tutti i post

sabato 18 maggio 2013

Android App: Pay Attention for privacy



Android is now, along with Apple's iOS, the mobile operating system most used in the world.

As you all know Android has a market of applications, Google Play, where you can download directly from the device most varied
app.

After the download of any app, when you start the installation phase, you are prompted for device from accepting certain permissions for various purposes.

Normally the user does not notice and accept them without even giving us a look.
There is nothing more wrong!
Considering that the permissions are often included items such as "send sms, read sms, precise location, access to the internet" and many others that, without a shadow of doubt, may affect our privacy.

Therefore, it is always a good idea to stop and read carefully the permissions that the app requires us before installation, and to assess whether the permissions the app may have a purpose is critical for the proper functioning of the same.

So I'll wait to find the "precise location" between the permissions an app Gps navigation rather than an app that implements a scientific calculator, or the "internet access" between the permissions the app is a social network rather than an app that allows me to change the theme to the device.

After taking a careful look at the permissions required, you decide whether to continue with the installation or close the app.

Follow these simple but useful advice, nor is half of your privacy.

In fact, many manufacturers include in their app creations systems to know such as the location of its users, their phone number, or even to control the device remotely, for a variety of purposes, such as the sale of information to advertising companies!

Android App accellerometer integration

Do you want to integrate the use of accelerometer in your Android app?Just follow these 2 simple steps:

    
Create an activity Accellerometro.java



import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.TextView;
public class Accellerometro extends Activity implements SensorEventListener {
private TextView Asse1;
private TextView Asse2;
private TextView Asse3;
private SensorManager sensorManager;
double ax,ay,az;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Asse1=(TextView) findViewById(R.id.asse1);
Asse2=(TextView) findViewById(R.id.asse2);
Asse3=(TextView) findViewById(R.id.asse3);
sensorManager=(SensorManager) getSystemService(SENSOR_SERVICE);
sensorManager.registerListener(this, sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_NORMAL);
}
public void onAccuracyChanged(Sensor arg0, int arg1) {
}
public void onSensorChanged(SensorEvent event) {
if (event.sensor.getType()==Sensor.TYPE_ACCELEROMETER){
ax=event.values[0];
ay=event.values[1];
az=event.values[2];
String assex=+ax+”";
String assey=+ay+”";
String assez=+az+”";
Asse1.setText(“Asse x=”+assex);
Asse2.setText(“Asse y=”+assey);
Asse3.setText(“Asse z=”+assez);
}
}
}
    Create a layout Accellerometro.xml

<RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android&#8221;
xmlns:tools=”http://schemas.android.com/tools&#8221;
android:layout_width=”match_parent”
android:layout_height=”match_parent”
tools:context=”.Accellerometro” >
<TextView
android:id=”@+id/asse1″
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_alignParentLeft=”true”
android:layout_alignParentTop=”true”
android:layout_marginLeft=”60dp”
android:layout_marginTop=”36dp”
android:text=”TextView” />
<TextView
android:id=”@+id/asse2″
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_alignLeft=”@+id/asse1″
android:layout_below=”@+id/asse1″
android:layout_marginTop=”26dp”
android:text=”TextView” />
<TextView
android:id=”@+id/asse3″
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_alignLeft=”@+id/asse2″
android:layout_below=”@+id/asse2″
android:layout_marginTop=”24dp”
android:text=”TextView” />
</RelativeLayout>


 


Once you start the activity you will see on the screen the values ​​of the 3 axes of the accellerometer!

Login with Facebook Php

Login with Facebook via PHP has never been so easy!The integration between Facebook and Php is often synonymous with Rogne and various problems.I will try to make you understand in the way more simple as possible how to achieve a page php which carries out the user's login on facebook and pulls out the credentials storing them into variables.
First of all download the SDK for PHP from here: https://github.com/facebook/facebook-php-sdk;Now create a file Accedi.php and copy the code below:
<?

//richiamo la facebook php sdk
require 'facebook-php-sdk-master/src/facebook.php';

//mi collego a facebook, sostituisco i parametri AppID e AppSecret con quelli della mia App
$app_id = 'xxxxxxxxxx';
$app_secret = 'xxxxxxxxx';
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
));

// Verifico se l'utente è connesso altrimenti lo collego
$user = $facebook->getUser();

//Controlla se l'utente è loggato su Facebook
if ($user) {
try {
   
// Cose da fare se l'utente è connesso
// Stampo informazioni dell'utente

$user_profile = $facebook->api('/me');

$first = $user_profile['first_name'];
echo "Benvenuto ";
echo $first;
echo " ";
$last = $user_profile['last_name'];
echo $last;
echo "<p>";

$FB_ID = $user_profile['id'];
echo "Il tuo Facebook ID e': ";
echo $FB_ID;
echo "<p>";

$FB_LINK = $user_profile['link'];
echo "Il tuo Facebook Link e': ";
echo $FB_LINK;
echo "<p>";

$compleanno = $user_profile['birthday'];
echo "Sei nato il: ";

$separatore="/";
$suddivisa=explode($separatore, $compleanno);
$mese=$suddivisa[0];
$giorno=$suddivisa[1];
$anno=$suddivisa[2];

echo $giorno;
echo"/";
echo $mese;
echo "/";
echo $anno;
echo "<p>";

$citta = $user_profile['location']['name'];

echo "Vivi a : ";
echo $citta;
echo "<p>";

$cittanatale = $user_profile['hometown']['name'];
if($cittanatale){
echo "Sei nato a : ";
echo $cittanatale;
echo "<p>";
}
$istruzione = $user_profile['education'][0]['school']['name'];
if($istruzione){
echo "Istruzione : ";
echo $istruzione;
echo "<p>";
}

$sesso = $user_profile['gender'];
echo "Sei: ";
if($sesso=="male"){
    $sesso="Maschio";
}
else if($sesso=="female"){
    $sesso="Femmina";
}
echo $sesso;
echo "<p>";

$lingua = $user_profile['locale'];
echo "Lingua: ";
$intermezzo="_";
$tokenlingua=explode($intermezzo, $lingua);
$lingua=$tokenlingua[1];
echo $lingua;
echo "<p>";

echo "<img src='http://graph.facebook.com/$FB_ID/picture'/>";

echo "<p>";

} catch (FacebookApiException $e) {
   
//se avviene qualche errore lo segnalo
error_log($e);
$user = null;
}
} else {
   
//se l'utente non è loggato faccio fare il login automatico
$params = array(
'scope' => 'user_birthday',
);
$loginUrl = $facebook->getLoginUrl($params);
echo("<script> top.location.href='" . $loginUrl . "'</script>");
}
?>

 
Replace the app id and app secret with those of your facebook app, copy the folder the SDK in the same directory where the file is located and you will Accedi.php concluded.When you open the page Accedi.php will ask you to log in with facebook and will print your personal data!

Getting Array of Facebook friends with Php

Are you trying to create an array containing Facebook friends and their information with php but it does not come out?
Here is the guide for you.
Download the SDK for PHP from here: https://github.com/facebook/facebook-php-sdk;
Create a file LettoreAmici.php and paste this into this:
<?
require 'facebook-php-sdk-master/src/facebook.php';
$ app_id = 'xxxxxxxxxxxxxx';
$ app_secret = 'xxxxxxxxxxxx';
$ facebook = new Facebook (array (
'AppId' => $ app_id,
'Secret' => $ app_secret,
));
$ user = $ facebook-> getUser ();
if ($ user) {
try {
$ user_profile = $ facebook-> api ('me / friends');
print_r ($ user_profile);
} Catch (FacebookApiException $ e) {
error_log ($ e);
$ user = null;
}
Else {}
$ params = array (
'Scope' => 'user_birthday',
);
$ loginUrl = $ facebook-> getLoginUrl ($ params);
echo ("<script> top.location.href = '". $ loginUrl. "' </ script>");
}
?>
Replace the lines $ app_id = 'xxxxxxxxxxxxxx', and $ app_secret = 'xxxxxxxxxxxx', with your app-secret and once started the page you will have the array with the information of your friends in the variable $ user_profile, which will also be printed in video from the command print_r.

Sending files via Socket Php

With php you can, just like with the java or c + + or any other language, implement tcp sockets for the exchange of data according to the client-server scheme.I show you how you can send a text file using a socket in php from a client to a server implementing only 2 files php: Server.php and Client.php.We start from the Server:

    
<? Php
    
set_time_limit (0);
    
if (($ sock = @ socket_create (AF_INET, SOCK_STREAM, SOL_TCP))) {
    
echo socket_strerror (socket_last_error ($ sock)); exit;
    
}
    
if ((@ socket_set_option ($ sock, SOL_SOCKET, SO_REUSEADDR, 1))) {echo socket_strerror (socket_last_error ($ sock));
    
exit;
    
}
    
if ((@ socket_bind ($ sock, '10 .0.1.4 ', 1048))) {/ / associate an ip of the machine and bring it to the socket
    
echo socket_strerror (socket_last_error ($ sock)); exit;
    
}
    
if ((@ socket_listen ($ sock))) {/ / put the listening socket
    
echo socket_strerror (socket_last_error ($ sock)); exit;
    
}
    
while (true) {
    
if (($ client = @ socket_accept ($ sock))) {/ / locking function: as long as it receives a request
    
echo socket_strerror (socket_last_error ($ sock));
    
exit;}
    
if ((@ socket_getpeername ($ client, $ addr))) {/ / we take the IP address of the client that is connected echo socket_strerror (socket_last_error ($ sock));
    
exit;
    
}
    
echo "Client connection from: $ addr \ n";
    
echo "Receiving file."
    
if (($ file = @ fopen ("." time ().. "txt", "w"))) {
    
echo "File open error. \ n"; exit;
    
}
    
if (($ rcv = @ socket_read ($ client, 1024, PHP_BINARY_READ))) {
    
echo socket_strerror (socket_last_error ($ sock));
    
exit;}
    
do {
    
if ((@ fwrite ($ file, $ rcv, 1024))) {
    
echo socket_strerror (socket_last_error ($ sock));
    
exit;}
    
if ((@ socket_write ($ client, "ok"))) {
    
echo socket_strerror (socket_last_error ($ sock));
    
exit;
    
}
    
if (($ rcv = @ socket_read ($ client, 1024, PHP_BINARY_READ))) {echo socket_strerror (socket_last_error ($ sock));
    
exit;
    
}
    
echo "."
    
} While ($ rcv! = "- @ END @ -");
    
echo "DONE \ n"; socket_close ($ client); break;
    
}
    
fclose ($ file);
    
socket_close ($ sock);
    
?>
And now the client:

    
<? Php
    
set_time_limit (0); / / Avoid that after a certain time the interpreter blocks php script as php.ini
    
if (($ file = @ fopen ("myfile.txt", "r"))) {
    
echo "File open error \ n."
    
exit;}
    
$ Server = array ('address' => 'Enter server ip', 'port' => 1048);
    
$ Sock = socket_create (AF_INET, SOCK_STREAM, SOL_TCP);
    
if (($ connection = @ socket_connect ($ sock, $ server ['address'], $ server ['port']))) {echo socket_strerror (socket_last_error ($ sock));
    
exit;
    
}
    
echo "Uploading files."
    
do {
    
if (feof ($ file)) {
    
echo "send complete \ n"; socket_write ($ sock, "- @ END @ -"); break;
    
}
    
if (($ pkt = @ fread ($ file, 1024))) {
    
echo socket_strerror (socket_last_error ($ sock));
    
exit;}
    
if ((@ socket_write ($ sock, $ pkt, 1024))) {
    
echo socket_strerror (socket_last_error ($ sock)); exit;
    
}
    
echo "."
    
if (($ rcv = @ socket_read ($ sock, 1024))) {
    
echo socket_strerror (socket_last_error ($ sock)); exit;
    
}
    
/ / Echo $ rcv. "\ N";
    
} While (true);
    
echo "DONE \ n";
    
fclose ($ file); socket_close ($ sock); echo "Exiting ... \ n";
    
?>
First start the server socket and then the client socket and you will see that the file "myfile.txt" will be sent from the client to the server!

Post on Facebook wall with PHP

Here is a simple PHP page that takes care to publish a post on facebook through php.

Download the Facebook SDK for PHP from here: https://github.com/facebook/facebook-php-sdk;

Insert the SDK folder on your server.

Create a page called PostFacebook.php and stick the following code:

<? php
require 'facebook-php-sdk-master/src/facebook.php';
$ app_id = 'Your App ID';
$ app_secret = 'Your App Secret';
$ facebook = new Facebook (array (
'appId' => $ app_id,
'secret' => $ app_secret,
));


$ user = $ facebook-> getUser ();


if ($ user == 0) {

$ login_url = $ facebook-> getLoginUrl ($ params = array ('scope' => "publish_stream"));

echo ("<script> top.location.href = '". $ login_url. "' </ script>");

} Else {$ token = $ facebook-> getAccessToken ();

   try {
         $ post = $ facebook-> api ("/ me / feed", "POST", array (

             'message' => "Message Body",
             'name' => "Post Title"
             'caption' => "Caption Zone"
             'description' => 'Description',
             'link' => "www.miosito.it"
             'picture' => "www.miosito.it / mypicture.png"
         ));
   }
    catch (FacebookApiException $ e) {
       $ result = $ e-> getResult ();
      }
   }
?>

Alter them voices "'message', 'name', 'caption', 'description', 'link', 'picture'" with the content you want to publish on the bulletin board and you're done, you can publish on Facebook wall using PHP!

Pdf file with php


Today I will explain how to create PDF on the fly with php!

First download the library from here http://www.fpdf.org/ FPDF.

Copied to the root directory of your server.

Create a file CreatorePdf.php and stick the following code:

require('fpdf/fpdf.php');
<?
//create a new object pdf
 $pdf=new FPDF();

 / / set the file properties
 $pdf->SetAuthor('Author');
 $pdf->SetTitle("Questo è il titolo del Pdf");

/ / set font for the entire document
 $pdf->SetFont('Helvetica','B',20);
 $pdf->SetTextColor(50,60,100);

//create the page
 $pdf->AddPage('P');
 $pdf->SetDisplayMode(real,'default');


  / / Create a title with an edge
 $pdf->SetXY(50,20);
 $pdf->SetDrawColor(50,60,100);
 $pdf->Cell(100,10,'Testo centrato',1,0,'C',0);

 
 $pdf->SetXY (10,50);
 $pdf->SetFontSize(10);
  $pdf->MultiCell(200,10,"Scrivete qui il corpo della pagina");

/ / Export the file
 $pdf->Output("MioFile.pdf",'I');
  ?>



As you can see nothing difficult!

Good Job!

venerdì 17 maggio 2013

How to find out who deleted you from Facebook friends

              Have you ever wondered if any of your friends you have deleted from Facebook?


                            Now you can find out what your friends have deleted from Facebook!

How?

The answer is simple:

Join Infamous Friends at www.thethings.it/index.php?ln=en;

Simply enter the site and click on "Login with Facebook"!

Then, whenever you have doubts that you have deleted some of your friends,


you can just go back on the site and you'll know who did it!


I enclose some Screenshot site: