How to force show the JavaScript console on Adobe Acrobat Standard/Pro


If you need the JavaScript console and the “Ctrl + J” shortcut does not work on your Acrobat (Standard or Pro), even though you activated it from the preferences menu, follow these steps to force it open.

Create a plain text file with the following code “console.show();” and call it “show console.js”.

If you are on a PC:
Place the above script in the folder called “Javascripts” from the installation folder of your Acrobat, usually  C:\Program Files (x86)\Adobe\Acrobat 10.0\Acrobat\Javascripts

If you are on a Mac:
Open up your Acrobat app by right clicking and picking “Show Package Contents”, navigate to Contents/Resources/JavaScripts and put the script there.

Restart your Acrobat and the console will open.

Using this file, the console will pop open every time Acrobat runs.

How to copy folder structure without files in Windows


If you need to copy directory structures in windows, you need to use Robocopy. Robocopy stands for “Robust file copy.” It’s a standard feature for Windows starting with Vista. It can also be installed in WinXP as part of the Windows Resource Kit.

To use Robocopy to clone a directory without files, use the following syntax in a Command Prompt (cmd.exe):

robocopy "C:\Your Folder" "C:\New Folder" /e /xf *

same as above but without displaying the status:

robocopy "C:\Your Folder" "C:\New Folder" /e /xf * >null

same as above and creates a log (overwrites existing log):

robocopy "C:\Your Folder" "C:\New Folder" /e /xf * /log:yourlogfile.log

same as above and appends to log (appends to existing log):

robocopy "C:\Your Folder" "C:\New Folder" /e /xf * /log+:yourlogfile.log

/e = Copies subdirectories, including empty ones.
/xf = Excludes files matching the specified names or paths.
Wildcards “*” and “?” are accepted.
Additional Robocopy commands can be found here.

How to test if a checkbox is selected in Adobe Livecycle Designer dynamic form


Here is a simple way to get the status of a Check Box (to know if a Check Box is ticket or not) in a dynamic form created with Adobe Livecycle Designer.

/**
 * @param {Object} elemetToCheck The element you want to check
 * @return {Boolean} true if is ticked; false if it's not ticked
 */
function isTicked(elemetToCheck) {
    return (elemetToCheck.rawValue == elemetToCheck.items.nodes.item(0).value) ? return true : return false;
}

The first element in the condition (elemetToCheck.rawValue) gets the current value of the Check Box, which can be either the value you wrote in On value or Off value.

2014-08-28_123901

The second element in the condition (elemetToCheck.items.nodes.item(0).value) gets the value which you wrote in the On Value (in this example is “THEM-OTH”).

Usage (example)

If you have a list of Check Boxes and the last one is “Other” and you need to show a Text Field for the user to write his data, here is how you can do it:

In the ::change event of the checkbox “Other” you put the following script:

if(isTicked(this)) {
    //explainTextField is the name of the Text Field you want to show or hide
    explainTextField.presence = "visible";
} else {
    explainTextField.presence = "hidden";
}

Please check here my article on different ways of hidding and showing parts of a dynamic form.

How to activate SWAP on Asus RT-AC68U router


To enable linux SWAP on your Asus RT-AC68U router you need the following:

  • Custom firmware with jffs partition enabled (I recommend Asuswrt-Merlin build);
  • an USB HDD or USB flash drive to mount on one of your router’s USB ports.

Using a swap file

To enable swapping using a swap file you need to first create the file, prepare it for swapping and then enable the swapping on it. First of, make sure the file system the disk you wish to swap on is properly mounted. If you chose labels for the partitions, use them instead of sda1, sda2, sdb1, etc.

#check how the disk was mounted
ls -l /tmp/mnt

For the purposes of this tutorial we will assume the disk is mounted as /tmp/mnt/sda1/ and we want to use the file /tmp/mnt/sda1/myswap.swp for swapping.

#create a 256MB swap file ("count" is in Kilobytes)
dd if=/dev/zero of=/tmp/mnt/sda1/myswap.swp bs=1k count=262144

#set up the swap file
mkswap /tmp/mnt/sda1/myswap.swp

#enable swap
swapon /tmp/mnt/sda1/myswap.swp

#check if swap is on
free

If you reboot your router, the swap will be inactive until you swapon again. To do this automatically you have to create the file /jffs/scripts/post-mount, or edit it if exists and add the line:

#!/bin/sh
swapon /tmp/mnt/sda1/myswap.swp

Now every time the router reboots, it will turn on swap.

Using a swap partition

This method is not recommended if using USB storage with multiple partitions.

  1. Using your computer, create a linux-swap partition on your disk that will be mounted on the router. You can use GParted for linux, MiniTool Partition Wizard Home Edition for Windows or Disk Utility for MacOS;
  2. Connect the formatted drive to router and in PuTTY terminal use command fdisk -l to see how it was mounted. Let’s asume it is mounted as sda1;
  3. Again in PuTTY terminal use command swapon /dev/sda1 and then free to see if swap is correctly activated;
  4. If swap is correctly activated, use the script /jffs/scripts/post-mount with the command swapon /dev/sda1 as mentioned above.
