Thursday, November 13, 2014

Emacs Error: maximum buffer size exceeded

When trying to load a one gigabyte file into Emacs, I got this error:"maximum buffer size exceeded", and I'm thinking to myself, "Hey, I've got a 64-bit machine with 8Gig of ram and using the awesome Emacs, it should handle one Gig".
After a little research I found a version of Emacs compiled for 64bit windows machines here.
Now I can view 1 Gig files to my hearts content.


Friday, November 07, 2014

Synergy is still Awesome

I use two machines at my desk. Synergy is an incredible program that let's you control multiple machines with a single keyboard and mouse. The latest version costs $5 and it's worth every penny. Setup which used to be awkward at best is now a breeze. Nick Bolton and his team have done a great job with this release.

Setting up a new Windows 7 machine

When setting up a new Windows 7 box, I do the following:
Set Preferences
-----------
Right-click RecycleBin, select "Properties" and uncheck "Display delete confirmation dialog" box
Right-click on background, select "Personalize" and select "High Contrast Black"
Right-click on bottom toolbar and set to small icons
In the task bar, right-click select properties and set "Taskbar buttons:" to be "Combine when taskbar is full"
Add environmental variable "HOME" and set to C:\home\mfincher so emacs can find me
Add C:\home\mfincher\bin to environmental variable "Path"
Create C:\tmp so ange-ftp can work.
Turn off error reporting, "My Computer"/Properties/Advanced system settings/Advanced/Startup and Recovery/Settings/System failure, set "Write debugging information" to "(none)"

Copy Files From Old Computer
----------------------------
Copy My Documents, My Pictures, c:\home, c:\opt
copy over all the old databases
Copy over inetpub directories
Copy over old Microsoft Mail archives, *.pst files
Copy root directory of Perforce files, C:\workfiles
Copy the old %AppData%\Launchy\Luanchy.ini config file over to new machine 
Copy Themes from %userprofile%\AppData\Local\Microsoft\Windows\Themes C:\Users\fincherm\AppData\Local\Microsoft\Windows\Themes

Install Utility Programs
------------------------
Install Chrome, Opera, and Firefox, set up sync in Firefox to get old bookmarks and addins
Install Launchy 
Install AutoHotKey
Install ConEmu http://code.google.com/p/conemu-maximus5/
Install Notepad++
Install an alternate file manager XYplorerFree, select "Favorites/Set Box Color..." and set it to black
Install Emacs
Install Mouse drivers
Install visual studio 2013, and p4vs plugin
Install pdf reader sumatra - http://blog.kowalczyk.info/software/sumatrapdf/download.html
Install Paint.Net http://www.getpaint.net/download.html
Install Mezer Tools https://www.bayden.com/mezer/ Windows-s for capture Windows-c for calipers 
Install 7-zip for zip/tar files from http://www.7-zip.org/
Install Process Explorer  http://technet.microsoft.com/en-us/sysinternals
Install cygwin, add c:\cygwin64\bin to "Path" environmental variable so emacs can see "gzip"
Install Nant http://sourceforge.net/projects/nant

Install Microsoft Programs
------------------------
Install latest version of powershell (inside Windows Management Framework 4/5) http://www.microsoft.com/en-us/download/details.aspx?id=40855   Windows6.1-KB2819745-x64-MultiPkg.msu
set powershell to use unsigned scripts: add  "set-executionpolicy remotesigned" 
Install sql server 2008R2
Install IIS  http://technet.microsoft.com/en-us/library/cc725762.aspx?ppud=4
Download SQL Server® 2008 R2 Feature Pack to get Invoke-SqlCmd working SqlServerCmdletSnapin100 sqlps
Add-PSSnapin SqlServerCmdletSnapin100
http://go.microsoft.com/fwlink/?LinkID=188436&clcid=0x409
What other programs and settings would you recommend?

Thursday, November 06, 2014

The term 'Invoke-Sqlcmd' is not recognized as the name of a cmdlet

