Git Stash

Oct 28th, 2013

Stashing is a great way to pause what you’re currently working on and come back to it later. For example, if you working on that awesome, brand new feature but someone just found a bug that you need to fix. Add your changes to the index using
git add .

Or add individual files to the index, your pick. Stash your changes away with:
git stash

And boom! You’re back to your original working state. Got that bug fixed? Bring your work back with:
git stash apply

You can also do multiple layers of stashes, so make sure to use
git stash list

To check out all of your current ones. If you need to apply a stash from deeper in the stack, that’s easy too. Here’s how to apply the second stash you’ve got:
git stash apply stash@{1}

You can also easily apply the top stash on the stack by using:
git stash pop

A note with this command, it deletes that stash for good, while apply does not. You can manually delete stashes with:
git stash drop

Or delete all of the stored stashes with:
git stash clear

Tags:

Boot back to Windows from grub-rescue prompt

Aug 12th, 2013

I had Windows 8 and wanted to try Ubuntu Linux. I installed Ubuntu and enabled it through dual boot. For some reason after couple of days I decided to remove Ubuntu Linux. To retrieve the space back, I booted to windows, deleted all Linux partitions, created a new drive and formatted it. Guess what, after rebooting the machine, I got “grub rescue>” prompt.

I did not know how to boot to Windows. I did some research and found couple of way to boot back to windows. The quickest way to get back my system boot to Windows was by booting my system with the Ubuntu Live CD. Open Terminal and run the following commands:

sudo apt-get install lilo
sudo lilo -M /dev/sda mbr

I rebooted the system and voila… it booted to Windows. I saved tons of time. Thanks Ubuntu forums! Complete details are available here.

Tags:

Remote access to PostgreSQL server

Jul 9th, 2013

Edit “postgresql.conf” file
change listen_addresses = ‘localhost’ to listen_addresses = '*'

Edit “pg_hba.conf” file
Assuming your ip address is W.X.Y.Z, add following line at the end of the file
host all all W.X.Y.Z/32 trust

Tags:

RoR – cygwin install – pg gem

Jun 13th, 2013

While creating a new application in RoR (on cygwin), I was having issue installing ‘pg’ gem. After a little research I found that you need to install pg-client and pg-devel libraries to install ‘pg’ gem. Even after installing both devel and client packages, still I was unable to install. It turns out I need to install with a particular platform:

gem install pg --platform=x86-mingw32

This install the gem but in my application I had to update my Gemfile as below:

gem 'pg', :platforms => 'mingw'

After doing the above steps, I was able to run bundle install successfully.

Tags:

Change default path for Desktop in Windows

Mar 15th, 2013

Use regedit to edit the following registry key:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
Find the value name called “Desktop” and set its data to the desired location for your desktop.

Tags:

How to create RoR app with PostgreSQL support

Mar 15th, 2013
rails new myapp --database=postgresql
Tags:

C# regex tester

Oct 30th, 2012

I found a great tool for validating Regex expressions for my C# project.  RegexHero – a great tool!

Tags:

Shrink transaction log SQL 2008 r2

Oct 27th, 2012

Once transaction log is full, I was unable to shrink it.  All searches in Google did not help.  Finally I found a script which clears the transaction log if and only if the transaction log is not full yet.  I tried it and it worked.

USE DBNAME
GO
ALTER DATABASE DBNAME SET RECOVERY SIMPLE WITH NO_WAIT
DBCC SHRINKFILE(DBNAME_log, 1)
ALTER DATABASE DBNAME SET RECOVERY FULL WITH NO_WAIT
GO

I still need to figure out what is the way to shrink after your transaction log is already full and database has started giving errors

SQL Server 2008 R2 (Suspect) mode – how to repair?

Aug 13th, 2012

Run the following SQL statements to fix the issue:


EXEC sp_resetstatus ‘yourDBname’;
ALTER DATABASE yourDBname SET EMERGENCY
DBCC checkdb(’yourDBname’)
ALTER DATABASE yourDBname SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB (’yourDBname’, REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE yourDBname SET MULTI_USER

 

Please see here for more details.

It worked for my database and I was able to repair successfully.

How to save password in TortoiseSVN

May 17th, 2012

Follow these steps
a) Right click on local code repo
b) Go to TortoiseSVN > Settings
c) Go to “Network”
d) Browse for SSH Client and use following
“C:\Program Files\TortoiseSVN\bin\TortoisePlink.exe” – Can be found in TortoiseSVN installation folder
d) Append following replacing username and password with your user name and password
“-l username -pw password”
e) Click OK/Apply

Tags: