Table cell creation warning/error about IBlockElement - itext

Just starting to try and use iText (latest version) and following some online examples. However, this bit of code in Visual Studio 2019, VB:
Dim cell1 = New Cell
cell1.Add("Name")
gives me an intellisense warning/error in the editor saying:
Runtime errors might occur when converting 'String' to 'IBlockElement'.
Why doesn't the cell.ADD argument accept strings as per online code examples please?
(I am also not well versed in using Interfaces either!)
Thank you

Why doesn't the cell.ADD argument accept strings as per online code examples please?
Apparently the online code examples you saw were created at the time of the early 7.0.x versions. But the whole table API has been overhauled in 7.1.0 including some breaking changes.
Thus, in the current version create an IBlockElement (e.g. a Paragraph) containing your text and add that block element to your table cell.

Related

Is it possible to use data frame in r-exams?

I would like to paste the data-frame from the R environment to the latex part (question or solution part) when creating exercises in r-exams. Later the exercises will be imported into Moodle. Is that possible in r-exams? We saw it is possible when the object is matrix object via $\Sexpr{toLatex(matrix_obj)}$. But a similar way does not seem to work with the data-frames. Thank you!
A data.frame would usually be included as a {tabular} in LaTeX and there are various packages for automatic conversion like xtable or using the function kable() in knitr. For PDF output this also works nicely including all vertical and/or horizontal lines included in the table. However, for HTML-based output (as for Moodle) the table as such is converted correctly but without any lines.
An overview of a couple of solutions is available as:
Different copies of question with table for Moodle with R-Exams
Moreover, Kenji Sato has proposed to inject some dedicated CSS code to handle the table formatting in HTML. We are currently working on some automated way of including this in R/exams:
https://www.kenjisato.jp/en/post/2020/07/moodle-bordered-table/

Text from UIAutomation property value truncated to 4k

I'm using UIAutomation from a 32-bit C++ application on Windows 7 to get the text content of windows of other processes. I noticed that the API always returns strings truncated to exactly 4096 characters if the text in the windows is longer than that. This happens both with the GetCachedPropertyValue() and the GetCurrentPropertyValue() calls, for both the UIA_ValueValuePropertyId and UIA_LegacyIAccessibleValuePropertyId property Ids.
Tested, among others, against 32- and 64-bit Notepad.
When I retrieve the text using SendMessage and the WM_GETTEXTLENGTH and WM_GETTEXT messages, the complete, untruncated text is returned. (This I currently use as a workaround.)
Looking through the documentation, I can nowhere find any mention of this limitation or how to get around it, which I would expect if truncation was by design.
I found a similar question on stackoverflow but there truncation was apparently due to the Visual Studio debugger, not to the UIAutomation API. However, this question makes it clear that UIAutomation should be able to return very long texts.
Googling the issue leads to another question on stackoverflow that also mentions the 4096 character limit, but unfortunately that question and any possible answer is deleted.
Perhaps the properties UIA_ValueValuePropertyId or UIA_LegacyIAccessibleValuePropertyId are not the correct one to use, but I failed to identify a better one.
Can anyone point me out what I'm doing wrong, or have suggestions for what I could try? Pointers to pieces of documentation that I obviously missed are welcome, too.
TIA
The exposition of the value is here for convenience but has limited capabilities. Instead, you must use TextPattern and it's DocumentRange property. This is explicitly specified here.
From it you can use the GetText(-1) method to retrieve your data.
You can code it like that :
string GetText(AutomationElement ae)
{
return (ae.GetCurrentPattern(TextPattern.Pattern) as TextPattern)?.DocumentRange.GetText(-1);
}

‘GtkWidget {aka struct _GtkWidget}’ has no member named ‘window’

I have recently tried my hand at learning GTK using Andrew Krause's "Foundations of GTK+ Development" (this is the most recent - 2007 - book on GTK I could find). Thus far, about half of the programs compile & run outright and the other half have deprecated functions which I can find replacements for with a little googling. I do use some online tutorials but they don't have the detail of explanation that Mr. Krause's book has.
In a perfect world, I would like to have an up to date book to learn from but that is not available. Thus I have to go back and forth between the book (GTK2) and online sources (GTK3).
My question, when I try to compile the source code from the book, I get several errors. I have been able to update all of the code except for the issue I name in the title that I cannot get past.
From the book, chapter 3 event boxes, this line is the one I am having trouble with:
gdk_window_set_cursor (eventbox->window, gdk_cursor_new (GDK_HAND1));
I have been able to modify it to work to this point but still get the error when I compile:
gdk_window_set_cursor (eventbox->window, gdk_cursor_new_for_display (gdk_display_get_default(), GDK_HAND1));
When I compile I get:
eventboxes.c:37:33: error: ‘GtkWidget {aka struct _GtkWidget}’ has no member named ‘window’
gdk_window_set_cursor (eventbox->window, gdk_cursor_new_for_display (gdk_display_get_default(), GDK_HAND1));
Having read some other items online such as this one "using cairo with gtk3"
I have found that changes between GTK2 and GTK3 have made members, such as window, inaccessible.
Sorry for the longwinded post by my question is:
Is there a way in GTK3 to make the line of code work or I am just pursuing a fool's errand and should let this one die?
This exact code can be fixed the following way:
GdkWindow * gdk_window = gtk_widget_get_window (eventbox);
gdk_window_set_cursor (gdk_window, gdk_cursor_new (GDK_HAND1));
However, I don't think it's a good idea to learn Gtk3 with Gtk2 books. You can read them to get overall view, but then switch to gtk documentation, gtk3-demo app for some recipes, gtk3-widget-factory source code and, of course, SO.

Embedded Coder not recognizing tokens in default code generation template

I recently obtained a license to use Embedded Coder with an existing Simulink model that we have developed. In attempting to generate C code for the first time from the model, I am working through several errors. At first, we had no code generation templates (.cgt) files defined in the model parameters. After some hunting, I found the default template that comes with MATLAB (matlabroot/toolbox/rtw/targets/ecoder/ert_code_template.cgt).
The latest is that I get errors on nearly every token in this default code generation template.
Since I'm just trying to get something to build, at first I commented out the offending lines (things like RTWFileVersion, etc), but now I am noticing that it's giving me errors for things that are mandatory (ie. Types). Types is one of several required items that must be in the .cgt file, so what's wrong that causes MATLAB to not recognize these tokens? I'm guessing something may be messed up with my installation, such as a path.
Other details:
Simulink R2013A x32
Target is a Freescale device
Thanks to Matthias W for getting me to check other configuration options. Turns out I had selected a .tlc file that was probably incompatible with Embedded Coder.
In Code Generation for "System target file" I have selected the ert.tlc file and now I am able to build the parts of my model I'm interested in.

QTP fails to recognize Java-applet Jtree object when used with Regular Expression

I am using QTP for automating an application. QTP recognizes Java applet- JTree as a html tag. In the html tag we have a number which is dynamic.
Hence we used Regular Expression so that QTP recognizes the object even if the number changes. But QTP is failing to do so. We have tested the regular expression in the evaluator and it works highlights the correct number as expected.
The expression in Obj Repository matches with the one in the Expert view.
Reg expressions do not work with html tags/applets is it??
Is there any other way to deal with dynamic elements in html tags??
Thanks in advance.
Try using descriptive programming it may help you. If you could provide more details of the issue then i could send you code snippet.
You should try UFT that is the next generation of QTP.
If you have a QTP-Licence you can update to UFT and I guess it will work well.
On the other hand how long will QTP will be supported