Skip to content

Instantly share code, notes, and snippets.

View jsfan3's full-sized avatar
💡
I make mobile apps using Codename One + Spring Boot

Francesco Galgani jsfan3

💡
I make mobile apps using Codename One + Spring Boot
View GitHub Profile
spring.datasource.url=jdbc:mysql://localhost/nomeDB
spring.datasource.username=root
spring.datasource.password=miaPassword
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.jpa.hibernate.ddl-auto=update
spring.jpa.generate-ddl=true
spring.datasource.tomcat.connection-properties=useUnicode=true
server.port=8080
Android and iOS videos
@jsfan3
jsfan3 / AppSettingsUtilitiesImpl.java
Created January 2, 2019 23:47
Codename One Android Native Interface to access the app settings
package net.informaticalibera.cn1.simpleapi;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.provider.Settings;
public class AppSettingsUtilitiesImpl {
private static Context context() {
@jsfan3
jsfan3 / RunnableWithArg.java
Created May 8, 2019 12:59
Java Runnable With Arg
public interface RunnableWithArg<T> {
/**
* Similar to the runnable interface but it accepts an argument
*
* @param arg any type of argument
*/
public void run(T arg);
}
@jsfan3
jsfan3 / AppApplication.java
Created June 3, 2019 06:58
Cloudinary in Spring Boot - Three files: the main AppApplication, the Controller and the Service, by Francesco Galgani, www.informatica-libera.net
package yourpackage.app;
import com.cloudinary.Cloudinary;
import com.cloudinary.SingletonManager;
import com.cloudinary.utils.ObjectUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@jsfan3
jsfan3 / mybackup.sh
Created January 25, 2020 13:29
Script di backup per GNU/Linux, basato su Bash e Rsync. Maggiori informazioni: https://www.informatica-libera.net/content/mybackup-gnulinux-backup-utility-based-rsync-francesco-galgani
#!/bin/bash
#################################################################################
################### MyBACKUP SCRIPT ####################
#################################################################################
# License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
# This is free software: you are free to change and redistribute it.
# There is NO WARRANTY, to the extent permitted by law.
# Autori: Francesco Galgani
@jsfan3
jsfan3 / MyApplication.java
Created February 15, 2020 13:07
SpanMultiButton test case
Form hi = new Form("Test SpanMultiButton", BoxLayout.y());
Image icon = FontImage.createMaterial(FontImage.MATERIAL_WARNING, "Button", 3.0f);
Image emblem = FontImage.createMaterial(FontImage.MATERIAL_ARROW_FORWARD, "Button", 3.0f);
SpanMultiButton twoLinesNoIcon = new SpanMultiButton("SpanMultiButton");
twoLinesNoIcon.setTextLine2("Line 2 long - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
SpanMultiButton oneLineIconEmblem = new SpanMultiButton("Icon + Emblem");
oneLineIconEmblem.setIcon(icon);
oneLineIconEmblem.setEmblem(emblem);
@jsfan3
jsfan3 / CaptureAndPlaybackAudioSample
Last active August 13, 2021 14:44
Demonstrates capturing of audio files and their playback using the Codename One APIs Media, MediaManager and MediaRecorderBuilder
private static final EasyThread countTime = EasyThread.start("countTime");
public void start() {
if (current != null) {
current.show();
return;
}
Form hi = new Form("Recording audio", BoxLayout.y());
hi.add(new SpanLabel("Example of recording and playback audio using the Media, MediaManager and MediaRecorderBuilder APIs"));
hi.add(recordAudio((String filePath) -> {
@jsfan3
jsfan3 / MyApplication.java
Last active May 4, 2020 15:02
Codename One fast image scaling algorithm to generate thumbnails from captured photos. This optimization makes sense on Android and Simulator (Java SE) only. See: https://github.com/codenameone/CodenameOne/issues/3090
package net.informaticalibera.test.imagescaling;
import com.codename1.capture.Capture;
import com.codename1.components.SpanLabel;
import com.codename1.io.FileSystemStorage;
import static com.codename1.ui.CN.*;
import com.codename1.ui.Form;
import com.codename1.ui.Dialog;
import com.codename1.ui.Label;
import com.codename1.ui.plaf.UIManager;
@jsfan3
jsfan3 / CodeExample.java
Last active May 7, 2020 09:48
Codename One Image.exifRotation usage example
Form hi = new Form("Hi World", BoxLayout.y());
Button cameraBtn = new Button("Open Camera");
Button galleryBtn = new Button("Open Gallery");
Label imageLbl = new Label();
hi.addAll(cameraBtn, galleryBtn, FlowLayout.encloseCenter(imageLbl));
hi.show();
SuccessCallback<String> callback = (String capturedPhoto) -> {
String rotatedPhoto = FileSystemStorage.getInstance().getAppHomePath() + "rotatedPhoto.jpg";
if (capturedPhoto != null) {