#!/bin/sh
swapon /dev/sda1

Warning!

Do not use SWAP (partition or file) on a device which goes to hibernation or does spin-down. You might make the router more unstable than without using SWAP.

Be sure you deactivate spin-down on the device which you want to use for SWAP.

Spin-down settings on ASUS router powered by Asuswrt-Merlin

Spin-down settings on ASUS router powered by Asuswrt-Merlin

There are some devices, like the Western Digital USB HDDs WD Elements, My Book or My Passport which have their own power management and will not be affected by the settings on the router and they will spin-down if data is not read or written for some time. I recommend to avoid this kind of devices for SWAP.

Info source:
http://www.dd-wrt.com/wiki/index.php/Linux_SWAP

Useful applications and Optware packages that I run on my Asus RT-AC68U router


This is a list of scripts and Optware packages I am currently running on my Asus RT-AC68U router:

  • nano – pico like text editor (ipkg install nano)
  • vim – text editor (ipkg install  vim)nano is easier to use
  • htop – an interactive process viewer (ipkg install htop)
  • atop – a better top with history monitoring (ipkg install atop)htop works better and offers more information
  • mc – Midnight Commander File Manager (ipkg install mc)
  • transmission – Lightweight BitTorrent client and daemon, with web interface bundled (How to install transmission for Optware on Asus RT-AC68U router)

These scripts and Optware packages I am planning to install:

  • Adblocking script
  • P2Partisan mass IP blocking script
  • Ipkg-web utility too much of a mess to set it up. It will break more then it will fix.
  • Syslog-ng utility (+ libol support library) + logrotate; cannot be used with RT-AC68U, as the default syslogd cannot be deactivated.
  • metalog – Modern, highly configurable syslogd replacement; cannot be used with RT-AC68U, as the default syslogd cannot be deactivated.

A list of all Optware packages, sources and dependencies (not all of them are useful or compatible with RT-AC68U).

How to configure the BBox-2 modem (Sagem F@st 3464) in bridge mode


If you are living in Belgium and you have internet from Belgacom, Scarlet or EDPNET, you might be the (un)happy user of their VDSL2 modem called BBox-2, which is actually a Sagem F@st 3464 in a different case.
It is using a PPPoE connection to get the dynamic WAN IP. Belgacom is usually updating the IP once every 3 days.

BBox-2 VDSL2 modemSagem F@st 3464 VDSL2 modem

If you have your own router, or you are planning to buy one and you need features like Dynamic DNS, port forwardingVPN server, FTP or other types of home-hosted servers, you need to bypass the modem’s wan connection by putting it in bridge mode and make the PPPoE connection directly on your router. In this post I will refer to BBox-2 as “the modem” and your own router as “the router”.

Preparatory steps:

  1. Connect your router’s WAN port to the BBox-2 modem’s 1st LAN port (PC1);
  2. The modem’s DHCP server starts to assign IPs starting with 192.168.1.2, so you need to check the configuration of your router’s LAN DHCP server to be different (for example set IP Pool Starting Address to 192.168.2.2 and IP Pool Ending Address to 192.168.2.254);
  3. Set your router to have a static WAN ip and set it to 192.168.1.2. At this moment if you try to connect to the web interface through your browser, at 192.168.1.1 will be the modem and at 192.168.1.2 will be your router. This way you will be able to have access to the modem after you set it up as bridge;
  4. [Optional] Deactivate your BBox2’s WiFi if you don’t need it;
  5. Keep your PPPoE internet connection credentials close. (ex: un1234@BELGACOM).

Steps to make the modem work in bridge mode:

  1. Connect to your BBox-2 through your browser (192.168.1.1);
  2. Go to Advanced Settings and then select Network Interfaces;
  3. Select Wan PPPoE, click on Disable button, then OK;
  4. Select Wan PPPoE again, go to Settings > Underlying Connection and select LAN Bridge;
  5. Delete the username (Login User Name (case sensitive)) to stop the modem retry to connect every 30 seconds;
  6. Uncheck “Internet Connection Firewall” and click Apply; (the modem might reboot)
  7. Connect to your router through your browser (192.168.1.2);
  8. Change the WAN connection type from Static IP to PPPoE and write the username and password provided by your internet provider. The router will connect to internet and will get the IP provided by your ISP.

You are now able to set-up dynamic DNS directly on your router (BBox-2 modem works only with DynDNS which is not free any more) and forward ports to your self-hosted services.
Other services like Belgacom TV and I-Talk should continue to work.

Here are two schemas of “before” and “after” setting the modem in bridge mode:

BBox-2 in bridge mode schema

BBox-2 in bridge mode schema

Info sources:
http://wiki.yobi.be/wiki/Modem_BBox-2
http://patrick.vande-walle.eu/belgacom-bbox-2-tricks/bbox-2-in-bridge/
http://carroarmato0.wordpress.com/2010/06/20/how-to-bridge-the-lan-ports-of-your-belgacom-bbox2/
http://bgctv.skynetblogs.be/#bbox2-modem-only