<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Vinicius Strugata Ambrosio on Medium]]></title>
        <description><![CDATA[Stories by Vinicius Strugata Ambrosio on Medium]]></description>
        <link>https://medium.com/@vstram?source=rss-29a6ebd5b2d5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*TgTlbADJJa-0_lfM.jpg</url>
            <title>Stories by Vinicius Strugata Ambrosio on Medium</title>
            <link>https://medium.com/@vstram?source=rss-29a6ebd5b2d5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 20:51:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vstram/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Tweak to Reduce the Size of APK]]></title>
            <link>https://vstram.medium.com/tweak-to-reduce-the-size-of-apk-c46f9c488af4?source=rss-29a6ebd5b2d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/c46f9c488af4</guid>
            <category><![CDATA[mendix-studio-pro]]></category>
            <category><![CDATA[mendix]]></category>
            <category><![CDATA[apk]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Vinicius Strugata Ambrosio]]></dc:creator>
            <pubDate>Sat, 26 Apr 2025 22:58:41 GMT</pubDate>
            <atom:updated>2025-04-27T14:06:16.387Z</atom:updated>
            <content:encoded><![CDATA[<p>A few days ago, I started a new <a href="https://marketplace.mendix.com/link/component/109511"><strong>Blank Native Mobile App</strong></a> project using <a href="https://www.mendix.com/"><strong>Mendix</strong></a><strong> </strong><a href="https://marketplace.mendix.com/link/studiopro"><strong>Studio Pro</strong></a> and immediately generated an APK to test a new automated script to build APKs/AABs/IPAs I’m working on. To my surprise, the generated APK was more than double its usual file size. This procedure presents a way to fix this issue.</p><figure><img alt="ChatGPT prompt: “Create an image of a mobile application being compressed by a mechanical device.”" src="https://cdn-images-1.medium.com/max/1024/1*_-caNGoCLzIJqyz4NGC6pA.png" /><figcaption>ChatGPT prompt: “Create an image of a mobile application being compressed by a mechanical device.” This image is weird, huh!?</figcaption></figure><h3>The issue</h3><p>In the image below, we can see the file size of the <strong>APK Debug</strong> built from the <strong>Mendix-generated React Native</strong> project files. It has <strong>185MB</strong>, more than twice the usual size I was used to remembering!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/955/1*I7q-hr4RwTHqhhkLEU1ZPA.png" /><figcaption>The APK Size file size increased 🤔!</figcaption></figure><p>Is this really an issue? Well, if you intend to generate nightly build APKs from your project in order to perform automated tests, and you need to store the APKs generated. The smaller the file size, the better.</p><p><em>For distribution in the app stores</em>, the <strong>Google Play Store</strong> requires the <strong>AAB (Android App Bundle)</strong> type format. <strong>AABs</strong> allow <strong>Google Play</strong> to deliver only the necessary components for a specific device, resulting in smaller downloads, faster installations, and less storage space used. So the <strong>AAB</strong> file size isn’t a concern here.</p><h3>The Rationale</h3><p>Looking for more info, I’ve found these references:</p><ul><li>Android Gradle Plugin 3.6.0: <a href="https://developer.android.com/build/releases/past-releases/agp-3-6-0-release-notes#extractNativeLibs">Native libraries packaged uncompressed by default</a>:</li></ul><blockquote>When you build your app, the plugin now sets extractNativeLibs to &quot;false&quot; by default. That is, your native libraries are page aligned and packaged uncompressed. While this results in a larger upload size, your users benefit from the following:</blockquote><blockquote>• Smaller app install size because the platform can access the native libraries directly from the installed APK, without creating a copy of the libraries.</blockquote><blockquote>• Smaller download size because Play Store compression is typically better when you include uncompressed native libraries in your APK or Android App Bundle.</blockquote><ul><li>The text above mentions the property <em>extractNativeLibs</em> . The <a href="https://developer.android.com/guide/topics/manifest/application-element">Android Documentation</a> says:</li></ul><blockquote>This attribute indicates whether the package installer extracts native libraries from the APK to the file system. If set to &quot;false&quot;, your native libraries are stored uncompressed in the APK. Although your APK might be larger, your application loads faster because the libraries load directly from the APK at runtime.</blockquote><blockquote>The default value of extractNativeLibs depends on minSdkVersion and the version of AGP you&#39;re using. In most cases, the default behavior is probably what you want, and you don&#39;t have to set this attribute explicitly</blockquote><ul><li>Android Gradle Plugin 4.2.0: <a href="https://developer.android.com/build/releases/past-releases/agp-4-2-0-release-notes#compress-native-libs-dsl">Use the DSL to package compressed native libraries</a>:</li></ul><blockquote>We recommend packaging native libraries in uncompressed form, because this results in a smaller app install size, smaller app download size, and faster app loading time for your users. However, if you want the Android Gradle plugin to package compressed native libraries when building your app, set <a href="https://developer.android.com/reference/tools/gradle-api/7.1/com/android/build/api/dsl/JniLibsPackagingOptions#uselegacypackaging">useLegacyPackaging</a> to true in your app&#39;s build.gradle file.</blockquote><p>This is something weird, since the AGP 3.6.0 and AGP 4.2.0 are both very old, and we should have identified this increase in the file size a long time ago.</p><p>Consulting the <strong>Mendix Support</strong>:</p><blockquote>The reason for the increased apk file size is due to the updated the minSdkVersion from Native Template v7.0.20 onwards<strong>.</strong><br> <br>Native Template v7.0.17 contains minSdkVersion = 21 while v7.0.25 contains minSdkVersion = 23. From minSdkVersion 23, the APK includes libraries for all ABIs which leads to this significant increase.<br>So this is expected.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*oXSoRB8LH6f15i2C6rFbWw.png" /><figcaption>The <a href="https://github.com/mendix/native-template/compare/v7.0.17...v7.0.25#diff-197b190e4a3512994d2cebed8aff5479ff88e136b8cc7a4b148ec9c3945bd65a">Diff file</a> showing the increase in the minSdkVersion</figcaption></figure><p>This makes sense! Recently, <strong>Mendix R&amp;D</strong> increased the minSdkVersion from 21 to 23, and as a consequence, we have the APK file size increase as a collateral effect.</p><p>Looking further, this post in the <a href="https://issuetracker.google.com/issues/127691661?pli=1">Google IssueTracker</a>:</p><blockquote>Starting with M, the platform can read the so files directly inside the APK without extracting them, saving storage space.</blockquote><blockquote>Right now we compress if the manifest attribute extractNativeLibs is true or not present. If the attribute is not present and minSdkVersion is M+, then we should not compress.</blockquote><p>If you don’t remember, <strong>Android API Level 23</strong> is the <strong>Android Marshmallow (Android M)</strong>.</p><h3>The Solution</h3><p>If you prefer to keep the previous behaviour, that is, keep the <strong>Native Libs</strong> compressed, the fix is very easy:</p><ul><li>[1] Open your app levelbuild.gradle file.</li><li>[2] Add the following inside the android scope:</li></ul><pre>android {<br>    //...<br>    packagingOptions {<br>        jniLibs {<br>            useLegacyPackaging true<br>        }<br>    }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*rAGbsrQYA4DdNVNL2hvpaw.png" /><figcaption>Changing the Native Libs Packing Options in Gradle</figcaption></figure><ul><li>[3] Rebuild your APK</li></ul><pre>.\gradlew.bat assembleAppstoreDebug --stacktrace</pre><ul><li>[4] Check the results. Now the APK file size is <strong>71MB</strong>!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*jebIRh8W8KZwfZlhEqx_Yg.png" /><figcaption>After the fix, the APK file size now seems “normal”</figcaption></figure><h3>Comments and Conclusion</h3><ul><li>As you could see, the fix to reduce the APK file size is easy, just define useLegacyPackaging true in the android/packagingOptions/jniLibs section of build.gradle.</li><li>Observe that, if you proceed with this fix, your app will become smaller in file size but slower in loading time. This is something I plan to investigate in a future article.</li><li>This fix is not relevant if you intend to generate the AAB and publish your app in the <strong>Google Play Store</strong>.</li><li>Worth mentioning that while the <strong>APK Release has ~42MB</strong>, even with this fix, the <strong>IPA file size (to be used in iOS devices)</strong> is <strong>~ 9MB</strong> 🤯!!</li><li>I hate to say it, but in a way I love bugs, as I learn a lot from them in the challenge of finding a solution!</li></ul><p>If you find an error or have a suggestion, please let me know in the comments!😉</p><h3>References</h3><ul><li><a href="https://developer.android.com/build/releases/past-releases/agp-4-2-0-release-notes#compress-native-libs-dsl">Android Studio | Android Developers</a></li><li><a href="https://developer.android.com/guide/topics/manifest/application-element#extractNativeLibs">| App architecture | Android Developers</a></li><li><a href="https://github.com/facebook/react-native/issues/44291">I compare 0.72.5 and 0.74.0 react native android app size,0.74.0 is 50MB,And 0.72.5 is 21.7 MB.How to reduce 0.74.0 android app size? · Issue #44291 · facebook/react-native</a></li><li><a href="https://developer.android.com/build/releases/past-releases/agp-3-6-0-release-notes#extractNativeLibs">Android Studio | Android Developers</a></li><li><a href="https://issuetracker.google.com/issues/127691661?pli=1">Google Issue Tracker</a></li><li><a href="https://stackoverflow.com/questions/42998083/setting-androidextractnativelibs-false-to-reduce-app-size/">Setting android:extractNativeLibs=false to reduce app size</a></li><li><a href="https://stackoverflow.com/questions/62440105/apk-size-increased-35mb-when-bumping-min-sdk-from-21-to-24">APK size increased 35mb when bumping min SDK from 21 to 24</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c46f9c488af4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Procedure to Monitor Mendix Runtime]]></title>
            <link>https://vstram.medium.com/procedure-to-monitor-mendix-runtime-4b4424099ed0?source=rss-29a6ebd5b2d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b4424099ed0</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[monitoring]]></category>
            <category><![CDATA[low-code]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[mendix]]></category>
            <dc:creator><![CDATA[Vinicius Strugata Ambrosio]]></dc:creator>
            <pubDate>Mon, 21 Apr 2025 12:45:17 GMT</pubDate>
            <atom:updated>2025-04-21T12:47:58.849Z</atom:updated>
            <content:encoded><![CDATA[<p>This article describes the procedure for extracting information about the Mendix runtime. This information can be useful when debugging or monitoring your Mendix Web Application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*USymBVaAslD8W7xmVjZpHw.png" /></figure><h3>Environment</h3><ul><li>Studio Pro 10.18.4, running locally a Mendix application (can be anyone)</li><li>Windows 11 Pro</li><li>Python 3.12.9</li></ul><h3>Procedure</h3><ul><li>[ 1 ] The first step is to start your <strong>Mendix</strong> application in <strong>Studio Pro</strong>. Hit <strong>F5</strong> or choose the menu <strong>Run → Run Locally</strong>.</li><li>[ 2] After that, we need to get the <strong>M2EE password</strong> to be able to access the service that provides the runtime information. That password is not the Admin password but instead a password automatically set by <strong>Studio Pro</strong> when the application is running. But how exactly can we get such a password?</li><li>[ 3 ] We have two options: using a tool called <strong>Process Explorer</strong> or using a <strong>Python Script</strong>.</li><li>[ 4 ] <strong>Process Explorer</strong> is part of a tool set called <strong>SysInternals Suite</strong>. You can install via:</li><li>[ 4a ] <strong>Microsoft Store</strong>: <a href="https://www.microsoft.com/store/apps/9p7knl5rwt25">https://www.microsoft.com/store/apps/9p7knl5rwt25</a></li><li>[ 4b ] Zip package: <a href="https://download.sysinternals.com/files/SysinternalsSuite.zip">https://download.sysinternals.com/files/SysinternalsSuite.zip</a></li><li>[ 4c ] Winget: winget install -e — id Microsoft.Sysinternals</li><li>[ 4d ] The <strong>Sysinternals Suite</strong> utility apps are very useful. You can learn more about it by following the <a href="https://learn.microsoft.com/en-us/sysinternals/downloads/sysinternals-suite">Official Documentation</a>. Once the installation is finished, run <strong>Process Explorer</strong> and search for a process called <strong>javaw</strong>:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/929/1*feaK1rE-942WEtlJClzcMg.png" /><figcaption>Process Explorer showing the javaw process ID</figcaption></figure><ul><li>[ 4e ] Right-click on the <strong>javaw.exe </strong>process and select <strong>Properties…</strong> Then, select the <strong>Environment</strong> tab:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*j9712T2E4azzQfmP3QeRnA.png" /><figcaption>The Environments associated with the javaw process</figcaption></figure><ul><li>[ 4f ] Search for a variable called <strong>M2EE_ADMIN_PASS</strong>. Take note of its value (Ctrl+C): 3c713cf1–0721–4ecb-b929-ebe5782039c3</li><li>[ 5a ] Now let’s do the same task, this time using a <strong>Python Script</strong>. Firstly, we need to install a package called <strong>psutil</strong> (see the <a href="https://psutil.readthedocs.io/en/latest/index.html#id1">psutil documentation</a>)</li></ul><pre>pip install psutil</pre><ul><li>[ 5b ] If you don’t have <strong>pip</strong> (Python Installation Package) utility installed, run the command below and then try the step [ 5a ] again:</li></ul><pre>curl -s https://bootstrap.pypa.io/get-pip.py | python</pre><ul><li>[ 5c ] Now we have to discover the PID (Process ID) related to the javaw process. Since we have the <strong>Sysinternals Suite</strong> installed, we can use a tool called <strong>pslist</strong> for that:</li></ul><pre>pslist javaw</pre><p>The output is</p><pre>PsList v1.41 - Process information lister<br>Copyright (C) 2000-2023 Mark Russinovich<br>Sysinternals - www.sysinternals.com<br><br>Process information for DESKTOP-T3FP63R:<br><br>Name                Pid Pri Thd  Hnd   Priv        CPU Time    Elapsed Time<br>javaw             34300   8 110 1382 571672     0:00:35.968     0:22:00.693</pre><ul><li>[ 5d ] With the PID <strong>34300</strong> in hand, run the command below to get the <strong>M2EE_ADMIN_PASS</strong></li></ul><pre>python -c &#39;import psutil; print(psutil.Process(pid=34300).environ()[&quot;M2EE_ADMIN_PASS&quot;])&#39;</pre><p>The output is 3c713cf1–0721–4ecb-b929-ebe5782039c3. Not surprisingly, it’s the same as step <strong>[ 4f ]</strong>!</p><ul><li>[ 5 ] ⚠️But this value is not yet the <strong>M2EE_ADMIN_PASS ⚠️</strong>! We have to convert it to base64. For that, let’s use the site <a href="https://www.base64encode.org/">https://www.base64encode.org/</a>. <br>⚠️⚠️<strong>IMPORTANT</strong>: Define Destination Character set as <strong>ASCII ⚠️⚠️</strong>. The output below is finally the password we were looking for:</li></ul><pre>M2M3MTNjZjEtMDcyMS00ZWNiLWI5MjktZWJlNTc4MjAzOWMz</pre><ul><li>[ 5 optional] If you prefer, it is also possible to get the same result using the Python script below:</li></ul><pre>python -c &#39;import base64; print(base64.b64encode(&quot;3c713cf1-0721-4ecb-b929-ebe5782039c3&quot;.encode(&quot;ascii&quot;)).decode(&quot;ascii&quot;))&#39;<br><br>M2M3MTNjZjEtMDcyMS00ZWNiLWI5MjktZWJlNTc4MjAzOWMz</pre><ul><li>[ 6 ] Finally, we can use this password to send a POST request to the admin endpoint created for our Mendix application. For that, let’s use the url <a href="http://localhost:8090/admin">http://localhost:8090/admin</a> in the curl command below:</li></ul><pre>curl -L -X POST &quot;http://localhost:8090/admin&quot; -H &quot;Content-Type: application/json&quot; -H &quot;X-M2EE-Authentication: ZWVkYWM2NDUtYzJjMi00NzMwLWIwMTAtODRjNzdmNTQ3MTE2&quot; -d &#39;{&quot;action&quot;:&quot;runtime_statistics&quot;,&quot;params&quot;: {}}&#39;</pre><ul><li>I used the action runtime_statistics in the command above. Please see the Mendix Documentation <a href="https://docs.mendix.com/refguide/monitoring-mendix-runtime/">Monitoring Mendix Runtime</a> for further details.</li><li>The output is:</li></ul><pre>PS C:\Users\vstram&gt; curl -L -X POST &quot;http://localhost:8090/admin&quot; -H &quot;Content-Type: application/json&quot; -H &quot;X-M2EE-Authentication: ZWVkYWM2NDUtYzJjMi00NzMwLWIwMTAtODRjNzdmNTQ3MTE2&quot; -d &#39;{&quot;action&quot;:&quot;runtime_statistics&quot;,&quot;params&quot;: {}}&#39;<br>{<br>    &quot;feedback&quot;: {<br>        &quot;sessions&quot;: {<br>            &quot;user_sessions&quot;: {<br>            },<br>            &quot;named_users&quot;: 0,<br>            &quot;anonymous_sessions&quot;: 0,<br>            &quot;named_user_sessions&quot;: 0<br>        },<br>        &quot;cache&quot;: {<br>            &quot;total_count&quot;: 0<br>        },<br>        &quot;memory&quot;: {<br>            &quot;used_nonheap&quot;: 152593352,<br>            &quot;init_nonheap&quot;: 7667712,<br>            &quot;max_nonheap&quot;: -1,<br>            &quot;committed_nonheap&quot;: 155844608,<br>            &quot;init_heap&quot;: 528482304,<br>            &quot;memorypools&quot;: [<br>                {<br>                    &quot;is_heap&quot;: false,<br>                    &quot;usage&quot;: 1954560,<br>                    &quot;name&quot;: &quot;CodeHeap &#39;non-nmethods&#39;&quot;,<br>                    &quot;index&quot;: 0<br>                },<br>                {<br>                    &quot;is_heap&quot;: false,<br>                    &quot;usage&quot;: 103138312,<br>                    &quot;name&quot;: &quot;Metaspace&quot;,<br>                    &quot;index&quot;: 1<br>                },<br>                {<br>                    &quot;is_heap&quot;: false,<br>                    &quot;usage&quot;: 27893120,<br>                    &quot;name&quot;: &quot;CodeHeap &#39;profiled nmethods&#39;&quot;,<br>                    &quot;index&quot;: 2<br>                },<br>                {<br>                    &quot;is_heap&quot;: false,<br>                    &quot;usage&quot;: 12043872,<br>                    &quot;name&quot;: &quot;Compressed Class Space&quot;,<br>                    &quot;index&quot;: 3<br>                },<br>                {<br>                    &quot;is_heap&quot;: true,<br>                    &quot;usage&quot;: 67108864,<br>                    &quot;name&quot;: &quot;G1 Eden Space&quot;,<br>                    &quot;index&quot;: 4<br>                },<br>                {<br>                    &quot;is_heap&quot;: true,<br>                    &quot;usage&quot;: 55358752,<br>                    &quot;name&quot;: &quot;G1 Old Gen&quot;,<br>                    &quot;index&quot;: 5<br>                },<br>                {<br>                    &quot;is_heap&quot;: true,<br>                    &quot;usage&quot;: 8535696,<br>                    &quot;name&quot;: &quot;G1 Survivor Space&quot;,<br>                    &quot;index&quot;: 6<br>                },<br>                {<br>                    &quot;is_heap&quot;: false,<br>                    &quot;usage&quot;: 7563392,<br>                    &quot;name&quot;: &quot;CodeHeap &#39;non-profiled nmethods&#39;&quot;,<br>                    &quot;index&quot;: 7<br>                }<br>            ],<br>            &quot;committed_heap&quot;: 205520896,<br>            &quot;max_heap&quot;: 8447328256,<br>            &quot;used_heap&quot;: 131003312<br>        },<br>        &quot;languages&quot;: [<br>            &quot;en_US&quot;<br>        ],<br>        &quot;entities&quot;: 57,<br>        &quot;requests&quot;: [<br>            {<br>                &quot;last_request_timestamp&quot;: 1745196187930,<br>                &quot;name&quot;: &quot;&quot;,<br>                &quot;value&quot;: 0<br>            },<br>            {<br>                &quot;last_request_timestamp&quot;: 1745196514085,<br>                &quot;name&quot;: &quot;debugger/&quot;,<br>                &quot;value&quot;: 15<br>            },<br>            {<br>                &quot;last_request_timestamp&quot;: 1745196188002,<br>                &quot;name&quot;: &quot;p/&quot;,<br>                &quot;value&quot;: 0<br>            },<br>            {<br>                &quot;last_request_timestamp&quot;: 1745196188003,<br>                &quot;name&quot;: &quot;manifest.webmanifest&quot;,<br>                &quot;value&quot;: 0<br>            },<br>            {<br>                &quot;last_request_timestamp&quot;: 1745196188000,<br>                &quot;name&quot;: &quot;file&quot;,<br>                &quot;value&quot;: 0<br>            },<br>            {<br>                &quot;last_request_timestamp&quot;: 1745196187994,<br>                &quot;name&quot;: &quot;xas/&quot;,<br>                &quot;value&quot;: 0<br>            }<br>        ],<br>        &quot;connectionbus&quot;: {<br>            &quot;select&quot;: 68,<br>            &quot;insert&quot;: 33,<br>            &quot;update&quot;: 22,<br>            &quot;delete&quot;: 17,<br>            &quot;transaction&quot;: 1024<br>        }<br>    },<br>    &quot;result&quot;: 0<br>}</pre><ul><li>Optionally, you can use <strong>Postman</strong> to run the same request:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZZQRNa2TJ16d5DAp0nI8TA.png" /><figcaption>Postman running the POST request to return the runtime statistics</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*gBaD16cQf-XKD7b3Jk4kLA.png" /><figcaption>The body used in this request</figcaption></figure><p>The table below summarizes all the “actions” available:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/455/1*zimbsErOALrZSodvkcpLgQ.png" /></figure><h3>Python Script</h3><p>For your convenience, run the script below if you intend to get the application memory heap consumption:</p><pre>import psutil<br>import base64<br>import requests<br>import json<br><br># Get the process ID<br># https://psutil.readthedocs.io/en/latest/index.html#find-process-by-name<br>def find_procs_by_name(name):<br>    &quot;Return a list of processes matching &#39;name&#39;.&quot;<br>    ls = []<br>    for p in psutil.process_iter([&#39;name&#39;]):<br>        if p.info[&#39;name&#39;] == name:<br>            ls.append(p)<br>    return ls<br><br># Get the M2EE password from the environment variables of the javaw process<br>def get_m2ee_password():<br>    pid = find_procs_by_name(&quot;javaw.exe&quot;)<br>    len_pid = len(pid)<br>    if len_pid == 0:<br>        print(&quot;ERROR: No processes found&quot;)<br>        exit(1)<br>    elif len_pid &gt; 1:<br>        print(&quot;ERROR: More than one process found&quot;)<br>        exit(1)<br><br>    # len_pid MUST be exactly == 1<br>    javaw_pid = pid[0].pid<br>    # TODO: use a try except here!<br>    m2ee_admin_pass = psutil.Process(pid=javaw_pid).environ()[&quot;M2EE_ADMIN_PASS&quot;]<br>    m2ee_admin_pass_b64 = base64.b64encode(m2ee_admin_pass.encode(&quot;ascii&quot;)).decode(&quot;ascii&quot;)<br><br>    print(f&quot;Javaw Process ID: {javaw_pid}&quot;)<br>    print(f&quot;Password: {m2ee_admin_pass}&quot;)<br>    print(f&quot;Base64 encoded password: {m2ee_admin_pass_b64}&quot;)<br><br>    return m2ee_admin_pass_b64<br><br># Get the runtime statistics from the M2EE admin API<br>def get_runtime_statistics():<br>    m2ee_admin_pass_b64 = get_m2ee_password()<br><br>    url = &quot;http://localhost:8090/admin&quot;<br><br>    payload = json.dumps({<br>    &quot;action&quot;: &quot;runtime_statistics&quot;,<br>    &quot;params&quot;: {}<br>    })<br>    headers = {<br>    &#39;Content-Type&#39;: &#39;application/json&#39;,<br>    &#39;X-M2EE-Authentication&#39;: m2ee_admin_pass_b64<br>    }<br><br>    response = requests.request(&quot;POST&quot;, url, headers=headers, data=payload)<br><br>    return response.text<br><br>runtime_statistics = get_runtime_statistics()<br>#print(f&quot;Runtime statistics: {runtime_statistics}&quot;)<br>used_heap = json.loads(runtime_statistics)[&quot;feedback&quot;][&quot;memory&quot;][&quot;used_heap&quot;]<br><br>print(f&quot;Used heap: {used_heap / 1024 / 1024} MB&quot;)</pre><p>Below is the script output:</p><pre>Javaw Process ID: 46008<br>Password: ec316419-d140-4cfc-b50d-0e8ee1dbfa26<br>Base64 encoded password: ZWMzMTY0MTktZDE0MC00Y2ZjLWI1MGQtMGU4ZWUxZGJmYTI2<br>Used heap: 173.9798583984375 MB</pre><h3>Conclusion &amp; Comments</h3><ul><li>Now what?! How can we use the information retrieved by this endpoint to our advantage? Well, this could be a subject for a future article.</li><li>Particularly, I’m interested in the runtime_statistics and the runtime_status actions. The former was used in the example, while the latter can return the following results: <br>created, starting, broken, running, stopping, stopped.<br>This can be used to create a status page, for example.</li><li>This procedure is mainly meant for the local deployment or on-premises (in this case, the only difference is that you can define your own M2EE_ADMIN_PASS in the file settings.yaml). For deployments to the <strong>Mendix Private Cloud</strong>, you do not have access to the m2ee admin handler to make these requests. If you use <strong>Mendix Cloud</strong>, you can get the same information from various pages in the <strong>Mendix Portal</strong>.</li></ul><h3>References</h3><ul><li><a href="https://learn.microsoft.com/pt-br/sysinternals/downloads/sysinternals-suite">Pacote Sysinternals - Sysinternals</a></li><li><a href="https://docs.mendix.com/refguide/monitoring-mendix-runtime/">Monitoring Mendix Runtime</a></li><li><a href="https://psutil.readthedocs.io/en/latest/index.html#">psutil documentation - psutil 7.0.1 documentation</a></li></ul><h3>Troubleshooting</h3><ul><li>If you get the error message below when running the Python command to get the M2EE_ADMIN_PASS, the problem is with the dash character, which may be using the Unicode version of ‘-’ instead of the ASCII. Replace with the ASCII version to solve.</li></ul><pre>UnicodeEncodeError: &#39;ascii&#39; codec can&#39;t encode character &#39;\u2013&#39; in position 8: ordinal not in range(128)</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b4424099ed0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Faker.JS With Mendix]]></title>
            <link>https://vstram.medium.com/using-faker-js-with-mendix-d076d28087eb?source=rss-29a6ebd5b2d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/d076d28087eb</guid>
            <category><![CDATA[low-code-development]]></category>
            <category><![CDATA[tips-and-tricks]]></category>
            <category><![CDATA[mendix]]></category>
            <category><![CDATA[low-code]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Vinicius Strugata Ambrosio]]></dc:creator>
            <pubDate>Sun, 30 Mar 2025 02:44:37 GMT</pubDate>
            <atom:updated>2025-03-30T12:51:27.330Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wJAMtXt4eNFeBOdekvMy_Q.png" /><figcaption>The Mendix Fake car application</figcaption></figure><p>Sometimes you need to feed your application with data. A lot of data. You don&#39;t mind whether this data is real or not. You may intend to perform a load test in your application. How can you achieve this fast? The Javascript <strong>Faker.JS</strong> library can be the solution.</p><h3>My Environment</h3><ul><li>Mac Mini M2 — Sequoia 15.3.2</li><li>Studio Pro 10.21.0 Beta for Mac</li><li>Node v23.5.0</li></ul><h3>The Use Case</h3><p>We will create a very simple application to generate fake vehicle data and show it on DataGrid2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VtiR3Ci4Gzn0Z5xQ8s598A.png" /><figcaption>The Fake Vehicle Web Application</figcaption></figure><h3>Procedure</h3><p>[ 1 ] Create a <strong>New Application</strong> using the <strong>Blank Template</strong>.</p><p>[ 2 ] Create a <strong>Persistent Entity</strong> called <strong>Vehicle</strong> with the following attributes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*HOI2Cb1oXkyRDE27jXiYOw.png" /><figcaption>Vehicle attributes</figcaption></figure><p>[ 3 ] Create a <strong>Snippet</strong> and drop a <strong>DataGrid2</strong> on it, then use the <strong>Vehicle</strong> entity as Datasource. Also, define a <strong>Variable</strong> called <strong>Count</strong> that will be used to create N Vehicles. This <strong>Count</strong> variable should be used as a Datasource for a <strong>TextBox</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*EALQX-DSfPTBFVqwsqV6Rw.png" /><figcaption>Datagrid2 defined to use Vehicle as Datasource</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*-pCS4Qyz5w2c04VqLHsBgA.png" /><figcaption>The Studio Pro 10.21.0 most useful new feature IMHO: Snippet/Page Variables !!</figcaption></figure><p>[ 4 ] Create a <strong>Button Create N</strong> besides the <strong>TextBox</strong>. Define a new Nanoflow called <strong>ACT_Vehicle_Create</strong> as <strong>OnClick</strong> event. This nanoflow must have the variable <strong>Count</strong> as a parameter:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*mpife9gpf_OKXtthEy1xcQ.png" /><figcaption>The ACT_Vehicle_Create requires a Count integer parameter</figcaption></figure><p>This nanoflow creates <strong>Count N Vehicles</strong> and adds each new <strong>Vehicle</strong> to a list retrieved from the <strong>Database</strong>. At the end, commit the newly created <strong>Vehicles</strong> to the <strong>Database</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tfPcG9J4Qv51eJv28QDiaA.png" /><figcaption>ACT_Vehicle_Create nanoflow</figcaption></figure><p>Observe that here I&#39;m using the <em>very very useful variable</em> $currentIndex as stop criteria for the while loop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*fkD8fcIcj1mmFY-rrYJ1bQ.png" /><figcaption>The very very useful $currentIndex variable</figcaption></figure><p>But how a new <strong>Vehicle</strong> is created? I&#39;ve used a JavaScript Action that uses the <strong>Faker.JS</strong> package API to configure the fake data for this new <strong>Vehicle</strong>.</p><p>[ 5 ] Therefore, create a JavaScript called <strong>JSA_Vehicle_Create</strong> that returns a <strong>Vehicle</strong> object and shouldn&#39;t have any parameter:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*3kZHhv9TUOBwLDOoIBLjHw.png" /><figcaption>JSA_Vehicle_Create returns a Vehicle object</figcaption></figure><p>[ 6 ] Before writing the javascript code, the <strong>Faker.JS</strong> library must be installed. Open a terminal at the <strong>JSA_Vehicle_Create</strong> path and run the command below:</p><pre>npm install @faker-js/faker --save-dev</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/1*zVbuNoZay78kIKMnE8yAWQ.png" /><figcaption>NPM command to install Faker.JS (in my case, the main module is called App)</figcaption></figure><p>After installing the <strong>Faker.JS</strong> package, you should have these files inside this folder:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*eibMWLi-_rztEeUyUTE62A.png" /></figure><p>[ 7 ] Let&#39;s code the script that creates the fake <strong>Vehicles</strong>! Firstly, the <strong>Faker.JS</strong> library must be imported:</p><pre>import { faker } from &#39;@faker-js/faker&#39;;</pre><p>Then, we can use the <a href="https://fakerjs.dev/api/">Faker.JS API</a> to get the fake vehicle data:</p><pre>const name = faker.vehicle.vehicle();<br>const model = faker.vehicle.model();<br>const manufacturer = faker.vehicle.manufacturer();<br>const color = faker.vehicle.color();<br>const fuel = faker.vehicle.fuel();<br>const year = faker.date.past().getFullYear();<br>const vrm = faker.vehicle.vrm();</pre><p>With these data available, we can create the MxObject Vehicle inside the JavaScript Action. Yes, this is possible! <a href="https://apidocs.rnd.mendix.com/10/client-mx-api/index.html">Check Mendix Documentation</a> for details.</p><pre>const newVehicle = await createMxObject(&quot;App.Vehicle&quot;);<br>newVehicle.set(&quot;Name&quot;, name);<br>newVehicle.set(&quot;Model&quot;, model);<br>newVehicle.set(&quot;Manufacturer&quot;, manufacturer);<br>newVehicle.set(&quot;Color&quot;, color);<br>newVehicle.set(&quot;Fuel&quot;, fuel);<br>newVehicle.set(&quot;Year&quot;, year);<br>newVehicle.set(&quot;Vrm&quot;, vrm);</pre><p>In addition, I&#39;ve created a helper function called createMxObject that effectively creates a new Object using the entityName given as a parameter:</p><pre>async function createMxObject(entityName) {<br> return new Promise(function(resolve, reject) {<br>  mx.data.create({<br>   entity: entityName,<br>   callback: function(mxObject) {<br>    resolve(mxObject);<br>   },<br>   error: function(e) {<br>    reject(&quot;Could not create object:&quot; + e.message);<br>   }<br>  });<br> });<br>}</pre><p>The complete code is below so that you can copy/paste:</p><pre>import &quot;mx-global&quot;;<br>import { Big } from &quot;big.js&quot;;<br>import { faker } from &#39;@faker-js/faker&#39;;<br><br>// BEGIN EXTRA CODE<br>async function createMxObject(entityName) {<br> return new Promise(function(resolve, reject) {<br>  mx.data.create({<br>   entity: entityName,<br>   callback: function(mxObject) {<br>    resolve(mxObject);<br>   },<br>   error: function(e) {<br>    reject(&quot;Could not create object:&quot; + e.message);<br>   }<br>  });<br> });<br>}<br>// END EXTRA CODE<br><br>/**<br> * @returns {Promise.&lt;MxObject&gt;}<br> */<br>export async function JSA_Vehicle_Create() {<br> // BEGIN USER CODE<br> const name = faker.vehicle.vehicle();<br> const model = faker.vehicle.model();<br> const manufacturer = faker.vehicle.manufacturer();<br> const color = faker.vehicle.color();<br> const fuel = faker.vehicle.fuel();<br> const year = faker.date.past().getFullYear();<br> const vrm = faker.vehicle.vrm();<br><br> const newVehicle = await createMxObject(&quot;App.Vehicle&quot;);<br> newVehicle.set(&quot;Name&quot;, name);<br> newVehicle.set(&quot;Model&quot;, model);<br> newVehicle.set(&quot;Manufacturer&quot;, manufacturer);<br> newVehicle.set(&quot;Color&quot;, color);<br> newVehicle.set(&quot;Fuel&quot;, fuel);<br> newVehicle.set(&quot;Year&quot;, year);<br> newVehicle.set(&quot;Vrm&quot;, vrm);<br><br> return newVehicle;<br> // END USER CODE<br>}</pre><p>[ 8 ] With the Javascript Action ready, we can finalize <strong>ACT_Vehicle_Create</strong> so that the <strong>Create N</strong> button can now fulfill its purpose. Then, drop the Snippet created in the step [ 3 ] in the <strong>Home_Web</strong> page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*50nxzqXQ4YwOg4AHorPetQ.png" /><figcaption>The Snippet placed in the Home_Web page</figcaption></figure><p>[ 9 ] Finally, let&#39;s run our application with F5:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dt0HMeSy0De9144zQM7lhg.gif" /><figcaption>The Faker.JS being used by our Mendix application</figcaption></figure><h3>Comments &amp; Conclusions</h3><ul><li>The combination of the Mendix Low-Code with the power and flexibility of JavaScript is a winning solution. The key factor here is to define precisely the boundaries of each technology.</li><li>In the current solution, I chose to create the Vehicle in JavaScript, so that by doing so I end up with just one call to JavaScript. Alternatively, I could just return the dummy data for each attribute and then create the Vehicle entity in a Nanoflow. I prefer the first option.</li><li>This is my first app completely created in MacOS. But at the date this article was written, the MacOS version of Studio Pro was still in Beta, and with a lot of bugs, limitations, and instabilities. For example, you cannot use keyboard shortcuts on the JavaScript editor to copy/paste and you cannot dock the Variables and Debugger views side by side in the StudioPro Viewport. But there are improvements also: finally, we can use a structured mode when designing the pages!</li><li>There&#39;s an alternative for creating Fake data using a Java library instead. This library is called <a href="https://github.com/DiUS/java-faker">Java Fake</a>. Take a look at the module <a href="https://marketplace.mendix.com/link/component/112021">FakeData</a>. Why I&#39;m not using it? Because it is very old! The last commit was 4 years ago, and it seems to me a defunct library. Faker.JS on the other side is being actively developed (the latest commit was done a few weeks ago).</li><li>This fact brings a frequently disregarded governance requirement: avoid the use of modules or widgets in which dependencies are very old. This can be a potential security risk for your application.</li></ul><p>If you find an error or have a suggestion, please let me know in the comments!😉</p><h3>References</h3><ul><li><a href="https://apidocs.rnd.mendix.com/10/client-mx-api/index.html">Mendix Client API Documentation</a></li><li><a href="https://fakerjs.dev/api/">FakerJS</a></li></ul><h3>Source Code</h3><p><a href="https://github.com/vstram/mx_faker">GitHub - vstram/mx_faker</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d076d28087eb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Update: Containerize Mendix Applications]]></title>
            <link>https://vstram.medium.com/update-containerize-mendix-applications-7eb5d56e2a1e?source=rss-29a6ebd5b2d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/7eb5d56e2a1e</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[low-code]]></category>
            <category><![CDATA[docker-compose]]></category>
            <category><![CDATA[mendix]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Vinicius Strugata Ambrosio]]></dc:creator>
            <pubDate>Sun, 23 Mar 2025 23:59:11 GMT</pubDate>
            <atom:updated>2025-03-27T23:55:40.081Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1qDRc7GoOQ6s0UYcAQg17Q.png" /></figure><p>The procedure for containerizing a Mendix application changed slightly in Docker Mendix Buildpack v6 compared to Docker Mendix Buildpack v5. This article intends to update and complement the article &quot;<a href="https://medium.com/@vstram/containerize-your-mendix-application-with-docker-d41c332b5a73">Containerize your Mendix Application with Docker</a>&quot; released in 2023.</p><h3>My Environment</h3><ul><li>Studio Pro 10.18.4</li><li>A Mendix project with Security Level: Production.</li><li>Docker Desktop 4.39.0</li><li>Windows 11 24H2 (with WSL — Windows Subsystem for Linux - Ubuntu)</li><li>Python 3 installed on WSL</li></ul><h3>Procedure</h3><p>Starting from version <a href="https://github.com/mendix/docker-mendix-buildpack/tree/v6.0.0">Docker Mendix Buildpack v6</a>, generating the images to containerize a Mendix application now requires a slightly different procedure than the earlier versions. Please follow the below steps:</p><p>[ 0 ] Open your WSL-Ubuntu Terminal. Prefer to run the commands in an empty directory</p><pre>WindowsKey + R<br>wsl + Enter</pre><p>[ 1 ] The first step is to download the package containing the required files from <a href="https://github.com/mendix/docker-mendix-buildpack/tree/v6.0.0">Docker Mendix Buildpack v6</a> repository. Install unzip if needed: sudo apt-get install unzip</p><pre>curl -L -o docker-mendix-buildpack.zip https://github.com/mendix/docker-mendix-buildpack/archive/refs/tags/v6.0.0.zip<br>unzip docker-mendix-buildpack.zip</pre><p>[ 2 ] Download your Mendix project from the Github repository [replace the URL to use your project]</p><pre>curl -L -o mx_docker_app.zip https://github.com/vstram/mx_docker_app/archive/refs/heads/main.zip<br>unzip mx_docker_app.zip</pre><p>[ 3 ] At this step, you should have the following files and directories in your working directory</p><pre>ls<br>docker-mendix-buildpack-6.0.0  docker-mendix-buildpack.zip  mx_docker_app-main  mx_docker_app.zip</pre><p>Go to the docker-mendix-buildpack-6.0.0 directory:</p><pre>cd docker-mendix-buildpack-6.0.0/</pre><p>[ 4 ] Run the magic build.py script with the correct parameters for your case (mainly --source and --destination):</p><pre>python3 ./build.py --source ./../mx_docker_app-main/ --destination ./tmp/docker-buildpack-context build-mda-dir</pre><p>This script builds the MDA from your Mendix Application and stores the deployable files on ./tmp/docker-buildpack-context directory.</p><p>[ 5 ] Still in the docker-mendix-buildpack directory, run the commands below to build the images …</p><pre>docker build -t mendix-rootfs:app -f rootfs-app.dockerfile .<br>docker build -t mendix-rootfs:builder -f rootfs-builder.dockerfile .</pre><p>[ 6 ] Now, let’s build our Mendix application image, using the images generated earlier. Observe that this command is tagging the application with the name vstram/mx_docker_app:1.0:</p><pre>docker build \<br> --build-arg BUILDER_ROOTFS_IMAGE=mendix-rootfs:builder \<br> --build-arg ROOTFS_IMAGE=mendix-rootfs:app \<br> -t vstram/mx_docker_app:1.0 ./tmp/docker-buildpack-context</pre><p>Check the output for any errors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sId8ydC5_wzscB0ZHf0EyA.png" /></figure><p>If all works as expected, you should have these docker images ready for use:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/1*DeP8IZjGi8iRrj-8mg9g6g.png" /></figure><p>[ 7 ] Open the file tests/docker-compose-postgres.yml and change line 5 to correspond to the app image name given in step 6. Also, change the ADMIN_PASSWORD, line 13, to comply with the requirements (12 chars and digits, mixed case, symbols)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*yNgG-F-EUmBJK6dauDZXMA.png" /></figure><p>[ 8 ] Finally, run the command below to start the database and the server on which your application will run:</p><pre>docker compose -f ./tests/docker-compose-postgres.yml up</pre><p>[ 9 ] Look in the output for the message stating that the server was successfully started</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SJPpsF18BoA0uZITyrJskw.png" /></figure><p>[ 10 ] Then, use your favorite browser to access your containerized Mendix Application!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*SFXOShyqya6fd6CBtAHaiA.png" /></figure><h4>The complete Bash Script</h4><p>Below is the complete bash script for your convenience. Pay attention to the header of this script!</p><pre>#---------------------------------------------------------------------------------------------------<br>#   This bash script contains all the steps to run a Mendix in a container<br>#   Requirements:<br>#   - Ubuntu (or WSL)<br>#   - Docker<br>#   - Python <br>#<br>#   ATTENTION: You must change the Mendix App GitHub repository URL (or any other repository), the <br>#   Build Pack Version, and the mendix tag name and password in the postgres compose file<br>#<br>#   WARNING 1: Run this script in an empty directory<br>#   WARNING 2: Install unzip if needed: sudo apt-get install unzip<br>#   WARNING 3: Be careful with line endings among Win/Linux! Use Notepad++<br>#              or VSCode to convert this script to use LF insted of CRLF<br>#---------------------------------------------------------------------------------------------------<br><br># Download and Unzip the Docker Mendix Build Pack v6<br>curl -L -o docker-mendix-buildpack.zip https://github.com/mendix/docker-mendix-buildpack/archive/refs/tags/v6.0.0.zip<br>unzip docker-mendix-buildpack.zip<br><br># Download and Unzip your Mendix application (change the Github URL to point)<br># to your application!<br>curl -L -o mx_docker_app.zip https://github.com/vstram/mx_docker_app/archive/refs/heads/main.zip<br>unzip mx_docker_app.zip<br><br># Change dir to Docker Mendix Build Pack folder<br>cd docker-mendix-buildpack-6.0.0/<br><br># Run the python script to create the MDA<br>python3 ./build.py --source ./../mx_docker_app-main/ --destination ./tmp/docker-buildpack-context build-mda-dir<br><br># Build the required images<br>docker build -t mendix-rootfs:app -f rootfs-app.dockerfile .<br>docker build -t mendix-rootfs:builder -f rootfs-builder.dockerfile .<br><br># Build the Mendix application image<br>docker build \<br> --build-arg BUILDER_ROOTFS_IMAGE=mendix-rootfs:builder \<br> --build-arg ROOTFS_IMAGE=mendix-rootfs:app \<br> -t vstram/mx_docker_app:1.0 ./tmp/docker-buildpack-context<br><br># Fix the docker-compose-postgres.yml [change it according with your needs]<br>sed -i -e &#39;s%mendix-testapp:$BUILDPACK_VERSION%vstram/mx_docker_app:1.0%g&#39; ./tests/docker-compose-postgres.yml<br>sed -i -e &#39;s%Password1!%Mendix@12345%g&#39; ./tests/docker-compose-postgres.yml<br><br># Start your Mendix app via docker compose<br>docker compose -f ./tests/docker-compose-postgres.yml up</pre><h3>Conclusions &amp; Comments</h3><ul><li>Mendix and Docker are a perfect match! Imagine the possibilities:<br>- You can create many docker-compose using different releases of your app so that you can investigate a bug or a performance issue;<br>- You create multiple docker-compose files with different databases for testing, load test, etc<br>- You can configure Docker on your CI/CD (GitHub Actions, Gitlab, …) to build and deploy your application automatically.</li><li><strong>However</strong>:<br>- It seems that now you need an image to generate the MDA, and because of that, more disk space is required.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*9pNoofDZuVvROnawbt8j-g.png" /><figcaption>These 3.3 GB used by the mendix-buildpack aren’t required in Docker Buildpack v5…</figcaption></figure><p>- ⚠️I’ve tried to run the bash script on another machine. Everything went fine, the app is deployed atlocalhost:8080 but I’ve got a mysterious bug just after login (kind of infinite loop at the login screen):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lb2MRmJAhLOwaXikidRbTw.png" /></figure><p>To be investigated… 🤔</p><p>This also occurred with you? I invite the reader to help me with this bug hunting!</p><p>If you find an error or have a suggestion, please let me know in the comments!😉</p><blockquote>⚠️⚠️⚠️UPDATE 2025/02/25 — If you face a fail in the login process, try using a different browser, or using the Anonymous Mode, or clear the cookies associated with the <a href="http://localhost:8080.">http://localhost:8080.</a> It should work!</blockquote><h3>References</h3><ul><li><a href="https://github.com/mendix/docker-mendix-buildpack/tree/v6.0.0">Docker Mendix Buildpack v6</a></li><li><a href="https://github.com/mendix/cf-mendix-buildpack/tree/v5.0.25">CF Mendix Buildpack</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7eb5d56e2a1e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Four Methods to Mirror Your Android Device Screen to PC]]></title>
            <link>https://vstram.medium.com/four-methods-to-mirror-your-android-device-screen-to-pc-109cf688ddc8?source=rss-29a6ebd5b2d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/109cf688ddc8</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[mendix]]></category>
            <category><![CDATA[mirror]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Vinicius Strugata Ambrosio]]></dc:creator>
            <pubDate>Sun, 29 Dec 2024 01:30:47 GMT</pubDate>
            <atom:updated>2025-02-16T12:39:03.967Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m a <a href="https://www.mendix.com/"><strong>Mendix</strong></a> LowCode developer specialized in mobile development. Unlike Web or Desktop development, where you can test your code directly on <strong>Windows</strong> or <strong>Mac</strong>, mobile development requires the use of <strong>Android</strong> or <strong>iOS</strong> devices. Since I’m part of a team, sometimes I need to show my device’s screen to a coworker (in a Google Meetings call) to explain a particular part of the code or feature. This tutorial shows four ways to do this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tb9mdKz2jZs2yR2l-ZA78A.png" /><figcaption>My prompt to Copilot: “Can you give me an image of a cellphone floating in front of the screen of a PC Monitor and its image being mirrored by the screen? Consider that this PC is located in a futuristic office.” Interesting to note that the Microsoft IA chose an Apple computer instead of a PC 😊</figcaption></figure><h3>SCRCPY — Screen Copy</h3><p>This is my preferred method! <a href="https://github.com/Genymobile/scrcpy"><strong>SCRCPY</strong></a> is an open-source, fast, lightweight solution to mirror the <strong>Android</strong> device screen on the PC. The main features include:</p><ul><li>You can use your PC’s keyboard &amp; mouse to interact with your app.</li><li>Bi-directional Copy/Past</li><li>Screen Recording</li><li>Camera Mirroring</li><li>Virtual Display</li><li>Wireless connection</li><li>… and many more (see the <a href="https://github.com/Genymobile/scrcpy">docs</a>)</li></ul><h4>Procedure</h4><p>[SCRCPY-1] First and foremost, you need to enable the <em>Developer Options</em> on your <strong>Android</strong>. See the doc <a href="https://developer.android.com/studio/debug/dev-options#enable">Enable Developer Options</a> for details.</p><p>[SCRCPY-2] <a href="https://developer.android.com/studio/debug/dev-options#debugging">Enable the USB debugging</a>.</p><p>[SCRCPY-3] Install <strong>SCRCPY</strong>. Four options (use <strong>PowerShell</strong> to execute the commands below):</p><ul><li>[ i ] Using <strong>Winget</strong> (default package manager tool on <strong>Windows</strong>). This will install <strong>SCRCPY</strong> and also <strong>adb</strong></li></ul><pre>winget install --exact Genymobile.scrcpy</pre><ul><li>[ ii ] Using <a href="https://chocolatey.org/">Chocolatey</a></li></ul><pre>choco install scrcpy<br>choco install adb</pre><ul><li>[ iii ] Using <a href="https://scoop.sh/">Scoop</a></li></ul><pre>scoop install scrcpy<br>scoop install adb </pre><ul><li>[ iv ] Download &amp; Unzip the <a href="https://github.com/Genymobile/scrcpy/releases/download/v3.1/scrcpy-win64-v3.1.zip">latest scrcpy release pack</a></li></ul><p>[SCRCPY-4] Use a USB cable to connect the PC to your <strong>Android Device</strong>. It’s possible to connect wirelessly, but I prefer via cable.</p><p>[SCRCPY-5] Using <strong>PowerShell</strong>, type scrcpy to execute the app. Pay attention to your device screen. At the first time, a popup message will appear asking for permission to allow <em>USB debugging</em>. Turn on the flag <em>Always allow from this computer</em>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*DzhPTE4ZDMbSywl1ZT9w6A.png" /></figure><p>[SCRCPY-6] Repeat the command execution. This time you’ll be able to see the <strong>Android Device</strong> screen mirrored to your PC screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/429/1*uzCNS7TGxAYhwedlORhaPA.png" /><figcaption>SCRCPY: Easy way to mirror Android screen on PC!</figcaption></figure><h3>Microsoft Phone Link</h3><blockquote>⚠️Before following this procedure, check if your <strong>Android</strong> device <a href="https://support.microsoft.com/en-us/topic/supported-devices-for-phone-link-experiences-cb044172-87aa-9e41-d446-c4ac83ce8807">supports</a> phone link⚠️.</blockquote><p><strong>Phone Link</strong> is a pre-installed feature in <strong>Windows 11</strong> in recent updates. It allows you to connect your<strong> Windows</strong> PC to your <strong>Android </strong>or <strong>iOS</strong> device to access content and apps from your mobile device.</p><p>You can use <strong>Phone Link</strong> to:</p><ul><li>Make and receive phone calls</li><li>Read and reply to messages</li><li>View your contacts</li><li>Review your call history</li><li>Check and dismiss notifications</li><li>Access your mobile apps (via Screen Mirroring) — I’ve tested only with an Android device</li><li>Transfer content between your devices</li></ul><h4>Procedure</h4><p>[PHONELINK-1] If needed, install the <a href="https://apps.microsoft.com/detail/9nmpj99vjbwv?hl=en-US&amp;gl=BR">Phone Link app</a> on your <strong>Windows</strong> using the <strong>Microsoft Store</strong>. This may not be required, since this app was released as part of the <em>Windows Update</em> in 2022.</p><p>[PHONELINK-2] Install the <a href="https://play.google.com/store/search?q=Phone%20link&amp;c=apps">Phone Link app</a> on your <strong>Android Device</strong> using the <strong>Google Play Store</strong>.</p><p>[PHONELINK-3] Use the shortcut key <strong>Windows+S</strong> and type <strong>Phone Link</strong> and then hit <strong>Enter</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/1*4mRSE6fQ17N7fPfOJi4RGw.png" /></figure><p>[PHONELINK-4] Choose <strong>Android</strong>, enter your credentials and you’ll get a <em>QR Code</em>. Scan this code with your device</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/1*9ITN5LtC8L4QYVzVRrL_hQ.png" /></figure><p>[PHONELINK-5] You will get a code to be entered into your device</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/1*CrajKLzk2FnkIdNM5b_Gnw.png" /></figure><p>[PHONELINK-6] After this, you need to authenticate via the <strong>Microsoft 2FA Authenticator</strong>. At the end, you’ll get a success message:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/1*2RS6H0dZyjuiw-1XgnUDCA.png" /></figure><p>[PHONELINK-7] Follow the instructions to unlock all features. You’ll need to confirm some permissions and also pair your PC and Device via <strong>Bluetooth</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/268/1*rQxYAWfhAQ4tLVg2krbYeA.png" /></figure><p>[PHONELINK-8] You should get a message like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*qVEfmgG_rBiLjfXxpAyfzQ.png" /></figure><p>[PHONELINK-9] ⚠️⚠️⚠️At this point, we should be able to mirror the device screen onto your PC ⚠️⚠️⚠️! However, if you cannot mirror your device screen it means your device is not compatible (as mine, <strong>Samsung M31</strong> used for testing). See the full <a href="https://support.microsoft.com/en-us/topic/supported-devices-for-phone-link-experiences-cb044172-87aa-9e41-d446-c4ac83ce8807">List of Supported Devices</a> and search for your device.</p><p>[PHONELINK-10] Fortunately, I have another Android device (<strong>Samsung A53</strong>), this time compatible, and the result is as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*Gi5hnk0N1cicjXZjgYOFgw.png" /></figure><h3>DroidVNC-NG</h3><p><a href="https://github.com/bk138/droidVNC-NG">DroidVNC-NG</a> is a <strong>VNC Server</strong> app for <strong>Android</strong> that does not require root privileges. Once the <strong>VNC Server</strong> is running on your <strong>Android</strong>, it’s possible to use any <strong>VNC Client</strong> to establish a connection that allows screen sharing.</p><h4>Procedure</h4><p>[DROIDVNC-NG-01] Install <strong>DroidVNC-NG</strong> on your <strong>Android Device</strong></p><ul><li><a href="https://play.google.com/store/apps/details?id=net.christianbeier.droidvnc_ng">https://play.google.com/store/apps/details?id=net.christianbeier.droidvnc_ng</a></li></ul><p>[DROIDVNC-NG-02] Launch the <strong>DroidVNC-NG</strong> app and hit the button <strong>Start</strong>. You must allow some required permissions so that <strong>DroidVNC-NG</strong> can work properly. After this, it will be shown an <strong>IP address</strong> to connect to:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/321/1*QD7JSJmFN6uRYsQ9r1CSlw.png" /></figure><p>[DROIDVNC-NG-03] Now, back to your PC, install a <strong>VNC Client</strong>, like <strong>TightVNC</strong>. Open a <strong>PowerShell</strong> terminal and type the command below (or download the installer from <a href="https://www.tightvnc.com/download.php">TighVNC</a>):</p><pre>winget install -e --id GlavSoft.TightVNC</pre><p>[DROIDVNC-NG-04] Launch the <strong>TightVNC</strong> Client and enter the <strong>IP address</strong> given by <strong>DroidVNC-NG</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*bpJwQAaySNd3QcQyf-nE2g.png" /></figure><p>[DROIDVNC-NG-05] Click on <strong>Connect</strong> and you will have your <strong>Android</strong> device screen mirrored on your PC!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/314/1*VABkpCU8eza8qBHkuiTkWw.png" /></figure><h3>Android Studio</h3><p>Starting with <strong>Android Studio 2022.2.1</strong>, you can mirror your device’s screen within the UI’s IDE. It works well, and eventually, you’ll be using <strong>Android Studio</strong> to debug or inspect with <strong>LogCat</strong>, so all the tools you need for mobile development are in the same IDE.</p><p>However, <strong>Android Studio</strong> is super heavy! You must have a powerful machine to run<strong> Android Studio + Studio Pro + Google Chrome + Node.JS + JAVA + YourAntiVirus</strong>!</p><h4>Procedure</h4><p>[ANDROIDSTUDIO-1] Follow the [SCRCPY-1] and [SCRCPY-2] steps above</p><p>[ANDROIDSTUDIO-2] If you do not have <strong>Android Studio</strong> installed, <a href="https://developer.android.com/studio">download and install it</a> before proceeding.</p><p>[ANDROIDSTUDIO-3] Redo the step [SCRCPY-4] if required.</p><p>[ANDROIDSTUDIO-4] Launch <strong>Android Studio</strong>. Unfortunately, you need to open a project to be able to see the mirrored screen. Therefore, create or open a project of your choice.</p><p>[ANDROIDSTUDIO-5] If you did the <strong>SCRCPY</strong> procedure steps correctly, you should see your device listed in the <strong>Device Manager</strong> list:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/541/1*--VOBNtlvb518FqTZhq1Ug.png" /></figure><p>[ANDROIDSTUDIO-6] Click on the <strong>Running Devices</strong> button. Then click on the + button to add your physical device</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*mEh2OSo_F8cZEgenDFSgMw.png" /></figure><p>[ANDROIDSTUDIO-7] After doing this, you’ll be able to see your device inside <strong>Android Studio IDE</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/1*6lrPxbY8BZbHs-v_7pRTag.png" /></figure><h3>Bonus: SCRCPY Plus</h3><p>As a bonus, you may consider <a href="https://github.com/Frontesque/scrcpy-plus">SCRCPY+</a>, a GUI version of <strong>SCPCPY</strong> based on Electron.JS.</p><h4>Procedure</h4><p>[SCRCPY Plus-1] Follow the [SCRCPY-1] and [SCRCPY-2] steps above</p><p>[SCRCPY Plus-2] Install <strong>SCRCPY Plus</strong></p><ul><li>Using <strong>Winget</strong></li></ul><pre>winget install -e --id Frontesque.scrcpy+</pre><ul><li>Download &amp; Install the <a href="https://github.com/Frontesque/scrcpy-plus/releases/download/2.2.1/scrcpy-plus-2.2.1-win-x64-installer.exe">latest scrcpy+ release</a></li></ul><p>[SCRCPY Plus-3] Redo the step [SCRCPY-4] if required.</p><p>[SCRCPY Plus-4] Launch <strong>SCRCPY Plus</strong>. I may be required to allow the <strong>USB debugging</strong> as shown in [SCRCPY-5]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*qXW56MXcq5zaSExyRlxiAA.png" /></figure><p>[SCRCPY Plus-5] Scroll down in this window and hit the <strong>START SCRCPY</strong> button</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*JmogHMK63tcwL07Tlcrryg.png" /></figure><p>[SCRCPY Plus-6] If everything goes well, you’ll get your <strong>Android Device Screen</strong> mirrored on your PC. The big advantage of <strong>SCRCPY Plus</strong> is the options available for launching (like always on top, show touches, etc…). Although these options are also available on SCRCPY, the UI eases its utilization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/429/1*z_dSipS-A6KRgJknQfHlYQ.png" /></figure><h3>Conclusion &amp; Comments</h3><ul><li>As I said earlier, I prefer and recommend the usage of <strong>SCRCPY</strong> or <strong>SCRCPY+</strong> to mirror your device screen to PC. They are lightweight and efficient solutions for this purpose.</li><li>In addition, I avoid using <strong>Android Emulators</strong> (such as <a href="https://www.bluestacks.com/">BlueStacks</a>), as they can contain bloatware and other threats. If you need to use an <strong>Android Emulator</strong>, use the one provided by <strong>Android Studio</strong>.</li><li>The <strong>PhoneLink</strong> method described above, despite the fact it offers the option to connect an iOS device, it seems that it doesn’t allow screen mirroring … (?) 🤔Please correct me if I’m wrong in the comments.</li><li>In theory, if we find a <strong>VNC Server</strong> for <strong>iOS</strong>, we could use a method similar to <strong>DROIDVNC-NG</strong> to mirror the <strong>iOS</strong> screen.</li></ul><h3>Additional References</h3><ul><li>Phone Link: How to connect Android and iPhone to Windows 2024 — <a href="https://youtu.be/LkelZJrIncA?si=l2VCj4uiIvLikQ2u">https://youtu.be/LkelZJrIncA?si=l2VCj4uiIvLikQ2u</a></li><li>Phone Link: How to Mirror Your Android Screen to Your PC Using Windows Phone Link — <a href="https://www.howtogeek.com/how-to-mirror-your-android-screen-to-your-pc-using-windows-phone-link/">https://www.howtogeek.com/how-to-mirror-your-android-screen-to-your-pc-using-windows-phone-link/</a></li><li>AndroidCast: How To Screen Mirror iPhone Screen to Windows 10/11 — <a href="https://howscreenmirroring.net/how-to-screen-mirror-iphone-screen-to-windows-10-11/">https://howscreenmirroring.net/how-to-screen-mirror-iphone-screen-to-windows-10-11/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=109cf688ddc8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mendix + DOCX = MenDOCX!]]></title>
            <link>https://vstram.medium.com/mendix-docx-mendocx-d05bd463ec32?source=rss-29a6ebd5b2d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/d05bd463ec32</guid>
            <category><![CDATA[ms-word]]></category>
            <category><![CDATA[javascript-tips]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[mendix]]></category>
            <category><![CDATA[report-generation]]></category>
            <dc:creator><![CDATA[Vinicius Strugata Ambrosio]]></dc:creator>
            <pubDate>Sat, 21 Dec 2024 14:56:32 GMT</pubDate>
            <atom:updated>2024-12-21T14:56:32.430Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*EGh-TkVxMyNRLhOoAokSPg.png" /><figcaption>MenDOCX: using DOCX.JS with Mendix!</figcaption></figure><p>This article shows a very basic way to generate <strong>Microsoft Word</strong> reports from a <strong>Mendix-made</strong> Web application. To accomplish this, we will use the <a href="https://docx.js.org/">DOCX.JS</a> javascript package.</p><h4>DEV Environment</h4><ul><li>Studio Pro 10.12.9</li><li>Node.JS v20.16.0</li></ul><h4>Use Case</h4><p>We will use an application that allows editing data about employees as a use case for this article.</p><h4>Procedure</h4><p>[ 1 ] <em>Start Studio Pro</em> and create a new project using the <em>Blank Web App</em>.</p><p>[ 2 ] Create a <em>Persistent Entity</em> called Employee with the following attributes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/174/1*xtQ0JVMUsi1E5cT463YC-g.png" /><figcaption>Employee Entity</figcaption></figure><p>[ 3 ] Right-click on the <em>Entity</em> and use the <em>Generate Overview Pages …</em> to instruct Studio Pro to create the <em>Overview</em> and <em>Edit</em> pages for you. Add the <em>Overview Page</em> to the <em>Navigation Menu</em>.</p><p>[ 4 ] Manually create some <em>Employees</em>, so that you have some data to export to DOCX. At this point, our app should resemble as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/1*cMnpir8Lx8tkpwBd2-46_g.png" /><figcaption>Employee Overview</figcaption></figure><p>[ 5 ] Now let’s add the code to export this data to DOCX. Create a <strong>Java Script Action</strong> called JSA_EmployeeList_ExportToDocx. This JSA must receive a list of Employees as a parameter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*KPFEZv81XnprsG5Tk30H6g.png" /><figcaption>JavaScriptAction parameters</figcaption></figure><p>[ 6 ] Open a <strong>PowerShell Terminal</strong> in the folder in which the <strong>Java Script Action</strong> was created &lt;your project name&gt;\javascriptsource\&lt;your app module&gt;\actions. In my case: D:\work\mx_docx\javascriptsource\app\actions</p><p>[ 7 ] Execute the command below to install the dependencies required to generate the DOCX file. These dependencies are the DOCX.JS and the FileSave.JS packages.</p><pre>npm i docx file-saver</pre><p>[ 8 ] Now let’s write the JS code that will generate the DOCX file from our data. Once the dependencies are in place, we can import them into our code (the full code will be shown later in this article):</p><pre>import { AlignmentType, Document, Packer, Paragraph, Tab, TableCell, Table, TableRow, TextRun, HeadingLevel } from &quot;docx&quot;;<br>import { saveAs } from &quot;file-saver&quot;;</pre><p>[ 9 ] The code below creates the basic table header:</p><pre>const tableHeaderRow = new TableRow({<br>  tableHeader: true,<br>  children: [<br>   new TableCell({<br>    children: [<br>     new Paragraph({<br>      children: [new TextRun({<br>       text: &quot;First Name&quot;,<br>       bold: true,<br>      })]<br>     })],<br>   }), <br>   new TableCell({<br>    children: [<br>     new Paragraph({<br>      children: [new TextRun({<br>       text: &quot;Last Name&quot;,<br>       bold: true,<br>      })]<br>     })],<br>   }),<br>   new TableCell({<br>    children: [<br>     new Paragraph({<br>      children: [new TextRun({<br>       text: &quot;Gender&quot;,<br>       bold: true,<br>      })]<br>     })],<br>   }), <br>   new TableCell({<br>    children: [<br>     new Paragraph({<br>      children: [new TextRun({<br>       text: &quot;Job Title&quot;,<br>       bold: true,<br>      })]<br>     })],<br>   }), <br>   new TableCell({<br>    children: [<br>     new Paragraph({<br>      children: [new TextRun({<br>       text: &quot;Age&quot;,<br>       bold: true,<br>      })]<br>     })],<br>   }),<br>  ]<br> });</pre><p>[ 10 ] The code below creates the table of employees, iterating over the list of Employees passed as a parameter:</p><pre> let tableRows = [];<br> tableRows.push(tableHeaderRow);<br><br> for (const person of employeeList) {<br>  const firstName = person.get(&quot;FirstName&quot;);<br>  const lastName = person.get(&quot;LastName&quot;);<br>  const gender = person.get(&quot;Gender&quot;);<br>  const jobTitle = person.get(&quot;JobTitle&quot;);<br>  const age = person.get(&quot;Age&quot;).toString();<br>  const firstNameTableCell = new TableCell({ children: [new Paragraph(firstName)], });<br>  const lastNameTableCell = new TableCell({ children: [new Paragraph(lastName)], });<br>  const genderTableCell = new TableCell({ children: [new Paragraph(gender)], });<br>  const jobTitleTableCell = new TableCell({ children: [new Paragraph(jobTitle)], });<br>  const ageTableCell = new TableCell({ children: [new Paragraph(age)], });  <br><br>  const tableRow = new TableRow({<br>   children: [firstNameTableCell, lastNameTableCell, genderTableCell, jobTitleTableCell, ageTableCell],<br>  });<br><br>  tableRows.push(tableRow);<br> }<br> const table = new Table({ rows: tableRows, alignment: AlignmentType.CENTER });</pre><p>[ 11 ] The code below creates an <em>MS Word Document Object</em> (provided by the <strong>DOCX</strong> package), defines its margins, creates two paragraphs (one for the heading and another for the description), and finally saves the DOCX with the <em>Employee</em> data:</p><pre> const doc = new Document({<br>  sections: [<br>   {<br>    properties: {<br>     page: {<br>      margin: {<br>       top: &#39;2.5cm&#39;,<br>       right: &#39;2.0cm&#39;,<br>       bottom: &#39;2.0cm&#39;,<br>       left: &#39;2.5cm&#39;<br>      },<br>     },<br>    },<br>    children: [<br>     new Paragraph({<br>      text: &quot;List of registered Employees&quot;,<br>      heading: HeadingLevel.HEADING_1,<br>      alignment: AlignmentType.CENTER,<br>     }),<br>     new Paragraph({<br>      text: &quot;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum id velit sed elit congue imperdiet. Cras bibendum risus cursus purus interdum ultricies. Fusce sed eleifend turpis, sed dignissim ex. Maecenas eu tellus felis. Nullam luctus, magna pulvinar interdum euismod, nisl augue porta sapien, sit amet vulputate ante metus non justo. Mauris erat diam, rhoncus id congue eu, consequat vel massa. Fusce at interdum felis. Aenean id commodo ex, non semper odio. Nunc id odio ex. Donec at sapien lobortis, cursus ante et, pulvinar eros.&quot;,<br>      alignment: AlignmentType.JUSTIFIED,<br>     }),<br>     table,<br>    ],<br>   },<br>  ],<br> });<br><br> saveDocumentToFile(doc, &quot;EmployeeList.docx&quot;);</pre><p>[ 12 ] Now, let’s create a <em>Nanoflow</em> that will retrieve the <em>Employee</em> data and send this data to the <em>JavaScript Action</em>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*t9XoR14wqyKdzNJHEmMwrg.png" /></figure><p>[ 13 ] Finally, let’s call this Nanoflow from the Overview Employee page (through the button Export to DOCX):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*2UuHYyI0d301nVKG8lfmaw.png" /></figure><p>[ 14 ] Hit F5 to run the application locally. The result should be as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*jrJpCG3MHArDDqo14Lw5vg.png" /></figure><p>[ 15 ] Click on the <em>Export to Docx</em> button and the DOCX document will be downloaded for you!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*BgyZW1liVVSDsUuI4f4iwQ.png" /></figure><p>[ 16 ] Yes, I admit that the result isn’t that pretty. However, since this article is becoming too large, I’ll write another showing how to format the document using the DOCX API, as well as using <em>Document Templates</em> as a basis to generate the document.</p><h4>Source Code</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bee0b113f84246b33330ff32b1c4a031/href">https://medium.com/media/bee0b113f84246b33330ff32b1c4a031/href</a></iframe><h4>Conclusion &amp; Comments</h4><ul><li>Mendix is a low-code technology. But low-code doesn’t mean never-code! By combining both programming approaches, we can get speedy results on the shoulders of the so-called traditional code (using Java or JavaScript).</li><li>There are plenty of Javascript libraries on the internet that we can take advantage of. With a little effort, we can use these solutions in a Mendix-Made application. For example:<br>- <a href="https://fakerjs.dev/">Faker.JS</a>: to generate fake data<br>- <a href="https://sheetjs.com/">Sheet.JS</a>: to generate XLSX documents<br>- <a href="https://www.npmjs.com/package/docx-templates">Document-template</a>: Template-based DOCX report creation for both Node and the browser.</li><li>All of the above-mentioned libraries will be subject of future articles here on Medium. Stay tuned!</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d05bd463ec32" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Material Design Snackbar for Android and IOS … and Mendix!]]></title>
            <link>https://vstram.medium.com/material-design-snackbar-for-android-and-ios-and-mendix-75175c794bd5?source=rss-29a6ebd5b2d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/75175c794bd5</guid>
            <category><![CDATA[studiopros]]></category>
            <category><![CDATA[snackbar]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[mendix]]></category>
            <dc:creator><![CDATA[Vinicius Strugata Ambrosio]]></dc:creator>
            <pubDate>Thu, 14 Nov 2024 23:28:47 GMT</pubDate>
            <atom:updated>2024-12-21T14:28:28.720Z</atom:updated>
            <content:encoded><![CDATA[<h3>Material Design Snackbar for Android and IOS … and Mendix!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SIdLXgvLJvFiDtAGqP5WGQ.png" /><figcaption>Ha ha, I&#39;m definitely not good at all in creating AI prompts for article cover images</figcaption></figure><p>Last year, I published an article called <a href="https://medium.com/@vstram/easy-toast-notifications-with-mendix-native-mobile-android-application-18b1212435dc">Easy Toast Notifications with Mendix Native Mobile Android Application</a> that demonstrates an easy way to show ephemeral messages to the user: the “Toast” messages. Another possibility is to use the so-called SnackBars. In this article, I’ll show you a procedure for using this approach on a Mendix-made Native Mobile application. For Android and IOS!</p><h4>Environment</h4><ul><li>Studio Pro 9.24.29 LTS</li><li>Eclipse Adoptium jdk-11.0.16.101-hotspot</li><li>Node.JS v20.17.0</li><li>Windows 11 Pro 24H2</li></ul><h4>Procedure</h4><p>[ 1 ] In Studio Pro, create a new project using the <a href="https://marketplace.mendix.com/link/component/109511"><strong>Blank Native Mobile App</strong></a> template.</p><p>[ 2 ] The goal is to use an NPM package called <a href="https://www.npmjs.com/package/react-native-snackbar/v/2.6.2?activeTab=readme">react-native-snackbar</a> to show brief messages to the user. This package was created based on the <a href="https://m2.material.io/components/snackbars">M2 Material Guidelines</a>.</p><p>[ 3 ] We don’t need to create a Mendix custom widget for this goal. The Snackbar code allows a direct call to the method that shows the message.</p><pre>Snackbar.show({<br>  text: &#39;Hello world&#39;,<br>  duration: Snackbar.LENGTH_SHORT,<br>});</pre><p>[ 4 ] I personally prefer to avoid creating custom widgets since it requires an additional effort to keep the custom widget code in sync with the subjacent NPM package. In addition, the <a href="https://medium.com/@vstram/easy-toast-notifications-with-mendix-native-mobile-android-application-18b1212435dc">standard solution described in the previous article</a> also is not ideal, as it’s not easily portable and/or reusable (besides requiring extra preparation effort — NPEs, Microflows, Containers, Visibility control). Therefore, it’s a huge plus for me just be able to call the code to show the message.</p><p>[ 5 ] Let’s write a <strong>JavaScript</strong> action that is responsible for the code to call the react-native-snackbar package’s method to show the message:</p><pre>import &quot;mx-global&quot;;<br>import { Big } from &quot;big.js&quot;;<br>import Snackbar from &#39;react-native-snackbar&#39;;<br><br>// BEGIN EXTRA CODE<br>// END EXTRA CODE<br><br>/**<br> * @param {string} message<br> * @returns {Promise.&lt;void&gt;}<br> */<br>export async function JSA_ShowSnackBar(message) {<br> // BEGIN USER CODE<br> Snackbar.show({<br>  text: message,<br>  duration: Snackbar.LENGTH_SHORT,<br>  marginBottom: 50,<br> });<br> // END USER CODE<br>}</pre><p>Notice that this JavaScript action was defined with the message parameter:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*JMHlc6dIrOKQSiAKZrSoqQ.png" /></figure><p>The code calls the Snackbar.show method with some basic parameters.</p><p>[ 6 ] The package react-native-snackbar must be installed so that the JavaScript action code can run properly. Open a <strong>PowerShell</strong> terminal on &lt;your-project-name&gt;\javascriptsource\nativemobile\actions folder and run the command below:</p><pre>npm i react-native-snackbar@2.6.2</pre><p>This will install the required node dependencies. Surprisingly, it takes only 204KB of your disk 🤣!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*F4u6-R8LLmwqasATcPUvjQ.png" /></figure><p>Observe that we are installing version 2.6.2 specifically (released 2 years ago). In my tests, <a href="https://github.com/facebook/react-native/issues/46355">the most recent version 2.8.0 did not compile</a>.</p><p>[ 7 ] Now create a Nanoflow <strong>ACT_ShowSnackBar </strong>that calls this JavaScript Action.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/845/1*uFXgUmouNkcMG04UvqbzQg.png" /></figure><p>[ 8 ] And finally call the Nanoflow created in Step 4 in your Native Home Screen. The result will be like this:</p><figure><img alt="react-native-snackbar being used in a Mendix made native application" src="https://cdn-images-1.medium.com/max/415/1*vkH3C1JMWpZfgdZ2HCeK4Q.gif" /><figcaption>react-native-snackbar being used in a Mendix made native application</figcaption></figure><p>[ 9 ] In addition, it’s possible to configure an action button with the message, so that the user has a chance to accept or reject the action (if that is the case). For that, we must create another JavaScript action called <strong>JSA_ShowSnackBarWithAction</strong> with the parameters as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*4TTCEVLl9-5xlZZKrj6Cnw.png" /><figcaption>JSA_ShowSnackBarWithAction parameters</figcaption></figure><pre>import &quot;mx-global&quot;;<br>import { Big } from &quot;big.js&quot;;<br>import Snackbar from &#39;react-native-snackbar&#39;;<br><br>// BEGIN EXTRA CODE<br>// END EXTRA CODE<br><br>/**<br> * @param {string} message<br> * @param {Nanoflow} action_callback<br> * @param {string} action_text<br> * @param {string} action_color<br> * @returns {Promise.&lt;void&gt;}<br> */<br>export async function JSA_ShowSnackBarWithAction(message, action_callback, action_text, action_color) {<br> // BEGIN USER CODE<br> Snackbar.show({<br>  text: message,<br>  duration: Snackbar.LENGTH_INDEFINITE,<br>  action: {<br>   text: action_text,<br>   textColor: action_color,<br>   onPress: async () =&gt; {<br>    await action_callback();<br>   },<br>  },<br> });<br> // END USER CODE<br>}</pre><p>The action button is bound to the Nanoflow passed as a parameter. This is fantastic, allowing great flexibility when implementing the functionalities.</p><p>[ 10 ] If we use this JavaScript action in a Nanoflow and call this Nanoflow our Native Home Screen. The result will be like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/415/1*6WcHQueERB7I40BvsaZbfQ.gif" /><figcaption>Snackbar with an action button that calls a Nanoflow</figcaption></figure><p>[ 11 ] And on top of that, this implementation also works on IOS (at least on the IOS simulator provided by XCode)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/433/1*Gf2U874-Rh7bGvs_lmsEmQ.gif" /></figure><h4>Comments and Conclusions</h4><p>With a little effort in searching, we can find the solutions required to implement the features we are asked for. This library package proved to be very useful since it has a lot of additional configurations.</p><p>However, would be perfect if this kind of feature would be provided by the ReactNative Framework by itself. <a href="https://reactnative.dev/docs/toastandroid">If we have this feature for Android</a>, why don&#39;t we have it for IOS?</p><p>Relying on official framework implementations strengthens the project governance and reduces fragmentation (using plenty of 3rd party code).</p><h4>References</h4><ul><li><a href="https://www.npmjs.com/package/react-native-snackbar?activeTab=readme">react-native-snackbar</a></li><li><a href="https://docs.mendix.com/refguide/javascript-actions/">JavaScript Actions</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75175c794bd5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to re-enable the menu Build Native Mobile App in Mendix Studio Pro]]></title>
            <link>https://vstram.medium.com/how-to-re-enable-the-menu-build-native-mobile-app-in-mendix-studio-pro-a00c9326b8af?source=rss-29a6ebd5b2d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/a00c9326b8af</guid>
            <category><![CDATA[mendix-studio-pro]]></category>
            <category><![CDATA[mendix]]></category>
            <dc:creator><![CDATA[Vinicius Strugata Ambrosio]]></dc:creator>
            <pubDate>Sat, 09 Nov 2024 01:11:32 GMT</pubDate>
            <atom:updated>2024-11-09T01:11:32.455Z</atom:updated>
            <content:encoded><![CDATA[<p>For some reason, maybe after you install or uninstall a given version of Studio Pro, the <strong>Build Native Mobile App</strong> menu item becomes unable. This article describes an easy procedure to re-enable such a menu item.</p><h4>The Problem</h4><p>Your <strong>Build Native Mobile App</strong> menu item is disabled, so you can’t execute the <strong>Native Builder UI</strong>! As a consequence, you can’t create or update the <strong>React Native Template</strong> project code with the <a href="https://docs.mendix.com/refguide/mobile/distributing-mobile-apps/building-native-apps/native-template/#bundle-information">Mendix bundle</a>.</p><figure><img alt="Build Native Mobile App is disabled!" src="https://cdn-images-1.medium.com/max/333/1*zeRxt9FYSJyOMfFGoZr9TQ.png" /><figcaption>Build Native Mobile App is disabled 😢!</figcaption></figure><p>Before proceeding with the solution, be sure that your <strong>Mendix</strong> project has the <a href="https://docs.mendix.com/refguide/navigation/"><strong>Native Profile</strong></a> properly configured.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*FwGZaJ_6BFgkHMQgMxbeWA.png" /><figcaption>Native Mobile Profile</figcaption></figure><h4>The Solution</h4><p>In order to solve this issue, you must re-install the <strong>Native Builder UI</strong>. Download the latest version of this tool by using the link below:</p><pre><a href="https://appdev-mx-cdn.s3.amazonaws.com/native-builders/latest.exe">https://appdev-mx-cdn.s3.amazonaws.com/native-builders/latest.exe</a></pre><p>This link seems weird, huh 🤨? But it is official, you can check in the <a href="https://docs.mendix.com/refguide/mobile/getting-started-with-mobile/prerequisites/#air-gapped-development"><strong>Mendix</strong> documentation</a>:</p><pre><a href="https://docs.mendix.com/refguide/mobile/getting-started-with-mobile/prerequisites/#air-gapped-development">https://docs.mendix.com/refguide/mobile/getting-started-with-mobile/prerequisites/#air-gapped-development</a></pre><p>If you have <strong>Studio Pro</strong> open, please close it. Then, install the tool latest.exe as usual:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/380/1*qT16PRUQZU9sJ9zZ7Sxfvg.png" /><figcaption>Native Builder UI re-installation</figcaption></figure><p>Finally, after installation, execute <strong>Studio Pro</strong> and hopefully, you will be able to use <strong>Native Builder UI</strong> again by clicking on the <strong>Build Native Mobile App</strong> menu item!</p><figure><img alt="Build Native Mobile App is enabled again!" src="https://cdn-images-1.medium.com/max/314/1*imHOrNOrkfAyBcRGUhxKAQ.png" /><figcaption>Build Native Mobile App is enabled again 🎉🥳!</figcaption></figure><h4>References</h4><ul><li><a href="https://docs.mendix.com/refguide/mobile/getting-started-with-mobile/prerequisites/">Native App Prerequisites and Troubleshooting</a></li><li><a href="https://docs.mendix.com/refguide/navigation/">Navigation</a></li><li><a href="https://docs.mendix.com/refguide/mobile/distributing-mobile-apps/building-native-apps/native-template/">Native Template</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a00c9326b8af" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Configure a Custom Splash Screen in a Mendix PWA Application]]></title>
            <link>https://vstram.medium.com/how-to-configure-a-custom-splash-screen-in-a-mendix-pwa-application-89849d235b02?source=rss-29a6ebd5b2d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/89849d235b02</guid>
            <category><![CDATA[splash-screen]]></category>
            <category><![CDATA[mendix]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[pwa]]></category>
            <dc:creator><![CDATA[Vinicius Strugata Ambrosio]]></dc:creator>
            <pubDate>Wed, 30 Oct 2024 00:34:38 GMT</pubDate>
            <atom:updated>2024-10-30T00:34:38.576Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*-0pxykUanbW1U1-p9VGYNg.jpeg" /><figcaption>An arbitrary AI image just here to illustrate the article!</figcaption></figure><p>A PWA Application is in essence a traditional web app packed as a mobile or desktop application. Indeed, PWA runs on an application shell provided by your browser. The big advantage is that PWA applications can be distributed outside the app stores (<strong>Google Play</strong> and <strong>Apple Store</strong>). However, there are some challenges when developing PWAs. One of them is related to the splash screen. This article will show you how to configure a simplified splash screen for your <strong>Mendix</strong> <strong>PWA Application</strong>.</p><h3>Procedure</h3><ul><li>[1] Open Studio Pro and create a new project from the Blank Web App template. Give it a name and enable the online services so that your project can be committed to the TeamServer and deployed to the <strong>Mendix</strong> Free App Environment. To test the PWA splash screen, the app must be deployed.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*EfFATUvKYJX-eDp5RIYXFQ.png" /><figcaption>Creating a Mendix Web Application from the Blank Web App template</figcaption></figure><ul><li>[2] Every <strong>Mendix</strong> Web application can be turned into a PWA application. Click on the <strong>App/Navigation</strong> item in the <strong>App Explorer</strong> panel and turn on the <a href="https://docs.mendix.com/refguide/mobile/introduction-to-mobile-technologies/progressive-web-app/#enabling-pwa-features">options related to the PWA</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*ZF0k8HUHI4Ahw5A71t_rcw.png" /><figcaption>Turning on the PWA options in the Responsive Web Navigation profile</figcaption></figure><ul><li>[3] To see your PWA application default configuration, click on the Publish button to deploy the app in the Mendix Free App. Notice the button <strong>Install Mendix app</strong> at the toolbar.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*fRUAgDaN2eaYmatgjLRxxw.png" /></figure><ul><li>[4] <strong>Mendix</strong> automatically defines a default <strong>mx</strong> logo for you so that you can identify your app in the Start Menu, Desktop, or Taskbar. In addition, the default splash screen is a blank screen that remains for a few instants before your application’s Home page. Click on the <strong>mx</strong> shortcut on the Taskbar to see for yourself.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*ezXdNUwK25Zkil8r8fJQ4Q.gif" /><figcaption>PWA running on Microsoft Edge shell</figcaption></figure><ul><li>Let’s configure the splash screen. For this procedure, we will not change the code. The goal is only to define the Splash Screen. To do this, we must change a file called manifest-overrides.webmanifest.json. This file contains some settings that override the file manifest.json, which indeed controls the PWA behavior. See more details at this link: <a href="https://web.dev/articles/add-manifest">Add a web app manifest</a>.</li><li>[5] First, we need to create an icon. This icon will appear in the Start Menu, Desktop, Taskbar, and also in the center of our Splash Screen. Let’s try this prompt on <a href="https://www.bing.com/images/create?FORM=IRPGEN">Bing Image Creator</a>:</li></ul><pre>A modern logotype of the Mendix LowCode company showing only the text &#39;mx&#39; <br>in lowercase, using the colors darkblue and white</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*wj2bz9YnVMyZnffi_ptMzQ.jpeg" /><figcaption>Mendix Logo created by the Bing’s Artificial Intelligence tool</figcaption></figure><ul><li>[6] Edit the file manifest-overrides.webmanifest.json located in [your projects_folder]\mx_splashpwa\theme\web. This file contents should resemble as below:</li></ul><pre>{<br> &quot;short_name&quot;: &quot;MxSplashPWA&quot;,<br> &quot;name&quot;: &quot;Mx Splash PWA&quot;,<br> &quot;background_color&quot;: &quot;#021E43&quot;,<br> &quot;icons&quot;: [<br>  {<br>   &quot;src&quot;: &quot;/images/mx-logo.jpg&quot;,<br>   &quot;type&quot;: &quot;image/jpeg&quot;,<br>   &quot;sizes&quot;: &quot;512x512&quot;<br>  }<br> ]<br>}</pre><ul><li>[7] However, if you try to run your PWA using the <strong>Edge</strong> shell, you’ll get the result below:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*BCzZnzTDRc1v6j84bvAAaQ.gif" /><figcaption>Oops, it seems that the Splash Screen doesn’t work on Windows Desktop 😢</figcaption></figure><ul><li>It seems that our Splash Screen almost worked on <strong>Edge</strong>. The background_color, name and short_name were applied, but the icon was only applied in the shortcuts. As expected, a similar result also occurs on <strong>Chrome</strong>.</li><li>[8] Let’s create a <strong>Phone Web</strong> navigation profile and test the application on <strong>Android</strong> and <strong>IOS</strong> to see if the Splash Screen configuration works. Go to <strong>Navigation</strong> and add a new navigation profile by clicking on the <strong>Add navigation profile</strong> button:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*iRuveos3pKYHZgVBAcUokg.png" /></figure><ul><li>[9] After installing the PWA on an <strong>Android</strong> device, we can confirm that the icon was properly configured. And, after executing the app, we finally can see the splash screen!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*ZP24Mo6L_yxdVAfKc0Wxkw.gif" /><figcaption>Mendix PWA application with the Icon and Splash Screen configured!</figcaption></figure><ul><li>I would try the same procedure on IOS. Since I don’t have an IOS device, but I do have a Mac mini, I intended to try with the IOS simulator. But unfortunately, the IOS simulator doesn’t have the Apple Store installed and the Safari Browser seems not to work with PWA applications 😢😢😢.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*jPQkzkj-fIUuytt3FcN4qg.gif" /><figcaption>Things are so easier on Android …</figcaption></figure><h3>Conclusions</h3><ul><li>Building <strong>PWA</strong> applications with <strong>Studio Pro</strong> is surprisingly easy. You just need to check on three checkboxes and ensure that your app is responsive (i.e. looks good on narrow screens).</li><li>If you are required to show a Splash Screen, you need to configure the manifest file as explained in the <strong>Procedure</strong> above.</li><li>With some UI/UX effort, your app will appear as good as a Native App. To give you an idea, the Uber mobile app is a PWA app!</li></ul><h3>References</h3><ul><li><a href="https://developer.mozilla.org/en-US/docs/Web/Manifest">Web app manifests | MDN</a></li><li><a href="https://web.dev/learn/pwa/web-app-manifest">Web app manifest | web.dev</a></li><li><a href="https://radixweb.com/blog/pwa-vs-native-apps">PWA vs Native Apps: What Should You Pick in 2024?</a></li></ul><p>If any of the readers have an IOS device with Chrome installed, you can try the PWA app after installing it on your device:</p><p><a href="https://mxsplashpwa-sandbox.mxapps.io/index.html?profile=Responsive">Mendix</a></p><p>To install a PWA on Android:</p><p><a href="https://support.google.com/chrome/answer/9658361?hl=en&amp;co=GENIE.Platform%3DAndroid">Use web apps</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89849d235b02" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hot Reload With Mendix]]></title>
            <link>https://vstram.medium.com/hot-reload-with-mendix-18da2ad8c246?source=rss-29a6ebd5b2d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/18da2ad8c246</guid>
            <category><![CDATA[hot-reloading]]></category>
            <category><![CDATA[mendix]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Vinicius Strugata Ambrosio]]></dc:creator>
            <pubDate>Mon, 21 Oct 2024 01:22:06 GMT</pubDate>
            <atom:updated>2024-10-26T18:56:47.212Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x6DU3adRJf-k5F0e6_DAJA.png" /><figcaption>I swear I asked the AI ​​to generate an image about Hot Reload and I spelled it correctly!</figcaption></figure><p>The <strong>Mendix</strong> technology is well known for quickly delivering web applications through its drag-and-drop Integrated Development Environment(IDE): <strong>Studio Pro</strong>. There&#39;s a pre-configured style for every visual element you drag into your UI. But what if you need to customize the default appearance of a typical Mendix Application?</p><h3>UI Resource Theme Module</h3><p>When you create an application within <strong>Studio Pro</strong> using the <strong>Blank Web App </strong>template, you also receive a pre-defined set of style sheets that configure its look and feel. These style sheets are normally defined in the <strong>Atlas_Core</strong> and <strong>Atlas_Web_Content</strong> (and <strong>Atlas_Native_Mobile</strong>, if your project was created based on the <strong>Blank Native Mobile App</strong>). It’s possible to have more style theme modules, but these are the basis.</p><p>Such modules define the <strong>Mendix</strong> application visuals. There is a <strong>Figma Design Kit — </strong><a href="https://www.figma.com/community/file/1291681319513425134/mendix-atlas-ui-kit-widgets-and-layouts"><strong>Mendix Atlas UI KIT-Widgets and Layouts</strong></a><strong> </strong>— specifically designed to help front-end developers and designers create beautiful web applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*xzgTNH9yDytVTWFrZFp2Qw.png" /><figcaption>Figma Mendix Atlas UI Kit</figcaption></figure><p>If you are happy with the visuals defined by <strong>Atlas UI Kit</strong>, you are ready to go. Just change the basic colors and maybe the fonts and you’ll get an application able to be released in the market.</p><h3>Warm Reload - Using the Design Properties Panel</h3><p>I’ve mentioned that the UI Modules define a set of styles for your application. You can change the pre-configured style for a given UI element by modifying its properties in the <strong>Design Properties Panel</strong>. By using this panel, even a developer with minimal knowledge of SCSS can build good-looking web applications because all the styles are previously available in a UI Resource Theme Module (such as <strong>Atlas_Core</strong>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n4wl9BW_D4IjSbgEjvnN9w.gif" /></figure><p>By changing the properties directly in the panel, we’ve got a kind of Warm Reload, since we still <em>need to run the application</em> in <strong>Studio Pro</strong> to effectively apply the changes. It’s not bad, but it could be quicker…</p><p>In addition, the <strong>Design Properties Panel</strong> doesn’t show all the possible styling properties for a given widget, so sometimes a junior <strong>Mendix </strong>front-end developer gets stuck when creating the pages.</p><p>For example, how could you set the Home text style to italic? Such property isn’t defined in the <strong>Design Properties Panel</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/322/1*ELdE3CBPqTM9E0sNSb6toA.png" /><figcaption>Where can I set the font as Italic?</figcaption></figure><h3>Hot Reload — Custom StyleSheets</h3><p>One possible solution for this issue is to define custom style sheets and apply them to the desired widget. Below is the procedure:</p><ul><li>[1] In the App Explorer panel, open the main.scss file, located in the app/styling/web folder.</li><li>[2] Use the SCSS code below to define a style class called text-italic that defines the font as italic.</li></ul><pre>@import &quot;custom-variables&quot;;<br><br>.text-italic {<br>  font-style: italic;<br>}</pre><ul><li>[3] Select the Home text. In the <strong>Design Properties Panel</strong>, append the text-italic class to the Class text field.</li><li>[4] Save the project and hit the <strong>Run</strong> button. The Home text should be rendered using the font-style: italic setting.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*6Rf6yE3OTDfL6dr3KF8Ifg.png" /><figcaption>A custom style sheet required to set the font style as Italic</figcaption></figure><ul><li>[5] This procedure may seem a bit laborious, but you get a bonus as a reward: the real Hot Reload! Append a new style to the previously defined class to apply a border around the Home text and then save the main.scss file:</li></ul><pre>@import &quot;custom-variables&quot;;<br><br>.text-italic {<br>  font-style: italic;<br>  border: 1px solid black;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/1*PvrR1eQ5rBU8M8NmQCThlA.gif" /><figcaption>Hot Reload with Mendix — Via Custom StyleSheets!</figcaption></figure><h3>Comments</h3><ul><li>By defining the SCSS styles in a custom style sheet you get the benefit of the Hot Reload. OK, for small projects this does not seem to be a huge advantage, but for bigger projects, it may save you some time.</li><li>In addition, if you are proficient in SCSS, you can achieve results that are not easily possible by using the <strong>Design Properties Panel </strong>exclusively.</li><li>It’s possible to define the font-italic as a setting to be configured in the <strong>Design Properties Panel</strong>. To do so, you need to edit a JSON file that instructs the panel to set the italic as font style. See more details in the <strong>Mendix </strong>Docs:</li></ul><p><a href="https://docs.mendix.com/apidocs-mxsdk/apidocs/design-properties/">Design Properties API</a></p><ul><li>Does the Hot Reload also work in Native Mobile? Kind of … If you follow a similar procedure in a Native Mobile Project in <strong>Studio Pro</strong>, you only get the styling results applied to your application after rerunning the project, as opposed to <strong>ReactNative</strong> or <strong>Flutter</strong>, which is only needed to save the file to apply the changes.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*lGjONm-g1BTYtXphQ5P3Gg.gif" /><figcaption>Mendix Native: Warm Reload (need to run the project to apply the changes)</figcaption></figure><ul><li>But if you do a three-finger gesture on the app, it will reload with the saved changes.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*Is6LfKFfaU-qqa7Gcf2tmw.gif" /><figcaption>Three-finger gesture to achieve (almost) the Hot Reload on Mendix Native</figcaption></figure><ul><li>It is worth mentioning that Hot Reload works with PWA applications as well.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18da2ad8c246" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>