Software Developer @ Royal TS
i am working on the new version of Royal TS from code4ward.net. here i struggle with windows-forms development ;)
Solution Architect @ IAEA/Safeguards
currently i am working as a Solution Architect at the IAEA in vienna:
Team Leader @ BWin
Before the IAEA i worked as a team lead of two software development teams at bwin.party (http://www.bwin.com)
my job was to
Private stuff
it is very relaxing for me to write some windows phone 7 apps to stay up to date ;). and if i dont do some coding, i love to improve my skills with my D7000 and get better in composing better shots.
In the this blog post we want to draw your attention to some “not-so-super-exciting” panels – but they still have some nice hidden features: the properties panel and the notes panel.
To Show or not to show
By default when you start Royal TS V2 the properties panel as well as the notes panel is not visible. To show them click in the Ribbon on “Other Panels” (or use “F4” as shortcut for the properties panel).
Both panels can be docked to the edges (default) or tabbed in the tab bar.
As you see in the center of the picture above you can work in the same way as with any advanced docking framework you might know and love.
Additionally you can have them as floating child windows (you get this with drag n drop or with double-clicking the title bar)
When docked to the edges you can also use the pin glyph to auto-hide them.
The properties panel
The properties panel shows … you guessed it! … the properties of a selected object. Besides some meta-data like “Created”, “Created by”, “Modified” and “Modified by” this panel shows its most usefulness when showing properties of connections or tasks. Everything (and more) that you can manipulate through the UI is shown here also. The data shown is read-only though.
5 Tips to work with the properties panel
Since especially in the case of connection objects, the amount of data shown is huge. To work more efficiently with it you can
1. Click on the header „Property Name” or “Value” to sort view
2. Double-click on any row to copy the value in the clipboard
3. Press CRTL-F and enter a string – the panel content is then filtered
4. Right-click on any row – this especially allows you to edit the selected object (not the specific property)
5. If you click on a pre/post connection task you have “Execute” in the context menu and can directly execute the task!
6. If you right click on any Custom Field (1 to 10) you have the “Execute” menu enabled as well. So if you entered a URL it is opened in the default browser. This is quite handy if you store e.g. web interfaces to admin websites. And of course it works with commands as well (as in the screenshot you can see “cmd.exe” in Custom Field 1)
The notes panel
For any selected object (any connection, task, credential, folder, document – even the application document - you can attach some notes to it. Click “Edit Notes” to bring up the rich text popup (which might take a little bit of time for the first time you launch it).
If you attach notes in the Application document they get saved automatically, for all other documents you have to save them for yourself.
Cheers,
Michael
In this blog post we want to show you how you can import data from CSV files and create connections, web pages, tasks and credentials in a very dynamic way. There are many ways to get data dumped to a CSV file (export from some Excel sheet, from a CMDB or maybe even create one via some script).
First of all fire up Royal TS V2 and make sure you have an open document where you want to import the CSV data into. Then select “File” from the Ribbon and click on “Import” and then “CSV File”:
In the “Object Type” dropdown you can select one of the supported types (at the moment you can create Remote Desktop Connections, Web Connections, Tasks and Credentials). Additionally you have to specify the path to the CSV file.
After clicking on “Next” you specify the separator (coma, semi color or tab) and if the given file contains column headers.
With the “Update Preview” button you can check upfront if Royal TS V2 can successfully open and parse the file with the given context:
In the next page of the wizard you specify the mappings.
In the left dropdown column you define object properties of the generated object (in our case a Remote Desktop Connection). In the dropdown you will find all supported properties. Note that the field “URI” is the umbrella term for the field “Computer name” for Remote Desktop Connections and “URL” for Web Connections.
In the right dropdown column you find the list of variables that will be dynamically filled by values from the CSV.
If you want add another mapping definition, use the “Add Mapping” button. Also you can remove any defined mapping with clicking on the “x” right next to it.
For example consider the content of the following CSV file (which was used to create the screenshots as well):
Computer,Type,Description,CV1,CSVPassword,ConnectToConsole,ColorDepth,InventaryNumber
DCOM206,ComputerD,d1,custom field 1,pwd1,true,16,10032
OM212,ComputerO,d2,custom field 2,pwd2,abc,9,102390
This will result in variables like $Computer$, $Type$ etc.
After specifying all properties that are relevant for you please click “Next”.
In the last step of the wizard you define where to put the imported objects (which document and folder). After clicking “OK” the wizard is finished and you can work with your objects.
Now I want to give you some more advanced tips on how to use the CSV import dialog.
CSV Import Tip 1: Bulk-edit after import
If you forget to specify some common element e.g. like Color Depth should be 16bit you can always select all imported objects and bulk-edit them. Just select the destination document and in the Dashboard select all imported objects.
Then click on “Properties” in the Ribbon or from the context menu.
In the properties pages then you see that the controls are disabled. Click “Override” and then e.g. “Color Depth”. This way you can overwrite the property for all selected objects with a simple click.
CSV Import Tip 2: Adapt the template before importing
Having the ability to specify all possible properties during the import is a very mighty feature. But usability-wise it is easier to have a nice UI for this. New Connections (Remote Desktop Connections and Web Connections for the time being) are created with values based on the template that is specified in the Application.
All properties you set here are used for new connections. So adapt the template to your liking and then import from the CSV.
Remark : in the current build (2.00.00.11020) we do have a bug regarding this templating mechanism. We are aware of it and will have it solved soon.
CSV Import Tip 3: Fun with variables
As we have explained the columns of the CSV translate to variables you can use for the import:
In the example above the Color Depth of the new objects will be set to the values from the CSV under the colum “ColorDepth”.
But you can do even more flexible stuff:
In the previous screenshot we want to set the “Description” field from the newly imported connection to a value that combines two values from the CSV. RoyalTS will expand “$InventaryNumber$-$Computer$” to the correct data from the CSV.
CSV Import Tip 4: Specify fixed values for all imported connections
You can easily specify a fixed value to any property that will be applied automatically to all connections. Remark: for Boolean values its “true” and “false”.
E.g. we want to set the feature “Use Multiple Monitors in Full Screen Mode” via the import mapping, you simply type “true” instead of using a variable from the dropdown:
Cheers,
Michael
Royal TS V2 will introduce a plethora of new features but at the same time supports the old file format from Royal TS V1.x. We made sure that you can migrate to our new V2 version seamlessly and without any issues.
Basically there are two ways to work with the .rts files: you either
Importing Royal TS V1.x files
Click in the Ribbon on "File" and in the Backstage area on "Import". This shows you the possible files Royal TS V2 can import at the moment: RDP File, CSV File and RTS File. RDP and CSV file imports are topic for another blog post - so stay tuned.
After selecting the "RTS File" option you enter a wizard that helps you defining how to import the Royal TS 1.x file.
You have to specify the path to the Royal TS 1.x file. Optionally you can define to import the Task Definitions (if any) from the Royal TS 1.x definitions. Tasks in Royal TS 1.x were stored in a separate document inside your Application Data directory. If you have spent a lot of time to maintain and set up your tasks this is a good way to seamlessly work with the same Task Definitions in the new version. Now click “Next”.
In the next step of the wizard you can specify the document and path where to import the Royal TS 1.x file. In our example we have only one document open (“code4ward Systems”). So it is required that you have a document open already where you can import the old file into. As import destination you can also specify a specific folder (in the screenshot above you can see that “Connections” is selected as destination folder).
After clicking “OK” you get a small confirmation message box:
If you have opted for importing the Task Definitions from the old file you can find them now in a new folder “Imported Tasks” under the root of the selected document or folder. In our case they are located at “code4ward systems” -> “Connections” -> “Imported Tasks”.
After importing you find also an entry in the Log about your import:
We have spent quite some time to make our document structure internally forward- and backwards-compatible. So you can safely open V1.x files in the Royal TS V2 directly and it will get converted in place. Just open V1.x files as you would open V2 files:
Click “Open” in the Ribbon Toolbar and make sure, you select “Royal TS 1 Files (*.rts)” in the filter.
After clicking “Open” Royal TS V2 converts the document to the new V2 format. You get notified with a message box that the new document was saved immediately with the same name but the new *.rtsx filename extension.
After confirming you can start working directly with your connections in V2! Task Definitions have been imported automatically for you. Note that in this case you don’t need to have a document open before you start because opening the old file will automatically create a new document for you.
The Log view in V2 will also have two new entries: one for Opening the V1.x file, one for the automatic save in the V2 format that happened.
Today I trippled over a very interesting change between .NET 3.5 and .NET 4.0:
I conducted a code review and found the following code:
1: var message = new MailMessage();
2: message.From = new MailAddress("...");
3: message.To.Add(new MailAddress("..."));
4: message.Subject = "...";
5: message.Body = "...";
6:
7: var client = new SmtpClient("host");
8: client.Send(message);
I remembered to use SmtpClient in a using statement to trigger IDisposable properly. But to my great surprise I found out, that in .NET 3.5 SmtpClient doesn’t implement IDisposable, in .NET 4.0 it does!
This is especially interesting because you don’t get any compiler notice if you migrate from 3.5 to 4.0…
Though, if you have enabled FxCop running (Enable Code Analysis on Build) even with the smallest set of rules from Microsoft they do give you the hint to use usig:
Btw: MailMessage is implementing IDisposable in 3.5 and 4.0.
lets start with a simple class for demonstration purposes – note, that the DateOfBirth is nullable …
1: public class Person
2: {
3: public string Name { get; set; }
4: public DateTime? DateOfBirth { get; set; }
5: }
using object initializers, we can instantiate the class in the following way:
1: // works
2: Person p1 = new Person() { Name="Michi", DateOfBirth=DateTime.Now };
but what happens, if we want to do the initialize the values based on some condition? you could be tempted to write the following code:
1: // doesnt compile
2: // Type of conditional expression cannot be determined because there is no implicit conversion between ''
3: bool someCondition = false;
4: Person p2 = new Person()
5: {
6: Name = "Michi",
7: DateOfBirth = (someCondition == true ? null : DateTime.Now)
8: };
boom! you get a compile error:
interestingly enough, an assignment from null to DateTime? is working!
1: // but this works...
2: Person p3 = new Person();
3: p3.Name = "Michi";
4: if(someCondition == true)
5: p3.DateOfBirth = null;
6: else
7: p3.DateOfBirth = DateTime.Now;
hmmm… so how do we get to use object initializers for elegante syntax but still are able to assign nullable types? fallback to the “real” type
that is used behind the scenes if you declare a DateTime? – it’s an instance of the System.Nullable struct – see Nullable Types C# on MSDN.
so here is the working code:
1: // in order to still use object intializers you can use the "real" type of DateTime?
2: Person p4 = new Person()
3: {
4: Name = "Michi",
5: DateOfBirth = (someCondition == true ? new Nullable() : DateTime.Now)
6: };
just sent my old homepage into retirement and created a fresh one with flavors.me – kinda neat to configure and flexible enough for me to make a nice hub of my digital activities. nothing more, nothing less – enjoy www.sargola.com.