Whaly's World tail -f /var/log/whaly

2Nov/090

SEO: Subfolders or Subdomains

I recently moved my blogs from subdomains and multiple domain to one domain with subfolders, here are articles on the subject from Chewy's Blog and Search Engine Journal

... search engine view subdomain site as a different site so the work you have done on the sub domain does not directly affect the parent domain as they are viewed as a separate entity.

History, first I had my blog.baleinoid.fr and whaly.baleinoid.fr websites, I moved recently whaly.baleinoid.fr to wha.ly for the fun of the new domain :-) now I moved again and I have http://baleinoid.com/journal/baleine and http://baleinoid.com/whaly

I checked the pro and cons and I choosed the subfolders path, because I don't have a lots of backlinks and it's easier to get a better search engine rank with one domain.

Subfolders Pro:

  • to spread/share the rank of the domain

Subdomains Pro:

  • if you have different hosting server for your blog / forum / website

9Oct/090

WCF WSDL SOAP binding: Rpc or Document, Encoded or Literal

Yeah, my new WebService must be Rpc/Encoded. What ????

Hopefully this page from Ibm explain the different style/use in SOAP message.

A WSDL document describes a Web service. A WSDL binding describes how the service is bound to a messaging protocol, particularly the SOAP messaging protocol. A WSDL SOAP binding can be either a Remote Procedure Call (RPC) style binding or a document style binding. A SOAP binding can also have an encoded use or a literal use.

Ok now I know that four style/use models:
RPC/Encoded, RPC/literal, Document/encoded or Document/literal

But how do I do that in WCF C# ?? It's very easy, just use the [XmlSerializerFormat] attribute.

Here is a very very simple test to check the different result in the soap message:

Interface of the Wcf service used :

using System.ServiceModel;

namespace WcfService1
{
    [ServiceContract]
    public interface IService1
    {
        [OperationContract]
        [XmlSerializerFormat(Style = OperationFormatStyle.Rpc, Use = OperationFormatUse.Encoded)]
        string TestRpcEncoded(int value);

        [OperationContract]
        [XmlSerializerFormat(Style = OperationFormatStyle.Rpc, Use = OperationFormatUse.Literal)]
        string TestRpcLiteral(int value);

        //[OperationContract]
        //[XmlSerializerFormat(Style = OperationFormatStyle.Document, Use = OperationFormatUse.Encoded)]
        //string TestDocumentEncoded(int value);

        [OperationContract]
        [XmlSerializerFormat(Style = OperationFormatStyle.Document, Use = OperationFormatUse.Literal)]
        string TestDocumentLiteral(int value);
    }
}

Result captured on the network with fiddler:

For clarity, I have removed:

  • s:Envelope tag
  • xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
  • xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  • xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  • xmlns="http://tempuri.org/"

RPC / Encoded call

<!-- Request -->
<s:Body s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <q1:TestRpcEncoded>
    <value xsi:type="xsd:int">42</value>
  </q1:TestRpcEncoded>
</s:Body>

<!-- Response -->
<s:Body s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <q1:TestRpcEncodedResponse>
    <TestRpcEncodedResult xsi:type="xsd:string">You entered: 42</TestRpcEncodedResult>
  </q1:TestRpcEncodedResponse>
</s:Body>

RPC / Literal call

<!-- Request -->
<s:Body>
  <TestRpcLiteral>
    <value xmlns="">42</value>
  </TestRpcLiteral>
</s:Body>

<!-- Response -->
<s:Body>
  <TestRpcLiteralResponse>
    <TestRpcLiteralResult xmlns="">You entered: 42</TestRpcLiteralResult>
  </TestRpcLiteralResponse>
</s:Body>

Document / Encoded call
If you add the TestDocumentEncoded you will get an InvalidOperationException.
This combination is not supported.

Document / Literal call

<!-- Request -->
<s:Body></code>
  <TestDocumentLiteral><value>42</value></TestDocumentLiteral>
</s:Body>

<!-- Response -->
<s:Body>
  <TestDocumentLiteralResponse>
    <TestDocumentLiteralResult>You entered: 42</TestDocumentLiteralResult>
  </TestDocumentLiteralResponse>
</s:Body>

24Sep/090

WWW or NO-WWW ?

For my new domain "frederichusson.com" I used links without "www." like "http://frederichusson.com" mainly because I like when things are simple.

Then I realized that maybe it was a mistake and maybe a "www." site can get a better ranking in search engine.
Then I searched on this subject and came accross "www. is deprecated" and a little after on an article at sitepoint.com

And so I decided to stay without "www." and to take some actions :

  1. Keep my current link without the www.
  2. Add a .htaccess file to redirect (301) visitors from http://www.frederichusson.com to http://frederichusson.com (for help look at "How can I become Class B?")
  3. Use the Google Webmasters Tools to configure my favorite domain.

15Sep/090

Howto test if and index exist in SQL Server

IF INDEXPROPERTY(OBJECT_ID('TableName'), 'IndexName', 'IndexID') IS NOT NULL
	PRINT 'Index is here'
ELSE
	PRINT 'Index not found'

10Aug/090

An easy way to remote control your mum :-)

TeamViewer

Why I use it for my mum ?

  • Very easy to use, just a click on an icon and she give me her id and password, nothing else to do.
  • Nothing to config to pass through firewalls.
  • You can send a file on the remote computer quickly.
  • It's not opensource, but it's free for non-commercial, personal use.

Need it ? Go to the TeamViewer Homepage

9Aug/092

The time separator

DateTime.Now.ToString("HH:mm:ss");

is a common mystake if you want to transmit to someone or to be sure that you have something like "HH:mm:ss" because the character (:) is not just a colon, it's a time separator wich depend on the locale.

Here is a list of culture where the (:) change into a dot (.)
it-IT : Italian (Italy)
fo-FO : Faroese (Faroe Islands)
bn-BD : Bengali (Bangladesh)
ml-IN : Malayalam (India)
bn-IN : Bengali (India)

To workaround you can use CultureInfo.InvariantCulture or escape the colon character.

... and same story for the date separator "/" but this one is at this time the same for every culture.

Tagged as: , , 2 Comments
20Jul/090

Changing the subtitle language in Monkey Island Special Edition

The first time you start Monkey Island SE, you can choose the subtitle language, but after that you can't do it anymore with the game interface.

You can follow the instruction on the steam support page or you can use my little tool and if you don't trust me the source code is available.

Have fun !
Whaly



16Jul/092

XmlWriter and UTF-8 encoding without signature

I used this code to serialize some objects in Xml :

XmlWriter writer = new XmlTextWriter(stream, Encoding.UTF8);

But the output contains an UTF header, the Byte Order Mark (BOM). The use of the header/signature is usually for xml file, if you want to use the ouput in an HttpResponse, you don't need the signature. (some parser can cause a parsing error in java, like org.xml.sax.SAXException).

Here is the change to remove the BOM :

XmlWriter writer = new XmlTextWriter(stream, new UTF8Encoding(false));

Tagged as: , , , 2 Comments
12Mar/080

Artificial Intelligence in Games

Logo site AIGameDev.com

is now in my bookmark and in my rss reader, as it should be in yours :-)

-- From Theory… To Practice!
--

Tagged as: , , No Comments
10Mar/080

Artificial Intelligence: A Modern Approach

Artificial Intelligence : A Modern Approach

by Stuart Russell and Peter Norvig

Thats THE book on the subject :-)

http://aima.cs.berkeley.edu

Tagged as: , No Comments