Wednesday, December 17, 2014
Remote Debugging....SP3G StudentPortal3G
If you are going to do remote debugging on SP3G, you have to be on the QA or Prod domain,
our security prevents... and if you are going to do that, you'd better get a clone of the QA/prod server created, and then you can just install what you need and debug directly without remoting at all
install
vs2010
vs2010 sp1
mvc 2
mvc 3
mvc 4
then just debug it.
Friday, December 12, 2014
Distance Between 2 cities, using Google Distance Matrix, in c#
public Double GetDistanceInMilesBetweenTwoCities( string city1, string city2 )
{
////Pass request to google api with origin and destination details(Map Coords)
HttpWebRequest request =
( HttpWebRequest )WebRequest.Create( "http://maps.googleapis.com/maps/api/distancematrix/json?origins="
+ city1 + "&destinations=" + city2 + "&mode=Car&language=us-en&sensor=false" );
HttpWebResponse response = ( HttpWebResponse )request.GetResponse();
using ( var streamReader = new StreamReader( response.GetResponseStream() ) )
{
var json = streamReader.ReadToEnd();
if ( !string.IsNullOrEmpty( json ) )
{
//Uses the NewtonSoft Json library that is shipped in vs 2013, the .N3.5 version to match this service. (thank you stack overflow!) - EWB
Parent parent = JsonConvert.DeserializeObject<Parent>( json );
if ( parent.rows[ 0 ].elements[ 0 ].status.ToUpper() != "OK" )
{
throw new Exception("Invalid City Name please try again");
}
Double distInKM = parent.rows[ 0 ].elements[ 0 ].distance.value;
return DistanceCoversion.ConvertMetersToMiles( distInKM );
}
}
return -1;
}
public class DistanceCoversion
{
<snip>
public static Double ConvertMetersToMiles( Double meters )
{
//
// Multiply by this constant.
//
return (meters/1000) * 0.621371192;
}
}
Friday, August 29, 2014
Adding a VSPackage to your visual Studio..
It was surprisingly hard to find this on the web, so here it is for posterity.
Once you've built your vs package, go to the bin folder
there you will see a *.visx file, double click it.
It's automatically added to VS (you need to restart VS)
To remove it click tools->Extensions and updates and look for VSPackage<yourpackagename> and uninstall it.
Wednesday, July 30, 2014
Updating package wtih nuget, installs fine, the reference is there, but when you compile, it says it's not there?
At work today, we had updated all out NuGet packages for our internal libraries.
I applied them to one of my solutions, a ton of projects...
most of them were fine... but for some of them, even though I could see the reference,
when I compiled it, it said the reference wasn't there.
Intelligence saw it, and my using statements were not RED..
WTF!
The answer of course is, assumptions...
Turns out, that the project in questions was referencing .Net4.0, and the Package referenced 4.5
there was even a yellow warning about it in my output window after the compile...
but who looks at those!(DOH)
I hope this saves someone else the pain...
Friday, July 25, 2014
Updating a large Soloution with lots fo projects wtih Nuget? How to remove the suq! (Nuget Commands to Remember #2)
Say you've got a large *.sln and it has lots of *.csproj s in it... and you made a fundamental change to nugget packages...
Updating it manually package after package and project after project, is uber painful... aka "The Suq"
I found several neat commands in NuGet that work across solutions Here: StackOverflow
but this is my favorite... In vs2013 (I have not tried it in earlier version of NuGet) at the
PackageManagerConsole Prompt type this
Update-Package
Then hit <return>, it will go through your packages, one by one, checking to see if it needs updating in EACH Solution.
Let it chew and your entire SLN is updated...
Man that ROCKS...
Hope you enjoy it.
Monday, July 7, 2014
Where do we keep the excel data sheets...
I keep forgetting where we put this excel sheet at work,
I'm making a not e to myself where it is.
D:\TFS\_Deployment\EFolderReportGenerator3G\SqlExcelSheets\
I'm making a not e to myself where it is.
D:\TFS\_Deployment\EFolderReportGenerator3G\SqlExcelSheets\
Copying a soloution to a new soloution, and renaming.
Often times, you want to take an existing project and reshape it into something new. This is especially true with utilities and other small project that you create to make your life easier.
Here is a quick and dirty SLN copier and renamer I wrote. It comes with the "It worked on my box" certification.
https://drive.google.com/file/d/0B8Bg9eVVQhaYTlEtQXNCUGpKSlk/edit?usp=sharing
It basically brute copies the entire directory tree, searching each file/folder name and each file contents for the SLN name, and replacing it with the new sln name.
Note that you can't use the old sln name in the new sln name. so BOB to BOB2 will fail...
but BOB2 to BOB will work okay.
I hope you find it helpful.
Wednesday, July 2, 2014
Sql thread blocking.
If you 've never dealt with a blocked Spid in SQL, it can be pretty intimidating...
But really it's pretty basic...
One thread (spid) has locked the table to modify it, and hasn't let it go.
Usually this is just a SQLcommand that's you've sent and you forgot to commit it.
Find that command and add the commit and you're all good. Usually...
Wednesday, April 23, 2014
VS2013 - Visual Studio 2013 References, WTF why can't I add references. (solved)
So I'm switching to Vs2013...
and I keep adding references to the project, but they don't' show up in the references list under the project.
all I can say is WTF... but I finally figured it out..
You dont' add references like you did in say... every other visual studio ever...
If you highlight the reference and hit OK... it doesn't add it.
You MUST check the checkboxes for one or more reference to get it to add (see image below)
You have to get the check box next the reference name to appear and get it checked...
the easiest way is to just double click the reference and it'll show up checked... then and only then can you add the reference..
It makes sense, now you can add multiple references in one go, unlike before.. but DAMN was it confusing to a brain that already "knew" how to do it....
Proving once again the Maxim,
It's not what you dont' know that will kill you, it's what you do know, that's not what you think it is.
Subscribe to:
Posts (Atom)