quinta-feira, 29 de agosto de 2013

Format of dates ISO 8601 translated to C#

Formatos ISO 8601 (inclui Atom)

    yyyy-MM-ddTHH:mm:ss.SSSZ
    yyyy-MM-ddTHH:mm:ss.SSS
    yyyy-MM-ddTHH:mm:ssZ
    yyyy-MM-ddTHH:mm:ss
    yyyy-MM-ddTHH:mmZ
    yyyy-MM-ddTHH:mm
    yyyy-MM-dd
    yyyy-MM
    yyyy

Translate to C#

    yyyy-MM-ddTHH:mm:ss.fffz
    yyyy-MM-ddTHH:mm:ss.fff
    yyyy-MM-ddTHH:mm:ssz
    yyyy-MM-ddTHH:mm:ss
    yyyy-MM-ddTHH:mmz
    yyyy-MM-ddTHH:mm
    yyyy-MM-dd
    yyyy-MM
    yyyy


yyyy
     The year shown in 4 digits. For example: 2008.
MM
     The month shown in 2 digits. For example, appear as of April 04. If the month is not given, the default is the first month of the year (01).
dd
     The day, shown in 2 digits. For example, appear as new day 09. If the day is not given, the default is the first day of the month (01).
T
     Designates the beginning of the time component of the representation date / time. If the time is not given, it defaults to 00:00:00.000.
HH
     The time shown in 2 digits. For example, 1 pm appear to 13. If the time is not provided, the default is 00.
mm
     The minutes, shown in 2 digits. For example, 15. If the minute is not provided, the default is 00.
ss
     The second, shown in 2 digits. For example, 49. If seconds are not provided, the default is 00.
