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 / 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 / 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) {
@jsfan3
jsfan3 / sendCode.sh
Created May 9, 2020 11:51
Modify, compile and upload the local Netbeans Spring Boot project to the destination testing VPS, installing it as a Linux service
#!/bin/bash
# REMEMBER TO REPLACE THE FOLLOWING VALUES
YOUR_TESTING_SERVER="mydomain.net"
SERVERCODE_DIR="MyServer"
SERVERCODE_DIR_PATH="/home/francesco/NetBeansProjects/"
JAR="MyServer-1.0.0-SNAPSHOT.jar"
SERVERCODE_FULLPATH=$SERVERCODE_DIR_PATH$SERVERCODE_DIR
echo "Server code full path: $SERVERCODE_FULLPATH"
@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 / MyApplication.java
Last active June 2, 2020 22:53
Codename One Util.downloadUrlSafely example
import com.codename1.components.SpanLabel;
import com.codename1.components.ToastBar;
import static com.codename1.ui.CN.*;
import com.codename1.ui.Display;
import com.codename1.ui.Form;
import com.codename1.ui.Dialog;
import com.codename1.ui.Label;
import com.codename1.ui.plaf.UIManager;
import com.codename1.ui.util.Resources;
import com.codename1.io.Log;
@jsfan3
jsfan3 / Example.java
Created June 27, 2020 14:43
UIID Generation Example
Form hi = new Form("Test UIID", BoxLayout.y());
Button button = new Button("Generate 10 UIID");
hi.add(button);
hi.show();
button.addActionListener(l -> {
String myId = "myUsername"; // do not exceed 12 characters
Preferences.set("CustomDeviceId__$", Long.parseLong(myId, 36));
hi.add(new SpanLabel("10 Random UUID"));
for (int i = 0; i < 10; i++) {
hi.add(new SpanLabel(Util.getUIID()));