B4JSnippetRaspberry Pi
Raspberry PI - setup as WiFi Access Point and Client
Raspberry PI - setup as WiFi Access Point and Client
@Chris2 · 2020-07-07
B4JSnippetStrings
Measure Multiline Text Height
Measuring the length of multiline text is simple in B4A with StringUtils.MeasureMultilineTextHeight and in B4i by setting the width of a multiline Label and calling SizeToFit. There is no similar method available in B4J. One option is to add a label to an AnchorPane and wait for the layout to be set: https://www.b4x.com/android/forum/threads/measure-text.45750/#post-311358 Another option is to call a non-public API with the following code
@Erel · 2020-06-11
B4JSnippetTable/Grid
B4xTable Row Move
The order of the rows can be changed with the Up and Down buttons from the start to the end of the table rows/records
@rodmcm · 2020-06-03
B4JSnippetAudio/Video
What did you hear?
Train your language listening skills by checking out if you''ve correctly listened what was talked.
@Xandoca · 2020-06-01
B4JSnippetGPS/location/maps
Create KML file
Several have asked how to create a KML file (or KMZ if compressed) starting from a map generated with the GMap library.
@Star-Dust · 2020-05-26
B4JSnippetABMaterial [ABMATERIAL]
Avoid browser image cache [ABMaterial]
Avoid browser image cache [ABMaterial]
@Alexandre Riani · 2020-05-22
B4JSnippetCharts
Visual Segment Designer
Visual Segment Designer
@Mark Turney · 2020-05-18
B4JSnippetB4J
Download library from maven with all dependencies
Not a snippet as such but for those who build Java libraries the site below is useful as you can search for a library (on Maven) and download it with all depencies in a single zip file
@tchart · 2020-05-14
B4JSnippetCompression [GZIP]
jShell and 7-Zip to list contents and decompress gz [gzip] archive files
I use jShell and 7-Zip to unpack/decompress gz (gzip) files in a B4J UI app. 7-Zip supports also 7z, xz, lzma, cab, zip, bzip2 and tar formats.
@raphaelcno · 2020-05-10
B4JSnippetGPS/location/maps [WITH SOURCES]
Two geodesic features on a web page using B4J+Python [with sources]
I haven''t seen the available B4X libraries for geodetic conversion, and rewriting them is very complicated computationally. Since at work, I often uses the transformation between coordinate systems, i decided to make it easier for myself and my colleagues at work. I used ABMaterial and Python for this. ABMaterial is responsible for the web page, python is responsible for converting between coordinate systems. Additionally, the function of searching for the coordinates of the specified address is added. The site operates in Polish language and are included coordinate systems that are most often used in my country. Python scripts I wrote myself and work with b4x code. The python script is over shell with parameters.
@MichalK73 · 2020-05-05
B4JSnippetImages
simple carousel photo
simple carousel photo
@giannimaione · 2020-05-03
B4JSnippetComms & Network
DoSFilter Request Timeout
The DoSFilter helps with protection against denial of service attacks. It has various configuration options.
@Erel · 2020-04-27
B4JSnippetIcons / fonts
FontPicker
FontPicker
@Diego Roman · 2020-04-18
B4JSnippetTranslation/localisation
B4J Simple Code to create PHPLang files & Manage Translation with a Excel WorkBook
Sometimes it is very hard to have to maintain a translation of a website PHP. Erel has long published an impressive tool: B4XLocalizator that greatly facilitates the work of translation within the app with a Excel workbook. Well, I have made this simple code to help generate the files that allow us to maintain a website translated in several languages.
@scsjc · 2020-04-17
B4JSnippetDate/time
DateTime
Snip from my stock app to check if markets are open and if they are how many chunks of time are left in the day. The second snip is to get how many minutes the markets have been open based on how many days you put in and add the remaining minutes are left today if the markets are still open.
@icakinser · 2020-04-11
B4JSnippetCSS [JAVAFX]
Metro Style CSS [JavaFX]
Hello, I will show you how to install this Metro skin in your projects. It is a JavaFX css style that allows you to modify the controls, giving it a metro effect.
@Brian Michael · 2020-04-02
B4JSnippetImages
Mark and Count items on an image
I wanted to be able to count items in an image (birds in a flock). The simple logic said load an image, and then use the left mouse click to mark each item with a coloured blob. I then made it remove the last blob with a right mouse click
@Peter Meares · 2020-03-26
B4JSnippetOther
covid-19 with source
covid-19 with source
@giannimaione · 2020-03-24
B4JSnippetImages
Detect dominant colors of images
Detect dominant colors of images
@xulihang · 2020-03-03
B4JSnippetStrings
Strings with equal Length for alignment when printing to a text file for printing/viewing in B4J
Could not find code to add spaces to a string in an array so they all become the same length. This makes the print output line up the columns of strings.
@Elby dev · 2020-02-27
B4JSnippetB4J
Resumable Subs (wait for / sleep) in server handlers
Resumable subs can only work when there is a message queue. By default, server handlers end when the Handle sub is completed. They do not create a message loop. If you want to wait for an event then you need to call StartMessageLoop and later StopMessageLoop. Example of handler that downloads a page and returns it as the response.
@Erel · 2020-02-16
B4JSnippetAudio/Video
Audio Input device detector
I have been searching for the last 3 days for a quick code to get a list of Audio Input devices (Microphones) on the system and display it in a Combo-box. Finally, have managed to put together a small example to do this, using In-line Java.
@IndieDev · 2020-02-15
B4JSnippetDate/time
B4X - cHolidays - Determine when a certain holiday is
I came across some excel formula''s (https://www.tek-tips.com/faqs.cfm?fid=7549) for determining when a holiday was and on what day / date. Thought it was an interesting way of doing it so I converted the code to something I could use in B4A and B4J. Some of cHolidays that you can check for are not real holidays "Black Friday" for one.
@Robert Valentino · 2020-01-02
B4JSnippetViews - additional [B4J]
Hex View CustomView [B4J]
Hex dump customview. You can: - Explore any size file - Load one or more arrays of bytes - Search the data
@stevel05 · 2019-12-29
B4JSnippetB4J [POWERSHELL SCRIPT]
Tidy Up Unused Modules [PowerShell Script]
A PowerShell script you can use to tidy up you project folder. You can run it from PowerShell ISE. It compiles a list of modules referenced in the b4j file and then compares this to modules in the projects directory. It then deletes modules that are not referenced. I used this to tidy up a large project from which I had removed a bunch of modules that were no longer needed.
@tchart · 2019-12-08
B4JSnippetChoicebox
Choicebox set items
If you need to set the items in a choice box based on data or processes in your app it can be problematic to maintain the list when multiple changes occur, this can simplified by setting the items just before the choices are presented where you only have to create the items list once. To do this we can use the standard MousePressed callback which fires before the choices are shown. If you have more than one Choicebox, you can set the event names the same and handle them all in one sub, or do them separately if you prefer.​
@stevel05 · 2019-12-05
B4JSnippetMQTT
how to connect to a MQTT broker that requires a client certificate
Example of how to use a client certificate with the MQTT client
@madru · 2019-12-03
B4JSnippetXML
XMLFilesToAndroidX
XMLFilesToAndroidX is a tool for convert android xml layout files in a folder to androidx xml files.
@mshafiee110 · 2019-11-25
B4JSnippetComms & Network [VPS]
Servers in prod: Disable Port 22 when you don''t need it [VPS]
Servers in prod: Disable Port 22 when you don''t need it [VPS]
@KMatle · 2019-11-12
B4JSnippetSystem Tray
displayMessage & Tray App Icon
You can use displayMessage to show a task bar message
@tchart · 2019-11-06