Thursday, 26 May 2022

Dynamically change sap.ui.table row binding behaviour

There is requirement to change behaviour of sap.ui.table depending on no. of rows present in backend being binded to table and a threshold value set. So if no. of rows are less than threshold value, then load all rows data and sorting/filtering done in browser i.e operationMode Client.

But if large no. of rows present exceeding threshold value then load with $top/$skip and sorting/filtering should trigger backend call i.e. operationMode Server.

As per documentation operationMode Auto should have worked but it keeps the sorting/filtering always on Server side irrespective of few rows present which are less than threshold value and so not working purely as Client operationMode.

Is there a direct way in XML view binding to change operationMode to Client/Server depending on count condition or operationMode injected conditionally in

<Table rows="{path: 'SampleEntitySet', parameters: {expand: 'Test123',operationMode: 'Server'}, templateShareable: false, events: {change: '.onTableChange'}}">
            

Please help in suggestion to solution. Thanks



from Dynamically change sap.ui.table row binding behaviour

how to use vue-3-socket.io with composition api in vue.js?

how can i access the socket instance inside the setup function in vue.js component

i use vue-3-socket.io

in my main.js


import VueSocketIO from 'vue-3-socket.io'
import SocketIO from 'socket.io-client'

Vue.use(new VueSocketIO({
    debug: true,
    connection: SocketIO('http://metinseylan.com:1992', {}), 
    vuex: {
      store,
      actionPrefix: "SOCKET_",
      mutationPrefix: "SOCKET_"
    }
  })
);



from how to use vue-3-socket.io with composition api in vue.js?

huggingface longformer case sensitive tokenizer

This page shows how to build a longformer based classification.

import pandas as pd
import datasets
from transformers import LongformerTokenizerFast, LongformerForSequenceClassification, Trainer, TrainingArguments, LongformerConfig
import torch.nn as nn
import torch
from torch.utils.data import Dataset, DataLoader
import numpy as np
from sklearn.metrics import accuracy_score, precision_recall_fscore_support
from tqdm import tqdm
import wandb
import os


# load model and tokenizer and define length of the text sequence
model = LongformerForSequenceClassification.from_pretrained('allenai/longformer-base-4096',
                                                           gradient_checkpointing=False,
                                                           attention_window = 512)
tokenizer = LongformerTokenizerFast.from_pretrained('allenai/longformer-base-4096', max_length = 1024)

I noticed that the tokenizer is sensitive to case of the data. words do and Do get different tokens below. I dont need such behavior. I can always lowercase my data before feeding to longformer. But is there is any other better way to tell tokenizer to ignore case of the data?

encoded_input = tokenizer("Do not meddle in the affairs of wizards, for they are subtle and quick to anger.")
print(encoded_input)
{'input_ids': [0, 8275, 45, 31510, 459, 11, 5, 5185, 9, 44859, 6, 13, 51, 32, 12405, 8, 2119, 7, 6378, 4, 2], 'attention_mask': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]}

encoded_input3 = tokenizer("do not meddle in the affairs of wizards, for they are subtle and quick to anger.")
print(encoded_input3)
{'input_ids': [0, 5016, 45, 31510, 459, 11, 5, 5185, 9, 44859, 6, 13, 51, 32, 12405, 8, 2119, 7, 6378, 4, 2], 'attention_mask': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]}


from huggingface longformer case sensitive tokenizer