text:
Q: Need to hide tinymce menubar in wordpress I am trying to remove the TinyMCE menubar below

from wordpress via the theme functions.php. I dont want to edit the core/script files. Is this possible? Removing button options is straight forward, but stripping this bar is proving difficult.
Thanks

A: Using tinyMCE 4 you can set the following in the tinymce init:
<script type="text/javascript">
    tinymce.init({
        menubar: false
    });
</script>

A: Apologies. A colleague installed advanced TinyMCE without me knowing, so i thought this was wordpress default. I have removed it from there. Question can be disregarded.

A: You can disable menubar by adding following code in enqueue in your theme function.php , selector is option you can use without it as well as said by Milap.
<script language="javascript" type="text/javascript">
   tinymce.init({
   selector: "textarea",
   menubar: false
 });
</script>


text:
Q: Prestashop: Notice: Undefined index: produits I'm new in prestashop: I'm trying to display the result of my query in a tpl file, and I get this error:

Notice: Undefined index: produits

This is my controller code :
class  AdminStatproduitController extends ModuleAdminController
{
    public function init() {
        parent::init();
    }

    public function initContent()
    {
         parent::initContent();

         $products = Db::getInstance()->ExecuteS('SELECT pp.id_product,  ppl.name, pps.quantity
                                            FROM  `'._DB_PREFIX_.'product` pp
                                            LEFT JOIN '._DB_PREFIX_.'product_sale pps ON pps.id_product = pp.id_product
                                            LEFT JOIN '._DB_PREFIX_.'product_lang ppl ON ppl.id_product = pp.id_product
                                            WHERE pp.cache_is_pack =0
                                            ORDER BY pps.quantity ASC
                                            LIMIT 3');
        $pack = Db::getInstance()->ExecuteS('SELECT pp.id_product,  ppl.name, pps.quantity
                                            FROM  `'._DB_PREFIX_.'product` pp
                                            LEFT JOIN '._DB_PREFIX_.'product_sale pps ON pps.id_product = pp.id_product
                                            LEFT JOIN '._DB_PREFIX_.'product_lang ppl ON ppl.id_product = pp.id_product
                                            WHERE pp.cache_is_pack =1
                                            ORDER BY pps.quantity DESC
                                            LIMIT 3');
        $smarty = $this->context->smarty;
        $content = $smarty->fetch(_PS_MODULE_DIR_ . 'statproduit/views/templates/admin/statproduit.tpl');
        $this->context->smarty->assign(array('produits'=>$products,
                                         'pack'=> $pack,
                                         'content' => $this->content . $content));
 }

and this is my tpl code

        <form id="formAddPayment" method="post">

                        Id Produit
                        Nom Produit
                        Quantité Produit
                        Pack Choisie

                    {foreach from=$produits item=produit}

                        {produit}
                        product.name
                        product.quantity
                        delete

                    {/foreach}

        </form>

Any suggestion??
thanks

A: just change this in the controller:
 $this->context->smarty->assign('produits',$products);
    $this->context->smarty->assign('pack',$pack);

    $content = $this->context->smarty->fetch(_PS_MODULE_DIR_ . 'statproduit/views/templates/admin/statproduit.tpl');
    $this->context->smarty->assign('content',$this->content . $content);

A: The complete code:
public function initContent()
{
    parent::initContent();

    $products = Db::getInstance()->ExecuteS('SELECT pp.id_product,  ppl.name, pps.quantity
                                            FROM  `'._DB_PREFIX_.'product` pp
                                            LEFT JOIN '._DB_PREFIX_.'product_sale pps ON pps.id_product = pp.id_product
                                            LEFT JOIN '._DB_PREFIX_.'product_lang ppl ON ppl.id_product = pp.id_product
                                            WHERE pp.cache_is_pack =0
                                            ORDER BY pps.quantity ASC
                                            LIMIT 3');
    $pack = Db::getInstance()->ExecuteS('SELECT pp.id_product,  ppl.name, pps.quantity
                                            FROM  `'._DB_PREFIX_.'product` pp
                                            LEFT JOIN '._DB_PREFIX_.'product_sale pps ON pps.id_product = pp.id_product
                                            LEFT JOIN '._DB_PREFIX_.'product_lang ppl ON ppl.id_product = pp.id_product
                                            WHERE pp.cache_is_pack =1
                                            ORDER BY pps.quantity DESC
                                            LIMIT 3');
    $this->context->smarty->assign(array('produits'=>$products,
                                         'pack'=> $pack));
    $content = $this->context->smarty->fetch(_PS_MODULE_DIR_ . 'statproduit/views/templates/admin/statproduit.tpl');

 }

And for tpl:
<form id="formAddPayment" method="post">

                Id Produit
                Nom Produit
                Quantité Produit
                Pack Choisie

            {foreach from=$produits item=produit}

                {$produit.id_product}
                {$produit.name}
                {$produit.quantity}
                delete

            {/foreach}

</form>

redpajama_set_name: RedPajamaStackExchange


text:
Q: Github Pages returns 404 Error when trying to grab paper.js resource I saw some other posts but it seems like I still can't get it to work, I made sure that the path exists inside the project but it doesn't seem to be able to grab it despite others working.
Specifically, as seen in the console in the page
Failed to load resource: the server responded with a status of 404 ()
for paper-full.js:1
The offending github page:
https://eriejar.github.io/SoundOfLife/gameoflife.js
The repo: https://github.com/Eriejar/SoundOfLife
Any help would be appreciated
I have tried the following URLs:

src="~/node_modules/paper/dist/paper-full.js"
src="./node_modules/paper/dist/paper-full.js"
src="/node_modules/paper/dist/paper-full.js"
src="node_modules/paper/dist/paper-full.js"

A: GitHub pages ignores the node_modules folder by default. Copy paper-full.js out of the folder or try the solution provided here: Github Pages 404 on node_modules folder


text:
Q: Error on nuget restore step in azure devops build after upgrade to .net 5 I have a build pipeline in azure devops that worked fine for net core 3.1, then I upgraded this project to .net 5.0 and the build doesn't work anymore, it stops on the nuget restore step

this is the error log
 MSBuild auto-detection: using msbuild version '16.200.19.31001' from 'D:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
MSBuild P2P timeout [ms]: 120000
D:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\bin\msbuild.exe "C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp\NuGetScratch\xbcsorbg.z0f.nugetinputs.targets" /t:GenerateRestoreGraphFile /nologo /nr:false /v:q /p:NuGetRestoreTargets="C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp\NuGetScratch\p0q3isxq.jbq.nugetrestore.targets" /p:RestoreUseCustomAfterTargets="True" /p:RestoreTaskAssemblyFile="C:\agent\_work\_tool\NuGet\5.7.0\x64\nuget.exe" /p:RestoreSolutionDirectory="C:\agent\_work\12\s\Framework\\" /p:RestoreConfigFile="C:\agent\_work\12\Nuget\tempNuGet_1947.config" /p:SolutionDir="C:\agent\_work\12\s\Framework\\" /p:SolutionName="Tenper Core"
NuGet.CommandLine.ExitCodeException: Exception of type 'NuGet.CommandLine.ExitCodeException' was thrown.
   at NuGet.CommandLine.MsBuildUtility.<GetProjectReferencesAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.CommandLine.RestoreCommand.<GetDependencyGraphSpecAsync>d__68.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.CommandLine.RestoreCommand.<DetermineInputsFromMSBuildAsync>d__63.MoveNext()
##[error]The nuget command failed with exit code(1) and error(C:\agent\_work\_tool\dotnet\sdk\5.0.100-rc.1.20452.10\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(54,5): error MSB4186: Invalid static method invocation syntax: "[MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')". Method '[MSBuild]::GetTargetFrameworkIdentifier' not found. Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(`a`, `b`)). Check that all parameters are defined, are of the correct type, and are specified in the right order. [C:\agent\_work\12\s\Framework\Interfaces\Interfaces.csproj]
C:\agent\_work\_tool\dotnet\sdk\5.0.100-rc.1.20452.10\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(54,5): error MSB4186: Invalid static method invocation syntax: "[MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')". Method '[MSBuild]::GetTargetFrameworkIdentifier' not found. Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(`a`, `b`)). Check that all parameters are defined, are of the correct type, and are specified in the right order. [C:\agent\_work\12\s\Framework\DI\DI.csproj]

A: The issue arises because the agent you are not using .Net Core sdk 5.0 preview 8.
According to your error log, you are using SDK 5.0.100-rc.1 which is not supported [MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)').
How to solve this issue:
You can replace your original .Net Core download tasks with the following download task:
- task: UseDotNet@2
  inputs:
    packageType: 'sdk'
    version: '5.0.100-preview.8.20417.9'
    includePreviewVersions: true

Then rebuild your pipeline.

A: Try using Use .net core task+Dotnet core task with restore command.
- task: UseDotNet@2
  displayName: 'Use .NET Core sdk 5.0.100-rc.1.20452.10'
  inputs:
    packageType: 'sdk'
    version: '5.0.100-rc.1.20452.10'
    includePreviewVersions: true

- task: DotNetCoreCLI@2
  displayName: 'dotnet restore'
  inputs:
    command: restore
    projects: '**/*.csproj'

It's strongly recommended to use dotnet restore and dotnet build tasks for projects that target .net core. See this statement from Nuget task:
If you are working with .NET Core or .NET Standard, use the .NET Core task, which has full support for all package scenarios and it's currently supported by dotnet.
Also, you should use 5.0.100-rc.1.20452.10 in UseDotNet@2 task according to the error message.

A: I also had a similar issue. I upgraded my project from 3.1 -> 5.0, and the restore option failed. However, I was using the dotnet cli to restore the nuget packages.
Turns out, there was some project called WorkerExtensions.csproj that was being restored, and was built using 3.1. I'm not sure where this project was referenced at all, as it isn't anywhere in the project I was building.
  Project.AzureFunction -> /home/vsts/work/1/s/publish_output/Project.AzureFunction.dll
  Determining projects to restore...
  Restored /tmp/o0lv1ony.pel/WorkerExtensions.csproj (in 6.89 sec).
  WorkerExtensions -> /tmp/o0lv1ony.pel/buildout/Microsoft.Azure.Functions.Worker.Extensions.dll
##[error]/home/vsts/.nuget/packages/microsoft.net.sdk.functions/3.0.11/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5): Error : It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '3.1.0' was not found.
  - The following frameworks were found:
      5.0.8 at [/opt/hostedtoolcache/dotnet/shared/Microsoft.NETCore.App]

The only thing I found close was the Microsoft.Azure.Functions.Worker.Extensions.Http nuget. After investigation, I still can't figure it out.
Regardless, to get the build working and to deploy it, I included both .NET Core 3.1 and .NET 5 in the YAML as following. I'm hoping to properly address the issue in the future.
# For some reason, Azure Functions still require .NET Core 3.x even with .NET 5. Maybe it won't be needed in the future.
    - task: UseDotNet@2
      displayName: "Install .NET Core 3.x"
      inputs:
        version: '3.x'
        packageType: sdk

    - task: UseDotNet@2
      displayName: 'Install .NET 5.x'
      inputs:
        packageType: sdk
        version: '5.x'


text:
Q: Python send outlook email with TITUS classification I need to send an email using python and to bypass the TITUS CLASSIFICATION pop-up that comes up with the current script. The pop-up stops it from auto sending.
PYTHON
olMailItem = 0x0
obj = win32com.client.Dispatch("Outlook.Application")
newMail = obj.CreateItem(olMailItem)
newMail.Subject = "My Subject"
newMail.Body = "My Body"
newMail.To  = "myemail@gmail.com"
newMail.send()

VBA
I have a VBA solution to auto send the email, but it would be easier and more intuitive to have everything in the PYTHON script rather than creating a VBA macro and calling it.
Dim AOMSOutlook As Object
Dim AOMailMsg As Object
Set AOMSOutlook = CreateObject("Outlook.Application")
Dim objUserProperty As Object
Dim OStrTITUS As String
Dim lStrInternal As String
Set AOMailMsg = AOMSOutlook.CreateItem(0)

Set objUserProperty = AOMailMsg.UserProperties.Add("TITUSAutomatedClassification", 1)
objUserProperty.Value = "TLPropertyRoot=ABCDE;Classification=For internal use only;Registered to:My Companies;"
With AOMailMsg
  .To = "myemail@gmail.com"
  .Subject = "My Subject"
  .Body = "My Body"
  .Send
End With

Set AOMailMsg = Nothing
Set objUserProperty = Nothing
Set AOMSOutlook = Nothing
Set lOMailMsg = Nothing
Set objUserProperty = Nothing
Set lOMSOutlook = Nothing

Any help greatly appreciated!

A: This should do it for you.
SMTPserver = 'smtp.att.yahoo.com'
sender =     'me@my_email_domain.net'
destination = ['recipient@her_email_domain.com']

USERNAME = "USER_NAME_FOR_INTERNET_SERVICE_PROVIDER"
PASSWORD = "PASSWORD_INTERNET_SERVICE_PROVIDER"

# typical values for text_subtype are plain, html, xml
text_subtype = 'plain'

content="""\
Test message
"""

subject="Sent from Python"

import sys
import os
import re

from smtplib import SMTP_SSL as SMTP       # this invokes the secure SMTP protocol (port 465, uses SSL)
# from smtplib import SMTP                  # use this for standard SMTP protocol   (port 25, no encryption)

# old version
# from email.MIMEText import MIMEText
from email.mime.text import MIMEText

try:
    msg = MIMEText(content, text_subtype)
    msg['Subject']=       subject
    msg['From']   = sender # some SMTP servers will do this automatically, not all

    conn = SMTP(SMTPserver)
    conn.set_debuglevel(False)
    conn.login(USERNAME, PASSWORD)
    try:
        conn.sendmail(sender, destination, msg.as_string())
    finally:
        conn.quit()

except Exception, exc:
    sys.exit( "mail failed; %s" % str(exc) ) # give a error message

See this link for more details.
Sending mail from Python using SMTP

A: Add the below code to end of send function and it selects TITUS Classification:
mailUserProperties  = newMail.UserProperties.Add("gmail.comClassification", 1)
mailUserProperties.Value = "For internal use only"
newMail.Display()
newMail.Send()


text:
Q: Как запретить копировать в буфер обмена Мне нужно запретить копировать текст из RichEdit
Я решил переопределить WM_COPY У своего компонента
TArticleRichEdit = class(TRichEdit)
  private
    procedure WMCopy(var Message: TWMCopy); message WM_COPY;
  end;

procedure TArticleRichEdit.WMCopy(var Message: TWMCopy);
begin
//
end;

Но почему то при копировании ctrl+c либо ctrl+ins не срабатывает обработчик

A: есть много вариантов, к примеру
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
 if (Key=#22) or (Key=#3) then Key:=#0;   // 22 = [Ctrl+V] / 3 = [Ctrl+C]
end;

вариант №2 (оригинал)
...
 var
   Form1: TForm1;
   NextInChain : THandle;
 implementation
 uses ClipBrd;
...

procedure WMDrawClipboard(var Msg: TMessage) ; message WM_DRAWCLIPBOARD;
procedure WMChangeCBChain(var Msg: TMessage) ; message WM_CHANGECBCHAIN;
...

procedure TForm1.WMDrawClipboard(var Msg:TMessage) ;
begin
  if Clipboard.HasFormat(cf_text) then
  begin
   Memo1.Lines.Clear;
   Memo1.PasteFromClipboard
  end
  else
  begin
   // работа других форматов
  end;
  //pass the message on to the next window
if NextInChain <> 0 then
   SendMessage(NextInChain, WM_DrawClipboard, 0, 0)
end;

procedure TForm1.WMChangeCBChain(var Msg: TMessage) ;
 var   Remove, Next: THandle;
 begin
   Remove := Msg.WParam;
   Next := Msg.LParam;
   with Msg do
   if NextInChain = Remove then
    NextInChain := Next
   else
   if NextInChain <> 0 then
    SendMessage(NextInChain, WM_ChangeCBChain, Remove, Next)
end;
...

procedure TForm1.FormCreate(Sender: TObject) ;
begin
  NextInChain := SetClipboardViewer(Handle) ;
end;


text:
Q: Attempt to delete item containing first responder that refused to resign I'm trying to show conditionally a List based on showElements value. This List contain a ForEach to show all the elements of the names array and a TextField to allow users to add a new name. Changing the value of showElements to false should remove all the elements of names array and empty name string. The code above works on iOS 15 and Xcode 13 but if I run the same project with Xcode 14 the app crash.
The steps to reproduce the crash are:

*

*Enable the Toggle

*Select the TextField

*Disable the Toggle (here the crash occur)

Here the code:
struct ContentView: View {
    @State private var names: [String] = []
    @State private var name: String = ""
    @State private var showElements: Bool = false

    var body: some View {
        Form {
            Section {
                Toggle(isOn: $showElements) {
                    Text("ShowElements")
                }
                .onChange(of: showElements) { newValue in
                    if newValue == false {
                        name = ""
                        names = []
                    }
                }

                if showElements {
                    List {
                        ForEach(names, id: \.self) { name in
                            Text(name)
                        }

                        HStack {
                            TextField("name", text: $name)
                            Button {
                                names.append(name)
                                name = ""
                            } label: {
                                Text("Add")
                            }
                        }
                    }
                }
            }
        }
    }
}

Here the console log:
2022-09-08 23:03:26.516945+0200 test[28915:875267] *** Assertion failure in -[SwiftUI.UpdateCoalescingCollectionView _resignOrRebaseFirstResponderViewWithUpdateItems:indexPathMapping:], UICollectionView.m:11437
2022-09-08 23:03:26.524664+0200 test[28915:875267] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Attempt to delete item containing first responder that refused to resign.
First responder that was asked to resign (returned YES from -resignFirstResponder): <UITextField: 0x7fa25b08aa00; frame = (0 0; 274.333 22); opaque = NO; autoresize = W+H; gestureRecognizers = <NSArray: 0x600002271c80>; placeholder = name; borderStyle = None; background = <_UITextFieldNoBackgroundProvider: 0x600002ec7c10: textfield=<UITextField 0x7fa25b08aa00>>; layer = <CALayer: 0x600002c7f540>> inside containing view: <SwiftUI.ListCollectionViewCell: 0x7fa25b054c00; baseClass = UICollectionViewListCell; frame = (20 79; 353 44); clipsToBounds = YES; layer = <CALayer: 0x600002c61400>> at index path: <NSIndexPath: 0xde7e4e75a67d6979> {length = 2, path = 0 - 1}
Current first responder: <_TtGC7SwiftUI15CellHostingViewGVS_15ModifiedContentVS_14_ViewList_ViewVS_26CollectionViewCellModifier__: 0x7fa25b012400; frame = (0 0; 353 44); autoresize = W+H; gestureRecognizers = <NSArray: 0x6000022750e0>; layer = <CALayer: 0x600002c616a0>> inside containing view: <SwiftUI.ListCollectionViewCell: 0x7fa25b054c00; baseClass = UICollectionViewListCell; frame = (20 79; 353 44); clipsToBounds = YES; layer = <CALayer: 0x600002c61400>> at index path: <NSIndexPath: 0xde7e4e75a67d6979> {length = 2, path = 0 - 1}'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007ff800427378 __exceptionPreprocess + 242
    1   libobjc.A.dylib                     0x00007ff80004dbaf objc_exception_throw + 48
    2   Foundation                          0x00007ff800b876ac _userInfoForFileAndLine + 0
    3   UIKitCore                           0x000000010b195c2f -[UICollectionView _resignOrRebaseFirstResponderViewWithUpdateItems:indexPathMapping:] + 1340
    4   UIKitCore                           0x000000010b1939bc -[UICollectionView _updateWithItems:tentativelyForReordering:propertyAnimator:collectionViewAnimator:] + 226
    5   UIKitCore                           0x000000010b18a71b -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:collectionViewAnimator:] + 14344
    6   UIKitCore                           0x000000010b19814c -[UICollectionView _performBatchUpdates:completion:invalidationContext:tentativelyForReordering:animator:animationHandler:] + 577
    7   UIKitCore                           0x000000010b197e7d -[UICollectionView performBatchUpdates:completion:] + 34
    8   SwiftUI                             0x000000010ec02c4f block_destroy_helper + 25991
    9   SwiftUI                             0x000000010ec03453 block_destroy_helper + 28043
    10  SwiftUI                             0x000000010f23985e __swift_memcpy56_4 + 159666
    11  SwiftUI                             0x000000010eda93be block_destroy_helper.23 + 66721
    12  SwiftUI                             0x000000010eda93d4 block_destroy_helper.23 + 66743
    13  UIKitCore                           0x000000010c277eff +[UIView(Animation) performWithoutAnimation:] + 84
    14  SwiftUI                             0x000000010f23aaa0 __swift_memcpy56_4 + 164340
    15  SwiftUI                             0x000000010f1298f8 objectdestroy.136Tm + 41411
    16  SwiftUI                             0x000000010ee4a86f block_destroy_helper + 35480
    17  SwiftUI                             0x000000010ee4a1d0 block_destroy_helper + 33785
    18  SwiftUI                             0x000000010eb35a78 __swift_assign_boxed_opaque_existential_1 + 70088
    19  SwiftUI                             0x000000010eb359db __swift_assign_boxed_opaque_existential_1 + 69931
    20  SwiftUI                             0x000000010eb35ad1 __swift_assign_boxed_opaque_existential_1 + 70177
    21  CoreFoundation                      0x00007ff800385fe5 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    22  CoreFoundation                      0x00007ff800380952 __CFRunLoopDoObservers + 515
    23  CoreFoundation                      0x00007ff800380e9d __CFRunLoopRun + 1161
    24  CoreFoundation                      0x00007ff800380637 CFRunLoopRunSpecific + 560
    25  GraphicsServices                    0x00007ff809c0f28a GSEventRunModal + 139
    26  UIKitCore                           0x000000010bc5d425 -[UIApplication _run] + 994
    27  UIKitCore                           0x000000010bc62301 UIApplicationMain + 123
    28  SwiftUI                             0x000000010f6dbfa3 __swift_memcpy53_8 + 95801
    29  SwiftUI                             0x000000010f6dbe50 __swift_memcpy53_8 + 95462
    30  SwiftUI                             0x000000010edfbafc __swift_memcpy195_8 + 12192
    31  test                                0x000000010a63123e $s4test0A3AppV5$mainyyFZ + 30
    32  test                                0x000000010a6312c9 main + 9
    33  dyld                                0x000000010a87c2bf start_sim + 10
    34  ???                                 0x000000011700252e 0x0 + 4680852782
)
libc++abi: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Attempt to delete item containing first responder that refused to resign.
First responder that was asked to resign (returned YES from -resignFirstResponder): <UITextField: 0x7fa25b08aa00; frame = (0 0; 274.333 22); opaque = NO; autoresize = W+H; gestureRecognizers = <NSArray: 0x600002271c80>; placeholder = name; borderStyle = None; background = <_UITextFieldNoBackgroundProvider: 0x600002ec7c10: textfield=<UITextField 0x7fa25b08aa00>>; layer = <CALayer: 0x600002c7f540>> inside containing view: <SwiftUI.ListCollectionViewCell: 0x7fa25b054c00; baseClass = UICollectionViewListCell; frame = (20 79; 353 44); clipsToBounds = YES; layer = <CALayer: 0x600002c61400>> at index path: <NSIndexPath: 0xde7e4e75a67d6979> {length = 2, path = 0 - 1}
Current first responder: <_TtGC7SwiftUI15CellHostingViewGVS_15ModifiedContentVS_14_ViewList_ViewVS_26CollectionViewCellModifier__: 0x7fa25b012400; frame = (0 0; 353 44); autoresize = W+H; gestureRecognizers = <NSArray: 0x6000022750e0>; layer = <CALayer: 0x600002c616a0>> inside containing view: <SwiftUI.ListCollectionViewCell: 0x7fa25b054c00; baseClass = UICollectionViewListCell; frame = (20 79; 353 44); clipsToBounds = YES; layer = <CALayer: 0x600002c61400>> at index path: <NSIndexPath: 0xde7e4e75a67d6979> {length = 2, path = 0 - 1}'
terminating with uncaught exception of type NSException
CoreSimulator 857.7 - Device: iPhone 14 Pro (157A86B8-D8A5-4E19-A9B1-B6D9971F2A97) - Runtime: iOS 16.0 (20A360) - DeviceType: iPhone 14 Pro
(lldb)

How can I solve this problem?

A: Lose the TextField focus before changing its state
This happens only when you try to change the TextField while it is still focused. If you add new elements and do not click/focus on a TextField and change the Toggle state you will see your code does not crash.
To solve the problem, add a @FocusState to the TextField
@FocusState private var textFieldIsFocused: Bool

TextField("name", text: $name)
    .focused($textFieldIsFocused)

and lose focus before changing the Toggle state. To achieve this I added a custom Binding to the Toggle so we can release the TextField focus before changing the state.
Toggle(
    isOn:
        .init(
            get: { showElements },
            set: {
                textFieldIsFocused = false
                showElements = $0
            }
        )
    ) {
         Text("ShowElements")
      }
      .onChange(of: showElements) { newValue in
          if newValue == false {
              name = ""
              names = []
          }
      }

The complete code
import SwiftUI

struct ContentView: View {
    @State private var names: [String] = []
    @State private var name: String = ""
    @State private var showElements: Bool = false

    @FocusState private var textFieldIsFocused: Bool

    var body: some View {
        Form {
            Section {
                Toggle(
                    isOn:
                    .init(
                        get: { showElements },
                        set: {
                            textFieldIsFocused = false
                            showElements = $0
                        }
                    )
                ) {
                    Text("ShowElements")
                }
                .onChange(of: showElements) { newValue in
                    if newValue == false {
                        name = ""
                        names = []
                    }
                }

                if showElements {
                    List {
                        ForEach(names, id: \.self) { name in
                            Text(name)
                        }

                        HStack {
                            TextField("name", text: $name)
                                .focused($textFieldIsFocused)
                            Button {
                                names.append(name)
                                name = ""
                            } label: {
                                Text("Add")
                            }
                        }
                    }
                }
            }
        }
    }
}

@main
struct MyApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

Happy Coding,
Kolmar Kafran (:


text:
Q: Repetitive Consumer For Loop I am using a library with a method where I call a method that takes an event class and a consumer to call when the event fires. This method returns a void. I need to call the method again in the consumer then in that consumer call it again etc. (a lot of times). How can I put this in a for loop to avoid typing out this method loads of times?
Code:
ShurikenBot.getInstance().getEventWaiter().waitForEvent(MessageReactionAddEvent.class,
                    t -> t.getMessageId().equals(m.getId()) && event.getAuthor().getId().equals(t.getMember().getUser().getId())
                            && t.getReaction().getReactionEmote().getName().equals("\u25B6"),
                    t ->
                            t.getChannel().getMessageById(t.getMessageId()).queue(msg -> {
                                System.out.println("yes");
                                // i want to call waitForEvent() again here
                                msg.editMessage(builder.setTitle("Shuriken Tutorial - Step 2").setImage("https://i.615283.net/u/47794c.jpg").build()).queue();
                                t.getReaction().removeReaction(t.getUser()).queue();
                            }));

A: Instead of using the EventWaiter you could create a State-Machine using a generic event listener.
public class StateMachine extends ListenerAdapter {
    private final long messageId;
    private final long userId;
    private final String emoji;

    private int state = 0;

    public StateMachine(...) {...}

    @Override
    public void onMessageReactionAdd(MessageReactionAddEvent event) {
        if (event.getMessageIdLong() != messageId) return;
        if (event.getUser().getIdLong() != userId) return;
        if (!event.getReactionEmote().getName().equals(emoji)) return;
        switch (state) {
        case 0:
            System.out.println("yes");
            event.getChannel().editMessageById(messageId, ...).queue();
            event.getReaction().removeReaction(event.getUser()).queue();
            state = 1;
            break;
        case 1:
            System.out.println("This is the next awaited event");
            // do something here...
            break;
        }
    }
}

Then you can define a final state in which you remove the event listener again.


text:
Q: Why is Ajax call not returning data in Mozilla? Hi all I have an ajax call function which calls my api and I get data from my method every thing is working good in IE the ajax call retunrs data
but when it comes to Mozilla it goes to error call and no data is returned there and I get the following error in my browser
error:[Exception... "Failure"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: http://localhost:60304/Scripts/jquery-1.7.1.min.js :: .send :: line 3"  data: no]

here is my ajax function I am using
function Loaddata(){
       $.ajax({
           url: "http://localhost:19999/api/Employees/GetAllEmployees?Id=1",
           jsonp: '$callback',
           dataType: 'text json',
           success: function (data) {
               if (data != null && data.length > 0) {
                   BuildCategorieString(data)
               }
           },
           error: function (XHR, textStatus, errorThrown) {
               alert(textStatus + ":" + errorThrown);
           }
      });
 }

A: This document looks like it covers what you need:
http://helpful.knobs-dials.com/index.php/0x80004005_(NS_ERROR_FAILURE)_and_other_firefox_errors

A: Try:
function Loaddata() {
    $.ajax({
        url : "http://localhost:19999/api/Employees/GetAllEmployees?Id=1",
        jsonp : '$callback',
        dataType : 'jsonp text',
        crossDomain: true,
        success : function (data) {
            if (data != null && data.length > 0) {
                BuildCategorieString(data)
            }
        },
        error : function (XHR, textStatus, errorThrown) {
            alert(textStatus + ":" + errorThrown);
        }
    });
}


text:
Q: How to decode Kernel-Power Event 566 when waking from sleep On a Dell Vostro 3470 desktop running Windows-11 Pro 21H2 build 22000.795, while troubleshooting an issue related to waking up from sleep (yes S3 sleep, not Modern Standby, as this platform does not support S0) I encounter numerous events in Event Viewer > Windows Logs > System similar to this:

The events in question are all Kernel-Power events with EventID 566 and descriptive text such as The system session has transitioned from xx to yy.  The xx and yy differ, but yy is always one greater than xx.
As they are all Information events, I consider them non-critical.  But I simply cannot find any information anywhere that can tell me what they mean.  Although I have discovered this page, which enumerates and describes values from 0 through 7, the events I'm seeing routinely report values well above 7, as shown in the attached screen shot.  And I've found no information anywhere regarding how to decode the associated Reason (in the above case, Reason 32.)
Can anyone provide any assistance in decoding these events, the meanings of xx and yy, and how to interpret values for Reason?

A: I am using 2 Windows 11 Pro laptops and sleep on both works well.
Update BIOS (UEFI), and Power Management driver.  In fact use the Dell Updater App to do this.
Do a final restart and test.
These are the two prime hardware issues to check for and address.
You should also test the hardware with the Dell Hardware Diagnostic App to see if there are hardware issues.
Did your machine come with Windows 11 Pre-load or was it upgraded from Windows 10?
You may need to try a Windows 11 Repair Install if nothing else fixes the issue.
https://www.microsoft.com/en-us/software-download/windows11
If everything is truly up to date and you have a completely fresh install of Windows 11, the computer may not be fully compatible with Windows 11.


text:
Q: View flipper is not flipping Is this even possible? I created this view flipper and I am calling the view flipper from the onClick inside of the xml layout. I have created a view flipper before but for some reason it's not working.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:cacheColorHint="@android:color/transparent"
    android:orientation="vertical" >

    <ViewFlipper
        android:id="@+id/viewFlipper1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@null"
        android:cacheColorHint="@android:color/transparent" >

        <LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/vf_sample1_main"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:cacheColorHint="@android:color/transparent"
            android:orientation="vertical" >

            <include layout="@layout/headers_main" />

            <include layout="@layout/searchbar" />

            <TextView
                android:id="@+id/sdfsd"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:gravity="center_horizontal"
                android:maxHeight="85dp"
                android:paddingBottom="10dp"
                android:paddingTop="10dp"
                onClick="gotoSomething"
                android:singleLine="false" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textColor="@color/aquablue"
                android:textSize="15dp"
                android:textStyle="bold" />

            <include layout="@layout/listview_item_row_now_playing_info" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textColor="@color/aquablue"
                android:textSize="15dp"
                android:textStyle="bold" />

            <include layout="@layout/container_listview" />
        </LinearLayout>

        <LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/vf_sdfsdfadf"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:background="@null"
            android:cacheColorHint="@android:color/transparent"
            android:orientation="vertical" >

            <include layout="@layout/header_vf_asdfasdfadadafsd" />
        </LinearLayout>

        <LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/vf_adsfasdfadsfasd"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:background="@null"
            android:cacheColorHint="@android:color/transparent"
            android:orientation="vertical" >
        </LinearLayout>

    </ViewFlipper>

</LinearLayout>

code:
 public class BeatSpotPrototypeActivity extends BaseListActivity {
        private final String TAG = BeatSpotPrototypeActivity.class.getSimpleName();
        private ApplicationStateManager mAppStateMananger = ApplicationStateManager.GetInstance();
        private Context mCtx = null;
        private boolean mIsInitalized = false;
        private boolean mDataChanded= false;
        private ViewFlipper mViewFlipper= null;
        private DrawableManager mDrawManager = new DrawableManager();
        private enum ViewFlipperModes {
            MAIN (0),
            NOW_PLAYING (1),
            SONG_INFORMATION (2);

            private final int index;

            ViewFlipperModes(int index) {
                this.index = index;
            }

            public int index() {
                return index;
            }
        }
        </code>
    <code>
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main_beatspot_activity);

            if (!mIsInitalized)
                init();
            else
                mDataChanded = true;
            showLoading(false);

        }

        private void init() {
            mCtx                                            = this;
            mIsInitalized                                   = true;
            mViewFlipper                                    = (ViewFlipper)findViewById(R.id.viewFlipper);
            fadeDrawables();
        }

        public void gotoBeatspotMain(View v) {
            mViewFlipper.setDisplayedChild(ViewFlipperModes.MAIN.index());
        }

        public void gotoNowPlaying(View v) {
            Log.d(TAG, mViewFlipper.getCurrentView().toString());
            mViewFlipper.setDisplayedChild(ViewFlipperModes.NOW_PLAYING.index());
        }

        public void gotoSongDetails(View v) {
            mViewFlipper.setDisplayedChild(ViewFlipperModes.SONG_INFORMATION.index());
            Log.d(TAG, String.valueOf(ViewFlipperModes.SONG_INFORMATION.index()));
        }

    }

A: setDisplayedChild takes an index, not an id.

A: before on create
ViewFlipper mViewFlipper = (ViewFlipper)findViewbyId(location);

on your onCreate() or onStart

Ensure that whatever your layout on setcontentView(R.layout.something)
  does contain the view flipper

Also try this for me. before this line mViewFlipper.setDisplayedChild(ViewFlipperModes.MAIN.index());
Type in:
int i = (ViewFlipperModes.MAIN.index()); place a debug point here
mViewFlipper.setDisplayedChild(i);

I also suggest using the debugger to try figure out if your flip views events are being called inside the debugger.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/book_as_whole_Layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="#FFFFFF">

    <ViewFlipper
            android:layout_marginTop="20dip"
            android:layout_marginLeft="20dip"
            android:layout_marginRight="20dip"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/ViewFlipper">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

        <TextView
            android:id="@+id/page1"
            android:text="@string/loading_string"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:textColor="#000000"
            android:typeface="serif"/>

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">
        <TextView
            android:id="@+id/page2"
            android:text="@string/loading_string"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:textColor="#000000"
            android:typeface="serif" />
        </LinearLayout>

    </ViewFlipper>

</LinearLayout>


text:
Q: A long, obscure word with the meaning "abstruse, erudite, (of a text) difficult" I have forgotten a particular word. It's very rare, but not so rare that it doesn't appear in online dictionaries—for instance, it appeared in Google Search's dedicated dictionary widget with its definition when I searched it. It's not a nonce word.
I recall that it was remarkably long and was composed of lots of Latin affixes (e.g ex-), and so on (think polyphiloprogenitive). It meant "abstruse, erudite, (of a text) difficult, etc."; in short, it described the kind of text in which it might appear. It is not the word sesquipedalian.
I am at my wit's end looking for this evasive word, which has eluded me for about a month of on-and-off casual detective work. Any help would be appreciated! The main thing that struck me about the word was its length. It was an adjective. It might be used as:

The philosopher's essay was a ____ meditation on the concept of being.

A: If it isn't sesquipedalian...
maybe it's hippopotomonstrosesquipedalian.
definition: pertaining to long words.
https://www.wordsense.eu/hippopotomonstrosesquipedalian/

A: A long, obscure adjective with a similar meaning; and modelled on a Latin lexical item is imperspicuous. OED provides the etymology and the definition as below:

Etymology: < im- prefix2 + perspicuous adj., after classical Latin imperspicuus not clear, obscure.
Not clearly expressed or easily understood; obscure, opaque; (of a speaker or writer) unclear in style, meaning, or expression.

A: Inenubilable could fit. There is a whole group of words etymologically related to shadow or clouds that mean obscurity and are themselves somewhat obscure. This one had the most syllables out of what I could find.
OED, inenubilable, adj.:

rare
That cannot be cleared of clouds or mist, or (figurative) of obscurity; indistinct; inexplicable


text:
Q: PHP Internals: Where are Arrays Created What code in the php-src repo handles a PHP programmer creating an array?
That is -- as a PHP programmer I might do something like this
$foo = array();
$foo = [];

Behind the scenes, I assume there's some bit of central PHP internals code that's alloc-ing out the zvalue_value and zval structs.  Where is that code?
Bonus -- if this is a dumb question -- why is it a dumb question? (i.e. what mis-assumption about the PHP Internals handling of an array am I missing?)

A: According to this
Zend/zend_hash.c
Zend/zend_hash.h
Have array international code.


text:
Q: Javascript Autocomple with multi coulmn and categorized suggestions Is there any JavaScript autocomplete which can show categorized suggestions in a multicolumn design like the one here http://www.healthgrades.com/. If there is a jquery or YUI plugin that would be better.

A: It would be better to create your own autocomplete, because you know what data you want to show and how to show, you can use table structure or ul-li structure. One more thing is that your back end all things shown depends on your back end what queries you needed to extract data. Your main issues is only design, as I think.

A: Here is a MultiColumn plugin you might use.


text:
Q: Is there a way we can call a java class and execute using google cloud workflows? I am working to encode a file using  base64 encoding. However I have to do it in cloud workflows. I am new to workflows, can someone guide me on how to do.

A: While Workflows can encode small amounts of data such as the arguments to an API, larger processing operations like encoding a full file should be done in a service called from a workflow step. Place your Java code in a Cloud Function or Cloud Run service and call it in a workflow step.


text:
Q: XACML Response is Not Applicable Hi I am experimenting with XACML3 and I have found that the request when matches the Condition I get response as Permit. but when it does not i get not applicable instead of deny. I am not sure if the behavior is correct.
I do understand that I can mask the Not applicable response with deny-unless-permit combining algorithm but I do not understand this behavior.
Below is my Policy
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" PolicyId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIA1:policy"
    RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:deny-overrides"
    Version="1.0">
    <Target>
        <AnyOf>
            <AllOf>
                <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
                    <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">MyApp</AttributeValue>
                    <AttributeDesignator
                        AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"
                        DataType="http://www.w3.org/2001/XMLSchema#string"
                        Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource"
                        MustBePresent="true" />
                </Match>
            </AllOf>
        </AnyOf>
    </Target>
    <Rule Effect="Permit"
        RuleId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIA1:rule">
        <Target />
        <Condition>
            <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-equal">
                <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
                    <AttributeDesignator
                        AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:age"
                        Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject"
                        DataType="http://www.w3.org/2001/XMLSchema#integer" MustBePresent="false" />
                </Apply>
                <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
                    <AttributeDesignator
                        AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:age2"
                        Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject"
                        DataType="http://www.w3.org/2001/XMLSchema#integer" MustBePresent="false" />
                </Apply>

            </Apply>
        </Condition>
    </Rule>
</Policy>

And this is my request for which i get response as not applicable
<?xml version="1.0" encoding="utf-8"?>
<Request  ReturnPolicyIdList="false" CombinedDecision="false" xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Attributes Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject">
    <Attribute IncludeInResult="false" AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:age">
      <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#integer">45</AttributeValue>
    </Attribute>
    <Attribute IncludeInResult="false" AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:age2">
      <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#integer">4</AttributeValue>
    </Attribute>
  </Attributes>
  <Attributes Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource">
    <Attribute IncludeInResult="false" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id">
      <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">MyApp</AttributeValue>
    </Attribute>
  </Attributes>
</Request>

I get response as Permit only when age and age2 match else response is not applicable. Not applicable implies that no matching rules found but the Target does make a successful match with the resource-id string so why the response is not applicable? Any help is appreciated.

A: Getting NotApplicable is a normal response. As a matter of fact, it may well be the most common response.
XACML defines 4 possible decisions in a response:

*

*Permit

*Deny

*NotApplicable

*Indeterminate (which I believe you have seen before. See this post)

When first writing your policies, it is very easy to hit NotApplicable because it essentially means your request does not match the policy. Imagine your policy is about bank accounts and you send a request about health records. You'd get NotApplicable.
There are ways to mask a NotApplicable and force a PDP to return Permit or Deny. One such way is to use either one of the following combining algorithms:

*

*permit-unless-deny

*deny-unless-permit

If your policy contains 3 rules and none of them applies, the policy would normally return NotApplicable. Using one of the 2 previous combining algorithms, you would get Permit or Deny.
Another option is to use another rule as a catch-all that will deny any access that was not previously handled. In that case the parent's combining algorithm needs to be first-applicable. See below.

Targets or conditions?
In XACML there are 2 key elements you can use to define the scope of an authorization policy (in the broad sense):

*

*a Target element: targets can exist in PolicySet, Policy, and Rule. Use them for simple match logic combined with and/or/and e.g. role=="manager" and age>18.

*a Condition element: conditions exist inside Rule elements only. They can be used for more advanced matching and in particular to compare 2 attributes together e.g. age>ageLimit. You cannot do the latter in a Target.

For a rule to be applicable, both the Target and the Condition (if any) must evaluate to true.


text:
Q: ¿Cómo mando un valor de una función de Javascript a otra con un valor de password? Aquí convierto un input en forma de password con un checkbox para mostrar y ocultar
function showPassword() {
    var x = document.getElementById("valor");
    if (x.type === "password") {
        x.type = "text";
    } else {
        x.type = "password";
    }
}

Al pasarlo en una tabla se pone en texto plano en vez de ponerlo como contraseña.
$(document).ready(function(){
    $(".add-row").click(function(){
        var param = $("#param").val();
        var valor = $("#valor").val();
        var markup = "
<input type='button' class='delete-row button green' value='Eliminar' name='record'>	<input type='button' class='delete-row button blue' value='Editar' name='record'>	" + param + "	" + valor + "
";
        $("table tbody").append(markup);
        $('input[type="text"]').val('');
    });

    $(".delete-row").live("click", function () {
        $(this).parents("tr").remove();

    });
});

Como puedo hacer para que el valor se mande como password y se imprima como tal en vez de texto plano?


text:
Q: Onclick doen't work in the fragments of viewpager2 I have a viewpager2 with a tablayout with two tabs. In the fragment of each tab a have a button, but the onclick listener never is called when I click on it. I don't know where is the problem...
Fragment where I instance the viewpager2:
        ...
    @BindView(R.id.tab_viewpager2_bookings)
    lateinit var tabLayout: TabLayout

    @BindView(R.id.viewpager2_booking)
    lateinit var viewPager: ViewPager2

    ...

    val tabs = arrayOf(getString(R.string.bookings_on_going), getString(R.string.bookings_upcoming))
        tabLayout.tabGravity = TabLayout.GRAVITY_FILL
        val adapter: FragmentStateAdapter = BookingsPagerAdapter(requireActivity(), tabs, ticketsOnGoing, ticketUpcoming, _user!!, bearerToken)
        viewPager.adapter = adapter

        if (ticketsOnGoing.isEmpty() && ticketUpcoming.isNotEmpty()) {
            viewPager.currentItem = 1
        }
        TabLayoutMediator(tabLayout, viewPager) { tab, position ->
            tab.text = tabs[position]
        }.attach()

The XML with the viewpager2:
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:animateLayoutChanges="true"
        android:orientation="vertical">

        <com.google.android.material.tabs.TabLayout
            android:id="@+id/tab_viewpager2_bookings"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="15dp"
            android:layout_marginTop="10dp"
            android:layout_marginEnd="15dp"
            android:visibility="visible"
            app:tabIndicatorColor="@color/tabs_indicator_boardingpass"
            app:tabTextColor="@color/tabs_indicator_boardingpass"></com.google.android.material.tabs.TabLayout>

        <androidx.viewpager2.widget.ViewPager2
            android:id="@+id/viewpager2_booking"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@id/tab_viewpager2_bookings" />
             ...

The adapter:
        class BookingsPagerAdapter(fa: FragmentActivity, private val tabs:Array<String>, private val
    ticketsOnGoing: List<TicketModel>, private val ticketUpcoming: List<TicketModel>,
                           private val user: UserModel, private val bearerToken: String) : FragmentStateAdapter(fa) {
    override fun getItemCount(): Int {
        return tabs.size
    }

    override fun createFragment(position: Int): Fragment {
        when(position){
            0 -> return BookingsTabFragment(ticketsOnGoing, position, user, bearerToken)
            1 -> return BookingsTabFragment(ticketUpcoming, position, user, bearerToken)
        }
        return BookingsTabFragment(ticketsOnGoing,0, user, bearerToken)
    }
    }

The tab fragment:
        class BookingsTabFragment(private val bookingsList: List<TicketModel>, val position: Int, val user: UserModel, private val bearerToken: String) : BaseFragment() {

    lateinit var buttonTest : Button

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        val v: View = inflater.inflate(R.layout.fragment_tab_bookings, container, false)

   if (bookingList.isEmpty()) {
       llMessageBookingsFragment.visibility = View.GONE
       rv_bookings_list.visibility = View.VISIBLE
       buttonTest = v.findViewById<Button>(R.id.button_test)

            buttonTest.setOnClickListener(View.OnClickListener {
                Toast.makeText(context, "Prueba", Toast.LENGTH_SHORT).show()
                //IT NEVER ENTER HERE!!
            })
   } else {
      llMessageBookingsFragment.visibility = View.VISIBLE
      rv_bookings_list.visibility = View.GONE
       ...

The XML of tab fragment:
        <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:id="@+id/ll_message_bookings_fragment"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:gravity="center"
        android:paddingLeft="40dp"
        android:paddingRight="40dp"
        android:orientation="vertical"
        tools:visibility="gone"
        android:clickable="true">
        <Button
            android:id="@+id/button_test"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Prueba"/>
        ...
   </LinearLayout>
   <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/rv_bookings_list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingTop="30dp"
        android:paddingBottom="30dp"
        android:clipToPadding="false"
        tools:listitem="@layout/row_bookings"
        tools:visibility="visible"/>

Thanks!

A: I found the problem. In the tab fragment, I use RelativeLayout. The order of the components is very important for this issue, so I put the recycler view before the layout with the button.
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.recyclerview.widget.RecyclerView
    android:id="@+id/rv_bookings_list"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingTop="30dp"
    android:paddingBottom="30dp"
    android:clipToPadding="false"
    tools:listitem="@layout/row_bookings"
    tools:visibility="visible"/>
<LinearLayout
    android:id="@+id/ll_message_bookings_fragment"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:gravity="center"
    android:paddingLeft="40dp"
    android:paddingRight="40dp"
    android:orientation="vertical"
    tools:visibility="gone"
    android:clickable="true">
    <Button
        android:id="@+id/button_test"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Prueba"/>
    ...


text:
Q: Mac App store apps use a different user ID so I can't install updates The OSX Mavericks machine that I use for work has Keynote, Pages, and Numbers installed under the company's Apple ID. (It was purchased in December 2012, pre-Mavericks. It was recently wiped and replaced with an image that I'm guessing already had iWork installed.)
Every day the App store bugs me about installing updates. When I try to do so, I'm prompted for the password, which I don't have. And it won't let me sign in under my personal Apple ID.

Is there a way for the helpdesk to transfer these apps to my personal account? Or any other way for me to get the updates aside from opening a helpdesk ticket and waiting patiently?

A: You have to re-buy it with your own account. I don't think there is any way to transfer purchases.


text:
Q: Unknown Reason For Error 'Undefined Index' I have defined the index yet I still receive the error message 'undefined index email'
Here is my code:
<?php
if (isset($_POST['submit']))
{
$email = $_POST['email'];
}
$securityq = mysqli_query ($db, "SELECT securityq FROM admin WHERE email = '$_POST[email]'");
?>

Can anyone see the problem here?
Notice: Undefined index: email in C:\xampp\htdocs\Intranet\passwordreset.php on line 28

A: The sql in your original code relied upon the submission of the form - if there was no POST there was no variable to use in the sql.
$email = isset( $_POST['submit'] ) && isset( $_POST['email'] ) ? $_POST['email'] : false;
if( $email ) {
    $sql="SELECT `securityq` FROM `admin` WHERE `email` = '{$email}';";
    $securityq = mysqli_query( $db, $sql );
}

A: Use the code like this.
<?php
    if (isset($_POST['submit'])){
     $email = (isset($_POST['email'])) ? $_POST['email'] : '';
    }
    $securityq = mysqli_query($db, "SELECT securityq FROM admin WHERE email = '{$email}'");
    ?>


text:
Q: TCPDF - use proportional numbers in output In my PDF I'm trying to output numbers. No problem with that.
The font I'm using is Vollkorn.
The numbers displayed although aren't what I'm looking for.
They look like this:

Using the font in Adobe Illustrator, when I switch the font to uppercase, a new variant of numbers is shown:

I would like the use the second set in my PDF output.
Opening the font in FontForge I can see those glyphs but none of them has an Unicode value assigned to it.
Is there some way to use theese number characters in TCPDF? My text is outputed via MultiCell();


text:
Q: GWT CellTable within TabLayoutPanel: no line wrap of data I want to display several CellTables within a TabLayoutPanel. Each tab has a single wrapped CellTable as it's widget.
My problem is: if I have a table which has many columns, in my case 12, the content flows to the right of the panel, means that some content is not visible. This is not the case if I display the table without a TabLayoutPanel; in that case, there are automatic line breaks so that all columns fit on the screen.
Screenshots:

I do not want to specify absolute widths, neither for the table nor for the columns as I want the table to use 100% of the available screen width.


text:
Q: SNX network extender with multi factor auth checkpoint VPN Hi I have the snx network extender by checkpoint vpn and I want to connect to my office ntwork.
Once I type snx -s "my vpn" -u "user" it asks my password.
My office VPN is set to insert an additional OTP recevide on my mobil phone, but once I confirm the password on the terminal the client gives me "access failed" and at the same time I recive the OTP.
Do you know if there is any additional option to configure when launching the command snx?
Thanks.
`


text:
Q: 'Being' a gerund 'being' a participle I really get confused about when being used as a gerund and when is it used as a participle?

*

*I being angry is not a good thing.

*My being angry is not a good thing.

*Me being angry is not a good thing.

This is what I think:
In (1) being acts as a participle.
In (2) being acts as a noun.
In (3) being acts as a participle.
I was reading this:
https://english.stackexchange.com/questions/2625/when-is-a-gerund-supposed-to-be-preceded-by-a-possessive-adjective-determiner
Like nohat said in that question we can't use nominative (I) as the subject of a gerund in a gerund clause and can't use genitive (my) in participle clause.
All three look fine to me. Please explain which one is correct and why.

A:
*[1] I being angry is not a good thing.
[2] My being angry is not a good thing.
[3] Me being angry is not a good thing.

No: "being" is a 'gerund-participle' verb in all three examples, but 1. is ungrammatical. Gerund-participial clauses in subject function take either genitive or accusative case pronouns, the only difference being that the genitive case is more formal.
It's tempting to call "being" in [2] a noun since the characteristic use of the genitive case is to mark the dependent of a noun, not a verb. Nevertheless, that "being" is a verb is evident from the possibility of it being modified by an adverb (but not an adjective), as in "my constantly being angry", and adverbs do not (normally) modify nouns.
Note that traditional grammar recognises gerunds and present participles as separate forms in the verb paradigm, but modern grammar simply combines both ing forms, calling the verbs 'gerund-participles', and the clauses they head 'gerund-participials'

A: Being angry is not a good thing. [being angry = gerund clause and the subject of the sentence].
To apply this to yourself, use my or me, not I. See the explanation below.

*

*My being angry is not a good thing. [same thing, except it refers to you; formal]

*Me being angry is not a good thing. [same thing, refers to you, informal]
Use possessive adjectives for formal constructions, use possessive pronouns for informal ones.
My, your, his/her/its their, our, your = formal
Me, you, he/she/it them, us, you = Informal
DIFFERENCE (another example):

*

*Their being late was not a problem. [formal]

*Them being late was not a problem [informal]

Being is a noun (gerund) in all those cases. It is not a participle, except in form but not in function.

*

*Being rich is great!

*My being late is not likely. [formal]

*Me being silly is very possible. [informal]

*Being a clueless downvoter is not a good thing.

*Being human is complicated.

*Playing is a good thing.

*Your playing at the concert is not a good idea.
Please note: any verb in English, just about, can be made into a noun gerund.


text:
Q: Best piecewise constant estimator in density estimation Assume that $X_1,\dots,X_n$ are i.i.d. random variables in $[0;1)$ and whose probability distribution has density $f_0$ that we would like to recover.
One well-known estimator is the histogram estimator, for instance on a regular grid of step $p^{-1}$:
$$\hat{f}(x)=\frac{p}{n}\sum_{i=0}^{p-1}1_{x\in[ip^{-1};(i+1)p^{-1})}\ \#\Big\{1\leq j\leq n \,\Big|\,X_j\in[ip^{-1};(i+1)p^{-1})\Big\}$$
It is then a piecewise constant estimator whose values are determined by the empirical frequency in each bin.
Now, does there exist some other piecewise constant estimator on the same partition  that could be better in some sense (having a better MISE or MSE for instant), particularly in the asymptotic setting.
If the partition introduced above is $\left(I_1,\dots,I_p\right)$, the estimator $\hat{f}$ is equivalent to an estimator of the vector of probabilities $\left(P(I_1),\dots,P(I_p)\right)$. If we want to estimate $P(I)$, for $I$ a measurable subset of $[0;1)$, from the observations $1_{X_i\in I}$, we can show that the empirical frequency attains the Cramer-Rao bound, (it's like estimating the parameter of a Bernoulli distribution). So, if we are interested in the MISE of our estimator, it makes sense to use $\hat{f}$. However, in the original problem, we also now where the $X_i$ lie exactly in $[0;1)$. So, we could think of using this knowledge to build a piecewise constant estimator.
Why is it maybe not sensible and why is $\hat{f}$ the only piecewise constant estimator that seems to be studied?


text:
Q: Proxy outgoing traffic of Kubernetes cluster through a static IP I am trying to build a service that needs to be connected to a socket over the internet without downtime. The service will be reading and publishing info to a message queue, messages should be published only once and in the order received.
For this reason I thought of deploying it into Kubernetes where I can automatically have multiple replicas in case one process fails, i.e. just one process (pod) should be running all time, not multiple pods publishing the same messages to the queue.
These requests need to be routed through a proxy with a static IP, otherwise I cannot connect to the socket. I understand this may not be a standard use case as a reverse proxy as it is normally use with load balancers such as Nginx.
How is it possible to build this kind of forward proxy in Kubernetes?
I will be deploying this on Google Container Engine.

A: Is the LoadBalancer that you need?
kubernetes create external loadbalancer,you can see this doc.

A: Assuming you're happy to use Terraform, you can use this:
https://github.com/GoogleCloudPlatform/terraform-google-nat-gateway
However, there's one caveat and that is it may inbound traffic to other clusters in that same region/zone.


text:
Q: Spring boot POST request getting NullPointerException I've got a problem with @PostMapping annotation in Spring boot. I deployed application and postgresql database to docker and I'm using docker-compose up to run it. However when I try to send with postman I get error 500. I tried printing data to console and it seems I get data but the id column is null. It has annotation @GeneratedValue so it should be like that?
name:vardas

Price [appliesFrom=2020, id=null, name=vardas, price=14.0]
     Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause
    java.lang.NullPointerException: null

This is my model file:
package lt.kvk.i15.rupeika_laimonas.models;

import java.sql.Date;

import javax.persistence.*;

import com.fasterxml.jackson.annotation.JsonProperty;

@Entity
@Table(name = "prices")
public class Prices {

    @Id @GeneratedValue private Long id;

    @Column(name="name")
    private String name;

    @Column(name="price")
    private double price;

    @Column(name="applies_from")
    private String appliesFrom;

    public Prices(){}

    public Prices(String name, double price, String appliesFrom) {
        this.name = name;
        this.price = price;
        this.appliesFrom = appliesFrom;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public String getAppliesFrom() {
        return appliesFrom;
    }

    public void setAppliesFrom(String appliesFrom) {
        this.appliesFrom = appliesFrom;
    }

    @Override
    public String toString() {
        return "Price [appliesFrom=" + appliesFrom + ", id=" + id + ", name=" + name + ", price=" + price + "]";
    }

}

PriceService.java
package lt.kvk.i15.rupeika_laimonas.services;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;

import lt.kvk.i15.rupeika_laimonas.models.Prices;
import lt.kvk.i15.rupeika_laimonas.repository.PricesRepository;

@Service
public class PriceService {

    private PricesRepository pricesRepository;

    public void saveData(@RequestBody Prices price)
    {
        System.out.println(price.toString());
        getPricesRepository().save(price);
    }

    public void saveAllData(List<Prices> pricesList)
    {
        getPricesRepository().saveAll(pricesList);
    }

    public List<Prices> showData()
    {
        return getPricesRepository().findAll();
    }

    public PricesRepository getPricesRepository() {
        return this.pricesRepository;
    }
}

PricesController.java
package lt.kvk.i15.rupeika_laimonas.controllers;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import lt.kvk.i15.rupeika_laimonas.models.Prices;
import lt.kvk.i15.rupeika_laimonas.services.PriceService;

@CrossOrigin(origins="http://localhost:3000")
@RestController
public class PriceController {

    private final PriceService priceService;

    @Autowired
    public PriceController(PriceService priceService)
    {
        this.priceService = priceService;
    }

    @RequestMapping("api/prices")
    public List<Prices> getPrices() throws FileNotFoundException, IOException
    {
        return priceService.showData();
    }

    @PostMapping("api/setoneprice")
    public ResponseEntity<Prices> setOnePrice(@RequestBody Prices price)
    {
        System.out.println("name:" + price.getName());
        priceService.saveData(price);
        return new ResponseEntity<>(price,HttpStatus.CREATED);
    }

}

PricesRepository.java
package lt.kvk.i15.rupeika_laimonas.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import lt.kvk.i15.rupeika_laimonas.models.Prices;

@Repository
public interface PricesRepository extends JpaRepository<Prices, Long> {

    @Override
    List<Prices> findAll();
}

I'm adding all my classes to not miss anything. What could be the problem? My saving is done in saveData() method.
Edit:
Adding full error stack trace:
2021-12-09 21:04:57.865 ERROR 1 --- [nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause

java.lang.NullPointerException: null

at lt.kvk.i15.rupeika_laimonas.services.PriceService.saveData(PriceService.java:125) ~[classes!/:0.0.1-SNAPSHOT]

at lt.kvk.i15.rupeika_laimonas.controllers.PriceController.setOnePrice(PriceController.java:68) ~[classes!/:0.0.1-SNAPSHOT]

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]

at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]

at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-5.3.10.jar!/:5.3.10]

at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150) ~[spring-web-5.3.10.jar!/:5.3.10]

at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) ~[spring-webmvc-5.3.10.jar!/:5.3.10]

at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) ~[spring-webmvc-5.3.10.jar!/:5.3.10]

at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.10.jar!/:5.3.10]

at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.10.jar!/:5.3.10]

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067) ~[spring-webmvc-5.3.10.jar!/:5.3.10]

at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963) ~[spring-webmvc-5.3.10.jar!/:5.3.10]

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.10.jar!/:5.3.10]

at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) ~[spring-webmvc-5.3.10.jar!/:5.3.10]

at javax.servlet.http.HttpServlet.service(HttpServlet.java:681) ~[tomcat-embed-core-9.0.53.jar!/:na]

at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.10.jar!/:5.3.10]

at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) ~[tomcat-embed-core-9.0.53.jar!/:na]

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.53.jar!/:na]

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.53.jar!/:na]

at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.53.jar!/:na]

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.53.jar!/:na]

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.53.jar!/:na]

at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.10.jar!/:5.3.10]

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.10.jar!/:5.3.10]

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.53.jar!/:na]

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.53.jar!/:na]

at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.10.jar!/:5.3.10]

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.10.jar!/:5.3.10]

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.53.jar!/:na]

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.53.jar!/:na]

at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.10.jar!/:5.3.10]

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.10.jar!/:5.3.10]

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.53.jar!/:na]

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.53.jar!/:na]

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) ~[tomcat-embed-core-9.0.53.jar!/:na]

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[tomcat-embed-core-9.0.53.jar!/:na]

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540) ~[tomcat-embed-core-9.0.53.jar!/:na]

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) ~[tomcat-embed-core-9.0.53.jar!/:na]

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.53.jar!/:na]

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[tomcat-embed-core-9.0.53.jar!/:na]

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) ~[tomcat-embed-core-9.0.53.jar!/:na]

at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382) ~[tomcat-embed-core-9.0.53.jar!/:na]

at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.53.jar!/:na]

at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893) ~[tomcat-embed-core-9.0.53.jar!/:na]

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1726) ~[tomcat-embed-core-9.0.53.jar!/:na]

at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.53.jar!/:na]

at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-9.0.53.jar!/:na]

at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-9.0.53.jar!/:na]

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.53.jar!/:na]

at java.base/java.lang.Thread.run(Thread.java:829) ~[na:na]

A: Your problem was not autowiring the repository, because of that, the dependency was not resolved.
No need for the other things you have done. And please, remove you @RequestBody annotation from your service's method saveData() since this is a service and it has nothing to do with HTTP.
Another important thing is that you should be able to debug your application locally, there is no need of using docker for testing it. If it works without docker, then you start creating your dockerfile and dealing with docker. Problems one by one.

A: I believe your line "System.out.println(price.toString());" throwing null pointer exception  .
You trace lines does not match with your code , try to debug the code .

A: So I actually found the problem. I modified my model class from:
@Id @GeneratedValue private Long id;

@Column(name="name")
private String name;

@Column(name="price")
private double price;

@Column(name="applies_from")
private String appliesFrom;

public Prices(){}

public Prices(String name, double price, String appliesFrom) {
    this.name = name;
    this.price = price;
    this.appliesFrom = appliesFrom;
}

to this:
@Id @GeneratedValue private Long id;
private String name;
private double price;
private String appliesFrom;

public Prices(){}

public Prices(
@JsonProperty("name")String name,
@JsonProperty("price")double price,
@JsonProperty("appliesFrom")String appliesFrom) {
    this.name = name;
    this.price = price;
    this.appliesFrom = appliesFrom;
}

and my services class also. I directly @Autowired pricesRepository
private PricesRepository pricesRepository;

changed to:
@Autowired
private PricesRepository pricesRepository;

My guess is when I used Postman to send json data it couldn't see it. Hope it helps someone who's having same problem. Thanks for help guys


text:
Q: How to search WITHIN subfolders in Thunar File Manager? I have GalliumOS, it's basically a Xubuntu for Chromebooks.
So, when I installed Firefox, the icon turned to a dumb theme. So I read oneline that the icon is located in /usr/share/icons, great!
But when I go there, I'm met with TONS of folders, and don't know which one has Firefox for the icon. When I type in the search, nothing, it only searches for the folder names but not INSIDE every folder in the current folder I'm in.
I go to Google this for help, but nothing relevant comes up. Is there anyway I can search inside the other sub-folders from the one I'm currently in? Sorta like Windows?

A: Thunar itself does not implement a recursive search.
E.g. catfish can be used for that ... you may want to add a Thunar custom action for using catfish.
Name: Search files inside…
Command: catfish %f
File pattern: *

Check as well the section "custom actions" in the thunar Wiki


text:
Q: Best practice for storing HTML in mysql DB I'm working on a mini blog which allows users to add a post using a WYSIWYG editor to the site therefore I will be storing this post in my DB .
Having researched markdown I have come to the conclusion that it is not fit for purpose since I require local video uploaded which is why I am now planning on storing the HTML from the WYSIWYG editor into my DB.
I however do have some concerns regarding SQL injection and XSS attacks however I have researched a solution which is HTML purifier.
If I use HTML purifier to remove unwanted HTML tags is this then a safe solution to store the HTML in my DB?

A: Storing HTML in the database is not intrinsically unsafe, any more than storing plain text is intrinsically unsafe.  The risk of SQL injection is trivially mitigated by using prepared statements and proper placeholders.  Escaping is neither necessary nor is it best practice for preventing SQL injection. Prepared statements are.
Conversely, XSS and other HTML-related vunerabilities have nothing to do with the database and everything to do with rendering HTML to viewers from untrusted sources.  The same vulnerabilities would be there if the HTML were simply stored in files, with no database at all, so there is no need to protect the database from malicious HTML.  The database has no knowledge of or vulnerability to what's contained in stored HTML content, because it doesn't render or interpret the HTML... again, as long as your database interactions use prepared statements.  There are no acceptable justifications for avoiding those.
To exaggerate the point to an extreme, it would be perfectly safe to store files containing viruses as blobs in a database, because the database does not execute the data stored in it, as code.  The vulnerability would be to the users downloading those viruses.

A: You can store html in sql... but escape them first.
See the example here...
http://php.net/manual/en/function.html-entity-decode.php

A: you can save html content in mysql field as "blob", before send de html content in the back you must use something function like base64_encode in PHP for example and then, you can get that content using base64_decode


text:
Q: How do I close (not kill) an application which has minimized to the system tray? I'm writing an app that closes a program, changes its data file then reopens it. I've noticed that if I use process.Kill() there is some data not written to the file.
If I use process.CloseMainWindow(), the main window closes but the process minimises to the start tray.
Is there some way I can send a graceful close message to the process?
If it's important, it's Grindstone that I'm trying to close.

A: Unfortunately, there's not much you can do to gracefully terminate an application that is not cooperating.
The suggested approach is to send the WM_CLOSE message to the window(s) of interest; this won't work here since the app chooses to hide itself as you describe. However, this is the only approach that Microsoft endorses.
The next step is to be a bit more heavy-handed and send the WM_QUIT message to a thread. This is a bit problematic because you have to find the thread in question using some form of process/thread enumeration and PInvoke PostThreadMessage to post WM_QUIT. However, MSDN seems to suggest that you should not do this (search for WM_QUIT). As a practical matter, it should work though.
If that doesn't work as well then Process.Kill is all you 're left with.
Update: The above is my own understanding, but there's also a Microsoft KB article on this same subject. It works with Win32 (not managed code), but the ideas can be adapted without much trouble.

A: The EventWaitHandle object in a BackgroundWorker solution provided here worked pretty good for me, and I think it's easier to code than using win API messages.
Basically you got a backgroundworker thread waiting for certain named event to happen with the myEventWaitHandle.WaitOne method.
Another application just creates the same named event and call myEventWaitHandle.Set() to trigger it. This cause the WaitOne() method in the background-worker to continue and therefore the RunWorkerCompleted to be triggered. At that point you can safely close your application.
Your main application:
private void evtBgWorker_DoWork(object sender, DoWorkEventArgs e) {
   string evtName = "MyExitRequest" + Process.GetCurrentProcess().Id.ToString();
   EventWaitHandle evt = new EventWaitHandle(false, EventResetMode.ManualReset, evtName);
   evt.WaitOne(); // the worker stops here until the event is triggered
 }

private void evtBgWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
  this.Close();
}

Your "graceful killer" application:
private void CloseMainApp()
{
   Process[] processes = Process.GetProcessesByName("MyProcessName");
   Process myprocess= null;
   if (processes.Length > 0)
   {
      myprocess = processes[0];
      string evtName = "MyExitRequest" + myprocess.Id; // the same event name
      EventWaitHandle evt = new EventWaitHandle(false, EventResetMode.ManualReset, evtName);
      evt.Set(); // triggers the event at the main app

      if (!myprocess.WaitForExit(10000)) // waits until the process ends gracefuly
      {
         // if don't...
         myprocess.Kill();
      }
   }
}

A: You need to send a WM_CLOSE message to the application's main window. Presumably, this is what CloseMainWindow abstracts for you. That will work fine every time.
Unfortunately, it sounds like the app in question handles the WM_CLOSE message by minimizing itself to the taskbar's notification area. In that case, it would do the same thing if you tried to exit the app any other way, including File -> Exit or clicking the "X" button in the title bar.
Applications that are extremely self-important often do this. It's wrong, and strongly discouraged, and there's even a right way of implementing it, but none of those things have ever stopped people before.
Therefore, the only way to actually get the program to close is going to be to check the documentation for the application in question and see how to close it, rather than minimize it. I'm betting there's an option in one of the preferences dialogs that controls this. Make sure you've set that option accordingly.
Definitely shy away from any suggestions involving sending the thread a WM_QUIT message, or killing the entire process. This is not the recommended approach, and can cause a number of problems, as you point out in the question. You need to figure out a way of getting the app to close itself nicely. Everything else falls squarely into the category of "killing", exactly what you wish to avoid.

A: For my application I was trying to shutdown a Python process and its spawned processes opened using "subprocess.Popen".  I tried TerminateProcess and it is too evil. :)  I finally determined that I can use the console command taskkill.  I did this in a C++ program:
    // standard kill process call
    void stopProcess(DWORD pid)
    {
        STARTUPINFO startupInfo;
        LPPROCESS_INFORMATION processInfo = new PROCESS_INFORMATION;

        // clear the memory to prevent garbage
        ZeroMemory(&startupInfo, sizeof(startupInfo));

        // set size of structure (not using Ex version)
        startupInfo.cb = sizeof(STARTUPINFO);
        // tell the application that we are setting the window display
        // information within this structure
        startupInfo.dwFlags = STARTF_USESHOWWINDOW;
        // hide process
        startupInfo.wShowWindow = SW_HIDE;

        //TerminateProcess(itr->second->hProcess, 0);  // not friendly to process, and does not kill child processes
        std::stringstream comStream;
        comStream << "taskkill /pid ";
        comStream << pid;
        //comStream << " /t /f";  // to be more like TerminateProcess
        _MESSAGE("%s", comStream.str().c_str());
        //system(comStream.str().c_str()); // works, but pops up a window momentarilly when called

        //LPSTR s = const_cast<char *>(comStream.str().c_str());
        LPSTR cString = strdup( comStream.str().c_str() );
        if(!CreateProcess(NULL,cString,NULL,NULL,false,NORMAL_PRIORITY_CLASS,NULL,NULL,&startupInfo,processInfo)){
            _MESSAGE("Could not launch '%s'",cString);
            SAFE_DELETE(processInfo);
        }else{
            // clean up
            CloseHandle(processInfo);
            SAFE_DELETE(processInfo);
        }
        // clean up
        free(cString);
    }

You will see my other experiments commented out.  I finally settled on this method because it hides any popup window that might appear.  I also found that this allows the Python app to call atexit properly.  However, even without my explicit ending of the subprocesses they shutdown anyway using the taskkill method.  I am guessing this is due to the way the Python code is designed.
So, you can try the above method, wait for the process to close, and if it fails then you can switch to the big guns using TerminateProcess if it just will not cooperate.  Taskkill also has modes for killing unrelentingly if needed too.


text:
Q: Do measurable "sparsenings" of the Interval exist? I'm a little unsure about terminology, but I am looking at a subset $I_a$ of $[0,1]$ that satisfies the following properties ($0≤a≤1$):

*

*$I_a$ is measurable and has measure $a$.

*$I_a$ is dense in $[0,1]$.

*For any sub-interval $[b,c]\subset[0,1]$ the measure of $I_a \cap [b,c]$ is $a\, (c-b)$.

The difficult condition is 3. Basically the idea is to have a set where $1-a$ of the measure is thrown away in a homogenous way, sparsening the interval so to speak.

A: First of all 1) and 2) are consequences of 3), and secondly a set like $I_a$ doesn't exists.
Suppose $I_a$ exists and is measurable for an $0<a<1$. By the properties of lebesgue measure for every $\varepsilon>0$ there existe a (countable) covering of $I_a$ by open intervals : $ I_a\subset \bigcup_{i=0}^\infty P_i $ such that $\sum_{i=0}^\infty \lambda( P_i)<\lambda(I_a)+\varepsilon$. Now, by the properties of $I_a$, we must have $\lambda(I_a\cap P_i)=a\lambda(P_i)$ for all $i$, and thus
$$\lambda(I_a\cap \bigcup_{i=0}^\infty P_i)=\lambda(\bigcup_{i=0}^\infty (P_i\cap I_a))\leq \sum_{i=0}^\infty \lambda(P_i \cap I_a)\leq \sum_{i=0}^\infty a\lambda(P_i)\leq a(\lambda(I_a)+\varepsilon)\leq a(a+\varepsilon)$$
But $\bigcup_{i=0}^\infty P_i$ is a covering of $I_a$ so $\lambda(I_a\cap \bigcup_{i=0}^\infty P_i)=\lambda(I_a)=a$, combining these we have $a\leq a^2+a\varepsilon $, but since $0<a<1$ for $\varepsilon$ sufficiently small we obtain $a^2+a\varepsilon<a$, contradiction.
However sets like $I_0$ and $I_1$ can be found easily.
So where is the error in Jonas response ? Well i'm pretty convinced that his set has either null or full measure.


text:
Q: Unrecognized attribute 'sameSite'. Note that attribute names are case-sensitive for Chrome version 80+ I have a application runnig where the contents open in iframe which is treated as cross-site scenarios.
I'm aware of the latest chrome 80+ version update where all the cookies are set to SameSite=Lax by default. My application was working fine with older version of chrome and with below tag added in my web.config file
<httpCookies requireSSL="true" sameSite="None"/>

Now with this tag added, I get error "Unrecognized attribute 'sameSite'. Note that attribute names are case-sensitive".
Without the tag, my application loads but I'm not able to browse through contents since it opens in iframe.
As per the blog here , asks me to add SameSite=None; Secure tag , but adding tag itself errors out. Am I missing out anything ?
As a work-around I have disabled SameSite by default cookies from flag chrome://flags/#same-site-by-default-cookies and now it seems to work fine.
Is there a way I can achieve this by adding tag in web.config rather than explicitly doing client side changes. Why am I getting unrecognized error for sameSite attribute ?

A: After lot of research found a way to do it from code-behind
HttpCookie Cookie = new HttpCookie("Cookie")
{
   Value = "value to be stored,
   Secure = true,
   HttpOnly = true
};

This adds the cookie to context with http and secure flag as true.
The issue was due to the samesite was by default assigned as "Lax" after the recent chrome update. Since my website was opening in iframe the cookies were not being passed due to cross-site requests. Changing it to none resolved the issue.


text: Q: How do you get a reference to your Scene Delegate (UIWindowSceneDelegate) as you would with your AppDelegate (UIApplicationDelegate)? Prior to iOS 13, when AppDelegate was king, you could do (well you still can) UIApplication.shared.delegate to get a reference to your AppDelegate. But how do you get a reference to your UIWindowSceneDelegate that manages a single window scene in iOS 13? UIWindowScene.shared.delegate doesn't exist, obviously.