gnuradio companion flowgraph error of source/sink IO size mismatch with hier block parameter - parameter-passing

I have a hier block that takes as a parameter the length of the input vector that is fed to the block from a top level flowgraph and uses it internally, such as to specify the Pad Source vector size. But GRC would give me source/sink IO size mismatch error whenever the value of the parameter set in the top flowgraph does not match the initial/default value set for the parameter in the hier block. The initial value set in the hier block should not matter as it should take the value passed in from the top flowgraph. But it does not appear so in this case as GRC seems to use this initial value to determine the Pad Source vector size and hence produces an error message saying the expected input size does not match that of its source. How would I go about solving this problem? Thank you.

Related

System.IO.FileLoadException: Exception raised in RichEditBox document

Hi, I have a user control that extends RichEditBox, we have a TextChanged Property, we bind a string variable to the Text Property, and the error shown in the image is generated within the TextChanged function, I am not sure why this error is being generated.. Any clue would be helpful.
For further information, Document.Selection is not null, Document.Selection.Text does show the last string bound to it, TASK_DONE_SYMBOL is not null either.
We have a page with a lot of items, each item has a RichEditBox, and when we update some of the items, sometimes, not always, does this issue come up.

How can i vary a parameter in function of another parameter in Anylogic?

I want to add a parameter(or a variable) that I would like to vary with a slider before running the simulation. This parameter represents the money spent to launch the ad campaign. This parameter, varying must vary the parameter AdEffectiveness and in consequence the output( shown in the main plot).
Main
Customer
AdEffectiveness
I will give you the link to the AnyLogic tutorial to set up parameters in the experiment page, which seems to be what you want:
https://www.youtube.com/watch?v=pd8QMBL-ri4
Drag a slider object mySlider into your simulation experiment. In the simulation experiment's properties screen, add mySlider.getIntValue() in the AdEffectiveness parameter field.
More generally, if the parameter is an integer then use mySlider.getIntValue(), if the parameter is a double, use mySlider.getValue().
In the slider properties you can set minimal and maximum values for the slider.

Simulink Matlab function block deleting rows from a vector

That i want to do is to delete certain rows (or columns doesn't really mater...) from a given vector.
By going through Simulink's components found out that there is nothing performing such an operation,there are blocks help one add elements but nothing clearly for removing,so ended up trying to delete them by using a function block and following the online examples that demonstrate the usage of "[]".Lets say that i want to delete the second column of the vector u,i do u(:, 2) = [];.
That works absolutely fine in a separate m file or function but unfortunately not in a function block returning:
"Simulink does not have enough information to determine output sizes for
this block. If you think the errors below are inaccurate, try specifying
types for the block inputs and/or sizes for the block outputs."
and:
Size mismatch (size [4 x 4] ~= size [4 x 3]).
The size to the left is the size of the left-hand side of the assignment.
Function 'MATLAB Function' (#107.41.42), line 4, column 1:
"u"
Launch diagnostic report.
Is there any alternative you can suggest to remove several elements in a given vector in Simulink?
Thanks in advance
George
Finally,managed to do it without function block.There is a much easier way,by using Pad,and defining the output vector to be shorter than the input resulting in truncation.

updating Label text within a Table through actors/cells within a GestureListener

Perhaps I'm simply going about this the wrong way ...
However, I'd simply like to change the text within a specific Label based on the direction of a GestureListener.fling(). I've kept both the Screen and GestureListener implementations within the same class in order to reduce possible trivial nonsense for this question:
public class TestScreen implements Screen, InputProcessor, GestureDetector.GestureListener {
In the show() method, I have the following:
Label heading = new Label("1ST", skin);
heading.setName("heading");
table.addActor(heading);
In the fling() method, I have the following:
Label l = table.findActor("heading");
l.setText("2ND");
However, the text within that label does not change. I've attempted to add the following line to the fling() method and it returns successful, but the text still does not update.
table.swapActors(table.getActor("heading"), l);
In an effort to be thorough, I've attempted the following to no avail:
SnapshotArray<Actor> children = table.getChildren();
int i = children.indexOf(l, false);
children.set(i, l);
and this ...
((Label)children.get(i)).setText(l.getText());
I even went as far as changing the initial .addActor() to just .add() in order for the table's cells to get created/populated - then attempted to modify the values of the table cells within the fling() method ...
Cell c = table.getCell(l);
c.setActor(l);
and this too ...
Array<Cell> cells = table.getCells();
int i = cells.indexOf(c, true);
cells.get(i).setActor(l);
Nothing appears to update the text visually on the screen - however, if I step through the debugger, then the table's actor/cell text appears to be updated ... but the text shown on the screen is always unchanged ... there is bound to be something that I'm missing here ...
Try to call .invalidate() on the label - that should force it to update to the changed text.
The invalidate method invalidates this actor's layout, causing layout() to happen the next time validate() is called. This method should be called when state changes in the actor that requires a layout but does not change the minimum, preferred, maximum, or actual size of the actor (meaning it does not affect the parent actor's layout).

How to get the real height of a character (fontmetrics/graphics2d)

I am currently in need to get the real height of a character. I am aware of the functions like getDecsent(), getAscent(), ... but they only allow to get values regarding the hole font (in its context). I also tried the way using getStringBounds(), but that is the same story.
Like the title says, I am looking for a way to get the height value of just one char at a time.
For example 'N' is higher then 'n', 'I' just a little bit higher then 'i' and so on
Thanks for your time
Use this
Rectangle2D bounds = font.getStringBounds("put your string here", context);
//font can be set to whatever you want
//my suggestion is that you use the same font for both characters
//context is a object of FontRenderContext
System.out.println(bounds.getHeight());
//Instead of just printing it you could do this a second time and compare the 2 strings