SSS (for C# fff)
     Milliseconds, shown in 3 digits. For example, 555. If milliseconds are not provided, the default is 000.
Z (for C# z)
     The assignment for the time zone Zulu, which is the allocation and military aviation for GMT (Greenwich Mean Time).

     With ISO 8601, the time zone can also be expressed as moving to plus (+) or minus (-) from time Coordinated Universal Time (UTC) or GMT. For example: 2008-04-13T17 :25:55.123-08: 00. If the time zone is not provided, the default is the time zone in which the JVM is running MashupHub.

Maximum number of items that can be serialized or deserialized in an object graph is '65536'. Change the object graph or increase the MaxItemsInObjectGraph quota.


OK, that's the problem.

The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:ObterSituacaoClienteGrupoResult. The InnerException message was 'Maximum number of items that can be serialized or deserialized in an object graph is '65536'. Change the object graph or increase the MaxItemsInObjectGraph quota. '.  Please see InnerException for more details.

First of all, this message was received by the client of the service. So, the issue has two sides: client and server.

The server side

On the server side you're gonna have to add a new property to your behaviour.

Example



  <system.serviceModel>

    <behaviors>

      <serviceBehaviors>
        <behavior name="MyBehaviour">
          <serviceMetadata httpGetEnabled="False" httpsGetEnabled="True"/>
          <serviceDebug includeExceptionDetailInFaults="False"/>
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
        </behavior>
    <services>


      <service behaviorConfiguration="MyBehaviour" name="Netdaniels.Services.Rating">
        <endpoint address="" binding="netTcpBinding" bindingConfiguration="MyBehaviour" bindingNamespace="http://www.netdaniels.com.br/product/risk/v1" contract="Netdaniels.Contract.IRisk" />



        <host>
          <baseAddresses>
            <add baseAddress="/Risk.svc" />
          </baseAddresses>
        </host>
      </service>

Unfortunately you have to change the client site too.

The client side

Example

<system.serviceModel>
<behaviors>
      <endpointBehaviors>
        <behavior name="MyBehaviour">
          <dataContractSerializer maxItemsInObjectGraph="2147483646" />
        </behavior>
      </endpointBehaviors>
</behaviors>

      <endpoint address="net.tcp://serverofclient:10261/Netdaniels.MyClient/shaba/"
                binding="netTcpBinding" behaviorConfiguration="MyBehaviour" bindingConfiguration="NetTcpBinding_IShaba"
                contract="ServicesNetdaniels.IShaba" name="NetTcpBinding_IShaba">
        <identity>
          <servicePrincipalName value="host/serverofclient" />
        </identity>
      </endpoint>

This is one of the most annoying problems I ever had.

I don't know if you noticed but there's a ripple effect related to this problem.

SERVER1 <- CLIENT 1 <- CLIENT 2 <- CLIENT 3

The scheme above means that, if you change configuration of server 1 you'll have to change configuration of client 1. If client 1 has a client, the configuration of this one must be changed too ans so on.

That's all folks!








terça-feira, 27 de agosto de 2013

ITILV3 - Day 37

IT Operations Management

IT Operations Management performs and monitors daily operational activities and events.

Example: IT Operations Management comprises the staff in a NOC (Network Operations Center).

Operations Management objectives:

1 - Diagnose IT Operations failures quickly.
2 - Improve service and reduce costs.
3 - Maintain stable processes and activities.
When it comes to Brasil Operations Management and Área de Infraestrutura are the same thing.

sexta-feira, 23 de agosto de 2013

Reading directories

import java.io.File;

public class DirList {
   public static void main(String args[]) {
      String dirname = "/tmp";
      File f1 = new File(dirname);
      if (f1.isDirectory()) {
         System.out.println( "Directory of " + dirname);
         String s[] = f1.list();
         for (int i=0; i < s.length; i++) {
            File f = new File(dirname + "/" + s[i]);
            if (f.isDirectory()) {
               System.out.println(s[i] + " is a directory");
            } else {
               System.out.println(s[i] + " is a file");
            }
         }
      } else {
         System.out.println(dirname + " is not a directory");
    }
  }
}

Read and Write file using Java

import java.io.*;

public class fileStreamTest{

   public static void main(String args[]){
  
   try{
      byte bWrite [] = {11,21,3,40,5};
      OutputStream os = new FileOutputStream("test.txt");
      for(int x=0; x < bWrite.length ; x++){
         os.write( bWrite[x] ); // writes the bytes
      }
      os.close();
    
      InputStream is = new FileInputStream("test.txt");
      int size = is.available();

      for(int i=0; i< size; i++){
         System.out.print((char)is.read() + "  ");
      }
      is.close();
   }catch(IOException e){
      System.out.print("Exception");
   }   
   }
}

quinta-feira, 22 de agosto de 2013

Could not find or load the default class

Hey!
How are you doing?
If you are like me, trying to remember how to configure youre machine to start programmin in JAVA, that's how your enviromental variables must look like bellow:
CLASSPATH = .;C:\Program Files\Java\jdk1.7.0_21\bin

JAVA_HOME=C:\Program Files\Java\jdk1.7.0_21

Path= %JAVA_HOME%\bin
Attention:
Avoid redundance of javas
For instance, my windows has JDK 1.7, JRE 1.6 and JRE 1.7.
If your machine was set for programming, use only jdk. Otherwise your gonna receive messages that are variations of that one
"Could not find or load the default class" - very irritating message.














And to be sure you are using the right version go DOS command line and type
java -version
The result in my case is
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) Client VM (build 23.21-b01, mixed mode, sharing)
You must be absolutely right about the javac and java. Both must be from the same version or, when you try to run you .class file, you're gonna receive an error message.
And that's all folks!


terça-feira, 13 de agosto de 2013

NANT - ftpUpload - [ftpUpload] ProtocolError - The remote server returned an error: (550) File unavailable (eg, file not found, no access).


[ftpUpload] ProtocolError - The remote server returned an error: (550) File unavailable (eg, file not found, no access).

Be the build file bellow the one I'm currently using to upload the files and directories of C:\ServicePublish

<project name="buildSolution" default="upload">
    <target name="upload" description="Upload files">
   
        <ftpUpload host="server001" username="user001" password="password001" todir="/MyService"  >            
            <fileset basedir="C:\ServicePublish\">        
                <include name="**/*" />
            </fileset>            

        </ftpUpload>    

    </target>               
   
</project>

Something you should understand

On server001, in /MyService, you are obliged to have the same tree of C:\ServicePublish

In other words

If the structure of your local machine is

C:\ServicePublish\Db
C:\ServicePublish\XML
C:\ServicePublish\Bin

The structure of /MyService must be

/MyService/Db
 /MyService/XML
/MyService/Bin

Otherwise, you're gonna receive the message:
 [ftpUpload] ProtocolError - The remote server returned an error: (550) File unavailable (eg, file not found, no access).

Conclusion:
ftpLoad doesn't create directories! 

sexta-feira, 9 de agosto de 2013

ITILV3 - Day 36

Internal and External Customers and Services

Internal Customers belong to thesame organization as the service provider. For example: departments, teams, or units. Internal Services are provided to customers in the same organization.

External Customers are not part of the organization providing the service. They enter into contracts with the service provider for service and pay money for those services.

External Services are provided to external customers.


segunda-feira, 5 de agosto de 2013

Excelente curso de japonês

Curso de Japonês

O “Curso de Japonês” da NHK WORLD é transmitido em 17 línguas. Selecione o seu idioma.

Japonês em 50 lições com a NHK WORLD RÁDIO JAPÃO

“Curso de Japonês” – aprenda japonês online em português –
Programas de 10 min. com a NHK WORLD transmitidos pelo rádio toda semana
 
 
http://www.nhk.or.jp/lesson/portuguese/

ITILV3 - Day 35

Information Security Management (ISM)

Information Security Management is a method used to ensure information availability, confidentiality and integrity.

The information security Manager ensures that the information security policy of the organization meets the Service Level Agreement (SLA) required levels of confidentiality, integrity and availability.

Information Security Management elements:

1. Control
2. Plan
3. Implement
4. Evaluate
5. Maintain

Corporate IT governance determines what needs to be protected as well as the level of protection in Information Security Management.

sexta-feira, 2 de agosto de 2013

ITILV3 - Day 34

Incident Management

Objectives:

1. Reduce the adverse effect on business operations.

2. Return to normal service operation quickly

Incident Models and Known Error Records are used to manage an Incident.

An incident Model predefines a standard method of steps that will be taken to handle and incident.

Successful incident management begins with logging every incident, requiring and categorizing incidents to assist with trend analysis.

Incident closing procedures:
1. Assign the correct incident category.
2. Ensure user satisfaction.
(Obvius)

Hierarchic Escalation means to notify IT managers about an incident.
(It seems to me that HIerarchic Escalation has nothing to do with solving the problem)
Functional Escalation means to escalate up the service chain for support and problem resolution.


quinta-feira, 1 de agosto de 2013

How to call a excel macro from VB6

Very simple!

This is old stuff, nonetheless, useful stuff
 
Private Sub Command1_Click()
  Dim x As Object
    
   Set x = CreateObject("Excel.Application") ' Create excel object

    x.Workbooks.Open txtPath.Text  'Open File; ex: c:\abc.xls

    x.Visible = True 'Turn visible on

    x.Run txtMacro.Text  'Execute Macro - Keep in mind that you already know the name of the macro

End Sub

Há!