Showing posts with label tricks. Show all posts
Showing posts with label tricks. Show all posts

Monday, May 16, 2011

Visual Studio: ASP.NET MVC, Flip quickly through your controllers and views

This tip is specifically for those writing ASP.NET MVC applications using Visual Studio

As your MVC application grows, the number of views and controllers can grow pretty quickly and ctrl+tabbing through them gets pretty painful, sometimes only to discover that you don't have *that* view open, so you need to go find it. That's where this tip comes in, if you right click on your controller, there's a menu option to go to the view, likewise, if you are in the view and right click there's a menu option to go to the controller, now, if you are a mouse guy, this is enough for you, you can stop reading now, but there's a quicker way, you can assign a shortcut key to those options

Go to Tools, Options, Environment (first option), keyboard, and type "GoToView" (without the quotes) and assign the shortcut you want, chose one that is not being used, or one of a feature you don't use (there are  millions of those), for this type of thing that I do a lot, I like using keys that are easily accessible, put that F1 key to good use!!, do the same thing for the "GoToController"




Click OK and you're ready to roll, go to your controller and press your shortcut, you'll be flipping through your views and controllers like there's no tomorrow!

You're welcome J

Friday, July 17, 2009

How to: Save GIF files in MS Outlook


For some reason MS Outlook doesn't give you an option easy way to save animation files (.GIF), actually it won't let you save .JPG, .PNG, etc directly from a message and what it does instead is that it gives you the option of saving it as BMP, but many times this is not desirable, every once in a while I need this and I keep forgetting how to do it so I decided to use my blog once again for the purpose of remembering later how to do something; it actually works quite well, so here it is

I actually lied on the title, there are ways to save the .GIF files in Outlook, but I'm not going there, there is a much easier way, forward the message to a web-based email account such as Yahoo or Gmail (haven't tried Hotmail, but it probably works there too)

You'll be able to save the files from there as you would expect, with a right click, save file as...

Thursday, April 02, 2009

Did you know? Interface members are allowed to be private

This one comes as a surprise to most people, but it is possible to have a private implementation for an interface member, let's look at a very simple example, just for purposes of the ilustration.

public interface ITest {

void Test();

}

public class Test : ITest {

void ITest.Test() {

Console.WriteLine("test");

}

public void Test2() {

Console.WriteLine("test2");

}

}

class Program {

static void Main(string[] args) {

ITest t = new Test();

t.Test();

Test t2 = new Test();

//t2.Test(); //<<=== doesn't compile


If you don't believe it you can try it of course.

But why is this useful or how do you use this?

The technique allows you to ensure that the method is only visible to those who are using a variable of the interface type. All this does is to force the use of the member through an instance of the interface, meaning, for this example, if you want to get access to the .Test method, you can only do so through a variable of type ITest.

The only trick to make this work is to precede the member declaration with the Interface type as in:

void ITest.Test();

Not the most useful of tricks, but something to have on the bag of tricks, or maybe something to make you win a bet ;)

Friday, December 22, 2006

Remote Desktop tips and tricks

Here's a list of tips and tricks that I have compiled from my reading list, I've seen a tip here and a trick there, but not a full list, so here it is (for me to remember J)

shutdown or restart a workstation

Note: These tips work on Windows XP, but there is no guarantee that they will work in future versions of Windows.

One way to do this is to run Task Manager and select your shutdown option from the "Shut Down" menu.

Another trick is to click on the desktop and type Alt+F4. This will call up the shutdown dialog, where you get the usual shutdown options like "Shut down", "Shut down without installing updates", "Restart", "Stand by", and "Hibernate".

These next two tricks are documented and will continue to work in future versions of Windows:

If you're a command line person, you can run shutdown.exe, but that program supports only shutdown and restart; it doesn't do stand-by or hibernate. But the shutdown.exe program has a serious flaw: It requires you to have administrator privileges. If you are a limited user with shutdown privileges, the shutdown.exe program will complain. (Which means that I don't use it.)

Finally, if your computer isn't using Fast User Switching, you can type the Ctrl+Alt+End hotkey, which is the Remote Desktop version of Ctrl+Alt+Del and consequently takes you to a dialog where you can do various system-type things, among them logging off and shutting down.

Connecting to terminal services when all active sessions are used:

mstsc /console

Mapping drives via Remote Desktop

Open the remote desktop application. Click on the Options button and go to the Local Resources tab. The bottom section of the tab is titled Local Devices, and there you will see a check box labeled Disk drives. Checking this box will automagically connect all disk drives on you local machine to the remote machine when you open the RDC.

Remote Desktop on a non-standard port

Modify this registry key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TerminalServer\WinStations\RDP-Tcp

Connecting via remote desktop to the non-standard port

Suppose you change the port for the virtual machine to listen in on port 3900. You simply append 3900 to the server name (or IP) when connecting via Remote Desktop.

Important shortcut keys:

Alt + Page Up
Switches between programs from left to right.

Alt + Page Down
Switches between programs from right to left.

Alt + Insert
Cycles through the programs in the order they were started.

Alt + Home
Displays the Start menu.

Ctrl + Alt + Break
Switches the client between a window and full screen.

Ctrl + Alt + End
Brings up the Windows Security dialog box.

Ctrl + Alt + Pause
Toggles between fullscreen and windowed mode
(note that this does not set the client desktop to the correct size)

Alt + Del
Displays the Windows menu

Ctrl + Alt + Num -
Places a snapshot of the client's active window on the clipboard

Ctrl + Alt + Num +

References

http://blogs.msdn.com/oldnewthing/archive/2006/10/20/849575.aspx

http://haacked.com/archive/2005/10/13/Remote_Desktop_To_Console_Session.aspx

http://stevenharman.net/blog/archive/2006/10/22/Mapping_Drives_via_Remote_Desktop.aspx

http://haacked.com/archive/2006/10/17/Remote_Desktop_On_A_NonStandard_Port.aspx

http://www.codinghorror.com/blog/archives/000570.html

Reading list