Custom Domain visualization - sqlanywhere

I'm storing .NET TimeSpan objects in a SQL Anywhere database as their underlying .NET implementation type, a 64-bit integer. I've even created a custom domain called "timespan" to do so.
When debugging in Visual Studio, you can override the default ToString() for the debugger window so that it shows what you want. I'm looking for a similar capability in SQL Anywhere.
Does anyone know if there's a way to specify a visualizer (or a format string, or anything) so that when interactively browsing a SQL Anywhere database, it will display a timespan value of 600000000 as 00:01:00.00 like it would in Visual Studio?

Related

Can telosys generation invoke external program prior to writing to target location and based on the return value continue or cancel writing to target

I want to generate c# asp.net core razor pages with many projects: Application, Domain, Infrastructure, Core etc.
I would like to know if Telosys is extensible to allow a custom console program to be called with arguments: , so this program can do some code merges in order to preserve possible additions/changes to the code a developer did since the previous code generation?
C# can have some directives called #region to partition the code and these will be "regenerate only regions" and outside these regions the developer can put his own code. We need to preserver his code.
C# Partial classes and methods can also help.
I want to have capability to merge newly re-generated code (e.g. entity class - I can add some properties or change some property name, type, annotations, tags etc.) into previously generated entity class. This could be done by creating #region .... #endregion where the code can be regenerated into and all the code that is outside these regions should be preserved. See: efg.loresoft.com/en/latest/regeneration So I would like to know if there would be a way to temporarily generate files in a TMPGEN folder and allow some "merge program to run" that will mege new code with previously generated code (with some code added by the developer) previously determining if merge is needed (compare hashes)
This is the code from EntityFrameworkCore.Generator tool that merges existing regions https://github.com/loresoft/EntityFrameworkCore.Generator..EntityFrameworkCore.Generator.Core/Templates/CodeTemplateBase.cs has the protected virtual method:
void MergeOutput(string fullPath, string outputContent) show that fullPath is an existing file and outputContent is the result of parsing the template (new content). RegionParser uses these namespaces: Microsoft.CodeAnalysis.CSharp; and Microsoft.CodeAnalysis.CSharp.Syntax;
so I need to user c# console application to user this preserver region code.
Thanks,
Rad
Yes, Telosys is extensible by using specific Java classes loaded in the template context with $loader
See : Is it possible in a Telosys template to call a function created specifically?
So, you just have to create a Java class to launch any Shell command
For example, see : How to get java getRuntime().exec() to run a command-line program with arguments?

Idea cannot find my tables in String with Postgresql language injection

I have been using Language Injection in Java code with Intellij Idea for years. It is nice because I can CTRL+Click from SQL types in my string in my Java to the schema in the data sources tab.
Recently I had to change all of our SQL queries to not hard code a schema name. Everything runs fine but Intellij thinks all of my tables do not exist inside my Postgresql Language strings.
In the SQL console in IDEA I fixed this by setting the search path. However I do not see where I can set the search path of injected strings in my Java. Any ideas?
Press CTRL+SHIFT+A -> find 'Attach session' action -> select target PG data source -> you can use already opened console session or create a new one, then you will be able to edit search path.
Exactly for that case IDEA has "SQL Resolution Scopes" mapping. There you can define mapping between files, data sources and expected "search path"

In Oracle Sql Developer, how can I view package_b scope (static) variables while debuging package_a?

I'm trying the debug function in Oracle Sql Developer 18.4, it looks fine until I ran into some complicate cases, one of them is, it seems I cannot view package_b.some_variable while I'm inside package_a.
See above screen, I'm currently break in package_a, which populate data into package_b (pk_DatVerify.g_model_boc and pk_DatVerify.g_model_boc_count), but the "Watches" window is not able to display any of them.
Is there any way I can see the variable value in pk_DatVerify.g_model_boc at that moment? Even if I have to manually type "dbms_output.put_line" somewhere (like in a command window), it will be much helpful!

How to reference COM lib like shdocvw using vbc commandline compiler (no IDE)?

The basis of this question comes from this tutorial on support.microsoft.com:
http://support.microsoft.com/kb/176792
To run the following code, it is necessary to add a reference to
"Microsoft Internet Controls" (Shdocvw.dll) and "Microsoft HTML Object
Library" (Mshtml.dll) to the Visual Basic project:
Dim SWs As New SHDocVw.ShellWindows
Dim IE As SHDocVw.InternetExplorer
This works fine in Visual Studio 2010, but it seems to rely on some behind-the-scenes magic that I can't duplicate using the straight commandline vbc compiler.
Obviously there is no "Add Reference" dialog for the commandline compiler. I naively tried adding:
/reference:"C:\windows\system32\shdocvw.dll"
to the commandline, but that didn't help. In both cases, I get:
error BC30002: Type 'SHDocVw.ShellWindows' is not defined.
error BC30002: Type 'SHDocVw.InternetExplorer' is not defined.
I've successfully used shdocvw.dll, AKA Shell.Application, from other languages like vbscript and autohotkey, but I currently have too little understanding of VB.NET to know whether I'm just doing it wrong or it's not possible.
You will have to run the Tlbimp.exe utility first. That's the tool that generates the interop library from the type library embedded in shdocvw.dll, normally done automatically when you add the reference in the IDE. It produces interop.shdocvw.dll, the one you need to pass with the /reference option.

ReSharper auto-complete behavior with anonymous types in a lambda expression

I am using C# 3.5 and Linq. I have ReSharper 6.1 on VS 2010.
For example, if I enter the following statement in the code editor:
var result = dataContext.Items.Select(i => new {Name = i.ItemName});
As soon as I type the new { it auto-completes to new string{}. Actually, not sure if it is always string or depends on the lambda. But I find I always need to delete it and back up. This happens whenever I am declaring anonymous types in a lambda.
What setting in ReSharper or VS do I need to change in order to be able to enter anonymous types using the above syntax without that occurring? Preferably, I would like to retain auto-completing in all other situations, just not this particular one as it is making an incorrect assumption as to my intent.
Resharper 6.1 added a new feature to control the way the intellisense autopopups act. Go to ReSharper->Options->Environment->IntelliSense->Autopopup and change the "After 'new'" setting to "Display but do not preselect".