30 Temmuz 2012 Pazartesi

Open file location from inside Eclipse

We know, we love and we are frequently using "Open Folder in Windows Explorer" in Visual Studio:

Unfortunately, Eclipse lacks a similar option. StartExplorer is an Eclipse plugin to fill this hole. To be honest, it is more than this:
You can visit Github or SourceForge page of the project.

Eclipse update site for impatient:

Highlighting log files in Notepad++

Popular programmer's editor  Notepad++ provides syntax highlighting for several programming and scripting languages. Because, I don't like reading code as plain text, this is very nice feature for a programmer like me. But better one is that Npp makes extendable this feature allowing you to create custom syntax highlighting:
User-defined language (UDL).

To take advantage of the UDL, open User-Defined Dialogue... under View menu:

A window like below one will pop up:

Now, you can play with the toy or import an existing UDL file (which is an XML file). My custom UDL for LogFiles is below. Save as LogFile.xml (or dowload directly):

    <UserLang name="LogFile" ext="log">
            <Global caseIgnored="yes" />
            <TreatAsSymbol comment="no" commentLine="no" />
            <Prefix words1="no" words2="no" words3="no" words4="no" />
            <Keywords name="Delimiters">[(0])0</Keywords>
            <Keywords name="Folder+"/>
            <Keywords name="Folder-"/>
            <Keywords name="Operators">&apos; - ! &quot; # $ % &amp; ( ) * , . / : ; ? @ [ \ ] ^ _ ` { | } ~ + &lt; = &gt;</Keywords>
            <Keywords name="Comment">1 2 0</Keywords>
            <Keywords name="Words1">ERROR</Keywords>
            <Keywords name="Words2">WARN WARNING</Keywords>
            <Keywords name="Words3">DEBUG</Keywords>
            <Keywords name="Words4">INFO</Keywords>
            <WordsStyle name="DEFAULT" styleID="11" fgColor="000000" 
                        bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="FOLDEROPEN" styleID="12" fgColor="000000" 
                        bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="FOLDERCLOSE" styleID="13" fgColor="000000" 
                        bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="KEYWORD1" styleID="5" fgColor="FFFFFF" 
                        bgColor="FF0000" fontName="" fontStyle="1" />
            <WordsStyle name="KEYWORD2" styleID="6" fgColor="FFFFFF" 
                        bgColor="FF8000" fontName="" fontStyle="1" />
            <WordsStyle name="KEYWORD3" styleID="7" fgColor="FFFFFF" 
                        bgColor="FF80FF" fontName="" fontStyle="1" />
            <WordsStyle name="KEYWORD4" styleID="8" fgColor="FFFFFF" 
                        bgColor="0080FF" fontName="" fontStyle="0" />
            <WordsStyle name="COMMENT" styleID="1" fgColor="000000" 
                        bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="COMMENT LINE" styleID="2" fgColor="000000" 
                        bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="NUMBER" styleID="4" fgColor="000000" 
                        bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="OPERATOR" styleID="10" fgColor="FF0080" 
                        bgColor="FFFFFF" fontName="" fontStyle="1" />
            <WordsStyle name="DELIMINER1" styleID="14" fgColor="000000" 
                        bgColor="FFFFBF" fontName="" fontStyle="1" />
            <WordsStyle name="DELIMINER2" styleID="15" fgColor="800000" 
                        bgColor="FFFFFF" fontName="" fontStyle="2" />
            <WordsStyle name="DELIMINER3" styleID="16" fgColor="000000" 
                        bgColor="FFFFFF" fontName="" fontStyle="0" />

Press Import... button and select LogFile.xml you just saved:

OK. Whenever you want to highlight a file according to LogFile UDL rules, you can select it under Language menu:

But, this is impractical. You want to see log files highlighted everytime you open a file with .log extension, don't you? So, you should associate log extension with LogFile UDL. Just write the extension to the box labeled as Ext. Note that you can write multiple extension separating them with spaces:

You will end up a log file like below:

Nice, isn't it?

24 Temmuz 2012 Salı

Learn to when someone registered to Twitter and more

Visit following URL:
https://twitter.com/users/show.xml?screen_name=BillGates »

You will see an XML like that:

So, we learnt that Bill Gates registered to Twitter at Jun 24, 2009.

You can replace BillGates part in the URL with any Twitter handle you want, and see detailed information about anyone. Have fun :)

https://twitter.com/users/show.xml?screen_name=mmdemirbas »

23 Temmuz 2012 Pazartesi

WinSCP SSH Tunneling Tutorial

WinSCP is a greate and free SFTP, SCP and FTP client for Windows. We will deal with the SSH tunneling scenario in this short tutorial.

SSH Tunneling Scenario

The PC wants to connect to Server B over Server A.
In other words, Server A will behave like a proxy.

Step 1: Target Host

In Session tab, enter host name, user name and password for target server (Server B):

Step 2: Proxy Host

In Connection > Tunnel tab, enable Connect through SSH tunnel checkbox and enter connection information for proxy server (Server A):

Step 3: Save Information (Optional)

You can save information to quickly access later.

 That's all.

20 Temmuz 2012 Cuma

Single WCF Service with SOAP & JSON Endpoints Tutorial

We want to write a single web service and to be able to access it both using SOAP and JSON. Also we need to generate a help page and publish WSDL. We don't want code duplication. Single service, simple configuration, and both access methods supported. How? Keep reading.

Step 1: Service Interface

Locate attributes (annotations of C#) properly in your service interface.

namespace CompositeService
    public interface IMyService
        [WebInvoke(UriTemplate = "login"BodyStyle = WebMessageBodyStyle.Wrapped)]
        LoginResponse Login(string username, string password);

        [WebInvoke(UriTemplate = "logout"BodyStyle = WebMessageBodyStyle.Wrapped)]
        ResponseEnum Logout(int userId);
    public class LoginResponse
        public ResponseEnum Durum { getset; }

        public int UserId { getset; }
    public enum ResponseEnum
        [EnumMember]Failed = 0,
        [EnumMember]Success = 1

Step 2: Implementation

Implement logic by yourself.

Step 3: Configuration - Important Part!!

    <!-- Define 2 endpoints (soap and json) -->
        <service name="CompositeService.MyService"
                 behaviorConfiguration="mySoapBehavior" >            <!-- Default service behavior is SOAP -->
            <endpoint address="soap"
                      contract="CompositeService.IMyService" />
            <endpoint address="json"
                      contract="CompositeService.IMyService" />  <!-- Json endpoint behavior is REST -->

    <!-- Define 2 behaviours: Default service behavior (SOAP) and REST endpoint behavior -->
            <behavior name="mySoapBehavior" >
                <serviceMetadata httpGetEnabled="true" />              <!-- Enable WSDL publishing -->
                <serviceDebug includeExceptionDetailInFaults="true" /> <!-- Enabled for debug purposes -->
            <behavior name="myJsonBehavior" >
                <webHttp defaultOutgoingResponseFormat="Json"
                         helpEnabled="true" />                         <!-- Enable REST help page -->


Access URL's

Congrats! If everything OK, you done in this point. Try following URL's:

SOAP Endpoint:
REST Endpoint:
REST Help Page:

WSO2 ESB + ClientAccesPolicy.xml + CrossDomain.xml

ClientAccesPolicy.xml and CrossDomain.xml files have to be found at root of your services Silverlight and Flex clients to be able to acce...