Angular 10 Mat Paginator showing undefined - angular-material

When setting mat-pagintor within the subscribe, I still get undefined. I have it set after I set the data.

If you have an *ngIf (like I did), make sure your <mat-paginator [pageSizeOptions]="[ 3, 5, 10, 20]" showFirstLastButtons></mat-paginator> is outside the *ngIf. Once you put it outside and you set pagination/sort within the subscribe you should be good.

Related

UI5-Application: Call to functionimport works ONLY in WebIDE but fails everywhere else

We are developing a custom UI5 application.
It is developed in the WebIDE, and therefore deployed as a BSP.
When we use the underlying model for calls ( currently 3, no CRUD ), we chose the path of using ONLY functionimports to communicate with the backend.
All of them work with the POST method.
And all of them work ONLY inside the WebIDE.
Once, I access the BSP URL otherwise, we get HTTP 500 error with "error while requesting the ressource.
We already created links, to enable special portfowarding, no result.
Let's stick to my URL from the BSP first.
I paste it into my 3 browsers: 500.
We also created a special non dialogue-user with proper roles and permissions, and in the SICF tree we assigned it .
Again, when calling from inside the WebIDE, the functionimport-calls work, otherwise not.
Error-Logs are empty.
Dumps do not happen.
ST05 trace shows where 500 is passed, deeply inside the HTTP framework, yet no chance to spot the code location, neither a breaktpoint.
In SICF logon-settings we have:
Types all, also flagged "all", SAML: inherited from parent node, sec-sessions Not limited, fix user and pw, sec: Standard, auth:Standard Sap user.
The gui-options contain ONLY one flag: ~CHECK_CSRF_TOKEN 0.
In my client I use :
Where the model is initialized as :
function initModelV2() {
var sUrl = "/sap/opu/odata/sap/Z_this_is_a_company_secret_service/";
var oModel = new sap.ui.model.odata.v2.ODataModel(sUrl);
sap.ui.getCore().setModel(oModel);
}
What else can I do to get "at least closer" to the reason, WHY ?
I could solve it, and believe it or not, sometimes simple logic helps.
I debugged the backend of CL_HTTP_RESPONSE, and once I saw, GET_STATUS, I thought to look for SET_STATUS.
There it was:
this.rModel.setHeaders( {"X-Requested-With" : "X" } );
Was missing.
Though I set it in the manifest of my model, it was not passed.
Once set in the code, it worked.
I wonder, why it is not accepted in manifest.
I have an assumption.
1st: I have this in my manifest ( yellow arrow shows, where i HAD it set up before):
But I also have an instantiation in my code, in servicebindings.js with this code
Can it be, that, in the end, I have accidently created 2 models ?

Gmod Lua HUDPaint Script not showing attempted change to HUD using Draw Functions, Why?

I've been learning how to influence HUDs and use draw functions on Gmod but whenever I try running any code relying on a 2d rendering context hook like HUDPaint it doesn't seem to work. There's no error that appears but there's also no drawing or any change to the HUD. Here's my code:
function test()
surface.SetDrawColor( 0, 0, 0, 120 )
surface.DrawRect( 50, 50, 128, 128 )
end
hook.Add("HUDPaint", "HUDPaint_DrawABox", test)
I'm not sure if it's a problem with HUDPaint, or the function I'm using to draw(test). My best guess is that it has something to do with HUDPaint being a server-side script, as I haven't yet used any code that is specifically server-side. I've been attempting to run this code in the normal singleplayer Gmod instance, which has worked so far for me when I've used other scripts.
HUDPaint is client-side, as are all rendering hooks.
Where are you placing the lua file for this?
It should be placed in addons/YOUR ADDON NAME/lua/autorun/client
Also, it's more standard convention to use draw.RoundedBox https://wiki.facepunch.com/gmod/draw.RoundedBox
(As you don't want to be setting a suface draw color unnecessarily if you can help it)

QtLua capture slider value change

I am trying to make a simple UI using qtlua, in which I want to capture the slider value everytime it changes. I tried to connect to the valueChanged() signal, but qlua gives me the following error:
cannot find source signal valueChanged()
The code snippet looks like this:
slide = (widget.sliderLight)
print(slide)
qt.connect(slide, 'valueChanged()',
function()
print('Value: ', slide.value)
end)
So just a test to print everytime the value changes. But I cannot get it working. The documentation for the qtlua doesn't have a class for qslider, so that's a dead end for me. And I couldn't find any examples for using qtlua with a slider that is connected to the valueChanged() signal. The only example I found was with the test.lua in the qtuiloader example, but that uses a timer, which I assume is pooled at regular interval. My aim is to hook this up to an image processing system, so it would be useful if I could tie it to when the value changes, rather than patch in with a timer and a check system. I am pretty new to qt, so must be missing something. Any and all help would be really appreciated!
Oh and I made sure I have tracking checkbox checked in the qtdesigner, to ensure that the signal is emitted.
Okay, so I dug around a little more in the documentation of QT for the valueChanged() slot. Turns out, the function signature has an int argument in it, so the Lua connect code was looking for a function signature without any arguments. Modifying the above code to the following works as expected:
slide = (widget.sliderLight)
print(slide)
qt.connect(slide, 'valueChanged(int)',
function(w)
print('Value: ', w)
end)
Declaring a function with the same signature also passes in the required value, which saves me an explicit value query.
Hopefully, this will be useful for someone someday.

What's the difference between FBTweakBind and FBTweakValue?

I am using FBTweak lib in my iOS project. I wonder is there difference between FBTweakBind and FBTweakValue.
For example:
FBTweakBind(self.headerView, alpha, #"Main Screen", #"Header", #"Alpha", 0.85);
can rewrite like this:
self.headerView.alpha = FBTweakValue( #"Main Screen", #"Header", #"Alpha", 0.85 );
so are they just equal ?
I am playing with FBTweak lib only since couple of minutes, but from what I understood from the documentation on github, FBTweakValue is just setting the value, but FBTweakBind is binding the changes to make tweaks update live.
Keep in mind, that both FBTweakValue and FBTweakBind might behave differently in a release builds
Source: https://github.com/facebook/Tweaks/wiki#bind
I figure it out.
FBTweakBinding will refresh the value it's binding. It means that FBTweak will call the setter of the property whenever you change the value while app is running.
FBTweakValue is just a variable. When program is going through that line of code, the property will be set. If you change the FBTweakValue after where it used, it did nothing, unless that line of code running again.

How do I use SetFilePointerEx to go to the end of a physical disk?

I have been able to use SetFilePointerEx just fine, when setting the position only.
SetFilePointerEx(PD, 512, #PositionVar, FILE_BEGIN);
SetFilePointerEx(PD, 0, #PositionVar, FILE_CURRENT);
Both work; I can set positions and even check my current one. But when I set FILE_END as per the documentation no matter what the second parameter is and whether or not I provide a pointer for the third parameter, it fails, even on a valid handle that many other operations are able to use without fail.
For example:
SetFailed := SetFilePointerEx(PD, 0, #PositionVar, FILE_END);
SetFailed := SetFilePointerEx(PD, 0, nil, FILE_END);
Whatever I put, it fails. I am working with a handle to a physical disk and it most definitely has an end. SetFilePointer works just fine, but it's just a little more trouble than I would like.
It's not the end of the world, but whats happening.
You can't do this as you have found out. You have to seek from the beginning or current. Use DeviceIoControl to find out the size of the device.

Resources