Monday 20 February 2017

How to stay awake at work (after doing weekend work).

Over the weekend I had to do a bunch of coding and crack my brain for a solution.
Monday morning I was back at it again coding after only a few hours sleep, not to mention having to do boring administration work at work. I always like to get my good 8 hours of ole sleep, so not like I do this all the time!

I knew that I would suffer a lot, because we have to keep up a high level of concentration at work. After some googling I found some stuff that I thought would help inspire me to keep awake, but I then thought to share my own spin on it.

So my top tips are:

1. Switch up your tasks when you feel yourself drifting off.
Work on something else for a bit or something more exciting, stay away from boring stuff.

2. Play music, youtube etc.
I hit the good old tube, I find some chillout mixes to be particularly effective.

3. Take a few breaks throughout the day.
Can take some strategic toilet breaks and close your eyes to rest them.

4. Also stare into the distance/out of a window (so called "eye breaks").

5. Eat some tasty food and drink plenty of water.
Of course glug down a coffee =) Listen to your body, it doesn't have to be super healthy in my books.

6. This my favourite one, sneak a bunch of drawing in your notebook.
Drawing can open up your imagination, it helps you to create ideas, and activates your right brain. This can potentially take the load off your left brain doing all the work and therefore makes you feel less tired.


Friday 17 February 2017

Creating XML, XSD, validating Test Instance XML and Text (Native) Files, and tips for Biztalk project issues in Visual Studio 2013/5

This is just a quick memo for myself regarding XML, XSD and creating/validating test instances of XML and Text files.

XML (Extensible Markup Language) is pretty much like a text file and can be opened as such, but with the addition of tags to describe the text information. Extensible here means that even if we make modifications to the XML text file, it is still usable by other users and software. In other words changes can be made dynamically to the XML file without it causing problems in software that uses the XML. More info here: www.w3schools.com/xml/xml_whatis.asp

XSD (XML Schema Definition) and can be used to control how exactly an XML document can appear. XML files do not need XSD files, but if you want a mechanism to check the structure and information is correct within an XML file, then an XSD file can be used. For example, an XSD file can define what tags are allowed including their nesting structure, the names of the tags and the order in which they appear in an XML file. The XSD file can also define what type of information the tags can contain, as well as their default value or an expected (fixed) value.

Creating an XSD file 
There are two ways to create an XSD file, firstly by hand, for example in Visual Studio you can use the Schema Editor and using an XML file or other reference create the structure.
  creating-new-xsd

The second method involves generating the XSD file from an XML file. This method will not give you control of what values and information the tags can contain. This can be added later using the Schema Editor, once the file is generated.

Validating / Testing the XSD 
Once you have created the XSD you can do a simple schema check in Visual Studio, right-click the XSD file and select Validate Schema.

validate-an-xsd-file

Creating a Test Instance XML/Text (Native) file 
Once your XSD has been created, you can in Visual Studio set the name of the test instance file and select type as either XML or Native Text file in the XSD properties. Then right-click the XSD and click Generate Instance.

generating-a-test-instance

Validating / Testing the Test Instance XML/Text (Native) file 
Similarly, once you have a test instance of the XML or Text (Native) file you can then test and validate it against your XSD file. Click your XSD file in Visual Studio, under Properties, go to General > Input Instance Filename and set it to the file name of the test instance or an XML file you created. Then set General > Validate Instance Input Type to XML or Native file depending on the type of file. Right-click the XSD and click Validate Instance to test your XSD file definitions against the XML or Text (Native) file.

validating-a-test-instance

Tips:

Flat File Schemas 
https://msdn.microsoft.com/en-us/library/aa561057.aspx?f=255&MSPPError=-2147217396

Unexpected data found while looking for: $Delimited$ 
https://social.msdn.microsoft.com/Forums/en-US/be46c68d-c36c-4713-b2ff-f79cda93ba7d/unexpected-data-found-while-looking-for-delimited?forum=biztalkgeneral

Postfix, prefix and infix 
 http://biztalk06.blogspot.co.uk/2008/10/postfix-infix-and-prefix.html

Early Termination with Position Flat Files
https://blogs.msdn.microsoft.com/skaufman/2004/05/07/early-termination-with-position-flat-files/

BizTalk Server: Teach me something new about Flat Files (or not) – Delimited Flat File Schema Optimizations 
https://blog.sandro-pereira.com/2015/10/23/biztalk-server-teach-me-something-new-about-flat-files-or-not-delimited-flat-file-schema-optimizations/

Viewing XSD as code 
http://stackoverflow.com/questions/3265971/viewing-xsd-as-code

Problem deploying Biztalk Application - Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) 
http://stackoverflow.com/questions/3460750/problem-deploying-biztalk-application-access-is-denied-exception-from-hresul