Tuesday, December 18, 2018

Spring Boot Application Properties List

The list of Spring Boot Application Common Properties:

Resources for jQuery i18n library

jQuery i18n is a handy library to provide multi-language for your web applications. Below are some useful references:

Inject git last commit id to SpringBoot project

1) Add git-commit-id-plugin in pom.xml

  <build>
  <plugins>
  <plugin>
      <groupId>pl.project13.maven</groupId>
      <artifactId>git-commit-id-plugin</artifactId>
      <executions>
          <execution>
              <goals>
                  <goal>revision</goal>
              </goals>
          </execution>
      </executions>
      <configuration>
          <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
          <includeOnlyProperties>
              <includeOnlyProperty>git.commit.id.abbrev</includeOnlyProperty>
          </includeOnlyProperties>
      </configuration>
  </plugin>
  ...
  </plugins>
  </build>


2) Get the value via Thymeleaf

   <head th:with="abbrev=${@environment.getProperty('git.commit.id.abbrev')}">

Sunday, August 19, 2018

Strange blue border in MapView of ArcGIS JS 4

Starting from ArcGIS JS 4.x, under some special conditions, the MapView will have a blue border when the MapView is focus, who genius get this geneless idea?

To get rid of this stupid box, style the following:

.esri-view-surface--inset-outline::after {   
    outline: none !important;
    padding: 0px !important;
}


So when this stupid design will come out? When ever your HTML got the following conditions, that stupid box will be shown when MapView is on focus:

body {
    margin: 0;


#mapDiv {
    width: 100%
}

... The most weird API ever encountered




Friday, July 20, 2018

Updating graphic in ArcGIS JS 4.x GraphicsLayer

Esri still don't have a clue on how to modify a graphic in GraphicsLayer directly at version 4.8.

You still need to clone the graphic, remove the existing one, and add the new one to realize the modification.

Ref:
https://developers.arcgis.com/javascript/latest/guide/functionality-matrix/index.html#graphicslayer

Stone age API.

Friday, April 27, 2018

Android: get resource ID from resource name

That's a nice resource:

https://stackoverflow.com/questions/3476430/how-to-get-a-resource-id-with-a-known-resource-name

Thursday, April 19, 2018

QEMU references

QEMU is a quick and clean solution for emulation. However, when compare to its alternatives like Virtualbox, it requires much more attention on its settings and tweak in order to get things work. The followings are some nice resources to make our life easier with that tool:

Wednesday, March 7, 2018

Map server URL with query parameters in ArcGIS JS 4.6

Starting from ArcGIS JS 4.6, the map server URL should not have any query parameters. Any query parameters exists in the map server URL will be removed.

To handle this issues, you can override the urlUtils.removeQueryParameters() as below


require(["esri/core/urlUtils"], function(urlUtils) {

   urlUtils.removeQueryParameters = function(a){
      return a;
   };

});

But somehow that's a bad trick. A better way is to use the TileLayer._set() to get rid of the parameters stripping action when setting the URL. i.e.

TileLayer._set('url', 'map_server_url')


Using Proxy with ArcGIS JS


For servers without CORS enabled. We can use proxy mechanism to access the services.

This is done by modifying the proxy.ashx.

You can also add any parameters before sending the request to the actual server.

More references could be found at:

https://developers.arcgis.com/javascript/latest/guide/proxies/index.html

Thursday, February 8, 2018

Windows file explorer cached hostname specified in hosts file

The 'hosts' file in Windows allows user to add hostname to IP entries. When you modify the entries in hosts, the file explorer might not reflect the changes immediately. This is because the mapping is already cached in the Workstation service.

Consider the following situation, you may hosts file with the following entry:

192.168.1.100   my_nas

Then you can use \\my_nas\share in the file explorer to view content in \\192.168.1.100\share. Next, you try to modify the entry as following:

192.168.1.101   my_nas

While the command ping my_nas tells you my_nas is now 192.168.1.101, but the file explorer cached the entry, hence \\my_nas\share still points to the old IP (i.e. 192.168.1.100).

To clear this cache, apart from rebooting the machine, user can consider to restart the "Workstation" service instead.




Tuesday, January 16, 2018

LineDashedMaterial in three.js

To use LineDashedMaterial in three.js:

var geometry = new THREE.Geometry();
geometry.vertices.push(new THREE.Vector3(590058.52, 231354.16, 766.42));
geometry.vertices.push(new THREE.Vector3(589941.68, 231476.67, 736.52));
geometry.vertices.push(new THREE.Vector3(589781.32, 231491.91, 757.73));
geometry.vertices.push(new THREE.Vector3(589711.88, 231445.56, 768.16));
geometry.vertices.push(new THREE.Vector3(589702.04, 231336.49, 772.91));
geometry.computeLineDistances();

let material = new THREE.LineDashedMaterial( {
    color: 0xff0000,
    linewidth: 1,
    scale: 1,
    dashSize: 5,
    gapSize: 3,
} );

let line = new THREE.Line(geometry, material);
scene.add(line);

Note: 
  • You need to call geometry.computeLineDistances() to make the dash work
  • computeLineDistances( ) only works with Geometry (Not work with BufferGeometry)
  • The linewidth has no effect in Windows, it is always equals 1

Sync multiple git repo at once

Use the following command in Linux will do the job:  ls -d RepoNames* | xargs -I{} git -C {} pull