Thursday, October 30, 2008

KeePass custom autotype

I will explain how to create custom auto-type in keepass on example.
Let's create autotype for WinSCP.
  1. Start WinSCP. You will get loggin form.
  2. Start KeePass. Choose Add Entry
  3. Set Title, username , password and url
  4. Tools button (bottom-left) | Auto-type: Select target window
  5. Choose WinSCP Login
  6. You will get in notes edit box: Auto-Type-Window: WinSCP Login
  7. In the notes edit box type on the : Auto-Type: {URL}{TAB}{USERNAME}{TAB}{PASSWORD}{ENTER}
That's it. Now, when WinSCP login dialod is opened chose your entry and press CTRL-V
:)

Saturday, October 25, 2008

.NET Disassembler

You can download here free disassembler. This disassembler does not have export functions. To enable export function you can download plugin here.

Thursday, October 23, 2008

Accessing object anywhere in code

If you want to see some object wherever in code (in watch window) do the following:
  • Set breakpoint in a place where you create this object
  • Right mouse button and "Add Watch"
  • In Watch window, right mouse button on your object and select "Make Object ID"
  • You will see something like {1#}. 1# is your object ID
  • Now, wherever you break your code you can add in watch window 1# and you will see your object

Load xsd file from assembly

First, you need to add xsd file to resource by changing build action to "Embedded Resource".
To access this file from code write something like:


XmlSchemaSet schemas = new XmlSchemaSet();
Assembly assembly = Assembly.GetExecutingAssembly();
Stream stream = assembly.GetManifestResourceStream("Namespace.ServiceDescription.xsd");
schemas.Add("", XmlReader.Create(new StreamReader(stream)));

Friday, October 17, 2008

Firefox, Redirect Loop and Google Calendar

If you have trouble to open google calendar using firefox maybe this can helps:
  1. Tools->Options->Privacy->Accept Cookies
  2. Tools->Options->Privacy->Clear Now-> (check cookies) -> Clear private data
  3. Restart firefox

Tuesday, October 14, 2008

WCF, IIS, Keyset does not exist

- Error: Keyset does not exist error when I try to test WCF project with X509 security.

Solution:
  1. Check if WCF support is installed for IIS:
  2. If you are using certificate, check if application pool have access permissions for private key. To provide access permissions do:
    1. Find IIS application pool identity
    2. Find private key file name for certificate (FindPrivateKey.exe):
    3. Add read permissions for IIS application pool identity (cacls.exe) or just open windows explorer and set permissions




Friday, October 10, 2008

Test run pending trouble

Sometimes when I start unit test from visual studio all test are in pending phase and no test will run.
Open task manager find proses named as VSTestHost.exe and kill it. After that try to start tests again.
It works for me.

And here is macro to do that for you



Sub KillDeadTestProcess()
Dim objProcess As System.Diagnostics.Process
For Each objProcess In System.Diagnostics.Process.GetProcesses()
Debug.Print(objProcess.ProcessName)
If (objProcess.ProcessName = "VSTestHost") Then
objProcess.Kill()
End If
Next
End Sub

Create certificate

To create certificate for use in WCF for example you can use Visual Studio command line tool makecert and pvk2pfx

For more information look here

Thursday, October 09, 2008

SqlRoleProvider - change password length

To change required password length add this section in config file:



<system.web>


<roleManager enabled="true" > </roleManager>


<membership>


<providers>


<clear/>


<add name="AspNetSqlMembershipProvider"


connectionStringName="LocalSqlServer"


enablePasswordRetrieval="false"


enablePasswordReset="true"


requiresQuestionAndAnswer="false"


applicationName="/"


requiresUniqueEmail="true"


passwordFormat="Hashed"


maxInvalidPasswordAttempts="10"


minRequiredPasswordLength="3"


minRequiredNonalphanumericCharacters="0"


passwordAttemptWindow="10"


passwordStrengthRegularExpression=""


type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>


</providers>


</membership>


Wednesday, October 08, 2008

Remove http://tempuri.org/ from wcf service

To remove tempuri.org you should define your own namespace in service contract atribute



    [ServiceContract(Namespace="http://myuri.com/")] 


Tuesday, October 07, 2008

The Address property on ChannelFactory.Endpoint was null

You created web service client, set up config file using Service Configuration Editor and you get

The Address property on ChannelFactory.Endpoint was null

message

You probably forgot to add configuration name in

new ChannelFactory();

method

Friday, October 03, 2008

Writing code in blogspot

Here is a nice way to write code in blogspot



<pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;">


<code>


Some code here


</code>


</pre>




Code will looks like:


Some code here


... or you can use "Copy as html" addin for visula studio. Link is:

http://blogs.microsoft.co.il/blogs/bursteg/archive/2007/11/21/copy-source-as-html-copysourceashtml-for-visual-studio-2008-rtm.aspx