Recently I ran into some vim issues while ssh’ing onto a windows server running cygwin… the process of getting things to work right was painful enough for me to do a write up.

To be more explicit, this was my situation : I was working on a mac laptop ssh’ing onto a windows machine running cygwin and using vim to edit files.

Here were the list of issues that I ran into and how I was able to address them :

SSH terminal window had a grayish color surrounding all text

To fix this I had to explicitly set the terminal type. I am not an expert on terminal types, and not really interested in becoming one, so all I can offer in this post is what worked for me, and that setting it to vt100.

If you are unclear on how to set the terminal type, it is an environment variable that be set in either your .profile or manually in the mac terminal by using the following command :


export TERM=vt100

Or open up the mac terminal preferences -> Settings -> Advanced -> under “Emulation” select vt100

Here is a decent article explaining terminal types

VIM issue with Delete not working outputting “^_”

What was happening here was that mac sends a different command for backspace than windows uses. This was took a few google searches but was able to track down the fixes for this issue.

1. Edit Terminal Preferences : Open up the mac terminal preferences -> Settings -> Advanced -> check “Delete sends Ctrl-H”

2. ssh onto the windows machine running cygwin and add the following to the .vimrc file in your home directory :


set backspace=indent,eol,start

These two things made vim work as expected while ssh’ing onto windows machine running cygwin.


While working on a project, I ran into .pfx issues. Not know what this was, I decided to write a post to help gain a better understanding.

Key Terms of this post :

  1. .pfx certificate
  2. MakeCert.exe
  3. Certificate Authority
  4. Authenticode

What is a .pfx certificate and why does it exist?

.pfx is a type of Authenticode digitally signed certificate used to ensure integrity and authenticity of a software program.

When you download executable (.exe) code to install on your PC, without a digital certificate, you have no guarantee that the program is legitimate. A .pfx certificate helps provide that legitimacy by allowing the developer to digitally sign their software.

Verifying the authenticity of a software application using the digitally signed certificate

There are 2 ways a developer obtains a certificate :

  1. Use MakeCert.exe, a utility command that is included in the .NET framework Software Development Kit to generate their own certificate.
  2. Purchase a certificate from a certificate vendor

MakeCert.exe (also referred to as “self-cert” or “test-cert”) combines a developer’s public and private keys into on file. While MakeCert.exe helps build credibility, it isn’t the best way to ensure the integrity and authenticity of a software project. MakeCert.exe lacks verifiable information about the publisher.

Purchasing a certificate from a Certificate Vendor is the more secure approach to digitally signing a software program. The Certificate Vendor will check with the Certificate Authority that signed the certificate to verify the identity of the developer.

What is a Certificate Authority?

A Certificate Authority is a third-party organization that verifies the identity of an online business. A few examples of Certificate Authorities include VeriSign, TRUSTe, GoDaddy.

What is Authenticode?

Authenticode is a technology developed by Microsoft that uses the digital certificate digitally signed by the application developer to verify the authenticity and to ensure that the application software hasn’t been modified since being digitally signed by the publisher/developer.


This has happened enough times for me to write a quick post. If you are using qtip2 (by the way, thanks Craig Thompson) with jquery, you may see a console error like the one below:


a.compareDocumentPosition is not a function

a.compareDocumentPosition is not a function

a.compareDocumentPosition is not a function

Easy Fix

Just edit your qtip configuration making sure you have “leave” set to “false” in “hide”. see below


hide : { delay : 0, leave: false },


I recently changed my root password for MySQL and forgot that I had done so.. when I restarted MAMP I got :


Error: Could not connect to MySQL server!

MAMP : Error: Could not connect to MySQL server!

Simple fix, open :


/Applications/MAMP/bin/mamp/index.php

and update the root users password :

$link = @mysql_connect(':/Applications/MAMP/tmp/mysql/mysql.sock', 'root', 'newpassword');

if you get this screen :

#1045 - Access denied for user 'root'@'localhost' (using password: YES)

#1045 - Access denied for user 'root'@'localhost' (using password: YES)

Simple Fix : Open

/Applications/MAMP/bin/phpMyAdmin/config.inc.php

Update line below with new password (note: this is for a basic install of MAMP on Mac).


$cfg['Servers'][$i]['password'] = root


Just a quick snippet.. if you want to pass additional parameters to be used in the callback function of an ajax request using JQuery… here is an example:


var foo = 20;
$.ajax({
url : 'http://someurl.com',
success : passingAdditionalParameter(foo),
error : error
});

//in this function declaration, return an anonymous
//function with your logic within
function passingAdditionalParameter(foo){
return function(data, textStatus, jqXHR){
//foo is now available in the callback function
console.log(foo);
}
}

function error(){
console.log('error');
}


Ran into an issue with Doctrine while trying to force table creation using Symfony’s command line tool..

Command


php app/console doctrine:schema:update --force

Error/Exception


[Exception]

DateTime::__construct(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead

Fix

Im running MAMP. I know this is kind of a hack, but it works. Create a new “php.ini” file in “/private/etc”.

Put the following in the new “php.ini” file


date.timezone = "UTC"

Rerun the command, and all should be good.

Please, if someone has a better fix, feel free to let me know


Recently was working through a Symfony2 tutorial and ran into an issue. Tried performing a create database command and ran into an issue.

Create Database Command


php app/console doctrine:database:create

The Error


Could not create database for connection named nameofthedatabase
SQLSTATE[HY000] [2002] No such file or directory

The Fix

Using MAMP, I had to create a symbolic link to the the MAMP myslq socket.


sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock mysql.sock

Rerun the command and all should be good!

What is the mysql.sock?

“The mysql.sock is the socket that mysqld creates for programs to connect to.”


If you are tired of tracking down the grails plugin directory (switching between mac and windows) or you would just rather have the plugins within the project for ease of use add this line to your BuildConfig.groovy

grails.project.plugins.dir=’plugins’

After doing this, the next time you run your project, grails will download all needed plugins and place them in your projects ‘plugin’ directory

Follow

Get every new post delivered to your Inbox.