This guide will show you how to setup the Perforce merge tool (p4merge) as your default git mergetool on Cygwin.
- Download the Perforce client (p4v) from here. (Go to Clients > Visual Merge Tool, and download the appropriate installer for your machine)
- Perform the installation, making sure that you only check the merge tool component and cross out all other components
- (This step is optional)
Open up cygwin, and create a symlink to p4merge by doing:
ln -s /cygdrive/c/Program\ Files/Perforce/p4merge.exe /usr/bin/p4merge
(modify the target path if you installed Perforce in a non-default folder). This way, you can open up p4merge anytime in Cygwin simply by typing “p4merge”
- Add the following lines to your ~/.gitconfig in Cygwin using your preferred text editor:
tool = p4merge
path = c:/Program Files/Perforce/p4merge.exe
trustExitCode = true
Again, edit the path if you used a non-default Perforce install path.
- Save and exit the file. If you have pending merges in the current git tree and you type git mergetool, voila, your merge will be done using the very user-friendly p4merge.
GoogleAPI’s hosting of jQuery 1.3.2 didn’t load on Firefox for me today, but was fine on IE8 and Chrome. Specifically this link: http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js would result in a “Firefox could not find the file at…” page. Surprisingly, all other versions of jQuery that they are hosting were working. Clearing my FF cache seemed to solve this. Wonder what was the actual problem?
I have been using Thunderbird to access my Purdue webmail account for a long time, but yesterday seemingly randomly I would get the message “Thunderbird can’t connect securely to x.mail.purdue.edu because the site uses a security protocol which isn’t enabled” whenever I tried to access the webmail server. After some fiddling around I realized the problem was that Purdue Webmail wasn’t using the TLS protocol for security anymore, rather it switched to SSL (or something to that effect). Therefore, you need to goto Tools > Account Settings > Server Settings > and under “Security Settings” click the “SSL” radio button.
This is annoying because I set up my Thunderbird account using ITaP’s tutorial which stated to use the TLS protocol. However, if you search further, there is an ECN Tutorial telling you to use SSL. So, if you are setting up Thunderbird for the first time, you might wanna follow the ECN one instead. Hope this helps somebody!
P/S: btw, there’s apparently a new online webmail client which is WAY better than the previous crappy client. There should be a link to it on the Purdue Webmail login page. Check it out. Still doesn’t beat Thunderbird though…
I just tried using dodgeit and mailinator (services which let you use a throwaway email address which you can check on their websites) to register to a forum board and neither of them got the registration email, whereas a more typical yahoo mail account got the email without any hassle. I’ve come to the conclusion that these services (along with some others) are probably already well-known enough that sysadmins who care are not sending mails to them. A service which provides a checkable random email domain will be best in this scenario, and there may be sites that offer this already.
So, just don’t use one of these well-known throwaway email services to register for something and expect to actually receive the mail.
I’d just like to put this out there, as I just “failed” a “do-at-home” interview assignment which was to implement a screen scraper using Java/PHP. I had previously (1-2 years ago) done screen scrapers in PHP, so I proceeded to do this assignment the same way – using regexes. Little did I know that using regexes would be one of the weak points of my submission – they wanted me to use a DOM parser instead. In hindsight, I guess I should have looked into that, but it just never occured to me because I already used other methods in the past.
So the moral of the story is to use DOM parsers when writing screen scrapers, they should be more robust than regex parsing in most cases. Here is an example tutorial.
These are some very helpful comments I came across from Stack Overflow. Thanks to Martin York and Adam Liss for providing these useful and concise comments.
Question 1: Float division
int a = 2, b = 3;
float c = static_cast(a) / b; // need to convert 1 operand to a float
Question 2: How the compiler works
Five rules of thumb to remember:
* Arithmetic operations are always performed on values of the same type.
* The result type is the same as the operands (after promotion)
* The smallest type arithmetic operations are performed on is int.
* ANSCI C (and thus C++) use value preserving integer promotion.
* Each operation is done in isolation.
The ANSI C rules are as follows:
Most of these rules also apply to C++ though not all types are officially supported (yet).
* If either operand is a long double the other is converted to a long double.
* If either operand is a double the other is converted to a double.
* If either operand is a float the other is converted to a float.
* If either operand is a unsigned long long the other is converted to unsigned long long.
* If either operand is a long long the other is converted to long long.
* If either operand is a unsigned long the other is converted to unsigned long.
* If either operand is a long the other is converted to long.
* If either operand is a unsigned int the other is converted to unsigned int.
* Otherwise both operands are converted to int.
Overflow is always a problem. Note. The type of the result is the same as the input operands so all the operations can overflow, so yes you do need to worry about it (though the language does not provide any explicit way to catch this happening.
As a side note:
Unsigned division can not overflow but signed division can.
std::numeric_limits::max() / -1 // No Overflow
std::numeric_limits::min() / -1 // Will Overflow
In general, if operands are of different types, the compiler will promote all to the largest or most precise type:
If one number is… And the other is… The compiler will promote to…
——————- ——————- ——————————-
char int int
signed unsigned unsigned
char or int float float
float double double
char + int ==> int
signed int + unsigned char ==> unsigned int
float + int ==> float
Beware, though, that promotion occurs only as required for each intermediate calculation, so:
4.0 + 5/3 = 4.0 + 1 = 5.0
This is because the integer division is performed first, then the result is promoted to float for the addition.
Spent some time getting this to work. Say you want to match “1\n;”, the way to do this is: