web log

Generating an SSL keystore for a website

First download the website’s certificate from Firefox:

View Page Info > Security > View Certificate > Details > Export >
...\jre1.6.0_33\lib\security\website.crt

Then generate the keystore:

$ cd ...\jre1.6.0_33
$ bin\keytool.exe -noprompt -import -keystore website.keystore -alias website -file lib\security\website.crt
Enter keystore password:
Re-enter new password:
Certificate was added to keystore

Modal view controller on top of another

Sometimes you need to present a modal view controller on top of another view controller. The simplest way to achieve this is by targeting the visible view controller from the root navigation controller:

1
2
3
4
UINavigationController *passcodeNavigationVC = [[UINavigationController alloc] initWithRootViewController:passcodeVC];
UINavigationController *rootVC = (UINavigationController *) self.window.rootViewController;

[rootVC.visibleViewController presentViewController:passcodeNavigationVC animated:YES completion:^{}];

Getting JRE zip

  1. Download JRE Windows x86 Offline installer.
  2. Launch the installation, but stop when the first dialog is shown.
  3. Go to ~\Application Data\Sun\Java\jre1.6.0_33.
  4. Extract core.zip from Data1.cab with Winzip.

via @ben-tech

Keeping Groovy sources in IntelliJ IDEA

After reimporting Maven projects in IntelliJ IDEA, sometimes the Groovy sources are removed from the module settings. Here is how to fix this:

Settings > Maven > Importing > Keep source and test folders on reimport

Creating Java class file from byte array

1
2
3
4
5
6
7
8
9
10
byte[] classBytes = // ...

ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
byteArrayOutputStream.write(classBytes);

FileOutputStream fileOutputStream = new FileOutputStream("~\MyClass.class");
byteArrayOutputStream.writeTo(fileOutputStream);

fileOutputStream.flush();
fileOutputStream.close();