June 2016

By default, JetBrains products (IntelliJ, WebStorm, etc) products default to a very small minimum (128 MB) and maximum (750 MB) Java Heap Space:

➜  ps aux | grep -i webstorm 
..
nick     22103  383  2.7 6838044 901056 .. /usr/lib/jvm/default/bin/java -agentlib:yjpagent-linux64=disablealloc,delay=10000,sessionname=WebStorm2016.2 -Xbootclasspath/a:/opt/webstorm-eap/bin/../lib/boot.jar -classpath /opt/webstorm-eap/bin/../lib/bootstrap.jar:/opt/webstorm-eap/bin/../lib/extensions.jar:/opt/webstorm-eap/bin/../lib/util.jar:/opt/webstorm-eap/bin/../lib/jdom.jar:/opt/webstorm-eap/bin/../lib/log4j.jar:/opt/webstorm-eap/bin/../lib/trove4j.jar:/opt/webstorm-eap/bin/../lib/jna.jar -Xms128m -Xmx750m -XX:ReservedCodeCacheSize=240m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -XX:MaxJavaStackTraceDepth=-1 -Dawt.useSystemAAFontSettings=lcd -Djb.vmOptionsFile=/opt/webstorm-eap/bin/webstorm64.vmoptions -XX:ErrorFile=/home/nick/java_error_in_WEBIDE_%p.log -XX:HeapDumpPath=/home/nick/java_error_in_WEBIDE.hprof -Djb.restart.code=88 -Didea.paths.selector=WebStorm2016.2 -Didea.platform.prefix=WebStorm com.intellij.idea.Main
..

Depending on the amount of memory (RAM) available on one’s machine, it may be desirable to bump up these values by simply modifying the appropriate *vmargs file. This will depend on one’s installation directory, which will vary by operating system. For me, running sudo vim /opt/webstorm-eap/bin/webstorm64.vmoptions and updating my JVM args as reflected below

-Xms8g
-Xmx24g
-XX:ReservedCodeCacheSize=1024m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-XX:MaxJavaStackTraceDepth=-1
-Dawt.useSystemAAFontSettings=lcd

My machine has 32 GB of RAM, so much higher values were appropriate. I also bumped up the value for ReservedCodeCacheSize which has a maximum allowed value of 1024m. I will need to re-start WebStorm after making this change to the webstorm64.vmoptions file, but I should now see these parameters reflected in the running webstorm process that I can check as shown above in the initial step.

Webby allows the creation of web apps, similar to “Chrome Apps”, but does not run on Google Chrome or Chromium and uses less resources natively on Linux. It provides a simple interface for creating an viewing your Webby apps:
Webby web apps

On Arch Linux, Webby can be installed through the AUR:

 
➜  yaourt webby 
1 aur/webby-browser-bzr r9-1 [installed: r17-1] (2) (0.01)
    A webapp browser.
==> Enter n° of packages to be installed (ex: 1 2 3 or 1-3)
==> -------------------------------------------------------
==> 1

See also an external blog on installing Webby on Ubuntu Linux. Note that Webby depends on GTK3+, so this may introduce dependency conflicts on Ubuntu.

There are a number of solutions available for accessing an Android device remotely from a computer. Mobizen is available for Android through Google Play. In particular,

  • it does not require root
  • it does not require a wired connection
  • it does not require to be on the same network as the device accessing it
  • it is free
  • it supports not only remote screen access, but also many other features, including transferring files between your Android and the remote computer

Some notable disadvantages are:

  • it appears to no longer support USB connections
  • depending on the quality of the network, performance and quality will vary greatly
  • sound cannot be played remotely
  • reliability, responsiveness and frequency of disconnection


By default, a machine will be assigned two different IP addresses if connected via multiple interfaces (i.e. wireless and wired ethernet). Here is an example on a MacBookAir connected to the same router as such:

 
➜  ~ ifconfig
en0: flags=8823<UP,BROADCAST,SMART,SIMPLEX,MULTICAST> mtu 1500
	ether 48:d7:05:bc:91:11
	nd6 options=1
	media: autoselect ()
	status: inactive
en4: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	options=10b<RXCSUM,TXCSUM,VLAN_HWTAGGING,AV>
	ether 98:5a:eb:d3:b9:b9
	inet6 fe80::9a5a:ebff:fed3:b9b9%en4 prefixlen 64 scopeid 0x9
	inet 192.168.0.113 netmask 0xffffff00 broadcast 192.168.0.255
	nd6 options=1
	media: autoselect (1000baseT <full-duplex,flow-control,energy-efficient-ethernet>)
	status: active

