Bypass FileVault 2 Login Screen

Posted: 1/5/2018 7:41 PM

By default, the FileVault 2 Login Screen comes up before the OS boots, preventing you from accessing it remotely via SSL or Screen Sharing.

Apple provides a utility that, when executed, will save your username and password in the system memory and use it one time (then clear it) to proceed past the FileVault 2 Login Screen.

Open Terminal and execute the following command. Be careful though, as it will cause an immediate reboot of the system (as though you used the shutdown command):

sudo fdesetup authrestart

After the reboot, your hard drive will be unlocked and you will be presented with the standard MacOS Login Screen (as though you do not have FileVault 2 enabled).

Not every Mac supports this command though. To find out if yours does, you can execute this command:

fdesetup supportsauthrestart

If the response is "true", then you're ready to reboot.

 

Encrypt an HFS+ Partition From the Terminal

Posted: 1/2/2018 7:21 PM

Use the following diskutil syntax to encrypt a partition on MacOS from the Terminal:

diskutil cs convert /Volumes/MyDrive -passphrase

You do not enter a passphrase on the command line, but rather you will be prompted for one.

 

Unsubscribe from Navigation Events

Posted: 12/13/2017 8:39 AM

I recently ran into a problem where an Angular Component was still responding to Navigation Events even after having navigated away from that route.

When subscribing to an Observable, be sure to store the subscription in a global variable and call the .unsubscribe() function when the component is being destroyed.

export class MyComponent implements OnInit, OnDestroy {

    constructor (private router: Router) { }

    // stores the subscription object
    navSubscription: Subscription = null;

    // called when the component is initialized
    ngOnInit() {
        this.navSubscription = this.router.events.subscribe((event: any) => {
            // test if the event is an end navigation
            if (event instanceof NavigationEnd) {
                // do something here
            }
        });
    }

    // called when the component is destroyed
    ngOnDestroy() {
        this.navSubscription.unsubscribe();
    }
}
 

Angular / Third Party Cookies

Posted: 11/8/2017 8:48 AM

When performing a GET or POST using Angular's HTTP service against a third-party server, returned cookies are, by default, not accepted by the browser.

To enable this, when calling your this.http.get() or this.http.post(), you need to add the option withCredentials and set it to true. This will allow your browser to accept any third-party cookies

 

Change Windows Network Connection to Private/Public

Posted: 8/20/2017 10:04 AM

Sometimes Windows will not correctly identify a network as public or private. To manually change the setting for a network connection, open a PowerShell prompt and execute:

PSH> Get-NetConnectionProfile

Name             : Network  2
InterfaceAlias   : Internet
InterfaceIndex   : 3
NetworkCategory  : Public
IPv4Connectivity : Internet
IPv6Connectivity : NoTraffic

Name             : Network
InterfaceAlias   : Local
InterfaceIndex   : 9
NetworkCategory  : Private
IPv4Connectivity : Internet
IPv6Connectivity : LocalNetwork

PSH> Set-NetConnectionProfile  -InterfaceIndex 3 -NetworkCategory Private

PSH> Set-NetConnectionProfile  -InterfaceIndex 3 -NetworkCategory Public
 

Join Angular Observables

Posted: 8/17/2017 4:11 PM

If you have multiple observables that you want to execute simultaneously, and be notified when they've completed, you use the Observable.forkJoin() function, passing it an array of Observables:

const observable1 = this.http.get('url1.html');
const observable2 = this.http.get('url2.html');

Observable.forkJoin([observable1, observable2]).subscribe(results => {
  const results1 = results[0]; // observable1 results
  const results2 = results[1]; // observable2 results

  this.processResults1(results1);
  this.processResults2(results2);
});
 

Add JAR to Local Maven Repository

Posted: 5/18/2017 6:48 PM

If you've obtained a JAR file that is not available in an existing Maven repository, you can add it to your local Maven repository with the following command. Make sure that all of your options are surrounded by double-quotes:

