Monday, March 9, 2015

[Solved] Copy-Paste broken in Outlook 2010

I had an issue where I couldn't copy-paste text to or from Outlook 2010. The issue was the
"Send to Bluetooth" Add-In. Here's how to fix it:
1- File -> Settings
2- Click "Add-Ins" then "Go..."
3- Uncheck "Send to Bluetooth"

You should now be able to copy-paste to and from Outlook now. This may be a bug in other office applications, too. You may need to do the same for them.





Thursday, January 24, 2013

PostGIS 2.0 functions list

I couldn't find a simple list of PostGIS functions on the web so here is a list of PostGIS 2.0 functions and a sql command to list them for yourself:
SELECT  proname
FROM    pg_catalog.pg_namespace n
JOIN    pg_catalog.pg_proc p
ON      pronamespace = n.oid
WHERE   nspname = 'public'
order by proname
See the list after the jump:

Tuesday, August 21, 2012

Remove outline of current line in VS2012

Visual Studio 2012 has a feature that will outline the current line in it's text editor. I hate this and wanted it to die. You can remove it here: Options -> Text Editor -> uncheck "Highlight Current line"

Monday, April 23, 2012

If you want to get a list of all the tables in a DB that have a particular column name:
SELECT table_name FROM information_schema.columns WHERE column_name = 'satellite_group_id';

Monday, April 2, 2012

Transform non lat/long coordinate to lat/long using proj.net

This took me some time. I eventually found something online close and created this method. The inputs are authority and the native point to be transformed. The authority is the string that you would use in a program like cs2cs.exe to make a transform.

private static double[] TransformCoordToLatLong(string authority, double[] fromPoint)
    {
        // The authority type needs to be proj4, and we will be turning the coordinate into lat/long (WGS84)
        string authType = "proj4";
        string WGS84WKT = "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\"," +
            "6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326" +
            "\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\"," +
            "0.01745329251994328, AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]]";

        SpatialReferenceTransformation srt = new SpatialReferenceTransformation();
        SR.AuthorityTransformationResult[] transformations;
        transformations = srt.TransformToKnownAuthorities(authType, authority, null);
        transformations = srt.AddLocalTransformation(transformations);
        
        ICoordinateSystem pcs_New = CoordinateSystemWktReader.Parse(transformations[0].AuthorityText) as ICoordinateSystem;
        ICoordinateSystem pcs_wgs84 = CoordinateSystemWktReader.Parse(WGS84WKT) as ICoordinateSystem;

        CoordinateSystemFactory csFactory = new ProjNet.CoordinateSystems.CoordinateSystemFactory();
        CoordinateTransformationFactory ctFactory = new CoordinateTransformationFactory();
        ICoordinateSystem sourceCS = csFactory.CreateFromWkt(transformations[0].AuthorityText);
        ICoordinateSystem targetCS = csFactory.CreateFromWkt(WGS84WKT);
        ICoordinateTransformation transformer = ctFactory.CreateFromCoordinateSystems(pcs_New, pcs_wgs84);

        double[] toPoint = transformer.MathTransform.Transform(fromPoint);
        return toPoint;
    }

Proj.net

Thursday, March 15, 2012

Superfish menu opens on click rather than on hover

I couldn't find anything online that worked for changing the Superfish menu to open on click rather than on hover. Here it is:

Changing this line (line 21, over function):

$$.showSuperfishUl().siblings().hideSuperfishUl();
To this:

$$.click(function(){$(this).showSuperfishUl().siblings().hideSuperfishUl();});

Full superfish code for clicking the menu:

Tuesday, February 14, 2012

Create a SQL insert statement(s) from a SQL select statement

I'm not sure why, but porting a SQL Server 2008 DB to PostGres has been a pain in the ass. I would think MS would have a simple SQL export command that would generate a script that could be used by another DB to create a new DB with the same data, but no.

A coworker showed me this trick to create INSERT statements from SELECT statements to help me out, though