On my new Windows 7 machine while inside Powershell I tried "Invoke-Sqlcmd", but kept getting the error message "The term 'Invoke-Sqlcmd' is not recognized as the name of a cmdlet".
Here was my solution:

Download the SQL Server® 2008 R2 Feature Pack from here.

Then click on the "Instructions" plus symbol.


Then search for "Microsoft® Windows PowerShell Extensions for SQL Server® 2008 R2" and select the appropriate download.

Now after installing, go inside Powershell and execute "Add-PSSnapin SqlServerCmdletSnapin100", then Invoke-SqlCmd worked for me.
To add it permanently, edit your profile and add "Add-PSSnapin SqlServerCmdletSnapin100". (You can find your profile location by executing "$profile").

ConEmu - a Console Emulator for Windows That You Need Now

You owe it to yourself to download ConEmu. It removes all the awfulness of the standard Windows cmd terminal. Things like selecting text are much easier and more natural.
By default to copy text from the console you execute hold down the left-shift key (it's different than the right-shift key), then left-mouse button to highlight and it selects over the carriage returns. If you like block copies select alt-left-click.
I recommend a few changes: Open the Settings Window by selecting the right-most icon with three bars:


Select "Keys & Macro"/Paste/ and set "Confirm pasting more than" to 20000 chars and uncheck "Confirm <Enter> keypress" so it does not nanny you to death by asking if you know you have an <enter> in your selection.
Select "Main/Confirm" and uncheck the top 5 boxes so you won't be nannied to death.
Optional: To prevent a hotkey collision with Mezer tools, remove the hotkey for Win-S by going to "Keys & Macro", select Win-S and reassign the hotkey.

How to delete the log file from sql server databases

Disclaimer: This process should not be done with databases that you really care about. This procedure is only for dev/testing environments, not for production databases. I'm using Sql Server 2008R2.

Often the log file, ".ldf", can be quite large. If it's a production database you need it, but for databases you are using for dev and testing, you can remove it carefully to save space.
Here's the steps:
  1. In Sql Enterprise Manager "detach" the database - this won't hurt it, don't worry.
    This will bring up another window and just select "OK".
  2. Then in File Explorer append ".bak" the ldf filename - just in case we need it. Location may vary, on my box it's in "C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA"
  3. Attach the database
    This will bring up a window. In the upper panel select "Add" and give the location of your .mdf file.
    Now comes the tricky part, in the lower panel select the log file and then select "Remove". Then select "attach", and voila, your old boat-anchor of a log file is now gone from your database!
  4. If all goes well, delete the renamed ".ldf" file.
Did I mention that you should not do this with databases you care about?

Tuesday, October 28, 2014

Vladimir Putin is the Future of America


From www.kremlin.ru via wikimedia
Most American citizens do not appreciate how truly dangerous the National Security Agency’s domestic surveillance program is. No less than our Republic itself is threatened.

The danger is that an insider from the NSA could seize power in the United States.
Sound farfetched? Vladimir Putin, a former KGB officer, took Russia from a democracy to a kleptocracy powered by his old KGB buddies. Someone from the NSA can do something quite similar in America.

Here are the steps:

1. The president succumbs to the temptation to use information gleaned from NSA surveillance to blackmail his opponents. You can imagine the phone call that results:

"Senator, I know you are planning to vote against the President's bill tomorrow, but just think of the consequences. We know you have nothing to hide, but your nephew has been looking at some sketchy websites; if this gets out he could go to prison. And your brother has been caught on tape to his accountant doing some very creative tax avoidance that could land him in jail as well. Oh, and one of your major donors has been doing some insider trading. So think carefully about how you vote tomorrow."

2. After a while, the NSA will tire of just pulling the strings for the president and want to put their own man in the White House. The NSA can try to blackmail all the good candidates out of the race. If that fails they can target the donors. If word leaked out that donors to a candidate were being
personally investigated by various governmental agencies, donations would dry up—along with any chance of winning an election.

The concentration of power in the NSA is incompatible with democracy. Vote for candidates who support reigning in domestic surveillance, unless you really admire what Vladimir Putin has done in his former democracy.