With a number of different screen sizes and resolutions you can not rely on static pixel size alone. That is where Android uses dips, or Density Independent Pixels. The combination of screen size and resolution is measured in Dots Per Inch, that is, how many pixels can you fit on one inch ?

Each device falls into one of these categories:

Screen Shot 2015-09-11 at 23.12.50

When you read the Android developer guidelines on images you will see that Google always refers to dp when describing image sizes. To calculate the pixel size based on dpi you can use this conversion table :

Screen Shot 2015-09-11 at 23.15.03

What this means,- the pixel density on a XXXHDPI screen is four times higher than the pixel density on a MDPI device.

If you want to create a 48p sized icon the actual size in pixels is 48 pixels on a MDPI screen and 192 pixels on a XXXHDPI screen.

This might not be that useful to know by itself, but my next blog post will be about 9-patch images and knowing your dip is always a good start.

  1. Insert a USB key in the system.
  2. Open a command prompt.
  3. Use diskpart.exe to format the USB key as a single FAT32 partition spanning the entire key, and set the partition to active, as shown in this example.
    • diskpart
    • list disk (note what disk the USB drive is. In this example it is Disk 2…I)
    • select disk 2
    • clean
    • create partition primary
    • select partition 1
    • active
    • format fs=fat32 quick
    • assign
    • exit
    • Copy files from ISO to the USB key.

For NTFS bootable USB drives there are some additional steps.

  1. Follow the steps above, but when formatting use format fs=ntfs quick.
  2. Remount the USB key if diskpart ejects it.
  3. Insert a Windows Operating System installer ISO image.
  4. Open a command prompt as Administrator and navigate to the boot folder (mine ISO is mounted in J:) J:\boot>
  5. bootsect /nt60 G: (where G: is the drive letter of your USB key). You should see something like this:
    J:\boot>bootsect.exe /nt60 G:
    Target volumes will be updated with BOOTMGR compatible bootcode.

    G: (\\?\Volume{db89f4a5-faa0-11e4-825a-989096b10a0c})

    Successfully updated NTFS filesystem bootcode.

    Bootcode was successfully updated on all targeted volumes.

When creating a custom SSLSocketFactory or modifing the application in any other way is not an option

This example uses a Tomcat server listing for HTTPS connections on port 8443 but should work anywhere.

Retrieve the public key:

$openssl s_client -connect localhost:8443, then create a file localhost.pem that looks like

BEGIN CERTIFICATE-----
lklkkkllklklklklllkllklkl
lklkkkllklklklklllkllklkl
lklkkkllklk
END CERTIFICATE

Import the key:

#keytool -import -alias localhost-selfsigned -keystore $JAVA_HOME/jre/lib/security/cacerts -file localhost.pem

When promted for password, write changeit

Restart JVM / Application server instance.

References: http://stackoverflow.com/questions/859111/how-do-i-accept-a-self-signed-certificate-with-a-java-httpsurlconnection

Ever created a lot of nice group policy items and come back to them a year or two later and think “Well where did I apply that firewall rule?” or “Where do I set up servers as Remote Desktop Session hosts?” ?

Powershell saves the day once again.

On a Domain Controller, import the AD Group Policy module

Import-Module GroupPolicy

Then,

Get-GPO -All | ForEach-Object {Get-GPOReport -Guid $_.Id -Path ($_.DisplayName + ".html") -ReportType HTML}

This gives you a nice collection of HTML files in the folder where you executed the script. They will contain the defined elements of your Group Policy item.

This tip is mostly useful in you have large generic GP items like “Windows Server” or “Customer Server”. I have learnt to keep my GP items simple-stupid, like “Firewall Allow TCP 80 Inbound” or “Allow Remote Desktop Connections”

Sometimes you just want a new firewall rule, you know that it doesn’t conflict with anything else and you want it simple.

The solution ? Powershell. Many other pages explain the powershell commands for managing the firewall in detail. For me, that made it harder to memorize what I was actually looking for, so I had to look it up the next time as well. So I decided to write down the simplest of all on this page.

This command will create a new firewall rule allowing incoming TCP connections on port 80 for all profiles:

New-NetFirewallRule -Name allowTcp80 -DisplayName "Allow Inbound Port 80" –LocalPort 80 -Protocol TCP

If you omit -Name a GUID will be assigned as the rule name. When you create a name yourself, it will be easier if you want to do more management from Powershell.

RabbitMQ installation is pretty straightforward except that the data folder is by default located in the User folder of the user performing the uninstall. When user accounts are purged once in a while and all user data are deleted you will also loose your entire RabbitMQ configuration.

Not cool… fortunately, this is easy to configure

So, to start with, grab the latest RabbitMQ installer from http://www.rabbitmq.com/install-windows.html and follow the instructions, install Erlang VM if required.

Choose to install as a Windows Service. When installation is complete, go to services.msc and stop the service.

Now, set up some environment variables, pick a suitable name for you base directory. In my case I use MY_RABBITMQ and point it at E:\rabbitmq. Do not prefix you variable with RABBITMQ_ as it may interfere with RabbitMQ.

System variables:

MY_RABBITMQ=E:\rabbitmq
RABBITMQ_BASE=%MY_RABBITMQ%\base
RABBITMQ_CONFIG_FILE=%MY_RABBITMQ%\rabbitmq
RABBITMQ_LOG_BASE=%MY_RABBITMQ%\logs
RABBITMQ_MNESIA_BASE=%MY_RABBITMQ%\mnesia_base

See http://www.rabbitmq.com/configure.html#customise-windows-environment for more info on RabbitMQ Environment variables.

Now you need to reinstall the RabbitMQ service, as the default paths were set during installation. When you reinstall the RabbitMQ service it will use you newly set environment variables.
1. Create the folder (E:\rabbitmq).
2. Run RabbitMQ Command Prompt as Administrator.
3. If you shell doesn’t point you there directly, go to the sbin folder of you installation (Default C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-x.x.x\sbin on 64-bit operating systems).
4. Run “rabbitmq-service install” (without the quotes). This will also start your service.
5. Install the web management console (requires a service restart).
6. Point your browser to http://localhost:15672 and log in as guest/guest to validate your installation (see how E:\rabbitmq is populated as you go)

C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.3.5\sbin>rabbitmq-service install
Creating base directory E:\rabbitmq\base
RabbitMQ service is already present - only updating service parameters

C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.3.5\sbin>rabbitmq-plugins enable rabbitmq_management
The following plugins have been enabled:
mochiweb
webmachine
rabbitmq_web_dispatch
amqp_client
rabbitmq_management_agent
rabbitmq_management
Plugin configuration has changed. Restart RabbitMQ for changes to take effect.

C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.3.5\sbin>rabbitmq-service stop
C:\Program Files\erl6.1\erts-6.1\bin\erlsrv: Service RabbitMQ stopped.

C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.3.5\sbin>rabbitmq-service start
C:\Program Files\erl6.1\erts-6.1\bin\erlsrv: Service RabbitMQ started.

Done !

Note: If you want to make changes to the RabbitMQ configuration file, the active configuration file override is now located at E:\rabbitmq\rabbitmq.config. It is not created by default. RabbitMQ ships with an example config file you may implement your changes in.

C:\>copy "Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.3.5\etc\rabbitmq.config.example" E:\rabbitmq\rabbitmq.config
1 file(s) copied.

Follow

Get every new post delivered to your Inbox.