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')
Wednesday, March 7, 2018
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.
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);
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
Wednesday, October 18, 2017
Null safe expression in Thymeleaf
Using '?' after the variable in Thymeleaf expression, that variable will be null safe.
<td th:text="${user.department?.name}"></td>
For the avoid example, even variable department is null, the expression will still be fine.
Thursday, August 17, 2017
OpenLayers blurry map with ArcGIS tiles
Check this out:
https://github.com/openlayers/openlayers/issues/6430
Monday, June 5, 2017
Skip testing in Maven
To skip the unit testing in Maven, we need to set the environment variable "maven.test.skip" to true. Or we can use "-DskipTests"
Sample command:
Prompt> mvn package -Dmaven.test.skip=true
OR
Prompt> mvn package -DskipTests
Reference:
https://www.mkyong.com/maven/how-to-skip-maven-unit-test/
Sample command:
Prompt> mvn package -Dmaven.test.skip=true
OR
Prompt> mvn package -DskipTests
Reference:
https://www.mkyong.com/maven/how-to-skip-maven-unit-test/
Tuesday, May 16, 2017
Query windows patch via command line
To check if a windows patch (e.g. KB1234567) has been installed, run the following command line:
C:> wmic qfe | find "1234567"
C:> wmic qfe | find "1234567"
Thursday, December 22, 2016
KVM with NKRO keyboard
Most KVM (e.g. ATEN CS62U) won't compatible with NKRO (N-Key Roll Over) keyboard (e.g. Most mechanical keyboard are with NKRO).
So please pay more attention when purchasing a KVM for NKRO keyboard.
So please pay more attention when purchasing a KVM for NKRO keyboard.
Tuesday, August 23, 2016
git commands
There are some useful git commands:
Setup a repository:
git init --bare
Copy an existing repository:
git clone drive:
Add file to repository:
git add file
git commit
git push
Get updated files from repository:
git fetch
Merge updated files to my workspace:
git merge
Setup a repository:
git init --bare
Copy an existing repository:
git clone drive:
Add file to repository:
git add file
git commit
git push
Get updated files from repository:
git fetch
Merge updated files to my workspace:
git merge
Subscribe to:
Posts (Atom)
CSP on Apache
To add CSP to root if sort of funny. The following will NOT work for most cases !! <LocationMatch "^/$"> Header s...
-
When Office2003 couldn't find file SKU011.CAB: regedit -> [HKEY_LOCAL_MACHINE] -> [SOFTWARE] -> [Microsoft] -> [Office] -...
-
The resolution can be changed by editing the BlueStack's registry: HKLM\SOFTWARE\BlueStacks\Guests\Android\FrameBuffer\0\Height and ...
-
Suppose you got a file in Big5 containing some HKSCS characters (e.g. 深水埗, 赤鱲角, etc). When your environment (Ref: Charset.defaultCharset( ) ...