mvn install:install-file "-DgroupId=org.mozilla" "-DartifactId=jss" "-Dversion=4.2.5" "-Dpackaging=jar" "-Dfile=jss-4.2.5.jar"
 

Enable Hibernate SQL Logging in Grails

Posted: 5/18/2017 6:08 PM

It's often useful when debugging a Grails application to be able to see the exact SQL that is being executed in the database.

If you're using GORM, you can modify your /grails-app/conf/application.yml file with the following settings. Each Hibernate statement that is executed will be outputted to the standard console.

dataSource:
    logSql: true
    formatSql: true
 

Hibernate Error: @P0 Syntax Error

Posted: 5/18/2017 6:02 PM

Grails domain classes using GORM offer the dynamic finders Class.findByXXX() and Class.findAllByXXX(max: 123), which will retrieve 1 record and 123 records, respectively.

On SQL Server 2012 or higher, attempting to call one of these functions will throw a Hibernate error "Invalid syntax @p0". This is because you need to add an additional configuration option to your /grails-app/conf/application.yml file dataSource section:

dialect: org.hibernate.dialect.SQLServer2012Dialect
 

Use Environment Variables in application.yml

Posted: 5/14/2017 9:29 AM

A convenient method of configuring parameters in a Grails app application.yml file is to use system environment variables instead of hard-coding values.

The syntax for an environment variable is:

settingToUse: ${VARIABLE_NAME_GOES_HERE}
 

Custom-Named Grails WAR Files

Posted: 5/6/2017 2:22 PM

Gradle provides the ability to customize the name of the WAR file that is generated from the Grails war command.

Grails uses the war gradle plugin, which specifies the following pattern to create the archive name:

[baseName]-[appendix]-[version]-[classifier].[extension]

To customize the name of a generated WAR file, add a war {} closure to the end of the build.gradle file. To remove a property from the name (such as the version), set it to an empty string. You can also include the name of the environment that the WAR file is being generated for by retrieving the Java system property grails.env. The name of the current project is rootProject.name and is the default value for baseName.

String env = System.getProperty("grails.env") ?: "production"

war {
    version ""
    baseName rootProject.name
    appendix env
    }
 

Change Grails Internal Tomcat Port

Posted: 4/30/2017 11:12 AM

By default, the grails run-app command, as well as running a Grails WAR from the terminal or as a Windows service, creates an instance of Tomcat on port 8080. To change this, edit the /grails-app/conf/application.yml file and create a new server section with the port number that you want:

---
server:
    port: 9001
 

Configure Tomcat Windows Service JVM Launch Options

Posted: 4/16/2017 12:32 PM

Launch regedit and navigate to the following key: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Apache Software Foundation\Procrun 2.0\{TomcatInstance}\Parameters\Java\Options where {TomcatInstance} is the name of the Tomcat instance you want to configure.

Separate each JVM option on a different line:

-Dcatalina.base=C:\java\apache-tomcat-7.0.47
-Dcatalina.home=C:\java\apache-tomcat-7.0.47
-Djava.endorsed.dirs=C:\java\apache-tomcat-7.0.47\endorsed
-Djava.io.tmpdir=C:\java\apache-tomcat-7.0.47\temp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
 

Configure JVM Garbage Collection Logging

Posted: 4/10/2017 2:26 PM

When your application gets to be a certain size, you'll have to enter the world of Java Garbage Collection, and analyzing memory usage to better determine needs and improve performance.

Part of that analysis is enabling Garbage Collection logging, so that you can then run the log through an analysis tool like GCEasy.io to get an idea of what's going on.

Add the following JVM options to the end of your launch string. In the example below, the file that's generated will be called gclog.txt.

-XX:+PrintGCTimeStamps
-verbose:gc
-XX:+PrintGCDetails
-Xloggc:gclog.txt
 

Intelli-J Error: "No Groovy SDK Defined"

