Skip to content

Instantly share code, notes, and snippets.

Avatar

Ludovic FRIN ludovicfrin

View GitHub Profile
@ludovicfrin
ludovicfrin / ReadSmsActivity.java
Last active Feb 1, 2016
Lecture de la liste des SMS sous Android
View ReadSmsActivity.java
/**
* Activité de lecture des SMS
*
* @author Ludovic FRIN
*/
public class ReadSmsActivity extends AppCompatActivity implements LoaderManager.LoaderCallbacks<Cursor> {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ludovicfrin
ludovicfrin / SendSmsActivity.java
Last active Feb 1, 2016
Envoi d'un SMS sous Android
View SendSmsActivity.java
public class SendSmsActivity extends AppCompatActivity {
...
private void sendSms(String recipient, String message) {
try {
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(recipient, null, message, null, null);
} catch (Exceptione e) {
e.printStackTrace();
}
}
@ludovicfrin
ludovicfrin / web.xml
Last active Feb 1, 2016
web.xml Pour service RESTFul Jersey
View web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<display-name>Jersey REST</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
@ludovicfrin
ludovicfrin / pom.xml
Last active Feb 1, 2016
pom.xml Pour service RESTFul Jersey
View pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fr.frin</groupId>
<artifactId>jersey</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>jersey</name>
<description>Jersey REST</description>
<properties>
@ludovicfrin
ludovicfrin / Controller.java
Last active Feb 1, 2016
Contrôleur pour service RestFul Jersey
View Controller.java
package fr.frin.jersey;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import fr.frin.phonesync.webapp.entity.Sms;
@ludovicfrin
ludovicfrin / pom.xml
Created Feb 2, 2016
Fichier pom.xml pour réalisation d'un service RESTFul avec le framework Spring
View pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fr.frin</groupId>
<artifactId>spring</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>spring</name>
<description>Spring REST</description>
<properties>
View EntityController.java
package fr.frin.spring;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* Controleur
*
* @author Ludovic FRIN
*/
@ludovicfrin
ludovicfrin / web.xml
Last active Feb 2, 2016
Fichier web.xml pour projet RESTful avec le framework Spring
View web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<display-name>Spring REST</display-name>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
@ludovicfrin
ludovicfrin / spring-servlet.xml
Last active Feb 2, 2016
Fichier spring-serlvet.xml pour réalisation d'un service RESTful avec le framework Spring
View spring-servlet.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">
<context:component-scan base-package="fr.frin.spring" />
View lm35.ino
float temperature;
int reading;
int pin = 5;
void setup()
{
analogReference(INTERNAL);
Serial.begin(9600);
}
You can’t perform that action at this time.