Thought this was pretty cool! Graeme and his crew has put in some serious work!
Fix SSH + VIM issues on mac to windows box running cygwin
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.
what is a .pfx certificate and why does it exist?
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 :
- .pfx certificate
- MakeCert.exe
- Certificate Authority
- 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.
There are 2 ways a developer obtains a certificate :
- Use MakeCert.exe, a utility command that is included in the .NET framework Software Development Kit to generate their own certificate.
- 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.
Mode assembly is built against version “v.xyz”
Add the following to your App.config
<startup useLegacyV2RuntimeActivationPolicy="true" ></startup>
How to access an object’s prototype in javascript?
Quick post to serve as a reminder…
var Person = function(name){
this.name = name;
}
Person.prototype.name = "Person";
var bob = new Person('Bob');
console.log(bob.name);//returns 'Bob'
What if for some reason you wanted to access the prototype’s name? Can be done by calling :
Object.getPrototypeOf(bob).name //return 'Person'
jquery + qtip js a.compareDocumentPosition is not a function
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
Easy Fix
Just edit your qtip configuration making sure you have “leave” set to “false” in “hide”. see below
hide : { delay : 0, leave: false },
MAMP : Error: Could not connect to MySQL server!
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!
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 :
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
JQuery : Additional parameter to be passed in $.ajax callback function
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');
}
Symfony2 + Doctrine + MAMP : DateTime::__construct(): It is not safe to rely on the system’s timezone settings.
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
Symfony2 + Doctrine + MAMP: Could not create database for connection named … SQLSTATE[HY000] [2002] No such file or directory
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.”
Grails plugins inside project
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