select 'insert into mugg.subscription(subscription_id, name, system) values (''' || subscription_id || ',' || name || ',' || system ||''')' from mugg.subscription

After running this, Here is one of the rows:
"insert into mugg.subscription(subscription_id, name, system) values ('6CBF39EE-0E53-4CED-841E-02EC0A8E8C00,i-cubed testing subscription,MUGG')"

The pipes (||) are SQL's way of concatenating strings and you use a single quote to escape a single quote.

Sunday, October 16, 2011

How I got Rage to work on my AMD/ATI Radeon 6870

The Rage release sucked for a lot of gamers. Here are my system specs and how I got the game to run.

  • Intel Core2Duo 2.93GHz E7500
  • Sapphire Radeon HD 6870
  • 4GB RAM

  • Get the 11.10 preview 2 drivers for Radeon cards. By itself this patch made the game completely unplayable for me. It worked better with the 11.9 drivers.
  • Get the latest game patch
  • Catalyst Control Settings:
    • Check "Use application settings" for everything
    • Catalyst AI: Set bar to middle (quality) and Enable Surface Format Optimize
    • Wait for V-Sync: Always On
    • Anti-Alias" Performace
    • OpenGL: Enable triple buffer
  • Add these command line args (In steam, right-click the game in the left pane -> Properties -> Set Launch Options): +set com_skipIntroVideo 1 +jobs_numThreads 0 +vt_maxPPF 8 +cvaradd g_fov 20 +set m_rawinput 1
  • This wasn't necessary, but may help performace: Create "rage" folder within an "id software" folder in your appdata folder (C:\Users\--your WINDOWS USER NAME--\AppData\Local\id software\rage)
I didn't have to use any config files to get this game running.

Although I can play the game at full settings, you may need to lower yours to get good framerates. Use the in-game video settings.

Best ok luck

Friday, October 7, 2011

Script for cleaning organizing your download folder

Here's a cool powershell script I wrote to keep my download folder organized. I have it setup to run automatically every day via Windows Task Scheduler. The last command is a call to CCleaner. If you don't have that installed, you should remove that line.

You'll need to change the directory variable "$downloadDir" to the location of your download folder.

Save the following code as a powershell script (eg: cleanup.ps1) and run it with powershell.

# Set this variable to your download directory (don't have a trailing '\')
$downloadDir = "C:\Users\jeremiah\Downloads";

# remove all torrent files
Write-Host "Deleting .torrent files..."
remove-item $downloadDir\*.torrent

# organize download folder
#create some folders:
Write-Host "Creating main directories..."
if(!(Test-Path $downloadDir\exe)) {
 mkdir $downloadDir\exe
}
if(!(Test-Path $downloadDir\zip)) {
 mkdir $downloadDir\zip
}
if(!(Test-Path $downloadDir\text)) {
 mkdir $downloadDir\text
}
if(!(Test-Path $downloadDir\images)) {
 mkdir $downloadDir\images
}
if(!(Test-Path $downloadDir\songs)) {
 mkdir $downloadDir\songs
}

Write-Host "Moving files to their folders..."
Move-Item $downloadDir\*.exe $downloadDir\exe -force
Move-Item $downloadDir\*.msi $downloadDir\exe -force

Move-Item $downloadDir\*.txt $downloadDir\text -force
Move-Item $downloadDir\*.log $downloadDir\text -force

Move-Item $downloadDir\*.zip $downloadDir\zip -force
Move-Item $downloadDir\*.7z $downloadDir\zip -force
Move-Item $downloadDir\*.rar $downloadDir\zip -force
Move-Item $downloadDir\*.tar $downloadDir\zip -force
Move-Item $downloadDir\*.gz $downloadDir\zip -force

Move-Item $downloadDir\*.jpg $downloadDir\images -force
Move-Item $downloadDir\*.jepg $downloadDir\images -force
Move-Item $downloadDir\*.png $downloadDir\images -force
Move-Item $downloadDir\*.gif $downloadDir\images -force
Move-Item $downloadDir\*.tif $downloadDir\images -force
Move-Item $downloadDir\*.tiff $downloadDir\images -force

Move-Item $downloadDir\*.m4a $downloadDir\songs -force
Move-Item $downloadDir\*.mp3 $downloadDir\songs -force
Move-Item $downloadDir\*.wav $downloadDir\songs -force

# Put the rest of the files in a folder with their extension as the folder name
$files = Get-ChildItem $downloadDir\* -include *.*
if($files.length -gt 0)
{
 foreach($file in $files)
 {
  $ext = [System.IO.Path]::GetExtension($file)
  $ext = $ext.Trim(".")

  if(!(Test-Path $downloadDir\$ext)) {
   mkdir $downloadDir\$ext
  }
  Move-Item $file $downloadDir\$ext -force
 }
}

# run ccleaner
Write-Host "Running CCleaner..."
&'C:\Program Files\CCleaner\CCleaner64.exe' /AUTO

Write-Host "All Done! Exiting."

Testing my code view

This is some code:

using System.IO;

class CodeViewTest
{
  private string _something;

  public void CodeViewTest(string somthing)
  {
    _something = something;
  }
}

For a really good guide on how to add this to your blog, go here

All the languages available here are:

  • cpp, c, c++
  • c#, c-sharp, csharp
  • delphi
  • pascal
  • java
  • js, jscript, javascript
  • php
  • py, python
  • rb, ruby, rails
  • ror
  • sql
  • vb, vb.net
  • xml, html, xhtml, css
  • xslt

Tuesday, October 4, 2011

Showing a regular date in Redmine (rather than # days ago)

Here's how to add the normal date to show up on issues/tickets in Redmine:


  • Open the show.rhtml file (C:\Program Files\BitNami Redmine Stack\apps\redmine\app\controllers)
  • Within the
    <div class="<%= css_issue_classes(@issue) %>"> 
    tag you can add a normal date with this line:
    Issue <em>Created</em> on: <strong><%= @issue.created_on %></strong>
I can't believe I couldn't find this posted anywhere on the interwebs.