Posted: 3/27/2017 2:35 PM
  1. Right-click on the root of your Grails project and select "Add Framework Support".
  2. Select "Groovy".
  3. The dropdown menu next to "Use library" will allow you to choose a Grails library.
  4. If the "Use library" dropdown menu is empty, click "Create" and choose your Grails library directory. If you have installed Grails through SDKMAN, it will be located at: /Users/{username}/.sdkman/candidates/grails/current/ where {username} is your username.
  5. To remove an old version of Grails: Select File -> Project Structure -> Global Libraries. Delete the missing Grails version.
 

Prevent Windows 10 Remote Desktop Session Auto-Logoff

Posted: 2/14/2017 1:05 PM

By default, Windows 10 will automatically log off idle Remote Desktop sessions.

To prevent this:

  1. Run gpedit.msc.
  2. Expand Computer Configuration -> Administrative Templates -> Windows Components -> Remote Desktop Services-> Remove Desktop Session Host -> Session Time Limits.
  3. Disable all of the listed policies, regardless of their current state.
  4. Expand User Configuration -> Administrative Templates -> Windows Components -> Remote Desktop Services-> Remove Desktop Session Host -> Session Time Limits.
  5. Disable all of the listed policies, regardless of their current state.
  6. Reboot the computer.
 

Windows 10 / Server 2016 Schedule Automatic Updates

Posted: 1/9/2017 1:41 PM

Microsoft revamped the Windows Update user interface in Windows 10 and Windows Server 2016 so that you can't control when the updates are installed anymore, only which (maximum of) 12 hour period the computer will not reboot during.

Instead, you can go into the Group Policy Editor and make this change.

  1. Open a blank MMC window. You can do this by running mmc.exe
  2. Add the Local Computer Policy snap-in to the window.
  3. Expand Local Computer Policy, Computer Configuration, Administrative Templates, Windows Components, Windows Update.
  4. Select Configure Automatic Updates and specify which day and time you want updates to download and install. Or just download.
 

SQL Server Connection Error: The Kerberos client received a KRB_AP_ERR_MODIFIED error from the server

Posted: 12/31/2016 11:47 AM

I recently changed the user account that my SQL Server instance was running under from "sql.user" to "sql.user2". When I attempted to have my application server connect via integrated Windows Authentication to this SQL Server after changing the user account and restarting the service, I began receiving this error message in the Windows System Event Log:

The Kerberos client received a KRB_AP_ERR_MODIFIED error from the server sql.user2. The target name used was MSSQLSvc/db01.xyz.com:52663.

I discovered after some research that the client server was still attempting to connect to my SQL Server using the old account name. Running the PowerShell command setspn -Q MSSQLSvc/db01.xyz.com:52663 yielded the following output, indicating that the old account was still being used.

Checking domain DC=xyz,DC=com
CN=SQL Server Service Account,OU=Service Accounts,DC=xyz,DC=com
    MSSQLSvc/db01.xyz.com:52663

To clear the cached kerberos entries, I ran the following commands on the client computer:

setspn -D MSSQLSvc/db01.xyz.com:52663 sql.user
setspn -S MSSQLSvc/db01.xyz.com:52663 sql.user2

This cleared out the cached entries and I was able to reconnect.

 

Grails Error: Error occurred running Grails CLI: No profile found for name [web].

Posted: 12/28/2016 1:03 PM

Sometimes after upgrading the version of Intelli-J that I'm using for development, when I try to run the command-line grails program, I receive the following error message:

Error occurred running Grails CLI: No profile found for name [web].

After searching around the web, I found that this was due to a problem with the build/.dependencies file located within your Grails project root. If you delete or rename this file, then run grails again, the dependencies will be corrected and you can run your app.

 

Update NPM to Latest Stable Version

Posted: 12/1/2016 11:04 AM

To update the Node Package Manager (NPM) to the latest stable version.

Install N:

sudo npm cache clean -f
sudo npm install -g n

Run N and request the latest stable version

sudo n stable