To change this, open System Preferences -> Network -> Thunderbolt Ethernet, and change Configure IPv4 to Using DHCP with manual address. Enter in the current IP address for the first network interface used. Then repeat the same for that interface too, so that when DHCP re-assigns these addresses (either after connection is re-initialized, or the DHCP assignment expires, if your router is not configured to assign IP addresses permanently.

If you run the ifconfig command after applying the new configurations, you should see that the IP address assigned for both interfaces is the same.

en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	ether 48:d7:05:bc:91:11
	inet6 fe80::4ad7:5ff:febc:9111%en0 prefixlen 64 scopeid 0x4
	inet 192.168.0.100 netmask 0xffffff00 broadcast 192.168.0.255
	nd6 options=1
	media: autoselect
	status: active
en4: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	options=10b<RXCSUM,TXCSUM,VLAN_HWTAGGING,AV>
	ether 98:5a:eb:d3:b9:b9
	inet6 fe80::9a5a:ebff:fed3:b9b9%en4 prefixlen 64 scopeid 0x9
	inet 192.168.0.100 netmask 0xffffff00 broadcast 192.168.0.255
	nd6 options=1
	media: autoselect (1000baseT <full-duplex,flow-control,energy-efficient-ethernet>)
	status: active

Firefox 47.0 was officially released yesterday. I usually wouldn’t comment too much on a browser version release, but this costed me several hours of thorough investigation. Some Selenium scripts written in python which I have been using regularly abruptly stopped working, and given the number of interactions between python 3.x, Firefox, and one’s setup and environment, I did not come to think initially that this was the source of the problem.

➜  thePlatform python get-auth-token.py      
Traceback (most recent call last):
  File "get-auth-token.py", line 6, in 
    driver = webdriver.Firefox()
  File "/usr/lib/python3.5/site-packages/selenium/webdriver/firefox/webdriver.py", line 81, in __init__
    self.binary, timeout)
  File "/usr/lib/python3.5/site-packages/selenium/webdriver/firefox/extension_connection.py", line 51, in __init__
    self.binary.launch_browser(self.profile, timeout=timeout)
  File "/usr/lib/python3.5/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 68, in launch_browser
    self._wait_until_connectable(timeout=timeout)
  File "/usr/lib/python3.5/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 98, in _wait_until_connectable
    raise WebDriverException("The browser appears to have exited "
selenium.common.exceptions.WebDriverException: Message: The browser appears to have exited before we could connect. If you specified a log_file in the FirefoxBinary constructor, check it for details.

A useless message. I downgraded to the “firefox-esr” (45.2.0-1) version available in the AUR, and my scripts worked perfectly again. For those not using Arch Linux, one can always downloaded past released versions from Mozilla’s website. Simply go to all Firefox downloads for your desired language/locale, but instead of clicking on the download link for your platform, copy the download location instead; simply change the version of 47.0 to 45.0 and you’ll have a Selenium-compatible version of Firefox once again. 🙂

Note that it is entirely possible to have multiple instances of Firefox installed on one’s machine.

  1. Type about:config in the address bar.
  2. Search for dom.ipc.processCount and enter in the the number of concurrent processes you wish to allow (I have 8 virtual CPU cores and opted to use 8 processes, though this does not need to be based on the number of cores your machine has).

Assuming you have plank installed and running on your Linux distro, you may wish to add an additional dock.

  1. First check your plank configuration directory to see the name/location of your existing dock:
    ➜  plank ls -la ~/.config/plank
    total 16
    drwxr-xr-x   4 nick nick 4096 Jun  1 12:47 .
    drwx------ 113 nick nick 4096 Jun  1 17:16 ..
    drwxr-xr-x   3 nick nick 4096 May 19 10:50 dock1
    drwxr-xr-x   3 nick nick 4096 Jun  1 12:47 dock2
    
  2. Run the following command, assuming you want to label your second dock as dock2:
    plank -n dock2 --preferences

    The preferences dialog will appear allowing you to customize your second dock.

  3. Since you’ll probably want to automatically start up your second dock, you can do so by either running this command manually, or setting it to be called when your desktop environment starts up:
    plank -n dock2